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