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