@sentientui/core 0.27.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- import{a as Y}from"./chunk-WKXD7KI3.mjs";import{a as T,d as z,e as E,f as b,g as G}from"./chunk-Z6ILOYBD.mjs";import{C as H,E as J}from"./chunk-TRBPPGFT.mjs";import"./chunk-2NVSFI4V.mjs";import{a as f,b as V}from"./chunk-TMCGHANO.mjs";import{fnv1a as Q}from"@sentientui/policy";var X="section, header, footer, nav, main > div, [data-sentient-section]",Z=2e4;function ee(d){let r=Array.from(d.querySelectorAll(X)),i=r.filter(a=>r.filter(c=>c!==a&&a.contains(c)).length<2);return i.filter(a=>!i.some(c=>c!==a&&c.contains(a)))}function te(d,r,i,a){try{fetch(`${r}/v1/section-map`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${d}`},body:JSON.stringify({pageUrl:i,sections:a})}).catch(()=>{})}catch(c){}}var h=()=>{};function ne(d,r){var k,x,L,N,D,R,_,F,M,P,$,K;let i=(k=r.doc)!=null?k:typeof document!="undefined"?document:void 0;if(!i||typeof IntersectionObserver=="undefined"||J()||!r.apiKey||!r.apiKey.startsWith("pk_"))return h;let a=((x=r.apiBase)!=null?x:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),c=ee(i);if(c.length===0)return h;let m=new Map,A=[];for(let e of c){let t=e.getAttribute("data-sentient-type"),o=t&&T.includes(t)?t:null,n=b(e),p=(N=o!=null?o:(L=r.typeOf)==null?void 0:L.call(r,e))!=null?N:E(n).type,l=Y(e,i),B=l?`nc-${p}-${Q(JSON.stringify({id:(D=l.id)!=null?D:null,dataAttr:(R=l.dataAttr)!=null?R:null,selector:(_=l.selector)!=null?_:null})).toString(36)}`:`nc-${p}`;m.set(e,B);let j=z.filter(([,S])=>S.test(n.bodyText)).map(([S])=>S);A.push(V(f({componentId:B,semanticType:p,source:o?"markup":"auto"},l?{locator:l}:{}),{observation:f(f({tag:n.tag,idClass:n.idClass.slice(0,200),headingText:n.headingText,textLength:n.textLength,actionCount:n.actionCount},n.ariaRole?{ariaRole:n.ariaRole}:{}),j.length>0?{patternFlags:j}:{})}))}let q=($=(P=(M=(F=i.defaultView)!=null?F:typeof window!="undefined"?window:void 0)==null?void 0:M.location)==null?void 0:P.pathname)!=null?$:"/";te(r.apiKey,a,q,A);let u=new Map,U=e=>{let t=u.get(e);return t||(t={ms:0,scroll:0,enterAt:null,intersecting:!1},u.set(e,t)),t},v=new IntersectionObserver(e=>{for(let t of e){let o=m.get(t.target);if(!o)continue;let n=U(o);t.isIntersecting?(n.intersecting=!0,n.enterAt=Date.now(),t.intersectionRatio>n.scroll&&(n.scroll=t.intersectionRatio)):(n.intersecting=!1,n.enterAt!=null&&(n.ms+=Date.now()-n.enterAt,n.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let e of m.keys())v.observe(e);let g=()=>{let e=Date.now();for(let[t,o]of u)if(o.enterAt!=null&&(o.ms+=e-o.enterAt,o.enterAt=null),!(o.ms<=0)){try{d.track({projectId:r.apiKey,componentId:t,eventType:"dwell",payload:{dwell_time:Math.round(o.ms),scroll_depth:Number(o.scroll.toFixed(2))}})}catch(n){}o.ms=0}},w=()=>{if(i.hidden)g();else{let e=Date.now();for(let t of u.values())t.intersecting&&(t.enterAt=e)}},y=!1,C=e=>{if(g(),e!=null&&e.persisted){y=!0;return}try{v.disconnect()}catch(t){}},O=e=>{if(!(e!=null&&e.persisted)||!y)return;y=!1;let t=Date.now();for(let o of u.values())o.enterAt=o.intersecting&&!i.hidden?t:null};i.addEventListener("visibilitychange",w);let s=(K=i.defaultView)!=null?K:typeof window!="undefined"?window:void 0;s==null||s.addEventListener("pagehide",C),s==null||s.addEventListener("pageshow",O);let W=setInterval(()=>{if(i.hidden||y)return;g();let e=Date.now();for(let t of u.values())t.intersecting&&(t.enterAt=e)},Z),I=[];return r.microSignals&&[...m.entries()].forEach(([e,t],o)=>{I.push(H((n,p={})=>{try{d.track({projectId:r.apiKey,componentId:t,eventType:"micro_signal",payload:f({signalType:n},p)})}catch(l){}},e,void 0,{tabLoss:o===0}))}),()=>{g(),clearInterval(W),i.removeEventListener("visibilitychange",w),s==null||s.removeEventListener("pagehide",C),s==null||s.removeEventListener("pageshow",O);for(let e of I)e();try{v.disconnect()}catch(e){}}}export{T as SEMANTIC_TYPES,E as classifyFeatures,G as classifySection,b as featuresFromElement,ne as startEngagementCapture};
1
+ import{a as Y}from"./chunk-WKXD7KI3.mjs";import{a as T,d as z,e as E,f as b,g as G}from"./chunk-Z6ILOYBD.mjs";import{I as H,K as J}from"./chunk-HY23LTUY.mjs";import"./chunk-2NVSFI4V.mjs";import{a as f,b as V}from"./chunk-TMCGHANO.mjs";import{fnv1a as Q}from"@sentientui/policy";var X="section, header, footer, nav, main > div, [data-sentient-section]",Z=2e4;function ee(d){let r=Array.from(d.querySelectorAll(X)),i=r.filter(a=>r.filter(c=>c!==a&&a.contains(c)).length<2);return i.filter(a=>!i.some(c=>c!==a&&c.contains(a)))}function te(d,r,i,a){try{fetch(`${r}/v1/section-map`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${d}`},body:JSON.stringify({pageUrl:i,sections:a})}).catch(()=>{})}catch(c){}}var h=()=>{};function ne(d,r){var k,x,L,N,D,R,_,F,M,P,$,K;let i=(k=r.doc)!=null?k:typeof document!="undefined"?document:void 0;if(!i||typeof IntersectionObserver=="undefined"||J()||!r.apiKey||!r.apiKey.startsWith("pk_"))return h;let a=((x=r.apiBase)!=null?x:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),c=ee(i);if(c.length===0)return h;let m=new Map,A=[];for(let e of c){let t=e.getAttribute("data-sentient-type"),o=t&&T.includes(t)?t:null,n=b(e),p=(N=o!=null?o:(L=r.typeOf)==null?void 0:L.call(r,e))!=null?N:E(n).type,l=Y(e,i),B=l?`nc-${p}-${Q(JSON.stringify({id:(D=l.id)!=null?D:null,dataAttr:(R=l.dataAttr)!=null?R:null,selector:(_=l.selector)!=null?_:null})).toString(36)}`:`nc-${p}`;m.set(e,B);let j=z.filter(([,S])=>S.test(n.bodyText)).map(([S])=>S);A.push(V(f({componentId:B,semanticType:p,source:o?"markup":"auto"},l?{locator:l}:{}),{observation:f(f({tag:n.tag,idClass:n.idClass.slice(0,200),headingText:n.headingText,textLength:n.textLength,actionCount:n.actionCount},n.ariaRole?{ariaRole:n.ariaRole}:{}),j.length>0?{patternFlags:j}:{})}))}let q=($=(P=(M=(F=i.defaultView)!=null?F:typeof window!="undefined"?window:void 0)==null?void 0:M.location)==null?void 0:P.pathname)!=null?$:"/";te(r.apiKey,a,q,A);let u=new Map,U=e=>{let t=u.get(e);return t||(t={ms:0,scroll:0,enterAt:null,intersecting:!1},u.set(e,t)),t},v=new IntersectionObserver(e=>{for(let t of e){let o=m.get(t.target);if(!o)continue;let n=U(o);t.isIntersecting?(n.intersecting=!0,n.enterAt=Date.now(),t.intersectionRatio>n.scroll&&(n.scroll=t.intersectionRatio)):(n.intersecting=!1,n.enterAt!=null&&(n.ms+=Date.now()-n.enterAt,n.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let e of m.keys())v.observe(e);let g=()=>{let e=Date.now();for(let[t,o]of u)if(o.enterAt!=null&&(o.ms+=e-o.enterAt,o.enterAt=null),!(o.ms<=0)){try{d.track({projectId:r.apiKey,componentId:t,eventType:"dwell",payload:{dwell_time:Math.round(o.ms),scroll_depth:Number(o.scroll.toFixed(2))}})}catch(n){}o.ms=0}},w=()=>{if(i.hidden)g();else{let e=Date.now();for(let t of u.values())t.intersecting&&(t.enterAt=e)}},y=!1,C=e=>{if(g(),e!=null&&e.persisted){y=!0;return}try{v.disconnect()}catch(t){}},O=e=>{if(!(e!=null&&e.persisted)||!y)return;y=!1;let t=Date.now();for(let o of u.values())o.enterAt=o.intersecting&&!i.hidden?t:null};i.addEventListener("visibilitychange",w);let s=(K=i.defaultView)!=null?K:typeof window!="undefined"?window:void 0;s==null||s.addEventListener("pagehide",C),s==null||s.addEventListener("pageshow",O);let W=setInterval(()=>{if(i.hidden||y)return;g();let e=Date.now();for(let t of u.values())t.intersecting&&(t.enterAt=e)},Z),I=[];return r.microSignals&&[...m.entries()].forEach(([e,t],o)=>{I.push(H((n,p={})=>{try{d.track({projectId:r.apiKey,componentId:t,eventType:"micro_signal",payload:f({signalType:n},p)})}catch(l){}},e,void 0,{tabLoss:o===0}))}),()=>{g(),clearInterval(W),i.removeEventListener("visibilitychange",w),s==null||s.removeEventListener("pagehide",C),s==null||s.removeEventListener("pageshow",O);for(let e of I)e();try{v.disconnect()}catch(e){}}}export{T as SEMANTIC_TYPES,E as classifyFeatures,G as classifySection,b as featuresFromElement,ne as startEngagementCapture};
2
2
  //# sourceMappingURL=index-engagement.mjs.map
@@ -1,7 +1,7 @@
1
- import { n as SentientConfig, m as SentientClient } from './index-B5b5LlRJ.cjs';
2
- export { A as AssignResult, a as Assignment, b as AssignmentCache, E as EventQueue, e as EventType, g as GraphClient, h as GraphConfig, i as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, M as MicroSignalEmitter, k as MicroSignalType, l as PageNode, Q as QueueConfig, o as SentientEvent, p as SessionConfig, q as SessionManager, r as attachMicroSignalDetectors, s as grantConsent, u as isDoNotTrackEnabled, v as sanitizePageUrl, w as sessionCookieName } from './index-B5b5LlRJ.cjs';
3
- import { z as CompoundLocator } from './session-meta-dN92q19_.cjs';
4
- export { B as BLOCK_ALIGNS, b as BLOCK_EMPHASES, c as BLOCK_FITS, d as BLOCK_GAPS, e as BLOCK_GRID_COLUMNS, f as BLOCK_HEADING_LEVELS, g as BLOCK_JUSTIFIES, h as BLOCK_RATIOS, i as BLOCK_SIZES, j as BLOCK_TEXT_ALIGNS, k as BLOCK_TONES, l as BLOCK_WEIGHTS, m as BadgeBlock, n as BlockAlign, o as BlockEmphasis, p as BlockFit, q as BlockGap, r as BlockJustify, s as BlockNode, t as BlockRatio, u as BlockSize, v as BlockTextAlign, w as BlockTone, x as BlockWeight, y as ButtonBlock, D as DecisionSnapshot, F as FORM_FIELD_KINDS, E as FORM_INPUT_TYPES, G as FormBlock, H as FormField, I as GridBlock, J as HeadingBlock, K as ImageBlock, L as LinkBlock, M as MAX_BLOCK_ARMS, N as MAX_BLOCK_CHILDREN, O as MAX_BLOCK_DEPTH, P as MAX_BLOCK_NODES, Q as MAX_BLOCK_TEXT_LEN, R as MAX_FORM_FIELDS, S as MAX_FORM_SELECT_OPTIONS, T as SNAPSHOT_STORAGE_KEY_PREFIX, V as SitePalette, W as SlotConfigEntry, X as SlotDeclInput, Y as SlotOps, Z as SpacerBlock, _ as StackBlock, $ as TextBlock, a2 as armOfResult, a3 as baselineResultFor, a4 as baselineSlots, a7 as containsFormBlock, a8 as deriveSessionSegment, a9 as detectDeviceClass, aa as detectTimeOfDay, ab as detectTrafficSource, ae as readSnapshot, af as referrerDomainFromReferer, ag as renderPrePaintScript, ah as toWireSlot, aj as writeSnapshot } from './session-meta-dN92q19_.cjs';
1
+ import { o as SentientConfig, n as SentientClient } from './index-B0PkJoeB.cjs';
2
+ export { A as AssignResult, a as Assignment, b as AssignmentCache, E as EventQueue, e as EventType, g as GraphClient, h as GraphConfig, i as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, M as MicroSignalEmitter, k as MicroSignalType, l as PageNode, Q as QueueConfig, p as SentientEvent, q as SessionConfig, r as SessionManager, s as attachMicroSignalDetectors, t as grantConsent, v as isDoNotTrackEnabled, y as sanitizePageUrl, z as sessionCookieName } from './index-B0PkJoeB.cjs';
3
+ import { I as CompoundLocator } from './session-meta-CY_Luh5i.cjs';
4
+ export { B as BLOCK_ALIGNS, b as BLOCK_EMPHASES, c as BLOCK_FITS, d as BLOCK_GAPS, e as BLOCK_GRID_COLUMNS, f as BLOCK_HEADING_LEVELS, g as BLOCK_JUSTIFIES, h as BLOCK_MAX_WIDTHS, i as BLOCK_PADS, j as BLOCK_RATIOS, k as BLOCK_SIZES, l as BLOCK_SURFACES, m as BLOCK_TEXT_ALIGNS, n as BLOCK_TONES, o as BLOCK_WEIGHTS, p as BadgeBlock, q as BlockAlign, r as BlockEmphasis, s as BlockFit, t as BlockGap, u as BlockJustify, v as BlockMaxWidth, w as BlockNode, x as BlockPad, y as BlockRatio, z as BlockSize, C as BlockSurface, D as BlockTextAlign, E as BlockTone, F as BlockWeight, G as ButtonBlock, J as DecisionSnapshot, K as DividerBlock, L as FORM_FIELD_KINDS, M as FORM_INPUT_TYPES, N as FormBlock, O as FormField, P as GridBlock, Q as HeadingBlock, R as ImageBlock, S as LinkBlock, T as MAX_BLOCK_ARMS, U as MAX_BLOCK_CHILDREN, V as MAX_BLOCK_DEPTH, W as MAX_BLOCK_NODES, X as MAX_BLOCK_TEXT_LEN, Y as MAX_FORM_FIELDS, Z as MAX_FORM_SELECT_OPTIONS, _ as SNAPSHOT_STORAGE_KEY_PREFIX, a0 as SitePalette, a1 as SlotConfigEntry, a2 as SlotDeclInput, a3 as SlotOps, a4 as SpacerBlock, a5 as StackBlock, a6 as TextBlock, a9 as armOfResult, aa as baselineResultFor, ab as baselineSlots, ae as containsFormBlock, af as deriveSessionSegment, ag as detectDeviceClass, ah as detectTimeOfDay, ai as detectTrafficSource, al as readSnapshot, am as referrerDomainFromReferer, an as renderPrePaintScript, ao as toWireSlot, aq as writeSnapshot } from './session-meta-CY_Luh5i.cjs';
5
5
  export { SlotResult } from '@sentientui/policy';
6
6
 
7
7
  /** Reads the rendered DOM to build the page-side context graph. */
@@ -1,7 +1,7 @@
1
- import { n as SentientConfig, m as SentientClient } from './index-NqZbPgmm.js';
2
- export { A as AssignResult, a as Assignment, b as AssignmentCache, E as EventQueue, e as EventType, g as GraphClient, h as GraphConfig, i as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, M as MicroSignalEmitter, k as MicroSignalType, l as PageNode, Q as QueueConfig, o as SentientEvent, p as SessionConfig, q as SessionManager, r as attachMicroSignalDetectors, s as grantConsent, u as isDoNotTrackEnabled, v as sanitizePageUrl, w as sessionCookieName } from './index-NqZbPgmm.js';
3
- import { z as CompoundLocator } from './session-meta-dN92q19_.js';
4
- export { B as BLOCK_ALIGNS, b as BLOCK_EMPHASES, c as BLOCK_FITS, d as BLOCK_GAPS, e as BLOCK_GRID_COLUMNS, f as BLOCK_HEADING_LEVELS, g as BLOCK_JUSTIFIES, h as BLOCK_RATIOS, i as BLOCK_SIZES, j as BLOCK_TEXT_ALIGNS, k as BLOCK_TONES, l as BLOCK_WEIGHTS, m as BadgeBlock, n as BlockAlign, o as BlockEmphasis, p as BlockFit, q as BlockGap, r as BlockJustify, s as BlockNode, t as BlockRatio, u as BlockSize, v as BlockTextAlign, w as BlockTone, x as BlockWeight, y as ButtonBlock, D as DecisionSnapshot, F as FORM_FIELD_KINDS, E as FORM_INPUT_TYPES, G as FormBlock, H as FormField, I as GridBlock, J as HeadingBlock, K as ImageBlock, L as LinkBlock, M as MAX_BLOCK_ARMS, N as MAX_BLOCK_CHILDREN, O as MAX_BLOCK_DEPTH, P as MAX_BLOCK_NODES, Q as MAX_BLOCK_TEXT_LEN, R as MAX_FORM_FIELDS, S as MAX_FORM_SELECT_OPTIONS, T as SNAPSHOT_STORAGE_KEY_PREFIX, V as SitePalette, W as SlotConfigEntry, X as SlotDeclInput, Y as SlotOps, Z as SpacerBlock, _ as StackBlock, $ as TextBlock, a2 as armOfResult, a3 as baselineResultFor, a4 as baselineSlots, a7 as containsFormBlock, a8 as deriveSessionSegment, a9 as detectDeviceClass, aa as detectTimeOfDay, ab as detectTrafficSource, ae as readSnapshot, af as referrerDomainFromReferer, ag as renderPrePaintScript, ah as toWireSlot, aj as writeSnapshot } from './session-meta-dN92q19_.js';
1
+ import { o as SentientConfig, n as SentientClient } from './index-BIdUwF-v.js';
2
+ export { A as AssignResult, a as Assignment, b as AssignmentCache, E as EventQueue, e as EventType, g as GraphClient, h as GraphConfig, i as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, M as MicroSignalEmitter, k as MicroSignalType, l as PageNode, Q as QueueConfig, p as SentientEvent, q as SessionConfig, r as SessionManager, s as attachMicroSignalDetectors, t as grantConsent, v as isDoNotTrackEnabled, y as sanitizePageUrl, z as sessionCookieName } from './index-BIdUwF-v.js';
3
+ import { I as CompoundLocator } from './session-meta-CY_Luh5i.js';
4
+ export { B as BLOCK_ALIGNS, b as BLOCK_EMPHASES, c as BLOCK_FITS, d as BLOCK_GAPS, e as BLOCK_GRID_COLUMNS, f as BLOCK_HEADING_LEVELS, g as BLOCK_JUSTIFIES, h as BLOCK_MAX_WIDTHS, i as BLOCK_PADS, j as BLOCK_RATIOS, k as BLOCK_SIZES, l as BLOCK_SURFACES, m as BLOCK_TEXT_ALIGNS, n as BLOCK_TONES, o as BLOCK_WEIGHTS, p as BadgeBlock, q as BlockAlign, r as BlockEmphasis, s as BlockFit, t as BlockGap, u as BlockJustify, v as BlockMaxWidth, w as BlockNode, x as BlockPad, y as BlockRatio, z as BlockSize, C as BlockSurface, D as BlockTextAlign, E as BlockTone, F as BlockWeight, G as ButtonBlock, J as DecisionSnapshot, K as DividerBlock, L as FORM_FIELD_KINDS, M as FORM_INPUT_TYPES, N as FormBlock, O as FormField, P as GridBlock, Q as HeadingBlock, R as ImageBlock, S as LinkBlock, T as MAX_BLOCK_ARMS, U as MAX_BLOCK_CHILDREN, V as MAX_BLOCK_DEPTH, W as MAX_BLOCK_NODES, X as MAX_BLOCK_TEXT_LEN, Y as MAX_FORM_FIELDS, Z as MAX_FORM_SELECT_OPTIONS, _ as SNAPSHOT_STORAGE_KEY_PREFIX, a0 as SitePalette, a1 as SlotConfigEntry, a2 as SlotDeclInput, a3 as SlotOps, a4 as SpacerBlock, a5 as StackBlock, a6 as TextBlock, a9 as armOfResult, aa as baselineResultFor, ab as baselineSlots, ae as containsFormBlock, af as deriveSessionSegment, ag as detectDeviceClass, ah as detectTimeOfDay, ai as detectTrafficSource, al as readSnapshot, am as referrerDomainFromReferer, an as renderPrePaintScript, ao as toWireSlot, aq as writeSnapshot } from './session-meta-CY_Luh5i.js';
5
5
  export { SlotResult } from '@sentientui/policy';
6
6
 
7
7
  /** Reads the rendered DOM to build the page-side context graph. */
@@ -1,2 +1,2 @@
1
- "use strict";var Ht=Object.create;var ve=Object.defineProperty,qt=Object.defineProperties,Qt=Object.getOwnPropertyDescriptor,Xt=Object.getOwnPropertyDescriptors,Yt=Object.getOwnPropertyNames,at=Object.getOwnPropertySymbols,Jt=Object.getPrototypeOf,lt=Object.prototype.hasOwnProperty,Vt=Object.prototype.propertyIsEnumerable;var ct=(e,t,n)=>t in e?ve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,v=(e,t)=>{for(var n in t||(t={}))lt.call(t,n)&&ct(e,n,t[n]);if(at)for(var n of at(t))Vt.call(t,n)&&ct(e,n,t[n]);return e},H=(e,t)=>qt(e,Xt(t));var Zt=(e,t)=>{for(var n in t)ve(e,n,{get:t[n],enumerable:!0})},dt=(e,t,n,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of Yt(t))!lt.call(e,d)&&d!==n&&ve(e,d,{get:()=>t[d],enumerable:!(c=Qt(t,d))||c.enumerable});return e};var en=(e,t,n)=>(n=e!=null?Ht(Jt(e)):{},dt(t||!e||!e.__esModule?ve(n,"default",{value:e,enumerable:!0}):n,e)),tn=e=>dt(ve({},"__esModule",{value:!0}),e);var Ar={};Zt(Ar,{BLOCK_ALIGNS:()=>Cn,BLOCK_EMPHASES:()=>_n,BLOCK_FITS:()=>Pn,BLOCK_GAPS:()=>xn,BLOCK_GRID_COLUMNS:()=>Nn,BLOCK_HEADING_LEVELS:()=>Ln,BLOCK_JUSTIFIES:()=>In,BLOCK_RATIOS:()=>On,BLOCK_SIZES:()=>kn,BLOCK_TEXT_ALIGNS:()=>Rn,BLOCK_TONES:()=>An,BLOCK_WEIGHTS:()=>Tn,FORM_FIELD_KINDS:()=>Dn,FORM_INPUT_TYPES:()=>Bn,LEGACY_SESSION_COOKIE_NAME:()=>we,MAX_BLOCK_ARMS:()=>Fn,MAX_BLOCK_CHILDREN:()=>Un,MAX_BLOCK_DEPTH:()=>$n,MAX_BLOCK_NODES:()=>Gn,MAX_BLOCK_TEXT_LEN:()=>jn,MAX_FORM_FIELDS:()=>Mn,MAX_FORM_SELECT_OPTIONS:()=>Kn,SNAPSHOT_STORAGE_KEY_PREFIX:()=>oe,armOfResult:()=>Le,attachMicroSignalDetectors:()=>kt,baselineResultFor:()=>fe,baselineSlots:()=>vt,containsFormBlock:()=>It,deriveSessionSegment:()=>We,detectDeviceClass:()=>le,detectTimeOfDay:()=>pe,detectTrafficSource:()=>de,grantConsent:()=>Pt,init:()=>zt,isDoNotTrackEnabled:()=>Ce,locatorFromElement:()=>Ke,readSnapshot:()=>me,referrerDomainFromReferer:()=>ue,renderPrePaintScript:()=>wt,sanitizePageUrl:()=>Xe,sessionCookieName:()=>ae,toWireSlot:()=>Ee,writeSnapshot:()=>ye});module.exports=tn(Ar);function Te(){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)})}function re(e){return e?`_${e.slice(0,12)}`:""}var we="_snt_uid";function ae(e){return`${we}${re(e)}`}var nn="_snt_uid",rn=365,Ae="_snt_uid";function on(){return Te()}function ut(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function sn(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=strict; path=/`}catch(c){}}function $e(e){try{return localStorage.getItem(e)}catch(t){return null}}function pt(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function gt(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function an(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function cn(e){try{sessionStorage.removeItem(e)}catch(t){}}function ln(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=strict; path=/`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function dn(e){try{localStorage.removeItem(e)}catch(t){}}function un(e){try{document.cookie=`${e}=; max-age=0; SameSite=strict; path=/`}catch(t){}}var pn={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function _e(e){var y,b,x,E,K,F,T;if(typeof window=="undefined")return pn;let t=re(e==null?void 0:e.apiKey),n=(y=e==null?void 0:e.cookieName)!=null?y:ae(e==null?void 0:e.apiKey),c=`${Ae}${t}`,d=`${Ae}_tomb${t}`,i=((b=e==null?void 0:e.cookieTTLDays)!=null?b:rn)*24*60*60,l=R=>R&&R.length>0?R:null,u=()=>{var R,A;return t&&!(e!=null&&e.cookieName)&&$e(d)===null?(A=(R=l(ut(nn)))!=null?R:l($e(Ae)))!=null?A:l(gt(Ae)):null},s=(T=(F=(K=(E=(x=l(ut(n)))!=null?x:l($e(c)))!=null?E:l(gt(c)))!=null?K:u())!=null?F:l(e==null?void 0:e.ssrSessionId))!=null?T:on();sn(n,s,i);let r=pt(c,s),o=ln(n),f=r?!1:an(c,s),p=!r&&!o&&!f;return{getSessionId:()=>s,isEphemeral:()=>p,destroy:()=>{s=null,un(n),dn(c),cn(c),t&&!(e!=null&&e.cookieName)&&pt(d,"1")}}}function ee(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function ce(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 Re(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let c=JSON.parse(n);return Array.isArray(c)?(localStorage.removeItem(e),c.slice(-t)):[]}catch(n){return[]}}function te(e,t,n){try{let c=(()=>{try{let a=localStorage.getItem(n);if(!a)return[];let i=JSON.parse(a);return Array.isArray(i)?i:[]}catch(a){return[]}})(),d=new Map;for(let a of c)d.set(a.id,a);for(let a of e)d.set(a.id,a);localStorage.setItem(n,JSON.stringify([...d.values()].slice(-t)))}catch(c){}}function Oe(e,t){try{let n=localStorage.getItem(t);if(!n)return;let c=JSON.parse(n);if(!Array.isArray(c))return;let d=new Set(e),a=c.filter(i=>!d.has(i.id));if(a.length===c.length)return;a.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(a))}catch(n){}}var gn=500,fn=56*1024;function Ue(e){return`_snt_retry_${e.slice(0,12)}`}var mn={push:()=>{},flush:()=>{},destroy:()=>{}};function ft(e){var X,B,he;if(typeof window=="undefined")return mn;let t=(X=e.flushIntervalMs)!=null?X:5e3,n=(B=e.maxBatchSize)!=null?B:20,c=(he=e.maxRetrySize)!=null?he:100,d=e.ingestUrl,a=e.apiKey,i=Ue(a),l=[],u=new Set,s=[],r=S=>{for(let I of S)o.delete(I),!u.has(I)&&(u.add(I),s.push(I));for(;s.length>gn;){let I=s.shift();I&&u.delete(I)}Oe(S,i)},o=new Set,f=()=>{for(;l.length>c;){let S=l.shift();S&&o.delete(S.id)}},p=S=>{u.has(S.id)||o.has(S.id)||(o.add(S.id),l.push(S),f())},y=S=>{for(let I of S)u.has(I.id)||(o.add(I.id),l.push(I));f()},b=Re(i,c);for(let S of b)p(S);let x=0,E=0,K=(S,I=!0)=>{if(S.length===0)return;let Y=JSON.stringify(S),G=S.map(J=>J.id),U;try{U=fetch(d,{method:"POST",keepalive:!0,body:Y,headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`}})}catch(J){te(S,c,i),y(S),E++,x=Date.now()+ee(E);return}let q=J=>{if(ce(J)!=="retry"){if(!J.ok&&I){let se=S.filter(V=>V.eventType!=="pageview");if(se.length>0&&se.length<S.length){r(S.filter(V=>V.eventType==="pageview").map(V=>V.id)),K(se,!1);return}}r(G),E=0,x=0;return}te(S,c,i),y(S),E++,x=Date.now()+ee(E)};U instanceof Promise?U.then(q).catch(()=>{te(S,c,i),y(S),E++,x=Date.now()+ee(E)}):q(U)},F=typeof TextEncoder!="undefined"?new TextEncoder:null,T=S=>F?F.encode(S).length:S.length,R=S=>{let I=[],Y=2;for(let G of S){let U=T(JSON.stringify(G))+1;if(I.length>0&&Y+U>fn||I.length>=n)break;I.push(G),Y+=U}return I},A=()=>{try{if(Date.now()<x)return;for(;l.length>0&&!(Date.now()<x);){let S=l.filter(Y=>!u.has(Y.id));if(l.length=0,S.length===0)break;let I=R(S);if(I.length===0)break;I.length<S.length&&l.push(...S.slice(I.length)),K(I)}}catch(S){}},h=!0,O=null;O=setInterval(()=>{h&&A()},t);let j=()=>{document.visibilityState==="hidden"&&A()},W=()=>{A()};return document.addEventListener("visibilitychange",j),window.addEventListener("pagehide",W),{push(S){p(S),l.length>=n&&A()},flush:A,destroy(){h=!1,O!==null&&(clearInterval(O),O=null),document.removeEventListener("visibilitychange",j),window.removeEventListener("pagehide",W),A()}}}var yn=200;function Fe(e){return`_snt_goal_retry_${e.slice(0,12)}`}var hn={send:()=>{},flush:()=>{},destroy:()=>{}};function mt(e){var T,R,A;if(typeof window=="undefined")return hn;let t=(T=e.flushIntervalMs)!=null?T:5e3,n=(R=e.maxRetrySize)!=null?R:100,c=(A=e.maxPerFlush)!=null?A:5,d=Fe(e.apiKey),a=[],i=new Set,l=new Set,u=[],s=0,r=0,o=!1,f=h=>{for(i.delete(h.id),l.has(h.id)||(l.add(h.id),u.push(h.id));u.length>yn;){let O=u.shift();O&&l.delete(O)}Oe([h.id],d)},p=h=>{te([h],n,d),!l.has(h.id)&&!i.has(h.id)&&(i.add(h.id),a.push(h)),Date.now()>=s&&(r++,s=Date.now()+ee(r))},y=h=>{let O;try{O=fetch(e.url,{method:"POST",keepalive:!0,body:h.body,headers:e.headers})}catch(W){p(h);return}let j=W=>{var B;let X=ce(W);if(X==="retry"){p(h);return}X==="dropped"&&((B=e.onDrop)==null||B.call(e,h,W.status)),f(h),r=0,s=0};O instanceof Promise?O.then(j).catch(()=>p(h)):j(O)},b=()=>{try{if(o||Date.now()<s)return;let h=0;for(;a.length>0&&h<c&&!(Date.now()<s);){let O=a.shift();i.delete(O.id),!l.has(O.id)&&(h++,y(O))}}catch(h){}},x=Re(d,n);for(let h of x)i.has(h.id)||(i.add(h.id),a.push(h));x.length>0&&te(x,n,d);let E=setInterval(b,t),K=()=>{document.visibilityState==="hidden"&&b()},F=()=>b();return document.addEventListener("visibilitychange",K),window.addEventListener("pagehide",F),{send(h){if(!o&&!(l.has(h.id)||i.has(h.id))){if(Date.now()<s){te([h],n,d),i.add(h.id),a.push(h);return}y(h)}},flush:b,destroy(){clearInterval(E),document.removeEventListener("visibilitychange",K),window.removeEventListener("pagehide",F),b(),o=!0}}}var Sn=1800*1e3;function Pe(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function yt(e=Sn,t){let n=new Map,c=`_snt_asgn${re(t)}_`,d=(s,r)=>`${c}${encodeURIComponent(s)}:${encodeURIComponent(r)}`,a=s=>{let r=s.slice(c.length),o=r.indexOf(":");if(o<0)return null;try{return{componentId:decodeURIComponent(r.slice(0,o)),segment:decodeURIComponent(r.slice(o+1))}}catch(f){return null}},i=()=>{try{let s=[];for(let r=0;r<localStorage.length;r++){let o=localStorage.key(r);o!=null&&o.startsWith(c)&&s.push(o)}return s}catch(s){return[]}},l=s=>s.assignedAt+(s.ttlMs&&s.ttlMs>0?s.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let s of i())try{let r=localStorage.getItem(s);if(!r)continue;let o=JSON.parse(r);if(l(o)){localStorage.removeItem(s);continue}let f=a(s);if(!f)continue;n.set(Pe(f.componentId,f.segment),o)}catch(r){}})(),{get(s,r){let o=n.get(Pe(s,r));return o?l(o)?(n.delete(Pe(s,r)),null):o:null},set(s,r,o){let f=Pe(s,r);n.set(f,o);try{localStorage.setItem(d(s,r),JSON.stringify(o))}catch(p){}},clear(){n.clear();for(let s of i())try{localStorage.removeItem(s)}catch(r){}}}}var ht=["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 Ne(e){return St(e)!==null}function St(e){var n;if(!e)return null;let t=e.toLowerCase();return(n=ht.find(c=>t.includes(c.toLowerCase())))!=null?n:null}function le(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 de(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(d){}let c=n.hostname.toLowerCase();return/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(c)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(c)?"social":"referral"}catch(n){return"direct"}}function ue(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var bt=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function je(e){let t={},n={};try{let c=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([d,a])=>{let i=Array.isArray(a)?a[0]:a;return i===void 0?[]:[[d,i]]});for(let[d,a]of c)d.startsWith("utm_")?d in t||(t[d]=a):bt.includes(d)&&(d in n||(n[d]=a))}catch(c){}return{utmParams:t,clickIds:n}}function pe(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function We(e){let t=bn("__segment__",e);return`${t.deviceClass}:${t.trafficSource}`}function bn(e,t){var a,i,l,u,s,r,o,f;let n=(i=(a=t==null?void 0:t.userAgent)==null?void 0:a.trim())!=null?i:"",c=(u=(l=t==null?void 0:t.referer)==null?void 0:l.trim())!=null?u:"",d=(s=t==null?void 0:t.now)!=null?s:new Date;return{sessionId:e,ephemeral:!1,utmParams:(r=t==null?void 0:t.utmParams)!=null?r:{},clickIds:(o=t==null?void 0:t.clickIds)!=null?o:{},deviceClass:n?le(n):"desktop",trafficSource:c?de(c,t==null?void 0:t.appOrigin):"direct",referrerDomain:ue(c),timeOfDay:pe(d),dayOfWeek:(f=["sun","mon","tue","wed","thu","fri","sat"][d.getDay()])!=null?f:"sun",automation:(t==null?void 0:t.webdriver)===!0||Ne(n)}}var ge=require("@sentientui/policy");function Ee(e){return v(v(v({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 fe(e){let t=Ee(e);return(0,ge.slotResultFor)(t,(0,ge.slotBaselineArm)(t))}function vt(e){let t={};for(let n of e)t[n.id]=fe(n);return t}function Le(e){return typeof e=="string"?e:(0,ge.canonicalArm)(e)}var oe="_snt_snap:",vn=["low","medium","high"];function me(e){try{let t=localStorage.getItem(oe+e);if(!t)return null;let n=JSON.parse(t);return!n||typeof n!="object"||n.v!==1||typeof n.persona!="string"||typeof n.band!="string"||!vn.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"||!(n.slotConfig===void 0||typeof n.slotConfig=="object"&&n.slotConfig!==null&&!Array.isArray(n.slotConfig))?null:n}catch(t){return null}}function ye(e,t){try{localStorage.setItem(oe+e,JSON.stringify(t))}catch(n){}}function wt(e){return"(function(){try{var r=localStorage.getItem("+JSON.stringify(oe+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;var d=document.documentElement;if(d.hasAttribute("data-sentient-persona"))return;d.setAttribute("data-sentient-persona",s.persona);d.setAttribute("data-sentient-confidence",s.band);}catch(e){}})();'}var He=require("@sentientui/policy");var Be=require("@sentientui/policy");var Et="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",wn="[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.",xt=!1,De=!1;function En(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function Ct(e){var s;let t=_e({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),n=(s=t.getSessionId())!=null?s:"local",c=En(),d=import("@sentientui/core/local").then(r=>{let o=r;return o.LOCAL_ENGINE_AVAILABLE?(xt||(xt=!0,console.info(wn)),o):(De||(De=!0,console.error(Et)),null)}).catch(()=>(De||(De=!0,console.error(Et)),null)),a=null,i={low:.15,medium:.5,high:.85},l=(()=>{var o;if(e.initialPersona)return v({},e.initialPersona);let r=me(e.apiKey||"local");return r?{persona:r.persona,confidence:(o=i[r.band])!=null?o:.15}:null})();function u(r){let o=document.documentElement;o.dataset.sentientPersona===void 0&&(o.dataset.sentientPersona=r.persona,o.dataset.sentientConfidence=(0,Be.confidenceBand)(r.confidence))}return{isLocal:!0,async decide(r){var p,y,b;let o=await d;if(!o)return null;let f=o.createLocalEngine({sessionId:n,forcedPersona:c}).decide(r);return a=H(v({},f),{layoutOrder:(y=(p=f.layoutOrder)!=null?p:a==null?void 0:a.layoutOrder)!=null?y:null,slots:v(v({},(b=a==null?void 0:a.slots)!=null?b:{}),f.slots)}),ye(e.apiKey||"local",{v:1,persona:a.persona,band:(0,Be.confidenceBand)(a.confidence),slots:a.slots,layoutOrder:a.layoutOrder,savedAt:Date.now()}),u(f),f},getSlotResult(r){var o,f,p;return(p=(f=a==null?void 0:a.slots[r])!=null?f:(o=e.initialSlots)==null?void 0:o[r])!=null?p:null},getSlotConfig(r){var o,f;return(f=(o=e.initialSlotConfig)==null?void 0:o[r])!=null?f:null},getSitePalette(){var r;return(r=e.initialPalette)!=null?r:null},reportSlots(){},getPersona(){let r=a!=null?a:l;return r?{persona:r.persona,confidence:r.confidence,band:(0,Be.confidenceBand)(r.confidence)}:null},async assign(r,o){var y;let f=await d;return!f||!o||o.length===0?o!=null&&o[0]?{variantId:o[0],assignmentTtlMs:0}:null:{variantId:(y=f.createLocalEngine({sessionId:n,forcedPersona:c}).decide({components:[{id:r,variantIds:o}]}).assignments[r])!=null?y:o[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>t.destroy()}}var xn=["none","sm","md","lg"],Cn=["start","center","end","stretch"],In=["start","center","end","between"],kn=["sm","md","lg"],Tn=["normal","medium","bold"],An=["default","muted","accent"],_n=["primary","secondary","ghost"],Rn=["left","center","right"],On=["auto","square","landscape","wide"],Pn=["cover","contain"],Nn=[2,3,4],Ln=[2,3,4],Dn=["input","textarea","select"],Bn=["text","email","number","tel"],Mn=5,Kn=8,Gn=64,$n=5,Un=12,Fn=4,jn=500;function It(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(It):!1}function kt(e,t,n,c){let d=[];{let l=!1,u=[],s=()=>{if(l)return;let r=Date.now();for(u.push(r);u.length>0&&r-u[0]>500;)u.shift();u.length>=3&&(l=!0,e("rage_click"))};t.addEventListener("click",s),d.push(()=>t.removeEventListener("click",s))}{let a=!1,i=l=>{if(a||!(l.target instanceof Node)||!t.contains(l.target)&&t!==l.target)return;a=!0;let u=typeof window!="undefined"?window.getSelection():null,s=u?u.toString().length:0;e("text_copy",{selectionLength:s})};document.addEventListener("copy",i),d.push(()=>document.removeEventListener("copy",i))}{let a=!1,i=!1,l=null,u=()=>{l!==null&&(clearTimeout(l),l=null)},s=()=>{a||!i||(u(),l=setTimeout(()=>{!a&&i&&(a=!0,e("scroll_hesitation"))},3e3))},r=()=>{u(),s()},o=p=>{for(let y of p)i=y.intersectionRatio>.3,i?s():u()},f=new IntersectionObserver(o,{threshold:[.3]});f.observe(t),window.addEventListener("scroll",r,{passive:!0}),d.push(()=>{f.disconnect(),window.removeEventListener("scroll",r),u()})}if((c==null?void 0:c.tabLoss)!==!1){let a=!1,i=n!=null?n:Date.now(),l=()=>{if(a||document.visibilityState!=="hidden")return;let u=Date.now()-i;u<15e3&&(a=!0,e("tab_loss",{timeOnPage:u}))};document.addEventListener("visibilitychange",l),d.push(()=>document.removeEventListener("visibilitychange",l))}return()=>{for(let a of d)a()}}var Tt="https://api.sentient-ui.com/v1/events",M=new Map,At=null;function _t(e,t){let n=M.get(e);n&&n.upgrade&&(n.reinit=t)}function Wn(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var zn=3;function ze(){return Te()}function Me(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function Hn(){let e=new WeakMap,t=new Map,n=!1,c=(l,u,s)=>{let r=l.get(u);return s===null?r?!0:(l.set(u,new Set),!1):r?r.has(s)?!0:(r.add(s),!1):(l.set(u,new Set([s])),!1)},d=typeof window!="undefined"&&"event"in window,a=()=>{if(!d)return;let l=window.event;return typeof Event=="function"&&l instanceof Event?l:void 0},i=()=>{if(d){Promise.resolve().then(()=>{n=!1,t.clear()});return}let l=!1,u=()=>{l||(l=!0,n=!1,t.clear())};if(setTimeout(u,0),typeof MessageChannel=="function"){let s=new MessageChannel;s.port1.onmessage=()=>{s.port1.close(),s.port2.close(),u()},s.port2.postMessage(0)}};return{firedBefore(l,u){let s=a();if(s){let o=e.get(s);return o||(o=new Map,e.set(s,o)),c(o,l,u)}let r=c(t,l,u);return!r&&!n&&(n=!0,i()),r}}}var Rt=new Set;function qn(e,t,n){let c=typeof window=="undefined"?null:window.history;if(!c)return()=>{};let d=!1,a,i=()=>{if(d)return;let s=Me();!s||s===a||(a=s,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${s}`))},l=[];for(let s of["pushState","replaceState"]){let r=c[s],o=function(...f){let p=r.apply(this,f);return i(),p};c[s]=o,l.push([s,r,o])}window.addEventListener("popstate",i);let u=Me();return u&&Rt.has(`${t}:${u}`)?a=u:i(),()=>{if(!d){d=!0,window.removeEventListener("popstate",i);for(let[s,r,o]of l)c[s]===o&&(c[s]=r)}}}var xe={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>{}};function Qn(){try{return je(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function Ot(e){return e.replace(/\/events\/?$/,"")}function Ce(){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 Pt(e){var u;if(typeof window=="undefined")return;let t=e!=null?e:At;if(!t){console.warn("[sentient] grantConsent() called before init()");return}let n=M.get(t);if(!n){console.warn("[sentient] grantConsent() called before init()");return}let{config:c,upgrade:d,reinit:a}=n;if(!d){n.upgradeBlockedReason&&console.warn(n.upgradeBlockedReason);return}if(c.respectDoNotTrack!==!1&&Ce())return;let i=(a!=null?a:Qe)(H(v({},c),{consent:!0}));d(i);let l=(u=M.get(t))==null?void 0:u.dispose;M.set(t,{config:H(v({},c),{consent:!0}),upgrade:null,dispose:l})}function Xn(e){var s;let t=e.preConsentBehavior==="statistical_winner",n=Ot((s=e.ingestUrl)!=null?s:Tt),c={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},d=new Map,a=new Map,i={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(r,o,f){if(!t)return Promise.resolve(null);let p=d.get(r);return p?Promise.resolve(p):qe(a,r,async()=>{try{let y=new URLSearchParams({componentId:r});for(let K of o!=null?o:[])y.append("variantIds[]",K);let b=await fetch(`${n}/winner?${y.toString()}`,{headers:c});if(!b.ok)return o!=null&&o[0]?{variantId:o[0],assignmentTtlMs:0}:null;let E={variantId:(await b.json()).variantId,assignmentTtlMs:0};return d.set(r,E),E}catch(y){return o!=null&&o[0]?{variantId:o[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>{}},l={track:r=>i.track(r),goal:((r,o,f,p)=>i.goal(r,o,f,p)),componentGoal:(r,o,f)=>i.componentGoal(r,o,f),identify:r=>i.identify(r),getAssignment:(r,o)=>i.getAssignment(r,o),assign:(r,o,f,p)=>i.assign(r,o,f,p),decide:r=>i.decide(r),getSlotResult:r=>i.getSlotResult(r),getSlotConfig:r=>i.getSlotConfig(r),getSitePalette:()=>i.getSitePalette(),reportSlots:r=>i.reportSlots(r),getPersona:()=>i.getPersona(),fetchWeights:()=>i.fetchWeights(),getGraph:()=>i.getGraph(),dispose:()=>i.dispose(),destroy:()=>i.destroy()};function u(r){i=r}return{proxy:l,setInner:u}}function qe(e,t,n){let c=e.get(t);if(c)return c;let d=(async()=>{try{return await n()}finally{e.delete(t)}})();return e.set(t,d),d}function Qe(e){var J,se,V,Ve,Ze,et,tt,nt,rt,ot;if(typeof window=="undefined")return xe;At=e.apiKey||"local";let t=M.get(e.apiKey||"local");if(t!=null&&t.dispose)try{t.dispose()}catch(g){}let n=e.respectDoNotTrack!==!1&&Ce(),c=e.consent===!1||n,d=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!d&&e.localMode!==!1)return M.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."}),c?xe:Ct(e);if(c){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."),M.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."}),xe;let{proxy:g,setInner:m}=Xn(e);return M.set(e.apiKey,{config:e,upgrade:n?null:m}),g}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."),xe;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),xe;let a=(J=e.ingestUrl)!=null?J:Tt,i=Date.now(),l=_e({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),u=yt(void 0,e.apiKey),s=ft({ingestUrl:a,apiKey:e.apiKey}),r=Ot(a),o={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},f=new Set,p=mt({url:`${r}/goals`,apiKey:e.apiKey,headers:o,onDrop:(g,m)=>{if(!e.debug){if(f.has(m))return;f.add(m)}console.warn(`[sentient] goal dropped (HTTP ${m}) \u2014 this will not be retried. `+(m===400?"The session was not found: call init() and let the session upsert complete before firing goals.":m===401||m===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),g)}}),y=le((se=navigator.userAgent)!=null?se:""),b=window.location.origin,x=de((V=document.referrer)!=null?V:"",b),E=(Ve=e.sessionSegment)!=null?Ve:`${y}:${x}`,K=new Map,F=new Map,T=new Map,R=new Map,A=null,h=null,O=new Set,j=new Set,W=null,X=g=>{for(let m of g)T.has(m.id)||T.set(m.id,fe(m))};if(e.initialSlots)for(let[g,m]of Object.entries(e.initialSlots))T.set(g,m);if(e.initialSlotConfig)for(let[g,m]of Object.entries(e.initialSlotConfig))R.set(g,m);e.initialPalette&&(A=e.initialPalette);let B=me(e.apiKey);if(B){for(let[g,m]of Object.entries(B.slots))T.has(g)||T.set(g,m);for(let[g,m]of Object.entries((Ze=B.slotConfig)!=null?Ze:{}))R.has(g)||R.set(g,m);!A&&B.palette&&(A=B.palette)}let he={low:.15,medium:.5,high:.85};if(e.initialPersona)h=v({},e.initialPersona);else{let g=document.documentElement.dataset;g.sentientPersona?h={persona:g.sentientPersona,confidence:(tt=he[(et=g.sentientConfidence)!=null?et:"low"])!=null?tt:.15}:B&&(h={persona:B.persona,confidence:(nt=he[B.band])!=null?nt:.15})}if(e.initialAssignments)for(let[g,m]of Object.entries(e.initialAssignments))u.set(g,E,{variantId:m,assignedAt:Date.now(),segment:E,confidence:1});let S=Promise.resolve(),I=l.getSessionId();if(I){let g=ue((rt=document.referrer)!=null?rt:""),{utmParams:m,clickIds:C}=Qn(),P=v(v(v(v({sessionId:I,deviceClass:y,trafficSource:x,referrerDomain:g,utmParams:m,clickIds:C,timeOfDay:pe(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:l.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||Ne((ot=navigator.userAgent)!=null?ot:"")},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}:{}),L=async()=>{for(let w=0;;w++){try{let _=await fetch(`${r}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(P),headers:o});if(_.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(_.ok||ce(_)==="dropped")return}catch(_){}if(w>=zn){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(_=>setTimeout(_,ee(w+1)))}};try{S=L()}catch(w){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:s});let Y=Hn(),G=null,U=!1,q={goal(g,m={},C=1,P=0){var Se,be,ie,k,Q,ke,N;let L=l.getSessionId();if(!L)return;let w=Wn(m)?m:{metadata:m},_=[g,(Se=w.externalId)!=null?Se:"",(be=w.stepIndex)!=null?be:P,(ie=w.weight)!=null?ie:C].join("\0"),$=w.value!==void 0?`${w.value}\0${(k=w.currency)!=null?k:""}`:null;if(Y.firedBefore(_,$)){e.debug&&console.log(`[sentient] goal("${g}") already recorded for this action \u2014 not sent twice`);return}let D=ze(),Z={sessionId:L,name:g,metadata:(Q=w.metadata)!=null?Q:{},weight:(ke=w.weight)!=null?ke:C,stepIndex:(N=w.stepIndex)!=null?N:P,goalId:D,value:w.value,currency:w.currency,externalId:w.externalId};e.debug&&console.log("[sentient] goal",Z);let ne={id:D,body:JSON.stringify(Z)};S.then(()=>p.send(ne))},componentGoal(g,m,C){var D,Z,ne;let P=l.getSessionId();if(!P)return;let L=u.get(g,E),w=L?null:(D=T.get(g))!=null?D:null;if(!L&&w===null){e.debug&&console.warn(`[sentient] componentGoal("${g}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}let _=L?L.variantId:Le(w),$={id:ze(),sessionId:P,projectId:e.apiKey,componentId:g,variantId:_,eventType:"goal_achieved",goalType:m,payload:v({reward:(Z=C==null?void 0:C.reward)!=null?Z:1,goalValue:C==null?void 0:C.value,currency:C==null?void 0:C.currency},(ne=C==null?void 0:C.metadata)!=null?ne:{}),timestamp:Date.now(),timeInSession:Date.now()-i,path:Me()};e.debug&&console.log("[sentient] componentGoal",$),S.then(()=>s.push($))},identify(g){let m=l.getSessionId();m&&S.then(()=>{fetch(`${r}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:m,userId:g,ephemeral:l.isEphemeral()}),headers:o}).catch(()=>{})})},track(g){let m=l.getSessionId();if(!m)return;let C=H(v({path:Me()},g),{id:ze(),sessionId:m,timestamp:Date.now(),timeInSession:Date.now()-i});e.debug&&console.log("[sentient] track",C),S.then(()=>s.push(C))},getAssignment(g,m){return u.get(g,m)},async assign(g,m,C,P){let L=l.getSessionId();if(!L)return null;let w=u.get(g,E);if(w&&(m!=null&&m.length||w.content!==void 0)){let _=w.ttlMs&&w.ttlMs>0?Math.max(0,w.assignedAt+w.ttlMs-Date.now()):0;return{variantId:w.variantId,assignmentTtlMs:_,content:w.content}}return qe(K,g,async()=>{await S;try{let _={sessionId:L,componentId:g,variantIds:m};P!==void 0?_.agentDataByVariant=P:C!==void 0&&(_.agentData=C);let $=await fetch(`${r}/assign`,{method:"POST",body:JSON.stringify(_),headers:o});if(!$.ok)return null;let D=await $.json();return u.set(g,E,v({variantId:D.variantId,assignedAt:Date.now(),segment:E,confidence:1,content:D.content},D.assignmentTtlMs&&D.assignmentTtlMs>0?{ttlMs:D.assignmentTtlMs}:{})),D}catch(_){return null}})},async decide(g){var w,_;let m=l.getSessionId();if(!m)return null;let C=(w=g.slots)!=null?w:[],P={sessionId:m};g.sections&&g.sections.length>0&&(P.sections=g.sections.map($=>({id:$}))),P.components=(_=g.components)!=null?_:[],C.length>0&&(P.slots=C.map(Ee)),g.slotsFrom==="registry"&&(P.slotsFrom="registry"),g.v&&(P.v=g.v),typeof g.pp=="number"&&(P.pp=g.pp),e.persona&&(P.persona=e.persona);let L=JSON.stringify(P);return qe(F,L,async()=>{var $,D,Z,ne,Se,be;await S;try{let ie=await fetch(`${r}/decide`,{method:"POST",body:L,headers:o});if(!ie.ok)return X(C),null;let k=await ie.json(),Q={};for(let N of C){let z=($=k.slots)==null?void 0:$[N.id];if(z!==void 0){Q[N.id]=z,T.set(N.id,z);continue}let st=T.get(N.id);if(st!==void 0)Q[N.id]=st;else{let it=fe(N);Q[N.id]=it,T.set(N.id,it)}}if(k.slots)for(let[N,z]of Object.entries(k.slots))N in Q||(Q[N]=z,T.set(N,z));let ke=h!=null&&h.persona!=="unknown";k.persona&&!(k.persona==="unknown"&&ke)?h={persona:k.persona,confidence:(D=k.confidence)!=null?D:0}:h||(h={persona:"unknown",confidence:0});for(let[N,z]of Object.entries((Z=k.assignments)!=null?Z:{}))u.set(N,E,{variantId:z,assignedAt:Date.now(),segment:E,confidence:1});if(k.slotConfig)for(let[N,z]of Object.entries(k.slotConfig))R.set(N,z);return k.palette&&(A=k.palette),ye(e.apiKey,v(v({v:1,persona:h.persona,band:(0,He.confidenceBand)(h.confidence),slots:Object.fromEntries(T),layoutOrder:(ne=k.layoutOrder)!=null?ne:null,savedAt:Date.now()},R.size>0?{slotConfig:Object.fromEntries(R)}:{}),A?{palette:A}:{})),v(v(v(v({layoutOrder:(Se=k.layoutOrder)!=null?Se:null,assignments:(be=k.assignments)!=null?be:{},slots:Q,persona:h.persona,confidence:h.confidence},k.slotConfig?{slotConfig:k.slotConfig}:{}),k.goals?{goals:k.goals}:{}),k.sectionMap?{sectionMap:k.sectionMap}:{}),k.palette?{palette:k.palette}:{})}catch(ie){return X(C),null}})},getSlotResult(g){var m;return(m=T.get(g))!=null?m:null},getSlotConfig(g){var m;return(m=R.get(g))!=null?m:null},reportSlots(g){for(let m of g)typeof m=="string"&&m.length>0&&!O.has(m)&&(O.add(m),j.add(m));j.size===0||W!=null||(W=setTimeout(()=>{W=null;let m=[...j].slice(0,20);j.clear(),m.length!==0&&fetch(`${r}/slots/observed`,{method:"POST",headers:o,body:JSON.stringify({slotIds:m})}).catch(()=>{})},1e3))},getSitePalette(){return A},getPersona(){return h?{persona:h.persona,confidence:h.confidence,band:(0,He.confidenceBand)(h.confidence)}:null},async fetchWeights(){var g;try{let m=await fetch(`${r}/weights`,{headers:o});return m.ok?(g=(await m.json()).components)!=null?g:[]:[]}catch(m){return[]}},getGraph(){return{pageNodes:[],capturedAt:0}},dispose(){var g;G==null||G(),U=!0,s.destroy(),p.destroy(),((g=M.get(e.apiKey))==null?void 0:g.dispose)===q.dispose&&M.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var g;G==null||G(),U=!0,s.destroy(),p.destroy(),l.destroy(),u.clear(),((g=M.get(e.apiKey))==null?void 0:g.dispose)===q.dispose&&M.delete(e.apiKey);try{localStorage.removeItem(oe+e.apiKey),localStorage.removeItem(Ue(e.apiKey)),localStorage.removeItem(Fe(e.apiKey))}catch(m){}e.debug&&console.log("[sentient] destroyed")}};if(M.set(e.apiKey,{config:e,upgrade:null,dispose:q.dispose}),G=qn(q,e.apiKey,g=>{S.then(()=>{U||Rt.add(g)})}),e.debug){let g=window;g.__sentient&&(g.__sentient.client=q)}return q}var Nt="_snt_graph_edges",Yn={pricing:["features","faq"],features:["pricing"],faq:["pricing"],social_proof:["cta"],cta:["social_proof","hero","trust"],hero:["cta"],comparison:["pricing"],trust:["cta"]};function Jn(e){var t;return(t=Yn[e])!=null?t:[]}function Vn(e,t){try{let n=localStorage.getItem(e);return n?JSON.parse(n):t}catch(n){return t}}function Zn(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(n){}}var er=new Set(["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"]);function tr(e){return er.has(e)?e:"generic"}function Xe(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch(t){return"/"}}function nr(e,t,n){let c=`${e}:${t}:${n.join(",")}`,d=5381;for(let a=0;a<c.length;a++)d=(d<<5)+d+c.charCodeAt(a)&4294967295;return(d>>>0).toString(16).padStart(8,"0")}function Lt(e){let t=new Map,n=new Map,c=`_snt_graph_nodes${re(e==null?void 0:e.apiKey)}`,d=()=>{typeof window!="undefined"&&Zn(c,[...t.values()])};if(typeof window!="undefined"){let a=Vn(c,[]);for(let i of a)t.set(i.componentId,i);try{localStorage.removeItem(Nt)}catch(i){}}return{addPageNode(a){t.set(a.componentId,a),d()},addStructuralEdge(a){let i=`${a.fromComponentId}->${a.toComponentId}`;n.set(i,a)},syncOnce(){var i,l;if(!(e!=null&&e.syncUrl)||typeof window=="undefined")return;let a=[...t.values()];if(a.length!==0)try{let u=new Map;for(let p of a){let y=(i=u.get(p.semanticType))!=null?i:[];y.push(p),u.set(p.semanticType,y)}let s=[],r=new Set;for(let p of a)for(let y of Jn(p.semanticType)){let b=(l=u.get(y))!=null?l:[];for(let x of b){if(x.componentId===p.componentId)continue;let E=`semantic:${p.componentId}->${x.componentId}`;r.has(E)||(r.add(E),s.push({fromComponentId:p.componentId,toComponentId:x.componentId,type:"semantic",weight:.4,confidence:.9}))}}let o=new Set(a.map(p=>p.componentId));for(let p of n.values()){if(!o.has(p.fromComponentId)||!o.has(p.toComponentId))continue;let y=`structural:${p.fromComponentId}->${p.toComponentId}`;r.has(y)||(r.add(y),s.push({fromComponentId:p.fromComponentId,toComponentId:p.toComponentId,type:"structural",weight:p.weight,confidence:1}))}let f=H(v(v({pageUrl:Xe(window.location.href)},e.sessionId?{sessionId:e.sessionId}:{}),e.projectId?{projectId:e.projectId}:{}),{nodes:a.map(p=>{let y=tr(p.semanticType);return{componentId:p.componentId,semanticType:y,answers:p.answers,contentHash:nr(p.componentId,y,p.answers),prominenceScore:p.prominenceScore,depthInPage:p.depth}}),edges:s});fetch(e.syncUrl,{method:"POST",keepalive:!0,headers:v({"Content-Type":"application/json"},e.apiKey?{Authorization:`Bearer ${e.apiKey}`}:{}),body:JSON.stringify(f)}).catch(()=>{})}catch(u){}},snapshot(){return{pageNodes:[...t.values()],capturedAt:Date.now()}},destroy(){if(typeof window!="undefined")try{localStorage.removeItem(c),localStorage.removeItem(Nt)}catch(a){}}}}var rr=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function Ye(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function or(e){return{tag:e.tagName.toLowerCase(),text:Ye(e).slice(0,40)}}function Dt(e){return e.replace(/["\\\]]/g,"\\$&")}function Ie(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function Bt(e,t){var i;let n=e.tagName.toLowerCase();if(!n)return null;let c=((i=e.getAttribute("class"))!=null?i:"").split(/\s+/).filter(l=>/^[a-zA-Z][\w-]*$/.test(l)),d=[n,...c.map(l=>`${n}.${l}`)];for(let l of d)if(Ie(t,l))return l;let a=e.parentElement;if(a&&a!==t){let l=Bt(a,t);if(l){for(let o of d){let f=`${l} > ${o}`;if(Ie(t,f))return f}let u=Array.from(a.children).filter(o=>o.tagName.toLowerCase()===n),s=u.indexOf(e),r=u.some(o=>o!==e&&Ye(o)!==Ye(e));if(s>=0&&r){let o=`${l} > ${n}:nth-of-type(${s+1})`;if(Ie(t,o))return o}}}return null}function Ke(e,t){let n=or(e),c=e.getAttribute("id");if(c&&Ie(t,`#${Dt(c)}`))return{v:1,id:c,fingerprint:n};for(let a of rr){let i=e.getAttribute(a);if(i&&Ie(t,`[${a}="${Dt(i)}"]`))return{v:1,dataAttr:{name:a,value:i},fingerprint:n}}let d=Bt(e,t);return d?{v:1,selector:d,fingerprint:n}:null}var Kt=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],sr={banner:"hero",navigation:"navigation",contentinfo:"footer"};function ir(e){let t=e.ariaRole?sr[e.ariaRole.toLowerCase()]:void 0;if(t)return t;if(e.tag==="nav")return"navigation";if(e.tag==="footer")return"footer";if(e.tag==="header")return e.actionCount>=5?"navigation":"hero";let n=`${e.idClass} ${e.headingText}`.toLowerCase();return/\b(navbar|nav-bar|navigation|site-nav|main-nav|topbar|footer)\b/.test(n)?/footer/.test(n)?"footer":"navigation":/\b(hero|masthead|jumbotron)\b/i.test(e.idClass)?"hero":null}function ar(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var cr=[["pricing",/\b(pricing|price list|per month|\/mo|subscriptions?)\b|\bplans?\b(?=[^.]{0,40}(from|start|month|year|[$€£]))/i],["faq",/\bfaq\b|frequently asked|common questions?/i],["comparison",/\b(compare|comparison|versus)\b|\bvs\./i],["social_proof",/\b(reviews?|ratings?|testimonial|brands?|galler(y|ies)|logos)\b|trusted by|loved by|case stud|what our customers say/i],["trust",/\b(insurance|warrant(y|ies)|guarantees?|certifi|accredit|security|privacy|compliance|gdpr|encrypt)\b|why choose|about us|our team/i],["cta",/\b(book|booking|reserve|appointments?|newsletter|subscribe)\b|contact us|get in touch|opening hours/i],["features",/\b(features?|benefits?|capabilit|services?|repairs?|menus?|products?)\b|how it works|our process|what we (do|offer)|what you get/i]],lr=[["pricing",/(?:[$€£]\s?\d[\d,.]*\s*(?:\/|per\s)\s*(?:mo|month|yr|year|seat|user))|(?:\b(?:starter|basic|pro|growth|premium|enterprise)\b[^.]{0,60}[$€£]\s?\d)/i],["social_proof",/(?:★{2,})|(?:\b\d(?:\.\d)?\s*(?:out of|\/)\s*5\b)|(?:\brated\b)|(?:["“][^"”]{20,160}["”]\s*[—–-]\s*[A-Z][a-z]+)/],["trust",/\b(?:money[- ]back guarantee|free returns?|returns? within|refund(?:s)? within|encrypted|soc ?2|iso ?27001|gdpr[- ]compliant|cancel anytime)\b/i],["comparison",/\b(?:vs|versus)\b\.?[^.!?]{0,80}\b(?:compare|comparison|plans?|features?|alternative)\b|\bhow (?:we|it) compares?\b/i]],Mt={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function dr(e){var n;let t=e.querySelector("h1, h2, h3");return((n=t==null?void 0:t.textContent)!=null?n:"").slice(0,160)}function ur(e){var d,a;let t=ir(e);if(t)return{type:(d=Mt[t])!=null?d:"generic",strength:"strong"};let n=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[i,l]of cr)if(l.test(n))return{type:i,strength:"strong"};for(let[i,l]of lr)if(l.test(e.bodyText))return{type:i,strength:"strong"};let c=ar(e);return{type:(a=Mt[c])!=null?a:"generic",strength:"weak"}}function pr(e){var c,d;let t=((c=e.textContent)!=null?c:"").replace(/\s+/g," ").trim(),n=e.getAttribute("role");return v({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((d=e.className)!=null?d:"")}`,headingText:dr(e),bodyText:t.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:t.length},n?{ariaRole:n}:{})}function Gt(e){return ur(pr(e)).type}var gr=new Set(["SECTION","ARTICLE","MAIN","DIV","ASIDE"]),fr="h1, h2, h3",mr="[data-sentient-id], section[aria-label], article[aria-label], main[aria-label], aside[aria-label]",$t=30,yr=1500,hr={scan:async()=>({nodes:[],edges:[],scannedAt:0}),observe:()=>{},getProminenceScore:()=>0,destroy:()=>{}};function Ut(e,t,n){return n<=t?0:Math.max(0,Math.min(1,(e-t)/(n-t)))}function Sr(e){var t,n,c;try{let d=e;for(let a of Object.keys(d)){if(!a.startsWith("__reactFiber")&&!a.startsWith("__reactInternalInstance"))continue;let i=d[a],l=(c=(t=i==null?void 0:i.type)==null?void 0:t.displayName)!=null?c:(n=i==null?void 0:i.type)==null?void 0:n.name;if(l&&l.length>1)return l}}catch(d){}}function br(e){let t={};for(let n of Array.from(e.attributes))n.name.startsWith("data-")&&(t[n.name]=n.value);return t}var Ft=new Set(Kt);function vr(e){let t=e.getAttribute("data-sentient-type");if(t&&Ft.has(t))return t;let n=e.getAttribute("role");return n&&Ft.has(n)?n:Gt(e)}function wr(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 Er(e){let t=[],n=e;for(;n;){let c=n.parentElement;if(!c){t.push(n.tagName.toLowerCase());break}let d=Array.prototype.indexOf.call(c.children,n);t.push(`${n.tagName.toLowerCase()}[${d}]`),n=c}return t.reverse().join("/")}function xr(e){var n;let t=(n=e.getAttribute("data-sentient-id"))!=null?n:e.getAttribute("id");return t||`${e.tagName.toLowerCase()}-${wr(Er(e))}`}function Cr(e){let t=0,n=e.parentElement;for(;n;)t++,n=n.parentElement;return t}function Je(e,t){var c,d,a,i;let n=e.querySelector(fr);return{componentId:xr(e),semanticType:vr(e),ariaLabel:(c=e.getAttribute("aria-label"))!=null?c:void 0,headingText:(a=(d=n==null?void 0:n.textContent)==null?void 0:d.trim())!=null?a:void 0,isAboveFold:e.getBoundingClientRect().top<window.innerHeight,prominenceScore:t(e),depth:Cr(e),reactComponentName:Sr(e),dataAttributes:br(e),locator:(i=Ke(e,e.ownerDocument))!=null?i:void 0}}function jt(e){var a;let t=[],n=new Set,c="__root__",d=new Map;for(let[i,l]of e){let u=i.parentElement,s=c;for(;u;){if(e.has(u)){s=e.get(u);let o=e.get(i),f=`${s}->${o}`;!n.has(f)&&s!==o&&(n.add(f),t.push({fromComponentId:s,toComponentId:o,weight:.6}));break}u=u.parentElement}let r=(a=d.get(s))!=null?a:[];r.push(i),d.set(s,r)}for(let i of d.values()){if(i.length<2)continue;let l=i.length>$t?i.slice(0,$t):i;for(let u=0;u<l.length;u++)for(let s=u+1;s<l.length;s++){if(t.length>=yr)return t;let r=e.get(l[u]),o=e.get(l[s]);if(r===o)continue;let f=`${r}->${o}::sib`,p=`${o}->${r}::sib`;n.has(f)||(n.add(f),t.push({fromComponentId:r,toComponentId:o,weight:.3})),n.has(p)||(n.add(p),t.push({fromComponentId:o,toComponentId:r,weight:.3}))}}return t}function Ir(e){let t=[],n=new Set,c=new Map;return document.querySelectorAll("[data-sentient-id]").forEach(i=>{if(i instanceof Element&&!n.has(i)){n.add(i);let l=Je(i,e);t.push(l),c.set(i,l.componentId)}}),document.querySelectorAll("section, article, main, aside").forEach(i=>{if(!(i instanceof Element)||n.has(i))return;let l=i.hasAttribute("aria-label"),u=i.hasAttribute("data-sentient-id");if(!l&&!u)return;n.add(i);let s=Je(i,e);t.push(s),c.set(i,s.componentId)}),{nodes:t,edges:jt(c),elementToId:c}}function Wt(){if(typeof window=="undefined")return hr;let e=null,t=0,n=null,c=new Map,d=u=>{try{let s=window.getComputedStyle(u),r=parseFloat(s.fontSize)||12,o=parseFloat(s.zIndex)||0,f=u.getBoundingClientRect(),p=Math.max(f.top,0),y=window.innerHeight||1,b=1/(p/y+1),x=Ut(r,12,48)*.4+b*.4+Ut(o,0,100)*.2;return Math.max(0,Math.min(1,x))}catch(s){return .5}};return{scan:()=>new Promise(u=>{let s=()=>{let{nodes:r,edges:o,elementToId:f}=Ir(d);c.clear();for(let[p,y]of f)c.set(p,y);u({nodes:r,edges:o,scannedAt:Date.now()})};try{typeof requestIdleCallback=="function"?t=requestIdleCallback(s,{timeout:100}):s()}catch(r){s()}}),observe:u=>{n=u;try{e=new MutationObserver(s=>{let r=[],o=new Set;for(let p of s)p.type==="childList"&&p.addedNodes.forEach(y=>{if(!(y instanceof Element))return;let b=[];gr.has(y.tagName)&&(y.hasAttribute("data-sentient-id")||y.hasAttribute("aria-label"))&&b.push(y);try{y.querySelectorAll(mr).forEach(x=>b.push(x))}catch(x){}for(let x of b){if(c.has(x))continue;let E=Je(x,d);r.push(E),o.add(E.componentId),c.set(x,E.componentId)}});if(r.length===0||!n)return;for(let p of[...c.keys()])p.isConnected||c.delete(p);let f=jt(c).filter(p=>o.has(p.fromComponentId)||o.has(p.toComponentId));n({nodes:r,edges:f,addedAt:Date.now()})}),e.observe(document.body,{childList:!0,subtree:!0})}catch(s){}},getProminenceScore:d,destroy:()=>{if(e&&(e.disconnect(),e=null),t&&typeof cancelIdleCallback=="function")try{cancelIdleCallback(t)}catch(u){}t=0,n=null,c.clear()}}}var kr="https://api.sentient-ui.com/v1/events";function Tr(e){var n;let t=c=>{try{let d=document.cookie.match(new RegExp(`(?:^|; )${c}=([^;]*)`));return d?decodeURIComponent(d[1]):void 0}catch(d){return}};return(n=e?t(ae(e)):void 0)!=null?n:t(we)}var Ge=new Map;function zt(e){var p;let t=Qe(e),n=e.respectDoNotTrack!==!1&&Ce(),c=e.consent===!1||n,d=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_"),a=e.localMode===!0||!d;if(!e.graph||a||typeof window=="undefined")return t;if(c)return n||_t(e.apiKey,y=>zt(y)),t;let i=Ge.get(e.apiKey);if(i)try{i()}catch(y){}let l=Wt(),u=(p=e.ingestUrl)!=null?p:kr,s=Lt({syncUrl:u.replace(/\/events\/?$/,"/graph/sync"),apiKey:e.apiKey,projectId:e.apiKey,sessionId:Tr(e.apiKey)});l.scan().then(y=>{for(let b of y.nodes)s.addPageNode({id:b.componentId,componentId:b.componentId,semanticType:b.semanticType,answers:e.captureDomText&&b.headingText?[b.headingText]:[],prominenceScore:b.prominenceScore,depth:b.depth});for(let b of y.edges)s.addStructuralEdge(b);s.syncOnce()});let r=null,o=()=>{r!==null&&clearTimeout(r),r=setTimeout(()=>{r=null,s.syncOnce()},500)};l.observe(y=>{for(let b of y.nodes)s.addPageNode({id:b.componentId,componentId:b.componentId,semanticType:b.semanticType,answers:e.captureDomText&&b.headingText?[b.headingText]:[],prominenceScore:b.prominenceScore,depth:b.depth});for(let b of y.edges)s.addStructuralEdge(b);o()});let f=()=>{r!==null&&(clearTimeout(r),r=null),l.destroy(),s.destroy(),Ge.get(e.apiKey)===f&&Ge.delete(e.apiKey)};return Ge.set(e.apiKey,f),H(v({},t),{getGraph:()=>s.snapshot(),dispose:()=>{f(),t.dispose()},destroy:()=>{f(),t.destroy()}})}0&&(module.exports={BLOCK_ALIGNS,BLOCK_EMPHASES,BLOCK_FITS,BLOCK_GAPS,BLOCK_GRID_COLUMNS,BLOCK_HEADING_LEVELS,BLOCK_JUSTIFIES,BLOCK_RATIOS,BLOCK_SIZES,BLOCK_TEXT_ALIGNS,BLOCK_TONES,BLOCK_WEIGHTS,FORM_FIELD_KINDS,FORM_INPUT_TYPES,LEGACY_SESSION_COOKIE_NAME,MAX_BLOCK_ARMS,MAX_BLOCK_CHILDREN,MAX_BLOCK_DEPTH,MAX_BLOCK_NODES,MAX_BLOCK_TEXT_LEN,MAX_FORM_FIELDS,MAX_FORM_SELECT_OPTIONS,SNAPSHOT_STORAGE_KEY_PREFIX,armOfResult,attachMicroSignalDetectors,baselineResultFor,baselineSlots,containsFormBlock,deriveSessionSegment,detectDeviceClass,detectTimeOfDay,detectTrafficSource,grantConsent,init,isDoNotTrackEnabled,locatorFromElement,readSnapshot,referrerDomainFromReferer,renderPrePaintScript,sanitizePageUrl,sessionCookieName,toWireSlot,writeSnapshot});
1
+ "use strict";var Jt=Object.create;var be=Object.defineProperty,Qt=Object.defineProperties,Vt=Object.getOwnPropertyDescriptor,Yt=Object.getOwnPropertyDescriptors,Zt=Object.getOwnPropertyNames,dt=Object.getOwnPropertySymbols,en=Object.getPrototypeOf,pt=Object.prototype.hasOwnProperty,tn=Object.prototype.propertyIsEnumerable;var ut=(e,t,n)=>t in e?be(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,x=(e,t)=>{for(var n in t||(t={}))pt.call(t,n)&&ut(e,n,t[n]);if(dt)for(var n of dt(t))tn.call(t,n)&&ut(e,n,t[n]);return e},q=(e,t)=>Qt(e,Yt(t));var nn=(e,t)=>{for(var n in t)be(e,n,{get:t[n],enumerable:!0})},gt=(e,t,n,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of Zt(t))!pt.call(e,d)&&d!==n&&be(e,d,{get:()=>t[d],enumerable:!(c=Vt(t,d))||c.enumerable});return e};var on=(e,t,n)=>(n=e!=null?Jt(en(e)):{},gt(t||!e||!e.__esModule?be(n,"default",{value:e,enumerable:!0}):n,e)),rn=e=>gt(be({},"__esModule",{value:!0}),e);var Bo={};nn(Bo,{BLOCK_ALIGNS:()=>Tn,BLOCK_EMPHASES:()=>Pn,BLOCK_FITS:()=>Dn,BLOCK_GAPS:()=>kn,BLOCK_GRID_COLUMNS:()=>Bn,BLOCK_HEADING_LEVELS:()=>Mn,BLOCK_JUSTIFIES:()=>_n,BLOCK_MAX_WIDTHS:()=>$n,BLOCK_PADS:()=>Gn,BLOCK_RATIOS:()=>Nn,BLOCK_SIZES:()=>An,BLOCK_SURFACES:()=>Kn,BLOCK_TEXT_ALIGNS:()=>Ln,BLOCK_TONES:()=>On,BLOCK_WEIGHTS:()=>Rn,FORM_FIELD_KINDS:()=>Un,FORM_INPUT_TYPES:()=>Fn,LEGACY_SESSION_COOKIE_NAME:()=>ve,MAX_BLOCK_ARMS:()=>Xn,MAX_BLOCK_CHILDREN:()=>qn,MAX_BLOCK_DEPTH:()=>Hn,MAX_BLOCK_NODES:()=>zn,MAX_BLOCK_TEXT_LEN:()=>Jn,MAX_FORM_FIELDS:()=>jn,MAX_FORM_SELECT_OPTIONS:()=>Wn,SNAPSHOT_STORAGE_KEY_PREFIX:()=>re,armOfResult:()=>Ne,attachMicroSignalDetectors:()=>At,baselineResultFor:()=>ge,baselineSlots:()=>Et,containsFormBlock:()=>_t,deriveSessionSegment:()=>We,detectDeviceClass:()=>ce,detectTimeOfDay:()=>ue,detectTrafficSource:()=>le,grantConsent:()=>Dt,init:()=>Xt,isDoNotTrackEnabled:()=>Ee,locatorFromElement:()=>Ke,readSnapshot:()=>fe,referrerDomainFromReferer:()=>de,renderPrePaintScript:()=>Ct,sanitizePageUrl:()=>Je,sessionCookieName:()=>ie,toWireSlot:()=>we,writeSnapshot:()=>me});module.exports=rn(Bo);function Te(){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)})}function oe(e){return e?`_${e.slice(0,12)}`:""}var ve="_snt_uid";function ie(e){return`${ve}${oe(e)}`}var sn="_snt_uid",an=365,_e="_snt_uid";function cn(){return Te()}function ft(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function ln(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=strict; path=/`}catch(c){}}function $e(e){try{return localStorage.getItem(e)}catch(t){return null}}function mt(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function yt(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function dn(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function un(e){try{sessionStorage.removeItem(e)}catch(t){}}function pn(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=strict; path=/`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function gn(e){try{localStorage.removeItem(e)}catch(t){}}function fn(e){try{document.cookie=`${e}=; max-age=0; SameSite=strict; path=/`}catch(t){}}var mn={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function Ae(e){var y,S,I,C,$,F,R;if(typeof window=="undefined")return mn;let t=oe(e==null?void 0:e.apiKey),n=(y=e==null?void 0:e.cookieName)!=null?y:ie(e==null?void 0:e.apiKey),c=`${_e}${t}`,d=`${_e}_tomb${t}`,i=((S=e==null?void 0:e.cookieTTLDays)!=null?S:an)*24*60*60,l=P=>P&&P.length>0?P:null,u=()=>{var P,O;return t&&!(e!=null&&e.cookieName)&&$e(d)===null?(O=(P=l(ft(sn)))!=null?P:l($e(_e)))!=null?O:l(yt(_e)):null},s=(R=(F=($=(C=(I=l(ft(n)))!=null?I:l($e(c)))!=null?C:l(yt(c)))!=null?$:u())!=null?F:l(e==null?void 0:e.ssrSessionId))!=null?R:cn();ln(n,s,i);let o=mt(c,s),r=pn(n),f=o?!1:dn(c,s),p=!o&&!r&&!f;return{getSessionId:()=>s,isEphemeral:()=>p,destroy:()=>{s=null,fn(n),gn(c),un(c),t&&!(e!=null&&e.cookieName)&&mt(d,"1")}}}function Y(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function ae(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 Re(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let c=JSON.parse(n);return Array.isArray(c)?(localStorage.removeItem(e),c.slice(-t)):[]}catch(n){return[]}}function Z(e,t,n){try{let c=(()=>{try{let a=localStorage.getItem(n);if(!a)return[];let i=JSON.parse(a);return Array.isArray(i)?i:[]}catch(a){return[]}})(),d=new Map;for(let a of c)d.set(a.id,a);for(let a of e)d.set(a.id,a);localStorage.setItem(n,JSON.stringify([...d.values()].slice(-t)))}catch(c){}}function Oe(e,t){try{let n=localStorage.getItem(t);if(!n)return;let c=JSON.parse(n);if(!Array.isArray(c))return;let d=new Set(e),a=c.filter(i=>!d.has(i.id));if(a.length===c.length)return;a.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(a))}catch(n){}}var yn=500,hn=56*1024;function Ue(e){return`_snt_retry_${e.slice(0,12)}`}var Sn={push:()=>{},flush:()=>{},destroy:()=>{}};function ht(e){var X,ee,ye;if(typeof window=="undefined")return Sn;let t=(X=e.flushIntervalMs)!=null?X:5e3,n=(ee=e.maxBatchSize)!=null?ee:20,c=(ye=e.maxRetrySize)!=null?ye:100,d=e.ingestUrl,a=e.apiKey,i=Ue(a),l=[],u=new Set,s=[],o=v=>{for(let E of v)r.delete(E),!u.has(E)&&(u.add(E),s.push(E));for(;s.length>yn;){let E=s.shift();E&&u.delete(E)}Oe(v,i)},r=new Set,f=()=>{for(;l.length>c;){let v=l.shift();v&&r.delete(v.id)}},p=v=>{u.has(v.id)||r.has(v.id)||(r.add(v.id),l.push(v),f())},y=v=>{for(let E of v)u.has(E.id)||(r.add(E.id),l.push(E));f()},S=Re(i,c);for(let v of S)p(v);let I=0,C=0,$=(v,E=!0)=>{if(v.length===0)return;let J=JSON.stringify(v),M=v.map(K=>K.id),z;try{z=fetch(d,{method:"POST",keepalive:!0,body:J,headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`}})}catch(K){Z(v,c,i),y(v),C++,I=Date.now()+Y(C);return}let Ie=K=>{if(ae(K)!=="retry"){if(!K.ok&&E){let te=v.filter(U=>U.eventType!=="pageview");if(te.length>0&&te.length<v.length){o(v.filter(U=>U.eventType==="pageview").map(U=>U.id)),$(te,!1);return}}o(M),C=0,I=0;return}Z(v,c,i),y(v),C++,I=Date.now()+Y(C)};z instanceof Promise?z.then(Ie).catch(()=>{Z(v,c,i),y(v),C++,I=Date.now()+Y(C)}):Ie(z)},F=typeof TextEncoder!="undefined"?new TextEncoder:null,R=v=>F?F.encode(v).length:v.length,P=v=>{let E=[],J=2;for(let M of v){let z=R(JSON.stringify(M))+1;if(E.length>0&&J+z>hn||E.length>=n)break;E.push(M),J+=z}return E},O=()=>{try{if(Date.now()<I)return;for(;l.length>0&&!(Date.now()<I);){let v=l.filter(J=>!u.has(J.id));if(l.length=0,v.length===0)break;let E=P(v);if(E.length===0)break;E.length<v.length&&l.push(...v.slice(E.length)),$(E)}}catch(v){}},h=!0,L=null;L=setInterval(()=>{h&&O()},t);let j=()=>{document.visibilityState==="hidden"&&O()},W=()=>{O()};return document.addEventListener("visibilitychange",j),window.addEventListener("pagehide",W),{push(v){p(v),l.length>=n&&O()},flush:O,destroy(){h=!1,L!==null&&(clearInterval(L),L=null),document.removeEventListener("visibilitychange",j),window.removeEventListener("pagehide",W),O()}}}var bn=200;function Fe(e){return`_snt_goal_retry_${e.slice(0,12)}`}var vn={send:()=>{},flush:()=>{},destroy:()=>{}};function St(e){var R,P,O;if(typeof window=="undefined")return vn;let t=(R=e.flushIntervalMs)!=null?R:5e3,n=(P=e.maxRetrySize)!=null?P:100,c=(O=e.maxPerFlush)!=null?O:5,d=Fe(e.apiKey),a=[],i=new Set,l=new Set,u=[],s=0,o=0,r=!1,f=h=>{for(i.delete(h.id),l.has(h.id)||(l.add(h.id),u.push(h.id));u.length>bn;){let L=u.shift();L&&l.delete(L)}Oe([h.id],d)},p=h=>{Z([h],n,d),!l.has(h.id)&&!i.has(h.id)&&(i.add(h.id),a.push(h)),Date.now()>=s&&(o++,s=Date.now()+Y(o))},y=h=>{let L;try{L=fetch(e.url,{method:"POST",keepalive:!0,body:h.body,headers:e.headers})}catch(W){p(h);return}let j=W=>{var ee;let X=ae(W);if(X==="retry"){p(h);return}X==="dropped"&&((ee=e.onDrop)==null||ee.call(e,h,W.status)),f(h),o=0,s=0};L instanceof Promise?L.then(j).catch(()=>p(h)):j(L)},S=()=>{try{if(r||Date.now()<s)return;let h=0;for(;a.length>0&&h<c&&!(Date.now()<s);){let L=a.shift();i.delete(L.id),!l.has(L.id)&&(h++,y(L))}}catch(h){}},I=Re(d,n);for(let h of I)i.has(h.id)||(i.add(h.id),a.push(h));I.length>0&&Z(I,n,d);let C=setInterval(S,t),$=()=>{document.visibilityState==="hidden"&&S()},F=()=>S();return document.addEventListener("visibilitychange",$),window.addEventListener("pagehide",F),{send(h){if(!r&&!(l.has(h.id)||i.has(h.id))){if(Date.now()<s){Z([h],n,d),i.add(h.id),a.push(h);return}y(h)}},flush:S,destroy(){clearInterval(C),document.removeEventListener("visibilitychange",$),window.removeEventListener("pagehide",F),S(),r=!0}}}var wn=1800*1e3;function Pe(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function bt(e=wn,t){let n=new Map,c=`_snt_asgn${oe(t)}_`,d=(s,o)=>`${c}${encodeURIComponent(s)}:${encodeURIComponent(o)}`,a=s=>{let o=s.slice(c.length),r=o.indexOf(":");if(r<0)return null;try{return{componentId:decodeURIComponent(o.slice(0,r)),segment:decodeURIComponent(o.slice(r+1))}}catch(f){return null}},i=()=>{try{let s=[];for(let o=0;o<localStorage.length;o++){let r=localStorage.key(o);r!=null&&r.startsWith(c)&&s.push(r)}return s}catch(s){return[]}},l=s=>s.assignedAt+(s.ttlMs&&s.ttlMs>0?s.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let s of i())try{let o=localStorage.getItem(s);if(!o)continue;let r=JSON.parse(o);if(l(r)){localStorage.removeItem(s);continue}let f=a(s);if(!f)continue;n.set(Pe(f.componentId,f.segment),r)}catch(o){}})(),{get(s,o){let r=n.get(Pe(s,o));return r?l(r)?(n.delete(Pe(s,o)),null):r:null},set(s,o,r){let f=Pe(s,o);n.set(f,r);try{localStorage.setItem(d(s,o),JSON.stringify(r))}catch(p){}},clear(){n.clear();for(let s of i())try{localStorage.removeItem(s)}catch(o){}}}}var vt=["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 Le(e){return wt(e)!==null}function wt(e){var n;if(!e)return null;let t=e.toLowerCase();return(n=vt.find(c=>t.includes(c.toLowerCase())))!=null?n:null}function ce(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 le(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(d){}let c=n.hostname.toLowerCase();return/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(c)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(c)?"social":"referral"}catch(n){return"direct"}}function de(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var xt=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function je(e){let t={},n={};try{let c=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([d,a])=>{let i=Array.isArray(a)?a[0]:a;return i===void 0?[]:[[d,i]]});for(let[d,a]of c)d.startsWith("utm_")?d in t||(t[d]=a):xt.includes(d)&&(d in n||(n[d]=a))}catch(c){}return{utmParams:t,clickIds:n}}function ue(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function We(e){let t=xn("__segment__",e);return`${t.deviceClass}:${t.trafficSource}`}function xn(e,t){var a,i,l,u,s,o,r,f;let n=(i=(a=t==null?void 0:t.userAgent)==null?void 0:a.trim())!=null?i:"",c=(u=(l=t==null?void 0:t.referer)==null?void 0:l.trim())!=null?u:"",d=(s=t==null?void 0:t.now)!=null?s:new Date;return{sessionId:e,ephemeral:!1,utmParams:(o=t==null?void 0:t.utmParams)!=null?o:{},clickIds:(r=t==null?void 0:t.clickIds)!=null?r:{},deviceClass:n?ce(n):"desktop",trafficSource:c?le(c,t==null?void 0:t.appOrigin):"direct",referrerDomain:de(c),timeOfDay:ue(d),dayOfWeek:(f=["sun","mon","tue","wed","thu","fri","sat"][d.getDay()])!=null?f:"sun",automation:(t==null?void 0:t.webdriver)===!0||Le(n)}}var pe=require("@sentientui/policy");function we(e){return x(x(x({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 ge(e){let t=we(e);return(0,pe.slotResultFor)(t,(0,pe.slotBaselineArm)(t))}function Et(e){let t={};for(let n of e)t[n.id]=ge(n);return t}function Ne(e){return typeof e=="string"?e:(0,pe.canonicalArm)(e)}var re="_snt_snap:",En=["low","medium","high"];function fe(e){try{let t=localStorage.getItem(re+e);if(!t)return null;let n=JSON.parse(t);return!n||typeof n!="object"||n.v!==1||typeof n.persona!="string"||typeof n.band!="string"||!En.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"||!(n.slotConfig===void 0||typeof n.slotConfig=="object"&&n.slotConfig!==null&&!Array.isArray(n.slotConfig))?null:n}catch(t){return null}}function me(e,t){try{localStorage.setItem(re+e,JSON.stringify(t))}catch(n){}}function Ct(e){return"(function(){try{var r=localStorage.getItem("+JSON.stringify(re+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;var d=document.documentElement;if(d.hasAttribute("data-sentient-persona"))return;d.setAttribute("data-sentient-persona",s.persona);d.setAttribute("data-sentient-confidence",s.band);}catch(e){}})();'}var He=require("@sentientui/policy");var Be=require("@sentientui/policy");var It="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",Cn="[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.",kt=!1,De=!1;function In(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function Tt(e){var s;let t=Ae({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),n=(s=t.getSessionId())!=null?s:"local",c=In(),d=import("@sentientui/core/local").then(o=>{let r=o;return r.LOCAL_ENGINE_AVAILABLE?(kt||(kt=!0,console.info(Cn)),r):(De||(De=!0,console.error(It)),null)}).catch(()=>(De||(De=!0,console.error(It)),null)),a=null,i={low:.15,medium:.5,high:.85},l=(()=>{var r;if(e.initialPersona)return x({},e.initialPersona);let o=fe(e.apiKey||"local");return o?{persona:o.persona,confidence:(r=i[o.band])!=null?r:.15}:null})();function u(o){let r=document.documentElement;r.dataset.sentientPersona===void 0&&(r.dataset.sentientPersona=o.persona,r.dataset.sentientConfidence=(0,Be.confidenceBand)(o.confidence))}return{isLocal:!0,async decide(o){var p,y,S;let r=await d;if(!r)return null;let f=r.createLocalEngine({sessionId:n,forcedPersona:c}).decide(o);return a=q(x({},f),{layoutOrder:(y=(p=f.layoutOrder)!=null?p:a==null?void 0:a.layoutOrder)!=null?y:null,slots:x(x({},(S=a==null?void 0:a.slots)!=null?S:{}),f.slots)}),me(e.apiKey||"local",{v:1,persona:a.persona,band:(0,Be.confidenceBand)(a.confidence),slots:a.slots,layoutOrder:a.layoutOrder,savedAt:Date.now()}),u(f),f},getSlotResult(o){var r,f,p;return(p=(f=a==null?void 0:a.slots[o])!=null?f:(r=e.initialSlots)==null?void 0:r[o])!=null?p:null},getSlotConfig(o){var r,f;return(f=(r=e.initialSlotConfig)==null?void 0:r[o])!=null?f:null},getSitePalette(){var o;return(o=e.initialPalette)!=null?o:null},reportSlots(){},getPersona(){let o=a!=null?a:l;return o?{persona:o.persona,confidence:o.confidence,band:(0,Be.confidenceBand)(o.confidence)}:null},async assign(o,r){var y;let f=await d;return!f||!r||r.length===0?r!=null&&r[0]?{variantId:r[0],assignmentTtlMs:0}:null:{variantId:(y=f.createLocalEngine({sessionId:n,forcedPersona:c}).decide({components:[{id:o,variantIds:r}]}).assignments[o])!=null?y:r[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>t.destroy()}}var kn=["none","sm","md","lg"],Tn=["start","center","end","stretch"],_n=["start","center","end","between"],An=["sm","md","lg"],Rn=["normal","medium","bold"],On=["default","muted","accent"],Pn=["primary","secondary","ghost"],Ln=["left","center","right"],Nn=["auto","square","landscape","wide"],Dn=["cover","contain"],Bn=[2,3,4],Mn=[2,3,4],Kn=["default","raised"],Gn=["none","sm","md","lg"],$n=["measure"],Un=["input","textarea","select"],Fn=["text","email","number","tel"],jn=5,Wn=8,zn=64,Hn=5,qn=12,Xn=4,Jn=500;function _t(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(_t):!1}function At(e,t,n,c){let d=[];{let l=!1,u=[],s=()=>{if(l)return;let o=Date.now();for(u.push(o);u.length>0&&o-u[0]>500;)u.shift();u.length>=3&&(l=!0,e("rage_click"))};t.addEventListener("click",s),d.push(()=>t.removeEventListener("click",s))}{let a=!1,i=l=>{if(a||!(l.target instanceof Node)||!t.contains(l.target)&&t!==l.target)return;a=!0;let u=typeof window!="undefined"?window.getSelection():null,s=u?u.toString().length:0;e("text_copy",{selectionLength:s})};document.addEventListener("copy",i),d.push(()=>document.removeEventListener("copy",i))}{let a=!1,i=!1,l=null,u=()=>{l!==null&&(clearTimeout(l),l=null)},s=()=>{a||!i||(u(),l=setTimeout(()=>{!a&&i&&(a=!0,e("scroll_hesitation"))},3e3))},o=()=>{u(),s()},r=p=>{for(let y of p)i=y.intersectionRatio>.3,i?s():u()},f=new IntersectionObserver(r,{threshold:[.3]});f.observe(t),window.addEventListener("scroll",o,{passive:!0}),d.push(()=>{f.disconnect(),window.removeEventListener("scroll",o),u()})}if((c==null?void 0:c.tabLoss)!==!1){let a=!1,i=n!=null?n:Date.now(),l=()=>{if(a||document.visibilityState!=="hidden")return;let u=Date.now()-i;u<15e3&&(a=!0,e("tab_loss",{timeOnPage:u}))};document.addEventListener("visibilitychange",l),d.push(()=>document.removeEventListener("visibilitychange",l))}return()=>{for(let a of d)a()}}function Qn(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var Rt="https://api.sentient-ui.com/v1/events",G=new Map,Ot=null;function Pt(e,t){let n=G.get(e);n&&n.upgrade&&(n.reinit=t)}function Vn(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var Yn=3;function ze(){return Te()}function Me(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function Zn(){let e=new WeakMap,t=new Map,n=!1,c=(l,u,s)=>{let o=l.get(u);return s===null?o?!0:(l.set(u,new Set),!1):o?o.has(s)?!0:(o.add(s),!1):(l.set(u,new Set([s])),!1)},d=typeof window!="undefined"&&"event"in window,a=()=>{if(!d)return;let l=window.event;return typeof Event=="function"&&l instanceof Event?l:void 0},i=()=>{if(d){Promise.resolve().then(()=>{n=!1,t.clear()});return}let l=!1,u=()=>{l||(l=!0,n=!1,t.clear())};if(setTimeout(u,0),typeof MessageChannel=="function"){let s=new MessageChannel;s.port1.onmessage=()=>{s.port1.close(),s.port2.close(),u()},s.port2.postMessage(0)}};return{firedBefore(l,u){let s=a();if(s){let r=e.get(s);return r||(r=new Map,e.set(s,r)),c(r,l,u)}let o=c(t,l,u);return!o&&!n&&(n=!0,i()),o}}}var Lt=new Set;function eo(e,t,n){let c=typeof window=="undefined"?null:window.history;if(!c)return()=>{};let d=!1,a,i=()=>{if(d)return;let s=Me();!s||s===a||(a=s,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${s}`))},l=[];for(let s of["pushState","replaceState"]){let o=c[s],r=function(...f){let p=o.apply(this,f);return i(),p};c[s]=r,l.push([s,o,r])}window.addEventListener("popstate",i);let u=Me();return u&&Lt.has(`${t}:${u}`)?a=u:i(),()=>{if(!d){d=!0,window.removeEventListener("popstate",i);for(let[s,o,r]of l)c[s]===r&&(c[s]=o)}}}var xe={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>{}};function to(){try{return je(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function Nt(e){return e.replace(/\/events\/?$/,"")}function Ee(){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 Dt(e){var u;if(typeof window=="undefined")return;let t=e!=null?e:Ot;if(!t){console.warn("[sentient] grantConsent() called before init()");return}let n=G.get(t);if(!n){console.warn("[sentient] grantConsent() called before init()");return}let{config:c,upgrade:d,reinit:a}=n;if(!d){n.upgradeBlockedReason&&console.warn(n.upgradeBlockedReason);return}if(c.respectDoNotTrack!==!1&&Ee())return;let i=(a!=null?a:Xe)(q(x({},c),{consent:!0}));d(i);let l=(u=G.get(t))==null?void 0:u.dispose;G.set(t,{config:q(x({},c),{consent:!0}),upgrade:null,dispose:l})}function no(e){var s;let t=e.preConsentBehavior==="statistical_winner",n=Nt((s=e.ingestUrl)!=null?s:Rt),c={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},d=new Map,a=new Map,i={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(o,r,f){if(!t)return Promise.resolve(null);let p=d.get(o);return p?Promise.resolve(p):qe(a,o,async()=>{try{let y=new URLSearchParams({componentId:o});for(let $ of r!=null?r:[])y.append("variantIds[]",$);let S=await fetch(`${n}/winner?${y.toString()}`,{headers:c});if(!S.ok)return r!=null&&r[0]?{variantId:r[0],assignmentTtlMs:0}:null;let C={variantId:(await S.json()).variantId,assignmentTtlMs:0};return d.set(o,C),C}catch(y){return r!=null&&r[0]?{variantId:r[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>{}},l={track:o=>i.track(o),goal:((o,r,f,p)=>i.goal(o,r,f,p)),componentGoal:(o,r,f)=>i.componentGoal(o,r,f),identify:o=>i.identify(o),getAssignment:(o,r)=>i.getAssignment(o,r),assign:(o,r,f,p)=>i.assign(o,r,f,p),decide:o=>i.decide(o),getSlotResult:o=>i.getSlotResult(o),getSlotConfig:o=>i.getSlotConfig(o),getSitePalette:()=>i.getSitePalette(),reportSlots:(o,r)=>i.reportSlots(o,r),getPersona:()=>i.getPersona(),fetchWeights:()=>i.fetchWeights(),getGraph:()=>i.getGraph(),dispose:()=>i.dispose(),destroy:()=>i.destroy()};function u(o){i=o}return{proxy:l,setInner:u}}function qe(e,t,n){let c=e.get(t);if(c)return c;let d=(async()=>{try{return await n()}finally{e.delete(t)}})();return e.set(t,d),d}function Xe(e){var Ye,Ze,et,tt,nt,ot,rt,st,it,at;if(typeof window=="undefined")return xe;Ot=e.apiKey||"local";let t=G.get(e.apiKey||"local");if(t!=null&&t.dispose)try{t.dispose()}catch(g){}let n=e.respectDoNotTrack!==!1&&Ee(),c=e.consent===!1||n,d=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!d&&e.localMode!==!1)return G.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."}),c?xe:Tt(e);if(c){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."),G.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."}),xe;let{proxy:g,setInner:m}=no(e);return G.set(e.apiKey,{config:e,upgrade:n?null:m}),g}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."),xe;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),xe;let a=(Ye=e.ingestUrl)!=null?Ye:Rt,i=Date.now(),l=Ae({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),u=bt(void 0,e.apiKey),s=ht({ingestUrl:a,apiKey:e.apiKey}),o=Nt(a),r={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},f=new Set,p=St({url:`${o}/goals`,apiKey:e.apiKey,headers:r,onDrop:(g,m)=>{if(!e.debug){if(f.has(m))return;f.add(m)}console.warn(`[sentient] goal dropped (HTTP ${m}) \u2014 this will not be retried. `+(m===400?"The session was not found: call init() and let the session upsert complete before firing goals.":m===401||m===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),g)}}),y=ce((Ze=navigator.userAgent)!=null?Ze:""),S=window.location.origin,I=le((et=document.referrer)!=null?et:"",S),C=(tt=e.sessionSegment)!=null?tt:`${y}:${I}`,$=new Map,F=new Map,R=new Map,P=new Map,O=null,h=null,L=new Set,j=new Set,W=new Map,X=null,ee=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,ye=new Set,v=g=>{for(let m of g)R.has(m.id)||R.set(m.id,ge(m))};if(e.initialSlots)for(let[g,m]of Object.entries(e.initialSlots))R.set(g,m);if(e.initialSlotConfig)for(let[g,m]of Object.entries(e.initialSlotConfig))P.set(g,m);e.initialPalette&&(O=e.initialPalette);let E=fe(e.apiKey);if(E){for(let[g,m]of Object.entries(E.slots))R.has(g)||R.set(g,m);for(let[g,m]of Object.entries((nt=E.slotConfig)!=null?nt:{}))P.has(g)||P.set(g,m);!O&&E.palette&&(O=E.palette)}let J={low:.15,medium:.5,high:.85};if(e.initialPersona)h=x({},e.initialPersona);else{let g=document.documentElement.dataset;g.sentientPersona?h={persona:g.sentientPersona,confidence:(rt=J[(ot=g.sentientConfidence)!=null?ot:"low"])!=null?rt:.15}:E&&(h={persona:E.persona,confidence:(st=J[E.band])!=null?st:.15})}if(e.initialAssignments)for(let[g,m]of Object.entries(e.initialAssignments))u.set(g,C,{variantId:m,assignedAt:Date.now(),segment:C,confidence:1});let M=Promise.resolve(),z=l.getSessionId();if(z){let g=de((it=document.referrer)!=null?it:""),{utmParams:m,clickIds:b}=to(),k=x(x(x(x({sessionId:z,deviceClass:y,trafficSource:I,referrerDomain:g,utmParams:m,clickIds:b,timeOfDay:ue(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:l.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||Le((at=navigator.userAgent)!=null?at:"")},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}:{}),A=async()=>{for(let w=0;;w++){try{let _=await fetch(`${o}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(k),headers:r});if(_.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(_.ok||ae(_)==="dropped")return}catch(_){}if(w>=Yn){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(_=>setTimeout(_,Y(w+1)))}};try{M=A()}catch(w){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:s});let Ie=Zn(),K=null,te=!1,U={goal(g,m={},b=1,k=0){var he,Se,se,T,Q,ke,N;let A=l.getSessionId();if(!A)return;let w=Vn(m)?m:{metadata:m},_=[g,(he=w.externalId)!=null?he:"",(Se=w.stepIndex)!=null?Se:k,(se=w.weight)!=null?se:b].join("\0"),D=w.value!==void 0?`${w.value}\0${(T=w.currency)!=null?T:""}`:null;if(Ie.firedBefore(_,D)){e.debug&&console.log(`[sentient] goal("${g}") already recorded for this action \u2014 not sent twice`);return}let B=ze(),V={sessionId:A,name:g,metadata:(Q=w.metadata)!=null?Q:{},weight:(ke=w.weight)!=null?ke:b,stepIndex:(N=w.stepIndex)!=null?N:k,goalId:B,value:w.value,currency:w.currency,externalId:w.externalId};e.debug&&console.log("[sentient] goal",V);let ne={id:B,body:JSON.stringify(V)};M.then(()=>p.send(ne))},componentGoal(g,m,b){var B,V,ne;let k=l.getSessionId();if(!k)return;let A=u.get(g,C),w=A?null:(B=R.get(g))!=null?B:null;if(!A&&w===null){e.debug&&console.warn(`[sentient] componentGoal("${g}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}let _=A?A.variantId:Ne(w),D={id:ze(),sessionId:k,projectId:e.apiKey,componentId:g,variantId:_,eventType:"goal_achieved",goalType:m,payload:x({reward:(V=b==null?void 0:b.reward)!=null?V:1,goalValue:b==null?void 0:b.value,currency:b==null?void 0:b.currency},(ne=b==null?void 0:b.metadata)!=null?ne:{}),timestamp:Date.now(),timeInSession:Date.now()-i,path:Me()};e.debug&&console.log("[sentient] componentGoal",D),M.then(()=>s.push(D))},identify(g){let m=l.getSessionId();m&&M.then(()=>{fetch(`${o}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:m,userId:g,ephemeral:l.isEphemeral()}),headers:r}).catch(()=>{})})},track(g){let m=l.getSessionId();if(!m)return;let b=q(x({path:Me()},g),{id:ze(),sessionId:m,timestamp:Date.now(),timeInSession:Date.now()-i});e.debug&&console.log("[sentient] track",b),M.then(()=>s.push(b))},getAssignment(g,m){return u.get(g,m)},async assign(g,m,b,k){let A=l.getSessionId();if(!A)return null;let w=u.get(g,C);if(w&&(m!=null&&m.length||w.content!==void 0)){let _=w.ttlMs&&w.ttlMs>0?Math.max(0,w.assignedAt+w.ttlMs-Date.now()):0;return{variantId:w.variantId,assignmentTtlMs:_,content:w.content}}return qe($,g,async()=>{await M;try{let _={sessionId:A,componentId:g,variantIds:m};k!==void 0?_.agentDataByVariant=k:b!==void 0&&(_.agentData=b);let D=await fetch(`${o}/assign`,{method:"POST",body:JSON.stringify(_),headers:r});if(!D.ok)return null;let B=await D.json();return u.set(g,C,x({variantId:B.variantId,assignedAt:Date.now(),segment:C,confidence:1,content:B.content},B.assignmentTtlMs&&B.assignmentTtlMs>0?{ttlMs:B.assignmentTtlMs}:{})),B}catch(_){return null}})},async decide(g){var w,_;let m=l.getSessionId();if(!m)return null;let b=(w=g.slots)!=null?w:[],k={sessionId:m};g.sections&&g.sections.length>0&&(k.sections=g.sections.map(D=>({id:D}))),k.components=(_=g.components)!=null?_:[],b.length>0&&(k.slots=b.map(we)),g.slotsFrom==="registry"&&(k.slotsFrom="registry"),g.v&&(k.v=g.v),typeof g.pp=="number"&&(k.pp=g.pp),e.persona&&(k.persona=e.persona);let A=JSON.stringify(k);return qe(F,A,async()=>{var D,B,V,ne,he,Se;await M;try{let se=await fetch(`${o}/decide`,{method:"POST",body:A,headers:r});if(!se.ok)return v(b),null;let T=await se.json(),Q={};for(let N of b){let H=(D=T.slots)==null?void 0:D[N.id];if(H!==void 0){Q[N.id]=H,R.set(N.id,H);continue}let ct=R.get(N.id);if(ct!==void 0)Q[N.id]=ct;else{let lt=ge(N);Q[N.id]=lt,R.set(N.id,lt)}}if(T.slots)for(let[N,H]of Object.entries(T.slots))N in Q||(Q[N]=H,R.set(N,H));let ke=h!=null&&h.persona!=="unknown";T.persona&&!(T.persona==="unknown"&&ke)?h={persona:T.persona,confidence:(B=T.confidence)!=null?B:0}:h||(h={persona:"unknown",confidence:0});for(let[N,H]of Object.entries((V=T.assignments)!=null?V:{}))u.set(N,C,{variantId:H,assignedAt:Date.now(),segment:C,confidence:1});if(T.slotConfig)for(let[N,H]of Object.entries(T.slotConfig))P.set(N,H);return T.palette&&(O=T.palette),me(e.apiKey,x(x({v:1,persona:h.persona,band:(0,He.confidenceBand)(h.confidence),slots:Object.fromEntries(R),layoutOrder:(ne=T.layoutOrder)!=null?ne:null,savedAt:Date.now()},P.size>0?{slotConfig:Object.fromEntries(P)}:{}),O?{palette:O}:{})),x(x(x(x({layoutOrder:(he=T.layoutOrder)!=null?he:null,assignments:(Se=T.assignments)!=null?Se:{},slots:Q,persona:h.persona,confidence:h.confidence},T.slotConfig?{slotConfig:T.slotConfig}:{}),T.goals?{goals:T.goals}:{}),T.sectionMap?{sectionMap:T.sectionMap}:{}),T.palette?{palette:T.palette}:{})}catch(se){return v(b),null}})},getSlotResult(g){var m;return(m=R.get(g))!=null?m:null},getSlotConfig(g){var m;return(m=P.get(g))!=null?m:null},reportSlots(g,m){for(let b of g)if(!(typeof b!="string"||b.length===0)){if(!ee.test(b)){Qn()&&!ye.has(b)&&(ye.add(b),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(b)} 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(!L.has(b)){L.add(b),j.add(b);let k=m==null?void 0:m[b];if(typeof k=="string"){let A=k.replace(/\s+/g," ").trim().slice(0,400);A!==""&&W.set(b,A)}}}j.size===0||X!=null||(X=setTimeout(()=>{X=null;let b=[...j];j.clear();for(let k=0;k<b.length;k+=20){let A=b.slice(k,k+20),w={};for(let _ of A){let D=W.get(_);D!==void 0&&(w[_]=D,W.delete(_))}fetch(`${o}/slots/observed`,{method:"POST",headers:r,body:JSON.stringify(x({slotIds:A},Object.keys(w).length>0?{baselineTexts:w}:{}))}).catch(()=>{})}},1e3))},getSitePalette(){return O},getPersona(){return h?{persona:h.persona,confidence:h.confidence,band:(0,He.confidenceBand)(h.confidence)}:null},async fetchWeights(){var g;try{let m=await fetch(`${o}/weights`,{headers:r});return m.ok?(g=(await m.json()).components)!=null?g:[]:[]}catch(m){return[]}},getGraph(){return{pageNodes:[],capturedAt:0}},dispose(){var g;K==null||K(),te=!0,s.destroy(),p.destroy(),((g=G.get(e.apiKey))==null?void 0:g.dispose)===U.dispose&&G.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var g;K==null||K(),te=!0,s.destroy(),p.destroy(),l.destroy(),u.clear(),((g=G.get(e.apiKey))==null?void 0:g.dispose)===U.dispose&&G.delete(e.apiKey);try{localStorage.removeItem(re+e.apiKey),localStorage.removeItem(Ue(e.apiKey)),localStorage.removeItem(Fe(e.apiKey))}catch(m){}e.debug&&console.log("[sentient] destroyed")}};if(G.set(e.apiKey,{config:e,upgrade:null,dispose:U.dispose}),K=eo(U,e.apiKey,g=>{M.then(()=>{te||Lt.add(g)})}),e.debug){let g=window;g.__sentient&&(g.__sentient.client=U)}return U}var Bt="_snt_graph_edges",oo={pricing:["features","faq"],features:["pricing"],faq:["pricing"],social_proof:["cta"],cta:["social_proof","hero","trust"],hero:["cta"],comparison:["pricing"],trust:["cta"]};function ro(e){var t;return(t=oo[e])!=null?t:[]}function so(e,t){try{let n=localStorage.getItem(e);return n?JSON.parse(n):t}catch(n){return t}}function io(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(n){}}var ao=new Set(["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"]);function co(e){return ao.has(e)?e:"generic"}function Je(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch(t){return"/"}}function lo(e,t,n){let c=`${e}:${t}:${n.join(",")}`,d=5381;for(let a=0;a<c.length;a++)d=(d<<5)+d+c.charCodeAt(a)&4294967295;return(d>>>0).toString(16).padStart(8,"0")}function Mt(e){let t=new Map,n=new Map,c=`_snt_graph_nodes${oe(e==null?void 0:e.apiKey)}`,d=()=>{typeof window!="undefined"&&io(c,[...t.values()])};if(typeof window!="undefined"){let a=so(c,[]);for(let i of a)t.set(i.componentId,i);try{localStorage.removeItem(Bt)}catch(i){}}return{addPageNode(a){t.set(a.componentId,a),d()},addStructuralEdge(a){let i=`${a.fromComponentId}->${a.toComponentId}`;n.set(i,a)},syncOnce(){var i,l;if(!(e!=null&&e.syncUrl)||typeof window=="undefined")return;let a=[...t.values()];if(a.length!==0)try{let u=new Map;for(let p of a){let y=(i=u.get(p.semanticType))!=null?i:[];y.push(p),u.set(p.semanticType,y)}let s=[],o=new Set;for(let p of a)for(let y of ro(p.semanticType)){let S=(l=u.get(y))!=null?l:[];for(let I of S){if(I.componentId===p.componentId)continue;let C=`semantic:${p.componentId}->${I.componentId}`;o.has(C)||(o.add(C),s.push({fromComponentId:p.componentId,toComponentId:I.componentId,type:"semantic",weight:.4,confidence:.9}))}}let r=new Set(a.map(p=>p.componentId));for(let p of n.values()){if(!r.has(p.fromComponentId)||!r.has(p.toComponentId))continue;let y=`structural:${p.fromComponentId}->${p.toComponentId}`;o.has(y)||(o.add(y),s.push({fromComponentId:p.fromComponentId,toComponentId:p.toComponentId,type:"structural",weight:p.weight,confidence:1}))}let f=q(x(x({pageUrl:Je(window.location.href)},e.sessionId?{sessionId:e.sessionId}:{}),e.projectId?{projectId:e.projectId}:{}),{nodes:a.map(p=>{let y=co(p.semanticType);return{componentId:p.componentId,semanticType:y,answers:p.answers,contentHash:lo(p.componentId,y,p.answers),prominenceScore:p.prominenceScore,depthInPage:p.depth}}),edges:s});fetch(e.syncUrl,{method:"POST",keepalive:!0,headers:x({"Content-Type":"application/json"},e.apiKey?{Authorization:`Bearer ${e.apiKey}`}:{}),body:JSON.stringify(f)}).catch(()=>{})}catch(u){}},snapshot(){return{pageNodes:[...t.values()],capturedAt:Date.now()}},destroy(){if(typeof window!="undefined")try{localStorage.removeItem(c),localStorage.removeItem(Bt)}catch(a){}}}}var uo=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function Qe(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function po(e){return{tag:e.tagName.toLowerCase(),text:Qe(e).slice(0,40)}}function Kt(e){return e.replace(/["\\\]]/g,"\\$&")}function Ce(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function Gt(e,t){var i;let n=e.tagName.toLowerCase();if(!n)return null;let c=((i=e.getAttribute("class"))!=null?i:"").split(/\s+/).filter(l=>/^[a-zA-Z][\w-]*$/.test(l)),d=[n,...c.map(l=>`${n}.${l}`)];for(let l of d)if(Ce(t,l))return l;let a=e.parentElement;if(a&&a!==t){let l=Gt(a,t);if(l){for(let r of d){let f=`${l} > ${r}`;if(Ce(t,f))return f}let u=Array.from(a.children).filter(r=>r.tagName.toLowerCase()===n),s=u.indexOf(e),o=u.some(r=>r!==e&&Qe(r)!==Qe(e));if(s>=0&&o){let r=`${l} > ${n}:nth-of-type(${s+1})`;if(Ce(t,r))return r}}}return null}function Ke(e,t){let n=po(e),c=e.getAttribute("id");if(c&&Ce(t,`#${Kt(c)}`))return{v:1,id:c,fingerprint:n};for(let a of uo){let i=e.getAttribute(a);if(i&&Ce(t,`[${a}="${Kt(i)}"]`))return{v:1,dataAttr:{name:a,value:i},fingerprint:n}}let d=Gt(e,t);return d?{v:1,selector:d,fingerprint:n}:null}var Ut=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],go={banner:"hero",navigation:"navigation",contentinfo:"footer"};function fo(e){let t=e.ariaRole?go[e.ariaRole.toLowerCase()]:void 0;if(t)return t;if(e.tag==="nav")return"navigation";if(e.tag==="footer")return"footer";if(e.tag==="header")return e.actionCount>=5?"navigation":"hero";let n=`${e.idClass} ${e.headingText}`.toLowerCase();return/\b(navbar|nav-bar|navigation|site-nav|main-nav|topbar|footer)\b/.test(n)?/footer/.test(n)?"footer":"navigation":/\b(hero|masthead|jumbotron)\b/i.test(e.idClass)?"hero":null}function mo(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var yo=[["pricing",/\b(pricing|price list|per month|\/mo|subscriptions?)\b|\bplans?\b(?=[^.]{0,40}(from|start|month|year|[$€£]))/i],["faq",/\bfaq\b|frequently asked|common questions?/i],["comparison",/\b(compare|comparison|versus)\b|\bvs\./i],["social_proof",/\b(reviews?|ratings?|testimonial|brands?|galler(y|ies)|logos)\b|trusted by|loved by|case stud|what our customers say/i],["trust",/\b(insurance|warrant(y|ies)|guarantees?|certifi|accredit|security|privacy|compliance|gdpr|encrypt)\b|why choose|about us|our team/i],["cta",/\b(book|booking|reserve|appointments?|newsletter|subscribe)\b|contact us|get in touch|opening hours/i],["features",/\b(features?|benefits?|capabilit|services?|repairs?|menus?|products?)\b|how it works|our process|what we (do|offer)|what you get/i]],ho=[["pricing",/(?:[$€£]\s?\d[\d,.]*\s*(?:\/|per\s)\s*(?:mo|month|yr|year|seat|user))|(?:\b(?:starter|basic|pro|growth|premium|enterprise)\b[^.]{0,60}[$€£]\s?\d)/i],["social_proof",/(?:★{2,})|(?:\b\d(?:\.\d)?\s*(?:out of|\/)\s*5\b)|(?:\brated\b)|(?:["“][^"”]{20,160}["”]\s*[—–-]\s*[A-Z][a-z]+)/],["trust",/\b(?:money[- ]back guarantee|free returns?|returns? within|refund(?:s)? within|encrypted|soc ?2|iso ?27001|gdpr[- ]compliant|cancel anytime)\b/i],["comparison",/\b(?:vs|versus)\b\.?[^.!?]{0,80}\b(?:compare|comparison|plans?|features?|alternative)\b|\bhow (?:we|it) compares?\b/i]],$t={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function So(e){var n;let t=e.querySelector("h1, h2, h3");return((n=t==null?void 0:t.textContent)!=null?n:"").slice(0,160)}function bo(e){var d,a;let t=fo(e);if(t)return{type:(d=$t[t])!=null?d:"generic",strength:"strong"};let n=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[i,l]of yo)if(l.test(n))return{type:i,strength:"strong"};for(let[i,l]of ho)if(l.test(e.bodyText))return{type:i,strength:"strong"};let c=mo(e);return{type:(a=$t[c])!=null?a:"generic",strength:"weak"}}function vo(e){var c,d;let t=((c=e.textContent)!=null?c:"").replace(/\s+/g," ").trim(),n=e.getAttribute("role");return x({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((d=e.className)!=null?d:"")}`,headingText:So(e),bodyText:t.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:t.length},n?{ariaRole:n}:{})}function Ft(e){return bo(vo(e)).type}var wo=new Set(["SECTION","ARTICLE","MAIN","DIV","ASIDE"]),xo="h1, h2, h3",Eo="[data-sentient-id], section[aria-label], article[aria-label], main[aria-label], aside[aria-label]",jt=30,Co=1500,Io={scan:async()=>({nodes:[],edges:[],scannedAt:0}),observe:()=>{},getProminenceScore:()=>0,destroy:()=>{}};function Wt(e,t,n){return n<=t?0:Math.max(0,Math.min(1,(e-t)/(n-t)))}function ko(e){var t,n,c;try{let d=e;for(let a of Object.keys(d)){if(!a.startsWith("__reactFiber")&&!a.startsWith("__reactInternalInstance"))continue;let i=d[a],l=(c=(t=i==null?void 0:i.type)==null?void 0:t.displayName)!=null?c:(n=i==null?void 0:i.type)==null?void 0:n.name;if(l&&l.length>1)return l}}catch(d){}}function To(e){let t={};for(let n of Array.from(e.attributes))n.name.startsWith("data-")&&(t[n.name]=n.value);return t}var zt=new Set(Ut);function _o(e){let t=e.getAttribute("data-sentient-type");if(t&&zt.has(t))return t;let n=e.getAttribute("role");return n&&zt.has(n)?n:Ft(e)}function Ao(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 Ro(e){let t=[],n=e;for(;n;){let c=n.parentElement;if(!c){t.push(n.tagName.toLowerCase());break}let d=Array.prototype.indexOf.call(c.children,n);t.push(`${n.tagName.toLowerCase()}[${d}]`),n=c}return t.reverse().join("/")}function Oo(e){var n;let t=(n=e.getAttribute("data-sentient-id"))!=null?n:e.getAttribute("id");return t||`${e.tagName.toLowerCase()}-${Ao(Ro(e))}`}function Po(e){let t=0,n=e.parentElement;for(;n;)t++,n=n.parentElement;return t}function Ve(e,t){var c,d,a,i;let n=e.querySelector(xo);return{componentId:Oo(e),semanticType:_o(e),ariaLabel:(c=e.getAttribute("aria-label"))!=null?c:void 0,headingText:(a=(d=n==null?void 0:n.textContent)==null?void 0:d.trim())!=null?a:void 0,isAboveFold:e.getBoundingClientRect().top<window.innerHeight,prominenceScore:t(e),depth:Po(e),reactComponentName:ko(e),dataAttributes:To(e),locator:(i=Ke(e,e.ownerDocument))!=null?i:void 0}}function Ht(e){var a;let t=[],n=new Set,c="__root__",d=new Map;for(let[i,l]of e){let u=i.parentElement,s=c;for(;u;){if(e.has(u)){s=e.get(u);let r=e.get(i),f=`${s}->${r}`;!n.has(f)&&s!==r&&(n.add(f),t.push({fromComponentId:s,toComponentId:r,weight:.6}));break}u=u.parentElement}let o=(a=d.get(s))!=null?a:[];o.push(i),d.set(s,o)}for(let i of d.values()){if(i.length<2)continue;let l=i.length>jt?i.slice(0,jt):i;for(let u=0;u<l.length;u++)for(let s=u+1;s<l.length;s++){if(t.length>=Co)return t;let o=e.get(l[u]),r=e.get(l[s]);if(o===r)continue;let f=`${o}->${r}::sib`,p=`${r}->${o}::sib`;n.has(f)||(n.add(f),t.push({fromComponentId:o,toComponentId:r,weight:.3})),n.has(p)||(n.add(p),t.push({fromComponentId:r,toComponentId:o,weight:.3}))}}return t}function Lo(e){let t=[],n=new Set,c=new Map;return document.querySelectorAll("[data-sentient-id]").forEach(i=>{if(i instanceof Element&&!n.has(i)){n.add(i);let l=Ve(i,e);t.push(l),c.set(i,l.componentId)}}),document.querySelectorAll("section, article, main, aside").forEach(i=>{if(!(i instanceof Element)||n.has(i))return;let l=i.hasAttribute("aria-label"),u=i.hasAttribute("data-sentient-id");if(!l&&!u)return;n.add(i);let s=Ve(i,e);t.push(s),c.set(i,s.componentId)}),{nodes:t,edges:Ht(c),elementToId:c}}function qt(){if(typeof window=="undefined")return Io;let e=null,t=0,n=null,c=new Map,d=u=>{try{let s=window.getComputedStyle(u),o=parseFloat(s.fontSize)||12,r=parseFloat(s.zIndex)||0,f=u.getBoundingClientRect(),p=Math.max(f.top,0),y=window.innerHeight||1,S=1/(p/y+1),I=Wt(o,12,48)*.4+S*.4+Wt(r,0,100)*.2;return Math.max(0,Math.min(1,I))}catch(s){return .5}};return{scan:()=>new Promise(u=>{let s=()=>{let{nodes:o,edges:r,elementToId:f}=Lo(d);c.clear();for(let[p,y]of f)c.set(p,y);u({nodes:o,edges:r,scannedAt:Date.now()})};try{typeof requestIdleCallback=="function"?t=requestIdleCallback(s,{timeout:100}):s()}catch(o){s()}}),observe:u=>{n=u;try{e=new MutationObserver(s=>{let o=[],r=new Set;for(let p of s)p.type==="childList"&&p.addedNodes.forEach(y=>{if(!(y instanceof Element))return;let S=[];wo.has(y.tagName)&&(y.hasAttribute("data-sentient-id")||y.hasAttribute("aria-label"))&&S.push(y);try{y.querySelectorAll(Eo).forEach(I=>S.push(I))}catch(I){}for(let I of S){if(c.has(I))continue;let C=Ve(I,d);o.push(C),r.add(C.componentId),c.set(I,C.componentId)}});if(o.length===0||!n)return;for(let p of[...c.keys()])p.isConnected||c.delete(p);let f=Ht(c).filter(p=>r.has(p.fromComponentId)||r.has(p.toComponentId));n({nodes:o,edges:f,addedAt:Date.now()})}),e.observe(document.body,{childList:!0,subtree:!0})}catch(s){}},getProminenceScore:d,destroy:()=>{if(e&&(e.disconnect(),e=null),t&&typeof cancelIdleCallback=="function")try{cancelIdleCallback(t)}catch(u){}t=0,n=null,c.clear()}}}var No="https://api.sentient-ui.com/v1/events";function Do(e){var n;let t=c=>{try{let d=document.cookie.match(new RegExp(`(?:^|; )${c}=([^;]*)`));return d?decodeURIComponent(d[1]):void 0}catch(d){return}};return(n=e?t(ie(e)):void 0)!=null?n:t(ve)}var Ge=new Map;function Xt(e){var p;let t=Xe(e),n=e.respectDoNotTrack!==!1&&Ee(),c=e.consent===!1||n,d=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_"),a=e.localMode===!0||!d;if(!e.graph||a||typeof window=="undefined")return t;if(c)return n||Pt(e.apiKey,y=>Xt(y)),t;let i=Ge.get(e.apiKey);if(i)try{i()}catch(y){}let l=qt(),u=(p=e.ingestUrl)!=null?p:No,s=Mt({syncUrl:u.replace(/\/events\/?$/,"/graph/sync"),apiKey:e.apiKey,projectId:e.apiKey,sessionId:Do(e.apiKey)});l.scan().then(y=>{for(let S of y.nodes)s.addPageNode({id:S.componentId,componentId:S.componentId,semanticType:S.semanticType,answers:e.captureDomText&&S.headingText?[S.headingText]:[],prominenceScore:S.prominenceScore,depth:S.depth});for(let S of y.edges)s.addStructuralEdge(S);s.syncOnce()});let o=null,r=()=>{o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,s.syncOnce()},500)};l.observe(y=>{for(let S of y.nodes)s.addPageNode({id:S.componentId,componentId:S.componentId,semanticType:S.semanticType,answers:e.captureDomText&&S.headingText?[S.headingText]:[],prominenceScore:S.prominenceScore,depth:S.depth});for(let S of y.edges)s.addStructuralEdge(S);r()});let f=()=>{o!==null&&(clearTimeout(o),o=null),l.destroy(),s.destroy(),Ge.get(e.apiKey)===f&&Ge.delete(e.apiKey)};return Ge.set(e.apiKey,f),q(x({},t),{getGraph:()=>s.snapshot(),dispose:()=>{f(),t.dispose()},destroy:()=>{f(),t.destroy()}})}0&&(module.exports={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,FORM_FIELD_KINDS,FORM_INPUT_TYPES,LEGACY_SESSION_COOKIE_NAME,MAX_BLOCK_ARMS,MAX_BLOCK_CHILDREN,MAX_BLOCK_DEPTH,MAX_BLOCK_NODES,MAX_BLOCK_TEXT_LEN,MAX_FORM_FIELDS,MAX_FORM_SELECT_OPTIONS,SNAPSHOT_STORAGE_KEY_PREFIX,armOfResult,attachMicroSignalDetectors,baselineResultFor,baselineSlots,containsFormBlock,deriveSessionSegment,detectDeviceClass,detectTimeOfDay,detectTrafficSource,grantConsent,init,isDoNotTrackEnabled,locatorFromElement,readSnapshot,referrerDomainFromReferer,renderPrePaintScript,sanitizePageUrl,sessionCookieName,toWireSlot,writeSnapshot});
2
2
  //# sourceMappingURL=index-graph.js.map