@sentientui/core 0.43.0 → 0.44.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-MDLYXFGL.mjs +2 -0
- package/dist/chunk-MDLYXFGL.mjs.map +1 -0
- package/dist/chunk-OT77D5DV.mjs +2 -0
- package/dist/chunk-OT77D5DV.mjs.map +1 -0
- package/dist/{index-CWHTKETi.d.cts → index-CPjHmDZO.d.cts} +1 -1
- package/dist/{index-cqfRT6LZ.d.ts → index-DnFJAMuK.d.ts} +1 -1
- package/dist/index-engagement.js.map +1 -1
- package/dist/index-engagement.mjs +1 -1
- package/dist/index-graph.d.cts +2 -2
- package/dist/index-graph.d.ts +2 -2
- 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-local.d.cts +1 -1
- package/dist/index-local.d.ts +1 -1
- package/dist/index-server.d.cts +37 -2
- package/dist/index-server.d.ts +37 -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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-3HMJERH4.mjs +0 -2
- package/dist/chunk-3HMJERH4.mjs.map +0 -1
- package/dist/chunk-5VIREVXA.mjs +0 -2
- package/dist/chunk-5VIREVXA.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{O as Q,Q as X}from"./chunk-
|
|
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{O as Q,Q as X}from"./chunk-OT77D5DV.mjs";import"./chunk-JNQY3XNF.mjs";import"./chunk-LCYGZNFI.mjs";import"./chunk-BGZLWZUG.mjs";import"./chunk-EVF5PQ4U.mjs";import"./chunk-MDLYXFGL.mjs";import"./chunk-WUFFNQHQ.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,5 +1,5 @@
|
|
|
1
|
-
import { s as SentientConfig, r as SentientClient } from './index-
|
|
2
|
-
export { a as AssignResult, b as Assignment, c as AssignmentCache, E as EventQueue, g as EventType, i as GraphClient, j as GraphConfig, k as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, M as MicroSignalEmitter, m as MicroSignalType, o as PageNode, Q as QueueConfig, S as STAGE_ATTRIBUTE, t as SentientEvent, u as SessionConfig, v as SessionManager, x as StageAttributes, z as attachMicroSignalDetectors, F as exposedStage, J as grantConsent, N as isDoNotTrackEnabled, Y as sanitizePageUrl, Z as sessionCookieName, a0 as setStageAttribute } from './index-
|
|
1
|
+
import { s as SentientConfig, r as SentientClient } from './index-CPjHmDZO.cjs';
|
|
2
|
+
export { a as AssignResult, b as Assignment, c as AssignmentCache, E as EventQueue, g as EventType, i as GraphClient, j as GraphConfig, k as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, M as MicroSignalEmitter, m as MicroSignalType, o as PageNode, Q as QueueConfig, S as STAGE_ATTRIBUTE, t as SentientEvent, u as SessionConfig, v as SessionManager, x as StageAttributes, z as attachMicroSignalDetectors, F as exposedStage, J as grantConsent, N as isDoNotTrackEnabled, Y as sanitizePageUrl, Z as sessionCookieName, a0 as setStageAttribute } from './index-CPjHmDZO.cjs';
|
|
3
3
|
import { c as CompoundLocator } from './session-meta-BqBaLZag.cjs';
|
|
4
4
|
export { D as DecisionSnapshot, S as SNAPSHOT_STORAGE_KEY_PREFIX, e as SlotConfigEntry, f as SlotDeclInput, g as SlotOps, j as armOfResult, k as baselineResultFor, l as baselineSlots, o as deriveSessionSegment, p as detectDeviceClass, q as detectTimeOfDay, r as detectTrafficSource, v as readSnapshot, w as referrerDomainFromReferer, x as renderPrePaintScript, y as toWireSlot, B as writeSnapshot } from './session-meta-BqBaLZag.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';
|
package/dist/index-graph.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as SentientConfig, r as SentientClient } from './index-
|
|
2
|
-
export { a as AssignResult, b as Assignment, c as AssignmentCache, E as EventQueue, g as EventType, i as GraphClient, j as GraphConfig, k as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, M as MicroSignalEmitter, m as MicroSignalType, o as PageNode, Q as QueueConfig, S as STAGE_ATTRIBUTE, t as SentientEvent, u as SessionConfig, v as SessionManager, x as StageAttributes, z as attachMicroSignalDetectors, F as exposedStage, J as grantConsent, N as isDoNotTrackEnabled, Y as sanitizePageUrl, Z as sessionCookieName, a0 as setStageAttribute } from './index-
|
|
1
|
+
import { s as SentientConfig, r as SentientClient } from './index-DnFJAMuK.js';
|
|
2
|
+
export { a as AssignResult, b as Assignment, c as AssignmentCache, E as EventQueue, g as EventType, i as GraphClient, j as GraphConfig, k as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, M as MicroSignalEmitter, m as MicroSignalType, o as PageNode, Q as QueueConfig, S as STAGE_ATTRIBUTE, t as SentientEvent, u as SessionConfig, v as SessionManager, x as StageAttributes, z as attachMicroSignalDetectors, F as exposedStage, J as grantConsent, N as isDoNotTrackEnabled, Y as sanitizePageUrl, Z as sessionCookieName, a0 as setStageAttribute } from './index-DnFJAMuK.js';
|
|
3
3
|
import { c as CompoundLocator } from './session-meta-D_kdNsaU.js';
|
|
4
4
|
export { D as DecisionSnapshot, S as SNAPSHOT_STORAGE_KEY_PREFIX, e as SlotConfigEntry, f as SlotDeclInput, g as SlotOps, j as armOfResult, k as baselineResultFor, l as baselineSlots, o as deriveSessionSegment, p as detectDeviceClass, q as detectTimeOfDay, r as detectTrafficSource, v as readSnapshot, w as referrerDomainFromReferer, x as renderPrePaintScript, y as toWireSlot, B as writeSnapshot } from './session-meta-D_kdNsaU.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';
|
package/dist/index-graph.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var Jn=Object.create;var Ke=Object.defineProperty,Yn=Object.defineProperties,Zn=Object.getOwnPropertyDescriptor,eo=Object.getOwnPropertyDescriptors,to=Object.getOwnPropertyNames,tn=Object.getOwnPropertySymbols,no=Object.getPrototypeOf,on=Object.prototype.hasOwnProperty,oo=Object.prototype.propertyIsEnumerable;var nn=(e,t,n)=>t in e?Ke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,k=(e,t)=>{for(var n in t||(t={}))on.call(t,n)&&nn(e,n,t[n]);if(tn)for(var n of tn(t))oo.call(t,n)&&nn(e,n,t[n]);return e},ne=(e,t)=>Yn(e,eo(t));var ro=(e,t)=>{for(var n in t)Ke(e,n,{get:t[n],enumerable:!0})},rn=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of to(t))!on.call(e,i)&&i!==n&&Ke(e,i,{get:()=>t[i],enumerable:!(r=Zn(t,i))||r.enumerable});return e};var sn=(e,t,n)=>(n=e!=null?Jn(no(e)):{},rn(t||!e||!e.__esModule?Ke(n,"default",{value:e,enumerable:!0}):n,e)),so=e=>rn(Ke({},"__esModule",{value:!0}),e);var Br={};ro(Br,{BLOCK_ALIGNS:()=>_o,BLOCK_EMPHASES:()=>Do,BLOCK_FITS:()=>Lo,BLOCK_GAPS:()=>To,BLOCK_GRID_COLUMNS:()=>Bo,BLOCK_HEADING_LEVELS:()=>Go,BLOCK_JUSTIFIES:()=>Ao,BLOCK_MAX_WIDTHS:()=>Uo,BLOCK_PADS:()=>$o,BLOCK_RATIOS:()=>Mo,BLOCK_SIZES:()=>Ro,BLOCK_SURFACES:()=>Ko,BLOCK_TEXT_ALIGNS:()=>No,BLOCK_TONES:()=>Po,BLOCK_WEIGHTS:()=>Oo,FORM_FIELD_KINDS:()=>Fo,FORM_INPUT_TYPES:()=>jo,LEGACY_SESSION_COOKIE_NAME:()=>ge,MAX_BLOCK_ARMS:()=>Xo,MAX_BLOCK_CHILDREN:()=>qo,MAX_BLOCK_DEPTH:()=>zo,MAX_BLOCK_NODES:()=>Vo,MAX_BLOCK_TEXT_LEN:()=>Qo,MAX_FORM_FIELDS:()=>Wo,MAX_FORM_SELECT_OPTIONS:()=>Ho,SNAPSHOT_STORAGE_KEY_PREFIX:()=>me,STAGE_ATTRIBUTE:()=>dt,armOfResult:()=>ct,attachMicroSignalDetectors:()=>Cn,baselineResultFor:()=>Me,baselineSlots:()=>vn,containsFormBlock:()=>In,deriveSessionSegment:()=>Ct,detectDeviceClass:()=>Re,detectTimeOfDay:()=>De,detectTrafficSource:()=>Oe,exposedStage:()=>ut,grantConsent:()=>Mn,init:()=>zn,isDoNotTrackEnabled:()=>He,locatorFromElement:()=>yt,readSnapshot:()=>Ie,referrerDomainFromReferer:()=>Pe,renderPrePaintScript:()=>ln,sanitizePageUrl:()=>Dt,sessionCookieName:()=>ve,setStageAttribute:()=>pt,toWireSlot:()=>je,writeSnapshot:()=>Ce});module.exports=so(Br);function pe(e){if(typeof AbortController!="function")return{clear:()=>{}};let t=new AbortController,n=setTimeout(()=>t.abort(),e);return{signal:t.signal,clear:()=>clearTimeout(n)}}function Qe(e,t){return new Promise(n=>{let r=setTimeout(()=>n(!1),t),i=()=>{clearTimeout(r),n(!0)};e.then(i,i)})}var io;function an(e){io=typeof e=="string"&&e!==""?e:void 0}function ae(e){return e?`_${e.slice(0,12)}`:""}var ge="_snt_uid";function ve(e){return`${ge}${ae(e)}`}var Je="__sntForgetGen",ao=()=>{try{return window[Je]}catch(e){return}};function Ye(e){var t,n;try{let r=window,i=(t=r[Je])!=null?t:r[Je]={};i[e]=((n=i[e])!=null?n:0)+1}catch(r){}}function fe(e){var t,n;return(n=(t=ao())==null?void 0:t[e])!=null?n:0}var me="_snt_snap:";var lo=["low","medium","high"];function Ie(e){try{let t=localStorage.getItem(me+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"||!lo.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 r=n.vocabulary;return r!==void 0&&(typeof r!="object"||r===null||!Array.isArray(r.entries)||!Array.isArray(r.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(me+e,JSON.stringify(t))}catch(n){}}function ln(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(me+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 ye(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 Ze(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let r=JSON.parse(n);return Array.isArray(r)?(localStorage.removeItem(e),r.slice(-t)):[]}catch(n){return[]}}function $e(e,t,n){try{let r=(()=>{try{let s=localStorage.getItem(n);if(!s)return[];let u=JSON.parse(s);return Array.isArray(u)?u:[]}catch(s){return[]}})(),i=new Map;for(let s of r)i.set(s.id,s);for(let s of e)i.set(s.id,s);localStorage.setItem(n,JSON.stringify([...i.values()].slice(-t)))}catch(r){}}function et(e,t){try{let n=localStorage.getItem(t);if(!n)return;let r=JSON.parse(n);if(!Array.isArray(r))return;let i=new Set(e),s=r.filter(u=>!i.has(u.id));if(s.length===r.length)return;s.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(s))}catch(n){}}var co=500,uo=56*1024;function Ue(e){return`_snt_retry_${e.slice(0,12)}`}var po={push:()=>{},flush:()=>{},destroy:()=>{}};function cn(e){var F,X,H;if(typeof window=="undefined")return po;let t=(F=e.flushIntervalMs)!=null?F:5e3,n=(X=e.maxBatchSize)!=null?X:20,r=(H=e.maxRetrySize)!=null?H:100,i=e.ingestUrl,s=e.apiKey,u=Ue(s),o=!1,p=fe(s),a=(...C)=>{!o&&fe(s)===p&&$e(...C)},c=[],d=new Set,S=[],m=C=>{for(let B of C)b.delete(B),!d.has(B)&&(d.add(B),S.push(B));for(;S.length>co;){let B=S.shift();B&&d.delete(B)}et(C,u)},b=new Set,w=()=>{for(;c.length>r;){let C=c.shift();C&&b.delete(C.id)}},N=C=>{d.has(C.id)||b.has(C.id)||(b.add(C.id),c.push(C),w())},_=C=>{for(let B of C)d.has(B.id)||(b.add(B.id),c.push(B));w()},D=Ze(u,r);for(let C of D)N(C);let L=0,K=0,Q=(C,B=!0)=>{if(C.length===0)return;let le=JSON.stringify(C),Se=C.map(he=>he.id),oe,xe=pe(15e3);try{oe=fetch(i,{method:"POST",keepalive:!0,signal:xe.signal,body:le,headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`}})}catch(he){a(C,r,u),_(C),K++,L=Date.now()+ye(K);return}Promise.resolve(oe).then(xe.clear,xe.clear);let Le=he=>{if(Te(he)!=="retry"){if(!he.ok&&B){let we=C.filter(se=>se.eventType!=="pageview");if(we.length>0&&we.length<C.length){m(C.filter(se=>se.eventType==="pageview").map(se=>se.id)),Q(we,!1);return}}m(Se),K=0,L=0;return}a(C,r,u),_(C),K++,L=Date.now()+ye(K)};oe&&typeof oe.then=="function"?oe.then(Le).catch(()=>{a(C,r,u),_(C),K++,L=Date.now()+ye(K)}):Le(oe)},te=typeof TextEncoder!="undefined"?new TextEncoder:null,f=C=>te?te.encode(C).length:C.length,y=C=>{let B=[],le=2;for(let Se of C){let oe=f(JSON.stringify(Se))+1;if(B.length>0&&le+oe>uo||B.length>=n)break;B.push(Se),le+=oe}return B},R=()=>{try{if(Date.now()<L)return;for(;c.length>0&&!(Date.now()<L);){let C=c.filter(le=>!d.has(le.id));if(c.length=0,C.length===0)break;let B=y(C);if(B.length===0)break;B.length<C.length&&c.push(...C.slice(B.length)),Q(B)}}catch(C){}},h=!0,I=null;I=setInterval(()=>{h&&R()},t);let $=()=>{document.visibilityState==="hidden"&&R()},V=()=>{R()};return document.addEventListener("visibilitychange",$),window.addEventListener("pagehide",V),{push(C){N(C),c.length>=n&&R()},flush:R,destroy(C){C!=null&&C.forget&&(o=!0),h=!1,I!==null&&(clearInterval(I),I=null),document.removeEventListener("visibilitychange",$),window.removeEventListener("pagehide",V),R()}}}var go=200;function Fe(e){return`_snt_goal_retry_${e.slice(0,12)}`}var fo={send:()=>{},flush:()=>{},destroy:()=>{}};function dn(e){var f,y,R;if(typeof window=="undefined")return fo;let t=(f=e.flushIntervalMs)!=null?f:5e3,n=(y=e.maxRetrySize)!=null?y:100,r=(R=e.maxPerFlush)!=null?R:5,i=Fe(e.apiKey),s=!1,u=fe(e.apiKey),o=(...h)=>{!s&&fe(e.apiKey)===u&&$e(...h)},p=[],a=new Set,c=new Set,d=[],S=0,m=0,b=!1,w=h=>{for(a.delete(h.id),c.has(h.id)||(c.add(h.id),d.push(h.id));d.length>go;){let I=d.shift();I&&c.delete(I)}et([h.id],i)},N=h=>{o([h],n,i),!c.has(h.id)&&!a.has(h.id)&&(a.add(h.id),p.push(h)),Date.now()>=S&&(m++,S=Date.now()+ye(m))},_=h=>{let I,$=pe(15e3);try{I=fetch(e.url,{method:"POST",keepalive:!0,signal:$.signal,body:h.body,headers:e.headers})}catch(F){N(h);return}let V=F=>{var H;let X=Te(F);if(X==="retry"){N(h);return}X==="dropped"&&((H=e.onDrop)==null||H.call(e,h,F.status)),w(h),m=0,S=0};Promise.resolve(I).then($.clear,$.clear),I&&typeof I.then=="function"?I.then(V).catch(()=>N(h)):V(I)},D=()=>{try{if(b||Date.now()<S)return;let h=0;for(;p.length>0&&h<r&&!(Date.now()<S);){let I=p.shift();a.delete(I.id),!c.has(I.id)&&(h++,_(I))}}catch(h){}},L=Ze(i,n);for(let h of L)a.has(h.id)||(a.add(h.id),p.push(h));L.length>0&&$e(L,n,i);let K=setInterval(D,t),Q=()=>{document.visibilityState==="hidden"&&D()},te=()=>D();return document.addEventListener("visibilitychange",Q),window.addEventListener("pagehide",te),{send(h){if(b){c.has(h.id)||o([h],n,i);return}if(!(c.has(h.id)||a.has(h.id))){if(Date.now()<S){o([h],n,i),a.add(h.id),p.push(h);return}_(h)}},flush:D,destroy(h){h!=null&&h.forget&&(s=!0),clearInterval(K),document.removeEventListener("visibilitychange",Q),window.removeEventListener("pagehide",te),D(),b=!0}}}function tt(e){let t=(e||"").toLowerCase();if(!t.includes(".")||/^[\d.]+$|:/.test(t))return[];let n=t.split("."),r=[];for(let i=n.length-2;i>=0;i--)r.push(n.slice(i).join("."));return r}function un(e){if(typeof window=="undefined"||!e)return!1;Ye(e);let t=!1,n=ve(e);try{if(new RegExp(`(?:^|; )${n}=`).test(document.cookie)){let u=location.protocol==="https:"?"; Secure":"";for(let o of["",...tt(location.hostname)])document.cookie=`${n}=; max-age=0; SameSite=lax; path=/${o?`; domain=${o}`:""}${u}`;t=!0}}catch(u){}let r=ae(e),i=[n,"_snt_graph_edges",me+e,Ue(e),Fe(e),`_snt_graph_nodes${r}`],s=[`_snt_asgn${r}_`];for(let u of["localStorage","sessionStorage"])try{let o=window[u];for(let p of i)o.getItem(p)!==null&&(o.removeItem(p),t=!0);for(let p=o.length-1;p>=0;p--){let a=o.key(p);a&&s.some(c=>a.startsWith(c))&&(o.removeItem(a),t=!0)}}catch(o){}try{(new RegExp(`(?:^|; )${ge}=[^;]`).test(document.cookie)||localStorage.getItem(ge)!==null||sessionStorage.getItem(ge)!==null)&&localStorage.setItem(`${ge}_tomb${r}`,"1")}catch(u){}return t}function nt(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch(e){}try{if(typeof crypto!="undefined"&&typeof crypto.getRandomValues=="function"){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,"0"),(n===3||n===5||n===7||n===9)&&(t+="-");return t}}catch(e){}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var pn="_snt_uid",mo=365,_e="_snt_uid";function yo(){return nt()}function Ae(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function fn(){try{return location.protocol==="https:"?"; Secure":""}catch(e){return""}}function st(e,t,n,r){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=lax; path=/${r?`; domain=${r}`:""}${fn()}`}catch(i){}}function ot(e){try{return localStorage.getItem(e)}catch(t){return null}}function gn(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function xt(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function So(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function ho(e){try{sessionStorage.removeItem(e)}catch(t){}}function bo(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=lax; path=/${fn()}`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function vo(e){try{localStorage.removeItem(e)}catch(t){}}function rt(e,t){st(e,"",0,t)}var wo={getSessionId:()=>null,isEphemeral:()=>!1,domain:null,destroy:()=>{}};function Eo(e,t){if(e===!1)return null;if(typeof e=="string")return e.replace(/^\./,"");for(let n of tt(location.hostname))if(st(t,"1",10,n),Ae(t)==="1")return rt(t,n),n;return null}function it(e){var _,D,L,K,Q,te,f;if(typeof window=="undefined")return wo;let t=ae(e==null?void 0:e.apiKey),n=(_=e==null?void 0:e.cookieName)!=null?_:ve(e==null?void 0:e.apiKey),r=`${_e}${t}`,i=`${_e}_tomb${t}`,u=((D=e==null?void 0:e.cookieTTLDays)!=null?D:mo)*24*60*60,o=y=>y&&y.length>0?y:null,p=()=>{var y,R;return t&&!(e!=null&&e.cookieName)&&ot(i)===null?(R=(y=o(Ae(pn)))!=null?y:o(ot(_e)))!=null?R:o(xt(_e)):null},a=Eo(e==null?void 0:e.cookieDomain,`${n}_dom`),c=o(Ae(n)),d=a?(rt(n),o(Ae(n))):null,S=(f=(te=(Q=(K=(L=d!=null?d:c)!=null?L:o(ot(r)))!=null?K:o(xt(r)))!=null?Q:p())!=null?te:o(e==null?void 0:e.ssrSessionId))!=null?f:yo();st(n,S,u,a),a&&Ae(n)!==S&&(a=null,st(n,S,u));let m=gn(r,S),b=bo(n),w=m?!1:So(r,S),N=!m&&!b&&!w;return{getSessionId:()=>S,isEphemeral:()=>N,domain:a,destroy:()=>{S=null,rt(n),rt(n,a),vo(r),ho(r),t&&!(e!=null&&e.cookieName)&&(Ae(pn)!==null||ot(_e)!==null||xt(_e)!==null)&&gn(i,"1")}}}var xo=1800*1e3;function at(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function mn(e=xo,t){let n=new Map,r=`_snt_asgn${ae(t)}_`,i=(a,c)=>`${r}${encodeURIComponent(a)}:${encodeURIComponent(c)}`,s=a=>{let c=a.slice(r.length),d=c.indexOf(":");if(d<0)return null;try{return{componentId:decodeURIComponent(c.slice(0,d)),segment:decodeURIComponent(c.slice(d+1))}}catch(S){return null}},u=()=>{try{let a=[];for(let c=0;c<localStorage.length;c++){let d=localStorage.key(c);d!=null&&d.startsWith(r)&&a.push(d)}return a}catch(a){return[]}},o=a=>a.assignedAt+(a.ttlMs&&a.ttlMs>0?a.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let a of u())try{let c=localStorage.getItem(a);if(!c)continue;let d=JSON.parse(c);if(o(d)){localStorage.removeItem(a);continue}let S=s(a);if(!S)continue;n.set(at(S.componentId,S.segment),d)}catch(c){}})(),{get(a,c){let d=n.get(at(a,c));return d?o(d)?(n.delete(at(a,c)),null):d:null},set(a,c,d){let S=at(a,c);n.set(S,d);try{localStorage.setItem(i(a,c),JSON.stringify(d))}catch(m){}},clear(){n.clear();for(let a of u())try{localStorage.removeItem(a)}catch(c){}}}}var yn=["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 lt(e){return kt(e)!==null}function kt(e){var n;if(!e)return null;let t=e.toLowerCase();return(n=yn.find(r=>t.includes(r.toLowerCase())))!=null?n:null}var Sn=["Googlebot","Bingbot","DuckDuckBot","YandexBot","Baiduspider","Applebot","Slurp","facebookexternalhit","LinkedInBot","Twitterbot"];function hn(e){var r;let t=kt(e);if(t)return t;if(!e)return null;let n=e.toLowerCase();return(r=Sn.find(i=>n.includes(i.toLowerCase())))!=null?r:null}function Re(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 Oe(e,t,n){if(!e)return"direct";try{let r=new URL(e);if(t)try{if(new URL(t).host===r.host)return"direct"}catch(s){}let i=r.hostname.toLowerCase();return n&&`.${i}`.endsWith(`.${n}`)?"direct":/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(i)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(i)?"social":"referral"}catch(r){return"direct"}}function Pe(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var bn=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function It(e){let t={},n={};try{let r=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([i,s])=>{let u=Array.isArray(s)?s[0]:s;return u===void 0?[]:[[i,u]]});for(let[i,s]of r)i.startsWith("utm_")?i in t||(t[i]=s):bn.includes(i)&&(i in n||(n[i]=s))}catch(r){}return{utmParams:t,clickIds:n}}function De(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function Ct(e){let t=ko("__segment__",e);return`${t.deviceClass}:${t.trafficSource}`}function ko(e,t){var u,o,p,a,c,d,S,m;let n=(o=(u=t==null?void 0:t.userAgent)==null?void 0:u.trim())!=null?o:"",r=(a=(p=t==null?void 0:t.referer)==null?void 0:p.trim())!=null?a:"",i=(c=t==null?void 0:t.now)!=null?c:new Date,s=hn(n);return k(k({sessionId:e,ephemeral:!1,utmParams:(d=t==null?void 0:t.utmParams)!=null?d:{},clickIds:(S=t==null?void 0:t.clickIds)!=null?S:{},deviceClass:n?Re(n):"desktop",trafficSource:r?Oe(r,t==null?void 0:t.appOrigin):"direct",referrerDomain:Pe(r),timeOfDay:De(i),dayOfWeek:(m=["sun","mon","tue","wed","thu","fri","sat"][i.getDay()])!=null?m:"sun",automation:(t==null?void 0:t.webdriver)===!0||lt(n)},s?{agentToken:s}:{}),t!=null&&t.landingPath?{landingPath:t.landingPath.split(/[?#]/)[0]}:{})}var Ne=require("@sentientui/policy");function je(e){return k(k(k({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 Me(e){let t=je(e);return(0,Ne.slotResultFor)(t,(0,Ne.slotBaselineArm)(t))}function vn(e){let t={};for(let n of e)t[n.id]=Me(n);return t}function ct(e){return typeof e=="string"?e:(0,Ne.canonicalArm)(e)}var wn=require("@sentientui/policy"),dt="data-sentient-stage";function ut(e,t){return!t||typeof e!="string"||!(e==="returning"||wn.STAGE_KEYS.includes(e))?null:t!=="detailed"&&(e==="customer"||e==="lapsed")?"returning":e}function pt(e,t=document){try{e?t.documentElement.setAttribute(dt,e):t.documentElement.removeAttribute(dt)}catch(n){}}var Rt=require("@sentientui/policy");var ft=require("@sentientui/policy");var En="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",Io="[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.",xn=!1,gt=!1;function Co(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function kn(e){var a;let t=it({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),n=(a=t.getSessionId())!=null?a:"local",r=Co(),i=import("@sentientui/core/local").then(c=>{let d=c;return d.LOCAL_ENGINE_AVAILABLE?(xn||(xn=!0,console.info(Io)),d):(gt||(gt=!0,console.error(En)),null)}).catch(()=>(gt||(gt=!0,console.error(En)),null)),s=null,u={low:.15,medium:.5,high:.85},o=(()=>{var d;if(e.initialPersona)return k({},e.initialPersona);let c=Ie(e.apiKey||"local");return c?{persona:c.persona,confidence:(d=u[c.band])!=null?d:.15}:null})();function p(c){let d=document.documentElement;d.dataset.sentientPersona===void 0&&(d.dataset.sentientPersona=c.persona,d.dataset.sentientConfidence=(0,ft.confidenceBand)(c.confidence))}return{isLocal:!0,async decide(c){var m,b,w;let d=await i;if(!d)return null;let S=d.createLocalEngine({sessionId:n,forcedPersona:r}).decide(c);return s=ne(k({},S),{layoutOrder:(b=(m=S.layoutOrder)!=null?m:s==null?void 0:s.layoutOrder)!=null?b:null,slots:k(k({},(w=s==null?void 0:s.slots)!=null?w:{}),S.slots)}),Ce(e.apiKey||"local",{v:1,persona:s.persona,band:(0,ft.confidenceBand)(s.confidence),slots:s.slots,layoutOrder:s.layoutOrder,savedAt:Date.now()}),p(S),S},getSlotResult(c){var d,S,m;return(m=(S=s==null?void 0:s.slots[c])!=null?S:(d=e.initialSlots)==null?void 0:d[c])!=null?m:null},getSlotConfig(c){var d,S;return(S=(d=e.initialSlotConfig)==null?void 0:d[c])!=null?S:null},getSitePalette(){var c;return(c=e.initialPalette)!=null?c:null},reportSlots(){},getVisitorId:()=>null,getPersona(){let c=s!=null?s:o;return c?{persona:c.persona,confidence:c.confidence,band:(0,ft.confidenceBand)(c.confidence)}:null},async assign(c,d){var b;let S=await i;return!S||!d||d.length===0?d!=null&&d[0]?{variantId:d[0],assignmentTtlMs:0}:null:{variantId:(b=S.createLocalEngine({sessionId:n,forcedPersona:r}).decide({components:[{id:c,variantIds:d}]}).assignments[c])!=null?b:d[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>t.destroy()}}var To=["none","sm","md","lg"],_o=["start","center","end","stretch"],Ao=["start","center","end","between"],Ro=["sm","md","lg"],Oo=["normal","medium","bold"],Po=["default","muted","accent"],Do=["primary","secondary","ghost"],No=["left","center","right"],Mo=["auto","square","landscape","wide"],Lo=["cover","contain"],Bo=[2,3,4],Go=[1,2,3,4],Ko=["default","raised"],$o=["none","sm","md","lg"],Uo=["measure"],Fo=["input","textarea","select"],jo=["text","email","number","tel"],Wo=5,Ho=8,Vo=64,zo=5,qo=12,Xo=4,Qo=500;function In(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(In):!1}function Cn(e,t,n,r){let i=[];{let o=!1,p=[],a=()=>{if(o)return;let c=Date.now();for(p.push(c);p.length>0&&c-p[0]>500;)p.shift();p.length>=3&&(o=!0,e("rage_click"))};t.addEventListener("click",a),i.push(()=>t.removeEventListener("click",a))}{let s=!1,u=o=>{if(s||!(o.target instanceof Node)||!t.contains(o.target)&&t!==o.target)return;s=!0;let p=typeof window!="undefined"?window.getSelection():null,a=p?p.toString().length:0;e("text_copy",{selectionLength:a})};document.addEventListener("copy",u),i.push(()=>document.removeEventListener("copy",u))}{let s=!1,u=!1,o=null,p=()=>{o!==null&&(clearTimeout(o),o=null)},a=()=>{s||!u||(p(),o=setTimeout(()=>{!s&&u&&(s=!0,e("scroll_hesitation"))},3e3))},c=()=>{p(),a()},d=m=>{for(let b of m)u=b.intersectionRatio>.3,u?a():p()},S=new IntersectionObserver(d,{threshold:[.3]});S.observe(t),window.addEventListener("scroll",c,{passive:!0}),i.push(()=>{S.disconnect(),window.removeEventListener("scroll",c),p()})}if((r==null?void 0:r.tabLoss)!==!1){let s=!1,u=n!=null?n:Date.now(),o=()=>{if(s||document.visibilityState!=="hidden")return;let p=Date.now()-u;p<15e3&&(s=!0,e("tab_loss",{timeOnPage:p}))};document.addEventListener("visibilitychange",o),i.push(()=>document.removeEventListener("visibilitychange",o))}return()=>{for(let s of i)s()}}function Jo(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var Rn="https://api.sentient-ui.com/v1/events",_n=()=>import("@sentientui/core/internal-traffic"),Y=new Map,On=null;function Pn(e,t){let n=Y.get(e);n&&n.upgrade&&(n.reinit=t)}function Yo(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var Zo=3;function _t(){return nt()}function mt(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function er(){let e=new WeakMap,t=new Map,n=!1,r=(o,p,a)=>{let c=o.get(p);return a===null?c?!0:(o.set(p,new Set),!1):c?c.has(a)?!0:(c.add(a),!1):(o.set(p,new Set([a])),!1)},i=typeof window!="undefined"&&"event"in window,s=()=>{if(!i)return;let o=window.event;return typeof Event=="function"&&o instanceof Event?o:void 0},u=()=>{if(i){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 a=new MessageChannel;a.port1.onmessage=()=>{a.port1.close(),a.port2.close(),p()},a.port2.postMessage(0)}};return{firedBefore(o,p){let a=s();if(a){let d=e.get(a);return d||(d=new Map,e.set(a,d)),r(d,o,p)}let c=r(t,o,p);return!c&&!n&&(n=!0,u()),c}}}var Dn=new Set;function tr(e,t,n){let r=typeof window=="undefined"?null:window.history;if(!r)return()=>{};let i=!1,s,u=()=>{if(i)return;let a=mt();!a||a===s||(s=a,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${a}`))},o=[];for(let a of["pushState","replaceState"]){let c=r[a],d=function(...S){let m=c.apply(this,S);return u(),m};r[a]=d,o.push([a,c,d])}window.addEventListener("popstate",u);let p=mt();return p&&Dn.has(`${t}:${p}`)?s=p:u(),()=>{if(!i){i=!0,window.removeEventListener("popstate",u);for(let[a,c,d]of o)r[a]===d&&(r[a]=c)}}}var We={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getVisitorId:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}};function nr(){try{return It(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function Nn(e){return e.replace(/\/events\/?$/,"")}function He(){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 Mn(e){var p;if(typeof window=="undefined")return;let t=e!=null?e:On;if(!t){console.warn("[sentient] grantConsent() called before init()");return}let n=Y.get(t);if(!n){console.warn("[sentient] grantConsent() called before init()");return}let{config:r,upgrade:i,reinit:s}=n;if(!i){n.upgradeBlockedReason&&console.warn(n.upgradeBlockedReason);return}if(r.respectDoNotTrack!==!1&&He())return;let u=(s!=null?s:Pt)(ne(k({},r),{consent:!0}));i(u);let o=(p=Y.get(t))==null?void 0:p.dispose;Y.set(t,{config:ne(k({},r),{consent:!0}),upgrade:null,dispose:o})}function or(e,t){var te;let n=e.preConsentBehavior==="statistical_winner",r=Nn((te=e.ingestUrl)!=null?te:Rn),i={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},s=new Map,u=new Map,o={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(f,y,R){if(!n)return Promise.resolve(null);let h=s.get(f);return h?Promise.resolve(h):Ot(u,f,async()=>{try{let I=new URLSearchParams({componentId:f});for(let X of y!=null?y:[])I.append("variantIds[]",X);let $=pe(5e3),V;try{let X=await fetch(`${r}/winner?${I.toString()}`,{headers:i,signal:$.signal});if(!X.ok)return y!=null&&y[0]?{variantId:y[0],assignmentTtlMs:0}:null;V=await X.json()}finally{$.clear()}let F={variantId:V.variantId,assignmentTtlMs:0};return s.set(f,F),F}catch(I){return y!=null&&y[0]?{variantId:y[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getVisitorId:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}},p=!1,a=new Set,c=[],d=[],S=[],m=()=>{for(let[,,f]of S.splice(0))f(null);b.length=0},b=[],w=!1,N=()=>{if(p)return;w=!0;let f=Y.get(e.apiKey);(f==null?void 0:f.upgrade)===Q&&Y.set(e.apiKey,{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): client released before consent; call init() again"})},_=[],D=()=>{setTimeout(()=>{var f;try{(f=_.shift())==null||f(o)}catch(y){}_.length&&D()})},L=f=>{p?_.length?_.push(f):f(o):!t&&!w&&b.length<100?b.push(f):w&&e.debug&&console.warn("[sentient] goal dropped: client released")},K={get gated(){return!p&&!t},get released(){return w&&!p},takeHeld:()=>b.splice(0),track:f=>o.track(f),goal:((f,y,R,h)=>L(I=>I.goal(f,y,R,h))),componentGoal:(f,y,R)=>o.componentGoal(f,y,R),identify:(f,y)=>o.identify(f,y),getAssignment:(f,y)=>o.getAssignment(f,y),isUnified:f=>{var y,R;return(R=(y=o.isUnified)==null?void 0:y.call(o,f))!=null?R:!1},assign:(f,y,R,h,I)=>o.assign(f,y,R,h,I),decide:f=>p?o.decide(f):w||t?Promise.resolve(null):new Promise(y=>S.push([f,An(),y])),getSlotResult:f=>o.getSlotResult(f),isSlotDecided:f=>{var y,R;return(R=(y=o.isSlotDecided)==null?void 0:y.call(o,f))!=null?R:!0},getSlotConfig:f=>o.getSlotConfig(f),getSitePalette:()=>o.getSitePalette(),getStyleVocabulary:()=>{var f,y;return(y=(f=o.getStyleVocabulary)==null?void 0:f.call(o))!=null?y:null},reportSlots:(f,y,R,h)=>o.reportSlots(f,y,R,h),reportSkeleton:(f,y)=>{var R;return(R=o.reportSkeleton)==null?void 0:R.call(o,f,y)},reportAgentData:(f,y,R)=>{var h;return(h=o.reportAgentData)==null?void 0:h.call(o,f,y,R)},reportDrift:(f,y,R,h)=>{var I;return(I=o.reportDrift)==null?void 0:I.call(o,f,y,R,h)},requestSlots:(f,y,R)=>{var h;return p?(h=o.requestSlots)==null?void 0:h.call(o,f,y,R):c.push([f,y,R])},decideSlots:f=>{var y;return p?(y=o.decideSlots)==null?void 0:y.call(o,f):d.push(...f)},cancelSlots:f=>{var R;if(p)return(R=o.cancelSlots)==null?void 0:R.call(o,f);let y=new Set(f);for(let h of c)h[0]=h[0].filter(I=>!y.has(I));d=d.filter(h=>!y.has(h.id))},onSlotsChanged:f=>(a.add(f),()=>{a.delete(f)}),getPersona:()=>o.getPersona(),getVisitorId:()=>{var f,y;return(y=(f=o.getVisitorId)==null?void 0:f.call(o))!=null?y:null},fetchWeights:()=>o.fetchWeights(),getGraph:()=>o.getGraph(),flush:()=>o.flush(),dispose:()=>(N(),m(),o.dispose()),destroy:()=>(N(),m(),p?o.destroy():un(e.apiKey))};function Q(f){var R,h,I;o=f,p=!0,b.length&&(_.push(...b.splice(0)),D());let y=An();for(let[$,V,F]of S.splice(0))V!==y?F(null):f.decide($).then(F,()=>F(null));(R=f.onSlotsChanged)==null||R.call(f,()=>a.forEach($=>$()));for(let[$,V,F]of c.splice(0))$.length>0&&((h=f.requestSlots)==null||h.call(f,$,V,F));d.length>0&&((I=f.decideSlots)==null||I.call(f,d.splice(0)))}return{proxy:K,setInner:Q}}function An(){return typeof location=="undefined"?"":location.pathname+(/^#!?\//.test(location.hash)?location.hash:"")}function Ot(e,t,n){let r=e.get(t);if(r)return r;let i=(async()=>{try{return await n()}finally{e.delete(t)}})();return e.set(t,i),i}function Pt(e){var Ft,jt,Wt,Ht,Vt,zt,qt,Xt,Qt,Jt,Yt;if(typeof window=="undefined")return We;e.nonce&&an(e.nonce),On=e.apiKey||"local";let t=Y.get(e.apiKey||"local");if(t!=null&&t.dispose)try{t.dispose()}catch(l){}let n=e.respectDoNotTrack!==!1&&He(),r=e.consent===!1||n,i=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!i&&e.localMode!==!1)return Y.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."}),r?We:kn(e);if(r){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."),Y.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."}),We;let{proxy:l,setInner:g}=or(e,n);return Y.set(e.apiKey,{config:e,upgrade:n?null:g}),l}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."),We;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),We;let s=(Ft=e.ingestUrl)!=null?Ft:Rn,u=Date.now(),o=it({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey,cookieDomain:e.cookieDomain}),p={},a;try{/sentient_internal=/.test(location.search+document.cookie)&&(a=_n().then(async l=>{p.internalToken=await l.takeInternalToken(o.domain)||void 0}).catch(()=>{})),(typeof e.internal=="function"?e.internal():e.internal)===!0&&(p.internal=!0)}catch(l){}let c=mn(void 0,e.apiKey),d=!1,S=fe(e.apiKey),m=()=>!d&&fe(e.apiKey)===S,b=new Set((jt=e.initialUnified)!=null?jt:[]),w=ne(k({},c),{get:(l,g)=>b.has(l)?null:c.get(l,g),set:(...l)=>{m()&&c.set(...l)}}),N=cn({ingestUrl:s,apiKey:e.apiKey}),_=Nn(s),D={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},L=new Set,K=dn({url:`${_}/goals`,apiKey:e.apiKey,headers:D,onDrop:(l,g)=>{if(!e.debug){if(L.has(g))return;L.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."),l)}}),Q=Re((Wt=navigator.userAgent)!=null?Wt:""),te=window.location.origin,f=Oe((Ht=document.referrer)!=null?Ht:"",te,o.domain),y=(Vt=e.sessionSegment)!=null?Vt:`${Q}:${f}`,R=new Map,h=new Map,I=new Map,$=new Set,V=new Map,F=null,X=null,H=null,C=new Set,B=new Set,le=new Map,Se=new Map,oe=new Set,xe=new Set,Le=new Set,he=new Set,we=null,se=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,Bt=new Set,ze=new Set,qe=new Set,Be=new Map,ht=null,Xe=new Set,Ge=new Map,bt=null,qn=2,Gt=new Map,ie=!1,Kt=(l,g,v)=>{var E;let A=new Set,P=1;for(let x of l){g.delete(x);let T=((E=Gt.get(x))!=null?E:0)+1;Gt.set(x,T),T<=qn&&(A.add(x),T>P&&(P=T))}A.size>0&&setTimeout(()=>{ie||v(A)},ye(P))},vt=l=>{for(let g of l)I.has(g.id)||I.set(g.id,Me(g))};if(e.initialSlots)for(let[l,g]of Object.entries(e.initialSlots))I.set(l,g),$.add(l);if(e.initialSlotConfig)for(let[l,g]of Object.entries(e.initialSlotConfig))V.set(l,g);e.initialPalette&&(F=e.initialPalette),e.initialVocabulary&&(X=e.initialVocabulary);let ce=Ie(e.apiKey);if(ce){for(let[l,g]of Object.entries(ce.slots))I.has(l)||I.set(l,g);for(let[l,g]of Object.entries((zt=ce.slotConfig)!=null?zt:{}))V.has(l)||V.set(l,g);!F&&ce.palette&&(F=ce.palette),!X&&ce.vocabulary&&(X=ce.vocabulary)}let $t={low:.15,medium:.5,high:.85};if(e.initialPersona)H=k({},e.initialPersona);else{let l=document.documentElement.dataset;l.sentientPersona?H={persona:l.sentientPersona,confidence:(Xt=$t[(qt=l.sentientConfidence)!=null?qt:"low"])!=null?Xt:.15}:ce&&(H={persona:ce.persona,confidence:(Qt=$t[ce.band])!=null?Qt:.15})}if(e.initialAssignments)for(let[l,g]of Object.entries(e.initialAssignments))w.set(l,y,{variantId:g,assignedAt:Date.now(),segment:y,confidence:1});let be=Promise.resolve(),Ut=o.getSessionId();if(Ut){let l=Pe((Jt=document.referrer)!=null?Jt:""),{utmParams:g,clickIds:v}=nr(),A=k(k(k(k({sessionId:Ut,deviceClass:Q,trafficSource:f,referrerDomain:l,utmParams:g,clickIds:v,landingPath:typeof location!="undefined"?location.pathname:void 0,timeOfDay:De(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:o.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||lt((Yt=navigator.userAgent)!=null?Yt:"")},e.userId?{userId:e.userId,userHash:e.userHash}:{}),e.persona?{persona:e.persona}:{}),e.country?{country:e.country}:{}),e.sdk?{sdk:e.sdk.name,sdkVersion:e.sdk.version}:{}),P=async()=>{a&&await Qe(a,2500);for(let E=0;;E++){if(ie||!m())return;let x=pe(5e3);try{let T=await fetch(`${_}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(Object.assign(A,p)),headers:D,signal:x.signal});if(T.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(T.ok||Te(T)==="dropped")return}catch(T){}finally{x.clear()}if(E>=Zo){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(T=>setTimeout(T,ye(E+1)))}};try{be=P()}catch(E){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:N});let Xn=er(),Ee=null,wt=!1,q={goal(l,g={},v=1,A=0){var z,G,Z,re,ee,J,O;let P=o.getSessionId();if(!P||ie||!m())return;let E=Yo(g)?g:{metadata:g},x=[l,(z=E.externalId)!=null?z:"",(G=E.stepIndex)!=null?G:A,(Z=E.weight)!=null?Z:v].join("\0"),T=E.value!==void 0?`${E.value}\0${(re=E.currency)!=null?re:""}`:null;if(Xn.firedBefore(x,T)){e.debug&&console.log(`[sentient] goal("${l}") already recorded for this action \u2014 not sent twice`);return}let U=_t(),M={sessionId:P,name:l,metadata:(ee=E.metadata)!=null?ee:{},weight:(J=E.weight)!=null?J:v,stepIndex:(O=E.stepIndex)!=null?O:A,goalId:U,value:E.value,currency:E.currency,externalId:E.externalId};e.debug&&console.log("[sentient] goal",M);let j={id:U,body:JSON.stringify(M)};be.then(()=>K.send(j))},componentGoal(l,g,v){var U,M,j;let A=o.getSessionId();if(!A||ie||!m())return;let P=w.get(l,y),E=P?null:(U=I.get(l))!=null?U:null;if(!P&&E===null){e.debug&&console.warn(`[sentient] componentGoal("${l}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}if(!P&&!$.has(l)){e.debug&&console.warn(`[sentient] componentGoal("${l}"): slot not decided this session \u2014 not attributed`);return}let x=P?P.variantId:ct(E),T={id:_t(),sessionId:A,projectId:e.apiKey,componentId:l,variantId:x,eventType:"goal_achieved",goalType:g,payload:k({reward:(M=v==null?void 0:v.reward)!=null?M:1,goalValue:v==null?void 0:v.value,currency:v==null?void 0:v.currency},(j=v==null?void 0:v.metadata)!=null?j:{}),timestamp:Date.now(),timeInSession:Date.now()-u,path:mt()};e.debug&&console.log("[sentient] componentGoal",T),be.then(()=>{!ie&&m()&&N.push(T)})},identify(l,g){let v=o.getSessionId();if(!v||ie||!m())return;let A=(g==null?void 0:g.email)!==void 0?_n().then(P=>P.emailFields(g.email)).catch(()=>({})):{};Promise.all([be,A]).then(([,P])=>{fetch(`${_}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(ne(k(k({sessionId:v,userId:l,userHash:g==null?void 0:g.userHash},P),p),{ephemeral:o.isEphemeral()})),headers:D}).catch(()=>{})})},track(l){let g=o.getSessionId();if(!g||ie||!m()||l.eventType==="variant_assigned"&&I.get(l.componentId)!==void 0&&!$.has(l.componentId)&&!w.get(l.componentId,y))return;let v=ne(k({path:mt()},l),{id:_t(),sessionId:g,timestamp:Date.now(),timeInSession:Date.now()-u});e.debug&&console.log("[sentient] track",v),be.then(()=>N.push(v))},getAssignment(l,g){return w.get(l,g)},isUnified:l=>b.has(l),async assign(l,g,v,A,P){var U;let E=o.getSessionId();if(!E)return null;let x=(P==null?void 0:P.unified)===!0;if(x&&b.has(l))return{variantId:(U=g==null?void 0:g[0])!=null?U:"",assignmentTtlMs:0,unified:!0};let T=w.get(l,y);if(T&&(g!=null&&g.length||T.content!==void 0)){let M=T.ttlMs&&T.ttlMs>0?Math.max(0,T.assignedAt+T.ttlMs-Date.now()):0;return{variantId:T.variantId,assignmentTtlMs:M,content:T.content}}return Ot(R,x?`${l}\0unified`:l,async()=>{if(!await Qe(be,2500)||ie||!m())return null;let M=pe(3e4);try{let j={sessionId:E,componentId:l,variantIds:g};A!==void 0?j.agentDataByVariant=A:v!==void 0&&(j.agentData=v),x&&(j.caps={unified:!0});let z=await fetch(`${_}/assign`,{method:"POST",body:JSON.stringify(j),headers:D,signal:M.signal});if(!z.ok)return null;let G=await z.json();return G.unified===!0?x?(b.add(l),{variantId:G.variantId,assignmentTtlMs:0,unified:!0}):null:(w.set(l,y,k({variantId:G.variantId,assignedAt:Date.now(),segment:y,confidence:1,content:G.content},G.assignmentTtlMs&&G.assignmentTtlMs>0?{ttlMs:G.assignmentTtlMs}:{})),G)}catch(j){return null}finally{M.clear()}})},async decide(l){var E,x;let g=o.getSessionId();if(!g)return null;let v=(E=l.slots)!=null?E:[],A={sessionId:g};l.sections&&l.sections.length>0&&(A.sections=l.sections.map(T=>({id:T}))),A.components=(x=l.components)!=null?x:[],v.length>0&&(A.slots=v.map(je)),l.slotsFrom==="registry"&&(A.slotsFrom="registry",l.registrySlotIds&&(A.registrySlotIds=l.registrySlotIds),l.bootstrap===!1&&(A.bootstrap=!1),l.render&&Object.keys(l.render).length>0&&(A.render=l.render)),l.v&&(A.v=l.v),typeof l.pp=="number"&&(A.pp=l.pp),e.persona&&(A.persona=e.persona),Object.assign(A,p);let P=JSON.stringify(A);return Ot(h,P,async()=>{var U,M,j,z,G,Z,re,ee;if(!await Qe(be,2500)||ie||!m())return vt(v),null;let T=pe(3e4);try{let J=await fetch(`${_}/decide`,{method:"POST",body:P,headers:D,signal:T.signal});if(!J.ok)return vt(v),null;let O=await J.json(),de=ut(O.stage,e.stageAttributes);e.stageAttributes&&pt(de);let ke={};for(let W of v){let ue=(U=O.slots)==null?void 0:U[W.id];if(ue!==void 0){ke[W.id]=ue,I.set(W.id,ue),$.add(W.id);continue}let Zt=I.get(W.id);if(Zt!==void 0)ke[W.id]=Zt;else{let en=Me(W);ke[W.id]=en,I.set(W.id,en)}}if(O.slots)for(let[W,ue]of Object.entries(O.slots))W in ke||(ke[W]=ue,I.set(W,ue),$.add(W));let Qn=H!=null&&H.persona!=="unknown";O.persona&&!(O.persona==="unknown"&&Qn)?H={persona:O.persona,confidence:(M=O.confidence)!=null?M:0}:H||(H={persona:"unknown",confidence:0});for(let[W,ue]of Object.entries((j=O.assignments)!=null?j:{}))w.set(W,y,{variantId:ue,assignedAt:Date.now(),segment:y,confidence:1});if(O.slotConfig)for(let[W,ue]of Object.entries(O.slotConfig))V.set(W,ue);O.palette&&(F=O.palette),O.vocabulary&&(X=O.vocabulary);for(let W of(z=l.registrySlotIds)!=null?z:[])(G=O.slotConfig)!=null&&G[W]||(V.delete(W),I.delete(W),$.delete(W));return m()&&Ce(e.apiKey,k(k(k(k({v:1,persona:H.persona,band:(0,Rt.confidenceBand)(H.confidence),slots:Object.fromEntries(I),layoutOrder:(Z=O.layoutOrder)!=null?Z:null,savedAt:Date.now()},V.size>0?{slotConfig:Object.fromEntries(V)}:{}),F?{palette:F}:{}),X?{vocabulary:X}:{}),de?{stage:de}:{})),k(k(k(k(k(k(k({layoutOrder:(re=O.layoutOrder)!=null?re:null,assignments:(ee=O.assignments)!=null?ee:{},slots:ke,persona:H.persona,confidence:H.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}:{}),O.stage?{stage:O.stage}:{}),O.context?{context:O.context}:{})}catch(J){return vt(v),null}finally{T.clear()}})},getSlotResult(l){var g;return(g=I.get(l))!=null?g:null},isSlotDecided(l){return $.has(l)},getSlotConfig(l){var g;return(g=V.get(l))!=null?g:null},reportSlots(l,g,v,A){var E;let P={};for(let[x,T]of Object.entries(A!=null?A:{}))for(let U of T){let M=`${x}|${U.key}`;!se.test(x)||Le.has(M)||(Le.add(M),((E=P[x])!=null?E:P[x]=[]).push(U))}Object.keys(P).length>0&&fetch(`${_}/slots/observed`,{method:"POST",headers:D,body:JSON.stringify({slotIds:Object.keys(P),authoredArms:P})}).catch(()=>{});for(let x of l)if(!(typeof x!="string"||x.length===0)){if(!se.test(x)){Jo()&&!Bt.has(x)&&(Bt.add(x),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(x)} will not register \u2014 ids must start with a letter or digit and contain only letters, digits, '_' or '-' (max 128 chars): /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.`));continue}if(!C.has(x)){C.add(x),B.add(x);let T=g==null?void 0:g[x];if(typeof T=="string"){let M=T.replace(/\s+/g," ").trim().slice(0,400);M!==""&&le.set(x,M)}let U=v==null?void 0:v[x];U!==void 0&&Se.set(x,U)}}B.size===0||we!=null||(we=setTimeout(()=>{we=null;let x=[...B];B.clear();for(let T=0;T<x.length;T+=20){let U=x.slice(T,T+20),M={},j={};for(let z of U){let G=le.get(z);G!==void 0&&(M[z]=G,le.delete(z));let Z=Se.get(z);Z!==void 0&&(j[z]=Z,Se.delete(z))}fetch(`${_}/slots/observed`,{method:"POST",headers:D,body:JSON.stringify(k(ne(k(k({slotIds:U},Object.keys(M).length>0?{baselineTexts:M}:{}),Object.keys(j).length>0?{baselineSkeletons:j}:{}),{pagePaths:Object.fromEntries(U.map(z=>[z,location.pathname]))}),Object.keys(M).length>0&&o.getSessionId()?{sessionId:o.getSessionId()}:{}))}).catch(()=>{})}},1e3))},reportSkeleton(l,g){!se.test(l)||oe.has(l)||(oe.add(l),fetch(`${_}/slots/observed`,{method:"POST",headers:D,body:JSON.stringify({slotIds:[l],baselineSkeletons:{[l]:g}})}).catch(()=>{}))},reportAgentData(l,g,v){let A=`${l}|${g}`;!se.test(l)||he.has(A)||(he.add(A),fetch(`${_}/slots/observed`,{method:"POST",headers:D,body:JSON.stringify(k(k({slotIds:[l],agentData:{[l]:{[g]:v}}},g.startsWith("authored.")?{authoredArms:{[l]:[{key:g.slice(9)}]}}:{}),o.getSessionId()?{sessionId:o.getSessionId()}:{}))}).catch(()=>{}))},reportDrift(l,g,v,A){let P=`${l}|${g}`,E=o.getSessionId();!E||xe.has(P)||(xe.add(P),fetch(`${_}/slots/drift`,{method:"POST",headers:D,body:JSON.stringify({sessionId:E,reports:[{slotId:l,expectedFp:g,observedFp:v,reason:A}]})}).catch(()=>{}))},requestSlots(l,g,v){var A,P;for(let E of l)qe.has(E)||(qe.add(E),se.test(E)?Be.set(E,{text:g==null?void 0:g[E],render:(A=v==null?void 0:v.render)==null?void 0:A[E],skeleton:(P=v==null?void 0:v.skeletons)==null?void 0:P[E]}):q.reportSlots([E]));Be.size===0||ht!=null||(ht=setTimeout(()=>{ht=null;let E=[...Be];Be.clear();for(let x=0;x<E.length;x+=50){let T=E.slice(x,x+50),U={};for(let[M,j]of T)j.render&&(U[M]=j.render);q.decide({slotsFrom:"registry",registrySlotIds:T.map(([M])=>M),bootstrap:!1,render:U}).then(M=>{var j,z;if(M){let G={},Z={},re=[];for(let[ee,J]of T){let O=(j=M.slotConfig)==null?void 0:j[ee];if(O){O.needsSkeleton&&J.skeleton&&((z=q.reportSkeleton)==null||z.call(q,ee,J.skeleton));continue}re.push(ee),J.text&&(G[ee]=J.text),J.skeleton&&(Z[ee]=J.skeleton)}re.length>0&&q.reportSlots(re,G,Z)}else Kt(T.map(([G])=>G),qe,G=>{var J;let Z={},re={},ee={};for(let[O,de]of T)G.has(O)&&(de.text&&(Z[O]=de.text),de.render&&(re[O]=de.render),de.skeleton&&(ee[O]=de.skeleton));(J=q.requestSlots)==null||J.call(q,[...G],Z,{render:re,skeletons:ee})});ze.forEach(G=>G())})}},0))},decideSlots(l){for(let g of l)Xe.has(g.id)||(Xe.add(g.id),Ge.set(g.id,g));Ge.size===0||bt!=null||(bt=setTimeout(()=>{bt=null;let g=[...Ge.values()];Ge.clear();for(let v=0;v<g.length;v+=30){let A=g.slice(v,v+30);q.decide({slots:A}).then(P=>{P||Kt(A.map(E=>E.id),Xe,E=>{var x;return(x=q.decideSlots)==null?void 0:x.call(q,A.filter(T=>E.has(T.id)))}),ze.forEach(E=>E())})}},0))},cancelSlots(l){for(let g of l)Be.delete(g)&&qe.delete(g),Ge.delete(g)&&Xe.delete(g)},onSlotsChanged(l){return ze.add(l),()=>{ze.delete(l)}},getStyleVocabulary(){return X},getSitePalette(){return F},getVisitorId:()=>m()?o.getSessionId():null,getPersona(){return H?{persona:H.persona,confidence:H.confidence,band:(0,Rt.confidenceBand)(H.confidence)}:null},async fetchWeights(){var g;let l=pe(5e3);try{let v=await fetch(`${_}/weights`,{headers:D,signal:l.signal});return v.ok?(g=(await v.json()).components)!=null?g:[]:[]}catch(v){return[]}finally{l.clear()}},getGraph(){return{pageNodes:[],capturedAt:0}},flush(){N.flush(),K.flush()},dispose(){var l;Ee==null||Ee(),wt=!0,ie=!0,N.destroy(),K.destroy(),((l=Y.get(e.apiKey))==null?void 0:l.dispose)===q.dispose&&Y.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var l;Ee==null||Ee(),wt=!0,ie=!0,d=!0,Ye(e.apiKey),N.destroy({forget:!0}),K.destroy({forget:!0}),o.destroy(),w.clear(),((l=Y.get(e.apiKey))==null?void 0:l.dispose)===q.dispose&&Y.delete(e.apiKey);try{localStorage.removeItem(me+e.apiKey),localStorage.removeItem(Ue(e.apiKey)),localStorage.removeItem(Fe(e.apiKey)),localStorage.removeItem(`_snt_graph_nodes${ae(e.apiKey)}`),localStorage.removeItem("_snt_graph_edges")}catch(g){}e.debug&&console.log("[sentient] destroyed")}};if(Y.set(e.apiKey,{config:e,upgrade:null,dispose:q.dispose}),Ee=tr(q,e.apiKey,l=>{be.then(()=>{wt||Dn.add(l)})}),e.debug){let l=window;l.__sentient&&(l.__sentient.client=q)}return q}var Ln="_snt_graph_edges",rr={pricing:["features","faq"],features:["pricing"],faq:["pricing"],social_proof:["cta"],cta:["social_proof","hero","trust"],hero:["cta"],comparison:["pricing"],trust:["cta"]};function sr(e){var t;return(t=rr[e])!=null?t:[]}function ir(e,t){try{let n=localStorage.getItem(e);return n?JSON.parse(n):t}catch(n){return t}}function ar(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(n){}}var lr=new Set(["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"]);function cr(e){return lr.has(e)?e:"generic"}function Dt(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch(t){return"/"}}function dr(e,t,n){let r=`${e}:${t}:${n.join(",")}`,i=5381;for(let s=0;s<r.length;s++)i=(i<<5)+i+r.charCodeAt(s)&4294967295;return(i>>>0).toString(16).padStart(8,"0")}function Bn(e){let t=new Map,n=new Map,r=`_snt_graph_nodes${ae(e==null?void 0:e.apiKey)}`,i=()=>{typeof window!="undefined"&&ar(r,[...t.values()])};if(typeof window!="undefined"){let s=ir(r,[]);for(let u of s)t.set(u.componentId,u);try{localStorage.removeItem(Ln)}catch(u){}}return{addPageNode(s){t.set(s.componentId,s),i()},addStructuralEdge(s){let u=`${s.fromComponentId}->${s.toComponentId}`;n.set(u,s)},syncOnce(){var u,o;if(!(e!=null&&e.syncUrl)||typeof window=="undefined")return;let s=[...t.values()];if(s.length!==0)try{let p=new Map;for(let m of s){let b=(u=p.get(m.semanticType))!=null?u:[];b.push(m),p.set(m.semanticType,b)}let a=[],c=new Set;for(let m of s)for(let b of sr(m.semanticType)){let w=(o=p.get(b))!=null?o:[];for(let N of w){if(N.componentId===m.componentId)continue;let _=`semantic:${m.componentId}->${N.componentId}`;c.has(_)||(c.add(_),a.push({fromComponentId:m.componentId,toComponentId:N.componentId,type:"semantic",weight:.4,confidence:.9}))}}let d=new Set(s.map(m=>m.componentId));for(let m of n.values()){if(!d.has(m.fromComponentId)||!d.has(m.toComponentId))continue;let b=`structural:${m.fromComponentId}->${m.toComponentId}`;c.has(b)||(c.add(b),a.push({fromComponentId:m.fromComponentId,toComponentId:m.toComponentId,type:"structural",weight:m.weight,confidence:1}))}let S=ne(k(k({pageUrl:Dt(window.location.href)},e.sessionId?{sessionId:e.sessionId}:{}),e.projectId?{projectId:e.projectId}:{}),{nodes:s.map(m=>{let b=cr(m.semanticType);return{componentId:m.componentId,semanticType:b,answers:m.answers,contentHash:dr(m.componentId,b,m.answers),prominenceScore:m.prominenceScore,depthInPage:m.depth}}),edges:a});fetch(e.syncUrl,{method:"POST",keepalive:!0,headers:k({"Content-Type":"application/json"},e.apiKey?{Authorization:`Bearer ${e.apiKey}`}:{}),body:JSON.stringify(S)}).catch(()=>{})}catch(p){}},snapshot(){return{pageNodes:[...t.values()],capturedAt:Date.now()}},destroy(){if(typeof window!="undefined")try{localStorage.removeItem(r),localStorage.removeItem(Ln)}catch(s){}}}}var ur=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function Nt(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function pr(e){return{tag:e.tagName.toLowerCase(),text:Nt(e).slice(0,40)}}function Gn(e){return e.replace(/["\\\]]/g,"\\$&")}function Ve(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function Kn(e,t){var u;let n=e.tagName.toLowerCase();if(!n)return null;let r=((u=e.getAttribute("class"))!=null?u:"").split(/\s+/).filter(o=>/^[a-zA-Z][\w-]*$/.test(o)),i=[n,...r.map(o=>`${n}.${o}`)];for(let o of i)if(Ve(t,o))return o;let s=e.parentElement;if(s&&s!==t){let o=Kn(s,t);if(o){for(let d of i){let S=`${o} > ${d}`;if(Ve(t,S))return S}let p=Array.from(s.children).filter(d=>d.tagName.toLowerCase()===n),a=p.indexOf(e),c=p.some(d=>d!==e&&Nt(d)!==Nt(e));if(a>=0&&c){let d=`${o} > ${n}:nth-of-type(${a+1})`;if(Ve(t,d))return d}}}return null}function yt(e,t){let n=pr(e),r=e.getAttribute("id");if(r&&Ve(t,`#${Gn(r)}`))return{v:1,id:r,fingerprint:n};for(let s of ur){let u=e.getAttribute(s);if(u&&Ve(t,`[${s}="${Gn(u)}"]`))return{v:1,dataAttr:{name:s,value:u},fingerprint:n}}let i=Kn(e,t);return i?{v:1,selector:i,fingerprint:n}:null}var Un=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],gr={banner:"hero",navigation:"navigation",contentinfo:"footer"};function fr(e){let t=e.ariaRole?gr[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 mr(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var yr=[["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]],Sr=[["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 hr(e){var n;let t=e.querySelector("h1, h2, h3");return((n=t==null?void 0:t.textContent)!=null?n:"").slice(0,160)}function br(e){var i,s;let t=fr(e);if(t)return{type:(i=$n[t])!=null?i:"generic",strength:"strong"};let n=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[u,o]of yr)if(o.test(n))return{type:u,strength:"strong"};for(let[u,o]of Sr)if(o.test(e.bodyText))return{type:u,strength:"strong"};let r=mr(e);return{type:(s=$n[r])!=null?s:"generic",strength:"weak"}}function vr(e){var r,i;let t=((r=e.textContent)!=null?r:"").replace(/\s+/g," ").trim(),n=e.getAttribute("role");return k({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((i=e.className)!=null?i:"")}`,headingText:hr(e),bodyText:t.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:t.length},n?{ariaRole:n}:{})}function Fn(e){return br(vr(e)).type}var wr=new Set(["SECTION","ARTICLE","MAIN","DIV","ASIDE"]),Er=200,xr="h1, h2, h3",kr="[data-sentient-id], section[aria-label], article[aria-label], main[aria-label], aside[aria-label]",jn=30,Ir=1500,Cr={scan:async()=>({nodes:[],edges:[],scannedAt:0}),observe:()=>{},getProminenceScore:()=>0,destroy:()=>{}};function Wn(e,t,n){return n<=t?0:Math.max(0,Math.min(1,(e-t)/(n-t)))}function Tr(e){var t,n,r;try{let i=e;for(let s of Object.keys(i)){if(!s.startsWith("__reactFiber")&&!s.startsWith("__reactInternalInstance"))continue;let u=i[s],o=(r=(t=u==null?void 0:u.type)==null?void 0:t.displayName)!=null?r:(n=u==null?void 0:u.type)==null?void 0:n.name;if(o&&o.length>1)return o}}catch(i){}}function _r(e){let t={};for(let n of Array.from(e.attributes))n.name.startsWith("data-")&&(t[n.name]=n.value);return t}var Mt=new Set(Un);function Ar(e,t){let n=e.getAttribute("data-sentient-id"),r=n?t==null?void 0:t[n]:void 0;if(r&&Mt.has(r))return r;let i=e.getAttribute("data-sentient-type");if(i&&Mt.has(i))return i;let s=e.getAttribute("role");return s&&Mt.has(s)?s:Fn(e)}function Rr(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 Or(e){let t=[],n=e;for(;n;){let r=n.parentElement;if(!r){t.push(n.tagName.toLowerCase());break}let i=Array.prototype.indexOf.call(r.children,n);t.push(`${n.tagName.toLowerCase()}[${i}]`),n=r}return t.reverse().join("/")}function Pr(e){var n;let t=(n=e.getAttribute("data-sentient-id"))!=null?n:e.getAttribute("id");return t||`${e.tagName.toLowerCase()}-${Rr(Or(e))}`}function Dr(e){let t=0,n=e.parentElement;for(;n;)t++,n=n.parentElement;return t}function Lt(e,t,n){var i,s,u,o;let r=e.querySelector(xr);return{componentId:Pr(e),semanticType:Ar(e,n),ariaLabel:(i=e.getAttribute("aria-label"))!=null?i:void 0,headingText:(u=(s=r==null?void 0:r.textContent)==null?void 0:s.trim())!=null?u:void 0,isAboveFold:e.getBoundingClientRect().top<window.innerHeight,prominenceScore:t(e),depth:Dr(e),reactComponentName:Tr(e),dataAttributes:_r(e),locator:(o=yt(e,e.ownerDocument))!=null?o:void 0}}function Hn(e){var s;let t=[],n=new Set,r="__root__",i=new Map;for(let[u,o]of e){let p=u.parentElement,a=r;for(;p;){if(e.has(p)){a=e.get(p);let d=e.get(u),S=`${a}->${d}`;!n.has(S)&&a!==d&&(n.add(S),t.push({fromComponentId:a,toComponentId:d,weight:.6}));break}p=p.parentElement}let c=(s=i.get(a))!=null?s:[];c.push(u),i.set(a,c)}for(let u of i.values()){if(u.length<2)continue;let o=u.length>jn?u.slice(0,jn):u;for(let p=0;p<o.length;p++)for(let a=p+1;a<o.length;a++){if(t.length>=Ir)return t;let c=e.get(o[p]),d=e.get(o[a]);if(c===d)continue;let S=`${c}->${d}::sib`,m=`${d}->${c}::sib`;n.has(S)||(n.add(S),t.push({fromComponentId:c,toComponentId:d,weight:.3})),n.has(m)||(n.add(m),t.push({fromComponentId:d,toComponentId:c,weight:.3}))}}return t}function Nr(e,t){let n=[],r=new Set,i=new Map;return document.querySelectorAll("[data-sentient-id]").forEach(o=>{if(o instanceof Element&&!r.has(o)){r.add(o);let p=Lt(o,e,t);n.push(p),i.set(o,p.componentId)}}),document.querySelectorAll("section, article, main, aside").forEach(o=>{if(!(o instanceof Element)||r.has(o))return;let p=o.hasAttribute("aria-label"),a=o.hasAttribute("data-sentient-id");if(!p&&!a)return;r.add(o);let c=Lt(o,e,t);n.push(c),i.set(o,c.componentId)}),{nodes:n,edges:Hn(i),elementToId:i}}function Vn(e={}){let{sectionTypes:t}=e;if(typeof window=="undefined")return Cr;let n=null,r=0,i=null,s=new Map,u=m=>{try{let b=window.getComputedStyle(m),w=parseFloat(b.fontSize)||12,N=parseFloat(b.zIndex)||0,_=m.getBoundingClientRect(),D=Math.max(_.top,0),L=window.innerHeight||1,K=1/(D/L+1),Q=Wn(w,12,48)*.4+K*.4+Wn(N,0,100)*.2;return Math.max(0,Math.min(1,Q))}catch(b){return .5}},o=()=>new Promise(m=>{let b=()=>{let{nodes:w,edges:N,elementToId:_}=Nr(u,t);s.clear();for(let[D,L]of _)s.set(D,L);m({nodes:w,edges:N,scannedAt:Date.now()})};try{typeof requestIdleCallback=="function"?r=requestIdleCallback(b,{timeout:100}):b()}catch(w){b()}}),p=new Set,a=null,c=()=>{a=null;let m=[...p];p.clear();let b=[],w=new Set;for(let _ of m){if(!_.isConnected)continue;let D=[];wr.has(_.tagName)&&(_.hasAttribute("data-sentient-id")||_.hasAttribute("aria-label"))&&D.push(_);try{_.querySelectorAll(kr).forEach(L=>D.push(L))}catch(L){}for(let L of D){if(s.has(L))continue;let K=Lt(L,u,t);b.push(K),w.add(K.componentId),s.set(L,K.componentId)}}if(b.length===0||!i)return;for(let _ of[...s.keys()])_.isConnected||s.delete(_);let N=Hn(s).filter(_=>w.has(_.fromComponentId)||w.has(_.toComponentId));i({nodes:b,edges:N,addedAt:Date.now()})};return{scan:o,observe:m=>{i=m;try{n=new MutationObserver(b=>{for(let w of b)w.type==="childList"&&w.addedNodes.forEach(N=>{N instanceof Element&&p.add(N)});p.size>0&&a===null&&(a=setTimeout(c,Er))}),n.observe(document.body,{childList:!0,subtree:!0})}catch(b){}},getProminenceScore:u,destroy:()=>{if(n&&(n.disconnect(),n=null),a!==null&&clearTimeout(a),a=null,p.clear(),r&&typeof cancelIdleCallback=="function")try{cancelIdleCallback(r)}catch(m){}r=0,i=null,s.clear()}}}var Mr="https://api.sentient-ui.com/v1/events";function Lr(e){var n;let t=r=>{try{let i=document.cookie.match(new RegExp(`(?:^|; )${r}=([^;]*)`));return i?decodeURIComponent(i[1]):void 0}catch(i){return}};return(n=e?t(ve(e)):void 0)!=null?n:t(ge)}var St=new Map;function zn(e){var m;let t=Pt(e),n=e.respectDoNotTrack!==!1&&He(),r=e.consent===!1||n,i=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_"),s=e.localMode===!0||!i;if(!e.graph||s||typeof window=="undefined")return t;if(r)return n||Pn(e.apiKey,b=>zn(b)),t;let u=St.get(e.apiKey);if(u)try{u()}catch(b){}let o=Vn({sectionTypes:e.sectionTypes}),p=(m=e.ingestUrl)!=null?m:Mr,a=Bn({syncUrl:p.replace(/\/events\/?$/,"/graph/sync"),apiKey:e.apiKey,projectId:e.apiKey,sessionId:Lr(e.apiKey)});o.scan().then(b=>{for(let w of b.nodes)a.addPageNode({id:w.componentId,componentId:w.componentId,semanticType:w.semanticType,answers:e.captureDomText&&w.headingText?[w.headingText]:[],prominenceScore:w.prominenceScore,depth:w.depth});for(let w of b.edges)a.addStructuralEdge(w);a.syncOnce()});let c=null,d=()=>{c!==null&&clearTimeout(c),c=setTimeout(()=>{c=null,a.syncOnce()},500)};o.observe(b=>{for(let w of b.nodes)a.addPageNode({id:w.componentId,componentId:w.componentId,semanticType:w.semanticType,answers:e.captureDomText&&w.headingText?[w.headingText]:[],prominenceScore:w.prominenceScore,depth:w.depth});for(let w of b.edges)a.addStructuralEdge(w);d()});let S=()=>{c!==null&&(clearTimeout(c),c=null),o.destroy(),a.destroy(),St.get(e.apiKey)===S&&St.delete(e.apiKey)};return St.set(e.apiKey,S),ne(k({},t),{getGraph:()=>a.snapshot(),dispose:()=>{S(),t.dispose()},destroy:()=>{S(),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});
|
|
1
|
+
"use strict";var Yn=Object.create;var Ke=Object.defineProperty,Jn=Object.defineProperties,Zn=Object.getOwnPropertyDescriptor,eo=Object.getOwnPropertyDescriptors,to=Object.getOwnPropertyNames,tn=Object.getOwnPropertySymbols,no=Object.getPrototypeOf,on=Object.prototype.hasOwnProperty,oo=Object.prototype.propertyIsEnumerable;var nn=(e,t,n)=>t in e?Ke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,k=(e,t)=>{for(var n in t||(t={}))on.call(t,n)&&nn(e,n,t[n]);if(tn)for(var n of tn(t))oo.call(t,n)&&nn(e,n,t[n]);return e},ne=(e,t)=>Jn(e,eo(t));var ro=(e,t)=>{for(var n in t)Ke(e,n,{get:t[n],enumerable:!0})},rn=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of to(t))!on.call(e,i)&&i!==n&&Ke(e,i,{get:()=>t[i],enumerable:!(r=Zn(t,i))||r.enumerable});return e};var sn=(e,t,n)=>(n=e!=null?Yn(no(e)):{},rn(t||!e||!e.__esModule?Ke(n,"default",{value:e,enumerable:!0}):n,e)),so=e=>rn(Ke({},"__esModule",{value:!0}),e);var Br={};ro(Br,{BLOCK_ALIGNS:()=>Ao,BLOCK_EMPHASES:()=>Do,BLOCK_FITS:()=>Lo,BLOCK_GAPS:()=>To,BLOCK_GRID_COLUMNS:()=>Bo,BLOCK_HEADING_LEVELS:()=>Go,BLOCK_JUSTIFIES:()=>_o,BLOCK_MAX_WIDTHS:()=>Uo,BLOCK_PADS:()=>$o,BLOCK_RATIOS:()=>Mo,BLOCK_SIZES:()=>Ro,BLOCK_SURFACES:()=>Ko,BLOCK_TEXT_ALIGNS:()=>No,BLOCK_TONES:()=>Po,BLOCK_WEIGHTS:()=>Oo,FORM_FIELD_KINDS:()=>Fo,FORM_INPUT_TYPES:()=>jo,LEGACY_SESSION_COOKIE_NAME:()=>ge,MAX_BLOCK_ARMS:()=>Xo,MAX_BLOCK_CHILDREN:()=>qo,MAX_BLOCK_DEPTH:()=>zo,MAX_BLOCK_NODES:()=>Vo,MAX_BLOCK_TEXT_LEN:()=>Qo,MAX_FORM_FIELDS:()=>Wo,MAX_FORM_SELECT_OPTIONS:()=>Ho,SNAPSHOT_STORAGE_KEY_PREFIX:()=>me,STAGE_ATTRIBUTE:()=>dt,armOfResult:()=>ct,attachMicroSignalDetectors:()=>Cn,baselineResultFor:()=>Me,baselineSlots:()=>vn,containsFormBlock:()=>In,deriveSessionSegment:()=>Ct,detectDeviceClass:()=>Re,detectTimeOfDay:()=>De,detectTrafficSource:()=>Oe,exposedStage:()=>ut,grantConsent:()=>Mn,init:()=>zn,isDoNotTrackEnabled:()=>He,locatorFromElement:()=>yt,readSnapshot:()=>Ie,referrerDomainFromReferer:()=>Pe,renderPrePaintScript:()=>ln,sanitizePageUrl:()=>Dt,sessionCookieName:()=>ve,setStageAttribute:()=>pt,toWireSlot:()=>je,writeSnapshot:()=>Ce});module.exports=so(Br);function pe(e){if(typeof AbortController!="function")return{clear:()=>{}};let t=new AbortController,n=setTimeout(()=>t.abort(),e);return{signal:t.signal,clear:()=>clearTimeout(n)}}function Qe(e,t){return new Promise(n=>{let r=setTimeout(()=>n(!1),t),i=()=>{clearTimeout(r),n(!0)};e.then(i,i)})}var io;function an(e){io=typeof e=="string"&&e!==""?e:void 0}function ae(e){return e?`_${e.slice(0,12)}`:""}var ge="_snt_uid";function ve(e){return`${ge}${ae(e)}`}var Ye="__sntForgetGen",ao=()=>{try{return window[Ye]}catch(e){return}};function Je(e){var t,n;try{let r=window,i=(t=r[Ye])!=null?t:r[Ye]={};i[e]=((n=i[e])!=null?n:0)+1}catch(r){}}function fe(e){var t,n;return(n=(t=ao())==null?void 0:t[e])!=null?n:0}var me="_snt_snap:";var lo=["low","medium","high"];function Ie(e){try{let t=localStorage.getItem(me+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"||!lo.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 r=n.vocabulary;return r!==void 0&&(typeof r!="object"||r===null||!Array.isArray(r.entries)||!Array.isArray(r.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(me+e,JSON.stringify(t))}catch(n){}}function ln(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(me+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 ye(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 Ze(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let r=JSON.parse(n);return Array.isArray(r)?(localStorage.removeItem(e),r.slice(-t)):[]}catch(n){return[]}}function $e(e,t,n){try{let r=(()=>{try{let s=localStorage.getItem(n);if(!s)return[];let u=JSON.parse(s);return Array.isArray(u)?u:[]}catch(s){return[]}})(),i=new Map;for(let s of r)i.set(s.id,s);for(let s of e)i.set(s.id,s);localStorage.setItem(n,JSON.stringify([...i.values()].slice(-t)))}catch(r){}}function et(e,t){try{let n=localStorage.getItem(t);if(!n)return;let r=JSON.parse(n);if(!Array.isArray(r))return;let i=new Set(e),s=r.filter(u=>!i.has(u.id));if(s.length===r.length)return;s.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(s))}catch(n){}}var co=500,uo=56*1024;function Ue(e){return`_snt_retry_${e.slice(0,12)}`}var po={push:()=>{},flush:()=>{},destroy:()=>{}};function cn(e){var F,X,H;if(typeof window=="undefined")return po;let t=(F=e.flushIntervalMs)!=null?F:5e3,n=(X=e.maxBatchSize)!=null?X:20,r=(H=e.maxRetrySize)!=null?H:100,i=e.ingestUrl,s=e.apiKey,u=Ue(s),o=!1,p=fe(s),a=(...C)=>{!o&&fe(s)===p&&$e(...C)},c=[],d=new Set,S=[],m=C=>{for(let B of C)b.delete(B),!d.has(B)&&(d.add(B),S.push(B));for(;S.length>co;){let B=S.shift();B&&d.delete(B)}et(C,u)},b=new Set,E=()=>{for(;c.length>r;){let C=c.shift();C&&b.delete(C.id)}},N=C=>{d.has(C.id)||b.has(C.id)||(b.add(C.id),c.push(C),E())},A=C=>{for(let B of C)d.has(B.id)||(b.add(B.id),c.push(B));E()},D=Ze(u,r);for(let C of D)N(C);let L=0,K=0,Q=(C,B=!0)=>{if(C.length===0)return;let le=JSON.stringify(C),Se=C.map(he=>he.id),oe,xe=pe(15e3);try{oe=fetch(i,{method:"POST",keepalive:!0,signal:xe.signal,body:le,headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`}})}catch(he){a(C,r,u),A(C),K++,L=Date.now()+ye(K);return}Promise.resolve(oe).then(xe.clear,xe.clear);let Le=he=>{if(Te(he)!=="retry"){if(!he.ok&&B){let Ee=C.filter(se=>se.eventType!=="pageview");if(Ee.length>0&&Ee.length<C.length){m(C.filter(se=>se.eventType==="pageview").map(se=>se.id)),Q(Ee,!1);return}}m(Se),K=0,L=0;return}a(C,r,u),A(C),K++,L=Date.now()+ye(K)};oe&&typeof oe.then=="function"?oe.then(Le).catch(()=>{a(C,r,u),A(C),K++,L=Date.now()+ye(K)}):Le(oe)},te=typeof TextEncoder!="undefined"?new TextEncoder:null,f=C=>te?te.encode(C).length:C.length,y=C=>{let B=[],le=2;for(let Se of C){let oe=f(JSON.stringify(Se))+1;if(B.length>0&&le+oe>uo||B.length>=n)break;B.push(Se),le+=oe}return B},R=()=>{try{if(Date.now()<L)return;for(;c.length>0&&!(Date.now()<L);){let C=c.filter(le=>!d.has(le.id));if(c.length=0,C.length===0)break;let B=y(C);if(B.length===0)break;B.length<C.length&&c.push(...C.slice(B.length)),Q(B)}}catch(C){}},h=!0,I=null;I=setInterval(()=>{h&&R()},t);let $=()=>{document.visibilityState==="hidden"&&R()},V=()=>{R()};return document.addEventListener("visibilitychange",$),window.addEventListener("pagehide",V),{push(C){N(C),c.length>=n&&R()},flush:R,destroy(C){C!=null&&C.forget&&(o=!0),h=!1,I!==null&&(clearInterval(I),I=null),document.removeEventListener("visibilitychange",$),window.removeEventListener("pagehide",V),R()}}}var go=200;function Fe(e){return`_snt_goal_retry_${e.slice(0,12)}`}var fo={send:()=>{},flush:()=>{},destroy:()=>{}};function dn(e){var f,y,R;if(typeof window=="undefined")return fo;let t=(f=e.flushIntervalMs)!=null?f:5e3,n=(y=e.maxRetrySize)!=null?y:100,r=(R=e.maxPerFlush)!=null?R:5,i=Fe(e.apiKey),s=!1,u=fe(e.apiKey),o=(...h)=>{!s&&fe(e.apiKey)===u&&$e(...h)},p=[],a=new Set,c=new Set,d=[],S=0,m=0,b=!1,E=h=>{for(a.delete(h.id),c.has(h.id)||(c.add(h.id),d.push(h.id));d.length>go;){let I=d.shift();I&&c.delete(I)}et([h.id],i)},N=h=>{o([h],n,i),!c.has(h.id)&&!a.has(h.id)&&(a.add(h.id),p.push(h)),Date.now()>=S&&(m++,S=Date.now()+ye(m))},A=h=>{let I,$=pe(15e3);try{I=fetch(e.url,{method:"POST",keepalive:!0,signal:$.signal,body:h.body,headers:e.headers})}catch(F){N(h);return}let V=F=>{var H;let X=Te(F);if(X==="retry"){N(h);return}X==="dropped"&&((H=e.onDrop)==null||H.call(e,h,F.status)),E(h),m=0,S=0};Promise.resolve(I).then($.clear,$.clear),I&&typeof I.then=="function"?I.then(V).catch(()=>N(h)):V(I)},D=()=>{try{if(b||Date.now()<S)return;let h=0;for(;p.length>0&&h<r&&!(Date.now()<S);){let I=p.shift();a.delete(I.id),!c.has(I.id)&&(h++,A(I))}}catch(h){}},L=Ze(i,n);for(let h of L)a.has(h.id)||(a.add(h.id),p.push(h));L.length>0&&$e(L,n,i);let K=setInterval(D,t),Q=()=>{document.visibilityState==="hidden"&&D()},te=()=>D();return document.addEventListener("visibilitychange",Q),window.addEventListener("pagehide",te),{send(h){if(b){c.has(h.id)||o([h],n,i);return}if(!(c.has(h.id)||a.has(h.id))){if(Date.now()<S){o([h],n,i),a.add(h.id),p.push(h);return}A(h)}},flush:D,destroy(h){h!=null&&h.forget&&(s=!0),clearInterval(K),document.removeEventListener("visibilitychange",Q),window.removeEventListener("pagehide",te),D(),b=!0}}}function tt(e){let t=(e||"").toLowerCase();if(!t.includes(".")||/^[\d.]+$|:/.test(t))return[];let n=t.split("."),r=[];for(let i=n.length-2;i>=0;i--)r.push(n.slice(i).join("."));return r}function un(e){if(typeof window=="undefined"||!e)return!1;Je(e);let t=!1,n=ve(e);try{if(new RegExp(`(?:^|; )${n}=`).test(document.cookie)){let u=location.protocol==="https:"?"; Secure":"";for(let o of["",...tt(location.hostname)])document.cookie=`${n}=; max-age=0; SameSite=lax; path=/${o?`; domain=${o}`:""}${u}`;t=!0}}catch(u){}let r=ae(e),i=[n,"_snt_graph_edges",me+e,Ue(e),Fe(e),`_snt_graph_nodes${r}`],s=[`_snt_asgn${r}_`];for(let u of["localStorage","sessionStorage"])try{let o=window[u];for(let p of i)o.getItem(p)!==null&&(o.removeItem(p),t=!0);for(let p=o.length-1;p>=0;p--){let a=o.key(p);a&&s.some(c=>a.startsWith(c))&&(o.removeItem(a),t=!0)}}catch(o){}try{(new RegExp(`(?:^|; )${ge}=[^;]`).test(document.cookie)||localStorage.getItem(ge)!==null||sessionStorage.getItem(ge)!==null)&&localStorage.setItem(`${ge}_tomb${r}`,"1")}catch(u){}return t}function nt(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch(e){}try{if(typeof crypto!="undefined"&&typeof crypto.getRandomValues=="function"){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,"0"),(n===3||n===5||n===7||n===9)&&(t+="-");return t}}catch(e){}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var pn="_snt_uid",mo=365,Ae="_snt_uid";function yo(){return nt()}function _e(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function fn(){try{return location.protocol==="https:"?"; Secure":""}catch(e){return""}}function st(e,t,n,r){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=lax; path=/${r?`; domain=${r}`:""}${fn()}`}catch(i){}}function ot(e){try{return localStorage.getItem(e)}catch(t){return null}}function gn(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function xt(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function So(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function ho(e){try{sessionStorage.removeItem(e)}catch(t){}}function bo(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=lax; path=/${fn()}`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function vo(e){try{localStorage.removeItem(e)}catch(t){}}function rt(e,t){st(e,"",0,t)}var Eo={getSessionId:()=>null,isEphemeral:()=>!1,domain:null,destroy:()=>{}};function wo(e,t){if(e===!1)return null;if(typeof e=="string")return e.replace(/^\./,"");for(let n of tt(location.hostname))if(st(t,"1",10,n),_e(t)==="1")return rt(t,n),n;return null}function it(e){var A,D,L,K,Q,te,f;if(typeof window=="undefined")return Eo;let t=ae(e==null?void 0:e.apiKey),n=(A=e==null?void 0:e.cookieName)!=null?A:ve(e==null?void 0:e.apiKey),r=`${Ae}${t}`,i=`${Ae}_tomb${t}`,u=((D=e==null?void 0:e.cookieTTLDays)!=null?D:mo)*24*60*60,o=y=>y&&y.length>0?y:null,p=()=>{var y,R;return t&&!(e!=null&&e.cookieName)&&ot(i)===null?(R=(y=o(_e(pn)))!=null?y:o(ot(Ae)))!=null?R:o(xt(Ae)):null},a=wo(e==null?void 0:e.cookieDomain,`${n}_dom`),c=o(_e(n)),d=a?(rt(n),o(_e(n))):null,S=(f=(te=(Q=(K=(L=d!=null?d:c)!=null?L:o(ot(r)))!=null?K:o(xt(r)))!=null?Q:p())!=null?te:o(e==null?void 0:e.ssrSessionId))!=null?f:yo();st(n,S,u,a),a&&_e(n)!==S&&(a=null,st(n,S,u));let m=gn(r,S),b=bo(n),E=m?!1:So(r,S),N=!m&&!b&&!E;return{getSessionId:()=>S,isEphemeral:()=>N,domain:a,destroy:()=>{S=null,rt(n),rt(n,a),vo(r),ho(r),t&&!(e!=null&&e.cookieName)&&(_e(pn)!==null||ot(Ae)!==null||xt(Ae)!==null)&&gn(i,"1")}}}var xo=1800*1e3;function at(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function mn(e=xo,t){let n=new Map,r=`_snt_asgn${ae(t)}_`,i=(a,c)=>`${r}${encodeURIComponent(a)}:${encodeURIComponent(c)}`,s=a=>{let c=a.slice(r.length),d=c.indexOf(":");if(d<0)return null;try{return{componentId:decodeURIComponent(c.slice(0,d)),segment:decodeURIComponent(c.slice(d+1))}}catch(S){return null}},u=()=>{try{let a=[];for(let c=0;c<localStorage.length;c++){let d=localStorage.key(c);d!=null&&d.startsWith(r)&&a.push(d)}return a}catch(a){return[]}},o=a=>a.assignedAt+(a.ttlMs&&a.ttlMs>0?a.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let a of u())try{let c=localStorage.getItem(a);if(!c)continue;let d=JSON.parse(c);if(o(d)){localStorage.removeItem(a);continue}let S=s(a);if(!S)continue;n.set(at(S.componentId,S.segment),d)}catch(c){}})(),{get(a,c){let d=n.get(at(a,c));return d?o(d)?(n.delete(at(a,c)),null):d:null},set(a,c,d){let S=at(a,c);n.set(S,d);try{localStorage.setItem(i(a,c),JSON.stringify(d))}catch(m){}},clear(){n.clear();for(let a of u())try{localStorage.removeItem(a)}catch(c){}}}}var yn=["GPTBot","ChatGPT-User","OAI-SearchBot","ClaudeBot","Claude-User","Claude-SearchBot","Claude-Agent","PerplexityBot","Perplexity-User","Google-Agent","Google-Extended","Applebot-Extended","Meta-ExternalAgent","Bytespider","CCBot","Amazonbot","cohere-ai","Diffbot"];function lt(e){return kt(e)!==null}function kt(e){var n;if(!e)return null;let t=e.toLowerCase();return(n=yn.find(r=>t.includes(r.toLowerCase())))!=null?n:null}var Sn=["Googlebot","Bingbot","DuckDuckBot","YandexBot","Baiduspider","Applebot","Slurp","facebookexternalhit","LinkedInBot","Twitterbot"];function hn(e){var r;let t=kt(e);if(t)return t;if(!e)return null;let n=e.toLowerCase();return(r=Sn.find(i=>n.includes(i.toLowerCase())))!=null?r:null}function Re(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 Oe(e,t,n){if(!e)return"direct";try{let r=new URL(e);if(t)try{if(new URL(t).host===r.host)return"direct"}catch(s){}let i=r.hostname.toLowerCase();return n&&`.${i}`.endsWith(`.${n}`)?"direct":/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(i)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(i)?"social":"referral"}catch(r){return"direct"}}function Pe(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var bn=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function It(e){let t={},n={};try{let r=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([i,s])=>{let u=Array.isArray(s)?s[0]:s;return u===void 0?[]:[[i,u]]});for(let[i,s]of r)i.startsWith("utm_")?i in t||(t[i]=s):bn.includes(i)&&(i in n||(n[i]=s))}catch(r){}return{utmParams:t,clickIds:n}}function De(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function Ct(e){let t=ko("__segment__",e);return`${t.deviceClass}:${t.trafficSource}`}function ko(e,t){var u,o,p,a,c,d,S,m;let n=(o=(u=t==null?void 0:t.userAgent)==null?void 0:u.trim())!=null?o:"",r=(a=(p=t==null?void 0:t.referer)==null?void 0:p.trim())!=null?a:"",i=(c=t==null?void 0:t.now)!=null?c:new Date,s=hn(n);return k(k({sessionId:e,ephemeral:!1,utmParams:(d=t==null?void 0:t.utmParams)!=null?d:{},clickIds:(S=t==null?void 0:t.clickIds)!=null?S:{},deviceClass:n?Re(n):"desktop",trafficSource:r?Oe(r,t==null?void 0:t.appOrigin):"direct",referrerDomain:Pe(r),timeOfDay:De(i),dayOfWeek:(m=["sun","mon","tue","wed","thu","fri","sat"][i.getDay()])!=null?m:"sun",automation:(t==null?void 0:t.webdriver)===!0||lt(n)},s?{agentToken:s}:{}),t!=null&&t.landingPath?{landingPath:t.landingPath.split(/[?#]/)[0]}:{})}var Ne=require("@sentientui/policy");function je(e){return k(k(k({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 Me(e){let t=je(e);return(0,Ne.slotResultFor)(t,(0,Ne.slotBaselineArm)(t))}function vn(e){let t={};for(let n of e)t[n.id]=Me(n);return t}function ct(e){return typeof e=="string"?e:(0,Ne.canonicalArm)(e)}var En=require("@sentientui/policy"),dt="data-sentient-stage";function ut(e,t){return!t||typeof e!="string"||!(e==="returning"||En.STAGE_KEYS.includes(e))?null:t!=="detailed"&&(e==="customer"||e==="lapsed")?"returning":e}function pt(e,t=document){try{e?t.documentElement.setAttribute(dt,e):t.documentElement.removeAttribute(dt)}catch(n){}}var Rt=require("@sentientui/policy");var ft=require("@sentientui/policy");var wn="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY (Vite: VITE_SENTIENT_API_KEY) or localMode: true.",Io="[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.",xn=!1,gt=!1;function Co(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function kn(e){var a;let t=it({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),n=(a=t.getSessionId())!=null?a:"local",r=Co(),i=import("@sentientui/core/local").then(c=>{let d=c;return d.LOCAL_ENGINE_AVAILABLE?(xn||(xn=!0,console.info(Io)),d):(gt||(gt=!0,console.error(wn)),null)}).catch(()=>(gt||(gt=!0,console.error(wn)),null)),s=null,u={low:.15,medium:.5,high:.85},o=(()=>{var d;if(e.initialPersona)return k({},e.initialPersona);let c=Ie(e.apiKey||"local");return c?{persona:c.persona,confidence:(d=u[c.band])!=null?d:.15}:null})();function p(c){let d=document.documentElement;d.dataset.sentientPersona===void 0&&(d.dataset.sentientPersona=c.persona,d.dataset.sentientConfidence=(0,ft.confidenceBand)(c.confidence))}return{isLocal:!0,async decide(c){var m,b,E;let d=await i;if(!d)return null;let S=d.createLocalEngine({sessionId:n,forcedPersona:r}).decide(c);return s=ne(k({},S),{layoutOrder:(b=(m=S.layoutOrder)!=null?m:s==null?void 0:s.layoutOrder)!=null?b:null,slots:k(k({},(E=s==null?void 0:s.slots)!=null?E:{}),S.slots)}),Ce(e.apiKey||"local",{v:1,persona:s.persona,band:(0,ft.confidenceBand)(s.confidence),slots:s.slots,layoutOrder:s.layoutOrder,savedAt:Date.now()}),p(S),S},getSlotResult(c){var d,S,m;return(m=(S=s==null?void 0:s.slots[c])!=null?S:(d=e.initialSlots)==null?void 0:d[c])!=null?m:null},getSlotConfig(c){var d,S;return(S=(d=e.initialSlotConfig)==null?void 0:d[c])!=null?S:null},getSitePalette(){var c;return(c=e.initialPalette)!=null?c:null},reportSlots(){},getVisitorId:()=>null,getPersona(){let c=s!=null?s:o;return c?{persona:c.persona,confidence:c.confidence,band:(0,ft.confidenceBand)(c.confidence)}:null},async assign(c,d){var b;let S=await i;return!S||!d||d.length===0?d!=null&&d[0]?{variantId:d[0],assignmentTtlMs:0}:null:{variantId:(b=S.createLocalEngine({sessionId:n,forcedPersona:r}).decide({components:[{id:c,variantIds:d}]}).assignments[c])!=null?b:d[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>t.destroy()}}var To=["none","sm","md","lg"],Ao=["start","center","end","stretch"],_o=["start","center","end","between"],Ro=["sm","md","lg"],Oo=["normal","medium","bold"],Po=["default","muted","accent"],Do=["primary","secondary","ghost"],No=["left","center","right"],Mo=["auto","square","landscape","wide"],Lo=["cover","contain"],Bo=[2,3,4],Go=[1,2,3,4],Ko=["default","raised"],$o=["none","sm","md","lg"],Uo=["measure"],Fo=["input","textarea","select"],jo=["text","email","number","tel"],Wo=5,Ho=8,Vo=64,zo=5,qo=12,Xo=4,Qo=500;function In(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(In):!1}function Cn(e,t,n,r){let i=[];{let o=!1,p=[],a=()=>{if(o)return;let c=Date.now();for(p.push(c);p.length>0&&c-p[0]>500;)p.shift();p.length>=3&&(o=!0,e("rage_click"))};t.addEventListener("click",a),i.push(()=>t.removeEventListener("click",a))}{let s=!1,u=o=>{if(s||!(o.target instanceof Node)||!t.contains(o.target)&&t!==o.target)return;s=!0;let p=typeof window!="undefined"?window.getSelection():null,a=p?p.toString().length:0;e("text_copy",{selectionLength:a})};document.addEventListener("copy",u),i.push(()=>document.removeEventListener("copy",u))}{let s=!1,u=!1,o=null,p=()=>{o!==null&&(clearTimeout(o),o=null)},a=()=>{s||!u||(p(),o=setTimeout(()=>{!s&&u&&(s=!0,e("scroll_hesitation"))},3e3))},c=()=>{p(),a()},d=m=>{for(let b of m)u=b.intersectionRatio>.3,u?a():p()},S=new IntersectionObserver(d,{threshold:[.3]});S.observe(t),window.addEventListener("scroll",c,{passive:!0}),i.push(()=>{S.disconnect(),window.removeEventListener("scroll",c),p()})}if((r==null?void 0:r.tabLoss)!==!1){let s=!1,u=n!=null?n:Date.now(),o=()=>{if(s||document.visibilityState!=="hidden")return;let p=Date.now()-u;p<15e3&&(s=!0,e("tab_loss",{timeOnPage:p}))};document.addEventListener("visibilitychange",o),i.push(()=>document.removeEventListener("visibilitychange",o))}return()=>{for(let s of i)s()}}function Yo(){try{return process.env.NODE_ENV!=="production"}catch(e){return!0}}var Rn="https://api.sentient-ui.com/v1/events",An=()=>import("@sentientui/core/internal-traffic"),J=new Map,On=null;function Pn(e,t){let n=J.get(e);n&&n.upgrade&&(n.reinit=t)}function Jo(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var Zo=3;function At(){return nt()}function mt(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function er(){let e=new WeakMap,t=new Map,n=!1,r=(o,p,a)=>{let c=o.get(p);return a===null?c?!0:(o.set(p,new Set),!1):c?c.has(a)?!0:(c.add(a),!1):(o.set(p,new Set([a])),!1)},i=typeof window!="undefined"&&"event"in window,s=()=>{if(!i)return;let o=window.event;return typeof Event=="function"&&o instanceof Event?o:void 0},u=()=>{if(i){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 a=new MessageChannel;a.port1.onmessage=()=>{a.port1.close(),a.port2.close(),p()},a.port2.postMessage(0)}};return{firedBefore(o,p){let a=s();if(a){let d=e.get(a);return d||(d=new Map,e.set(a,d)),r(d,o,p)}let c=r(t,o,p);return!c&&!n&&(n=!0,u()),c}}}var Dn=new Set;function tr(e,t,n){let r=typeof window=="undefined"?null:window.history;if(!r)return()=>{};let i=!1,s,u=()=>{if(i)return;let a=mt();!a||a===s||(s=a,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${a}`))},o=[];for(let a of["pushState","replaceState"]){let c=r[a],d=function(...S){let m=c.apply(this,S);return u(),m};r[a]=d,o.push([a,c,d])}window.addEventListener("popstate",u);let p=mt();return p&&Dn.has(`${t}:${p}`)?s=p:u(),()=>{if(!i){i=!0,window.removeEventListener("popstate",u);for(let[a,c,d]of o)r[a]===d&&(r[a]=c)}}}var We={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getVisitorId:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}};function nr(){try{return It(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function Nn(e){return e.replace(/\/events\/?$/,"")}function He(){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 Mn(e){var p;if(typeof window=="undefined")return;let t=e!=null?e:On;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:r,upgrade:i,reinit:s}=n;if(!i){n.upgradeBlockedReason&&console.warn(n.upgradeBlockedReason);return}if(r.respectDoNotTrack!==!1&&He())return;let u=(s!=null?s:Pt)(ne(k({},r),{consent:!0}));i(u);let o=(p=J.get(t))==null?void 0:p.dispose;J.set(t,{config:ne(k({},r),{consent:!0}),upgrade:null,dispose:o})}function or(e,t){var te;let n=e.preConsentBehavior==="statistical_winner",r=Nn((te=e.ingestUrl)!=null?te:Rn),i={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},s=new Map,u=new Map,o={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(f,y,R){if(!n)return Promise.resolve(null);let h=s.get(f);return h?Promise.resolve(h):Ot(u,f,async()=>{try{let I=new URLSearchParams({componentId:f});for(let X of y!=null?y:[])I.append("variantIds[]",X);let $=pe(5e3),V;try{let X=await fetch(`${r}/winner?${I.toString()}`,{headers:i,signal:$.signal});if(!X.ok)return y!=null&&y[0]?{variantId:y[0],assignmentTtlMs:0}:null;V=await X.json()}finally{$.clear()}let F={variantId:V.variantId,assignmentTtlMs:0};return s.set(f,F),F}catch(I){return y!=null&&y[0]?{variantId:y[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getVisitorId:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}},p=!1,a=new Set,c=[],d=[],S=[],m=()=>{for(let[,,f]of S.splice(0))f(null);b.length=0},b=[],E=!1,N=()=>{if(p)return;E=!0;let f=J.get(e.apiKey);(f==null?void 0:f.upgrade)===Q&&J.set(e.apiKey,{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): client released before consent; call init() again"})},A=[],D=()=>{setTimeout(()=>{var f;try{(f=A.shift())==null||f(o)}catch(y){}A.length&&D()})},L=f=>{p?A.length?A.push(f):f(o):!t&&!E&&b.length<100?b.push(f):E&&e.debug&&console.warn("[sentient] goal dropped: client released")},K={get gated(){return!p&&!t},get released(){return E&&!p},takeHeld:()=>b.splice(0),track:f=>o.track(f),goal:((f,y,R,h)=>L(I=>I.goal(f,y,R,h))),componentGoal:(f,y,R)=>o.componentGoal(f,y,R),identify:(f,y)=>o.identify(f,y),getAssignment:(f,y)=>o.getAssignment(f,y),isUnified:f=>{var y,R;return(R=(y=o.isUnified)==null?void 0:y.call(o,f))!=null?R:!1},assign:(f,y,R,h,I)=>o.assign(f,y,R,h,I),decide:f=>p?o.decide(f):E||t?Promise.resolve(null):new Promise(y=>S.push([f,_n(),y])),getSlotResult:f=>o.getSlotResult(f),isSlotDecided:f=>{var y,R;return(R=(y=o.isSlotDecided)==null?void 0:y.call(o,f))!=null?R:!0},getSlotConfig:f=>o.getSlotConfig(f),getSitePalette:()=>o.getSitePalette(),getStyleVocabulary:()=>{var f,y;return(y=(f=o.getStyleVocabulary)==null?void 0:f.call(o))!=null?y:null},reportSlots:(f,y,R,h)=>o.reportSlots(f,y,R,h),reportSkeleton:(f,y)=>{var R;return(R=o.reportSkeleton)==null?void 0:R.call(o,f,y)},reportAgentData:(f,y,R)=>{var h;return(h=o.reportAgentData)==null?void 0:h.call(o,f,y,R)},reportDrift:(f,y,R,h)=>{var I;return(I=o.reportDrift)==null?void 0:I.call(o,f,y,R,h)},requestSlots:(f,y,R)=>{var h;return p?(h=o.requestSlots)==null?void 0:h.call(o,f,y,R):c.push([f,y,R])},decideSlots:f=>{var y;return p?(y=o.decideSlots)==null?void 0:y.call(o,f):d.push(...f)},cancelSlots:f=>{var R;if(p)return(R=o.cancelSlots)==null?void 0:R.call(o,f);let y=new Set(f);for(let h of c)h[0]=h[0].filter(I=>!y.has(I));d=d.filter(h=>!y.has(h.id))},onSlotsChanged:f=>(a.add(f),()=>{a.delete(f)}),getPersona:()=>o.getPersona(),getVisitorId:()=>{var f,y;return(y=(f=o.getVisitorId)==null?void 0:f.call(o))!=null?y:null},fetchWeights:()=>o.fetchWeights(),getGraph:()=>o.getGraph(),flush:()=>o.flush(),dispose:()=>(N(),m(),o.dispose()),destroy:()=>(N(),m(),p?o.destroy():un(e.apiKey))};function Q(f){var R,h,I;o=f,p=!0,b.length&&(A.push(...b.splice(0)),D());let y=_n();for(let[$,V,F]of S.splice(0))V!==y?F(null):f.decide($).then(F,()=>F(null));(R=f.onSlotsChanged)==null||R.call(f,()=>a.forEach($=>$()));for(let[$,V,F]of c.splice(0))$.length>0&&((h=f.requestSlots)==null||h.call(f,$,V,F));d.length>0&&((I=f.decideSlots)==null||I.call(f,d.splice(0)))}return{proxy:K,setInner:Q}}function _n(){return typeof location=="undefined"?"":location.pathname+(/^#!?\//.test(location.hash)?location.hash:"")}function Ot(e,t,n){let r=e.get(t);if(r)return r;let i=(async()=>{try{return await n()}finally{e.delete(t)}})();return e.set(t,i),i}function Pt(e){var Ft,jt,Wt,Ht,Vt,zt,qt,Xt,Qt,Yt,Jt;if(typeof window=="undefined")return We;e.nonce&&an(e.nonce),On=e.apiKey||"local";let t=J.get(e.apiKey||"local");if(t!=null&&t.dispose)try{t.dispose()}catch(l){}let n=e.respectDoNotTrack!==!1&&He(),r=e.consent===!1||n,i=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!i&&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."}),r?We:kn(e);if(r){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."}),We;let{proxy:l,setInner:g}=or(e,n);return J.set(e.apiKey,{config:e,upgrade:n?null:g}),l}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."),We;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),We;let s=(Ft=e.ingestUrl)!=null?Ft:Rn,u=Date.now(),o=it({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey,cookieDomain:e.cookieDomain}),p={},a;try{/sentient_internal=/.test(location.search+document.cookie)&&(a=An().then(async l=>{p.internalToken=await l.takeInternalToken(o.domain)||void 0}).catch(()=>{})),(typeof e.internal=="function"?e.internal():e.internal)===!0&&(p.internal=!0)}catch(l){}let c=mn(void 0,e.apiKey),d=!1,S=fe(e.apiKey),m=()=>!d&&fe(e.apiKey)===S,b=new Set((jt=e.initialUnified)!=null?jt:[]),E=ne(k({},c),{get:(l,g)=>b.has(l)?null:c.get(l,g),set:(...l)=>{m()&&c.set(...l)}}),N=cn({ingestUrl:s,apiKey:e.apiKey}),A=Nn(s),D={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},L=new Set,K=dn({url:`${A}/goals`,apiKey:e.apiKey,headers:D,onDrop:(l,g)=>{if(!e.debug){if(L.has(g))return;L.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."),l)}}),Q=Re((Wt=navigator.userAgent)!=null?Wt:""),te=window.location.origin,f=Oe((Ht=document.referrer)!=null?Ht:"",te,o.domain),y=(Vt=e.sessionSegment)!=null?Vt:`${Q}:${f}`,R=new Map,h=new Map,I=new Map,$=new Set,V=new Map,F=null,X=null,H=null,C=new Set,B=new Set,le=new Map,Se=new Map,oe=new Set,xe=new Set,Le=new Set,he=new Set,Ee=null,se=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,Bt=new Set,ze=new Set,qe=new Set,Be=new Map,ht=null,Xe=new Set,Ge=new Map,bt=null,qn=2,Gt=new Map,ie=!1,Kt=(l,g,v)=>{var w;let _=new Set,P=1;for(let x of l){g.delete(x);let T=((w=Gt.get(x))!=null?w:0)+1;Gt.set(x,T),T<=qn&&(_.add(x),T>P&&(P=T))}_.size>0&&setTimeout(()=>{ie||v(_)},ye(P))},vt=l=>{for(let g of l)I.has(g.id)||I.set(g.id,Me(g))};if(e.initialSlots)for(let[l,g]of Object.entries(e.initialSlots))I.set(l,g),$.add(l);if(e.initialSlotConfig)for(let[l,g]of Object.entries(e.initialSlotConfig))V.set(l,g);e.initialPalette&&(F=e.initialPalette),e.initialVocabulary&&(X=e.initialVocabulary);let ce=Ie(e.apiKey);if(ce){for(let[l,g]of Object.entries(ce.slots))I.has(l)||I.set(l,g);for(let[l,g]of Object.entries((zt=ce.slotConfig)!=null?zt:{}))V.has(l)||V.set(l,g);!F&&ce.palette&&(F=ce.palette),!X&&ce.vocabulary&&(X=ce.vocabulary)}let $t={low:.15,medium:.5,high:.85};if(e.initialPersona)H=k({},e.initialPersona);else{let l=document.documentElement.dataset;l.sentientPersona?H={persona:l.sentientPersona,confidence:(Xt=$t[(qt=l.sentientConfidence)!=null?qt:"low"])!=null?Xt:.15}:ce&&(H={persona:ce.persona,confidence:(Qt=$t[ce.band])!=null?Qt:.15})}if(e.initialAssignments)for(let[l,g]of Object.entries(e.initialAssignments))E.set(l,y,{variantId:g,assignedAt:Date.now(),segment:y,confidence:1});let be=Promise.resolve(),Ut=o.getSessionId();if(Ut){let l=Pe((Yt=document.referrer)!=null?Yt:""),{utmParams:g,clickIds:v}=nr(),_=k(k(k(k({sessionId:Ut,deviceClass:Q,trafficSource:f,referrerDomain:l,utmParams:g,clickIds:v,landingPath:typeof location!="undefined"?location.pathname:void 0,timeOfDay:De(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:o.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||lt((Jt=navigator.userAgent)!=null?Jt:"")},e.userId?{userId:e.userId,userHash:e.userHash}:{}),e.persona?{persona:e.persona}:{}),e.country?{country:e.country}:{}),e.sdk?{sdk:e.sdk.name,sdkVersion:e.sdk.version}:{}),P=async()=>{a&&await Qe(a,2500);for(let w=0;;w++){if(ie||!m())return;let x=pe(5e3);try{let T=await fetch(`${A}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(Object.assign(_,p)),headers:D,signal:x.signal});if(T.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(T.ok||Te(T)==="dropped")return}catch(T){}finally{x.clear()}if(w>=Zo){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(T=>setTimeout(T,ye(w+1)))}};try{be=P()}catch(w){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:N});let Xn=er(),we=null,Et=!1,q={goal(l,g={},v=1,_=0){var z,G,Z,re,ee,Y,O;let P=o.getSessionId();if(!P||ie||!m())return;let w=Jo(g)?g:{metadata:g},x=[l,(z=w.externalId)!=null?z:"",(G=w.stepIndex)!=null?G:_,(Z=w.weight)!=null?Z:v].join("\0"),T=w.value!==void 0?`${w.value}\0${(re=w.currency)!=null?re:""}`:null;if(Xn.firedBefore(x,T)){e.debug&&console.log(`[sentient] goal("${l}") already recorded for this action \u2014 not sent twice`);return}let U=At(),M={sessionId:P,name:l,metadata:(ee=w.metadata)!=null?ee:{},weight:(Y=w.weight)!=null?Y:v,stepIndex:(O=w.stepIndex)!=null?O:_,goalId:U,value:w.value,currency:w.currency,externalId:w.externalId};e.debug&&console.log("[sentient] goal",M);let j={id:U,body:JSON.stringify(M)};be.then(()=>K.send(j))},componentGoal(l,g,v){var U,M,j;let _=o.getSessionId();if(!_||ie||!m())return;let P=E.get(l,y),w=P?null:(U=I.get(l))!=null?U:null;if(!P&&w===null){e.debug&&console.warn(`[sentient] componentGoal("${l}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}if(!P&&!$.has(l)){e.debug&&console.warn(`[sentient] componentGoal("${l}"): slot not decided this session \u2014 not attributed`);return}let x=P?P.variantId:ct(w),T={id:At(),sessionId:_,projectId:e.apiKey,componentId:l,variantId:x,eventType:"goal_achieved",goalType:g,payload:k({reward:(M=v==null?void 0:v.reward)!=null?M:1,goalValue:v==null?void 0:v.value,currency:v==null?void 0:v.currency},(j=v==null?void 0:v.metadata)!=null?j:{}),timestamp:Date.now(),timeInSession:Date.now()-u,path:mt()};e.debug&&console.log("[sentient] componentGoal",T),be.then(()=>{!ie&&m()&&N.push(T)})},identify(l,g){let v=o.getSessionId();if(!v||ie||!m())return;let _=(g==null?void 0:g.email)!==void 0?An().then(P=>P.emailFields(g.email)).catch(()=>({})):{};Promise.all([be,_]).then(([,P])=>{fetch(`${A}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(ne(k(k({sessionId:v,userId:l,userHash:g==null?void 0:g.userHash},P),p),{ephemeral:o.isEphemeral()})),headers:D}).catch(()=>{})})},track(l){let g=o.getSessionId();if(!g||ie||!m()||l.eventType==="variant_assigned"&&I.get(l.componentId)!==void 0&&!$.has(l.componentId)&&!E.get(l.componentId,y))return;let v=ne(k({path:mt()},l),{id:At(),sessionId:g,timestamp:Date.now(),timeInSession:Date.now()-u});e.debug&&console.log("[sentient] track",v),be.then(()=>N.push(v))},getAssignment(l,g){return E.get(l,g)},isUnified:l=>b.has(l),async assign(l,g,v,_,P){var U;let w=o.getSessionId();if(!w)return null;let x=(P==null?void 0:P.unified)===!0;if(x&&b.has(l))return{variantId:(U=g==null?void 0:g[0])!=null?U:"",assignmentTtlMs:0,unified:!0};let T=E.get(l,y);if(T&&(g!=null&&g.length||T.content!==void 0)){let M=T.ttlMs&&T.ttlMs>0?Math.max(0,T.assignedAt+T.ttlMs-Date.now()):0;return{variantId:T.variantId,assignmentTtlMs:M,content:T.content}}return Ot(R,x?`${l}\0unified`:l,async()=>{if(!await Qe(be,2500)||ie||!m())return null;let M=pe(3e4);try{let j={sessionId:w,componentId:l,variantIds:g};_!==void 0?j.agentDataByVariant=_:v!==void 0&&(j.agentData=v),x&&(j.caps={unified:!0});let z=await fetch(`${A}/assign`,{method:"POST",body:JSON.stringify(j),headers:D,signal:M.signal});if(!z.ok)return null;let G=await z.json();return G.unified===!0?x?(b.add(l),{variantId:G.variantId,assignmentTtlMs:0,unified:!0}):null:(E.set(l,y,k({variantId:G.variantId,assignedAt:Date.now(),segment:y,confidence:1,content:G.content},G.assignmentTtlMs&&G.assignmentTtlMs>0?{ttlMs:G.assignmentTtlMs}:{})),G)}catch(j){return null}finally{M.clear()}})},async decide(l){var w,x;let g=o.getSessionId();if(!g)return null;let v=(w=l.slots)!=null?w:[],_={sessionId:g};l.sections&&l.sections.length>0&&(_.sections=l.sections.map(T=>({id:T}))),_.components=(x=l.components)!=null?x:[],v.length>0&&(_.slots=v.map(je)),l.slotsFrom==="registry"&&(_.slotsFrom="registry",l.registrySlotIds&&(_.registrySlotIds=l.registrySlotIds),l.bootstrap===!1&&(_.bootstrap=!1),l.render&&Object.keys(l.render).length>0&&(_.render=l.render)),l.v&&(_.v=l.v),typeof l.pp=="number"&&(_.pp=l.pp),e.persona&&(_.persona=e.persona),Object.assign(_,p);let P=JSON.stringify(_);return Ot(h,P,async()=>{var U,M,j,z,G,Z,re,ee;if(!await Qe(be,2500)||ie||!m())return vt(v),null;let T=pe(3e4);try{let Y=await fetch(`${A}/decide`,{method:"POST",body:P,headers:D,signal:T.signal});if(!Y.ok)return vt(v),null;let O=await Y.json(),de=ut(O.stage,e.stageAttributes);e.stageAttributes&&pt(de);let ke={};for(let W of v){let ue=(U=O.slots)==null?void 0:U[W.id];if(ue!==void 0){ke[W.id]=ue,I.set(W.id,ue),$.add(W.id);continue}let Zt=I.get(W.id);if(Zt!==void 0)ke[W.id]=Zt;else{let en=Me(W);ke[W.id]=en,I.set(W.id,en)}}if(O.slots)for(let[W,ue]of Object.entries(O.slots))W in ke||(ke[W]=ue,I.set(W,ue),$.add(W));let Qn=H!=null&&H.persona!=="unknown";O.persona&&!(O.persona==="unknown"&&Qn)?H={persona:O.persona,confidence:(M=O.confidence)!=null?M:0}:H||(H={persona:"unknown",confidence:0});for(let[W,ue]of Object.entries((j=O.assignments)!=null?j:{}))E.set(W,y,{variantId:ue,assignedAt:Date.now(),segment:y,confidence:1});if(O.slotConfig)for(let[W,ue]of Object.entries(O.slotConfig))V.set(W,ue);O.palette&&(F=O.palette),O.vocabulary&&(X=O.vocabulary);for(let W of(z=l.registrySlotIds)!=null?z:[])(G=O.slotConfig)!=null&&G[W]||(V.delete(W),I.delete(W),$.delete(W));return m()&&Ce(e.apiKey,k(k(k(k({v:1,persona:H.persona,band:(0,Rt.confidenceBand)(H.confidence),slots:Object.fromEntries(I),layoutOrder:(Z=O.layoutOrder)!=null?Z:null,savedAt:Date.now()},V.size>0?{slotConfig:Object.fromEntries(V)}:{}),F?{palette:F}:{}),X?{vocabulary:X}:{}),de?{stage:de}:{})),k(k(k(k(k(k(k({layoutOrder:(re=O.layoutOrder)!=null?re:null,assignments:(ee=O.assignments)!=null?ee:{},slots:ke,persona:H.persona,confidence:H.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}:{}),O.stage?{stage:O.stage}:{}),O.context?{context:O.context}:{})}catch(Y){return vt(v),null}finally{T.clear()}})},getSlotResult(l){var g;return(g=I.get(l))!=null?g:null},isSlotDecided(l){return $.has(l)},getSlotConfig(l){var g;return(g=V.get(l))!=null?g:null},reportSlots(l,g,v,_){var w;let P={};for(let[x,T]of Object.entries(_!=null?_:{}))for(let U of T){let M=`${x}|${U.key}`;!se.test(x)||Le.has(M)||(Le.add(M),((w=P[x])!=null?w:P[x]=[]).push(U))}Object.keys(P).length>0&&fetch(`${A}/slots/observed`,{method:"POST",headers:D,body:JSON.stringify({slotIds:Object.keys(P),authoredArms:P})}).catch(()=>{});for(let x of l)if(!(typeof x!="string"||x.length===0)){if(!se.test(x)){Yo()&&!Bt.has(x)&&(Bt.add(x),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(x)} will not register \u2014 ids must start with a letter or digit and contain only letters, digits, '_' or '-' (max 128 chars): /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.`));continue}if(!C.has(x)){C.add(x),B.add(x);let T=g==null?void 0:g[x];if(typeof T=="string"){let M=T.replace(/\s+/g," ").trim().slice(0,400);M!==""&&le.set(x,M)}let U=v==null?void 0:v[x];U!==void 0&&Se.set(x,U)}}B.size===0||Ee!=null||(Ee=setTimeout(()=>{Ee=null;let x=[...B];B.clear();for(let T=0;T<x.length;T+=20){let U=x.slice(T,T+20),M={},j={};for(let z of U){let G=le.get(z);G!==void 0&&(M[z]=G,le.delete(z));let Z=Se.get(z);Z!==void 0&&(j[z]=Z,Se.delete(z))}fetch(`${A}/slots/observed`,{method:"POST",headers:D,body:JSON.stringify(k(ne(k(k({slotIds:U},Object.keys(M).length>0?{baselineTexts:M}:{}),Object.keys(j).length>0?{baselineSkeletons:j}:{}),{pagePaths:Object.fromEntries(U.map(z=>[z,location.pathname]))}),Object.keys(M).length>0&&o.getSessionId()?{sessionId:o.getSessionId()}:{}))}).catch(()=>{})}},1e3))},reportSkeleton(l,g){!se.test(l)||oe.has(l)||(oe.add(l),fetch(`${A}/slots/observed`,{method:"POST",headers:D,body:JSON.stringify({slotIds:[l],baselineSkeletons:{[l]:g}})}).catch(()=>{}))},reportAgentData(l,g,v){let _=`${l}|${g}`;!se.test(l)||he.has(_)||(he.add(_),fetch(`${A}/slots/observed`,{method:"POST",headers:D,body:JSON.stringify(k(k({slotIds:[l],agentData:{[l]:{[g]:v}}},g.startsWith("authored.")?{authoredArms:{[l]:[{key:g.slice(9)}]}}:{}),o.getSessionId()?{sessionId:o.getSessionId()}:{}))}).catch(()=>{}))},reportDrift(l,g,v,_){let P=`${l}|${g}`,w=o.getSessionId();!w||xe.has(P)||(xe.add(P),fetch(`${A}/slots/drift`,{method:"POST",headers:D,body:JSON.stringify({sessionId:w,reports:[{slotId:l,expectedFp:g,observedFp:v,reason:_}]})}).catch(()=>{}))},requestSlots(l,g,v){var _,P;for(let w of l)qe.has(w)||(qe.add(w),se.test(w)?Be.set(w,{text:g==null?void 0:g[w],render:(_=v==null?void 0:v.render)==null?void 0:_[w],skeleton:(P=v==null?void 0:v.skeletons)==null?void 0:P[w]}):q.reportSlots([w]));Be.size===0||ht!=null||(ht=setTimeout(()=>{ht=null;let w=[...Be];Be.clear();for(let x=0;x<w.length;x+=50){let T=w.slice(x,x+50),U={};for(let[M,j]of T)j.render&&(U[M]=j.render);q.decide({slotsFrom:"registry",registrySlotIds:T.map(([M])=>M),bootstrap:!1,render:U}).then(M=>{var j,z;if(M){let G={},Z={},re=[];for(let[ee,Y]of T){let O=(j=M.slotConfig)==null?void 0:j[ee];if(O){O.needsSkeleton&&Y.skeleton&&((z=q.reportSkeleton)==null||z.call(q,ee,Y.skeleton));continue}re.push(ee),Y.text&&(G[ee]=Y.text),Y.skeleton&&(Z[ee]=Y.skeleton)}re.length>0&&q.reportSlots(re,G,Z)}else Kt(T.map(([G])=>G),qe,G=>{var Y;let Z={},re={},ee={};for(let[O,de]of T)G.has(O)&&(de.text&&(Z[O]=de.text),de.render&&(re[O]=de.render),de.skeleton&&(ee[O]=de.skeleton));(Y=q.requestSlots)==null||Y.call(q,[...G],Z,{render:re,skeletons:ee})});ze.forEach(G=>G())})}},0))},decideSlots(l){for(let g of l)Xe.has(g.id)||(Xe.add(g.id),Ge.set(g.id,g));Ge.size===0||bt!=null||(bt=setTimeout(()=>{bt=null;let g=[...Ge.values()];Ge.clear();for(let v=0;v<g.length;v+=30){let _=g.slice(v,v+30);q.decide({slots:_}).then(P=>{P||Kt(_.map(w=>w.id),Xe,w=>{var x;return(x=q.decideSlots)==null?void 0:x.call(q,_.filter(T=>w.has(T.id)))}),ze.forEach(w=>w())})}},0))},cancelSlots(l){for(let g of l)Be.delete(g)&&qe.delete(g),Ge.delete(g)&&Xe.delete(g)},onSlotsChanged(l){return ze.add(l),()=>{ze.delete(l)}},getStyleVocabulary(){return X},getSitePalette(){return F},getVisitorId:()=>m()?o.getSessionId():null,getPersona(){return H?{persona:H.persona,confidence:H.confidence,band:(0,Rt.confidenceBand)(H.confidence)}:null},async fetchWeights(){var g;let l=pe(5e3);try{let v=await fetch(`${A}/weights`,{headers:D,signal:l.signal});return v.ok?(g=(await v.json()).components)!=null?g:[]:[]}catch(v){return[]}finally{l.clear()}},getGraph(){return{pageNodes:[],capturedAt:0}},flush(){N.flush(),K.flush()},dispose(){var l;we==null||we(),Et=!0,ie=!0,N.destroy(),K.destroy(),((l=J.get(e.apiKey))==null?void 0:l.dispose)===q.dispose&&J.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var l;we==null||we(),Et=!0,ie=!0,d=!0,Je(e.apiKey),N.destroy({forget:!0}),K.destroy({forget:!0}),o.destroy(),E.clear(),((l=J.get(e.apiKey))==null?void 0:l.dispose)===q.dispose&&J.delete(e.apiKey);try{localStorage.removeItem(me+e.apiKey),localStorage.removeItem(Ue(e.apiKey)),localStorage.removeItem(Fe(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:q.dispose}),we=tr(q,e.apiKey,l=>{be.then(()=>{Et||Dn.add(l)})}),e.debug){let l=window;l.__sentient&&(l.__sentient.client=q)}return q}var Ln="_snt_graph_edges",rr={pricing:["features","faq"],features:["pricing"],faq:["pricing"],social_proof:["cta"],cta:["social_proof","hero","trust"],hero:["cta"],comparison:["pricing"],trust:["cta"]};function sr(e){var t;return(t=rr[e])!=null?t:[]}function ir(e,t){try{let n=localStorage.getItem(e);return n?JSON.parse(n):t}catch(n){return t}}function ar(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(n){}}var lr=new Set(["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"]);function cr(e){return lr.has(e)?e:"generic"}function Dt(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch(t){return"/"}}function dr(e,t,n){let r=`${e}:${t}:${n.join(",")}`,i=5381;for(let s=0;s<r.length;s++)i=(i<<5)+i+r.charCodeAt(s)&4294967295;return(i>>>0).toString(16).padStart(8,"0")}function Bn(e){let t=new Map,n=new Map,r=`_snt_graph_nodes${ae(e==null?void 0:e.apiKey)}`,i=()=>{typeof window!="undefined"&&ar(r,[...t.values()])};if(typeof window!="undefined"){let s=ir(r,[]);for(let u of s)t.set(u.componentId,u);try{localStorage.removeItem(Ln)}catch(u){}}return{addPageNode(s){t.set(s.componentId,s),i()},addStructuralEdge(s){let u=`${s.fromComponentId}->${s.toComponentId}`;n.set(u,s)},syncOnce(){var u,o;if(!(e!=null&&e.syncUrl)||typeof window=="undefined")return;let s=[...t.values()];if(s.length!==0)try{let p=new Map;for(let m of s){let b=(u=p.get(m.semanticType))!=null?u:[];b.push(m),p.set(m.semanticType,b)}let a=[],c=new Set;for(let m of s)for(let b of sr(m.semanticType)){let E=(o=p.get(b))!=null?o:[];for(let N of E){if(N.componentId===m.componentId)continue;let A=`semantic:${m.componentId}->${N.componentId}`;c.has(A)||(c.add(A),a.push({fromComponentId:m.componentId,toComponentId:N.componentId,type:"semantic",weight:.4,confidence:.9}))}}let d=new Set(s.map(m=>m.componentId));for(let m of n.values()){if(!d.has(m.fromComponentId)||!d.has(m.toComponentId))continue;let b=`structural:${m.fromComponentId}->${m.toComponentId}`;c.has(b)||(c.add(b),a.push({fromComponentId:m.fromComponentId,toComponentId:m.toComponentId,type:"structural",weight:m.weight,confidence:1}))}let S=ne(k(k({pageUrl:Dt(window.location.href)},e.sessionId?{sessionId:e.sessionId}:{}),e.projectId?{projectId:e.projectId}:{}),{nodes:s.map(m=>{let b=cr(m.semanticType);return{componentId:m.componentId,semanticType:b,answers:m.answers,contentHash:dr(m.componentId,b,m.answers),prominenceScore:m.prominenceScore,depthInPage:m.depth}}),edges:a});fetch(e.syncUrl,{method:"POST",keepalive:!0,headers:k({"Content-Type":"application/json"},e.apiKey?{Authorization:`Bearer ${e.apiKey}`}:{}),body:JSON.stringify(S)}).catch(()=>{})}catch(p){}},snapshot(){return{pageNodes:[...t.values()],capturedAt:Date.now()}},destroy(){if(typeof window!="undefined")try{localStorage.removeItem(r),localStorage.removeItem(Ln)}catch(s){}}}}var ur=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function Nt(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function pr(e){return{tag:e.tagName.toLowerCase(),text:Nt(e).slice(0,40)}}function Gn(e){return e.replace(/["\\\]]/g,"\\$&")}function Ve(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function Kn(e,t){var u;let n=e.tagName.toLowerCase();if(!n)return null;let r=((u=e.getAttribute("class"))!=null?u:"").split(/\s+/).filter(o=>/^[a-zA-Z][\w-]*$/.test(o)),i=[n,...r.map(o=>`${n}.${o}`)];for(let o of i)if(Ve(t,o))return o;let s=e.parentElement;if(s&&s!==t){let o=Kn(s,t);if(o){for(let d of i){let S=`${o} > ${d}`;if(Ve(t,S))return S}let p=Array.from(s.children).filter(d=>d.tagName.toLowerCase()===n),a=p.indexOf(e),c=p.some(d=>d!==e&&Nt(d)!==Nt(e));if(a>=0&&c){let d=`${o} > ${n}:nth-of-type(${a+1})`;if(Ve(t,d))return d}}}return null}function yt(e,t){let n=pr(e),r=e.getAttribute("id");if(r&&Ve(t,`#${Gn(r)}`))return{v:1,id:r,fingerprint:n};for(let s of ur){let u=e.getAttribute(s);if(u&&Ve(t,`[${s}="${Gn(u)}"]`))return{v:1,dataAttr:{name:s,value:u},fingerprint:n}}let i=Kn(e,t);return i?{v:1,selector:i,fingerprint:n}:null}var Un=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],gr={banner:"hero",navigation:"navigation",contentinfo:"footer"};function fr(e){let t=e.ariaRole?gr[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 mr(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var yr=[["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]],Sr=[["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 hr(e){var n;let t=e.querySelector("h1, h2, h3");return((n=t==null?void 0:t.textContent)!=null?n:"").slice(0,160)}function br(e){var i,s;let t=fr(e);if(t)return{type:(i=$n[t])!=null?i:"generic",strength:"strong"};let n=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[u,o]of yr)if(o.test(n))return{type:u,strength:"strong"};for(let[u,o]of Sr)if(o.test(e.bodyText))return{type:u,strength:"strong"};let r=mr(e);return{type:(s=$n[r])!=null?s:"generic",strength:"weak"}}function vr(e){var r,i;let t=((r=e.textContent)!=null?r:"").replace(/\s+/g," ").trim(),n=e.getAttribute("role");return k({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((i=e.className)!=null?i:"")}`,headingText:hr(e),bodyText:t.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:t.length},n?{ariaRole:n}:{})}function Fn(e){return br(vr(e)).type}var Er=new Set(["SECTION","ARTICLE","MAIN","DIV","ASIDE"]),wr=200,xr="h1, h2, h3",kr="[data-sentient-id], section[aria-label], article[aria-label], main[aria-label], aside[aria-label]",jn=30,Ir=1500,Cr={scan:async()=>({nodes:[],edges:[],scannedAt:0}),observe:()=>{},getProminenceScore:()=>0,destroy:()=>{}};function Wn(e,t,n){return n<=t?0:Math.max(0,Math.min(1,(e-t)/(n-t)))}function Tr(e){var t,n,r;try{let i=e;for(let s of Object.keys(i)){if(!s.startsWith("__reactFiber")&&!s.startsWith("__reactInternalInstance"))continue;let u=i[s],o=(r=(t=u==null?void 0:u.type)==null?void 0:t.displayName)!=null?r:(n=u==null?void 0:u.type)==null?void 0:n.name;if(o&&o.length>1)return o}}catch(i){}}function Ar(e){let t={};for(let n of Array.from(e.attributes))n.name.startsWith("data-")&&(t[n.name]=n.value);return t}var Mt=new Set(Un);function _r(e,t){let n=e.getAttribute("data-sentient-id"),r=n?t==null?void 0:t[n]:void 0;if(r&&Mt.has(r))return r;let i=e.getAttribute("data-sentient-type");if(i&&Mt.has(i))return i;let s=e.getAttribute("role");return s&&Mt.has(s)?s:Fn(e)}function Rr(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 Or(e){let t=[],n=e;for(;n;){let r=n.parentElement;if(!r){t.push(n.tagName.toLowerCase());break}let i=Array.prototype.indexOf.call(r.children,n);t.push(`${n.tagName.toLowerCase()}[${i}]`),n=r}return t.reverse().join("/")}function Pr(e){var n;let t=(n=e.getAttribute("data-sentient-id"))!=null?n:e.getAttribute("id");return t||`${e.tagName.toLowerCase()}-${Rr(Or(e))}`}function Dr(e){let t=0,n=e.parentElement;for(;n;)t++,n=n.parentElement;return t}function Lt(e,t,n){var i,s,u,o;let r=e.querySelector(xr);return{componentId:Pr(e),semanticType:_r(e,n),ariaLabel:(i=e.getAttribute("aria-label"))!=null?i:void 0,headingText:(u=(s=r==null?void 0:r.textContent)==null?void 0:s.trim())!=null?u:void 0,isAboveFold:e.getBoundingClientRect().top<window.innerHeight,prominenceScore:t(e),depth:Dr(e),reactComponentName:Tr(e),dataAttributes:Ar(e),locator:(o=yt(e,e.ownerDocument))!=null?o:void 0}}function Hn(e){var s;let t=[],n=new Set,r="__root__",i=new Map;for(let[u,o]of e){let p=u.parentElement,a=r;for(;p;){if(e.has(p)){a=e.get(p);let d=e.get(u),S=`${a}->${d}`;!n.has(S)&&a!==d&&(n.add(S),t.push({fromComponentId:a,toComponentId:d,weight:.6}));break}p=p.parentElement}let c=(s=i.get(a))!=null?s:[];c.push(u),i.set(a,c)}for(let u of i.values()){if(u.length<2)continue;let o=u.length>jn?u.slice(0,jn):u;for(let p=0;p<o.length;p++)for(let a=p+1;a<o.length;a++){if(t.length>=Ir)return t;let c=e.get(o[p]),d=e.get(o[a]);if(c===d)continue;let S=`${c}->${d}::sib`,m=`${d}->${c}::sib`;n.has(S)||(n.add(S),t.push({fromComponentId:c,toComponentId:d,weight:.3})),n.has(m)||(n.add(m),t.push({fromComponentId:d,toComponentId:c,weight:.3}))}}return t}function Nr(e,t){let n=[],r=new Set,i=new Map;return document.querySelectorAll("[data-sentient-id]").forEach(o=>{if(o instanceof Element&&!r.has(o)){r.add(o);let p=Lt(o,e,t);n.push(p),i.set(o,p.componentId)}}),document.querySelectorAll("section, article, main, aside").forEach(o=>{if(!(o instanceof Element)||r.has(o))return;let p=o.hasAttribute("aria-label"),a=o.hasAttribute("data-sentient-id");if(!p&&!a)return;r.add(o);let c=Lt(o,e,t);n.push(c),i.set(o,c.componentId)}),{nodes:n,edges:Hn(i),elementToId:i}}function Vn(e={}){let{sectionTypes:t}=e;if(typeof window=="undefined")return Cr;let n=null,r=0,i=null,s=new Map,u=m=>{try{let b=window.getComputedStyle(m),E=parseFloat(b.fontSize)||12,N=parseFloat(b.zIndex)||0,A=m.getBoundingClientRect(),D=Math.max(A.top,0),L=window.innerHeight||1,K=1/(D/L+1),Q=Wn(E,12,48)*.4+K*.4+Wn(N,0,100)*.2;return Math.max(0,Math.min(1,Q))}catch(b){return .5}},o=()=>new Promise(m=>{let b=()=>{let{nodes:E,edges:N,elementToId:A}=Nr(u,t);s.clear();for(let[D,L]of A)s.set(D,L);m({nodes:E,edges:N,scannedAt:Date.now()})};try{typeof requestIdleCallback=="function"?r=requestIdleCallback(b,{timeout:100}):b()}catch(E){b()}}),p=new Set,a=null,c=()=>{a=null;let m=[...p];p.clear();let b=[],E=new Set;for(let A of m){if(!A.isConnected)continue;let D=[];Er.has(A.tagName)&&(A.hasAttribute("data-sentient-id")||A.hasAttribute("aria-label"))&&D.push(A);try{A.querySelectorAll(kr).forEach(L=>D.push(L))}catch(L){}for(let L of D){if(s.has(L))continue;let K=Lt(L,u,t);b.push(K),E.add(K.componentId),s.set(L,K.componentId)}}if(b.length===0||!i)return;for(let A of[...s.keys()])A.isConnected||s.delete(A);let N=Hn(s).filter(A=>E.has(A.fromComponentId)||E.has(A.toComponentId));i({nodes:b,edges:N,addedAt:Date.now()})};return{scan:o,observe:m=>{i=m;try{n=new MutationObserver(b=>{for(let E of b)E.type==="childList"&&E.addedNodes.forEach(N=>{N instanceof Element&&p.add(N)});p.size>0&&a===null&&(a=setTimeout(c,wr))}),n.observe(document.body,{childList:!0,subtree:!0})}catch(b){}},getProminenceScore:u,destroy:()=>{if(n&&(n.disconnect(),n=null),a!==null&&clearTimeout(a),a=null,p.clear(),r&&typeof cancelIdleCallback=="function")try{cancelIdleCallback(r)}catch(m){}r=0,i=null,s.clear()}}}var Mr="https://api.sentient-ui.com/v1/events";function Lr(e){var n;let t=r=>{try{let i=document.cookie.match(new RegExp(`(?:^|; )${r}=([^;]*)`));return i?decodeURIComponent(i[1]):void 0}catch(i){return}};return(n=e?t(ve(e)):void 0)!=null?n:t(ge)}var St=new Map;function zn(e){var m;let t=Pt(e),n=e.respectDoNotTrack!==!1&&He(),r=e.consent===!1||n,i=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_"),s=e.localMode===!0||!i;if(!e.graph||s||typeof window=="undefined")return t;if(r)return n||Pn(e.apiKey,b=>zn(b)),t;let u=St.get(e.apiKey);if(u)try{u()}catch(b){}let o=Vn({sectionTypes:e.sectionTypes}),p=(m=e.ingestUrl)!=null?m:Mr,a=Bn({syncUrl:p.replace(/\/events\/?$/,"/graph/sync"),apiKey:e.apiKey,projectId:e.apiKey,sessionId:Lr(e.apiKey)});o.scan().then(b=>{for(let E of b.nodes)a.addPageNode({id:E.componentId,componentId:E.componentId,semanticType:E.semanticType,answers:e.captureDomText&&E.headingText?[E.headingText]:[],prominenceScore:E.prominenceScore,depth:E.depth});for(let E of b.edges)a.addStructuralEdge(E);a.syncOnce()});let c=null,d=()=>{c!==null&&clearTimeout(c),c=setTimeout(()=>{c=null,a.syncOnce()},500)};o.observe(b=>{for(let E of b.nodes)a.addPageNode({id:E.componentId,componentId:E.componentId,semanticType:E.semanticType,answers:e.captureDomText&&E.headingText?[E.headingText]:[],prominenceScore:E.prominenceScore,depth:E.depth});for(let E of b.edges)a.addStructuralEdge(E);d()});let S=()=>{c!==null&&(clearTimeout(c),c=null),o.destroy(),a.destroy(),St.get(e.apiKey)===S&&St.delete(e.apiKey)};return St.set(e.apiKey,S),ne(k({},t),{getGraph:()=>a.snapshot(),dispose:()=>{S(),t.dispose()},destroy:()=>{S(),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
|