@sentientui/snippet 0.25.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";var SentientSnippet=(()=>{var Xe=Object.defineProperty,hr=Object.defineProperties,yr=Object.getOwnPropertyDescriptor,vr=Object.getOwnPropertyDescriptors,br=Object.getOwnPropertyNames,zt=Object.getOwnPropertySymbols;var qt=Object.prototype.hasOwnProperty,wr=Object.prototype.propertyIsEnumerable;var Ft=(e,t,n)=>t in e?Xe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Y=(e,t)=>{for(var n in t||(t={}))qt.call(t,n)&&Ft(e,n,t[n]);if(zt)for(var n of zt(t))wr.call(t,n)&&Ft(e,n,t[n]);return e},Wt=(e,t)=>hr(e,vr(t));var Ht=(e,t)=>()=>(e&&(t=e(e=0)),t);var Jt=(e,t)=>{for(var n in t)Xe(e,n,{get:t[n],enumerable:!0})},Sr=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of br(t))!qt.call(e,o)&&o!==n&&Xe(e,o,{get:()=>t[o],enumerable:!(r=yr(t,o))||r.enumerable});return e};var Ar=e=>Sr(Xe({},"__esModule",{value:!0}),e);var Er,kr,xr,Vt,_r,Cr,Xt,T,we,Be=Ht(()=>{"use strict";Er=Object.defineProperty,kr=Object.defineProperties,xr=Object.getOwnPropertyDescriptors,Vt=Object.getOwnPropertySymbols,_r=Object.prototype.hasOwnProperty,Cr=Object.prototype.propertyIsEnumerable,Xt=(e,t,n)=>t in e?Er(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,T=(e,t)=>{for(var n in t||(t={}))_r.call(t,n)&&Xt(e,n,t[n]);if(Vt)for(var n of Vt(t))Cr.call(t,n)&&Xt(e,n,t[n]);return e},we=(e,t)=>kr(e,xr(t))});var cn={};Jt(cn,{LOCAL_ENGINE_AVAILABLE:()=>Dr,createLocalEngine:()=>Mr});function Mr(e){throw new Error("[sentient] createLocalEngine is not available in production builds. The local engine only exists under the `development` export condition.")}var Dr,un=Ht(()=>{"use strict";Dr=!1});var Zo={};Jt(Zo,{applyPersonaAttributes:()=>lt,applyRegistrySlots:()=>dt,applySlotArms:()=>ut,applySlotAttributes:()=>ct,parseEditorToken:()=>ur,parsePersonaPreview:()=>pr,parsePreview:()=>fr,parseSnippetConfig:()=>it,planReorder:()=>gt,reapply:()=>$t,run:()=>gr,version:()=>Je});Be();var Or=["buyer","researcher","deal_seeker","browser"];var Ir={buyer:"Buyer",researcher:"Researcher",deal_seeker:"Deal seeker",browser:"Browser",unknown:"Unknown"};function Ye(e){return Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("|")}function Yt(e){if(e.length===0)return null;let t={};for(let n of e.split("|")){let r=n.indexOf("=");if(r<=0||r!==n.lastIndexOf("=")||r===n.length-1)return null;let o=n.slice(0,r);if(o in t)return null;t[o]=n.slice(r+1)}return t}function wt(e){var t,n,r;if(e.arms)return typeof e.baseline=="string"?e.baseline:(t=e.arms[0])!=null?t:"";if(e.baseline!==void 0&&typeof e.baseline=="object")return Ye(e.baseline);if(typeof e.baseline=="string")return e.baseline;let o={};for(let[c,i]of Object.entries((n=e.dims)!=null?n:{}))o[c]=(r=i[0])!=null?r:"";return Ye(o)}function Zt(e,t){var n,r;return e.dims!=null?(r=(n=Yt(t))!=null?n:Yt(wt(e)))!=null?r:{}:t}function Qt(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t}function Se(e){return e>=.3?e<.7?"medium":"high":"low"}var ti=Or.map(e=>({key:e,displayName:Ir[e]}));function Ze(e){return e?`_${e.slice(0,12)}`:""}var Lr="_snt_uid";function en(e){return`${Lr}${Ze(e)}`}var Pr=["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 tn(e){return Rr(e)!==null}function Rr(e){var t;if(!e)return null;let n=e.toLowerCase();return(t=Pr.find(r=>n.includes(r.toLowerCase())))!=null?t:null}function nn(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 rn(e,t){if(!e)return"direct";try{let n=new URL(e);if(t)try{if(new URL(t).host===n.host)return"direct"}catch(o){}let r=n.hostname.toLowerCase();return/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(r)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(r)?"social":"referral"}catch(n){return"direct"}}function on(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var Tr=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function sn(e){let t={},n={};try{let r=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([o,c])=>{let i=Array.isArray(c)?c[0]:c;return i===void 0?[]:[[o,i]]});for(let[o,c]of r)o.startsWith("utm_")?o in t||(t[o]=c):Tr.includes(o)&&(o in n||(n[o]=c))}catch(r){}return{utmParams:t,clickIds:n}}function an(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function St(e){return T(T(T({id:e.id},e.arms?{arms:[...e.arms]}:{}),e.dims?{dims:Object.fromEntries(Object.entries(e.dims).map(([t,n])=>[t,[...n]]))}:{}),e.baseline!==void 0?{baseline:e.baseline}:{})}function At(e){let t=St(e);return Zt(t,wt(t))}function ln(e){return typeof e=="string"?e:Ye(e)}Be();function mn(){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 Br="_snt_uid",$r=365,Qe="_snt_uid";function Nr(){return mn()}function dn(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function Kr(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=strict; path=/`}catch(r){}}function Et(e){try{return localStorage.getItem(e)}catch(t){return null}}function fn(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function pn(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function jr(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function Gr(e){try{sessionStorage.removeItem(e)}catch(t){}}function Ur(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=strict; path=/`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function zr(e){try{localStorage.removeItem(e)}catch(t){}}function Fr(e){try{document.cookie=`${e}=; max-age=0; SameSite=strict; path=/`}catch(t){}}var qr={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function hn(e){var t,n,r,o,c,i,s;if(typeof window=="undefined")return qr;let a=Ze(e==null?void 0:e.apiKey),d=(t=e==null?void 0:e.cookieName)!=null?t:en(e==null?void 0:e.apiKey),l=`${Qe}${a}`,u=`${Qe}_tomb${a}`,g=((n=e==null?void 0:e.cookieTTLDays)!=null?n:$r)*24*60*60,v=m=>m&&m.length>0?m:null,S=()=>{var m,I;return a&&!(e!=null&&e.cookieName)&&Et(u)===null?(I=(m=v(dn(Br)))!=null?m:v(Et(Qe)))!=null?I:v(pn(Qe)):null},A=(s=(i=(c=(o=(r=v(dn(d)))!=null?r:v(Et(l)))!=null?o:v(pn(l)))!=null?c:S())!=null?i:v(e==null?void 0:e.ssrSessionId))!=null?s:Nr();Kr(d,A,g);let O=fn(l,A),x=Ur(d),D=O?!1:jr(l,A),f=!O&&!x&&!D;return{getSessionId:()=>A,isEphemeral:()=>f,destroy:()=>{A=null,Fr(d),zr(l),Gr(l),a&&!(e!=null&&e.cookieName)&&fn(u,"1")}}}function Ne(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function Ct(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 yn(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let r=JSON.parse(n);return Array.isArray(r)?(localStorage.removeItem(e),r.slice(-t)):[]}catch(n){return[]}}function Oe(e,t,n){try{let r=(()=>{try{let c=localStorage.getItem(n);if(!c)return[];let i=JSON.parse(c);return Array.isArray(i)?i:[]}catch(c){return[]}})(),o=new Map;for(let c of r)o.set(c.id,c);for(let c of e)o.set(c.id,c);localStorage.setItem(n,JSON.stringify([...o.values()].slice(-t)))}catch(r){}}function vn(e,t){try{let n=localStorage.getItem(t);if(!n)return;let r=JSON.parse(n);if(!Array.isArray(r))return;let o=new Set(e),c=r.filter(i=>!o.has(i.id));if(c.length===r.length)return;c.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(c))}catch(n){}}var Wr=500,Hr=56*1024;function bn(e){return`_snt_retry_${e.slice(0,12)}`}var Jr={push:()=>{},flush:()=>{},destroy:()=>{}};function Vr(e){var t,n,r;if(typeof window=="undefined")return Jr;let o=(t=e.flushIntervalMs)!=null?t:5e3,c=(n=e.maxBatchSize)!=null?n:20,i=(r=e.maxRetrySize)!=null?r:100,s=e.ingestUrl,a=e.apiKey,d=bn(a),l=[],u=new Set,g=[],v=b=>{for(let h of b)S.delete(h),!u.has(h)&&(u.add(h),g.push(h));for(;g.length>Wr;){let h=g.shift();h&&u.delete(h)}vn(b,d)},S=new Set,A=()=>{for(;l.length>i;){let b=l.shift();b&&S.delete(b.id)}},O=b=>{u.has(b.id)||S.has(b.id)||(S.add(b.id),l.push(b),A())},x=b=>{for(let h of b)u.has(h.id)||(S.add(h.id),l.push(h));A()},D=yn(d,i);for(let b of D)O(b);let f=0,m=0,I=(b,h=!0)=>{if(b.length===0)return;let C=JSON.stringify(b),_=b.map(V=>V.id),R;try{R=fetch(s,{method:"POST",keepalive:!0,body:C,headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`}})}catch(V){Oe(b,i,d),x(b),m++,f=Date.now()+Ne(m);return}let te=V=>{if(Ct(V)!=="retry"){if(!V.ok&&h){let oe=b.filter(ie=>ie.eventType!=="pageview");if(oe.length>0&&oe.length<b.length){v(b.filter(ie=>ie.eventType==="pageview").map(ie=>ie.id)),I(oe,!1);return}}v(_),m=0,f=0;return}Oe(b,i,d),x(b),m++,f=Date.now()+Ne(m)};R instanceof Promise?R.then(te).catch(()=>{Oe(b,i,d),x(b),m++,f=Date.now()+Ne(m)}):te(R)},E=typeof TextEncoder!="undefined"?new TextEncoder:null,w=b=>E?E.encode(b).length:b.length,$=b=>{let h=[],C=2;for(let _ of b){let R=w(JSON.stringify(_))+1;if(h.length>0&&C+R>Hr||h.length>=c)break;h.push(_),C+=R}return h},P=()=>{try{if(Date.now()<f)return;for(;l.length>0&&!(Date.now()<f);){let b=l.filter(C=>!u.has(C.id));if(l.length=0,b.length===0)break;let h=$(b);if(h.length===0)break;h.length<b.length&&l.push(...b.slice(h.length)),I(h)}}catch(b){}},U=!0,j=null;j=setInterval(()=>{U&&P()},o);let q=()=>{document.visibilityState==="hidden"&&P()},le=()=>{P()};return document.addEventListener("visibilitychange",q),window.addEventListener("pagehide",le),{push(b){O(b),l.length>=c&&P()},flush:P,destroy(){U=!1,j!==null&&(clearInterval(j),j=null),document.removeEventListener("visibilitychange",q),window.removeEventListener("pagehide",le),P()}}}var Xr=200;function wn(e){return`_snt_goal_retry_${e.slice(0,12)}`}var Yr={send:()=>{},flush:()=>{},destroy:()=>{}};function Zr(e){var t,n,r;if(typeof window=="undefined")return Yr;let o=(t=e.flushIntervalMs)!=null?t:5e3,c=(n=e.maxRetrySize)!=null?n:100,i=(r=e.maxPerFlush)!=null?r:5,s=wn(e.apiKey),a=[],d=new Set,l=new Set,u=[],g=0,v=0,S=!1,A=w=>{for(d.delete(w.id),l.has(w.id)||(l.add(w.id),u.push(w.id));u.length>Xr;){let $=u.shift();$&&l.delete($)}vn([w.id],s)},O=w=>{Oe([w],c,s),!l.has(w.id)&&!d.has(w.id)&&(d.add(w.id),a.push(w)),Date.now()>=g&&(v++,g=Date.now()+Ne(v))},x=w=>{let $;try{$=fetch(e.url,{method:"POST",keepalive:!0,body:w.body,headers:e.headers})}catch(U){O(w);return}let P=U=>{var j;let q=Ct(U);if(q==="retry"){O(w);return}q==="dropped"&&((j=e.onDrop)==null||j.call(e,w,U.status)),A(w),v=0,g=0};$ instanceof Promise?$.then(P).catch(()=>O(w)):P($)},D=()=>{try{if(S||Date.now()<g)return;let w=0;for(;a.length>0&&w<i&&!(Date.now()<g);){let $=a.shift();d.delete($.id),!l.has($.id)&&(w++,x($))}}catch(w){}},f=yn(s,c);for(let w of f)d.has(w.id)||(d.add(w.id),a.push(w));f.length>0&&Oe(f,c,s);let m=setInterval(D,o),I=()=>{document.visibilityState==="hidden"&&D()},E=()=>D();return document.addEventListener("visibilitychange",I),window.addEventListener("pagehide",E),{send(w){if(!S&&!(l.has(w.id)||d.has(w.id))){if(Date.now()<g){Oe([w],c,s),d.add(w.id),a.push(w);return}x(w)}},flush:D,destroy(){clearInterval(m),document.removeEventListener("visibilitychange",I),window.removeEventListener("pagehide",E),D(),S=!0}}}var Qr=1800*1e3;function et(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function eo(e=Qr,t){let n=new Map,r=`_snt_asgn${Ze(t)}_`,o=(a,d)=>`${r}${encodeURIComponent(a)}:${encodeURIComponent(d)}`,c=a=>{let d=a.slice(r.length),l=d.indexOf(":");if(l<0)return null;try{return{componentId:decodeURIComponent(d.slice(0,l)),segment:decodeURIComponent(d.slice(l+1))}}catch(u){return null}},i=()=>{try{let a=[];for(let d=0;d<localStorage.length;d++){let l=localStorage.key(d);l!=null&&l.startsWith(r)&&a.push(l)}return a}catch(a){return[]}},s=a=>a.assignedAt+(a.ttlMs&&a.ttlMs>0?a.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let a of i())try{let d=localStorage.getItem(a);if(!d)continue;let l=JSON.parse(d);if(s(l)){localStorage.removeItem(a);continue}let u=c(a);if(!u)continue;n.set(et(u.componentId,u.segment),l)}catch(d){}})(),{get(a,d){let l=n.get(et(a,d));return l?s(l)?(n.delete(et(a,d)),null):l:null},set(a,d,l){let u=et(a,d);n.set(u,l);try{localStorage.setItem(o(a,d),JSON.stringify(l))}catch(g){}},clear(){n.clear();for(let a of i())try{localStorage.removeItem(a)}catch(d){}}}}var rt="_snt_snap:",to=["low","medium","high"];function Ke(e){try{let t=localStorage.getItem(rt+e);if(!t)return null;let n=JSON.parse(t);return!n||typeof n!="object"||n.v!==1||typeof n.persona!="string"||typeof n.band!="string"||!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"||!(n.slotConfig===void 0||typeof n.slotConfig=="object"&&n.slotConfig!==null&&!Array.isArray(n.slotConfig))?null:n}catch(t){return null}}function je(e,t){try{localStorage.setItem(rt+e,JSON.stringify(t))}catch(n){}}var xt="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",Sn="[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.",gn=!1,tt=!1;function no(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function ro(e){var t;let n=hn({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),r=(t=n.getSessionId())!=null?t:"local",o=no(),c=Promise.resolve().then(()=>(un(),cn)).then(l=>{let u=l;return u.LOCAL_ENGINE_AVAILABLE?(gn||(gn=!0,console.info(Sn)),u):(tt||(tt=!0,console.error(xt)),null)}).catch(()=>(tt||(tt=!0,console.error(xt)),null)),i=null,s={low:.15,medium:.5,high:.85},a=(()=>{var l;if(e.initialPersona)return T({},e.initialPersona);let u=Ke(e.apiKey||"local");return u?{persona:u.persona,confidence:(l=s[u.band])!=null?l:.15}:null})();function d(l){let u=document.documentElement;u.dataset.sentientPersona===void 0&&(u.dataset.sentientPersona=l.persona,u.dataset.sentientConfidence=Se(l.confidence))}return{isLocal:!0,async decide(l){var u,g,v;let S=await c;if(!S)return null;let A=S.createLocalEngine({sessionId:r,forcedPersona:o}).decide(l);return i=we(T({},A),{layoutOrder:(g=(u=A.layoutOrder)!=null?u:i==null?void 0:i.layoutOrder)!=null?g:null,slots:T(T({},(v=i==null?void 0:i.slots)!=null?v:{}),A.slots)}),je(e.apiKey||"local",{v:1,persona:i.persona,band:Se(i.confidence),slots:i.slots,layoutOrder:i.layoutOrder,savedAt:Date.now()}),d(A),A},getSlotResult(l){var u,g,v;return(v=(g=i==null?void 0:i.slots[l])!=null?g:(u=e.initialSlots)==null?void 0:u[l])!=null?v:null},getSlotConfig(l){var u,g;return(g=(u=e.initialSlotConfig)==null?void 0:u[l])!=null?g:null},getSitePalette(){var l;return(l=e.initialPalette)!=null?l:null},reportSlots(){},getPersona(){let l=i!=null?i:a;return l?{persona:l.persona,confidence:l.confidence,band:Se(l.confidence)}:null},async assign(l,u){var g;let v=await c;return!v||!u||u.length===0?u!=null&&u[0]?{variantId:u[0],assignmentTtlMs:0}:null:{variantId:(g=v.createLocalEngine({sessionId:r,forcedPersona:o}).decide({components:[{id:l,variantIds:u}]}).assignments[l])!=null?g:u[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>n.destroy()}}function ot(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(ot):!1}function Ge(e,t,n,r){let o=[];{let c=!1,i=[],s=()=>{if(c)return;let a=Date.now();for(i.push(a);i.length>0&&a-i[0]>500;)i.shift();i.length>=3&&(c=!0,e("rage_click"))};t.addEventListener("click",s),o.push(()=>t.removeEventListener("click",s))}{let c=!1,i=s=>{if(c||!(s.target instanceof Node)||!t.contains(s.target)&&t!==s.target)return;c=!0;let a=typeof window!="undefined"?window.getSelection():null,d=a?a.toString().length:0;e("text_copy",{selectionLength:d})};document.addEventListener("copy",i),o.push(()=>document.removeEventListener("copy",i))}{let c=!1,i=!1,s=null,a=()=>{s!==null&&(clearTimeout(s),s=null)},d=()=>{c||!i||(a(),s=setTimeout(()=>{!c&&i&&(c=!0,e("scroll_hesitation"))},3e3))},l=()=>{a(),d()},u=v=>{for(let S of v)i=S.intersectionRatio>.3,i?d():a()},g=new IntersectionObserver(u,{threshold:[.3]});g.observe(t),window.addEventListener("scroll",l,{passive:!0}),o.push(()=>{g.disconnect(),window.removeEventListener("scroll",l),a()})}if((r==null?void 0:r.tabLoss)!==!1){let c=!1,i=n!=null?n:Date.now(),s=()=>{if(c||document.visibilityState!=="hidden")return;let a=Date.now()-i;a<15e3&&(c=!0,e("tab_loss",{timeOnPage:a}))};document.addEventListener("visibilitychange",s),o.push(()=>document.removeEventListener("visibilitychange",s))}return()=>{for(let c of o)c()}}function oo(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var An="https://api.sentient-ui.com/v1/events",ne=new Map,En=null;function io(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var so=3;function kt(){return mn()}function nt(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function ao(){let e=new WeakMap,t=new Map,n=!1,r=(s,a,d)=>{let l=s.get(a);return d===null?l?!0:(s.set(a,new Set),!1):l?l.has(d)?!0:(l.add(d),!1):(s.set(a,new Set([d])),!1)},o=typeof window!="undefined"&&"event"in window,c=()=>{if(!o)return;let s=window.event;return typeof Event=="function"&&s instanceof Event?s:void 0},i=()=>{if(o){Promise.resolve().then(()=>{n=!1,t.clear()});return}let s=!1,a=()=>{s||(s=!0,n=!1,t.clear())};if(setTimeout(a,0),typeof MessageChannel=="function"){let d=new MessageChannel;d.port1.onmessage=()=>{d.port1.close(),d.port2.close(),a()},d.port2.postMessage(0)}};return{firedBefore(s,a){let d=c();if(d){let u=e.get(d);return u||(u=new Map,e.set(d,u)),r(u,s,a)}let l=r(t,s,a);return!l&&!n&&(n=!0,i()),l}}}var kn=new Set;function lo(e,t,n){let r=typeof window=="undefined"?null:window.history;if(!r)return()=>{};let o=!1,c,i=()=>{if(o)return;let d=nt();!d||d===c||(c=d,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${d}`))},s=[];for(let d of["pushState","replaceState"]){let l=r[d],u=function(...g){let v=l.apply(this,g);return i(),v};r[d]=u,s.push([d,l,u])}window.addEventListener("popstate",i);let a=nt();return a&&kn.has(`${t}:${a}`)?c=a:i(),()=>{if(!o){o=!0,window.removeEventListener("popstate",i);for(let[d,l,u]of s)r[d]===u&&(r[d]=l)}}}var $e={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>{}};function co(){try{return sn(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function xn(e){return e.replace(/\/events\/?$/,"")}function Ae(){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(e=>e==="1"||e==="yes")}function Ot(e){var t;if(typeof window=="undefined")return;let n=e!=null?e:En;if(!n){console.warn("[sentient] grantConsent() called before init()");return}let r=ne.get(n);if(!r){console.warn("[sentient] grantConsent() called before init()");return}let{config:o,upgrade:c,reinit:i}=r;if(!c){r.upgradeBlockedReason&&console.warn(r.upgradeBlockedReason);return}if(o.respectDoNotTrack!==!1&&Ae())return;let s=(i!=null?i:Ue)(we(T({},o),{consent:!0}));c(s);let a=(t=ne.get(n))==null?void 0:t.dispose;ne.set(n,{config:we(T({},o),{consent:!0}),upgrade:null,dispose:a})}function uo(e){var t;let n=e.preConsentBehavior==="statistical_winner",r=xn((t=e.ingestUrl)!=null?t:An),o={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},c=new Map,i=new Map,s={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(l,u,g){if(!n)return Promise.resolve(null);let v=c.get(l);return v?Promise.resolve(v):_t(i,l,async()=>{try{let S=new URLSearchParams({componentId:l});for(let x of u!=null?u:[])S.append("variantIds[]",x);let A=await fetch(`${r}/winner?${S.toString()}`,{headers:o});if(!A.ok)return u!=null&&u[0]?{variantId:u[0],assignmentTtlMs:0}:null;let O={variantId:(await A.json()).variantId,assignmentTtlMs:0};return c.set(l,O),O}catch(S){return u!=null&&u[0]?{variantId:u[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>{}},a={track:l=>s.track(l),goal:((l,u,g,v)=>s.goal(l,u,g,v)),componentGoal:(l,u,g)=>s.componentGoal(l,u,g),identify:l=>s.identify(l),getAssignment:(l,u)=>s.getAssignment(l,u),assign:(l,u,g,v)=>s.assign(l,u,g,v),decide:l=>s.decide(l),getSlotResult:l=>s.getSlotResult(l),getSlotConfig:l=>s.getSlotConfig(l),getSitePalette:()=>s.getSitePalette(),reportSlots:(l,u)=>s.reportSlots(l,u),getPersona:()=>s.getPersona(),fetchWeights:()=>s.fetchWeights(),getGraph:()=>s.getGraph(),dispose:()=>s.dispose(),destroy:()=>s.destroy()};function d(l){s=l}return{proxy:a,setInner:d}}function _t(e,t,n){let r=e.get(t);if(r)return r;let o=(async()=>{try{return await n()}finally{e.delete(t)}})();return e.set(t,o),o}function Ue(e){var t,n,r,o,c,i,s,a,d,l;if(typeof window=="undefined")return $e;En=e.apiKey||"local";let u=ne.get(e.apiKey||"local");if(u!=null&&u.dispose)try{u.dispose()}catch(p){}let g=e.respectDoNotTrack!==!1&&Ae(),v=e.consent===!1||g,S=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!S&&e.localMode!==!1)return ne.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."}),v?$e:ro(e);if(v){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."),ne.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."}),$e;let{proxy:p,setInner:y}=uo(e);return ne.set(e.apiKey,{config:e,upgrade:g?null:y}),p}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."),$e;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),$e;let A=(t=e.ingestUrl)!=null?t:An,O=Date.now(),x=hn({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),D=eo(void 0,e.apiKey),f=Vr({ingestUrl:A,apiKey:e.apiKey}),m=xn(A),I={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},E=new Set,w=Zr({url:`${m}/goals`,apiKey:e.apiKey,headers:I,onDrop:(p,y)=>{if(!e.debug){if(E.has(y))return;E.add(y)}console.warn(`[sentient] goal dropped (HTTP ${y}) \u2014 this will not be retried. `+(y===400?"The session was not found: call init() and let the session upsert complete before firing goals.":y===401||y===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),p)}}),$=nn((n=navigator.userAgent)!=null?n:""),P=window.location.origin,U=rn((r=document.referrer)!=null?r:"",P),j=(o=e.sessionSegment)!=null?o:`${$}:${U}`,q=new Map,le=new Map,b=new Map,h=new Map,C=null,_=null,R=new Set,te=new Set,V=new Map,oe=null,ie=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,_e=new Set,Nt=p=>{for(let y of p)b.has(y.id)||b.set(y.id,At(y))};if(e.initialSlots)for(let[p,y]of Object.entries(e.initialSlots))b.set(p,y);if(e.initialSlotConfig)for(let[p,y]of Object.entries(e.initialSlotConfig))h.set(p,y);e.initialPalette&&(C=e.initialPalette);let fe=Ke(e.apiKey);if(fe){for(let[p,y]of Object.entries(fe.slots))b.has(p)||b.set(p,y);for(let[p,y]of Object.entries((c=fe.slotConfig)!=null?c:{}))h.has(p)||h.set(p,y);!C&&fe.palette&&(C=fe.palette)}let Kt={low:.15,medium:.5,high:.85};if(e.initialPersona)_=T({},e.initialPersona);else{let p=document.documentElement.dataset;p.sentientPersona?_={persona:p.sentientPersona,confidence:(s=Kt[(i=p.sentientConfidence)!=null?i:"low"])!=null?s:.15}:fe&&(_={persona:fe.persona,confidence:(a=Kt[fe.band])!=null?a:.15})}if(e.initialAssignments)for(let[p,y]of Object.entries(e.initialAssignments))D.set(p,j,{variantId:y,assignedAt:Date.now(),segment:j,confidence:1});let pe=Promise.resolve(),jt=x.getSessionId();if(jt){let p=on((d=document.referrer)!=null?d:""),{utmParams:y,clickIds:L}=co(),z=T(T(T(T({sessionId:jt,deviceClass:$,trafficSource:U,referrerDomain:p,utmParams:y,clickIds:L,timeOfDay:an(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:x.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||tn((l=navigator.userAgent)!=null?l:"")},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}:{}),G=async()=>{for(let M=0;;M++){try{let B=await fetch(`${m}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(z),headers:I});if(B.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(B.ok||Ct(B)==="dropped")return}catch(B){}if(M>=so){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(B=>setTimeout(B,Ne(M+1)))}};try{pe=G()}catch(M){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:f});let mr=ao(),Te=null,bt=!1,Ce={goal(p,y={},L=1,z=0){var G,M,B,H,Q,be,ge;let De=x.getSessionId();if(!De)return;let ee=io(y)?y:{metadata:y},Me=[p,(G=ee.externalId)!=null?G:"",(M=ee.stepIndex)!=null?M:z,(B=ee.weight)!=null?B:L].join("\0"),N=ee.value!==void 0?`${ee.value}\0${(H=ee.currency)!=null?H:""}`:null;if(mr.firedBefore(Me,N)){e.debug&&console.log(`[sentient] goal("${p}") already recorded for this action \u2014 not sent twice`);return}let ce=kt(),Ve={sessionId:De,name:p,metadata:(Q=ee.metadata)!=null?Q:{},weight:(be=ee.weight)!=null?be:L,stepIndex:(ge=ee.stepIndex)!=null?ge:z,goalId:ce,value:ee.value,currency:ee.currency,externalId:ee.externalId};e.debug&&console.log("[sentient] goal",Ve);let J={id:ce,body:JSON.stringify(Ve)};pe.then(()=>w.send(J))},componentGoal(p,y,L){var z,G,M;let B=x.getSessionId();if(!B)return;let H=D.get(p,j),Q=H?null:(z=b.get(p))!=null?z:null;if(!H&&Q===null){e.debug&&console.warn(`[sentient] componentGoal("${p}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}let be=H?H.variantId:ln(Q),ge={id:kt(),sessionId:B,projectId:e.apiKey,componentId:p,variantId:be,eventType:"goal_achieved",goalType:y,payload:T({reward:(G=L==null?void 0:L.reward)!=null?G:1,goalValue:L==null?void 0:L.value,currency:L==null?void 0:L.currency},(M=L==null?void 0:L.metadata)!=null?M:{}),timestamp:Date.now(),timeInSession:Date.now()-O,path:nt()};e.debug&&console.log("[sentient] componentGoal",ge),pe.then(()=>f.push(ge))},identify(p){let y=x.getSessionId();y&&pe.then(()=>{fetch(`${m}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:y,userId:p,ephemeral:x.isEphemeral()}),headers:I}).catch(()=>{})})},track(p){let y=x.getSessionId();if(!y)return;let L=we(T({path:nt()},p),{id:kt(),sessionId:y,timestamp:Date.now(),timeInSession:Date.now()-O});e.debug&&console.log("[sentient] track",L),pe.then(()=>f.push(L))},getAssignment(p,y){return D.get(p,y)},async assign(p,y,L,z){let G=x.getSessionId();if(!G)return null;let M=D.get(p,j);if(M&&(y!=null&&y.length||M.content!==void 0)){let B=M.ttlMs&&M.ttlMs>0?Math.max(0,M.assignedAt+M.ttlMs-Date.now()):0;return{variantId:M.variantId,assignmentTtlMs:B,content:M.content}}return _t(q,p,async()=>{await pe;try{let B={sessionId:G,componentId:p,variantIds:y};z!==void 0?B.agentDataByVariant=z:L!==void 0&&(B.agentData=L);let H=await fetch(`${m}/assign`,{method:"POST",body:JSON.stringify(B),headers:I});if(!H.ok)return null;let Q=await H.json();return D.set(p,j,T({variantId:Q.variantId,assignedAt:Date.now(),segment:j,confidence:1,content:Q.content},Q.assignmentTtlMs&&Q.assignmentTtlMs>0?{ttlMs:Q.assignmentTtlMs}:{})),Q}catch(B){return null}})},async decide(p){var y,L;let z=x.getSessionId();if(!z)return null;let G=(y=p.slots)!=null?y:[],M={sessionId:z};p.sections&&p.sections.length>0&&(M.sections=p.sections.map(H=>({id:H}))),M.components=(L=p.components)!=null?L:[],G.length>0&&(M.slots=G.map(St)),p.slotsFrom==="registry"&&(M.slotsFrom="registry"),p.v&&(M.v=p.v),typeof p.pp=="number"&&(M.pp=p.pp),e.persona&&(M.persona=e.persona);let B=JSON.stringify(M);return _t(le,B,async()=>{var H,Q,be,ge,De,ee;await pe;try{let Me=await fetch(`${m}/decide`,{method:"POST",body:B,headers:I});if(!Me.ok)return Nt(G),null;let N=await Me.json(),ce={};for(let J of G){let se=(H=N.slots)==null?void 0:H[J.id];if(se!==void 0){ce[J.id]=se,b.set(J.id,se);continue}let Gt=b.get(J.id);if(Gt!==void 0)ce[J.id]=Gt;else{let Ut=At(J);ce[J.id]=Ut,b.set(J.id,Ut)}}if(N.slots)for(let[J,se]of Object.entries(N.slots))J in ce||(ce[J]=se,b.set(J,se));let Ve=_!=null&&_.persona!=="unknown";N.persona&&!(N.persona==="unknown"&&Ve)?_={persona:N.persona,confidence:(Q=N.confidence)!=null?Q:0}:_||(_={persona:"unknown",confidence:0});for(let[J,se]of Object.entries((be=N.assignments)!=null?be:{}))D.set(J,j,{variantId:se,assignedAt:Date.now(),segment:j,confidence:1});if(N.slotConfig)for(let[J,se]of Object.entries(N.slotConfig))h.set(J,se);return N.palette&&(C=N.palette),je(e.apiKey,T(T({v:1,persona:_.persona,band:Se(_.confidence),slots:Object.fromEntries(b),layoutOrder:(ge=N.layoutOrder)!=null?ge:null,savedAt:Date.now()},h.size>0?{slotConfig:Object.fromEntries(h)}:{}),C?{palette:C}:{})),T(T(T(T({layoutOrder:(De=N.layoutOrder)!=null?De:null,assignments:(ee=N.assignments)!=null?ee:{},slots:ce,persona:_.persona,confidence:_.confidence},N.slotConfig?{slotConfig:N.slotConfig}:{}),N.goals?{goals:N.goals}:{}),N.sectionMap?{sectionMap:N.sectionMap}:{}),N.palette?{palette:N.palette}:{})}catch(Me){return Nt(G),null}})},getSlotResult(p){var y;return(y=b.get(p))!=null?y:null},getSlotConfig(p){var y;return(y=h.get(p))!=null?y:null},reportSlots(p,y){for(let L of p)if(!(typeof L!="string"||L.length===0)){if(!ie.test(L)){oo()&&!_e.has(L)&&(_e.add(L),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(L)} 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(!R.has(L)){R.add(L),te.add(L);let z=y==null?void 0:y[L];if(typeof z=="string"){let G=z.replace(/\s+/g," ").trim().slice(0,400);G!==""&&V.set(L,G)}}}te.size===0||oe!=null||(oe=setTimeout(()=>{oe=null;let L=[...te];te.clear();for(let z=0;z<L.length;z+=20){let G=L.slice(z,z+20),M={};for(let B of G){let H=V.get(B);H!==void 0&&(M[B]=H,V.delete(B))}fetch(`${m}/slots/observed`,{method:"POST",headers:I,body:JSON.stringify(T({slotIds:G},Object.keys(M).length>0?{baselineTexts:M}:{}))}).catch(()=>{})}},1e3))},getSitePalette(){return C},getPersona(){return _?{persona:_.persona,confidence:_.confidence,band:Se(_.confidence)}:null},async fetchWeights(){var p;try{let y=await fetch(`${m}/weights`,{headers:I});return y.ok?(p=(await y.json()).components)!=null?p:[]:[]}catch(y){return[]}},getGraph(){return{pageNodes:[],capturedAt:0}},dispose(){var p;Te==null||Te(),bt=!0,f.destroy(),w.destroy(),((p=ne.get(e.apiKey))==null?void 0:p.dispose)===Ce.dispose&&ne.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var p;Te==null||Te(),bt=!0,f.destroy(),w.destroy(),x.destroy(),D.clear(),((p=ne.get(e.apiKey))==null?void 0:p.dispose)===Ce.dispose&&ne.delete(e.apiKey);try{localStorage.removeItem(rt+e.apiKey),localStorage.removeItem(bn(e.apiKey)),localStorage.removeItem(wn(e.apiKey))}catch(y){}e.debug&&console.log("[sentient] destroyed")}};if(ne.set(e.apiKey,{config:e,upgrade:null,dispose:Ce.dispose}),Te=lo(Ce,e.apiKey,p=>{pe.then(()=>{bt||kn.add(p)})}),e.debug){let p=window;p.__sentient&&(p.__sentient.client=Ce)}return Ce}var fo=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function It(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function po(e){return{tag:e.tagName.toLowerCase(),text:It(e).slice(0,40)}}function _n(e){return e.replace(/["\\\]]/g,"\\$&")}function ze(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function Cn(e,t){var n;let r=e.tagName.toLowerCase();if(!r)return null;let o=((n=e.getAttribute("class"))!=null?n:"").split(/\s+/).filter(s=>/^[a-zA-Z][\w-]*$/.test(s)),c=[r,...o.map(s=>`${r}.${s}`)];for(let s of c)if(ze(t,s))return s;let i=e.parentElement;if(i&&i!==t){let s=Cn(i,t);if(s){for(let u of c){let g=`${s} > ${u}`;if(ze(t,g))return g}let a=Array.from(i.children).filter(u=>u.tagName.toLowerCase()===r),d=a.indexOf(e),l=a.some(u=>u!==e&&It(u)!==It(e));if(d>=0&&l){let u=`${s} > ${r}:nth-of-type(${d+1})`;if(ze(t,u))return u}}}return null}function On(e,t){let n=po(e),r=e.getAttribute("id");if(r&&ze(t,`#${_n(r)}`))return{v:1,id:r,fingerprint:n};for(let c of fo){let i=e.getAttribute(c);if(i&&ze(t,`[${c}="${_n(i)}"]`))return{v:1,dataAttr:{name:c,value:i},fingerprint:n}}let o=Cn(e,t);return o?{v:1,selector:o,fingerprint:n}:null}Be();var Ln=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],go={banner:"hero",navigation:"navigation",contentinfo:"footer"};function mo(e){let t=e.ariaRole?go[e.ariaRole.toLowerCase()]:void 0;if(t)return t;if(e.tag==="nav")return"navigation";if(e.tag==="footer")return"footer";if(e.tag==="header")return e.actionCount>=5?"navigation":"hero";let n=`${e.idClass} ${e.headingText}`.toLowerCase();return/\b(navbar|nav-bar|navigation|site-nav|main-nav|topbar|footer)\b/.test(n)?/footer/.test(n)?"footer":"navigation":/\b(hero|masthead|jumbotron)\b/i.test(e.idClass)?"hero":null}function ho(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var yo=[["pricing",/\b(pricing|price list|per month|\/mo|subscriptions?)\b|\bplans?\b(?=[^.]{0,40}(from|start|month|year|[$€£]))/i],["faq",/\bfaq\b|frequently asked|common questions?/i],["comparison",/\b(compare|comparison|versus)\b|\bvs\./i],["social_proof",/\b(reviews?|ratings?|testimonial|brands?|galler(y|ies)|logos)\b|trusted by|loved by|case stud|what our customers say/i],["trust",/\b(insurance|warrant(y|ies)|guarantees?|certifi|accredit|security|privacy|compliance|gdpr|encrypt)\b|why choose|about us|our team/i],["cta",/\b(book|booking|reserve|appointments?|newsletter|subscribe)\b|contact us|get in touch|opening hours/i],["features",/\b(features?|benefits?|capabilit|services?|repairs?|menus?|products?)\b|how it works|our process|what we (do|offer)|what you get/i]],Lt=[["pricing",/(?:[$€£]\s?\d[\d,.]*\s*(?:\/|per\s)\s*(?:mo|month|yr|year|seat|user))|(?:\b(?:starter|basic|pro|growth|premium|enterprise)\b[^.]{0,60}[$€£]\s?\d)/i],["social_proof",/(?:★{2,})|(?:\b\d(?:\.\d)?\s*(?:out of|\/)\s*5\b)|(?:\brated\b)|(?:["“][^"”]{20,160}["”]\s*[—–-]\s*[A-Z][a-z]+)/],["trust",/\b(?:money[- ]back guarantee|free returns?|returns? within|refund(?:s)? within|encrypted|soc ?2|iso ?27001|gdpr[- ]compliant|cancel anytime)\b/i],["comparison",/\b(?:vs|versus)\b\.?[^.!?]{0,80}\b(?:compare|comparison|plans?|features?|alternative)\b|\bhow (?:we|it) compares?\b/i]],In={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function vo(e){var t;let n=e.querySelector("h1, h2, h3");return((t=n==null?void 0:n.textContent)!=null?t:"").slice(0,160)}function Pn(e){var t,n;let r=mo(e);if(r)return{type:(t=In[r])!=null?t:"generic",strength:"strong"};let o=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[i,s]of yo)if(s.test(o))return{type:i,strength:"strong"};for(let[i,s]of Lt)if(s.test(e.bodyText))return{type:i,strength:"strong"};let c=ho(e);return{type:(n=In[c])!=null?n:"generic",strength:"weak"}}function Rn(e){var t,n;let r=((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim(),o=e.getAttribute("role");return T({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((n=e.className)!=null?n:"")}`,headingText:vo(e),bodyText:r.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:r.length},o?{ariaRole:o}:{})}Be();var bo="section, header, footer, nav, main > div, [data-sentient-section]",wo=2e4;function So(e){let t=Array.from(e.querySelectorAll(bo)),n=t.filter(r=>t.filter(o=>o!==r&&r.contains(o)).length<2);return n.filter(r=>!n.some(o=>o!==r&&o.contains(r)))}function Ao(e,t,n,r){try{fetch(`${t}/v1/section-map`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${e}`},body:JSON.stringify({pageUrl:n,sections:r})}).catch(()=>{})}catch(o){}}var Tn=()=>{};function Dn(e,t){var n,r,o,c,i,s,a,d,l,u,g,v;let S=(n=t.doc)!=null?n:typeof document!="undefined"?document:void 0;if(!S||typeof IntersectionObserver=="undefined"||Ae()||!t.apiKey||!t.apiKey.startsWith("pk_"))return Tn;let A=((r=t.apiBase)!=null?r:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),O=So(S);if(O.length===0)return Tn;let x=new Map,D=[];for(let h of O){let C=h.getAttribute("data-sentient-type"),_=C&&Ln.includes(C)?C:null,R=Rn(h),te=(c=_!=null?_:(o=t.typeOf)==null?void 0:o.call(t,h))!=null?c:Pn(R).type,V=On(h,S),oe=V?`nc-${te}-${Qt(JSON.stringify({id:(i=V.id)!=null?i:null,dataAttr:(s=V.dataAttr)!=null?s:null,selector:(a=V.selector)!=null?a:null})).toString(36)}`:`nc-${te}`;x.set(h,oe);let ie=Lt.filter(([,_e])=>_e.test(R.bodyText)).map(([_e])=>_e);D.push(we(T({componentId:oe,semanticType:te,source:_?"markup":"auto"},V?{locator:V}:{}),{observation:T(T({tag:R.tag,idClass:R.idClass.slice(0,200),headingText:R.headingText,textLength:R.textLength,actionCount:R.actionCount},R.ariaRole?{ariaRole:R.ariaRole}:{}),ie.length>0?{patternFlags:ie}:{})}))}let f=(g=(u=(l=(d=S.defaultView)!=null?d:typeof window!="undefined"?window:void 0)==null?void 0:l.location)==null?void 0:u.pathname)!=null?g:"/";Ao(t.apiKey,A,f,D);let m=new Map,I=h=>{let C=m.get(h);return C||(C={ms:0,scroll:0,enterAt:null,intersecting:!1},m.set(h,C)),C},E=new IntersectionObserver(h=>{for(let C of h){let _=x.get(C.target);if(!_)continue;let R=I(_);C.isIntersecting?(R.intersecting=!0,R.enterAt=Date.now(),C.intersectionRatio>R.scroll&&(R.scroll=C.intersectionRatio)):(R.intersecting=!1,R.enterAt!=null&&(R.ms+=Date.now()-R.enterAt,R.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let h of x.keys())E.observe(h);let w=()=>{let h=Date.now();for(let[C,_]of m)if(_.enterAt!=null&&(_.ms+=h-_.enterAt,_.enterAt=null),!(_.ms<=0)){try{e.track({projectId:t.apiKey,componentId:C,eventType:"dwell",payload:{dwell_time:Math.round(_.ms),scroll_depth:Number(_.scroll.toFixed(2))}})}catch(R){}_.ms=0}},$=()=>{if(S.hidden)w();else{let h=Date.now();for(let C of m.values())C.intersecting&&(C.enterAt=h)}},P=!1,U=h=>{if(w(),h!=null&&h.persisted){P=!0;return}try{E.disconnect()}catch(C){}},j=h=>{if(!(h!=null&&h.persisted)||!P)return;P=!1;let C=Date.now();for(let _ of m.values())_.enterAt=_.intersecting&&!S.hidden?C:null};S.addEventListener("visibilitychange",$);let q=(v=S.defaultView)!=null?v:typeof window!="undefined"?window:void 0;q==null||q.addEventListener("pagehide",U),q==null||q.addEventListener("pageshow",j);let le=setInterval(()=>{if(S.hidden||P)return;w();let h=Date.now();for(let C of m.values())C.intersecting&&(C.enterAt=h)},wo),b=[];return t.microSignals&&[...x.entries()].forEach(([h,C],_)=>{b.push(Ge((R,te={})=>{try{e.track({projectId:t.apiKey,componentId:C,eventType:"micro_signal",payload:T({signalType:R},te)})}catch(V){}},h,void 0,{tabLoss:_===0}))}),()=>{w(),clearInterval(le),S.removeEventListener("visibilitychange",$),q==null||q.removeEventListener("pagehide",U),q==null||q.removeEventListener("pageshow",j);for(let h of b)h();try{E.disconnect()}catch(h){}}}var Eo=["landing","ecommerce","saas","marketplace"];function ko(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;let t=Object.entries(e);if(t.length<1||t.length>4)return null;let n={};for(let[r,o]of t){if(!Array.isArray(o)||o.length<2||o.length>6||!o.every(c=>typeof c=="string"))return null;n[r]=o}return n}function xo(e){return!Array.isArray(e)||e.length<2||e.length>12||!e.every(t=>typeof t=="string")?null:e}function _o(e){try{return e()}catch(t){return}}function it(e){if(typeof e!="object"||e===null)return null;let t=e;if(typeof t.apiKey!="string"||!t.apiKey.startsWith("pk_"))return null;let n=Eo.includes(t.context)?t.context:"landing",r={};if(typeof t.slots=="object"&&t.slots!==null&&!Array.isArray(t.slots))for(let[i,s]of Object.entries(t.slots)){if(typeof s!="object"||s===null)continue;let a=s,d=ko(a.dims);if(!d||a.target!==void 0&&typeof a.target!="string")continue;let l=a.arms!==void 0?xo(a.arms):null,u={dims:d};typeof a.target=="string"&&(u.target=a.target),l&&(u.arms=l),r[i]=u}let o={apiKey:t.apiKey,context:n,personaAttributes:t.personaAttributes===!0,slots:r};typeof t.consent=="boolean"&&(o.consent=t.consent),(t.preConsentBehavior==="statistical_winner"||t.preConsentBehavior==="control")&&(o.preConsentBehavior=t.preConsentBehavior),t.debug===!0&&(o.debug=!0),typeof t.registry=="boolean"&&(o.registry=t.registry),typeof t.editorSrc=="string"&&(o.editorSrc=t.editorSrc),typeof t.apiBase=="string"&&(o.apiBase=t.apiBase),typeof t.sectionCapture=="boolean"&&(o.sectionCapture=t.sectionCapture);let c=typeof t.persona=="function"?_o(t.persona):t.persona;if(typeof c=="string"&&c.trim()!==""&&(o.persona=c),Array.isArray(t.sections)){let i=t.sections.filter(s=>typeof s=="string"&&s.trim()!=="").slice(0,50);i.length>=2&&(o.sections=i)}return o}function st(e){var n,r,o;let t=(r=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0)==null?void 0:r.location;return(o=t==null?void 0:t.pathname)!=null?o:""}function Co(e,t){var n;if(t.tag&&e.tagName.toLowerCase()!==t.tag.toLowerCase())return!1;if(t.text){let r=((n=e.textContent)!=null?n:"").replace(/\s+/g," ").trim().toLowerCase(),o=t.text.replace(/\s+/g," ").trim().toLowerCase();if(!(r===o||r.startsWith(o)||o.startsWith(r)))return!1}return!0}function Mn(e,t){return!!(e!=null&&e.urlMatch)&&!st(t).includes(e.urlMatch)}var Oo=/^[a-zA-Z_][-a-zA-Z0-9_]*$/;function me(e,t){var o;if(e.urlMatch&&!st(t).includes(e.urlMatch))return null;let n=[];if(e.id){let c=t.getElementById(e.id);n=c?[c]:[]}if(n.length===0&&((o=e.dataAttr)!=null&&o.name)&&Oo.test(e.dataAttr.name))try{let c=e.dataAttr.value.replace(/["\\]/g,"\\$&");n=Array.from(t.querySelectorAll(`[${e.dataAttr.name}="${c}"]`))}catch(c){n=[]}if(n.length===0&&e.selector)try{n=Array.from(t.querySelectorAll(e.selector))}catch(c){n=[]}if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!Co(r,e.fingerprint)?null:r}var Bn={color:"color",background:"background",fontSize:"font-size",fontWeight:"font-weight",textAlign:"text-align",padding:"padding",margin:"margin",borderRadius:"border-radius",width:"width",height:"height",maxWidth:"max-width",border:"border",boxShadow:"box-shadow",opacity:"opacity",lineHeight:"line-height",letterSpacing:"letter-spacing",textTransform:"text-transform",gap:"gap",fontFamily:"font-family"},Io=/^(rgb|rgba|hsl|hsla|calc|var|min|max|clamp)$/i;function $n(e){var r;if(e.trim().length===0||/[;{}<>]/.test(e))return!1;let t=/([A-Za-z-]*)\(/g,n;for(;(n=t.exec(e))!==null;)if(!Io.test((r=n[1])!=null?r:""))return!1;return!0}var Nn=/^https:\/\//i,Kn=new Map,he=null;function Lo(e){return e.replace(/["\\]/g,"\\$&")}function Po(e){var t;(!he||!he.isConnected)&&(he=e.querySelector("style[data-sentient-ops]"),he||(he=e.createElement("style"),he.setAttribute("data-sentient-ops",""),((t=e.head)!=null?t:e.documentElement).appendChild(he))),he.textContent=[...Kn.entries()].map(([n,r])=>`[data-snt-e="${Lo(n)}"]{${r}}`).join(`
2
- `)}function jn(e,t,n,r){var s;let o=!1,c=(s=t.moveBefore)!=null?s:t.moveAfter;if(c){let a=me(c,r);!a||a===e||a.parentElement!==e.parentElement||!e.parentElement?o=!0:t.moveBefore?e.parentElement.insertBefore(e,a):e.parentElement.insertBefore(e,a.nextSibling)}typeof t.text=="string"&&(e.textContent=t.text),typeof t.href=="string"&&Nn.test(t.href)&&e.setAttribute("href",t.href),typeof t.imageSrc=="string"&&Nn.test(t.imageSrc)&&e.setAttribute("src",t.imageSrc),typeof t.imageAlt=="string"&&e.setAttribute("alt",t.imageAlt);let i=[];if(t.hidden&&i.push("display:none !important"),t.style)for(let[a,d]of Object.entries(t.style)){let l=Bn[a];l&&typeof d=="string"&&$n(d)&&i.push(`${l}:${d.trim()} !important`)}return i.length>0&&(e.setAttribute("data-snt-e",n),Kn.set(n,i.join(";")),Po(r)),{anchorMiss:o}}var Fe="data-sentient-block-arm",k=null;function qe(e){k=e!=null?e:null}var ue="data-sentient-blocks-hid",Ie={none:"0",sm:"8px",md:"16px",lg:"24px"},Pt={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},Gn={sm:"0.875em",md:"1em",lg:"1.25em"},Ro={sm:"1.25em",md:"1.5em",lg:"2em"},To={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},Un={sm:"8px",md:"16px",lg:"32px"},Do={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},Mo={normal:"400",medium:"500",bold:"700"};function re(e,t){for(let[n,r]of Object.entries(t))r!==void 0&&e.style.setProperty(n,r);return e}function zn(e){return e==="muted"?k!=null&&k.muted?{color:k.muted}:{opacity:"0.7"}:e==="accent"?{"font-weight":"600",color:k==null?void 0:k.accent}:{}}function Fn(e,t){var n,r,o,c,i,s,a,d,l,u,g,v,S,A,O,x,D,f,m,I;try{switch(e.type){case"stack":case"grid":{let E=t.createElement("div");if(e.type==="stack"){let P=e;re(E,{display:"flex","flex-direction":P.direction,gap:(r=Ie[(n=P.gap)!=null?n:"md"])!=null?r:Ie.md,"align-items":P.align?Pt[P.align]:void 0,"justify-content":P.justify?Pt[P.justify]:void 0,"flex-wrap":P.wrap?"wrap":void 0})}else{let P=e,U=(c=Ie[(o=P.gap)!=null?o:"md"])!=null?c:Ie.md;re(E,{display:"grid","grid-template-columns":`repeat(auto-fit, minmax(max(200px, calc((100% - ${P.columns-1} * ${U}) / ${P.columns})), 1fr))`,gap:U,"align-items":P.align?Pt[P.align]:void 0})}let w=e.type==="stack"&&e.surface==="raised",$=(i=e.pad)!=null?i:w?"md":void 0;$&&re(E,{padding:(s=Ie[$])!=null?s:Ie.md}),w&&re(E,{background:k==null?void 0:k.surface,color:k!=null&&k.surface?k==null?void 0:k.surfaceText:void 0,border:`1px solid ${(a=k==null?void 0:k.border)!=null?a:"currentColor"}`,"border-radius":(d=k==null?void 0:k.radius)!=null?d:"8px"});for(let P of(l=e.children)!=null?l:[]){let U=Fn(P,t);U&&E.appendChild(U)}return E}case"text":{let E=t.createElement("p");return E.textContent=e.value,re(E,Wt(Y({margin:"0","font-size":e.size?Gn[e.size]:void 0,"font-weight":e.weight?Mo[e.weight]:void 0,"text-align":e.align},zn(e.tone)),{"max-width":e.maxWidth==="measure"?"65ch":void 0}))}case"heading":{let E=t.createElement(`h${e.level}`);return E.textContent=e.value,re(E,{margin:"0","font-size":Ro[(u=e.size)!=null?u:"md"],"text-align":e.align,"max-width":e.maxWidth==="measure"?"65ch":void 0})}case"button":{let E=t.createElement("a");E.textContent=e.label,E.href=e.href,e.tag&&E.setAttribute("data-sentient-tag",e.tag);let w=(g=e.emphasis)!=null?g:"primary";return re(E,{display:"inline-block",padding:To[(v=e.size)!=null?v:"md"],"border-radius":(S=k==null?void 0:k.radius)!=null?S:"8px",font:"inherit","font-size":e.size?Gn[e.size]:void 0,"text-decoration":w==="ghost"?"underline":"none",cursor:"pointer",background:w==="primary"?(A=k==null?void 0:k.primaryBg)!=null?A:"#111827":"transparent",color:w==="primary"?(O=k==null?void 0:k.primaryText)!=null?O:"#ffffff":(x=k==null?void 0:k.accent)!=null?x:"inherit",border:w==="secondary"?`1px solid ${(D=k==null?void 0:k.accent)!=null?D:"currentColor"}`:"none"})}case"link":{let E=t.createElement("a");return E.textContent=e.label,E.href=e.href,e.tag&&E.setAttribute("data-sentient-tag",e.tag),re(E,{color:"inherit","text-decoration":"underline"})}case"image":{let E=t.createElement("img");return E.src=e.src,E.alt=e.alt,re(E,{display:"block","max-width":"100%","aspect-ratio":e.ratio&&e.ratio!=="auto"?Do[e.ratio]:void 0,"object-fit":e.fit,width:e.ratio&&e.ratio!=="auto"?"100%":void 0})}case"badge":{let E=t.createElement("span");return E.textContent=e.value,re(E,Y({display:"inline-block",padding:"2px 10px","border-radius":"999px","font-size":"0.75em",border:`1px solid ${(f=k==null?void 0:k.border)!=null?f:"currentColor"}`},zn(e.tone)))}case"spacer":return re(t.createElement("div"),{height:(m=Un[e.size])!=null?m:Un.md});case"divider":return re(t.createElement("hr"),{border:"none","border-top":`1px solid ${(I=k==null?void 0:k.border)!=null?I:"currentColor"}`,margin:"0",width:"100%"});default:return null}}catch(E){return null}}function qn(e,t,n,r){try{let o=new Set;for(let i of Array.from(e.children)){let s=i.getAttribute(Fe);s!==null&&(t[s]===void 0?i.remove():o.add(s))}for(let[i,s]of Object.entries(t)){if(o.has(i))continue;let a=Fn(s,r);if(!a)continue;let d=r.createElement("div");d.setAttribute(Fe,i),d.style.display="none",d.appendChild(a),e.appendChild(d)}let c=n!==void 0&&t[n]!==void 0;for(let i of Array.from(e.children)){let s=i.getAttribute(Fe),a=i;s!==null?a.style.display=c&&s===n?"":"none":c?a.hasAttribute(ue)||(a.setAttribute(ue,a.style.display),a.style.display="none"):a.hasAttribute(ue)&&(a.style.display=a.getAttribute(ue),a.removeAttribute(ue))}}catch(o){}}function Bo(e){try{for(let t of Array.from(e.children)){let n=t;if(n.getAttribute(Fe)!==null){n.remove();continue}n.hasAttribute(ue)&&(n.style.display=n.getAttribute(ue),n.removeAttribute(ue))}}catch(t){}}function at(e,t){try{let n=new Set;for(let r of Array.from(e.querySelectorAll(`[${Fe}]`)))r.parentElement&&n.add(r.parentElement);for(let r of Array.from(e.querySelectorAll(`[${ue}]`)))r.parentElement&&n.add(r.parentElement);for(let r of n)t.has(r)||Bo(r)}catch(n){}}function Rt(e,t){if(!e)return[t.documentElement];try{return Array.from(t.querySelectorAll(e))}catch(n){return[]}}function lt(e,t,n,r){n.documentElement.setAttribute("data-sentient-persona",e),n.documentElement.setAttribute("data-sentient-confidence",t),r==null||r(n.documentElement,"data-sentient-persona"),r==null||r(n.documentElement,"data-sentient-confidence")}function ct(e,t,n,r){var o;for(let[c,i]of Object.entries(t)){let s=e[c];if(!s||typeof s=="string")continue;let a=Rt(i.target,n);for(let d of a)for(let[l,u]of Object.entries(s))(o=i.dims[l])!=null&&o.includes(u)&&(d.setAttribute(`data-${l}`,u),r==null||r(d,`data-${l}`))}}function ut(e,t,n,r){for(let[o,c]of Object.entries(t)){let i=e[o];if(typeof i!="string"||!c.arms||!c.arms.includes(i))continue;let s=Rt(c.target,n);for(let a of s)a.setAttribute("data-sentient-arm",i),r==null||r(a,"data-sentient-arm")}}function dt(e,t,n,r){var s,a,d,l;let o=new Set,c=(s=r==null?void 0:r.contentAndOps)!=null?s:!0,i=[];for(let[u,g]of Object.entries(t)){if(Mn(g.locator,n))continue;let v;if(g.locator){let A=me(g.locator,n);v=A?[A]:[]}else v=Rt(g.target,n);(g.locator||g.target)&&v.length===0&&i.push(u);let S=e[u];for(let A of v){if(S!==void 0)if(typeof S=="string")A.setAttribute("data-sentient-arm",S),(a=r==null?void 0:r.onAttr)==null||a.call(r,A,"data-sentient-arm"),c&&((d=r==null?void 0:r.onApplied)==null||d.call(r,u,S,A));else for(let[O,x]of Object.entries(S))A.setAttribute(`data-${O}`,x),(l=r==null?void 0:r.onAttr)==null||l.call(r,A,`data-${O}`);if(g.blocks&&!No(n)){let O=Object.fromEntries(Object.entries(g.blocks).filter(([,x])=>!ot(x)));Object.keys(O).length>0&&(qn(A,O,typeof S=="string"?S:void 0,n),o.add(A))}c&&(typeof g.content=="string"&&(A.textContent=g.content),g.ops&&jn(A,g.ops,u,n).anchorMiss&&!i.includes(u)&&i.push(u))}}return at(n,o),i}var $o=/bot|crawler|spider|crawling|googlebot|bingbot|duckduckbot|baiduspider|yandexbot|slurp|gptbot|claudebot|anthropic|perplexity|ccbot|applebot|headlesschrome/i;function No(e){var t,n,r;try{let o=(n=(t=e.defaultView)!=null?t:typeof window!="undefined"?window:void 0)==null?void 0:n.navigator;return o?o.webdriver===!0?!0:$o.test((r=o.userAgent)!=null?r:""):!1}catch(o){return!1}}var Ko=800;function ft(e,t,n){let r=[];return n.forEach(({slotId:o,arm:c,el:i},s)=>{r.push(Ge((g,v={})=>{try{e.track({projectId:t,componentId:o,variantId:c,eventType:"micro_signal",payload:Y({signalType:g},v)})}catch(S){}},i,void 0,{tabLoss:s===0}));let a=null,d=0,l=()=>{d=Date.now(),a=setTimeout(()=>{try{e.track({projectId:t,componentId:o,variantId:c,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-d}})}catch(g){}a=null},Ko)},u=()=>{a!==null&&(clearTimeout(a),a=null)};i.addEventListener("mouseenter",l),i.addEventListener("mouseleave",u),r.push(()=>{i.removeEventListener("mouseenter",l),i.removeEventListener("mouseleave",u),a!==null&&clearTimeout(a)})}),()=>{for(let o of r)o()}}function jo(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 Hn(e){return e?`_snt_fired_goals_${e.slice(0,12)}`:"_snt_fired_goals"}var Go="_snt_fired_goals";function Jn(e,t){try{e==null||e.sessionStorage.removeItem(Hn(t)),e==null||e.sessionStorage.removeItem(Go)}catch(n){}}function Wn(e){var t;return[(t=e.slotId)!=null?t:"",e.goalId,e.event,e.locator?JSON.stringify(e.locator):""].join("|")}function Uo(e,t){try{let n=e==null?void 0:e.sessionStorage.getItem(t);if(!n)return new Set;let r=JSON.parse(n);return Array.isArray(r)?new Set(r.filter(o=>typeof o=="string")):new Set}catch(n){return new Set}}function zo(e,t,n){try{e==null||e.sessionStorage.setItem(t,JSON.stringify([...n]))}catch(r){}}function pt(e,t,n,r){var x,D;let o=(x=n.defaultView)!=null?x:typeof window!="undefined"?window:null,c=Hn(r),i=Uo(o,c),s=f=>{let m=Wn(f);if(!i.has(m))try{f.slotId?t.componentGoal(f.slotId,f.goalId):t.goal(f.goalId),i.add(m),zo(o,c,i)}catch(I){}},a=e.filter(f=>f.event==="click"),d=e.filter(f=>f.event==="form_submit"),l=e.filter(f=>f.event==="url_reached"),u=e.filter(f=>f.event==="scroll_depth"),g=(f,m)=>{if(!f.locator)return!1;let I=me(f.locator,n);return!!I&&(I===m||I.contains(m))},v=f=>{let m=f.target;if(!(!m||typeof m.closest!="function"))for(let I of a)g(I,m)&&s(I)},S=f=>{let m=f.target;if(m)for(let I of d)g(I,m)&&s(I)},A=()=>{if(l.length===0)return;let f=st(n);for(let m of l)m.urlPattern&&jo(m.urlPattern,f)&&s(m)},O=()=>{var I;let f=n.documentElement,m=f.scrollHeight>0?(f.scrollTop+f.clientHeight)/f.scrollHeight:0;for(let E of u)m>=((I=E.threshold)!=null?I:.75)&&s(E);u.every(E=>i.has(Wn(E)))&&n.removeEventListener("scroll",O)};return n.addEventListener("click",v,!0),n.addEventListener("submit",S,!0),(D=n.defaultView)==null||D.addEventListener("popstate",A),A(),u.length>0&&(n.addEventListener("scroll",O,{passive:!0}),O()),{checkUrl:A,teardown:()=>{var f;n.removeEventListener("click",v,!0),n.removeEventListener("submit",S,!0),(f=n.defaultView)==null||f.removeEventListener("popstate",A),u.length>0&&n.removeEventListener("scroll",O)}}}function gt(e,t){if(!e||e.length<2||t.size!==e.length)return null;let n=[];for(let i of e){let s=t.get(i);if(!s||n.includes(s))return null;n.push(s)}let r=n[0].parentNode;if(!r||!n.every(i=>i.parentNode===r))return null;let o=n.slice().sort((i,s)=>i.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),c=[];for(let i=0;i<n.length;i++){let s=n[i];o[i]!==s&&(c.push({el:s,before:o[i]}),o.splice(o.indexOf(s),1),o.splice(i,0,s))}return c}var Vn="__snt_editor_token";function Xn(){try{return typeof sessionStorage!="undefined"?sessionStorage.getItem(Vn):null}catch(e){return null}}function Yn(e){try{sessionStorage.setItem(Vn,e)}catch(t){}}var Je="0.25.0",yt=Je!=="0.0.0-dev"?{name:"snippet",version:Je}:void 0,ir=5e3,Fo=50,sr=(()=>{try{if(typeof window=="undefined")return[];let e=window.SentientSnippet;return Array.isArray(e==null?void 0:e.q)?e.q:[]}catch(e){return[]}})(),Z=null,K=null,de={},ve=null,W=null,ye=null,X=null,ae=null,F=null,Ee=null,Zn=!1,Tt=null,mt=null,vt=null,Le=!1,We=!1,xe=!1;function ar(e,t){let n,r=new Promise(o=>{n=setTimeout(()=>o(null),t)});return Promise.race([e,r]).then(o=>(clearTimeout(n),o),o=>{throw clearTimeout(n),o})}function ke(e,...t){e!=null&&e.debug&&console.log("[sentient-snippet]",...t)}function Pe(e,t){return Z?(Z.personaAttributes&&F&&lt(F.persona,F.band,e,t==null?void 0:t.onAttr),ct(de,Z.slots,e,t==null?void 0:t.onAttr),ut(de,Z.slots,e,t==null?void 0:t.onAttr),ve?dt(de,ve,e,t):(at(e,new Set),[])):[]}function lr(e){var n;let t=new Map;for(let r of(n=Z==null?void 0:Z.sections)!=null?n:[])try{let o=e.querySelectorAll(r);o.length===1&&t.set(r,o[0])}catch(o){}return t}function Dt(e,t){var n,r;try{if(!e||e.length<2)return;for(let o of(n=gt(e,lr(t)))!=null?n:[])(r=o.before.parentNode)==null||r.insertBefore(o.el,o.before)}catch(o){}}function qo(e,t,n){let r=(o,c)=>t.some(([i,s])=>i===o&&s===c);try{if(Array.isArray(e.stamped))for(let o of e.stamped){if(!Array.isArray(o))continue;let[c,i,s]=o;!c||typeof i!="string"||r(c,i)||(s==null?c.removeAttribute(i):c.setAttribute(i,s))}if(Array.isArray(e.html))for(let o of e.html)typeof o!="string"||r(n.documentElement,o)||n.documentElement.removeAttribute(o)}catch(o){}}function Wo(){try{let e=window.__sntPP;return e&&typeof e=="object"&&typeof e.v=="number"?e:null}catch(e){return null}}function cr(e){return e.apiBase?`${e.apiBase.replace(/\/+$/,"")}/v1/events`:void 0}function Ho(e,t){var n;if(t.length!==0)try{let r=(n=e.apiBase)!=null?n:"https://api.sentient-ui.com";fetch(`${r}/v1/locator-miss`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${e.apiKey}`},body:JSON.stringify({slots:t})}).catch(()=>{})}catch(r){}}function Re(){return!!(Z&&K&&Z.sectionCapture!==!1&&(Z.consent!==!1||We)&&!Ae())}function Jo(){if(!K||!Z||!Re()||ae)return;let e=[];Pe(document,{contentAndOps:Le,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),Bt();try{X==null||X(),X=ft(K,Z.apiKey,e)}catch(t){}}function Bt(){if(typeof document=="undefined"||!Re())return;let e;try{if(mt&&mt.length>0){let t=new Map;for(let n of mt){if(n.urlMatch!==window.location.pathname)continue;let r=me(n.locator,document);r&&t.set(r,n.type)}t.size>0&&(e=n=>{var r;return(r=t.get(n))!=null?r:null})}}catch(t){}try{ae=Dn(K,Y({apiKey:Z.apiKey,apiBase:Z.apiBase,doc:document,microSignals:!0},e?{typeOf:e}:{})),vt=window.location.pathname}catch(t){}}function $t(){try{let e=[];if(X==null||X(),X=null,Pe(document,{contentAndOps:Le,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),Dt(Ee,document),e.length>0&&Re())try{X=ft(K,Z.apiKey,e)}catch(t){}try{typeof window!="undefined"&&vt!==null&&window.location.pathname!==vt&&Re()&&(ae==null||ae(),ae=null,Bt())}catch(t){}}catch(e){}}function Qn(){Tt===null&&(Tt=setTimeout(()=>{Tt=null,$t();try{W==null||W.checkUrl()}catch(e){}},Fo))}function Mt(){if(!(Zn||typeof window=="undefined"||typeof history=="undefined")){Zn=!0;try{let e=t=>{let n=history[t];history[t]=function(r,o,c){let i=n.call(this,r,o,c!=null?c:null);return Qn(),i}};e("pushState"),e("replaceState"),window.addEventListener("popstate",Qn)}catch(e){}}}function ht(e){let t={};for(let[n,r]of Object.entries(e.slots))try{t[n]=r.target?document.querySelectorAll(r.target).length:1}catch(o){t[n]=0}return t}function ur(e){return new URLSearchParams(e).get("sentient_editor")}function Vo(){try{let e=Array.from(document.getElementsByTagName("script")),t=/(^|\/)snippet(\.global)?\.js(\?|$)/,n=e.find(r=>t.test(r.src));if(n!=null&&n.src)return n.src.replace(t,"$1editor.global.js$3")}catch(e){}return null}function Xo(e,t){var n,r,o,c;try{window.__sentientEditor={token:t,apiBase:(n=e.apiBase)!=null?n:"https://api.sentient-ui.com"};try{let a=document.createElement("meta");a.name="referrer",a.content="no-referrer",a.setAttribute("data-sentient-editor",""),((r=document.head)!=null?r:document.documentElement).appendChild(a)}catch(a){}let i=(o=e.editorSrc)!=null?o:Vo();if(!i){tr();return}let s=document.createElement("script");s.src=i,s.async=!0,s.onerror=()=>tr(),((c=document.head)!=null?c:document.documentElement).appendChild(s)}catch(i){}}var er="sentient-editor-load-notice",dr={position:"fixed",bottom:"16px",zIndex:"2147483647",background:"#111827",color:"#fff",boxShadow:"0 10px 34px rgba(0,0,0,0.45)"};function tr(){var e,t;try{if(typeof document=="undefined"||document.getElementById(er))return;(e=document.querySelector('meta[name="referrer"][data-sentient-editor]'))==null||e.remove();let n=document.createElement("div");n.id=er,n.textContent="Couldn\u2019t load the editor \u2014 check your connection and reopen it from your dashboard.",Object.assign(n.style,dr,{right:"16px",maxWidth:"320px",padding:"14px 16px",borderRadius:"14px",font:"13px/1.45 system-ui, sans-serif",border:"1px solid rgba(245,158,11,0.6)",cursor:"pointer"}),n.addEventListener("click",()=>n.remove()),((t=document.body)!=null?t:document.documentElement).appendChild(n),setTimeout(()=>n.remove(),1e4)}catch(n){}}function fr(e){let t=new URLSearchParams(e).get("sentient_preview");if(!t)return null;let n={};for(let r of t.split("|")){let o=r.indexOf(":"),c=o===-1?"":r.slice(0,o),i=o===-1?"":r.slice(o+1);if(!(!c||!i))if(i.includes("=")){let s={};for(let a of i.split(",")){let[d,l]=a.split("=");d&&l&&(s[d]=l)}Object.keys(s).length&&(n[c]=s)}else n[c]=i}return Object.keys(n).length?n:null}function pr(e){try{return new URLSearchParams(e).get("sentient_persona")||null}catch(t){return null}}var nr="sentient-persona-preview-banner";function rr(e,t){var n;try{if(typeof document=="undefined"||document.getElementById(nr))return;let r=e.charAt(0).toUpperCase()+e.slice(1).replace(/[_-]+/g," "),o=document.createElement("div");o.id=nr,o.setAttribute("role","status"),Object.assign(o.style,dr,{left:"50%",transform:"translateX(-50%)",display:"flex",alignItems:"center",gap:"12px",padding:"10px 14px",borderRadius:"999px",font:"13px/1 system-ui, sans-serif",border:"1px solid rgba(255,255,255,0.14)"});let c=document.createElement("span");c.textContent=t?`\u201C${e}\u201D isn\u2019t in your personas \u2014 showing the default experience`:`Previewing as ${r}`;let i=document.createElement("button");i.type="button",i.textContent="Exit preview",Object.assign(i.style,{cursor:"pointer",border:"1px solid rgba(255,255,255,0.3)",background:"transparent",color:"#fff",font:"inherit",padding:"4px 10px",borderRadius:"999px"}),i.addEventListener("click",()=>{try{let s=new URL(window.location.href);s.searchParams.delete("sentient_persona"),window.location.href=s.pathname+s.search+s.hash}catch(s){}}),o.appendChild(c),o.appendChild(i),((n=document.body)!=null?n:document.documentElement).appendChild(o)}catch(r){}}async function Yo(e,t){var d,l,u,g,v,S,A,O,x,D;let n=(d=e.apiBase)!=null?d:"https://api.sentient-ui.com",o=((l=e.registry)!=null?l:Object.keys(e.slots).length===0)?{persona:t,slotsFrom:"registry"}:{persona:t,slots:Object.entries(e.slots).map(([f,m])=>({id:f,dims:m.dims}))},c=await ar(fetch(`${n}/v1/explain`,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${e.apiKey}`},body:JSON.stringify(o)}).then(f=>f.ok?f.json():null).catch(()=>null),ir);if(!c){He(e),ke(e,"persona preview: explain unavailable \u2014 page left as-is");return}let i=c;de=(u=i.slots)!=null?u:{},ve=(g=i.slotConfig)!=null?g:null,qe(i.palette);let s=(A=(S=(v=i.personaAttributes)==null?void 0:v.persona)!=null?S:i.persona)!=null?A:t,a=(x=(O=i.personaAttributes)==null?void 0:O.confidence)!=null?x:"high";F={persona:s,band:a},Pe(document),Le=!0,Mt(),He(e),i.recognized===!1?rr(t,!0):rr((D=i.personaDisplay)!=null?D:s)}function He(e){let t={goal(n,r){try{K==null||K.goal(n,r)}catch(o){}},componentGoal(n,r){try{K==null||K.componentGoal(n,r)}catch(o){}},grantConsent(){try{!K&&xe?(K=Ue(Y({apiKey:e.apiKey,context:e.context,consent:!0,preConsentBehavior:e.preConsentBehavior,debug:e.debug,persona:e.persona,ingestUrl:cr(e)},yt?{sdk:yt}:{})),ye&&ye.length>0&&(W==null||W.teardown(),W=pt(ye,K,document,e.apiKey))):(Ot(e.apiKey),K&&ye&&ye.length>0&&(W==null||W.teardown(),W=pt(ye,K,document,e.apiKey))),xe=!1}catch(n){}We=!0;try{Jo()}catch(n){}},revokeConsent(){try{ae==null||ae(),ae=null,vt=null,X==null||X(),X=null,W==null||W.teardown(),W=null,Jn(typeof window!="undefined"?window:null,e.apiKey),We=!1,xe=!0,K==null||K.destroy(),K=null}catch(n){}},reapply:$t,getState(){var n,r;try{return{apiKey:e.apiKey,persona:(n=F==null?void 0:F.persona)!=null?n:null,band:(r=F==null?void 0:F.band)!=null?r:null,slots:de,matchCounts:ht(e),consent:!xe&&(e.consent!==!1||We)}}catch(o){return{apiKey:e.apiKey,persona:null,band:null,slots:{},matchCounts:{},consent:!1}}}};window.SentientSnippet=t;for(let n of sr.splice(0))try{n[0]==="goal"&&t.goal(n[1],n[2])}catch(r){}}function or(){var e;try{if(typeof window=="undefined")return;let t=window;if(typeof((e=t.SentientSnippet)==null?void 0:e.goal)=="function")return;let n=()=>{};t.SentientSnippet={goal:n,componentGoal:n,grantConsent:n,revokeConsent:n,reapply:n,getState:()=>({apiKey:"",persona:null,band:null,slots:{},matchCounts:{},consent:!1})},sr.length=0}catch(t){}}async function gr(){var e,t;try{let n=it(window.sentient);if(!n){or();return}Z=n,Le=!1,Ee=null,qe(null),We=!1,xe=!1,ye=null;let r=typeof window!="undefined"?ur(window.location.search):null;if(r){Yn(r);try{let f=new URL(window.location.href);f.searchParams.delete("sentient_editor"),window.history.replaceState(null,"",f.pathname+f.search+f.hash)}catch(f){}}let o=r!=null?r:Xn();if(o){Xo(n,o),He(n),ke(n,"editor mode");return}let c=typeof window!="undefined"?fr(window.location.search):null;if(c){de=c,F=null,Pe(document),Mt(),He(n),ke(n,"preview mode",c);return}let i=typeof window!="undefined"?pr(window.location.search):null;if(i){await Yo(n,i),ke(n,"persona preview",i);return}let s=(e=n.registry)!=null?e:Object.keys(n.slots).length===0,a=Wo();try{(t=a==null?void 0:a.stop)==null||t.call(a)}catch(f){}let d=Ke(n.apiKey),l=[];d&&(F={persona:d.persona,band:d.band},de=d.slots,d.slotConfig&&(ve=d.slotConfig),d.palette&&qe(d.palette),Pe(document,Y({contentAndOps:!1},a?{onAttr:(f,m)=>l.push([f,m])}:{})),d.layoutOrder&&(Ee=d.layoutOrder,Dt(Ee,document))),a&&qo(a,l,document);let u=Ue(Y({apiKey:n.apiKey,context:n.context,consent:n.consent,preConsentBehavior:n.preConsentBehavior,debug:n.debug,persona:n.persona,ingestUrl:cr(n)},yt?{sdk:yt}:{}));K=u,He(n),Mt();let g=Object.entries(n.slots).map(([f,m])=>({id:f,dims:m.dims})),v=Je!=="0.0.0-dev"?{v:Je}:{},S={pp:a?a.v:0},A=Array.from(lr(document).keys()),O=u.decide(Y(Y(Y(Y({slots:g},v),S),A.length>=2?{sections:A}:{}),s?{slotsFrom:"registry"}:{})),x=await ar(O,ir),D=f=>{var E,w,$,P,U,j;let m=u.getPersona();m?F={persona:m.persona,band:m.band}:f.persona&&(F={persona:f.persona,band:"low"}),de=f.slots,s?ve=(E=f.slotConfig)!=null?E:null:f.slotConfig&&(ve=f.slotConfig),f.palette&&qe(f.palette),Ee=(w=f.layoutOrder)!=null?w:Ee;let I=()=>{let q=[];if(Ho(n,Pe(document,{onApplied:(le,b,h)=>q.push({slotId:le,arm:b,el:h})})),Dt(Ee,document),Le=!0,Re())try{X==null||X(),X=ft(K,n.apiKey,q)}catch(le){}};if(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",I,{once:!0}):I(),ye=($=f.goals)!=null?$:null,f.goals&&f.goals.length>0&&n.consent!==!1&&K)try{W==null||W.teardown(),W=pt(f.goals,K,document,n.apiKey)}catch(q){}mt=(P=f.sectionMap)!=null?P:null,Re()&&Bt(),ke(n,"applied",{persona:F,slots:de,matches:ht(n)}),!xe&&je(n.apiKey,Y(Y({v:1,persona:(U=F==null?void 0:F.persona)!=null?U:f.persona,band:(j=F==null?void 0:F.band)!=null?j:"low",slots:f.slots,layoutOrder:f.layoutOrder,savedAt:Date.now()},ve?{slotConfig:ve}:{}),f.palette?{palette:f.palette}:{}))};if(!x){ke(n,"decide timeout/null \u2014 snapshot state stands",ht(n)),O.then(f=>{!f||Le||xe||K!==u||(D(f),ke(n,"late decide applied",ht(n)))}).catch(()=>{});return}D(x)}catch(n){or()}}if(typeof window!="undefined"&&window.sentient){let e=window;e.__sentientInitialized||(e.__sentientInitialized=!0,Promise.resolve().then(()=>{gr()}))}return Ar(Zo);})();
1
+ "use strict";var SentientSnippet=(()=>{var Xe=Object.defineProperty,wr=Object.defineProperties,Sr=Object.getOwnPropertyDescriptor,Ar=Object.getOwnPropertyDescriptors,xr=Object.getOwnPropertyNames,Ht=Object.getOwnPropertySymbols;var Vt=Object.prototype.hasOwnProperty,Er=Object.prototype.propertyIsEnumerable;var Jt=(e,t,n)=>t in e?Xe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,W=(e,t)=>{for(var n in t||(t={}))Vt.call(t,n)&&Jt(e,n,t[n]);if(Ht)for(var n of Ht(t))Er.call(t,n)&&Jt(e,n,t[n]);return e},Ze=(e,t)=>wr(e,Ar(t));var Yt=(e,t)=>()=>(e&&(t=e(e=0)),t);var Xt=(e,t)=>{for(var n in t)Xe(e,n,{get:t[n],enumerable:!0})},kr=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of xr(t))!Vt.call(e,o)&&o!==n&&Xe(e,o,{get:()=>t[o],enumerable:!(r=Sr(t,o))||r.enumerable});return e};var _r=e=>kr(Xe({},"__esModule",{value:!0}),e);var Cr,Or,Ir,Zt,Lr,Rr,Qt,D,we,$e=Yt(()=>{"use strict";Cr=Object.defineProperty,Or=Object.defineProperties,Ir=Object.getOwnPropertyDescriptors,Zt=Object.getOwnPropertySymbols,Lr=Object.prototype.hasOwnProperty,Rr=Object.prototype.propertyIsEnumerable,Qt=(e,t,n)=>t in e?Cr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,D=(e,t)=>{for(var n in t||(t={}))Lr.call(t,n)&&Qt(e,n,t[n]);if(Zt)for(var n of Zt(t))Rr.call(t,n)&&Qt(e,n,t[n]);return e},we=(e,t)=>Or(e,Ir(t))});var fn={};Xt(fn,{LOCAL_ENGINE_AVAILABLE:()=>Nr,createLocalEngine:()=>Kr});function Kr(e){throw new Error("[sentient] createLocalEngine is not available in production builds. The local engine only exists under the `development` export condition.")}var Nr,pn=Yt(()=>{"use strict";Nr=!1});var ri={};Xt(ri,{applyPersonaAttributes:()=>ut,applyRegistrySlots:()=>pt,applySlotArms:()=>ft,applySlotAttributes:()=>dt,parseEditorToken:()=>gr,parsePersonaPreview:()=>yr,parsePreview:()=>hr,parseSnippetConfig:()=>at,planReorder:()=>ht,reapply:()=>Gt,run:()=>vr,version:()=>Ve});$e();var Pr=["buyer","researcher","deal_seeker","browser"];var Tr={buyer:"Buyer",researcher:"Researcher",deal_seeker:"Deal seeker",browser:"Browser",unknown:"Unknown"};function Qe(e){return Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("|")}function en(e){if(e.length===0)return null;let t={};for(let n of e.split("|")){let r=n.indexOf("=");if(r<=0||r!==n.lastIndexOf("=")||r===n.length-1)return null;let o=n.slice(0,r);if(o in t)return null;t[o]=n.slice(r+1)}return t}function At(e){var t,n,r;if(e.arms)return typeof e.baseline=="string"?e.baseline:(t=e.arms[0])!=null?t:"";if(e.baseline!==void 0&&typeof e.baseline=="object")return Qe(e.baseline);if(typeof e.baseline=="string")return e.baseline;let o={};for(let[c,i]of Object.entries((n=e.dims)!=null?n:{}))o[c]=(r=i[0])!=null?r:"";return Qe(o)}function tn(e,t){var n,r;return e.dims!=null?(r=(n=en(t))!=null?n:en(At(e)))!=null?r:{}:t}function nn(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t}function Se(e){return e>=.3?e<.7?"medium":"high":"low"}var si=Pr.map(e=>({key:e,displayName:Tr[e]}));function et(e){return e?`_${e.slice(0,12)}`:""}var Dr="_snt_uid";function rn(e){return`${Dr}${et(e)}`}var Mr=["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 on(e){return Br(e)!==null}function Br(e){var t;if(!e)return null;let n=e.toLowerCase();return(t=Mr.find(r=>n.includes(r.toLowerCase())))!=null?t:null}function sn(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 an(e,t){if(!e)return"direct";try{let n=new URL(e);if(t)try{if(new URL(t).host===n.host)return"direct"}catch(o){}let r=n.hostname.toLowerCase();return/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(r)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(r)?"social":"referral"}catch(n){return"direct"}}function ln(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var $r=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function cn(e){let t={},n={};try{let r=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([o,c])=>{let i=Array.isArray(c)?c[0]:c;return i===void 0?[]:[[o,i]]});for(let[o,c]of r)o.startsWith("utm_")?o in t||(t[o]=c):$r.includes(o)&&(o in n||(n[o]=c))}catch(r){}return{utmParams:t,clickIds:n}}function un(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function xt(e){return D(D(D({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 Et(e){let t=xt(e);return tn(t,At(t))}function dn(e){return typeof e=="string"?e:Qe(e)}$e();function bn(){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 jr="_snt_uid",Gr=365,tt="_snt_uid";function Ur(){return bn()}function gn(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function Fr(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=strict; path=/`}catch(r){}}function kt(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 hn(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function zr(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function Wr(e){try{sessionStorage.removeItem(e)}catch(t){}}function qr(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=strict; path=/`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function Hr(e){try{localStorage.removeItem(e)}catch(t){}}function Jr(e){try{document.cookie=`${e}=; max-age=0; SameSite=strict; path=/`}catch(t){}}var Vr={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function wn(e){var t,n,r,o,c,i,s;if(typeof window=="undefined")return Vr;let a=et(e==null?void 0:e.apiKey),d=(t=e==null?void 0:e.cookieName)!=null?t:rn(e==null?void 0:e.apiKey),l=`${tt}${a}`,u=`${tt}_tomb${a}`,g=((n=e==null?void 0:e.cookieTTLDays)!=null?n:Gr)*24*60*60,v=m=>m&&m.length>0?m:null,w=()=>{var m,O;return a&&!(e!=null&&e.cookieName)&&kt(u)===null?(O=(m=v(gn(jr)))!=null?m:v(kt(tt)))!=null?O:v(hn(tt)):null},A=(s=(i=(c=(o=(r=v(gn(d)))!=null?r:v(kt(l)))!=null?o:v(hn(l)))!=null?c:w())!=null?i:v(e==null?void 0:e.ssrSessionId))!=null?s:Ur();Fr(d,A,g);let P=mn(l,A),E=qr(d),L=P?!1:zr(l,A),f=!P&&!E&&!L;return{getSessionId:()=>A,isEphemeral:()=>f,destroy:()=>{A=null,Jr(d),Hr(l),Wr(l),a&&!(e!=null&&e.cookieName)&&mn(u,"1")}}}function Ke(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function Lt(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 Sn(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let r=JSON.parse(n);return Array.isArray(r)?(localStorage.removeItem(e),r.slice(-t)):[]}catch(n){return[]}}function Oe(e,t,n){try{let r=(()=>{try{let c=localStorage.getItem(n);if(!c)return[];let i=JSON.parse(c);return Array.isArray(i)?i:[]}catch(c){return[]}})(),o=new Map;for(let c of r)o.set(c.id,c);for(let c of e)o.set(c.id,c);localStorage.setItem(n,JSON.stringify([...o.values()].slice(-t)))}catch(r){}}function An(e,t){try{let n=localStorage.getItem(t);if(!n)return;let r=JSON.parse(n);if(!Array.isArray(r))return;let o=new Set(e),c=r.filter(i=>!o.has(i.id));if(c.length===r.length)return;c.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(c))}catch(n){}}var Yr=500,Xr=56*1024;function xn(e){return`_snt_retry_${e.slice(0,12)}`}var Zr={push:()=>{},flush:()=>{},destroy:()=>{}};function Qr(e){var t,n,r;if(typeof window=="undefined")return Zr;let o=(t=e.flushIntervalMs)!=null?t:5e3,c=(n=e.maxBatchSize)!=null?n:20,i=(r=e.maxRetrySize)!=null?r:100,s=e.ingestUrl,a=e.apiKey,d=xn(a),l=[],u=new Set,g=[],v=b=>{for(let h of b)w.delete(h),!u.has(h)&&(u.add(h),g.push(h));for(;g.length>Yr;){let h=g.shift();h&&u.delete(h)}An(b,d)},w=new Set,A=()=>{for(;l.length>i;){let b=l.shift();b&&w.delete(b.id)}},P=b=>{u.has(b.id)||w.has(b.id)||(w.add(b.id),l.push(b),A())},E=b=>{for(let h of b)u.has(h.id)||(w.add(h.id),l.push(h));A()},L=Sn(d,i);for(let b of L)P(b);let f=0,m=0,O=(b,h=!0)=>{if(b.length===0)return;let C=JSON.stringify(b),_=b.map(Y=>Y.id),T;try{T=fetch(s,{method:"POST",keepalive:!0,body:C,headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`}})}catch(Y){Oe(b,i,d),E(b),m++,f=Date.now()+Ke(m);return}let te=Y=>{if(Lt(Y)!=="retry"){if(!Y.ok&&h){let oe=b.filter(ie=>ie.eventType!=="pageview");if(oe.length>0&&oe.length<b.length){v(b.filter(ie=>ie.eventType==="pageview").map(ie=>ie.id)),O(oe,!1);return}}v(_),m=0,f=0;return}Oe(b,i,d),E(b),m++,f=Date.now()+Ke(m)};T instanceof Promise?T.then(te).catch(()=>{Oe(b,i,d),E(b),m++,f=Date.now()+Ke(m)}):te(T)},x=typeof TextEncoder!="undefined"?new TextEncoder:null,S=b=>x?x.encode(b).length:b.length,$=b=>{let h=[],C=2;for(let _ of b){let T=S(JSON.stringify(_))+1;if(h.length>0&&C+T>Xr||h.length>=c)break;h.push(_),C+=T}return h},R=()=>{try{if(Date.now()<f)return;for(;l.length>0&&!(Date.now()<f);){let b=l.filter(C=>!u.has(C.id));if(l.length=0,b.length===0)break;let h=$(b);if(h.length===0)break;h.length<b.length&&l.push(...b.slice(h.length)),O(h)}}catch(b){}},F=!0,G=null;G=setInterval(()=>{F&&R()},o);let q=()=>{document.visibilityState==="hidden"&&R()},le=()=>{R()};return document.addEventListener("visibilitychange",q),window.addEventListener("pagehide",le),{push(b){P(b),l.length>=c&&R()},flush:R,destroy(){F=!1,G!==null&&(clearInterval(G),G=null),document.removeEventListener("visibilitychange",q),window.removeEventListener("pagehide",le),R()}}}var eo=200;function En(e){return`_snt_goal_retry_${e.slice(0,12)}`}var to={send:()=>{},flush:()=>{},destroy:()=>{}};function no(e){var t,n,r;if(typeof window=="undefined")return to;let o=(t=e.flushIntervalMs)!=null?t:5e3,c=(n=e.maxRetrySize)!=null?n:100,i=(r=e.maxPerFlush)!=null?r:5,s=En(e.apiKey),a=[],d=new Set,l=new Set,u=[],g=0,v=0,w=!1,A=S=>{for(d.delete(S.id),l.has(S.id)||(l.add(S.id),u.push(S.id));u.length>eo;){let $=u.shift();$&&l.delete($)}An([S.id],s)},P=S=>{Oe([S],c,s),!l.has(S.id)&&!d.has(S.id)&&(d.add(S.id),a.push(S)),Date.now()>=g&&(v++,g=Date.now()+Ke(v))},E=S=>{let $;try{$=fetch(e.url,{method:"POST",keepalive:!0,body:S.body,headers:e.headers})}catch(F){P(S);return}let R=F=>{var G;let q=Lt(F);if(q==="retry"){P(S);return}q==="dropped"&&((G=e.onDrop)==null||G.call(e,S,F.status)),A(S),v=0,g=0};$ instanceof Promise?$.then(R).catch(()=>P(S)):R($)},L=()=>{try{if(w||Date.now()<g)return;let S=0;for(;a.length>0&&S<i&&!(Date.now()<g);){let $=a.shift();d.delete($.id),!l.has($.id)&&(S++,E($))}}catch(S){}},f=Sn(s,c);for(let S of f)d.has(S.id)||(d.add(S.id),a.push(S));f.length>0&&Oe(f,c,s);let m=setInterval(L,o),O=()=>{document.visibilityState==="hidden"&&L()},x=()=>L();return document.addEventListener("visibilitychange",O),window.addEventListener("pagehide",x),{send(S){if(!w&&!(l.has(S.id)||d.has(S.id))){if(Date.now()<g){Oe([S],c,s),d.add(S.id),a.push(S);return}E(S)}},flush:L,destroy(){clearInterval(m),document.removeEventListener("visibilitychange",O),window.removeEventListener("pagehide",x),L(),w=!0}}}var ro=1800*1e3;function nt(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function oo(e=ro,t){let n=new Map,r=`_snt_asgn${et(t)}_`,o=(a,d)=>`${r}${encodeURIComponent(a)}:${encodeURIComponent(d)}`,c=a=>{let d=a.slice(r.length),l=d.indexOf(":");if(l<0)return null;try{return{componentId:decodeURIComponent(d.slice(0,l)),segment:decodeURIComponent(d.slice(l+1))}}catch(u){return null}},i=()=>{try{let a=[];for(let d=0;d<localStorage.length;d++){let l=localStorage.key(d);l!=null&&l.startsWith(r)&&a.push(l)}return a}catch(a){return[]}},s=a=>a.assignedAt+(a.ttlMs&&a.ttlMs>0?a.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let a of i())try{let d=localStorage.getItem(a);if(!d)continue;let l=JSON.parse(d);if(s(l)){localStorage.removeItem(a);continue}let u=c(a);if(!u)continue;n.set(nt(u.componentId,u.segment),l)}catch(d){}})(),{get(a,d){let l=n.get(nt(a,d));return l?s(l)?(n.delete(nt(a,d)),null):l:null},set(a,d,l){let u=nt(a,d);n.set(u,l);try{localStorage.setItem(o(a,d),JSON.stringify(l))}catch(g){}},clear(){n.clear();for(let a of i())try{localStorage.removeItem(a)}catch(d){}}}}var it="_snt_snap:",io=["low","medium","high"];function je(e){try{let t=localStorage.getItem(it+e);if(!t)return null;let n=JSON.parse(t);return!n||typeof n!="object"||n.v!==1||typeof n.persona!="string"||typeof n.band!="string"||!io.includes(n.band)||typeof n.slots!="object"||n.slots===null||Array.isArray(n.slots)||!(n.layoutOrder===null||Array.isArray(n.layoutOrder))||typeof n.savedAt!="number"||!(n.slotConfig===void 0||typeof n.slotConfig=="object"&&n.slotConfig!==null&&!Array.isArray(n.slotConfig))?null:n}catch(t){return null}}function Ge(e,t){try{localStorage.setItem(it+e,JSON.stringify(t))}catch(n){}}var Ot="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",kn="[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.",yn=!1,rt=!1;function so(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function ao(e){var t;let n=wn({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),r=(t=n.getSessionId())!=null?t:"local",o=so(),c=Promise.resolve().then(()=>(pn(),fn)).then(l=>{let u=l;return u.LOCAL_ENGINE_AVAILABLE?(yn||(yn=!0,console.info(kn)),u):(rt||(rt=!0,console.error(Ot)),null)}).catch(()=>(rt||(rt=!0,console.error(Ot)),null)),i=null,s={low:.15,medium:.5,high:.85},a=(()=>{var l;if(e.initialPersona)return D({},e.initialPersona);let u=je(e.apiKey||"local");return u?{persona:u.persona,confidence:(l=s[u.band])!=null?l:.15}:null})();function d(l){let u=document.documentElement;u.dataset.sentientPersona===void 0&&(u.dataset.sentientPersona=l.persona,u.dataset.sentientConfidence=Se(l.confidence))}return{isLocal:!0,async decide(l){var u,g,v;let w=await c;if(!w)return null;let A=w.createLocalEngine({sessionId:r,forcedPersona:o}).decide(l);return i=we(D({},A),{layoutOrder:(g=(u=A.layoutOrder)!=null?u:i==null?void 0:i.layoutOrder)!=null?g:null,slots:D(D({},(v=i==null?void 0:i.slots)!=null?v:{}),A.slots)}),Ge(e.apiKey||"local",{v:1,persona:i.persona,band:Se(i.confidence),slots:i.slots,layoutOrder:i.layoutOrder,savedAt:Date.now()}),d(A),A},getSlotResult(l){var u,g,v;return(v=(g=i==null?void 0:i.slots[l])!=null?g:(u=e.initialSlots)==null?void 0:u[l])!=null?v:null},getSlotConfig(l){var u,g;return(g=(u=e.initialSlotConfig)==null?void 0:u[l])!=null?g:null},getSitePalette(){var l;return(l=e.initialPalette)!=null?l:null},reportSlots(){},getPersona(){let l=i!=null?i:a;return l?{persona:l.persona,confidence:l.confidence,band:Se(l.confidence)}:null},async assign(l,u){var g;let v=await c;return!v||!u||u.length===0?u!=null&&u[0]?{variantId:u[0],assignmentTtlMs:0}:null:{variantId:(g=v.createLocalEngine({sessionId:r,forcedPersona:o}).decide({components:[{id:l,variantIds:u}]}).assignments[l])!=null?g:u[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>n.destroy()}}function st(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(st):!1}var vn="sentient-reveal",Ie="sentient-revealed";var _t=!1;function lo(e){if(_t||e.getElementById(vn)){_t=!0;return}let t=e.createElement("style");t.id=vn,t.textContent=`@media (prefers-reduced-motion: no-preference){@keyframes ${Ie}{from{opacity:.55;transform:translateY(2px)}to{opacity:1;transform:none}}.${Ie}{animation:${Ie} 240ms cubic-bezier(.2,.6,.2,1) both}}`,e.head.appendChild(t),_t=!0}function Rt(e,t={}){var n;let r=(n=t.doc)!=null?n:typeof document!="undefined"?document:void 0;if(!r||!(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;lo(r),e.classList.remove(Ie),e.offsetWidth,e.classList.add(Ie);let o=()=>{e.classList.remove(Ie),e.removeEventListener("animationend",o)};return e.addEventListener("animationend",o),!0}function Ue(e,t,n,r){let o=[];{let c=!1,i=[],s=()=>{if(c)return;let a=Date.now();for(i.push(a);i.length>0&&a-i[0]>500;)i.shift();i.length>=3&&(c=!0,e("rage_click"))};t.addEventListener("click",s),o.push(()=>t.removeEventListener("click",s))}{let c=!1,i=s=>{if(c||!(s.target instanceof Node)||!t.contains(s.target)&&t!==s.target)return;c=!0;let a=typeof window!="undefined"?window.getSelection():null,d=a?a.toString().length:0;e("text_copy",{selectionLength:d})};document.addEventListener("copy",i),o.push(()=>document.removeEventListener("copy",i))}{let c=!1,i=!1,s=null,a=()=>{s!==null&&(clearTimeout(s),s=null)},d=()=>{c||!i||(a(),s=setTimeout(()=>{!c&&i&&(c=!0,e("scroll_hesitation"))},3e3))},l=()=>{a(),d()},u=v=>{for(let w of v)i=w.intersectionRatio>.3,i?d():a()},g=new IntersectionObserver(u,{threshold:[.3]});g.observe(t),window.addEventListener("scroll",l,{passive:!0}),o.push(()=>{g.disconnect(),window.removeEventListener("scroll",l),a()})}if((r==null?void 0:r.tabLoss)!==!1){let c=!1,i=n!=null?n:Date.now(),s=()=>{if(c||document.visibilityState!=="hidden")return;let a=Date.now()-i;a<15e3&&(c=!0,e("tab_loss",{timeOnPage:a}))};document.addEventListener("visibilitychange",s),o.push(()=>document.removeEventListener("visibilitychange",s))}return()=>{for(let c of o)c()}}function co(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var _n="https://api.sentient-ui.com/v1/events",ne=new Map,Cn=null;function uo(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var fo=3;function Ct(){return bn()}function ot(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function po(){let e=new WeakMap,t=new Map,n=!1,r=(s,a,d)=>{let l=s.get(a);return d===null?l?!0:(s.set(a,new Set),!1):l?l.has(d)?!0:(l.add(d),!1):(s.set(a,new Set([d])),!1)},o=typeof window!="undefined"&&"event"in window,c=()=>{if(!o)return;let s=window.event;return typeof Event=="function"&&s instanceof Event?s:void 0},i=()=>{if(o){Promise.resolve().then(()=>{n=!1,t.clear()});return}let s=!1,a=()=>{s||(s=!0,n=!1,t.clear())};if(setTimeout(a,0),typeof MessageChannel=="function"){let d=new MessageChannel;d.port1.onmessage=()=>{d.port1.close(),d.port2.close(),a()},d.port2.postMessage(0)}};return{firedBefore(s,a){let d=c();if(d){let u=e.get(d);return u||(u=new Map,e.set(d,u)),r(u,s,a)}let l=r(t,s,a);return!l&&!n&&(n=!0,i()),l}}}var On=new Set;function go(e,t,n){let r=typeof window=="undefined"?null:window.history;if(!r)return()=>{};let o=!1,c,i=()=>{if(o)return;let d=ot();!d||d===c||(c=d,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${d}`))},s=[];for(let d of["pushState","replaceState"]){let l=r[d],u=function(...g){let v=l.apply(this,g);return i(),v};r[d]=u,s.push([d,l,u])}window.addEventListener("popstate",i);let a=ot();return a&&On.has(`${t}:${a}`)?c=a:i(),()=>{if(!o){o=!0,window.removeEventListener("popstate",i);for(let[d,l,u]of s)r[d]===u&&(r[d]=l)}}}var Ne={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>{}};function mo(){try{return cn(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function In(e){return e.replace(/\/events\/?$/,"")}function Ae(){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(e=>e==="1"||e==="yes")}function Pt(e){var t;if(typeof window=="undefined")return;let n=e!=null?e:Cn;if(!n){console.warn("[sentient] grantConsent() called before init()");return}let r=ne.get(n);if(!r){console.warn("[sentient] grantConsent() called before init()");return}let{config:o,upgrade:c,reinit:i}=r;if(!c){r.upgradeBlockedReason&&console.warn(r.upgradeBlockedReason);return}if(o.respectDoNotTrack!==!1&&Ae())return;let s=(i!=null?i:Fe)(we(D({},o),{consent:!0}));c(s);let a=(t=ne.get(n))==null?void 0:t.dispose;ne.set(n,{config:we(D({},o),{consent:!0}),upgrade:null,dispose:a})}function ho(e){var t;let n=e.preConsentBehavior==="statistical_winner",r=In((t=e.ingestUrl)!=null?t:_n),o={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},c=new Map,i=new Map,s={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(l,u,g){if(!n)return Promise.resolve(null);let v=c.get(l);return v?Promise.resolve(v):It(i,l,async()=>{try{let w=new URLSearchParams({componentId:l});for(let E of u!=null?u:[])w.append("variantIds[]",E);let A=await fetch(`${r}/winner?${w.toString()}`,{headers:o});if(!A.ok)return u!=null&&u[0]?{variantId:u[0],assignmentTtlMs:0}:null;let P={variantId:(await A.json()).variantId,assignmentTtlMs:0};return c.set(l,P),P}catch(w){return u!=null&&u[0]?{variantId:u[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>{}},a={track:l=>s.track(l),goal:((l,u,g,v)=>s.goal(l,u,g,v)),componentGoal:(l,u,g)=>s.componentGoal(l,u,g),identify:l=>s.identify(l),getAssignment:(l,u)=>s.getAssignment(l,u),assign:(l,u,g,v)=>s.assign(l,u,g,v),decide:l=>s.decide(l),getSlotResult:l=>s.getSlotResult(l),getSlotConfig:l=>s.getSlotConfig(l),getSitePalette:()=>s.getSitePalette(),reportSlots:(l,u)=>s.reportSlots(l,u),getPersona:()=>s.getPersona(),fetchWeights:()=>s.fetchWeights(),getGraph:()=>s.getGraph(),dispose:()=>s.dispose(),destroy:()=>s.destroy()};function d(l){s=l}return{proxy:a,setInner:d}}function It(e,t,n){let r=e.get(t);if(r)return r;let o=(async()=>{try{return await n()}finally{e.delete(t)}})();return e.set(t,o),o}function Fe(e){var t,n,r,o,c,i,s,a,d,l;if(typeof window=="undefined")return Ne;Cn=e.apiKey||"local";let u=ne.get(e.apiKey||"local");if(u!=null&&u.dispose)try{u.dispose()}catch(p){}let g=e.respectDoNotTrack!==!1&&Ae(),v=e.consent===!1||g,w=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!w&&e.localMode!==!1)return ne.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."}),v?Ne:ao(e);if(v){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."),ne.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."}),Ne;let{proxy:p,setInner:y}=ho(e);return ne.set(e.apiKey,{config:e,upgrade:g?null:y}),p}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."),Ne;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),Ne;let A=(t=e.ingestUrl)!=null?t:_n,P=Date.now(),E=wn({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),L=oo(void 0,e.apiKey),f=Qr({ingestUrl:A,apiKey:e.apiKey}),m=In(A),O={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},x=new Set,S=no({url:`${m}/goals`,apiKey:e.apiKey,headers:O,onDrop:(p,y)=>{if(!e.debug){if(x.has(y))return;x.add(y)}console.warn(`[sentient] goal dropped (HTTP ${y}) \u2014 this will not be retried. `+(y===400?"The session was not found: call init() and let the session upsert complete before firing goals.":y===401||y===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),p)}}),$=sn((n=navigator.userAgent)!=null?n:""),R=window.location.origin,F=an((r=document.referrer)!=null?r:"",R),G=(o=e.sessionSegment)!=null?o:`${$}:${F}`,q=new Map,le=new Map,b=new Map,h=new Map,C=null,_=null,T=new Set,te=new Set,Y=new Map,oe=null,ie=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,_e=new Set,Ut=p=>{for(let y of p)b.has(y.id)||b.set(y.id,Et(y))};if(e.initialSlots)for(let[p,y]of Object.entries(e.initialSlots))b.set(p,y);if(e.initialSlotConfig)for(let[p,y]of Object.entries(e.initialSlotConfig))h.set(p,y);e.initialPalette&&(C=e.initialPalette);let fe=je(e.apiKey);if(fe){for(let[p,y]of Object.entries(fe.slots))b.has(p)||b.set(p,y);for(let[p,y]of Object.entries((c=fe.slotConfig)!=null?c:{}))h.has(p)||h.set(p,y);!C&&fe.palette&&(C=fe.palette)}let Ft={low:.15,medium:.5,high:.85};if(e.initialPersona)_=D({},e.initialPersona);else{let p=document.documentElement.dataset;p.sentientPersona?_={persona:p.sentientPersona,confidence:(s=Ft[(i=p.sentientConfidence)!=null?i:"low"])!=null?s:.15}:fe&&(_={persona:fe.persona,confidence:(a=Ft[fe.band])!=null?a:.15})}if(e.initialAssignments)for(let[p,y]of Object.entries(e.initialAssignments))L.set(p,G,{variantId:y,assignedAt:Date.now(),segment:G,confidence:1});let pe=Promise.resolve(),zt=E.getSessionId();if(zt){let p=ln((d=document.referrer)!=null?d:""),{utmParams:y,clickIds:I}=mo(),z=D(D(D(D({sessionId:zt,deviceClass:$,trafficSource:F,referrerDomain:p,utmParams:y,clickIds:I,timeOfDay:un(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:E.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||on((l=navigator.userAgent)!=null?l:"")},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}:{}),U=async()=>{for(let M=0;;M++){try{let B=await fetch(`${m}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(z),headers:O});if(B.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(B.ok||Lt(B)==="dropped")return}catch(B){}if(M>=fo){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(B=>setTimeout(B,Ke(M+1)))}};try{pe=U()}catch(M){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:f});let br=po(),De=null,St=!1,Ce={goal(p,y={},I=1,z=0){var U,M,B,J,Q,be,ge;let Me=E.getSessionId();if(!Me)return;let ee=uo(y)?y:{metadata:y},Be=[p,(U=ee.externalId)!=null?U:"",(M=ee.stepIndex)!=null?M:z,(B=ee.weight)!=null?B:I].join("\0"),N=ee.value!==void 0?`${ee.value}\0${(J=ee.currency)!=null?J:""}`:null;if(br.firedBefore(Be,N)){e.debug&&console.log(`[sentient] goal("${p}") already recorded for this action \u2014 not sent twice`);return}let ce=Ct(),Ye={sessionId:Me,name:p,metadata:(Q=ee.metadata)!=null?Q:{},weight:(be=ee.weight)!=null?be:I,stepIndex:(ge=ee.stepIndex)!=null?ge:z,goalId:ce,value:ee.value,currency:ee.currency,externalId:ee.externalId};e.debug&&console.log("[sentient] goal",Ye);let V={id:ce,body:JSON.stringify(Ye)};pe.then(()=>S.send(V))},componentGoal(p,y,I){var z,U,M;let B=E.getSessionId();if(!B)return;let J=L.get(p,G),Q=J?null:(z=b.get(p))!=null?z:null;if(!J&&Q===null){e.debug&&console.warn(`[sentient] componentGoal("${p}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}let be=J?J.variantId:dn(Q),ge={id:Ct(),sessionId:B,projectId:e.apiKey,componentId:p,variantId:be,eventType:"goal_achieved",goalType:y,payload:D({reward:(U=I==null?void 0:I.reward)!=null?U:1,goalValue:I==null?void 0:I.value,currency:I==null?void 0:I.currency},(M=I==null?void 0:I.metadata)!=null?M:{}),timestamp:Date.now(),timeInSession:Date.now()-P,path:ot()};e.debug&&console.log("[sentient] componentGoal",ge),pe.then(()=>f.push(ge))},identify(p){let y=E.getSessionId();y&&pe.then(()=>{fetch(`${m}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:y,userId:p,ephemeral:E.isEphemeral()}),headers:O}).catch(()=>{})})},track(p){let y=E.getSessionId();if(!y)return;let I=we(D({path:ot()},p),{id:Ct(),sessionId:y,timestamp:Date.now(),timeInSession:Date.now()-P});e.debug&&console.log("[sentient] track",I),pe.then(()=>f.push(I))},getAssignment(p,y){return L.get(p,y)},async assign(p,y,I,z){let U=E.getSessionId();if(!U)return null;let M=L.get(p,G);if(M&&(y!=null&&y.length||M.content!==void 0)){let B=M.ttlMs&&M.ttlMs>0?Math.max(0,M.assignedAt+M.ttlMs-Date.now()):0;return{variantId:M.variantId,assignmentTtlMs:B,content:M.content}}return It(q,p,async()=>{await pe;try{let B={sessionId:U,componentId:p,variantIds:y};z!==void 0?B.agentDataByVariant=z:I!==void 0&&(B.agentData=I);let J=await fetch(`${m}/assign`,{method:"POST",body:JSON.stringify(B),headers:O});if(!J.ok)return null;let Q=await J.json();return L.set(p,G,D({variantId:Q.variantId,assignedAt:Date.now(),segment:G,confidence:1,content:Q.content},Q.assignmentTtlMs&&Q.assignmentTtlMs>0?{ttlMs:Q.assignmentTtlMs}:{})),Q}catch(B){return null}})},async decide(p){var y,I;let z=E.getSessionId();if(!z)return null;let U=(y=p.slots)!=null?y:[],M={sessionId:z};p.sections&&p.sections.length>0&&(M.sections=p.sections.map(J=>({id:J}))),M.components=(I=p.components)!=null?I:[],U.length>0&&(M.slots=U.map(xt)),p.slotsFrom==="registry"&&(M.slotsFrom="registry"),p.v&&(M.v=p.v),typeof p.pp=="number"&&(M.pp=p.pp),e.persona&&(M.persona=e.persona);let B=JSON.stringify(M);return It(le,B,async()=>{var J,Q,be,ge,Me,ee;await pe;try{let Be=await fetch(`${m}/decide`,{method:"POST",body:B,headers:O});if(!Be.ok)return Ut(U),null;let N=await Be.json(),ce={};for(let V of U){let se=(J=N.slots)==null?void 0:J[V.id];if(se!==void 0){ce[V.id]=se,b.set(V.id,se);continue}let Wt=b.get(V.id);if(Wt!==void 0)ce[V.id]=Wt;else{let qt=Et(V);ce[V.id]=qt,b.set(V.id,qt)}}if(N.slots)for(let[V,se]of Object.entries(N.slots))V in ce||(ce[V]=se,b.set(V,se));let Ye=_!=null&&_.persona!=="unknown";N.persona&&!(N.persona==="unknown"&&Ye)?_={persona:N.persona,confidence:(Q=N.confidence)!=null?Q:0}:_||(_={persona:"unknown",confidence:0});for(let[V,se]of Object.entries((be=N.assignments)!=null?be:{}))L.set(V,G,{variantId:se,assignedAt:Date.now(),segment:G,confidence:1});if(N.slotConfig)for(let[V,se]of Object.entries(N.slotConfig))h.set(V,se);return N.palette&&(C=N.palette),Ge(e.apiKey,D(D({v:1,persona:_.persona,band:Se(_.confidence),slots:Object.fromEntries(b),layoutOrder:(ge=N.layoutOrder)!=null?ge:null,savedAt:Date.now()},h.size>0?{slotConfig:Object.fromEntries(h)}:{}),C?{palette:C}:{})),D(D(D(D({layoutOrder:(Me=N.layoutOrder)!=null?Me:null,assignments:(ee=N.assignments)!=null?ee:{},slots:ce,persona:_.persona,confidence:_.confidence},N.slotConfig?{slotConfig:N.slotConfig}:{}),N.goals?{goals:N.goals}:{}),N.sectionMap?{sectionMap:N.sectionMap}:{}),N.palette?{palette:N.palette}:{})}catch(Be){return Ut(U),null}})},getSlotResult(p){var y;return(y=b.get(p))!=null?y:null},getSlotConfig(p){var y;return(y=h.get(p))!=null?y:null},reportSlots(p,y){for(let I of p)if(!(typeof I!="string"||I.length===0)){if(!ie.test(I)){co()&&!_e.has(I)&&(_e.add(I),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(I)} 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(!T.has(I)){T.add(I),te.add(I);let z=y==null?void 0:y[I];if(typeof z=="string"){let U=z.replace(/\s+/g," ").trim().slice(0,400);U!==""&&Y.set(I,U)}}}te.size===0||oe!=null||(oe=setTimeout(()=>{oe=null;let I=[...te];te.clear();for(let z=0;z<I.length;z+=20){let U=I.slice(z,z+20),M={};for(let B of U){let J=Y.get(B);J!==void 0&&(M[B]=J,Y.delete(B))}fetch(`${m}/slots/observed`,{method:"POST",headers:O,body:JSON.stringify(D({slotIds:U},Object.keys(M).length>0?{baselineTexts:M}:{}))}).catch(()=>{})}},1e3))},getSitePalette(){return C},getPersona(){return _?{persona:_.persona,confidence:_.confidence,band:Se(_.confidence)}:null},async fetchWeights(){var p;try{let y=await fetch(`${m}/weights`,{headers:O});return y.ok?(p=(await y.json()).components)!=null?p:[]:[]}catch(y){return[]}},getGraph(){return{pageNodes:[],capturedAt:0}},dispose(){var p;De==null||De(),St=!0,f.destroy(),S.destroy(),((p=ne.get(e.apiKey))==null?void 0:p.dispose)===Ce.dispose&&ne.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var p;De==null||De(),St=!0,f.destroy(),S.destroy(),E.destroy(),L.clear(),((p=ne.get(e.apiKey))==null?void 0:p.dispose)===Ce.dispose&&ne.delete(e.apiKey);try{localStorage.removeItem(it+e.apiKey),localStorage.removeItem(xn(e.apiKey)),localStorage.removeItem(En(e.apiKey))}catch(y){}e.debug&&console.log("[sentient] destroyed")}};if(ne.set(e.apiKey,{config:e,upgrade:null,dispose:Ce.dispose}),De=go(Ce,e.apiKey,p=>{pe.then(()=>{St||On.add(p)})}),e.debug){let p=window;p.__sentient&&(p.__sentient.client=Ce)}return Ce}var yo=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function Tt(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function vo(e){return{tag:e.tagName.toLowerCase(),text:Tt(e).slice(0,40)}}function Ln(e){return e.replace(/["\\\]]/g,"\\$&")}function ze(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function Rn(e,t){var n;let r=e.tagName.toLowerCase();if(!r)return null;let o=((n=e.getAttribute("class"))!=null?n:"").split(/\s+/).filter(s=>/^[a-zA-Z][\w-]*$/.test(s)),c=[r,...o.map(s=>`${r}.${s}`)];for(let s of c)if(ze(t,s))return s;let i=e.parentElement;if(i&&i!==t){let s=Rn(i,t);if(s){for(let u of c){let g=`${s} > ${u}`;if(ze(t,g))return g}let a=Array.from(i.children).filter(u=>u.tagName.toLowerCase()===r),d=a.indexOf(e),l=a.some(u=>u!==e&&Tt(u)!==Tt(e));if(d>=0&&l){let u=`${s} > ${r}:nth-of-type(${d+1})`;if(ze(t,u))return u}}}return null}function Pn(e,t){let n=vo(e),r=e.getAttribute("id");if(r&&ze(t,`#${Ln(r)}`))return{v:1,id:r,fingerprint:n};for(let c of yo){let i=e.getAttribute(c);if(i&&ze(t,`[${c}="${Ln(i)}"]`))return{v:1,dataAttr:{name:c,value:i},fingerprint:n}}let o=Rn(e,t);return o?{v:1,selector:o,fingerprint:n}:null}$e();var Dn=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],bo={banner:"hero",navigation:"navigation",contentinfo:"footer"};function wo(e){let t=e.ariaRole?bo[e.ariaRole.toLowerCase()]:void 0;if(t)return t;if(e.tag==="nav")return"navigation";if(e.tag==="footer")return"footer";if(e.tag==="header")return e.actionCount>=5?"navigation":"hero";let n=`${e.idClass} ${e.headingText}`.toLowerCase();return/\b(navbar|nav-bar|navigation|site-nav|main-nav|topbar|footer)\b/.test(n)?/footer/.test(n)?"footer":"navigation":/\b(hero|masthead|jumbotron)\b/i.test(e.idClass)?"hero":null}function So(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var Ao=[["pricing",/\b(pricing|price list|per month|\/mo|subscriptions?)\b|\bplans?\b(?=[^.]{0,40}(from|start|month|year|[$€£]))/i],["faq",/\bfaq\b|frequently asked|common questions?/i],["comparison",/\b(compare|comparison|versus)\b|\bvs\./i],["social_proof",/\b(reviews?|ratings?|testimonial|brands?|galler(y|ies)|logos)\b|trusted by|loved by|case stud|what our customers say/i],["trust",/\b(insurance|warrant(y|ies)|guarantees?|certifi|accredit|security|privacy|compliance|gdpr|encrypt)\b|why choose|about us|our team/i],["cta",/\b(book|booking|reserve|appointments?|newsletter|subscribe)\b|contact us|get in touch|opening hours/i],["features",/\b(features?|benefits?|capabilit|services?|repairs?|menus?|products?)\b|how it works|our process|what we (do|offer)|what you get/i]],Dt=[["pricing",/(?:[$€£]\s?\d[\d,.]*\s*(?:\/|per\s)\s*(?:mo|month|yr|year|seat|user))|(?:\b(?:starter|basic|pro|growth|premium|enterprise)\b[^.]{0,60}[$€£]\s?\d)/i],["social_proof",/(?:★{2,})|(?:\b\d(?:\.\d)?\s*(?:out of|\/)\s*5\b)|(?:\brated\b)|(?:["“][^"”]{20,160}["”]\s*[—–-]\s*[A-Z][a-z]+)/],["trust",/\b(?:money[- ]back guarantee|free returns?|returns? within|refund(?:s)? within|encrypted|soc ?2|iso ?27001|gdpr[- ]compliant|cancel anytime)\b/i],["comparison",/\b(?:vs|versus)\b\.?[^.!?]{0,80}\b(?:compare|comparison|plans?|features?|alternative)\b|\bhow (?:we|it) compares?\b/i]],Tn={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function xo(e){var t;let n=e.querySelector("h1, h2, h3");return((t=n==null?void 0:n.textContent)!=null?t:"").slice(0,160)}function Mn(e){var t,n;let r=wo(e);if(r)return{type:(t=Tn[r])!=null?t:"generic",strength:"strong"};let o=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[i,s]of Ao)if(s.test(o))return{type:i,strength:"strong"};for(let[i,s]of Dt)if(s.test(e.bodyText))return{type:i,strength:"strong"};let c=So(e);return{type:(n=Tn[c])!=null?n:"generic",strength:"weak"}}function Bn(e){var t,n;let r=((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim(),o=e.getAttribute("role");return D({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((n=e.className)!=null?n:"")}`,headingText:xo(e),bodyText:r.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:r.length},o?{ariaRole:o}:{})}$e();var Eo="section, header, footer, nav, main > div, [data-sentient-section]",ko=2e4;function _o(e){let t=Array.from(e.querySelectorAll(Eo)),n=t.filter(r=>t.filter(o=>o!==r&&r.contains(o)).length<2);return n.filter(r=>!n.some(o=>o!==r&&o.contains(r)))}function Co(e,t,n,r){try{fetch(`${t}/v1/section-map`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${e}`},body:JSON.stringify({pageUrl:n,sections:r})}).catch(()=>{})}catch(o){}}var $n=()=>{};function Nn(e,t){var n,r,o,c,i,s,a,d,l,u,g,v;let w=(n=t.doc)!=null?n:typeof document!="undefined"?document:void 0;if(!w||typeof IntersectionObserver=="undefined"||Ae()||!t.apiKey||!t.apiKey.startsWith("pk_"))return $n;let A=((r=t.apiBase)!=null?r:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),P=_o(w);if(P.length===0)return $n;let E=new Map,L=[];for(let h of P){let C=h.getAttribute("data-sentient-type"),_=C&&Dn.includes(C)?C:null,T=Bn(h),te=(c=_!=null?_:(o=t.typeOf)==null?void 0:o.call(t,h))!=null?c:Mn(T).type,Y=Pn(h,w),oe=Y?`nc-${te}-${nn(JSON.stringify({id:(i=Y.id)!=null?i:null,dataAttr:(s=Y.dataAttr)!=null?s:null,selector:(a=Y.selector)!=null?a:null})).toString(36)}`:`nc-${te}`;E.set(h,oe);let ie=Dt.filter(([,_e])=>_e.test(T.bodyText)).map(([_e])=>_e);L.push(we(D({componentId:oe,semanticType:te,source:_?"markup":"auto"},Y?{locator:Y}:{}),{observation:D(D({tag:T.tag,idClass:T.idClass.slice(0,200),headingText:T.headingText,textLength:T.textLength,actionCount:T.actionCount},T.ariaRole?{ariaRole:T.ariaRole}:{}),ie.length>0?{patternFlags:ie}:{})}))}let f=(g=(u=(l=(d=w.defaultView)!=null?d:typeof window!="undefined"?window:void 0)==null?void 0:l.location)==null?void 0:u.pathname)!=null?g:"/";Co(t.apiKey,A,f,L);let m=new Map,O=h=>{let C=m.get(h);return C||(C={ms:0,scroll:0,enterAt:null,intersecting:!1},m.set(h,C)),C},x=new IntersectionObserver(h=>{for(let C of h){let _=E.get(C.target);if(!_)continue;let T=O(_);C.isIntersecting?(T.intersecting=!0,T.enterAt=Date.now(),C.intersectionRatio>T.scroll&&(T.scroll=C.intersectionRatio)):(T.intersecting=!1,T.enterAt!=null&&(T.ms+=Date.now()-T.enterAt,T.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let h of E.keys())x.observe(h);let S=()=>{let h=Date.now();for(let[C,_]of m)if(_.enterAt!=null&&(_.ms+=h-_.enterAt,_.enterAt=null),!(_.ms<=0)){try{e.track({projectId:t.apiKey,componentId:C,eventType:"dwell",payload:{dwell_time:Math.round(_.ms),scroll_depth:Number(_.scroll.toFixed(2))}})}catch(T){}_.ms=0}},$=()=>{if(w.hidden)S();else{let h=Date.now();for(let C of m.values())C.intersecting&&(C.enterAt=h)}},R=!1,F=h=>{if(S(),h!=null&&h.persisted){R=!0;return}try{x.disconnect()}catch(C){}},G=h=>{if(!(h!=null&&h.persisted)||!R)return;R=!1;let C=Date.now();for(let _ of m.values())_.enterAt=_.intersecting&&!w.hidden?C:null};w.addEventListener("visibilitychange",$);let q=(v=w.defaultView)!=null?v:typeof window!="undefined"?window:void 0;q==null||q.addEventListener("pagehide",F),q==null||q.addEventListener("pageshow",G);let le=setInterval(()=>{if(w.hidden||R)return;S();let h=Date.now();for(let C of m.values())C.intersecting&&(C.enterAt=h)},ko),b=[];return t.microSignals&&[...E.entries()].forEach(([h,C],_)=>{b.push(Ue((T,te={})=>{try{e.track({projectId:t.apiKey,componentId:C,eventType:"micro_signal",payload:D({signalType:T},te)})}catch(Y){}},h,void 0,{tabLoss:_===0}))}),()=>{S(),clearInterval(le),w.removeEventListener("visibilitychange",$),q==null||q.removeEventListener("pagehide",F),q==null||q.removeEventListener("pageshow",G);for(let h of b)h();try{x.disconnect()}catch(h){}}}var Oo=["landing","ecommerce","saas","marketplace"];function Io(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;let t=Object.entries(e);if(t.length<1||t.length>4)return null;let n={};for(let[r,o]of t){if(!Array.isArray(o)||o.length<2||o.length>6||!o.every(c=>typeof c=="string"))return null;n[r]=o}return n}function Lo(e){return!Array.isArray(e)||e.length<2||e.length>12||!e.every(t=>typeof t=="string")?null:e}function Ro(e){try{return e()}catch(t){return}}function at(e){if(typeof e!="object"||e===null)return null;let t=e;if(typeof t.apiKey!="string"||!t.apiKey.startsWith("pk_"))return null;let n=Oo.includes(t.context)?t.context:"landing",r={};if(typeof t.slots=="object"&&t.slots!==null&&!Array.isArray(t.slots))for(let[i,s]of Object.entries(t.slots)){if(typeof s!="object"||s===null)continue;let a=s,d=Io(a.dims);if(!d||a.target!==void 0&&typeof a.target!="string")continue;let l=a.arms!==void 0?Lo(a.arms):null,u={dims:d};typeof a.target=="string"&&(u.target=a.target),l&&(u.arms=l),r[i]=u}let o={apiKey:t.apiKey,context:n,personaAttributes:t.personaAttributes===!0,slots:r};typeof t.consent=="boolean"&&(o.consent=t.consent),(t.preConsentBehavior==="statistical_winner"||t.preConsentBehavior==="control")&&(o.preConsentBehavior=t.preConsentBehavior),t.debug===!0&&(o.debug=!0),typeof t.registry=="boolean"&&(o.registry=t.registry),typeof t.editorSrc=="string"&&(o.editorSrc=t.editorSrc),typeof t.apiBase=="string"&&(o.apiBase=t.apiBase),typeof t.sectionCapture=="boolean"&&(o.sectionCapture=t.sectionCapture);let c=typeof t.persona=="function"?Ro(t.persona):t.persona;if(typeof c=="string"&&c.trim()!==""&&(o.persona=c),Array.isArray(t.sections)){let i=t.sections.filter(s=>typeof s=="string"&&s.trim()!=="").slice(0,50);i.length>=2&&(o.sections=i)}return o}function lt(e){var n,r,o;let t=(r=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0)==null?void 0:r.location;return(o=t==null?void 0:t.pathname)!=null?o:""}function Po(e,t){var n;if(t.tag&&e.tagName.toLowerCase()!==t.tag.toLowerCase())return!1;if(t.text){let r=((n=e.textContent)!=null?n:"").replace(/\s+/g," ").trim().toLowerCase(),o=t.text.replace(/\s+/g," ").trim().toLowerCase();if(!(r===o||r.startsWith(o)||o.startsWith(r)))return!1}return!0}function Kn(e,t){return!!(e!=null&&e.urlMatch)&&!lt(t).includes(e.urlMatch)}var To=/^[a-zA-Z_][-a-zA-Z0-9_]*$/;function me(e,t){var o;if(e.urlMatch&&!lt(t).includes(e.urlMatch))return null;let n=[];if(e.id){let c=t.getElementById(e.id);n=c?[c]:[]}if(n.length===0&&((o=e.dataAttr)!=null&&o.name)&&To.test(e.dataAttr.name))try{let c=e.dataAttr.value.replace(/["\\]/g,"\\$&");n=Array.from(t.querySelectorAll(`[${e.dataAttr.name}="${c}"]`))}catch(c){n=[]}if(n.length===0&&e.selector)try{n=Array.from(t.querySelectorAll(e.selector))}catch(c){n=[]}if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!Po(r,e.fingerprint)?null:r}var jn={color:"color",background:"background",fontSize:"font-size",fontWeight:"font-weight",textAlign:"text-align",padding:"padding",margin:"margin",borderRadius:"border-radius",width:"width",height:"height",maxWidth:"max-width",border:"border",boxShadow:"box-shadow",opacity:"opacity",lineHeight:"line-height",letterSpacing:"letter-spacing",textTransform:"text-transform",gap:"gap",fontFamily:"font-family"},Do=/^(rgb|rgba|hsl|hsla|calc|var|min|max|clamp)$/i;function Gn(e){var r;if(e.trim().length===0||/[;{}<>]/.test(e))return!1;let t=/([A-Za-z-]*)\(/g,n;for(;(n=t.exec(e))!==null;)if(!Do.test((r=n[1])!=null?r:""))return!1;return!0}var Un=/^https:\/\//i,Fn=new Map,he=null;function Mo(e){return e.replace(/["\\]/g,"\\$&")}function Bo(e){var t;(!he||!he.isConnected)&&(he=e.querySelector("style[data-sentient-ops]"),he||(he=e.createElement("style"),he.setAttribute("data-sentient-ops",""),((t=e.head)!=null?t:e.documentElement).appendChild(he))),he.textContent=[...Fn.entries()].map(([n,r])=>`[data-snt-e="${Mo(n)}"]{${r}}`).join(`
2
+ `)}function zn(e,t,n,r){var s;let o=!1,c=(s=t.moveBefore)!=null?s:t.moveAfter;if(c){let a=me(c,r);!a||a===e||a.parentElement!==e.parentElement||!e.parentElement?o=!0:t.moveBefore?e.parentElement.insertBefore(e,a):e.parentElement.insertBefore(e,a.nextSibling)}typeof t.text=="string"&&(e.textContent=t.text),typeof t.href=="string"&&Un.test(t.href)&&e.setAttribute("href",t.href),typeof t.imageSrc=="string"&&Un.test(t.imageSrc)&&e.setAttribute("src",t.imageSrc),typeof t.imageAlt=="string"&&e.setAttribute("alt",t.imageAlt);let i=[];if(t.hidden&&i.push("display:none !important"),t.style)for(let[a,d]of Object.entries(t.style)){let l=jn[a];l&&typeof d=="string"&&Gn(d)&&i.push(`${l}:${d.trim()} !important`)}return i.length>0&&(e.setAttribute("data-snt-e",n),Fn.set(n,i.join(";")),Bo(r)),{anchorMiss:o}}var We="data-sentient-block-arm",k=null;function qe(e){k=e!=null?e:null}var ue="data-sentient-blocks-hid",Le={none:"0",sm:"8px",md:"16px",lg:"24px"},Mt={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},Wn={sm:"0.875em",md:"1em",lg:"1.25em"},$o={sm:"1.25em",md:"1.5em",lg:"2em"},No={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},qn={sm:"8px",md:"16px",lg:"32px"},Ko={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},jo={normal:"400",medium:"500",bold:"700"};function re(e,t){for(let[n,r]of Object.entries(t))r!==void 0&&e.style.setProperty(n,r);return e}function Hn(e){return e==="muted"?k!=null&&k.muted?{color:k.muted}:{opacity:"0.7"}:e==="accent"?{"font-weight":"600",color:k==null?void 0:k.accent}:{}}function Jn(e,t){var n,r,o,c,i,s,a,d,l,u,g,v,w,A,P,E,L,f,m,O;try{switch(e.type){case"stack":case"grid":{let x=t.createElement("div");if(e.type==="stack"){let R=e;re(x,{display:"flex","flex-direction":R.direction,gap:(r=Le[(n=R.gap)!=null?n:"md"])!=null?r:Le.md,"align-items":R.align?Mt[R.align]:void 0,"justify-content":R.justify?Mt[R.justify]:void 0,"flex-wrap":R.wrap?"wrap":void 0})}else{let R=e,F=(c=Le[(o=R.gap)!=null?o:"md"])!=null?c:Le.md;re(x,{display:"grid","grid-template-columns":`repeat(auto-fit, minmax(max(200px, calc((100% - ${R.columns-1} * ${F}) / ${R.columns})), 1fr))`,gap:F,"align-items":R.align?Mt[R.align]:void 0})}let S=e.type==="stack"&&e.surface==="raised",$=(i=e.pad)!=null?i:S?"md":void 0;$&&re(x,{padding:(s=Le[$])!=null?s:Le.md}),S&&re(x,{background:k==null?void 0:k.surface,color:k!=null&&k.surface?k==null?void 0:k.surfaceText:void 0,border:`1px solid ${(a=k==null?void 0:k.border)!=null?a:"currentColor"}`,"border-radius":(d=k==null?void 0:k.radius)!=null?d:"8px"});for(let R of(l=e.children)!=null?l:[]){let F=Jn(R,t);F&&x.appendChild(F)}return x}case"text":{let x=t.createElement("p");return x.textContent=e.value,re(x,Ze(W({margin:"0","font-size":e.size?Wn[e.size]:void 0,"font-weight":e.weight?jo[e.weight]:void 0,"text-align":e.align},Hn(e.tone)),{"max-width":e.maxWidth==="measure"?"65ch":void 0}))}case"heading":{let x=t.createElement(`h${e.level}`);return x.textContent=e.value,re(x,{margin:"0","font-size":$o[(u=e.size)!=null?u:"md"],"text-align":e.align,"max-width":e.maxWidth==="measure"?"65ch":void 0})}case"button":{let x=t.createElement("a");x.textContent=e.label,x.href=e.href,e.tag&&x.setAttribute("data-sentient-tag",e.tag);let S=(g=e.emphasis)!=null?g:"primary";return re(x,{display:"inline-block",padding:No[(v=e.size)!=null?v:"md"],"border-radius":(w=k==null?void 0:k.radius)!=null?w:"8px",font:"inherit","font-size":e.size?Wn[e.size]:void 0,"text-decoration":S==="ghost"?"underline":"none",cursor:"pointer",background:S==="primary"?(A=k==null?void 0:k.primaryBg)!=null?A:"#111827":"transparent",color:S==="primary"?(P=k==null?void 0:k.primaryText)!=null?P:"#ffffff":(E=k==null?void 0:k.accent)!=null?E:"inherit",border:S==="secondary"?`1px solid ${(L=k==null?void 0:k.accent)!=null?L:"currentColor"}`:"none"})}case"link":{let x=t.createElement("a");return x.textContent=e.label,x.href=e.href,e.tag&&x.setAttribute("data-sentient-tag",e.tag),re(x,{color:"inherit","text-decoration":"underline"})}case"image":{let x=t.createElement("img");return x.src=e.src,x.alt=e.alt,re(x,{display:"block","max-width":"100%","aspect-ratio":e.ratio&&e.ratio!=="auto"?Ko[e.ratio]:void 0,"object-fit":e.fit,width:e.ratio&&e.ratio!=="auto"?"100%":void 0})}case"badge":{let x=t.createElement("span");return x.textContent=e.value,re(x,W({display:"inline-block",padding:"2px 10px","border-radius":"999px","font-size":"0.75em",border:`1px solid ${(f=k==null?void 0:k.border)!=null?f:"currentColor"}`},Hn(e.tone)))}case"spacer":return re(t.createElement("div"),{height:(m=qn[e.size])!=null?m:qn.md});case"divider":return re(t.createElement("hr"),{border:"none","border-top":`1px solid ${(O=k==null?void 0:k.border)!=null?O:"currentColor"}`,margin:"0",width:"100%"});default:return null}}catch(x){return null}}function Vn(e,t,n,r){try{let o=new Set;for(let i of Array.from(e.children)){let s=i.getAttribute(We);s!==null&&(t[s]===void 0?i.remove():o.add(s))}for(let[i,s]of Object.entries(t)){if(o.has(i))continue;let a=Jn(s,r);if(!a)continue;let d=r.createElement("div");d.setAttribute(We,i),d.style.display="none",d.appendChild(a),e.appendChild(d)}let c=n!==void 0&&t[n]!==void 0;for(let i of Array.from(e.children)){let s=i.getAttribute(We),a=i;s!==null?a.style.display=c&&s===n?"":"none":c?a.hasAttribute(ue)||(a.setAttribute(ue,a.style.display),a.style.display="none"):a.hasAttribute(ue)&&(a.style.display=a.getAttribute(ue),a.removeAttribute(ue))}}catch(o){}}function Go(e){try{for(let t of Array.from(e.children)){let n=t;if(n.getAttribute(We)!==null){n.remove();continue}n.hasAttribute(ue)&&(n.style.display=n.getAttribute(ue),n.removeAttribute(ue))}}catch(t){}}function ct(e,t){try{let n=new Set;for(let r of Array.from(e.querySelectorAll(`[${We}]`)))r.parentElement&&n.add(r.parentElement);for(let r of Array.from(e.querySelectorAll(`[${ue}]`)))r.parentElement&&n.add(r.parentElement);for(let r of n)t.has(r)||Go(r)}catch(n){}}function Bt(e,t){if(!e)return[t.documentElement];try{return Array.from(t.querySelectorAll(e))}catch(n){return[]}}function ut(e,t,n,r){n.documentElement.setAttribute("data-sentient-persona",e),n.documentElement.setAttribute("data-sentient-confidence",t),r==null||r(n.documentElement,"data-sentient-persona"),r==null||r(n.documentElement,"data-sentient-confidence")}function dt(e,t,n,r){var o;for(let[c,i]of Object.entries(t)){let s=e[c];if(!s||typeof s=="string")continue;let a=Bt(i.target,n);for(let d of a)for(let[l,u]of Object.entries(s))(o=i.dims[l])!=null&&o.includes(u)&&(d.setAttribute(`data-${l}`,u),r==null||r(d,`data-${l}`))}}function ft(e,t,n,r){for(let[o,c]of Object.entries(t)){let i=e[o];if(typeof i!="string"||!c.arms||!c.arms.includes(i))continue;let s=Bt(c.target,n);for(let a of s)a.setAttribute("data-sentient-arm",i),r==null||r(a,"data-sentient-arm")}}function pt(e,t,n,r){var s,a,d,l;let o=new Set,c=(s=r==null?void 0:r.contentAndOps)!=null?s:!0,i=[];for(let[u,g]of Object.entries(t)){if(Kn(g.locator,n))continue;let v;if(g.locator){let A=me(g.locator,n);v=A?[A]:[]}else v=Bt(g.target,n);(g.locator||g.target)&&v.length===0&&i.push(u);let w=e[u];for(let A of v){if(w!==void 0)if(typeof w=="string")A.setAttribute("data-sentient-arm",w),(a=r==null?void 0:r.onAttr)==null||a.call(r,A,"data-sentient-arm"),c&&((d=r==null?void 0:r.onApplied)==null||d.call(r,u,w,A));else for(let[E,L]of Object.entries(w))A.setAttribute(`data-${E}`,L),(l=r==null?void 0:r.onAttr)==null||l.call(r,A,`data-${E}`);if(g.blocks&&!Fo(n)){let E=Object.fromEntries(Object.entries(g.blocks).filter(([,L])=>!st(L)));Object.keys(E).length>0&&(Vn(A,E,typeof w=="string"?w:void 0,n),o.add(A))}if(!c)continue;let P=A.textContent;typeof g.content=="string"&&(A.textContent=g.content),g.ops&&zn(A,g.ops,u,n).anchorMiss&&!i.includes(u)&&i.push(u),Rt(A,Ze(W(W({previous:P},typeof w=="string"?{arm:w}:{}),(r==null?void 0:r.persona)!==void 0?{persona:r.persona}:{}),{doc:n}))}}return ct(n,o),i}var Uo=/bot|crawler|spider|crawling|googlebot|bingbot|duckduckbot|baiduspider|yandexbot|slurp|gptbot|claudebot|anthropic|perplexity|ccbot|applebot|headlesschrome/i;function Fo(e){var t,n,r;try{let o=(n=(t=e.defaultView)!=null?t:typeof window!="undefined"?window:void 0)==null?void 0:n.navigator;return o?o.webdriver===!0?!0:Uo.test((r=o.userAgent)!=null?r:""):!1}catch(o){return!1}}var zo=800;function gt(e,t,n){let r=[];return n.forEach(({slotId:o,arm:c,el:i},s)=>{r.push(Ue((g,v={})=>{try{e.track({projectId:t,componentId:o,variantId:c,eventType:"micro_signal",payload:W({signalType:g},v)})}catch(w){}},i,void 0,{tabLoss:s===0}));let a=null,d=0,l=()=>{d=Date.now(),a=setTimeout(()=>{try{e.track({projectId:t,componentId:o,variantId:c,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-d}})}catch(g){}a=null},zo)},u=()=>{a!==null&&(clearTimeout(a),a=null)};i.addEventListener("mouseenter",l),i.addEventListener("mouseleave",u),r.push(()=>{i.removeEventListener("mouseenter",l),i.removeEventListener("mouseleave",u),a!==null&&clearTimeout(a)})}),()=>{for(let o of r)o()}}function Wo(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 Xn(e){return e?`_snt_fired_goals_${e.slice(0,12)}`:"_snt_fired_goals"}var qo="_snt_fired_goals";function Zn(e,t){try{e==null||e.sessionStorage.removeItem(Xn(t)),e==null||e.sessionStorage.removeItem(qo)}catch(n){}}function Yn(e){var t;return[(t=e.slotId)!=null?t:"",e.goalId,e.event,e.locator?JSON.stringify(e.locator):""].join("|")}function Ho(e,t){try{let n=e==null?void 0:e.sessionStorage.getItem(t);if(!n)return new Set;let r=JSON.parse(n);return Array.isArray(r)?new Set(r.filter(o=>typeof o=="string")):new Set}catch(n){return new Set}}function Jo(e,t,n){try{e==null||e.sessionStorage.setItem(t,JSON.stringify([...n]))}catch(r){}}function mt(e,t,n,r){var E,L;let o=(E=n.defaultView)!=null?E:typeof window!="undefined"?window:null,c=Xn(r),i=Ho(o,c),s=f=>{let m=Yn(f);if(!i.has(m))try{f.slotId?t.componentGoal(f.slotId,f.goalId):t.goal(f.goalId),i.add(m),Jo(o,c,i)}catch(O){}},a=e.filter(f=>f.event==="click"),d=e.filter(f=>f.event==="form_submit"),l=e.filter(f=>f.event==="url_reached"),u=e.filter(f=>f.event==="scroll_depth"),g=(f,m)=>{if(!f.locator)return!1;let O=me(f.locator,n);return!!O&&(O===m||O.contains(m))},v=f=>{let m=f.target;if(!(!m||typeof m.closest!="function"))for(let O of a)g(O,m)&&s(O)},w=f=>{let m=f.target;if(m)for(let O of d)g(O,m)&&s(O)},A=()=>{if(l.length===0)return;let f=lt(n);for(let m of l)m.urlPattern&&Wo(m.urlPattern,f)&&s(m)},P=()=>{var O;let f=n.documentElement,m=f.scrollHeight>0?(f.scrollTop+f.clientHeight)/f.scrollHeight:0;for(let x of u)m>=((O=x.threshold)!=null?O:.75)&&s(x);u.every(x=>i.has(Yn(x)))&&n.removeEventListener("scroll",P)};return n.addEventListener("click",v,!0),n.addEventListener("submit",w,!0),(L=n.defaultView)==null||L.addEventListener("popstate",A),A(),u.length>0&&(n.addEventListener("scroll",P,{passive:!0}),P()),{checkUrl:A,teardown:()=>{var f;n.removeEventListener("click",v,!0),n.removeEventListener("submit",w,!0),(f=n.defaultView)==null||f.removeEventListener("popstate",A),u.length>0&&n.removeEventListener("scroll",P)}}}function ht(e,t){if(!e||e.length<2||t.size!==e.length)return null;let n=[];for(let i of e){let s=t.get(i);if(!s||n.includes(s))return null;n.push(s)}let r=n[0].parentNode;if(!r||!n.every(i=>i.parentNode===r))return null;let o=n.slice().sort((i,s)=>i.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),c=[];for(let i=0;i<n.length;i++){let s=n[i];o[i]!==s&&(c.push({el:s,before:o[i]}),o.splice(o.indexOf(s),1),o.splice(i,0,s))}return c}var Qn="__snt_editor_token";function er(){try{return typeof sessionStorage!="undefined"?sessionStorage.getItem(Qn):null}catch(e){return null}}function tr(e){try{sessionStorage.setItem(Qn,e)}catch(t){}}var Ve="0.26.0",bt=Ve!=="0.0.0-dev"?{name:"snippet",version:Ve}:void 0,cr=5e3,Vo=50,ur=(()=>{try{if(typeof window=="undefined")return[];let e=window.SentientSnippet;return Array.isArray(e==null?void 0:e.q)?e.q:[]}catch(e){return[]}})(),Z=null,K=null,de={},ve=null,H=null,ye=null,X=null,ae=null,j=null,xe=null,nr=!1,$t=null,yt=null,wt=null,Re=!1,He=!1,ke=!1;function dr(e,t){let n,r=new Promise(o=>{n=setTimeout(()=>o(null),t)});return Promise.race([e,r]).then(o=>(clearTimeout(n),o),o=>{throw clearTimeout(n),o})}function Ee(e,...t){e!=null&&e.debug&&console.log("[sentient-snippet]",...t)}function Pe(e,t){return Z?(Z.personaAttributes&&j&&ut(j.persona,j.band,e,t==null?void 0:t.onAttr),dt(de,Z.slots,e,t==null?void 0:t.onAttr),ft(de,Z.slots,e,t==null?void 0:t.onAttr),ve?pt(de,ve,e,W(W({},t),j?{persona:j.persona}:{})):(ct(e,new Set),[])):[]}function fr(e){var n;let t=new Map;for(let r of(n=Z==null?void 0:Z.sections)!=null?n:[])try{let o=e.querySelectorAll(r);o.length===1&&t.set(r,o[0])}catch(o){}return t}function Nt(e,t){var n,r;try{if(!e||e.length<2)return;for(let o of(n=ht(e,fr(t)))!=null?n:[])(r=o.before.parentNode)==null||r.insertBefore(o.el,o.before)}catch(o){}}function Yo(e,t,n){let r=(o,c)=>t.some(([i,s])=>i===o&&s===c);try{if(Array.isArray(e.stamped))for(let o of e.stamped){if(!Array.isArray(o))continue;let[c,i,s]=o;!c||typeof i!="string"||r(c,i)||(s==null?c.removeAttribute(i):c.setAttribute(i,s))}if(Array.isArray(e.html))for(let o of e.html)typeof o!="string"||r(n.documentElement,o)||n.documentElement.removeAttribute(o)}catch(o){}}function Xo(){try{let e=window.__sntPP;return e&&typeof e=="object"&&typeof e.v=="number"?e:null}catch(e){return null}}function pr(e){return e.apiBase?`${e.apiBase.replace(/\/+$/,"")}/v1/events`:void 0}function Zo(e,t){var n;if(t.length!==0)try{let r=(n=e.apiBase)!=null?n:"https://api.sentient-ui.com";fetch(`${r}/v1/locator-miss`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${e.apiKey}`},body:JSON.stringify({slots:t})}).catch(()=>{})}catch(r){}}function Te(){return!!(Z&&K&&Z.sectionCapture!==!1&&(Z.consent!==!1||He)&&!Ae())}function Qo(){if(!K||!Z||!Te()||ae)return;let e=[];Pe(document,{contentAndOps:Re,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),jt();try{X==null||X(),X=gt(K,Z.apiKey,e)}catch(t){}}function jt(){if(typeof document=="undefined"||!Te())return;let e;try{if(yt&&yt.length>0){let t=new Map;for(let n of yt){if(n.urlMatch!==window.location.pathname)continue;let r=me(n.locator,document);r&&t.set(r,n.type)}t.size>0&&(e=n=>{var r;return(r=t.get(n))!=null?r:null})}}catch(t){}try{ae=Nn(K,W({apiKey:Z.apiKey,apiBase:Z.apiBase,doc:document,microSignals:!0},e?{typeOf:e}:{})),wt=window.location.pathname}catch(t){}}function Gt(){try{let e=[];if(X==null||X(),X=null,Pe(document,{contentAndOps:Re,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),Nt(xe,document),e.length>0&&Te())try{X=gt(K,Z.apiKey,e)}catch(t){}try{typeof window!="undefined"&&wt!==null&&window.location.pathname!==wt&&Te()&&(ae==null||ae(),ae=null,jt())}catch(t){}}catch(e){}}function rr(){$t===null&&($t=setTimeout(()=>{$t=null,Gt();try{H==null||H.checkUrl()}catch(e){}},Vo))}function Kt(){if(!(nr||typeof window=="undefined"||typeof history=="undefined")){nr=!0;try{let e=t=>{let n=history[t];history[t]=function(r,o,c){let i=n.call(this,r,o,c!=null?c:null);return rr(),i}};e("pushState"),e("replaceState"),window.addEventListener("popstate",rr)}catch(e){}}}function vt(e){let t={};for(let[n,r]of Object.entries(e.slots))try{t[n]=r.target?document.querySelectorAll(r.target).length:1}catch(o){t[n]=0}return t}function gr(e){return new URLSearchParams(e).get("sentient_editor")}function ei(){try{let e=Array.from(document.getElementsByTagName("script")),t=/(^|\/)snippet(\.global)?\.js(\?|$)/,n=e.find(r=>t.test(r.src));if(n!=null&&n.src)return n.src.replace(t,"$1editor.global.js$3")}catch(e){}return null}function ti(e,t){var n,r,o,c;try{window.__sentientEditor={token:t,apiBase:(n=e.apiBase)!=null?n:"https://api.sentient-ui.com"};try{let a=document.createElement("meta");a.name="referrer",a.content="no-referrer",a.setAttribute("data-sentient-editor",""),((r=document.head)!=null?r:document.documentElement).appendChild(a)}catch(a){}let i=(o=e.editorSrc)!=null?o:ei();if(!i){ir();return}let s=document.createElement("script");s.src=i,s.async=!0,s.onerror=()=>ir(),((c=document.head)!=null?c:document.documentElement).appendChild(s)}catch(i){}}var or="sentient-editor-load-notice",mr={position:"fixed",bottom:"16px",zIndex:"2147483647",background:"#111827",color:"#fff",boxShadow:"0 10px 34px rgba(0,0,0,0.45)"};function ir(){var e,t;try{if(typeof document=="undefined"||document.getElementById(or))return;(e=document.querySelector('meta[name="referrer"][data-sentient-editor]'))==null||e.remove();let n=document.createElement("div");n.id=or,n.textContent="Couldn\u2019t load the editor \u2014 check your connection and reopen it from your dashboard.",Object.assign(n.style,mr,{right:"16px",maxWidth:"320px",padding:"14px 16px",borderRadius:"14px",font:"13px/1.45 system-ui, sans-serif",border:"1px solid rgba(245,158,11,0.6)",cursor:"pointer"}),n.addEventListener("click",()=>n.remove()),((t=document.body)!=null?t:document.documentElement).appendChild(n),setTimeout(()=>n.remove(),1e4)}catch(n){}}function hr(e){let t=new URLSearchParams(e).get("sentient_preview");if(!t)return null;let n={};for(let r of t.split("|")){let o=r.indexOf(":"),c=o===-1?"":r.slice(0,o),i=o===-1?"":r.slice(o+1);if(!(!c||!i))if(i.includes("=")){let s={};for(let a of i.split(",")){let[d,l]=a.split("=");d&&l&&(s[d]=l)}Object.keys(s).length&&(n[c]=s)}else n[c]=i}return Object.keys(n).length?n:null}function yr(e){try{return new URLSearchParams(e).get("sentient_persona")||null}catch(t){return null}}var sr="sentient-persona-preview-banner";function ar(e,t){var n;try{if(typeof document=="undefined"||document.getElementById(sr))return;let r=e.charAt(0).toUpperCase()+e.slice(1).replace(/[_-]+/g," "),o=document.createElement("div");o.id=sr,o.setAttribute("role","status"),Object.assign(o.style,mr,{left:"50%",transform:"translateX(-50%)",display:"flex",alignItems:"center",gap:"12px",padding:"10px 14px",borderRadius:"999px",font:"13px/1 system-ui, sans-serif",border:"1px solid rgba(255,255,255,0.14)"});let c=document.createElement("span");c.textContent=t?`\u201C${e}\u201D isn\u2019t in your personas \u2014 showing the default experience`:`Previewing as ${r}`;let i=document.createElement("button");i.type="button",i.textContent="Exit preview",Object.assign(i.style,{cursor:"pointer",border:"1px solid rgba(255,255,255,0.3)",background:"transparent",color:"#fff",font:"inherit",padding:"4px 10px",borderRadius:"999px"}),i.addEventListener("click",()=>{try{let s=new URL(window.location.href);s.searchParams.delete("sentient_persona"),window.location.href=s.pathname+s.search+s.hash}catch(s){}}),o.appendChild(c),o.appendChild(i),((n=document.body)!=null?n:document.documentElement).appendChild(o)}catch(r){}}async function ni(e,t){var d,l,u,g,v,w,A,P,E,L;let n=(d=e.apiBase)!=null?d:"https://api.sentient-ui.com",o=((l=e.registry)!=null?l:Object.keys(e.slots).length===0)?{persona:t,slotsFrom:"registry"}:{persona:t,slots:Object.entries(e.slots).map(([f,m])=>({id:f,dims:m.dims}))},c=await dr(fetch(`${n}/v1/explain`,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${e.apiKey}`},body:JSON.stringify(o)}).then(f=>f.ok?f.json():null).catch(()=>null),cr);if(!c){Je(e),Ee(e,"persona preview: explain unavailable \u2014 page left as-is");return}let i=c;de=(u=i.slots)!=null?u:{},ve=(g=i.slotConfig)!=null?g:null,qe(i.palette);let s=(A=(w=(v=i.personaAttributes)==null?void 0:v.persona)!=null?w:i.persona)!=null?A:t,a=(E=(P=i.personaAttributes)==null?void 0:P.confidence)!=null?E:"high";j={persona:s,band:a},Pe(document),Re=!0,Kt(),Je(e),i.recognized===!1?ar(t,!0):ar((L=i.personaDisplay)!=null?L:s)}function Je(e){let t={goal(n,r){try{K==null||K.goal(n,r)}catch(o){}},componentGoal(n,r){try{K==null||K.componentGoal(n,r)}catch(o){}},grantConsent(){try{!K&&ke?(K=Fe(W({apiKey:e.apiKey,context:e.context,consent:!0,preConsentBehavior:e.preConsentBehavior,debug:e.debug,persona:e.persona,ingestUrl:pr(e)},bt?{sdk:bt}:{})),ye&&ye.length>0&&(H==null||H.teardown(),H=mt(ye,K,document,e.apiKey))):(Pt(e.apiKey),K&&ye&&ye.length>0&&(H==null||H.teardown(),H=mt(ye,K,document,e.apiKey))),ke=!1}catch(n){}He=!0;try{Qo()}catch(n){}},revokeConsent(){try{ae==null||ae(),ae=null,wt=null,X==null||X(),X=null,H==null||H.teardown(),H=null,Zn(typeof window!="undefined"?window:null,e.apiKey),He=!1,ke=!0,K==null||K.destroy(),K=null}catch(n){}},reapply:Gt,getState(){var n,r;try{return{apiKey:e.apiKey,persona:(n=j==null?void 0:j.persona)!=null?n:null,band:(r=j==null?void 0:j.band)!=null?r:null,slots:de,matchCounts:vt(e),consent:!ke&&(e.consent!==!1||He)}}catch(o){return{apiKey:e.apiKey,persona:null,band:null,slots:{},matchCounts:{},consent:!1}}}};window.SentientSnippet=t;for(let n of ur.splice(0))try{n[0]==="goal"&&t.goal(n[1],n[2])}catch(r){}}function lr(){var e;try{if(typeof window=="undefined")return;let t=window;if(typeof((e=t.SentientSnippet)==null?void 0:e.goal)=="function")return;let n=()=>{};t.SentientSnippet={goal:n,componentGoal:n,grantConsent:n,revokeConsent:n,reapply:n,getState:()=>({apiKey:"",persona:null,band:null,slots:{},matchCounts:{},consent:!1})},ur.length=0}catch(t){}}async function vr(){var e,t;try{let n=at(window.sentient);if(!n){lr();return}Z=n,Re=!1,xe=null,qe(null),He=!1,ke=!1,ye=null;let r=typeof window!="undefined"?gr(window.location.search):null;if(r){tr(r);try{let f=new URL(window.location.href);f.searchParams.delete("sentient_editor"),window.history.replaceState(null,"",f.pathname+f.search+f.hash)}catch(f){}}let o=r!=null?r:er();if(o){ti(n,o),Je(n),Ee(n,"editor mode");return}let c=typeof window!="undefined"?hr(window.location.search):null;if(c){de=c,j=null,Pe(document),Kt(),Je(n),Ee(n,"preview mode",c);return}let i=typeof window!="undefined"?yr(window.location.search):null;if(i){await ni(n,i),Ee(n,"persona preview",i);return}let s=(e=n.registry)!=null?e:Object.keys(n.slots).length===0,a=Xo();try{(t=a==null?void 0:a.stop)==null||t.call(a)}catch(f){}let d=je(n.apiKey),l=[];d&&(j={persona:d.persona,band:d.band},de=d.slots,d.slotConfig&&(ve=d.slotConfig),d.palette&&qe(d.palette),Pe(document,W({contentAndOps:!1},a?{onAttr:(f,m)=>l.push([f,m])}:{})),d.layoutOrder&&(xe=d.layoutOrder,Nt(xe,document))),a&&Yo(a,l,document);let u=Fe(W({apiKey:n.apiKey,context:n.context,consent:n.consent,preConsentBehavior:n.preConsentBehavior,debug:n.debug,persona:n.persona,ingestUrl:pr(n)},bt?{sdk:bt}:{}));K=u,Je(n),Kt();let g=Object.entries(n.slots).map(([f,m])=>({id:f,dims:m.dims})),v=Ve!=="0.0.0-dev"?{v:Ve}:{},w={pp:a?a.v:0},A=Array.from(fr(document).keys()),P=u.decide(W(W(W(W({slots:g},v),w),A.length>=2?{sections:A}:{}),s?{slotsFrom:"registry"}:{})),E=await dr(P,cr),L=f=>{var x,S,$,R,F,G;let m=u.getPersona();m?j={persona:m.persona,band:m.band}:f.persona&&(j={persona:f.persona,band:"low"}),de=f.slots,s?ve=(x=f.slotConfig)!=null?x:null:f.slotConfig&&(ve=f.slotConfig),f.palette&&qe(f.palette),xe=(S=f.layoutOrder)!=null?S:xe;let O=()=>{let q=[];if(Zo(n,Pe(document,{onApplied:(le,b,h)=>q.push({slotId:le,arm:b,el:h})})),Nt(xe,document),Re=!0,Te())try{X==null||X(),X=gt(K,n.apiKey,q)}catch(le){}};if(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",O,{once:!0}):O(),ye=($=f.goals)!=null?$:null,f.goals&&f.goals.length>0&&n.consent!==!1&&K)try{H==null||H.teardown(),H=mt(f.goals,K,document,n.apiKey)}catch(q){}yt=(R=f.sectionMap)!=null?R:null,Te()&&jt(),Ee(n,"applied",{persona:j,slots:de,matches:vt(n)}),!ke&&Ge(n.apiKey,W(W({v:1,persona:(F=j==null?void 0:j.persona)!=null?F:f.persona,band:(G=j==null?void 0:j.band)!=null?G:"low",slots:f.slots,layoutOrder:f.layoutOrder,savedAt:Date.now()},ve?{slotConfig:ve}:{}),f.palette?{palette:f.palette}:{}))};if(!E){Ee(n,"decide timeout/null \u2014 snapshot state stands",vt(n)),P.then(f=>{!f||Re||ke||K!==u||(L(f),Ee(n,"late decide applied",vt(n)))}).catch(()=>{});return}L(E)}catch(n){lr()}}if(typeof window!="undefined"&&window.sentient){let e=window;e.__sentientInitialized||(e.__sentientInitialized=!0,Promise.resolve().then(()=>{vr()}))}return _r(ri);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentientui/snippet",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "private": false,
5
5
  "description": "SentientUI Style-rung snippet for non-React sites — persona attributes and adaptive style tokens from one script tag",
6
6
  "license": "MIT",
@@ -38,7 +38,7 @@
38
38
  "tsx": "^4.19.2",
39
39
  "typescript": "^5.7.2",
40
40
  "vitest": "^2.1.8",
41
- "@sentientui/core": "0.28.0"
41
+ "@sentientui/core": "0.29.0"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "tsup",