@sentientui/core 0.37.0 → 0.38.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.
- package/dist/chunk-VLFWHJNJ.mjs +2 -0
- package/dist/chunk-VLFWHJNJ.mjs.map +1 -0
- package/dist/chunk-XZRKD2GS.mjs +2 -0
- package/dist/chunk-XZRKD2GS.mjs.map +1 -0
- package/dist/{index-C-meVCmm.d.cts → index-BdpO3Qlm.d.cts} +32 -2
- package/dist/{index-DbpGK3Dj.d.ts → index-DzGhQhSK.d.ts} +32 -2
- package/dist/index-consent.js.map +1 -1
- package/dist/index-consent.mjs +1 -1
- package/dist/index-engagement.js +1 -1
- package/dist/index-engagement.js.map +1 -1
- package/dist/index-engagement.mjs +1 -1
- package/dist/index-graph.d.cts +4 -4
- package/dist/index-graph.d.ts +4 -4
- package/dist/index-graph.js +1 -1
- package/dist/index-graph.js.map +1 -1
- package/dist/index-graph.mjs +1 -1
- package/dist/index-graph.mjs.map +1 -1
- package/dist/index-local.d.cts +2 -2
- package/dist/index-local.d.ts +2 -2
- package/dist/index-server.d.cts +7 -2
- package/dist/index-server.d.ts +7 -2
- package/dist/index-server.js +1 -1
- package/dist/index-server.js.map +1 -1
- package/dist/index-server.mjs +1 -1
- package/dist/index-server.mjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{session-meta-DlCp0tyi.d.ts → session-meta-CvEwPQCX.d.ts} +6 -1
- package/dist/{session-meta-CJ-QAskZ.d.cts → session-meta-USVMwvsR.d.cts} +6 -1
- package/package.json +1 -1
- package/dist/chunk-5CCBWT6H.mjs +0 -2
- package/dist/chunk-5CCBWT6H.mjs.map +0 -1
- package/dist/chunk-DU3AXQHR.mjs +0 -2
- package/dist/chunk-DU3AXQHR.mjs.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as Z}from"./chunk-WKXD7KI3.mjs";import{a as j,d as J,e as H,f as q,g as se}from"./chunk-Z6ILOYBD.mjs";import{
|
|
1
|
+
import{a as Z}from"./chunk-WKXD7KI3.mjs";import{a as j,d as J,e as H,f as q,g as se}from"./chunk-Z6ILOYBD.mjs";import{M as Q,O as X}from"./chunk-VLFWHJNJ.mjs";import"./chunk-XZRKD2GS.mjs";import"./chunk-NCLBL5V3.mjs";import"./chunk-MKM7TD3L.mjs";import"./chunk-J5EL7HKC.mjs";import{a as $,b as z}from"./chunk-TMCGHANO.mjs";import{fnv1a as ue}from"@sentientui/policy";var ee=[100,300,1e3,3e3,1e4],ie=250,ae=1e3,ce=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function te(t,o){t.n++;let e=o-t.mean;t.mean+=e/t.n,t.m2+=e*(o-t.mean)}var ne=t=>t.n>1?Math.sqrt(t.m2/t.n):0;function le(t){var o;try{let e=t.createElement("canvas"),u=e.getContext("webgl")||e.getContext("experimental-webgl");if(!u)return"unknown";let d=u.getExtension("WEBGL_debug_renderer_info"),p=d?String((o=u.getParameter(d.UNMASKED_RENDERER_WEBGL))!=null?o:""):"";return p?/swiftshader|llvmpipe|softpipe|software|mesa offscreen/i.test(p)?"sw":"hw":"unknown"}catch(e){return"unknown"}}function re(t,o=Date.now){var a,c;let e=(a=t.defaultView)!=null?a:typeof window!="undefined"?window:void 0,u={n:0,mean:0,m2:0},d={n:0,mean:0,m2:0},p=[0,0,0,0,0,0],_=0,G=0,k=0,U=0,g=0,V=0,T=0,h=0,I=0,b=0,L=-1/0,C=-1/0,m=null,w=null,A=null,x=(c=e==null?void 0:e.scrollY)!=null?c:0,N=0,f=t.hidden?null:o(),E=()=>{let n=o();if(A!=null){let l=n-A,v=0;for(;v<ee.length&&l>=ee[v];)v++;p[v]++}A=n},O=()=>{_++,L=o()},R=()=>{G++,C=o()},M=()=>{m=o()},D=()=>{m!=null&&(te(u,o()-m),m=null)},P=()=>{let n=o();k++,n-L>ie&&n-C>ae&&U++,E()},S=()=>{g++},W=()=>{var l;let n=(l=e==null?void 0:e.scrollY)!=null?l:0;V+=Math.abs(n-x),x=n,E()},K=n=>{let l=o();T++,(n.key==="Backspace"||n.key==="Delete")&&I++,ce.has(n.key)&&b++,w!=null&&te(d,l-w),w=l,E()},F=n=>{let l=n.data;typeof l=="string"&&(h+=l.length),E()},B=()=>{let n=o();t.hidden?f!=null&&(N+=n-f,f=null):f==null&&(f=n)},i={passive:!0,capture:!0};t.addEventListener("mousemove",O,i),t.addEventListener("touchstart",R,i),t.addEventListener("touchmove",S,i),t.addEventListener("mousedown",M,i),t.addEventListener("mouseup",D,i),t.addEventListener("click",P,i),t.addEventListener("wheel",S,i),t.addEventListener("keydown",K,i),t.addEventListener("input",F,i),t.addEventListener("visibilitychange",B),e==null||e.addEventListener("scroll",W,i);let r=le(t),s=(()=>{var n;try{return((n=e==null?void 0:e.matchMedia)==null?void 0:n.call(e,"(prefers-reduced-motion: reduce)").matches)===!0}catch(l){return!1}})();return{snapshot(){var v,y;let n=o(),l=N+(f!=null?n-f:0);return{v:1,active_ms:Math.round(l),mm:_,mm_rate:l>0?Number((_*1e3/l).toFixed(2)):0,touches:G,clicks:k,hold_n:u.n,hold_mean:Math.round(u.mean),hold_std:Math.round(ne(u)),teleport:U,wheel:g,scroll_px:Math.round(V),keydowns:T,input_chars:h,ik_cv:d.mean>0?Number((ne(d)/d.mean).toFixed(2)):0,backspaces:I,gaps:[...p],reduced_motion:s,kb_nav:b,renderer:r,vp:[(v=e==null?void 0:e.innerWidth)!=null?v:0,(y=e==null?void 0:e.innerHeight)!=null?y:0],dpr:(e==null?void 0:e.devicePixelRatio)||1}},stop(){t.removeEventListener("mousemove",O,i),t.removeEventListener("touchstart",R,i),t.removeEventListener("touchmove",S,i),t.removeEventListener("mousedown",M,i),t.removeEventListener("mouseup",D,i),t.removeEventListener("click",P,i),t.removeEventListener("wheel",S,i),t.removeEventListener("keydown",K,i),t.removeEventListener("input",F,i),t.removeEventListener("visibilitychange",B),e==null||e.removeEventListener("scroll",W,i)}}}var de="section, header, footer, nav, main > div, [data-sentient-section]",me=2e4,oe="__session__";function pe(t){let o=Array.from(t.querySelectorAll(de)),e=o.filter(u=>o.filter(d=>d!==u&&u.contains(d)).length<2);return e.filter(u=>!e.some(d=>d!==u&&d.contains(u)))}function fe(t,o,e,u){try{fetch(`${o}/v1/section-map`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${t}`},body:JSON.stringify({pageUrl:e,sections:u})}).catch(()=>{})}catch(d){}}var Y=()=>{};function ve(t,o){var x,N,f,E,O,R,M,D,P,S,W,K,F,B,i;let e=(x=o.doc)!=null?x:typeof document!="undefined"?document:void 0;if(!e||typeof IntersectionObserver=="undefined"||X()||!o.apiKey||!o.apiKey.startsWith("pk_"))return Y;let u=((N=o.apiBase)!=null?N:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),d=pe(e);if(d.length===0)return Y;let p=new Map,_=[];for(let r of d){let s=(O=[(E=o.sectionTypes)==null?void 0:E[(f=r.getAttribute("data-sentient-id"))!=null?f:""],r.getAttribute("data-sentient-type")].find(y=>j.includes(y)))!=null?O:null,a=q(r),c=(M=s!=null?s:(R=o.typeOf)==null?void 0:R.call(o,r))!=null?M:H(a).type,n=Z(r,e),l=n?`nc-${c}-${ue(JSON.stringify({id:(D=n.id)!=null?D:null,dataAttr:(P=n.dataAttr)!=null?P:null,selector:(S=n.selector)!=null?S:null})).toString(36)}`:`nc-${c}`;p.set(r,l);let v=J.filter(([,y])=>y.test(a.bodyText)).map(([y])=>y);_.push(z($({componentId:l,semanticType:c,source:s?"markup":"auto"},n?{locator:n}:{}),{observation:$($({tag:a.tag,idClass:a.idClass.slice(0,200),headingText:a.headingText,textLength:a.textLength,actionCount:a.actionCount},a.ariaRole?{ariaRole:a.ariaRole}:{}),v.length>0?{patternFlags:v}:{})}))}let G=(B=(F=(K=(W=e.defaultView)!=null?W:typeof window!="undefined"?window:void 0)==null?void 0:K.location)==null?void 0:F.pathname)!=null?B:"/";fe(o.apiKey,u,G,_);let k=re(e),U=()=>{let r;try{r=k.snapshot()}catch(s){return}try{t.track({projectId:o.apiKey,componentId:oe,eventType:"interaction_stats",payload:r})}catch(s){}},g=new Map,V=r=>{let s=g.get(r);return s||(s={ms:0,scroll:0,enterAt:null,intersecting:!1},g.set(r,s)),s},T=new IntersectionObserver(r=>{for(let s of r){let a=p.get(s.target);if(!a)continue;let c=V(a);s.isIntersecting?(c.intersecting=!0,c.enterAt=Date.now(),s.intersectionRatio>c.scroll&&(c.scroll=s.intersectionRatio)):(c.intersecting=!1,c.enterAt!=null&&(c.ms+=Date.now()-c.enterAt,c.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let r of p.keys())T.observe(r);let h=(r=!1)=>{var a;let s=Date.now();for(let[c,n]of g)if(n.enterAt!=null&&(n.ms+=s-n.enterAt,n.enterAt=null),!(n.ms<=0)){try{t.track({projectId:o.apiKey,componentId:c,eventType:"dwell",payload:{dwell_time:Math.round(n.ms),scroll_depth:Number(n.scroll.toFixed(2))}})}catch(l){}n.ms=0}if(U(),r)try{(a=t.flush)==null||a.call(t)}catch(c){}},I=()=>{if(e.hidden)h(!0);else{let r=Date.now();for(let s of g.values())s.intersecting&&(s.enterAt=r)}},b=!1,L=r=>{if(h(!0),r!=null&&r.persisted){b=!0;return}try{T.disconnect()}catch(s){}},C=r=>{if(!(r!=null&&r.persisted)||!b)return;b=!1;let s=Date.now();for(let a of g.values())a.enterAt=a.intersecting&&!e.hidden?s:null};e.addEventListener("visibilitychange",I);let m=(i=e.defaultView)!=null?i:typeof window!="undefined"?window:void 0;m==null||m.addEventListener("pagehide",L),m==null||m.addEventListener("pageshow",C);let w=setInterval(()=>{if(e.hidden||b)return;h();let r=Date.now();for(let s of g.values())s.intersecting&&(s.enterAt=r)},me),A=[];return o.microSignals&&[...p.entries()].forEach(([r,s],a)=>{A.push(Q((c,n={})=>{try{t.track({projectId:o.apiKey,componentId:s,eventType:"micro_signal",payload:$({signalType:c},n)})}catch(l){}},r,void 0,{tabLoss:a===0}))}),()=>{h(!0),clearInterval(w),k.stop(),e.removeEventListener("visibilitychange",I),m==null||m.removeEventListener("pagehide",L),m==null||m.removeEventListener("pageshow",C);for(let r of A)r();try{T.disconnect()}catch(r){}}}export{oe as INTERACTION_STATS_COMPONENT,j as SEMANTIC_TYPES,H as classifyFeatures,se as classifySection,q as featuresFromElement,ve as startEngagementCapture};
|
|
2
2
|
//# sourceMappingURL=index-engagement.mjs.map
|
package/dist/index-graph.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as AssignResult, a as Assignment, b as AssignmentCache, E as EventQueue, f as EventType, h as GraphClient, i as GraphConfig, j as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, M as MicroSignalEmitter, l as MicroSignalType, n as PageNode, Q as QueueConfig,
|
|
3
|
-
import { b as CompoundLocator } from './session-meta-
|
|
4
|
-
export { D as DecisionSnapshot, S as SNAPSHOT_STORAGE_KEY_PREFIX, d as SlotConfigEntry, e as SlotDeclInput, f as SlotOps, i as armOfResult, j as baselineResultFor, k as baselineSlots, n as deriveSessionSegment, o as detectDeviceClass, p as detectTimeOfDay, q as detectTrafficSource, t as readSnapshot, u as referrerDomainFromReferer, v as renderPrePaintScript, w as toWireSlot, y as writeSnapshot } from './session-meta-
|
|
1
|
+
import { r as SentientConfig, q as SentientClient } from './index-BdpO3Qlm.cjs';
|
|
2
|
+
export { A as AssignResult, a as Assignment, b as AssignmentCache, E as EventQueue, f as EventType, h as GraphClient, i as GraphConfig, j as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, M as MicroSignalEmitter, l as MicroSignalType, n as PageNode, Q as QueueConfig, S as STAGE_ATTRIBUTE, s as SentientEvent, t as SessionConfig, u as SessionManager, w as StageAttributes, y as attachMicroSignalDetectors, B as exposedStage, H as grantConsent, J as isDoNotTrackEnabled, U as sanitizePageUrl, V as sessionCookieName, Y as setStageAttribute } from './index-BdpO3Qlm.cjs';
|
|
3
|
+
import { b as CompoundLocator } from './session-meta-USVMwvsR.cjs';
|
|
4
|
+
export { D as DecisionSnapshot, S as SNAPSHOT_STORAGE_KEY_PREFIX, d as SlotConfigEntry, e as SlotDeclInput, f as SlotOps, i as armOfResult, j as baselineResultFor, k as baselineSlots, n as deriveSessionSegment, o as detectDeviceClass, p as detectTimeOfDay, q as detectTrafficSource, t as readSnapshot, u as referrerDomainFromReferer, v as renderPrePaintScript, w as toWireSlot, y as writeSnapshot } from './session-meta-USVMwvsR.cjs';
|
|
5
5
|
export { B as BLOCK_ALIGNS, a as BLOCK_EMPHASES, b as BLOCK_FITS, c as BLOCK_GAPS, d as BLOCK_GRID_COLUMNS, e as BLOCK_HEADING_LEVELS, f as BLOCK_JUSTIFIES, g as BLOCK_MAX_WIDTHS, h as BLOCK_PADS, i as BLOCK_RATIOS, j as BLOCK_SIZES, k as BLOCK_SURFACES, l as BLOCK_TEXT_ALIGNS, m as BLOCK_TONES, n as BLOCK_WEIGHTS, o as BadgeBlock, p as BlockAlign, q as BlockEmphasis, r as BlockFit, s as BlockGap, t as BlockJustify, u as BlockMaxWidth, v as BlockNode, w as BlockPad, x as BlockRatio, y as BlockSize, z as BlockSurface, A as BlockTextAlign, C as BlockTone, D as BlockWeight, E as ButtonBlock, G as DividerBlock, H as FORM_FIELD_KINDS, I as FORM_INPUT_TYPES, J as FormBlock, K as FormField, L as GridBlock, M as HeadingBlock, N as ImageBlock, P as LinkBlock, Q as MAX_BLOCK_ARMS, R as MAX_BLOCK_CHILDREN, S as MAX_BLOCK_DEPTH, T as MAX_BLOCK_NODES, U as MAX_BLOCK_TEXT_LEN, V as MAX_FORM_FIELDS, W as MAX_FORM_SELECT_OPTIONS, $ as SitePalette, a0 as SpacerBlock, a1 as StackBlock, a5 as TextBlock, a6 as containsFormBlock } from './style-vocabulary-Ba_g6_DD.cjs';
|
|
6
6
|
export { SlotResult } from '@sentientui/policy';
|
|
7
7
|
import './region-skeleton-D2ahkcbe.cjs';
|
package/dist/index-graph.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as AssignResult, a as Assignment, b as AssignmentCache, E as EventQueue, f as EventType, h as GraphClient, i as GraphConfig, j as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, M as MicroSignalEmitter, l as MicroSignalType, n as PageNode, Q as QueueConfig,
|
|
3
|
-
import { b as CompoundLocator } from './session-meta-
|
|
4
|
-
export { D as DecisionSnapshot, S as SNAPSHOT_STORAGE_KEY_PREFIX, d as SlotConfigEntry, e as SlotDeclInput, f as SlotOps, i as armOfResult, j as baselineResultFor, k as baselineSlots, n as deriveSessionSegment, o as detectDeviceClass, p as detectTimeOfDay, q as detectTrafficSource, t as readSnapshot, u as referrerDomainFromReferer, v as renderPrePaintScript, w as toWireSlot, y as writeSnapshot } from './session-meta-
|
|
1
|
+
import { r as SentientConfig, q as SentientClient } from './index-DzGhQhSK.js';
|
|
2
|
+
export { A as AssignResult, a as Assignment, b as AssignmentCache, E as EventQueue, f as EventType, h as GraphClient, i as GraphConfig, j as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, M as MicroSignalEmitter, l as MicroSignalType, n as PageNode, Q as QueueConfig, S as STAGE_ATTRIBUTE, s as SentientEvent, t as SessionConfig, u as SessionManager, w as StageAttributes, y as attachMicroSignalDetectors, B as exposedStage, H as grantConsent, J as isDoNotTrackEnabled, U as sanitizePageUrl, V as sessionCookieName, Y as setStageAttribute } from './index-DzGhQhSK.js';
|
|
3
|
+
import { b as CompoundLocator } from './session-meta-CvEwPQCX.js';
|
|
4
|
+
export { D as DecisionSnapshot, S as SNAPSHOT_STORAGE_KEY_PREFIX, d as SlotConfigEntry, e as SlotDeclInput, f as SlotOps, i as armOfResult, j as baselineResultFor, k as baselineSlots, n as deriveSessionSegment, o as detectDeviceClass, p as detectTimeOfDay, q as detectTrafficSource, t as readSnapshot, u as referrerDomainFromReferer, v as renderPrePaintScript, w as toWireSlot, y as writeSnapshot } from './session-meta-CvEwPQCX.js';
|
|
5
5
|
export { B as BLOCK_ALIGNS, a as BLOCK_EMPHASES, b as BLOCK_FITS, c as BLOCK_GAPS, d as BLOCK_GRID_COLUMNS, e as BLOCK_HEADING_LEVELS, f as BLOCK_JUSTIFIES, g as BLOCK_MAX_WIDTHS, h as BLOCK_PADS, i as BLOCK_RATIOS, j as BLOCK_SIZES, k as BLOCK_SURFACES, l as BLOCK_TEXT_ALIGNS, m as BLOCK_TONES, n as BLOCK_WEIGHTS, o as BadgeBlock, p as BlockAlign, q as BlockEmphasis, r as BlockFit, s as BlockGap, t as BlockJustify, u as BlockMaxWidth, v as BlockNode, w as BlockPad, x as BlockRatio, y as BlockSize, z as BlockSurface, A as BlockTextAlign, C as BlockTone, D as BlockWeight, E as ButtonBlock, G as DividerBlock, H as FORM_FIELD_KINDS, I as FORM_INPUT_TYPES, J as FormBlock, K as FormField, L as GridBlock, M as HeadingBlock, N as ImageBlock, P as LinkBlock, Q as MAX_BLOCK_ARMS, R as MAX_BLOCK_CHILDREN, S as MAX_BLOCK_DEPTH, T as MAX_BLOCK_NODES, U as MAX_BLOCK_TEXT_LEN, V as MAX_FORM_FIELDS, W as MAX_FORM_SELECT_OPTIONS, $ as SitePalette, a0 as SpacerBlock, a1 as StackBlock, a5 as TextBlock, a6 as containsFormBlock } from './style-vocabulary-Ba_g6_DD.js';
|
|
6
6
|
export { SlotResult } from '@sentientui/policy';
|
|
7
7
|
import './region-skeleton-D2ahkcbe.js';
|
package/dist/index-graph.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var Nn=Object.create;var Le=Object.defineProperty,Mn=Object.defineProperties,Ln=Object.getOwnPropertyDescriptor,Bn=Object.getOwnPropertyDescriptors,Kn=Object.getOwnPropertyNames,Ft=Object.getOwnPropertySymbols,Gn=Object.getPrototypeOf,Wt=Object.prototype.hasOwnProperty,$n=Object.prototype.propertyIsEnumerable;var jt=(e,t,n)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,T=(e,t)=>{for(var n in t||(t={}))Wt.call(t,n)&&jt(e,n,t[n]);if(Ft)for(var n of Ft(t))$n.call(t,n)&&jt(e,n,t[n]);return e},re=(e,t)=>Mn(e,Bn(t));var Un=(e,t)=>{for(var n in t)Le(e,n,{get:t[n],enumerable:!0})},Ht=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of Kn(t))!Wt.call(e,c)&&c!==n&&Le(e,c,{get:()=>t[c],enumerable:!(s=Ln(t,c))||s.enumerable});return e};var Fn=(e,t,n)=>(n=e!=null?Nn(Gn(e)):{},Ht(t||!e||!e.__esModule?Le(n,"default",{value:e,enumerable:!0}):n,e)),jn=e=>Ht(Le({},"__esModule",{value:!0}),e);var Er={};Un(Er,{BLOCK_ALIGNS:()=>go,BLOCK_EMPHASES:()=>ho,BLOCK_FITS:()=>wo,BLOCK_GAPS:()=>po,BLOCK_GRID_COLUMNS:()=>Eo,BLOCK_HEADING_LEVELS:()=>xo,BLOCK_JUSTIFIES:()=>fo,BLOCK_MAX_WIDTHS:()=>Co,BLOCK_PADS:()=>Io,BLOCK_RATIOS:()=>vo,BLOCK_SIZES:()=>mo,BLOCK_SURFACES:()=>ko,BLOCK_TEXT_ALIGNS:()=>bo,BLOCK_TONES:()=>So,BLOCK_WEIGHTS:()=>yo,FORM_FIELD_KINDS:()=>To,FORM_INPUT_TYPES:()=>_o,LEGACY_SESSION_COOKIE_NAME:()=>pe,MAX_BLOCK_ARMS:()=>No,MAX_BLOCK_CHILDREN:()=>Do,MAX_BLOCK_DEPTH:()=>Po,MAX_BLOCK_NODES:()=>Oo,MAX_BLOCK_TEXT_LEN:()=>Mo,MAX_FORM_FIELDS:()=>Ao,MAX_FORM_SELECT_OPTIONS:()=>Ro,SNAPSHOT_STORAGE_KEY_PREFIX:()=>ye,armOfResult:()=>et,attachMicroSignalDetectors:()=>ln,baselineResultFor:()=>De,baselineSlots:()=>on,containsFormBlock:()=>cn,deriveSessionSegment:()=>yt,detectDeviceClass:()=>_e,detectTimeOfDay:()=>Oe,detectTrafficSource:()=>Ae,grantConsent:()=>hn,init:()=>Rn,isDoNotTrackEnabled:()=>Fe,locatorFromElement:()=>rt,readSnapshot:()=>ke,referrerDomainFromReferer:()=>Re,renderPrePaintScript:()=>zt,sanitizePageUrl:()=>Et,sessionCookieName:()=>we,toWireSlot:()=>$e,writeSnapshot:()=>Ie});module.exports=jn(Er);function ue(e){if(typeof AbortController!="function")return{clear:()=>{}};let t=new AbortController,n=setTimeout(()=>t.abort(),e);return{signal:t.signal,clear:()=>clearTimeout(n)}}function dt(e,t){return new Promise(n=>{let s=setTimeout(()=>n(!1),t),c=()=>{clearTimeout(s),n(!0)};e.then(c,c)})}var Wn;function qt(e){Wn=typeof e=="string"&&e!==""?e:void 0}function ae(e){return e?`_${e.slice(0,12)}`:""}var pe="_snt_uid";function we(e){return`${pe}${ae(e)}`}var He="__sntForgetGen",Hn=()=>{try{return window[He]}catch(e){return}};function qe(e){var t,n;try{let s=window,c=(t=s[He])!=null?t:s[He]={};c[e]=((n=c[e])!=null?n:0)+1}catch(s){}}function me(e){var t,n;return(n=(t=Hn())==null?void 0:t[e])!=null?n:0}var ye="_snt_snap:";var qn=["low","medium","high"];function ke(e){try{let t=localStorage.getItem(ye+e);if(!t)return null;let n=JSON.parse(t);if(!n||typeof n!="object"||n.v!==1||typeof n.persona!="string"||typeof n.band!="string"||!qn.includes(n.band)||typeof n.slots!="object"||n.slots===null||Array.isArray(n.slots)||!(n.layoutOrder===null||Array.isArray(n.layoutOrder))||typeof n.savedAt!="number"||!(Date.now()-n.savedAt<2592e6)||!(n.slotConfig===void 0||typeof n.slotConfig=="object"&&n.slotConfig!==null&&!Array.isArray(n.slotConfig)))return null;let s=n.vocabulary;return s!==void 0&&(typeof s!="object"||s===null||!Array.isArray(s.entries)||!Array.isArray(s.images))&&delete n.vocabulary,n}catch(t){return null}}function Ie(e,t){try{localStorage.setItem(ye+e,JSON.stringify(t))}catch(n){}}function zt(e){return'(function(){try{var N=navigator,W=window;if(N.doNotTrack=="1"||N.doNotTrack=="yes"||W.doNotTrack=="1"||N.msDoNotTrack=="1"||N.globalPrivacyControl)return;var r=localStorage.getItem('+JSON.stringify(ye+e).replace(/</g,"\\u003c")+');if(!r)return;var s=JSON.parse(r);if(!s||s.v!==1||typeof s.persona!=="string"||typeof s.band!=="string")return;if(!('+2592e6+'>Date.now()-s.savedAt))return;var d=document.documentElement;if(d.hasAttribute("data-sentient-persona"))return;d.setAttribute("data-sentient-persona",s.persona);d.setAttribute("data-sentient-confidence",s.band);}catch(e){}})();'}function Se(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 ze(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let s=JSON.parse(n);return Array.isArray(s)?(localStorage.removeItem(e),s.slice(-t)):[]}catch(n){return[]}}function Be(e,t,n){try{let s=(()=>{try{let r=localStorage.getItem(n);if(!r)return[];let u=JSON.parse(r);return Array.isArray(u)?u:[]}catch(r){return[]}})(),c=new Map;for(let r of s)c.set(r.id,r);for(let r of e)c.set(r.id,r);localStorage.setItem(n,JSON.stringify([...c.values()].slice(-t)))}catch(s){}}function Ve(e,t){try{let n=localStorage.getItem(t);if(!n)return;let s=JSON.parse(n);if(!Array.isArray(s))return;let c=new Set(e),r=s.filter(u=>!c.has(u.id));if(r.length===s.length)return;r.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(r))}catch(n){}}var zn=500,Vn=56*1024;function Ke(e){return`_snt_retry_${e.slice(0,12)}`}var Xn={push:()=>{},flush:()=>{},destroy:()=>{}};function Vt(e){var H,Q,ge;if(typeof window=="undefined")return Xn;let t=(H=e.flushIntervalMs)!=null?H:5e3,n=(Q=e.maxBatchSize)!=null?Q:20,s=(ge=e.maxRetrySize)!=null?ge:100,c=e.ingestUrl,r=e.apiKey,u=Ke(r),o=!1,p=me(r),i=(...x)=>{!o&&me(r)===p&&Be(...x)},a=[],l=new Set,h=[],y=x=>{for(let K of x)S.delete(K),!l.has(K)&&(l.add(K),h.push(K));for(;h.length>zn;){let K=h.shift();K&&l.delete(K)}Ve(x,u)},S=new Set,v=()=>{for(;a.length>s;){let x=a.shift();x&&S.delete(x.id)}},M=x=>{l.has(x.id)||S.has(x.id)||(S.add(x.id),a.push(x),v())},_=x=>{for(let K of x)l.has(K.id)||(S.add(K.id),a.push(K));v()},G=ze(u,s);for(let x of G)M(x);let L=0,F=0,B=(x,K=!0)=>{if(x.length===0)return;let fe=JSON.stringify(x),Ee=x.map(ce=>ce.id),te,he=ue(15e3);try{te=fetch(c,{method:"POST",keepalive:!0,signal:he.signal,body:fe,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}})}catch(ce){i(x,s,u),_(x),F++,L=Date.now()+Se(F);return}Promise.resolve(te).then(he.clear,he.clear);let Ne=ce=>{if(Ce(ce)!=="retry"){if(!ce.ok&&K){let be=x.filter(se=>se.eventType!=="pageview");if(be.length>0&&be.length<x.length){y(x.filter(se=>se.eventType==="pageview").map(se=>se.id)),B(be,!1);return}}y(Ee),F=0,L=0;return}i(x,s,u),_(x),F++,L=Date.now()+Se(F)};te&&typeof te.then=="function"?te.then(Ne).catch(()=>{i(x,s,u),_(x),F++,L=Date.now()+Se(F)}):Ne(te)},ee=typeof TextEncoder!="undefined"?new TextEncoder:null,f=x=>ee?ee.encode(x).length:x.length,b=x=>{let K=[],fe=2;for(let Ee of x){let te=f(JSON.stringify(Ee))+1;if(K.length>0&&fe+te>Vn||K.length>=n)break;K.push(Ee),fe+=te}return K},C=()=>{try{if(Date.now()<L)return;for(;a.length>0&&!(Date.now()<L);){let x=a.filter(fe=>!l.has(fe.id));if(a.length=0,x.length===0)break;let K=b(x);if(K.length===0)break;K.length<x.length&&a.push(...x.slice(K.length)),B(K)}}catch(x){}},m=!0,A=null;A=setInterval(()=>{m&&C()},t);let $=()=>{document.visibilityState==="hidden"&&C()},N=()=>{C()};return document.addEventListener("visibilitychange",$),window.addEventListener("pagehide",N),{push(x){M(x),a.length>=n&&C()},flush:C,destroy(x){x!=null&&x.forget&&(o=!0),m=!1,A!==null&&(clearInterval(A),A=null),document.removeEventListener("visibilitychange",$),window.removeEventListener("pagehide",N),C()}}}var Qn=200;function Ge(e){return`_snt_goal_retry_${e.slice(0,12)}`}var Jn={send:()=>{},flush:()=>{},destroy:()=>{}};function Xt(e){var f,b,C;if(typeof window=="undefined")return Jn;let t=(f=e.flushIntervalMs)!=null?f:5e3,n=(b=e.maxRetrySize)!=null?b:100,s=(C=e.maxPerFlush)!=null?C:5,c=Ge(e.apiKey),r=!1,u=me(e.apiKey),o=(...m)=>{!r&&me(e.apiKey)===u&&Be(...m)},p=[],i=new Set,a=new Set,l=[],h=0,y=0,S=!1,v=m=>{for(i.delete(m.id),a.has(m.id)||(a.add(m.id),l.push(m.id));l.length>Qn;){let A=l.shift();A&&a.delete(A)}Ve([m.id],c)},M=m=>{o([m],n,c),!a.has(m.id)&&!i.has(m.id)&&(i.add(m.id),p.push(m)),Date.now()>=h&&(y++,h=Date.now()+Se(y))},_=m=>{let A,$=ue(15e3);try{A=fetch(e.url,{method:"POST",keepalive:!0,signal:$.signal,body:m.body,headers:e.headers})}catch(H){M(m);return}let N=H=>{var ge;let Q=Ce(H);if(Q==="retry"){M(m);return}Q==="dropped"&&((ge=e.onDrop)==null||ge.call(e,m,H.status)),v(m),y=0,h=0};Promise.resolve(A).then($.clear,$.clear),A&&typeof A.then=="function"?A.then(N).catch(()=>M(m)):N(A)},G=()=>{try{if(S||Date.now()<h)return;let m=0;for(;p.length>0&&m<s&&!(Date.now()<h);){let A=p.shift();i.delete(A.id),!a.has(A.id)&&(m++,_(A))}}catch(m){}},L=ze(c,n);for(let m of L)i.has(m.id)||(i.add(m.id),p.push(m));L.length>0&&Be(L,n,c);let F=setInterval(G,t),B=()=>{document.visibilityState==="hidden"&&G()},ee=()=>G();return document.addEventListener("visibilitychange",B),window.addEventListener("pagehide",ee),{send(m){if(S){a.has(m.id)||o([m],n,c);return}if(!(a.has(m.id)||i.has(m.id))){if(Date.now()<h){o([m],n,c),i.add(m.id),p.push(m);return}_(m)}},flush:G,destroy(m){m!=null&&m.forget&&(r=!0),clearInterval(F),document.removeEventListener("visibilitychange",B),window.removeEventListener("pagehide",ee),G(),S=!0}}}function Qt(e){if(typeof window=="undefined"||!e)return!1;qe(e);let t=!1,n=we(e);try{if(new RegExp(`(?:^|; )${n}=`).test(document.cookie)){let u=location.protocol==="https:"?"; Secure":"";document.cookie=`${n}=; max-age=0; SameSite=lax; path=/${u}`,t=!0}}catch(u){}let s=ae(e),c=[n,"_snt_graph_edges",ye+e,Ke(e),Ge(e),`_snt_graph_nodes${s}`],r=[`_snt_asgn${s}_`];for(let u of["localStorage","sessionStorage"])try{let o=window[u];for(let p of c)o.getItem(p)!==null&&(o.removeItem(p),t=!0);for(let p=o.length-1;p>=0;p--){let i=o.key(p);i&&r.some(a=>i.startsWith(a))&&(o.removeItem(i),t=!0)}}catch(o){}try{(new RegExp(`(?:^|; )${pe}=[^;]`).test(document.cookie)||localStorage.getItem(pe)!==null||sessionStorage.getItem(pe)!==null)&&localStorage.setItem(`${pe}_tomb${s}`,"1")}catch(u){}return t}function Xe(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch(e){}try{if(typeof crypto!="undefined"&&typeof crypto.getRandomValues=="function"){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,"0"),(n===3||n===5||n===7||n===9)&&(t+="-");return t}}catch(e){}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var Jt="_snt_uid",Yn=365,Te="_snt_uid";function Zn(){return Xe()}function pt(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function ft(){try{return location.protocol==="https:"?"; Secure":""}catch(e){return""}}function eo(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=lax; path=/${ft()}`}catch(s){}}function Qe(e){try{return localStorage.getItem(e)}catch(t){return null}}function Yt(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 to(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function no(e){try{sessionStorage.removeItem(e)}catch(t){}}function oo(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=lax; path=/${ft()}`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function ro(e){try{localStorage.removeItem(e)}catch(t){}}function so(e){try{document.cookie=`${e}=; max-age=0; SameSite=lax; path=/${ft()}`}catch(t){}}var io={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function Je(e){var S,v,M,_,G,L,F;if(typeof window=="undefined")return io;let t=ae(e==null?void 0:e.apiKey),n=(S=e==null?void 0:e.cookieName)!=null?S:we(e==null?void 0:e.apiKey),s=`${Te}${t}`,c=`${Te}_tomb${t}`,u=((v=e==null?void 0:e.cookieTTLDays)!=null?v:Yn)*24*60*60,o=B=>B&&B.length>0?B:null,p=()=>{var B,ee;return t&&!(e!=null&&e.cookieName)&&Qe(c)===null?(ee=(B=o(pt(Jt)))!=null?B:o(Qe(Te)))!=null?ee:o(gt(Te)):null},i=(F=(L=(G=(_=(M=o(pt(n)))!=null?M:o(Qe(s)))!=null?_:o(gt(s)))!=null?G:p())!=null?L:o(e==null?void 0:e.ssrSessionId))!=null?F:Zn();eo(n,i,u);let a=Yt(s,i),l=oo(n),h=a?!1:to(s,i),y=!a&&!l&&!h;return{getSessionId:()=>i,isEphemeral:()=>y,destroy:()=>{i=null,so(n),ro(s),no(s),t&&!(e!=null&&e.cookieName)&&(pt(Jt)!==null||Qe(Te)!==null||gt(Te)!==null)&&Yt(c,"1")}}}var ao=1800*1e3;function Ye(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function Zt(e=ao,t){let n=new Map,s=`_snt_asgn${ae(t)}_`,c=(i,a)=>`${s}${encodeURIComponent(i)}:${encodeURIComponent(a)}`,r=i=>{let a=i.slice(s.length),l=a.indexOf(":");if(l<0)return null;try{return{componentId:decodeURIComponent(a.slice(0,l)),segment:decodeURIComponent(a.slice(l+1))}}catch(h){return null}},u=()=>{try{let i=[];for(let a=0;a<localStorage.length;a++){let l=localStorage.key(a);l!=null&&l.startsWith(s)&&i.push(l)}return i}catch(i){return[]}},o=i=>i.assignedAt+(i.ttlMs&&i.ttlMs>0?i.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let i of u())try{let a=localStorage.getItem(i);if(!a)continue;let l=JSON.parse(a);if(o(l)){localStorage.removeItem(i);continue}let h=r(i);if(!h)continue;n.set(Ye(h.componentId,h.segment),l)}catch(a){}})(),{get(i,a){let l=n.get(Ye(i,a));return l?o(l)?(n.delete(Ye(i,a)),null):l:null},set(i,a,l){let h=Ye(i,a);n.set(h,l);try{localStorage.setItem(c(i,a),JSON.stringify(l))}catch(y){}},clear(){n.clear();for(let i of u())try{localStorage.removeItem(i)}catch(a){}}}}var en=["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 Ze(e){return tn(e)!==null}function tn(e){var n;if(!e)return null;let t=e.toLowerCase();return(n=en.find(s=>t.includes(s.toLowerCase())))!=null?n:null}function _e(e){let t=e.toLowerCase();return/ipad|tablet|playbook|kindle|silk/.test(t)?"tablet":/mobi|iphone|ipod|android.*mobile|phone/.test(t)?"mobile":"desktop"}function Ae(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(c){}let s=n.hostname.toLowerCase();return/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(s)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(s)?"social":"referral"}catch(n){return"direct"}}function Re(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var nn=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function mt(e){let t={},n={};try{let s=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([c,r])=>{let u=Array.isArray(r)?r[0]:r;return u===void 0?[]:[[c,u]]});for(let[c,r]of s)c.startsWith("utm_")?c in t||(t[c]=r):nn.includes(c)&&(c in n||(n[c]=r))}catch(s){}return{utmParams:t,clickIds:n}}function Oe(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function yt(e){let t=co("__segment__",e);return`${t.deviceClass}:${t.trafficSource}`}function co(e,t){var r,u,o,p,i,a,l,h;let n=(u=(r=t==null?void 0:t.userAgent)==null?void 0:r.trim())!=null?u:"",s=(p=(o=t==null?void 0:t.referer)==null?void 0:o.trim())!=null?p:"",c=(i=t==null?void 0:t.now)!=null?i:new Date;return T({sessionId:e,ephemeral:!1,utmParams:(a=t==null?void 0:t.utmParams)!=null?a:{},clickIds:(l=t==null?void 0:t.clickIds)!=null?l:{},deviceClass:n?_e(n):"desktop",trafficSource:s?Ae(s,t==null?void 0:t.appOrigin):"direct",referrerDomain:Re(s),timeOfDay:Oe(c),dayOfWeek:(h=["sun","mon","tue","wed","thu","fri","sat"][c.getDay()])!=null?h:"sun",automation:(t==null?void 0:t.webdriver)===!0||Ze(n)},t!=null&&t.landingPath?{landingPath:t.landingPath.split(/[?#]/)[0]}:{})}var Pe=require("@sentientui/policy");function $e(e){return T(T(T({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 De(e){let t=$e(e);return(0,Pe.slotResultFor)(t,(0,Pe.slotBaselineArm)(t))}function on(e){let t={};for(let n of e)t[n.id]=De(n);return t}function et(e){return typeof e=="string"?e:(0,Pe.canonicalArm)(e)}var bt=require("@sentientui/policy");var nt=require("@sentientui/policy");var rn="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",lo="[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.",sn=!1,tt=!1;function uo(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function an(e){var i;let t=Je({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),n=(i=t.getSessionId())!=null?i:"local",s=uo(),c=import("@sentientui/core/local").then(a=>{let l=a;return l.LOCAL_ENGINE_AVAILABLE?(sn||(sn=!0,console.info(lo)),l):(tt||(tt=!0,console.error(rn)),null)}).catch(()=>(tt||(tt=!0,console.error(rn)),null)),r=null,u={low:.15,medium:.5,high:.85},o=(()=>{var l;if(e.initialPersona)return T({},e.initialPersona);let a=ke(e.apiKey||"local");return a?{persona:a.persona,confidence:(l=u[a.band])!=null?l:.15}:null})();function p(a){let l=document.documentElement;l.dataset.sentientPersona===void 0&&(l.dataset.sentientPersona=a.persona,l.dataset.sentientConfidence=(0,nt.confidenceBand)(a.confidence))}return{isLocal:!0,async decide(a){var y,S,v;let l=await c;if(!l)return null;let h=l.createLocalEngine({sessionId:n,forcedPersona:s}).decide(a);return r=re(T({},h),{layoutOrder:(S=(y=h.layoutOrder)!=null?y:r==null?void 0:r.layoutOrder)!=null?S:null,slots:T(T({},(v=r==null?void 0:r.slots)!=null?v:{}),h.slots)}),Ie(e.apiKey||"local",{v:1,persona:r.persona,band:(0,nt.confidenceBand)(r.confidence),slots:r.slots,layoutOrder:r.layoutOrder,savedAt:Date.now()}),p(h),h},getSlotResult(a){var l,h,y;return(y=(h=r==null?void 0:r.slots[a])!=null?h:(l=e.initialSlots)==null?void 0:l[a])!=null?y:null},getSlotConfig(a){var l,h;return(h=(l=e.initialSlotConfig)==null?void 0:l[a])!=null?h:null},getSitePalette(){var a;return(a=e.initialPalette)!=null?a:null},reportSlots(){},getPersona(){let a=r!=null?r:o;return a?{persona:a.persona,confidence:a.confidence,band:(0,nt.confidenceBand)(a.confidence)}:null},async assign(a,l){var S;let h=await c;return!h||!l||l.length===0?l!=null&&l[0]?{variantId:l[0],assignmentTtlMs:0}:null:{variantId:(S=h.createLocalEngine({sessionId:n,forcedPersona:s}).decide({components:[{id:a,variantIds:l}]}).assignments[a])!=null?S:l[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>t.destroy()}}var po=["none","sm","md","lg"],go=["start","center","end","stretch"],fo=["start","center","end","between"],mo=["sm","md","lg"],yo=["normal","medium","bold"],So=["default","muted","accent"],ho=["primary","secondary","ghost"],bo=["left","center","right"],vo=["auto","square","landscape","wide"],wo=["cover","contain"],Eo=[2,3,4],xo=[1,2,3,4],ko=["default","raised"],Io=["none","sm","md","lg"],Co=["measure"],To=["input","textarea","select"],_o=["text","email","number","tel"],Ao=5,Ro=8,Oo=64,Po=5,Do=12,No=4,Mo=500;function cn(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(cn):!1}function ln(e,t,n,s){let c=[];{let o=!1,p=[],i=()=>{if(o)return;let a=Date.now();for(p.push(a);p.length>0&&a-p[0]>500;)p.shift();p.length>=3&&(o=!0,e("rage_click"))};t.addEventListener("click",i),c.push(()=>t.removeEventListener("click",i))}{let r=!1,u=o=>{if(r||!(o.target instanceof Node)||!t.contains(o.target)&&t!==o.target)return;r=!0;let p=typeof window!="undefined"?window.getSelection():null,i=p?p.toString().length:0;e("text_copy",{selectionLength:i})};document.addEventListener("copy",u),c.push(()=>document.removeEventListener("copy",u))}{let r=!1,u=!1,o=null,p=()=>{o!==null&&(clearTimeout(o),o=null)},i=()=>{r||!u||(p(),o=setTimeout(()=>{!r&&u&&(r=!0,e("scroll_hesitation"))},3e3))},a=()=>{p(),i()},l=y=>{for(let S of y)u=S.intersectionRatio>.3,u?i():p()},h=new IntersectionObserver(l,{threshold:[.3]});h.observe(t),window.addEventListener("scroll",a,{passive:!0}),c.push(()=>{h.disconnect(),window.removeEventListener("scroll",a),p()})}if((s==null?void 0:s.tabLoss)!==!1){let r=!1,u=n!=null?n:Date.now(),o=()=>{if(r||document.visibilityState!=="hidden")return;let p=Date.now()-u;p<15e3&&(r=!0,e("tab_loss",{timeOnPage:p}))};document.addEventListener("visibilitychange",o),c.push(()=>document.removeEventListener("visibilitychange",o))}return()=>{for(let r of c)r()}}function Lo(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var gn="https://api.sentient-ui.com/v1/events",J=new Map,fn=null;function mn(e,t){let n=J.get(e);n&&n.upgrade&&(n.reinit=t)}function Bo(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var Ko=3;function St(){return Xe()}function ot(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function Go(){let e=new WeakMap,t=new Map,n=!1,s=(o,p,i)=>{let a=o.get(p);return i===null?a?!0:(o.set(p,new Set),!1):a?a.has(i)?!0:(a.add(i),!1):(o.set(p,new Set([i])),!1)},c=typeof window!="undefined"&&"event"in window,r=()=>{if(!c)return;let o=window.event;return typeof Event=="function"&&o instanceof Event?o:void 0},u=()=>{if(c){Promise.resolve().then(()=>{n=!1,t.clear()});return}let o=!1,p=()=>{o||(o=!0,n=!1,t.clear())};if(setTimeout(p,0),typeof MessageChannel=="function"){let i=new MessageChannel;i.port1.onmessage=()=>{i.port1.close(),i.port2.close(),p()},i.port2.postMessage(0)}};return{firedBefore(o,p){let i=r();if(i){let l=e.get(i);return l||(l=new Map,e.set(i,l)),s(l,o,p)}let a=s(t,o,p);return!a&&!n&&(n=!0,u()),a}}}var yn=new Set;function $o(e,t,n){let s=typeof window=="undefined"?null:window.history;if(!s)return()=>{};let c=!1,r,u=()=>{if(c)return;let i=ot();!i||i===r||(r=i,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${i}`))},o=[];for(let i of["pushState","replaceState"]){let a=s[i],l=function(...h){let y=a.apply(this,h);return u(),y};s[i]=l,o.push([i,a,l])}window.addEventListener("popstate",u);let p=ot();return p&&yn.has(`${t}:${p}`)?r=p:u(),()=>{if(!c){c=!0,window.removeEventListener("popstate",u);for(let[i,a,l]of o)s[i]===l&&(s[i]=a)}}}var Ue={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}),flush:()=>{},dispose:()=>{},destroy:()=>{}};function Uo(){try{return mt(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function Sn(e){return e.replace(/\/events\/?$/,"")}function Fe(){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 hn(e){var p;if(typeof window=="undefined")return;let t=e!=null?e:fn;if(!t){console.warn("[sentient] grantConsent() called before init()");return}let n=J.get(t);if(!n){console.warn("[sentient] grantConsent() called before init()");return}let{config:s,upgrade:c,reinit:r}=n;if(!c){n.upgradeBlockedReason&&console.warn(n.upgradeBlockedReason);return}if(s.respectDoNotTrack!==!1&&Fe())return;let u=(r!=null?r:wt)(re(T({},s),{consent:!0}));c(u);let o=(p=J.get(t))==null?void 0:p.dispose;J.set(t,{config:re(T({},s),{consent:!0}),upgrade:null,dispose:o})}function Fo(e,t){var ee;let n=e.preConsentBehavior==="statistical_winner",s=Sn((ee=e.ingestUrl)!=null?ee:gn),c={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},r=new Map,u=new Map,o={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(f,b,C){if(!n)return Promise.resolve(null);let m=r.get(f);return m?Promise.resolve(m):vt(u,f,async()=>{try{let A=new URLSearchParams({componentId:f});for(let Q of b!=null?b:[])A.append("variantIds[]",Q);let $=ue(5e3),N;try{let Q=await fetch(`${s}/winner?${A.toString()}`,{headers:c,signal:$.signal});if(!Q.ok)return b!=null&&b[0]?{variantId:b[0],assignmentTtlMs:0}:null;N=await Q.json()}finally{$.clear()}let H={variantId:N.variantId,assignmentTtlMs:0};return r.set(f,H),H}catch(A){return b!=null&&b[0]?{variantId:b[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}},p=!1,i=new Set,a=[],l=[],h=[],y=()=>{for(let[,,f]of h.splice(0))f(null);S.length=0},S=[],v=!1,M=()=>{if(p)return;v=!0;let f=J.get(e.apiKey);(f==null?void 0:f.upgrade)===B&&J.set(e.apiKey,{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): client released before consent; call init() again"})},_=[],G=()=>{setTimeout(()=>{var f;try{(f=_.shift())==null||f(o)}catch(b){}_.length&&G()})},L=f=>{p?_.length?_.push(f):f(o):!t&&!v&&S.length<100?S.push(f):v&&e.debug&&console.warn("[sentient] goal dropped: client released")},F={get gated(){return!p&&!t},get released(){return v&&!p},takeHeld:()=>S.splice(0),track:f=>o.track(f),goal:((f,b,C,m)=>L(A=>A.goal(f,b,C,m))),componentGoal:(f,b,C)=>o.componentGoal(f,b,C),identify:f=>o.identify(f),getAssignment:(f,b)=>o.getAssignment(f,b),assign:(f,b,C,m)=>o.assign(f,b,C,m),decide:f=>p?o.decide(f):v||t?Promise.resolve(null):new Promise(b=>h.push([f,pn(),b])),getSlotResult:f=>o.getSlotResult(f),isSlotDecided:f=>{var b,C;return(C=(b=o.isSlotDecided)==null?void 0:b.call(o,f))!=null?C:!0},getSlotConfig:f=>o.getSlotConfig(f),getSitePalette:()=>o.getSitePalette(),getStyleVocabulary:()=>{var f,b;return(b=(f=o.getStyleVocabulary)==null?void 0:f.call(o))!=null?b:null},reportSlots:(f,b,C,m)=>o.reportSlots(f,b,C,m),reportSkeleton:(f,b)=>{var C;return(C=o.reportSkeleton)==null?void 0:C.call(o,f,b)},reportDrift:(f,b,C,m)=>{var A;return(A=o.reportDrift)==null?void 0:A.call(o,f,b,C,m)},requestSlots:(f,b,C)=>{var m;return p?(m=o.requestSlots)==null?void 0:m.call(o,f,b,C):a.push([f,b,C])},decideSlots:f=>{var b;return p?(b=o.decideSlots)==null?void 0:b.call(o,f):l.push(...f)},cancelSlots:f=>{var C;if(p)return(C=o.cancelSlots)==null?void 0:C.call(o,f);let b=new Set(f);for(let m of a)m[0]=m[0].filter(A=>!b.has(A));l=l.filter(m=>!b.has(m.id))},onSlotsChanged:f=>(i.add(f),()=>{i.delete(f)}),getPersona:()=>o.getPersona(),fetchWeights:()=>o.fetchWeights(),getGraph:()=>o.getGraph(),flush:()=>o.flush(),dispose:()=>(M(),y(),o.dispose()),destroy:()=>(M(),y(),p?o.destroy():Qt(e.apiKey))};function B(f){var C,m,A;o=f,p=!0,S.length&&(_.push(...S.splice(0)),G());let b=pn();for(let[$,N,H]of h.splice(0))N!==b?H(null):f.decide($).then(H,()=>H(null));(C=f.onSlotsChanged)==null||C.call(f,()=>i.forEach($=>$()));for(let[$,N,H]of a.splice(0))$.length>0&&((m=f.requestSlots)==null||m.call(f,$,N,H));l.length>0&&((A=f.decideSlots)==null||A.call(f,l.splice(0)))}return{proxy:F,setInner:B}}function pn(){return typeof location=="undefined"?"":location.pathname+(/^#!?\//.test(location.hash)?location.hash:"")}function vt(e,t,n){let s=e.get(t);if(s)return s;let c=(async()=>{try{return await n()}finally{e.delete(t)}})();return e.set(t,c),c}function wt(e){var Rt,Ot,Pt,Dt,Nt,Mt,Lt,Bt,Kt,Gt;if(typeof window=="undefined")return Ue;e.nonce&&qt(e.nonce),fn=e.apiKey||"local";let t=J.get(e.apiKey||"local");if(t!=null&&t.dispose)try{t.dispose()}catch(d){}let n=e.respectDoNotTrack!==!1&&Fe(),s=e.consent===!1||n,c=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!c&&e.localMode!==!1)return J.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."}),s?Ue:an(e);if(s){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."),J.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."}),Ue;let{proxy:d,setInner:g}=Fo(e,n);return J.set(e.apiKey,{config:e,upgrade:n?null:g}),d}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."),Ue;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),Ue;let r=(Rt=e.ingestUrl)!=null?Rt:gn,u=Date.now(),o=Je({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),p=Zt(void 0,e.apiKey),i=!1,a=me(e.apiKey),l=()=>!i&&me(e.apiKey)===a,h=re(T({},p),{set:(...d)=>{l()&&p.set(...d)}}),y=Vt({ingestUrl:r,apiKey:e.apiKey}),S=Sn(r),v={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},M=new Set,_=Xt({url:`${S}/goals`,apiKey:e.apiKey,headers:v,onDrop:(d,g)=>{if(!e.debug){if(M.has(g))return;M.add(g)}console.warn(`[sentient] goal dropped (HTTP ${g}) \u2014 this will not be retried. `+(g===400?"The session was not found: call init() and let the session upsert complete before firing goals.":g===401||g===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),d)}}),G=_e((Ot=navigator.userAgent)!=null?Ot:""),L=window.location.origin,F=Ae((Pt=document.referrer)!=null?Pt:"",L),B=(Dt=e.sessionSegment)!=null?Dt:`${G}:${F}`,ee=new Map,f=new Map,b=new Map,C=new Set,m=new Map,A=null,$=null,N=null,H=new Set,Q=new Set,ge=new Map,x=new Map,K=new Set,fe=new Set,Ee=new Set,te=null,he=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,Ne=new Set,ce=new Set,be=new Set,se=new Map,it=null,We=new Set,Me=new Map,at=null,On=2,Ct=new Map,ie=!1,Tt=(d,g,E)=>{var w;let R=new Set,P=1;for(let k of d){g.delete(k);let I=((w=Ct.get(k))!=null?w:0)+1;Ct.set(k,I),I<=On&&(R.add(k),I>P&&(P=I))}R.size>0&&setTimeout(()=>{ie||E(R)},Se(P))},ct=d=>{for(let g of d)b.has(g.id)||b.set(g.id,De(g))};if(e.initialSlots)for(let[d,g]of Object.entries(e.initialSlots))b.set(d,g),C.add(d);if(e.initialSlotConfig)for(let[d,g]of Object.entries(e.initialSlotConfig))m.set(d,g);e.initialPalette&&(A=e.initialPalette),e.initialVocabulary&&($=e.initialVocabulary);let le=ke(e.apiKey);if(le){for(let[d,g]of Object.entries(le.slots))b.has(d)||b.set(d,g);for(let[d,g]of Object.entries((Nt=le.slotConfig)!=null?Nt:{}))m.has(d)||m.set(d,g);!A&&le.palette&&(A=le.palette),!$&&le.vocabulary&&($=le.vocabulary)}let _t={low:.15,medium:.5,high:.85};if(e.initialPersona)N=T({},e.initialPersona);else{let d=document.documentElement.dataset;d.sentientPersona?N={persona:d.sentientPersona,confidence:(Lt=_t[(Mt=d.sentientConfidence)!=null?Mt:"low"])!=null?Lt:.15}:le&&(N={persona:le.persona,confidence:(Bt=_t[le.band])!=null?Bt:.15})}if(e.initialAssignments)for(let[d,g]of Object.entries(e.initialAssignments))h.set(d,B,{variantId:g,assignedAt:Date.now(),segment:B,confidence:1});let ve=Promise.resolve(),At=o.getSessionId();if(At){let d=Re((Kt=document.referrer)!=null?Kt:""),{utmParams:g,clickIds:E}=Uo(),R=T(T(T(T({sessionId:At,deviceClass:G,trafficSource:F,referrerDomain:d,utmParams:g,clickIds:E,landingPath:typeof location!="undefined"?location.pathname:void 0,timeOfDay:Oe(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:o.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||Ze((Gt=navigator.userAgent)!=null?Gt:"")},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}:{}),P=async()=>{for(let w=0;;w++){if(ie||!l())return;let k=ue(5e3);try{let I=await fetch(`${S}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(R),headers:v,signal:k.signal});if(I.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(I.ok||Ce(I)==="dropped")return}catch(I){}finally{k.clear()}if(w>=Ko){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(I=>setTimeout(I,Se(w+1)))}};try{ve=P()}catch(w){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:y});let Pn=Go(),xe=null,lt=!1,W={goal(d,g={},E=1,R=0){var V,q,Y,oe,Z,X,O;let P=o.getSessionId();if(!P||ie||!l())return;let w=Bo(g)?g:{metadata:g},k=[d,(V=w.externalId)!=null?V:"",(q=w.stepIndex)!=null?q:R,(Y=w.weight)!=null?Y:E].join("\0"),I=w.value!==void 0?`${w.value}\0${(oe=w.currency)!=null?oe:""}`:null;if(Pn.firedBefore(k,I)){e.debug&&console.log(`[sentient] goal("${d}") already recorded for this action \u2014 not sent twice`);return}let U=St(),D={sessionId:P,name:d,metadata:(Z=w.metadata)!=null?Z:{},weight:(X=w.weight)!=null?X:E,stepIndex:(O=w.stepIndex)!=null?O:R,goalId:U,value:w.value,currency:w.currency,externalId:w.externalId};e.debug&&console.log("[sentient] goal",D);let z={id:U,body:JSON.stringify(D)};ve.then(()=>_.send(z))},componentGoal(d,g,E){var U,D,z;let R=o.getSessionId();if(!R||ie||!l())return;let P=h.get(d,B),w=P?null:(U=b.get(d))!=null?U:null;if(!P&&w===null){e.debug&&console.warn(`[sentient] componentGoal("${d}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}if(!P&&!C.has(d)){e.debug&&console.warn(`[sentient] componentGoal("${d}"): slot not decided this session \u2014 not attributed`);return}let k=P?P.variantId:et(w),I={id:St(),sessionId:R,projectId:e.apiKey,componentId:d,variantId:k,eventType:"goal_achieved",goalType:g,payload:T({reward:(D=E==null?void 0:E.reward)!=null?D:1,goalValue:E==null?void 0:E.value,currency:E==null?void 0:E.currency},(z=E==null?void 0:E.metadata)!=null?z:{}),timestamp:Date.now(),timeInSession:Date.now()-u,path:ot()};e.debug&&console.log("[sentient] componentGoal",I),ve.then(()=>{!ie&&l()&&y.push(I)})},identify(d){let g=o.getSessionId();!g||ie||!l()||ve.then(()=>{fetch(`${S}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:g,userId:d,ephemeral:o.isEphemeral()}),headers:v}).catch(()=>{})})},track(d){let g=o.getSessionId();if(!g||ie||!l()||d.eventType==="variant_assigned"&&b.get(d.componentId)!==void 0&&!C.has(d.componentId)&&!h.get(d.componentId,B))return;let E=re(T({path:ot()},d),{id:St(),sessionId:g,timestamp:Date.now(),timeInSession:Date.now()-u});e.debug&&console.log("[sentient] track",E),ve.then(()=>y.push(E))},getAssignment(d,g){return h.get(d,g)},async assign(d,g,E,R){let P=o.getSessionId();if(!P)return null;let w=h.get(d,B);if(w&&(g!=null&&g.length||w.content!==void 0)){let k=w.ttlMs&&w.ttlMs>0?Math.max(0,w.assignedAt+w.ttlMs-Date.now()):0;return{variantId:w.variantId,assignmentTtlMs:k,content:w.content}}return vt(ee,d,async()=>{if(!await dt(ve,2500)||ie||!l())return null;let k=ue(3e4);try{let I={sessionId:P,componentId:d,variantIds:g};R!==void 0?I.agentDataByVariant=R:E!==void 0&&(I.agentData=E);let U=await fetch(`${S}/assign`,{method:"POST",body:JSON.stringify(I),headers:v,signal:k.signal});if(!U.ok)return null;let D=await U.json();return h.set(d,B,T({variantId:D.variantId,assignedAt:Date.now(),segment:B,confidence:1,content:D.content},D.assignmentTtlMs&&D.assignmentTtlMs>0?{ttlMs:D.assignmentTtlMs}:{})),D}catch(I){return null}finally{k.clear()}})},async decide(d){var w,k;let g=o.getSessionId();if(!g)return null;let E=(w=d.slots)!=null?w:[],R={sessionId:g};d.sections&&d.sections.length>0&&(R.sections=d.sections.map(I=>({id:I}))),R.components=(k=d.components)!=null?k:[],E.length>0&&(R.slots=E.map($e)),d.slotsFrom==="registry"&&(R.slotsFrom="registry",d.registrySlotIds&&(R.registrySlotIds=d.registrySlotIds),d.bootstrap===!1&&(R.bootstrap=!1),d.render&&Object.keys(d.render).length>0&&(R.render=d.render)),d.v&&(R.v=d.v),typeof d.pp=="number"&&(R.pp=d.pp),e.persona&&(R.persona=e.persona);let P=JSON.stringify(R);return vt(f,P,async()=>{var U,D,z,V,q,Y,oe,Z;if(!await dt(ve,2500)||ie||!l())return ct(E),null;let I=ue(3e4);try{let X=await fetch(`${S}/decide`,{method:"POST",body:P,headers:v,signal:I.signal});if(!X.ok)return ct(E),null;let O=await X.json(),ne={};for(let j of E){let de=(U=O.slots)==null?void 0:U[j.id];if(de!==void 0){ne[j.id]=de,b.set(j.id,de),C.add(j.id);continue}let $t=b.get(j.id);if($t!==void 0)ne[j.id]=$t;else{let Ut=De(j);ne[j.id]=Ut,b.set(j.id,Ut)}}if(O.slots)for(let[j,de]of Object.entries(O.slots))j in ne||(ne[j]=de,b.set(j,de),C.add(j));let Dn=N!=null&&N.persona!=="unknown";O.persona&&!(O.persona==="unknown"&&Dn)?N={persona:O.persona,confidence:(D=O.confidence)!=null?D:0}:N||(N={persona:"unknown",confidence:0});for(let[j,de]of Object.entries((z=O.assignments)!=null?z:{}))h.set(j,B,{variantId:de,assignedAt:Date.now(),segment:B,confidence:1});if(O.slotConfig)for(let[j,de]of Object.entries(O.slotConfig))m.set(j,de);O.palette&&(A=O.palette),O.vocabulary&&($=O.vocabulary);for(let j of(V=d.registrySlotIds)!=null?V:[])(q=O.slotConfig)!=null&&q[j]||(m.delete(j),b.delete(j),C.delete(j));return l()&&Ie(e.apiKey,T(T(T({v:1,persona:N.persona,band:(0,bt.confidenceBand)(N.confidence),slots:Object.fromEntries(b),layoutOrder:(Y=O.layoutOrder)!=null?Y:null,savedAt:Date.now()},m.size>0?{slotConfig:Object.fromEntries(m)}:{}),A?{palette:A}:{}),$?{vocabulary:$}:{})),T(T(T(T(T({layoutOrder:(oe=O.layoutOrder)!=null?oe:null,assignments:(Z=O.assignments)!=null?Z:{},slots:ne,persona:N.persona,confidence:N.confidence},O.slotConfig?{slotConfig:O.slotConfig}:{}),O.goals?{goals:O.goals}:{}),O.sectionMap?{sectionMap:O.sectionMap}:{}),O.palette?{palette:O.palette}:{}),O.vocabulary?{vocabulary:O.vocabulary}:{})}catch(X){return ct(E),null}finally{I.clear()}})},getSlotResult(d){var g;return(g=b.get(d))!=null?g:null},isSlotDecided(d){return C.has(d)},getSlotConfig(d){var g;return(g=m.get(d))!=null?g:null},reportSlots(d,g,E,R){var w;let P={};for(let[k,I]of Object.entries(R!=null?R:{}))for(let U of I){let D=`${k}|${U.key}`;!he.test(k)||Ee.has(D)||(Ee.add(D),((w=P[k])!=null?w:P[k]=[]).push(U))}Object.keys(P).length>0&&fetch(`${S}/slots/observed`,{method:"POST",headers:v,body:JSON.stringify({slotIds:Object.keys(P),authoredArms:P})}).catch(()=>{});for(let k of d)if(!(typeof k!="string"||k.length===0)){if(!he.test(k)){Lo()&&!Ne.has(k)&&(Ne.add(k),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(k)} 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(!H.has(k)){H.add(k),Q.add(k);let I=g==null?void 0:g[k];if(typeof I=="string"){let D=I.replace(/\s+/g," ").trim().slice(0,400);D!==""&&ge.set(k,D)}let U=E==null?void 0:E[k];U!==void 0&&x.set(k,U)}}Q.size===0||te!=null||(te=setTimeout(()=>{te=null;let k=[...Q];Q.clear();for(let I=0;I<k.length;I+=20){let U=k.slice(I,I+20),D={},z={};for(let V of U){let q=ge.get(V);q!==void 0&&(D[V]=q,ge.delete(V));let Y=x.get(V);Y!==void 0&&(z[V]=Y,x.delete(V))}fetch(`${S}/slots/observed`,{method:"POST",headers:v,body:JSON.stringify(T(re(T(T({slotIds:U},Object.keys(D).length>0?{baselineTexts:D}:{}),Object.keys(z).length>0?{baselineSkeletons:z}:{}),{pagePaths:Object.fromEntries(U.map(V=>[V,location.pathname]))}),Object.keys(D).length>0&&o.getSessionId()?{sessionId:o.getSessionId()}:{}))}).catch(()=>{})}},1e3))},reportSkeleton(d,g){!he.test(d)||K.has(d)||(K.add(d),fetch(`${S}/slots/observed`,{method:"POST",headers:v,body:JSON.stringify({slotIds:[d],baselineSkeletons:{[d]:g}})}).catch(()=>{}))},reportDrift(d,g,E,R){let P=`${d}|${g}`,w=o.getSessionId();!w||fe.has(P)||(fe.add(P),fetch(`${S}/slots/drift`,{method:"POST",headers:v,body:JSON.stringify({sessionId:w,reports:[{slotId:d,expectedFp:g,observedFp:E,reason:R}]})}).catch(()=>{}))},requestSlots(d,g,E){var R,P;for(let w of d)be.has(w)||(be.add(w),he.test(w)?se.set(w,{text:g==null?void 0:g[w],render:(R=E==null?void 0:E.render)==null?void 0:R[w],skeleton:(P=E==null?void 0:E.skeletons)==null?void 0:P[w]}):W.reportSlots([w]));se.size===0||it!=null||(it=setTimeout(()=>{it=null;let w=[...se];se.clear();for(let k=0;k<w.length;k+=50){let I=w.slice(k,k+50),U={};for(let[D,z]of I)z.render&&(U[D]=z.render);W.decide({slotsFrom:"registry",registrySlotIds:I.map(([D])=>D),bootstrap:!1,render:U}).then(D=>{var z,V;if(D){let q={},Y={},oe=[];for(let[Z,X]of I){let O=(z=D.slotConfig)==null?void 0:z[Z];if(O){O.needsSkeleton&&X.skeleton&&((V=W.reportSkeleton)==null||V.call(W,Z,X.skeleton));continue}oe.push(Z),X.text&&(q[Z]=X.text),X.skeleton&&(Y[Z]=X.skeleton)}oe.length>0&&W.reportSlots(oe,q,Y)}else Tt(I.map(([q])=>q),be,q=>{var X;let Y={},oe={},Z={};for(let[O,ne]of I)q.has(O)&&(ne.text&&(Y[O]=ne.text),ne.render&&(oe[O]=ne.render),ne.skeleton&&(Z[O]=ne.skeleton));(X=W.requestSlots)==null||X.call(W,[...q],Y,{render:oe,skeletons:Z})});ce.forEach(q=>q())})}},0))},decideSlots(d){for(let g of d)We.has(g.id)||(We.add(g.id),Me.set(g.id,g));Me.size===0||at!=null||(at=setTimeout(()=>{at=null;let g=[...Me.values()];Me.clear();for(let E=0;E<g.length;E+=30){let R=g.slice(E,E+30);W.decide({slots:R}).then(P=>{P||Tt(R.map(w=>w.id),We,w=>{var k;return(k=W.decideSlots)==null?void 0:k.call(W,R.filter(I=>w.has(I.id)))}),ce.forEach(w=>w())})}},0))},cancelSlots(d){for(let g of d)se.delete(g)&&be.delete(g),Me.delete(g)&&We.delete(g)},onSlotsChanged(d){return ce.add(d),()=>{ce.delete(d)}},getStyleVocabulary(){return $},getSitePalette(){return A},getPersona(){return N?{persona:N.persona,confidence:N.confidence,band:(0,bt.confidenceBand)(N.confidence)}:null},async fetchWeights(){var g;let d=ue(5e3);try{let E=await fetch(`${S}/weights`,{headers:v,signal:d.signal});return E.ok?(g=(await E.json()).components)!=null?g:[]:[]}catch(E){return[]}finally{d.clear()}},getGraph(){return{pageNodes:[],capturedAt:0}},flush(){y.flush(),_.flush()},dispose(){var d;xe==null||xe(),lt=!0,ie=!0,y.destroy(),_.destroy(),((d=J.get(e.apiKey))==null?void 0:d.dispose)===W.dispose&&J.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var d;xe==null||xe(),lt=!0,ie=!0,i=!0,qe(e.apiKey),y.destroy({forget:!0}),_.destroy({forget:!0}),o.destroy(),h.clear(),((d=J.get(e.apiKey))==null?void 0:d.dispose)===W.dispose&&J.delete(e.apiKey);try{localStorage.removeItem(ye+e.apiKey),localStorage.removeItem(Ke(e.apiKey)),localStorage.removeItem(Ge(e.apiKey)),localStorage.removeItem(`_snt_graph_nodes${ae(e.apiKey)}`),localStorage.removeItem("_snt_graph_edges")}catch(g){}e.debug&&console.log("[sentient] destroyed")}};if(J.set(e.apiKey,{config:e,upgrade:null,dispose:W.dispose}),xe=$o(W,e.apiKey,d=>{ve.then(()=>{lt||yn.add(d)})}),e.debug){let d=window;d.__sentient&&(d.__sentient.client=W)}return W}var bn="_snt_graph_edges",jo={pricing:["features","faq"],features:["pricing"],faq:["pricing"],social_proof:["cta"],cta:["social_proof","hero","trust"],hero:["cta"],comparison:["pricing"],trust:["cta"]};function Wo(e){var t;return(t=jo[e])!=null?t:[]}function Ho(e,t){try{let n=localStorage.getItem(e);return n?JSON.parse(n):t}catch(n){return t}}function qo(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(n){}}var zo=new Set(["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"]);function Vo(e){return zo.has(e)?e:"generic"}function Et(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch(t){return"/"}}function Xo(e,t,n){let s=`${e}:${t}:${n.join(",")}`,c=5381;for(let r=0;r<s.length;r++)c=(c<<5)+c+s.charCodeAt(r)&4294967295;return(c>>>0).toString(16).padStart(8,"0")}function vn(e){let t=new Map,n=new Map,s=`_snt_graph_nodes${ae(e==null?void 0:e.apiKey)}`,c=()=>{typeof window!="undefined"&&qo(s,[...t.values()])};if(typeof window!="undefined"){let r=Ho(s,[]);for(let u of r)t.set(u.componentId,u);try{localStorage.removeItem(bn)}catch(u){}}return{addPageNode(r){t.set(r.componentId,r),c()},addStructuralEdge(r){let u=`${r.fromComponentId}->${r.toComponentId}`;n.set(u,r)},syncOnce(){var u,o;if(!(e!=null&&e.syncUrl)||typeof window=="undefined")return;let r=[...t.values()];if(r.length!==0)try{let p=new Map;for(let y of r){let S=(u=p.get(y.semanticType))!=null?u:[];S.push(y),p.set(y.semanticType,S)}let i=[],a=new Set;for(let y of r)for(let S of Wo(y.semanticType)){let v=(o=p.get(S))!=null?o:[];for(let M of v){if(M.componentId===y.componentId)continue;let _=`semantic:${y.componentId}->${M.componentId}`;a.has(_)||(a.add(_),i.push({fromComponentId:y.componentId,toComponentId:M.componentId,type:"semantic",weight:.4,confidence:.9}))}}let l=new Set(r.map(y=>y.componentId));for(let y of n.values()){if(!l.has(y.fromComponentId)||!l.has(y.toComponentId))continue;let S=`structural:${y.fromComponentId}->${y.toComponentId}`;a.has(S)||(a.add(S),i.push({fromComponentId:y.fromComponentId,toComponentId:y.toComponentId,type:"structural",weight:y.weight,confidence:1}))}let h=re(T(T({pageUrl:Et(window.location.href)},e.sessionId?{sessionId:e.sessionId}:{}),e.projectId?{projectId:e.projectId}:{}),{nodes:r.map(y=>{let S=Vo(y.semanticType);return{componentId:y.componentId,semanticType:S,answers:y.answers,contentHash:Xo(y.componentId,S,y.answers),prominenceScore:y.prominenceScore,depthInPage:y.depth}}),edges:i});fetch(e.syncUrl,{method:"POST",keepalive:!0,headers:T({"Content-Type":"application/json"},e.apiKey?{Authorization:`Bearer ${e.apiKey}`}:{}),body:JSON.stringify(h)}).catch(()=>{})}catch(p){}},snapshot(){return{pageNodes:[...t.values()],capturedAt:Date.now()}},destroy(){if(typeof window!="undefined")try{localStorage.removeItem(s),localStorage.removeItem(bn)}catch(r){}}}}var Qo=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function xt(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function Jo(e){return{tag:e.tagName.toLowerCase(),text:xt(e).slice(0,40)}}function wn(e){return e.replace(/["\\\]]/g,"\\$&")}function je(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function En(e,t){var u;let n=e.tagName.toLowerCase();if(!n)return null;let s=((u=e.getAttribute("class"))!=null?u:"").split(/\s+/).filter(o=>/^[a-zA-Z][\w-]*$/.test(o)),c=[n,...s.map(o=>`${n}.${o}`)];for(let o of c)if(je(t,o))return o;let r=e.parentElement;if(r&&r!==t){let o=En(r,t);if(o){for(let l of c){let h=`${o} > ${l}`;if(je(t,h))return h}let p=Array.from(r.children).filter(l=>l.tagName.toLowerCase()===n),i=p.indexOf(e),a=p.some(l=>l!==e&&xt(l)!==xt(e));if(i>=0&&a){let l=`${o} > ${n}:nth-of-type(${i+1})`;if(je(t,l))return l}}}return null}function rt(e,t){let n=Jo(e),s=e.getAttribute("id");if(s&&je(t,`#${wn(s)}`))return{v:1,id:s,fingerprint:n};for(let r of Qo){let u=e.getAttribute(r);if(u&&je(t,`[${r}="${wn(u)}"]`))return{v:1,dataAttr:{name:r,value:u},fingerprint:n}}let c=En(e,t);return c?{v:1,selector:c,fingerprint:n}:null}var kn=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],Yo={banner:"hero",navigation:"navigation",contentinfo:"footer"};function Zo(e){let t=e.ariaRole?Yo[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 er(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var tr=[["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]],nr=[["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]],xn={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function or(e){var n;let t=e.querySelector("h1, h2, h3");return((n=t==null?void 0:t.textContent)!=null?n:"").slice(0,160)}function rr(e){var c,r;let t=Zo(e);if(t)return{type:(c=xn[t])!=null?c:"generic",strength:"strong"};let n=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[u,o]of tr)if(o.test(n))return{type:u,strength:"strong"};for(let[u,o]of nr)if(o.test(e.bodyText))return{type:u,strength:"strong"};let s=er(e);return{type:(r=xn[s])!=null?r:"generic",strength:"weak"}}function sr(e){var s,c;let t=((s=e.textContent)!=null?s:"").replace(/\s+/g," ").trim(),n=e.getAttribute("role");return T({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((c=e.className)!=null?c:"")}`,headingText:or(e),bodyText:t.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:t.length},n?{ariaRole:n}:{})}function In(e){return rr(sr(e)).type}var ir=new Set(["SECTION","ARTICLE","MAIN","DIV","ASIDE"]),ar=200,cr="h1, h2, h3",lr="[data-sentient-id], section[aria-label], article[aria-label], main[aria-label], aside[aria-label]",Cn=30,dr=1500,ur={scan:async()=>({nodes:[],edges:[],scannedAt:0}),observe:()=>{},getProminenceScore:()=>0,destroy:()=>{}};function Tn(e,t,n){return n<=t?0:Math.max(0,Math.min(1,(e-t)/(n-t)))}function pr(e){var t,n,s;try{let c=e;for(let r of Object.keys(c)){if(!r.startsWith("__reactFiber")&&!r.startsWith("__reactInternalInstance"))continue;let u=c[r],o=(s=(t=u==null?void 0:u.type)==null?void 0:t.displayName)!=null?s:(n=u==null?void 0:u.type)==null?void 0:n.name;if(o&&o.length>1)return o}}catch(c){}}function gr(e){let t={};for(let n of Array.from(e.attributes))n.name.startsWith("data-")&&(t[n.name]=n.value);return t}var kt=new Set(kn);function fr(e,t){let n=e.getAttribute("data-sentient-id"),s=n?t==null?void 0:t[n]:void 0;if(s&&kt.has(s))return s;let c=e.getAttribute("data-sentient-type");if(c&&kt.has(c))return c;let r=e.getAttribute("role");return r&&kt.has(r)?r:In(e)}function mr(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 yr(e){let t=[],n=e;for(;n;){let s=n.parentElement;if(!s){t.push(n.tagName.toLowerCase());break}let c=Array.prototype.indexOf.call(s.children,n);t.push(`${n.tagName.toLowerCase()}[${c}]`),n=s}return t.reverse().join("/")}function Sr(e){var n;let t=(n=e.getAttribute("data-sentient-id"))!=null?n:e.getAttribute("id");return t||`${e.tagName.toLowerCase()}-${mr(yr(e))}`}function hr(e){let t=0,n=e.parentElement;for(;n;)t++,n=n.parentElement;return t}function It(e,t,n){var c,r,u,o;let s=e.querySelector(cr);return{componentId:Sr(e),semanticType:fr(e,n),ariaLabel:(c=e.getAttribute("aria-label"))!=null?c:void 0,headingText:(u=(r=s==null?void 0:s.textContent)==null?void 0:r.trim())!=null?u:void 0,isAboveFold:e.getBoundingClientRect().top<window.innerHeight,prominenceScore:t(e),depth:hr(e),reactComponentName:pr(e),dataAttributes:gr(e),locator:(o=rt(e,e.ownerDocument))!=null?o:void 0}}function _n(e){var r;let t=[],n=new Set,s="__root__",c=new Map;for(let[u,o]of e){let p=u.parentElement,i=s;for(;p;){if(e.has(p)){i=e.get(p);let l=e.get(u),h=`${i}->${l}`;!n.has(h)&&i!==l&&(n.add(h),t.push({fromComponentId:i,toComponentId:l,weight:.6}));break}p=p.parentElement}let a=(r=c.get(i))!=null?r:[];a.push(u),c.set(i,a)}for(let u of c.values()){if(u.length<2)continue;let o=u.length>Cn?u.slice(0,Cn):u;for(let p=0;p<o.length;p++)for(let i=p+1;i<o.length;i++){if(t.length>=dr)return t;let a=e.get(o[p]),l=e.get(o[i]);if(a===l)continue;let h=`${a}->${l}::sib`,y=`${l}->${a}::sib`;n.has(h)||(n.add(h),t.push({fromComponentId:a,toComponentId:l,weight:.3})),n.has(y)||(n.add(y),t.push({fromComponentId:l,toComponentId:a,weight:.3}))}}return t}function br(e,t){let n=[],s=new Set,c=new Map;return document.querySelectorAll("[data-sentient-id]").forEach(o=>{if(o instanceof Element&&!s.has(o)){s.add(o);let p=It(o,e,t);n.push(p),c.set(o,p.componentId)}}),document.querySelectorAll("section, article, main, aside").forEach(o=>{if(!(o instanceof Element)||s.has(o))return;let p=o.hasAttribute("aria-label"),i=o.hasAttribute("data-sentient-id");if(!p&&!i)return;s.add(o);let a=It(o,e,t);n.push(a),c.set(o,a.componentId)}),{nodes:n,edges:_n(c),elementToId:c}}function An(e={}){let{sectionTypes:t}=e;if(typeof window=="undefined")return ur;let n=null,s=0,c=null,r=new Map,u=y=>{try{let S=window.getComputedStyle(y),v=parseFloat(S.fontSize)||12,M=parseFloat(S.zIndex)||0,_=y.getBoundingClientRect(),G=Math.max(_.top,0),L=window.innerHeight||1,F=1/(G/L+1),B=Tn(v,12,48)*.4+F*.4+Tn(M,0,100)*.2;return Math.max(0,Math.min(1,B))}catch(S){return .5}},o=()=>new Promise(y=>{let S=()=>{let{nodes:v,edges:M,elementToId:_}=br(u,t);r.clear();for(let[G,L]of _)r.set(G,L);y({nodes:v,edges:M,scannedAt:Date.now()})};try{typeof requestIdleCallback=="function"?s=requestIdleCallback(S,{timeout:100}):S()}catch(v){S()}}),p=new Set,i=null,a=()=>{i=null;let y=[...p];p.clear();let S=[],v=new Set;for(let _ of y){if(!_.isConnected)continue;let G=[];ir.has(_.tagName)&&(_.hasAttribute("data-sentient-id")||_.hasAttribute("aria-label"))&&G.push(_);try{_.querySelectorAll(lr).forEach(L=>G.push(L))}catch(L){}for(let L of G){if(r.has(L))continue;let F=It(L,u,t);S.push(F),v.add(F.componentId),r.set(L,F.componentId)}}if(S.length===0||!c)return;for(let _ of[...r.keys()])_.isConnected||r.delete(_);let M=_n(r).filter(_=>v.has(_.fromComponentId)||v.has(_.toComponentId));c({nodes:S,edges:M,addedAt:Date.now()})};return{scan:o,observe:y=>{c=y;try{n=new MutationObserver(S=>{for(let v of S)v.type==="childList"&&v.addedNodes.forEach(M=>{M instanceof Element&&p.add(M)});p.size>0&&i===null&&(i=setTimeout(a,ar))}),n.observe(document.body,{childList:!0,subtree:!0})}catch(S){}},getProminenceScore:u,destroy:()=>{if(n&&(n.disconnect(),n=null),i!==null&&clearTimeout(i),i=null,p.clear(),s&&typeof cancelIdleCallback=="function")try{cancelIdleCallback(s)}catch(y){}s=0,c=null,r.clear()}}}var vr="https://api.sentient-ui.com/v1/events";function wr(e){var n;let t=s=>{try{let c=document.cookie.match(new RegExp(`(?:^|; )${s}=([^;]*)`));return c?decodeURIComponent(c[1]):void 0}catch(c){return}};return(n=e?t(we(e)):void 0)!=null?n:t(pe)}var st=new Map;function Rn(e){var y;let t=wt(e),n=e.respectDoNotTrack!==!1&&Fe(),s=e.consent===!1||n,c=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_"),r=e.localMode===!0||!c;if(!e.graph||r||typeof window=="undefined")return t;if(s)return n||mn(e.apiKey,S=>Rn(S)),t;let u=st.get(e.apiKey);if(u)try{u()}catch(S){}let o=An({sectionTypes:e.sectionTypes}),p=(y=e.ingestUrl)!=null?y:vr,i=vn({syncUrl:p.replace(/\/events\/?$/,"/graph/sync"),apiKey:e.apiKey,projectId:e.apiKey,sessionId:wr(e.apiKey)});o.scan().then(S=>{for(let v of S.nodes)i.addPageNode({id:v.componentId,componentId:v.componentId,semanticType:v.semanticType,answers:e.captureDomText&&v.headingText?[v.headingText]:[],prominenceScore:v.prominenceScore,depth:v.depth});for(let v of S.edges)i.addStructuralEdge(v);i.syncOnce()});let a=null,l=()=>{a!==null&&clearTimeout(a),a=setTimeout(()=>{a=null,i.syncOnce()},500)};o.observe(S=>{for(let v of S.nodes)i.addPageNode({id:v.componentId,componentId:v.componentId,semanticType:v.semanticType,answers:e.captureDomText&&v.headingText?[v.headingText]:[],prominenceScore:v.prominenceScore,depth:v.depth});for(let v of S.edges)i.addStructuralEdge(v);l()});let h=()=>{a!==null&&(clearTimeout(a),a=null),o.destroy(),i.destroy(),st.get(e.apiKey)===h&&st.delete(e.apiKey)};return st.set(e.apiKey,h),re(T({},t),{getGraph:()=>i.snapshot(),dispose:()=>{h(),t.dispose()},destroy:()=>{h(),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});
|
|
1
|
+
"use strict";var Kn=Object.create;var Be=Object.defineProperty,$n=Object.defineProperties,Un=Object.getOwnPropertyDescriptor,Fn=Object.getOwnPropertyDescriptors,jn=Object.getOwnPropertyNames,qt=Object.getOwnPropertySymbols,Wn=Object.getPrototypeOf,Vt=Object.prototype.hasOwnProperty,Hn=Object.prototype.propertyIsEnumerable;var zt=(e,t,n)=>t in e?Be(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,I=(e,t)=>{for(var n in t||(t={}))Vt.call(t,n)&&zt(e,n,t[n]);if(qt)for(var n of qt(t))Hn.call(t,n)&&zt(e,n,t[n]);return e},oe=(e,t)=>$n(e,Fn(t));var qn=(e,t)=>{for(var n in t)Be(e,n,{get:t[n],enumerable:!0})},Xt=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of jn(t))!Vt.call(e,c)&&c!==n&&Be(e,c,{get:()=>t[c],enumerable:!(s=Un(t,c))||s.enumerable});return e};var zn=(e,t,n)=>(n=e!=null?Kn(Wn(e)):{},Xt(t||!e||!e.__esModule?Be(n,"default",{value:e,enumerable:!0}):n,e)),Vn=e=>Xt(Be({},"__esModule",{value:!0}),e);var Tr={};qn(Tr,{BLOCK_ALIGNS:()=>ho,BLOCK_EMPHASES:()=>xo,BLOCK_FITS:()=>Co,BLOCK_GAPS:()=>So,BLOCK_GRID_COLUMNS:()=>To,BLOCK_HEADING_LEVELS:()=>_o,BLOCK_JUSTIFIES:()=>bo,BLOCK_MAX_WIDTHS:()=>Oo,BLOCK_PADS:()=>Ro,BLOCK_RATIOS:()=>Io,BLOCK_SIZES:()=>vo,BLOCK_SURFACES:()=>Ao,BLOCK_TEXT_ALIGNS:()=>ko,BLOCK_TONES:()=>wo,BLOCK_WEIGHTS:()=>Eo,FORM_FIELD_KINDS:()=>Po,FORM_INPUT_TYPES:()=>Do,LEGACY_SESSION_COOKIE_NAME:()=>pe,MAX_BLOCK_ARMS:()=>Ko,MAX_BLOCK_CHILDREN:()=>Go,MAX_BLOCK_DEPTH:()=>Bo,MAX_BLOCK_NODES:()=>Lo,MAX_BLOCK_TEXT_LEN:()=>$o,MAX_FORM_FIELDS:()=>No,MAX_FORM_SELECT_OPTIONS:()=>Mo,SNAPSHOT_STORAGE_KEY_PREFIX:()=>ye,STAGE_ATTRIBUTE:()=>nt,armOfResult:()=>tt,attachMicroSignalDetectors:()=>fn,baselineResultFor:()=>Ne,baselineSlots:()=>cn,containsFormBlock:()=>gn,deriveSessionSegment:()=>vt,detectDeviceClass:()=>Ae,detectTimeOfDay:()=>Pe,detectTrafficSource:()=>Re,exposedStage:()=>ot,grantConsent:()=>xn,init:()=>Mn,isDoNotTrackEnabled:()=>je,locatorFromElement:()=>ct,readSnapshot:()=>Ie,referrerDomainFromReferer:()=>Oe,renderPrePaintScript:()=>Jt,sanitizePageUrl:()=>Ct,sessionCookieName:()=>Ee,setStageAttribute:()=>rt,toWireSlot:()=>Ue,writeSnapshot:()=>Ce});module.exports=Vn(Tr);function ue(e){if(typeof AbortController!="function")return{clear:()=>{}};let t=new AbortController,n=setTimeout(()=>t.abort(),e);return{signal:t.signal,clear:()=>clearTimeout(n)}}function ft(e,t){return new Promise(n=>{let s=setTimeout(()=>n(!1),t),c=()=>{clearTimeout(s),n(!0)};e.then(c,c)})}var Xn;function Qt(e){Xn=typeof e=="string"&&e!==""?e:void 0}function ie(e){return e?`_${e.slice(0,12)}`:""}var pe="_snt_uid";function Ee(e){return`${pe}${ie(e)}`}var qe="__sntForgetGen",Qn=()=>{try{return window[qe]}catch(e){return}};function ze(e){var t,n;try{let s=window,c=(t=s[qe])!=null?t:s[qe]={};c[e]=((n=c[e])!=null?n:0)+1}catch(s){}}function me(e){var t,n;return(n=(t=Qn())==null?void 0:t[e])!=null?n:0}var ye="_snt_snap:";var Jn=["low","medium","high"];function Ie(e){try{let t=localStorage.getItem(ye+e);if(!t)return null;let n=JSON.parse(t);if(!n||typeof n!="object"||n.v!==1||typeof n.persona!="string"||typeof n.band!="string"||!Jn.includes(n.band)||typeof n.slots!="object"||n.slots===null||Array.isArray(n.slots)||!(n.layoutOrder===null||Array.isArray(n.layoutOrder))||typeof n.savedAt!="number"||!(Date.now()-n.savedAt<2592e6)||!(n.slotConfig===void 0||typeof n.slotConfig=="object"&&n.slotConfig!==null&&!Array.isArray(n.slotConfig)))return null;let s=n.vocabulary;return s!==void 0&&(typeof s!="object"||s===null||!Array.isArray(s.entries)||!Array.isArray(s.images))&&delete n.vocabulary,n.stage!==void 0&&typeof n.stage!="string"&&delete n.stage,n}catch(t){return null}}function Ce(e,t){try{localStorage.setItem(ye+e,JSON.stringify(t))}catch(n){}}function Jt(e,t){return'(function(){try{var N=navigator,W=window;if(N.doNotTrack=="1"||N.doNotTrack=="yes"||W.doNotTrack=="1"||N.msDoNotTrack=="1"||N.globalPrivacyControl)return;var r=localStorage.getItem('+JSON.stringify(ye+e).replace(/</g,"\\u003c")+');if(!r)return;var s=JSON.parse(r);if(!s||s.v!==1||typeof s.persona!=="string"||typeof s.band!=="string")return;if(!('+2592e6+">Date.now()-s.savedAt))return;var d=document.documentElement;"+(t!=null&&t.stage?'if(typeof s.stage=="string"&&!d.hasAttribute("data-sentient-stage"))d.setAttribute("data-sentient-stage",s.stage);':"")+'if(d.hasAttribute("data-sentient-persona"))return;d.setAttribute("data-sentient-persona",s.persona);d.setAttribute("data-sentient-confidence",s.band);}catch(e){}})();'}function Se(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function Te(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 Ve(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let s=JSON.parse(n);return Array.isArray(s)?(localStorage.removeItem(e),s.slice(-t)):[]}catch(n){return[]}}function Ge(e,t,n){try{let s=(()=>{try{let r=localStorage.getItem(n);if(!r)return[];let u=JSON.parse(r);return Array.isArray(u)?u:[]}catch(r){return[]}})(),c=new Map;for(let r of s)c.set(r.id,r);for(let r of e)c.set(r.id,r);localStorage.setItem(n,JSON.stringify([...c.values()].slice(-t)))}catch(s){}}function Xe(e,t){try{let n=localStorage.getItem(t);if(!n)return;let s=JSON.parse(n);if(!Array.isArray(s))return;let c=new Set(e),r=s.filter(u=>!c.has(u.id));if(r.length===s.length)return;r.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(r))}catch(n){}}var Yn=500,Zn=56*1024;function Ke(e){return`_snt_retry_${e.slice(0,12)}`}var eo={push:()=>{},flush:()=>{},destroy:()=>{}};function Yt(e){var H,Q,ge;if(typeof window=="undefined")return eo;let t=(H=e.flushIntervalMs)!=null?H:5e3,n=(Q=e.maxBatchSize)!=null?Q:20,s=(ge=e.maxRetrySize)!=null?ge:100,c=e.ingestUrl,r=e.apiKey,u=Ke(r),o=!1,p=me(r),i=(...x)=>{!o&&me(r)===p&&Ge(...x)},a=[],l=new Set,h=[],y=x=>{for(let G of x)S.delete(G),!l.has(G)&&(l.add(G),h.push(G));for(;h.length>Yn;){let G=h.shift();G&&l.delete(G)}Xe(x,u)},S=new Set,v=()=>{for(;a.length>s;){let x=a.shift();x&&S.delete(x.id)}},M=x=>{l.has(x.id)||S.has(x.id)||(S.add(x.id),a.push(x),v())},A=x=>{for(let G of x)l.has(G.id)||(S.add(G.id),a.push(G));v()},K=Ve(u,s);for(let x of K)M(x);let L=0,F=0,B=(x,G=!0)=>{if(x.length===0)return;let fe=JSON.stringify(x),we=x.map(ae=>ae.id),te,he=ue(15e3);try{te=fetch(c,{method:"POST",keepalive:!0,signal:he.signal,body:fe,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}})}catch(ae){i(x,s,u),A(x),F++,L=Date.now()+Se(F);return}Promise.resolve(te).then(he.clear,he.clear);let Me=ae=>{if(Te(ae)!=="retry"){if(!ae.ok&&G){let be=x.filter(re=>re.eventType!=="pageview");if(be.length>0&&be.length<x.length){y(x.filter(re=>re.eventType==="pageview").map(re=>re.id)),B(be,!1);return}}y(we),F=0,L=0;return}i(x,s,u),A(x),F++,L=Date.now()+Se(F)};te&&typeof te.then=="function"?te.then(Me).catch(()=>{i(x,s,u),A(x),F++,L=Date.now()+Se(F)}):Me(te)},ee=typeof TextEncoder!="undefined"?new TextEncoder:null,f=x=>ee?ee.encode(x).length:x.length,b=x=>{let G=[],fe=2;for(let we of x){let te=f(JSON.stringify(we))+1;if(G.length>0&&fe+te>Zn||G.length>=n)break;G.push(we),fe+=te}return G},_=()=>{try{if(Date.now()<L)return;for(;a.length>0&&!(Date.now()<L);){let x=a.filter(fe=>!l.has(fe.id));if(a.length=0,x.length===0)break;let G=b(x);if(G.length===0)break;G.length<x.length&&a.push(...x.slice(G.length)),B(G)}}catch(x){}},m=!0,R=null;R=setInterval(()=>{m&&_()},t);let $=()=>{document.visibilityState==="hidden"&&_()},N=()=>{_()};return document.addEventListener("visibilitychange",$),window.addEventListener("pagehide",N),{push(x){M(x),a.length>=n&&_()},flush:_,destroy(x){x!=null&&x.forget&&(o=!0),m=!1,R!==null&&(clearInterval(R),R=null),document.removeEventListener("visibilitychange",$),window.removeEventListener("pagehide",N),_()}}}var to=200;function $e(e){return`_snt_goal_retry_${e.slice(0,12)}`}var no={send:()=>{},flush:()=>{},destroy:()=>{}};function Zt(e){var f,b,_;if(typeof window=="undefined")return no;let t=(f=e.flushIntervalMs)!=null?f:5e3,n=(b=e.maxRetrySize)!=null?b:100,s=(_=e.maxPerFlush)!=null?_:5,c=$e(e.apiKey),r=!1,u=me(e.apiKey),o=(...m)=>{!r&&me(e.apiKey)===u&&Ge(...m)},p=[],i=new Set,a=new Set,l=[],h=0,y=0,S=!1,v=m=>{for(i.delete(m.id),a.has(m.id)||(a.add(m.id),l.push(m.id));l.length>to;){let R=l.shift();R&&a.delete(R)}Xe([m.id],c)},M=m=>{o([m],n,c),!a.has(m.id)&&!i.has(m.id)&&(i.add(m.id),p.push(m)),Date.now()>=h&&(y++,h=Date.now()+Se(y))},A=m=>{let R,$=ue(15e3);try{R=fetch(e.url,{method:"POST",keepalive:!0,signal:$.signal,body:m.body,headers:e.headers})}catch(H){M(m);return}let N=H=>{var ge;let Q=Te(H);if(Q==="retry"){M(m);return}Q==="dropped"&&((ge=e.onDrop)==null||ge.call(e,m,H.status)),v(m),y=0,h=0};Promise.resolve(R).then($.clear,$.clear),R&&typeof R.then=="function"?R.then(N).catch(()=>M(m)):N(R)},K=()=>{try{if(S||Date.now()<h)return;let m=0;for(;p.length>0&&m<s&&!(Date.now()<h);){let R=p.shift();i.delete(R.id),!a.has(R.id)&&(m++,A(R))}}catch(m){}},L=Ve(c,n);for(let m of L)i.has(m.id)||(i.add(m.id),p.push(m));L.length>0&&Ge(L,n,c);let F=setInterval(K,t),B=()=>{document.visibilityState==="hidden"&&K()},ee=()=>K();return document.addEventListener("visibilitychange",B),window.addEventListener("pagehide",ee),{send(m){if(S){a.has(m.id)||o([m],n,c);return}if(!(a.has(m.id)||i.has(m.id))){if(Date.now()<h){o([m],n,c),i.add(m.id),p.push(m);return}A(m)}},flush:K,destroy(m){m!=null&&m.forget&&(r=!0),clearInterval(F),document.removeEventListener("visibilitychange",B),window.removeEventListener("pagehide",ee),K(),S=!0}}}function en(e){if(typeof window=="undefined"||!e)return!1;ze(e);let t=!1,n=Ee(e);try{if(new RegExp(`(?:^|; )${n}=`).test(document.cookie)){let u=location.protocol==="https:"?"; Secure":"";document.cookie=`${n}=; max-age=0; SameSite=lax; path=/${u}`,t=!0}}catch(u){}let s=ie(e),c=[n,"_snt_graph_edges",ye+e,Ke(e),$e(e),`_snt_graph_nodes${s}`],r=[`_snt_asgn${s}_`];for(let u of["localStorage","sessionStorage"])try{let o=window[u];for(let p of c)o.getItem(p)!==null&&(o.removeItem(p),t=!0);for(let p=o.length-1;p>=0;p--){let i=o.key(p);i&&r.some(a=>i.startsWith(a))&&(o.removeItem(i),t=!0)}}catch(o){}try{(new RegExp(`(?:^|; )${pe}=[^;]`).test(document.cookie)||localStorage.getItem(pe)!==null||sessionStorage.getItem(pe)!==null)&&localStorage.setItem(`${pe}_tomb${s}`,"1")}catch(u){}return t}function Qe(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch(e){}try{if(typeof crypto!="undefined"&&typeof crypto.getRandomValues=="function"){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,"0"),(n===3||n===5||n===7||n===9)&&(t+="-");return t}}catch(e){}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var tn="_snt_uid",oo=365,_e="_snt_uid";function ro(){return Qe()}function yt(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function ht(){try{return location.protocol==="https:"?"; Secure":""}catch(e){return""}}function so(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=lax; path=/${ht()}`}catch(s){}}function Je(e){try{return localStorage.getItem(e)}catch(t){return null}}function nn(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function St(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function io(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function ao(e){try{sessionStorage.removeItem(e)}catch(t){}}function co(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=lax; path=/${ht()}`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function lo(e){try{localStorage.removeItem(e)}catch(t){}}function uo(e){try{document.cookie=`${e}=; max-age=0; SameSite=lax; path=/${ht()}`}catch(t){}}var po={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function Ye(e){var S,v,M,A,K,L,F;if(typeof window=="undefined")return po;let t=ie(e==null?void 0:e.apiKey),n=(S=e==null?void 0:e.cookieName)!=null?S:Ee(e==null?void 0:e.apiKey),s=`${_e}${t}`,c=`${_e}_tomb${t}`,u=((v=e==null?void 0:e.cookieTTLDays)!=null?v:oo)*24*60*60,o=B=>B&&B.length>0?B:null,p=()=>{var B,ee;return t&&!(e!=null&&e.cookieName)&&Je(c)===null?(ee=(B=o(yt(tn)))!=null?B:o(Je(_e)))!=null?ee:o(St(_e)):null},i=(F=(L=(K=(A=(M=o(yt(n)))!=null?M:o(Je(s)))!=null?A:o(St(s)))!=null?K:p())!=null?L:o(e==null?void 0:e.ssrSessionId))!=null?F:ro();so(n,i,u);let a=nn(s,i),l=co(n),h=a?!1:io(s,i),y=!a&&!l&&!h;return{getSessionId:()=>i,isEphemeral:()=>y,destroy:()=>{i=null,uo(n),lo(s),ao(s),t&&!(e!=null&&e.cookieName)&&(yt(tn)!==null||Je(_e)!==null||St(_e)!==null)&&nn(c,"1")}}}var go=1800*1e3;function Ze(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function on(e=go,t){let n=new Map,s=`_snt_asgn${ie(t)}_`,c=(i,a)=>`${s}${encodeURIComponent(i)}:${encodeURIComponent(a)}`,r=i=>{let a=i.slice(s.length),l=a.indexOf(":");if(l<0)return null;try{return{componentId:decodeURIComponent(a.slice(0,l)),segment:decodeURIComponent(a.slice(l+1))}}catch(h){return null}},u=()=>{try{let i=[];for(let a=0;a<localStorage.length;a++){let l=localStorage.key(a);l!=null&&l.startsWith(s)&&i.push(l)}return i}catch(i){return[]}},o=i=>i.assignedAt+(i.ttlMs&&i.ttlMs>0?i.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let i of u())try{let a=localStorage.getItem(i);if(!a)continue;let l=JSON.parse(a);if(o(l)){localStorage.removeItem(i);continue}let h=r(i);if(!h)continue;n.set(Ze(h.componentId,h.segment),l)}catch(a){}})(),{get(i,a){let l=n.get(Ze(i,a));return l?o(l)?(n.delete(Ze(i,a)),null):l:null},set(i,a,l){let h=Ze(i,a);n.set(h,l);try{localStorage.setItem(c(i,a),JSON.stringify(l))}catch(y){}},clear(){n.clear();for(let i of u())try{localStorage.removeItem(i)}catch(a){}}}}var rn=["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 et(e){return sn(e)!==null}function sn(e){var n;if(!e)return null;let t=e.toLowerCase();return(n=rn.find(s=>t.includes(s.toLowerCase())))!=null?n:null}function Ae(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 Re(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(c){}let s=n.hostname.toLowerCase();return/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(s)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(s)?"social":"referral"}catch(n){return"direct"}}function Oe(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var an=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function bt(e){let t={},n={};try{let s=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([c,r])=>{let u=Array.isArray(r)?r[0]:r;return u===void 0?[]:[[c,u]]});for(let[c,r]of s)c.startsWith("utm_")?c in t||(t[c]=r):an.includes(c)&&(c in n||(n[c]=r))}catch(s){}return{utmParams:t,clickIds:n}}function Pe(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function vt(e){let t=fo("__segment__",e);return`${t.deviceClass}:${t.trafficSource}`}function fo(e,t){var r,u,o,p,i,a,l,h;let n=(u=(r=t==null?void 0:t.userAgent)==null?void 0:r.trim())!=null?u:"",s=(p=(o=t==null?void 0:t.referer)==null?void 0:o.trim())!=null?p:"",c=(i=t==null?void 0:t.now)!=null?i:new Date;return I({sessionId:e,ephemeral:!1,utmParams:(a=t==null?void 0:t.utmParams)!=null?a:{},clickIds:(l=t==null?void 0:t.clickIds)!=null?l:{},deviceClass:n?Ae(n):"desktop",trafficSource:s?Re(s,t==null?void 0:t.appOrigin):"direct",referrerDomain:Oe(s),timeOfDay:Pe(c),dayOfWeek:(h=["sun","mon","tue","wed","thu","fri","sat"][c.getDay()])!=null?h:"sun",automation:(t==null?void 0:t.webdriver)===!0||et(n)},t!=null&&t.landingPath?{landingPath:t.landingPath.split(/[?#]/)[0]}:{})}var De=require("@sentientui/policy");function Ue(e){return I(I(I({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 Ne(e){let t=Ue(e);return(0,De.slotResultFor)(t,(0,De.slotBaselineArm)(t))}function cn(e){let t={};for(let n of e)t[n.id]=Ne(n);return t}function tt(e){return typeof e=="string"?e:(0,De.canonicalArm)(e)}var ln=require("@sentientui/policy"),nt="data-sentient-stage";function ot(e,t){return!t||typeof e!="string"||!(e==="returning"||ln.STAGE_KEYS.includes(e))?null:t!=="detailed"&&(e==="customer"||e==="lapsed")?"returning":e}function rt(e,t=document){try{e?t.documentElement.setAttribute(nt,e):t.documentElement.removeAttribute(nt)}catch(n){}}var xt=require("@sentientui/policy");var it=require("@sentientui/policy");var dn="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",mo="[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.",un=!1,st=!1;function yo(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function pn(e){var i;let t=Ye({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),n=(i=t.getSessionId())!=null?i:"local",s=yo(),c=import("@sentientui/core/local").then(a=>{let l=a;return l.LOCAL_ENGINE_AVAILABLE?(un||(un=!0,console.info(mo)),l):(st||(st=!0,console.error(dn)),null)}).catch(()=>(st||(st=!0,console.error(dn)),null)),r=null,u={low:.15,medium:.5,high:.85},o=(()=>{var l;if(e.initialPersona)return I({},e.initialPersona);let a=Ie(e.apiKey||"local");return a?{persona:a.persona,confidence:(l=u[a.band])!=null?l:.15}:null})();function p(a){let l=document.documentElement;l.dataset.sentientPersona===void 0&&(l.dataset.sentientPersona=a.persona,l.dataset.sentientConfidence=(0,it.confidenceBand)(a.confidence))}return{isLocal:!0,async decide(a){var y,S,v;let l=await c;if(!l)return null;let h=l.createLocalEngine({sessionId:n,forcedPersona:s}).decide(a);return r=oe(I({},h),{layoutOrder:(S=(y=h.layoutOrder)!=null?y:r==null?void 0:r.layoutOrder)!=null?S:null,slots:I(I({},(v=r==null?void 0:r.slots)!=null?v:{}),h.slots)}),Ce(e.apiKey||"local",{v:1,persona:r.persona,band:(0,it.confidenceBand)(r.confidence),slots:r.slots,layoutOrder:r.layoutOrder,savedAt:Date.now()}),p(h),h},getSlotResult(a){var l,h,y;return(y=(h=r==null?void 0:r.slots[a])!=null?h:(l=e.initialSlots)==null?void 0:l[a])!=null?y:null},getSlotConfig(a){var l,h;return(h=(l=e.initialSlotConfig)==null?void 0:l[a])!=null?h:null},getSitePalette(){var a;return(a=e.initialPalette)!=null?a:null},reportSlots(){},getPersona(){let a=r!=null?r:o;return a?{persona:a.persona,confidence:a.confidence,band:(0,it.confidenceBand)(a.confidence)}:null},async assign(a,l){var S;let h=await c;return!h||!l||l.length===0?l!=null&&l[0]?{variantId:l[0],assignmentTtlMs:0}:null:{variantId:(S=h.createLocalEngine({sessionId:n,forcedPersona:s}).decide({components:[{id:a,variantIds:l}]}).assignments[a])!=null?S:l[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>t.destroy()}}var So=["none","sm","md","lg"],ho=["start","center","end","stretch"],bo=["start","center","end","between"],vo=["sm","md","lg"],Eo=["normal","medium","bold"],wo=["default","muted","accent"],xo=["primary","secondary","ghost"],ko=["left","center","right"],Io=["auto","square","landscape","wide"],Co=["cover","contain"],To=[2,3,4],_o=[1,2,3,4],Ao=["default","raised"],Ro=["none","sm","md","lg"],Oo=["measure"],Po=["input","textarea","select"],Do=["text","email","number","tel"],No=5,Mo=8,Lo=64,Bo=5,Go=12,Ko=4,$o=500;function gn(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(gn):!1}function fn(e,t,n,s){let c=[];{let o=!1,p=[],i=()=>{if(o)return;let a=Date.now();for(p.push(a);p.length>0&&a-p[0]>500;)p.shift();p.length>=3&&(o=!0,e("rage_click"))};t.addEventListener("click",i),c.push(()=>t.removeEventListener("click",i))}{let r=!1,u=o=>{if(r||!(o.target instanceof Node)||!t.contains(o.target)&&t!==o.target)return;r=!0;let p=typeof window!="undefined"?window.getSelection():null,i=p?p.toString().length:0;e("text_copy",{selectionLength:i})};document.addEventListener("copy",u),c.push(()=>document.removeEventListener("copy",u))}{let r=!1,u=!1,o=null,p=()=>{o!==null&&(clearTimeout(o),o=null)},i=()=>{r||!u||(p(),o=setTimeout(()=>{!r&&u&&(r=!0,e("scroll_hesitation"))},3e3))},a=()=>{p(),i()},l=y=>{for(let S of y)u=S.intersectionRatio>.3,u?i():p()},h=new IntersectionObserver(l,{threshold:[.3]});h.observe(t),window.addEventListener("scroll",a,{passive:!0}),c.push(()=>{h.disconnect(),window.removeEventListener("scroll",a),p()})}if((s==null?void 0:s.tabLoss)!==!1){let r=!1,u=n!=null?n:Date.now(),o=()=>{if(r||document.visibilityState!=="hidden")return;let p=Date.now()-u;p<15e3&&(r=!0,e("tab_loss",{timeOnPage:p}))};document.addEventListener("visibilitychange",o),c.push(()=>document.removeEventListener("visibilitychange",o))}return()=>{for(let r of c)r()}}function Uo(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var hn="https://api.sentient-ui.com/v1/events",J=new Map,bn=null;function vn(e,t){let n=J.get(e);n&&n.upgrade&&(n.reinit=t)}function Fo(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var jo=3;function Et(){return Qe()}function at(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function Wo(){let e=new WeakMap,t=new Map,n=!1,s=(o,p,i)=>{let a=o.get(p);return i===null?a?!0:(o.set(p,new Set),!1):a?a.has(i)?!0:(a.add(i),!1):(o.set(p,new Set([i])),!1)},c=typeof window!="undefined"&&"event"in window,r=()=>{if(!c)return;let o=window.event;return typeof Event=="function"&&o instanceof Event?o:void 0},u=()=>{if(c){Promise.resolve().then(()=>{n=!1,t.clear()});return}let o=!1,p=()=>{o||(o=!0,n=!1,t.clear())};if(setTimeout(p,0),typeof MessageChannel=="function"){let i=new MessageChannel;i.port1.onmessage=()=>{i.port1.close(),i.port2.close(),p()},i.port2.postMessage(0)}};return{firedBefore(o,p){let i=r();if(i){let l=e.get(i);return l||(l=new Map,e.set(i,l)),s(l,o,p)}let a=s(t,o,p);return!a&&!n&&(n=!0,u()),a}}}var En=new Set;function Ho(e,t,n){let s=typeof window=="undefined"?null:window.history;if(!s)return()=>{};let c=!1,r,u=()=>{if(c)return;let i=at();!i||i===r||(r=i,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${i}`))},o=[];for(let i of["pushState","replaceState"]){let a=s[i],l=function(...h){let y=a.apply(this,h);return u(),y};s[i]=l,o.push([i,a,l])}window.addEventListener("popstate",u);let p=at();return p&&En.has(`${t}:${p}`)?r=p:u(),()=>{if(!c){c=!0,window.removeEventListener("popstate",u);for(let[i,a,l]of o)s[i]===l&&(s[i]=a)}}}var Fe={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}),flush:()=>{},dispose:()=>{},destroy:()=>{}};function qo(){try{return bt(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function wn(e){return e.replace(/\/events\/?$/,"")}function je(){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 xn(e){var p;if(typeof window=="undefined")return;let t=e!=null?e:bn;if(!t){console.warn("[sentient] grantConsent() called before init()");return}let n=J.get(t);if(!n){console.warn("[sentient] grantConsent() called before init()");return}let{config:s,upgrade:c,reinit:r}=n;if(!c){n.upgradeBlockedReason&&console.warn(n.upgradeBlockedReason);return}if(s.respectDoNotTrack!==!1&&je())return;let u=(r!=null?r:It)(oe(I({},s),{consent:!0}));c(u);let o=(p=J.get(t))==null?void 0:p.dispose;J.set(t,{config:oe(I({},s),{consent:!0}),upgrade:null,dispose:o})}function zo(e,t){var ee;let n=e.preConsentBehavior==="statistical_winner",s=wn((ee=e.ingestUrl)!=null?ee:hn),c={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},r=new Map,u=new Map,o={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(f,b,_){if(!n)return Promise.resolve(null);let m=r.get(f);return m?Promise.resolve(m):kt(u,f,async()=>{try{let R=new URLSearchParams({componentId:f});for(let Q of b!=null?b:[])R.append("variantIds[]",Q);let $=ue(5e3),N;try{let Q=await fetch(`${s}/winner?${R.toString()}`,{headers:c,signal:$.signal});if(!Q.ok)return b!=null&&b[0]?{variantId:b[0],assignmentTtlMs:0}:null;N=await Q.json()}finally{$.clear()}let H={variantId:N.variantId,assignmentTtlMs:0};return r.set(f,H),H}catch(R){return b!=null&&b[0]?{variantId:b[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}},p=!1,i=new Set,a=[],l=[],h=[],y=()=>{for(let[,,f]of h.splice(0))f(null);S.length=0},S=[],v=!1,M=()=>{if(p)return;v=!0;let f=J.get(e.apiKey);(f==null?void 0:f.upgrade)===B&&J.set(e.apiKey,{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): client released before consent; call init() again"})},A=[],K=()=>{setTimeout(()=>{var f;try{(f=A.shift())==null||f(o)}catch(b){}A.length&&K()})},L=f=>{p?A.length?A.push(f):f(o):!t&&!v&&S.length<100?S.push(f):v&&e.debug&&console.warn("[sentient] goal dropped: client released")},F={get gated(){return!p&&!t},get released(){return v&&!p},takeHeld:()=>S.splice(0),track:f=>o.track(f),goal:((f,b,_,m)=>L(R=>R.goal(f,b,_,m))),componentGoal:(f,b,_)=>o.componentGoal(f,b,_),identify:f=>o.identify(f),getAssignment:(f,b)=>o.getAssignment(f,b),assign:(f,b,_,m)=>o.assign(f,b,_,m),decide:f=>p?o.decide(f):v||t?Promise.resolve(null):new Promise(b=>h.push([f,Sn(),b])),getSlotResult:f=>o.getSlotResult(f),isSlotDecided:f=>{var b,_;return(_=(b=o.isSlotDecided)==null?void 0:b.call(o,f))!=null?_:!0},getSlotConfig:f=>o.getSlotConfig(f),getSitePalette:()=>o.getSitePalette(),getStyleVocabulary:()=>{var f,b;return(b=(f=o.getStyleVocabulary)==null?void 0:f.call(o))!=null?b:null},reportSlots:(f,b,_,m)=>o.reportSlots(f,b,_,m),reportSkeleton:(f,b)=>{var _;return(_=o.reportSkeleton)==null?void 0:_.call(o,f,b)},reportDrift:(f,b,_,m)=>{var R;return(R=o.reportDrift)==null?void 0:R.call(o,f,b,_,m)},requestSlots:(f,b,_)=>{var m;return p?(m=o.requestSlots)==null?void 0:m.call(o,f,b,_):a.push([f,b,_])},decideSlots:f=>{var b;return p?(b=o.decideSlots)==null?void 0:b.call(o,f):l.push(...f)},cancelSlots:f=>{var _;if(p)return(_=o.cancelSlots)==null?void 0:_.call(o,f);let b=new Set(f);for(let m of a)m[0]=m[0].filter(R=>!b.has(R));l=l.filter(m=>!b.has(m.id))},onSlotsChanged:f=>(i.add(f),()=>{i.delete(f)}),getPersona:()=>o.getPersona(),fetchWeights:()=>o.fetchWeights(),getGraph:()=>o.getGraph(),flush:()=>o.flush(),dispose:()=>(M(),y(),o.dispose()),destroy:()=>(M(),y(),p?o.destroy():en(e.apiKey))};function B(f){var _,m,R;o=f,p=!0,S.length&&(A.push(...S.splice(0)),K());let b=Sn();for(let[$,N,H]of h.splice(0))N!==b?H(null):f.decide($).then(H,()=>H(null));(_=f.onSlotsChanged)==null||_.call(f,()=>i.forEach($=>$()));for(let[$,N,H]of a.splice(0))$.length>0&&((m=f.requestSlots)==null||m.call(f,$,N,H));l.length>0&&((R=f.decideSlots)==null||R.call(f,l.splice(0)))}return{proxy:F,setInner:B}}function Sn(){return typeof location=="undefined"?"":location.pathname+(/^#!?\//.test(location.hash)?location.hash:"")}function kt(e,t,n){let s=e.get(t);if(s)return s;let c=(async()=>{try{return await n()}finally{e.delete(t)}})();return e.set(t,c),c}function It(e){var Nt,Mt,Lt,Bt,Gt,Kt,$t,Ut,Ft,jt;if(typeof window=="undefined")return Fe;e.nonce&&Qt(e.nonce),bn=e.apiKey||"local";let t=J.get(e.apiKey||"local");if(t!=null&&t.dispose)try{t.dispose()}catch(d){}let n=e.respectDoNotTrack!==!1&&je(),s=e.consent===!1||n,c=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!c&&e.localMode!==!1)return J.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."}),s?Fe:pn(e);if(s){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."),J.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."}),Fe;let{proxy:d,setInner:g}=zo(e,n);return J.set(e.apiKey,{config:e,upgrade:n?null:g}),d}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."),Fe;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),Fe;let r=(Nt=e.ingestUrl)!=null?Nt:hn,u=Date.now(),o=Ye({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),p=on(void 0,e.apiKey),i=!1,a=me(e.apiKey),l=()=>!i&&me(e.apiKey)===a,h=oe(I({},p),{set:(...d)=>{l()&&p.set(...d)}}),y=Yt({ingestUrl:r,apiKey:e.apiKey}),S=wn(r),v={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},M=new Set,A=Zt({url:`${S}/goals`,apiKey:e.apiKey,headers:v,onDrop:(d,g)=>{if(!e.debug){if(M.has(g))return;M.add(g)}console.warn(`[sentient] goal dropped (HTTP ${g}) \u2014 this will not be retried. `+(g===400?"The session was not found: call init() and let the session upsert complete before firing goals.":g===401||g===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),d)}}),K=Ae((Mt=navigator.userAgent)!=null?Mt:""),L=window.location.origin,F=Re((Lt=document.referrer)!=null?Lt:"",L),B=(Bt=e.sessionSegment)!=null?Bt:`${K}:${F}`,ee=new Map,f=new Map,b=new Map,_=new Set,m=new Map,R=null,$=null,N=null,H=new Set,Q=new Set,ge=new Map,x=new Map,G=new Set,fe=new Set,we=new Set,te=null,he=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,Me=new Set,ae=new Set,be=new Set,re=new Map,dt=null,He=new Set,Le=new Map,ut=null,Ln=2,Rt=new Map,se=!1,Ot=(d,g,w)=>{var E;let O=new Set,P=1;for(let k of d){g.delete(k);let C=((E=Rt.get(k))!=null?E:0)+1;Rt.set(k,C),C<=Ln&&(O.add(k),C>P&&(P=C))}O.size>0&&setTimeout(()=>{se||w(O)},Se(P))},pt=d=>{for(let g of d)b.has(g.id)||b.set(g.id,Ne(g))};if(e.initialSlots)for(let[d,g]of Object.entries(e.initialSlots))b.set(d,g),_.add(d);if(e.initialSlotConfig)for(let[d,g]of Object.entries(e.initialSlotConfig))m.set(d,g);e.initialPalette&&(R=e.initialPalette),e.initialVocabulary&&($=e.initialVocabulary);let ce=Ie(e.apiKey);if(ce){for(let[d,g]of Object.entries(ce.slots))b.has(d)||b.set(d,g);for(let[d,g]of Object.entries((Gt=ce.slotConfig)!=null?Gt:{}))m.has(d)||m.set(d,g);!R&&ce.palette&&(R=ce.palette),!$&&ce.vocabulary&&($=ce.vocabulary)}let Pt={low:.15,medium:.5,high:.85};if(e.initialPersona)N=I({},e.initialPersona);else{let d=document.documentElement.dataset;d.sentientPersona?N={persona:d.sentientPersona,confidence:($t=Pt[(Kt=d.sentientConfidence)!=null?Kt:"low"])!=null?$t:.15}:ce&&(N={persona:ce.persona,confidence:(Ut=Pt[ce.band])!=null?Ut:.15})}if(e.initialAssignments)for(let[d,g]of Object.entries(e.initialAssignments))h.set(d,B,{variantId:g,assignedAt:Date.now(),segment:B,confidence:1});let ve=Promise.resolve(),Dt=o.getSessionId();if(Dt){let d=Oe((Ft=document.referrer)!=null?Ft:""),{utmParams:g,clickIds:w}=qo(),O=I(I(I(I({sessionId:Dt,deviceClass:K,trafficSource:F,referrerDomain:d,utmParams:g,clickIds:w,landingPath:typeof location!="undefined"?location.pathname:void 0,timeOfDay:Pe(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:o.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||et((jt=navigator.userAgent)!=null?jt:"")},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}:{}),P=async()=>{for(let E=0;;E++){if(se||!l())return;let k=ue(5e3);try{let C=await fetch(`${S}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(O),headers:v,signal:k.signal});if(C.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(C.ok||Te(C)==="dropped")return}catch(C){}finally{k.clear()}if(E>=jo){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(C=>setTimeout(C,Se(E+1)))}};try{ve=P()}catch(E){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:y});let Bn=Wo(),xe=null,gt=!1,W={goal(d,g={},w=1,O=0){var V,q,Y,ne,Z,X,T;let P=o.getSessionId();if(!P||se||!l())return;let E=Fo(g)?g:{metadata:g},k=[d,(V=E.externalId)!=null?V:"",(q=E.stepIndex)!=null?q:O,(Y=E.weight)!=null?Y:w].join("\0"),C=E.value!==void 0?`${E.value}\0${(ne=E.currency)!=null?ne:""}`:null;if(Bn.firedBefore(k,C)){e.debug&&console.log(`[sentient] goal("${d}") already recorded for this action \u2014 not sent twice`);return}let U=Et(),D={sessionId:P,name:d,metadata:(Z=E.metadata)!=null?Z:{},weight:(X=E.weight)!=null?X:w,stepIndex:(T=E.stepIndex)!=null?T:O,goalId:U,value:E.value,currency:E.currency,externalId:E.externalId};e.debug&&console.log("[sentient] goal",D);let z={id:U,body:JSON.stringify(D)};ve.then(()=>A.send(z))},componentGoal(d,g,w){var U,D,z;let O=o.getSessionId();if(!O||se||!l())return;let P=h.get(d,B),E=P?null:(U=b.get(d))!=null?U:null;if(!P&&E===null){e.debug&&console.warn(`[sentient] componentGoal("${d}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}if(!P&&!_.has(d)){e.debug&&console.warn(`[sentient] componentGoal("${d}"): slot not decided this session \u2014 not attributed`);return}let k=P?P.variantId:tt(E),C={id:Et(),sessionId:O,projectId:e.apiKey,componentId:d,variantId:k,eventType:"goal_achieved",goalType:g,payload:I({reward:(D=w==null?void 0:w.reward)!=null?D:1,goalValue:w==null?void 0:w.value,currency:w==null?void 0:w.currency},(z=w==null?void 0:w.metadata)!=null?z:{}),timestamp:Date.now(),timeInSession:Date.now()-u,path:at()};e.debug&&console.log("[sentient] componentGoal",C),ve.then(()=>{!se&&l()&&y.push(C)})},identify(d){let g=o.getSessionId();!g||se||!l()||ve.then(()=>{fetch(`${S}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:g,userId:d,ephemeral:o.isEphemeral()}),headers:v}).catch(()=>{})})},track(d){let g=o.getSessionId();if(!g||se||!l()||d.eventType==="variant_assigned"&&b.get(d.componentId)!==void 0&&!_.has(d.componentId)&&!h.get(d.componentId,B))return;let w=oe(I({path:at()},d),{id:Et(),sessionId:g,timestamp:Date.now(),timeInSession:Date.now()-u});e.debug&&console.log("[sentient] track",w),ve.then(()=>y.push(w))},getAssignment(d,g){return h.get(d,g)},async assign(d,g,w,O){let P=o.getSessionId();if(!P)return null;let E=h.get(d,B);if(E&&(g!=null&&g.length||E.content!==void 0)){let k=E.ttlMs&&E.ttlMs>0?Math.max(0,E.assignedAt+E.ttlMs-Date.now()):0;return{variantId:E.variantId,assignmentTtlMs:k,content:E.content}}return kt(ee,d,async()=>{if(!await ft(ve,2500)||se||!l())return null;let k=ue(3e4);try{let C={sessionId:P,componentId:d,variantIds:g};O!==void 0?C.agentDataByVariant=O:w!==void 0&&(C.agentData=w);let U=await fetch(`${S}/assign`,{method:"POST",body:JSON.stringify(C),headers:v,signal:k.signal});if(!U.ok)return null;let D=await U.json();return h.set(d,B,I({variantId:D.variantId,assignedAt:Date.now(),segment:B,confidence:1,content:D.content},D.assignmentTtlMs&&D.assignmentTtlMs>0?{ttlMs:D.assignmentTtlMs}:{})),D}catch(C){return null}finally{k.clear()}})},async decide(d){var E,k;let g=o.getSessionId();if(!g)return null;let w=(E=d.slots)!=null?E:[],O={sessionId:g};d.sections&&d.sections.length>0&&(O.sections=d.sections.map(C=>({id:C}))),O.components=(k=d.components)!=null?k:[],w.length>0&&(O.slots=w.map(Ue)),d.slotsFrom==="registry"&&(O.slotsFrom="registry",d.registrySlotIds&&(O.registrySlotIds=d.registrySlotIds),d.bootstrap===!1&&(O.bootstrap=!1),d.render&&Object.keys(d.render).length>0&&(O.render=d.render)),d.v&&(O.v=d.v),typeof d.pp=="number"&&(O.pp=d.pp),e.persona&&(O.persona=e.persona);let P=JSON.stringify(O);return kt(f,P,async()=>{var U,D,z,V,q,Y,ne,Z;if(!await ft(ve,2500)||se||!l())return pt(w),null;let C=ue(3e4);try{let X=await fetch(`${S}/decide`,{method:"POST",body:P,headers:v,signal:C.signal});if(!X.ok)return pt(w),null;let T=await X.json(),le=ot(T.stage,e.stageAttributes);e.stageAttributes&&rt(le);let ke={};for(let j of w){let de=(U=T.slots)==null?void 0:U[j.id];if(de!==void 0){ke[j.id]=de,b.set(j.id,de),_.add(j.id);continue}let Wt=b.get(j.id);if(Wt!==void 0)ke[j.id]=Wt;else{let Ht=Ne(j);ke[j.id]=Ht,b.set(j.id,Ht)}}if(T.slots)for(let[j,de]of Object.entries(T.slots))j in ke||(ke[j]=de,b.set(j,de),_.add(j));let Gn=N!=null&&N.persona!=="unknown";T.persona&&!(T.persona==="unknown"&&Gn)?N={persona:T.persona,confidence:(D=T.confidence)!=null?D:0}:N||(N={persona:"unknown",confidence:0});for(let[j,de]of Object.entries((z=T.assignments)!=null?z:{}))h.set(j,B,{variantId:de,assignedAt:Date.now(),segment:B,confidence:1});if(T.slotConfig)for(let[j,de]of Object.entries(T.slotConfig))m.set(j,de);T.palette&&(R=T.palette),T.vocabulary&&($=T.vocabulary);for(let j of(V=d.registrySlotIds)!=null?V:[])(q=T.slotConfig)!=null&&q[j]||(m.delete(j),b.delete(j),_.delete(j));return l()&&Ce(e.apiKey,I(I(I(I({v:1,persona:N.persona,band:(0,xt.confidenceBand)(N.confidence),slots:Object.fromEntries(b),layoutOrder:(Y=T.layoutOrder)!=null?Y:null,savedAt:Date.now()},m.size>0?{slotConfig:Object.fromEntries(m)}:{}),R?{palette:R}:{}),$?{vocabulary:$}:{}),le?{stage:le}:{})),I(I(I(I(I(I(I({layoutOrder:(ne=T.layoutOrder)!=null?ne:null,assignments:(Z=T.assignments)!=null?Z:{},slots:ke,persona:N.persona,confidence:N.confidence},T.slotConfig?{slotConfig:T.slotConfig}:{}),T.goals?{goals:T.goals}:{}),T.sectionMap?{sectionMap:T.sectionMap}:{}),T.palette?{palette:T.palette}:{}),T.vocabulary?{vocabulary:T.vocabulary}:{}),T.stage?{stage:T.stage}:{}),T.context?{context:T.context}:{})}catch(X){return pt(w),null}finally{C.clear()}})},getSlotResult(d){var g;return(g=b.get(d))!=null?g:null},isSlotDecided(d){return _.has(d)},getSlotConfig(d){var g;return(g=m.get(d))!=null?g:null},reportSlots(d,g,w,O){var E;let P={};for(let[k,C]of Object.entries(O!=null?O:{}))for(let U of C){let D=`${k}|${U.key}`;!he.test(k)||we.has(D)||(we.add(D),((E=P[k])!=null?E:P[k]=[]).push(U))}Object.keys(P).length>0&&fetch(`${S}/slots/observed`,{method:"POST",headers:v,body:JSON.stringify({slotIds:Object.keys(P),authoredArms:P})}).catch(()=>{});for(let k of d)if(!(typeof k!="string"||k.length===0)){if(!he.test(k)){Uo()&&!Me.has(k)&&(Me.add(k),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(k)} 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(!H.has(k)){H.add(k),Q.add(k);let C=g==null?void 0:g[k];if(typeof C=="string"){let D=C.replace(/\s+/g," ").trim().slice(0,400);D!==""&&ge.set(k,D)}let U=w==null?void 0:w[k];U!==void 0&&x.set(k,U)}}Q.size===0||te!=null||(te=setTimeout(()=>{te=null;let k=[...Q];Q.clear();for(let C=0;C<k.length;C+=20){let U=k.slice(C,C+20),D={},z={};for(let V of U){let q=ge.get(V);q!==void 0&&(D[V]=q,ge.delete(V));let Y=x.get(V);Y!==void 0&&(z[V]=Y,x.delete(V))}fetch(`${S}/slots/observed`,{method:"POST",headers:v,body:JSON.stringify(I(oe(I(I({slotIds:U},Object.keys(D).length>0?{baselineTexts:D}:{}),Object.keys(z).length>0?{baselineSkeletons:z}:{}),{pagePaths:Object.fromEntries(U.map(V=>[V,location.pathname]))}),Object.keys(D).length>0&&o.getSessionId()?{sessionId:o.getSessionId()}:{}))}).catch(()=>{})}},1e3))},reportSkeleton(d,g){!he.test(d)||G.has(d)||(G.add(d),fetch(`${S}/slots/observed`,{method:"POST",headers:v,body:JSON.stringify({slotIds:[d],baselineSkeletons:{[d]:g}})}).catch(()=>{}))},reportDrift(d,g,w,O){let P=`${d}|${g}`,E=o.getSessionId();!E||fe.has(P)||(fe.add(P),fetch(`${S}/slots/drift`,{method:"POST",headers:v,body:JSON.stringify({sessionId:E,reports:[{slotId:d,expectedFp:g,observedFp:w,reason:O}]})}).catch(()=>{}))},requestSlots(d,g,w){var O,P;for(let E of d)be.has(E)||(be.add(E),he.test(E)?re.set(E,{text:g==null?void 0:g[E],render:(O=w==null?void 0:w.render)==null?void 0:O[E],skeleton:(P=w==null?void 0:w.skeletons)==null?void 0:P[E]}):W.reportSlots([E]));re.size===0||dt!=null||(dt=setTimeout(()=>{dt=null;let E=[...re];re.clear();for(let k=0;k<E.length;k+=50){let C=E.slice(k,k+50),U={};for(let[D,z]of C)z.render&&(U[D]=z.render);W.decide({slotsFrom:"registry",registrySlotIds:C.map(([D])=>D),bootstrap:!1,render:U}).then(D=>{var z,V;if(D){let q={},Y={},ne=[];for(let[Z,X]of C){let T=(z=D.slotConfig)==null?void 0:z[Z];if(T){T.needsSkeleton&&X.skeleton&&((V=W.reportSkeleton)==null||V.call(W,Z,X.skeleton));continue}ne.push(Z),X.text&&(q[Z]=X.text),X.skeleton&&(Y[Z]=X.skeleton)}ne.length>0&&W.reportSlots(ne,q,Y)}else Ot(C.map(([q])=>q),be,q=>{var X;let Y={},ne={},Z={};for(let[T,le]of C)q.has(T)&&(le.text&&(Y[T]=le.text),le.render&&(ne[T]=le.render),le.skeleton&&(Z[T]=le.skeleton));(X=W.requestSlots)==null||X.call(W,[...q],Y,{render:ne,skeletons:Z})});ae.forEach(q=>q())})}},0))},decideSlots(d){for(let g of d)He.has(g.id)||(He.add(g.id),Le.set(g.id,g));Le.size===0||ut!=null||(ut=setTimeout(()=>{ut=null;let g=[...Le.values()];Le.clear();for(let w=0;w<g.length;w+=30){let O=g.slice(w,w+30);W.decide({slots:O}).then(P=>{P||Ot(O.map(E=>E.id),He,E=>{var k;return(k=W.decideSlots)==null?void 0:k.call(W,O.filter(C=>E.has(C.id)))}),ae.forEach(E=>E())})}},0))},cancelSlots(d){for(let g of d)re.delete(g)&&be.delete(g),Le.delete(g)&&He.delete(g)},onSlotsChanged(d){return ae.add(d),()=>{ae.delete(d)}},getStyleVocabulary(){return $},getSitePalette(){return R},getPersona(){return N?{persona:N.persona,confidence:N.confidence,band:(0,xt.confidenceBand)(N.confidence)}:null},async fetchWeights(){var g;let d=ue(5e3);try{let w=await fetch(`${S}/weights`,{headers:v,signal:d.signal});return w.ok?(g=(await w.json()).components)!=null?g:[]:[]}catch(w){return[]}finally{d.clear()}},getGraph(){return{pageNodes:[],capturedAt:0}},flush(){y.flush(),A.flush()},dispose(){var d;xe==null||xe(),gt=!0,se=!0,y.destroy(),A.destroy(),((d=J.get(e.apiKey))==null?void 0:d.dispose)===W.dispose&&J.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var d;xe==null||xe(),gt=!0,se=!0,i=!0,ze(e.apiKey),y.destroy({forget:!0}),A.destroy({forget:!0}),o.destroy(),h.clear(),((d=J.get(e.apiKey))==null?void 0:d.dispose)===W.dispose&&J.delete(e.apiKey);try{localStorage.removeItem(ye+e.apiKey),localStorage.removeItem(Ke(e.apiKey)),localStorage.removeItem($e(e.apiKey)),localStorage.removeItem(`_snt_graph_nodes${ie(e.apiKey)}`),localStorage.removeItem("_snt_graph_edges")}catch(g){}e.debug&&console.log("[sentient] destroyed")}};if(J.set(e.apiKey,{config:e,upgrade:null,dispose:W.dispose}),xe=Ho(W,e.apiKey,d=>{ve.then(()=>{gt||En.add(d)})}),e.debug){let d=window;d.__sentient&&(d.__sentient.client=W)}return W}var kn="_snt_graph_edges",Vo={pricing:["features","faq"],features:["pricing"],faq:["pricing"],social_proof:["cta"],cta:["social_proof","hero","trust"],hero:["cta"],comparison:["pricing"],trust:["cta"]};function Xo(e){var t;return(t=Vo[e])!=null?t:[]}function Qo(e,t){try{let n=localStorage.getItem(e);return n?JSON.parse(n):t}catch(n){return t}}function Jo(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(n){}}var Yo=new Set(["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"]);function Zo(e){return Yo.has(e)?e:"generic"}function Ct(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch(t){return"/"}}function er(e,t,n){let s=`${e}:${t}:${n.join(",")}`,c=5381;for(let r=0;r<s.length;r++)c=(c<<5)+c+s.charCodeAt(r)&4294967295;return(c>>>0).toString(16).padStart(8,"0")}function In(e){let t=new Map,n=new Map,s=`_snt_graph_nodes${ie(e==null?void 0:e.apiKey)}`,c=()=>{typeof window!="undefined"&&Jo(s,[...t.values()])};if(typeof window!="undefined"){let r=Qo(s,[]);for(let u of r)t.set(u.componentId,u);try{localStorage.removeItem(kn)}catch(u){}}return{addPageNode(r){t.set(r.componentId,r),c()},addStructuralEdge(r){let u=`${r.fromComponentId}->${r.toComponentId}`;n.set(u,r)},syncOnce(){var u,o;if(!(e!=null&&e.syncUrl)||typeof window=="undefined")return;let r=[...t.values()];if(r.length!==0)try{let p=new Map;for(let y of r){let S=(u=p.get(y.semanticType))!=null?u:[];S.push(y),p.set(y.semanticType,S)}let i=[],a=new Set;for(let y of r)for(let S of Xo(y.semanticType)){let v=(o=p.get(S))!=null?o:[];for(let M of v){if(M.componentId===y.componentId)continue;let A=`semantic:${y.componentId}->${M.componentId}`;a.has(A)||(a.add(A),i.push({fromComponentId:y.componentId,toComponentId:M.componentId,type:"semantic",weight:.4,confidence:.9}))}}let l=new Set(r.map(y=>y.componentId));for(let y of n.values()){if(!l.has(y.fromComponentId)||!l.has(y.toComponentId))continue;let S=`structural:${y.fromComponentId}->${y.toComponentId}`;a.has(S)||(a.add(S),i.push({fromComponentId:y.fromComponentId,toComponentId:y.toComponentId,type:"structural",weight:y.weight,confidence:1}))}let h=oe(I(I({pageUrl:Ct(window.location.href)},e.sessionId?{sessionId:e.sessionId}:{}),e.projectId?{projectId:e.projectId}:{}),{nodes:r.map(y=>{let S=Zo(y.semanticType);return{componentId:y.componentId,semanticType:S,answers:y.answers,contentHash:er(y.componentId,S,y.answers),prominenceScore:y.prominenceScore,depthInPage:y.depth}}),edges:i});fetch(e.syncUrl,{method:"POST",keepalive:!0,headers:I({"Content-Type":"application/json"},e.apiKey?{Authorization:`Bearer ${e.apiKey}`}:{}),body:JSON.stringify(h)}).catch(()=>{})}catch(p){}},snapshot(){return{pageNodes:[...t.values()],capturedAt:Date.now()}},destroy(){if(typeof window!="undefined")try{localStorage.removeItem(s),localStorage.removeItem(kn)}catch(r){}}}}var tr=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function Tt(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function nr(e){return{tag:e.tagName.toLowerCase(),text:Tt(e).slice(0,40)}}function Cn(e){return e.replace(/["\\\]]/g,"\\$&")}function We(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function Tn(e,t){var u;let n=e.tagName.toLowerCase();if(!n)return null;let s=((u=e.getAttribute("class"))!=null?u:"").split(/\s+/).filter(o=>/^[a-zA-Z][\w-]*$/.test(o)),c=[n,...s.map(o=>`${n}.${o}`)];for(let o of c)if(We(t,o))return o;let r=e.parentElement;if(r&&r!==t){let o=Tn(r,t);if(o){for(let l of c){let h=`${o} > ${l}`;if(We(t,h))return h}let p=Array.from(r.children).filter(l=>l.tagName.toLowerCase()===n),i=p.indexOf(e),a=p.some(l=>l!==e&&Tt(l)!==Tt(e));if(i>=0&&a){let l=`${o} > ${n}:nth-of-type(${i+1})`;if(We(t,l))return l}}}return null}function ct(e,t){let n=nr(e),s=e.getAttribute("id");if(s&&We(t,`#${Cn(s)}`))return{v:1,id:s,fingerprint:n};for(let r of tr){let u=e.getAttribute(r);if(u&&We(t,`[${r}="${Cn(u)}"]`))return{v:1,dataAttr:{name:r,value:u},fingerprint:n}}let c=Tn(e,t);return c?{v:1,selector:c,fingerprint:n}:null}var An=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],or={banner:"hero",navigation:"navigation",contentinfo:"footer"};function rr(e){let t=e.ariaRole?or[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 sr(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var ir=[["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]],ar=[["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]],_n={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function cr(e){var n;let t=e.querySelector("h1, h2, h3");return((n=t==null?void 0:t.textContent)!=null?n:"").slice(0,160)}function lr(e){var c,r;let t=rr(e);if(t)return{type:(c=_n[t])!=null?c:"generic",strength:"strong"};let n=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[u,o]of ir)if(o.test(n))return{type:u,strength:"strong"};for(let[u,o]of ar)if(o.test(e.bodyText))return{type:u,strength:"strong"};let s=sr(e);return{type:(r=_n[s])!=null?r:"generic",strength:"weak"}}function dr(e){var s,c;let t=((s=e.textContent)!=null?s:"").replace(/\s+/g," ").trim(),n=e.getAttribute("role");return I({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((c=e.className)!=null?c:"")}`,headingText:cr(e),bodyText:t.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:t.length},n?{ariaRole:n}:{})}function Rn(e){return lr(dr(e)).type}var ur=new Set(["SECTION","ARTICLE","MAIN","DIV","ASIDE"]),pr=200,gr="h1, h2, h3",fr="[data-sentient-id], section[aria-label], article[aria-label], main[aria-label], aside[aria-label]",On=30,mr=1500,yr={scan:async()=>({nodes:[],edges:[],scannedAt:0}),observe:()=>{},getProminenceScore:()=>0,destroy:()=>{}};function Pn(e,t,n){return n<=t?0:Math.max(0,Math.min(1,(e-t)/(n-t)))}function Sr(e){var t,n,s;try{let c=e;for(let r of Object.keys(c)){if(!r.startsWith("__reactFiber")&&!r.startsWith("__reactInternalInstance"))continue;let u=c[r],o=(s=(t=u==null?void 0:u.type)==null?void 0:t.displayName)!=null?s:(n=u==null?void 0:u.type)==null?void 0:n.name;if(o&&o.length>1)return o}}catch(c){}}function hr(e){let t={};for(let n of Array.from(e.attributes))n.name.startsWith("data-")&&(t[n.name]=n.value);return t}var _t=new Set(An);function br(e,t){let n=e.getAttribute("data-sentient-id"),s=n?t==null?void 0:t[n]:void 0;if(s&&_t.has(s))return s;let c=e.getAttribute("data-sentient-type");if(c&&_t.has(c))return c;let r=e.getAttribute("role");return r&&_t.has(r)?r:Rn(e)}function vr(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 s=n.parentElement;if(!s){t.push(n.tagName.toLowerCase());break}let c=Array.prototype.indexOf.call(s.children,n);t.push(`${n.tagName.toLowerCase()}[${c}]`),n=s}return t.reverse().join("/")}function wr(e){var n;let t=(n=e.getAttribute("data-sentient-id"))!=null?n:e.getAttribute("id");return t||`${e.tagName.toLowerCase()}-${vr(Er(e))}`}function xr(e){let t=0,n=e.parentElement;for(;n;)t++,n=n.parentElement;return t}function At(e,t,n){var c,r,u,o;let s=e.querySelector(gr);return{componentId:wr(e),semanticType:br(e,n),ariaLabel:(c=e.getAttribute("aria-label"))!=null?c:void 0,headingText:(u=(r=s==null?void 0:s.textContent)==null?void 0:r.trim())!=null?u:void 0,isAboveFold:e.getBoundingClientRect().top<window.innerHeight,prominenceScore:t(e),depth:xr(e),reactComponentName:Sr(e),dataAttributes:hr(e),locator:(o=ct(e,e.ownerDocument))!=null?o:void 0}}function Dn(e){var r;let t=[],n=new Set,s="__root__",c=new Map;for(let[u,o]of e){let p=u.parentElement,i=s;for(;p;){if(e.has(p)){i=e.get(p);let l=e.get(u),h=`${i}->${l}`;!n.has(h)&&i!==l&&(n.add(h),t.push({fromComponentId:i,toComponentId:l,weight:.6}));break}p=p.parentElement}let a=(r=c.get(i))!=null?r:[];a.push(u),c.set(i,a)}for(let u of c.values()){if(u.length<2)continue;let o=u.length>On?u.slice(0,On):u;for(let p=0;p<o.length;p++)for(let i=p+1;i<o.length;i++){if(t.length>=mr)return t;let a=e.get(o[p]),l=e.get(o[i]);if(a===l)continue;let h=`${a}->${l}::sib`,y=`${l}->${a}::sib`;n.has(h)||(n.add(h),t.push({fromComponentId:a,toComponentId:l,weight:.3})),n.has(y)||(n.add(y),t.push({fromComponentId:l,toComponentId:a,weight:.3}))}}return t}function kr(e,t){let n=[],s=new Set,c=new Map;return document.querySelectorAll("[data-sentient-id]").forEach(o=>{if(o instanceof Element&&!s.has(o)){s.add(o);let p=At(o,e,t);n.push(p),c.set(o,p.componentId)}}),document.querySelectorAll("section, article, main, aside").forEach(o=>{if(!(o instanceof Element)||s.has(o))return;let p=o.hasAttribute("aria-label"),i=o.hasAttribute("data-sentient-id");if(!p&&!i)return;s.add(o);let a=At(o,e,t);n.push(a),c.set(o,a.componentId)}),{nodes:n,edges:Dn(c),elementToId:c}}function Nn(e={}){let{sectionTypes:t}=e;if(typeof window=="undefined")return yr;let n=null,s=0,c=null,r=new Map,u=y=>{try{let S=window.getComputedStyle(y),v=parseFloat(S.fontSize)||12,M=parseFloat(S.zIndex)||0,A=y.getBoundingClientRect(),K=Math.max(A.top,0),L=window.innerHeight||1,F=1/(K/L+1),B=Pn(v,12,48)*.4+F*.4+Pn(M,0,100)*.2;return Math.max(0,Math.min(1,B))}catch(S){return .5}},o=()=>new Promise(y=>{let S=()=>{let{nodes:v,edges:M,elementToId:A}=kr(u,t);r.clear();for(let[K,L]of A)r.set(K,L);y({nodes:v,edges:M,scannedAt:Date.now()})};try{typeof requestIdleCallback=="function"?s=requestIdleCallback(S,{timeout:100}):S()}catch(v){S()}}),p=new Set,i=null,a=()=>{i=null;let y=[...p];p.clear();let S=[],v=new Set;for(let A of y){if(!A.isConnected)continue;let K=[];ur.has(A.tagName)&&(A.hasAttribute("data-sentient-id")||A.hasAttribute("aria-label"))&&K.push(A);try{A.querySelectorAll(fr).forEach(L=>K.push(L))}catch(L){}for(let L of K){if(r.has(L))continue;let F=At(L,u,t);S.push(F),v.add(F.componentId),r.set(L,F.componentId)}}if(S.length===0||!c)return;for(let A of[...r.keys()])A.isConnected||r.delete(A);let M=Dn(r).filter(A=>v.has(A.fromComponentId)||v.has(A.toComponentId));c({nodes:S,edges:M,addedAt:Date.now()})};return{scan:o,observe:y=>{c=y;try{n=new MutationObserver(S=>{for(let v of S)v.type==="childList"&&v.addedNodes.forEach(M=>{M instanceof Element&&p.add(M)});p.size>0&&i===null&&(i=setTimeout(a,pr))}),n.observe(document.body,{childList:!0,subtree:!0})}catch(S){}},getProminenceScore:u,destroy:()=>{if(n&&(n.disconnect(),n=null),i!==null&&clearTimeout(i),i=null,p.clear(),s&&typeof cancelIdleCallback=="function")try{cancelIdleCallback(s)}catch(y){}s=0,c=null,r.clear()}}}var Ir="https://api.sentient-ui.com/v1/events";function Cr(e){var n;let t=s=>{try{let c=document.cookie.match(new RegExp(`(?:^|; )${s}=([^;]*)`));return c?decodeURIComponent(c[1]):void 0}catch(c){return}};return(n=e?t(Ee(e)):void 0)!=null?n:t(pe)}var lt=new Map;function Mn(e){var y;let t=It(e),n=e.respectDoNotTrack!==!1&&je(),s=e.consent===!1||n,c=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_"),r=e.localMode===!0||!c;if(!e.graph||r||typeof window=="undefined")return t;if(s)return n||vn(e.apiKey,S=>Mn(S)),t;let u=lt.get(e.apiKey);if(u)try{u()}catch(S){}let o=Nn({sectionTypes:e.sectionTypes}),p=(y=e.ingestUrl)!=null?y:Ir,i=In({syncUrl:p.replace(/\/events\/?$/,"/graph/sync"),apiKey:e.apiKey,projectId:e.apiKey,sessionId:Cr(e.apiKey)});o.scan().then(S=>{for(let v of S.nodes)i.addPageNode({id:v.componentId,componentId:v.componentId,semanticType:v.semanticType,answers:e.captureDomText&&v.headingText?[v.headingText]:[],prominenceScore:v.prominenceScore,depth:v.depth});for(let v of S.edges)i.addStructuralEdge(v);i.syncOnce()});let a=null,l=()=>{a!==null&&clearTimeout(a),a=setTimeout(()=>{a=null,i.syncOnce()},500)};o.observe(S=>{for(let v of S.nodes)i.addPageNode({id:v.componentId,componentId:v.componentId,semanticType:v.semanticType,answers:e.captureDomText&&v.headingText?[v.headingText]:[],prominenceScore:v.prominenceScore,depth:v.depth});for(let v of S.edges)i.addStructuralEdge(v);l()});let h=()=>{a!==null&&(clearTimeout(a),a=null),o.destroy(),i.destroy(),lt.get(e.apiKey)===h&<.delete(e.apiKey)};return lt.set(e.apiKey,h),oe(I({},t),{getGraph:()=>i.snapshot(),dispose:()=>{h(),t.dispose()},destroy:()=>{h(),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,STAGE_ATTRIBUTE,armOfResult,attachMicroSignalDetectors,baselineResultFor,baselineSlots,containsFormBlock,deriveSessionSegment,detectDeviceClass,detectTimeOfDay,detectTrafficSource,exposedStage,grantConsent,init,isDoNotTrackEnabled,locatorFromElement,readSnapshot,referrerDomainFromReferer,renderPrePaintScript,sanitizePageUrl,sessionCookieName,setStageAttribute,toWireSlot,writeSnapshot});
|
|
2
2
|
//# sourceMappingURL=index-graph.js.map
|