@sentientui/snippet 0.35.0 → 0.36.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/README.md CHANGED
@@ -27,6 +27,10 @@ so it is not reproduced here):
27
27
  stageAttributes: true, // optional: sets data-sentient-stage on <html> (see below)
28
28
  persona: () => window.myApp?.role, // optional: declare the role your site already knows
29
29
  // (string or function; must be a key from Matrix → Audiences)
30
+ userId: () => window.myApp?.user?.id, // optional: your own id for a signed-in visitor (string,
31
+ // number or function). Links their devices and lets someone
32
+ // who already signed up or bought be recognised as such.
33
+ // Never an email address — one is ignored.
30
34
  sections: ['#hero', '#pricing', '#faq'], // optional: sections eligible for reordering,
31
35
  // CSS selectors in your theme's natural order
32
36
  slots: {
@@ -1,5 +1,5 @@
1
1
  "use strict";var __sentientEditorBundle=(()=>{var Ft=Object.defineProperty,kr=Object.defineProperties,Sr=Object.getOwnPropertyDescriptor,Er=Object.getOwnPropertyDescriptors,Tr=Object.getOwnPropertyNames,Ut=Object.getOwnPropertySymbols;var mn=Object.prototype.hasOwnProperty,co=Object.prototype.propertyIsEnumerable;var lo=(e,t,n)=>t in e?Ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,K=(e,t)=>{for(var n in t||(t={}))mn.call(t,n)&&lo(e,n,t[n]);if(Ut)for(var n of Ut(t))co.call(t,n)&&lo(e,n,t[n]);return e},le=(e,t)=>kr(e,Er(t));var uo=e=>typeof e=="symbol"?e:e+"",po=(e,t)=>{var n={};for(var r in e)mn.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ut)for(var r of Ut(e))t.indexOf(r)<0&&co.call(e,r)&&(n[r]=e[r]);return n};var Cr=(e,t)=>()=>(e&&(t=e(e=0)),t);var Lr=(e,t)=>{for(var n in t)Ft(e,n,{get:t[n],enumerable:!0})},Ar=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Tr(t))!mn.call(e,s)&&s!==n&&Ft(e,s,{get:()=>t[s],enumerable:!(r=Sr(t,s))||r.enumerable});return e};var _r=e=>Ar(Ft({},"__esModule",{value:!0}),e);var Ir,$r,Br,fo,Or,Pr,go,ce,lt,hn=Cr(()=>{"use strict";Ir=Object.defineProperty,$r=Object.defineProperties,Br=Object.getOwnPropertyDescriptors,fo=Object.getOwnPropertySymbols,Or=Object.prototype.hasOwnProperty,Pr=Object.prototype.propertyIsEnumerable,go=(e,t,n)=>t in e?Ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ce=(e,t)=>{for(var n in t||(t={}))Or.call(t,n)&&go(e,n,t[n]);if(fo)for(var n of fo(t))Pr.call(t,n)&&go(e,n,t[n]);return e},lt=(e,t)=>$r(e,Br(t))});var Bi={};Lr(Bi,{buildStyleOps:()=>Mn,clearTargetHighlights:()=>mt,computeMoveAnchors:()=>en,deriveSlotId:()=>Ce,drawTargetHighlights:()=>nr,exchangeCode:()=>er,isHex6:()=>Nn,mount:()=>ir,registerAuditTargets:()=>tr,sectionTypesFor:()=>or,styleFieldError:()=>rr,toHexColor:()=>Bn});var mo;function ho(e=document){if(mo)return mo;try{let t=e.querySelector("script[nonce]");return(t==null?void 0:t.nonce)||(t==null?void 0:t.getAttribute("nonce"))||void 0}catch(t){return}}function _t(e,t=document){let n=ho(t);return n&&e.setAttribute("nonce",n),e}var Mi=1800*1e3;var yn=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function Mr(e){var n,r,s;let t=(r=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0)==null?void 0:r.location;return(s=t==null?void 0:t.pathname)!=null?s:""}function Rr(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(),s=t.text.replace(/\s+/g," ").trim().toLowerCase();if(!(r===s||r.startsWith(s)||s.startsWith(r)))return!1}return!0}var Nr=/^[a-zA-Z_][-a-zA-Z0-9_]*$/;function Dr(e,t){var r;let n=[];if(e.id){let s=t.getElementById(e.id);n=s?[s]:[]}if(n.length===0&&((r=e.dataAttr)!=null&&r.name)&&Nr.test(e.dataAttr.name))try{let s=e.dataAttr.value.replace(/["\\]/g,"\\$&");n=Array.from(t.querySelectorAll(`[${e.dataAttr.name}="${s}"]`))}catch(s){n=[]}if(n.length===0&&e.selector)try{n=Array.from(t.querySelectorAll(e.selector))}catch(s){n=[]}return n}function we(e,t){if(e.urlMatch&&!Mr(t).includes(e.urlMatch))return null;let n=Dr(e,t);if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!Rr(r,e.fingerprint)?null:r}var It={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"},Hr=/^(rgb|rgba|hsl|hsla|calc|var|min|max|clamp)$/i;function dt(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(!Hr.test((r=n[1])!=null?r:""))return!1;return!0}function bn(e){var r,s;let t=e.ownerDocument.createTreeWalker(e,4),n=null;for(let d=t.nextNode();d!==null;d=t.nextNode()){if(((r=d.nodeValue)!=null?r:"").trim()==="")continue;let m=(s=d.parentElement)==null?void 0:s.tagName;if(!(m==="SCRIPT"||m==="STYLE"||m==="TEMPLATE")){if(n!==null)return null;n=d}}return n}function vn(e){return e.childElementCount===0||bn(e)!==null}function xn(e){var t,n,r;return(r=(n=(t=bn(e))==null?void 0:t.nodeValue)!=null?n:e.textContent)!=null?r:""}function Ye(e,t){let n=bn(e);n!==null?n.nodeValue=t:e.textContent=t}var wn=/^https:\/\//i;function Wt(e){return typeof e=="string"&&!/[\s\x00-\x1f\\]/.test(e)&&(wn.test(e)||e[0]==="/"&&e[1]!=="/")?e:null}var yo=new Map,Ne=null;function zr(e){return e.replace(/["\\]/g,"\\$&")}function jr(e){var t;(!Ne||!Ne.isConnected)&&(Ne=e.querySelector("style[data-sentient-ops]"),Ne||(Ne=_t(e.createElement("style"),e),Ne.setAttribute("data-sentient-ops",""),((t=e.head)!=null?t:e.documentElement).appendChild(Ne))),Ne.textContent=[...yo.entries()].map(([n,r])=>`[data-snt-e="${zr(n)}"]{${r}}`).join(`
2
- `)}function bo(e,t,n,r){var x;let s=!1,d=(x=t.moveBefore)!=null?x:t.moveAfter;if(d){let g=we(d,r);!g||g===e||g.parentElement!==e.parentElement||!e.parentElement?s=!0:t.moveBefore?e.parentElement.insertBefore(e,g):e.parentElement.insertBefore(e,g.nextSibling)}typeof t.text=="string"&&Ye(e,t.text),typeof t.href=="string"&&wn.test(t.href)&&e.setAttribute("href",t.href),typeof t.imageSrc=="string"&&wn.test(t.imageSrc)&&e.setAttribute("src",t.imageSrc),typeof t.imageAlt=="string"&&e.setAttribute("alt",t.imageAlt);let m=[];if(t.hidden&&m.push("display:none !important"),t.style)for(let[g,k]of Object.entries(t.style)){let y=It[g];y&&typeof k=="string"&&dt(k)&&m.push(`${y}:${k.trim()} !important`)}return m.length>0&&(e.setAttribute("data-snt-e",n),yo.set(n,m.join(";")),jr(r)),{anchorMiss:s}}var kn="data-sentient-block-arm",O=null;var Je=null;function ko(e){Je=e!=null?e:null}var So=e=>{var t;return typeof e=="string"?(t=Je==null?void 0:Je.entries.find(n=>n.id===e))==null?void 0:t.classes:void 0},Eo=e=>{let t=typeof e=="string"?Je==null?void 0:Je.entries.find(n=>n.id===e):void 0;return t!=null&&t.computed.inheritsColor?t.computed.color:void 0},$t="data-sentient-blocks-hid",ct={none:"0",sm:"8px",md:"16px",lg:"24px"},Sn={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},vo={sm:"0.875em",md:"1em",lg:"1.25em"},Kr={sm:"1.25em",md:"1.5em",lg:"2em"},Gr={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},xo={sm:"8px",md:"16px",lg:"32px"},Ur={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},Fr={normal:"400",medium:"500",bold:"700"};function he(e,t){for(let[n,r]of Object.entries(t))r!==void 0&&e.style.setProperty(n,r);return e}function wo(e){return e==="muted"?O!=null&&O.muted?{color:O.muted}:{opacity:"0.7"}:e==="accent"?{"font-weight":"600",color:O==null?void 0:O.accent}:{}}function To(e,t){let n=Wr(e,t),r=Eo(e.like);return n&&r&&(n.style.color=r),n}function Wr(e,t){var n,r,s,d,m,x,g,k,y,$,L,D,E,z,J,Z,U,X,ne,Q;try{let P=So(e.like),re=e.maxWidth==="measure"?"65ch":void 0,ie=I=>(I.className=P,he(I,{"max-width":re}));switch(e.type){case"stack":case"grid":{let I=t.createElement("div");if(e.type==="stack"){let B=e;he(I,{display:"flex","flex-direction":B.direction,gap:(r=ct[(n=B.gap)!=null?n:"md"])!=null?r:ct.md,"align-items":B.align?Sn[B.align]:void 0,"justify-content":B.justify?Sn[B.justify]:void 0,"flex-wrap":B.wrap?"wrap":void 0})}else{let B=e,V=(d=ct[(s=B.gap)!=null?s:"md"])!=null?d:ct.md;he(I,{display:"grid","grid-template-columns":`repeat(auto-fit, minmax(max(200px, calc((100% - ${B.columns-1} * ${V}) / ${B.columns})), 1fr))`,gap:V,"align-items":B.align?Sn[B.align]:void 0})}P&&(I.className=P);let M=!P&&e.type==="stack"&&e.surface==="raised",q=(m=e.pad)!=null?m:M?"md":void 0;q&&he(I,{padding:(x=ct[q])!=null?x:ct.md}),M&&he(I,{background:O==null?void 0:O.surface,color:O!=null&&O.surface?O==null?void 0:O.surfaceText:void 0,border:`1px solid ${(g=O==null?void 0:O.border)!=null?g:"currentColor"}`,"border-radius":(k=O==null?void 0:O.radius)!=null?k:"8px"});for(let B of(y=e.children)!=null?y:[]){let V=To(B,t);V&&I.appendChild(V)}return I}case"text":{let I=t.createElement("p");return I.textContent=e.value,P?ie(I):he(I,le(K({margin:"0","font-size":e.size?vo[e.size]:void 0,"font-weight":e.weight?Fr[e.weight]:void 0,"text-align":e.align},wo(e.tone)),{"max-width":e.maxWidth==="measure"?"65ch":void 0}))}case"heading":{let I=t.createElement(`h${e.level}`);return I.textContent=e.value,P?ie(I):he(I,{margin:"0","font-size":Kr[($=e.size)!=null?$:"md"],"text-align":e.align,"max-width":e.maxWidth==="measure"?"65ch":void 0})}case"button":{let I=t.createElement("a");I.textContent=e.label;let M=Wt(e.href);if(M&&(I.href=M),e.tag&&I.setAttribute("data-sentient-tag",e.tag),P)return ie(I);let q=(L=e.emphasis)!=null?L:"primary";return he(I,{display:"inline-block",padding:Gr[(D=e.size)!=null?D:"md"],"border-radius":(E=O==null?void 0:O.radius)!=null?E:"8px",font:"inherit","font-size":e.size?vo[e.size]:void 0,"text-decoration":q==="ghost"?"underline":"none",cursor:"pointer",background:q==="primary"?(z=O==null?void 0:O.primaryBg)!=null?z:"#111827":"transparent",color:q==="primary"?(J=O==null?void 0:O.primaryText)!=null?J:"#ffffff":(Z=O==null?void 0:O.accent)!=null?Z:"inherit",border:q==="secondary"?`1px solid ${(U=O==null?void 0:O.accent)!=null?U:"currentColor"}`:"none"})}case"link":{let I=t.createElement("a");I.textContent=e.label;let M=Wt(e.href);return M&&(I.href=M),e.tag&&I.setAttribute("data-sentient-tag",e.tag),P?ie(I):he(I,{color:"inherit","text-decoration":"underline"})}case"image":{let I=t.createElement("img"),M=Wt(e.src);return M&&(I.src=M),I.alt=e.alt,P&&(I.className=P),he(I,{display:"block","max-width":"100%","aspect-ratio":e.ratio&&e.ratio!=="auto"?Ur[e.ratio]:void 0,"object-fit":e.fit,width:e.ratio&&e.ratio!=="auto"?"100%":void 0})}case"badge":{let I=t.createElement("span");return I.textContent=e.value,P?ie(I):he(I,K({display:"inline-block",padding:"2px 10px","border-radius":"999px","font-size":"0.75em",border:`1px solid ${(X=O==null?void 0:O.border)!=null?X:"currentColor"}`},wo(e.tone)))}case"spacer":return he(t.createElement("div"),{height:(ne=xo[e.size])!=null?ne:xo.md});case"divider":return he(t.createElement("hr"),{border:"none","border-top":`1px solid ${(Q=O==null?void 0:O.border)!=null?Q:"currentColor"}`,margin:"0",width:"100%"});default:return null}}catch(P){return null}}function Co(e,t,n,r){var s,d;try{let m=new Set;for(let g of Array.from(e.children)){let k=g.getAttribute(kn);k!==null&&(t[k]===void 0?g.remove():m.add(k))}for(let[g,k]of Object.entries(t)){if(m.has(g))continue;let y="tree"in k?k:null,$=To(y?y.tree:k,r);if(!$)continue;let L=r.createElement("div");L.setAttribute(kn,g),L.style.display="none";let D=y?So((s=y.surface)==null?void 0:s.like):void 0;if(D){let E=r.createElement("div");E.className=D;let z=Eo((d=y.surface)==null?void 0:d.like);z&&(E.style.color=z),E.appendChild($),L.appendChild(E)}else L.appendChild($);e.appendChild(L)}let x=n!==void 0&&t[n]!==void 0;for(let g of Array.from(e.children)){let k=g.getAttribute(kn),y=g;k!==null?y.style.display=x&&k===n?"":"none":x?y.hasAttribute($t)||(y.setAttribute($t,y.style.display),y.style.display="none"):y.hasAttribute($t)&&(y.style.display=y.getAttribute($t),y.removeAttribute($t))}}catch(m){}}var qr=/(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\([^()]*\)|#[0-9a-f]{3,8}\b/gi,Vr=/^rgba?\(\s*[\d.]+[,\s]+[\d.]+[,\s]+[\d.]+(?:[,\s/]+[\d.]+%?)?\s*\)$/i,Bt;function Yr(e){if(Bt!==void 0)return Bt;try{let t=e.createElement("canvas");t.width=t.height=1,Bt=t.getContext("2d",{willReadFrequently:!0})}catch(t){Bt=null}return Bt}function ke(e,t){let n=(e!=null?e:"").trim();if(n===""||n==="transparent")return n==="transparent"?"rgba(0, 0, 0, 0)":"";if(Vr.test(n)||/^#[0-9a-f]{3,8}$/i.test(n))return n;let r=Yr(t);if(!r)return"";try{if(r.fillStyle="#010203",r.fillStyle=n,String(r.fillStyle).toLowerCase()==="#010203"&&n.toLowerCase()!=="#010203")return"";r.clearRect(0,0,1,1),r.fillRect(0,0,1,1);let[s,d,m,x]=r.getImageData(0,0,1,1).data;return x===255?`rgb(${s}, ${d}, ${m})`:`rgba(${s}, ${d}, ${m}, ${Math.round(x/255*1e3)/1e3})`}catch(s){return""}}function qt(e,t){var n;return!e||e==="none"||!/gradient/i.test(e)?[]:((n=e.match(qr))!=null?n:[]).map(r=>ke(r,t)).filter(r=>r!=="")}hn();function _o(e){return e.replace(/\s+/g," ").trim().slice(0,300)}function Lo(e,t){let n=t>>>0;for(let r=0;r<e.length;r++)n^=e.charCodeAt(r),n=Math.imul(n,16777619)>>>0;return n.toString(16).padStart(8,"0")}function Io(e){let t=e.join("");return Lo(t,2166136261)+Lo(t,1523705862)}var Jr=new Set(["A","BUTTON"]),$o=/^H([1-6])$/,Xr=new Set(["P","LI","LABEL","BLOCKQUOTE","FIGCAPTION","DT","DD","TD","TH"]),Zr=new Set(["LABEL","FIGCAPTION","DT"]),Qr=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"]);function Bo(e){return Jr.has(e.tagName)||e.getAttribute("role")==="button"?!0:e.tagName==="INPUT"&&/^(submit|button)$/i.test(e.type)}function ei(e){if($o.test(e.tagName)||Xr.has(e.tagName))return!0;let t=e.ownerDocument.defaultView,n=t?t.getComputedStyle(e).display:"";return n!==""&&n!=="inline"&&n!=="contents"}function ti(e,t){let n=null;for(let r=e.parentElement;r&&r!==t.parentElement;r=r.parentElement){if(Bo(r)){n=r;break}if(r===t)break}if(n)return n;for(let r=e.parentElement;r;r=r.parentElement)if(r===t||ei(r))return r;return t}function Ao(e,t){var n,r;if(e)try{let s=new URL(e,(r=(n=t.location)==null?void 0:n.href)!=null?r:"https://relative.invalid/");return s.protocol!=="https:"&&s.protocol!=="http:"?void 0:t.location&&s.origin===t.location.origin?s.pathname:`${s.origin}${s.pathname}`}catch(s){return}}function Oo(e){return e===""||e==="transparent"||/rgba\([^)]*,\s*0\)$/.test(e)}function ni(e){let t=e.ownerDocument,n=t.defaultView;if(!n)return{bg:null};for(let r=e;r;r=r.parentElement){let s=n.getComputedStyle(r),d=qt(s.backgroundImage,t);if(d.length>0)return ce({bg:d[0]},d.length>1?{alt:d[d.length-1]}:{});let m=ke(s.backgroundColor,t);if(!Oo(m))return{bg:m}}return{bg:null}}function En(e,t=40){var n,r,s;let d=e.ownerDocument.createTreeWalker(e,4),m=[];for(let y=d.nextNode();y;y=d.nextNode())if(((n=y.nodeValue)!=null?n:"").trim()!==""&&!Qr.has((s=(r=y.parentElement)==null?void 0:r.tagName)!=null?s:"")&&(m.push(y),m.length>120))return{reason:"too_large"};if(m.length===0)return{reason:"empty"};let x=[],g=[];for(let y of m){let $=ti(y,e),L=x.indexOf($);L===-1&&(x.push($),L=x.length-1),g.push(L)}if(x.length>t)return{reason:"too_large"};let k=m.map(y=>{var $;return _o(($=y.nodeValue)!=null?$:"")});return{textNodes:m,ownerEls:x,leafToNode:g,leaves:k,fp:Io(k)}}function oi(e,t=40){var n;let r=En(e,t);if(!("fp"in r))return{skeleton:null,reason:r.reason};let{textNodes:s,ownerEls:d,leafToNode:m,leaves:x}=r,g=e.ownerDocument,k=g.defaultView,y=[],$=d.map((E,z)=>{var J,Z;let U=k==null?void 0:k.getComputedStyle(E),X=(J=E.parentElement)!=null?J:e,ne=y.indexOf(X);ne===-1&&(y.push(X),ne=y.length-1);let Q=$o.exec(E.tagName),P=Bo(E)?"action":Q?"heading":Zr.has(E.tagName)?"label":"text",re=_o(x.filter((ie,I)=>m[I]===z).join(" "));return lt(ce(lt(ce({tag:E.tagName.toLowerCase(),role:P},Q?{level:Number(Q[1])}:{}),{text:re,classes:((Z=E.getAttribute("class"))!=null?Z:"").replace(/\s+/g," ").trim()}),P==="action"?ce({filled:!!U&&(!Oo(ke(U.backgroundColor,e.ownerDocument))||U.backgroundImage!==""&&U.backgroundImage!=="none")},Ao(E.getAttribute("href"),g)!==void 0?{href:Ao(E.getAttribute("href"),g)}:{}):{}),{color:ke(U==null?void 0:U.color,e.ownerDocument),group:ne,restylable:!0})}),L=ni(e),D=k==null?void 0:k.getComputedStyle(e);return{skeleton:{v:1,root:lt(ce({tag:e.tagName.toLowerCase(),classes:((n=e.getAttribute("class"))!=null?n:"").replace(/\s+/g," ").trim(),ambientBg:L.bg},L.alt?{ambientBgAlt:L.alt}:{}),{ambientText:ke(D==null?void 0:D.color,e.ownerDocument)}),nodes:$,leaves:x,leafToNode:m,fp:Io(x)},textNodes:s,ownerEls:d}}function Po(e,t){try{let n=oi(e,t==null?void 0:t.maxNodes);return n.skeleton?{skeleton:n.skeleton}:n}catch(n){return{skeleton:null,reason:"unaddressable"}}}var Mo=new WeakMap;function Ro(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function No(e,t,n){var d,m,x;let r=Mo.get(e);if(r){if(r.fp!==n.fp||!Ro(r.leafToNode,n.leafToNode))return"mismatch"}else{let g=En(e);if(!("fp"in g)||(r={fp:g.fp,leafToNode:g.leafToNode,textNodes:g.textNodes,ownerEls:g.ownerEls,classes:g.ownerEls.map(k=>{var y;return(y=k.getAttribute("class"))!=null?y:""})},r.fp!==n.fp||!Ro(r.leafToNode,n.leafToNode)))return"mismatch";Mo.set(e,r)}let s=r;for(let[g,k]of Object.entries(t.nodes)){let y=Number(g),$=s.ownerEls[y];if($){if(typeof k.text=="string"){let L=!0;s.leafToNode.forEach((D,E)=>{D===y&&(s.textNodes[E].nodeValue=L?k.text:"",L=!1)})}k.like!==void 0&&s.classes[k.like]!==void 0&&$.setAttribute("class",s.classes[k.like]),k.hidden&&((d=$.style)==null||d.setProperty("display","none","important"))}}for(let g of Object.values((m=t.order)!=null?m:{})){let k=g.map(E=>s.ownerEls[E]).filter(E=>!!E),y=(x=k[0])==null?void 0:x.parentElement;if(!y||k.length!==g.length||k.some(E=>E.parentElement!==y))continue;let $=new Set(k),L=0;Array.from(y.children).map(E=>$.has(E)?k[L++]:E).forEach((E,z)=>{var J;y.children[z]!==E&&y.insertBefore(E,(J=y.children[z])!=null?J:null)})}return"applied"}hn();var ri=4,ii=new Set(["inline-block","block","flex","inline-flex"]),Do={H1:"heading-1",H2:"heading-2",H3:"heading-3"},Ot=null;function He(e){let t=Ot?ke(e,Ot):e,n=/rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[,\s/]+([\d.]+%?))?\s*\)/i.exec(t);if(!n)return null;let r=n[4]===void 0?1:n[4].endsWith("%")?Number.parseFloat(n[4])/100:Number(n[4]);return{r:Number(n[1]),g:Number(n[2]),b:Number(n[3]),a:r}}function Yt(e){let t=n=>{let r=n/255;return r<=.03928?r/12.92:((r+.055)/1.055)**2.4};return .2126*t(e.r)+.7152*t(e.g)+.0722*t(e.b)}function Tn(e,t){let[n,r]=[Yt(e),Yt(t)].sort((s,d)=>d-s);return(n+.05)/(r+.05)}var Jt=e=>{let t=He(e);return t!==null&&t.a>0};function Cn(e){return Ot?qt(e,Ot):[]}var De=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?t:0};function Ho(e,t){for(let n=e;n;n=n.parentElement){let r=t.getComputedStyle(n);if(Jt(r.backgroundColor))return He(r.backgroundColor);let s=Cn(r.backgroundImage);if(s.length>0)return He(s[0])}return{r:255,g:255,b:255,a:1}}var ai='#CybotCookiebotDialog, #onetrust-consent-sdk, #usercentrics-root, #usercentrics-cmp-ui, .cky-consent-container, .cky-modal, #didomi-host, #qc-cmp2-container, #cmplz-cookiebanner-container, .cc-window, #cc-main, #iubenda-cs-banner, #truste-consent-track, [id^="sp_message_container"], #termly-code-snippet-support';function si(e,t,n){if(e.closest(ai))return!0;for(let r=e;r&&r!==e.ownerDocument.body;r=r.parentElement){let s=t.getComputedStyle(r).position;if(s==="fixed"||s==="sticky"){let d=r.getBoundingClientRect().width;return d>0&&n>0&&d<.6*n}}return!1}function Vt(e){var t;for(let n of Array.from(e.childNodes))if(n.nodeType===3&&((t=n.nodeValue)!=null?t:"").trim()!=="")return!0;return!1}function li(e,t,n){var r;let s=e.tagName,d=De(t.fontSize)||n.bodySize,m=Number(t.fontWeight)||400,x=Jt(t.backgroundColor),g=Cn(t.backgroundImage).length>0,k=De(t.borderTopLeftRadius||t.borderRadius),y=e.getBoundingClientRect().width;if(s==="BUTTON"||e.getAttribute("role")==="button"||s==="INPUT"&&/^(submit|button)$/i.test(e.type)||s==="A"&&ii.has(t.display)&&De(t.paddingLeft)>=8){if(((r=e.textContent)!=null?r:"").trim()==="")return null;let L=He(t.backgroundColor),D=e.parentElement?Ho(e.parentElement,n.view):n.pageBg;return x&&L&&L.a>=.9&&Tn(L,D)>=1.5?"button-primary":x||De(t.borderTopWidth)>0?"button-secondary":"button-ghost"}if(s==="A")return"link";if(Do[s])return Do[s];if(Vt(e)&&d>=1.8*n.bodySize&&m>=600)return d>=2.5*n.bodySize?"heading-1":d>=2*n.bodySize?"heading-2":"heading-3";let $=e.nextElementSibling;if(Vt(e)&&d<=.9*n.bodySize&&(t.textTransform==="uppercase"||De(t.letterSpacing)>.05*d)&&$!==null&&/^H[1-4]$/.test($.tagName))return"eyebrow";if(s==="UL"||s==="OL")return e.querySelectorAll(":scope > li").length>=2?"list":null;if(s==="P"&&Vt(e)){if(d>=1.1*n.bodySize)return"text-lead";if(d<=.85*n.bodySize)return"text-small";let L=He(t.color);return L&&Tn(L,Ho(e,n.view))<n.bodyContrast*.8?"text-muted":"text-body"}return(s==="SPAN"||s==="DIV")&&x&&Vt(e)&&e.children.length===0&&k>=999?"badge":/^(DIV|ARTICLE|LI|SECTION|ASIDE)$/.test(s)&&(x||g)&&k>0&&De(t.paddingTop)>=16&&!(y>0&&y>=.9*n.vw)?"card":/^(SECTION|DIV|HEADER|MAIN|ASIDE)$/.test(s)&&(x||g)&&e.querySelector("h1,h2,h3")!==null&&(y===0||y>=.9*n.vw)?"section":null}function zo(e,t){var n,r,s,d,m,x,g,k,y;let $=e.defaultView;if(!$||!e.body)return{entries:[],images:[]};Ot=e;let L=$.getComputedStyle(e.body),D=De(L.fontSize)||16,E=Jt(L.backgroundColor)?He(L.backgroundColor):{r:255,g:255,b:255,a:1},z=(n=He(L.color))!=null?n:{r:17,g:24,b:39,a:1},J={bodySize:D,pageBg:E,bodyContrast:Tn(z,E),view:$,vw:$.innerWidth||0},Z=(s=(r=$.location)==null?void 0:r.pathname)!=null?s:"/",U=new Date().toISOString(),X=new Map,ne=new Map,Q=new Map,P=Array.from(e.body.querySelectorAll("*")).slice(0,(d=t==null?void 0:t.maxElements)!=null?d:4e3);for(let M of P)try{if(M.tagName==="IMG"){let ee=M,Ie=((m=ee.getAttribute("alt"))!=null?m:"").trim(),Y=ee.naturalWidth||Number(ee.getAttribute("width"))||0,et=ee.naturalHeight||Number(ee.getAttribute("height"))||0,ve=ee.getAttribute("src");if(Ie&&Y>=200&&ve){let $e=new URL(ve,e.baseURI).href;$e.startsWith("https://")&&!Q.has($e)&&Q.set($e,{id:`img-${Q.size+1}`,src:$e,alt:Ie.slice(0,200),w:Y,h:et,seenOn:Z})}}let q=((x=M.getAttribute("class"))!=null?x:"").replace(/\s+/g," ").trim();if(q===""||si(M,$,J.vw))continue;let B=$.getComputedStyle(M),V=M.tagName==="IMG"?((g=M.getAttribute("alt"))!=null?g:"").trim()?"image":null:li(M,B,J);if(!V)continue;let Se=`${V}|${q}`,ze=M.getBoundingClientRect();ne.set(Se,Math.max((k=ne.get(Se))!=null?k:0,ze.width*ze.height));let _e=X.get(Se);if(_e){_e.seen.count++;continue}let ye=Cn(B.backgroundImage).map(He).filter(ee=>ee!==null),ue,je;if(Jt(B.backgroundColor))ue=ke(B.backgroundColor,e);else if(ye.length>0){let ee=[...ye].sort((Y,et)=>Yt(Y)-Yt(et)),Ie=Y=>Y.a<1?`rgba(${Y.r}, ${Y.g}, ${Y.b}, ${Y.a})`:`rgb(${Y.r}, ${Y.g}, ${Y.b})`;ue=Ie(ee[0]),ee.length>1&&(je=Ie(ee[ee.length-1]))}let pe=B.borderTopLeftRadius||B.borderRadius;X.set(Se,{id:V,role:V,classes:q,computed:ce(ce(ce(ce(ce(ce(ce({},ke(B.color,e)?{color:ke(B.color,e)}:{}),M.parentElement&&$.getComputedStyle(M.parentElement).color===B.color?{inheritsColor:!0}:{}),ue?{bg:ue}:{}),je?{bgDark:je}:{}),B.fontSize?{fontSize:B.fontSize}:{}),B.fontWeight?{fontWeight:B.fontWeight}:{}),pe&&De(pe)>0?{radius:pe}:{}),seen:{url:Z,count:1,at:U}})}catch(q){}let re=new Map;for(let M of X.values())re.set(M.role,[...(y=re.get(M.role))!=null?y:[],M]);let ie=[],I=M=>{var q;return(q=ne.get(`${M.role}|${M.classes}`))!=null?q:0};for(let[M,q]of re)q.sort((B,V)=>(M.startsWith("button-")?I(V)-I(B):0)||V.seen.count-B.seen.count).slice(0,ri).forEach((B,V)=>ie.push(lt(ce({},B),{id:V===0?M:`${M}-${V+1}`})));return{entries:ie,images:[...Q.values()]}}function jo(e){let t=globalThis;if(t.CSS&&typeof t.CSS.escape=="function")return t.CSS.escape(e);let n="";for(let r=0;r<e.length;r++){let s=e[r],d=s>="0"&&s<="9";r===0&&d||r===1&&d&&e[0]==="-"?n+=`\\3${s} `:r===0&&s==="-"&&e.length===1?n+="\\-":/[a-zA-Z0-9_-]/.test(s)?n+=s:n+=`\\${s}`}return n}function di(e,t){if(e.id)return`#${jo(e.id)}`;let n=[],r=e,s=0;for(;r&&r!==t.body&&r!==t.documentElement&&s<6;){if(r.id){n.unshift(`#${jo(r.id)}`);break}let d=r.tagName.toLowerCase(),m=r.parentElement;if(m){let x=Array.from(m.children).filter(g=>g.tagName===r.tagName);x.length>1&&(d+=`:nth-of-type(${x.indexOf(r)+1})`)}n.unshift(d),r=r.parentElement,s++}return n.join(" > ")}function Xe(e,t){var s;let n={v:1};e.id&&(n.id=e.id);for(let d of["data-framer-name","data-w-id","data-sentient-name"]){let m=e.getAttribute(d);if(m){n.dataAttr={name:d,value:m};break}}n.selector=di(e,t);let r=((s=e.textContent)!=null?s:"").trim().replace(/\s+/g," ").slice(0,80);return n.fingerprint=K({tag:e.tagName.toLowerCase()},r?{text:r}:{}),n}function ut(e,t,n){return we(e,n)===t}var Ko="__snt_editor_token";function Go(e){try{sessionStorage.setItem(Ko,e)}catch(t){}}function Pt(){try{sessionStorage.removeItem(Ko)}catch(e){}}var ci=/rgba\([^)]*,\s*0\s*\)$/,ui=/^\d+(\.\d+)?px$/;function Uo(e){var t,n;try{let r=e.defaultView;if(!r||!e.body)return null;let s=r.getComputedStyle(e.body).backgroundColor,d=e.querySelectorAll('button, [role="button"], input[type="submit"], a[class*="btn" i], a[class*="button" i]'),m=new Map;for(let L of Array.from(d).slice(0,300)){let D=L.getBoundingClientRect();if(D.width>0&&(D.width<48||D.height<24))continue;let E=r.getComputedStyle(L),z=E.backgroundColor;if(!z||z==="transparent"||z===s||ci.test(z))continue;let J=(t=(E.borderRadius||"").split(" ")[0])!=null?t:"",Z=`${z}|${E.color}|${ui.test(J)?J:"8px"}`;m.set(Z,((n=m.get(Z))!=null?n:0)+1)}let x=null,g=0;for(let[L,D]of m)D>g&&(x=L,g=D);if(!x)return null;let[k,y,$]=x.split("|");return{primaryBg:k,primaryText:y,radius:$}}catch(r){return null}}function Mt(e){let t=e.split(/[?#]/)[0]||"/";return t.length>1?t.replace(/\/+$/,"")||"/":t}function Fo(e,t){return e==="*"?"Every page":e.endsWith("/*")?`All pages under ${e.slice(0,-1)}`:e===t?`This page (${e})`:`Only on ${e}`}function Ln(e,t){let n=Mt(e),r=n.split("/").filter(Boolean),s=[n,"*"];return r.length>=2&&s.push(`/${r[0]}/*`),(t?[t,...s.filter(d=>d!==t)]:s).filter(d=>yn.test(d))}function Xt(e){let t=e.steps.length,n=e.status==="active"?"":` (${e.status})`;return`${e.display_name} \u2014 ${t} step${t===1?"":"s"}${n}`}function Zt(e,t){return e.steps.map(n=>{var r;return{value:n.step_index,label:`${n.step_index+1}. ${(r=t.get(n.goal_id))!=null?r:n.goal_id}`}})}function Wo(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}function pi(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"funnel"}function qo(e,t){let n=e.trim();return n?t.length<2?{ok:!1,error:"Pick at least 2 goals \u2014 a funnel is a sequence."}:t.length>12?{ok:!1,error:"A funnel can have at most 12 steps."}:{ok:!0,funnelId:pi(n),body:{displayName:n.slice(0,128),steps:t.map(r=>({goalId:r}))}}:{ok:!1,error:"Give the funnel a name."}}function Zo(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)>>>0;return t.toString(36)}function pt(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}function Ce(e,t,n){var x,g;let r=t.id||((x=t.dataAttr)==null?void 0:x.value)||((g=n.textContent)!=null?g:"").trim()||n.tagName,s=pt(r)||"el",d=Zo(JSON.stringify(t));return`${e}-${s}-${d}`.slice(0,128)}var fi="sentient-editor-highlight",gi="sentient-editor-selection",gt="sentient-editor-panel",tn="sentient-editor-toast",_n="sentient-editor-styles",In="sentient-editor-target-highlight",mi=10,Vo="Editor session expired. Reopen it from your dashboard to keep editing \u2014 your saved changes are safe.",Yo="Couldn\u2019t load the editor \u2014 check your connection and reopen it from your dashboard.";function Qo(){var t;if(document.getElementById(_n))return;let e=_t(document.createElement("style"));e.id=_n,e.textContent=`
2
+ `)}function bo(e,t,n,r){var w;let s=!1,d=(w=t.moveBefore)!=null?w:t.moveAfter;if(d){let g=we(d,r);!g||g===e||g.parentElement!==e.parentElement||!e.parentElement?s=!0:t.moveBefore?e.parentElement.insertBefore(e,g):e.parentElement.insertBefore(e,g.nextSibling)}typeof t.text=="string"&&Ye(e,t.text),typeof t.href=="string"&&wn.test(t.href)&&e.setAttribute("href",t.href),typeof t.imageSrc=="string"&&wn.test(t.imageSrc)&&e.setAttribute("src",t.imageSrc),typeof t.imageAlt=="string"&&e.setAttribute("alt",t.imageAlt);let m=[];if(t.hidden&&m.push("display:none !important"),t.style)for(let[g,x]of Object.entries(t.style)){let y=It[g];y&&typeof x=="string"&&dt(x)&&m.push(`${y}:${x.trim()} !important`)}return m.length>0&&(e.setAttribute("data-snt-e",n),yo.set(n,m.join(";")),jr(r)),{anchorMiss:s}}var kn="data-sentient-block-arm",O=null;var Je=null;function ko(e){Je=e!=null?e:null}var So=e=>{var t;return typeof e=="string"?(t=Je==null?void 0:Je.entries.find(n=>n.id===e))==null?void 0:t.classes:void 0},Eo=e=>{let t=typeof e=="string"?Je==null?void 0:Je.entries.find(n=>n.id===e):void 0;return t!=null&&t.computed.inheritsColor?t.computed.color:void 0},$t="data-sentient-blocks-hid",ct={none:"0",sm:"8px",md:"16px",lg:"24px"},Sn={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},vo={sm:"0.875em",md:"1em",lg:"1.25em"},Kr={sm:"1.25em",md:"1.5em",lg:"2em"},Gr={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},xo={sm:"8px",md:"16px",lg:"32px"},Ur={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},Fr={normal:"400",medium:"500",bold:"700"};function he(e,t){for(let[n,r]of Object.entries(t))r!==void 0&&e.style.setProperty(n,r);return e}function wo(e){return e==="muted"?O!=null&&O.muted?{color:O.muted}:{opacity:"0.7"}:e==="accent"?{"font-weight":"600",color:O==null?void 0:O.accent}:{}}function To(e,t){let n=Wr(e,t),r=Eo(e.like);return n&&r&&(n.style.color=r),n}function Wr(e,t){var n,r,s,d,m,w,g,x,y,$,L,D,E,z,J,Z,U,X,ne,Q;try{let P=So(e.like),re=e.maxWidth==="measure"?"65ch":void 0,ie=I=>(I.className=P,he(I,{"max-width":re}));switch(e.type){case"stack":case"grid":{let I=t.createElement("div");if(e.type==="stack"){let B=e;he(I,{display:"flex","flex-direction":B.direction,gap:(r=ct[(n=B.gap)!=null?n:"md"])!=null?r:ct.md,"align-items":B.align?Sn[B.align]:void 0,"justify-content":B.justify?Sn[B.justify]:void 0,"flex-wrap":B.wrap?"wrap":void 0})}else{let B=e,V=(d=ct[(s=B.gap)!=null?s:"md"])!=null?d:ct.md;he(I,{display:"grid","grid-template-columns":`repeat(auto-fit, minmax(max(200px, calc((100% - ${B.columns-1} * ${V}) / ${B.columns})), 1fr))`,gap:V,"align-items":B.align?Sn[B.align]:void 0})}P&&(I.className=P);let M=!P&&e.type==="stack"&&e.surface==="raised",q=(m=e.pad)!=null?m:M?"md":void 0;q&&he(I,{padding:(w=ct[q])!=null?w:ct.md}),M&&he(I,{background:O==null?void 0:O.surface,color:O!=null&&O.surface?O==null?void 0:O.surfaceText:void 0,border:`1px solid ${(g=O==null?void 0:O.border)!=null?g:"currentColor"}`,"border-radius":(x=O==null?void 0:O.radius)!=null?x:"8px"});for(let B of(y=e.children)!=null?y:[]){let V=To(B,t);V&&I.appendChild(V)}return I}case"text":{let I=t.createElement("p");return I.textContent=e.value,P?ie(I):he(I,le(K({margin:"0","font-size":e.size?vo[e.size]:void 0,"font-weight":e.weight?Fr[e.weight]:void 0,"text-align":e.align},wo(e.tone)),{"max-width":e.maxWidth==="measure"?"65ch":void 0}))}case"heading":{let I=t.createElement(`h${e.level}`);return I.textContent=e.value,P?ie(I):he(I,{margin:"0","font-size":Kr[($=e.size)!=null?$:"md"],"text-align":e.align,"max-width":e.maxWidth==="measure"?"65ch":void 0})}case"button":{let I=t.createElement("a");I.textContent=e.label;let M=Wt(e.href);if(M&&(I.href=M),e.tag&&I.setAttribute("data-sentient-tag",e.tag),P)return ie(I);let q=(L=e.emphasis)!=null?L:"primary";return he(I,{display:"inline-block",padding:Gr[(D=e.size)!=null?D:"md"],"border-radius":(E=O==null?void 0:O.radius)!=null?E:"8px",font:"inherit","font-size":e.size?vo[e.size]:void 0,"text-decoration":q==="ghost"?"underline":"none",cursor:"pointer",background:q==="primary"?(z=O==null?void 0:O.primaryBg)!=null?z:"#111827":"transparent",color:q==="primary"?(J=O==null?void 0:O.primaryText)!=null?J:"#ffffff":(Z=O==null?void 0:O.accent)!=null?Z:"inherit",border:q==="secondary"?`1px solid ${(U=O==null?void 0:O.accent)!=null?U:"currentColor"}`:"none"})}case"link":{let I=t.createElement("a");I.textContent=e.label;let M=Wt(e.href);return M&&(I.href=M),e.tag&&I.setAttribute("data-sentient-tag",e.tag),P?ie(I):he(I,{color:"inherit","text-decoration":"underline"})}case"image":{let I=t.createElement("img"),M=Wt(e.src);return M&&(I.src=M),I.alt=e.alt,P&&(I.className=P),he(I,{display:"block","max-width":"100%","aspect-ratio":e.ratio&&e.ratio!=="auto"?Ur[e.ratio]:void 0,"object-fit":e.fit,width:e.ratio&&e.ratio!=="auto"?"100%":void 0})}case"badge":{let I=t.createElement("span");return I.textContent=e.value,P?ie(I):he(I,K({display:"inline-block",padding:"2px 10px","border-radius":"999px","font-size":"0.75em",border:`1px solid ${(X=O==null?void 0:O.border)!=null?X:"currentColor"}`},wo(e.tone)))}case"spacer":return he(t.createElement("div"),{height:(ne=xo[e.size])!=null?ne:xo.md});case"divider":return he(t.createElement("hr"),{border:"none","border-top":`1px solid ${(Q=O==null?void 0:O.border)!=null?Q:"currentColor"}`,margin:"0",width:"100%"});default:return null}}catch(P){return null}}function Co(e,t,n,r){var s,d;try{let m=new Set;for(let g of Array.from(e.children)){let x=g.getAttribute(kn);x!==null&&(t[x]===void 0?g.remove():m.add(x))}for(let[g,x]of Object.entries(t)){if(m.has(g))continue;let y="tree"in x?x:null,$=To(y?y.tree:x,r);if(!$)continue;let L=r.createElement("div");L.setAttribute(kn,g),L.style.display="none";let D=y?So((s=y.surface)==null?void 0:s.like):void 0;if(D){let E=r.createElement("div");E.className=D;let z=Eo((d=y.surface)==null?void 0:d.like);z&&(E.style.color=z),E.appendChild($),L.appendChild(E)}else L.appendChild($);e.appendChild(L)}let w=n!==void 0&&t[n]!==void 0;for(let g of Array.from(e.children)){let x=g.getAttribute(kn),y=g;x!==null?y.style.display=w&&x===n?"":"none":w?y.hasAttribute($t)||(y.setAttribute($t,y.style.display),y.style.display="none"):y.hasAttribute($t)&&(y.style.display=y.getAttribute($t),y.removeAttribute($t))}}catch(m){}}var qr=/(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\([^()]*\)|#[0-9a-f]{3,8}\b/gi,Vr=/^rgba?\(\s*[\d.]+[,\s]+[\d.]+[,\s]+[\d.]+(?:[,\s/]+[\d.]+%?)?\s*\)$/i,Bt;function Yr(e){if(Bt!==void 0)return Bt;try{let t=e.createElement("canvas");t.width=t.height=1,Bt=t.getContext("2d",{willReadFrequently:!0})}catch(t){Bt=null}return Bt}function ke(e,t){let n=(e!=null?e:"").trim();if(n===""||n==="transparent")return n==="transparent"?"rgba(0, 0, 0, 0)":"";if(Vr.test(n)||/^#[0-9a-f]{3,8}$/i.test(n))return n;let r=Yr(t);if(!r)return"";try{if(r.fillStyle="#010203",r.fillStyle=n,String(r.fillStyle).toLowerCase()==="#010203"&&n.toLowerCase()!=="#010203")return"";r.clearRect(0,0,1,1),r.fillRect(0,0,1,1);let[s,d,m,w]=r.getImageData(0,0,1,1).data;return w===255?`rgb(${s}, ${d}, ${m})`:`rgba(${s}, ${d}, ${m}, ${Math.round(w/255*1e3)/1e3})`}catch(s){return""}}function qt(e,t){var n;return!e||e==="none"||!/gradient/i.test(e)?[]:((n=e.match(qr))!=null?n:[]).map(r=>ke(r,t)).filter(r=>r!=="")}hn();function _o(e){return e.replace(/\s+/g," ").trim().slice(0,300)}function Lo(e,t){let n=t>>>0;for(let r=0;r<e.length;r++)n^=e.charCodeAt(r),n=Math.imul(n,16777619)>>>0;return n.toString(16).padStart(8,"0")}function Io(e){let t=e.join("");return Lo(t,2166136261)+Lo(t,1523705862)}var Jr=new Set(["A","BUTTON"]),$o=/^H([1-6])$/,Xr=new Set(["P","LI","LABEL","BLOCKQUOTE","FIGCAPTION","DT","DD","TD","TH"]),Zr=new Set(["LABEL","FIGCAPTION","DT"]),Qr=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"]);function Bo(e){return Jr.has(e.tagName)||e.getAttribute("role")==="button"?!0:e.tagName==="INPUT"&&/^(submit|button)$/i.test(e.type)}function ei(e){if($o.test(e.tagName)||Xr.has(e.tagName))return!0;let t=e.ownerDocument.defaultView,n=t?t.getComputedStyle(e).display:"";return n!==""&&n!=="inline"&&n!=="contents"}function ti(e,t){let n=null;for(let r=e.parentElement;r&&r!==t.parentElement;r=r.parentElement){if(Bo(r)){n=r;break}if(r===t)break}if(n)return n;for(let r=e.parentElement;r;r=r.parentElement)if(r===t||ei(r))return r;return t}function Ao(e,t){var n,r;if(e)try{let s=new URL(e,(r=(n=t.location)==null?void 0:n.href)!=null?r:"https://relative.invalid/");return s.protocol!=="https:"&&s.protocol!=="http:"?void 0:t.location&&s.origin===t.location.origin?s.pathname:`${s.origin}${s.pathname}`}catch(s){return}}function Oo(e){return e===""||e==="transparent"||/rgba\([^)]*,\s*0\)$/.test(e)}function ni(e){let t=e.ownerDocument,n=t.defaultView;if(!n)return{bg:null};for(let r=e;r;r=r.parentElement){let s=n.getComputedStyle(r),d=qt(s.backgroundImage,t);if(d.length>0)return ce({bg:d[0]},d.length>1?{alt:d[d.length-1]}:{});let m=ke(s.backgroundColor,t);if(!Oo(m))return{bg:m}}return{bg:null}}function En(e,t=40){var n,r,s;let d=e.ownerDocument.createTreeWalker(e,4),m=[];for(let y=d.nextNode();y;y=d.nextNode())if(((n=y.nodeValue)!=null?n:"").trim()!==""&&!Qr.has((s=(r=y.parentElement)==null?void 0:r.tagName)!=null?s:"")&&(m.push(y),m.length>120))return{reason:"too_large"};if(m.length===0)return{reason:"empty"};let w=[],g=[];for(let y of m){let $=ti(y,e),L=w.indexOf($);L===-1&&(w.push($),L=w.length-1),g.push(L)}if(w.length>t)return{reason:"too_large"};let x=m.map(y=>{var $;return _o(($=y.nodeValue)!=null?$:"")});return{textNodes:m,ownerEls:w,leafToNode:g,leaves:x,fp:Io(x)}}function oi(e,t=40){var n;let r=En(e,t);if(!("fp"in r))return{skeleton:null,reason:r.reason};let{textNodes:s,ownerEls:d,leafToNode:m,leaves:w}=r,g=e.ownerDocument,x=g.defaultView,y=[],$=d.map((E,z)=>{var J,Z;let U=x==null?void 0:x.getComputedStyle(E),X=(J=E.parentElement)!=null?J:e,ne=y.indexOf(X);ne===-1&&(y.push(X),ne=y.length-1);let Q=$o.exec(E.tagName),P=Bo(E)?"action":Q?"heading":Zr.has(E.tagName)?"label":"text",re=_o(w.filter((ie,I)=>m[I]===z).join(" "));return lt(ce(lt(ce({tag:E.tagName.toLowerCase(),role:P},Q?{level:Number(Q[1])}:{}),{text:re,classes:((Z=E.getAttribute("class"))!=null?Z:"").replace(/\s+/g," ").trim()}),P==="action"?ce({filled:!!U&&(!Oo(ke(U.backgroundColor,e.ownerDocument))||U.backgroundImage!==""&&U.backgroundImage!=="none")},Ao(E.getAttribute("href"),g)!==void 0?{href:Ao(E.getAttribute("href"),g)}:{}):{}),{color:ke(U==null?void 0:U.color,e.ownerDocument),group:ne,restylable:!0})}),L=ni(e),D=x==null?void 0:x.getComputedStyle(e);return{skeleton:{v:1,root:lt(ce({tag:e.tagName.toLowerCase(),classes:((n=e.getAttribute("class"))!=null?n:"").replace(/\s+/g," ").trim(),ambientBg:L.bg},L.alt?{ambientBgAlt:L.alt}:{}),{ambientText:ke(D==null?void 0:D.color,e.ownerDocument)}),nodes:$,leaves:w,leafToNode:m,fp:Io(w)},textNodes:s,ownerEls:d}}function Po(e,t){try{let n=oi(e,t==null?void 0:t.maxNodes);return n.skeleton?{skeleton:n.skeleton}:n}catch(n){return{skeleton:null,reason:"unaddressable"}}}var Mo=new WeakMap;function Ro(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function No(e,t,n){var d,m,w;let r=Mo.get(e);if(r){if(r.fp!==n.fp||!Ro(r.leafToNode,n.leafToNode))return"mismatch"}else{let g=En(e);if(!("fp"in g)||(r={fp:g.fp,leafToNode:g.leafToNode,textNodes:g.textNodes,ownerEls:g.ownerEls,classes:g.ownerEls.map(x=>{var y;return(y=x.getAttribute("class"))!=null?y:""})},r.fp!==n.fp||!Ro(r.leafToNode,n.leafToNode)))return"mismatch";Mo.set(e,r)}let s=r;for(let[g,x]of Object.entries(t.nodes)){let y=Number(g),$=s.ownerEls[y];if($){if(typeof x.text=="string"){let L=!0;s.leafToNode.forEach((D,E)=>{D===y&&(s.textNodes[E].nodeValue=L?x.text:"",L=!1)})}x.like!==void 0&&s.classes[x.like]!==void 0&&$.setAttribute("class",s.classes[x.like]),x.hidden&&((d=$.style)==null||d.setProperty("display","none","important"))}}for(let g of Object.values((m=t.order)!=null?m:{})){let x=g.map(E=>s.ownerEls[E]).filter(E=>!!E),y=(w=x[0])==null?void 0:w.parentElement;if(!y||x.length!==g.length||x.some(E=>E.parentElement!==y))continue;let $=new Set(x),L=0;Array.from(y.children).map(E=>$.has(E)?x[L++]:E).forEach((E,z)=>{var J;y.children[z]!==E&&y.insertBefore(E,(J=y.children[z])!=null?J:null)})}return"applied"}hn();var ri=4,ii=new Set(["inline-block","block","flex","inline-flex"]),Do={H1:"heading-1",H2:"heading-2",H3:"heading-3"},Ot=null;function He(e){let t=Ot?ke(e,Ot):e,n=/rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[,\s/]+([\d.]+%?))?\s*\)/i.exec(t);if(!n)return null;let r=n[4]===void 0?1:n[4].endsWith("%")?Number.parseFloat(n[4])/100:Number(n[4]);return{r:Number(n[1]),g:Number(n[2]),b:Number(n[3]),a:r}}function Yt(e){let t=n=>{let r=n/255;return r<=.03928?r/12.92:((r+.055)/1.055)**2.4};return .2126*t(e.r)+.7152*t(e.g)+.0722*t(e.b)}function Tn(e,t){let[n,r]=[Yt(e),Yt(t)].sort((s,d)=>d-s);return(n+.05)/(r+.05)}var Jt=e=>{let t=He(e);return t!==null&&t.a>0};function Cn(e){return Ot?qt(e,Ot):[]}var De=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?t:0};function Ho(e,t){for(let n=e;n;n=n.parentElement){let r=t.getComputedStyle(n);if(Jt(r.backgroundColor))return He(r.backgroundColor);let s=Cn(r.backgroundImage);if(s.length>0)return He(s[0])}return{r:255,g:255,b:255,a:1}}var ai='#CybotCookiebotDialog, #onetrust-consent-sdk, #usercentrics-root, #usercentrics-cmp-ui, .cky-consent-container, .cky-modal, #didomi-host, #qc-cmp2-container, #cmplz-cookiebanner-container, .cc-window, #cc-main, #iubenda-cs-banner, #truste-consent-track, [id^="sp_message_container"], #termly-code-snippet-support';function si(e,t,n){if(e.closest(ai))return!0;for(let r=e;r&&r!==e.ownerDocument.body;r=r.parentElement){let s=t.getComputedStyle(r).position;if(s==="fixed"||s==="sticky"){let d=r.getBoundingClientRect().width;return d>0&&n>0&&d<.6*n}}return!1}function Vt(e){var t;for(let n of Array.from(e.childNodes))if(n.nodeType===3&&((t=n.nodeValue)!=null?t:"").trim()!=="")return!0;return!1}function li(e,t,n){var r;let s=e.tagName,d=De(t.fontSize)||n.bodySize,m=Number(t.fontWeight)||400,w=Jt(t.backgroundColor),g=Cn(t.backgroundImage).length>0,x=De(t.borderTopLeftRadius||t.borderRadius),y=e.getBoundingClientRect().width;if(s==="BUTTON"||e.getAttribute("role")==="button"||s==="INPUT"&&/^(submit|button)$/i.test(e.type)||s==="A"&&ii.has(t.display)&&De(t.paddingLeft)>=8){if(((r=e.textContent)!=null?r:"").trim()==="")return null;let L=He(t.backgroundColor),D=e.parentElement?Ho(e.parentElement,n.view):n.pageBg;return w&&L&&L.a>=.9&&Tn(L,D)>=1.5?"button-primary":w||De(t.borderTopWidth)>0?"button-secondary":"button-ghost"}if(s==="A")return"link";if(Do[s])return Do[s];if(Vt(e)&&d>=1.8*n.bodySize&&m>=600)return d>=2.5*n.bodySize?"heading-1":d>=2*n.bodySize?"heading-2":"heading-3";let $=e.nextElementSibling;if(Vt(e)&&d<=.9*n.bodySize&&(t.textTransform==="uppercase"||De(t.letterSpacing)>.05*d)&&$!==null&&/^H[1-4]$/.test($.tagName))return"eyebrow";if(s==="UL"||s==="OL")return e.querySelectorAll(":scope > li").length>=2?"list":null;if(s==="P"&&Vt(e)){if(d>=1.1*n.bodySize)return"text-lead";if(d<=.85*n.bodySize)return"text-small";let L=He(t.color);return L&&Tn(L,Ho(e,n.view))<n.bodyContrast*.8?"text-muted":"text-body"}return(s==="SPAN"||s==="DIV")&&w&&Vt(e)&&e.children.length===0&&x>=999?"badge":/^(DIV|ARTICLE|LI|SECTION|ASIDE)$/.test(s)&&(w||g)&&x>0&&De(t.paddingTop)>=16&&!(y>0&&y>=.9*n.vw)?"card":/^(SECTION|DIV|HEADER|MAIN|ASIDE)$/.test(s)&&(w||g)&&e.querySelector("h1,h2,h3")!==null&&(y===0||y>=.9*n.vw)?"section":null}function zo(e,t){var n,r,s,d,m,w,g,x,y;let $=e.defaultView;if(!$||!e.body)return{entries:[],images:[]};Ot=e;let L=$.getComputedStyle(e.body),D=De(L.fontSize)||16,E=Jt(L.backgroundColor)?He(L.backgroundColor):{r:255,g:255,b:255,a:1},z=(n=He(L.color))!=null?n:{r:17,g:24,b:39,a:1},J={bodySize:D,pageBg:E,bodyContrast:Tn(z,E),view:$,vw:$.innerWidth||0},Z=(s=(r=$.location)==null?void 0:r.pathname)!=null?s:"/",U=new Date().toISOString(),X=new Map,ne=new Map,Q=new Map,P=Array.from(e.body.querySelectorAll("*")).slice(0,(d=t==null?void 0:t.maxElements)!=null?d:4e3);for(let M of P)try{if(M.tagName==="IMG"){let ee=M,Ie=((m=ee.getAttribute("alt"))!=null?m:"").trim(),Y=ee.naturalWidth||Number(ee.getAttribute("width"))||0,et=ee.naturalHeight||Number(ee.getAttribute("height"))||0,ve=ee.getAttribute("src");if(Ie&&Y>=200&&ve){let $e=new URL(ve,e.baseURI).href;$e.startsWith("https://")&&!Q.has($e)&&Q.set($e,{id:`img-${Q.size+1}`,src:$e,alt:Ie.slice(0,200),w:Y,h:et,seenOn:Z})}}let q=((w=M.getAttribute("class"))!=null?w:"").replace(/\s+/g," ").trim();if(q===""||si(M,$,J.vw))continue;let B=$.getComputedStyle(M),V=M.tagName==="IMG"?((g=M.getAttribute("alt"))!=null?g:"").trim()?"image":null:li(M,B,J);if(!V)continue;let Se=`${V}|${q}`,ze=M.getBoundingClientRect();ne.set(Se,Math.max((x=ne.get(Se))!=null?x:0,ze.width*ze.height));let _e=X.get(Se);if(_e){_e.seen.count++;continue}let ye=Cn(B.backgroundImage).map(He).filter(ee=>ee!==null),ue,je;if(Jt(B.backgroundColor))ue=ke(B.backgroundColor,e);else if(ye.length>0){let ee=[...ye].sort((Y,et)=>Yt(Y)-Yt(et)),Ie=Y=>Y.a<1?`rgba(${Y.r}, ${Y.g}, ${Y.b}, ${Y.a})`:`rgb(${Y.r}, ${Y.g}, ${Y.b})`;ue=Ie(ee[0]),ee.length>1&&(je=Ie(ee[ee.length-1]))}let pe=B.borderTopLeftRadius||B.borderRadius;X.set(Se,{id:V,role:V,classes:q,computed:ce(ce(ce(ce(ce(ce(ce({},ke(B.color,e)?{color:ke(B.color,e)}:{}),M.parentElement&&$.getComputedStyle(M.parentElement).color===B.color?{inheritsColor:!0}:{}),ue?{bg:ue}:{}),je?{bgDark:je}:{}),B.fontSize?{fontSize:B.fontSize}:{}),B.fontWeight?{fontWeight:B.fontWeight}:{}),pe&&De(pe)>0?{radius:pe}:{}),seen:{url:Z,count:1,at:U}})}catch(q){}let re=new Map;for(let M of X.values())re.set(M.role,[...(y=re.get(M.role))!=null?y:[],M]);let ie=[],I=M=>{var q;return(q=ne.get(`${M.role}|${M.classes}`))!=null?q:0};for(let[M,q]of re)q.sort((B,V)=>(M.startsWith("button-")?I(V)-I(B):0)||V.seen.count-B.seen.count).slice(0,ri).forEach((B,V)=>ie.push(lt(ce({},B),{id:V===0?M:`${M}-${V+1}`})));return{entries:ie,images:[...Q.values()]}}function jo(e){let t=globalThis;if(t.CSS&&typeof t.CSS.escape=="function")return t.CSS.escape(e);let n="";for(let r=0;r<e.length;r++){let s=e[r],d=s>="0"&&s<="9";r===0&&d||r===1&&d&&e[0]==="-"?n+=`\\3${s} `:r===0&&s==="-"&&e.length===1?n+="\\-":/[a-zA-Z0-9_-]/.test(s)?n+=s:n+=`\\${s}`}return n}function di(e,t){if(e.id)return`#${jo(e.id)}`;let n=[],r=e,s=0;for(;r&&r!==t.body&&r!==t.documentElement&&s<6;){if(r.id){n.unshift(`#${jo(r.id)}`);break}let d=r.tagName.toLowerCase(),m=r.parentElement;if(m){let w=Array.from(m.children).filter(g=>g.tagName===r.tagName);w.length>1&&(d+=`:nth-of-type(${w.indexOf(r)+1})`)}n.unshift(d),r=r.parentElement,s++}return n.join(" > ")}function Xe(e,t){var s;let n={v:1};e.id&&(n.id=e.id);for(let d of["data-framer-name","data-w-id","data-sentient-name"]){let m=e.getAttribute(d);if(m){n.dataAttr={name:d,value:m};break}}n.selector=di(e,t);let r=((s=e.textContent)!=null?s:"").trim().replace(/\s+/g," ").slice(0,80);return n.fingerprint=K({tag:e.tagName.toLowerCase()},r?{text:r}:{}),n}function ut(e,t,n){return we(e,n)===t}var Ko="__snt_editor_token";function Go(e){try{sessionStorage.setItem(Ko,e)}catch(t){}}function Pt(){try{sessionStorage.removeItem(Ko)}catch(e){}}var ci=/rgba\([^)]*,\s*0\s*\)$/,ui=/^\d+(\.\d+)?px$/;function Uo(e){var t,n;try{let r=e.defaultView;if(!r||!e.body)return null;let s=r.getComputedStyle(e.body).backgroundColor,d=e.querySelectorAll('button, [role="button"], input[type="submit"], a[class*="btn" i], a[class*="button" i]'),m=new Map;for(let L of Array.from(d).slice(0,300)){let D=L.getBoundingClientRect();if(D.width>0&&(D.width<48||D.height<24))continue;let E=r.getComputedStyle(L),z=E.backgroundColor;if(!z||z==="transparent"||z===s||ci.test(z))continue;let J=(t=(E.borderRadius||"").split(" ")[0])!=null?t:"",Z=`${z}|${E.color}|${ui.test(J)?J:"8px"}`;m.set(Z,((n=m.get(Z))!=null?n:0)+1)}let w=null,g=0;for(let[L,D]of m)D>g&&(w=L,g=D);if(!w)return null;let[x,y,$]=w.split("|");return{primaryBg:x,primaryText:y,radius:$}}catch(r){return null}}function Mt(e){let t=e.split(/[?#]/)[0]||"/";return t.length>1?t.replace(/\/+$/,"")||"/":t}function Fo(e,t){return e==="*"?"Every page":e.endsWith("/*")?`All pages under ${e.slice(0,-1)}`:e===t?`This page (${e})`:`Only on ${e}`}function Ln(e,t){let n=Mt(e),r=n.split("/").filter(Boolean),s=[n,"*"];return r.length>=2&&s.push(`/${r[0]}/*`),(t?[t,...s.filter(d=>d!==t)]:s).filter(d=>yn.test(d))}function Xt(e){let t=e.steps.length,n=e.status==="active"?"":` (${e.status})`;return`${e.display_name} \u2014 ${t} step${t===1?"":"s"}${n}`}function Zt(e,t){return e.steps.map(n=>{var r;return{value:n.step_index,label:`${n.step_index+1}. ${(r=t.get(n.goal_id))!=null?r:n.goal_id}`}})}function Wo(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}function pi(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"funnel"}function qo(e,t){let n=e.trim();return n?t.length<2?{ok:!1,error:"Pick at least 2 goals \u2014 a funnel is a sequence."}:t.length>12?{ok:!1,error:"A funnel can have at most 12 steps."}:{ok:!0,funnelId:pi(n),body:{displayName:n.slice(0,128),steps:t.map(r=>({goalId:r}))}}:{ok:!1,error:"Give the funnel a name."}}function Zo(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)>>>0;return t.toString(36)}function pt(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}function Ce(e,t,n){var g,x,y;let r=t.fingerprint?(g=t.fingerprint.text)!=null?g:"":((x=n.textContent)!=null?x:"").trim(),s=t.id||((y=t.dataAttr)==null?void 0:y.value)||r||n.tagName,d=pt(s)||"el",m=Zo(JSON.stringify(t));return`${e}-${d}-${m}`.slice(0,128)}var fi="sentient-editor-highlight",gi="sentient-editor-selection",gt="sentient-editor-panel",tn="sentient-editor-toast",_n="sentient-editor-styles",In="sentient-editor-target-highlight",mi=10,Vo="Editor session expired. Reopen it from your dashboard to keep editing \u2014 your saved changes are safe.",Yo="Couldn\u2019t load the editor \u2014 check your connection and reopen it from your dashboard.";function Qo(){var t;if(document.getElementById(_n))return;let e=_t(document.createElement("style"));e.id=_n,e.textContent=`
3
3
  @keyframes sntedi-in {
4
4
  from { opacity: 0; transform: translateY(28px) scale(0.94); }
5
5
  to { opacity: 1; transform: translateY(0) scale(1); }
@@ -21,14 +21,14 @@
21
21
  @media (prefers-reduced-motion: reduce) {
22
22
  #${gt}, #${gt} .sntedi-dot, #${tn} { animation: none !important; }
23
23
  }
24
- `,((t=document.head)!=null?t:document.documentElement).appendChild(e)}function Qt(e){var r,s;Qo(),(r=document.getElementById(tn))==null||r.remove();let t=c("div",{position:"fixed",bottom:"16px",right:"16px",zIndex:"2147483647",maxWidth:"320px",padding:"14px 16px",borderRadius:"14px",background:"#111827",color:"#fff",font:"13px/1.45 system-ui, sans-serif",border:"1px solid rgba(245,158,11,0.6)",boxShadow:"0 10px 34px rgba(0,0,0,0.45)",display:"flex",gap:"10px",alignItems:"flex-start",cursor:"pointer"});t.id=tn;let n=c("span",{width:"9px",height:"9px",marginTop:"4px",borderRadius:"50%",background:"#f59e0b",flex:"0 0 auto"});t.append(n,c("div",{},e)),((s=document.body)!=null?s:document.documentElement).appendChild(t),t.addEventListener("click",()=>t.remove()),setTimeout(()=>t.remove(),1e4)}function hi(){let e=window.__sentientEditor;return e&&typeof e.apiBase=="string"&&(typeof e.token=="string"||typeof e.code=="string")?e:null}async function er(e){try{let t=await fetch(`${e.apiBase}/v1/editor/exchange`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:e.code})}),n=t.ok?(await t.json()).token:null;return e.code=null,n?(e.token=n,Go(n),200):t.ok?500:t.status}catch(t){return 0}}async function yi(e){try{let t=await fetch(`${e.apiBase}/v1/editor/verify`,{headers:{authorization:`Bearer ${e.token}`}});if(t.status===401)return{ok:!1,unauthorized:!0};if(!t.ok)return{ok:!1,unauthorized:!1};let n=(await t.json()).projectId;return n?{ok:!0,projectId:n}:{ok:!1,unauthorized:!1}}catch(t){return{ok:!1,unauthorized:!1}}}function Rn(e,t){return K(K(K(K({r:e===401?"expired":"error",status:e},typeof(t==null?void 0:t.error)=="string"?{code:t.error}:{}),typeof(t==null?void 0:t.message)=="string"?{message:t.message}:{}),typeof(t==null?void 0:t.feature)=="string"?{feature:t.feature}:{}),typeof(t==null?void 0:t.plan)=="string"?{plan:t.plan}:{})}async function de(e,t,n){try{let r=await fetch(`${e.apiBase}${t}`,{method:"POST",headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify(n)});if(r.ok)return{r:"ok"};let s=await r.json().catch(()=>null);return Rn(r.status,s)}catch(r){return{r:"error"}}}async function bi(e,t){try{let n=await fetch(`${e.apiBase}${t}`,{method:"DELETE",headers:{authorization:`Bearer ${e.token}`}});if(n.ok)return{r:"ok"};let r=await n.json().catch(()=>null);return Rn(n.status,r)}catch(n){return{r:"error"}}}async function vi(e,t,n){try{let r=await fetch(`${e.apiBase}${t}`,{method:"POST",headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify(n)}),s=await r.json().catch(()=>null);return r.ok?{r:"ok",data:s,outcome:{r:"ok"}}:{r:r.status===401?"expired":"error",data:s,outcome:Rn(r.status,s)}}catch(r){return{r:"error",data:null,outcome:{r:"error"}}}}var $n=[];function Nn(e){return/^#[0-9a-fA-F]{6}$/.test(e)}function Bn(e){let t=e.trim();if(Nn(t))return t;let n=/^#([0-9a-fA-F]{3})$/.exec(t);if(n)return`#${n[1].split("").map(d=>d+d).join("")}`;let r=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/.exec(t);if(!r)return t;let s=d=>Math.min(255,Number(d)).toString(16).padStart(2,"0");return`#${s(r[1])}${s(r[2])}${s(r[3])}`}var Ze=null,On=[];function tr(e){On=e}async function xi(e){try{let t=await fetch(`${e.apiBase}/v1/editor/targets`,{headers:{authorization:`Bearer ${e.token}`}});if(!t.ok)return[];let n=await t.json();return $n=Array.isArray(n.fonts)?n.fonts.filter(r=>typeof r=="string"):[],Array.isArray(n.targets)?n.targets:[]}catch(t){return[]}}async function ft(e,t){try{let n=await fetch(`${e.apiBase}${t}`,{headers:{authorization:`Bearer ${e.token}`}});return n.ok?await n.json():null}catch(n){return null}}function mt(e=document){for(let t of Array.from(e.querySelectorAll(`.${In}`)))t.remove()}function nr(e,t=document){var r;mt(t);let n=0;for(let s of e){if(n>=mi)break;let d=we(s.locator,t);if(!d)continue;let m=d.getBoundingClientRect(),x=c("div",{position:"fixed",pointerEvents:"none",zIndex:"2147483645",left:`${m.left}px`,top:`${m.top}px`,width:`${m.width}px`,height:`${m.height}px`,border:"2px dashed #10b981",background:"rgba(16,185,129,0.08)"});x.className=In;let g=c("div",{position:"fixed",pointerEvents:"none",zIndex:"2147483645",left:`${m.left}px`,top:`${Math.max(0,m.top-20)}px`,padding:"2px 6px",borderRadius:"4px",background:"#10b981",color:"#fff",font:"11px system-ui, sans-serif",whiteSpace:"nowrap"},s.label);g.className=In,((r=t.body)!=null?r:t.documentElement).append(x,g),n+=1}}function en(e,t){let n=e.previousElementSibling,r=e.nextElementSibling,s=n?Xe(n,t):null,d=r?Xe(r,t):null;return{prevEl:n,nextEl:r,prevLocator:n&&s&&ut(s,n,t)?s:null,nextLocator:r&&d&&ut(d,r,t)?d:null}}var wi=/testimonial|review|quote/i;function or(e){let t=[],n=e.headings.length>=1,r=e.links.length>=1;return n&&r&&t.push("hero","cta_band"),e.headings.length>=2&&e.paragraphs.length>=2&&t.push("feature_grid"),e.quotes.length>=1&&t.push("testimonial"),t}var Pn=["color","background","fontSize","fontWeight","borderRadius","textAlign","fontFamily"],ki=/^(0|\d*\.?\d+(px|rem|em|%|vh|vw|vmin|vmax|ch|pt))$/i,Si=new Set(["left","center","right","justify","start","end"]),Ei=/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Ti=/^(rgb|rgba|hsl|hsla)\(/i;function Ci(e){return Ei.test(e)||Ti.test(e)}function rr(e,t){switch(e){case"fontSize":case"borderRadius":return ki.test(t)?null:"Add a unit, e.g. 20px or 1.5rem.";case"fontWeight":return/^(normal|bold|bolder|lighter)$/i.test(t)||/^\d{1,4}$/.test(t)&&+t>=1&&+t<=1e3?null:"Use 100\u2013900, or normal/bold.";case"textAlign":return Si.has(t.toLowerCase())?null:"Choose left, center, right, or justify.";case"color":case"background":return Ci(t)?null:"Enter a colour, e.g. #1a1a1a.";case"fontFamily":{let n=t.split(",").map(r=>r.trim().replace(/^['"]|['"]$/g,""));return t.length<=120&&n.length>=1&&n.length<=5&&n.every(r=>/^[A-Za-z0-9][A-Za-z0-9 -]*$/.test(r))?null:"Use a font name, e.g. Georgia, serif."}default:return null}}function Mn(e){let t={},n={};for(let r of Pn){let s=e[r];if(typeof s!="string")continue;let d=s.trim();if(d==="")continue;if(!dt(d)){n[r]="That value isn\u2019t allowed.";continue}let m=rr(r,d);if(m){n[r]=m;continue}t[r]=d}return{style:t,errors:n}}var Rt={display:"block",width:"100%",boxSizing:"border-box",marginTop:"4px",padding:"7px 9px",borderRadius:"8px",border:"1px solid rgba(255,255,255,0.18)",background:"#1f2937",color:"#fff",font:"13px system-ui, sans-serif"};function c(e,t,n){let r=document.createElement(e);return Object.assign(r.style,t),n!==void 0&&(r.textContent=n),r}function ir(e){var so;let t=null,n=[],r=null,s=()=>{for(;n.length>0;){let o=n.splice(0,20);try{fetch(`${e.apiBase}/v1/editor/telemetry`,{method:"POST",keepalive:!0,headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify({events:o})}).catch(()=>{})}catch(i){}}},d=(o,i)=>{n.push(K({kind:o},i?{meta:i}:{})),r&&clearTimeout(r),r=setTimeout(s,2e3)};window.addEventListener("pagehide",s);let m=c("div",{position:"fixed",pointerEvents:"none",zIndex:"2147483646",border:"2px solid #6366f1",background:"rgba(99,102,241,0.12)",display:"none"});m.id=fi;let x=c("div",{position:"fixed",pointerEvents:"none",zIndex:"2147483646",border:"2px solid #10b981",background:"rgba(16,185,129,0.10)",borderRadius:"4px",display:"none"});x.id=gi;let g=()=>{if(!t||!t.isConnected){x.style.display="none";return}let o=t.getBoundingClientRect();Object.assign(x.style,{display:"block",left:`${o.left-2}px`,top:`${o.top-2}px`,width:`${o.width}px`,height:`${o.height}px`})},k=()=>g();Qo();let y=c("div",{position:"fixed",bottom:"16px",right:"16px",zIndex:"2147483647",width:"min(408px, calc(100vw - 32px))",padding:"16px",borderRadius:"14px",background:"#111827",color:"#fff",font:"13px/1.4 system-ui, sans-serif",border:"1px solid rgba(99,102,241,0.55)",boxShadow:"0 10px 34px rgba(0,0,0,0.45)",maxHeight:"calc(100vh - 32px)",overflowY:"auto",overscrollBehavior:"contain"});y.id=gt;let $=c("span",{width:"9px",height:"9px",borderRadius:"50%",background:"#34d399",display:"inline-block",flex:"0 0 auto"});$.className="sntedi-dot";let L=c("div",{display:"flex",alignItems:"center",gap:"8px",fontWeight:"700",fontSize:"14px",marginBottom:"6px"});L.append($,c("span",{},"SentientUI"));let D=c("div",{opacity:"0.85",marginBottom:"8px"},"Click any element on the page to adapt it."),E=!1,z=c("button",F("#374151"),"Pause selecting");z.onclick=()=>{E=!E,z.textContent=E?"Resume selecting":"Pause selecting",E?(m.style.display="none",mt(document),T("Selection paused \u2014 browse normally, then resume.")):T("Click any element on the page to adapt it.")};let J=c("div",{fontSize:"12px",marginBottom:"6px",padding:"5px 8px",borderRadius:"8px",background:"rgba(16,185,129,0.14)",border:"1px solid rgba(16,185,129,0.45)",display:"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),Z=c("div",{fontSize:"12px",marginBottom:"8px",minHeight:"16px"}),U=c("button",F("#6366f1"),"Test different text here"),X=c("button",F("#374151"),"Change style"),ne=c("button",F("#374151"),"Try a different layout for this section"),Q=c("button",F("#374151"),"Track clicks as a goal"),P=c("button",F("#374151"),"Track form submissions as a goal"),re=c("button",F("#374151"),"Track page visits as a goal"),ie=c("button",F("#374151"),"Track reading this far as a goal"),I=c("button",F("#374151"),"Set up a funnel"),M=c("button",F("#374151"),"Attach this test to a funnel step"),q=c("button",F("#10b981"),"Turn the funnel on"),B=c("button",F("#374151"),"Move up"),V=c("button",F("#374151"),"Move down"),Se=c("button",F("#6366f1"),"Save this arrangement"),ze=c("button",F("#374151"),"Undo"),_e=An("close","Close editor"),ye=c("button",F("#10b981"),"Publish now \u2014 go live"),ue=c("button",F("#10b981"),"Start tracking now");for(let o of[U,X,ne,Q,B,V])o.disabled=!0;let je=[U,X,ne,Q,P,B,V];for(let o of je)o.style.display="none";Se.style.display="none",ze.style.display="none",ye.style.display="none",ue.style.display="none",M.style.display="none",q.style.display="none";let pe=c("div",{display:"none",fontSize:"11px",opacity:"0.75",marginBottom:"2px",lineHeight:"1.8",overflow:"hidden",textOverflow:"ellipsis"}),ee=c("div",{}),Ie=[{id:"text",label:"Text",icon:"\u270F\uFE0F"},{id:"style",label:"Style",icon:"\u{1F3A8}"},{id:"layout",label:"Layout",icon:"\u{1F9F1}"},{id:"goals",label:"Goals",icon:"\u{1F3AF}"},{id:"funnels",label:"Funnels",icon:"\u{1F9ED}"},{id:"drafts",label:"Drafts",icon:"\u{1F5C2}\uFE0F"}],Y="text",et=new Map,ve=new Map,$e=new Map,Dn=c("div",{display:"flex",gap:"0",margin:"10px 0 0",justifyContent:"space-between",borderBottom:"1px solid rgba(255,255,255,0.1)"}),Hn=c("div",{paddingTop:"10px"});for(let o of Ie){let i=c("button",{background:"transparent",border:"none",cursor:"pointer",font:"600 11.5px system-ui, sans-serif",color:"#9ca3af",whiteSpace:"nowrap",padding:"7px 5px",borderBottom:"2px solid transparent",marginBottom:"-1px"});i.append(c("span",{fontSize:"11px",marginRight:"3px"},o.icon),c("span",{},o.label)),i.onclick=()=>ar(o.id),et.set(o.id,i),Dn.append(i);let a=c("div",{display:"none"}),l=c("div",{fontSize:"12px",opacity:"0.7",padding:"2px 0 6px",display:"none"});a.append(l),$e.set(o.id,l),ve.set(o.id,a),Hn.append(a)}ve.get("text").append(U),ve.get("style").append(X),ve.get("layout").append(ne,B,V,Se,ze),ve.get("goals").append(Q,P,re,ie),ve.get("funnels").append(I,M,q);let xe=c("div",{});ve.get("drafts").append(xe);let Nt=()=>{var i,a;for(let l of Ie){let u=l.id===Y,f=et.get(l.id);f.style.color=u?"#ffffff":"#9ca3af",f.style.borderBottom=u?"2px solid #6366f1":"2px solid transparent",ve.get(l.id).style.display=u?"block":"none",$e.get(l.id).style.display="none"}let o=l=>{let u=$e.get(Y);u.textContent=l,u.style.display="block"};Y==="text"?t?U.disabled?o(U.title||"This element can\u2019t be targeted reliably \u2014 try its heading or a button."):(i=U.onclick)==null||i.call(U,new MouseEvent("click")):o("Click any text on the page to test a different wording."):Y==="style"?t?X.disabled?o("This element can\u2019t be targeted reliably \u2014 try a heading, a button, or a whole section."):(a=X.onclick)==null||a.call(X,new MouseEvent("click")):o("Click any element on the page to change how it looks."):Y==="layout"?t||o("Click a section to move it or lay it out differently. Layouts re-arrange the words already on the page \u2014 they never add a section you don\u2019t have."):Y==="goals"?t||o("Page-level goals work right away; click a button or form to track it specifically."):Y==="funnels"?o("Chain tracked goals into a journey \u2014 the drop-off view fills in as visitors move through it."):Y==="drafts"&&tt()},Le=(o,i)=>c("button",le(K({},F(o)),{display:"inline-block",width:"auto",margin:"0",padding:"4px 9px",fontSize:"11px",flex:"0 0 auto"}),i),zn=(o,i)=>{let a=new URL(window.location.href);a.searchParams.set("sentient_preview",o),i&&a.searchParams.set("sentient_arm",i),window.location.assign(a.toString())},Dt=(o,i,a)=>{let l=Le("#374151","Discard");return l.onclick=async()=>{l.disabled=!0;let u=await bi(e,o);l.disabled=!1,be(u,i),u.r==="ok"&&a()},l},jn=(o,i)=>{Ke.textContent="";let a=c("div",{margin:"0 0 6px",padding:"8px 10px",borderRadius:"8px",fontSize:"12px",background:"rgba(99,102,241,0.10)",border:"1px solid rgba(99,102,241,0.35)"}),l=c("div",{display:"flex",gap:"6px",flexWrap:"wrap"});l.append(...i),a.append(c("div",{marginBottom:"6px"},o),l),Ke.append(a)},tt=async()=>{var S,C,w,v,b,A,R,H,G,N,ge,me;xe.textContent="",xe.append(c("div",{fontSize:"12px",opacity:"0.6",padding:"4px 0"},"Loading\u2026"));let o=[],i=[],a=null,l=!1;if(await Promise.all([(async()=>{var _;try{let j=await fetch(`${e.apiBase}/v1/editor/slots`,{headers:{authorization:`Bearer ${e.token}`}});j.ok?o=(_=(await j.json()).slots)!=null?_:[]:a=j.status===401?"expired":"error"}catch(j){a="error"}})(),(async()=>{var _;try{let j=await fetch(`${e.apiBase}/v1/editor/goals`,{headers:{authorization:`Bearer ${e.token}`}});j.ok?i=(_=(await j.json()).goals)!=null?_:[]:l=!0}catch(j){l=!0}})()]),Y!=="drafts")return;if(xe.textContent="",a){if(xe.append(c("div",{fontSize:"12px",opacity:"0.8",padding:"4px 0"},a==="expired"?"Editor session expired \u2014 reopen it from your dashboard to see your drafts. They\u2019re safe.":"Couldn\u2019t load your drafts \u2014 they\u2019re safe; check your connection and retry.")),a==="error"){let _=Le("#374151","Retry");_.onclick=()=>{tt()},xe.append(_)}return}let u=o.filter(_=>{var j,se,Ae,Re,Ve,At;return((Ae=(se=(j=_.draft_config)==null?void 0:j.arms)==null?void 0:se.length)!=null?Ae:0)>0||((At=(Ve=(Re=_.published_config)==null?void 0:Re.arms)==null?void 0:Ve.length)!=null?At:0)>0}),f=i.filter(_=>_.event!=="custom"&&(_.status==="draft"||_.status==="active"));if(u.length===0&&f.length===0&&!l){xe.append(c("div",{fontSize:"12px",opacity:"0.7",padding:"4px 0"},"Nothing saved yet \u2014 changes and goals you save land here, previewable before they go live."));return}let h=_=>c("span",{fontSize:"10px",padding:"2px 7px",borderRadius:"999px",flex:"0 0 auto",background:_?"rgba(16,185,129,0.2)":"rgba(99,102,241,0.25)",color:_?"#6ee7b7":"#c7d2fe"},_?"live":"draft"),p=_=>{let j=c("div",{display:"flex",alignItems:"center",gap:"6px",padding:"7px 0",borderBottom:"1px solid rgba(255,255,255,0.08)",fontSize:"12px"}),se=c("div",{flex:"1 1 auto",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},_);return j.append(se),{row:j,name:se}};for(let _ of u){let{row:j}=p((S=_.display_name)!=null?S:_.slot_id);j.append(h(_.status==="published"));let se=(b=(v=(C=_.draft_config)==null?void 0:C.arms)!=null?v:(w=_.published_config)==null?void 0:w.arms)!=null?b:[],Ae=(H=(A=se[1])==null?void 0:A.id)!=null?H:(R=se[0])==null?void 0:R.id,Re=Le("#374151","Preview");if(Re.onclick=()=>zn(_.slot_id,Ae),j.append(Re),_.status!=="published"&&((ge=(N=(G=_.draft_config)==null?void 0:G.arms)==null?void 0:N.length)!=null?ge:0)>0){let Ve=Le("#10b981","Publish");Ve.onclick=async()=>{Ve.disabled=!0;let At=await de(e,`/v1/editor/slots/${encodeURIComponent(_.slot_id)}/publish`,{});Ve.disabled=!1,be(At,"\u2713 Published \u2014 live for new visitors."),At.r==="ok"&&(d("published",{kind:"slot"}),tt())},j.append(Ve)}_.status!=="published"&&j.append(Dt(`/v1/editor/slots/${encodeURIComponent(_.slot_id)}`,"\u{1F5D1} Draft discarded \u2014 nothing changed for your visitors.",()=>{Yn(_.slot_id),tt()})),xe.append(j)}if(l)xe.append(c("div",{fontSize:"11px",opacity:"0.6",padding:"6px 0 2px"},"Couldn\u2019t load your goals right now \u2014 they\u2019re safe."));else if(f.length>0){xe.append(c("div",{fontSize:"11px",opacity:"0.6",padding:"8px 0 2px"},"Goals"));for(let _ of f){let{row:j}=p((me=_.display_name)!=null?me:_.goal_id);if(j.append(h(_.status==="active")),_.status==="draft"){let se=Le("#10b981","Start tracking");se.onclick=async()=>{se.disabled=!0;let Ae=await de(e,`/v1/editor/goals/${encodeURIComponent(_.goal_id)}/publish`,{});se.disabled=!1,be(Ae,"\u2713 Tracking is live \u2014 it counts from your next visitor."),Ae.r==="ok"&&(d("published",{kind:"goal"}),tt())},j.append(se,Dt(`/v1/editor/goals/${encodeURIComponent(_.goal_id)}`,"\u{1F5D1} Draft goal discarded \u2014 it never tracked anything.",()=>{Jn(_.goal_id),tt()}))}xe.append(j)}}},ar=o=>{Y!==o&&(ae(),kt(),Y=o,Nt())},Kn=c("div",{display:"flex",alignItems:"center",gap:"6px",marginBottom:"10px"});Object.assign(L.style,{marginBottom:"0",flex:"1 1 auto",fontSize:"13px",whiteSpace:"nowrap"});let Gn=!1,Be=c("button",{position:"fixed",bottom:"16px",right:"16px",zIndex:"2147483647",width:"44px",height:"44px",borderRadius:"12px",border:"1px solid #2a2a2a",background:"#000",cursor:"pointer",display:"none",padding:"0",alignItems:"center",justifyContent:"center",boxShadow:"0 6px 18px rgba(0,0,0,0.4)"});Be.append(Ai(26)),Be.title="Open the SentientUI editor",Be.setAttribute("aria-label","Open the SentientUI editor");let Un=An("minimize","Minimize");Un.onclick=()=>{y.style.display="none",Be.style.display="flex",Gn=E,E=!0,m.style.display="none",mt(document)},Be.onclick=()=>{y.style.display="block",Be.style.display="none",E=Gn},Object.assign(z.style,{display:"inline-block",width:"auto",margin:"0",padding:"3px 8px",fontSize:"10.5px",borderRadius:"999px",background:"#374151",whiteSpace:"nowrap"}),Kn.append(L,z,Un,_e);let Fn=c("div",{marginTop:"10px",borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"8px"}),Ke=c("div",{});Object.assign(Z.style,{marginBottom:"4px"}),Fn.append(Ke,Z,ye,ue);let Wn=c("button",{display:"inline-block",width:"auto",margin:"0",padding:"5px 10px",flex:"0 0 auto",fontSize:"11px",borderRadius:"999px",background:"rgba(250,204,21,0.15)",border:"1px solid rgba(250,204,21,0.45)",color:"#fde68a",cursor:"pointer",whiteSpace:"nowrap"},"\u2728 Ask AI"),on=c("div",{display:"flex",alignItems:"center",gap:"6px"});Object.assign(J.style,{flex:"1 1 auto",marginBottom:"0"}),on.append(J,Wn),Object.assign(on.style,{marginBottom:"6px"});let Ht=c("div",{}),W=c("div",{marginTop:"4px"});W.addEventListener("input",()=>{nt=!0}),W.addEventListener("change",()=>{nt=!0}),y.append(Kn,D,on,pe,ee,Ht,Dn,Hn,W,Fn),((so=document.body)!=null?so:document.documentElement).append(m,x,y,Be);let Oe=null,zt=()=>{Oe==null||Oe(),Oe=null},qn=()=>{Oe=null},ht=null,nt=!1,rn=null,ae=()=>{zt(),ht=null,W.textContent="",nt=!1,rn=null,gn=!1},yt=(o,i,a,l)=>{var C;ae();let u={},f={};for(let w of o){let v=c("label",{display:"block",fontSize:"12px",opacity:"0.85",marginTop:"8px"},w.label);if(W.append(v),w.type==="select"){let A=c("select",Rt);A.setAttribute("data-field",w.key);let R=document.createElement("option");R.value="",R.textContent="\u2014 no change \u2014",A.append(R);for(let H of(C=w.options)!=null?C:[]){let G=document.createElement("option");G.value=H,G.textContent=H,A.append(G)}u[w.key]=()=>A.value,W.append(A)}else if(w.type==="color"){let A=c("input",le(K({},Rt),{padding:"2px",height:"34px"}));A.type="color",A.setAttribute("data-field",w.key);let R=!1;A.addEventListener("input",()=>{R=!0}),u[w.key]=()=>R?A.value:"",W.append(A)}else{let A=c("input",Rt);A.setAttribute("data-field",w.key),w.value!==void 0&&(A.value=w.value),u[w.key]=()=>A.value,W.append(A)}let b=c("div",{fontSize:"11px",color:"#fca5a5",marginTop:"3px",display:"none"});b.setAttribute("data-feedback",w.key),f[w.key]=b,W.append(b)}let h=(w,v)=>{let b=f[w];b&&(b.textContent=v!=null?v:"",b.style.display=v?"block":"none")};if(l){let w=Vn(l);W.append(w.node),u[bt]=w.value}let p=c("button",F("#6366f1"),i),S=c("button",le(K({},F("transparent")),{opacity:"0.6"}),"Cancel");p.onclick=()=>a(Object.fromEntries(Object.entries(u).map(([w,v])=>[w,v()])),h),S.onclick=ae,W.append(p,S)},bt="__page",an={},sr=o=>{var i;for(let a of o!=null?o:[])an[a.slot_id]=(i=a.target)==null?void 0:i.page};ft(e,"/v1/editor/slots").then(o=>sr(o==null?void 0:o.slots));let Vn=o=>{let i=Mt(location.pathname),a=c("div",{}),l=c("select",Rt);l.setAttribute("data-field","page");for(let u of Ln(i,an[o])){let f=document.createElement("option");f.value=u,f.textContent=Fo(u,i),l.append(f)}return a.append(c("label",{display:"block",fontSize:"12px",opacity:"0.85",marginTop:"8px"},"Where does this appear?"),l,c("div",{fontSize:"11px",opacity:"0.6",marginTop:"3px"},"Helps us tell a moved element from a page it isn\u2019t on.")),{node:a,value:()=>l.value}},vt=(o,i)=>i?le(K({},o),{page:i}):o,T=(o,i=!0)=>{Z.textContent=o,Z.style.color=i?"#a7f3d0":"#fca5a5"},sn=(o,i)=>{var l,u;if(d("error_shown",{code:(u=o.code)!=null?u:`http_${(l=o.status)!=null?l:"network"}`}),o.code==="plan_limit_reached"){let f=o.feature==="live_goals"?"live goal":"of these",h=o.plan?`${o.plan} plan`:"plan";return o.feature==="live_goals"?`Your ${h} includes 1 live goal. Pause another goal in your dashboard, or upgrade to track more.`:`Your ${h} has reached its limit for ${f}. Manage them in your dashboard, or upgrade for more.`}if(o.code==="role_required")return"Your account can view but not edit this project \u2014 ask an admin for editor access.";if(o.code==="demo_read_only"&&o.message)return o.message;let a=o.status?` (HTTP ${o.status})`:"";return`\u26A0 Couldn\u2019t ${i} \u2014 try again.${a}`},be=(o,i)=>{o.r==="ok"?T(i,!0):o.r==="expired"?T("Editor session expired \u2014 reopen it from your dashboard to save this. Your earlier changes are safe.",!1):T(sn(o,"save"),!1)},Ge=null,jt=o=>o.length>30?`${o.slice(0,27)}\u2026`:o,Yn=o=>{Ge===o&&(ht===o&&(zt(),ht=null),Ge=null,ye.style.display="none",M.style.display="none",Ke.textContent="")},Jn=o=>{at===o&&(at=null,ue.style.display="none",Ke.textContent="")},xt=(o,i,a)=>{Ge=o,ye.textContent=i?`Publish \u201C${jt(i)}\u201D \u2014 go live`:"Publish now \u2014 go live",ye.style.display="block",M.style.display="block";let l=[];if(a){let u=Le("#374151","Preview");u.onclick=()=>zn(o,a),l.push(u)}l.push(Dt(`/v1/editor/slots/${encodeURIComponent(o)}`,"\u{1F5D1} Draft discarded \u2014 nothing changed for your visitors.",()=>Yn(o))),jn(i?`Draft saved for \u201C${jt(i)}\u201D \u2014 nothing is live for visitors yet.`:"Draft saved \u2014 nothing is live for visitors yet.",l)};ye.onclick=async()=>{if(!Ge)return;ye.disabled=!0,T("Publishing\u2026");let o=await de(e,`/v1/editor/slots/${encodeURIComponent(Ge)}/publish`,{});ye.disabled=!1,o.r==="ok"?(d("published",{kind:"slot"}),T("\u2713 Published \u2014 live for new visitors.",!0),ye.style.display="none",Ge=null,Ke.textContent=""):o.r==="expired"?T("Editor session expired \u2014 reopen it from your dashboard to publish. Your saved draft is safe.",!1):T(sn(o,"publish"),!1)};let oe=null,Pe=!1,ot=null,rt=null,Ee=null,Ue=null,wt=null,Kt=null,Fe=!1,Xn=(o,i)=>Pe?o?"":`Nothing to swap with ${i} \u2014 it\u2019s at the edge, or that neighbor can\u2019t be targeted reliably.`:"This element can\u2019t be targeted reliably, so it can\u2019t be moved.",Zn=()=>{B.disabled=!Pe||!Ee,V.disabled=!Pe||!Ue,B.title=B.disabled?Xn(Ee,"above"):"",V.title=V.disabled?Xn(Ue,"below"):""},Te=null,ln=o=>{o&&!Te&&t&&oe?(Te=Vn(Ce("move",oe,t)),Se.before(Te.node)):o||(Te==null||Te.node.remove(),Te=null),Se.style.display=o?"block":"none",ze.style.display=o?"block":"none",Zn()},kt=()=>{if(Fe&&t&&wt&&wt.insertBefore(t,Kt),Fe=!1,wt=null,Kt=null,t){let o=en(t,document);ot=o.prevEl,rt=o.nextEl,Ee=o.prevLocator,Ue=o.nextLocator}g(),ln(!1)},Qn=o=>{if(E)return;let i=o.target;if(!i||y.contains(i)||i===m)return;mt(document);let a=i.getBoundingClientRect();Object.assign(m.style,{display:"block",left:`${a.left}px`,top:`${a.top}px`,width:`${a.width}px`,height:`${a.height}px`})},Me=o=>{var a;let i=((a=o.textContent)!=null?a:"").trim().replace(/\s+/g," ");return i?i.length>40?`${i.slice(0,37)}\u2026`:i:o.tagName.toLowerCase()},lr=o=>!!o.id||["section","header","footer","nav","main","form","article","aside"].includes(o.tagName.toLowerCase())||!!o.querySelector(":scope > h1, :scope > h2, :scope > h3"),dr=o=>{var l;let i=o.querySelector("h1, h2, h3"),a=(l=i==null?void 0:i.textContent)==null?void 0:l.replace(/\s+/g," ").trim();return a?a.length>28?`${a.slice(0,25)}\u2026`:a:o.id?`#${o.id.length>24?`${o.id.slice(0,21)}\u2026`:o.id}`:`<${o.tagName.toLowerCase()}>`},cr=o=>{pe.textContent="";let i=[];for(let h=o.parentElement;h&&h!==document.body&&i.length<3;h=h.parentElement)lr(h)&&i.push(h);let a=Me(o),l=()=>c("span",{opacity:"0.5",margin:"0 4px"},"\u2039"),u=!0;for(let h of i){let p=dr(h);if(p===a||a.startsWith(p))continue;let S=c("button",{background:"transparent",border:"none",color:"#a5b4fc",cursor:"pointer",font:"inherit",padding:"0",textDecoration:"underline"},p);S.onclick=()=>St(h),u||pe.append(l()),pe.append(S),u=!1}u||pe.append(l());let f=c("button",{background:"transparent",border:"none",color:"#a5b4fc",cursor:"pointer",font:"inherit",padding:"0",textDecoration:"underline",opacity:"0.7"},"Page");f.onclick=()=>eo(),pe.append(f),pe.style.display="block"},ur=o=>{ee.textContent="";let i=null,a=0;for(let u=o.parentElement;u&&u!==document.body&&a<6;u=u.parentElement,a++)if(ut(Xe(u,document),u,document)){i=u;break}let l=c("div",{marginBottom:"8px",padding:"8px 10px",borderRadius:"8px",fontSize:"12px",background:"rgba(252,165,165,0.12)",border:"1px solid rgba(252,165,165,0.4)"});if(i){let u=i;l.append(c("div",{marginBottom:"6px"},"This exact element can\u2019t be tracked safely \u2014 it looks identical to others on the page. You can pick something more specific inside it, or work with the whole block, which we can target reliably."));let f=c("button",le(K({},F("#6366f1")),{marginTop:"0"}),`Select \u201C${Me(u)}\u201D instead`);f.onclick=()=>St(u);let h=c("button",le(K({},F("transparent")),{opacity:"0.6"}),"Pick something else");h.onclick=()=>{ee.textContent=""},l.append(f,h)}else l.append(c("div",{},"This part of the page can\u2019t be targeted reliably \u2014 try a heading, a button, or a whole section instead."));ee.append(l)},St=o=>{kt(),ae(),ee.textContent="",t=o,oe=Xe(o,document);let i=ut(oe,o,document);Pe=i,g(),J.style.display="block",J.textContent=`Selected: ${Me(o)}`,cr(o),d("element_selected",{unique:i}),T(i?"\u2713 Matches exactly 1 element":"",i),i||ur(o),D.style.display="none",pn();for(let f of je)f.style.display="block";U.style.display="none",X.style.display="none";let a=vn(o);U.disabled=!i||!a,U.title=i?a?"":"This element contains other elements, so testing text here would replace them. Pick the text itself (e.g. the heading), not its container.":"",X.disabled=!i,ne.disabled=!i,Q.disabled=!i;let l=o.closest("form");P.style.display=l?"block":"none",P.disabled=!l;let u=en(o,document);ot=u.prevEl,rt=u.nextEl,Ee=u.prevLocator,Ue=u.nextLocator,Zn(),Nt()},eo=()=>{kt(),ae(),t=null,oe=null,Pe=!1,ot=null,rt=null,Ee=null,Ue=null,g(),ee.textContent="",pn(),pe.textContent="",pe.style.display="none",J.textContent="",J.style.display="none";for(let o of je)o.style.display="none";D.style.display="block",T(""),Nt()},it=!1,dn=-1,to=o=>{var l,u;let i=o.target,a=!!((l=i==null?void 0:i.closest)!=null&&l.call(i,'input, textarea, select, [contenteditable="true"]'));if(o.key==="Escape"){if(W.childElementCount>0){ae(),it=!1;return}if(t){eo(),it=!1;return}if(!it){it=!0,T("Press Esc again to close the editor.");return}it=!1,(u=_e.onclick)==null||u.call(_e,new MouseEvent("click"));return}if(it=!1,!(a||E)){if(o.key==="ArrowUp"||o.key==="ArrowDown"){if(!t||(o.key==="ArrowUp"?B:V).disabled)return;o.preventDefault(),fn(o.key==="ArrowUp"?"up":"down");return}if(o.key==="Tab"){let f=[];for(let p of On){let S=we(p.locator,document);S&&!f.includes(S)&&f.push(S)}if(f.length===0)return;if(nt){T("\u26A0 You have unsaved changes \u2014 Save or Cancel before picking another element.",!1),o.preventDefault();return}o.preventDefault(),dn=(dn+(o.shiftKey?-1:1)+f.length)%f.length;let h=f[dn];St(h);try{h.scrollIntoView({block:"center",behavior:"smooth"})}catch(p){}}}},no=o=>{if(E)return;let i=o.target;if(!(!i||y.contains(i))){if(o.preventDefault(),o.stopPropagation(),nt&&i!==t&&rn!==i){rn=i,T("\u26A0 You have unsaved changes \u2014 Save or Cancel first, or click that element again to discard them.",!1);return}St(i)}};U.onclick=()=>{var f,h;if(!t||!oe)return;d("form_opened",{kind:"text"});let o=oe,i=(h=(f=t.textContent)==null?void 0:f.trim())!=null?h:"";yt([{key:"current",label:"Current wording",value:i},{key:"alt",label:"Alternative wording to test",value:""}],"Save draft",async p=>{let S=p.alt.trim();if(!S){T("\u26A0 Enter alternative wording to test.",!1);return}if(S===p.current.trim()){T("\u26A0 Enter different wording \u2014 the alternative matches the current text.",!1);return}let C=Ce("text",o,t);T("Saving\u2026");let w=await de(e,`/v1/editor/slots/${encodeURIComponent(C)}`,{kind:"arms",target:vt(o,p[bt]),draftConfig:{arms:[{id:"a",displayName:"Original",ops:{text:p.current}},{id:"b",displayName:"Alternative",ops:{text:p.alt}}]}});w.r==="ok"&&(d("draft_saved",{kind:"slot"}),qn(),ae(),xt(C,Me(t),"b")),be(w,"\u2713 Saved as a draft. Click \u201CPublish\u201D below to go live.")},Ce("text",o,t));let a=t,l=xn(a);Oe=()=>{Ye(a,l)};let u=W.querySelector('input[data-field="alt"]');u==null||u.addEventListener("input",()=>{Ye(a,u.value.trim()===""?l:u.value)})};let Et=null,oo=o=>{let i=p=>{var S;return((S=p.textContent)!=null?S:"").replace(/\s+/g," ").trim()},a=Array.from(o.querySelectorAll("h1,h2,h3,h4")).map(i).filter(Boolean);if(a.length===0){let p=o.closest("h1,h2,h3,h4");p&&a.push(i(p))}let l=Array.from(o.querySelectorAll("p")).map(i).filter(p=>p.length>0&&p.length<=300),u=[];for(let p of Array.from(o.querySelectorAll("a[href], button"))){let S=i(p);if(!S||S.length>60)continue;let C="",w=p.getAttribute("href");if(w)try{let v=new URL(w,window.location.href);v.protocol==="https:"&&(C=v.href)}catch(v){}u.push({label:S,href:C})}let f=Array.from(o.querySelectorAll("blockquote, q")).map(i).filter(Boolean);if(f.length===0&&wi.test(`${o.className} ${o.id}`))for(let p of l)p.length>=20&&f.push(p);let h=Array.from(o.querySelectorAll('cite, figcaption, footer, [class*="author"]')).map(i).filter(p=>p.length>0&&p.length<=80);return{headings:a,paragraphs:l,links:u,quotes:f,attributions:h}},pr=(o,i)=>{var l,u,f,h,p,S,C,w,v,b,A,R,H,G,N,ge,me,_,j,se;let a=Ae=>{var Re;return i.paragraphs.length>=3&&(Re=i.paragraphs[i.paragraphs.length-3+Ae])!=null?Re:""};switch(o){case"headline":return(l=i.headings[0])!=null?l:"";case"supporting":return(u=i.paragraphs[0])!=null?u:"";case"cta_label":return(h=(f=i.links[0])==null?void 0:f.label)!=null?h:"";case"cta_href":return(S=(p=i.links[0])==null?void 0:p.href)!=null?S:"";case"secondary_label":return(w=(C=i.links[1])==null?void 0:C.label)!=null?w:"";case"secondary_href":return(b=(v=i.links[1])==null?void 0:v.href)!=null?b:"";case"quote":case"q1":return(A=i.quotes[0])!=null?A:"";case"q2":return(R=i.quotes[1])!=null?R:"";case"q3":return(H=i.quotes[2])!=null?H:"";case"name":case"n1":return(G=i.attributions[0])!=null?G:"";case"n2":return(N=i.attributions[1])!=null?N:"";case"n3":return(ge=i.attributions[2])!=null?ge:"";case"role":return(me=i.attributions[1])!=null?me:"";case"eyebrow":return"";case"f1_title":return(_=i.headings[1])!=null?_:"";case"f2_title":return(j=i.headings[2])!=null?j:"";case"f3_title":return(se=i.headings[3])!=null?se:"";case"f1_body":return a(0);case"f2_body":return a(1);case"f3_body":return a(2);default:return""}},fr=(o,i,a)=>{d("form_opened",{kind:"arrangement"});let l=oo(a);yt(o.fields.map(u=>({key:u.id,label:u.kind==="href"?`${u.label} (https link \u2014 required)`:u.label,value:pr(u.id,l)})),"Save draft",async(u,f)=>{var A,R,G,N,ge;let h=!1,p=!1;for(let me of o.fields){if(me.kind==="href"){let j=!1;try{j=new URL((A=u[me.id])!=null?A:"").protocol==="https:"}catch(se){}f(me.id,j?null:"Links need to start with https://"),j||(h=!0);continue}let _=((R=u[me.id])!=null?R:"").trim()==="";f(me.id,_?"Fill this in with your own words":null),_&&(p=!0)}if(h){T("\u26A0 Fix the highlighted link(s).",!1);return}if(p){T("\u26A0 Every field needs your own words \u2014 this layout re-arranges your copy, it doesn\u2019t write any.",!1);return}T("Saving\u2026");let H=u,{[bt]:S}=H,C=po(H,[uo(bt)]),w=await vi(e,`/v1/editor/arrangements/${encodeURIComponent(o.id)}/instantiate`,{fields:C});if(w.r!=="ok"||!((G=w.data)!=null&&G.blocks)){w.r==="expired"?be(w.outcome,""):T(`\u26A0 ${(ge=(N=w.data)==null?void 0:N.reason)!=null?ge:"Couldn\u2019t build the arrangement \u2014 check the fields."}`,!1);return}let v=Ce("arrange",i,a),b=await de(e,`/v1/editor/slots/${encodeURIComponent(v)}`,{kind:"arms",target:vt(i,S),draftConfig:{arms:[{id:"original",displayName:"Your page today"},{id:o.id,displayName:o.name,blocks:w.data.blocks}],baseline:"original"}});b.r==="ok"&&(d("draft_saved",{kind:"arrangement"}),ae(),xt(v,o.name,o.id)),be(b,"\u2713 Saved as a draft \u2014 it will test against this section as it is today. Click \u201CPublish\u201D below to go live.")},Ce("arrange",i,a))};ne.onclick=async()=>{var f,h;if(!t||!oe)return;let o=oe,i=t;if(ae(),T("Loading arrangements\u2026"),!Et){let p=await ft(e,"/v1/editor/arrangements");Et=(f=p==null?void 0:p.arrangements)!=null?f:null}if(!Et||Et.length===0){T("\u26A0 Couldn\u2019t load the arrangements \u2014 try again.",!1);return}let a=or(oo(i)),l=Et.filter(p=>a.includes(p.sectionType));if(l.length===0){T("No other layout fits this section. Layouts re-arrange the words already here \u2014 they don\u2019t add sections your page doesn\u2019t have.",!1);return}T("Pick a layout for this section \u2014 your own words are carried across.");for(let p of l){let S=c("button",le(K({},F("#374151")),{textAlign:"left"}));S.append(c("div",{fontWeight:"600"},p.name),c("div",{fontSize:"11px",opacity:"0.7"},p.description)),S.onclick=()=>fr(p,o,i),W.append(S)}let u=c("button",le(K({},F("transparent")),{opacity:"0.6"}),"Cancel");u.onclick=ae,W.append(u),(h=W.scrollIntoView)==null||h.call(W,{block:"nearest"})};let at=null,gr=(o,i)=>{at=o,ue.textContent=i?`Start tracking \u201C${jt(i)}\u201D now`:"Start tracking now",ue.style.display="block",jn(i?`Goal \u201C${jt(i)}\u201D saved \u2014 it isn\u2019t counting anything until you start it.`:"Goal saved \u2014 it isn\u2019t counting anything until you start it.",[Dt(`/v1/editor/goals/${encodeURIComponent(o)}`,"\u{1F5D1} Draft goal discarded \u2014 it never tracked anything.",()=>Jn(o))])};ue.onclick=async()=>{if(!at)return;ue.disabled=!0,T("Activating\u2026");let o=await de(e,`/v1/editor/goals/${encodeURIComponent(at)}/publish`,{});ue.disabled=!1,o.r==="ok"?(d("published",{kind:"goal"}),T("\u2713 Tracking is live \u2014 it counts from your next visitor.",!0),ue.style.display="none",at=null,Ke.textContent=""):o.r==="expired"?T("Editor session expired \u2014 reopen it from your dashboard to activate. Your saved goal is safe.",!1):T(sn(o,"activate"),!1)};let st=(o,i)=>`${pt(o)||"goal"}-${Zo(i)}`.slice(0,128),ro=o=>{var l,u,f;let i=((l=o.textContent)!=null?l:"").replace(/\s+/g," ").trim();return i&&i.length<=60?i:((f=(u=o.getAttribute("aria-label"))!=null?u:o.getAttribute("id"))!=null?f:"").trim()||"element-clicked"},Tt=async(o,i,a)=>{T("Saving\u2026");let l=await de(e,`/v1/editor/goals/${encodeURIComponent(o)}`,i);return l.r==="ok"&&(d("draft_saved",{kind:"goal"}),gr(o,a)),be(l,"\u2713 Goal saved. Click \u201CStart tracking\u201D below to go live."),l};Q.onclick=()=>{if(!t||!oe)return;let o=st(ro(t),JSON.stringify(oe));Tt(o,{event:"click",locator:oe},Me(t))},P.onclick=()=>{var l,u;let o=t==null?void 0:t.closest("form");if(!o)return;let i=Xe(o,document),a=(u=(l=o.getAttribute("id"))!=null?l:o.getAttribute("name"))!=null?u:"form-submitted";Tt(st(a,JSON.stringify(i)),{event:"form_submit",locator:i},a)},re.onclick=()=>{let o=window.location.pathname||"/",i=pt(o)?`reached-${pt(o)}`:"page-visited";Tt(st(i,o),{event:"url_reached",urlPattern:o},o)};let cn=[{label:"25% \u2014 skimmed the top",value:.25},{label:"50% \u2014 read halfway",value:.5},{label:"75% \u2014 read most of the page",value:.75},{label:"90% \u2014 read to the end",value:.9}];ie.onclick=()=>{yt([{key:"depth",label:"Counts once a visitor reads",type:"select",options:cn.map(o=>o.label)}],"Track it",o=>{var l;let i=(l=cn.find(u=>u.label===o.depth))!=null?l:cn[2],a=Math.round(i.value*100);Tt(`read-${a}pct`,{event:"scroll_depth",threshold:i.value},`read ${a}%`),ae()})};let Gt=null,mr=o=>{Gt=o,q.style.display="block"};q.onclick=async()=>{if(!Gt)return;q.disabled=!0,T("Turning on\u2026");let o=await de(e,`/v1/editor/funnels/${encodeURIComponent(Gt)}/publish`,{});q.disabled=!1,o.r==="ok"?(d("published",{kind:"funnel"}),T("\u2713 Funnel is on \u2014 the drop-off view fills in as visitors move through it.",!0),q.style.display="none",Gt=null):o.r==="expired"?T("Editor session expired \u2014 reopen it from your dashboard to turn the funnel on. Your draft is safe.",!1):T("\u26A0 Couldn\u2019t turn the funnel on \u2014 try again.",!1)},I.onclick=async()=>{var w;T("Loading your goals\u2026");let o=await ft(e,"/v1/editor/goals"),i=(w=o==null?void 0:o.goals)!=null?w:[];if(i.length<2){T("Track at least 2 goals first \u2014 a funnel is a sequence of them (e.g. \u201Cviewed pricing\u201D \u2192 \u201Csigned up\u201D).",!1);return}T("Pick the steps in order \u2014 first click = first step."),ae();let a=[],l=c("label",{display:"block",fontSize:"12px",opacity:"0.85",marginTop:"8px"},"Funnel name"),u=c("input",Rt);W.append(l,u);let f=c("div",{fontSize:"11px",opacity:"0.7",marginTop:"6px"},"Steps (click in journey order):");W.append(f);let h=new Map,p=()=>{var v,b;for(let[A,R]of h){let H=a.indexOf(A),G=(b=(v=i.find(N=>N.goal_id===A))==null?void 0:v.display_name)!=null?b:A;R.textContent=H===-1?G:`${H+1}. ${G}`,R.style.background=H===-1?"#374151":"#6366f1"}};for(let v of i){let b=c("button",le(K({},F("#374151")),{textAlign:"left"}));h.set(v.goal_id,b),b.onclick=()=>{a=Wo(a,v.goal_id),p()},W.append(b)}p();let S=c("button",F("#6366f1"),"Save funnel"),C=c("button",le(K({},F("transparent")),{opacity:"0.6"}),"Cancel");C.onclick=ae,S.onclick=async()=>{let v=qo(u.value,a);if(!v.ok){T(`\u26A0 ${v.error}`,!1);return}T("Saving\u2026");let b=await de(e,`/v1/editor/funnels/${encodeURIComponent(v.funnelId)}`,v.body);b.r==="ok"&&(d("draft_saved",{kind:"funnel"}),ae(),mr(v.funnelId)),be(b,"\u2713 Funnel saved as a draft. Click \u201CTurn the funnel on\u201D to start measuring.")},W.append(S,C)},M.onclick=async()=>{var p,S;let o=Ge;if(!o)return;T("Loading funnels\u2026");let i=await ft(e,"/v1/editor/funnels"),a=(p=i==null?void 0:i.funnels)!=null?p:[];if(a.length===0){T("No funnels yet \u2014 click \u201CSet up a funnel\u201D first.",!1);return}let l=await ft(e,"/v1/editor/goals"),u=new Map(((S=l==null?void 0:l.goals)!=null?S:[]).map(C=>[C.goal_id,C.display_name]));yt([{key:"funnel",label:"Funnel",type:"select",options:a.map(C=>Xt(C))},{key:"step",label:"Which step does this element serve?",type:"select",options:Zt(a[0],u).map(C=>C.label)}],"Attach",async C=>{var A;let w=(A=a.find(R=>Xt(R)===C.funnel))!=null?A:a[0],v=Zt(w,u).findIndex(R=>R.label===C.step);if(v<0){T("\u26A0 Pick which step this element serves.",!1);return}T("Attaching\u2026");let b=await de(e,`/v1/editor/funnels/${encodeURIComponent(w.funnel_id)}/assign`,{slotId:o,stepIndex:v});b.r==="ok"&&ae(),be(b,`\u2713 Attached \u2014 this test now works toward \u201C${w.display_name}\u201D.`)});let f=W.querySelector('select[data-field="funnel"]'),h=W.querySelector('select[data-field="step"]');f&&h&&f.addEventListener("change",()=>{var w;let C=(w=a.find(v=>Xt(v)===f.value))!=null?w:a[0];h.length=1;for(let v of Zt(C,u)){let b=document.createElement("option");b.value=v.label,b.textContent=v.label,h.append(b)}})},X.onclick=()=>{if(!t||!oe)return;d("form_opened",{kind:"style"});let o=oe;yt([{key:"color",label:"Text colour",type:"color"},{key:"background",label:"Background colour",type:"color"},{key:"fontSize",label:"Font size (e.g. 20px)"},{key:"fontWeight",label:"Font weight (e.g. 700)"},{key:"fontFamily",label:$n.length?`Font (this site has: ${$n.slice(0,3).join(", ")})`:"Font (e.g. Georgia, serif)"},{key:"borderRadius",label:"Corner radius (e.g. 8px)"},{key:"textAlign",label:"Alignment",type:"select",options:["left","center","right","justify"]}],"Save draft",async(h,p)=>{var A;let{style:S,errors:C}=Mn(h),w=!1;for(let R of Pn)p(R,(A=C[R])!=null?A:null),C[R]&&(w=!0);if(w){T("\u26A0 Fix the highlighted field(s).",!1);return}if(Object.keys(S).length===0){T("\u26A0 Enter at least one style change.",!1);return}let v=Ce("style",o,t);T("Saving\u2026");let b=await de(e,`/v1/editor/slots/${encodeURIComponent(v)}`,{kind:"arms",target:vt(o,h[bt]),draftConfig:{arms:[{id:"a",displayName:"Current look",ops:{}},{id:"b",displayName:"New look",ops:{style:S}}]}});b.r==="ok"&&(d("draft_saved",{kind:"slot"}),qn(),ae(),xt(v,Me(t),"b")),be(b,"\u2713 Saved as a draft. Click \u201CPublish\u201D below to go live.")},Ce("style",o,t));let i=t,a=i.style.cssText;Oe=()=>{i.style.cssText=a};let l={},u=()=>{let{style:h}=Mn(l);i.style.cssText=a;for(let[p,S]of Object.entries(h)){let C=It[p];C&&dt(S)&&i.style.setProperty(C,S.trim(),"important")}};for(let h of Pn){let p=W.querySelector(`[data-field="${h}"]`);if(!p)continue;let S=()=>{l[h]=p.value,u()};p.addEventListener("input",S),p.addEventListener("change",S)}let f=[Ze==null?void 0:Ze.primaryBg,Ze==null?void 0:Ze.primaryText,"#ffffff"].filter(h=>!!h).map(Bn).filter((h,p,S)=>Nn(h)&&S.indexOf(h)===p);for(let h of["color","background"]){let p=W.querySelector(`input[data-field="${h}"]`);if(!p)continue;let S=c("div",{display:"flex",gap:"6px",marginTop:"4px"});for(let C of f){let w=c("button",{width:"22px",height:"22px",borderRadius:"6px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.35)",background:C,padding:"0"});w.title=C,w.onclick=()=>{p.value=Bn(C),p.dispatchEvent(new Event("input"))},S.append(w)}p.after(S)}};let We=[],Ct=new Map,un=!1,fe=null,te=null,Lt=null,hr=()=>{Ct.clear();let o=[],i=(a,l,u)=>{var p;if(o.length>=16||[...Ct.values()].some(S=>S.node===a))return;let f=a===t,h=f?"selected":`e${o.length}`;Ct.set(h,{node:a,locator:l}),o.push(K(K({ref:h,tag:a.tagName.toLowerCase().slice(0,16),text:((p=a.textContent)!=null?p:"").replace(/\s+/g," ").trim().slice(0,300),isLeaf:vn(a),inForm:!!a.closest("form")},f?{selected:!0}:{}),u?{label:u.slice(0,120)}:{}))};t&&oe&&Pe&&i(t,oe);for(let a of On){let l=we(a.locator,document);l&&i(l,a.locator,a.label)}return{pagePath:Mt(location.pathname),pageTitle:document.title.slice(0,200),elements:o}},qe=(o,i="")=>{let a=o==="user",l=c("div",{margin:"6px 0",padding:"7px 10px",borderRadius:"10px",fontSize:"12px",lineHeight:"1.45",whiteSpace:"pre-wrap",wordBreak:"break-word",maxWidth:"88%",marginLeft:a?"auto":"0",background:a?"#6366f1":o==="note"?"transparent":"rgba(255,255,255,0.07)",opacity:o==="note"?"0.75":"1"},i);return fe==null||fe.append(l),fe&&(fe.scrollTop=fe.scrollHeight),l},pn=()=>{Lt&&(Lt.textContent=t?Pe?`Looking at: ${Me(t)}`:"This element can\u2019t be targeted reliably \u2014 pick a heading, button, or section.":"Nothing selected \u2014 click an element, or ask for a page goal.")},io=(o,i)=>{var u;zt();let a=xn(o),l=o.style.cssText;if(Oe=()=>{Ye(o,a),o.style.cssText=l},!!i){typeof i.text=="string"&&Ye(o,i.text);for(let[f,h]of Object.entries((u=i.style)!=null?u:{})){let p=It[f];p&&typeof h=="string"&&dt(h)&&o.style.setProperty(p,h.trim(),"important")}}},yr=async o=>{var A,R;let i=Ct.get(o.ref);if(!i||!i.node.isConnected)return"\u26A0 That element is no longer on the page \u2014 click it and ask again.";let{node:a,locator:l}=i,u=o.versions.some(H=>typeof H.ops.text=="string"),f=Ce(u?"text":"style",l,a),h=Ln(location.pathname,an[f])[0];T("Saving\u2026");let p=await de(e,`/v1/editor/slots/${encodeURIComponent(f)}`,{kind:"arms",target:vt(l,h),draftConfig:{arms:[{id:"a",displayName:"Original",ops:u?{text:((A=a.textContent)!=null?A:"").trim()}:{}},...o.versions]}});if(be(p,"\u2713 Draft saved and previewing \u2014 nothing is live until you publish."),p.r!=="ok")return(R=Z.textContent)!=null?R:"\u26A0 Couldn\u2019t save the draft.";d("draft_saved",{kind:"slot",via:"chat"}),a!==t&&St(a),ae();let S=a;io(S,o.versions[0].ops),ht=f;try{S.scrollIntoView({block:"center",behavior:"smooth"})}catch(H){}xt(f,o.label,o.versions[0].id);let C=qe("assistant");C.textContent="",C.append(c("div",{fontWeight:"600",marginBottom:"6px"},`Draft: ${o.label}`));let w=c("div",{display:"flex",gap:"5px",flexWrap:"wrap"}),v=[],b=(H,G)=>{for(let N of v)N.style.background="#374151";H.style.background="#6366f1",io(S,G),ht=f};for(let[H,G]of[["Original",null],...o.versions.map(N=>[N.displayName,N.ops])]){let N=Le("#374151",H);N.onclick=()=>b(N,G),v.push(N),w.append(N)}return v[1].style.background="#6366f1",C.append(w),`[Created draft "${o.label}" with ${o.versions.length} version(s)]`},br=(o,i,a)=>{var h;let l=[],u={position:"absolute",pointerEvents:"none",zIndex:"2147483645",padding:"2px 6px",borderRadius:"4px",background:"#f59e0b",color:"#111827",font:"600 11px system-ui, sans-serif",whiteSpace:"nowrap"},f=null;if(o){let p=o.getBoundingClientRect();f=p.top+window.scrollY,l.push(c("div",{position:"absolute",pointerEvents:"none",zIndex:"2147483645",left:`${p.left+window.scrollX-3}px`,top:`${f-3}px`,width:`${p.width+6}px`,height:`${p.height+6}px`,border:"2px dashed #f59e0b",borderRadius:"6px"}),c("div",le(K({},u),{left:`${p.left+window.scrollX}px`,top:`${Math.max(0,f-24)}px`}),`Goal: ${a}`))}else i!==void 0&&(f=Math.round(document.documentElement.scrollHeight*i),l.push(c("div",{position:"absolute",pointerEvents:"none",zIndex:"2147483645",left:"0",right:"0",top:`${f}px`,borderTop:"2px dashed #f59e0b"}),c("div",le(K({},u),{left:"16px",top:`${f+4}px`}),`Goal counts here: ${a}`)));if(l.length!==0){if(((h=document.body)!=null?h:document.documentElement).append(...l),f!==null)try{window.scrollTo({top:Math.max(0,f-window.innerHeight/3),behavior:"smooth"})}catch(p){}setTimeout(()=>{for(let p of l)p.remove()},6e3)}},vr=async o=>{var f,h,p,S,C,w;let i=null,a,l;if(o.event==="click"||o.event==="form_submit"){let v=o.ref?Ct.get(o.ref):void 0;if(!v||!v.node.isConnected)return"\u26A0 That element is no longer on the page \u2014 click it and ask again.";if(o.event==="click")i=v.node,a=st(ro(i),JSON.stringify(v.locator)),l={event:"click",locator:v.locator};else{let b=v.node.closest("form");if(!b)return"\u26A0 That element isn\u2019t inside a form.";let A=Xe(b,document);if(!ut(A,b,document))return"\u26A0 This form can\u2019t be targeted reliably, so it can\u2019t be tracked.";i=b,a=st((h=(f=b.getAttribute("id"))!=null?f:b.getAttribute("name"))!=null?h:"form-submitted",JSON.stringify(A)),l={event:"form_submit",locator:A}}}else if(o.event==="url_reached"){let v=(p=o.urlPattern)!=null?p:Mt(location.pathname);a=st(pt(v)?`reached-${pt(v)}`:"page-visited",v),l={event:"url_reached",urlPattern:v}}else a=`read-${Math.round(((S=o.threshold)!=null?S:.75)*100)}pct`,l={event:"scroll_depth",threshold:(C=o.threshold)!=null?C:.75};return(await Tt(a,le(K({},l),{displayName:o.displayName}),o.displayName)).r!=="ok"?(w=Z.textContent)!=null?w:"\u26A0 Couldn\u2019t save the goal.":(br(i,o.event==="scroll_depth"?l.threshold:void 0,o.displayName),`[Created draft goal "${o.displayName}"]`)},ao=async o=>{var S,C,w;let i=o.trim();if(!i||un)return;un=!0,te&&(te.value="",te.disabled=!0),qe("user",i),We.push({role:"user",content:i.slice(0,4e3)}),d("form_opened",{kind:"chat"});let a=qe("assistant","\u2026"),l="",u=!1,f=[],h=[],p=v=>{var A,R;if(v==="[DONE]")return;let b;try{b=JSON.parse(v)}catch(H){return}if(b.error){f.push("\u26A0 The assistant hit a problem \u2014 try again.");return}if(b.type==="delta"&&b.text)u&&l&&(l+=`
24
+ `,((t=document.head)!=null?t:document.documentElement).appendChild(e)}function Qt(e){var r,s;Qo(),(r=document.getElementById(tn))==null||r.remove();let t=c("div",{position:"fixed",bottom:"16px",right:"16px",zIndex:"2147483647",maxWidth:"320px",padding:"14px 16px",borderRadius:"14px",background:"#111827",color:"#fff",font:"13px/1.45 system-ui, sans-serif",border:"1px solid rgba(245,158,11,0.6)",boxShadow:"0 10px 34px rgba(0,0,0,0.45)",display:"flex",gap:"10px",alignItems:"flex-start",cursor:"pointer"});t.id=tn;let n=c("span",{width:"9px",height:"9px",marginTop:"4px",borderRadius:"50%",background:"#f59e0b",flex:"0 0 auto"});t.append(n,c("div",{},e)),((s=document.body)!=null?s:document.documentElement).appendChild(t),t.addEventListener("click",()=>t.remove()),setTimeout(()=>t.remove(),1e4)}function hi(){let e=window.__sentientEditor;return e&&typeof e.apiBase=="string"&&(typeof e.token=="string"||typeof e.code=="string")?e:null}async function er(e){try{let t=await fetch(`${e.apiBase}/v1/editor/exchange`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:e.code})}),n=t.ok?(await t.json()).token:null;return e.code=null,n?(e.token=n,Go(n),200):t.ok?500:t.status}catch(t){return 0}}async function yi(e){try{let t=await fetch(`${e.apiBase}/v1/editor/verify`,{headers:{authorization:`Bearer ${e.token}`}});if(t.status===401)return{ok:!1,unauthorized:!0};if(!t.ok)return{ok:!1,unauthorized:!1};let n=(await t.json()).projectId;return n?{ok:!0,projectId:n}:{ok:!1,unauthorized:!1}}catch(t){return{ok:!1,unauthorized:!1}}}function Rn(e,t){return K(K(K(K({r:e===401?"expired":"error",status:e},typeof(t==null?void 0:t.error)=="string"?{code:t.error}:{}),typeof(t==null?void 0:t.message)=="string"?{message:t.message}:{}),typeof(t==null?void 0:t.feature)=="string"?{feature:t.feature}:{}),typeof(t==null?void 0:t.plan)=="string"?{plan:t.plan}:{})}async function de(e,t,n){try{let r=await fetch(`${e.apiBase}${t}`,{method:"POST",headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify(n)});if(r.ok)return{r:"ok"};let s=await r.json().catch(()=>null);return Rn(r.status,s)}catch(r){return{r:"error"}}}async function bi(e,t){try{let n=await fetch(`${e.apiBase}${t}`,{method:"DELETE",headers:{authorization:`Bearer ${e.token}`}});if(n.ok)return{r:"ok"};let r=await n.json().catch(()=>null);return Rn(n.status,r)}catch(n){return{r:"error"}}}async function vi(e,t,n){try{let r=await fetch(`${e.apiBase}${t}`,{method:"POST",headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify(n)}),s=await r.json().catch(()=>null);return r.ok?{r:"ok",data:s,outcome:{r:"ok"}}:{r:r.status===401?"expired":"error",data:s,outcome:Rn(r.status,s)}}catch(r){return{r:"error",data:null,outcome:{r:"error"}}}}var $n=[];function Nn(e){return/^#[0-9a-fA-F]{6}$/.test(e)}function Bn(e){let t=e.trim();if(Nn(t))return t;let n=/^#([0-9a-fA-F]{3})$/.exec(t);if(n)return`#${n[1].split("").map(d=>d+d).join("")}`;let r=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/.exec(t);if(!r)return t;let s=d=>Math.min(255,Number(d)).toString(16).padStart(2,"0");return`#${s(r[1])}${s(r[2])}${s(r[3])}`}var Ze=null,On=[];function tr(e){On=e}async function xi(e){try{let t=await fetch(`${e.apiBase}/v1/editor/targets`,{headers:{authorization:`Bearer ${e.token}`}});if(!t.ok)return[];let n=await t.json();return $n=Array.isArray(n.fonts)?n.fonts.filter(r=>typeof r=="string"):[],Array.isArray(n.targets)?n.targets:[]}catch(t){return[]}}async function ft(e,t){try{let n=await fetch(`${e.apiBase}${t}`,{headers:{authorization:`Bearer ${e.token}`}});return n.ok?await n.json():null}catch(n){return null}}function mt(e=document){for(let t of Array.from(e.querySelectorAll(`.${In}`)))t.remove()}function nr(e,t=document){var r;mt(t);let n=0;for(let s of e){if(n>=mi)break;let d=we(s.locator,t);if(!d)continue;let m=d.getBoundingClientRect(),w=c("div",{position:"fixed",pointerEvents:"none",zIndex:"2147483645",left:`${m.left}px`,top:`${m.top}px`,width:`${m.width}px`,height:`${m.height}px`,border:"2px dashed #10b981",background:"rgba(16,185,129,0.08)"});w.className=In;let g=c("div",{position:"fixed",pointerEvents:"none",zIndex:"2147483645",left:`${m.left}px`,top:`${Math.max(0,m.top-20)}px`,padding:"2px 6px",borderRadius:"4px",background:"#10b981",color:"#fff",font:"11px system-ui, sans-serif",whiteSpace:"nowrap"},s.label);g.className=In,((r=t.body)!=null?r:t.documentElement).append(w,g),n+=1}}function en(e,t){let n=e.previousElementSibling,r=e.nextElementSibling,s=n?Xe(n,t):null,d=r?Xe(r,t):null;return{prevEl:n,nextEl:r,prevLocator:n&&s&&ut(s,n,t)?s:null,nextLocator:r&&d&&ut(d,r,t)?d:null}}var wi=/testimonial|review|quote/i;function or(e){let t=[],n=e.headings.length>=1,r=e.links.length>=1;return n&&r&&t.push("hero","cta_band"),e.headings.length>=2&&e.paragraphs.length>=2&&t.push("feature_grid"),e.quotes.length>=1&&t.push("testimonial"),t}var Pn=["color","background","fontSize","fontWeight","borderRadius","textAlign","fontFamily"],ki=/^(0|\d*\.?\d+(px|rem|em|%|vh|vw|vmin|vmax|ch|pt))$/i,Si=new Set(["left","center","right","justify","start","end"]),Ei=/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Ti=/^(rgb|rgba|hsl|hsla)\(/i;function Ci(e){return Ei.test(e)||Ti.test(e)}function rr(e,t){switch(e){case"fontSize":case"borderRadius":return ki.test(t)?null:"Add a unit, e.g. 20px or 1.5rem.";case"fontWeight":return/^(normal|bold|bolder|lighter)$/i.test(t)||/^\d{1,4}$/.test(t)&&+t>=1&&+t<=1e3?null:"Use 100\u2013900, or normal/bold.";case"textAlign":return Si.has(t.toLowerCase())?null:"Choose left, center, right, or justify.";case"color":case"background":return Ci(t)?null:"Enter a colour, e.g. #1a1a1a.";case"fontFamily":{let n=t.split(",").map(r=>r.trim().replace(/^['"]|['"]$/g,""));return t.length<=120&&n.length>=1&&n.length<=5&&n.every(r=>/^[A-Za-z0-9][A-Za-z0-9 -]*$/.test(r))?null:"Use a font name, e.g. Georgia, serif."}default:return null}}function Mn(e){let t={},n={};for(let r of Pn){let s=e[r];if(typeof s!="string")continue;let d=s.trim();if(d==="")continue;if(!dt(d)){n[r]="That value isn\u2019t allowed.";continue}let m=rr(r,d);if(m){n[r]=m;continue}t[r]=d}return{style:t,errors:n}}var Rt={display:"block",width:"100%",boxSizing:"border-box",marginTop:"4px",padding:"7px 9px",borderRadius:"8px",border:"1px solid rgba(255,255,255,0.18)",background:"#1f2937",color:"#fff",font:"13px system-ui, sans-serif"};function c(e,t,n){let r=document.createElement(e);return Object.assign(r.style,t),n!==void 0&&(r.textContent=n),r}function ir(e){var so;let t=null,n=[],r=null,s=()=>{for(;n.length>0;){let o=n.splice(0,20);try{fetch(`${e.apiBase}/v1/editor/telemetry`,{method:"POST",keepalive:!0,headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify({events:o})}).catch(()=>{})}catch(i){}}},d=(o,i)=>{n.push(K({kind:o},i?{meta:i}:{})),r&&clearTimeout(r),r=setTimeout(s,2e3)};window.addEventListener("pagehide",s);let m=c("div",{position:"fixed",pointerEvents:"none",zIndex:"2147483646",border:"2px solid #6366f1",background:"rgba(99,102,241,0.12)",display:"none"});m.id=fi;let w=c("div",{position:"fixed",pointerEvents:"none",zIndex:"2147483646",border:"2px solid #10b981",background:"rgba(16,185,129,0.10)",borderRadius:"4px",display:"none"});w.id=gi;let g=()=>{if(!t||!t.isConnected){w.style.display="none";return}let o=t.getBoundingClientRect();Object.assign(w.style,{display:"block",left:`${o.left-2}px`,top:`${o.top-2}px`,width:`${o.width}px`,height:`${o.height}px`})},x=()=>g();Qo();let y=c("div",{position:"fixed",bottom:"16px",right:"16px",zIndex:"2147483647",width:"min(408px, calc(100vw - 32px))",padding:"16px",borderRadius:"14px",background:"#111827",color:"#fff",font:"13px/1.4 system-ui, sans-serif",border:"1px solid rgba(99,102,241,0.55)",boxShadow:"0 10px 34px rgba(0,0,0,0.45)",maxHeight:"calc(100vh - 32px)",overflowY:"auto",overscrollBehavior:"contain"});y.id=gt;let $=c("span",{width:"9px",height:"9px",borderRadius:"50%",background:"#34d399",display:"inline-block",flex:"0 0 auto"});$.className="sntedi-dot";let L=c("div",{display:"flex",alignItems:"center",gap:"8px",fontWeight:"700",fontSize:"14px",marginBottom:"6px"});L.append($,c("span",{},"SentientUI"));let D=c("div",{opacity:"0.85",marginBottom:"8px"},"Click any element on the page to adapt it."),E=!1,z=c("button",F("#374151"),"Pause selecting");z.onclick=()=>{E=!E,z.textContent=E?"Resume selecting":"Pause selecting",E?(m.style.display="none",mt(document),T("Selection paused \u2014 browse normally, then resume.")):T("Click any element on the page to adapt it.")};let J=c("div",{fontSize:"12px",marginBottom:"6px",padding:"5px 8px",borderRadius:"8px",background:"rgba(16,185,129,0.14)",border:"1px solid rgba(16,185,129,0.45)",display:"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),Z=c("div",{fontSize:"12px",marginBottom:"8px",minHeight:"16px"}),U=c("button",F("#6366f1"),"Test different text here"),X=c("button",F("#374151"),"Change style"),ne=c("button",F("#374151"),"Try a different layout for this section"),Q=c("button",F("#374151"),"Track clicks as a goal"),P=c("button",F("#374151"),"Track form submissions as a goal"),re=c("button",F("#374151"),"Track page visits as a goal"),ie=c("button",F("#374151"),"Track reading this far as a goal"),I=c("button",F("#374151"),"Set up a funnel"),M=c("button",F("#374151"),"Attach this test to a funnel step"),q=c("button",F("#10b981"),"Turn the funnel on"),B=c("button",F("#374151"),"Move up"),V=c("button",F("#374151"),"Move down"),Se=c("button",F("#6366f1"),"Save this arrangement"),ze=c("button",F("#374151"),"Undo"),_e=An("close","Close editor"),ye=c("button",F("#10b981"),"Publish now \u2014 go live"),ue=c("button",F("#10b981"),"Start tracking now");for(let o of[U,X,ne,Q,B,V])o.disabled=!0;let je=[U,X,ne,Q,P,B,V];for(let o of je)o.style.display="none";Se.style.display="none",ze.style.display="none",ye.style.display="none",ue.style.display="none",M.style.display="none",q.style.display="none";let pe=c("div",{display:"none",fontSize:"11px",opacity:"0.75",marginBottom:"2px",lineHeight:"1.8",overflow:"hidden",textOverflow:"ellipsis"}),ee=c("div",{}),Ie=[{id:"text",label:"Text",icon:"\u270F\uFE0F"},{id:"style",label:"Style",icon:"\u{1F3A8}"},{id:"layout",label:"Layout",icon:"\u{1F9F1}"},{id:"goals",label:"Goals",icon:"\u{1F3AF}"},{id:"funnels",label:"Funnels",icon:"\u{1F9ED}"},{id:"drafts",label:"Drafts",icon:"\u{1F5C2}\uFE0F"}],Y="text",et=new Map,ve=new Map,$e=new Map,Dn=c("div",{display:"flex",gap:"0",margin:"10px 0 0",justifyContent:"space-between",borderBottom:"1px solid rgba(255,255,255,0.1)"}),Hn=c("div",{paddingTop:"10px"});for(let o of Ie){let i=c("button",{background:"transparent",border:"none",cursor:"pointer",font:"600 11.5px system-ui, sans-serif",color:"#9ca3af",whiteSpace:"nowrap",padding:"7px 5px",borderBottom:"2px solid transparent",marginBottom:"-1px"});i.append(c("span",{fontSize:"11px",marginRight:"3px"},o.icon),c("span",{},o.label)),i.onclick=()=>ar(o.id),et.set(o.id,i),Dn.append(i);let a=c("div",{display:"none"}),l=c("div",{fontSize:"12px",opacity:"0.7",padding:"2px 0 6px",display:"none"});a.append(l),$e.set(o.id,l),ve.set(o.id,a),Hn.append(a)}ve.get("text").append(U),ve.get("style").append(X),ve.get("layout").append(ne,B,V,Se,ze),ve.get("goals").append(Q,P,re,ie),ve.get("funnels").append(I,M,q);let xe=c("div",{});ve.get("drafts").append(xe);let Nt=()=>{var i,a;for(let l of Ie){let u=l.id===Y,f=et.get(l.id);f.style.color=u?"#ffffff":"#9ca3af",f.style.borderBottom=u?"2px solid #6366f1":"2px solid transparent",ve.get(l.id).style.display=u?"block":"none",$e.get(l.id).style.display="none"}let o=l=>{let u=$e.get(Y);u.textContent=l,u.style.display="block"};Y==="text"?t?U.disabled?o(U.title||"This element can\u2019t be targeted reliably \u2014 try its heading or a button."):(i=U.onclick)==null||i.call(U,new MouseEvent("click")):o("Click any text on the page to test a different wording."):Y==="style"?t?X.disabled?o("This element can\u2019t be targeted reliably \u2014 try a heading, a button, or a whole section."):(a=X.onclick)==null||a.call(X,new MouseEvent("click")):o("Click any element on the page to change how it looks."):Y==="layout"?t||o("Click a section to move it or lay it out differently. Layouts re-arrange the words already on the page \u2014 they never add a section you don\u2019t have."):Y==="goals"?t||o("Page-level goals work right away; click a button or form to track it specifically."):Y==="funnels"?o("Chain tracked goals into a journey \u2014 the drop-off view fills in as visitors move through it."):Y==="drafts"&&tt()},Le=(o,i)=>c("button",le(K({},F(o)),{display:"inline-block",width:"auto",margin:"0",padding:"4px 9px",fontSize:"11px",flex:"0 0 auto"}),i),zn=(o,i)=>{let a=new URL(window.location.href);a.searchParams.set("sentient_preview",o),i&&a.searchParams.set("sentient_arm",i),window.location.assign(a.toString())},Dt=(o,i,a)=>{let l=Le("#374151","Discard");return l.onclick=async()=>{l.disabled=!0;let u=await bi(e,o);l.disabled=!1,be(u,i),u.r==="ok"&&a()},l},jn=(o,i)=>{Ke.textContent="";let a=c("div",{margin:"0 0 6px",padding:"8px 10px",borderRadius:"8px",fontSize:"12px",background:"rgba(99,102,241,0.10)",border:"1px solid rgba(99,102,241,0.35)"}),l=c("div",{display:"flex",gap:"6px",flexWrap:"wrap"});l.append(...i),a.append(c("div",{marginBottom:"6px"},o),l),Ke.append(a)},tt=async()=>{var S,C,k,v,b,A,R,H,G,N,ge,me;xe.textContent="",xe.append(c("div",{fontSize:"12px",opacity:"0.6",padding:"4px 0"},"Loading\u2026"));let o=[],i=[],a=null,l=!1;if(await Promise.all([(async()=>{var _;try{let j=await fetch(`${e.apiBase}/v1/editor/slots`,{headers:{authorization:`Bearer ${e.token}`}});j.ok?o=(_=(await j.json()).slots)!=null?_:[]:a=j.status===401?"expired":"error"}catch(j){a="error"}})(),(async()=>{var _;try{let j=await fetch(`${e.apiBase}/v1/editor/goals`,{headers:{authorization:`Bearer ${e.token}`}});j.ok?i=(_=(await j.json()).goals)!=null?_:[]:l=!0}catch(j){l=!0}})()]),Y!=="drafts")return;if(xe.textContent="",a){if(xe.append(c("div",{fontSize:"12px",opacity:"0.8",padding:"4px 0"},a==="expired"?"Editor session expired \u2014 reopen it from your dashboard to see your drafts. They\u2019re safe.":"Couldn\u2019t load your drafts \u2014 they\u2019re safe; check your connection and retry.")),a==="error"){let _=Le("#374151","Retry");_.onclick=()=>{tt()},xe.append(_)}return}let u=o.filter(_=>{var j,se,Ae,Re,Ve,At;return((Ae=(se=(j=_.draft_config)==null?void 0:j.arms)==null?void 0:se.length)!=null?Ae:0)>0||((At=(Ve=(Re=_.published_config)==null?void 0:Re.arms)==null?void 0:Ve.length)!=null?At:0)>0}),f=i.filter(_=>_.event!=="custom"&&(_.status==="draft"||_.status==="active"));if(u.length===0&&f.length===0&&!l){xe.append(c("div",{fontSize:"12px",opacity:"0.7",padding:"4px 0"},"Nothing saved yet \u2014 changes and goals you save land here, previewable before they go live."));return}let h=_=>c("span",{fontSize:"10px",padding:"2px 7px",borderRadius:"999px",flex:"0 0 auto",background:_?"rgba(16,185,129,0.2)":"rgba(99,102,241,0.25)",color:_?"#6ee7b7":"#c7d2fe"},_?"live":"draft"),p=_=>{let j=c("div",{display:"flex",alignItems:"center",gap:"6px",padding:"7px 0",borderBottom:"1px solid rgba(255,255,255,0.08)",fontSize:"12px"}),se=c("div",{flex:"1 1 auto",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},_);return j.append(se),{row:j,name:se}};for(let _ of u){let{row:j}=p((S=_.display_name)!=null?S:_.slot_id);j.append(h(_.status==="published"));let se=(b=(v=(C=_.draft_config)==null?void 0:C.arms)!=null?v:(k=_.published_config)==null?void 0:k.arms)!=null?b:[],Ae=(H=(A=se[1])==null?void 0:A.id)!=null?H:(R=se[0])==null?void 0:R.id,Re=Le("#374151","Preview");if(Re.onclick=()=>zn(_.slot_id,Ae),j.append(Re),_.status!=="published"&&((ge=(N=(G=_.draft_config)==null?void 0:G.arms)==null?void 0:N.length)!=null?ge:0)>0){let Ve=Le("#10b981","Publish");Ve.onclick=async()=>{Ve.disabled=!0;let At=await de(e,`/v1/editor/slots/${encodeURIComponent(_.slot_id)}/publish`,{});Ve.disabled=!1,be(At,"\u2713 Published \u2014 live for new visitors."),At.r==="ok"&&(d("published",{kind:"slot"}),tt())},j.append(Ve)}_.status!=="published"&&j.append(Dt(`/v1/editor/slots/${encodeURIComponent(_.slot_id)}`,"\u{1F5D1} Draft discarded \u2014 nothing changed for your visitors.",()=>{Yn(_.slot_id),tt()})),xe.append(j)}if(l)xe.append(c("div",{fontSize:"11px",opacity:"0.6",padding:"6px 0 2px"},"Couldn\u2019t load your goals right now \u2014 they\u2019re safe."));else if(f.length>0){xe.append(c("div",{fontSize:"11px",opacity:"0.6",padding:"8px 0 2px"},"Goals"));for(let _ of f){let{row:j}=p((me=_.display_name)!=null?me:_.goal_id);if(j.append(h(_.status==="active")),_.status==="draft"){let se=Le("#10b981","Start tracking");se.onclick=async()=>{se.disabled=!0;let Ae=await de(e,`/v1/editor/goals/${encodeURIComponent(_.goal_id)}/publish`,{});se.disabled=!1,be(Ae,"\u2713 Tracking is live \u2014 it counts from your next visitor."),Ae.r==="ok"&&(d("published",{kind:"goal"}),tt())},j.append(se,Dt(`/v1/editor/goals/${encodeURIComponent(_.goal_id)}`,"\u{1F5D1} Draft goal discarded \u2014 it never tracked anything.",()=>{Jn(_.goal_id),tt()}))}xe.append(j)}}},ar=o=>{Y!==o&&(ae(),kt(),Y=o,Nt())},Kn=c("div",{display:"flex",alignItems:"center",gap:"6px",marginBottom:"10px"});Object.assign(L.style,{marginBottom:"0",flex:"1 1 auto",fontSize:"13px",whiteSpace:"nowrap"});let Gn=!1,Be=c("button",{position:"fixed",bottom:"16px",right:"16px",zIndex:"2147483647",width:"44px",height:"44px",borderRadius:"12px",border:"1px solid #2a2a2a",background:"#000",cursor:"pointer",display:"none",padding:"0",alignItems:"center",justifyContent:"center",boxShadow:"0 6px 18px rgba(0,0,0,0.4)"});Be.append(Ai(26)),Be.title="Open the SentientUI editor",Be.setAttribute("aria-label","Open the SentientUI editor");let Un=An("minimize","Minimize");Un.onclick=()=>{y.style.display="none",Be.style.display="flex",Gn=E,E=!0,m.style.display="none",mt(document)},Be.onclick=()=>{y.style.display="block",Be.style.display="none",E=Gn},Object.assign(z.style,{display:"inline-block",width:"auto",margin:"0",padding:"3px 8px",fontSize:"10.5px",borderRadius:"999px",background:"#374151",whiteSpace:"nowrap"}),Kn.append(L,z,Un,_e);let Fn=c("div",{marginTop:"10px",borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"8px"}),Ke=c("div",{});Object.assign(Z.style,{marginBottom:"4px"}),Fn.append(Ke,Z,ye,ue);let Wn=c("button",{display:"inline-block",width:"auto",margin:"0",padding:"5px 10px",flex:"0 0 auto",fontSize:"11px",borderRadius:"999px",background:"rgba(250,204,21,0.15)",border:"1px solid rgba(250,204,21,0.45)",color:"#fde68a",cursor:"pointer",whiteSpace:"nowrap"},"\u2728 Ask AI"),on=c("div",{display:"flex",alignItems:"center",gap:"6px"});Object.assign(J.style,{flex:"1 1 auto",marginBottom:"0"}),on.append(J,Wn),Object.assign(on.style,{marginBottom:"6px"});let Ht=c("div",{}),W=c("div",{marginTop:"4px"});W.addEventListener("input",()=>{nt=!0}),W.addEventListener("change",()=>{nt=!0}),y.append(Kn,D,on,pe,ee,Ht,Dn,Hn,W,Fn),((so=document.body)!=null?so:document.documentElement).append(m,w,y,Be);let Oe=null,zt=()=>{Oe==null||Oe(),Oe=null},qn=()=>{Oe=null},ht=null,nt=!1,rn=null,ae=()=>{zt(),ht=null,W.textContent="",nt=!1,rn=null,gn=!1},yt=(o,i,a,l)=>{var C;ae();let u={},f={};for(let k of o){let v=c("label",{display:"block",fontSize:"12px",opacity:"0.85",marginTop:"8px"},k.label);if(W.append(v),k.type==="select"){let A=c("select",Rt);A.setAttribute("data-field",k.key);let R=document.createElement("option");R.value="",R.textContent="\u2014 no change \u2014",A.append(R);for(let H of(C=k.options)!=null?C:[]){let G=document.createElement("option");G.value=H,G.textContent=H,A.append(G)}u[k.key]=()=>A.value,W.append(A)}else if(k.type==="color"){let A=c("input",le(K({},Rt),{padding:"2px",height:"34px"}));A.type="color",A.setAttribute("data-field",k.key);let R=!1;A.addEventListener("input",()=>{R=!0}),u[k.key]=()=>R?A.value:"",W.append(A)}else{let A=c("input",Rt);A.setAttribute("data-field",k.key),k.value!==void 0&&(A.value=k.value),u[k.key]=()=>A.value,W.append(A)}let b=c("div",{fontSize:"11px",color:"#fca5a5",marginTop:"3px",display:"none"});b.setAttribute("data-feedback",k.key),f[k.key]=b,W.append(b)}let h=(k,v)=>{let b=f[k];b&&(b.textContent=v!=null?v:"",b.style.display=v?"block":"none")};if(l){let k=Vn(l);W.append(k.node),u[bt]=k.value}let p=c("button",F("#6366f1"),i),S=c("button",le(K({},F("transparent")),{opacity:"0.6"}),"Cancel");p.onclick=()=>a(Object.fromEntries(Object.entries(u).map(([k,v])=>[k,v()])),h),S.onclick=ae,W.append(p,S)},bt="__page",an={},sr=o=>{var i;for(let a of o!=null?o:[])an[a.slot_id]=(i=a.target)==null?void 0:i.page};ft(e,"/v1/editor/slots").then(o=>sr(o==null?void 0:o.slots));let Vn=o=>{let i=Mt(location.pathname),a=c("div",{}),l=c("select",Rt);l.setAttribute("data-field","page");for(let u of Ln(i,an[o])){let f=document.createElement("option");f.value=u,f.textContent=Fo(u,i),l.append(f)}return a.append(c("label",{display:"block",fontSize:"12px",opacity:"0.85",marginTop:"8px"},"Where does this appear?"),l,c("div",{fontSize:"11px",opacity:"0.6",marginTop:"3px"},"Helps us tell a moved element from a page it isn\u2019t on.")),{node:a,value:()=>l.value}},vt=(o,i)=>i?le(K({},o),{page:i}):o,T=(o,i=!0)=>{Z.textContent=o,Z.style.color=i?"#a7f3d0":"#fca5a5"},sn=(o,i)=>{var l,u;if(d("error_shown",{code:(u=o.code)!=null?u:`http_${(l=o.status)!=null?l:"network"}`}),o.code==="plan_limit_reached"){let f=o.feature==="live_goals"?"live goal":"of these",h=o.plan?`${o.plan} plan`:"plan";return o.feature==="live_goals"?`Your ${h} includes 1 live goal. Pause another goal in your dashboard, or upgrade to track more.`:`Your ${h} has reached its limit for ${f}. Manage them in your dashboard, or upgrade for more.`}if(o.code==="role_required")return"Your account can view but not edit this project \u2014 ask an admin for editor access.";if(o.code==="demo_read_only"&&o.message)return o.message;let a=o.status?` (HTTP ${o.status})`:"";return`\u26A0 Couldn\u2019t ${i} \u2014 try again.${a}`},be=(o,i)=>{o.r==="ok"?T(i,!0):o.r==="expired"?T("Editor session expired \u2014 reopen it from your dashboard to save this. Your earlier changes are safe.",!1):T(sn(o,"save"),!1)},Ge=null,jt=o=>o.length>30?`${o.slice(0,27)}\u2026`:o,Yn=o=>{Ge===o&&(ht===o&&(zt(),ht=null),Ge=null,ye.style.display="none",M.style.display="none",Ke.textContent="")},Jn=o=>{at===o&&(at=null,ue.style.display="none",Ke.textContent="")},xt=(o,i,a)=>{Ge=o,ye.textContent=i?`Publish \u201C${jt(i)}\u201D \u2014 go live`:"Publish now \u2014 go live",ye.style.display="block",M.style.display="block";let l=[];if(a){let u=Le("#374151","Preview");u.onclick=()=>zn(o,a),l.push(u)}l.push(Dt(`/v1/editor/slots/${encodeURIComponent(o)}`,"\u{1F5D1} Draft discarded \u2014 nothing changed for your visitors.",()=>Yn(o))),jn(i?`Draft saved for \u201C${jt(i)}\u201D \u2014 nothing is live for visitors yet.`:"Draft saved \u2014 nothing is live for visitors yet.",l)};ye.onclick=async()=>{if(!Ge)return;ye.disabled=!0,T("Publishing\u2026");let o=await de(e,`/v1/editor/slots/${encodeURIComponent(Ge)}/publish`,{});ye.disabled=!1,o.r==="ok"?(d("published",{kind:"slot"}),T("\u2713 Published \u2014 live for new visitors.",!0),ye.style.display="none",Ge=null,Ke.textContent=""):o.r==="expired"?T("Editor session expired \u2014 reopen it from your dashboard to publish. Your saved draft is safe.",!1):T(sn(o,"publish"),!1)};let oe=null,Pe=!1,ot=null,rt=null,Ee=null,Ue=null,wt=null,Kt=null,Fe=!1,Xn=(o,i)=>Pe?o?"":`Nothing to swap with ${i} \u2014 it\u2019s at the edge, or that neighbor can\u2019t be targeted reliably.`:"This element can\u2019t be targeted reliably, so it can\u2019t be moved.",Zn=()=>{B.disabled=!Pe||!Ee,V.disabled=!Pe||!Ue,B.title=B.disabled?Xn(Ee,"above"):"",V.title=V.disabled?Xn(Ue,"below"):""},Te=null,ln=o=>{o&&!Te&&t&&oe?(Te=Vn(Ce("move",oe,t)),Se.before(Te.node)):o||(Te==null||Te.node.remove(),Te=null),Se.style.display=o?"block":"none",ze.style.display=o?"block":"none",Zn()},kt=()=>{if(Fe&&t&&wt&&wt.insertBefore(t,Kt),Fe=!1,wt=null,Kt=null,t){let o=en(t,document);ot=o.prevEl,rt=o.nextEl,Ee=o.prevLocator,Ue=o.nextLocator}g(),ln(!1)},Qn=o=>{if(E)return;let i=o.target;if(!i||y.contains(i)||i===m)return;mt(document);let a=i.getBoundingClientRect();Object.assign(m.style,{display:"block",left:`${a.left}px`,top:`${a.top}px`,width:`${a.width}px`,height:`${a.height}px`})},Me=o=>{var a;let i=((a=o.textContent)!=null?a:"").trim().replace(/\s+/g," ");return i?i.length>40?`${i.slice(0,37)}\u2026`:i:o.tagName.toLowerCase()},lr=o=>!!o.id||["section","header","footer","nav","main","form","article","aside"].includes(o.tagName.toLowerCase())||!!o.querySelector(":scope > h1, :scope > h2, :scope > h3"),dr=o=>{var l;let i=o.querySelector("h1, h2, h3"),a=(l=i==null?void 0:i.textContent)==null?void 0:l.replace(/\s+/g," ").trim();return a?a.length>28?`${a.slice(0,25)}\u2026`:a:o.id?`#${o.id.length>24?`${o.id.slice(0,21)}\u2026`:o.id}`:`<${o.tagName.toLowerCase()}>`},cr=o=>{pe.textContent="";let i=[];for(let h=o.parentElement;h&&h!==document.body&&i.length<3;h=h.parentElement)lr(h)&&i.push(h);let a=Me(o),l=()=>c("span",{opacity:"0.5",margin:"0 4px"},"\u2039"),u=!0;for(let h of i){let p=dr(h);if(p===a||a.startsWith(p))continue;let S=c("button",{background:"transparent",border:"none",color:"#a5b4fc",cursor:"pointer",font:"inherit",padding:"0",textDecoration:"underline"},p);S.onclick=()=>St(h),u||pe.append(l()),pe.append(S),u=!1}u||pe.append(l());let f=c("button",{background:"transparent",border:"none",color:"#a5b4fc",cursor:"pointer",font:"inherit",padding:"0",textDecoration:"underline",opacity:"0.7"},"Page");f.onclick=()=>eo(),pe.append(f),pe.style.display="block"},ur=o=>{ee.textContent="";let i=null,a=0;for(let u=o.parentElement;u&&u!==document.body&&a<6;u=u.parentElement,a++)if(ut(Xe(u,document),u,document)){i=u;break}let l=c("div",{marginBottom:"8px",padding:"8px 10px",borderRadius:"8px",fontSize:"12px",background:"rgba(252,165,165,0.12)",border:"1px solid rgba(252,165,165,0.4)"});if(i){let u=i;l.append(c("div",{marginBottom:"6px"},"This exact element can\u2019t be tracked safely \u2014 it looks identical to others on the page. You can pick something more specific inside it, or work with the whole block, which we can target reliably."));let f=c("button",le(K({},F("#6366f1")),{marginTop:"0"}),`Select \u201C${Me(u)}\u201D instead`);f.onclick=()=>St(u);let h=c("button",le(K({},F("transparent")),{opacity:"0.6"}),"Pick something else");h.onclick=()=>{ee.textContent=""},l.append(f,h)}else l.append(c("div",{},"This part of the page can\u2019t be targeted reliably \u2014 try a heading, a button, or a whole section instead."));ee.append(l)},St=o=>{kt(),ae(),ee.textContent="",t=o,oe=Xe(o,document);let i=ut(oe,o,document);Pe=i,g(),J.style.display="block",J.textContent=`Selected: ${Me(o)}`,cr(o),d("element_selected",{unique:i}),T(i?"\u2713 Matches exactly 1 element":"",i),i||ur(o),D.style.display="none",pn();for(let f of je)f.style.display="block";U.style.display="none",X.style.display="none";let a=vn(o);U.disabled=!i||!a,U.title=i?a?"":"This element contains other elements, so testing text here would replace them. Pick the text itself (e.g. the heading), not its container.":"",X.disabled=!i,ne.disabled=!i,Q.disabled=!i;let l=o.closest("form");P.style.display=l?"block":"none",P.disabled=!l;let u=en(o,document);ot=u.prevEl,rt=u.nextEl,Ee=u.prevLocator,Ue=u.nextLocator,Zn(),Nt()},eo=()=>{kt(),ae(),t=null,oe=null,Pe=!1,ot=null,rt=null,Ee=null,Ue=null,g(),ee.textContent="",pn(),pe.textContent="",pe.style.display="none",J.textContent="",J.style.display="none";for(let o of je)o.style.display="none";D.style.display="block",T(""),Nt()},it=!1,dn=-1,to=o=>{var l,u;let i=o.target,a=!!((l=i==null?void 0:i.closest)!=null&&l.call(i,'input, textarea, select, [contenteditable="true"]'));if(o.key==="Escape"){if(W.childElementCount>0){ae(),it=!1;return}if(t){eo(),it=!1;return}if(!it){it=!0,T("Press Esc again to close the editor.");return}it=!1,(u=_e.onclick)==null||u.call(_e,new MouseEvent("click"));return}if(it=!1,!(a||E)){if(o.key==="ArrowUp"||o.key==="ArrowDown"){if(!t||(o.key==="ArrowUp"?B:V).disabled)return;o.preventDefault(),fn(o.key==="ArrowUp"?"up":"down");return}if(o.key==="Tab"){let f=[];for(let p of On){let S=we(p.locator,document);S&&!f.includes(S)&&f.push(S)}if(f.length===0)return;if(nt){T("\u26A0 You have unsaved changes \u2014 Save or Cancel before picking another element.",!1),o.preventDefault();return}o.preventDefault(),dn=(dn+(o.shiftKey?-1:1)+f.length)%f.length;let h=f[dn];St(h);try{h.scrollIntoView({block:"center",behavior:"smooth"})}catch(p){}}}},no=o=>{if(E)return;let i=o.target;if(!(!i||y.contains(i))){if(o.preventDefault(),o.stopPropagation(),nt&&i!==t&&rn!==i){rn=i,T("\u26A0 You have unsaved changes \u2014 Save or Cancel first, or click that element again to discard them.",!1);return}St(i)}};U.onclick=()=>{var f,h;if(!t||!oe)return;d("form_opened",{kind:"text"});let o=oe,i=(h=(f=t.textContent)==null?void 0:f.trim())!=null?h:"";yt([{key:"current",label:"Current wording",value:i},{key:"alt",label:"Alternative wording to test",value:""}],"Save draft",async p=>{let S=p.alt.trim();if(!S){T("\u26A0 Enter alternative wording to test.",!1);return}if(S===p.current.trim()){T("\u26A0 Enter different wording \u2014 the alternative matches the current text.",!1);return}let C=Ce("text",o,t);T("Saving\u2026");let k=await de(e,`/v1/editor/slots/${encodeURIComponent(C)}`,{kind:"arms",target:vt(o,p[bt]),draftConfig:{arms:[{id:"a",displayName:"Original",ops:{text:p.current}},{id:"b",displayName:"Alternative",ops:{text:p.alt}}]}});k.r==="ok"&&(d("draft_saved",{kind:"slot"}),qn(),ae(),xt(C,Me(t),"b")),be(k,"\u2713 Saved as a draft. Click \u201CPublish\u201D below to go live.")},Ce("text",o,t));let a=t,l=xn(a);Oe=()=>{Ye(a,l)};let u=W.querySelector('input[data-field="alt"]');u==null||u.addEventListener("input",()=>{Ye(a,u.value.trim()===""?l:u.value)})};let Et=null,oo=o=>{let i=p=>{var S;return((S=p.textContent)!=null?S:"").replace(/\s+/g," ").trim()},a=Array.from(o.querySelectorAll("h1,h2,h3,h4")).map(i).filter(Boolean);if(a.length===0){let p=o.closest("h1,h2,h3,h4");p&&a.push(i(p))}let l=Array.from(o.querySelectorAll("p")).map(i).filter(p=>p.length>0&&p.length<=300),u=[];for(let p of Array.from(o.querySelectorAll("a[href], button"))){let S=i(p);if(!S||S.length>60)continue;let C="",k=p.getAttribute("href");if(k)try{let v=new URL(k,window.location.href);v.protocol==="https:"&&(C=v.href)}catch(v){}u.push({label:S,href:C})}let f=Array.from(o.querySelectorAll("blockquote, q")).map(i).filter(Boolean);if(f.length===0&&wi.test(`${o.className} ${o.id}`))for(let p of l)p.length>=20&&f.push(p);let h=Array.from(o.querySelectorAll('cite, figcaption, footer, [class*="author"]')).map(i).filter(p=>p.length>0&&p.length<=80);return{headings:a,paragraphs:l,links:u,quotes:f,attributions:h}},pr=(o,i)=>{var l,u,f,h,p,S,C,k,v,b,A,R,H,G,N,ge,me,_,j,se;let a=Ae=>{var Re;return i.paragraphs.length>=3&&(Re=i.paragraphs[i.paragraphs.length-3+Ae])!=null?Re:""};switch(o){case"headline":return(l=i.headings[0])!=null?l:"";case"supporting":return(u=i.paragraphs[0])!=null?u:"";case"cta_label":return(h=(f=i.links[0])==null?void 0:f.label)!=null?h:"";case"cta_href":return(S=(p=i.links[0])==null?void 0:p.href)!=null?S:"";case"secondary_label":return(k=(C=i.links[1])==null?void 0:C.label)!=null?k:"";case"secondary_href":return(b=(v=i.links[1])==null?void 0:v.href)!=null?b:"";case"quote":case"q1":return(A=i.quotes[0])!=null?A:"";case"q2":return(R=i.quotes[1])!=null?R:"";case"q3":return(H=i.quotes[2])!=null?H:"";case"name":case"n1":return(G=i.attributions[0])!=null?G:"";case"n2":return(N=i.attributions[1])!=null?N:"";case"n3":return(ge=i.attributions[2])!=null?ge:"";case"role":return(me=i.attributions[1])!=null?me:"";case"eyebrow":return"";case"f1_title":return(_=i.headings[1])!=null?_:"";case"f2_title":return(j=i.headings[2])!=null?j:"";case"f3_title":return(se=i.headings[3])!=null?se:"";case"f1_body":return a(0);case"f2_body":return a(1);case"f3_body":return a(2);default:return""}},fr=(o,i,a)=>{d("form_opened",{kind:"arrangement"});let l=oo(a);yt(o.fields.map(u=>({key:u.id,label:u.kind==="href"?`${u.label} (https link \u2014 required)`:u.label,value:pr(u.id,l)})),"Save draft",async(u,f)=>{var A,R,G,N,ge;let h=!1,p=!1;for(let me of o.fields){if(me.kind==="href"){let j=!1;try{j=new URL((A=u[me.id])!=null?A:"").protocol==="https:"}catch(se){}f(me.id,j?null:"Links need to start with https://"),j||(h=!0);continue}let _=((R=u[me.id])!=null?R:"").trim()==="";f(me.id,_?"Fill this in with your own words":null),_&&(p=!0)}if(h){T("\u26A0 Fix the highlighted link(s).",!1);return}if(p){T("\u26A0 Every field needs your own words \u2014 this layout re-arranges your copy, it doesn\u2019t write any.",!1);return}T("Saving\u2026");let H=u,{[bt]:S}=H,C=po(H,[uo(bt)]),k=await vi(e,`/v1/editor/arrangements/${encodeURIComponent(o.id)}/instantiate`,{fields:C});if(k.r!=="ok"||!((G=k.data)!=null&&G.blocks)){k.r==="expired"?be(k.outcome,""):T(`\u26A0 ${(ge=(N=k.data)==null?void 0:N.reason)!=null?ge:"Couldn\u2019t build the arrangement \u2014 check the fields."}`,!1);return}let v=Ce("arrange",i,a),b=await de(e,`/v1/editor/slots/${encodeURIComponent(v)}`,{kind:"arms",target:vt(i,S),draftConfig:{arms:[{id:"original",displayName:"Your page today"},{id:o.id,displayName:o.name,blocks:k.data.blocks}],baseline:"original"}});b.r==="ok"&&(d("draft_saved",{kind:"arrangement"}),ae(),xt(v,o.name,o.id)),be(b,"\u2713 Saved as a draft \u2014 it will test against this section as it is today. Click \u201CPublish\u201D below to go live.")},Ce("arrange",i,a))};ne.onclick=async()=>{var f,h;if(!t||!oe)return;let o=oe,i=t;if(ae(),T("Loading arrangements\u2026"),!Et){let p=await ft(e,"/v1/editor/arrangements");Et=(f=p==null?void 0:p.arrangements)!=null?f:null}if(!Et||Et.length===0){T("\u26A0 Couldn\u2019t load the arrangements \u2014 try again.",!1);return}let a=or(oo(i)),l=Et.filter(p=>a.includes(p.sectionType));if(l.length===0){T("No other layout fits this section. Layouts re-arrange the words already here \u2014 they don\u2019t add sections your page doesn\u2019t have.",!1);return}T("Pick a layout for this section \u2014 your own words are carried across.");for(let p of l){let S=c("button",le(K({},F("#374151")),{textAlign:"left"}));S.append(c("div",{fontWeight:"600"},p.name),c("div",{fontSize:"11px",opacity:"0.7"},p.description)),S.onclick=()=>fr(p,o,i),W.append(S)}let u=c("button",le(K({},F("transparent")),{opacity:"0.6"}),"Cancel");u.onclick=ae,W.append(u),(h=W.scrollIntoView)==null||h.call(W,{block:"nearest"})};let at=null,gr=(o,i)=>{at=o,ue.textContent=i?`Start tracking \u201C${jt(i)}\u201D now`:"Start tracking now",ue.style.display="block",jn(i?`Goal \u201C${jt(i)}\u201D saved \u2014 it isn\u2019t counting anything until you start it.`:"Goal saved \u2014 it isn\u2019t counting anything until you start it.",[Dt(`/v1/editor/goals/${encodeURIComponent(o)}`,"\u{1F5D1} Draft goal discarded \u2014 it never tracked anything.",()=>Jn(o))])};ue.onclick=async()=>{if(!at)return;ue.disabled=!0,T("Activating\u2026");let o=await de(e,`/v1/editor/goals/${encodeURIComponent(at)}/publish`,{});ue.disabled=!1,o.r==="ok"?(d("published",{kind:"goal"}),T("\u2713 Tracking is live \u2014 it counts from your next visitor.",!0),ue.style.display="none",at=null,Ke.textContent=""):o.r==="expired"?T("Editor session expired \u2014 reopen it from your dashboard to activate. Your saved goal is safe.",!1):T(sn(o,"activate"),!1)};let st=(o,i)=>`${pt(o)||"goal"}-${Zo(i)}`.slice(0,128),ro=o=>{var l,u,f;let i=((l=o.textContent)!=null?l:"").replace(/\s+/g," ").trim();return i&&i.length<=60?i:((f=(u=o.getAttribute("aria-label"))!=null?u:o.getAttribute("id"))!=null?f:"").trim()||"element-clicked"},Tt=async(o,i,a)=>{T("Saving\u2026");let l=await de(e,`/v1/editor/goals/${encodeURIComponent(o)}`,i);return l.r==="ok"&&(d("draft_saved",{kind:"goal"}),gr(o,a)),be(l,"\u2713 Goal saved. Click \u201CStart tracking\u201D below to go live."),l};Q.onclick=()=>{if(!t||!oe)return;let o=st(ro(t),JSON.stringify(oe));Tt(o,{event:"click",locator:oe},Me(t))},P.onclick=()=>{var l,u;let o=t==null?void 0:t.closest("form");if(!o)return;let i=Xe(o,document),a=(u=(l=o.getAttribute("id"))!=null?l:o.getAttribute("name"))!=null?u:"form-submitted";Tt(st(a,JSON.stringify(i)),{event:"form_submit",locator:i},a)},re.onclick=()=>{let o=window.location.pathname||"/",i=pt(o)?`reached-${pt(o)}`:"page-visited";Tt(st(i,o),{event:"url_reached",urlPattern:o},o)};let cn=[{label:"25% \u2014 skimmed the top",value:.25},{label:"50% \u2014 read halfway",value:.5},{label:"75% \u2014 read most of the page",value:.75},{label:"90% \u2014 read to the end",value:.9}];ie.onclick=()=>{yt([{key:"depth",label:"Counts once a visitor reads",type:"select",options:cn.map(o=>o.label)}],"Track it",o=>{var l;let i=(l=cn.find(u=>u.label===o.depth))!=null?l:cn[2],a=Math.round(i.value*100);Tt(`read-${a}pct`,{event:"scroll_depth",threshold:i.value},`read ${a}%`),ae()})};let Gt=null,mr=o=>{Gt=o,q.style.display="block"};q.onclick=async()=>{if(!Gt)return;q.disabled=!0,T("Turning on\u2026");let o=await de(e,`/v1/editor/funnels/${encodeURIComponent(Gt)}/publish`,{});q.disabled=!1,o.r==="ok"?(d("published",{kind:"funnel"}),T("\u2713 Funnel is on \u2014 the drop-off view fills in as visitors move through it.",!0),q.style.display="none",Gt=null):o.r==="expired"?T("Editor session expired \u2014 reopen it from your dashboard to turn the funnel on. Your draft is safe.",!1):T("\u26A0 Couldn\u2019t turn the funnel on \u2014 try again.",!1)},I.onclick=async()=>{var k;T("Loading your goals\u2026");let o=await ft(e,"/v1/editor/goals"),i=(k=o==null?void 0:o.goals)!=null?k:[];if(i.length<2){T("Track at least 2 goals first \u2014 a funnel is a sequence of them (e.g. \u201Cviewed pricing\u201D \u2192 \u201Csigned up\u201D).",!1);return}T("Pick the steps in order \u2014 first click = first step."),ae();let a=[],l=c("label",{display:"block",fontSize:"12px",opacity:"0.85",marginTop:"8px"},"Funnel name"),u=c("input",Rt);W.append(l,u);let f=c("div",{fontSize:"11px",opacity:"0.7",marginTop:"6px"},"Steps (click in journey order):");W.append(f);let h=new Map,p=()=>{var v,b;for(let[A,R]of h){let H=a.indexOf(A),G=(b=(v=i.find(N=>N.goal_id===A))==null?void 0:v.display_name)!=null?b:A;R.textContent=H===-1?G:`${H+1}. ${G}`,R.style.background=H===-1?"#374151":"#6366f1"}};for(let v of i){let b=c("button",le(K({},F("#374151")),{textAlign:"left"}));h.set(v.goal_id,b),b.onclick=()=>{a=Wo(a,v.goal_id),p()},W.append(b)}p();let S=c("button",F("#6366f1"),"Save funnel"),C=c("button",le(K({},F("transparent")),{opacity:"0.6"}),"Cancel");C.onclick=ae,S.onclick=async()=>{let v=qo(u.value,a);if(!v.ok){T(`\u26A0 ${v.error}`,!1);return}T("Saving\u2026");let b=await de(e,`/v1/editor/funnels/${encodeURIComponent(v.funnelId)}`,v.body);b.r==="ok"&&(d("draft_saved",{kind:"funnel"}),ae(),mr(v.funnelId)),be(b,"\u2713 Funnel saved as a draft. Click \u201CTurn the funnel on\u201D to start measuring.")},W.append(S,C)},M.onclick=async()=>{var p,S;let o=Ge;if(!o)return;T("Loading funnels\u2026");let i=await ft(e,"/v1/editor/funnels"),a=(p=i==null?void 0:i.funnels)!=null?p:[];if(a.length===0){T("No funnels yet \u2014 click \u201CSet up a funnel\u201D first.",!1);return}let l=await ft(e,"/v1/editor/goals"),u=new Map(((S=l==null?void 0:l.goals)!=null?S:[]).map(C=>[C.goal_id,C.display_name]));yt([{key:"funnel",label:"Funnel",type:"select",options:a.map(C=>Xt(C))},{key:"step",label:"Which step does this element serve?",type:"select",options:Zt(a[0],u).map(C=>C.label)}],"Attach",async C=>{var A;let k=(A=a.find(R=>Xt(R)===C.funnel))!=null?A:a[0],v=Zt(k,u).findIndex(R=>R.label===C.step);if(v<0){T("\u26A0 Pick which step this element serves.",!1);return}T("Attaching\u2026");let b=await de(e,`/v1/editor/funnels/${encodeURIComponent(k.funnel_id)}/assign`,{slotId:o,stepIndex:v});b.r==="ok"&&ae(),be(b,`\u2713 Attached \u2014 this test now works toward \u201C${k.display_name}\u201D.`)});let f=W.querySelector('select[data-field="funnel"]'),h=W.querySelector('select[data-field="step"]');f&&h&&f.addEventListener("change",()=>{var k;let C=(k=a.find(v=>Xt(v)===f.value))!=null?k:a[0];h.length=1;for(let v of Zt(C,u)){let b=document.createElement("option");b.value=v.label,b.textContent=v.label,h.append(b)}})},X.onclick=()=>{if(!t||!oe)return;d("form_opened",{kind:"style"});let o=oe;yt([{key:"color",label:"Text colour",type:"color"},{key:"background",label:"Background colour",type:"color"},{key:"fontSize",label:"Font size (e.g. 20px)"},{key:"fontWeight",label:"Font weight (e.g. 700)"},{key:"fontFamily",label:$n.length?`Font (this site has: ${$n.slice(0,3).join(", ")})`:"Font (e.g. Georgia, serif)"},{key:"borderRadius",label:"Corner radius (e.g. 8px)"},{key:"textAlign",label:"Alignment",type:"select",options:["left","center","right","justify"]}],"Save draft",async(h,p)=>{var A;let{style:S,errors:C}=Mn(h),k=!1;for(let R of Pn)p(R,(A=C[R])!=null?A:null),C[R]&&(k=!0);if(k){T("\u26A0 Fix the highlighted field(s).",!1);return}if(Object.keys(S).length===0){T("\u26A0 Enter at least one style change.",!1);return}let v=Ce("style",o,t);T("Saving\u2026");let b=await de(e,`/v1/editor/slots/${encodeURIComponent(v)}`,{kind:"arms",target:vt(o,h[bt]),draftConfig:{arms:[{id:"a",displayName:"Current look",ops:{}},{id:"b",displayName:"New look",ops:{style:S}}]}});b.r==="ok"&&(d("draft_saved",{kind:"slot"}),qn(),ae(),xt(v,Me(t),"b")),be(b,"\u2713 Saved as a draft. Click \u201CPublish\u201D below to go live.")},Ce("style",o,t));let i=t,a=i.style.cssText;Oe=()=>{i.style.cssText=a};let l={},u=()=>{let{style:h}=Mn(l);i.style.cssText=a;for(let[p,S]of Object.entries(h)){let C=It[p];C&&dt(S)&&i.style.setProperty(C,S.trim(),"important")}};for(let h of Pn){let p=W.querySelector(`[data-field="${h}"]`);if(!p)continue;let S=()=>{l[h]=p.value,u()};p.addEventListener("input",S),p.addEventListener("change",S)}let f=[Ze==null?void 0:Ze.primaryBg,Ze==null?void 0:Ze.primaryText,"#ffffff"].filter(h=>!!h).map(Bn).filter((h,p,S)=>Nn(h)&&S.indexOf(h)===p);for(let h of["color","background"]){let p=W.querySelector(`input[data-field="${h}"]`);if(!p)continue;let S=c("div",{display:"flex",gap:"6px",marginTop:"4px"});for(let C of f){let k=c("button",{width:"22px",height:"22px",borderRadius:"6px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.35)",background:C,padding:"0"});k.title=C,k.onclick=()=>{p.value=Bn(C),p.dispatchEvent(new Event("input"))},S.append(k)}p.after(S)}};let We=[],Ct=new Map,un=!1,fe=null,te=null,Lt=null,hr=()=>{Ct.clear();let o=[],i=(a,l,u)=>{var p;if(o.length>=16||[...Ct.values()].some(S=>S.node===a))return;let f=a===t,h=f?"selected":`e${o.length}`;Ct.set(h,{node:a,locator:l}),o.push(K(K({ref:h,tag:a.tagName.toLowerCase().slice(0,16),text:((p=a.textContent)!=null?p:"").replace(/\s+/g," ").trim().slice(0,300),isLeaf:vn(a),inForm:!!a.closest("form")},f?{selected:!0}:{}),u?{label:u.slice(0,120)}:{}))};t&&oe&&Pe&&i(t,oe);for(let a of On){let l=we(a.locator,document);l&&i(l,a.locator,a.label)}return{pagePath:Mt(location.pathname),pageTitle:document.title.slice(0,200),elements:o}},qe=(o,i="")=>{let a=o==="user",l=c("div",{margin:"6px 0",padding:"7px 10px",borderRadius:"10px",fontSize:"12px",lineHeight:"1.45",whiteSpace:"pre-wrap",wordBreak:"break-word",maxWidth:"88%",marginLeft:a?"auto":"0",background:a?"#6366f1":o==="note"?"transparent":"rgba(255,255,255,0.07)",opacity:o==="note"?"0.75":"1"},i);return fe==null||fe.append(l),fe&&(fe.scrollTop=fe.scrollHeight),l},pn=()=>{Lt&&(Lt.textContent=t?Pe?`Looking at: ${Me(t)}`:"This element can\u2019t be targeted reliably \u2014 pick a heading, button, or section.":"Nothing selected \u2014 click an element, or ask for a page goal.")},io=(o,i)=>{var u;zt();let a=xn(o),l=o.style.cssText;if(Oe=()=>{Ye(o,a),o.style.cssText=l},!!i){typeof i.text=="string"&&Ye(o,i.text);for(let[f,h]of Object.entries((u=i.style)!=null?u:{})){let p=It[f];p&&typeof h=="string"&&dt(h)&&o.style.setProperty(p,h.trim(),"important")}}},yr=async o=>{var A,R;let i=Ct.get(o.ref);if(!i||!i.node.isConnected)return"\u26A0 That element is no longer on the page \u2014 click it and ask again.";let{node:a,locator:l}=i,u=o.versions.some(H=>typeof H.ops.text=="string"),f=Ce(u?"text":"style",l,a),h=Ln(location.pathname,an[f])[0];T("Saving\u2026");let p=await de(e,`/v1/editor/slots/${encodeURIComponent(f)}`,{kind:"arms",target:vt(l,h),draftConfig:{arms:[{id:"a",displayName:"Original",ops:u?{text:((A=a.textContent)!=null?A:"").trim()}:{}},...o.versions]}});if(be(p,"\u2713 Draft saved and previewing \u2014 nothing is live until you publish."),p.r!=="ok")return(R=Z.textContent)!=null?R:"\u26A0 Couldn\u2019t save the draft.";d("draft_saved",{kind:"slot",via:"chat"}),a!==t&&St(a),ae();let S=a;io(S,o.versions[0].ops),ht=f;try{S.scrollIntoView({block:"center",behavior:"smooth"})}catch(H){}xt(f,o.label,o.versions[0].id);let C=qe("assistant");C.textContent="",C.append(c("div",{fontWeight:"600",marginBottom:"6px"},`Draft: ${o.label}`));let k=c("div",{display:"flex",gap:"5px",flexWrap:"wrap"}),v=[],b=(H,G)=>{for(let N of v)N.style.background="#374151";H.style.background="#6366f1",io(S,G),ht=f};for(let[H,G]of[["Original",null],...o.versions.map(N=>[N.displayName,N.ops])]){let N=Le("#374151",H);N.onclick=()=>b(N,G),v.push(N),k.append(N)}return v[1].style.background="#6366f1",C.append(k),`[Created draft "${o.label}" with ${o.versions.length} version(s)]`},br=(o,i,a)=>{var h;let l=[],u={position:"absolute",pointerEvents:"none",zIndex:"2147483645",padding:"2px 6px",borderRadius:"4px",background:"#f59e0b",color:"#111827",font:"600 11px system-ui, sans-serif",whiteSpace:"nowrap"},f=null;if(o){let p=o.getBoundingClientRect();f=p.top+window.scrollY,l.push(c("div",{position:"absolute",pointerEvents:"none",zIndex:"2147483645",left:`${p.left+window.scrollX-3}px`,top:`${f-3}px`,width:`${p.width+6}px`,height:`${p.height+6}px`,border:"2px dashed #f59e0b",borderRadius:"6px"}),c("div",le(K({},u),{left:`${p.left+window.scrollX}px`,top:`${Math.max(0,f-24)}px`}),`Goal: ${a}`))}else i!==void 0&&(f=Math.round(document.documentElement.scrollHeight*i),l.push(c("div",{position:"absolute",pointerEvents:"none",zIndex:"2147483645",left:"0",right:"0",top:`${f}px`,borderTop:"2px dashed #f59e0b"}),c("div",le(K({},u),{left:"16px",top:`${f+4}px`}),`Goal counts here: ${a}`)));if(l.length!==0){if(((h=document.body)!=null?h:document.documentElement).append(...l),f!==null)try{window.scrollTo({top:Math.max(0,f-window.innerHeight/3),behavior:"smooth"})}catch(p){}setTimeout(()=>{for(let p of l)p.remove()},6e3)}},vr=async o=>{var f,h,p,S,C,k;let i=null,a,l;if(o.event==="click"||o.event==="form_submit"){let v=o.ref?Ct.get(o.ref):void 0;if(!v||!v.node.isConnected)return"\u26A0 That element is no longer on the page \u2014 click it and ask again.";if(o.event==="click")i=v.node,a=st(ro(i),JSON.stringify(v.locator)),l={event:"click",locator:v.locator};else{let b=v.node.closest("form");if(!b)return"\u26A0 That element isn\u2019t inside a form.";let A=Xe(b,document);if(!ut(A,b,document))return"\u26A0 This form can\u2019t be targeted reliably, so it can\u2019t be tracked.";i=b,a=st((h=(f=b.getAttribute("id"))!=null?f:b.getAttribute("name"))!=null?h:"form-submitted",JSON.stringify(A)),l={event:"form_submit",locator:A}}}else if(o.event==="url_reached"){let v=(p=o.urlPattern)!=null?p:Mt(location.pathname);a=st(pt(v)?`reached-${pt(v)}`:"page-visited",v),l={event:"url_reached",urlPattern:v}}else a=`read-${Math.round(((S=o.threshold)!=null?S:.75)*100)}pct`,l={event:"scroll_depth",threshold:(C=o.threshold)!=null?C:.75};return(await Tt(a,le(K({},l),{displayName:o.displayName}),o.displayName)).r!=="ok"?(k=Z.textContent)!=null?k:"\u26A0 Couldn\u2019t save the goal.":(br(i,o.event==="scroll_depth"?l.threshold:void 0,o.displayName),`[Created draft goal "${o.displayName}"]`)},ao=async o=>{var S,C,k;let i=o.trim();if(!i||un)return;un=!0,te&&(te.value="",te.disabled=!0),qe("user",i),We.push({role:"user",content:i.slice(0,4e3)}),d("form_opened",{kind:"chat"});let a=qe("assistant","\u2026"),l="",u=!1,f=[],h=[],p=v=>{var A,R;if(v==="[DONE]")return;let b;try{b=JSON.parse(v)}catch(H){return}if(b.error){f.push("\u26A0 The assistant hit a problem \u2014 try again.");return}if(b.type==="delta"&&b.text)u&&l&&(l+=`
25
25
 
26
26
  `),u=!1,l+=b.text,a.textContent=l,fe&&(fe.scrollTop=fe.scrollHeight);else if(b.type==="tool_status")u=!0,b.state==="running"&&!l&&(a.textContent=(A=b.name)!=null&&A.startsWith("create_")?"Creating a draft\u2026":"Thinking\u2026");else if(b.type==="choice_prompt"&&b.question){l+=(l?`
27
27
 
28
- `:"")+b.question,a.textContent=l;let H=c("div",{display:"flex",gap:"5px",flexWrap:"wrap",marginTop:"6px"});for(let G of(R=b.options)!=null?R:[]){let N=Le("#374151",G.label);N.onclick=()=>{ao(G.label)},H.append(N)}a.append(H)}else if(b.type==="artifact"&&b.artifact){let H=b.artifact.type==="editor_component_draft"?yr(b.artifact.payload):b.artifact.type==="editor_goal_draft"?vr(b.artifact.payload):null;H&&h.push(H.then(G=>{f.push(G),G.startsWith("\u26A0")&&qe("note",G)}))}};try{let v=We.slice(-20);for(;((S=v[0])==null?void 0:S.role)==="assistant";)v=v.slice(1);let b=await fetch(`${e.apiBase}/v1/editor/chat`,{method:"POST",headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify({messages:v,context:hr()})});if(!b.ok){let N=(C=await b.json().catch(()=>null))==null?void 0:C.error;a.textContent=b.status===401?"Editor session expired \u2014 reopen it from your dashboard. Your drafts are safe.":N==="rate_limit"?"You\u2019ve used today\u2019s AI allowance \u2014 more tomorrow, or upgrade for a bigger daily budget.":N==="plan_required"?"AI chat isn\u2019t included in this plan.":N==="ai_unavailable"?"The assistant is unavailable right now \u2014 try again later.":`\u26A0 Couldn\u2019t reach the assistant \u2014 try again. (HTTP ${b.status})`,We.pop();return}let A=(w=b.body)==null?void 0:w.getReader(),R="",H=()=>{let N;for(;(N=R.indexOf(`
28
+ `:"")+b.question,a.textContent=l;let H=c("div",{display:"flex",gap:"5px",flexWrap:"wrap",marginTop:"6px"});for(let G of(R=b.options)!=null?R:[]){let N=Le("#374151",G.label);N.onclick=()=>{ao(G.label)},H.append(N)}a.append(H)}else if(b.type==="artifact"&&b.artifact){let H=b.artifact.type==="editor_component_draft"?yr(b.artifact.payload):b.artifact.type==="editor_goal_draft"?vr(b.artifact.payload):null;H&&h.push(H.then(G=>{f.push(G),G.startsWith("\u26A0")&&qe("note",G)}))}};try{let v=We.slice(-20);for(;((S=v[0])==null?void 0:S.role)==="assistant";)v=v.slice(1);let b=await fetch(`${e.apiBase}/v1/editor/chat`,{method:"POST",headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify({messages:v,context:hr()})});if(!b.ok){let N=(C=await b.json().catch(()=>null))==null?void 0:C.error;a.textContent=b.status===401?"Editor session expired \u2014 reopen it from your dashboard. Your drafts are safe.":N==="rate_limit"?"You\u2019ve used today\u2019s AI allowance \u2014 more tomorrow, or upgrade for a bigger daily budget.":N==="plan_required"?"AI chat isn\u2019t included in this plan.":N==="ai_unavailable"?"The assistant is unavailable right now \u2014 try again later.":`\u26A0 Couldn\u2019t reach the assistant \u2014 try again. (HTTP ${b.status})`,We.pop();return}let A=(k=b.body)==null?void 0:k.getReader(),R="",H=()=>{let N;for(;(N=R.indexOf(`
29
29
 
30
30
  `))>=0;){for(let ge of R.slice(0,N).split(`
31
31
  `))ge.startsWith("data: ")&&p(ge.slice(6));R=R.slice(N+2)}};if(A){let N=new TextDecoder;for(;;){let{done:ge,value:me}=await A.read();if(ge)break;R+=N.decode(me,{stream:!0}),H()}}else R=await b.text();R+=`
32
32
 
33
33
  `,H(),await Promise.all(h),l||(a.textContent=f.some(N=>N.startsWith("["))?"Done \u2014 have a look at the page.":"No reply \u2014 try rephrasing.");for(let N of f)N.startsWith("\u26A0 The assistant")&&qe("note",N);let G=[l,...f.filter(N=>N.startsWith("["))].filter(Boolean).join(`
34
- `);We.push({role:"assistant",content:(G||"(no reply)").slice(0,4e3)})}catch(v){a.textContent="\u26A0 Couldn\u2019t reach the assistant \u2014 check your connection and try again.",We.pop()}finally{un=!1,te&&(te.disabled=!1,te.focus())}},xr=()=>{if(fe){te==null||te.focus();return}let o=c("div",{margin:"0 0 8px",padding:"9px 11px",borderRadius:"10px",background:"rgba(250,204,21,0.06)",border:"1px solid rgba(250,204,21,0.3)"});o.setAttribute("data-sentient-chat","");let i=c("div",{display:"flex",alignItems:"center",gap:"6px",marginBottom:"4px"}),a=An("close","Close AI chat");if(a.onclick=()=>{Ht.textContent="",fe=null,te=null,Lt=null},i.append(c("div",{fontWeight:"600",flex:"1 1 auto"},"\u2728 AI"),a),Lt=c("div",{fontSize:"11px",opacity:"0.7",marginBottom:"4px"}),pn(),fe=c("div",{maxHeight:"260px",overflowY:"auto",overscrollBehavior:"contain"}),We.length===0)qe("note","Tell me what to try \u2014 e.g. \u201Cmake this headline more urgent\u201D or \u201Ctrack clicks on the signup button\u201D. I\u2019ll create a draft and show it on the page. Nothing goes live until you publish.");else for(let f of We)qe(f.role,f.content);let l=c("div",{display:"flex",gap:"6px",marginTop:"6px"});te=c("input",{flex:"1 1 auto",minWidth:"0",boxSizing:"border-box",padding:"6px 8px",borderRadius:"7px",border:"1px solid rgba(255,255,255,0.18)",background:"rgba(0,0,0,0.25)",color:"#fff",font:"12px system-ui, sans-serif"}),te.type="text",te.maxLength=1e3,te.placeholder="What do you want to change or track?",te.setAttribute("data-field","ai-chat");let u=Le("#6366f1","Send");u.setAttribute("data-action","ai-send"),u.onclick=()=>{te&&ao(te.value)},te.onkeydown=f=>{var h;f.key==="Enter"&&(f.preventDefault(),(h=u.onclick)==null||h.call(u,new MouseEvent("click")))},l.append(te,u),o.append(i,Lt,fe,l),Ht.textContent="",Ht.append(o),te.focus()};Wn.onclick=()=>xr();let fn=o=>{if(!t)return;let i=t.parentElement;if(!i)return;Fe||(wt=i,Kt=t.nextSibling,Fe=!0),o==="up"&&ot?i.insertBefore(t,ot):o==="down"&&rt&&i.insertBefore(t,rt.nextSibling);let a=en(t,document);ot=a.prevEl,rt=a.nextEl,Ee=a.prevLocator,Ue=a.nextLocator;try{t.scrollIntoView({block:"nearest",behavior:"smooth"})}catch(l){}g(),ln(!0),T("Previewing the new position \u2014 keep moving, save, or undo.")};B.onclick=()=>fn("up"),V.onclick=()=>fn("down"),ze.onclick=()=>{kt(),T("Move undone \u2014 back to the original position.")},Se.onclick=async()=>{if(!t||!oe||!Fe||!Pe)return;let o=Ee?"moveAfter":"moveBefore",i=Ee!=null?Ee:Ue;if(!i){T("\u26A0 Couldn\u2019t anchor the new position \u2014 nudge it next to a section with an id.",!1);return}let a=Ce("move",oe,t);T("Saving\u2026");let l=await de(e,`/v1/editor/slots/${encodeURIComponent(a)}`,{kind:"arms",target:vt(oe,Te==null?void 0:Te.value()),draftConfig:{arms:[{id:"a",ops:{}},{id:"b",ops:{[o]:i}}]}});l.r==="ok"&&(d("draft_saved",{kind:"move"}),Fe=!1,wt=null,Kt=null,ln(!1),xt(a,Me(t),"b")),be(l,"\u2713 Saved as a draft. Click \u201CPublish\u201D below to go live.")};let wr=()=>{var o,i;d("editor_closed"),s(),window.removeEventListener("pagehide",s),r&&clearTimeout(r),kt(),zt(),document.removeEventListener("mousemove",Qn,!0),document.removeEventListener("click",no,!0),document.removeEventListener("keydown",to,!0),window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k),mt(document),(o=document.getElementById(_n))==null||o.remove(),m.remove(),x.remove(),y.remove(),Be.remove(),window.__sentientEditor=null,(i=document.querySelector("meta[data-sentient-editor]"))==null||i.remove(),Pt()},gn=!1;_e.onclick=()=>{if((nt||Fe)&&!gn){gn=!0,T("\u26A0 Unsaved changes \u2014 click \xD7 again to discard them.",!1);return}wr()},document.addEventListener("mousemove",Qn,!0),document.addEventListener("click",no,!0),document.addEventListener("keydown",to,!0),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),Nt(),d("editor_opened")}var Li="http://www.w3.org/2000/svg";function Qe(e,t){let n=document.createElementNS(Li,e);for(let[r,s]of Object.entries(t))n.setAttribute(r,s);return n}function Ai(e){let t=Qe("svg",{width:String(e),height:String(e),viewBox:"0 0 32 32",fill:"none","aria-hidden":"true"}),n={stroke:"#fff","stroke-width":"2.2","stroke-linecap":"round","stroke-linejoin":"round"};return t.append(Qe("path",K({d:"M21 9H14C11.2 9 9.8 10.8 9.8 13C9.8 15.4 11.6 16.6 14.5 16.6H18.5C20.5 16.6 20.7 18.2 20.4 19.6"},n)),Qe("path",K({d:"M10 22H17"},n)),Qe("circle",{cx:"20.6",cy:"22",r:"2.1",fill:"#fff"})),t}function An(e,t){let n=c("button",{display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",width:"24px",height:"24px",margin:"0",padding:"0",borderRadius:"6px",background:"transparent",border:"none",color:"#9ca3af",cursor:"pointer"});n.setAttribute("aria-label",t),n.title=t;let r=Qe("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true"}),s={stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"};return e==="minimize"?r.append(Qe("path",K({d:"M3 7h8"},s))):r.append(Qe("path",K({d:"M3.5 3.5l7 7M10.5 3.5l-7 7"},s))),n.append(r),n.onmouseenter=()=>{n.style.background="rgba(255,255,255,0.1)",n.style.color="#fff"},n.onmouseleave=()=>{n.style.background="transparent",n.style.color="#9ca3af"},n}function F(e){return{display:"block",width:"100%",marginTop:"8px",padding:"8px 10px",borderRadius:"8px",border:"none",background:e,color:"#fff",font:"13px system-ui, sans-serif",cursor:"pointer",textAlign:"left"}}var nn="sentient-preview-bar";async function _i(e,t){var y,$,L,D,E,z,J,Z,U,X,ne,Q;try{fetch(`${e.apiBase}/v1/editor/telemetry`,{method:"POST",keepalive:!0,headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify({events:[{kind:"previewed"}]})}).catch(()=>{})}catch(P){}let n=null;try{let P=await fetch(`${e.apiBase}/v1/editor/slots`,{headers:{authorization:`Bearer ${e.token}`}});P.ok&&(n=($=((y=(await P.json()).slots)!=null?y:[]).find(ie=>ie.slot_id===t&&ie.kind==="arms"))!=null?$:null)}catch(P){}let r=c("div",{position:"fixed",bottom:"16px",left:"50%",transform:"translateX(-50%)",zIndex:"2147483647",display:"flex",alignItems:"center",gap:"8px",padding:"10px 14px",borderRadius:"12px",maxWidth:"90vw",flexWrap:"wrap",background:"#111827",color:"#fff",font:"13px system-ui, sans-serif",border:"1px solid rgba(99,102,241,0.55)",boxShadow:"0 10px 34px rgba(0,0,0,0.45)"});r.id=nn;let s=c("button",{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.3)",background:"transparent",color:"#fff",font:"12px system-ui, sans-serif",cursor:"pointer",opacity:"0.7"},"Exit preview");s.onclick=()=>{Pt();let P=new URL(location.href);for(let re of["sentient_preview","sentient_arm"])P.searchParams.delete(re);location.assign(P.toString())};let d=c("button",{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.3)",background:"#6366f1",color:"#fff",font:"12px system-ui, sans-serif",cursor:"pointer"},"Back to editor");d.onclick=()=>{let P=new URL(location.href);for(let re of["sentient_preview","sentient_arm"])P.searchParams.delete(re);location.assign(P.toString())};let m=(z=(E=(L=n==null?void 0:n.draft_config)==null?void 0:L.arms)!=null?E:(D=n==null?void 0:n.published_config)==null?void 0:D.arms)!=null?z:[];if(!n||m.length===0){r.append(c("span",{},"Couldn\u2019t load this preview \u2014 reopen it from your dashboard."),d,s),((J=document.body)!=null?J:document.documentElement).append(r);return}let x=new URLSearchParams(location.search).get("sentient_arm"),g=(U=(Z=m.find(P=>P.id===x))!=null?Z:m[1])!=null?U:m[0];r.append(c("span",{fontWeight:"700"},`Previewing: ${(X=n.display_name)!=null?X:n.slot_id}`));let k=n.target&&typeof n.target=="object"?we(n.target,document):null;if(!k)r.append(c("span",{opacity:"0.85"},"\u2014 we couldn\u2019t find this component on this page. It may live on another page, or the page changed."));else{bo(k,g.ops,`preview-${n.slot_id}`,document);try{k.scrollIntoView({block:"center"})}catch(P){}for(let P of m){let re=c("button",{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.3)",cursor:"pointer",background:P.id===g.id?"#6366f1":"transparent",color:"#fff",font:"12px system-ui, sans-serif"},(ne=P.displayName)!=null?ne:P.id);re.onclick=()=>{let ie=new URL(location.href);ie.searchParams.set("sentient_arm",P.id),location.assign(ie.toString())},r.append(re)}}r.append(d,s),((Q=document.body)!=null?Q:document.documentElement).append(r)}async function Ii(e,t){var y,$,L,D;let n=t.lastIndexOf("~"),r=n>0?t.slice(0,n):t,s=n>0?t.slice(n+1):"",d=c("div",{position:"fixed",bottom:"16px",left:"50%",transform:"translateX(-50%)",zIndex:"2147483647",display:"flex",alignItems:"center",gap:"8px",padding:"10px 14px",borderRadius:"12px",maxWidth:"90vw",flexWrap:"wrap",background:"#111827",color:"#fff",font:"13px system-ui, sans-serif",border:"1px solid rgba(139,92,246,0.6)",boxShadow:"0 10px 34px rgba(0,0,0,0.45)"});d.id=nn;let m=c("button",{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.3)",background:"transparent",color:"#fff",font:"12px system-ui, sans-serif",cursor:"pointer"},"Exit preview");m.onclick=()=>{Pt();let E=new URL(location.href);for(let z of["sentient_preview_cell","sentient_refresh_region"])E.searchParams.delete(z);location.assign(E.toString())};let x=E=>{var z;d.append(c("span",{},E),m),((z=document.body)!=null?z:document.documentElement).append(d)},g=null;try{let E=await fetch(`${e.apiBase}/v1/editor/cell-preview?slotId=${encodeURIComponent(r)}&persona=${encodeURIComponent(s)}`,{headers:{authorization:`Bearer ${e.token}`}});E.ok&&(g=await E.json())}catch(E){}if(!g)return x("Couldn\u2019t load this preview \u2014 reopen it from your dashboard.");let k=g.target&&typeof g.target=="object"?we(g.target,document):null;if(!k)return x("\u2014 we couldn\u2019t find this part of the page here. It may live on another page.");if(g.edits!=null&&typeof g.skeletonFp=="string"&&Array.isArray(g.leafToNode)){if(No(k,g.edits,{fp:g.skeletonFp,leafToNode:g.leafToNode})==="mismatch")return x("This part of the page changed since this version was written \u2014 regenerate it from your dashboard.")}else if(g.compose!=null||g.blocks!=null)g.vocabulary&&Array.isArray(g.vocabulary.entries)&&ko(g.vocabulary),Co(k,{preview:(y=g.compose)!=null?y:g.blocks},"preview",document);else if(typeof g.content=="string")k.textContent=g.content;else return x("Nothing to preview in that square yet.");try{k.scrollIntoView({block:"center"})}catch(E){}d.append(c("span",{fontWeight:"700"},`Previewing: ${($=g.slotName)!=null?$:r}`),c("span",{opacity:"0.85"},`for ${(L=g.personaDisplay)!=null?L:s}${g.status==="review"?" \u2014 waiting for your approval":""}. Nothing is being tracked.`),m),((D=document.body)!=null?D:document.documentElement).append(d)}async function Jo(e,t){var d;let n=await ft(e,"/v1/editor/slots"),r=((d=n==null?void 0:n.slots)!=null?d:[]).filter(m=>t?m.slot_id===t:m.region_skeleton_status==null),s=r.length===0&&t?"missing":"none";for(let m of r){let x=m.target&&typeof m.target=="object"?we(m.target,document):null;if(!x){t&&(s="missing");continue}let g=Po(x),k=g.skeleton?{slotId:m.slot_id,skeleton:g.skeleton}:{slotId:m.slot_id,status:g.reason};s=(await de(e,"/v1/editor/region-skeleton",k)).r==="ok"?"ok":"failed"}return s}async function Xo(e){try{await de(e,"/v1/editor/style-vocabulary",zo(document))}catch(t){}}async function $i(){if(typeof document=="undefined")return;let e=hi();if(!e)return;if(e.code){let x=await er(e);if(x!==200){Qt(x===401?Vo:Yo);return}}let t=await yi(e);if(!t.ok){t.unauthorized?(Pt(),Qt(Vo)):Qt(Yo);return}let n=new URLSearchParams(location.search).get("sentient_preview");if(n){document.getElementById(nn)||await _i(e,n);return}let r=new URLSearchParams(location.search).get("sentient_preview_cell");if(r){document.getElementById(nn)||await Ii(e,r),Xo(e);return}let s=new URLSearchParams(location.search).get("sentient_refresh_region");if(s){let x=await Jo(e,s);Qt(x==="ok"?"Region refreshed \u2014 you can regenerate its versions now.":x==="missing"?"We couldn\u2019t find that part of the page here. It may live on another page.":"Couldn\u2019t refresh this region \u2014 reopen the link from your dashboard.");return}if(document.getElementById(gt))return;ir(e);let d=Uo(document);Ze=d,d&&de(e,"/v1/editor/palette",d),Xo(e),Jo(e).catch(()=>{});let m=await xi(e);tr(m),nr(m,document)}$i();return _r(Bi);})();
34
+ `);We.push({role:"assistant",content:(G||"(no reply)").slice(0,4e3)})}catch(v){a.textContent="\u26A0 Couldn\u2019t reach the assistant \u2014 check your connection and try again.",We.pop()}finally{un=!1,te&&(te.disabled=!1,te.focus())}},xr=()=>{if(fe){te==null||te.focus();return}let o=c("div",{margin:"0 0 8px",padding:"9px 11px",borderRadius:"10px",background:"rgba(250,204,21,0.06)",border:"1px solid rgba(250,204,21,0.3)"});o.setAttribute("data-sentient-chat","");let i=c("div",{display:"flex",alignItems:"center",gap:"6px",marginBottom:"4px"}),a=An("close","Close AI chat");if(a.onclick=()=>{Ht.textContent="",fe=null,te=null,Lt=null},i.append(c("div",{fontWeight:"600",flex:"1 1 auto"},"\u2728 AI"),a),Lt=c("div",{fontSize:"11px",opacity:"0.7",marginBottom:"4px"}),pn(),fe=c("div",{maxHeight:"260px",overflowY:"auto",overscrollBehavior:"contain"}),We.length===0)qe("note","Tell me what to try \u2014 e.g. \u201Cmake this headline more urgent\u201D or \u201Ctrack clicks on the signup button\u201D. I\u2019ll create a draft and show it on the page. Nothing goes live until you publish.");else for(let f of We)qe(f.role,f.content);let l=c("div",{display:"flex",gap:"6px",marginTop:"6px"});te=c("input",{flex:"1 1 auto",minWidth:"0",boxSizing:"border-box",padding:"6px 8px",borderRadius:"7px",border:"1px solid rgba(255,255,255,0.18)",background:"rgba(0,0,0,0.25)",color:"#fff",font:"12px system-ui, sans-serif"}),te.type="text",te.maxLength=1e3,te.placeholder="What do you want to change or track?",te.setAttribute("data-field","ai-chat");let u=Le("#6366f1","Send");u.setAttribute("data-action","ai-send"),u.onclick=()=>{te&&ao(te.value)},te.onkeydown=f=>{var h;f.key==="Enter"&&(f.preventDefault(),(h=u.onclick)==null||h.call(u,new MouseEvent("click")))},l.append(te,u),o.append(i,Lt,fe,l),Ht.textContent="",Ht.append(o),te.focus()};Wn.onclick=()=>xr();let fn=o=>{if(!t)return;let i=t.parentElement;if(!i)return;Fe||(wt=i,Kt=t.nextSibling,Fe=!0),o==="up"&&ot?i.insertBefore(t,ot):o==="down"&&rt&&i.insertBefore(t,rt.nextSibling);let a=en(t,document);ot=a.prevEl,rt=a.nextEl,Ee=a.prevLocator,Ue=a.nextLocator;try{t.scrollIntoView({block:"nearest",behavior:"smooth"})}catch(l){}g(),ln(!0),T("Previewing the new position \u2014 keep moving, save, or undo.")};B.onclick=()=>fn("up"),V.onclick=()=>fn("down"),ze.onclick=()=>{kt(),T("Move undone \u2014 back to the original position.")},Se.onclick=async()=>{if(!t||!oe||!Fe||!Pe)return;let o=Ee?"moveAfter":"moveBefore",i=Ee!=null?Ee:Ue;if(!i){T("\u26A0 Couldn\u2019t anchor the new position \u2014 nudge it next to a section with an id.",!1);return}let a=Ce("move",oe,t);T("Saving\u2026");let l=await de(e,`/v1/editor/slots/${encodeURIComponent(a)}`,{kind:"arms",target:vt(oe,Te==null?void 0:Te.value()),draftConfig:{arms:[{id:"a",ops:{}},{id:"b",ops:{[o]:i}}]}});l.r==="ok"&&(d("draft_saved",{kind:"move"}),Fe=!1,wt=null,Kt=null,ln(!1),xt(a,Me(t),"b")),be(l,"\u2713 Saved as a draft. Click \u201CPublish\u201D below to go live.")};let wr=()=>{var o,i;d("editor_closed"),s(),window.removeEventListener("pagehide",s),r&&clearTimeout(r),kt(),zt(),document.removeEventListener("mousemove",Qn,!0),document.removeEventListener("click",no,!0),document.removeEventListener("keydown",to,!0),window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",x),mt(document),(o=document.getElementById(_n))==null||o.remove(),m.remove(),w.remove(),y.remove(),Be.remove(),window.__sentientEditor=null,(i=document.querySelector("meta[data-sentient-editor]"))==null||i.remove(),Pt()},gn=!1;_e.onclick=()=>{if((nt||Fe)&&!gn){gn=!0,T("\u26A0 Unsaved changes \u2014 click \xD7 again to discard them.",!1);return}wr()},document.addEventListener("mousemove",Qn,!0),document.addEventListener("click",no,!0),document.addEventListener("keydown",to,!0),window.addEventListener("scroll",x,!0),window.addEventListener("resize",x),Nt(),d("editor_opened")}var Li="http://www.w3.org/2000/svg";function Qe(e,t){let n=document.createElementNS(Li,e);for(let[r,s]of Object.entries(t))n.setAttribute(r,s);return n}function Ai(e){let t=Qe("svg",{width:String(e),height:String(e),viewBox:"0 0 32 32",fill:"none","aria-hidden":"true"}),n={stroke:"#fff","stroke-width":"2.2","stroke-linecap":"round","stroke-linejoin":"round"};return t.append(Qe("path",K({d:"M21 9H14C11.2 9 9.8 10.8 9.8 13C9.8 15.4 11.6 16.6 14.5 16.6H18.5C20.5 16.6 20.7 18.2 20.4 19.6"},n)),Qe("path",K({d:"M10 22H17"},n)),Qe("circle",{cx:"20.6",cy:"22",r:"2.1",fill:"#fff"})),t}function An(e,t){let n=c("button",{display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",width:"24px",height:"24px",margin:"0",padding:"0",borderRadius:"6px",background:"transparent",border:"none",color:"#9ca3af",cursor:"pointer"});n.setAttribute("aria-label",t),n.title=t;let r=Qe("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true"}),s={stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"};return e==="minimize"?r.append(Qe("path",K({d:"M3 7h8"},s))):r.append(Qe("path",K({d:"M3.5 3.5l7 7M10.5 3.5l-7 7"},s))),n.append(r),n.onmouseenter=()=>{n.style.background="rgba(255,255,255,0.1)",n.style.color="#fff"},n.onmouseleave=()=>{n.style.background="transparent",n.style.color="#9ca3af"},n}function F(e){return{display:"block",width:"100%",marginTop:"8px",padding:"8px 10px",borderRadius:"8px",border:"none",background:e,color:"#fff",font:"13px system-ui, sans-serif",cursor:"pointer",textAlign:"left"}}var nn="sentient-preview-bar";async function _i(e,t){var y,$,L,D,E,z,J,Z,U,X,ne,Q;try{fetch(`${e.apiBase}/v1/editor/telemetry`,{method:"POST",keepalive:!0,headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify({events:[{kind:"previewed"}]})}).catch(()=>{})}catch(P){}let n=null;try{let P=await fetch(`${e.apiBase}/v1/editor/slots`,{headers:{authorization:`Bearer ${e.token}`}});P.ok&&(n=($=((y=(await P.json()).slots)!=null?y:[]).find(ie=>ie.slot_id===t&&ie.kind==="arms"))!=null?$:null)}catch(P){}let r=c("div",{position:"fixed",bottom:"16px",left:"50%",transform:"translateX(-50%)",zIndex:"2147483647",display:"flex",alignItems:"center",gap:"8px",padding:"10px 14px",borderRadius:"12px",maxWidth:"90vw",flexWrap:"wrap",background:"#111827",color:"#fff",font:"13px system-ui, sans-serif",border:"1px solid rgba(99,102,241,0.55)",boxShadow:"0 10px 34px rgba(0,0,0,0.45)"});r.id=nn;let s=c("button",{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.3)",background:"transparent",color:"#fff",font:"12px system-ui, sans-serif",cursor:"pointer",opacity:"0.7"},"Exit preview");s.onclick=()=>{Pt();let P=new URL(location.href);for(let re of["sentient_preview","sentient_arm"])P.searchParams.delete(re);location.assign(P.toString())};let d=c("button",{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.3)",background:"#6366f1",color:"#fff",font:"12px system-ui, sans-serif",cursor:"pointer"},"Back to editor");d.onclick=()=>{let P=new URL(location.href);for(let re of["sentient_preview","sentient_arm"])P.searchParams.delete(re);location.assign(P.toString())};let m=(z=(E=(L=n==null?void 0:n.draft_config)==null?void 0:L.arms)!=null?E:(D=n==null?void 0:n.published_config)==null?void 0:D.arms)!=null?z:[];if(!n||m.length===0){r.append(c("span",{},"Couldn\u2019t load this preview \u2014 reopen it from your dashboard."),d,s),((J=document.body)!=null?J:document.documentElement).append(r);return}let w=new URLSearchParams(location.search).get("sentient_arm"),g=(U=(Z=m.find(P=>P.id===w))!=null?Z:m[1])!=null?U:m[0];r.append(c("span",{fontWeight:"700"},`Previewing: ${(X=n.display_name)!=null?X:n.slot_id}`));let x=n.target&&typeof n.target=="object"?we(n.target,document):null;if(!x)r.append(c("span",{opacity:"0.85"},"\u2014 we couldn\u2019t find this component on this page. It may live on another page, or the page changed."));else{bo(x,g.ops,`preview-${n.slot_id}`,document);try{x.scrollIntoView({block:"center"})}catch(P){}for(let P of m){let re=c("button",{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.3)",cursor:"pointer",background:P.id===g.id?"#6366f1":"transparent",color:"#fff",font:"12px system-ui, sans-serif"},(ne=P.displayName)!=null?ne:P.id);re.onclick=()=>{let ie=new URL(location.href);ie.searchParams.set("sentient_arm",P.id),location.assign(ie.toString())},r.append(re)}}r.append(d,s),((Q=document.body)!=null?Q:document.documentElement).append(r)}async function Ii(e,t){var y,$,L,D;let n=t.lastIndexOf("~"),r=n>0?t.slice(0,n):t,s=n>0?t.slice(n+1):"",d=c("div",{position:"fixed",bottom:"16px",left:"50%",transform:"translateX(-50%)",zIndex:"2147483647",display:"flex",alignItems:"center",gap:"8px",padding:"10px 14px",borderRadius:"12px",maxWidth:"90vw",flexWrap:"wrap",background:"#111827",color:"#fff",font:"13px system-ui, sans-serif",border:"1px solid rgba(139,92,246,0.6)",boxShadow:"0 10px 34px rgba(0,0,0,0.45)"});d.id=nn;let m=c("button",{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.3)",background:"transparent",color:"#fff",font:"12px system-ui, sans-serif",cursor:"pointer"},"Exit preview");m.onclick=()=>{Pt();let E=new URL(location.href);for(let z of["sentient_preview_cell","sentient_refresh_region"])E.searchParams.delete(z);location.assign(E.toString())};let w=E=>{var z;d.append(c("span",{},E),m),((z=document.body)!=null?z:document.documentElement).append(d)},g=null;try{let E=await fetch(`${e.apiBase}/v1/editor/cell-preview?slotId=${encodeURIComponent(r)}&persona=${encodeURIComponent(s)}`,{headers:{authorization:`Bearer ${e.token}`}});E.ok&&(g=await E.json())}catch(E){}if(!g)return w("Couldn\u2019t load this preview \u2014 reopen it from your dashboard.");let x=g.target&&typeof g.target=="object"?we(g.target,document):null;if(!x)return w("\u2014 we couldn\u2019t find this part of the page here. It may live on another page.");if(g.edits!=null&&typeof g.skeletonFp=="string"&&Array.isArray(g.leafToNode)){if(No(x,g.edits,{fp:g.skeletonFp,leafToNode:g.leafToNode})==="mismatch")return w("This part of the page changed since this version was written \u2014 regenerate it from your dashboard.")}else if(g.compose!=null||g.blocks!=null)g.vocabulary&&Array.isArray(g.vocabulary.entries)&&ko(g.vocabulary),Co(x,{preview:(y=g.compose)!=null?y:g.blocks},"preview",document);else if(typeof g.content=="string")x.textContent=g.content;else return w("Nothing to preview in that square yet.");try{x.scrollIntoView({block:"center"})}catch(E){}d.append(c("span",{fontWeight:"700"},`Previewing: ${($=g.slotName)!=null?$:r}`),c("span",{opacity:"0.85"},`for ${(L=g.personaDisplay)!=null?L:s}${g.status==="review"?" \u2014 waiting for your approval":""}. Nothing is being tracked.`),m),((D=document.body)!=null?D:document.documentElement).append(d)}async function Jo(e,t){var d;let n=await ft(e,"/v1/editor/slots"),r=((d=n==null?void 0:n.slots)!=null?d:[]).filter(m=>t?m.slot_id===t:m.region_skeleton_status==null),s=r.length===0&&t?"missing":"none";for(let m of r){let w=m.target&&typeof m.target=="object"?we(m.target,document):null;if(!w){t&&(s="missing");continue}let g=Po(w),x=g.skeleton?{slotId:m.slot_id,skeleton:g.skeleton}:{slotId:m.slot_id,status:g.reason};s=(await de(e,"/v1/editor/region-skeleton",x)).r==="ok"?"ok":"failed"}return s}async function Xo(e){try{await de(e,"/v1/editor/style-vocabulary",zo(document))}catch(t){}}async function $i(){if(typeof document=="undefined")return;let e=hi();if(!e)return;if(e.code){let w=await er(e);if(w!==200){Qt(w===401?Vo:Yo);return}}let t=await yi(e);if(!t.ok){t.unauthorized?(Pt(),Qt(Vo)):Qt(Yo);return}let n=new URLSearchParams(location.search).get("sentient_preview");if(n){document.getElementById(nn)||await _i(e,n);return}let r=new URLSearchParams(location.search).get("sentient_preview_cell");if(r){document.getElementById(nn)||await Ii(e,r),Xo(e);return}let s=new URLSearchParams(location.search).get("sentient_refresh_region");if(s){let w=await Jo(e,s);Qt(w==="ok"?"Region refreshed \u2014 you can regenerate its versions now.":w==="missing"?"We couldn\u2019t find that part of the page here. It may live on another page.":"Couldn\u2019t refresh this region \u2014 reopen the link from your dashboard.");return}if(document.getElementById(gt))return;ir(e);let d=Uo(document);Ze=d,d&&de(e,"/v1/editor/palette",d),Xo(e),Jo(e).catch(()=>{});let m=await xi(e);tr(m),nr(m,document)}$i();return _r(Bi);})();
@@ -1 +1 @@
1
- "use strict";var __sentientEngagement=(()=>{var J=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var Ae=Object.getOwnPropertyNames;var $e=Object.prototype.hasOwnProperty;var q=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ee=(e,t)=>{for(var n in t)J(e,n,{get:t[n],enumerable:!0})},Ce=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ae(t))!$e.call(e,r)&&r!==n&&J(e,r,{get:()=>t[r],enumerable:!(o=Ie(t,r))||o.enumerable});return e};var Oe=e=>Ce(J({},"__esModule",{value:!0}),e);var Me,Te,Ne,ae,De,Ke,oe,L,le,Z=q(()=>{"use strict";Me=Object.defineProperty,Te=Object.defineProperties,Ne=Object.getOwnPropertyDescriptors,ae=Object.getOwnPropertySymbols,De=Object.prototype.hasOwnProperty,Ke=Object.prototype.propertyIsEnumerable,oe=(e,t,n)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,L=(e,t)=>{for(var n in t||(t={}))De.call(t,n)&&oe(e,n,t[n]);if(ae)for(var n of ae(t))Ke.call(t,n)&&oe(e,n,t[n]);return e},le=(e,t)=>Te(e,Ne(t))});var I,de=q(()=>{"use strict";I="sentient_internal"});function X(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function We(){try{return location.protocol==="https:"?"; Secure":""}catch(e){return""}}function H(e,t,n,o){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=lax; path=/${o?`; domain=${o}`:""}${We()}`}catch(r){}}function ee(e,t){H(e,"",0,t)}var fe=q(()=>{"use strict"});function et(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase(),[n,o,r]=t.split("@");return n&&o&&r===void 0?t:null}async function ke(e){let t=et(e),n=t==null?void 0:t.split("@")[1];if(!n||n.length>253)return{};try{let o=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t)),r="";for(let i of new Uint8Array(o))r+=i.toString(16).padStart(2,"0");return{emailHash:r,emailDomain:n}}catch(o){return{emailDomain:n}}}function _e(e){try{let t=new URL(location.href),n=t.searchParams.get(I);n!==null&&(ee(I),e&&ee(I,e),n!=="off"&&/^[\w-]{1,128}$/.test(n)&&(H(I,n,Se,e),X(I)!==n&&H(I,n,Se)),t.searchParams.delete(I),history.replaceState(history.state,"",t.pathname+t.search+t.hash))}catch(t){}return X(I)}var Se,xe=q(()=>{"use strict";fe();de();Se=365*24*60*60});var tt={};Ee(tt,{emailFields:()=>ke,startEngagementCapture:()=>we,takeInternalToken:()=>_e});var Le=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function Y(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function Pe(e){return{tag:e.tagName.toLowerCase(),text:Y(e).slice(0,40)}}function te(e){return e.replace(/["\\\]]/g,"\\$&")}function W(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function ne(e,t){var n;let o=e.tagName.toLowerCase();if(!o)return null;let r=((n=e.getAttribute("class"))!=null?n:"").split(/\s+/).filter(c=>/^[a-zA-Z][\w-]*$/.test(c)),i=[o,...r.map(c=>`${o}.${c}`)];for(let c of i)if(W(t,c))return c;let s=e.parentElement;if(s&&s!==t){let c=ne(s,t);if(c){for(let m of i){let b=`${c} > ${m}`;if(W(t,b))return b}let d=Array.from(s.children).filter(m=>m.tagName.toLowerCase()===o),y=d.indexOf(e),S=d.some(m=>m!==e&&Y(m)!==Y(e));if(y>=0&&S){let m=`${c} > ${o}:nth-of-type(${y+1})`;if(W(t,m))return m}}}return null}function re(e,t){let n=Pe(e),o=e.getAttribute("id");if(o&&W(t,`#${te(o)}`))return{v:1,id:o,fingerprint:n};for(let i of Le){let s=e.getAttribute(i);if(s&&W(t,`[${i}="${te(s)}"]`))return{v:1,dataAttr:{name:i,value:s},fingerprint:n}}let r=ne(e,t);return r?{v:1,selector:r,fingerprint:n}:null}Z();var se=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],Re={banner:"hero",navigation:"navigation",contentinfo:"footer"};function je(e){let t=e.ariaRole?Re[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 Ue(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var Fe=[["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]],Q=[["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]],ie={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function Be(e){var t;let n=e.querySelector("h1, h2, h3");return((t=n==null?void 0:n.textContent)!=null?t:"").slice(0,160)}function ue(e){var t,n;let o=je(e);if(o)return{type:(t=ie[o])!=null?t:"generic",strength:"strong"};let r=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[s,c]of Fe)if(c.test(r))return{type:s,strength:"strong"};for(let[s,c]of Q)if(c.test(e.bodyText))return{type:s,strength:"strong"};let i=Ue(e);return{type:(n=ie[i])!=null?n:"generic",strength:"weak"}}function ce(e){var t,n;let o=((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim(),r=e.getAttribute("role");return L({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((n=e.className)!=null?n:"")}`,headingText:Be(e),bodyText:o.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:o.length},r?{ariaRole:r}:{})}function pe(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}var ct=1800*1e3;function ge(e,t,n,o){let r=[];{let i=!1,s=[],c=()=>{if(i)return;let d=Date.now();for(s.push(d);s.length>0&&d-s[0]>500;)s.shift();s.length>=3&&(i=!0,e("rage_click"))};t.addEventListener("click",c),r.push(()=>t.removeEventListener("click",c))}{let i=!1,s=c=>{if(i||!(c.target instanceof Node)||!t.contains(c.target)&&t!==c.target)return;i=!0;let d=typeof window!="undefined"?window.getSelection():null,y=d?d.toString().length:0;e("text_copy",{selectionLength:y})};document.addEventListener("copy",s),r.push(()=>document.removeEventListener("copy",s))}{let i=!1,s=!1,c=null,d=()=>{c!==null&&(clearTimeout(c),c=null)},y=()=>{i||!s||(d(),c=setTimeout(()=>{!i&&s&&(i=!0,e("scroll_hesitation"))},3e3))},S=()=>{d(),y()},m=A=>{for(let $ of A)s=$.intersectionRatio>.3,s?y():d()},b=new IntersectionObserver(m,{threshold:[.3]});b.observe(t),window.addEventListener("scroll",S,{passive:!0}),r.push(()=>{b.disconnect(),window.removeEventListener("scroll",S),d()})}if((o==null?void 0:o.tabLoss)!==!1){let i=!1,s=n!=null?n:Date.now(),c=()=>{if(i||document.visibilityState!=="hidden")return;let d=Date.now()-s;d<15e3&&(i=!0,e("tab_loss",{timeOnPage:d}))};document.addEventListener("visibilitychange",c),r.push(()=>document.removeEventListener("visibilitychange",c))}return()=>{for(let i of r)i()}}function me(){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")}Z();var he=[100,300,1e3,3e3,1e4],ze=250,Ge=1e3,Ve=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function ve(e,t){e.n++;let n=t-e.mean;e.mean+=n/e.n,e.m2+=n*(t-e.mean)}var ye=e=>e.n>1?Math.sqrt(e.m2/e.n):0;function qe(e){var t;try{let n=e.createElement("canvas"),o=n.getContext("webgl")||n.getContext("experimental-webgl");if(!o)return"unknown";let r=o.getExtension("WEBGL_debug_renderer_info"),i=r?String((t=o.getParameter(r.UNMASKED_RENDERER_WEBGL))!=null?t:""):"";return i?/swiftshader|llvmpipe|softpipe|software|mesa offscreen/i.test(i)?"sw":"hw":"unknown"}catch(n){return"unknown"}}function He(e,t=Date.now){var n,o;let r=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0,i={n:0,mean:0,m2:0},s={n:0,mean:0,m2:0},c=[0,0,0,0,0,0],d=0,y=0,S=0,m=0,b=0,A=0,$=0,N=0,D=0,h=0,z=-1/0,K=-1/0,k=null,P=null,R=null,j=(o=r==null?void 0:r.scrollY)!=null?o:0,G=0,v=e.hidden?null:t(),M=()=>{let l=t();if(R!=null){let g=l-R,_=0;for(;_<he.length&&g>=he[_];)_++;c[_]++}R=l},T=()=>{d++,z=t()},E=()=>{y++,K=t()},U=()=>{k=t()},C=()=>{k!=null&&(ve(i,t()-k),k=null)},F=()=>{let l=t();S++,l-z>ze&&l-K>Ge&&m++,M()},O=()=>{b++},w=()=>{var l;let g=(l=r==null?void 0:r.scrollY)!=null?l:0;A+=Math.abs(g-j),j=g,M()},V=l=>{let g=t();$++,(l.key==="Backspace"||l.key==="Delete")&&D++,Ve.has(l.key)&&h++,P!=null&&ve(s,g-P),P=g,M()},B=l=>{let g=l.data;typeof g=="string"&&(N+=g.length),M()},u=()=>{let l=t();e.hidden?v!=null&&(G+=l-v,v=null):v==null&&(v=l)},a={passive:!0,capture:!0};e.addEventListener("mousemove",T,a),e.addEventListener("touchstart",E,a),e.addEventListener("touchmove",O,a),e.addEventListener("mousedown",U,a),e.addEventListener("mouseup",C,a),e.addEventListener("click",F,a),e.addEventListener("wheel",O,a),e.addEventListener("keydown",V,a),e.addEventListener("input",B,a),e.addEventListener("visibilitychange",u),r==null||r.addEventListener("scroll",w,a);let f=qe(e),p=(()=>{var l;try{return((l=r==null?void 0:r.matchMedia)==null?void 0:l.call(r,"(prefers-reduced-motion: reduce)").matches)===!0}catch(g){return!1}})();return{snapshot(){var l,g;let _=t(),x=G+(v!=null?_-v:0);return{v:1,active_ms:Math.round(x),mm:d,mm_rate:x>0?Number((d*1e3/x).toFixed(2)):0,touches:y,clicks:S,hold_n:i.n,hold_mean:Math.round(i.mean),hold_std:Math.round(ye(i)),teleport:m,wheel:b,scroll_px:Math.round(A),keydowns:$,input_chars:N,ik_cv:s.mean>0?Number((ye(s)/s.mean).toFixed(2)):0,backspaces:D,gaps:[...c],reduced_motion:p,kb_nav:h,renderer:f,vp:[(l=r==null?void 0:r.innerWidth)!=null?l:0,(g=r==null?void 0:r.innerHeight)!=null?g:0],dpr:(r==null?void 0:r.devicePixelRatio)||1}},stop(){e.removeEventListener("mousemove",T,a),e.removeEventListener("touchstart",E,a),e.removeEventListener("touchmove",O,a),e.removeEventListener("mousedown",U,a),e.removeEventListener("mouseup",C,a),e.removeEventListener("click",F,a),e.removeEventListener("wheel",O,a),e.removeEventListener("keydown",V,a),e.removeEventListener("input",B,a),e.removeEventListener("visibilitychange",u),r==null||r.removeEventListener("scroll",w,a)}}}var Je="section, header, footer, nav, main > div, [data-sentient-section]",Ye=2e4,Ze="__session__";function Qe(e){let t=Array.from(e.querySelectorAll(Je)),n=t.filter(o=>t.filter(r=>r!==o&&o.contains(r)).length<2);return n.filter(o=>!n.some(r=>r!==o&&r.contains(o)))}function Xe(e,t,n,o){try{fetch(`${t}/v1/section-map`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${e}`},body:JSON.stringify({pageUrl:n,sections:o})}).catch(()=>{})}catch(r){}}var be=()=>{};function we(e,t){var n,o,r,i,s,c,d,y,S,m,b,A,$,N,D;let h=(n=t.doc)!=null?n:typeof document!="undefined"?document:void 0;if(!h||typeof IntersectionObserver=="undefined"||me()||!t.apiKey||!t.apiKey.startsWith("pk_"))return be;let z=((o=t.apiBase)!=null?o:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),K=Qe(h);if(K.length===0)return be;let k=new Map,P=[];for(let u of K){let a=(s=[(i=t.sectionTypes)==null?void 0:i[(r=u.getAttribute("data-sentient-id"))!=null?r:""],u.getAttribute("data-sentient-type")].find(x=>se.includes(x)))!=null?s:null,f=ce(u),p=(d=a!=null?a:(c=t.typeOf)==null?void 0:c.call(t,u))!=null?d:ue(f).type,l=re(u,h),g=l?`nc-${p}-${pe(JSON.stringify({id:(y=l.id)!=null?y:null,dataAttr:(S=l.dataAttr)!=null?S:null,selector:(m=l.selector)!=null?m:null})).toString(36)}`:`nc-${p}`;k.set(u,g);let _=Q.filter(([,x])=>x.test(f.bodyText)).map(([x])=>x);P.push(le(L({componentId:g,semanticType:p,source:a?"markup":"auto"},l?{locator:l}:{}),{observation:L(L({tag:f.tag,idClass:f.idClass.slice(0,200),headingText:f.headingText,textLength:f.textLength,actionCount:f.actionCount},f.ariaRole?{ariaRole:f.ariaRole}:{}),_.length>0?{patternFlags:_}:{})}))}let R=(N=($=(A=(b=h.defaultView)!=null?b:typeof window!="undefined"?window:void 0)==null?void 0:A.location)==null?void 0:$.pathname)!=null?N:"/";Xe(t.apiKey,z,R,P);let j=He(h),G=()=>{let u;try{u=j.snapshot()}catch(a){return}try{e.track({projectId:t.apiKey,componentId:Ze,eventType:"interaction_stats",payload:u})}catch(a){}},v=new Map,M=u=>{let a=v.get(u);return a||(a={ms:0,scroll:0,enterAt:null,intersecting:!1},v.set(u,a)),a},T=new IntersectionObserver(u=>{for(let a of u){let f=k.get(a.target);if(!f)continue;let p=M(f);a.isIntersecting?(p.intersecting=!0,p.enterAt=Date.now(),a.intersectionRatio>p.scroll&&(p.scroll=a.intersectionRatio)):(p.intersecting=!1,p.enterAt!=null&&(p.ms+=Date.now()-p.enterAt,p.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let u of k.keys())T.observe(u);let E=(u=!1)=>{var a;let f=Date.now();for(let[p,l]of v)if(l.enterAt!=null&&(l.ms+=f-l.enterAt,l.enterAt=null),!(l.ms<=0)){try{e.track({projectId:t.apiKey,componentId:p,eventType:"dwell",payload:{dwell_time:Math.round(l.ms),scroll_depth:Number(l.scroll.toFixed(2))}})}catch(g){}l.ms=0}if(G(),u)try{(a=e.flush)==null||a.call(e)}catch(p){}},U=()=>{if(h.hidden)E(!0);else{let u=Date.now();for(let a of v.values())a.intersecting&&(a.enterAt=u)}},C=!1,F=u=>{if(E(!0),u!=null&&u.persisted){C=!0;return}try{T.disconnect()}catch(a){}},O=u=>{if(!(u!=null&&u.persisted)||!C)return;C=!1;let a=Date.now();for(let f of v.values())f.enterAt=f.intersecting&&!h.hidden?a:null};h.addEventListener("visibilitychange",U);let w=(D=h.defaultView)!=null?D:typeof window!="undefined"?window:void 0;w==null||w.addEventListener("pagehide",F),w==null||w.addEventListener("pageshow",O);let V=setInterval(()=>{if(h.hidden||C)return;E();let u=Date.now();for(let a of v.values())a.intersecting&&(a.enterAt=u)},Ye),B=[];return t.microSignals&&[...k.entries()].forEach(([u,a],f)=>{B.push(ge((p,l={})=>{try{e.track({projectId:t.apiKey,componentId:a,eventType:"micro_signal",payload:L({signalType:p},l)})}catch(g){}},u,void 0,{tabLoss:f===0}))}),()=>{E(!0),clearInterval(V),j.stop(),h.removeEventListener("visibilitychange",U),w==null||w.removeEventListener("pagehide",F),w==null||w.removeEventListener("pageshow",O);for(let u of B)u();try{T.disconnect()}catch(u){}}}xe();return Oe(tt);})();
1
+ "use strict";var __sentientEngagement=(()=>{var J=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var Ae=Object.getOwnPropertyNames;var $e=Object.prototype.hasOwnProperty;var q=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ee=(e,t)=>{for(var n in t)J(e,n,{get:t[n],enumerable:!0})},Ce=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ae(t))!$e.call(e,r)&&r!==n&&J(e,r,{get:()=>t[r],enumerable:!(o=Ie(t,r))||o.enumerable});return e};var Oe=e=>Ce(J({},"__esModule",{value:!0}),e);var Me,Te,Ne,ae,De,Ke,oe,L,le,Z=q(()=>{"use strict";Me=Object.defineProperty,Te=Object.defineProperties,Ne=Object.getOwnPropertyDescriptors,ae=Object.getOwnPropertySymbols,De=Object.prototype.hasOwnProperty,Ke=Object.prototype.propertyIsEnumerable,oe=(e,t,n)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,L=(e,t)=>{for(var n in t||(t={}))De.call(t,n)&&oe(e,n,t[n]);if(ae)for(var n of ae(t))Ke.call(t,n)&&oe(e,n,t[n]);return e},le=(e,t)=>Te(e,Ne(t))});var I,de=q(()=>{"use strict";I="sentient_internal"});function X(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function We(){try{return location.protocol==="https:"?"; Secure":""}catch(e){return""}}function H(e,t,n,o){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=lax; path=/${o?`; domain=${o}`:""}${We()}`}catch(r){}}function ee(e,t){H(e,"",0,t)}var fe=q(()=>{"use strict"});function et(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase(),[n,o,r]=t.split("@");return n&&o&&r===void 0?t:null}async function ke(e){let t=et(e),n=t==null?void 0:t.split("@")[1];if(!n||n.length>253)return{};try{let o=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t)),r="";for(let i of new Uint8Array(o))r+=i.toString(16).padStart(2,"0");return{emailHash:r,emailDomain:n}}catch(o){return{emailDomain:n}}}function _e(e){try{let t=new URL(location.href),n=t.searchParams.get(I);n!==null&&(ee(I),e&&ee(I,e),n!=="off"&&/^[\w-]{1,128}$/.test(n)&&(H(I,n,Se,e),X(I)!==n&&H(I,n,Se)),t.searchParams.delete(I),history.replaceState(history.state,"",t.pathname+t.search+t.hash))}catch(t){}return X(I)}var Se,xe=q(()=>{"use strict";fe();de();Se=365*24*60*60});var tt={};Ee(tt,{emailFields:()=>ke,startEngagementCapture:()=>we,takeInternalToken:()=>_e});var Le=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function Y(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function Pe(e){return{tag:e.tagName.toLowerCase(),text:Y(e).slice(0,40)}}function te(e){return e.replace(/["\\\]]/g,"\\$&")}function W(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function ne(e,t){var n;let o=e.tagName.toLowerCase();if(!o)return null;let r=((n=e.getAttribute("class"))!=null?n:"").split(/\s+/).filter(c=>/^[a-zA-Z][\w-]*$/.test(c)),i=[o,...r.map(c=>`${o}.${c}`)];for(let c of i)if(W(t,c))return c;let s=e.parentElement;if(s&&s!==t){let c=ne(s,t);if(c){for(let g of i){let b=`${c} > ${g}`;if(W(t,b))return b}let d=Array.from(s.children).filter(g=>g.tagName.toLowerCase()===o),y=d.indexOf(e),S=d.some(g=>g!==e&&Y(g)!==Y(e));if(y>=0&&S){let g=`${c} > ${o}:nth-of-type(${y+1})`;if(W(t,g))return g}}}return null}function re(e,t){let n=Pe(e),o=e.getAttribute("id");if(o&&W(t,`#${te(o)}`))return{v:1,id:o,fingerprint:n};for(let i of Le){let s=e.getAttribute(i);if(s&&W(t,`[${i}="${te(s)}"]`))return{v:1,dataAttr:{name:i,value:s},fingerprint:n}}let r=ne(e,t);return r?{v:1,selector:r,fingerprint:n}:null}Z();var se=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],Re={banner:"hero",navigation:"navigation",contentinfo:"footer"};function je(e){let t=e.ariaRole?Re[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 Ue(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var Fe=[["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]],Q=[["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]],ie={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function Be(e){var t;let n=e.querySelector("h1, h2, h3");return((t=n==null?void 0:n.textContent)!=null?t:"").slice(0,160)}function ue(e){var t,n;let o=je(e);if(o)return{type:(t=ie[o])!=null?t:"generic",strength:"strong"};let r=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[s,c]of Fe)if(c.test(r))return{type:s,strength:"strong"};for(let[s,c]of Q)if(c.test(e.bodyText))return{type:s,strength:"strong"};let i=Ue(e);return{type:(n=ie[i])!=null?n:"generic",strength:"weak"}}function ce(e){var t,n;let o=((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim(),r=e.getAttribute("role");return L({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((n=e.className)!=null?n:"")}`,headingText:Be(e),bodyText:o.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:o.length},r?{ariaRole:r}:{})}function pe(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}var ct=1800*1e3;function me(e,t,n,o){let r=[];{let i=!1,s=[],c=()=>{if(i)return;let d=Date.now();for(s.push(d);s.length>0&&d-s[0]>500;)s.shift();s.length>=3&&(i=!0,e("rage_click"))};t.addEventListener("click",c),r.push(()=>t.removeEventListener("click",c))}{let i=!1,s=c=>{if(i||!(c.target instanceof Node)||!t.contains(c.target)&&t!==c.target)return;i=!0;let d=typeof window!="undefined"?window.getSelection():null,y=d?d.toString().length:0;e("text_copy",{selectionLength:y})};document.addEventListener("copy",s),r.push(()=>document.removeEventListener("copy",s))}{let i=!1,s=!1,c=null,d=()=>{c!==null&&(clearTimeout(c),c=null)},y=()=>{i||!s||(d(),c=setTimeout(()=>{!i&&s&&(i=!0,e("scroll_hesitation"))},3e3))},S=()=>{d(),y()},g=A=>{for(let $ of A)s=$.intersectionRatio>.3,s?y():d()},b=new IntersectionObserver(g,{threshold:[.3]});b.observe(t),window.addEventListener("scroll",S,{passive:!0}),r.push(()=>{b.disconnect(),window.removeEventListener("scroll",S),d()})}if((o==null?void 0:o.tabLoss)!==!1){let i=!1,s=n!=null?n:Date.now(),c=()=>{if(i||document.visibilityState!=="hidden")return;let d=Date.now()-s;d<15e3&&(i=!0,e("tab_loss",{timeOnPage:d}))};document.addEventListener("visibilitychange",c),r.push(()=>document.removeEventListener("visibilitychange",c))}return()=>{for(let i of r)i()}}function ge(){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")}Z();var he=[100,300,1e3,3e3,1e4],Ve=250,ze=1e3,Ge=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function ve(e,t){e.n++;let n=t-e.mean;e.mean+=n/e.n,e.m2+=n*(t-e.mean)}var ye=e=>e.n>1?Math.sqrt(e.m2/e.n):0;function qe(e){var t;try{let n=e.createElement("canvas"),o=n.getContext("webgl")||n.getContext("experimental-webgl");if(!o)return"unknown";let r=o.getExtension("WEBGL_debug_renderer_info"),i=r?String((t=o.getParameter(r.UNMASKED_RENDERER_WEBGL))!=null?t:""):"";return i?/swiftshader|llvmpipe|softpipe|software|mesa offscreen/i.test(i)?"sw":"hw":"unknown"}catch(n){return"unknown"}}function He(e,t=Date.now){var n,o;let r=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0,i={n:0,mean:0,m2:0},s={n:0,mean:0,m2:0},c=[0,0,0,0,0,0],d=0,y=0,S=0,g=0,b=0,A=0,$=0,N=0,D=0,h=0,V=-1/0,K=-1/0,k=null,P=null,R=null,j=(o=r==null?void 0:r.scrollY)!=null?o:0,z=0,v=e.hidden?null:t(),M=()=>{let l=t();if(R!=null){let m=l-R,_=0;for(;_<he.length&&m>=he[_];)_++;c[_]++}R=l},T=()=>{d++,V=t()},E=()=>{y++,K=t()},U=()=>{k=t()},C=()=>{k!=null&&(ve(i,t()-k),k=null)},F=()=>{let l=t();S++,l-V>Ve&&l-K>ze&&g++,M()},O=()=>{b++},w=()=>{var l;let m=(l=r==null?void 0:r.scrollY)!=null?l:0;A+=Math.abs(m-j),j=m,M()},G=l=>{let m=t();$++,(l.key==="Backspace"||l.key==="Delete")&&D++,Ge.has(l.key)&&h++,P!=null&&ve(s,m-P),P=m,M()},B=l=>{let m=l.data;typeof m=="string"&&(N+=m.length),M()},u=()=>{let l=t();e.hidden?v!=null&&(z+=l-v,v=null):v==null&&(v=l)},a={passive:!0,capture:!0};e.addEventListener("mousemove",T,a),e.addEventListener("touchstart",E,a),e.addEventListener("touchmove",O,a),e.addEventListener("mousedown",U,a),e.addEventListener("mouseup",C,a),e.addEventListener("click",F,a),e.addEventListener("wheel",O,a),e.addEventListener("keydown",G,a),e.addEventListener("input",B,a),e.addEventListener("visibilitychange",u),r==null||r.addEventListener("scroll",w,a);let f=qe(e),p=(()=>{var l;try{return((l=r==null?void 0:r.matchMedia)==null?void 0:l.call(r,"(prefers-reduced-motion: reduce)").matches)===!0}catch(m){return!1}})();return{snapshot(){var l,m;let _=t(),x=z+(v!=null?_-v:0);return{v:1,active_ms:Math.round(x),mm:d,mm_rate:x>0?Number((d*1e3/x).toFixed(2)):0,touches:y,clicks:S,hold_n:i.n,hold_mean:Math.round(i.mean),hold_std:Math.round(ye(i)),teleport:g,wheel:b,scroll_px:Math.round(A),keydowns:$,input_chars:N,ik_cv:s.mean>0?Number((ye(s)/s.mean).toFixed(2)):0,backspaces:D,gaps:[...c],reduced_motion:p,kb_nav:h,renderer:f,vp:[(l=r==null?void 0:r.innerWidth)!=null?l:0,(m=r==null?void 0:r.innerHeight)!=null?m:0],dpr:(r==null?void 0:r.devicePixelRatio)||1}},stop(){e.removeEventListener("mousemove",T,a),e.removeEventListener("touchstart",E,a),e.removeEventListener("touchmove",O,a),e.removeEventListener("mousedown",U,a),e.removeEventListener("mouseup",C,a),e.removeEventListener("click",F,a),e.removeEventListener("wheel",O,a),e.removeEventListener("keydown",G,a),e.removeEventListener("input",B,a),e.removeEventListener("visibilitychange",u),r==null||r.removeEventListener("scroll",w,a)}}}var Je="section, header, footer, nav, main > div, [data-sentient-section]",Ye=2e4,Ze="__session__";function Qe(e){let t=Array.from(e.querySelectorAll(Je)),n=t.filter(o=>t.filter(r=>r!==o&&o.contains(r)).length<2);return n.filter(o=>!n.some(r=>r!==o&&r.contains(o)))}function Xe(e,t,n,o){try{fetch(`${t}/v1/section-map`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${e}`},body:JSON.stringify({pageUrl:n,sections:o})}).catch(()=>{})}catch(r){}}var be=()=>{};function we(e,t){var n,o,r,i,s,c,d,y,S,g,b,A,$,N,D;let h=(n=t.doc)!=null?n:typeof document!="undefined"?document:void 0;if(!h||typeof IntersectionObserver=="undefined"||ge()||!t.apiKey||!t.apiKey.startsWith("pk_"))return be;let V=((o=t.apiBase)!=null?o:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),K=Qe(h);if(K.length===0)return be;let k=new Map,P=[];for(let u of K){let a=(s=[(i=t.sectionTypes)==null?void 0:i[(r=u.getAttribute("data-sentient-id"))!=null?r:""],u.getAttribute("data-sentient-type")].find(x=>se.includes(x)))!=null?s:null,f=ce(u),p=(d=a!=null?a:(c=t.typeOf)==null?void 0:c.call(t,u))!=null?d:ue(f).type,l=re(u,h),m=l?`nc-${p}-${pe(JSON.stringify({id:(y=l.id)!=null?y:null,dataAttr:(S=l.dataAttr)!=null?S:null,selector:(g=l.selector)!=null?g:null})).toString(36)}`:`nc-${p}`;k.set(u,m);let _=Q.filter(([,x])=>x.test(f.bodyText)).map(([x])=>x);P.push(le(L({componentId:m,semanticType:p,source:a?"markup":"auto"},l?{locator:l}:{}),{observation:L(L({tag:f.tag,idClass:f.idClass.slice(0,200),headingText:f.headingText,textLength:f.textLength,actionCount:f.actionCount},f.ariaRole?{ariaRole:f.ariaRole}:{}),_.length>0?{patternFlags:_}:{})}))}let R=(N=($=(A=(b=h.defaultView)!=null?b:typeof window!="undefined"?window:void 0)==null?void 0:A.location)==null?void 0:$.pathname)!=null?N:"/";Xe(t.apiKey,V,R,P);let j=He(h),z=()=>{let u;try{u=j.snapshot()}catch(a){return}try{e.track({projectId:t.apiKey,componentId:Ze,eventType:"interaction_stats",payload:u})}catch(a){}},v=new Map,M=u=>{let a=v.get(u);return a||(a={ms:0,scroll:0,enterAt:null,intersecting:!1},v.set(u,a)),a},T=new IntersectionObserver(u=>{for(let a of u){let f=k.get(a.target);if(!f)continue;let p=M(f);a.isIntersecting?(p.intersecting=!0,p.enterAt=Date.now(),a.intersectionRatio>p.scroll&&(p.scroll=a.intersectionRatio)):(p.intersecting=!1,p.enterAt!=null&&(p.ms+=Date.now()-p.enterAt,p.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let u of k.keys())T.observe(u);let E=(u=!1)=>{var a;let f=Date.now();for(let[p,l]of v)if(l.enterAt!=null&&(l.ms+=f-l.enterAt,l.enterAt=null),!(l.ms<=0)){try{e.track({projectId:t.apiKey,componentId:p,eventType:"dwell",payload:{dwell_time:Math.round(l.ms),scroll_depth:Number(l.scroll.toFixed(2))}})}catch(m){}l.ms=0}if(z(),u)try{(a=e.flush)==null||a.call(e)}catch(p){}},U=()=>{if(h.hidden)E(!0);else{let u=Date.now();for(let a of v.values())a.intersecting&&(a.enterAt=u)}},C=!1,F=u=>{if(E(!0),u!=null&&u.persisted){C=!0;return}try{T.disconnect()}catch(a){}},O=u=>{if(!(u!=null&&u.persisted)||!C)return;C=!1;let a=Date.now();for(let f of v.values())f.enterAt=f.intersecting&&!h.hidden?a:null};h.addEventListener("visibilitychange",U);let w=(D=h.defaultView)!=null?D:typeof window!="undefined"?window:void 0;w==null||w.addEventListener("pagehide",F),w==null||w.addEventListener("pageshow",O);let G=setInterval(()=>{if(h.hidden||C)return;E();let u=Date.now();for(let a of v.values())a.intersecting&&(a.enterAt=u)},Ye),B=[];return t.microSignals&&[...k.entries()].forEach(([u,a],f)=>{B.push(me((p,l={})=>{try{e.track({projectId:t.apiKey,componentId:a,eventType:"micro_signal",payload:L({signalType:p},l)})}catch(m){}},u,void 0,{tabLoss:f===0}))}),()=>{E(!0),clearInterval(G),j.stop(),h.removeEventListener("visibilitychange",U),w==null||w.removeEventListener("pagehide",F),w==null||w.removeEventListener("pageshow",O);for(let u of B)u();try{T.disconnect()}catch(u){}}}xe();return Oe(tt);})();
@@ -1 +1 @@
1
- "use strict";var __sentientPreview=(()=>{var p=Object.defineProperty,F=Object.defineProperties,j=Object.getOwnPropertyDescriptor,U=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertyNames,x=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var E=(e,t,n)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t)=>{for(var n in t||(t={}))A.call(t,n)&&E(e,n,t[n]);if(x)for(var n of x(t))W.call(t,n)&&E(e,n,t[n]);return e},O=(e,t)=>F(e,U(t));var H=(e,t)=>{for(var n in t)p(e,n,{get:t[n],enumerable:!0})},z=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of G(t))!A.call(e,r)&&r!==n&&p(e,r,{get:()=>t[r],enumerable:!(a=j(t,r))||a.enumerable});return e};var V=e=>z(p({},"__esModule",{value:!0}),e);var ne={};H(ne,{parseContextPreview:()=>$,parsePersonaPreview:()=>N,parsePreview:()=>R,runPreview:()=>Z});var C=["new","browsing","carted","customer","lapsed"];var se=1800*1e3;var f="data-sentient-stage";function g(e,t){return!t||typeof e!="string"||!(e==="returning"||C.includes(e))?null:t!=="detailed"&&(e==="customer"||e==="lapsed")?"returning":e}function m(e,t=document){try{e?t.documentElement.setAttribute(f,e):t.documentElement.removeAttribute(f)}catch(n){}}var q="__snt_editor_token";function P(){try{return typeof sessionStorage!="undefined"?sessionStorage.getItem(q):null}catch(e){return null}}function T(e){let t=null;try{let n=location.hash.slice(1),a=RegExp("(^|[?&])"+e+"=([^&]*)").exec(n);if(a){t=a[2];let r=n.slice(a.index+a[0].length);a[1]!="&"&&r[0]=="&"&&(r=a[1]+r.slice(1));let i=n.slice(0,a.index)+r;history.replaceState(history.state,"",i?"#"+i:location.pathname+location.search)}}catch(n){}return t}var X=5e3;function J(e,t){let n,a=new Promise(r=>{n=setTimeout(()=>r(null),t)});return Promise.race([e,a]).then(r=>(clearTimeout(n),r),r=>{throw clearTimeout(n),r})}var Y={position:"fixed",bottom:"16px",zIndex:"2147483647",background:"#111827",color:"#fff",boxShadow:"0 10px 34px rgba(0,0,0,0.45)"};async function Z(e){let t=$(window.location.search),n=R(window.location.search),a=N(window.location.search);return n?(await ee(e,n,t,a),!0):a||t?(await te(e,a!=null?a:"",t),e.dbg("persona preview",a,t),!0):!1}function $(e){try{let t=new URLSearchParams(e).get("sentient_context");return t&&/^[a-z_]{1,40}$/.test(t)?t:null}catch(t){return null}}function R(e){let t=new URLSearchParams(e).get("sentient_preview");if(!t)return null;let n={};for(let a of t.split("|")){let r=a.indexOf(":"),i=r===-1?"":a.slice(0,r),o=r===-1?"":a.slice(r+1);if(!(!i||!o))if(o.includes("=")){let s={};for(let l of o.split(",")){let[u,c]=l.split("=");u&&c&&(s[u]=c)}Object.keys(s).length&&(n[i]=s)}else n[i]=o}return Object.keys(n).length?n:null}function N(e){try{return new URLSearchParams(e).get("sentient_persona")||null}catch(t){return null}}var M="sentient-persona-preview-banner";function L(e,t,n,a){var r;try{if(typeof document=="undefined"||document.getElementById(M))return;let i=e.charAt(0).toUpperCase()+e.slice(1).replace(/[_-]+/g," "),o=document.createElement("div");o.id=M,o.setAttribute("role","status"),Object.assign(o.style,Y,{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 s=document.createElement("span"),l=n?` \xB7 ${n.replace(/_/g," ")} visitors${a?" (not served until stage serving is on)":""}`:"";s.textContent=(t?`\u201C${e}\u201D isn\u2019t in your personas \u2014 showing the default experience`:e?`Previewing as ${i}`:"Previewing")+l;let u=document.createElement("button");u.type="button",u.textContent="Exit preview",Object.assign(u.style,{cursor:"pointer",border:"1px solid rgba(255,255,255,0.3)",background:"transparent",color:"#fff",font:"inherit",padding:"4px 10px",borderRadius:"999px"}),u.addEventListener("click",()=>{try{let c=new URL(window.location.href);c.searchParams.delete("sentient_persona"),c.searchParams.delete("sentient_context"),window.location.href=c.pathname+c.search+c.hash}catch(c){}}),o.appendChild(s),o.appendChild(u),((r=document.body)!=null?r:document.documentElement).appendChild(o)}catch(i){}}function Q(){var e;return(e=T("sentient_preview_token"))!=null?e:P()}function K(e,t){let n=e.cfg;return J(fetch(`${e.apiBase}/v1/explain`,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${n.apiKey}`},body:JSON.stringify(t)}).then(a=>a.ok?a.json():null).catch(()=>null),X)}async function ee(e,t,n=null,a=null){var s;let r=e.cfg,i=(s=r.registry)!=null?s:Object.keys(r.slots).length===0,o=Q();if(i){let l=await K(e,O(d(d(d({slotsFrom:"registry",includeDrafts:!0},o?{previewToken:o}:{}),n?{context:n}:{}),a?{persona:a}:{}),{force:Object.fromEntries(Object.entries(t).filter(u=>typeof u[1]=="string"))}));if(!(l!=null&&l.slotConfig)){e.exposeGlobal(),e.dbg("preview mode: slot config unavailable \u2014 page left as-is");return}e.set({slotConfig:l.slotConfig,look:l})}e.set({slots:t,persona:null}),e.apply(),e.installSpaHooks(),e.exposeGlobal(),e.dbg("preview mode",t)}async function te(e,t,n=null){var h,v,y,b,w,S,_,k,I;let a=e.cfg,r=(h=a.registry)!=null?h:Object.keys(a.slots).length===0,i=n?{context:n}:{},o=await K(e,d(r?{persona:t,slotsFrom:"registry"}:{persona:t,slots:Object.entries(a.slots).map(([D,B])=>({id:D,dims:B.dims}))},i));if(!o){e.exposeGlobal(),e.dbg("persona preview: explain unavailable \u2014 page left as-is");return}let s=o,l=(b=(y=(v=s.personaAttributes)==null?void 0:v.persona)!=null?y:s.persona)!=null?b:t,u=(S=(w=s.personaAttributes)==null?void 0:w.confidence)!=null?S:"high";e.set({slots:(_=s.slots)!=null?_:{},slotConfig:(k=s.slotConfig)!=null?k:null,look:s,persona:{persona:l,band:u},decided:!0}),e.apply(),e.installSpaHooks(),e.exposeGlobal(),n&&a.stageAttributes&&m(g(n,a.stageAttributes));let c=s.contextServing===!1;t&&s.recognized===!1?L(t,!0,n,c):L(t?(I=s.personaDisplay)!=null?I:l:"",!1,n,c)}return V(ne);})();
1
+ "use strict";var __sentientPreview=(()=>{var g=Object.defineProperty,j=Object.defineProperties,F=Object.getOwnPropertyDescriptor,U=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertyNames,x=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var E=(e,t,n)=>t in e?g(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p=(e,t)=>{for(var n in t||(t={}))A.call(t,n)&&E(e,n,t[n]);if(x)for(var n of x(t))W.call(t,n)&&E(e,n,t[n]);return e},O=(e,t)=>j(e,U(t));var z=(e,t)=>{for(var n in t)g(e,n,{get:t[n],enumerable:!0})},H=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of G(t))!A.call(e,r)&&r!==n&&g(e,r,{get:()=>t[r],enumerable:!(a=F(t,r))||a.enumerable});return e};var V=e=>H(g({},"__esModule",{value:!0}),e);var ne={};z(ne,{parseContextPreview:()=>$,parsePersonaPreview:()=>N,parsePreview:()=>R,runPreview:()=>Z});var C=["new","browsing","carted","customer","lapsed"];var se=1800*1e3;var m="data-sentient-stage";function h(e,t){return!t||typeof e!="string"||!(e==="returning"||C.includes(e))?null:t!=="detailed"&&(e==="customer"||e==="lapsed")?"returning":e}function v(e,t=document){try{e?t.documentElement.setAttribute(m,e):t.documentElement.removeAttribute(m)}catch(n){}}var q="__snt_editor_token";function P(){try{return typeof sessionStorage!="undefined"?sessionStorage.getItem(q):null}catch(e){return null}}function T(e){let t=null;try{let n=location.hash.slice(1),a=RegExp("(^|[?&])"+e+"=([^&]*)").exec(n);if(a){t=a[2];let r=n.slice(a.index+a[0].length);a[1]!="&"&&r[0]=="&"&&(r=a[1]+r.slice(1));let l=n.slice(0,a.index)+r;history.replaceState(history.state,"",l?"#"+l:location.pathname+location.search)}}catch(n){}return t}var X=5e3;function J(e,t){let n,a=new Promise(r=>{n=setTimeout(()=>r(null),t)});return Promise.race([e,a]).then(r=>(clearTimeout(n),r),r=>{throw clearTimeout(n),r})}var Y={position:"fixed",bottom:"16px",zIndex:"2147483647",background:"#111827",color:"#fff",boxShadow:"0 10px 34px rgba(0,0,0,0.45)"};async function Z(e){let t=$(window.location.search),n=R(window.location.search),a=N(window.location.search);return n?(await ee(e,n,t,a),!0):a||t?(await te(e,a!=null?a:"",t),e.dbg("persona preview",a,t),!0):!1}function $(e){try{let t=new URLSearchParams(e).get("sentient_context");return t&&/^[a-z_]{1,40}$/.test(t)?t:null}catch(t){return null}}function R(e){let t=new URLSearchParams(e).get("sentient_preview");if(!t)return null;let n={};for(let a of t.split("|")){let r=a.indexOf(":"),l=r===-1?"":a.slice(0,r),o=r===-1?"":a.slice(r+1);if(!(!l||!o))if(o.includes("=")){let s={};for(let u of o.split(",")){let[c,i]=u.split("=");c&&i&&(s[c]=i)}Object.keys(s).length&&(n[l]=s)}else n[l]=o}return Object.keys(n).length?n:null}function N(e){try{return new URLSearchParams(e).get("sentient_persona")||null}catch(t){return null}}var M="sentient-persona-preview-banner";function L(e,t,n,a){var r;try{if(typeof document=="undefined"||document.getElementById(M))return;let l=e.charAt(0).toUpperCase()+e.slice(1).replace(/[_-]+/g," "),o=document.createElement("div");o.id=M,o.setAttribute("role","status"),Object.assign(o.style,Y,{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 s=document.createElement("span"),u=n?` \xB7 ${n.replace(/_/g," ")} visitors${a?" (not served until stage serving is on)":""}`:"";s.textContent=(t?`\u201C${e}\u201D isn\u2019t in your personas \u2014 showing the default experience`:e?`Previewing as ${l}`:"Previewing")+u;let c=document.createElement("button");c.type="button",c.textContent="Exit preview",Object.assign(c.style,{cursor:"pointer",border:"1px solid rgba(255,255,255,0.3)",background:"transparent",color:"#fff",font:"inherit",padding:"4px 10px",borderRadius:"999px"}),c.addEventListener("click",()=>{try{let i=new URL(window.location.href);i.searchParams.delete("sentient_persona"),i.searchParams.delete("sentient_context"),window.location.href=i.pathname+i.search+i.hash}catch(i){}}),o.appendChild(s),o.appendChild(c),((r=document.body)!=null?r:document.documentElement).appendChild(o)}catch(l){}}function Q(){var e;return(e=T("sentient_preview_token"))!=null?e:P()}function K(e,t){let n=e.cfg;return J(fetch(`${e.apiBase}/v1/explain`,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${n.apiKey}`},body:JSON.stringify(t)}).then(a=>a.ok?a.json():null).catch(()=>null),X)}async function ee(e,t,n=null,a=null){var s;let r=e.cfg,l=(s=r.registry)!=null?s:Object.keys(r.slots).length===0,o=Q();if(l){let u=await K(e,O(p(p(p({slotsFrom:"registry",includeDrafts:!0},o?{previewToken:o}:{}),n?{context:n}:{}),a?{persona:a}:{}),{force:Object.fromEntries(Object.entries(t).filter(d=>typeof d[1]=="string"))}));if(!(u!=null&&u.slotConfig)){e.exposeGlobal(),e.dbg("preview mode: slot config unavailable \u2014 page left as-is");return}let c=p({},u.slotConfig),i=u.slots;if(i&&typeof i=="object")for(let[d,f]of Object.entries(t))typeof f=="string"&&i[d]!==f&&(delete t[d],delete c[d]);e.set({slotConfig:c,look:u})}e.set({slots:t,persona:null}),e.apply(),e.installSpaHooks(),e.exposeGlobal(),e.dbg("preview mode",t)}async function te(e,t,n=null){var d,f,y,b,w,S,_,k,I;let a=e.cfg,r=(d=a.registry)!=null?d:Object.keys(a.slots).length===0,l=n?{context:n}:{},o=await K(e,p(r?{persona:t,slotsFrom:"registry"}:{persona:t,slots:Object.entries(a.slots).map(([D,B])=>({id:D,dims:B.dims}))},l));if(!o){e.exposeGlobal(),e.dbg("persona preview: explain unavailable \u2014 page left as-is");return}let s=o,u=(b=(y=(f=s.personaAttributes)==null?void 0:f.persona)!=null?y:s.persona)!=null?b:t,c=(S=(w=s.personaAttributes)==null?void 0:w.confidence)!=null?S:"high";e.set({slots:(_=s.slots)!=null?_:{},slotConfig:(k=s.slotConfig)!=null?k:null,look:s,persona:{persona:u,band:c},decided:!0}),e.apply(),e.installSpaHooks(),e.exposeGlobal(),n&&a.stageAttributes&&v(h(n,a.stageAttributes));let i=s.contextServing===!1;t&&s.recognized===!1?L(t,!0,n,i):L(t?(I=s.personaDisplay)!=null?I:u:"",!1,n,i)}return V(ne);})();
@@ -1,2 +1,2 @@
1
- "use strict";var SentientSnippet=(()=>{var Kt=Object.defineProperty,si=Object.defineProperties,li=Object.getOwnPropertyDescriptor,ui=Object.getOwnPropertyDescriptors,ci=Object.getOwnPropertyNames,Ir=Object.getOwnPropertySymbols;var Tr=Object.prototype.hasOwnProperty,di=Object.prototype.propertyIsEnumerable;var Or=(e,t,n)=>t in e?Kt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,W=(e,t)=>{for(var n in t||(t={}))Tr.call(t,n)&&Or(e,n,t[n]);if(Ir)for(var n of Ir(t))di.call(t,n)&&Or(e,n,t[n]);return e},je=(e,t)=>si(e,ui(t));var Pn=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ln=(e,t)=>{for(var n in t)Kt(e,n,{get:t[n],enumerable:!0})},fi=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ci(t))!Tr.call(e,o)&&o!==n&&Kt(e,o,{get:()=>t[o],enumerable:!(r=li(t,o))||r.enumerable});return e};var pi=e=>fi(Kt({},"__esModule",{value:!0}),e);var Oi,Ti,Pi,Br,Li,Ri,Kr,$,Ue,Bn=Pn(()=>{"use strict";Oi=Object.defineProperty,Ti=Object.defineProperties,Pi=Object.getOwnPropertyDescriptors,Br=Object.getOwnPropertySymbols,Li=Object.prototype.hasOwnProperty,Ri=Object.prototype.propertyIsEnumerable,Kr=(e,t,n)=>t in e?Oi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$=(e,t)=>{for(var n in t||(t={}))Li.call(t,n)&&Kr(e,n,t[n]);if(Br)for(var n of Br(t))Ri.call(t,n)&&Kr(e,n,t[n]);return e},Ue=(e,t)=>Ti(e,Pi(t))});var Yr={};Ln(Yr,{LOCAL_ENGINE_AVAILABLE:()=>$i,createLocalEngine:()=>Bi});function Bi(e){throw new Error("[sentient] createLocalEngine is not available in production builds. The local engine only exists under the `development` export condition.")}var $i,Xr=Pn(()=>{"use strict";$i=!1});var eo={};Ln(eo,{emailFields:()=>ji,setInternalLoader:()=>Fn,takeInternalToken:()=>Ki});function Fn(e){Zr=e}var Zr,Qr,Ki,ji,Un=Pn(()=>{"use strict";Zr=()=>Promise.resolve(null);Qr=()=>Zr().then(e=>e!=null&&e.emailFields?e:Promise.reject()),Ki=e=>Qr().then(t=>t.takeInternalToken(e)),ji=e=>Qr().then(t=>t.emailFields(e))});var Va={};Ln(Va,{applyPersonaAttributes:()=>dn,applyRegistrySlots:()=>gn,applySlotArms:()=>pn,applySlotAttributes:()=>fn,consentWatcher:()=>Qe,parseSnippetConfig:()=>an,planReorder:()=>hn,reapply:()=>Nt,run:()=>ri,version:()=>Ot});function jt(e){let t=(e||"").toLowerCase();if(!t.includes(".")||/^[\d.]+$|:/.test(t))return[];let n=t.split("."),r=[];for(let o=n.length-2;o>=0;o--)r.push(n.slice(o).join("."));return r}function Ge(e){return e?`_${e.slice(0,12)}`:""}var He="_snt_uid";function vt(e){return`${He}${Ge(e)}`}var Rn="__sntForgetGen",gi=()=>{try{return window[Rn]}catch(e){return}};function Gt(e){var t,n;try{let r=window,o=(t=r[Rn])!=null?t:r[Rn]={};o[e]=((n=o[e])!=null?n:0)+1}catch(r){}}function fe(e){var t,n;return(n=(t=gi())==null?void 0:t[e])!=null?n:0}var at="_snt_snap:",mi=["low","medium","high"];function st(e){try{let t=localStorage.getItem(at+e);if(!t)return null;let n=JSON.parse(t);if(!n||typeof n!="object"||n.v!==1||typeof n.persona!="string"||typeof n.band!="string"||!mi.includes(n.band)||typeof n.slots!="object"||n.slots===null||Array.isArray(n.slots)||!(n.layoutOrder===null||Array.isArray(n.layoutOrder))||typeof n.savedAt!="number"||!(Date.now()-n.savedAt<2592e6)||!(n.slotConfig===void 0||typeof n.slotConfig=="object"&&n.slotConfig!==null&&!Array.isArray(n.slotConfig)))return null;let r=n.vocabulary;return r!==void 0&&(typeof r!="object"||r===null||!Array.isArray(r.entries)||!Array.isArray(r.images))&&delete n.vocabulary,n.stage!==void 0&&typeof n.stage!="string"&&delete n.stage,n}catch(t){return null}}function Je(e,t){try{localStorage.setItem(at+e,JSON.stringify(t))}catch(n){}}function Fe(e){if(typeof AbortController!="function")return{clear:()=>{}};let t=new AbortController,n=setTimeout(()=>t.abort(),e);return{signal:t.signal,clear:()=>clearTimeout(n)}}function Ft(e,t){return new Promise(n=>{let r=setTimeout(()=>n(!1),t),o=()=>{clearTimeout(r),n(!0)};e.then(o,o)})}function qe(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function Ut(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 Pr(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 Nn(e,t,n){try{let r=(()=>{try{let a=localStorage.getItem(n);if(!a)return[];let s=JSON.parse(a);return Array.isArray(s)?s:[]}catch(a){return[]}})(),o=new Map;for(let a of r)o.set(a.id,a);for(let a of e)o.set(a.id,a);localStorage.setItem(n,JSON.stringify([...o.values()].slice(-t)))}catch(r){}}function Lr(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),a=r.filter(s=>!o.has(s.id));if(a.length===r.length)return;a.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(a))}catch(n){}}var hi=500,yi=56*1024;function Wt(e){return`_snt_retry_${e.slice(0,12)}`}var vi={push:()=>{},flush:()=>{},destroy:()=>{}};function Rr(e){var t,n,r;if(typeof window=="undefined")return vi;let o=(t=e.flushIntervalMs)!=null?t:5e3,a=(n=e.maxBatchSize)!=null?n:20,s=(r=e.maxRetrySize)!=null?r:100,l=e.ingestUrl,i=e.apiKey,u=Wt(i),c=!1,p=fe(i),y=(...C)=>{!c&&fe(i)===p&&Nn(...C)},S=[],w=new Set,b=[],K=C=>{for(let H of C)j.delete(H),!w.has(H)&&(w.add(H),b.push(H));for(;b.length>hi;){let H=b.shift();H&&w.delete(H)}Lr(C,u)},j=new Set,_=()=>{for(;S.length>s;){let C=S.shift();C&&j.delete(C.id)}},E=C=>{w.has(C.id)||j.has(C.id)||(j.add(C.id),S.push(C),_())},O=C=>{for(let H of C)w.has(H.id)||(j.add(H.id),S.push(H));_()},N=Pr(u,s);for(let C of N)E(C);let M=0,m=0,v=(C,H=!0)=>{if(C.length===0)return;let te=JSON.stringify(C),Ie=C.map(ce=>ce.id),ge,Z=Fe(15e3);try{ge=fetch(l,{method:"POST",keepalive:!0,signal:Z.signal,body:te,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`}})}catch(ce){y(C,s,u),O(C),m++,M=Date.now()+qe(m);return}Promise.resolve(ge).then(Z.clear,Z.clear);let Oe=ce=>{if(Ut(ce)!=="retry"){if(!ce.ok&&H){let ke=C.filter(me=>me.eventType!=="pageview");if(ke.length>0&&ke.length<C.length){K(C.filter(me=>me.eventType==="pageview").map(me=>me.id)),v(ke,!1);return}}K(Ie),m=0,M=0;return}y(C,s,u),O(C),m++,M=Date.now()+qe(m)};ge&&typeof ge.then=="function"?ge.then(Oe).catch(()=>{y(C,s,u),O(C),m++,M=Date.now()+qe(m)}):Oe(ge)},f=typeof TextEncoder!="undefined"?new TextEncoder:null,g=C=>f?f.encode(C).length:C.length,A=C=>{let H=[],te=2;for(let Ie of C){let ge=g(JSON.stringify(Ie))+1;if(H.length>0&&te+ge>yi||H.length>=a)break;H.push(Ie),te+=ge}return H},I=()=>{try{if(Date.now()<M)return;for(;S.length>0&&!(Date.now()<M);){let C=S.filter(te=>!w.has(te.id));if(S.length=0,C.length===0)break;let H=A(C);if(H.length===0)break;H.length<C.length&&S.push(...C.slice(H.length)),v(H)}}catch(C){}},F=!0,Y=null;Y=setInterval(()=>{F&&I()},o);let ne=()=>{document.visibilityState==="hidden"&&I()},_e=()=>{I()};return document.addEventListener("visibilitychange",ne),window.addEventListener("pagehide",_e),{push(C){E(C),S.length>=a&&I()},flush:I,destroy(C){C!=null&&C.forget&&(c=!0),F=!1,Y!==null&&(clearInterval(Y),Y=null),document.removeEventListener("visibilitychange",ne),window.removeEventListener("pagehide",_e),I()}}}var bi=200;function Vt(e){return`_snt_goal_retry_${e.slice(0,12)}`}var Si={send:()=>{},flush:()=>{},destroy:()=>{}};function Nr(e){var t,n,r;if(typeof window=="undefined")return Si;let o=(t=e.flushIntervalMs)!=null?t:5e3,a=(n=e.maxRetrySize)!=null?n:100,s=(r=e.maxPerFlush)!=null?r:5,l=Vt(e.apiKey),i=!1,u=fe(e.apiKey),c=(...g)=>{!i&&fe(e.apiKey)===u&&Nn(...g)},p=[],y=new Set,S=new Set,w=[],b=0,K=0,j=!1,_=g=>{for(y.delete(g.id),S.has(g.id)||(S.add(g.id),w.push(g.id));w.length>bi;){let A=w.shift();A&&S.delete(A)}Lr([g.id],l)},E=g=>{c([g],a,l),!S.has(g.id)&&!y.has(g.id)&&(y.add(g.id),p.push(g)),Date.now()>=b&&(K++,b=Date.now()+qe(K))},O=g=>{let A,I=Fe(15e3);try{A=fetch(e.url,{method:"POST",keepalive:!0,signal:I.signal,body:g.body,headers:e.headers})}catch(Y){E(g);return}let F=Y=>{var ne;let _e=Ut(Y);if(_e==="retry"){E(g);return}_e==="dropped"&&((ne=e.onDrop)==null||ne.call(e,g,Y.status)),_(g),K=0,b=0};Promise.resolve(A).then(I.clear,I.clear),A&&typeof A.then=="function"?A.then(F).catch(()=>E(g)):F(A)},N=()=>{try{if(j||Date.now()<b)return;let g=0;for(;p.length>0&&g<s&&!(Date.now()<b);){let A=p.shift();y.delete(A.id),!S.has(A.id)&&(g++,O(A))}}catch(g){}},M=Pr(l,a);for(let g of M)y.has(g.id)||(y.add(g.id),p.push(g));M.length>0&&Nn(M,a,l);let m=setInterval(N,o),v=()=>{document.visibilityState==="hidden"&&N()},f=()=>N();return document.addEventListener("visibilitychange",v),window.addEventListener("pagehide",f),{send(g){if(j){S.has(g.id)||c([g],a,l);return}if(!(S.has(g.id)||y.has(g.id))){if(Date.now()<b){c([g],a,l),y.add(g.id),p.push(g);return}O(g)}},flush:N,destroy(g){g!=null&&g.forget&&(i=!0),clearInterval(m),document.removeEventListener("visibilitychange",v),window.removeEventListener("pagehide",f),N(),j=!0}}}function lt(e){if(typeof window=="undefined"||!e)return!1;Gt(e);let t=!1,n=vt(e);try{if(new RegExp(`(?:^|; )${n}=`).test(document.cookie)){let s=location.protocol==="https:"?"; Secure":"";for(let l of["",...jt(location.hostname)])document.cookie=`${n}=; max-age=0; SameSite=lax; path=/${l?`; domain=${l}`:""}${s}`;t=!0}}catch(s){}let r=Ge(e),o=[n,"_snt_graph_edges",at+e,Wt(e),Vt(e),`_snt_graph_nodes${r}`],a=[`_snt_asgn${r}_`];for(let s of["localStorage","sessionStorage"])try{let l=window[s];for(let i of o)l.getItem(i)!==null&&(l.removeItem(i),t=!0);for(let i=l.length-1;i>=0;i--){let u=l.key(i);u&&a.some(c=>u.startsWith(c))&&(l.removeItem(u),t=!0)}}catch(l){}try{(new RegExp(`(?:^|; )${He}=[^;]`).test(document.cookie)||localStorage.getItem(He)!==null||sessionStorage.getItem(He)!==null)&&localStorage.setItem(`${He}_tomb${r}`,"1")}catch(s){}return t}function Mn(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch(e){}try{if(typeof crypto!="undefined"&&typeof crypto.getRandomValues=="function"){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,"0"),(n===3||n===5||n===7||n===9)&&(t+="-");return t}}catch(e){}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var Dr="_snt_uid",wi=365,ut="_snt_uid";function _i(){return Mn()}function ct(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function $r(){try{return location.protocol==="https:"?"; Secure":""}catch(e){return""}}function qt(e,t,n,r){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=lax; path=/${r?`; domain=${r}`:""}${$r()}`}catch(o){}}function zt(e){try{return localStorage.getItem(e)}catch(t){return null}}function Mr(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function Dn(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function ki(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function Ei(e){try{sessionStorage.removeItem(e)}catch(t){}}function xi(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=lax; path=/${$r()}`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function Ai(e){try{localStorage.removeItem(e)}catch(t){}}function Ht(e,t){qt(e,"",0,t)}var Ci={getSessionId:()=>null,isEphemeral:()=>!1,domain:null,destroy:()=>{}};function Ii(e,t){if(e===!1)return null;if(typeof e=="string")return e.replace(/^\./,"");for(let n of jt(location.hostname))if(qt(t,"1",10,n),ct(t)==="1")return Ht(t,n),n;return null}function $n(e){var t,n,r,o,a,s,l;if(typeof window=="undefined")return Ci;let i=Ge(e==null?void 0:e.apiKey),u=(t=e==null?void 0:e.cookieName)!=null?t:vt(e==null?void 0:e.apiKey),c=`${ut}${i}`,p=`${ut}_tomb${i}`,y=((n=e==null?void 0:e.cookieTTLDays)!=null?n:wi)*24*60*60,S=m=>m&&m.length>0?m:null,w=()=>{var m,v;return i&&!(e!=null&&e.cookieName)&&zt(p)===null?(v=(m=S(ct(Dr)))!=null?m:S(zt(ut)))!=null?v:S(Dn(ut)):null},b=Ii(e==null?void 0:e.cookieDomain,`${u}_dom`),K=S(ct(u)),j=b?(Ht(u),S(ct(u))):null,_=(l=(s=(a=(o=(r=j!=null?j:K)!=null?r:S(zt(c)))!=null?o:S(Dn(c)))!=null?a:w())!=null?s:S(e==null?void 0:e.ssrSessionId))!=null?l:_i();qt(u,_,y,b),b&&ct(u)!==_&&(b=null,qt(u,_,y));let E=Mr(c,_),O=xi(u),N=E?!1:ki(c,_),M=!E&&!O&&!N;return{getSessionId:()=>_,isEphemeral:()=>M,domain:b,destroy:()=>{_=null,Ht(u),Ht(u,b),Ai(c),Ei(c),i&&!(e!=null&&e.cookieName)&&(ct(Dr)!==null||zt(ut)!==null||Dn(ut)!==null)&&Mr(p,"1")}}}Bn();function Jt(e){return Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("|")}function jr(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 Kn(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 Jt(e.baseline);if(typeof e.baseline=="string")return e.baseline;let o={};for(let[a,s]of Object.entries((n=e.dims)!=null?n:{}))o[a]=(r=s[0])!=null?r:"";return Jt(o)}function Gr(e,t){var n,r;return e.dims!=null?(r=(n=jr(t))!=null?n:jr(Kn(e)))!=null?r:{}:t}function Ye(e){return e>=.3?e<.7?"medium":"high":"low"}var Fr=["new","browsing","carted","customer","lapsed"];var Ni=["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 Ur(e){return Di(e)!==null}function Di(e){var t;if(!e)return null;let n=e.toLowerCase();return(t=Ni.find(r=>n.includes(r.toLowerCase())))!=null?t:null}function Wr(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 Vr(e,t,n){if(!e)return"direct";try{let r=new URL(e);if(t)try{if(new URL(t).host===r.host)return"direct"}catch(a){}let o=r.hostname.toLowerCase();return n&&`.${o}`.endsWith(`.${n}`)?"direct":/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(o)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(o)?"social":"referral"}catch(r){return"direct"}}function zr(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var Mi=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function Hr(e){let t={},n={};try{let r=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([o,a])=>{let s=Array.isArray(a)?a[0]:a;return s===void 0?[]:[[o,s]]});for(let[o,a]of r)o.startsWith("utm_")?o in t||(t[o]=a):Mi.includes(o)&&(o in n||(n[o]=a))}catch(r){}return{utmParams:t,clickIds:n}}function qr(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function jn(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 Gn(e){let t=jn(e);return Gr(t,Kn(t))}function Jr(e){return typeof e=="string"?e:Jt(e)}Bn();var Hn;function Qt(e){Hn=typeof e=="string"&&e!==""?e:void 0}function oo(e=document){if(Hn)return Hn;try{let t=e.querySelector("script[nonce]");return(t==null?void 0:t.nonce)||(t==null?void 0:t.getAttribute("nonce"))||void 0}catch(t){return}}function We(e,t=document){let n=oo(t);return n&&e.setAttribute("nonce",n),e}var Gi=1800*1e3;function Yt(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function Fi(e=Gi,t){let n=new Map,r=`_snt_asgn${Ge(t)}_`,o=(i,u)=>`${r}${encodeURIComponent(i)}:${encodeURIComponent(u)}`,a=i=>{let u=i.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(p){return null}},s=()=>{try{let i=[];for(let u=0;u<localStorage.length;u++){let c=localStorage.key(u);c!=null&&c.startsWith(r)&&i.push(c)}return i}catch(i){return[]}},l=i=>i.assignedAt+(i.ttlMs&&i.ttlMs>0?i.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let i of s())try{let u=localStorage.getItem(i);if(!u)continue;let c=JSON.parse(u);if(l(c)){localStorage.removeItem(i);continue}let p=a(i);if(!p)continue;n.set(Yt(p.componentId,p.segment),c)}catch(u){}})(),{get(i,u){let c=n.get(Yt(i,u));return c?l(c)?(n.delete(Yt(i,u)),null):c:null},set(i,u,c){let p=Yt(i,u);n.set(p,c);try{localStorage.setItem(o(i,u),JSON.stringify(c))}catch(y){}},clear(){n.clear();for(let i of s())try{localStorage.removeItem(i)}catch(u){}}}}var qn="data-sentient-stage";function St(e,t){return!t||typeof e!="string"||!(e==="returning"||Fr.includes(e))?null:t!=="detailed"&&(e==="customer"||e==="lapsed")?"returning":e}function en(e,t=document){try{e?t.documentElement.setAttribute(qn,e):t.documentElement.removeAttribute(qn)}catch(n){}}var Jn="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",io="[sentient] Local mode \u2014 decisions are simulated on-device and nothing is sent over the network. Add an API key to learn from real traffic.",to=!1,Xt=!1;function Ui(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function Wi(e){var t;let n=$n({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),r=(t=n.getSessionId())!=null?t:"local",o=Ui(),a=Promise.resolve().then(()=>(Xr(),Yr)).then(c=>{let p=c;return p.LOCAL_ENGINE_AVAILABLE?(to||(to=!0,console.info(io)),p):(Xt||(Xt=!0,console.error(Jn)),null)}).catch(()=>(Xt||(Xt=!0,console.error(Jn)),null)),s=null,l={low:.15,medium:.5,high:.85},i=(()=>{var c;if(e.initialPersona)return $({},e.initialPersona);let p=st(e.apiKey||"local");return p?{persona:p.persona,confidence:(c=l[p.band])!=null?c:.15}:null})();function u(c){let p=document.documentElement;p.dataset.sentientPersona===void 0&&(p.dataset.sentientPersona=c.persona,p.dataset.sentientConfidence=Ye(c.confidence))}return{isLocal:!0,async decide(c){var p,y,S;let w=await a;if(!w)return null;let b=w.createLocalEngine({sessionId:r,forcedPersona:o}).decide(c);return s=Ue($({},b),{layoutOrder:(y=(p=b.layoutOrder)!=null?p:s==null?void 0:s.layoutOrder)!=null?y:null,slots:$($({},(S=s==null?void 0:s.slots)!=null?S:{}),b.slots)}),Je(e.apiKey||"local",{v:1,persona:s.persona,band:Ye(s.confidence),slots:s.slots,layoutOrder:s.layoutOrder,savedAt:Date.now()}),u(b),b},getSlotResult(c){var p,y,S;return(S=(y=s==null?void 0:s.slots[c])!=null?y:(p=e.initialSlots)==null?void 0:p[c])!=null?S:null},getSlotConfig(c){var p,y;return(y=(p=e.initialSlotConfig)==null?void 0:p[c])!=null?y:null},getSitePalette(){var c;return(c=e.initialPalette)!=null?c:null},reportSlots(){},getVisitorId:()=>null,getPersona(){let c=s!=null?s:i;return c?{persona:c.persona,confidence:c.confidence,band:Ye(c.confidence)}:null},async assign(c,p){var y;let S=await a;return!S||!p||p.length===0?p!=null&&p[0]?{variantId:p[0],assignmentTtlMs:0}:null:{variantId:(y=S.createLocalEngine({sessionId:r,forcedPersona:o}).decide({components:[{id:c,variantIds:p}]}).assignments[c])!=null?y:p[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>n.destroy()}}var tn=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function Wn(e){let t=e.split(/[?#]/)[0]||"/";return t.length>1?t.replace(/\/+$/,"")||"/":t}function Xn(e,t){if(e===void 0||!tn.test(e))return!1;if(e==="*")return!0;let n=Wn(t);if(e.endsWith("/*")){let r=Wn(e.slice(0,-2));return n.startsWith(r==="/"?"/":`${r}/`)&&n!==r}return n===Wn(e)}function Zn(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 wt(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(wt):!1}var no="sentient-reveal",dt="sentient-revealed",ao=240,Vn=!1;function Vi(e){if(Vn||e.getElementById(no)){Vn=!0;return}let t=We(e.createElement("style"),e);t.id=no,t.textContent=`@media (prefers-reduced-motion: no-preference){@keyframes ${dt}{from{opacity:.55;transform:translateY(2px)}to{opacity:1;transform:none}}.${dt}{animation:${dt} ${ao}ms cubic-bezier(.2,.6,.2,1) both}}`,e.head.appendChild(t),Vn=!0}function Qn(e,t={}){var n;let r=(n=t.doc)!=null?n:typeof document!="undefined"?document:void 0;if(!r||!(e instanceof Element)||(t.arm!==void 0&&e.setAttribute("data-sentient-arm",t.arm),t.persona!==void 0&&e.setAttribute("data-sentient-persona",t.persona),t.previous!==void 0&&t.previous===e.textContent))return!1;Vi(r),e.classList.remove(dt),e.offsetWidth,e.classList.add(dt);let o=()=>{e.classList.remove(dt),e.removeEventListener("animationend",o)};return e.addEventListener("animationend",o),!0}function er(e,t,n,r){let o=[];{let a=!1,s=[],l=()=>{if(a)return;let i=Date.now();for(s.push(i);s.length>0&&i-s[0]>500;)s.shift();s.length>=3&&(a=!0,e("rage_click"))};t.addEventListener("click",l),o.push(()=>t.removeEventListener("click",l))}{let a=!1,s=l=>{if(a||!(l.target instanceof Node)||!t.contains(l.target)&&t!==l.target)return;a=!0;let i=typeof window!="undefined"?window.getSelection():null,u=i?i.toString().length:0;e("text_copy",{selectionLength:u})};document.addEventListener("copy",s),o.push(()=>document.removeEventListener("copy",s))}{let a=!1,s=!1,l=null,i=()=>{l!==null&&(clearTimeout(l),l=null)},u=()=>{a||!s||(i(),l=setTimeout(()=>{!a&&s&&(a=!0,e("scroll_hesitation"))},3e3))},c=()=>{i(),u()},p=S=>{for(let w of S)s=w.intersectionRatio>.3,s?u():i()},y=new IntersectionObserver(p,{threshold:[.3]});y.observe(t),window.addEventListener("scroll",c,{passive:!0}),o.push(()=>{y.disconnect(),window.removeEventListener("scroll",c),i()})}if((r==null?void 0:r.tabLoss)!==!1){let a=!1,s=n!=null?n:Date.now(),l=()=>{if(a||document.visibilityState!=="hidden")return;let i=Date.now()-s;i<15e3&&(a=!0,e("tab_loss",{timeOnPage:i}))};document.addEventListener("visibilitychange",l),o.push(()=>document.removeEventListener("visibilitychange",l))}return()=>{for(let a of o)a()}}function zi(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var so="https://api.sentient-ui.com/v1/events",ro=()=>Promise.resolve().then(()=>(Un(),eo)),pe=new Map,lo=null;function Hi(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var qi=3;function zn(){return Mn()}function Zt(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function Ji(){let e=new WeakMap,t=new Map,n=!1,r=(l,i,u)=>{let c=l.get(i);return u===null?c?!0:(l.set(i,new Set),!1):c?c.has(u)?!0:(c.add(u),!1):(l.set(i,new Set([u])),!1)},o=typeof window!="undefined"&&"event"in window,a=()=>{if(!o)return;let l=window.event;return typeof Event=="function"&&l instanceof Event?l:void 0},s=()=>{if(o){Promise.resolve().then(()=>{n=!1,t.clear()});return}let l=!1,i=()=>{l||(l=!0,n=!1,t.clear())};if(setTimeout(i,0),typeof MessageChannel=="function"){let u=new MessageChannel;u.port1.onmessage=()=>{u.port1.close(),u.port2.close(),i()},u.port2.postMessage(0)}};return{firedBefore(l,i){let u=a();if(u){let p=e.get(u);return p||(p=new Map,e.set(u,p)),r(p,l,i)}let c=r(t,l,i);return!c&&!n&&(n=!0,s()),c}}}var uo=new Set;function Yi(e,t,n){let r=typeof window=="undefined"?null:window.history;if(!r)return()=>{};let o=!1,a,s=()=>{if(o)return;let u=Zt();!u||u===a||(a=u,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${u}`))},l=[];for(let u of["pushState","replaceState"]){let c=r[u],p=function(...y){let S=c.apply(this,y);return s(),S};r[u]=p,l.push([u,c,p])}window.addEventListener("popstate",s);let i=Zt();return i&&uo.has(`${t}:${i}`)?a=i:s(),()=>{if(!o){o=!0,window.removeEventListener("popstate",s);for(let[u,c,p]of l)r[u]===p&&(r[u]=c)}}}var bt={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getVisitorId:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}};function Xi(){try{return Hr(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function co(e){return e.replace(/\/events\/?$/,"")}function Xe(){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 tr(e){var t;if(typeof window=="undefined")return;let n=e!=null?e:lo;if(!n){console.warn("[sentient] grantConsent() called before init()");return}let r=pe.get(n);if(!r){console.warn("[sentient] grantConsent() called before init()");return}let{config:o,upgrade:a,reinit:s}=r;if(!a){r.upgradeBlockedReason&&console.warn(r.upgradeBlockedReason);return}if(o.respectDoNotTrack!==!1&&Xe())return;let l=(s!=null?s:_t)(Ue($({},o),{consent:!0}));a(l);let i=(t=pe.get(n))==null?void 0:t.dispose;pe.set(n,{config:Ue($({},o),{consent:!0}),upgrade:null,dispose:i})}function Zi(e,t){var n;let r=e.preConsentBehavior==="statistical_winner",o=co((n=e.ingestUrl)!=null?n:so),a={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},s=new Map,l=new Map,i={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(m,v,f){if(!r)return Promise.resolve(null);let g=s.get(m);return g?Promise.resolve(g):Yn(l,m,async()=>{try{let A=new URLSearchParams({componentId:m});for(let ne of v!=null?v:[])A.append("variantIds[]",ne);let I=Fe(5e3),F;try{let ne=await fetch(`${o}/winner?${A.toString()}`,{headers:a,signal:I.signal});if(!ne.ok)return v!=null&&v[0]?{variantId:v[0],assignmentTtlMs:0}:null;F=await ne.json()}finally{I.clear()}let Y={variantId:F.variantId,assignmentTtlMs:0};return s.set(m,Y),Y}catch(A){return v!=null&&v[0]?{variantId:v[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getVisitorId:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}},u=!1,c=new Set,p=[],y=[],S=[],w=()=>{for(let[,,m]of S.splice(0))m(null);b.length=0},b=[],K=!1,j=()=>{if(u)return;K=!0;let m=pe.get(e.apiKey);(m==null?void 0:m.upgrade)===M&&pe.set(e.apiKey,{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): client released before consent; call init() again"})},_=[],E=()=>{setTimeout(()=>{var m;try{(m=_.shift())==null||m(i)}catch(v){}_.length&&E()})},O=m=>{u?_.length?_.push(m):m(i):!t&&!K&&b.length<100?b.push(m):K&&e.debug&&console.warn("[sentient] goal dropped: client released")},N={get gated(){return!u&&!t},get released(){return K&&!u},takeHeld:()=>b.splice(0),track:m=>i.track(m),goal:((m,v,f,g)=>O(A=>A.goal(m,v,f,g))),componentGoal:(m,v,f)=>i.componentGoal(m,v,f),identify:(m,v)=>i.identify(m,v),getAssignment:(m,v)=>i.getAssignment(m,v),isUnified:m=>{var v,f;return(f=(v=i.isUnified)==null?void 0:v.call(i,m))!=null?f:!1},assign:(m,v,f,g,A)=>i.assign(m,v,f,g,A),decide:m=>u?i.decide(m):K||t?Promise.resolve(null):new Promise(v=>S.push([m,Re(),v])),getSlotResult:m=>i.getSlotResult(m),isSlotDecided:m=>{var v,f;return(f=(v=i.isSlotDecided)==null?void 0:v.call(i,m))!=null?f:!0},getSlotConfig:m=>i.getSlotConfig(m),getSitePalette:()=>i.getSitePalette(),getStyleVocabulary:()=>{var m,v;return(v=(m=i.getStyleVocabulary)==null?void 0:m.call(i))!=null?v:null},reportSlots:(m,v,f,g)=>i.reportSlots(m,v,f,g),reportSkeleton:(m,v)=>{var f;return(f=i.reportSkeleton)==null?void 0:f.call(i,m,v)},reportAgentData:(m,v,f)=>{var g;return(g=i.reportAgentData)==null?void 0:g.call(i,m,v,f)},reportDrift:(m,v,f,g)=>{var A;return(A=i.reportDrift)==null?void 0:A.call(i,m,v,f,g)},requestSlots:(m,v,f)=>{var g;return u?(g=i.requestSlots)==null?void 0:g.call(i,m,v,f):p.push([m,v,f])},decideSlots:m=>{var v;return u?(v=i.decideSlots)==null?void 0:v.call(i,m):y.push(...m)},cancelSlots:m=>{var v;if(u)return(v=i.cancelSlots)==null?void 0:v.call(i,m);let f=new Set(m);for(let g of p)g[0]=g[0].filter(A=>!f.has(A));y=y.filter(g=>!f.has(g.id))},onSlotsChanged:m=>(c.add(m),()=>{c.delete(m)}),getPersona:()=>i.getPersona(),getVisitorId:()=>{var m,v;return(v=(m=i.getVisitorId)==null?void 0:m.call(i))!=null?v:null},fetchWeights:()=>i.fetchWeights(),getGraph:()=>i.getGraph(),flush:()=>i.flush(),dispose:()=>(j(),w(),i.dispose()),destroy:()=>(j(),w(),u?i.destroy():lt(e.apiKey))};function M(m){var v,f,g;i=m,u=!0,b.length&&(_.push(...b.splice(0)),E());let A=Re();for(let[I,F,Y]of S.splice(0))F!==A?Y(null):m.decide(I).then(Y,()=>Y(null));(v=m.onSlotsChanged)==null||v.call(m,()=>c.forEach(I=>I()));for(let[I,F,Y]of p.splice(0))I.length>0&&((f=m.requestSlots)==null||f.call(m,I,F,Y));y.length>0&&((g=m.decideSlots)==null||g.call(m,y.splice(0)))}return{proxy:N,setInner:M}}function Re(){return typeof location=="undefined"?"":location.pathname+(/^#!?\//.test(location.hash)?location.hash:"")}function Yn(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 _t(e){var t,n,r,o,a,s,l,i,u,c,p;if(typeof window=="undefined")return bt;e.nonce&&Qt(e.nonce),lo=e.apiKey||"local";let y=pe.get(e.apiKey||"local");if(y!=null&&y.dispose)try{y.dispose()}catch(d){}let S=e.respectDoNotTrack!==!1&&Xe(),w=e.consent===!1||S,b=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!b&&e.localMode!==!1)return pe.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?bt:Wi(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."),pe.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."}),bt;let{proxy:d,setInner:h}=Zi(e,S);return pe.set(e.apiKey,{config:e,upgrade:S?null:h}),d}if(!e.apiKey||!e.apiKey.startsWith("pk_"))return console.warn("[sentient] init() called with an invalid apiKey \u2014 expected a pk_ public key. SDK disabled."),bt;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),bt;let K=(t=e.ingestUrl)!=null?t:so,j=Date.now(),_=$n({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey,cookieDomain:e.cookieDomain}),E={},O;try{/sentient_internal=/.test(location.search+document.cookie)&&(O=ro().then(async d=>{E.internalToken=await d.takeInternalToken(_.domain)||void 0}).catch(()=>{})),(typeof e.internal=="function"?e.internal():e.internal)===!0&&(E.internal=!0)}catch(d){}let N=Fi(void 0,e.apiKey),M=!1,m=fe(e.apiKey),v=()=>!M&&fe(e.apiKey)===m,f=new Set((n=e.initialUnified)!=null?n:[]),g=Ue($({},N),{get:(d,h)=>f.has(d)?null:N.get(d,h),set:(...d)=>{v()&&N.set(...d)}}),A=Rr({ingestUrl:K,apiKey:e.apiKey}),I=co(K),F={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},Y=new Set,ne=Nr({url:`${I}/goals`,apiKey:e.apiKey,headers:F,onDrop:(d,h)=>{if(!e.debug){if(Y.has(h))return;Y.add(h)}console.warn(`[sentient] goal dropped (HTTP ${h}) \u2014 this will not be retried. `+(h===400?"The session was not found: call init() and let the session upsert complete before firing goals.":h===401||h===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),d)}}),_e=Wr((r=navigator.userAgent)!=null?r:""),C=window.location.origin,H=Vr((o=document.referrer)!=null?o:"",C,_.domain),te=(a=e.sessionSegment)!=null?a:`${_e}:${H}`,Ie=new Map,ge=new Map,Z=new Map,Oe=new Set,ce=new Map,ke=null,me=null,ie=null,hr=new Set,Dt=new Set,En=new Map,xn=new Map,yr=new Set,vr=new Set,br=new Set,Sr=new Set,An=null,gt=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,wr=new Set,Mt=new Set,$t=new Set,mt=new Map,Cn=null,Bt=new Set,ht=new Map,In=null,oi=2,_r=new Map,Ee=!1,kr=(d,h,P)=>{var U;let G=new Set,x=1;for(let T of d){h.delete(T);let L=((U=_r.get(T))!=null?U:0)+1;_r.set(T,L),L<=oi&&(G.add(T),L>x&&(x=L))}G.size>0&&setTimeout(()=>{Ee||P(G)},qe(x))},On=d=>{for(let h of d)Z.has(h.id)||Z.set(h.id,Gn(h))};if(e.initialSlots)for(let[d,h]of Object.entries(e.initialSlots))Z.set(d,h),Oe.add(d);if(e.initialSlotConfig)for(let[d,h]of Object.entries(e.initialSlotConfig))ce.set(d,h);e.initialPalette&&(ke=e.initialPalette),e.initialVocabulary&&(me=e.initialVocabulary);let Te=st(e.apiKey);if(Te){for(let[d,h]of Object.entries(Te.slots))Z.has(d)||Z.set(d,h);for(let[d,h]of Object.entries((s=Te.slotConfig)!=null?s:{}))ce.has(d)||ce.set(d,h);!ke&&Te.palette&&(ke=Te.palette),!me&&Te.vocabulary&&(me=Te.vocabulary)}let Er={low:.15,medium:.5,high:.85};if(e.initialPersona)ie=$({},e.initialPersona);else{let d=document.documentElement.dataset;d.sentientPersona?ie={persona:d.sentientPersona,confidence:(i=Er[(l=d.sentientConfidence)!=null?l:"low"])!=null?i:.15}:Te&&(ie={persona:Te.persona,confidence:(u=Er[Te.band])!=null?u:.15})}if(e.initialAssignments)for(let[d,h]of Object.entries(e.initialAssignments))g.set(d,te,{variantId:h,assignedAt:Date.now(),segment:te,confidence:1});let Ke=Promise.resolve(),xr=_.getSessionId();if(xr){let d=zr((c=document.referrer)!=null?c:""),{utmParams:h,clickIds:P}=Xi(),U=$($($($({sessionId:xr,deviceClass:_e,trafficSource:H,referrerDomain:d,utmParams:h,clickIds:P,landingPath:typeof location!="undefined"?location.pathname:void 0,timeOfDay:qr(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:_.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||Ur((p=navigator.userAgent)!=null?p:"")},e.userId?{userId:e.userId}:{}),e.persona?{persona:e.persona}:{}),e.country?{country:e.country}:{}),e.sdk?{sdk:e.sdk.name,sdkVersion:e.sdk.version}:{}),G=async()=>{O&&await Ft(O,2500);for(let x=0;;x++){if(Ee||!v())return;let T=Fe(5e3);try{let L=await fetch(`${I}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(Object.assign(U,E)),headers:F,signal:T.signal});if(L.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(L.ok||Ut(L)==="dropped")return}catch(L){}finally{T.clear()}if(x>=qi){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(L=>setTimeout(L,qe(x+1)))}};try{Ke=G()}catch(x){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:A});let ii=Ji(),yt=null,Tn=!1,ae={goal(d,h={},P=1,U=0){var G,x,T,L,V,z,q;let Q=_.getSessionId();if(!Q||Ee||!v())return;let B=Hi(h)?h:{metadata:h},he=[d,(G=B.externalId)!=null?G:"",(x=B.stepIndex)!=null?x:U,(T=B.weight)!=null?T:P].join("\0"),xe=B.value!==void 0?`${B.value}\0${(L=B.currency)!=null?L:""}`:null;if(ii.firedBefore(he,xe)){e.debug&&console.log(`[sentient] goal("${d}") already recorded for this action \u2014 not sent twice`);return}let de=zn(),se={sessionId:Q,name:d,metadata:(V=B.metadata)!=null?V:{},weight:(z=B.weight)!=null?z:P,stepIndex:(q=B.stepIndex)!=null?q:U,goalId:de,value:B.value,currency:B.currency,externalId:B.externalId};e.debug&&console.log("[sentient] goal",se);let D={id:de,body:JSON.stringify(se)};Ke.then(()=>ne.send(D))},componentGoal(d,h,P){var U,G,x;let T=_.getSessionId();if(!T||Ee||!v())return;let L=g.get(d,te),V=L?null:(U=Z.get(d))!=null?U:null;if(!L&&V===null){e.debug&&console.warn(`[sentient] componentGoal("${d}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}if(!L&&!Oe.has(d)){e.debug&&console.warn(`[sentient] componentGoal("${d}"): slot not decided this session \u2014 not attributed`);return}let z=L?L.variantId:Jr(V),q={id:zn(),sessionId:T,projectId:e.apiKey,componentId:d,variantId:z,eventType:"goal_achieved",goalType:h,payload:$({reward:(G=P==null?void 0:P.reward)!=null?G:1,goalValue:P==null?void 0:P.value,currency:P==null?void 0:P.currency},(x=P==null?void 0:P.metadata)!=null?x:{}),timestamp:Date.now(),timeInSession:Date.now()-j,path:Zt()};e.debug&&console.log("[sentient] componentGoal",q),Ke.then(()=>{!Ee&&v()&&A.push(q)})},identify(d,h){let P=_.getSessionId();if(!P||Ee||!v())return;let U=(h==null?void 0:h.email)!==void 0?ro().then(G=>G.emailFields(h.email)).catch(()=>({})):{};Promise.all([Ke,U]).then(([,G])=>{fetch(`${I}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(Ue($($({sessionId:P,userId:d,userHash:h==null?void 0:h.userHash},G),E),{ephemeral:_.isEphemeral()})),headers:F}).catch(()=>{})})},track(d){let h=_.getSessionId();if(!h||Ee||!v()||d.eventType==="variant_assigned"&&Z.get(d.componentId)!==void 0&&!Oe.has(d.componentId)&&!g.get(d.componentId,te))return;let P=Ue($({path:Zt()},d),{id:zn(),sessionId:h,timestamp:Date.now(),timeInSession:Date.now()-j});e.debug&&console.log("[sentient] track",P),Ke.then(()=>A.push(P))},getAssignment(d,h){return g.get(d,h)},isUnified:d=>f.has(d),async assign(d,h,P,U,G){var x;let T=_.getSessionId();if(!T)return null;let L=(G==null?void 0:G.unified)===!0;if(L&&f.has(d))return{variantId:(x=h==null?void 0:h[0])!=null?x:"",assignmentTtlMs:0,unified:!0};let V=g.get(d,te);if(V&&(h!=null&&h.length||V.content!==void 0)){let z=V.ttlMs&&V.ttlMs>0?Math.max(0,V.assignedAt+V.ttlMs-Date.now()):0;return{variantId:V.variantId,assignmentTtlMs:z,content:V.content}}return Yn(Ie,L?`${d}\0unified`:d,async()=>{if(!await Ft(Ke,2500)||Ee||!v())return null;let z=Fe(3e4);try{let q={sessionId:T,componentId:d,variantIds:h};U!==void 0?q.agentDataByVariant=U:P!==void 0&&(q.agentData=P),L&&(q.caps={unified:!0});let Q=await fetch(`${I}/assign`,{method:"POST",body:JSON.stringify(q),headers:F,signal:z.signal});if(!Q.ok)return null;let B=await Q.json();return B.unified===!0?L?(f.add(d),{variantId:B.variantId,assignmentTtlMs:0,unified:!0}):null:(g.set(d,te,$({variantId:B.variantId,assignedAt:Date.now(),segment:te,confidence:1,content:B.content},B.assignmentTtlMs&&B.assignmentTtlMs>0?{ttlMs:B.assignmentTtlMs}:{})),B)}catch(q){return null}finally{z.clear()}})},async decide(d){var h,P;let U=_.getSessionId();if(!U)return null;let G=(h=d.slots)!=null?h:[],x={sessionId:U};d.sections&&d.sections.length>0&&(x.sections=d.sections.map(L=>({id:L}))),x.components=(P=d.components)!=null?P:[],G.length>0&&(x.slots=G.map(jn)),d.slotsFrom==="registry"&&(x.slotsFrom="registry",d.registrySlotIds&&(x.registrySlotIds=d.registrySlotIds),d.bootstrap===!1&&(x.bootstrap=!1),d.render&&Object.keys(d.render).length>0&&(x.render=d.render)),d.v&&(x.v=d.v),typeof d.pp=="number"&&(x.pp=d.pp),e.persona&&(x.persona=e.persona),Object.assign(x,E);let T=JSON.stringify(x);return Yn(ge,T,async()=>{var L,V,z,q,Q,B,he,xe;if(!await Ft(Ke,2500)||Ee||!v())return On(G),null;let de=Fe(3e4);try{let se=await fetch(`${I}/decide`,{method:"POST",body:T,headers:F,signal:de.signal});if(!se.ok)return On(G),null;let D=await se.json(),Pe=St(D.stage,e.stageAttributes);e.stageAttributes&&en(Pe);let it={};for(let X of G){let Le=(L=D.slots)==null?void 0:L[X.id];if(Le!==void 0){it[X.id]=Le,Z.set(X.id,Le),Oe.add(X.id);continue}let Ar=Z.get(X.id);if(Ar!==void 0)it[X.id]=Ar;else{let Cr=Gn(X);it[X.id]=Cr,Z.set(X.id,Cr)}}if(D.slots)for(let[X,Le]of Object.entries(D.slots))X in it||(it[X]=Le,Z.set(X,Le),Oe.add(X));let ai=ie!=null&&ie.persona!=="unknown";D.persona&&!(D.persona==="unknown"&&ai)?ie={persona:D.persona,confidence:(V=D.confidence)!=null?V:0}:ie||(ie={persona:"unknown",confidence:0});for(let[X,Le]of Object.entries((z=D.assignments)!=null?z:{}))g.set(X,te,{variantId:Le,assignedAt:Date.now(),segment:te,confidence:1});if(D.slotConfig)for(let[X,Le]of Object.entries(D.slotConfig))ce.set(X,Le);D.palette&&(ke=D.palette),D.vocabulary&&(me=D.vocabulary);for(let X of(q=d.registrySlotIds)!=null?q:[])(Q=D.slotConfig)!=null&&Q[X]||(ce.delete(X),Z.delete(X),Oe.delete(X));return v()&&Je(e.apiKey,$($($($({v:1,persona:ie.persona,band:Ye(ie.confidence),slots:Object.fromEntries(Z),layoutOrder:(B=D.layoutOrder)!=null?B:null,savedAt:Date.now()},ce.size>0?{slotConfig:Object.fromEntries(ce)}:{}),ke?{palette:ke}:{}),me?{vocabulary:me}:{}),Pe?{stage:Pe}:{})),$($($($($($($({layoutOrder:(he=D.layoutOrder)!=null?he:null,assignments:(xe=D.assignments)!=null?xe:{},slots:it,persona:ie.persona,confidence:ie.confidence},D.slotConfig?{slotConfig:D.slotConfig}:{}),D.goals?{goals:D.goals}:{}),D.sectionMap?{sectionMap:D.sectionMap}:{}),D.palette?{palette:D.palette}:{}),D.vocabulary?{vocabulary:D.vocabulary}:{}),D.stage?{stage:D.stage}:{}),D.context?{context:D.context}:{})}catch(se){return On(G),null}finally{de.clear()}})},getSlotResult(d){var h;return(h=Z.get(d))!=null?h:null},isSlotDecided(d){return Oe.has(d)},getSlotConfig(d){var h;return(h=ce.get(d))!=null?h:null},reportSlots(d,h,P,U){var G;let x={};for(let[T,L]of Object.entries(U!=null?U:{}))for(let V of L){let z=`${T}|${V.key}`;!gt.test(T)||br.has(z)||(br.add(z),((G=x[T])!=null?G:x[T]=[]).push(V))}Object.keys(x).length>0&&fetch(`${I}/slots/observed`,{method:"POST",headers:F,body:JSON.stringify({slotIds:Object.keys(x),authoredArms:x})}).catch(()=>{});for(let T of d)if(!(typeof T!="string"||T.length===0)){if(!gt.test(T)){zi()&&!wr.has(T)&&(wr.add(T),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(T)} will not register \u2014 ids must start with a letter or digit and contain only letters, digits, '_' or '-' (max 128 chars): /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.`));continue}if(!hr.has(T)){hr.add(T),Dt.add(T);let L=h==null?void 0:h[T];if(typeof L=="string"){let z=L.replace(/\s+/g," ").trim().slice(0,400);z!==""&&En.set(T,z)}let V=P==null?void 0:P[T];V!==void 0&&xn.set(T,V)}}Dt.size===0||An!=null||(An=setTimeout(()=>{An=null;let T=[...Dt];Dt.clear();for(let L=0;L<T.length;L+=20){let V=T.slice(L,L+20),z={},q={};for(let Q of V){let B=En.get(Q);B!==void 0&&(z[Q]=B,En.delete(Q));let he=xn.get(Q);he!==void 0&&(q[Q]=he,xn.delete(Q))}fetch(`${I}/slots/observed`,{method:"POST",headers:F,body:JSON.stringify($(Ue($($({slotIds:V},Object.keys(z).length>0?{baselineTexts:z}:{}),Object.keys(q).length>0?{baselineSkeletons:q}:{}),{pagePaths:Object.fromEntries(V.map(Q=>[Q,location.pathname]))}),Object.keys(z).length>0&&_.getSessionId()?{sessionId:_.getSessionId()}:{}))}).catch(()=>{})}},1e3))},reportSkeleton(d,h){!gt.test(d)||yr.has(d)||(yr.add(d),fetch(`${I}/slots/observed`,{method:"POST",headers:F,body:JSON.stringify({slotIds:[d],baselineSkeletons:{[d]:h}})}).catch(()=>{}))},reportAgentData(d,h,P){let U=`${d}|${h}`;!gt.test(d)||Sr.has(U)||(Sr.add(U),fetch(`${I}/slots/observed`,{method:"POST",headers:F,body:JSON.stringify($($({slotIds:[d],agentData:{[d]:{[h]:P}}},h.startsWith("authored.")?{authoredArms:{[d]:[{key:h.slice(9)}]}}:{}),_.getSessionId()?{sessionId:_.getSessionId()}:{}))}).catch(()=>{}))},reportDrift(d,h,P,U){let G=`${d}|${h}`,x=_.getSessionId();!x||vr.has(G)||(vr.add(G),fetch(`${I}/slots/drift`,{method:"POST",headers:F,body:JSON.stringify({sessionId:x,reports:[{slotId:d,expectedFp:h,observedFp:P,reason:U}]})}).catch(()=>{}))},requestSlots(d,h,P){var U,G;for(let x of d)$t.has(x)||($t.add(x),gt.test(x)?mt.set(x,{text:h==null?void 0:h[x],render:(U=P==null?void 0:P.render)==null?void 0:U[x],skeleton:(G=P==null?void 0:P.skeletons)==null?void 0:G[x]}):ae.reportSlots([x]));mt.size===0||Cn!=null||(Cn=setTimeout(()=>{Cn=null;let x=[...mt];mt.clear();for(let T=0;T<x.length;T+=50){let L=x.slice(T,T+50),V={};for(let[z,q]of L)q.render&&(V[z]=q.render);ae.decide({slotsFrom:"registry",registrySlotIds:L.map(([z])=>z),bootstrap:!1,render:V}).then(z=>{var q,Q;if(z){let B={},he={},xe=[];for(let[de,se]of L){let D=(q=z.slotConfig)==null?void 0:q[de];if(D){D.needsSkeleton&&se.skeleton&&((Q=ae.reportSkeleton)==null||Q.call(ae,de,se.skeleton));continue}xe.push(de),se.text&&(B[de]=se.text),se.skeleton&&(he[de]=se.skeleton)}xe.length>0&&ae.reportSlots(xe,B,he)}else kr(L.map(([B])=>B),$t,B=>{var he;let xe={},de={},se={};for(let[D,Pe]of L)B.has(D)&&(Pe.text&&(xe[D]=Pe.text),Pe.render&&(de[D]=Pe.render),Pe.skeleton&&(se[D]=Pe.skeleton));(he=ae.requestSlots)==null||he.call(ae,[...B],xe,{render:de,skeletons:se})});Mt.forEach(B=>B())})}},0))},decideSlots(d){for(let h of d)Bt.has(h.id)||(Bt.add(h.id),ht.set(h.id,h));ht.size===0||In!=null||(In=setTimeout(()=>{In=null;let h=[...ht.values()];ht.clear();for(let P=0;P<h.length;P+=30){let U=h.slice(P,P+30);ae.decide({slots:U}).then(G=>{G||kr(U.map(x=>x.id),Bt,x=>{var T;return(T=ae.decideSlots)==null?void 0:T.call(ae,U.filter(L=>x.has(L.id)))}),Mt.forEach(x=>x())})}},0))},cancelSlots(d){for(let h of d)mt.delete(h)&&$t.delete(h),ht.delete(h)&&Bt.delete(h)},onSlotsChanged(d){return Mt.add(d),()=>{Mt.delete(d)}},getStyleVocabulary(){return me},getSitePalette(){return ke},getVisitorId:()=>v()?_.getSessionId():null,getPersona(){return ie?{persona:ie.persona,confidence:ie.confidence,band:Ye(ie.confidence)}:null},async fetchWeights(){var d;let h=Fe(5e3);try{let P=await fetch(`${I}/weights`,{headers:F,signal:h.signal});return P.ok?(d=(await P.json()).components)!=null?d:[]:[]}catch(P){return[]}finally{h.clear()}},getGraph(){return{pageNodes:[],capturedAt:0}},flush(){A.flush(),ne.flush()},dispose(){var d;yt==null||yt(),Tn=!0,Ee=!0,A.destroy(),ne.destroy(),((d=pe.get(e.apiKey))==null?void 0:d.dispose)===ae.dispose&&pe.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var d;yt==null||yt(),Tn=!0,Ee=!0,M=!0,Gt(e.apiKey),A.destroy({forget:!0}),ne.destroy({forget:!0}),_.destroy(),g.clear(),((d=pe.get(e.apiKey))==null?void 0:d.dispose)===ae.dispose&&pe.delete(e.apiKey);try{localStorage.removeItem(at+e.apiKey),localStorage.removeItem(Wt(e.apiKey)),localStorage.removeItem(Vt(e.apiKey)),localStorage.removeItem(`_snt_graph_nodes${Ge(e.apiKey)}`),localStorage.removeItem("_snt_graph_edges")}catch(h){}e.debug&&console.log("[sentient] destroyed")}};if(pe.set(e.apiKey,{config:e,upgrade:null,dispose:ae.dispose}),yt=Yi(ae,e.apiKey,d=>{Ke.then(()=>{Tn||uo.add(d)})}),e.debug){let d=window;d.__sentient&&(d.__sentient.client=ae)}return ae}var nr=/(^|\/)snippet(\.global)?(\.min)?\.js(\?|$)/,Qi=(()=>{var e,t;try{return(t=(e=document.currentScript)==null?void 0:e.src)!=null?t:""}catch(n){return""}})(),ea=/@\d+\.\d+\.\d+[^/]*\//;function rr(e){var t;try{let n=Qi||((t=Array.from(document.getElementsByTagName("script")).find(r=>nr.test(r.src)))==null?void 0:t.src);for(let r of n?[n]:[]){let o=nr.test(r)?r.replace(nr,`$1${e}$4`):r.replace(/[^/?#]*([?#].*)?$/,e),a=(e==="consent.global.js"?"sha384-+7/RqBOFLU5bMaQ6bcBAWzG589skmxN8tedG9hkoQQ6HaQkRRBJfoRVD94e/fJcM":e==="editor.global.js"?"sha384-ZY9K0V+Fm+ZwoOUv2XZ3yvp6dfGGsYWbnzARkvr7ryFUYXw+moJi/TOtl7y4uR9Z":e==="preview.global.js"?"sha384-iHjmt/ZXRTZdLlt3tQnwy1O0vWs9YLvdbchk8ObiVg6+PmtSIuWbc0hiFf2iNK2C":"sha384-4qwTVE0fpyOJonE3RHji+ffzMR4zcPEYl7xXQX78yUrJ9cD+Nm5To3ufuyvKD9e6")||"";return ea.test(o)&&a.indexOf("sha384-")===0?{src:o,integrity:a}:{src:o}}}catch(n){}return null}var nn=new Map;function Ze(e,t,n){let r=window[t];if(r)return Promise.resolve(r);let o=nn.get(e);return o||(o=new Promise(a=>{var i;let s=n?{src:n}:rr(e);if(!s)return a(null);let l=We(document.createElement("script"));or(l,s),l.async=!0,l.onload=()=>{var c;let u=(c=window[t])!=null?c:null;u||nn.delete(e),a(u)},l.onerror=()=>{nn.delete(e),a(null)},((i=document.head)!=null?i:document.documentElement).appendChild(l)}),nn.set(e,o)),o}function or(e,t){t.integrity&&(e.integrity=t.integrity,e.crossOrigin="anonymous"),e.src=t.src}var fo="__sentientConsent",De=null,ir=!1,rn=new Set,ar=()=>{let e=window[fo];return typeof(e==null?void 0:e.consentWatcher)=="function"?e.consentWatcher:null},kt;function po(e){kt=e}function ta(){De||(De=ar())||ir||(ir=!0,Ze("consent.global.js",fo,kt).then(e=>{if(ir=!1,!e)return na(kt!=null?kt:"consent.global.js");if(De=ar(),De)for(let t of Array.from(rn))t()}))}function na(e){console.warn(`[sentient] could not load ${e} \u2014 tracking stays off. Set window.sentient.consentSrc to its URL.`)}function Qe(e){ta();let t=null,n=()=>(!t&&(De!=null?De:De=ar())&&(t=De(e)),t);return{read:()=>{var r,o;return(o=(r=n())==null?void 0:r.read())!=null?o:null},refused:()=>{var r,o;return(o=(r=n())==null?void 0:r.refused())!=null?o:!1},subscribe(r){let o,a=!1,s=()=>{rn.delete(s);let l=n();a||!l||(o=l.subscribe(r),r())};return n()?(o=t.subscribe(r),Promise.resolve().then(()=>{a||r()})):rn.add(s),()=>{a=!0,rn.delete(s),o==null||o()}}}}function ra(e){return e.replace(/\s+/g," ").trim().slice(0,300)}function go(e,t){let n=t>>>0;for(let r=0;r<e.length;r++)n^=e.charCodeAt(r),n=Math.imul(n,16777619)>>>0;return n.toString(16).padStart(8,"0")}function oa(e){let t=e.join("");return go(t,2166136261)+go(t,1523705862)}var ia=new Set(["A","BUTTON"]),aa=/^H([1-6])$/,sa=new Set(["P","LI","LABEL","BLOCKQUOTE","FIGCAPTION","DT","DD","TD","TH"]);var la=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"]);function ua(e){return ia.has(e.tagName)||e.getAttribute("role")==="button"?!0:e.tagName==="INPUT"&&/^(submit|button)$/i.test(e.type)}function ca(e){if(aa.test(e.tagName)||sa.has(e.tagName))return!0;let t=e.ownerDocument.defaultView,n=t?t.getComputedStyle(e).display:"";return n!==""&&n!=="inline"&&n!=="contents"}function da(e,t){let n=null;for(let r=e.parentElement;r&&r!==t.parentElement;r=r.parentElement){if(ua(r)){n=r;break}if(r===t)break}if(n)return n;for(let r=e.parentElement;r;r=r.parentElement)if(r===t||ca(r))return r;return t}function on(e,t=40){var n,r,o;let a=e.ownerDocument.createTreeWalker(e,4),s=[];for(let c=a.nextNode();c;c=a.nextNode())if(((n=c.nodeValue)!=null?n:"").trim()!==""&&!la.has((o=(r=c.parentElement)==null?void 0:r.tagName)!=null?o:"")&&(s.push(c),s.length>120))return{reason:"too_large"};if(s.length===0)return{reason:"empty"};let l=[],i=[];for(let c of s){let p=da(c,e),y=l.indexOf(p);y===-1&&(l.push(p),y=l.length-1),i.push(y)}if(l.length>t)return{reason:"too_large"};let u=s.map(c=>{var p;return ra((p=c.nodeValue)!=null?p:"")});return{textNodes:s,ownerEls:l,leafToNode:i,leaves:u,fp:oa(u)}}var mo=["cookiebot","onetrust","cookieyes","tcf","google-consent-mode","shopify"];function fa(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(a=>typeof a=="string")||/[=|]/.test(r)||o.some(a=>/[=|]/.test(a)))return null;n[r]=o}return n}function pa(e){return!Array.isArray(e)||e.length<2||e.length>12||!e.every(t=>typeof t=="string")?null:e}function ho(e){try{return e()}catch(t){return}}function an(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={};if(typeof t.slots=="object"&&t.slots!==null&&!Array.isArray(t.slots))for(let[l,i]of Object.entries(t.slots)){if(typeof i!="object"||i===null)continue;let u=i,c=fa(u.dims);if(!c||u.target!==void 0&&typeof u.target!="string")continue;let p=u.arms!==void 0?pa(u.arms):null,y={dims:c};typeof u.target=="string"&&(y.target=u.target),p&&(y.arms=p),n[l]=y}let r={apiKey:t.apiKey,personaAttributes:t.personaAttributes===!0,slots:n};typeof t.consent=="boolean"?r.consent=t.consent:t.consent!==void 0&&a("consent");let o=t.consentFrom;if(typeof o=="string"&&mo.includes(o))r.consentFrom=o;else if(o&&typeof o=="object"&&!Array.isArray(o)){let l=o;typeof l.cmp=="string"&&mo.includes(l.cmp)||l.cmp===void 0&&(typeof l.cookie=="string"||typeof l.check=="function")?r.consentFrom=l:a("consentFrom")}else o!==void 0&&a("consentFrom");function a(l){r.consent=!1,console.warn(`[sentient] invalid ${l} \u2014 tracking stays OFF until it is fixed (sentient-ui.com/docs#consent).`)}(t.preConsentBehavior==="statistical_winner"||t.preConsentBehavior==="control")&&(r.preConsentBehavior=t.preConsentBehavior),t.debug===!0&&(r.debug=!0),(t.stageAttributes===!0||t.stageAttributes==="detailed")&&(r.stageAttributes=t.stageAttributes),typeof t.registry=="boolean"&&(r.registry=t.registry),typeof t.editorSrc=="string"&&(r.editorSrc=t.editorSrc),typeof t.consentSrc=="string"&&(r.consentSrc=t.consentSrc),typeof t.nonce=="string"&&t.nonce!==""&&(r.nonce=t.nonce),typeof t.apiBase=="string"&&(r.apiBase=t.apiBase),typeof t.sectionCapture=="boolean"&&(r.sectionCapture=t.sectionCapture);let s=typeof t.persona=="function"?ho(t.persona):t.persona;if(typeof s=="string"&&s.trim()!==""&&(r.persona=s),(typeof t.internal=="function"?ho(t.internal):t.internal)===!0&&(r.internal=!0),Array.isArray(t.sections)){let l=t.sections.filter(i=>typeof i=="string"&&i.trim()!=="").slice(0,50);l.length>=2&&(r.sections=l)}return r}var yo=new WeakMap;function vo(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function bo(e,t,n){var a,s,l;let r=yo.get(e);if(r){if(r.fp!==n.fp||!vo(r.leafToNode,n.leafToNode))return"mismatch"}else{let i=on(e);if(!("fp"in i)||(r={fp:i.fp,leafToNode:i.leafToNode,textNodes:i.textNodes,ownerEls:i.ownerEls,classes:i.ownerEls.map(u=>{var c;return(c=u.getAttribute("class"))!=null?c:""})},r.fp!==n.fp||!vo(r.leafToNode,n.leafToNode)))return"mismatch";yo.set(e,r)}let o=r;for(let[i,u]of Object.entries(t.nodes)){let c=Number(i),p=o.ownerEls[c];if(p){if(typeof u.text=="string"){let y=!0;o.leafToNode.forEach((S,w)=>{S===c&&(o.textNodes[w].nodeValue=y?u.text:"",y=!1)})}u.like!==void 0&&o.classes[u.like]!==void 0&&p.setAttribute("class",o.classes[u.like]),u.hidden&&((a=p.style)==null||a.setProperty("display","none","important"))}}for(let i of Object.values((s=t.order)!=null?s:{})){let u=i.map(w=>o.ownerEls[w]).filter(w=>!!w),c=(l=u[0])==null?void 0:l.parentElement;if(!c||u.length!==i.length||u.some(w=>w.parentElement!==c))continue;let p=new Set(u),y=0;Array.from(c.children).map(w=>p.has(w)?u[y++]:w).forEach((w,b)=>{var K;c.children[b]!==w&&c.insertBefore(w,(K=c.children[b])!=null?K:null)})}return"applied"}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 ga(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 sn(e,t){return!!(e!=null&&e.urlMatch)&&!Et(t).includes(e.urlMatch)}var ma=/^[a-zA-Z_][-a-zA-Z0-9_]*$/;function So(e,t){var r;let n=[];if(e.id){let o=t.getElementById(e.id);n=o?[o]:[]}if(n.length===0&&((r=e.dataAttr)!=null&&r.name)&&ma.test(e.dataAttr.name))try{let o=e.dataAttr.value.replace(/["\\]/g,"\\$&");n=Array.from(t.querySelectorAll(`[${e.dataAttr.name}="${o}"]`))}catch(o){n=[]}if(n.length===0&&e.selector)try{n=Array.from(t.querySelectorAll(e.selector))}catch(o){n=[]}return n}function Ne(e,t){if(e.urlMatch&&!Et(t).includes(e.urlMatch))return null;let n=So(e,t);if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!ga(r,e.fingerprint)?null:r}function wo(e,t){return sn(e,t)?!1:!!e.selector&&!e.dataAttr&&!e.id&&!e.fingerprint&&e.page===void 0?_o(e,t):Ne(e,t)!==null}function _o(e,t){return So(e,t).length>0}function ln(e,t){return sn(e,t)?!1:e.page!==void 0&&tn.test(e.page)?Xn(e.page,Et(t)):_o(e,t)}var ko={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"},ha=/^(rgb|rgba|hsl|hsla|calc|var|min|max|clamp)$/i;function Eo(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(!ha.test((r=n[1])!=null?r:""))return!1;return!0}function ya(e){var r,o;let t=e.ownerDocument.createTreeWalker(e,4),n=null;for(let a=t.nextNode();a!==null;a=t.nextNode()){if(((r=a.nodeValue)!=null?r:"").trim()==="")continue;let s=(o=a.parentElement)==null?void 0:o.tagName;if(!(s==="SCRIPT"||s==="STYLE"||s==="TEMPLATE")){if(n!==null)return null;n=a}}return n}function xt(e,t){let n=ya(e);n!==null?n.nodeValue=t:e.textContent=t}var sr=/^https:\/\//i;function un(e){return typeof e=="string"&&!/[\s\x00-\x1f\\]/.test(e)&&(sr.test(e)||e[0]==="/"&&e[1]!=="/")?e:null}var xo=new Map,Ve=null;function va(e){return e.replace(/["\\]/g,"\\$&")}function ba(e){var t;(!Ve||!Ve.isConnected)&&(Ve=e.querySelector("style[data-sentient-ops]"),Ve||(Ve=We(e.createElement("style"),e),Ve.setAttribute("data-sentient-ops",""),((t=e.head)!=null?t:e.documentElement).appendChild(Ve))),Ve.textContent=[...xo.entries()].map(([n,r])=>`[data-snt-e="${va(n)}"]{${r}}`).join(`
2
- `)}function Ao(e,t,n,r){var l;let o=!1,a=(l=t.moveBefore)!=null?l:t.moveAfter;if(a){let i=Ne(a,r);!i||i===e||i.parentElement!==e.parentElement||!e.parentElement?o=!0:t.moveBefore?e.parentElement.insertBefore(e,i):e.parentElement.insertBefore(e,i.nextSibling)}typeof t.text=="string"&&xt(e,t.text),typeof t.href=="string"&&sr.test(t.href)&&e.setAttribute("href",t.href),typeof t.imageSrc=="string"&&sr.test(t.imageSrc)&&e.setAttribute("src",t.imageSrc),typeof t.imageAlt=="string"&&e.setAttribute("alt",t.imageAlt);let s=[];if(t.hidden&&s.push("display:none !important"),t.style)for(let[i,u]of Object.entries(t.style)){let c=ko[i];c&&typeof u=="string"&&Eo(u)&&s.push(`${c}:${u.trim()} !important`)}return s.length>0&&(e.setAttribute("data-snt-e",n),xo.set(n,s.join(";")),ba(r)),{anchorMiss:o}}var At="data-sentient-block-arm",R=null;function Ct(e){R=e!=null?e:null}var et=null;function It(e){et=e!=null?e:null}var To=e=>{var t;return typeof e=="string"?(t=et==null?void 0:et.entries.find(n=>n.id===e))==null?void 0:t.classes:void 0},Po=e=>{let t=typeof e=="string"?et==null?void 0:et.entries.find(n=>n.id===e):void 0;return t!=null&&t.computed.inheritsColor?t.computed.color:void 0},Me="data-sentient-blocks-hid",ft={none:"0",sm:"8px",md:"16px",lg:"24px"},lr={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},Co={sm:"0.875em",md:"1em",lg:"1.25em"},Sa={sm:"1.25em",md:"1.5em",lg:"2em"},wa={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},Io={sm:"8px",md:"16px",lg:"32px"},_a={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},ka={normal:"400",medium:"500",bold:"700"};function ye(e,t){for(let[n,r]of Object.entries(t))r!==void 0&&e.style.setProperty(n,r);return e}function Oo(e){return e==="muted"?R!=null&&R.muted?{color:R.muted}:{opacity:"0.7"}:e==="accent"?{"font-weight":"600",color:R==null?void 0:R.accent}:{}}function Lo(e,t){let n=Ea(e,t),r=Po(e.like);return n&&r&&(n.style.color=r),n}function Ea(e,t){var n,r,o,a,s,l,i,u,c,p,y,S,w,b,K,j,_,E,O,N;try{let M=To(e.like),m=e.maxWidth==="measure"?"65ch":void 0,v=f=>(f.className=M,ye(f,{"max-width":m}));switch(e.type){case"stack":case"grid":{let f=t.createElement("div");if(e.type==="stack"){let I=e;ye(f,{display:"flex","flex-direction":I.direction,gap:(r=ft[(n=I.gap)!=null?n:"md"])!=null?r:ft.md,"align-items":I.align?lr[I.align]:void 0,"justify-content":I.justify?lr[I.justify]:void 0,"flex-wrap":I.wrap?"wrap":void 0})}else{let I=e,F=(a=ft[(o=I.gap)!=null?o:"md"])!=null?a:ft.md;ye(f,{display:"grid","grid-template-columns":`repeat(auto-fit, minmax(max(200px, calc((100% - ${I.columns-1} * ${F}) / ${I.columns})), 1fr))`,gap:F,"align-items":I.align?lr[I.align]:void 0})}M&&(f.className=M);let g=!M&&e.type==="stack"&&e.surface==="raised",A=(s=e.pad)!=null?s:g?"md":void 0;A&&ye(f,{padding:(l=ft[A])!=null?l:ft.md}),g&&ye(f,{background:R==null?void 0:R.surface,color:R!=null&&R.surface?R==null?void 0:R.surfaceText:void 0,border:`1px solid ${(i=R==null?void 0:R.border)!=null?i:"currentColor"}`,"border-radius":(u=R==null?void 0:R.radius)!=null?u:"8px"});for(let I of(c=e.children)!=null?c:[]){let F=Lo(I,t);F&&f.appendChild(F)}return f}case"text":{let f=t.createElement("p");return f.textContent=e.value,M?v(f):ye(f,je(W({margin:"0","font-size":e.size?Co[e.size]:void 0,"font-weight":e.weight?ka[e.weight]:void 0,"text-align":e.align},Oo(e.tone)),{"max-width":e.maxWidth==="measure"?"65ch":void 0}))}case"heading":{let f=t.createElement(`h${e.level}`);return f.textContent=e.value,M?v(f):ye(f,{margin:"0","font-size":Sa[(p=e.size)!=null?p:"md"],"text-align":e.align,"max-width":e.maxWidth==="measure"?"65ch":void 0})}case"button":{let f=t.createElement("a");f.textContent=e.label;let g=un(e.href);if(g&&(f.href=g),e.tag&&f.setAttribute("data-sentient-tag",e.tag),M)return v(f);let A=(y=e.emphasis)!=null?y:"primary";return ye(f,{display:"inline-block",padding:wa[(S=e.size)!=null?S:"md"],"border-radius":(w=R==null?void 0:R.radius)!=null?w:"8px",font:"inherit","font-size":e.size?Co[e.size]:void 0,"text-decoration":A==="ghost"?"underline":"none",cursor:"pointer",background:A==="primary"?(b=R==null?void 0:R.primaryBg)!=null?b:"#111827":"transparent",color:A==="primary"?(K=R==null?void 0:R.primaryText)!=null?K:"#ffffff":(j=R==null?void 0:R.accent)!=null?j:"inherit",border:A==="secondary"?`1px solid ${(_=R==null?void 0:R.accent)!=null?_:"currentColor"}`:"none"})}case"link":{let f=t.createElement("a");f.textContent=e.label;let g=un(e.href);return g&&(f.href=g),e.tag&&f.setAttribute("data-sentient-tag",e.tag),M?v(f):ye(f,{color:"inherit","text-decoration":"underline"})}case"image":{let f=t.createElement("img"),g=un(e.src);return g&&(f.src=g),f.alt=e.alt,M&&(f.className=M),ye(f,{display:"block","max-width":"100%","aspect-ratio":e.ratio&&e.ratio!=="auto"?_a[e.ratio]:void 0,"object-fit":e.fit,width:e.ratio&&e.ratio!=="auto"?"100%":void 0})}case"badge":{let f=t.createElement("span");return f.textContent=e.value,M?v(f):ye(f,W({display:"inline-block",padding:"2px 10px","border-radius":"999px","font-size":"0.75em",border:`1px solid ${(E=R==null?void 0:R.border)!=null?E:"currentColor"}`},Oo(e.tone)))}case"spacer":return ye(t.createElement("div"),{height:(O=Io[e.size])!=null?O:Io.md});case"divider":return ye(t.createElement("hr"),{border:"none","border-top":`1px solid ${(N=R==null?void 0:R.border)!=null?N:"currentColor"}`,margin:"0",width:"100%"});default:return null}}catch(M){return null}}function Ro(e,t,n,r){var o,a;try{let s=new Set;for(let i of Array.from(e.children)){let u=i.getAttribute(At);u!==null&&(t[u]===void 0?i.remove():s.add(u))}for(let[i,u]of Object.entries(t)){if(s.has(i))continue;let c="tree"in u?u:null,p=Lo(c?c.tree:u,r);if(!p)continue;let y=r.createElement("div");y.setAttribute(At,i),y.style.display="none";let S=c?To((o=c.surface)==null?void 0:o.like):void 0;if(S){let w=r.createElement("div");w.className=S;let b=Po((a=c.surface)==null?void 0:a.like);b&&(w.style.color=b),w.appendChild(p),y.appendChild(w)}else y.appendChild(p);e.appendChild(y)}let l=n!==void 0&&t[n]!==void 0;for(let i of Array.from(e.children)){let u=i.getAttribute(At),c=i;u!==null?c.style.display=l&&u===n?"":"none":l?c.hasAttribute(Me)||(c.setAttribute(Me,c.style.display),c.style.display="none"):c.hasAttribute(Me)&&(c.style.display=c.getAttribute(Me),c.removeAttribute(Me))}}catch(s){}}function xa(e){try{for(let t of Array.from(e.children)){let n=t;if(n.getAttribute(At)!==null){n.remove();continue}n.hasAttribute(Me)&&(n.style.display=n.getAttribute(Me),n.removeAttribute(Me))}}catch(t){}}function cn(e,t){try{let n=new Set;for(let r of Array.from(e.querySelectorAll(`[${At}]`)))r.parentElement&&n.add(r.parentElement);for(let r of Array.from(e.querySelectorAll(`[${Me}]`)))r.parentElement&&n.add(r.parentElement);for(let r of n)t.has(r)||xa(r)}catch(n){}}function ur(e,t){if(!e)return[t.documentElement];try{return Array.from(t.querySelectorAll(e))}catch(n){return[]}}function dn(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 fn(e,t,n,r){var o;for(let[a,s]of Object.entries(t)){let l=e[a];if(!l||typeof l=="string")continue;let i=ur(s.target,n);for(let u of i)for(let[c,p]of Object.entries(l))(o=s.dims[c])!=null&&o.includes(p)&&(u.setAttribute(`data-${c}`,p),r==null||r(u,`data-${c}`))}}function pn(e,t,n,r){for(let[o,a]of Object.entries(t)){let s=e[o];if(typeof s!="string"||!a.arms||!a.arms.includes(s))continue;let l=ur(a.target,n);for(let i of l)i.setAttribute("data-sentient-arm",s),r==null||r(i,"data-sentient-arm")}}function gn(e,t,n,r){var l,i,u,c,p,y,S;let o=new Set,a=(l=r==null?void 0:r.contentAndOps)!=null?l:!0,s=[];for(let[w,b]of Object.entries(t)){if(sn(b.locator,n))continue;let K;if(b.locator){let _=Ne(b.locator,n);K=_?[_]:[],!_&&ln(b.locator,n)&&s.push(w)}else K=ur(b.target,n);let j=e[w];for(let _ of K){if(j!==void 0)if(typeof j=="string")_.setAttribute("data-sentient-arm",j),(i=r==null?void 0:r.onAttr)==null||i.call(r,_,"data-sentient-arm"),a&&((u=r==null?void 0:r.onApplied)==null||u.call(r,w,j,_));else for(let[O,N]of Object.entries(j))_.setAttribute(`data-${O}`,N),(c=r==null?void 0:r.onAttr)==null||c.call(r,_,`data-${O}`);if((b.blocks||b.compose)&&!Ca(n)){let O=Object.fromEntries([...Object.entries((p=b.blocks)!=null?p:{}).filter(([,N])=>!wt(N)),...Object.entries((y=b.compose)!=null?y:{}).filter(([,N])=>!wt(N.tree))]);Object.keys(O).length>0&&(Ro(_,O,typeof j=="string"?j:void 0,n),o.add(_))}if(!a)continue;let E=_.textContent;b.edits?bo(_,b.edits.edits,b.edits)==="mismatch"&&((S=r==null?void 0:r.onDrift)==null||S.call(r,w,b.edits.fp)):typeof b.content=="string"&&xt(_,b.content),b.ops&&Ao(_,b.ops,w,n).anchorMiss&&!s.includes(w)&&s.push(w),Qn(_,je(W(W({previous:E},typeof j=="string"?{arm:j}:{}),(r==null?void 0:r.persona)!==void 0?{persona:r.persona}:{}),{doc:n}))}}return cn(n,o),s}var Aa=/bot|crawler|spider|crawling|googlebot|bingbot|duckduckbot|baiduspider|yandexbot|slurp|gptbot|claudebot|anthropic|perplexity|ccbot|applebot|headlesschrome/i;function Ca(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:Aa.test((r=o.userAgent)!=null?r:""):!1}catch(o){return!1}}var Ia=800;function mn(e,t,n){let r=[];return n.forEach(({slotId:o,arm:a,el:s},l)=>{r.push(er((y,S={})=>{try{e.track({projectId:t,componentId:o,variantId:a,eventType:"micro_signal",payload:W({signalType:y},S)})}catch(w){}},s,void 0,{tabLoss:l===0}));let i=null,u=0,c=()=>{u=Date.now(),i=setTimeout(()=>{try{e.track({projectId:t,componentId:o,variantId:a,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-u}})}catch(y){}i=null},Ia)},p=()=>{i!==null&&(clearTimeout(i),i=null)};s.addEventListener("mouseenter",c),s.addEventListener("mouseleave",p),r.push(()=>{s.removeEventListener("mouseenter",c),s.removeEventListener("mouseleave",p),i!==null&&clearTimeout(i)})}),()=>{for(let o of r)o()}}function Do(e){return e?`_snt_fired_goals_${e.slice(0,12)}`:"_snt_fired_goals"}var Oa="_snt_fired_goals";function cr(e,t){try{e==null||e.sessionStorage.removeItem(Do(t)),e==null||e.sessionStorage.removeItem(Oa)}catch(n){}}function No(e){var t;return[(t=e.slotId)!=null?t:"",e.goalId,e.event,e.locator?JSON.stringify(e.locator):""].join("|")}function Ta(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 Pa(e,t,n){try{e==null||e.sessionStorage.setItem(t,JSON.stringify([...n]))}catch(r){}}function Mo(e,t,n,r){var j,_;let o=(j=n.defaultView)!=null?j:typeof window!="undefined"?window:null,a=Do(r),s=Ta(o,a),l=E=>{let O=No(E);if(!s.has(O))try{E.slotId?t.componentGoal(E.slotId,E.goalId):t.goal(E.goalId),s.add(O),Pa(o,a,s)}catch(N){}},i=e.filter(E=>E.event==="click"),u=e.filter(E=>E.event==="form_submit"),c=e.filter(E=>E.event==="url_reached"),p=e.filter(E=>E.event==="scroll_depth"),y=(E,O)=>{if(!E.locator)return!1;let N=Ne(E.locator,n);return!!N&&(N===O||N.contains(O))},S=E=>{let O=E.target;if(!(!O||typeof O.closest!="function"))for(let N of i)y(N,O)&&l(N)},w=E=>{let O=E.target;if(O)for(let N of u)y(N,O)&&l(N)},b=()=>{if(c.length===0)return;let E=Et(n);for(let O of c)O.urlPattern&&Zn(O.urlPattern,E)&&l(O)},K=()=>{var N;let E=n.documentElement,O=E.scrollHeight>0?(E.scrollTop+E.clientHeight)/E.scrollHeight:0;for(let M of p)O>=((N=M.threshold)!=null?N:.75)&&l(M);p.every(M=>s.has(No(M)))&&n.removeEventListener("scroll",K)};return n.addEventListener("click",S,!0),n.addEventListener("submit",w,!0),(_=n.defaultView)==null||_.addEventListener("popstate",b),b(),p.length>0&&(n.addEventListener("scroll",K,{passive:!0}),K()),{checkUrl:b,teardown:()=>{var E;n.removeEventListener("click",S,!0),n.removeEventListener("submit",w,!0),(E=n.defaultView)==null||E.removeEventListener("popstate",b),p.length>0&&n.removeEventListener("scroll",K)}}}function hn(e,t){if(!e||e.length<2||t.size!==e.length)return null;let n=[];for(let s of e){let l=t.get(s);if(!l||n.includes(l))return null;n.push(l)}let r=n[0].parentNode;if(!r||!n.every(s=>s.parentNode===r))return null;let o=n.slice().sort((s,l)=>s.compareDocumentPosition(l)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),a=[];for(let s=0;s<n.length;s++){let l=n[s];o[s]!==l&&(a.push({el:l,before:o[s]}),o.splice(o.indexOf(l),1),o.splice(s,0,l))}return a}var La="__snt_editor_token";function $o(){try{return typeof sessionStorage!="undefined"?sessionStorage.getItem(La):null}catch(e){return null}}function Bo(e){let t=null;try{let n=location.hash.slice(1),r=RegExp("(^|[?&])"+e+"=([^&]*)").exec(n);if(r){t=r[2];let o=n.slice(r.index+r[0].length);r[1]!="&"&&o[0]=="&"&&(o=r[1]+o.slice(1));let a=n.slice(0,r.index)+o;history.replaceState(history.state,"",a?"#"+a:location.pathname+location.search)}}catch(n){}return t}Un();Fn(()=>Ze("engagement.global.js","__sentientEngagement"));var Ot="0.35.0",bn=Ot!=="0.0.0-dev"?{name:"snippet",version:Ot}:void 0,zo=Ot!=="0.0.0-dev"?{v:Ot}:{},Ko=5e3,Ra=50,Ho=(()=>{try{if(typeof window=="undefined")return[];let e=window.SentientSnippet;return Array.isArray(e==null?void 0:e.q)?e.q:[]}catch(e){return[]}})(),ee=null,k=null,Se={},be=null,we=null,Tt=null,re=null,oe=null,Pt=0,J=null,tt=null,jo=!1,dr=null,yn=null,Lt=null,Ae=!1,ze=!1,Sn=!1,wn=0,qo=e=>fe(e)===wn,pt=null,ue=!1,Be=null,Ce=[],nt=null,rt=null,ve=null,Na=3e3,Da=100;function Go(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 $e(e,...t){e!=null&&e.debug&&console.log("[sentient-snippet]",...t)}function Rt(e,t){return ee?(ee.personaAttributes&&J&&dn(J.persona,J.band,e,t==null?void 0:t.onAttr),fn(Se,ee.slots,e,t==null?void 0:t.onAttr),pn(Se,ee.slots,e,t==null?void 0:t.onAttr),be?gn(Se,be,e,W(je(W({},t),{onDrift:(n,r)=>{var o,a;return(a=k==null?void 0:k.reportDrift)==null?void 0:a.call(k,n,r,(o=Xo[n])!=null?o:null,"fp_mismatch")}}),J?{persona:J.persona}:{})):(cn(e,new Set),[])):[]}function Jo(e){var n;let t=new Map;for(let r of(n=ee==null?void 0:ee.sections)!=null?n:[])try{let o=e.querySelectorAll(r);o.length===1&&t.set(r,o[0])}catch(o){}return t}function fr(e,t){var n,r;try{if(!e||e.length<2)return;for(let o of(n=hn(e,Jo(t)))!=null?n:[])(r=o.before.parentNode)==null||r.insertBefore(o.el,o.before)}catch(o){}}function Ma(e,t,n){let r=(o,a)=>t.some(([s,l])=>s===o&&l===a);try{if(Array.isArray(e.stamped))for(let o of e.stamped){if(!Array.isArray(o))continue;let[a,s,l]=o;!a||typeof s!="string"||r(a,s)||(l==null?a.removeAttribute(s):a.setAttribute(s,l))}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 $a(){try{let e=window.__sntPP;return e&&typeof e=="object"&&typeof e.v=="number"?e:null}catch(e){return null}}function Yo(e){return e.apiBase?`${e.apiBase.replace(/\/+$/,"")}/v1/events`:void 0}function kn(e){var t;return(t=e.apiBase)!=null?t:"https://api.sentient-ui.com"}function Ba(e){return Promise.resolve().then(()=>fetch(`${kn(e)}/v1/registry/locators`,{headers:{authorization:`Bearer ${e.apiKey}`}})).then(t=>t.ok?t.json():null).then(t=>Array.isArray(t==null?void 0:t.slots)?t.slots:null).catch(()=>null)}function pr(e,t){let n=[],r=[];for(let o of e)try{if(typeof(o==null?void 0:o.id)!="string")continue;!o.locator||wo(o.locator,t)?n.push(o.id):ln(o.locator,t)&&r.push(o.id)}catch(a){}return[n,r]}var Xo={};function Zo(e,t){var r;let n={};for(let o of e){let a=(r=Be==null?void 0:Be.find(u=>u.id===o))==null?void 0:r.locator,s=a?Ne(a,t):null,l=s?on(s):null,i=l&&"fp"in l?l.fp:void 0;i&&(Xo[o]=i),n[o]=je(W({},i?{fp:i}:{}),{forms:!1,compose:!0,content:!0})}return n}function Qo(e,t){let n=null;for(let r of t)e!=null&&e[r]&&((n!=null?n:n={})[r]=e[r]);return n}var le=null;function ei(){if(!Ae){le&&nt!==Re()&&le(!0);return}!Be||nt===Re()||(nt=Re(),Ka())}function Ka(){ve==null||ve();let e=ee,t=Be;if(!e||!t)return;let n,r,o=()=>{clearTimeout(n),clearTimeout(l),r==null||r.disconnect(),ve===o&&(ve=null)},a=null,s=i=>{let[u,c]=pr(t,document),p=u.filter(y=>!Ce.includes(y));a!==null&&u.some(y=>!a.has(y)&&!p.includes(y))&&Nt(),a=new Set(u),p.length>0&&ja(p).catch(()=>{}),(i||c.length===0&&!t.some(y=>!u.includes(y.id)&&!Ce.includes(y.id)))&&(o(),ti(e,c))},l=setTimeout(()=>s(!0),Na);if(ve=o,s(),ve===o)try{r=new MutationObserver(()=>{clearTimeout(n),n=setTimeout(s,Da)}),r.observe(document.documentElement,{childList:!0,subtree:!0})}catch(i){}}function _n(e,t){if(!(!e||e.length===0||!t||!ee))try{we==null||we.teardown(),we=Mo(e,t,document,ee.apiKey)}catch(n){}}async function ja(e){let t=ee,n=k;if(!t||!n)return;Ce=Ce.concat(e);let r=await n.decide(W({slotsFrom:"registry",registrySlotIds:e,render:Zo(e,document)},zo));if(r||(Ce=Ce.filter(a=>!e.includes(a))),!r||ue||k!==n)return;Se=W(W({},Se),r.slots),!we&&r.goals&&(t.consent!==!1||ze)&&_n(Tt=r.goals,n);let o=Qo(r.slotConfig,e);o&&(be=W(W({},be),o)),Nt(),$e(t,"late decide",e),rt&&qo(t.apiKey)&&Je(t.apiKey,rt=W(je(W({},rt),{slots:Se,savedAt:Date.now()}),be?{slotConfig:be}:{}))}function ti(e,t){if(t.length!==0)try{fetch(`${kn(e)}/v1/locator-miss`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${e.apiKey}`},body:JSON.stringify({slots:t})}).catch(()=>{})}catch(n){}}function ot(){return!!(ee&&k&&ee.sectionCapture!==!1&&(ee.consent!==!1||ze)&&!Xe())}function Ga(){if(!k||!ee||!ot()||oe)return;let e=[];Rt(document,{contentAndOps:Ae,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),mr();try{re==null||re(),re=mn(k,ee.apiKey,e)}catch(t){}}function mr(){if(typeof document=="undefined"||!ot())return;let e;try{if(yn&&yn.length>0){let r=new Map;for(let o of yn){if(o.urlMatch!==window.location.pathname)continue;let a=Ne(o.locator,document);a&&r.set(a,o.type)}r.size>0&&(e=o=>{var a;return(a=r.get(o))!=null?a:null})}}catch(r){}let t=k,n=++Pt;Lt=window.location.pathname,Ze("engagement.global.js","__sentientEngagement").then(r=>{if(!(!r||n!==Pt||k!==t||!t||!ot()))try{oe==null||oe(),oe=r.startEngagementCapture(t,W({apiKey:ee.apiKey,apiBase:ee.apiBase,doc:document,microSignals:!0},e?{typeOf:e}:{}))}catch(o){}})}function Nt(){try{let e=[];if(re==null||re(),re=null,Rt(document,{contentAndOps:Ae,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),fr(tt,document),e.length>0&&ot())try{re=mn(k,ee.apiKey,e)}catch(t){}try{typeof window!="undefined"&&Lt!==null&&window.location.pathname!==Lt&&ot()&&(oe==null||oe(),oe=null,Pt++,mr())}catch(t){}}catch(e){}}function Fo(){dr===null&&(dr=setTimeout(()=>{dr=null,Nt();try{we==null||we.checkUrl()}catch(e){}ei()},Ra))}function ni(){if(!(jo||typeof window=="undefined"||typeof history=="undefined")){jo=!0;try{let e=t=>{let n=history[t];history[t]=function(r,o,a){let s=n.call(this,r,o,a!=null?a:null);return Fo(),s}};e("pushState"),e("replaceState"),window.addEventListener("popstate",Fo)}catch(e){}}}function vn(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 Fa(e,t,n){var r;try{window.__sentientEditor={token:t,code:n,apiBase:kn(e)};let o=e.editorSrc?{src:e.editorSrc}:rr("editor.global.js");if(!o){Wo();return}let a=We(document.createElement("script"));or(a,o),a.async=!0,a.onerror=()=>Wo(),((r=document.head)!=null?r:document.documentElement).appendChild(a)}catch(o){}}var Uo="sentient-editor-load-notice";function Wo(){var e;try{if(document.getElementById(Uo))return;let t=document.createElement("div");t.id=Uo,t.textContent="Couldn\u2019t load the editor \u2014 check your connection and reopen it from your dashboard.",t.style.cssText="position:fixed;bottom:16px;right:16px;z-index:2147483647;padding:12px;background:#111;color:#fff;font:13px system-ui",t.onclick=()=>t.remove(),((e=document.body)!=null?e:document.documentElement).appendChild(t),setTimeout(()=>t.remove(),1e4)}catch(t){}}function Ua(e){let t={cfg:e,apiBase:kn(e),set(n){n.slots!==void 0&&(Se=n.slots),n.slotConfig!==void 0&&(be=n.slotConfig),n.persona!==void 0&&(J=n.persona),n.decided&&(Ae=!0),n.look&&(Ct(n.look.palette),It(n.look.vocabulary))},apply:()=>Rt(document),installSpaHooks:ni,exposeGlobal:()=>{Sn=!0,gr(e)},dbg:(...n)=>$e(e,...n)};return Ze("preview.global.js","__sentientPreview").then(n=>n?n.runPreview(t):Promise.reject()).catch(()=>(t.exposeGlobal(),$e(e,"preview chunk unavailable \u2014 page left as-is"),!0))}function gr(e){let t=r=>{try{oe==null||oe(),oe=null,Pt++,Lt=null,re==null||re(),re=null,ve==null||ve(),we==null||we.teardown(),we=null,r&&cr(typeof window!="undefined"?window:null,e.apiKey),ze=!1,ue=!0,r?(rt=null,J=null,k?k.destroy():lt(e.apiKey)):k==null||k.dispose(),k=null}catch(o){}},n={consentWatcher:Qe,goal(r,o){try{k==null||k.goal(r,o)}catch(a){}},componentGoal(r,o){try{k==null||k.componentGoal(r,o)}catch(a){}},identify(r,o){try{k==null||k.identify(r,o)}catch(a){}},grantConsent(){try{if(!k&&ue||k!=null&&k.released)wn=fe(e.apiKey),k=_t(W({apiKey:e.apiKey,consent:!0,preConsentBehavior:e.preConsentBehavior,debug:e.debug,persona:e.persona,internal:e.internal,ingestUrl:Yo(e)},bn?{sdk:bn}:{})),_n(Tt,k);else{let r=(k==null?void 0:k.gated)===!0;tr(e.apiKey),r&&(wn=fe(e.apiKey)),_n(Tt,k)}ue=!1,le==null||le()}catch(r){}ze=!0;try{Ga()}catch(r){}},revokeConsent(){t(!0)},reapply:Nt,getState(){var r,o;try{return{apiKey:e.apiKey,persona:(r=J==null?void 0:J.persona)!=null?r:null,band:(o=J==null?void 0:J.band)!=null?o:null,slots:Se,matchCounts:vn(e),consent:!ue&&(e.consent!==!1||ze)}}catch(a){return{apiKey:e.apiKey,persona:null,band:null,slots:{},matchCounts:{},consent:!1}}}};if(window.SentientSnippet=n,window.__sentientApi=n,e.consentFrom&&!pt&&!Sn)try{let r=Qe(e.consentFrom),o=!1,a=!1,s=()=>!!k&&!ue&&(k.gated===void 0?e.consent!==!1||ze:!k.gated);pt=r.subscribe(()=>{try{let l=r.read();l!==null&&(a=!0);let i=l!=null?l:a?!1:null,u=s(),c=!u&&i!==!0&&r.refused();if(c&&!o&&(k!=null&&k.gated?k.destroy():lt(e.apiKey),cr(window,e.apiKey),rt=null,J=null),o=c,i===!0&&!u)n.grantConsent();else if(i===!1&&u){let p=r.refused();t(p),p&&(o=!0)}}catch(l){}})}catch(r){}for(let r of Ho.splice(0))try{r[0]==="goal"?n.goal(r[1],r[2]):r[0]==="grantConsent"&&k?n.grantConsent():r[0]==="revokeConsent"&&k&&n.revokeConsent()}catch(o){}}function Vo(){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,identify:n,grantConsent:n,revokeConsent:n,reapply:n,consentWatcher:Qe,getState:()=>({apiKey:"",persona:null,band:null,slots:{},matchCounts:{},consent:!1})},Ho.length=0}catch(t){}}function Wa(){try{let e=window.Shopify;return typeof(e==null?void 0:e.shop)=="string"&&e.shop!==""}catch(e){return!1}}async function ri(){var e,t;try{let n=an(window.sentient);if(!n){Vo();return}ee=n,pt==null||pt(),pt=null,!n.consentFrom&&n.consent===void 0&&Wa()&&(n.consentFrom="shopify"),po(n.consentSrc),Qt(n.nonce),Sn=!1,Ae=!1,le=null,tt=null,Se={},be=null,Ct(null),It(null),ze=!1,ue=!1,Tt=null,Be=null,Ce=[],nt=null,rt=null,ve==null||ve(),oe==null||oe(),oe=null,Pt++,Lt=null;let r=Bo("sentient_editor_code"),o=r?null:$o();if(r||o){Fa(n,o,r),Sn=!0,gr(n),$e(n,"editor mode");return}if(typeof window!="undefined"&&/[?&]sentient_(preview|persona|context)=[^&]/.test(window.location.search)&&await Ua(n))return;if(n.consentFrom&&n.consent===void 0)try{n.consent=Qe(n.consentFrom).read()===!0}catch(f){n.consent=!1}n.consent!==!1&&n.sectionCapture!==!1&&!Xe()&&Ze("engagement.global.js","__sentientEngagement");let a=(e=n.registry)!=null?e:Object.keys(n.slots).length===0;n.registry===void 0&&!a&&$e(n,"slots declared without registry: true, so dashboard-published components are not applied");let s=a?Ba(n):null,l=$a();try{(t=l==null?void 0:l.stop)==null||t.call(l)}catch(f){}let i=n.consent!==!1&&!Xe()?st(n.apiKey):null,u=[];if(i){J={persona:i.persona,band:i.band},Se=i.slots,i.slotConfig&&(be=i.slotConfig),i.palette&&Ct(i.palette),i.vocabulary&&It(i.vocabulary),Rt(document,W({contentAndOps:!1},l?{onAttr:(g,A)=>u.push([g,A])}:{})),i.layoutOrder&&(tt=i.layoutOrder,fr(tt,document));let f=St(i.stage,n.stageAttributes);f&&(en(f),u.push([document.documentElement,"data-sentient-stage"]))}l&&Ma(l,u,document);let c=_t(W({apiKey:n.apiKey,consent:n.consent,preConsentBehavior:n.preConsentBehavior,debug:n.debug,persona:n.persona,internal:n.internal,stageAttributes:n.stageAttributes,ingestUrl:Yo(n)},bn?{sdk:bn}:{}));k=c,wn=fe(n.apiKey),gr(n),ni();let p=Object.entries(n.slots).map(([f,g])=>({id:f,dims:g.dims})),y=zo,S={pp:l?l.v:0},w=[];if(s){let[f]=await Promise.all([Go(s,Ko),document.readyState==="loading"?new Promise(g=>document.addEventListener("DOMContentLoaded",g,{once:!0})):null]);Be=f,f&&(Ce=w=pr(f,document)[0]),$e(n,"registry scope",f&&w)}let b=(f=c)=>{let g=Array.from(Jo(document).keys());return f.decide(W(W(W(W({slots:p},y),S),g.length>=2?{sections:g}:{}),a?{slotsFrom:"registry",registrySlotIds:w,render:Zo(w,document)}:{}))},K=Re(),j=c.gated===!0,_=!1,E=!1,O=!1,N=!1;le=(f=!1)=>{let g=k;!_||E||N||Ae||ue||!g||g.gated||!f&&!O||(O=!1,N=!0,K=nt=Re(),Be&&(Ce=w=pr(Be,document)[0]),b(g).then(A=>{N=!1,A&&!Ae&&!ue&&k===g?v(A):(A||(Ce=[]),!Ae&&(g.released||k!==g||ue)&&(O=!0))}).catch(()=>{N=!1}))};let M=b();M.then(()=>{_=!0},()=>{_=!0});let m=await Go(M,Ko),v=f=>{var I,F,Y,ne,_e;E=!0;let g=(k!=null?k:c).getPersona();g?J={persona:g.persona,band:g.band}:f.persona&&(J={persona:f.persona,band:"low"}),Se=f.slots,a?be=Qo(f.slotConfig,w):f.slotConfig&&(be=f.slotConfig),f.palette&&Ct(f.palette),f.vocabulary&&It(f.vocabulary),tt=(I=f.layoutOrder)!=null?I:tt;let A=()=>{var te;let C=[],H=Rt(document,{onApplied:(Ie,ge,Z)=>C.push({slotId:Ie,arm:ge,el:Z})});a||ti(n,H),fr(tt,document);try{(te=l==null?void 0:l.reveal)==null||te.call(l)}catch(Ie){}if(Ae=!0,ot())try{re==null||re(),re=mn(k,n.apiKey,C)}catch(Ie){}};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",A,{once:!0}):A(),Tt=(F=f.goals)!=null?F:null,(n.consent!==!1||ze)&&!ue&&_n(f.goals,k),yn=(Y=f.sectionMap)!=null?Y:null,ot()&&mr(),$e(n,"applied",{persona:J,slots:Se,matches:vn(n)}),!ue&&(qo(n.apiKey)&&Je(n.apiKey,rt=W(W(W(W({v:1,persona:(ne=J==null?void 0:J.persona)!=null?ne:f.persona,band:(_e=J==null?void 0:J.band)!=null?_e:"low",slots:f.slots,layoutOrder:f.layoutOrder,savedAt:Date.now()},be?{slotConfig:be}:{}),f.palette?{palette:f.palette}:{}),f.vocabulary?{vocabulary:f.vocabulary}:{}),(C=>C?{stage:C}:{})(St(f.stage,n.stageAttributes)))),nt=null,ei())};if(!m){$e(n,"decide timeout/null \u2014 snapshot state stands",vn(n)),M.then(f=>{if(!f){if(Ae)return;Ce=[],c.released===!0||k!==c||ue||j&&Re()!==K?(O=!0,le==null||le()):nt=K;return}if(!(!f||Ae||ue)){if(k!==c){O=!0,le==null||le();return}v(f),$e(n,"late decide applied",vn(n))}}).catch(()=>{});return}if(ue||k!==c){O=!0,le==null||le();return}v(m)}catch(n){Vo()}}if(typeof window!="undefined"&&window.sentient){let e=window;if(!e.__sentientInitialized)e.__sentientInitialized=!0,Promise.resolve().then(()=>{ri()});else{let t=window.__sentientApi;t&&Promise.resolve().then(()=>{window.SentientSnippet=t})}}return pi(Va);})();
1
+ "use strict";var SentientSnippet=(()=>{var Kt=Object.defineProperty,si=Object.defineProperties,li=Object.getOwnPropertyDescriptor,ui=Object.getOwnPropertyDescriptors,ci=Object.getOwnPropertyNames,Or=Object.getOwnPropertySymbols;var Pr=Object.prototype.hasOwnProperty,di=Object.prototype.propertyIsEnumerable;var Tr=(e,t,n)=>t in e?Kt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,W=(e,t)=>{for(var n in t||(t={}))Pr.call(t,n)&&Tr(e,n,t[n]);if(Or)for(var n of Or(t))di.call(t,n)&&Tr(e,n,t[n]);return e},je=(e,t)=>si(e,ui(t));var Pn=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ln=(e,t)=>{for(var n in t)Kt(e,n,{get:t[n],enumerable:!0})},fi=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ci(t))!Pr.call(e,o)&&o!==n&&Kt(e,o,{get:()=>t[o],enumerable:!(r=li(t,o))||r.enumerable});return e};var pi=e=>fi(Kt({},"__esModule",{value:!0}),e);var Oi,Ti,Pi,Kr,Li,Ri,jr,$,Ue,Bn=Pn(()=>{"use strict";Oi=Object.defineProperty,Ti=Object.defineProperties,Pi=Object.getOwnPropertyDescriptors,Kr=Object.getOwnPropertySymbols,Li=Object.prototype.hasOwnProperty,Ri=Object.prototype.propertyIsEnumerable,jr=(e,t,n)=>t in e?Oi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$=(e,t)=>{for(var n in t||(t={}))Li.call(t,n)&&jr(e,n,t[n]);if(Kr)for(var n of Kr(t))Ri.call(t,n)&&jr(e,n,t[n]);return e},Ue=(e,t)=>Ti(e,Pi(t))});var Xr={};Ln(Xr,{LOCAL_ENGINE_AVAILABLE:()=>$i,createLocalEngine:()=>Bi});function Bi(e){throw new Error("[sentient] createLocalEngine is not available in production builds. The local engine only exists under the `development` export condition.")}var $i,Zr=Pn(()=>{"use strict";$i=!1});var to={};Ln(to,{emailFields:()=>ji,setInternalLoader:()=>Fn,takeInternalToken:()=>Ki});function Fn(e){Qr=e}var Qr,eo,Ki,ji,Un=Pn(()=>{"use strict";Qr=()=>Promise.resolve(null);eo=()=>Qr().then(e=>e!=null&&e.emailFields?e:Promise.reject()),Ki=e=>eo().then(t=>t.takeInternalToken(e)),ji=e=>eo().then(t=>t.emailFields(e))});var Va={};Ln(Va,{applyPersonaAttributes:()=>dn,applyRegistrySlots:()=>gn,applySlotArms:()=>pn,applySlotAttributes:()=>fn,consentWatcher:()=>Qe,parseSnippetConfig:()=>an,planReorder:()=>hn,reapply:()=>Nt,run:()=>ri,version:()=>Ot});function jt(e){let t=(e||"").toLowerCase();if(!t.includes(".")||/^[\d.]+$|:/.test(t))return[];let n=t.split("."),r=[];for(let o=n.length-2;o>=0;o--)r.push(n.slice(o).join("."));return r}function Ge(e){return e?`_${e.slice(0,12)}`:""}var ze="_snt_uid";function vt(e){return`${ze}${Ge(e)}`}var Rn="__sntForgetGen",gi=()=>{try{return window[Rn]}catch(e){return}};function Gt(e){var t,n;try{let r=window,o=(t=r[Rn])!=null?t:r[Rn]={};o[e]=((n=o[e])!=null?n:0)+1}catch(r){}}function fe(e){var t,n;return(n=(t=gi())==null?void 0:t[e])!=null?n:0}var at="_snt_snap:",mi=["low","medium","high"];function st(e){try{let t=localStorage.getItem(at+e);if(!t)return null;let n=JSON.parse(t);if(!n||typeof n!="object"||n.v!==1||typeof n.persona!="string"||typeof n.band!="string"||!mi.includes(n.band)||typeof n.slots!="object"||n.slots===null||Array.isArray(n.slots)||!(n.layoutOrder===null||Array.isArray(n.layoutOrder))||typeof n.savedAt!="number"||!(Date.now()-n.savedAt<2592e6)||!(n.slotConfig===void 0||typeof n.slotConfig=="object"&&n.slotConfig!==null&&!Array.isArray(n.slotConfig)))return null;let r=n.vocabulary;return r!==void 0&&(typeof r!="object"||r===null||!Array.isArray(r.entries)||!Array.isArray(r.images))&&delete n.vocabulary,n.stage!==void 0&&typeof n.stage!="string"&&delete n.stage,n}catch(t){return null}}function Je(e,t){try{localStorage.setItem(at+e,JSON.stringify(t))}catch(n){}}function Fe(e){if(typeof AbortController!="function")return{clear:()=>{}};let t=new AbortController,n=setTimeout(()=>t.abort(),e);return{signal:t.signal,clear:()=>clearTimeout(n)}}function Ft(e,t){return new Promise(n=>{let r=setTimeout(()=>n(!1),t),o=()=>{clearTimeout(r),n(!0)};e.then(o,o)})}function qe(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function Ut(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 Lr(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 Nn(e,t,n){try{let r=(()=>{try{let a=localStorage.getItem(n);if(!a)return[];let s=JSON.parse(a);return Array.isArray(s)?s:[]}catch(a){return[]}})(),o=new Map;for(let a of r)o.set(a.id,a);for(let a of e)o.set(a.id,a);localStorage.setItem(n,JSON.stringify([...o.values()].slice(-t)))}catch(r){}}function Rr(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),a=r.filter(s=>!o.has(s.id));if(a.length===r.length)return;a.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(a))}catch(n){}}var hi=500,yi=56*1024;function Wt(e){return`_snt_retry_${e.slice(0,12)}`}var vi={push:()=>{},flush:()=>{},destroy:()=>{}};function Nr(e){var t,n,r;if(typeof window=="undefined")return vi;let o=(t=e.flushIntervalMs)!=null?t:5e3,a=(n=e.maxBatchSize)!=null?n:20,s=(r=e.maxRetrySize)!=null?r:100,c=e.ingestUrl,i=e.apiKey,l=Wt(i),u=!1,p=fe(i),v=(...C)=>{!u&&fe(i)===p&&Nn(...C)},b=[],S=new Set,w=[],K=C=>{for(let z of C)j.delete(z),!S.has(z)&&(S.add(z),w.push(z));for(;w.length>hi;){let z=w.shift();z&&S.delete(z)}Rr(C,l)},j=new Set,_=()=>{for(;b.length>s;){let C=b.shift();C&&j.delete(C.id)}},E=C=>{S.has(C.id)||j.has(C.id)||(j.add(C.id),b.push(C),_())},O=C=>{for(let z of C)S.has(z.id)||(j.add(z.id),b.push(z));_()},N=Lr(l,s);for(let C of N)E(C);let M=0,m=0,y=(C,z=!0)=>{if(C.length===0)return;let te=JSON.stringify(C),Ie=C.map(ce=>ce.id),ge,Z=Fe(15e3);try{ge=fetch(c,{method:"POST",keepalive:!0,signal:Z.signal,body:te,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`}})}catch(ce){v(C,s,l),O(C),m++,M=Date.now()+qe(m);return}Promise.resolve(ge).then(Z.clear,Z.clear);let Oe=ce=>{if(Ut(ce)!=="retry"){if(!ce.ok&&z){let ke=C.filter(me=>me.eventType!=="pageview");if(ke.length>0&&ke.length<C.length){K(C.filter(me=>me.eventType==="pageview").map(me=>me.id)),y(ke,!1);return}}K(Ie),m=0,M=0;return}v(C,s,l),O(C),m++,M=Date.now()+qe(m)};ge&&typeof ge.then=="function"?ge.then(Oe).catch(()=>{v(C,s,l),O(C),m++,M=Date.now()+qe(m)}):Oe(ge)},f=typeof TextEncoder!="undefined"?new TextEncoder:null,g=C=>f?f.encode(C).length:C.length,A=C=>{let z=[],te=2;for(let Ie of C){let ge=g(JSON.stringify(Ie))+1;if(z.length>0&&te+ge>yi||z.length>=a)break;z.push(Ie),te+=ge}return z},I=()=>{try{if(Date.now()<M)return;for(;b.length>0&&!(Date.now()<M);){let C=b.filter(te=>!S.has(te.id));if(b.length=0,C.length===0)break;let z=A(C);if(z.length===0)break;z.length<C.length&&b.push(...C.slice(z.length)),y(z)}}catch(C){}},F=!0,Y=null;Y=setInterval(()=>{F&&I()},o);let ne=()=>{document.visibilityState==="hidden"&&I()},_e=()=>{I()};return document.addEventListener("visibilitychange",ne),window.addEventListener("pagehide",_e),{push(C){E(C),b.length>=a&&I()},flush:I,destroy(C){C!=null&&C.forget&&(u=!0),F=!1,Y!==null&&(clearInterval(Y),Y=null),document.removeEventListener("visibilitychange",ne),window.removeEventListener("pagehide",_e),I()}}}var bi=200;function Vt(e){return`_snt_goal_retry_${e.slice(0,12)}`}var Si={send:()=>{},flush:()=>{},destroy:()=>{}};function Dr(e){var t,n,r;if(typeof window=="undefined")return Si;let o=(t=e.flushIntervalMs)!=null?t:5e3,a=(n=e.maxRetrySize)!=null?n:100,s=(r=e.maxPerFlush)!=null?r:5,c=Vt(e.apiKey),i=!1,l=fe(e.apiKey),u=(...g)=>{!i&&fe(e.apiKey)===l&&Nn(...g)},p=[],v=new Set,b=new Set,S=[],w=0,K=0,j=!1,_=g=>{for(v.delete(g.id),b.has(g.id)||(b.add(g.id),S.push(g.id));S.length>bi;){let A=S.shift();A&&b.delete(A)}Rr([g.id],c)},E=g=>{u([g],a,c),!b.has(g.id)&&!v.has(g.id)&&(v.add(g.id),p.push(g)),Date.now()>=w&&(K++,w=Date.now()+qe(K))},O=g=>{let A,I=Fe(15e3);try{A=fetch(e.url,{method:"POST",keepalive:!0,signal:I.signal,body:g.body,headers:e.headers})}catch(Y){E(g);return}let F=Y=>{var ne;let _e=Ut(Y);if(_e==="retry"){E(g);return}_e==="dropped"&&((ne=e.onDrop)==null||ne.call(e,g,Y.status)),_(g),K=0,w=0};Promise.resolve(A).then(I.clear,I.clear),A&&typeof A.then=="function"?A.then(F).catch(()=>E(g)):F(A)},N=()=>{try{if(j||Date.now()<w)return;let g=0;for(;p.length>0&&g<s&&!(Date.now()<w);){let A=p.shift();v.delete(A.id),!b.has(A.id)&&(g++,O(A))}}catch(g){}},M=Lr(c,a);for(let g of M)v.has(g.id)||(v.add(g.id),p.push(g));M.length>0&&Nn(M,a,c);let m=setInterval(N,o),y=()=>{document.visibilityState==="hidden"&&N()},f=()=>N();return document.addEventListener("visibilitychange",y),window.addEventListener("pagehide",f),{send(g){if(j){b.has(g.id)||u([g],a,c);return}if(!(b.has(g.id)||v.has(g.id))){if(Date.now()<w){u([g],a,c),v.add(g.id),p.push(g);return}O(g)}},flush:N,destroy(g){g!=null&&g.forget&&(i=!0),clearInterval(m),document.removeEventListener("visibilitychange",y),window.removeEventListener("pagehide",f),N(),j=!0}}}function lt(e){if(typeof window=="undefined"||!e)return!1;Gt(e);let t=!1,n=vt(e);try{if(new RegExp(`(?:^|; )${n}=`).test(document.cookie)){let s=location.protocol==="https:"?"; Secure":"";for(let c of["",...jt(location.hostname)])document.cookie=`${n}=; max-age=0; SameSite=lax; path=/${c?`; domain=${c}`:""}${s}`;t=!0}}catch(s){}let r=Ge(e),o=[n,"_snt_graph_edges",at+e,Wt(e),Vt(e),`_snt_graph_nodes${r}`],a=[`_snt_asgn${r}_`];for(let s of["localStorage","sessionStorage"])try{let c=window[s];for(let i of o)c.getItem(i)!==null&&(c.removeItem(i),t=!0);for(let i=c.length-1;i>=0;i--){let l=c.key(i);l&&a.some(u=>l.startsWith(u))&&(c.removeItem(l),t=!0)}}catch(c){}try{(new RegExp(`(?:^|; )${ze}=[^;]`).test(document.cookie)||localStorage.getItem(ze)!==null||sessionStorage.getItem(ze)!==null)&&localStorage.setItem(`${ze}_tomb${r}`,"1")}catch(s){}return t}function Mn(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch(e){}try{if(typeof crypto!="undefined"&&typeof crypto.getRandomValues=="function"){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,"0"),(n===3||n===5||n===7||n===9)&&(t+="-");return t}}catch(e){}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var Mr="_snt_uid",wi=365,ut="_snt_uid";function _i(){return Mn()}function ct(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function Br(){try{return location.protocol==="https:"?"; Secure":""}catch(e){return""}}function qt(e,t,n,r){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=lax; path=/${r?`; domain=${r}`:""}${Br()}`}catch(o){}}function Ht(e){try{return localStorage.getItem(e)}catch(t){return null}}function $r(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function Dn(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function ki(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function Ei(e){try{sessionStorage.removeItem(e)}catch(t){}}function xi(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=lax; path=/${Br()}`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function Ai(e){try{localStorage.removeItem(e)}catch(t){}}function zt(e,t){qt(e,"",0,t)}var Ci={getSessionId:()=>null,isEphemeral:()=>!1,domain:null,destroy:()=>{}};function Ii(e,t){if(e===!1)return null;if(typeof e=="string")return e.replace(/^\./,"");for(let n of jt(location.hostname))if(qt(t,"1",10,n),ct(t)==="1")return zt(t,n),n;return null}function $n(e){var t,n,r,o,a,s,c;if(typeof window=="undefined")return Ci;let i=Ge(e==null?void 0:e.apiKey),l=(t=e==null?void 0:e.cookieName)!=null?t:vt(e==null?void 0:e.apiKey),u=`${ut}${i}`,p=`${ut}_tomb${i}`,v=((n=e==null?void 0:e.cookieTTLDays)!=null?n:wi)*24*60*60,b=m=>m&&m.length>0?m:null,S=()=>{var m,y;return i&&!(e!=null&&e.cookieName)&&Ht(p)===null?(y=(m=b(ct(Mr)))!=null?m:b(Ht(ut)))!=null?y:b(Dn(ut)):null},w=Ii(e==null?void 0:e.cookieDomain,`${l}_dom`),K=b(ct(l)),j=w?(zt(l),b(ct(l))):null,_=(c=(s=(a=(o=(r=j!=null?j:K)!=null?r:b(Ht(u)))!=null?o:b(Dn(u)))!=null?a:S())!=null?s:b(e==null?void 0:e.ssrSessionId))!=null?c:_i();qt(l,_,v,w),w&&ct(l)!==_&&(w=null,qt(l,_,v));let E=$r(u,_),O=xi(l),N=E?!1:ki(u,_),M=!E&&!O&&!N;return{getSessionId:()=>_,isEphemeral:()=>M,domain:w,destroy:()=>{_=null,zt(l),zt(l,w),Ai(u),Ei(u),i&&!(e!=null&&e.cookieName)&&(ct(Mr)!==null||Ht(ut)!==null||Dn(ut)!==null)&&$r(p,"1")}}}Bn();function Jt(e){return Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("|")}function Gr(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 Kn(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 Jt(e.baseline);if(typeof e.baseline=="string")return e.baseline;let o={};for(let[a,s]of Object.entries((n=e.dims)!=null?n:{}))o[a]=(r=s[0])!=null?r:"";return Jt(o)}function Fr(e,t){var n,r;return e.dims!=null?(r=(n=Gr(t))!=null?n:Gr(Kn(e)))!=null?r:{}:t}function Ye(e){return e>=.3?e<.7?"medium":"high":"low"}var Ur=["new","browsing","carted","customer","lapsed"];var Ni=["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 Wr(e){return Di(e)!==null}function Di(e){var t;if(!e)return null;let n=e.toLowerCase();return(t=Ni.find(r=>n.includes(r.toLowerCase())))!=null?t:null}function Vr(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 Hr(e,t,n){if(!e)return"direct";try{let r=new URL(e);if(t)try{if(new URL(t).host===r.host)return"direct"}catch(a){}let o=r.hostname.toLowerCase();return n&&`.${o}`.endsWith(`.${n}`)?"direct":/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(o)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(o)?"social":"referral"}catch(r){return"direct"}}function zr(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var Mi=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function qr(e){let t={},n={};try{let r=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([o,a])=>{let s=Array.isArray(a)?a[0]:a;return s===void 0?[]:[[o,s]]});for(let[o,a]of r)o.startsWith("utm_")?o in t||(t[o]=a):Mi.includes(o)&&(o in n||(n[o]=a))}catch(r){}return{utmParams:t,clickIds:n}}function Jr(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function jn(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 Gn(e){let t=jn(e);return Fr(t,Kn(t))}function Yr(e){return typeof e=="string"?e:Jt(e)}Bn();var zn;function Qt(e){zn=typeof e=="string"&&e!==""?e:void 0}function io(e=document){if(zn)return zn;try{let t=e.querySelector("script[nonce]");return(t==null?void 0:t.nonce)||(t==null?void 0:t.getAttribute("nonce"))||void 0}catch(t){return}}function We(e,t=document){let n=io(t);return n&&e.setAttribute("nonce",n),e}var Gi=1800*1e3;function Yt(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function Fi(e=Gi,t){let n=new Map,r=`_snt_asgn${Ge(t)}_`,o=(i,l)=>`${r}${encodeURIComponent(i)}:${encodeURIComponent(l)}`,a=i=>{let l=i.slice(r.length),u=l.indexOf(":");if(u<0)return null;try{return{componentId:decodeURIComponent(l.slice(0,u)),segment:decodeURIComponent(l.slice(u+1))}}catch(p){return null}},s=()=>{try{let i=[];for(let l=0;l<localStorage.length;l++){let u=localStorage.key(l);u!=null&&u.startsWith(r)&&i.push(u)}return i}catch(i){return[]}},c=i=>i.assignedAt+(i.ttlMs&&i.ttlMs>0?i.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let i of s())try{let l=localStorage.getItem(i);if(!l)continue;let u=JSON.parse(l);if(c(u)){localStorage.removeItem(i);continue}let p=a(i);if(!p)continue;n.set(Yt(p.componentId,p.segment),u)}catch(l){}})(),{get(i,l){let u=n.get(Yt(i,l));return u?c(u)?(n.delete(Yt(i,l)),null):u:null},set(i,l,u){let p=Yt(i,l);n.set(p,u);try{localStorage.setItem(o(i,l),JSON.stringify(u))}catch(v){}},clear(){n.clear();for(let i of s())try{localStorage.removeItem(i)}catch(l){}}}}var qn="data-sentient-stage";function St(e,t){return!t||typeof e!="string"||!(e==="returning"||Ur.includes(e))?null:t!=="detailed"&&(e==="customer"||e==="lapsed")?"returning":e}function en(e,t=document){try{e?t.documentElement.setAttribute(qn,e):t.documentElement.removeAttribute(qn)}catch(n){}}var Jn="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",ao="[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.",no=!1,Xt=!1;function Ui(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function Wi(e){var t;let n=$n({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),r=(t=n.getSessionId())!=null?t:"local",o=Ui(),a=Promise.resolve().then(()=>(Zr(),Xr)).then(u=>{let p=u;return p.LOCAL_ENGINE_AVAILABLE?(no||(no=!0,console.info(ao)),p):(Xt||(Xt=!0,console.error(Jn)),null)}).catch(()=>(Xt||(Xt=!0,console.error(Jn)),null)),s=null,c={low:.15,medium:.5,high:.85},i=(()=>{var u;if(e.initialPersona)return $({},e.initialPersona);let p=st(e.apiKey||"local");return p?{persona:p.persona,confidence:(u=c[p.band])!=null?u:.15}:null})();function l(u){let p=document.documentElement;p.dataset.sentientPersona===void 0&&(p.dataset.sentientPersona=u.persona,p.dataset.sentientConfidence=Ye(u.confidence))}return{isLocal:!0,async decide(u){var p,v,b;let S=await a;if(!S)return null;let w=S.createLocalEngine({sessionId:r,forcedPersona:o}).decide(u);return s=Ue($({},w),{layoutOrder:(v=(p=w.layoutOrder)!=null?p:s==null?void 0:s.layoutOrder)!=null?v:null,slots:$($({},(b=s==null?void 0:s.slots)!=null?b:{}),w.slots)}),Je(e.apiKey||"local",{v:1,persona:s.persona,band:Ye(s.confidence),slots:s.slots,layoutOrder:s.layoutOrder,savedAt:Date.now()}),l(w),w},getSlotResult(u){var p,v,b;return(b=(v=s==null?void 0:s.slots[u])!=null?v:(p=e.initialSlots)==null?void 0:p[u])!=null?b:null},getSlotConfig(u){var p,v;return(v=(p=e.initialSlotConfig)==null?void 0:p[u])!=null?v:null},getSitePalette(){var u;return(u=e.initialPalette)!=null?u:null},reportSlots(){},getVisitorId:()=>null,getPersona(){let u=s!=null?s:i;return u?{persona:u.persona,confidence:u.confidence,band:Ye(u.confidence)}:null},async assign(u,p){var v;let b=await a;return!b||!p||p.length===0?p!=null&&p[0]?{variantId:p[0],assignmentTtlMs:0}:null:{variantId:(v=b.createLocalEngine({sessionId:r,forcedPersona:o}).decide({components:[{id:u,variantIds:p}]}).assignments[u])!=null?v:p[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>n.destroy()}}var tn=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function Wn(e){let t=e.split(/[?#]/)[0]||"/";return t.length>1?t.replace(/\/+$/,"")||"/":t}function Xn(e,t){if(e===void 0||!tn.test(e))return!1;if(e==="*")return!0;let n=Wn(t);if(e.endsWith("/*")){let r=Wn(e.slice(0,-2));return n.startsWith(r==="/"?"/":`${r}/`)&&n!==r}return n===Wn(e)}function Zn(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 wt(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(wt):!1}var ro="sentient-reveal",dt="sentient-revealed",so=240,Vn=!1;function Vi(e){if(Vn||e.getElementById(ro)){Vn=!0;return}let t=We(e.createElement("style"),e);t.id=ro,t.textContent=`@media (prefers-reduced-motion: no-preference){@keyframes ${dt}{from{opacity:.55;transform:translateY(2px)}to{opacity:1;transform:none}}.${dt}{animation:${dt} ${so}ms cubic-bezier(.2,.6,.2,1) both}}`,e.head.appendChild(t),Vn=!0}function Qn(e,t={}){var n;let r=(n=t.doc)!=null?n:typeof document!="undefined"?document:void 0;if(!r||!(e instanceof Element)||(t.arm!==void 0&&e.setAttribute("data-sentient-arm",t.arm),t.persona!==void 0&&e.setAttribute("data-sentient-persona",t.persona),t.previous!==void 0&&t.previous===e.textContent))return!1;Vi(r),e.classList.remove(dt),e.offsetWidth,e.classList.add(dt);let o=()=>{e.classList.remove(dt),e.removeEventListener("animationend",o)};return e.addEventListener("animationend",o),!0}function er(e,t,n,r){let o=[];{let a=!1,s=[],c=()=>{if(a)return;let i=Date.now();for(s.push(i);s.length>0&&i-s[0]>500;)s.shift();s.length>=3&&(a=!0,e("rage_click"))};t.addEventListener("click",c),o.push(()=>t.removeEventListener("click",c))}{let a=!1,s=c=>{if(a||!(c.target instanceof Node)||!t.contains(c.target)&&t!==c.target)return;a=!0;let i=typeof window!="undefined"?window.getSelection():null,l=i?i.toString().length:0;e("text_copy",{selectionLength:l})};document.addEventListener("copy",s),o.push(()=>document.removeEventListener("copy",s))}{let a=!1,s=!1,c=null,i=()=>{c!==null&&(clearTimeout(c),c=null)},l=()=>{a||!s||(i(),c=setTimeout(()=>{!a&&s&&(a=!0,e("scroll_hesitation"))},3e3))},u=()=>{i(),l()},p=b=>{for(let S of b)s=S.intersectionRatio>.3,s?l():i()},v=new IntersectionObserver(p,{threshold:[.3]});v.observe(t),window.addEventListener("scroll",u,{passive:!0}),o.push(()=>{v.disconnect(),window.removeEventListener("scroll",u),i()})}if((r==null?void 0:r.tabLoss)!==!1){let a=!1,s=n!=null?n:Date.now(),c=()=>{if(a||document.visibilityState!=="hidden")return;let i=Date.now()-s;i<15e3&&(a=!0,e("tab_loss",{timeOnPage:i}))};document.addEventListener("visibilitychange",c),o.push(()=>document.removeEventListener("visibilitychange",c))}return()=>{for(let a of o)a()}}function Hi(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var lo="https://api.sentient-ui.com/v1/events",oo=()=>Promise.resolve().then(()=>(Un(),to)),pe=new Map,uo=null;function zi(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var qi=3;function Hn(){return Mn()}function Zt(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function Ji(){let e=new WeakMap,t=new Map,n=!1,r=(c,i,l)=>{let u=c.get(i);return l===null?u?!0:(c.set(i,new Set),!1):u?u.has(l)?!0:(u.add(l),!1):(c.set(i,new Set([l])),!1)},o=typeof window!="undefined"&&"event"in window,a=()=>{if(!o)return;let c=window.event;return typeof Event=="function"&&c instanceof Event?c:void 0},s=()=>{if(o){Promise.resolve().then(()=>{n=!1,t.clear()});return}let c=!1,i=()=>{c||(c=!0,n=!1,t.clear())};if(setTimeout(i,0),typeof MessageChannel=="function"){let l=new MessageChannel;l.port1.onmessage=()=>{l.port1.close(),l.port2.close(),i()},l.port2.postMessage(0)}};return{firedBefore(c,i){let l=a();if(l){let p=e.get(l);return p||(p=new Map,e.set(l,p)),r(p,c,i)}let u=r(t,c,i);return!u&&!n&&(n=!0,s()),u}}}var co=new Set;function Yi(e,t,n){let r=typeof window=="undefined"?null:window.history;if(!r)return()=>{};let o=!1,a,s=()=>{if(o)return;let l=Zt();!l||l===a||(a=l,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${l}`))},c=[];for(let l of["pushState","replaceState"]){let u=r[l],p=function(...v){let b=u.apply(this,v);return s(),b};r[l]=p,c.push([l,u,p])}window.addEventListener("popstate",s);let i=Zt();return i&&co.has(`${t}:${i}`)?a=i:s(),()=>{if(!o){o=!0,window.removeEventListener("popstate",s);for(let[l,u,p]of c)r[l]===p&&(r[l]=u)}}}var bt={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getVisitorId:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}};function Xi(){try{return qr(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function fo(e){return e.replace(/\/events\/?$/,"")}function Xe(){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 tr(e){var t;if(typeof window=="undefined")return;let n=e!=null?e:uo;if(!n){console.warn("[sentient] grantConsent() called before init()");return}let r=pe.get(n);if(!r){console.warn("[sentient] grantConsent() called before init()");return}let{config:o,upgrade:a,reinit:s}=r;if(!a){r.upgradeBlockedReason&&console.warn(r.upgradeBlockedReason);return}if(o.respectDoNotTrack!==!1&&Xe())return;let c=(s!=null?s:_t)(Ue($({},o),{consent:!0}));a(c);let i=(t=pe.get(n))==null?void 0:t.dispose;pe.set(n,{config:Ue($({},o),{consent:!0}),upgrade:null,dispose:i})}function Zi(e,t){var n;let r=e.preConsentBehavior==="statistical_winner",o=fo((n=e.ingestUrl)!=null?n:lo),a={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},s=new Map,c=new Map,i={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(m,y,f){if(!r)return Promise.resolve(null);let g=s.get(m);return g?Promise.resolve(g):Yn(c,m,async()=>{try{let A=new URLSearchParams({componentId:m});for(let ne of y!=null?y:[])A.append("variantIds[]",ne);let I=Fe(5e3),F;try{let ne=await fetch(`${o}/winner?${A.toString()}`,{headers:a,signal:I.signal});if(!ne.ok)return y!=null&&y[0]?{variantId:y[0],assignmentTtlMs:0}:null;F=await ne.json()}finally{I.clear()}let Y={variantId:F.variantId,assignmentTtlMs:0};return s.set(m,Y),Y}catch(A){return y!=null&&y[0]?{variantId:y[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getVisitorId:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}},l=!1,u=new Set,p=[],v=[],b=[],S=()=>{for(let[,,m]of b.splice(0))m(null);w.length=0},w=[],K=!1,j=()=>{if(l)return;K=!0;let m=pe.get(e.apiKey);(m==null?void 0:m.upgrade)===M&&pe.set(e.apiKey,{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): client released before consent; call init() again"})},_=[],E=()=>{setTimeout(()=>{var m;try{(m=_.shift())==null||m(i)}catch(y){}_.length&&E()})},O=m=>{l?_.length?_.push(m):m(i):!t&&!K&&w.length<100?w.push(m):K&&e.debug&&console.warn("[sentient] goal dropped: client released")},N={get gated(){return!l&&!t},get released(){return K&&!l},takeHeld:()=>w.splice(0),track:m=>i.track(m),goal:((m,y,f,g)=>O(A=>A.goal(m,y,f,g))),componentGoal:(m,y,f)=>i.componentGoal(m,y,f),identify:(m,y)=>i.identify(m,y),getAssignment:(m,y)=>i.getAssignment(m,y),isUnified:m=>{var y,f;return(f=(y=i.isUnified)==null?void 0:y.call(i,m))!=null?f:!1},assign:(m,y,f,g,A)=>i.assign(m,y,f,g,A),decide:m=>l?i.decide(m):K||t?Promise.resolve(null):new Promise(y=>b.push([m,Re(),y])),getSlotResult:m=>i.getSlotResult(m),isSlotDecided:m=>{var y,f;return(f=(y=i.isSlotDecided)==null?void 0:y.call(i,m))!=null?f:!0},getSlotConfig:m=>i.getSlotConfig(m),getSitePalette:()=>i.getSitePalette(),getStyleVocabulary:()=>{var m,y;return(y=(m=i.getStyleVocabulary)==null?void 0:m.call(i))!=null?y:null},reportSlots:(m,y,f,g)=>i.reportSlots(m,y,f,g),reportSkeleton:(m,y)=>{var f;return(f=i.reportSkeleton)==null?void 0:f.call(i,m,y)},reportAgentData:(m,y,f)=>{var g;return(g=i.reportAgentData)==null?void 0:g.call(i,m,y,f)},reportDrift:(m,y,f,g)=>{var A;return(A=i.reportDrift)==null?void 0:A.call(i,m,y,f,g)},requestSlots:(m,y,f)=>{var g;return l?(g=i.requestSlots)==null?void 0:g.call(i,m,y,f):p.push([m,y,f])},decideSlots:m=>{var y;return l?(y=i.decideSlots)==null?void 0:y.call(i,m):v.push(...m)},cancelSlots:m=>{var y;if(l)return(y=i.cancelSlots)==null?void 0:y.call(i,m);let f=new Set(m);for(let g of p)g[0]=g[0].filter(A=>!f.has(A));v=v.filter(g=>!f.has(g.id))},onSlotsChanged:m=>(u.add(m),()=>{u.delete(m)}),getPersona:()=>i.getPersona(),getVisitorId:()=>{var m,y;return(y=(m=i.getVisitorId)==null?void 0:m.call(i))!=null?y:null},fetchWeights:()=>i.fetchWeights(),getGraph:()=>i.getGraph(),flush:()=>i.flush(),dispose:()=>(j(),S(),i.dispose()),destroy:()=>(j(),S(),l?i.destroy():lt(e.apiKey))};function M(m){var y,f,g;i=m,l=!0,w.length&&(_.push(...w.splice(0)),E());let A=Re();for(let[I,F,Y]of b.splice(0))F!==A?Y(null):m.decide(I).then(Y,()=>Y(null));(y=m.onSlotsChanged)==null||y.call(m,()=>u.forEach(I=>I()));for(let[I,F,Y]of p.splice(0))I.length>0&&((f=m.requestSlots)==null||f.call(m,I,F,Y));v.length>0&&((g=m.decideSlots)==null||g.call(m,v.splice(0)))}return{proxy:N,setInner:M}}function Re(){return typeof location=="undefined"?"":location.pathname+(/^#!?\//.test(location.hash)?location.hash:"")}function Yn(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 _t(e){var t,n,r,o,a,s,c,i,l,u,p;if(typeof window=="undefined")return bt;e.nonce&&Qt(e.nonce),uo=e.apiKey||"local";let v=pe.get(e.apiKey||"local");if(v!=null&&v.dispose)try{v.dispose()}catch(d){}let b=e.respectDoNotTrack!==!1&&Xe(),S=e.consent===!1||b,w=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!w&&e.localMode!==!1)return pe.set(e.apiKey||"local",{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): this client is keyless/local \u2014 there is no hosted client to upgrade to. Configure a pk_ API key to enable tracking."}),S?bt:Wi(e);if(S){if(!e.apiKey||!e.apiKey.startsWith("pk_"))return e.preConsentBehavior==="statistical_winner"&&console.warn("[sentient] init() called with an invalid apiKey \u2014 expected a pk_ public key. SDK disabled."),pe.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."}),bt;let{proxy:d,setInner:h}=Zi(e,b);return pe.set(e.apiKey,{config:e,upgrade:b?null:h}),d}if(!e.apiKey||!e.apiKey.startsWith("pk_"))return console.warn("[sentient] init() called with an invalid apiKey \u2014 expected a pk_ public key. SDK disabled."),bt;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),bt;let K=(t=e.ingestUrl)!=null?t:lo,j=Date.now(),_=$n({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey,cookieDomain:e.cookieDomain}),E={},O;try{/sentient_internal=/.test(location.search+document.cookie)&&(O=oo().then(async d=>{E.internalToken=await d.takeInternalToken(_.domain)||void 0}).catch(()=>{})),(typeof e.internal=="function"?e.internal():e.internal)===!0&&(E.internal=!0)}catch(d){}let N=Fi(void 0,e.apiKey),M=!1,m=fe(e.apiKey),y=()=>!M&&fe(e.apiKey)===m,f=new Set((n=e.initialUnified)!=null?n:[]),g=Ue($({},N),{get:(d,h)=>f.has(d)?null:N.get(d,h),set:(...d)=>{y()&&N.set(...d)}}),A=Nr({ingestUrl:K,apiKey:e.apiKey}),I=fo(K),F={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},Y=new Set,ne=Dr({url:`${I}/goals`,apiKey:e.apiKey,headers:F,onDrop:(d,h)=>{if(!e.debug){if(Y.has(h))return;Y.add(h)}console.warn(`[sentient] goal dropped (HTTP ${h}) \u2014 this will not be retried. `+(h===400?"The session was not found: call init() and let the session upsert complete before firing goals.":h===401||h===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),d)}}),_e=Vr((r=navigator.userAgent)!=null?r:""),C=window.location.origin,z=Hr((o=document.referrer)!=null?o:"",C,_.domain),te=(a=e.sessionSegment)!=null?a:`${_e}:${z}`,Ie=new Map,ge=new Map,Z=new Map,Oe=new Set,ce=new Map,ke=null,me=null,ie=null,yr=new Set,Dt=new Set,En=new Map,xn=new Map,vr=new Set,br=new Set,Sr=new Set,wr=new Set,An=null,gt=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,_r=new Set,Mt=new Set,$t=new Set,mt=new Map,Cn=null,Bt=new Set,ht=new Map,In=null,oi=2,kr=new Map,Ee=!1,Er=(d,h,P)=>{var U;let G=new Set,x=1;for(let T of d){h.delete(T);let L=((U=kr.get(T))!=null?U:0)+1;kr.set(T,L),L<=oi&&(G.add(T),L>x&&(x=L))}G.size>0&&setTimeout(()=>{Ee||P(G)},qe(x))},On=d=>{for(let h of d)Z.has(h.id)||Z.set(h.id,Gn(h))};if(e.initialSlots)for(let[d,h]of Object.entries(e.initialSlots))Z.set(d,h),Oe.add(d);if(e.initialSlotConfig)for(let[d,h]of Object.entries(e.initialSlotConfig))ce.set(d,h);e.initialPalette&&(ke=e.initialPalette),e.initialVocabulary&&(me=e.initialVocabulary);let Te=st(e.apiKey);if(Te){for(let[d,h]of Object.entries(Te.slots))Z.has(d)||Z.set(d,h);for(let[d,h]of Object.entries((s=Te.slotConfig)!=null?s:{}))ce.has(d)||ce.set(d,h);!ke&&Te.palette&&(ke=Te.palette),!me&&Te.vocabulary&&(me=Te.vocabulary)}let xr={low:.15,medium:.5,high:.85};if(e.initialPersona)ie=$({},e.initialPersona);else{let d=document.documentElement.dataset;d.sentientPersona?ie={persona:d.sentientPersona,confidence:(i=xr[(c=d.sentientConfidence)!=null?c:"low"])!=null?i:.15}:Te&&(ie={persona:Te.persona,confidence:(l=xr[Te.band])!=null?l:.15})}if(e.initialAssignments)for(let[d,h]of Object.entries(e.initialAssignments))g.set(d,te,{variantId:h,assignedAt:Date.now(),segment:te,confidence:1});let Ke=Promise.resolve(),Ar=_.getSessionId();if(Ar){let d=zr((u=document.referrer)!=null?u:""),{utmParams:h,clickIds:P}=Xi(),U=$($($($({sessionId:Ar,deviceClass:_e,trafficSource:z,referrerDomain:d,utmParams:h,clickIds:P,landingPath:typeof location!="undefined"?location.pathname:void 0,timeOfDay:Jr(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:_.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||Wr((p=navigator.userAgent)!=null?p:"")},e.userId?{userId:e.userId,userHash:e.userHash}:{}),e.persona?{persona:e.persona}:{}),e.country?{country:e.country}:{}),e.sdk?{sdk:e.sdk.name,sdkVersion:e.sdk.version}:{}),G=async()=>{O&&await Ft(O,2500);for(let x=0;;x++){if(Ee||!y())return;let T=Fe(5e3);try{let L=await fetch(`${I}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(Object.assign(U,E)),headers:F,signal:T.signal});if(L.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(L.ok||Ut(L)==="dropped")return}catch(L){}finally{T.clear()}if(x>=qi){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(L=>setTimeout(L,qe(x+1)))}};try{Ke=G()}catch(x){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:A});let ii=Ji(),yt=null,Tn=!1,ae={goal(d,h={},P=1,U=0){var G,x,T,L,V,H,q;let Q=_.getSessionId();if(!Q||Ee||!y())return;let B=zi(h)?h:{metadata:h},he=[d,(G=B.externalId)!=null?G:"",(x=B.stepIndex)!=null?x:U,(T=B.weight)!=null?T:P].join("\0"),xe=B.value!==void 0?`${B.value}\0${(L=B.currency)!=null?L:""}`:null;if(ii.firedBefore(he,xe)){e.debug&&console.log(`[sentient] goal("${d}") already recorded for this action \u2014 not sent twice`);return}let de=Hn(),se={sessionId:Q,name:d,metadata:(V=B.metadata)!=null?V:{},weight:(H=B.weight)!=null?H:P,stepIndex:(q=B.stepIndex)!=null?q:U,goalId:de,value:B.value,currency:B.currency,externalId:B.externalId};e.debug&&console.log("[sentient] goal",se);let D={id:de,body:JSON.stringify(se)};Ke.then(()=>ne.send(D))},componentGoal(d,h,P){var U,G,x;let T=_.getSessionId();if(!T||Ee||!y())return;let L=g.get(d,te),V=L?null:(U=Z.get(d))!=null?U:null;if(!L&&V===null){e.debug&&console.warn(`[sentient] componentGoal("${d}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}if(!L&&!Oe.has(d)){e.debug&&console.warn(`[sentient] componentGoal("${d}"): slot not decided this session \u2014 not attributed`);return}let H=L?L.variantId:Yr(V),q={id:Hn(),sessionId:T,projectId:e.apiKey,componentId:d,variantId:H,eventType:"goal_achieved",goalType:h,payload:$({reward:(G=P==null?void 0:P.reward)!=null?G:1,goalValue:P==null?void 0:P.value,currency:P==null?void 0:P.currency},(x=P==null?void 0:P.metadata)!=null?x:{}),timestamp:Date.now(),timeInSession:Date.now()-j,path:Zt()};e.debug&&console.log("[sentient] componentGoal",q),Ke.then(()=>{!Ee&&y()&&A.push(q)})},identify(d,h){let P=_.getSessionId();if(!P||Ee||!y())return;let U=(h==null?void 0:h.email)!==void 0?oo().then(G=>G.emailFields(h.email)).catch(()=>({})):{};Promise.all([Ke,U]).then(([,G])=>{fetch(`${I}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(Ue($($({sessionId:P,userId:d,userHash:h==null?void 0:h.userHash},G),E),{ephemeral:_.isEphemeral()})),headers:F}).catch(()=>{})})},track(d){let h=_.getSessionId();if(!h||Ee||!y()||d.eventType==="variant_assigned"&&Z.get(d.componentId)!==void 0&&!Oe.has(d.componentId)&&!g.get(d.componentId,te))return;let P=Ue($({path:Zt()},d),{id:Hn(),sessionId:h,timestamp:Date.now(),timeInSession:Date.now()-j});e.debug&&console.log("[sentient] track",P),Ke.then(()=>A.push(P))},getAssignment(d,h){return g.get(d,h)},isUnified:d=>f.has(d),async assign(d,h,P,U,G){var x;let T=_.getSessionId();if(!T)return null;let L=(G==null?void 0:G.unified)===!0;if(L&&f.has(d))return{variantId:(x=h==null?void 0:h[0])!=null?x:"",assignmentTtlMs:0,unified:!0};let V=g.get(d,te);if(V&&(h!=null&&h.length||V.content!==void 0)){let H=V.ttlMs&&V.ttlMs>0?Math.max(0,V.assignedAt+V.ttlMs-Date.now()):0;return{variantId:V.variantId,assignmentTtlMs:H,content:V.content}}return Yn(Ie,L?`${d}\0unified`:d,async()=>{if(!await Ft(Ke,2500)||Ee||!y())return null;let H=Fe(3e4);try{let q={sessionId:T,componentId:d,variantIds:h};U!==void 0?q.agentDataByVariant=U:P!==void 0&&(q.agentData=P),L&&(q.caps={unified:!0});let Q=await fetch(`${I}/assign`,{method:"POST",body:JSON.stringify(q),headers:F,signal:H.signal});if(!Q.ok)return null;let B=await Q.json();return B.unified===!0?L?(f.add(d),{variantId:B.variantId,assignmentTtlMs:0,unified:!0}):null:(g.set(d,te,$({variantId:B.variantId,assignedAt:Date.now(),segment:te,confidence:1,content:B.content},B.assignmentTtlMs&&B.assignmentTtlMs>0?{ttlMs:B.assignmentTtlMs}:{})),B)}catch(q){return null}finally{H.clear()}})},async decide(d){var h,P;let U=_.getSessionId();if(!U)return null;let G=(h=d.slots)!=null?h:[],x={sessionId:U};d.sections&&d.sections.length>0&&(x.sections=d.sections.map(L=>({id:L}))),x.components=(P=d.components)!=null?P:[],G.length>0&&(x.slots=G.map(jn)),d.slotsFrom==="registry"&&(x.slotsFrom="registry",d.registrySlotIds&&(x.registrySlotIds=d.registrySlotIds),d.bootstrap===!1&&(x.bootstrap=!1),d.render&&Object.keys(d.render).length>0&&(x.render=d.render)),d.v&&(x.v=d.v),typeof d.pp=="number"&&(x.pp=d.pp),e.persona&&(x.persona=e.persona),Object.assign(x,E);let T=JSON.stringify(x);return Yn(ge,T,async()=>{var L,V,H,q,Q,B,he,xe;if(!await Ft(Ke,2500)||Ee||!y())return On(G),null;let de=Fe(3e4);try{let se=await fetch(`${I}/decide`,{method:"POST",body:T,headers:F,signal:de.signal});if(!se.ok)return On(G),null;let D=await se.json(),Pe=St(D.stage,e.stageAttributes);e.stageAttributes&&en(Pe);let it={};for(let X of G){let Le=(L=D.slots)==null?void 0:L[X.id];if(Le!==void 0){it[X.id]=Le,Z.set(X.id,Le),Oe.add(X.id);continue}let Cr=Z.get(X.id);if(Cr!==void 0)it[X.id]=Cr;else{let Ir=Gn(X);it[X.id]=Ir,Z.set(X.id,Ir)}}if(D.slots)for(let[X,Le]of Object.entries(D.slots))X in it||(it[X]=Le,Z.set(X,Le),Oe.add(X));let ai=ie!=null&&ie.persona!=="unknown";D.persona&&!(D.persona==="unknown"&&ai)?ie={persona:D.persona,confidence:(V=D.confidence)!=null?V:0}:ie||(ie={persona:"unknown",confidence:0});for(let[X,Le]of Object.entries((H=D.assignments)!=null?H:{}))g.set(X,te,{variantId:Le,assignedAt:Date.now(),segment:te,confidence:1});if(D.slotConfig)for(let[X,Le]of Object.entries(D.slotConfig))ce.set(X,Le);D.palette&&(ke=D.palette),D.vocabulary&&(me=D.vocabulary);for(let X of(q=d.registrySlotIds)!=null?q:[])(Q=D.slotConfig)!=null&&Q[X]||(ce.delete(X),Z.delete(X),Oe.delete(X));return y()&&Je(e.apiKey,$($($($({v:1,persona:ie.persona,band:Ye(ie.confidence),slots:Object.fromEntries(Z),layoutOrder:(B=D.layoutOrder)!=null?B:null,savedAt:Date.now()},ce.size>0?{slotConfig:Object.fromEntries(ce)}:{}),ke?{palette:ke}:{}),me?{vocabulary:me}:{}),Pe?{stage:Pe}:{})),$($($($($($($({layoutOrder:(he=D.layoutOrder)!=null?he:null,assignments:(xe=D.assignments)!=null?xe:{},slots:it,persona:ie.persona,confidence:ie.confidence},D.slotConfig?{slotConfig:D.slotConfig}:{}),D.goals?{goals:D.goals}:{}),D.sectionMap?{sectionMap:D.sectionMap}:{}),D.palette?{palette:D.palette}:{}),D.vocabulary?{vocabulary:D.vocabulary}:{}),D.stage?{stage:D.stage}:{}),D.context?{context:D.context}:{})}catch(se){return On(G),null}finally{de.clear()}})},getSlotResult(d){var h;return(h=Z.get(d))!=null?h:null},isSlotDecided(d){return Oe.has(d)},getSlotConfig(d){var h;return(h=ce.get(d))!=null?h:null},reportSlots(d,h,P,U){var G;let x={};for(let[T,L]of Object.entries(U!=null?U:{}))for(let V of L){let H=`${T}|${V.key}`;!gt.test(T)||Sr.has(H)||(Sr.add(H),((G=x[T])!=null?G:x[T]=[]).push(V))}Object.keys(x).length>0&&fetch(`${I}/slots/observed`,{method:"POST",headers:F,body:JSON.stringify({slotIds:Object.keys(x),authoredArms:x})}).catch(()=>{});for(let T of d)if(!(typeof T!="string"||T.length===0)){if(!gt.test(T)){Hi()&&!_r.has(T)&&(_r.add(T),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(T)} will not register \u2014 ids must start with a letter or digit and contain only letters, digits, '_' or '-' (max 128 chars): /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.`));continue}if(!yr.has(T)){yr.add(T),Dt.add(T);let L=h==null?void 0:h[T];if(typeof L=="string"){let H=L.replace(/\s+/g," ").trim().slice(0,400);H!==""&&En.set(T,H)}let V=P==null?void 0:P[T];V!==void 0&&xn.set(T,V)}}Dt.size===0||An!=null||(An=setTimeout(()=>{An=null;let T=[...Dt];Dt.clear();for(let L=0;L<T.length;L+=20){let V=T.slice(L,L+20),H={},q={};for(let Q of V){let B=En.get(Q);B!==void 0&&(H[Q]=B,En.delete(Q));let he=xn.get(Q);he!==void 0&&(q[Q]=he,xn.delete(Q))}fetch(`${I}/slots/observed`,{method:"POST",headers:F,body:JSON.stringify($(Ue($($({slotIds:V},Object.keys(H).length>0?{baselineTexts:H}:{}),Object.keys(q).length>0?{baselineSkeletons:q}:{}),{pagePaths:Object.fromEntries(V.map(Q=>[Q,location.pathname]))}),Object.keys(H).length>0&&_.getSessionId()?{sessionId:_.getSessionId()}:{}))}).catch(()=>{})}},1e3))},reportSkeleton(d,h){!gt.test(d)||vr.has(d)||(vr.add(d),fetch(`${I}/slots/observed`,{method:"POST",headers:F,body:JSON.stringify({slotIds:[d],baselineSkeletons:{[d]:h}})}).catch(()=>{}))},reportAgentData(d,h,P){let U=`${d}|${h}`;!gt.test(d)||wr.has(U)||(wr.add(U),fetch(`${I}/slots/observed`,{method:"POST",headers:F,body:JSON.stringify($($({slotIds:[d],agentData:{[d]:{[h]:P}}},h.startsWith("authored.")?{authoredArms:{[d]:[{key:h.slice(9)}]}}:{}),_.getSessionId()?{sessionId:_.getSessionId()}:{}))}).catch(()=>{}))},reportDrift(d,h,P,U){let G=`${d}|${h}`,x=_.getSessionId();!x||br.has(G)||(br.add(G),fetch(`${I}/slots/drift`,{method:"POST",headers:F,body:JSON.stringify({sessionId:x,reports:[{slotId:d,expectedFp:h,observedFp:P,reason:U}]})}).catch(()=>{}))},requestSlots(d,h,P){var U,G;for(let x of d)$t.has(x)||($t.add(x),gt.test(x)?mt.set(x,{text:h==null?void 0:h[x],render:(U=P==null?void 0:P.render)==null?void 0:U[x],skeleton:(G=P==null?void 0:P.skeletons)==null?void 0:G[x]}):ae.reportSlots([x]));mt.size===0||Cn!=null||(Cn=setTimeout(()=>{Cn=null;let x=[...mt];mt.clear();for(let T=0;T<x.length;T+=50){let L=x.slice(T,T+50),V={};for(let[H,q]of L)q.render&&(V[H]=q.render);ae.decide({slotsFrom:"registry",registrySlotIds:L.map(([H])=>H),bootstrap:!1,render:V}).then(H=>{var q,Q;if(H){let B={},he={},xe=[];for(let[de,se]of L){let D=(q=H.slotConfig)==null?void 0:q[de];if(D){D.needsSkeleton&&se.skeleton&&((Q=ae.reportSkeleton)==null||Q.call(ae,de,se.skeleton));continue}xe.push(de),se.text&&(B[de]=se.text),se.skeleton&&(he[de]=se.skeleton)}xe.length>0&&ae.reportSlots(xe,B,he)}else Er(L.map(([B])=>B),$t,B=>{var he;let xe={},de={},se={};for(let[D,Pe]of L)B.has(D)&&(Pe.text&&(xe[D]=Pe.text),Pe.render&&(de[D]=Pe.render),Pe.skeleton&&(se[D]=Pe.skeleton));(he=ae.requestSlots)==null||he.call(ae,[...B],xe,{render:de,skeletons:se})});Mt.forEach(B=>B())})}},0))},decideSlots(d){for(let h of d)Bt.has(h.id)||(Bt.add(h.id),ht.set(h.id,h));ht.size===0||In!=null||(In=setTimeout(()=>{In=null;let h=[...ht.values()];ht.clear();for(let P=0;P<h.length;P+=30){let U=h.slice(P,P+30);ae.decide({slots:U}).then(G=>{G||Er(U.map(x=>x.id),Bt,x=>{var T;return(T=ae.decideSlots)==null?void 0:T.call(ae,U.filter(L=>x.has(L.id)))}),Mt.forEach(x=>x())})}},0))},cancelSlots(d){for(let h of d)mt.delete(h)&&$t.delete(h),ht.delete(h)&&Bt.delete(h)},onSlotsChanged(d){return Mt.add(d),()=>{Mt.delete(d)}},getStyleVocabulary(){return me},getSitePalette(){return ke},getVisitorId:()=>y()?_.getSessionId():null,getPersona(){return ie?{persona:ie.persona,confidence:ie.confidence,band:Ye(ie.confidence)}:null},async fetchWeights(){var d;let h=Fe(5e3);try{let P=await fetch(`${I}/weights`,{headers:F,signal:h.signal});return P.ok?(d=(await P.json()).components)!=null?d:[]:[]}catch(P){return[]}finally{h.clear()}},getGraph(){return{pageNodes:[],capturedAt:0}},flush(){A.flush(),ne.flush()},dispose(){var d;yt==null||yt(),Tn=!0,Ee=!0,A.destroy(),ne.destroy(),((d=pe.get(e.apiKey))==null?void 0:d.dispose)===ae.dispose&&pe.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var d;yt==null||yt(),Tn=!0,Ee=!0,M=!0,Gt(e.apiKey),A.destroy({forget:!0}),ne.destroy({forget:!0}),_.destroy(),g.clear(),((d=pe.get(e.apiKey))==null?void 0:d.dispose)===ae.dispose&&pe.delete(e.apiKey);try{localStorage.removeItem(at+e.apiKey),localStorage.removeItem(Wt(e.apiKey)),localStorage.removeItem(Vt(e.apiKey)),localStorage.removeItem(`_snt_graph_nodes${Ge(e.apiKey)}`),localStorage.removeItem("_snt_graph_edges")}catch(h){}e.debug&&console.log("[sentient] destroyed")}};if(pe.set(e.apiKey,{config:e,upgrade:null,dispose:ae.dispose}),yt=Yi(ae,e.apiKey,d=>{Ke.then(()=>{Tn||co.add(d)})}),e.debug){let d=window;d.__sentient&&(d.__sentient.client=ae)}return ae}var nr=/(^|\/)snippet(\.global)?(\.min)?\.js(\?|$)/,Qi=(()=>{var e,t;try{return(t=(e=document.currentScript)==null?void 0:e.src)!=null?t:""}catch(n){return""}})(),ea=/@\d+\.\d+\.\d+[^/]*\//;function rr(e){var t;try{let n=Qi||((t=Array.from(document.getElementsByTagName("script")).find(r=>nr.test(r.src)))==null?void 0:t.src);for(let r of n?[n]:[]){let o=nr.test(r)?r.replace(nr,`$1${e}$4`):r.replace(/[^/?#]*([?#].*)?$/,e),a=(e==="consent.global.js"?"sha384-+7/RqBOFLU5bMaQ6bcBAWzG589skmxN8tedG9hkoQQ6HaQkRRBJfoRVD94e/fJcM":e==="editor.global.js"?"sha384-J3kI3tXyTb3bunJ4b/FFo3I6RKE5hNb8YL0Y2BLFGyo4iiua9ZdnfKYbv77Pp9We":e==="preview.global.js"?"sha384-ykXMh3rcK4kzjOdF+hq3iE4YZUc5TpYw3WCosk79CSWBck3txIyXJ26dIubpIBR2":"sha384-lUCBY6UlFqdw1iuh1evba6WFLLWkf1idCimLbjsQakXElSeN5L63Ev4qHKaRfQdn")||"";return ea.test(o)&&a.indexOf("sha384-")===0?{src:o,integrity:a}:{src:o}}}catch(n){}return null}var nn=new Map;function Ze(e,t,n){let r=window[t];if(r)return Promise.resolve(r);let o=nn.get(e);return o||(o=new Promise(a=>{var i;let s=n?{src:n}:rr(e);if(!s)return a(null);let c=We(document.createElement("script"));or(c,s),c.async=!0,c.onload=()=>{var u;let l=(u=window[t])!=null?u:null;l||nn.delete(e),a(l)},c.onerror=()=>{nn.delete(e),a(null)},((i=document.head)!=null?i:document.documentElement).appendChild(c)}),nn.set(e,o)),o}function or(e,t){t.integrity&&(e.integrity=t.integrity,e.crossOrigin="anonymous"),e.src=t.src}var po="__sentientConsent",De=null,ir=!1,rn=new Set,ar=()=>{let e=window[po];return typeof(e==null?void 0:e.consentWatcher)=="function"?e.consentWatcher:null},kt;function go(e){kt=e}function ta(){De||(De=ar())||ir||(ir=!0,Ze("consent.global.js",po,kt).then(e=>{if(ir=!1,!e)return na(kt!=null?kt:"consent.global.js");if(De=ar(),De)for(let t of Array.from(rn))t()}))}function na(e){console.warn(`[sentient] could not load ${e} \u2014 tracking stays off. Set window.sentient.consentSrc to its URL.`)}function Qe(e){ta();let t=null,n=()=>(!t&&(De!=null?De:De=ar())&&(t=De(e)),t);return{read:()=>{var r,o;return(o=(r=n())==null?void 0:r.read())!=null?o:null},refused:()=>{var r,o;return(o=(r=n())==null?void 0:r.refused())!=null?o:!1},subscribe(r){let o,a=!1,s=()=>{rn.delete(s);let c=n();a||!c||(o=c.subscribe(r),r())};return n()?(o=t.subscribe(r),Promise.resolve().then(()=>{a||r()})):rn.add(s),()=>{a=!0,rn.delete(s),o==null||o()}}}}function ra(e){return e.replace(/\s+/g," ").trim().slice(0,300)}function mo(e,t){let n=t>>>0;for(let r=0;r<e.length;r++)n^=e.charCodeAt(r),n=Math.imul(n,16777619)>>>0;return n.toString(16).padStart(8,"0")}function oa(e){let t=e.join("");return mo(t,2166136261)+mo(t,1523705862)}var ia=new Set(["A","BUTTON"]),aa=/^H([1-6])$/,sa=new Set(["P","LI","LABEL","BLOCKQUOTE","FIGCAPTION","DT","DD","TD","TH"]);var la=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"]);function ua(e){return ia.has(e.tagName)||e.getAttribute("role")==="button"?!0:e.tagName==="INPUT"&&/^(submit|button)$/i.test(e.type)}function ca(e){if(aa.test(e.tagName)||sa.has(e.tagName))return!0;let t=e.ownerDocument.defaultView,n=t?t.getComputedStyle(e).display:"";return n!==""&&n!=="inline"&&n!=="contents"}function da(e,t){let n=null;for(let r=e.parentElement;r&&r!==t.parentElement;r=r.parentElement){if(ua(r)){n=r;break}if(r===t)break}if(n)return n;for(let r=e.parentElement;r;r=r.parentElement)if(r===t||ca(r))return r;return t}function on(e,t=40){var n,r,o;let a=e.ownerDocument.createTreeWalker(e,4),s=[];for(let u=a.nextNode();u;u=a.nextNode())if(((n=u.nodeValue)!=null?n:"").trim()!==""&&!la.has((o=(r=u.parentElement)==null?void 0:r.tagName)!=null?o:"")&&(s.push(u),s.length>120))return{reason:"too_large"};if(s.length===0)return{reason:"empty"};let c=[],i=[];for(let u of s){let p=da(u,e),v=c.indexOf(p);v===-1&&(c.push(p),v=c.length-1),i.push(v)}if(c.length>t)return{reason:"too_large"};let l=s.map(u=>{var p;return ra((p=u.nodeValue)!=null?p:"")});return{textNodes:s,ownerEls:c,leafToNode:i,leaves:l,fp:oa(l)}}var ho=["cookiebot","onetrust","cookieyes","tcf","google-consent-mode","shopify"];function fa(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(a=>typeof a=="string")||/[=|]/.test(r)||o.some(a=>/[=|]/.test(a)))return null;n[r]=o}return n}function pa(e){return!Array.isArray(e)||e.length<2||e.length>12||!e.every(t=>typeof t=="string")?null:e}function sr(e){try{return e()}catch(t){return}}function an(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={};if(typeof t.slots=="object"&&t.slots!==null&&!Array.isArray(t.slots))for(let[l,u]of Object.entries(t.slots)){if(typeof u!="object"||u===null)continue;let p=u,v=fa(p.dims);if(!v||p.target!==void 0&&typeof p.target!="string")continue;let b=p.arms!==void 0?pa(p.arms):null,S={dims:v};typeof p.target=="string"&&(S.target=p.target),b&&(S.arms=b),n[l]=S}let r={apiKey:t.apiKey,personaAttributes:t.personaAttributes===!0,slots:n};typeof t.consent=="boolean"?r.consent=t.consent:t.consent!==void 0&&a("consent");let o=t.consentFrom;if(typeof o=="string"&&ho.includes(o))r.consentFrom=o;else if(o&&typeof o=="object"&&!Array.isArray(o)){let l=o;typeof l.cmp=="string"&&ho.includes(l.cmp)||l.cmp===void 0&&(typeof l.cookie=="string"||typeof l.check=="function")?r.consentFrom=l:a("consentFrom")}else o!==void 0&&a("consentFrom");function a(l){r.consent=!1,console.warn(`[sentient] invalid ${l} \u2014 tracking stays OFF until it is fixed (sentient-ui.com/docs#consent).`)}(t.preConsentBehavior==="statistical_winner"||t.preConsentBehavior==="control")&&(r.preConsentBehavior=t.preConsentBehavior),t.debug===!0&&(r.debug=!0),(t.stageAttributes===!0||t.stageAttributes==="detailed")&&(r.stageAttributes=t.stageAttributes),typeof t.registry=="boolean"&&(r.registry=t.registry),typeof t.editorSrc=="string"&&(r.editorSrc=t.editorSrc),typeof t.consentSrc=="string"&&(r.consentSrc=t.consentSrc),typeof t.nonce=="string"&&t.nonce!==""&&(r.nonce=t.nonce),typeof t.apiBase=="string"&&(r.apiBase=t.apiBase),typeof t.sectionCapture=="boolean"&&(r.sectionCapture=t.sectionCapture);let s=typeof t.persona=="function"?sr(t.persona):t.persona;typeof s=="string"&&s.trim()!==""&&(r.persona=s);let c=typeof t.userId=="function"?sr(t.userId):t.userId,i=typeof c=="number"||typeof c=="string"?String(c).trim():"";if(i&&i.length<=256&&!i.includes("@")&&(r.userId=i,typeof t.userHash=="string"&&t.userHash&&(r.userHash=t.userHash)),(typeof t.internal=="function"?sr(t.internal):t.internal)===!0&&(r.internal=!0),Array.isArray(t.sections)){let l=t.sections.filter(u=>typeof u=="string"&&u.trim()!=="").slice(0,50);l.length>=2&&(r.sections=l)}return r}var yo=new WeakMap;function vo(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function bo(e,t,n){var a,s,c;let r=yo.get(e);if(r){if(r.fp!==n.fp||!vo(r.leafToNode,n.leafToNode))return"mismatch"}else{let i=on(e);if(!("fp"in i)||(r={fp:i.fp,leafToNode:i.leafToNode,textNodes:i.textNodes,ownerEls:i.ownerEls,classes:i.ownerEls.map(l=>{var u;return(u=l.getAttribute("class"))!=null?u:""})},r.fp!==n.fp||!vo(r.leafToNode,n.leafToNode)))return"mismatch";yo.set(e,r)}let o=r;for(let[i,l]of Object.entries(t.nodes)){let u=Number(i),p=o.ownerEls[u];if(p){if(typeof l.text=="string"){let v=!0;o.leafToNode.forEach((b,S)=>{b===u&&(o.textNodes[S].nodeValue=v?l.text:"",v=!1)})}l.like!==void 0&&o.classes[l.like]!==void 0&&p.setAttribute("class",o.classes[l.like]),l.hidden&&((a=p.style)==null||a.setProperty("display","none","important"))}}for(let i of Object.values((s=t.order)!=null?s:{})){let l=i.map(S=>o.ownerEls[S]).filter(S=>!!S),u=(c=l[0])==null?void 0:c.parentElement;if(!u||l.length!==i.length||l.some(S=>S.parentElement!==u))continue;let p=new Set(l),v=0;Array.from(u.children).map(S=>p.has(S)?l[v++]:S).forEach((S,w)=>{var K;u.children[w]!==S&&u.insertBefore(S,(K=u.children[w])!=null?K:null)})}return"applied"}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 ga(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 sn(e,t){return!!(e!=null&&e.urlMatch)&&!Et(t).includes(e.urlMatch)}var ma=/^[a-zA-Z_][-a-zA-Z0-9_]*$/;function So(e,t){var r;let n=[];if(e.id){let o=t.getElementById(e.id);n=o?[o]:[]}if(n.length===0&&((r=e.dataAttr)!=null&&r.name)&&ma.test(e.dataAttr.name))try{let o=e.dataAttr.value.replace(/["\\]/g,"\\$&");n=Array.from(t.querySelectorAll(`[${e.dataAttr.name}="${o}"]`))}catch(o){n=[]}if(n.length===0&&e.selector)try{n=Array.from(t.querySelectorAll(e.selector))}catch(o){n=[]}return n}function Ne(e,t){if(e.urlMatch&&!Et(t).includes(e.urlMatch))return null;let n=So(e,t);if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!ga(r,e.fingerprint)?null:r}function wo(e,t){return sn(e,t)?!1:!!e.selector&&!e.dataAttr&&!e.id&&!e.fingerprint&&e.page===void 0?_o(e,t):Ne(e,t)!==null}function _o(e,t){return So(e,t).length>0}function ln(e,t){return sn(e,t)?!1:e.page!==void 0&&tn.test(e.page)?Xn(e.page,Et(t)):_o(e,t)}var ko={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"},ha=/^(rgb|rgba|hsl|hsla|calc|var|min|max|clamp)$/i;function Eo(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(!ha.test((r=n[1])!=null?r:""))return!1;return!0}function ya(e){var r,o;let t=e.ownerDocument.createTreeWalker(e,4),n=null;for(let a=t.nextNode();a!==null;a=t.nextNode()){if(((r=a.nodeValue)!=null?r:"").trim()==="")continue;let s=(o=a.parentElement)==null?void 0:o.tagName;if(!(s==="SCRIPT"||s==="STYLE"||s==="TEMPLATE")){if(n!==null)return null;n=a}}return n}function xt(e,t){let n=ya(e);n!==null?n.nodeValue=t:e.textContent=t}var lr=/^https:\/\//i;function un(e){return typeof e=="string"&&!/[\s\x00-\x1f\\]/.test(e)&&(lr.test(e)||e[0]==="/"&&e[1]!=="/")?e:null}var xo=new Map,Ve=null;function va(e){return e.replace(/["\\]/g,"\\$&")}function ba(e){var t;(!Ve||!Ve.isConnected)&&(Ve=e.querySelector("style[data-sentient-ops]"),Ve||(Ve=We(e.createElement("style"),e),Ve.setAttribute("data-sentient-ops",""),((t=e.head)!=null?t:e.documentElement).appendChild(Ve))),Ve.textContent=[...xo.entries()].map(([n,r])=>`[data-snt-e="${va(n)}"]{${r}}`).join(`
2
+ `)}function Ao(e,t,n,r){var c;let o=!1,a=(c=t.moveBefore)!=null?c:t.moveAfter;if(a){let i=Ne(a,r);!i||i===e||i.parentElement!==e.parentElement||!e.parentElement?o=!0:t.moveBefore?e.parentElement.insertBefore(e,i):e.parentElement.insertBefore(e,i.nextSibling)}typeof t.text=="string"&&xt(e,t.text),typeof t.href=="string"&&lr.test(t.href)&&e.setAttribute("href",t.href),typeof t.imageSrc=="string"&&lr.test(t.imageSrc)&&e.setAttribute("src",t.imageSrc),typeof t.imageAlt=="string"&&e.setAttribute("alt",t.imageAlt);let s=[];if(t.hidden&&s.push("display:none !important"),t.style)for(let[i,l]of Object.entries(t.style)){let u=ko[i];u&&typeof l=="string"&&Eo(l)&&s.push(`${u}:${l.trim()} !important`)}return s.length>0&&(e.setAttribute("data-snt-e",n),xo.set(n,s.join(";")),ba(r)),{anchorMiss:o}}var At="data-sentient-block-arm",R=null;function Ct(e){R=e!=null?e:null}var et=null;function It(e){et=e!=null?e:null}var To=e=>{var t;return typeof e=="string"?(t=et==null?void 0:et.entries.find(n=>n.id===e))==null?void 0:t.classes:void 0},Po=e=>{let t=typeof e=="string"?et==null?void 0:et.entries.find(n=>n.id===e):void 0;return t!=null&&t.computed.inheritsColor?t.computed.color:void 0},Me="data-sentient-blocks-hid",ft={none:"0",sm:"8px",md:"16px",lg:"24px"},ur={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},Co={sm:"0.875em",md:"1em",lg:"1.25em"},Sa={sm:"1.25em",md:"1.5em",lg:"2em"},wa={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},Io={sm:"8px",md:"16px",lg:"32px"},_a={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},ka={normal:"400",medium:"500",bold:"700"};function ye(e,t){for(let[n,r]of Object.entries(t))r!==void 0&&e.style.setProperty(n,r);return e}function Oo(e){return e==="muted"?R!=null&&R.muted?{color:R.muted}:{opacity:"0.7"}:e==="accent"?{"font-weight":"600",color:R==null?void 0:R.accent}:{}}function Lo(e,t){let n=Ea(e,t),r=Po(e.like);return n&&r&&(n.style.color=r),n}function Ea(e,t){var n,r,o,a,s,c,i,l,u,p,v,b,S,w,K,j,_,E,O,N;try{let M=To(e.like),m=e.maxWidth==="measure"?"65ch":void 0,y=f=>(f.className=M,ye(f,{"max-width":m}));switch(e.type){case"stack":case"grid":{let f=t.createElement("div");if(e.type==="stack"){let I=e;ye(f,{display:"flex","flex-direction":I.direction,gap:(r=ft[(n=I.gap)!=null?n:"md"])!=null?r:ft.md,"align-items":I.align?ur[I.align]:void 0,"justify-content":I.justify?ur[I.justify]:void 0,"flex-wrap":I.wrap?"wrap":void 0})}else{let I=e,F=(a=ft[(o=I.gap)!=null?o:"md"])!=null?a:ft.md;ye(f,{display:"grid","grid-template-columns":`repeat(auto-fit, minmax(max(200px, calc((100% - ${I.columns-1} * ${F}) / ${I.columns})), 1fr))`,gap:F,"align-items":I.align?ur[I.align]:void 0})}M&&(f.className=M);let g=!M&&e.type==="stack"&&e.surface==="raised",A=(s=e.pad)!=null?s:g?"md":void 0;A&&ye(f,{padding:(c=ft[A])!=null?c:ft.md}),g&&ye(f,{background:R==null?void 0:R.surface,color:R!=null&&R.surface?R==null?void 0:R.surfaceText:void 0,border:`1px solid ${(i=R==null?void 0:R.border)!=null?i:"currentColor"}`,"border-radius":(l=R==null?void 0:R.radius)!=null?l:"8px"});for(let I of(u=e.children)!=null?u:[]){let F=Lo(I,t);F&&f.appendChild(F)}return f}case"text":{let f=t.createElement("p");return f.textContent=e.value,M?y(f):ye(f,je(W({margin:"0","font-size":e.size?Co[e.size]:void 0,"font-weight":e.weight?ka[e.weight]:void 0,"text-align":e.align},Oo(e.tone)),{"max-width":e.maxWidth==="measure"?"65ch":void 0}))}case"heading":{let f=t.createElement(`h${e.level}`);return f.textContent=e.value,M?y(f):ye(f,{margin:"0","font-size":Sa[(p=e.size)!=null?p:"md"],"text-align":e.align,"max-width":e.maxWidth==="measure"?"65ch":void 0})}case"button":{let f=t.createElement("a");f.textContent=e.label;let g=un(e.href);if(g&&(f.href=g),e.tag&&f.setAttribute("data-sentient-tag",e.tag),M)return y(f);let A=(v=e.emphasis)!=null?v:"primary";return ye(f,{display:"inline-block",padding:wa[(b=e.size)!=null?b:"md"],"border-radius":(S=R==null?void 0:R.radius)!=null?S:"8px",font:"inherit","font-size":e.size?Co[e.size]:void 0,"text-decoration":A==="ghost"?"underline":"none",cursor:"pointer",background:A==="primary"?(w=R==null?void 0:R.primaryBg)!=null?w:"#111827":"transparent",color:A==="primary"?(K=R==null?void 0:R.primaryText)!=null?K:"#ffffff":(j=R==null?void 0:R.accent)!=null?j:"inherit",border:A==="secondary"?`1px solid ${(_=R==null?void 0:R.accent)!=null?_:"currentColor"}`:"none"})}case"link":{let f=t.createElement("a");f.textContent=e.label;let g=un(e.href);return g&&(f.href=g),e.tag&&f.setAttribute("data-sentient-tag",e.tag),M?y(f):ye(f,{color:"inherit","text-decoration":"underline"})}case"image":{let f=t.createElement("img"),g=un(e.src);return g&&(f.src=g),f.alt=e.alt,M&&(f.className=M),ye(f,{display:"block","max-width":"100%","aspect-ratio":e.ratio&&e.ratio!=="auto"?_a[e.ratio]:void 0,"object-fit":e.fit,width:e.ratio&&e.ratio!=="auto"?"100%":void 0})}case"badge":{let f=t.createElement("span");return f.textContent=e.value,M?y(f):ye(f,W({display:"inline-block",padding:"2px 10px","border-radius":"999px","font-size":"0.75em",border:`1px solid ${(E=R==null?void 0:R.border)!=null?E:"currentColor"}`},Oo(e.tone)))}case"spacer":return ye(t.createElement("div"),{height:(O=Io[e.size])!=null?O:Io.md});case"divider":return ye(t.createElement("hr"),{border:"none","border-top":`1px solid ${(N=R==null?void 0:R.border)!=null?N:"currentColor"}`,margin:"0",width:"100%"});default:return null}}catch(M){return null}}function Ro(e,t,n,r){var o,a;try{let s=new Set;for(let i of Array.from(e.children)){let l=i.getAttribute(At);l!==null&&(t[l]===void 0?i.remove():s.add(l))}for(let[i,l]of Object.entries(t)){if(s.has(i))continue;let u="tree"in l?l:null,p=Lo(u?u.tree:l,r);if(!p)continue;let v=r.createElement("div");v.setAttribute(At,i),v.style.display="none";let b=u?To((o=u.surface)==null?void 0:o.like):void 0;if(b){let S=r.createElement("div");S.className=b;let w=Po((a=u.surface)==null?void 0:a.like);w&&(S.style.color=w),S.appendChild(p),v.appendChild(S)}else v.appendChild(p);e.appendChild(v)}let c=n!==void 0&&t[n]!==void 0;for(let i of Array.from(e.children)){let l=i.getAttribute(At),u=i;l!==null?u.style.display=c&&l===n?"":"none":c?u.hasAttribute(Me)||(u.setAttribute(Me,u.style.display),u.style.display="none"):u.hasAttribute(Me)&&(u.style.display=u.getAttribute(Me),u.removeAttribute(Me))}}catch(s){}}function xa(e){try{for(let t of Array.from(e.children)){let n=t;if(n.getAttribute(At)!==null){n.remove();continue}n.hasAttribute(Me)&&(n.style.display=n.getAttribute(Me),n.removeAttribute(Me))}}catch(t){}}function cn(e,t){try{let n=new Set;for(let r of Array.from(e.querySelectorAll(`[${At}]`)))r.parentElement&&n.add(r.parentElement);for(let r of Array.from(e.querySelectorAll(`[${Me}]`)))r.parentElement&&n.add(r.parentElement);for(let r of n)t.has(r)||xa(r)}catch(n){}}function cr(e,t){if(!e)return[t.documentElement];try{return Array.from(t.querySelectorAll(e))}catch(n){return[]}}function dn(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 fn(e,t,n,r){var o;for(let[a,s]of Object.entries(t)){let c=e[a];if(!c||typeof c=="string")continue;let i=cr(s.target,n);for(let l of i)for(let[u,p]of Object.entries(c))(o=s.dims[u])!=null&&o.includes(p)&&(l.setAttribute(`data-${u}`,p),r==null||r(l,`data-${u}`))}}function pn(e,t,n,r){for(let[o,a]of Object.entries(t)){let s=e[o];if(typeof s!="string"||!a.arms||!a.arms.includes(s))continue;let c=cr(a.target,n);for(let i of c)i.setAttribute("data-sentient-arm",s),r==null||r(i,"data-sentient-arm")}}function gn(e,t,n,r){var c,i,l,u,p,v,b;let o=new Set,a=(c=r==null?void 0:r.contentAndOps)!=null?c:!0,s=[];for(let[S,w]of Object.entries(t)){if(sn(w.locator,n))continue;let K;if(w.locator){let _=Ne(w.locator,n);K=_?[_]:[],!_&&ln(w.locator,n)&&s.push(S)}else K=cr(w.target,n);let j=e[S];for(let _ of K){if(j!==void 0)if(typeof j=="string")_.setAttribute("data-sentient-arm",j),(i=r==null?void 0:r.onAttr)==null||i.call(r,_,"data-sentient-arm"),a&&((l=r==null?void 0:r.onApplied)==null||l.call(r,S,j,_));else for(let[O,N]of Object.entries(j))_.setAttribute(`data-${O}`,N),(u=r==null?void 0:r.onAttr)==null||u.call(r,_,`data-${O}`);if((w.blocks||w.compose)&&!Ca(n)){let O=Object.fromEntries([...Object.entries((p=w.blocks)!=null?p:{}).filter(([,N])=>!wt(N)),...Object.entries((v=w.compose)!=null?v:{}).filter(([,N])=>!wt(N.tree))]);Object.keys(O).length>0&&(Ro(_,O,typeof j=="string"?j:void 0,n),o.add(_))}if(!a)continue;let E=_.textContent;w.edits?bo(_,w.edits.edits,w.edits)==="mismatch"&&((b=r==null?void 0:r.onDrift)==null||b.call(r,S,w.edits.fp)):typeof w.content=="string"&&xt(_,w.content),w.ops&&Ao(_,w.ops,S,n).anchorMiss&&!s.includes(S)&&s.push(S),Qn(_,je(W(W({previous:E},typeof j=="string"?{arm:j}:{}),(r==null?void 0:r.persona)!==void 0?{persona:r.persona}:{}),{doc:n}))}}return cn(n,o),s}var Aa=/bot|crawler|spider|crawling|googlebot|bingbot|duckduckbot|baiduspider|yandexbot|slurp|gptbot|claudebot|anthropic|perplexity|ccbot|applebot|headlesschrome/i;function Ca(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:Aa.test((r=o.userAgent)!=null?r:""):!1}catch(o){return!1}}var Ia=800;function mn(e,t,n){let r=[];return n.forEach(({slotId:o,arm:a,el:s},c)=>{r.push(er((v,b={})=>{try{e.track({projectId:t,componentId:o,variantId:a,eventType:"micro_signal",payload:W({signalType:v},b)})}catch(S){}},s,void 0,{tabLoss:c===0}));let i=null,l=0,u=()=>{l=Date.now(),i=setTimeout(()=>{try{e.track({projectId:t,componentId:o,variantId:a,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-l}})}catch(v){}i=null},Ia)},p=()=>{i!==null&&(clearTimeout(i),i=null)};s.addEventListener("mouseenter",u),s.addEventListener("mouseleave",p),r.push(()=>{s.removeEventListener("mouseenter",u),s.removeEventListener("mouseleave",p),i!==null&&clearTimeout(i)})}),()=>{for(let o of r)o()}}function Do(e){return e?`_snt_fired_goals_${e.slice(0,12)}`:"_snt_fired_goals"}var Oa="_snt_fired_goals";function dr(e,t){try{e==null||e.sessionStorage.removeItem(Do(t)),e==null||e.sessionStorage.removeItem(Oa)}catch(n){}}function No(e){var t;return[(t=e.slotId)!=null?t:"",e.goalId,e.event,e.locator?JSON.stringify(e.locator):""].join("|")}function Ta(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 Pa(e,t,n){try{e==null||e.sessionStorage.setItem(t,JSON.stringify([...n]))}catch(r){}}function Mo(e,t,n,r){var j,_;let o=(j=n.defaultView)!=null?j:typeof window!="undefined"?window:null,a=Do(r),s=Ta(o,a),c=E=>{let O=No(E);if(!s.has(O))try{E.slotId?t.componentGoal(E.slotId,E.goalId):t.goal(E.goalId),s.add(O),Pa(o,a,s)}catch(N){}},i=e.filter(E=>E.event==="click"),l=e.filter(E=>E.event==="form_submit"),u=e.filter(E=>E.event==="url_reached"),p=e.filter(E=>E.event==="scroll_depth"),v=(E,O)=>{if(!E.locator)return!1;let N=Ne(E.locator,n);return!!N&&(N===O||N.contains(O))},b=E=>{let O=E.target;if(!(!O||typeof O.closest!="function"))for(let N of i)v(N,O)&&c(N)},S=E=>{let O=E.target;if(O)for(let N of l)v(N,O)&&c(N)},w=()=>{if(u.length===0)return;let E=Et(n);for(let O of u)O.urlPattern&&Zn(O.urlPattern,E)&&c(O)},K=()=>{var N;let E=n.documentElement,O=E.scrollHeight>0?(E.scrollTop+E.clientHeight)/E.scrollHeight:0;for(let M of p)O>=((N=M.threshold)!=null?N:.75)&&c(M);p.every(M=>s.has(No(M)))&&n.removeEventListener("scroll",K)};return n.addEventListener("click",b,!0),n.addEventListener("submit",S,!0),(_=n.defaultView)==null||_.addEventListener("popstate",w),w(),p.length>0&&(n.addEventListener("scroll",K,{passive:!0}),K()),{checkUrl:w,teardown:()=>{var E;n.removeEventListener("click",b,!0),n.removeEventListener("submit",S,!0),(E=n.defaultView)==null||E.removeEventListener("popstate",w),p.length>0&&n.removeEventListener("scroll",K)}}}function hn(e,t){if(!e||e.length<2||t.size!==e.length)return null;let n=[];for(let s of e){let c=t.get(s);if(!c||n.includes(c))return null;n.push(c)}let r=n[0].parentNode;if(!r||!n.every(s=>s.parentNode===r))return null;let o=n.slice().sort((s,c)=>s.compareDocumentPosition(c)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),a=[];for(let s=0;s<n.length;s++){let c=n[s];o[s]!==c&&(a.push({el:c,before:o[s]}),o.splice(o.indexOf(c),1),o.splice(s,0,c))}return a}var La="__snt_editor_token";function $o(){try{return typeof sessionStorage!="undefined"?sessionStorage.getItem(La):null}catch(e){return null}}function Bo(e){let t=null;try{let n=location.hash.slice(1),r=RegExp("(^|[?&])"+e+"=([^&]*)").exec(n);if(r){t=r[2];let o=n.slice(r.index+r[0].length);r[1]!="&"&&o[0]=="&"&&(o=r[1]+o.slice(1));let a=n.slice(0,r.index)+o;history.replaceState(history.state,"",a?"#"+a:location.pathname+location.search)}}catch(n){}return t}Un();Fn(()=>Ze("engagement.global.js","__sentientEngagement"));var Ot="0.36.1",bn=Ot!=="0.0.0-dev"?{name:"snippet",version:Ot}:void 0,Ho=Ot!=="0.0.0-dev"?{v:Ot}:{},Ko=5e3,Ra=50,zo=(()=>{try{if(typeof window=="undefined")return[];let e=window.SentientSnippet;return Array.isArray(e==null?void 0:e.q)?e.q:[]}catch(e){return[]}})(),ee=null,k=null,Se={},be=null,we=null,Tt=null,re=null,oe=null,Pt=0,J=null,tt=null,jo=!1,fr=null,yn=null,Lt=null,Ae=!1,He=!1,Sn=!1,wn=0,qo=e=>fe(e)===wn,pt=null,ue=!1,Be=null,Ce=[],nt=null,rt=null,ve=null,Na=3e3,Da=100;function Go(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 $e(e,...t){e!=null&&e.debug&&console.log("[sentient-snippet]",...t)}function Rt(e,t){return ee?(ee.personaAttributes&&J&&dn(J.persona,J.band,e,t==null?void 0:t.onAttr),fn(Se,ee.slots,e,t==null?void 0:t.onAttr),pn(Se,ee.slots,e,t==null?void 0:t.onAttr),be?gn(Se,be,e,W(je(W({},t),{onDrift:(n,r)=>{var o,a;return(a=k==null?void 0:k.reportDrift)==null?void 0:a.call(k,n,r,(o=Xo[n])!=null?o:null,"fp_mismatch")}}),J?{persona:J.persona}:{})):(cn(e,new Set),[])):[]}function Jo(e){var n;let t=new Map;for(let r of(n=ee==null?void 0:ee.sections)!=null?n:[])try{let o=e.querySelectorAll(r);o.length===1&&t.set(r,o[0])}catch(o){}return t}function pr(e,t){var n,r;try{if(!e||e.length<2)return;for(let o of(n=hn(e,Jo(t)))!=null?n:[])(r=o.before.parentNode)==null||r.insertBefore(o.el,o.before)}catch(o){}}function Ma(e,t,n){let r=(o,a)=>t.some(([s,c])=>s===o&&c===a);try{if(Array.isArray(e.stamped))for(let o of e.stamped){if(!Array.isArray(o))continue;let[a,s,c]=o;!a||typeof s!="string"||r(a,s)||(c==null?a.removeAttribute(s):a.setAttribute(s,c))}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 $a(){try{let e=window.__sntPP;return e&&typeof e=="object"&&typeof e.v=="number"?e:null}catch(e){return null}}function Yo(e){return e.apiBase?`${e.apiBase.replace(/\/+$/,"")}/v1/events`:void 0}function kn(e){var t;return(t=e.apiBase)!=null?t:"https://api.sentient-ui.com"}function Ba(e){return Promise.resolve().then(()=>fetch(`${kn(e)}/v1/registry/locators`,{headers:{authorization:`Bearer ${e.apiKey}`}})).then(t=>t.ok?t.json():null).then(t=>Array.isArray(t==null?void 0:t.slots)?t.slots:null).catch(()=>null)}function gr(e,t){let n=[],r=[];for(let o of e)try{if(typeof(o==null?void 0:o.id)!="string")continue;!o.locator||wo(o.locator,t)?n.push(o.id):ln(o.locator,t)&&r.push(o.id)}catch(a){}return[n,r]}var Xo={};function Zo(e,t){var r;let n={};for(let o of e){let a=(r=Be==null?void 0:Be.find(l=>l.id===o))==null?void 0:r.locator,s=a?Ne(a,t):null,c=s?on(s):null,i=c&&"fp"in c?c.fp:void 0;i&&(Xo[o]=i),n[o]=je(W({},i?{fp:i}:{}),{forms:!1,compose:!0,content:!0})}return n}function Qo(e,t){let n=null;for(let r of t)e!=null&&e[r]&&((n!=null?n:n={})[r]=e[r]);return n}var le=null;function ei(){if(!Ae){le&&nt!==Re()&&le(!0);return}!Be||nt===Re()||(nt=Re(),Ka())}function Ka(){ve==null||ve();let e=ee,t=Be;if(!e||!t)return;let n,r,o=()=>{clearTimeout(n),clearTimeout(c),r==null||r.disconnect(),ve===o&&(ve=null)},a=null,s=i=>{let[l,u]=gr(t,document),p=l.filter(v=>!Ce.includes(v));a!==null&&l.some(v=>!a.has(v)&&!p.includes(v))&&Nt(),a=new Set(l),p.length>0&&ja(p).catch(()=>{}),(i||u.length===0&&!t.some(v=>!l.includes(v.id)&&!Ce.includes(v.id)))&&(o(),ti(e,u))},c=setTimeout(()=>s(!0),Na);if(ve=o,s(),ve===o)try{r=new MutationObserver(()=>{clearTimeout(n),n=setTimeout(s,Da)}),r.observe(document.documentElement,{childList:!0,subtree:!0})}catch(i){}}function _n(e,t){if(!(!e||e.length===0||!t||!ee))try{we==null||we.teardown(),we=Mo(e,t,document,ee.apiKey)}catch(n){}}async function ja(e){let t=ee,n=k;if(!t||!n)return;Ce=Ce.concat(e);let r=await n.decide(W({slotsFrom:"registry",registrySlotIds:e,render:Zo(e,document)},Ho));if(r||(Ce=Ce.filter(a=>!e.includes(a))),!r||ue||k!==n)return;Se=W(W({},Se),r.slots),!we&&r.goals&&(t.consent!==!1||He)&&_n(Tt=r.goals,n);let o=Qo(r.slotConfig,e);o&&(be=W(W({},be),o)),Nt(),$e(t,"late decide",e),rt&&qo(t.apiKey)&&Je(t.apiKey,rt=W(je(W({},rt),{slots:Se,savedAt:Date.now()}),be?{slotConfig:be}:{}))}function ti(e,t){if(t.length!==0)try{fetch(`${kn(e)}/v1/locator-miss`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${e.apiKey}`},body:JSON.stringify({slots:t})}).catch(()=>{})}catch(n){}}function ot(){return!!(ee&&k&&ee.sectionCapture!==!1&&(ee.consent!==!1||He)&&!Xe())}function Ga(){if(!k||!ee||!ot()||oe)return;let e=[];Rt(document,{contentAndOps:Ae,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),hr();try{re==null||re(),re=mn(k,ee.apiKey,e)}catch(t){}}function hr(){if(typeof document=="undefined"||!ot())return;let e;try{if(yn&&yn.length>0){let r=new Map;for(let o of yn){if(o.urlMatch!==window.location.pathname)continue;let a=Ne(o.locator,document);a&&r.set(a,o.type)}r.size>0&&(e=o=>{var a;return(a=r.get(o))!=null?a:null})}}catch(r){}let t=k,n=++Pt;Lt=window.location.pathname,Ze("engagement.global.js","__sentientEngagement").then(r=>{if(!(!r||n!==Pt||k!==t||!t||!ot()))try{oe==null||oe(),oe=r.startEngagementCapture(t,W({apiKey:ee.apiKey,apiBase:ee.apiBase,doc:document,microSignals:!0},e?{typeOf:e}:{}))}catch(o){}})}function Nt(){try{let e=[];if(re==null||re(),re=null,Rt(document,{contentAndOps:Ae,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),pr(tt,document),e.length>0&&ot())try{re=mn(k,ee.apiKey,e)}catch(t){}try{typeof window!="undefined"&&Lt!==null&&window.location.pathname!==Lt&&ot()&&(oe==null||oe(),oe=null,Pt++,hr())}catch(t){}}catch(e){}}function Fo(){fr===null&&(fr=setTimeout(()=>{fr=null,Nt();try{we==null||we.checkUrl()}catch(e){}ei()},Ra))}function ni(){if(!(jo||typeof window=="undefined"||typeof history=="undefined")){jo=!0;try{let e=t=>{let n=history[t];history[t]=function(r,o,a){let s=n.call(this,r,o,a!=null?a:null);return Fo(),s}};e("pushState"),e("replaceState"),window.addEventListener("popstate",Fo)}catch(e){}}}function vn(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 Fa(e,t,n){var r;try{window.__sentientEditor={token:t,code:n,apiBase:kn(e)};let o=e.editorSrc?{src:e.editorSrc}:rr("editor.global.js");if(!o){Wo();return}let a=We(document.createElement("script"));or(a,o),a.async=!0,a.onerror=()=>Wo(),((r=document.head)!=null?r:document.documentElement).appendChild(a)}catch(o){}}var Uo="sentient-editor-load-notice";function Wo(){var e;try{if(document.getElementById(Uo))return;let t=document.createElement("div");t.id=Uo,t.textContent="Couldn\u2019t load the editor \u2014 check your connection and reopen it from your dashboard.",t.style.cssText="position:fixed;bottom:16px;right:16px;z-index:2147483647;padding:12px;background:#111;color:#fff;font:13px system-ui",t.onclick=()=>t.remove(),((e=document.body)!=null?e:document.documentElement).appendChild(t),setTimeout(()=>t.remove(),1e4)}catch(t){}}function Ua(e){let t={cfg:e,apiBase:kn(e),set(n){n.slots!==void 0&&(Se=n.slots),n.slotConfig!==void 0&&(be=n.slotConfig),n.persona!==void 0&&(J=n.persona),n.decided&&(Ae=!0),n.look&&(Ct(n.look.palette),It(n.look.vocabulary))},apply:()=>Rt(document),installSpaHooks:ni,exposeGlobal:()=>{Sn=!0,mr(e)},dbg:(...n)=>$e(e,...n)};return Ze("preview.global.js","__sentientPreview").then(n=>n?n.runPreview(t):Promise.reject()).catch(()=>(t.exposeGlobal(),$e(e,"preview chunk unavailable \u2014 page left as-is"),!0))}function mr(e){let t=r=>{try{oe==null||oe(),oe=null,Pt++,Lt=null,re==null||re(),re=null,ve==null||ve(),we==null||we.teardown(),we=null,r&&dr(typeof window!="undefined"?window:null,e.apiKey),He=!1,ue=!0,r?(rt=null,J=null,k?k.destroy():lt(e.apiKey)):k==null||k.dispose(),k=null}catch(o){}},n={consentWatcher:Qe,goal(r,o){try{k==null||k.goal(r,o)}catch(a){}},componentGoal(r,o){try{k==null||k.componentGoal(r,o)}catch(a){}},identify(r,o){try{k==null||k.identify(r,o)}catch(a){}},grantConsent(){try{if(!k&&ue||k!=null&&k.released)wn=fe(e.apiKey),k=_t(W({apiKey:e.apiKey,consent:!0,preConsentBehavior:e.preConsentBehavior,debug:e.debug,persona:e.persona,internal:e.internal,ingestUrl:Yo(e)},bn?{sdk:bn}:{})),_n(Tt,k);else{let r=(k==null?void 0:k.gated)===!0;tr(e.apiKey),r&&(wn=fe(e.apiKey)),_n(Tt,k)}ue=!1,le==null||le()}catch(r){}He=!0;try{Ga()}catch(r){}},revokeConsent(){t(!0)},reapply:Nt,getState(){var r,o;try{return{apiKey:e.apiKey,persona:(r=J==null?void 0:J.persona)!=null?r:null,band:(o=J==null?void 0:J.band)!=null?o:null,slots:Se,matchCounts:vn(e),consent:!ue&&(e.consent!==!1||He)}}catch(a){return{apiKey:e.apiKey,persona:null,band:null,slots:{},matchCounts:{},consent:!1}}}};if(window.SentientSnippet=n,window.__sentientApi=n,e.consentFrom&&!pt&&!Sn)try{let r=Qe(e.consentFrom),o=!1,a=!1,s=()=>!!k&&!ue&&(k.gated===void 0?e.consent!==!1||He:!k.gated);pt=r.subscribe(()=>{try{let c=r.read();c!==null&&(a=!0);let i=c!=null?c:a?!1:null,l=s(),u=!l&&i!==!0&&r.refused();if(u&&!o&&(k!=null&&k.gated?k.destroy():lt(e.apiKey),dr(window,e.apiKey),rt=null,J=null),o=u,i===!0&&!l)n.grantConsent();else if(i===!1&&l){let p=r.refused();t(p),p&&(o=!0)}}catch(c){}})}catch(r){}for(let r of zo.splice(0))try{r[0]==="goal"?n.goal(r[1],r[2]):r[0]==="grantConsent"&&k?n.grantConsent():r[0]==="revokeConsent"&&k&&n.revokeConsent()}catch(o){}}function Vo(){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,identify:n,grantConsent:n,revokeConsent:n,reapply:n,consentWatcher:Qe,getState:()=>({apiKey:"",persona:null,band:null,slots:{},matchCounts:{},consent:!1})},zo.length=0}catch(t){}}function Wa(){try{let e=window.Shopify;return typeof(e==null?void 0:e.shop)=="string"&&e.shop!==""}catch(e){return!1}}async function ri(){var e,t;try{let n=an(window.sentient);if(!n){Vo();return}ee=n,pt==null||pt(),pt=null,!n.consentFrom&&n.consent===void 0&&Wa()&&(n.consentFrom="shopify"),go(n.consentSrc),Qt(n.nonce),Sn=!1,Ae=!1,le=null,tt=null,Se={},be=null,Ct(null),It(null),He=!1,ue=!1,Tt=null,Be=null,Ce=[],nt=null,rt=null,ve==null||ve(),oe==null||oe(),oe=null,Pt++,Lt=null;let r=Bo("sentient_editor_code"),o=r?null:$o();if(r||o){Fa(n,o,r),Sn=!0,mr(n),$e(n,"editor mode");return}if(typeof window!="undefined"&&/[?&]sentient_(preview|persona|context)=[^&]/.test(window.location.search)&&await Ua(n))return;if(n.consentFrom&&n.consent===void 0)try{n.consent=Qe(n.consentFrom).read()===!0}catch(f){n.consent=!1}n.consent!==!1&&n.sectionCapture!==!1&&!Xe()&&Ze("engagement.global.js","__sentientEngagement");let a=(e=n.registry)!=null?e:Object.keys(n.slots).length===0;n.registry===void 0&&!a&&$e(n,"slots declared without registry: true, so dashboard-published components are not applied");let s=a?Ba(n):null,c=$a();try{(t=c==null?void 0:c.stop)==null||t.call(c)}catch(f){}let i=n.consent!==!1&&!Xe()?st(n.apiKey):null,l=[];if(i){J={persona:i.persona,band:i.band},Se=i.slots,i.slotConfig&&(be=i.slotConfig),i.palette&&Ct(i.palette),i.vocabulary&&It(i.vocabulary),Rt(document,W({contentAndOps:!1},c?{onAttr:(g,A)=>l.push([g,A])}:{})),i.layoutOrder&&(tt=i.layoutOrder,pr(tt,document));let f=St(i.stage,n.stageAttributes);f&&(en(f),l.push([document.documentElement,"data-sentient-stage"]))}c&&Ma(c,l,document);let u=_t(W({apiKey:n.apiKey,consent:n.consent,preConsentBehavior:n.preConsentBehavior,debug:n.debug,persona:n.persona,userId:n.userId,userHash:n.userHash,internal:n.internal,stageAttributes:n.stageAttributes,ingestUrl:Yo(n)},bn?{sdk:bn}:{}));k=u,wn=fe(n.apiKey),mr(n),ni();let p=Object.entries(n.slots).map(([f,g])=>({id:f,dims:g.dims})),v=Ho,b={pp:c?c.v:0},S=[];if(s){let[f]=await Promise.all([Go(s,Ko),document.readyState==="loading"?new Promise(g=>document.addEventListener("DOMContentLoaded",g,{once:!0})):null]);Be=f,f&&(Ce=S=gr(f,document)[0]),$e(n,"registry scope",f&&S)}let w=(f=u)=>{let g=Array.from(Jo(document).keys());return f.decide(W(W(W(W({slots:p},v),b),g.length>=2?{sections:g}:{}),a?{slotsFrom:"registry",registrySlotIds:S,render:Zo(S,document)}:{}))},K=Re(),j=u.gated===!0,_=!1,E=!1,O=!1,N=!1;le=(f=!1)=>{let g=k;!_||E||N||Ae||ue||!g||g.gated||!f&&!O||(O=!1,N=!0,K=nt=Re(),Be&&(Ce=S=gr(Be,document)[0]),w(g).then(A=>{N=!1,A&&!Ae&&!ue&&k===g?y(A):(A||(Ce=[]),!Ae&&(g.released||k!==g||ue)&&(O=!0))}).catch(()=>{N=!1}))};let M=w();M.then(()=>{_=!0},()=>{_=!0});let m=await Go(M,Ko),y=f=>{var I,F,Y,ne,_e;E=!0;let g=(k!=null?k:u).getPersona();g?J={persona:g.persona,band:g.band}:f.persona&&(J={persona:f.persona,band:"low"}),Se=f.slots,a?be=Qo(f.slotConfig,S):f.slotConfig&&(be=f.slotConfig),f.palette&&Ct(f.palette),f.vocabulary&&It(f.vocabulary),tt=(I=f.layoutOrder)!=null?I:tt;let A=()=>{var te;let C=[],z=Rt(document,{onApplied:(Ie,ge,Z)=>C.push({slotId:Ie,arm:ge,el:Z})});a||ti(n,z),pr(tt,document);try{(te=c==null?void 0:c.reveal)==null||te.call(c)}catch(Ie){}if(Ae=!0,ot())try{re==null||re(),re=mn(k,n.apiKey,C)}catch(Ie){}};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",A,{once:!0}):A(),Tt=(F=f.goals)!=null?F:null,(n.consent!==!1||He)&&!ue&&_n(f.goals,k),yn=(Y=f.sectionMap)!=null?Y:null,ot()&&hr(),$e(n,"applied",{persona:J,slots:Se,matches:vn(n)}),!ue&&(qo(n.apiKey)&&Je(n.apiKey,rt=W(W(W(W({v:1,persona:(ne=J==null?void 0:J.persona)!=null?ne:f.persona,band:(_e=J==null?void 0:J.band)!=null?_e:"low",slots:f.slots,layoutOrder:f.layoutOrder,savedAt:Date.now()},be?{slotConfig:be}:{}),f.palette?{palette:f.palette}:{}),f.vocabulary?{vocabulary:f.vocabulary}:{}),(C=>C?{stage:C}:{})(St(f.stage,n.stageAttributes)))),nt=null,ei())};if(!m){$e(n,"decide timeout/null \u2014 snapshot state stands",vn(n)),M.then(f=>{if(!f){if(Ae)return;Ce=[],u.released===!0||k!==u||ue||j&&Re()!==K?(O=!0,le==null||le()):nt=K;return}if(!(!f||Ae||ue)){if(k!==u){O=!0,le==null||le();return}y(f),$e(n,"late decide applied",vn(n))}}).catch(()=>{});return}if(ue||k!==u){O=!0,le==null||le();return}y(m)}catch(n){Vo()}}if(typeof window!="undefined"&&window.sentient){let e=window;if(!e.__sentientInitialized)e.__sentientInitialized=!0,Promise.resolve().then(()=>{ri()});else{let t=window.__sentientApi;t&&Promise.resolve().then(()=>{window.SentientSnippet=t})}}return pi(Va);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentientui/snippet",
3
- "version": "0.35.0",
3
+ "version": "0.36.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",
@@ -41,7 +41,7 @@
41
41
  "tsx": "^4.19.2",
42
42
  "typescript": "^5.7.2",
43
43
  "vitest": "^2.1.8",
44
- "@sentientui/core": "0.42.0"
44
+ "@sentientui/core": "0.43.0"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsup && node scripts/stamp-chunk-sri.mjs",