@sentientui/snippet 0.32.0 → 0.32.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- "use strict";var __sentientEditorBundle=(()=>{var Ut=Object.defineProperty,yr=Object.defineProperties,br=Object.getOwnPropertyDescriptor,vr=Object.getOwnPropertyDescriptors,xr=Object.getOwnPropertyNames,Kt=Object.getOwnPropertySymbols;var fn=Object.prototype.hasOwnProperty,ro=Object.prototype.propertyIsEnumerable;var oo=(e,t,n)=>t in e?Ut(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,K=(e,t)=>{for(var n in t||(t={}))fn.call(t,n)&&oo(e,n,t[n]);if(Kt)for(var n of Kt(t))ro.call(t,n)&&oo(e,n,t[n]);return e},le=(e,t)=>yr(e,vr(t));var io=e=>typeof e=="symbol"?e:e+"",ao=(e,t)=>{var n={};for(var r in e)fn.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Kt)for(var r of Kt(e))t.indexOf(r)<0&&ro.call(e,r)&&(n[r]=e[r]);return n};var wr=(e,t)=>()=>(e&&(t=e(e=0)),t);var kr=(e,t)=>{for(var n in t)Ut(e,n,{get:t[n],enumerable:!0})},Sr=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of xr(t))!fn.call(e,s)&&s!==n&&Ut(e,s,{get:()=>t[s],enumerable:!(r=br(t,s))||r.enumerable});return e};var Er=e=>Sr(Ut({},"__esModule",{value:!0}),e);var Cr,Tr,Lr,so,_r,Ir,lo,de,st,gn=wr(()=>{"use strict";Cr=Object.defineProperty,Tr=Object.defineProperties,Lr=Object.getOwnPropertyDescriptors,so=Object.getOwnPropertySymbols,_r=Object.prototype.hasOwnProperty,Ir=Object.prototype.propertyIsEnumerable,lo=(e,t,n)=>t in e?Cr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,de=(e,t)=>{for(var n in t||(t={}))_r.call(t,n)&&lo(e,n,t[n]);if(so)for(var n of so(t))Ir.call(t,n)&&lo(e,n,t[n]);return e},st=(e,t)=>Tr(e,Lr(t))});var Li={};kr(Li,{buildStyleOps:()=>An,clearTargetHighlights:()=>gt,computeMoveAnchors:()=>Zt,deriveSlotId:()=>Te,drawTargetHighlights:()=>Xo,exchangeCode:()=>Yo,isHex6:()=>Bn,mount:()=>er,registerAuditTargets:()=>Jo,sectionTypesFor:()=>Zo,styleFieldError:()=>Qo,toHexColor:()=>Ln});var co;function uo(e=document){if(co)return co;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=uo(t);return n&&e.setAttribute("nonce",n),e}var Ai=1800*1e3;var mn=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function Ar(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 $r(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 Br=/^[a-zA-Z_][-a-zA-Z0-9_]*$/;function Or(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)&&Br.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&&!Ar(t).includes(e.urlMatch))return null;let n=Or(e,t);if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!$r(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"},Mr=/^(rgb|rgba|hsl|hsla|calc|var|min|max|clamp)$/i;function lt(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(!Mr.test((r=n[1])!=null?r:""))return!1;return!0}var hn=/^https:\/\//i;function Gt(e){return typeof e=="string"&&!/[\s\x00-\x1f\\]/.test(e)&&(hn.test(e)||e[0]==="/"&&e[1]!=="/")?e:null}var po=new Map,Ne=null;function Pr(e){return e.replace(/["\\]/g,"\\$&")}function Rr(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=[...po.entries()].map(([n,r])=>`[data-snt-e="${Pr(n)}"]{${r}}`).join(`
2
- `)}function fo(e,t,n,r){var w;let s=!1,u=(w=t.moveBefore)!=null?w:t.moveAfter;if(u){let g=we(u,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"&&(e.textContent=t.text),typeof t.href=="string"&&hn.test(t.href)&&e.setAttribute("href",t.href),typeof t.imageSrc=="string"&&hn.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 b=It[g];b&&typeof k=="string"&&lt(k)&&m.push(`${b}:${k.trim()} !important`)}return m.length>0&&(e.setAttribute("data-snt-e",n),po.set(n,m.join(";")),Rr(r)),{anchorMiss:s}}var yn="data-sentient-block-arm",M=null;var Ye=null;function yo(e){Ye=e!=null?e:null}var bo=e=>{var t;return typeof e=="string"?(t=Ye==null?void 0:Ye.entries.find(n=>n.id===e))==null?void 0:t.classes:void 0},vo=e=>{let t=typeof e=="string"?Ye==null?void 0:Ye.entries.find(n=>n.id===e):void 0;return t!=null&&t.computed.inheritsColor?t.computed.color:void 0},At="data-sentient-blocks-hid",ct={none:"0",sm:"8px",md:"16px",lg:"24px"},bn={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},go={sm:"0.875em",md:"1em",lg:"1.25em"},Nr={sm:"1.25em",md:"1.5em",lg:"2em"},Dr={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},mo={sm:"8px",md:"16px",lg:"32px"},Hr={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},zr={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 ho(e){return e==="muted"?M!=null&&M.muted?{color:M.muted}:{opacity:"0.7"}:e==="accent"?{"font-weight":"600",color:M==null?void 0:M.accent}:{}}function xo(e,t){let n=jr(e,t),r=vo(e.like);return n&&r&&(n.style.color=r),n}function jr(e,t){var n,r,s,u,m,w,g,k,b,B,L,H,S,z,J,Z,U,X,ne,Q;try{let P=bo(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 O=e;he(I,{display:"flex","flex-direction":O.direction,gap:(r=ct[(n=O.gap)!=null?n:"md"])!=null?r:ct.md,"align-items":O.align?bn[O.align]:void 0,"justify-content":O.justify?bn[O.justify]:void 0,"flex-wrap":O.wrap?"wrap":void 0})}else{let O=e,V=(u=ct[(s=O.gap)!=null?s:"md"])!=null?u:ct.md;he(I,{display:"grid","grid-template-columns":`repeat(auto-fit, minmax(max(200px, calc((100% - ${O.columns-1} * ${V}) / ${O.columns})), 1fr))`,gap:V,"align-items":O.align?bn[O.align]:void 0})}P&&(I.className=P);let R=!P&&e.type==="stack"&&e.surface==="raised",q=(m=e.pad)!=null?m:R?"md":void 0;q&&he(I,{padding:(w=ct[q])!=null?w:ct.md}),R&&he(I,{background:M==null?void 0:M.surface,color:M!=null&&M.surface?M==null?void 0:M.surfaceText:void 0,border:`1px solid ${(g=M==null?void 0:M.border)!=null?g:"currentColor"}`,"border-radius":(k=M==null?void 0:M.radius)!=null?k:"8px"});for(let O of(b=e.children)!=null?b:[]){let V=xo(O,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?go[e.size]:void 0,"font-weight":e.weight?zr[e.weight]:void 0,"text-align":e.align},ho(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":Nr[(B=e.size)!=null?B:"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 R=Gt(e.href);if(R&&(I.href=R),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:Dr[(H=e.size)!=null?H:"md"],"border-radius":(S=M==null?void 0:M.radius)!=null?S:"8px",font:"inherit","font-size":e.size?go[e.size]:void 0,"text-decoration":q==="ghost"?"underline":"none",cursor:"pointer",background:q==="primary"?(z=M==null?void 0:M.primaryBg)!=null?z:"#111827":"transparent",color:q==="primary"?(J=M==null?void 0:M.primaryText)!=null?J:"#ffffff":(Z=M==null?void 0:M.accent)!=null?Z:"inherit",border:q==="secondary"?`1px solid ${(U=M==null?void 0:M.accent)!=null?U:"currentColor"}`:"none"})}case"link":{let I=t.createElement("a");I.textContent=e.label;let R=Gt(e.href);return R&&(I.href=R),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"),R=Gt(e.src);return R&&(I.src=R),I.alt=e.alt,P&&(I.className=P),he(I,{display:"block","max-width":"100%","aspect-ratio":e.ratio&&e.ratio!=="auto"?Hr[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=M==null?void 0:M.border)!=null?X:"currentColor"}`},ho(e.tone)))}case"spacer":return he(t.createElement("div"),{height:(ne=mo[e.size])!=null?ne:mo.md});case"divider":return he(t.createElement("hr"),{border:"none","border-top":`1px solid ${(Q=M==null?void 0:M.border)!=null?Q:"currentColor"}`,margin:"0",width:"100%"});default:return null}}catch(P){return null}}function wo(e,t,n,r){var s,u;try{let m=new Set;for(let g of Array.from(e.children)){let k=g.getAttribute(yn);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 b="tree"in k?k:null,B=xo(b?b.tree:k,r);if(!B)continue;let L=r.createElement("div");L.setAttribute(yn,g),L.style.display="none";let H=b?bo((s=b.surface)==null?void 0:s.like):void 0;if(H){let S=r.createElement("div");S.className=H;let z=vo((u=b.surface)==null?void 0:u.like);z&&(S.style.color=z),S.appendChild(B),L.appendChild(S)}else L.appendChild(B);e.appendChild(L)}let w=n!==void 0&&t[n]!==void 0;for(let g of Array.from(e.children)){let k=g.getAttribute(yn),b=g;k!==null?b.style.display=w&&k===n?"":"none":w?b.hasAttribute(At)||(b.setAttribute(At,b.style.display),b.style.display="none"):b.hasAttribute(At)&&(b.style.display=b.getAttribute(At),b.removeAttribute(At))}}catch(m){}}var Kr=/(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\([^()]*\)|#[0-9a-f]{3,8}\b/gi,Ur=/^rgba?\(\s*[\d.]+[,\s]+[\d.]+[,\s]+[\d.]+(?:[,\s/]+[\d.]+%?)?\s*\)$/i,$t;function Gr(e){if($t!==void 0)return $t;try{let t=e.createElement("canvas");t.width=t.height=1,$t=t.getContext("2d",{willReadFrequently:!0})}catch(t){$t=null}return $t}function ke(e,t){let n=(e!=null?e:"").trim();if(n===""||n==="transparent")return n==="transparent"?"rgba(0, 0, 0, 0)":"";if(Ur.test(n)||/^#[0-9a-f]{3,8}$/i.test(n))return n;let r=Gr(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,u,m,w]=r.getImageData(0,0,1,1).data;return w===255?`rgb(${s}, ${u}, ${m})`:`rgba(${s}, ${u}, ${m}, ${Math.round(w/255*1e3)/1e3})`}catch(s){return""}}function Ft(e,t){var n;return!e||e==="none"||!/gradient/i.test(e)?[]:((n=e.match(Kr))!=null?n:[]).map(r=>ke(r,t)).filter(r=>r!=="")}gn();function Eo(e){return e.replace(/\s+/g," ").trim().slice(0,300)}function ko(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 Co(e){let t=e.join("");return ko(t,2166136261)+ko(t,1523705862)}var Fr=new Set(["A","BUTTON"]),To=/^H([1-6])$/,Wr=new Set(["P","LI","LABEL","BLOCKQUOTE","FIGCAPTION","DT","DD","TD","TH"]),qr=new Set(["LABEL","FIGCAPTION","DT"]),Vr=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"]);function Lo(e){return Fr.has(e.tagName)||e.getAttribute("role")==="button"?!0:e.tagName==="INPUT"&&/^(submit|button)$/i.test(e.type)}function Yr(e){if(To.test(e.tagName)||Wr.has(e.tagName))return!0;let t=e.ownerDocument.defaultView,n=t?t.getComputedStyle(e).display:"";return n!==""&&n!=="inline"&&n!=="contents"}function Jr(e,t){let n=null;for(let r=e.parentElement;r&&r!==t.parentElement;r=r.parentElement){if(Lo(r)){n=r;break}if(r===t)break}if(n)return n;for(let r=e.parentElement;r;r=r.parentElement)if(r===t||Yr(r))return r;return t}function So(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 _o(e){return e===""||e==="transparent"||/rgba\([^)]*,\s*0\)$/.test(e)}function Xr(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),u=Ft(s.backgroundImage,t);if(u.length>0)return de({bg:u[0]},u.length>1?{alt:u[u.length-1]}:{});let m=ke(s.backgroundColor,t);if(!_o(m))return{bg:m}}return{bg:null}}function vn(e,t=40){var n,r,s;let u=e.ownerDocument.createTreeWalker(e,4),m=[];for(let b=u.nextNode();b;b=u.nextNode())if(((n=b.nodeValue)!=null?n:"").trim()!==""&&!Vr.has((s=(r=b.parentElement)==null?void 0:r.tagName)!=null?s:"")&&(m.push(b),m.length>120))return{reason:"too_large"};if(m.length===0)return{reason:"empty"};let w=[],g=[];for(let b of m){let B=Jr(b,e),L=w.indexOf(B);L===-1&&(w.push(B),L=w.length-1),g.push(L)}if(w.length>t)return{reason:"too_large"};let k=m.map(b=>{var B;return Eo((B=b.nodeValue)!=null?B:"")});return{textNodes:m,ownerEls:w,leafToNode:g,leaves:k,fp:Co(k)}}function Zr(e,t=40){var n;let r=vn(e,t);if(!("fp"in r))return{skeleton:null,reason:r.reason};let{textNodes:s,ownerEls:u,leafToNode:m,leaves:w}=r,g=e.ownerDocument,k=g.defaultView,b=[],B=u.map((S,z)=>{var J,Z;let U=k==null?void 0:k.getComputedStyle(S),X=(J=S.parentElement)!=null?J:e,ne=b.indexOf(X);ne===-1&&(b.push(X),ne=b.length-1);let Q=To.exec(S.tagName),P=Lo(S)?"action":Q?"heading":qr.has(S.tagName)?"label":"text",re=Eo(w.filter((ie,I)=>m[I]===z).join(" "));return st(de(st(de({tag:S.tagName.toLowerCase(),role:P},Q?{level:Number(Q[1])}:{}),{text:re,classes:((Z=S.getAttribute("class"))!=null?Z:"").replace(/\s+/g," ").trim()}),P==="action"?de({filled:!!U&&(!_o(ke(U.backgroundColor,e.ownerDocument))||U.backgroundImage!==""&&U.backgroundImage!=="none")},So(S.getAttribute("href"),g)!==void 0?{href:So(S.getAttribute("href"),g)}:{}):{}),{color:ke(U==null?void 0:U.color,e.ownerDocument),group:ne,restylable:!0})}),L=Xr(e),H=k==null?void 0:k.getComputedStyle(e);return{skeleton:{v:1,root:st(de({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(H==null?void 0:H.color,e.ownerDocument)}),nodes:B,leaves:w,leafToNode:m,fp:Co(w)},textNodes:s,ownerEls:u}}function Io(e,t){try{let n=Zr(e,t==null?void 0:t.maxNodes);return n.skeleton?{skeleton:n.skeleton}:n}catch(n){return{skeleton:null,reason:"unaddressable"}}}var Ao=new WeakMap;function $o(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Bo(e,t,n){var u,m,w;let r=Ao.get(e);if(r){if(r.fp!==n.fp||!$o(r.leafToNode,n.leafToNode))return"mismatch"}else{let g=vn(e);if(!("fp"in g)||(r={fp:g.fp,leafToNode:g.leafToNode,textNodes:g.textNodes,ownerEls:g.ownerEls,classes:g.ownerEls.map(k=>{var b;return(b=k.getAttribute("class"))!=null?b:""})},r.fp!==n.fp||!$o(r.leafToNode,n.leafToNode)))return"mismatch";Ao.set(e,r)}let s=r;for(let[g,k]of Object.entries(t.nodes)){let b=Number(g),B=s.ownerEls[b];if(B){if(typeof k.text=="string"){let L=!0;s.leafToNode.forEach((H,S)=>{H===b&&(s.textNodes[S].nodeValue=L?k.text:"",L=!1)})}k.like!==void 0&&s.classes[k.like]!==void 0&&B.setAttribute("class",s.classes[k.like]),k.hidden&&((u=B.style)==null||u.setProperty("display","none","important"))}}for(let g of Object.values((m=t.order)!=null?m:{})){let k=g.map(S=>s.ownerEls[S]).filter(S=>!!S),b=(w=k[0])==null?void 0:w.parentElement;if(!b||k.length!==g.length||k.some(S=>S.parentElement!==b))continue;let B=new Set(k),L=0;Array.from(b.children).map(S=>B.has(S)?k[L++]:S).forEach((S,z)=>{var J;b.children[z]!==S&&b.insertBefore(S,(J=b.children[z])!=null?J:null)})}return"applied"}gn();var Qr=4,ei=new Set(["inline-block","block","flex","inline-flex"]),Oo={H1:"heading-1",H2:"heading-2",H3:"heading-3"},Bt=null;function He(e){let t=Bt?ke(e,Bt):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 qt(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 xn(e,t){let[n,r]=[qt(e),qt(t)].sort((s,u)=>u-s);return(n+.05)/(r+.05)}var Vt=e=>{let t=He(e);return t!==null&&t.a>0};function wn(e){return Bt?Ft(e,Bt):[]}var De=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?t:0};function Mo(e,t){for(let n=e;n;n=n.parentElement){let r=t.getComputedStyle(n);if(Vt(r.backgroundColor))return He(r.backgroundColor);let s=wn(r.backgroundImage);if(s.length>0)return He(s[0])}return{r:255,g:255,b:255,a:1}}var ti='#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 ni(e,t,n){if(e.closest(ti))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 u=r.getBoundingClientRect().width;return u>0&&n>0&&u<.6*n}}return!1}function Wt(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 oi(e,t,n){var r;let s=e.tagName,u=De(t.fontSize)||n.bodySize,m=Number(t.fontWeight)||400,w=Vt(t.backgroundColor),g=wn(t.backgroundImage).length>0,k=De(t.borderTopLeftRadius||t.borderRadius),b=e.getBoundingClientRect().width;if(s==="BUTTON"||e.getAttribute("role")==="button"||s==="INPUT"&&/^(submit|button)$/i.test(e.type)||s==="A"&&ei.has(t.display)&&De(t.paddingLeft)>=8){if(((r=e.textContent)!=null?r:"").trim()==="")return null;let L=He(t.backgroundColor),H=e.parentElement?Mo(e.parentElement,n.view):n.pageBg;return w&&L&&L.a>=.9&&xn(L,H)>=1.5?"button-primary":w||De(t.borderTopWidth)>0?"button-secondary":"button-ghost"}if(s==="A")return"link";if(Oo[s])return Oo[s];if(Wt(e)&&u>=1.8*n.bodySize&&m>=600)return u>=2.5*n.bodySize?"heading-1":u>=2*n.bodySize?"heading-2":"heading-3";let B=e.nextElementSibling;if(Wt(e)&&u<=.9*n.bodySize&&(t.textTransform==="uppercase"||De(t.letterSpacing)>.05*u)&&B!==null&&/^H[1-4]$/.test(B.tagName))return"eyebrow";if(s==="UL"||s==="OL")return e.querySelectorAll(":scope > li").length>=2?"list":null;if(s==="P"&&Wt(e)){if(u>=1.1*n.bodySize)return"text-lead";if(u<=.85*n.bodySize)return"text-small";let L=He(t.color);return L&&xn(L,Mo(e,n.view))<n.bodyContrast*.8?"text-muted":"text-body"}return(s==="SPAN"||s==="DIV")&&w&&Wt(e)&&e.children.length===0&&k>=999?"badge":/^(DIV|ARTICLE|LI|SECTION|ASIDE)$/.test(s)&&(w||g)&&k>0&&De(t.paddingTop)>=16&&!(b>0&&b>=.9*n.vw)?"card":/^(SECTION|DIV|HEADER|MAIN|ASIDE)$/.test(s)&&(w||g)&&e.querySelector("h1,h2,h3")!==null&&(b===0||b>=.9*n.vw)?"section":null}function Po(e,t){var n,r,s,u,m,w,g,k,b;let B=e.defaultView;if(!B||!e.body)return{entries:[],images:[]};Bt=e;let L=B.getComputedStyle(e.body),H=De(L.fontSize)||16,S=Vt(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:H,pageBg:S,bodyContrast:xn(z,S),view:B,vw:B.innerWidth||0},Z=(s=(r=B.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,(u=t==null?void 0:t.maxElements)!=null?u:4e3);for(let R of P)try{if(R.tagName==="IMG"){let ee=R,Ae=((m=ee.getAttribute("alt"))!=null?m:"").trim(),Y=ee.naturalWidth||Number(ee.getAttribute("width"))||0,Qe=ee.naturalHeight||Number(ee.getAttribute("height"))||0,ve=ee.getAttribute("src");if(Ae&&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:Ae.slice(0,200),w:Y,h:Qe,seenOn:Z})}}let q=((w=R.getAttribute("class"))!=null?w:"").replace(/\s+/g," ").trim();if(q===""||ni(R,B,J.vw))continue;let O=B.getComputedStyle(R),V=R.tagName==="IMG"?((g=R.getAttribute("alt"))!=null?g:"").trim()?"image":null:oi(R,O,J);if(!V)continue;let Se=`${V}|${q}`,ze=R.getBoundingClientRect();ne.set(Se,Math.max((k=ne.get(Se))!=null?k:0,ze.width*ze.height));let Ie=X.get(Se);if(Ie){Ie.seen.count++;continue}let ye=wn(O.backgroundImage).map(He).filter(ee=>ee!==null),ue,je;if(Vt(O.backgroundColor))ue=ke(O.backgroundColor,e);else if(ye.length>0){let ee=[...ye].sort((Y,Qe)=>qt(Y)-qt(Qe)),Ae=Y=>Y.a<1?`rgba(${Y.r}, ${Y.g}, ${Y.b}, ${Y.a})`:`rgb(${Y.r}, ${Y.g}, ${Y.b})`;ue=Ae(ee[0]),ee.length>1&&(je=Ae(ee[ee.length-1]))}let pe=O.borderTopLeftRadius||O.borderRadius;X.set(Se,{id:V,role:V,classes:q,computed:de(de(de(de(de(de(de({},ke(O.color,e)?{color:ke(O.color,e)}:{}),R.parentElement&&B.getComputedStyle(R.parentElement).color===O.color?{inheritsColor:!0}:{}),ue?{bg:ue}:{}),je?{bgDark:je}:{}),O.fontSize?{fontSize:O.fontSize}:{}),O.fontWeight?{fontWeight:O.fontWeight}:{}),pe&&De(pe)>0?{radius:pe}:{}),seen:{url:Z,count:1,at:U}})}catch(q){}let re=new Map;for(let R of X.values())re.set(R.role,[...(b=re.get(R.role))!=null?b:[],R]);let ie=[],I=R=>{var q;return(q=ne.get(`${R.role}|${R.classes}`))!=null?q:0};for(let[R,q]of re)q.sort((O,V)=>(R.startsWith("button-")?I(V)-I(O):0)||V.seen.count-O.seen.count).slice(0,Qr).forEach((O,V)=>ie.push(st(de({},O),{id:V===0?R:`${R}-${V+1}`})));return{entries:ie,images:[...Q.values()]}}function Ro(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],u=s>="0"&&s<="9";r===0&&u||r===1&&u&&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 ri(e,t){if(e.id)return`#${Ro(e.id)}`;let n=[],r=e,s=0;for(;r&&r!==t.body&&r!==t.documentElement&&s<6;){if(r.id){n.unshift(`#${Ro(r.id)}`);break}let u=r.tagName.toLowerCase(),m=r.parentElement;if(m){let w=Array.from(m.children).filter(g=>g.tagName===r.tagName);w.length>1&&(u+=`:nth-of-type(${w.indexOf(r)+1})`)}n.unshift(u),r=r.parentElement,s++}return n.join(" > ")}function Je(e,t){var s;let n={v:1};e.id&&(n.id=e.id);for(let u of["data-framer-name","data-w-id","data-sentient-name"]){let m=e.getAttribute(u);if(m){n.dataAttr={name:u,value:m};break}}n.selector=ri(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 dt(e,t,n){return we(e,n)===t}var No="__snt_editor_token";function Do(e){try{sessionStorage.setItem(No,e)}catch(t){}}function Ot(){try{sessionStorage.removeItem(No)}catch(e){}}var ii=/rgba\([^)]*,\s*0\s*\)$/,ai=/^\d+(\.\d+)?px$/;function Ho(e){var t,n;try{let r=e.defaultView;if(!r||!e.body)return null;let s=r.getComputedStyle(e.body).backgroundColor,u=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(u).slice(0,300)){let H=L.getBoundingClientRect();if(H.width>0&&(H.width<48||H.height<24))continue;let S=r.getComputedStyle(L),z=S.backgroundColor;if(!z||z==="transparent"||z===s||ii.test(z))continue;let J=(t=(S.borderRadius||"").split(" ")[0])!=null?t:"",Z=`${z}|${S.color}|${ai.test(J)?J:"8px"}`;m.set(Z,((n=m.get(Z))!=null?n:0)+1)}let w=null,g=0;for(let[L,H]of m)H>g&&(w=L,g=H);if(!w)return null;let[k,b,B]=w.split("|");return{primaryBg:k,primaryText:b,radius:B}}catch(r){return null}}function Mt(e){let t=e.split(/[?#]/)[0]||"/";return t.length>1?t.replace(/\/+$/,"")||"/":t}function zo(e,t){return e==="*"?"Every page":e.endsWith("/*")?`All pages under ${e.slice(0,-1)}`:e===t?`This page (${e})`:`Only on ${e}`}function kn(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(u=>u!==t)]:s).filter(u=>mn.test(u))}function Yt(e){let t=e.steps.length,n=e.status==="active"?"":` (${e.status})`;return`${e.display_name} \u2014 ${t} step${t===1?"":"s"}${n}`}function Jt(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 jo(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}function si(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"funnel"}function Ko(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:si(n),body:{displayName:n.slice(0,128),steps:t.map(r=>({goalId:r}))}}:{ok:!1,error:"Give the funnel a name."}}function qo(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 ut(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}function Te(e,t,n){var w,g;let r=t.id||((w=t.dataAttr)==null?void 0:w.value)||((g=n.textContent)!=null?g:"").trim()||n.tagName,s=ut(r)||"el",u=qo(JSON.stringify(t));return`${e}-${s}-${u}`.slice(0,128)}var li="sentient-editor-highlight",ci="sentient-editor-selection",ft="sentient-editor-panel",Qt="sentient-editor-toast",En="sentient-editor-styles",Cn="sentient-editor-target-highlight",di=10,Uo="Editor session expired. Reopen it from your dashboard to keep editing \u2014 your saved changes are safe.",Go="Couldn\u2019t load the editor \u2014 check your connection and reopen it from your dashboard.";function Vo(){var t;if(document.getElementById(En))return;let e=_t(document.createElement("style"));e.id=En,e.textContent=`
1
+ "use strict";var __sentientEditorBundle=(()=>{var Ft=Object.defineProperty,kr=Object.defineProperties,Sr=Object.getOwnPropertyDescriptor,Er=Object.getOwnPropertyDescriptors,Cr=Object.getOwnPropertyNames,Gt=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(Gt)for(var n of Gt(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&&Gt)for(var r of Gt(e))t.indexOf(r)<0&&co.call(e,r)&&(n[r]=e[r]);return n};var Tr=(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})},_r=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Cr(t))!mn.call(e,s)&&s!==n&&Ft(e,s,{get:()=>t[s],enumerable:!(r=Sr(t,s))||r.enumerable});return e};var Ir=e=>_r(Ft({},"__esModule",{value:!0}),e);var Ar,$r,Br,fo,Or,Mr,go,de,lt,hn=Tr(()=>{"use strict";Ar=Object.defineProperty,$r=Object.defineProperties,Br=Object.getOwnPropertyDescriptors,fo=Object.getOwnPropertySymbols,Or=Object.prototype.hasOwnProperty,Mr=Object.prototype.propertyIsEnumerable,go=(e,t,n)=>t in e?Ar(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,de=(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))Mr.call(t,n)&&go(e,n,t[n]);return e},lt=(e,t)=>$r(e,Br(t))});var Bi={};Lr(Bi,{buildStyleOps:()=>Nn,clearTargetHighlights:()=>mt,computeMoveAnchors:()=>en,deriveSlotId:()=>Te,drawTargetHighlights:()=>nr,exchangeCode:()=>er,isHex6:()=>Rn,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 It(e,t=document){let n=ho(t);return n&&e.setAttribute("nonce",n),e}var Ni=1800*1e3;var yn=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function Nr(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 Pr(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 Rr=/^[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)&&Rr.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&&!Nr(t).includes(e.urlMatch))return null;let n=Dr(e,t);if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!Pr(r,e.fingerprint)?null:r}var At={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 ct(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 c=t.nextNode();c!==null;c=t.nextNode()){if(((r=c.nodeValue)!=null?r:"").trim()==="")continue;let m=(s=c.parentElement)==null?void 0:s.tagName;if(!(m==="SCRIPT"||m==="STYLE"||m==="TEMPLATE")){if(n!==null)return null;n=c}}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,Re=null;function zr(e){return e.replace(/["\\]/g,"\\$&")}function jr(e){var t;(!Re||!Re.isConnected)&&(Re=e.querySelector("style[data-sentient-ops]"),Re||(Re=It(e.createElement("style"),e),Re.setAttribute("data-sentient-ops",""),((t=e.head)!=null?t:e.documentElement).appendChild(Re))),Re.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,c=(x=t.moveBefore)!=null?x:t.moveAfter;if(c){let g=we(c,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=At[g];y&&typeof k=="string"&&ct(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",dt={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"},Ur={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},xo={sm:"8px",md:"16px",lg:"32px"},Gr={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 Co(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,c,m,x,g,k,y,$,L,D,E,z,J,Z,G,X,ne,Q;try{let M=So(e.like),re=e.maxWidth==="measure"?"65ch":void 0,ie=A=>(A.className=M,he(A,{"max-width":re}));switch(e.type){case"stack":case"grid":{let A=t.createElement("div");if(e.type==="stack"){let B=e;he(A,{display:"flex","flex-direction":B.direction,gap:(r=dt[(n=B.gap)!=null?n:"md"])!=null?r:dt.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=(c=dt[(s=B.gap)!=null?s:"md"])!=null?c:dt.md;he(A,{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})}M&&(A.className=M);let N=!M&&e.type==="stack"&&e.surface==="raised",q=(m=e.pad)!=null?m:N?"md":void 0;q&&he(A,{padding:(x=dt[q])!=null?x:dt.md}),N&&he(A,{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=Co(B,t);V&&A.appendChild(V)}return A}case"text":{let A=t.createElement("p");return A.textContent=e.value,M?ie(A):he(A,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 A=t.createElement(`h${e.level}`);return A.textContent=e.value,M?ie(A):he(A,{margin:"0","font-size":Kr[($=e.size)!=null?$:"md"],"text-align":e.align,"max-width":e.maxWidth==="measure"?"65ch":void 0})}case"button":{let A=t.createElement("a");A.textContent=e.label;let N=Wt(e.href);if(N&&(A.href=N),e.tag&&A.setAttribute("data-sentient-tag",e.tag),M)return ie(A);let q=(L=e.emphasis)!=null?L:"primary";return he(A,{display:"inline-block",padding:Ur[(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 ${(G=O==null?void 0:O.accent)!=null?G:"currentColor"}`:"none"})}case"link":{let A=t.createElement("a");A.textContent=e.label;let N=Wt(e.href);return N&&(A.href=N),e.tag&&A.setAttribute("data-sentient-tag",e.tag),M?ie(A):he(A,{color:"inherit","text-decoration":"underline"})}case"image":{let A=t.createElement("img"),N=Wt(e.src);return N&&(A.src=N),A.alt=e.alt,M&&(A.className=M),he(A,{display:"block","max-width":"100%","aspect-ratio":e.ratio&&e.ratio!=="auto"?Gr[e.ratio]:void 0,"object-fit":e.fit,width:e.ratio&&e.ratio!=="auto"?"100%":void 0})}case"badge":{let A=t.createElement("span");return A.textContent=e.value,M?ie(A):he(A,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(M){return null}}function To(e,t,n,r){var s,c;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,$=Co(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((c=y.surface)==null?void 0:c.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,c,m,x]=r.getImageData(0,0,1,1).data;return x===255?`rgb(${s}, ${c}, ${m})`:`rgba(${s}, ${c}, ${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 Io(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 Ao(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 _o(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),c=qt(s.backgroundImage,t);if(c.length>0)return de({bg:c[0]},c.length>1?{alt:c[c.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 c=e.ownerDocument.createTreeWalker(e,4),m=[];for(let y=c.nextNode();y;y=c.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 Io(($=y.nodeValue)!=null?$:"")});return{textNodes:m,ownerEls:x,leafToNode:g,leaves:k,fp:Ao(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:c,leafToNode:m,leaves:x}=r,g=e.ownerDocument,k=g.defaultView,y=[],$=c.map((E,z)=>{var J,Z;let G=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),M=Bo(E)?"action":Q?"heading":Zr.has(E.tagName)?"label":"text",re=Io(x.filter((ie,A)=>m[A]===z).join(" "));return lt(de(lt(de({tag:E.tagName.toLowerCase(),role:M},Q?{level:Number(Q[1])}:{}),{text:re,classes:((Z=E.getAttribute("class"))!=null?Z:"").replace(/\s+/g," ").trim()}),M==="action"?de({filled:!!G&&(!Oo(ke(G.backgroundColor,e.ownerDocument))||G.backgroundImage!==""&&G.backgroundImage!=="none")},_o(E.getAttribute("href"),g)!==void 0?{href:_o(E.getAttribute("href"),g)}:{}):{}),{color:ke(G==null?void 0:G.color,e.ownerDocument),group:ne,restylable:!0})}),L=ni(e),D=k==null?void 0:k.getComputedStyle(e);return{skeleton:{v:1,root:lt(de({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:Ao(x)},textNodes:s,ownerEls:c}}function Mo(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 No=new WeakMap;function Po(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Ro(e,t,n){var c,m,x;let r=No.get(e);if(r){if(r.fp!==n.fp||!Po(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||!Po(r.leafToNode,n.leafToNode)))return"mismatch";No.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&&((c=$.style)==null||c.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 Cn(e,t){let[n,r]=[Yt(e),Yt(t)].sort((s,c)=>c-s);return(n+.05)/(r+.05)}var Jt=e=>{let t=He(e);return t!==null&&t.a>0};function Tn(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=Tn(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 c=r.getBoundingClientRect().width;return c>0&&n>0&&c<.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,c=De(t.fontSize)||n.bodySize,m=Number(t.fontWeight)||400,x=Jt(t.backgroundColor),g=Tn(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&&Cn(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)&&c>=1.8*n.bodySize&&m>=600)return c>=2.5*n.bodySize?"heading-1":c>=2*n.bodySize?"heading-2":"heading-3";let $=e.nextElementSibling;if(Vt(e)&&c<=.9*n.bodySize&&(t.textTransform==="uppercase"||De(t.letterSpacing)>.05*c)&&$!==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(c>=1.1*n.bodySize)return"text-lead";if(c<=.85*n.bodySize)return"text-small";let L=He(t.color);return L&&Cn(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,c,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:Cn(z,E),view:$,vw:$.innerWidth||0},Z=(s=(r=$.location)==null?void 0:r.pathname)!=null?s:"/",G=new Date().toISOString(),X=new Map,ne=new Map,Q=new Map,M=Array.from(e.body.querySelectorAll("*")).slice(0,(c=t==null?void 0:t.maxElements)!=null?c:4e3);for(let N of M)try{if(N.tagName==="IMG"){let ee=N,Ae=((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(Ae&&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:Ae.slice(0,200),w:Y,h:et,seenOn:Z})}}let q=((x=N.getAttribute("class"))!=null?x:"").replace(/\s+/g," ").trim();if(q===""||si(N,$,J.vw))continue;let B=$.getComputedStyle(N),V=N.tagName==="IMG"?((g=N.getAttribute("alt"))!=null?g:"").trim()?"image":null:li(N,B,J);if(!V)continue;let Se=`${V}|${q}`,ze=N.getBoundingClientRect();ne.set(Se,Math.max((k=ne.get(Se))!=null?k:0,ze.width*ze.height));let Ie=X.get(Se);if(Ie){Ie.seen.count++;continue}let ye=Tn(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)),Ae=Y=>Y.a<1?`rgba(${Y.r}, ${Y.g}, ${Y.b}, ${Y.a})`:`rgb(${Y.r}, ${Y.g}, ${Y.b})`;ue=Ae(ee[0]),ee.length>1&&(je=Ae(ee[ee.length-1]))}let pe=B.borderTopLeftRadius||B.borderRadius;X.set(Se,{id:V,role:V,classes:q,computed:de(de(de(de(de(de(de({},ke(B.color,e)?{color:ke(B.color,e)}:{}),N.parentElement&&$.getComputedStyle(N.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:G}})}catch(q){}let re=new Map;for(let N of X.values())re.set(N.role,[...(y=re.get(N.role))!=null?y:[],N]);let ie=[],A=N=>{var q;return(q=ne.get(`${N.role}|${N.classes}`))!=null?q:0};for(let[N,q]of re)q.sort((B,V)=>(N.startsWith("button-")?A(V)-A(B):0)||V.seen.count-B.seen.count).slice(0,ri).forEach((B,V)=>ie.push(lt(de({},B),{id:V===0?N:`${N}-${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],c=s>="0"&&s<="9";r===0&&c||r===1&&c&&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 ci(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 c=r.tagName.toLowerCase(),m=r.parentElement;if(m){let x=Array.from(m.children).filter(g=>g.tagName===r.tagName);x.length>1&&(c+=`:nth-of-type(${x.indexOf(r)+1})`)}n.unshift(c),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 c of["data-framer-name","data-w-id","data-sentient-name"]){let m=e.getAttribute(c);if(m){n.dataAttr={name:c,value:m};break}}n.selector=ci(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 Uo(e){try{sessionStorage.setItem(Ko,e)}catch(t){}}function Mt(){try{sessionStorage.removeItem(Ko)}catch(e){}}var di=/rgba\([^)]*,\s*0\s*\)$/,ui=/^\d+(\.\d+)?px$/;function Go(e){var t,n;try{let r=e.defaultView;if(!r||!e.body)return null;let s=r.getComputedStyle(e.body).backgroundColor,c=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(c).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||di.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 Nt(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=Nt(e),r=n.split("/").filter(Boolean),s=[n,"*"];return r.length>=2&&s.push(`/${r[0]}/*`),(t?[t,...s.filter(c=>c!==t)]:s).filter(c=>yn.test(c))}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 Te(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",c=Zo(JSON.stringify(t));return`${e}-${s}-${c}`.slice(0,128)}var fi="sentient-editor-highlight",gi="sentient-editor-selection",gt="sentient-editor-panel",tn="sentient-editor-toast",In="sentient-editor-styles",An="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(In))return;let e=It(document.createElement("style"));e.id=In,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); }
@@ -12,23 +12,23 @@
12
12
  0%, 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0.55); }
13
13
  50% { box-shadow: 0 0 0 5px rgba(52,211,153,0); }
14
14
  }
15
- #${ft} {
15
+ #${gt} {
16
16
  animation: sntedi-in 0.42s cubic-bezier(0.2,0.9,0.25,1.15) both,
17
17
  sntedi-attn 1.7s ease-in-out 0.42s 3;
18
18
  }
19
- #${ft} .sntedi-dot { animation: sntedi-dot 1.4s ease-in-out infinite; }
20
- #${Qt} { animation: sntedi-in 0.42s cubic-bezier(0.2,0.9,0.25,1.15) both; }
19
+ #${gt} .sntedi-dot { animation: sntedi-dot 1.4s ease-in-out infinite; }
20
+ #${tn} { animation: sntedi-in 0.42s cubic-bezier(0.2,0.9,0.25,1.15) both; }
21
21
  @media (prefers-reduced-motion: reduce) {
22
- #${ft}, #${ft} .sntedi-dot, #${Qt} { animation: none !important; }
22
+ #${gt}, #${gt} .sntedi-dot, #${tn} { animation: none !important; }
23
23
  }
24
- `,((t=document.head)!=null?t:document.documentElement).appendChild(e)}function Xt(e){var r,s;Vo(),(r=document.getElementById(Qt))==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=Qt;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 ui(){let e=window.__sentientEditor;return e&&typeof e.apiBase=="string"&&(typeof e.token=="string"||typeof e.code=="string")?e:null}async function Yo(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,Do(n),200):t.ok?500:t.status}catch(t){return 0}}async function pi(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 $n(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 ce(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 $n(r.status,s)}catch(r){return{r:"error"}}}async function fi(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 $n(n.status,r)}catch(n){return{r:"error"}}}async function gi(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:$n(r.status,s)}}catch(r){return{r:"error",data:null,outcome:{r:"error"}}}}var Tn=[];function Bn(e){return/^#[0-9a-fA-F]{6}$/.test(e)}function Ln(e){let t=e.trim();if(Bn(t))return t;let n=/^#([0-9a-fA-F]{3})$/.exec(t);if(n)return`#${n[1].split("").map(u=>u+u).join("")}`;let r=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/.exec(t);if(!r)return t;let s=u=>Math.min(255,Number(u)).toString(16).padStart(2,"0");return`#${s(r[1])}${s(r[2])}${s(r[3])}`}var Xe=null,_n=[];function Jo(e){_n=e}async function mi(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 Tn=Array.isArray(n.fonts)?n.fonts.filter(r=>typeof r=="string"):[],Array.isArray(n.targets)?n.targets:[]}catch(t){return[]}}async function pt(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 gt(e=document){for(let t of Array.from(e.querySelectorAll(`.${Cn}`)))t.remove()}function Xo(e,t=document){var r;gt(t);let n=0;for(let s of e){if(n>=di)break;let u=we(s.locator,t);if(!u)continue;let m=u.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=Cn;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=Cn,((r=t.body)!=null?r:t.documentElement).append(w,g),n+=1}}function Zt(e,t){let n=e.previousElementSibling,r=e.nextElementSibling,s=n?Je(n,t):null,u=r?Je(r,t):null;return{prevEl:n,nextEl:r,prevLocator:n&&s&&dt(s,n,t)?s:null,nextLocator:r&&u&&dt(u,r,t)?u:null}}var hi=/testimonial|review|quote/i;function Zo(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 In=["color","background","fontSize","fontWeight","borderRadius","textAlign","fontFamily"],yi=/^(0|\d*\.?\d+(px|rem|em|%|vh|vw|vmin|vmax|ch|pt))$/i,bi=new Set(["left","center","right","justify","start","end"]),vi=/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,xi=/^(rgb|rgba|hsl|hsla)\(/i;function wi(e){return vi.test(e)||xi.test(e)}function Qo(e,t){switch(e){case"fontSize":case"borderRadius":return yi.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 bi.has(t.toLowerCase())?null:"Choose left, center, right, or justify.";case"color":case"background":return wi(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 An(e){let t={},n={};for(let r of In){let s=e[r];if(typeof s!="string")continue;let u=s.trim();if(u==="")continue;if(!lt(u)){n[r]="That value isn\u2019t allowed.";continue}let m=Qo(r,u);if(m){n[r]=m;continue}t[r]=u}return{style:t,errors:n}}function c(e,t,n){let r=document.createElement(e);return Object.assign(r.style,t),n!==void 0&&(r.textContent=n),r}function er(e){var no;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){}}},u=(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=li;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=ci;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`})},k=()=>g();Vo();let b=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"});b.id=ft;let B=c("span",{width:"9px",height:"9px",borderRadius:"50%",background:"#34d399",display:"inline-block",flex:"0 0 auto"});B.className="sntedi-dot";let L=c("div",{display:"flex",alignItems:"center",gap:"8px",fontWeight:"700",fontSize:"14px",marginBottom:"6px"});L.append(B,c("span",{},"SentientUI"));let H=c("div",{opacity:"0.85",marginBottom:"8px"},"Click any element on the page to adapt it."),S=!1,z=c("button",F("#374151"),"Pause selecting");z.onclick=()=>{S=!S,z.textContent=S?"Resume selecting":"Pause selecting",S?(m.style.display="none",gt(document),E("Selection paused \u2014 browse normally, then resume.")):E("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"),R=c("button",F("#374151"),"Attach this test to a funnel step"),q=c("button",F("#10b981"),"Turn the funnel on"),O=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"),Ie=Sn("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,O,V])o.disabled=!0;let je=[U,X,ne,Q,P,O,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",R.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",{}),Ae=[{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",Qe=new Map,ve=new Map,$e=new Map,On=c("div",{display:"flex",gap:"0",margin:"10px 0 0",justifyContent:"space-between",borderBottom:"1px solid rgba(255,255,255,0.1)"}),Mn=c("div",{paddingTop:"10px"});for(let o of Ae){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=()=>tr(o.id),Qe.set(o.id,i),On.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),Mn.append(a)}ve.get("text").append(U),ve.get("style").append(X),ve.get("layout").append(ne,O,V,Se,ze),ve.get("goals").append(Q,P,re,ie),ve.get("funnels").append(I,R,q);let xe=c("div",{});ve.get("drafts").append(xe);let Pt=()=>{var i,a;for(let l of Ae){let d=l.id===Y,p=Qe.get(l.id);p.style.color=d?"#ffffff":"#9ca3af",p.style.borderBottom=d?"2px solid #6366f1":"2px solid transparent",ve.get(l.id).style.display=d?"block":"none",$e.get(l.id).style.display="none"}let o=l=>{let d=$e.get(Y);d.textContent=l,d.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"&&et()},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),Pn=(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())},Rt=(o,i,a)=>{let l=Le("#374151","Discard");return l.onclick=async()=>{l.disabled=!0;let d=await fi(e,o);l.disabled=!1,be(d,i),d.r==="ok"&&a()},l},Rn=(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)},et=async()=>{var x,C,A,h,v,N,T,D,G,$,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=()=>{et()},xe.append(_)}return}let d=o.filter(_=>{var j,se,_e,Re,Ve,Lt;return((_e=(se=(j=_.draft_config)==null?void 0:j.arms)==null?void 0:se.length)!=null?_e:0)>0||((Lt=(Ve=(Re=_.published_config)==null?void 0:Re.arms)==null?void 0:Ve.length)!=null?Lt:0)>0}),p=i.filter(_=>_.event!=="custom"&&(_.status==="draft"||_.status==="active"));if(d.length===0&&p.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 y=_=>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"),f=_=>{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 d){let{row:j}=f((x=_.display_name)!=null?x:_.slot_id);j.append(y(_.status==="published"));let se=(v=(h=(C=_.draft_config)==null?void 0:C.arms)!=null?h:(A=_.published_config)==null?void 0:A.arms)!=null?v:[],_e=(D=(N=se[1])==null?void 0:N.id)!=null?D:(T=se[0])==null?void 0:T.id,Re=Le("#374151","Preview");if(Re.onclick=()=>Pn(_.slot_id,_e),j.append(Re),_.status!=="published"&&((ge=($=(G=_.draft_config)==null?void 0:G.arms)==null?void 0:$.length)!=null?ge:0)>0){let Ve=Le("#10b981","Publish");Ve.onclick=async()=>{Ve.disabled=!0;let Lt=await ce(e,`/v1/editor/slots/${encodeURIComponent(_.slot_id)}/publish`,{});Ve.disabled=!1,be(Lt,"\u2713 Published \u2014 live for new visitors."),Lt.r==="ok"&&(u("published",{kind:"slot"}),et())},j.append(Ve)}_.status!=="published"&&j.append(Rt(`/v1/editor/slots/${encodeURIComponent(_.slot_id)}`,"\u{1F5D1} Draft discarded \u2014 nothing changed for your visitors.",()=>{Gn(_.slot_id),et()})),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(p.length>0){xe.append(c("div",{fontSize:"11px",opacity:"0.6",padding:"8px 0 2px"},"Goals"));for(let _ of p){let{row:j}=f((me=_.display_name)!=null?me:_.goal_id);if(j.append(y(_.status==="active")),_.status==="draft"){let se=Le("#10b981","Start tracking");se.onclick=async()=>{se.disabled=!0;let _e=await ce(e,`/v1/editor/goals/${encodeURIComponent(_.goal_id)}/publish`,{});se.disabled=!1,be(_e,"\u2713 Tracking is live \u2014 it counts from your next visitor."),_e.r==="ok"&&(u("published",{kind:"goal"}),et())},j.append(se,Rt(`/v1/editor/goals/${encodeURIComponent(_.goal_id)}`,"\u{1F5D1} Draft goal discarded \u2014 it never tracked anything.",()=>{Fn(_.goal_id),et()}))}xe.append(j)}}},tr=o=>{Y!==o&&(ae(),wt(),Y=o,Pt())},Nn=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 Dn=!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(Si(26)),Be.title="Open the SentientUI editor",Be.setAttribute("aria-label","Open the SentientUI editor");let Hn=Sn("minimize","Minimize");Hn.onclick=()=>{b.style.display="none",Be.style.display="flex",Dn=S,S=!0,m.style.display="none",gt(document)},Be.onclick=()=>{b.style.display="block",Be.style.display="none",S=Dn},Object.assign(z.style,{display:"inline-block",width:"auto",margin:"0",padding:"3px 8px",fontSize:"10.5px",borderRadius:"999px",background:"#374151",whiteSpace:"nowrap"}),Nn.append(L,z,Hn,Ie);let zn=c("div",{marginTop:"10px",borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"8px"}),Ke=c("div",{});Object.assign(Z.style,{marginBottom:"4px"}),zn.append(Ke,Z,ye,ue);let jn=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"),tn=c("div",{display:"flex",alignItems:"center",gap:"6px"});Object.assign(J.style,{flex:"1 1 auto",marginBottom:"0"}),tn.append(J,jn),Object.assign(tn.style,{marginBottom:"6px"});let Nt=c("div",{}),W=c("div",{marginTop:"4px"});W.addEventListener("input",()=>{tt=!0}),W.addEventListener("change",()=>{tt=!0}),b.append(Nn,H,tn,pe,ee,Nt,On,Mn,W,zn),((no=document.body)!=null?no:document.documentElement).append(m,w,b,Be);let Oe=null,Dt=()=>{Oe==null||Oe(),Oe=null},Kn=()=>{Oe=null},mt=null,tt=!1,nn=null,ae=()=>{Dt(),mt=null,W.textContent="",tt=!1,nn=null,pn=!1},ht=(o,i,a,l)=>{var A;ae();let d={},p={},y={display:"block",width:"100%",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"};for(let h of o){let v=c("label",{display:"block",fontSize:"12px",opacity:"0.85",marginTop:"8px"},h.label);if(W.append(v),h.type==="select"){let T=c("select",y);T.setAttribute("data-field",h.key);let D=document.createElement("option");D.value="",D.textContent="\u2014 no change \u2014",T.append(D);for(let G of(A=h.options)!=null?A:[]){let $=document.createElement("option");$.value=G,$.textContent=G,T.append($)}d[h.key]=()=>T.value,W.append(T)}else if(h.type==="color"){let T=c("input",le(K({},y),{padding:"2px",height:"34px"}));T.type="color",T.setAttribute("data-field",h.key);let D=!1;T.addEventListener("input",()=>{D=!0}),d[h.key]=()=>D?T.value:"",W.append(T)}else{let T=c("input",y);T.setAttribute("data-field",h.key),h.value!==void 0&&(T.value=h.value),d[h.key]=()=>T.value,W.append(T)}let N=c("div",{fontSize:"11px",color:"#fca5a5",marginTop:"3px",display:"none"});N.setAttribute("data-feedback",h.key),p[h.key]=N,W.append(N)}let f=(h,v)=>{let N=p[h];N&&(N.textContent=v!=null?v:"",N.style.display=v?"block":"none")};if(l){let h=Un(l);W.append(h.node),d[yt]=h.value}let x=c("button",F("#6366f1"),i),C=c("button",le(K({},F("transparent")),{opacity:"0.6"}),"Cancel");x.onclick=()=>a(Object.fromEntries(Object.entries(d).map(([h,v])=>[h,v()])),f),C.onclick=ae,W.append(x,C)},yt="__page",on={},nr=o=>{var i;for(let a of o!=null?o:[])on[a.slot_id]=(i=a.target)==null?void 0:i.page};pt(e,"/v1/editor/slots").then(o=>nr(o==null?void 0:o.slots));let Un=o=>{let i=Mt(location.pathname),a=c("div",{}),l=c("select",{display:"block",width:"100%",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"});l.setAttribute("data-field","page");for(let d of kn(i,on[o])){let p=document.createElement("option");p.value=d,p.textContent=zo(d,i),l.append(p)}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}},bt=(o,i)=>i?le(K({},o),{page:i}):o,E=(o,i=!0)=>{Z.textContent=o,Z.style.color=i?"#a7f3d0":"#fca5a5"},rn=(o,i)=>{var l,d;if(u("error_shown",{code:(d=o.code)!=null?d:`http_${(l=o.status)!=null?l:"network"}`}),o.code==="plan_limit_reached"){let p=o.feature==="live_goals"?"live goal":"of these",y=o.plan?`${o.plan} plan`:"plan";return o.feature==="live_goals"?`Your ${y} includes 1 live goal. Pause another goal in your dashboard, or upgrade to track more.`:`Your ${y} has reached its limit for ${p}. 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"?E(i,!0):o.r==="expired"?E("Editor session expired \u2014 reopen it from your dashboard to save this. Your earlier changes are safe.",!1):E(rn(o,"save"),!1)},Ue=null,Ht=o=>o.length>30?`${o.slice(0,27)}\u2026`:o,Gn=o=>{Ue===o&&(mt===o&&(Dt(),mt=null),Ue=null,ye.style.display="none",R.style.display="none",Ke.textContent="")},Fn=o=>{it===o&&(it=null,ue.style.display="none",Ke.textContent="")},vt=(o,i,a)=>{Ue=o,ye.textContent=i?`Publish \u201C${Ht(i)}\u201D \u2014 go live`:"Publish now \u2014 go live",ye.style.display="block",R.style.display="block";let l=[];if(a){let d=Le("#374151","Preview");d.onclick=()=>Pn(o,a),l.push(d)}l.push(Rt(`/v1/editor/slots/${encodeURIComponent(o)}`,"\u{1F5D1} Draft discarded \u2014 nothing changed for your visitors.",()=>Gn(o))),Rn(i?`Draft saved for \u201C${Ht(i)}\u201D \u2014 nothing is live for visitors yet.`:"Draft saved \u2014 nothing is live for visitors yet.",l)};ye.onclick=async()=>{if(!Ue)return;ye.disabled=!0,E("Publishing\u2026");let o=await ce(e,`/v1/editor/slots/${encodeURIComponent(Ue)}/publish`,{});ye.disabled=!1,o.r==="ok"?(u("published",{kind:"slot"}),E("\u2713 Published \u2014 live for new visitors.",!0),ye.style.display="none",Ue=null,Ke.textContent=""):o.r==="expired"?E("Editor session expired \u2014 reopen it from your dashboard to publish. Your saved draft is safe.",!1):E(rn(o,"publish"),!1)};let oe=null,Me=!1,nt=null,ot=null,Ee=null,Ge=null,xt=null,zt=null,Fe=!1,Wn=(o,i)=>Me?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.",qn=()=>{O.disabled=!Me||!Ee,V.disabled=!Me||!Ge,O.title=O.disabled?Wn(Ee,"above"):"",V.title=V.disabled?Wn(Ge,"below"):""},Ce=null,an=o=>{o&&!Ce&&t&&oe?(Ce=Un(Te("move",oe,t)),Se.before(Ce.node)):o||(Ce==null||Ce.node.remove(),Ce=null),Se.style.display=o?"block":"none",ze.style.display=o?"block":"none",qn()},wt=()=>{if(Fe&&t&&xt&&xt.insertBefore(t,zt),Fe=!1,xt=null,zt=null,t){let o=Zt(t,document);nt=o.prevEl,ot=o.nextEl,Ee=o.prevLocator,Ge=o.nextLocator}g(),an(!1)},Vn=o=>{if(S)return;let i=o.target;if(!i||b.contains(i)||i===m)return;gt(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`})},Pe=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()},or=o=>!!o.id||["section","header","footer","nav","main","form","article","aside"].includes(o.tagName.toLowerCase())||!!o.querySelector(":scope > h1, :scope > h2, :scope > h3"),rr=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()}>`},ir=o=>{pe.textContent="";let i=[];for(let y=o.parentElement;y&&y!==document.body&&i.length<3;y=y.parentElement)or(y)&&i.push(y);let a=Pe(o),l=()=>c("span",{opacity:"0.5",margin:"0 4px"},"\u2039"),d=!0;for(let y of i){let f=rr(y);if(f===a||a.startsWith(f))continue;let x=c("button",{background:"transparent",border:"none",color:"#a5b4fc",cursor:"pointer",font:"inherit",padding:"0",textDecoration:"underline"},f);x.onclick=()=>kt(y),d||pe.append(l()),pe.append(x),d=!1}d||pe.append(l());let p=c("button",{background:"transparent",border:"none",color:"#a5b4fc",cursor:"pointer",font:"inherit",padding:"0",textDecoration:"underline",opacity:"0.7"},"Page");p.onclick=()=>Yn(),pe.append(p),pe.style.display="block"},ar=o=>{ee.textContent="";let i=null,a=0;for(let d=o.parentElement;d&&d!==document.body&&a<6;d=d.parentElement,a++)if(dt(Je(d,document),d,document)){i=d;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 d=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 p=c("button",le(K({},F("#6366f1")),{marginTop:"0"}),`Select \u201C${Pe(d)}\u201D instead`);p.onclick=()=>kt(d);let y=c("button",le(K({},F("transparent")),{opacity:"0.6"}),"Pick something else");y.onclick=()=>{ee.textContent=""},l.append(p,y)}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)},kt=o=>{wt(),ae(),ee.textContent="",t=o,oe=Je(o,document);let i=dt(oe,o,document);Me=i,g(),J.style.display="block",J.textContent=`Selected: ${Pe(o)}`,ir(o),u("element_selected",{unique:i}),E(i?"\u2713 Matches exactly 1 element":"",i),i||ar(o),H.style.display="none",dn();for(let p of je)p.style.display="block";U.style.display="none",X.style.display="none";let a=o.childElementCount===0;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 d=Zt(o,document);nt=d.prevEl,ot=d.nextEl,Ee=d.prevLocator,Ge=d.nextLocator,qn(),Pt()},Yn=()=>{wt(),ae(),t=null,oe=null,Me=!1,nt=null,ot=null,Ee=null,Ge=null,g(),ee.textContent="",dn(),pe.textContent="",pe.style.display="none",J.textContent="",J.style.display="none";for(let o of je)o.style.display="none";H.style.display="block",E(""),Pt()},rt=!1,sn=-1,Jn=o=>{var l,d;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(),rt=!1;return}if(t){Yn(),rt=!1;return}if(!rt){rt=!0,E("Press Esc again to close the editor.");return}rt=!1,(d=Ie.onclick)==null||d.call(Ie,new MouseEvent("click"));return}if(rt=!1,!(a||S)){if(o.key==="ArrowUp"||o.key==="ArrowDown"){if(!t||(o.key==="ArrowUp"?O:V).disabled)return;o.preventDefault(),un(o.key==="ArrowUp"?"up":"down");return}if(o.key==="Tab"){let p=[];for(let f of _n){let x=we(f.locator,document);x&&!p.includes(x)&&p.push(x)}if(p.length===0)return;if(tt){E("\u26A0 You have unsaved changes \u2014 Save or Cancel before picking another element.",!1),o.preventDefault();return}o.preventDefault(),sn=(sn+(o.shiftKey?-1:1)+p.length)%p.length;let y=p[sn];kt(y);try{y.scrollIntoView({block:"center",behavior:"smooth"})}catch(f){}}}},Xn=o=>{if(S)return;let i=o.target;if(!(!i||b.contains(i))){if(o.preventDefault(),o.stopPropagation(),tt&&i!==t&&nn!==i){nn=i,E("\u26A0 You have unsaved changes \u2014 Save or Cancel first, or click that element again to discard them.",!1);return}kt(i)}};U.onclick=()=>{var p,y,f;if(!t||!oe)return;u("form_opened",{kind:"text"});let o=oe,i=(y=(p=t.textContent)==null?void 0:p.trim())!=null?y:"";ht([{key:"current",label:"Current wording",value:i},{key:"alt",label:"Alternative wording to test",value:""}],"Save draft",async x=>{let C=x.alt.trim();if(!C){E("\u26A0 Enter alternative wording to test.",!1);return}if(C===x.current.trim()){E("\u26A0 Enter different wording \u2014 the alternative matches the current text.",!1);return}let A=Te("text",o,t);E("Saving\u2026");let h=await ce(e,`/v1/editor/slots/${encodeURIComponent(A)}`,{kind:"arms",target:bt(o,x[yt]),draftConfig:{arms:[{id:"a",displayName:"Original",ops:{text:x.current}},{id:"b",displayName:"Alternative",ops:{text:x.alt}}]}});h.r==="ok"&&(u("draft_saved",{kind:"slot"}),Kn(),ae(),vt(A,Pe(t),"b")),be(h,"\u2713 Saved as a draft. Click \u201CPublish\u201D below to go live.")},Te("text",o,t));let a=t,l=(f=a.textContent)!=null?f:"";Oe=()=>{a.textContent=l};let d=W.querySelector('input[data-field="alt"]');d==null||d.addEventListener("input",()=>{a.textContent=d.value.trim()===""?l:d.value})};let St=null,Zn=o=>{let i=f=>{var x;return((x=f.textContent)!=null?x:"").replace(/\s+/g," ").trim()},a=Array.from(o.querySelectorAll("h1,h2,h3,h4")).map(i).filter(Boolean);if(a.length===0){let f=o.closest("h1,h2,h3,h4");f&&a.push(i(f))}let l=Array.from(o.querySelectorAll("p")).map(i).filter(f=>f.length>0&&f.length<=300),d=[];for(let f of Array.from(o.querySelectorAll("a[href], button"))){let x=i(f);if(!x||x.length>60)continue;let C="",A=f.getAttribute("href");if(A)try{let h=new URL(A,window.location.href);h.protocol==="https:"&&(C=h.href)}catch(h){}d.push({label:x,href:C})}let p=Array.from(o.querySelectorAll("blockquote, q")).map(i).filter(Boolean);if(p.length===0&&hi.test(`${o.className} ${o.id}`))for(let f of l)f.length>=20&&p.push(f);let y=Array.from(o.querySelectorAll('cite, figcaption, footer, [class*="author"]')).map(i).filter(f=>f.length>0&&f.length<=80);return{headings:a,paragraphs:l,links:d,quotes:p,attributions:y}},sr=(o,i)=>{var l,d,p,y,f,x,C,A,h,v,N,T,D,G,$,ge,me,_,j,se;let a=_e=>{var Re;return i.paragraphs.length>=3&&(Re=i.paragraphs[i.paragraphs.length-3+_e])!=null?Re:""};switch(o){case"headline":return(l=i.headings[0])!=null?l:"";case"supporting":return(d=i.paragraphs[0])!=null?d:"";case"cta_label":return(y=(p=i.links[0])==null?void 0:p.label)!=null?y:"";case"cta_href":return(x=(f=i.links[0])==null?void 0:f.href)!=null?x:"";case"secondary_label":return(A=(C=i.links[1])==null?void 0:C.label)!=null?A:"";case"secondary_href":return(v=(h=i.links[1])==null?void 0:h.href)!=null?v:"";case"quote":case"q1":return(N=i.quotes[0])!=null?N:"";case"q2":return(T=i.quotes[1])!=null?T:"";case"q3":return(D=i.quotes[2])!=null?D:"";case"name":case"n1":return(G=i.attributions[0])!=null?G:"";case"n2":return($=i.attributions[1])!=null?$:"";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""}},lr=(o,i,a)=>{u("form_opened",{kind:"arrangement"});let l=Zn(a);ht(o.fields.map(d=>({key:d.id,label:d.kind==="href"?`${d.label} (https link \u2014 required)`:d.label,value:sr(d.id,l)})),"Save draft",async(d,p)=>{var N,T,G,$,ge;let y=!1,f=!1;for(let me of o.fields){if(me.kind==="href"){let j=!1;try{j=new URL((N=d[me.id])!=null?N:"").protocol==="https:"}catch(se){}p(me.id,j?null:"Links need to start with https://"),j||(y=!0);continue}let _=((T=d[me.id])!=null?T:"").trim()==="";p(me.id,_?"Fill this in with your own words":null),_&&(f=!0)}if(y){E("\u26A0 Fix the highlighted link(s).",!1);return}if(f){E("\u26A0 Every field needs your own words \u2014 this layout re-arranges your copy, it doesn\u2019t write any.",!1);return}E("Saving\u2026");let D=d,{[yt]:x}=D,C=ao(D,[io(yt)]),A=await gi(e,`/v1/editor/arrangements/${encodeURIComponent(o.id)}/instantiate`,{fields:C});if(A.r!=="ok"||!((G=A.data)!=null&&G.blocks)){A.r==="expired"?be(A.outcome,""):E(`\u26A0 ${(ge=($=A.data)==null?void 0:$.reason)!=null?ge:"Couldn\u2019t build the arrangement \u2014 check the fields."}`,!1);return}let h=Te("arrange",i,a),v=await ce(e,`/v1/editor/slots/${encodeURIComponent(h)}`,{kind:"arms",target:bt(i,x),draftConfig:{arms:[{id:"original",displayName:"Your page today"},{id:o.id,displayName:o.name,blocks:A.data.blocks}],baseline:"original"}});v.r==="ok"&&(u("draft_saved",{kind:"arrangement"}),ae(),vt(h,o.name,o.id)),be(v,"\u2713 Saved as a draft \u2014 it will test against this section as it is today. Click \u201CPublish\u201D below to go live.")},Te("arrange",i,a))};ne.onclick=async()=>{var p,y;if(!t||!oe)return;let o=oe,i=t;if(ae(),E("Loading arrangements\u2026"),!St){let f=await pt(e,"/v1/editor/arrangements");St=(p=f==null?void 0:f.arrangements)!=null?p:null}if(!St||St.length===0){E("\u26A0 Couldn\u2019t load the arrangements \u2014 try again.",!1);return}let a=Zo(Zn(i)),l=St.filter(f=>a.includes(f.sectionType));if(l.length===0){E("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}E("Pick a layout for this section \u2014 your own words are carried across.");for(let f of l){let x=c("button",le(K({},F("#374151")),{textAlign:"left"}));x.append(c("div",{fontWeight:"600"},f.name),c("div",{fontSize:"11px",opacity:"0.7"},f.description)),x.onclick=()=>lr(f,o,i),W.append(x)}let d=c("button",le(K({},F("transparent")),{opacity:"0.6"}),"Cancel");d.onclick=ae,W.append(d),(y=W.scrollIntoView)==null||y.call(W,{block:"nearest"})};let it=null,cr=(o,i)=>{it=o,ue.textContent=i?`Start tracking \u201C${Ht(i)}\u201D now`:"Start tracking now",ue.style.display="block",Rn(i?`Goal \u201C${Ht(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.",[Rt(`/v1/editor/goals/${encodeURIComponent(o)}`,"\u{1F5D1} Draft goal discarded \u2014 it never tracked anything.",()=>Fn(o))])};ue.onclick=async()=>{if(!it)return;ue.disabled=!0,E("Activating\u2026");let o=await ce(e,`/v1/editor/goals/${encodeURIComponent(it)}/publish`,{});ue.disabled=!1,o.r==="ok"?(u("published",{kind:"goal"}),E("\u2713 Tracking is live \u2014 it counts from your next visitor.",!0),ue.style.display="none",it=null,Ke.textContent=""):o.r==="expired"?E("Editor session expired \u2014 reopen it from your dashboard to activate. Your saved goal is safe.",!1):E(rn(o,"activate"),!1)};let at=(o,i)=>`${ut(o)||"goal"}-${qo(i)}`.slice(0,128),Qn=o=>{var l,d,p;let i=((l=o.textContent)!=null?l:"").replace(/\s+/g," ").trim();return i&&i.length<=60?i:((p=(d=o.getAttribute("aria-label"))!=null?d:o.getAttribute("id"))!=null?p:"").trim()||"element-clicked"},Et=async(o,i,a)=>{E("Saving\u2026");let l=await ce(e,`/v1/editor/goals/${encodeURIComponent(o)}`,i);return l.r==="ok"&&(u("draft_saved",{kind:"goal"}),cr(o,a)),be(l,"\u2713 Goal saved. Click \u201CStart tracking\u201D below to go live."),l};Q.onclick=()=>{if(!t||!oe)return;let o=at(Qn(t),JSON.stringify(oe));Et(o,{event:"click",locator:oe},Pe(t))},P.onclick=()=>{var l,d;let o=t==null?void 0:t.closest("form");if(!o)return;let i=Je(o,document),a=(d=(l=o.getAttribute("id"))!=null?l:o.getAttribute("name"))!=null?d:"form-submitted";Et(at(a,JSON.stringify(i)),{event:"form_submit",locator:i},a)},re.onclick=()=>{let o=window.location.pathname||"/",i=ut(o)?`reached-${ut(o)}`:"page-visited";Et(at(i,o),{event:"url_reached",urlPattern:o},o)};let ln=[{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=()=>{ht([{key:"depth",label:"Counts once a visitor reads",type:"select",options:ln.map(o=>o.label)}],"Track it",o=>{var l;let i=(l=ln.find(d=>d.label===o.depth))!=null?l:ln[2],a=Math.round(i.value*100);Et(`read-${a}pct`,{event:"scroll_depth",threshold:i.value},`read ${a}%`),ae()})};let jt=null,dr=o=>{jt=o,q.style.display="block"};q.onclick=async()=>{if(!jt)return;q.disabled=!0,E("Turning on\u2026");let o=await ce(e,`/v1/editor/funnels/${encodeURIComponent(jt)}/publish`,{});q.disabled=!1,o.r==="ok"?(u("published",{kind:"funnel"}),E("\u2713 Funnel is on \u2014 the drop-off view fills in as visitors move through it.",!0),q.style.display="none",jt=null):o.r==="expired"?E("Editor session expired \u2014 reopen it from your dashboard to turn the funnel on. Your draft is safe.",!1):E("\u26A0 Couldn\u2019t turn the funnel on \u2014 try again.",!1)},I.onclick=async()=>{var A;E("Loading your goals\u2026");let o=await pt(e,"/v1/editor/goals"),i=(A=o==null?void 0:o.goals)!=null?A:[];if(i.length<2){E("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}E("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"),d=c("input",{display:"block",width:"100%",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"});W.append(l,d);let p=c("div",{fontSize:"11px",opacity:"0.7",marginTop:"6px"},"Steps (click in journey order):");W.append(p);let y=new Map,f=()=>{var h,v;for(let[N,T]of y){let D=a.indexOf(N),G=(v=(h=i.find($=>$.goal_id===N))==null?void 0:h.display_name)!=null?v:N;T.textContent=D===-1?G:`${D+1}. ${G}`,T.style.background=D===-1?"#374151":"#6366f1"}};for(let h of i){let v=c("button",le(K({},F("#374151")),{textAlign:"left"}));y.set(h.goal_id,v),v.onclick=()=>{a=jo(a,h.goal_id),f()},W.append(v)}f();let x=c("button",F("#6366f1"),"Save funnel"),C=c("button",le(K({},F("transparent")),{opacity:"0.6"}),"Cancel");C.onclick=ae,x.onclick=async()=>{let h=Ko(d.value,a);if(!h.ok){E(`\u26A0 ${h.error}`,!1);return}E("Saving\u2026");let v=await ce(e,`/v1/editor/funnels/${encodeURIComponent(h.funnelId)}`,h.body);v.r==="ok"&&(u("draft_saved",{kind:"funnel"}),ae(),dr(h.funnelId)),be(v,"\u2713 Funnel saved as a draft. Click \u201CTurn the funnel on\u201D to start measuring.")},W.append(x,C)},R.onclick=async()=>{var f,x;let o=Ue;if(!o)return;E("Loading funnels\u2026");let i=await pt(e,"/v1/editor/funnels"),a=(f=i==null?void 0:i.funnels)!=null?f:[];if(a.length===0){E("No funnels yet \u2014 click \u201CSet up a funnel\u201D first.",!1);return}let l=await pt(e,"/v1/editor/goals"),d=new Map(((x=l==null?void 0:l.goals)!=null?x:[]).map(C=>[C.goal_id,C.display_name]));ht([{key:"funnel",label:"Funnel",type:"select",options:a.map(C=>Yt(C))},{key:"step",label:"Which step does this element serve?",type:"select",options:Jt(a[0],d).map(C=>C.label)}],"Attach",async C=>{var N;let A=(N=a.find(T=>Yt(T)===C.funnel))!=null?N:a[0],h=Jt(A,d).findIndex(T=>T.label===C.step);if(h<0){E("\u26A0 Pick which step this element serves.",!1);return}E("Attaching\u2026");let v=await ce(e,`/v1/editor/funnels/${encodeURIComponent(A.funnel_id)}/assign`,{slotId:o,stepIndex:h});v.r==="ok"&&ae(),be(v,`\u2713 Attached \u2014 this test now works toward \u201C${A.display_name}\u201D.`)});let p=W.querySelector('select[data-field="funnel"]'),y=W.querySelector('select[data-field="step"]');p&&y&&p.addEventListener("change",()=>{var A;let C=(A=a.find(h=>Yt(h)===p.value))!=null?A:a[0];y.length=1;for(let h of Jt(C,d)){let v=document.createElement("option");v.value=h.label,v.textContent=h.label,y.append(v)}})},X.onclick=()=>{if(!t||!oe)return;u("form_opened",{kind:"style"});let o=oe;ht([{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:Tn.length?`Font (this site has: ${Tn.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(y,f)=>{var N;let{style:x,errors:C}=An(y),A=!1;for(let T of In)f(T,(N=C[T])!=null?N:null),C[T]&&(A=!0);if(A){E("\u26A0 Fix the highlighted field(s).",!1);return}if(Object.keys(x).length===0){E("\u26A0 Enter at least one style change.",!1);return}let h=Te("style",o,t);E("Saving\u2026");let v=await ce(e,`/v1/editor/slots/${encodeURIComponent(h)}`,{kind:"arms",target:bt(o,y[yt]),draftConfig:{arms:[{id:"a",displayName:"Current look",ops:{}},{id:"b",displayName:"New look",ops:{style:x}}]}});v.r==="ok"&&(u("draft_saved",{kind:"slot"}),Kn(),ae(),vt(h,Pe(t),"b")),be(v,"\u2713 Saved as a draft. Click \u201CPublish\u201D below to go live.")},Te("style",o,t));let i=t,a=i.style.cssText;Oe=()=>{i.style.cssText=a};let l={},d=()=>{let{style:y}=An(l);i.style.cssText=a;for(let[f,x]of Object.entries(y)){let C=It[f];C&&lt(x)&&i.style.setProperty(C,x.trim(),"important")}};for(let y of In){let f=W.querySelector(`[data-field="${y}"]`);if(!f)continue;let x=()=>{l[y]=f.value,d()};f.addEventListener("input",x),f.addEventListener("change",x)}let p=[Xe==null?void 0:Xe.primaryBg,Xe==null?void 0:Xe.primaryText,"#ffffff"].filter(y=>!!y).map(Ln).filter((y,f,x)=>Bn(y)&&x.indexOf(y)===f);for(let y of["color","background"]){let f=W.querySelector(`input[data-field="${y}"]`);if(!f)continue;let x=c("div",{display:"flex",gap:"6px",marginTop:"4px"});for(let C of p){let A=c("button",{width:"22px",height:"22px",borderRadius:"6px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.35)",background:C,padding:"0"});A.title=C,A.onclick=()=>{f.value=Ln(C),f.dispatchEvent(new Event("input"))},x.append(A)}f.after(x)}};let We=[],Ct=new Map,cn=!1,fe=null,te=null,Tt=null,ur=()=>{Ct.clear();let o=[],i=(a,l,d)=>{var f;if(o.length>=16||[...Ct.values()].some(x=>x.node===a))return;let p=a===t,y=p?"selected":`e${o.length}`;Ct.set(y,{node:a,locator:l}),o.push(K(K({ref:y,tag:a.tagName.toLowerCase().slice(0,16),text:((f=a.textContent)!=null?f:"").replace(/\s+/g," ").trim().slice(0,300),isLeaf:a.childElementCount===0,inForm:!!a.closest("form")},p?{selected:!0}:{}),d?{label:d.slice(0,120)}:{}))};t&&oe&&Me&&i(t,oe);for(let a of _n){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},dn=()=>{Tt&&(Tt.textContent=t?Me?`Looking at: ${Pe(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.")},eo=(o,i)=>{var d,p;Dt();let a=(d=o.textContent)!=null?d:"",l=o.style.cssText;if(Oe=()=>{o.textContent=a,o.style.cssText=l},!!i){typeof i.text=="string"&&(o.textContent=i.text);for(let[y,f]of Object.entries((p=i.style)!=null?p:{})){let x=It[y];x&&typeof f=="string"&&lt(f)&&o.style.setProperty(x,f.trim(),"important")}}},pr=async o=>{var N,T;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,d=o.versions.some(D=>typeof D.ops.text=="string"),p=Te(d?"text":"style",l,a),y=kn(location.pathname,on[p])[0];E("Saving\u2026");let f=await ce(e,`/v1/editor/slots/${encodeURIComponent(p)}`,{kind:"arms",target:bt(l,y),draftConfig:{arms:[{id:"a",displayName:"Original",ops:d?{text:((N=a.textContent)!=null?N:"").trim()}:{}},...o.versions]}});if(be(f,"\u2713 Draft saved and previewing \u2014 nothing is live until you publish."),f.r!=="ok")return(T=Z.textContent)!=null?T:"\u26A0 Couldn\u2019t save the draft.";u("draft_saved",{kind:"slot",via:"chat"}),a!==t&&kt(a),ae();let x=a;eo(x,o.versions[0].ops),mt=p;try{x.scrollIntoView({block:"center",behavior:"smooth"})}catch(D){}vt(p,o.label,o.versions[0].id);let C=qe("assistant");C.textContent="",C.append(c("div",{fontWeight:"600",marginBottom:"6px"},`Draft: ${o.label}`));let A=c("div",{display:"flex",gap:"5px",flexWrap:"wrap"}),h=[],v=(D,G)=>{for(let $ of h)$.style.background="#374151";D.style.background="#6366f1",eo(x,G),mt=p};for(let[D,G]of[["Original",null],...o.versions.map($=>[$.displayName,$.ops])]){let $=Le("#374151",D);$.onclick=()=>v($,G),h.push($),A.append($)}return h[1].style.background="#6366f1",C.append(A),`[Created draft "${o.label}" with ${o.versions.length} version(s)]`},fr=(o,i,a)=>{var y;let l=[],d={position:"absolute",pointerEvents:"none",zIndex:"2147483645",padding:"2px 6px",borderRadius:"4px",background:"#f59e0b",color:"#111827",font:"600 11px system-ui, sans-serif",whiteSpace:"nowrap"},p=null;if(o){let f=o.getBoundingClientRect();p=f.top+window.scrollY,l.push(c("div",{position:"absolute",pointerEvents:"none",zIndex:"2147483645",left:`${f.left+window.scrollX-3}px`,top:`${p-3}px`,width:`${f.width+6}px`,height:`${f.height+6}px`,border:"2px dashed #f59e0b",borderRadius:"6px"}),c("div",le(K({},d),{left:`${f.left+window.scrollX}px`,top:`${Math.max(0,p-24)}px`}),`Goal: ${a}`))}else i!==void 0&&(p=Math.round(document.documentElement.scrollHeight*i),l.push(c("div",{position:"absolute",pointerEvents:"none",zIndex:"2147483645",left:"0",right:"0",top:`${p}px`,borderTop:"2px dashed #f59e0b"}),c("div",le(K({},d),{left:"16px",top:`${p+4}px`}),`Goal counts here: ${a}`)));if(l.length!==0){if(((y=document.body)!=null?y:document.documentElement).append(...l),p!==null)try{window.scrollTo({top:Math.max(0,p-window.innerHeight/3),behavior:"smooth"})}catch(f){}setTimeout(()=>{for(let f of l)f.remove()},6e3)}},gr=async o=>{var p,y,f,x,C,A;let i=null,a,l;if(o.event==="click"||o.event==="form_submit"){let h=o.ref?Ct.get(o.ref):void 0;if(!h||!h.node.isConnected)return"\u26A0 That element is no longer on the page \u2014 click it and ask again.";if(o.event==="click")i=h.node,a=at(Qn(i),JSON.stringify(h.locator)),l={event:"click",locator:h.locator};else{let v=h.node.closest("form");if(!v)return"\u26A0 That element isn\u2019t inside a form.";let N=Je(v,document);if(!dt(N,v,document))return"\u26A0 This form can\u2019t be targeted reliably, so it can\u2019t be tracked.";i=v,a=at((y=(p=v.getAttribute("id"))!=null?p:v.getAttribute("name"))!=null?y:"form-submitted",JSON.stringify(N)),l={event:"form_submit",locator:N}}}else if(o.event==="url_reached"){let h=(f=o.urlPattern)!=null?f:Mt(location.pathname);a=at(ut(h)?`reached-${ut(h)}`:"page-visited",h),l={event:"url_reached",urlPattern:h}}else a=`read-${Math.round(((x=o.threshold)!=null?x:.75)*100)}pct`,l={event:"scroll_depth",threshold:(C=o.threshold)!=null?C:.75};return(await Et(a,le(K({},l),{displayName:o.displayName}),o.displayName)).r!=="ok"?(A=Z.textContent)!=null?A:"\u26A0 Couldn\u2019t save the goal.":(fr(i,o.event==="scroll_depth"?l.threshold:void 0,o.displayName),`[Created draft goal "${o.displayName}"]`)},to=async o=>{var x,C,A;let i=o.trim();if(!i||cn)return;cn=!0,te&&(te.value="",te.disabled=!0),qe("user",i),We.push({role:"user",content:i.slice(0,4e3)}),u("form_opened",{kind:"chat"});let a=qe("assistant","\u2026"),l="",d=!1,p=[],y=[],f=h=>{var N,T;if(h==="[DONE]")return;let v;try{v=JSON.parse(h)}catch(D){return}if(v.error){p.push("\u26A0 The assistant hit a problem \u2014 try again.");return}if(v.type==="delta"&&v.text)d&&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=d("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=d("span",{width:"9px",height:"9px",marginTop:"4px",borderRadius:"50%",background:"#f59e0b",flex:"0 0 auto"});t.append(n,d("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,Uo(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 Pn(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 ce(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 Pn(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 Pn(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:Pn(r.status,s)}}catch(r){return{r:"error",data:null,outcome:{r:"error"}}}}var $n=[];function Rn(e){return/^#[0-9a-fA-F]{6}$/.test(e)}function Bn(e){let t=e.trim();if(Rn(t))return t;let n=/^#([0-9a-fA-F]{3})$/.exec(t);if(n)return`#${n[1].split("").map(c=>c+c).join("")}`;let r=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/.exec(t);if(!r)return t;let s=c=>Math.min(255,Number(c)).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(`.${An}`)))t.remove()}function nr(e,t=document){var r;mt(t);let n=0;for(let s of e){if(n>=mi)break;let c=we(s.locator,t);if(!c)continue;let m=c.getBoundingClientRect(),x=d("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=An;let g=d("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=An,((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,c=r?Xe(r,t):null;return{prevEl:n,nextEl:r,prevLocator:n&&s&&ut(s,n,t)?s:null,nextLocator:r&&c&&ut(c,r,t)?c: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 Mn=["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,Ci=/^(rgb|rgba|hsl|hsla)\(/i;function Ti(e){return Ei.test(e)||Ci.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 Ti(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 Nn(e){let t={},n={};for(let r of Mn){let s=e[r];if(typeof s!="string")continue;let c=s.trim();if(c==="")continue;if(!ct(c)){n[r]="That value isn\u2019t allowed.";continue}let m=rr(r,c);if(m){n[r]=m;continue}t[r]=c}return{style:t,errors:n}}var Pt={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 d(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){}}},c=(o,i)=>{n.push(K({kind:o},i?{meta:i}:{})),r&&clearTimeout(r),r=setTimeout(s,2e3)};window.addEventListener("pagehide",s);let m=d("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=d("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=d("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 $=d("span",{width:"9px",height:"9px",borderRadius:"50%",background:"#34d399",display:"inline-block",flex:"0 0 auto"});$.className="sntedi-dot";let L=d("div",{display:"flex",alignItems:"center",gap:"8px",fontWeight:"700",fontSize:"14px",marginBottom:"6px"});L.append($,d("span",{},"SentientUI"));let D=d("div",{opacity:"0.85",marginBottom:"8px"},"Click any element on the page to adapt it."),E=!1,z=d("button",F("#374151"),"Pause selecting");z.onclick=()=>{E=!E,z.textContent=E?"Resume selecting":"Pause selecting",E?(m.style.display="none",mt(document),C("Selection paused \u2014 browse normally, then resume.")):C("Click any element on the page to adapt it.")};let J=d("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=d("div",{fontSize:"12px",marginBottom:"8px",minHeight:"16px"}),G=d("button",F("#6366f1"),"Test different text here"),X=d("button",F("#374151"),"Change style"),ne=d("button",F("#374151"),"Try a different layout for this section"),Q=d("button",F("#374151"),"Track clicks as a goal"),M=d("button",F("#374151"),"Track form submissions as a goal"),re=d("button",F("#374151"),"Track page visits as a goal"),ie=d("button",F("#374151"),"Track reading this far as a goal"),A=d("button",F("#374151"),"Set up a funnel"),N=d("button",F("#374151"),"Attach this test to a funnel step"),q=d("button",F("#10b981"),"Turn the funnel on"),B=d("button",F("#374151"),"Move up"),V=d("button",F("#374151"),"Move down"),Se=d("button",F("#6366f1"),"Save this arrangement"),ze=d("button",F("#374151"),"Undo"),Ie=_n("close","Close editor"),ye=d("button",F("#10b981"),"Publish now \u2014 go live"),ue=d("button",F("#10b981"),"Start tracking now");for(let o of[G,X,ne,Q,B,V])o.disabled=!0;let je=[G,X,ne,Q,M,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",N.style.display="none",q.style.display="none";let pe=d("div",{display:"none",fontSize:"11px",opacity:"0.75",marginBottom:"2px",lineHeight:"1.8",overflow:"hidden",textOverflow:"ellipsis"}),ee=d("div",{}),Ae=[{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=d("div",{display:"flex",gap:"0",margin:"10px 0 0",justifyContent:"space-between",borderBottom:"1px solid rgba(255,255,255,0.1)"}),Hn=d("div",{paddingTop:"10px"});for(let o of Ae){let i=d("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(d("span",{fontSize:"11px",marginRight:"3px"},o.icon),d("span",{},o.label)),i.onclick=()=>ar(o.id),et.set(o.id,i),Dn.append(i);let a=d("div",{display:"none"}),l=d("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(G),ve.get("style").append(X),ve.get("layout").append(ne,B,V,Se,ze),ve.get("goals").append(Q,M,re,ie),ve.get("funnels").append(A,N,q);let xe=d("div",{});ve.get("drafts").append(xe);let Rt=()=>{var i,a;for(let l of Ae){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?G.disabled?o(G.title||"This element can\u2019t be targeted reliably \u2014 try its heading or a button."):(i=G.onclick)==null||i.call(G,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)=>d("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=d("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=d("div",{display:"flex",gap:"6px",flexWrap:"wrap"});l.append(...i),a.append(d("div",{marginBottom:"6px"},o),l),Ke.append(a)},tt=async()=>{var S,T,w,v,b,_,P,H,U,R,ge,me;xe.textContent="",xe.append(d("div",{fontSize:"12px",opacity:"0.6",padding:"4px 0"},"Loading\u2026"));let o=[],i=[],a=null,l=!1;if(await Promise.all([(async()=>{var I;try{let j=await fetch(`${e.apiBase}/v1/editor/slots`,{headers:{authorization:`Bearer ${e.token}`}});j.ok?o=(I=(await j.json()).slots)!=null?I:[]:a=j.status===401?"expired":"error"}catch(j){a="error"}})(),(async()=>{var I;try{let j=await fetch(`${e.apiBase}/v1/editor/goals`,{headers:{authorization:`Bearer ${e.token}`}});j.ok?i=(I=(await j.json()).goals)!=null?I:[]:l=!0}catch(j){l=!0}})()]),Y!=="drafts")return;if(xe.textContent="",a){if(xe.append(d("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 I=Le("#374151","Retry");I.onclick=()=>{tt()},xe.append(I)}return}let u=o.filter(I=>{var j,se,_e,Pe,Ve,_t;return((_e=(se=(j=I.draft_config)==null?void 0:j.arms)==null?void 0:se.length)!=null?_e:0)>0||((_t=(Ve=(Pe=I.published_config)==null?void 0:Pe.arms)==null?void 0:Ve.length)!=null?_t:0)>0}),f=i.filter(I=>I.event!=="custom"&&(I.status==="draft"||I.status==="active"));if(u.length===0&&f.length===0&&!l){xe.append(d("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=I=>d("span",{fontSize:"10px",padding:"2px 7px",borderRadius:"999px",flex:"0 0 auto",background:I?"rgba(16,185,129,0.2)":"rgba(99,102,241,0.25)",color:I?"#6ee7b7":"#c7d2fe"},I?"live":"draft"),p=I=>{let j=d("div",{display:"flex",alignItems:"center",gap:"6px",padding:"7px 0",borderBottom:"1px solid rgba(255,255,255,0.08)",fontSize:"12px"}),se=d("div",{flex:"1 1 auto",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},I);return j.append(se),{row:j,name:se}};for(let I of u){let{row:j}=p((S=I.display_name)!=null?S:I.slot_id);j.append(h(I.status==="published"));let se=(b=(v=(T=I.draft_config)==null?void 0:T.arms)!=null?v:(w=I.published_config)==null?void 0:w.arms)!=null?b:[],_e=(H=(_=se[1])==null?void 0:_.id)!=null?H:(P=se[0])==null?void 0:P.id,Pe=Le("#374151","Preview");if(Pe.onclick=()=>zn(I.slot_id,_e),j.append(Pe),I.status!=="published"&&((ge=(R=(U=I.draft_config)==null?void 0:U.arms)==null?void 0:R.length)!=null?ge:0)>0){let Ve=Le("#10b981","Publish");Ve.onclick=async()=>{Ve.disabled=!0;let _t=await ce(e,`/v1/editor/slots/${encodeURIComponent(I.slot_id)}/publish`,{});Ve.disabled=!1,be(_t,"\u2713 Published \u2014 live for new visitors."),_t.r==="ok"&&(c("published",{kind:"slot"}),tt())},j.append(Ve)}I.status!=="published"&&j.append(Dt(`/v1/editor/slots/${encodeURIComponent(I.slot_id)}`,"\u{1F5D1} Draft discarded \u2014 nothing changed for your visitors.",()=>{Yn(I.slot_id),tt()})),xe.append(j)}if(l)xe.append(d("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(d("div",{fontSize:"11px",opacity:"0.6",padding:"8px 0 2px"},"Goals"));for(let I of f){let{row:j}=p((me=I.display_name)!=null?me:I.goal_id);if(j.append(h(I.status==="active")),I.status==="draft"){let se=Le("#10b981","Start tracking");se.onclick=async()=>{se.disabled=!0;let _e=await ce(e,`/v1/editor/goals/${encodeURIComponent(I.goal_id)}/publish`,{});se.disabled=!1,be(_e,"\u2713 Tracking is live \u2014 it counts from your next visitor."),_e.r==="ok"&&(c("published",{kind:"goal"}),tt())},j.append(se,Dt(`/v1/editor/goals/${encodeURIComponent(I.goal_id)}`,"\u{1F5D1} Draft goal discarded \u2014 it never tracked anything.",()=>{Jn(I.goal_id),tt()}))}xe.append(j)}}},ar=o=>{Y!==o&&(ae(),kt(),Y=o,Rt())},Kn=d("div",{display:"flex",alignItems:"center",gap:"6px",marginBottom:"10px"});Object.assign(L.style,{marginBottom:"0",flex:"1 1 auto",fontSize:"13px",whiteSpace:"nowrap"});let Un=!1,Be=d("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(_i(26)),Be.title="Open the SentientUI editor",Be.setAttribute("aria-label","Open the SentientUI editor");let Gn=_n("minimize","Minimize");Gn.onclick=()=>{y.style.display="none",Be.style.display="flex",Un=E,E=!0,m.style.display="none",mt(document)},Be.onclick=()=>{y.style.display="block",Be.style.display="none",E=Un},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,Gn,Ie);let Fn=d("div",{marginTop:"10px",borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"8px"}),Ke=d("div",{});Object.assign(Z.style,{marginBottom:"4px"}),Fn.append(Ke,Z,ye,ue);let Wn=d("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=d("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=d("div",{}),W=d("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 T;ae();let u={},f={};for(let w of o){let v=d("label",{display:"block",fontSize:"12px",opacity:"0.85",marginTop:"8px"},w.label);if(W.append(v),w.type==="select"){let _=d("select",Pt);_.setAttribute("data-field",w.key);let P=document.createElement("option");P.value="",P.textContent="\u2014 no change \u2014",_.append(P);for(let H of(T=w.options)!=null?T:[]){let U=document.createElement("option");U.value=H,U.textContent=H,_.append(U)}u[w.key]=()=>_.value,W.append(_)}else if(w.type==="color"){let _=d("input",le(K({},Pt),{padding:"2px",height:"34px"}));_.type="color",_.setAttribute("data-field",w.key);let P=!1;_.addEventListener("input",()=>{P=!0}),u[w.key]=()=>P?_.value:"",W.append(_)}else{let _=d("input",Pt);_.setAttribute("data-field",w.key),w.value!==void 0&&(_.value=w.value),u[w.key]=()=>_.value,W.append(_)}let b=d("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=d("button",F("#6366f1"),i),S=d("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=Nt(location.pathname),a=d("div",{}),l=d("select",Pt);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(d("label",{display:"block",fontSize:"12px",opacity:"0.85",marginTop:"8px"},"Where does this appear?"),l,d("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,C=(o,i=!0)=>{Z.textContent=o,Z.style.color=i?"#a7f3d0":"#fca5a5"},sn=(o,i)=>{var l,u;if(c("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"?C(i,!0):o.r==="expired"?C("Editor session expired \u2014 reopen it from your dashboard to save this. Your earlier changes are safe.",!1):C(sn(o,"save"),!1)},Ue=null,jt=o=>o.length>30?`${o.slice(0,27)}\u2026`:o,Yn=o=>{Ue===o&&(ht===o&&(zt(),ht=null),Ue=null,ye.style.display="none",N.style.display="none",Ke.textContent="")},Jn=o=>{at===o&&(at=null,ue.style.display="none",Ke.textContent="")},xt=(o,i,a)=>{Ue=o,ye.textContent=i?`Publish \u201C${jt(i)}\u201D \u2014 go live`:"Publish now \u2014 go live",ye.style.display="block",N.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(!Ue)return;ye.disabled=!0,C("Publishing\u2026");let o=await ce(e,`/v1/editor/slots/${encodeURIComponent(Ue)}/publish`,{});ye.disabled=!1,o.r==="ok"?(c("published",{kind:"slot"}),C("\u2713 Published \u2014 live for new visitors.",!0),ye.style.display="none",Ue=null,Ke.textContent=""):o.r==="expired"?C("Editor session expired \u2014 reopen it from your dashboard to publish. Your saved draft is safe.",!1):C(sn(o,"publish"),!1)};let oe=null,Me=!1,ot=null,rt=null,Ee=null,Ge=null,wt=null,Kt=null,Fe=!1,Xn=(o,i)=>Me?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=!Me||!Ee,V.disabled=!Me||!Ge,B.title=B.disabled?Xn(Ee,"above"):"",V.title=V.disabled?Xn(Ge,"below"):""},Ce=null,ln=o=>{o&&!Ce&&t&&oe?(Ce=Vn(Te("move",oe,t)),Se.before(Ce.node)):o||(Ce==null||Ce.node.remove(),Ce=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,Ge=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`})},Ne=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"),cr=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()}>`},dr=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=Ne(o),l=()=>d("span",{opacity:"0.5",margin:"0 4px"},"\u2039"),u=!0;for(let h of i){let p=cr(h);if(p===a||a.startsWith(p))continue;let S=d("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=d("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=d("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(d("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=d("button",le(K({},F("#6366f1")),{marginTop:"0"}),`Select \u201C${Ne(u)}\u201D instead`);f.onclick=()=>St(u);let h=d("button",le(K({},F("transparent")),{opacity:"0.6"}),"Pick something else");h.onclick=()=>{ee.textContent=""},l.append(f,h)}else l.append(d("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);Me=i,g(),J.style.display="block",J.textContent=`Selected: ${Ne(o)}`,dr(o),c("element_selected",{unique:i}),C(i?"\u2713 Matches exactly 1 element":"",i),i||ur(o),D.style.display="none",pn();for(let f of je)f.style.display="block";G.style.display="none",X.style.display="none";let a=vn(o);G.disabled=!i||!a,G.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");M.style.display=l?"block":"none",M.disabled=!l;let u=en(o,document);ot=u.prevEl,rt=u.nextEl,Ee=u.prevLocator,Ge=u.nextLocator,Zn(),Rt()},eo=()=>{kt(),ae(),t=null,oe=null,Me=!1,ot=null,rt=null,Ee=null,Ge=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",C(""),Rt()},it=!1,cn=-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,C("Press Esc again to close the editor.");return}it=!1,(u=Ie.onclick)==null||u.call(Ie,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){C("\u26A0 You have unsaved changes \u2014 Save or Cancel before picking another element.",!1),o.preventDefault();return}o.preventDefault(),cn=(cn+(o.shiftKey?-1:1)+f.length)%f.length;let h=f[cn];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,C("\u26A0 You have unsaved changes \u2014 Save or Cancel first, or click that element again to discard them.",!1);return}St(i)}};G.onclick=()=>{var f,h;if(!t||!oe)return;c("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){C("\u26A0 Enter alternative wording to test.",!1);return}if(S===p.current.trim()){C("\u26A0 Enter different wording \u2014 the alternative matches the current text.",!1);return}let T=Te("text",o,t);C("Saving\u2026");let w=await ce(e,`/v1/editor/slots/${encodeURIComponent(T)}`,{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"&&(c("draft_saved",{kind:"slot"}),qn(),ae(),xt(T,Ne(t),"b")),be(w,"\u2713 Saved as a draft. Click \u201CPublish\u201D below to go live.")},Te("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 T="",w=p.getAttribute("href");if(w)try{let v=new URL(w,window.location.href);v.protocol==="https:"&&(T=v.href)}catch(v){}u.push({label:S,href:T})}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,T,w,v,b,_,P,H,U,R,ge,me,I,j,se;let a=_e=>{var Pe;return i.paragraphs.length>=3&&(Pe=i.paragraphs[i.paragraphs.length-3+_e])!=null?Pe:""};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=(T=i.links[1])==null?void 0:T.label)!=null?w:"";case"secondary_href":return(b=(v=i.links[1])==null?void 0:v.href)!=null?b:"";case"quote":case"q1":return(_=i.quotes[0])!=null?_:"";case"q2":return(P=i.quotes[1])!=null?P:"";case"q3":return(H=i.quotes[2])!=null?H:"";case"name":case"n1":return(U=i.attributions[0])!=null?U:"";case"n2":return(R=i.attributions[1])!=null?R:"";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=i.headings[1])!=null?I:"";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)=>{c("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 _,P,U,R,ge;let h=!1,p=!1;for(let me of o.fields){if(me.kind==="href"){let j=!1;try{j=new URL((_=u[me.id])!=null?_:"").protocol==="https:"}catch(se){}f(me.id,j?null:"Links need to start with https://"),j||(h=!0);continue}let I=((P=u[me.id])!=null?P:"").trim()==="";f(me.id,I?"Fill this in with your own words":null),I&&(p=!0)}if(h){C("\u26A0 Fix the highlighted link(s).",!1);return}if(p){C("\u26A0 Every field needs your own words \u2014 this layout re-arranges your copy, it doesn\u2019t write any.",!1);return}C("Saving\u2026");let H=u,{[bt]:S}=H,T=po(H,[uo(bt)]),w=await vi(e,`/v1/editor/arrangements/${encodeURIComponent(o.id)}/instantiate`,{fields:T});if(w.r!=="ok"||!((U=w.data)!=null&&U.blocks)){w.r==="expired"?be(w.outcome,""):C(`\u26A0 ${(ge=(R=w.data)==null?void 0:R.reason)!=null?ge:"Couldn\u2019t build the arrangement \u2014 check the fields."}`,!1);return}let v=Te("arrange",i,a),b=await ce(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"&&(c("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.")},Te("arrange",i,a))};ne.onclick=async()=>{var f,h;if(!t||!oe)return;let o=oe,i=t;if(ae(),C("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){C("\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){C("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}C("Pick a layout for this section \u2014 your own words are carried across.");for(let p of l){let S=d("button",le(K({},F("#374151")),{textAlign:"left"}));S.append(d("div",{fontWeight:"600"},p.name),d("div",{fontSize:"11px",opacity:"0.7"},p.description)),S.onclick=()=>fr(p,o,i),W.append(S)}let u=d("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,C("Activating\u2026");let o=await ce(e,`/v1/editor/goals/${encodeURIComponent(at)}/publish`,{});ue.disabled=!1,o.r==="ok"?(c("published",{kind:"goal"}),C("\u2713 Tracking is live \u2014 it counts from your next visitor.",!0),ue.style.display="none",at=null,Ke.textContent=""):o.r==="expired"?C("Editor session expired \u2014 reopen it from your dashboard to activate. Your saved goal is safe.",!1):C(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"},Ct=async(o,i,a)=>{C("Saving\u2026");let l=await ce(e,`/v1/editor/goals/${encodeURIComponent(o)}`,i);return l.r==="ok"&&(c("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));Ct(o,{event:"click",locator:oe},Ne(t))},M.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";Ct(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";Ct(st(i,o),{event:"url_reached",urlPattern:o},o)};let dn=[{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:dn.map(o=>o.label)}],"Track it",o=>{var l;let i=(l=dn.find(u=>u.label===o.depth))!=null?l:dn[2],a=Math.round(i.value*100);Ct(`read-${a}pct`,{event:"scroll_depth",threshold:i.value},`read ${a}%`),ae()})};let Ut=null,mr=o=>{Ut=o,q.style.display="block"};q.onclick=async()=>{if(!Ut)return;q.disabled=!0,C("Turning on\u2026");let o=await ce(e,`/v1/editor/funnels/${encodeURIComponent(Ut)}/publish`,{});q.disabled=!1,o.r==="ok"?(c("published",{kind:"funnel"}),C("\u2713 Funnel is on \u2014 the drop-off view fills in as visitors move through it.",!0),q.style.display="none",Ut=null):o.r==="expired"?C("Editor session expired \u2014 reopen it from your dashboard to turn the funnel on. Your draft is safe.",!1):C("\u26A0 Couldn\u2019t turn the funnel on \u2014 try again.",!1)},A.onclick=async()=>{var w;C("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){C("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}C("Pick the steps in order \u2014 first click = first step."),ae();let a=[],l=d("label",{display:"block",fontSize:"12px",opacity:"0.85",marginTop:"8px"},"Funnel name"),u=d("input",Pt);W.append(l,u);let f=d("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[_,P]of h){let H=a.indexOf(_),U=(b=(v=i.find(R=>R.goal_id===_))==null?void 0:v.display_name)!=null?b:_;P.textContent=H===-1?U:`${H+1}. ${U}`,P.style.background=H===-1?"#374151":"#6366f1"}};for(let v of i){let b=d("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=d("button",F("#6366f1"),"Save funnel"),T=d("button",le(K({},F("transparent")),{opacity:"0.6"}),"Cancel");T.onclick=ae,S.onclick=async()=>{let v=qo(u.value,a);if(!v.ok){C(`\u26A0 ${v.error}`,!1);return}C("Saving\u2026");let b=await ce(e,`/v1/editor/funnels/${encodeURIComponent(v.funnelId)}`,v.body);b.r==="ok"&&(c("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,T)},N.onclick=async()=>{var p,S;let o=Ue;if(!o)return;C("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){C("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(T=>[T.goal_id,T.display_name]));yt([{key:"funnel",label:"Funnel",type:"select",options:a.map(T=>Xt(T))},{key:"step",label:"Which step does this element serve?",type:"select",options:Zt(a[0],u).map(T=>T.label)}],"Attach",async T=>{var _;let w=(_=a.find(P=>Xt(P)===T.funnel))!=null?_:a[0],v=Zt(w,u).findIndex(P=>P.label===T.step);if(v<0){C("\u26A0 Pick which step this element serves.",!1);return}C("Attaching\u2026");let b=await ce(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 T=(w=a.find(v=>Xt(v)===f.value))!=null?w:a[0];h.length=1;for(let v of Zt(T,u)){let b=document.createElement("option");b.value=v.label,b.textContent=v.label,h.append(b)}})},X.onclick=()=>{if(!t||!oe)return;c("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 _;let{style:S,errors:T}=Nn(h),w=!1;for(let P of Mn)p(P,(_=T[P])!=null?_:null),T[P]&&(w=!0);if(w){C("\u26A0 Fix the highlighted field(s).",!1);return}if(Object.keys(S).length===0){C("\u26A0 Enter at least one style change.",!1);return}let v=Te("style",o,t);C("Saving\u2026");let b=await ce(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"&&(c("draft_saved",{kind:"slot"}),qn(),ae(),xt(v,Ne(t),"b")),be(b,"\u2713 Saved as a draft. Click \u201CPublish\u201D below to go live.")},Te("style",o,t));let i=t,a=i.style.cssText;Oe=()=>{i.style.cssText=a};let l={},u=()=>{let{style:h}=Nn(l);i.style.cssText=a;for(let[p,S]of Object.entries(h)){let T=At[p];T&&ct(S)&&i.style.setProperty(T,S.trim(),"important")}};for(let h of Mn){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)=>Rn(h)&&S.indexOf(h)===p);for(let h of["color","background"]){let p=W.querySelector(`input[data-field="${h}"]`);if(!p)continue;let S=d("div",{display:"flex",gap:"6px",marginTop:"4px"});for(let T of f){let w=d("button",{width:"22px",height:"22px",borderRadius:"6px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.35)",background:T,padding:"0"});w.title=T,w.onclick=()=>{p.value=Bn(T),p.dispatchEvent(new Event("input"))},S.append(w)}p.after(S)}};let We=[],Tt=new Map,un=!1,fe=null,te=null,Lt=null,hr=()=>{Tt.clear();let o=[],i=(a,l,u)=>{var p;if(o.length>=16||[...Tt.values()].some(S=>S.node===a))return;let f=a===t,h=f?"selected":`e${o.length}`;Tt.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&&Me&&i(t,oe);for(let a of On){let l=we(a.locator,document);l&&i(l,a.locator,a.label)}return{pagePath:Nt(location.pathname),pageTitle:document.title.slice(0,200),elements:o}},qe=(o,i="")=>{let a=o==="user",l=d("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?Me?`Looking at: ${Ne(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=At[f];p&&typeof h=="string"&&ct(h)&&o.style.setProperty(p,h.trim(),"important")}}},yr=async o=>{var _,P;let i=Tt.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=Te(u?"text":"style",l,a),h=Ln(location.pathname,an[f])[0];C("Saving\u2026");let p=await ce(e,`/v1/editor/slots/${encodeURIComponent(f)}`,{kind:"arms",target:vt(l,h),draftConfig:{arms:[{id:"a",displayName:"Original",ops:u?{text:((_=a.textContent)!=null?_:"").trim()}:{}},...o.versions]}});if(be(p,"\u2713 Draft saved and previewing \u2014 nothing is live until you publish."),p.r!=="ok")return(P=Z.textContent)!=null?P:"\u26A0 Couldn\u2019t save the draft.";c("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 T=qe("assistant");T.textContent="",T.append(d("div",{fontWeight:"600",marginBottom:"6px"},`Draft: ${o.label}`));let w=d("div",{display:"flex",gap:"5px",flexWrap:"wrap"}),v=[],b=(H,U)=>{for(let R of v)R.style.background="#374151";H.style.background="#6366f1",io(S,U),ht=f};for(let[H,U]of[["Original",null],...o.versions.map(R=>[R.displayName,R.ops])]){let R=Le("#374151",H);R.onclick=()=>b(R,U),v.push(R),w.append(R)}return v[1].style.background="#6366f1",T.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(d("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"}),d("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(d("div",{position:"absolute",pointerEvents:"none",zIndex:"2147483645",left:"0",right:"0",top:`${f}px`,borderTop:"2px dashed #f59e0b"}),d("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,T,w;let i=null,a,l;if(o.event==="click"||o.event==="form_submit"){let v=o.ref?Tt.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 _=Xe(b,document);if(!ut(_,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(_)),l={event:"form_submit",locator:_}}}else if(o.event==="url_reached"){let v=(p=o.urlPattern)!=null?p:Nt(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:(T=o.threshold)!=null?T:.75};return(await Ct(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,T,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)}),c("form_opened",{kind:"chat"});let a=qe("assistant","\u2026"),l="",u=!1,f=[],h=[],p=v=>{var _,P;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
- `),d=!1,l+=v.text,a.textContent=l,fe&&(fe.scrollTop=fe.scrollHeight);else if(v.type==="tool_status")d=!0,v.state==="running"&&!l&&(a.textContent=(N=v.name)!=null&&N.startsWith("create_")?"Creating a draft\u2026":"Thinking\u2026");else if(v.type==="choice_prompt"&&v.question){l+=(l?`
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=(_=b.name)!=null&&_.startsWith("create_")?"Creating a draft\u2026":"Thinking\u2026");else if(b.type==="choice_prompt"&&b.question){l+=(l?`
27
27
 
28
- `:"")+v.question,a.textContent=l;let D=c("div",{display:"flex",gap:"5px",flexWrap:"wrap",marginTop:"6px"});for(let G of(T=v.options)!=null?T:[]){let $=Le("#374151",G.label);$.onclick=()=>{to(G.label)},D.append($)}a.append(D)}else if(v.type==="artifact"&&v.artifact){let D=v.artifact.type==="editor_component_draft"?pr(v.artifact.payload):v.artifact.type==="editor_goal_draft"?gr(v.artifact.payload):null;D&&y.push(D.then(G=>{p.push(G),G.startsWith("\u26A0")&&qe("note",G)}))}};try{let h=We.slice(-20);for(;((x=h[0])==null?void 0:x.role)==="assistant";)h=h.slice(1);let v=await fetch(`${e.apiBase}/v1/editor/chat`,{method:"POST",headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify({messages:h,context:ur()})});if(!v.ok){let $=(C=await v.json().catch(()=>null))==null?void 0:C.error;a.textContent=v.status===401?"Editor session expired \u2014 reopen it from your dashboard. Your drafts are safe.":$==="rate_limit"?"You\u2019ve used today\u2019s AI allowance \u2014 more tomorrow, or upgrade for a bigger daily budget.":$==="plan_required"?"AI chat isn\u2019t included in this plan.":$==="ai_unavailable"?"The assistant is unavailable right now \u2014 try again later.":`\u26A0 Couldn\u2019t reach the assistant \u2014 try again. (HTTP ${v.status})`,We.pop();return}let N=(A=v.body)==null?void 0:A.getReader(),T="",D=()=>{let $;for(;($=T.indexOf(`
28
+ `:"")+b.question,a.textContent=l;let H=d("div",{display:"flex",gap:"5px",flexWrap:"wrap",marginTop:"6px"});for(let U of(P=b.options)!=null?P:[]){let R=Le("#374151",U.label);R.onclick=()=>{ao(U.label)},H.append(R)}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(U=>{f.push(U),U.startsWith("\u26A0")&&qe("note",U)}))}};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 R=(T=await b.json().catch(()=>null))==null?void 0:T.error;a.textContent=b.status===401?"Editor session expired \u2014 reopen it from your dashboard. Your drafts are safe.":R==="rate_limit"?"You\u2019ve used today\u2019s AI allowance \u2014 more tomorrow, or upgrade for a bigger daily budget.":R==="plan_required"?"AI chat isn\u2019t included in this plan.":R==="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 _=(w=b.body)==null?void 0:w.getReader(),P="",H=()=>{let R;for(;(R=P.indexOf(`
29
29
 
30
- `))>=0;){for(let ge of T.slice(0,$).split(`
31
- `))ge.startsWith("data: ")&&f(ge.slice(6));T=T.slice($+2)}};if(N){let $=new TextDecoder;for(;;){let{done:ge,value:me}=await N.read();if(ge)break;T+=$.decode(me,{stream:!0}),D()}}else T=await v.text();T+=`
30
+ `))>=0;){for(let ge of P.slice(0,R).split(`
31
+ `))ge.startsWith("data: ")&&p(ge.slice(6));P=P.slice(R+2)}};if(_){let R=new TextDecoder;for(;;){let{done:ge,value:me}=await _.read();if(ge)break;P+=R.decode(me,{stream:!0}),H()}}else P=await b.text();P+=`
32
32
 
33
- `,D(),await Promise.all(y),l||(a.textContent=p.some($=>$.startsWith("["))?"Done \u2014 have a look at the page.":"No reply \u2014 try rephrasing.");for(let $ of p)$.startsWith("\u26A0 The assistant")&&qe("note",$);let G=[l,...p.filter($=>$.startsWith("["))].filter(Boolean).join(`
34
- `);We.push({role:"assistant",content:(G||"(no reply)").slice(0,4e3)})}catch(h){a.textContent="\u26A0 Couldn\u2019t reach the assistant \u2014 check your connection and try again.",We.pop()}finally{cn=!1,te&&(te.disabled=!1,te.focus())}},mr=()=>{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=Sn("close","Close AI chat");if(a.onclick=()=>{Nt.textContent="",fe=null,te=null,Tt=null},i.append(c("div",{fontWeight:"600",flex:"1 1 auto"},"\u2728 AI"),a),Tt=c("div",{fontSize:"11px",opacity:"0.7",marginBottom:"4px"}),dn(),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 p of We)qe(p.role,p.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 d=Le("#6366f1","Send");d.setAttribute("data-action","ai-send"),d.onclick=()=>{te&&to(te.value)},te.onkeydown=p=>{var y;p.key==="Enter"&&(p.preventDefault(),(y=d.onclick)==null||y.call(d,new MouseEvent("click")))},l.append(te,d),o.append(i,Tt,fe,l),Nt.textContent="",Nt.append(o),te.focus()};jn.onclick=()=>mr();let un=o=>{if(!t)return;let i=t.parentElement;if(!i)return;Fe||(xt=i,zt=t.nextSibling,Fe=!0),o==="up"&&nt?i.insertBefore(t,nt):o==="down"&&ot&&i.insertBefore(t,ot.nextSibling);let a=Zt(t,document);nt=a.prevEl,ot=a.nextEl,Ee=a.prevLocator,Ge=a.nextLocator;try{t.scrollIntoView({block:"nearest",behavior:"smooth"})}catch(l){}g(),an(!0),E("Previewing the new position \u2014 keep moving, save, or undo.")};O.onclick=()=>un("up"),V.onclick=()=>un("down"),ze.onclick=()=>{wt(),E("Move undone \u2014 back to the original position.")},Se.onclick=async()=>{if(!t||!oe||!Fe||!Me)return;let o=Ee?"moveAfter":"moveBefore",i=Ee!=null?Ee:Ge;if(!i){E("\u26A0 Couldn\u2019t anchor the new position \u2014 nudge it next to a section with an id.",!1);return}let a=Te("move",oe,t);E("Saving\u2026");let l=await ce(e,`/v1/editor/slots/${encodeURIComponent(a)}`,{kind:"arms",target:bt(oe,Ce==null?void 0:Ce.value()),draftConfig:{arms:[{id:"a",ops:{}},{id:"b",ops:{[o]:i}}]}});l.r==="ok"&&(u("draft_saved",{kind:"move"}),Fe=!1,xt=null,zt=null,an(!1),vt(a,Pe(t),"b")),be(l,"\u2713 Saved as a draft. Click \u201CPublish\u201D below to go live.")};let hr=()=>{var o,i;u("editor_closed"),s(),window.removeEventListener("pagehide",s),r&&clearTimeout(r),wt(),Dt(),document.removeEventListener("mousemove",Vn,!0),document.removeEventListener("click",Xn,!0),document.removeEventListener("keydown",Jn,!0),window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k),gt(document),(o=document.getElementById(En))==null||o.remove(),m.remove(),w.remove(),b.remove(),Be.remove(),window.__sentientEditor=null,(i=document.querySelector("meta[data-sentient-editor]"))==null||i.remove(),Ot()},pn=!1;Ie.onclick=()=>{if((tt||Fe)&&!pn){pn=!0,E("\u26A0 Unsaved changes \u2014 click \xD7 again to discard them.",!1);return}hr()},document.addEventListener("mousemove",Vn,!0),document.addEventListener("click",Xn,!0),document.addEventListener("keydown",Jn,!0),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),Pt(),u("editor_opened")}var ki="http://www.w3.org/2000/svg";function Ze(e,t){let n=document.createElementNS(ki,e);for(let[r,s]of Object.entries(t))n.setAttribute(r,s);return n}function Si(e){let t=Ze("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(Ze("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)),Ze("path",K({d:"M10 22H17"},n)),Ze("circle",{cx:"20.6",cy:"22",r:"2.1",fill:"#fff"})),t}function Sn(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=Ze("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(Ze("path",K({d:"M3 7h8"},s))):r.append(Ze("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 en="sentient-preview-bar";async function Ei(e,t){var b,B,L,H,S,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=(B=((b=(await P.json()).slots)!=null?b:[]).find(ie=>ie.slot_id===t&&ie.kind==="arms"))!=null?B: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=en;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=()=>{Ot();let P=new URL(location.href);for(let re of["sentient_preview","sentient_arm"])P.searchParams.delete(re);location.assign(P.toString())};let u=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");u.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=(S=(L=n==null?void 0:n.draft_config)==null?void 0:L.arms)!=null?S:(H=n==null?void 0:n.published_config)==null?void 0:H.arms)!=null?z:[];if(!n||m.length===0){r.append(c("span",{},"Couldn\u2019t load this preview \u2014 reopen it from your dashboard."),u,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 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{fo(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(u,s),((Q=document.body)!=null?Q:document.documentElement).append(r)}async function Ci(e,t){var b,B,L,H;let n=t.lastIndexOf("~"),r=n>0?t.slice(0,n):t,s=n>0?t.slice(n+1):"",u=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)"});u.id=en;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=()=>{Ot();let S=new URL(location.href);for(let z of["sentient_preview_cell","sentient_refresh_region"])S.searchParams.delete(z);location.assign(S.toString())};let w=S=>{var z;u.append(c("span",{},S),m),((z=document.body)!=null?z:document.documentElement).append(u)},g=null;try{let S=await fetch(`${e.apiBase}/v1/editor/cell-preview?slotId=${encodeURIComponent(r)}&persona=${encodeURIComponent(s)}`,{headers:{authorization:`Bearer ${e.token}`}});S.ok&&(g=await S.json())}catch(S){}if(!g)return w("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 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(Bo(k,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)&&yo(g.vocabulary),wo(k,{preview:(b=g.compose)!=null?b:g.blocks},"preview",document);else if(typeof g.content=="string")k.textContent=g.content;else return w("Nothing to preview in that square yet.");try{k.scrollIntoView({block:"center"})}catch(S){}u.append(c("span",{fontWeight:"700"},`Previewing: ${(B=g.slotName)!=null?B: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),((H=document.body)!=null?H:document.documentElement).append(u)}async function Fo(e,t){var u;let n=await pt(e,"/v1/editor/slots"),r=((u=n==null?void 0:n.slots)!=null?u:[]).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=Io(w),k=g.skeleton?{slotId:m.slot_id,skeleton:g.skeleton}:{slotId:m.slot_id,status:g.reason};s=(await ce(e,"/v1/editor/region-skeleton",k)).r==="ok"?"ok":"failed"}return s}async function Wo(e){try{await ce(e,"/v1/editor/style-vocabulary",Po(document))}catch(t){}}async function Ti(){if(typeof document=="undefined")return;let e=ui();if(!e)return;if(e.code){let w=await Yo(e);if(w!==200){Xt(w===401?Uo:Go);return}}let t=await pi(e);if(!t.ok){t.unauthorized?(Ot(),Xt(Uo)):Xt(Go);return}let n=new URLSearchParams(location.search).get("sentient_preview");if(n){document.getElementById(en)||await Ei(e,n);return}let r=new URLSearchParams(location.search).get("sentient_preview_cell");if(r){document.getElementById(en)||await Ci(e,r),Wo(e);return}let s=new URLSearchParams(location.search).get("sentient_refresh_region");if(s){let w=await Fo(e,s);Xt(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(ft))return;er(e);let u=Ho(document);Xe=u,u&&ce(e,"/v1/editor/palette",u),Wo(e),Fo(e).catch(()=>{});let m=await mi(e);Jo(m),Xo(m,document)}Ti();return Er(Li);})();
33
+ `,H(),await Promise.all(h),l||(a.textContent=f.some(R=>R.startsWith("["))?"Done \u2014 have a look at the page.":"No reply \u2014 try rephrasing.");for(let R of f)R.startsWith("\u26A0 The assistant")&&qe("note",R);let U=[l,...f.filter(R=>R.startsWith("["))].filter(Boolean).join(`
34
+ `);We.push({role:"assistant",content:(U||"(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=d("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=d("div",{display:"flex",alignItems:"center",gap:"6px",marginBottom:"4px"}),a=_n("close","Close AI chat");if(a.onclick=()=>{Ht.textContent="",fe=null,te=null,Lt=null},i.append(d("div",{fontWeight:"600",flex:"1 1 auto"},"\u2728 AI"),a),Lt=d("div",{fontSize:"11px",opacity:"0.7",marginBottom:"4px"}),pn(),fe=d("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=d("div",{display:"flex",gap:"6px",marginTop:"6px"});te=d("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,Ge=a.nextLocator;try{t.scrollIntoView({block:"nearest",behavior:"smooth"})}catch(l){}g(),ln(!0),C("Previewing the new position \u2014 keep moving, save, or undo.")};B.onclick=()=>fn("up"),V.onclick=()=>fn("down"),ze.onclick=()=>{kt(),C("Move undone \u2014 back to the original position.")},Se.onclick=async()=>{if(!t||!oe||!Fe||!Me)return;let o=Ee?"moveAfter":"moveBefore",i=Ee!=null?Ee:Ge;if(!i){C("\u26A0 Couldn\u2019t anchor the new position \u2014 nudge it next to a section with an id.",!1);return}let a=Te("move",oe,t);C("Saving\u2026");let l=await ce(e,`/v1/editor/slots/${encodeURIComponent(a)}`,{kind:"arms",target:vt(oe,Ce==null?void 0:Ce.value()),draftConfig:{arms:[{id:"a",ops:{}},{id:"b",ops:{[o]:i}}]}});l.r==="ok"&&(c("draft_saved",{kind:"move"}),Fe=!1,wt=null,Kt=null,ln(!1),xt(a,Ne(t),"b")),be(l,"\u2713 Saved as a draft. Click \u201CPublish\u201D below to go live.")};let wr=()=>{var o,i;c("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(In))==null||o.remove(),m.remove(),x.remove(),y.remove(),Be.remove(),window.__sentientEditor=null,(i=document.querySelector("meta[data-sentient-editor]"))==null||i.remove(),Mt()},gn=!1;Ie.onclick=()=>{if((nt||Fe)&&!gn){gn=!0,C("\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),Rt(),c("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 _i(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 _n(e,t){let n=d("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 Ii(e,t){var y,$,L,D,E,z,J,Z,G,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(M){}let n=null;try{let M=await fetch(`${e.apiBase}/v1/editor/slots`,{headers:{authorization:`Bearer ${e.token}`}});M.ok&&(n=($=((y=(await M.json()).slots)!=null?y:[]).find(ie=>ie.slot_id===t&&ie.kind==="arms"))!=null?$:null)}catch(M){}let r=d("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=d("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=()=>{Mt();let M=new URL(location.href);for(let re of["sentient_preview","sentient_arm"])M.searchParams.delete(re);location.assign(M.toString())};let c=d("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");c.onclick=()=>{let M=new URL(location.href);for(let re of["sentient_preview","sentient_arm"])M.searchParams.delete(re);location.assign(M.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(d("span",{},"Couldn\u2019t load this preview \u2014 reopen it from your dashboard."),c,s),((J=document.body)!=null?J:document.documentElement).append(r);return}let x=new URLSearchParams(location.search).get("sentient_arm"),g=(G=(Z=m.find(M=>M.id===x))!=null?Z:m[1])!=null?G:m[0];r.append(d("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(d("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(M){}for(let M of m){let re=d("button",{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.3)",cursor:"pointer",background:M.id===g.id?"#6366f1":"transparent",color:"#fff",font:"12px system-ui, sans-serif"},(ne=M.displayName)!=null?ne:M.id);re.onclick=()=>{let ie=new URL(location.href);ie.searchParams.set("sentient_arm",M.id),location.assign(ie.toString())},r.append(re)}}r.append(c,s),((Q=document.body)!=null?Q:document.documentElement).append(r)}async function Ai(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):"",c=d("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)"});c.id=nn;let m=d("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=()=>{Mt();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;c.append(d("span",{},E),m),((z=document.body)!=null?z:document.documentElement).append(c)},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(Ro(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),To(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){}c.append(d("span",{fontWeight:"700"},`Previewing: ${($=g.slotName)!=null?$:r}`),d("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(c)}async function Jo(e,t){var c;let n=await ft(e,"/v1/editor/slots"),r=((c=n==null?void 0:n.slots)!=null?c:[]).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=Mo(x),k=g.skeleton?{slotId:m.slot_id,skeleton:g.skeleton}:{slotId:m.slot_id,status:g.reason};s=(await ce(e,"/v1/editor/region-skeleton",k)).r==="ok"?"ok":"failed"}return s}async function Xo(e){try{await ce(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?(Mt(),Qt(Vo)):Qt(Yo);return}let n=new URLSearchParams(location.search).get("sentient_preview");if(n){document.getElementById(nn)||await Ii(e,n);return}let r=new URLSearchParams(location.search).get("sentient_preview_cell");if(r){document.getElementById(nn)||await Ai(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 c=Go(document);Ze=c,c&&ce(e,"/v1/editor/palette",c),Xo(e),Jo(e).catch(()=>{});let m=await xi(e);tr(m),nr(m,document)}$i();return Ir(Bi);})();
@@ -1 +1 @@
1
- "use strict";var __sentientEngagement=(()=>{var W=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var ve=Object.prototype.hasOwnProperty;var he=(e,t)=>()=>(e&&(t=e(e=0)),t);var ye=(e,t)=>{for(var n in t)W(e,n,{get:t[n],enumerable:!0})},we=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of me(t))!ve.call(e,r)&&r!==n&&W(e,r,{get:()=>t[r],enumerable:!(a=ge(t,r))||a.enumerable});return e};var be=e=>we(W({},"__esModule",{value:!0}),e);var Ie,xe,_e,X,Ae,Ee,ee,$,te,Y=he(()=>{"use strict";Ie=Object.defineProperty,xe=Object.defineProperties,_e=Object.getOwnPropertyDescriptors,X=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,ee=(e,t,n)=>t in e?Ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$=(e,t)=>{for(var n in t||(t={}))Ae.call(t,n)&&ee(e,n,t[n]);if(X)for(var n of X(t))Ee.call(t,n)&&ee(e,n,t[n]);return e},te=(e,t)=>xe(e,_e(t))});var qe={};ye(qe,{startEngagementCapture:()=>pe});var Se=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function V(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function ke(e){return{tag:e.tagName.toLowerCase(),text:V(e).slice(0,40)}}function H(e){return e.replace(/["\\\]]/g,"\\$&")}function F(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function Z(e,t){var n;let a=e.tagName.toLowerCase();if(!a)return null;let r=((n=e.getAttribute("class"))!=null?n:"").split(/\s+/).filter(u=>/^[a-zA-Z][\w-]*$/.test(u)),c=[a,...r.map(u=>`${a}.${u}`)];for(let u of c)if(F(t,u))return u;let i=e.parentElement;if(i&&i!==t){let u=Z(i,t);if(u){for(let m of c){let w=`${u} > ${m}`;if(F(t,w))return w}let d=Array.from(i.children).filter(m=>m.tagName.toLowerCase()===a),y=d.indexOf(e),S=d.some(m=>m!==e&&V(m)!==V(e));if(y>=0&&S){let m=`${u} > ${a}:nth-of-type(${y+1})`;if(F(t,m))return m}}}return null}function Q(e,t){let n=ke(e),a=e.getAttribute("id");if(a&&F(t,`#${H(a)}`))return{v:1,id:a,fingerprint:n};for(let c of Se){let i=e.getAttribute(c);if(i&&F(t,`[${c}="${H(i)}"]`))return{v:1,dataAttr:{name:c,value:i},fingerprint:n}}let r=Z(e,t);return r?{v:1,selector:r,fingerprint:n}:null}Y();var re=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],Ce={banner:"hero",navigation:"navigation",contentinfo:"footer"};function Oe(e){let t=e.ariaRole?Ce[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 $e(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var Le=[["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]],J=[["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]],ne={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function Pe(e){var t;let n=e.querySelector("h1, h2, h3");return((t=n==null?void 0:n.textContent)!=null?t:"").slice(0,160)}function oe(e){var t,n;let a=Oe(e);if(a)return{type:(t=ne[a])!=null?t:"generic",strength:"strong"};let r=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[i,u]of Le)if(u.test(r))return{type:i,strength:"strong"};for(let[i,u]of J)if(u.test(e.bodyText))return{type:i,strength:"strong"};let c=$e(e);return{type:(n=ne[c])!=null?n:"generic",strength:"weak"}}function le(e){var t,n;let a=((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim(),r=e.getAttribute("role");return $({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((n=e.className)!=null?n:"")}`,headingText:Pe(e),bodyText:a.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:a.length},r?{ariaRole:r}:{})}function ae(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 He=1800*1e3;function ie(e,t,n,a){let r=[];{let c=!1,i=[],u=()=>{if(c)return;let d=Date.now();for(i.push(d);i.length>0&&d-i[0]>500;)i.shift();i.length>=3&&(c=!0,e("rage_click"))};t.addEventListener("click",u),r.push(()=>t.removeEventListener("click",u))}{let c=!1,i=u=>{if(c||!(u.target instanceof Node)||!t.contains(u.target)&&t!==u.target)return;c=!0;let d=typeof window!="undefined"?window.getSelection():null,y=d?d.toString().length:0;e("text_copy",{selectionLength:y})};document.addEventListener("copy",i),r.push(()=>document.removeEventListener("copy",i))}{let c=!1,i=!1,u=null,d=()=>{u!==null&&(clearTimeout(u),u=null)},y=()=>{c||!i||(d(),u=setTimeout(()=>{!c&&i&&(c=!0,e("scroll_hesitation"))},3e3))},S=()=>{d(),y()},m=_=>{for(let A of _)i=A.intersectionRatio>.3,i?y():d()},w=new IntersectionObserver(m,{threshold:[.3]});w.observe(t),window.addEventListener("scroll",S,{passive:!0}),r.push(()=>{w.disconnect(),window.removeEventListener("scroll",S),d()})}if((a==null?void 0:a.tabLoss)!==!1){let c=!1,i=n!=null?n:Date.now(),u=()=>{if(c||document.visibilityState!=="hidden")return;let d=Date.now()-i;d<15e3&&(c=!0,e("tab_loss",{timeOnPage:d}))};document.addEventListener("visibilitychange",u),r.push(()=>document.removeEventListener("visibilitychange",u))}return()=>{for(let c of r)c()}}function se(){return typeof navigator!="undefined"&&navigator.globalPrivacyControl===!0?!0:[typeof navigator!="undefined"?navigator.doNotTrack:void 0,typeof window!="undefined"?window.doNotTrack:void 0,typeof navigator!="undefined"?navigator.msDoNotTrack:void 0].some(e=>e==="1"||e==="yes")}Y();var ue=[100,300,1e3,3e3,1e4],Te=250,Me=1e3,Ke=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function ce(e,t){e.n++;let n=t-e.mean;e.mean+=n/e.n,e.m2+=n*(t-e.mean)}var de=e=>e.n>1?Math.sqrt(e.m2/e.n):0;function Ne(e){var t;try{let n=e.createElement("canvas"),a=n.getContext("webgl")||n.getContext("experimental-webgl");if(!a)return"unknown";let r=a.getExtension("WEBGL_debug_renderer_info"),c=r?String((t=a.getParameter(r.UNMASKED_RENDERER_WEBGL))!=null?t:""):"";return c?/swiftshader|llvmpipe|softpipe|software|mesa offscreen/i.test(c)?"sw":"hw":"unknown"}catch(n){return"unknown"}}function De(e,t=Date.now){var n,a;let r=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0,c={n:0,mean:0,m2:0},i={n:0,mean:0,m2:0},u=[0,0,0,0,0,0],d=0,y=0,S=0,m=0,w=0,_=0,A=0,M=0,K=0,v=0,q=-1/0,N=-1/0,k=null,L=null,D=null,R=(a=r==null?void 0:r.scrollY)!=null?a:0,z=0,h=e.hidden?null:t(),P=()=>{let l=t();if(D!=null){let g=l-D,I=0;for(;I<ue.length&&g>=ue[I];)I++;u[I]++}D=l},T=()=>{d++,q=t()},E=()=>{y++,N=t()},j=()=>{k=t()},C=()=>{k!=null&&(ce(c,t()-k),k=null)},U=()=>{let l=t();S++,l-q>Te&&l-N>Me&&m++,P()},O=()=>{w++},b=()=>{var l;let g=(l=r==null?void 0:r.scrollY)!=null?l:0;_+=Math.abs(g-R),R=g,P()},G=l=>{let g=t();A++,(l.key==="Backspace"||l.key==="Delete")&&K++,Ke.has(l.key)&&v++,L!=null&&ce(i,g-L),L=g,P()},B=l=>{let g=l.data;typeof g=="string"&&(M+=g.length),P()},s=()=>{let l=t();e.hidden?h!=null&&(z+=l-h,h=null):h==null&&(h=l)},o={passive:!0,capture:!0};e.addEventListener("mousemove",T,o),e.addEventListener("touchstart",E,o),e.addEventListener("touchmove",O,o),e.addEventListener("mousedown",j,o),e.addEventListener("mouseup",C,o),e.addEventListener("click",U,o),e.addEventListener("wheel",O,o),e.addEventListener("keydown",G,o),e.addEventListener("input",B,o),e.addEventListener("visibilitychange",s),r==null||r.addEventListener("scroll",b,o);let f=Ne(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 I=t(),x=z+(h!=null?I-h: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:c.n,hold_mean:Math.round(c.mean),hold_std:Math.round(de(c)),teleport:m,wheel:w,scroll_px:Math.round(_),keydowns:A,input_chars:M,ik_cv:i.mean>0?Number((de(i)/i.mean).toFixed(2)):0,backspaces:K,gaps:[...u],reduced_motion:p,kb_nav:v,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,o),e.removeEventListener("touchstart",E,o),e.removeEventListener("touchmove",O,o),e.removeEventListener("mousedown",j,o),e.removeEventListener("mouseup",C,o),e.removeEventListener("click",U,o),e.removeEventListener("wheel",O,o),e.removeEventListener("keydown",G,o),e.removeEventListener("input",B,o),e.removeEventListener("visibilitychange",s),r==null||r.removeEventListener("scroll",b,o)}}}var Re="section, header, footer, nav, main > div, [data-sentient-section]",je=2e4,Ue="__session__";function Be(e){let t=Array.from(e.querySelectorAll(Re)),n=t.filter(a=>t.filter(r=>r!==a&&a.contains(r)).length<2);return n.filter(a=>!n.some(r=>r!==a&&r.contains(a)))}function Fe(e,t,n,a){try{fetch(`${t}/v1/section-map`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${e}`},body:JSON.stringify({pageUrl:n,sections:a})}).catch(()=>{})}catch(r){}}var fe=()=>{};function pe(e,t){var n,a,r,c,i,u,d,y,S,m,w,_,A,M,K;let v=(n=t.doc)!=null?n:typeof document!="undefined"?document:void 0;if(!v||typeof IntersectionObserver=="undefined"||se()||!t.apiKey||!t.apiKey.startsWith("pk_"))return fe;let q=((a=t.apiBase)!=null?a:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),N=Be(v);if(N.length===0)return fe;let k=new Map,L=[];for(let s of N){let o=(i=[(c=t.sectionTypes)==null?void 0:c[(r=s.getAttribute("data-sentient-id"))!=null?r:""],s.getAttribute("data-sentient-type")].find(x=>re.includes(x)))!=null?i:null,f=le(s),p=(d=o!=null?o:(u=t.typeOf)==null?void 0:u.call(t,s))!=null?d:oe(f).type,l=Q(s,v),g=l?`nc-${p}-${ae(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(s,g);let I=J.filter(([,x])=>x.test(f.bodyText)).map(([x])=>x);L.push(te($({componentId:g,semanticType:p,source:o?"markup":"auto"},l?{locator:l}:{}),{observation:$($({tag:f.tag,idClass:f.idClass.slice(0,200),headingText:f.headingText,textLength:f.textLength,actionCount:f.actionCount},f.ariaRole?{ariaRole:f.ariaRole}:{}),I.length>0?{patternFlags:I}:{})}))}let D=(M=(A=(_=(w=v.defaultView)!=null?w:typeof window!="undefined"?window:void 0)==null?void 0:_.location)==null?void 0:A.pathname)!=null?M:"/";Fe(t.apiKey,q,D,L);let R=De(v),z=()=>{let s;try{s=R.snapshot()}catch(o){return}try{e.track({projectId:t.apiKey,componentId:Ue,eventType:"interaction_stats",payload:s})}catch(o){}},h=new Map,P=s=>{let o=h.get(s);return o||(o={ms:0,scroll:0,enterAt:null,intersecting:!1},h.set(s,o)),o},T=new IntersectionObserver(s=>{for(let o of s){let f=k.get(o.target);if(!f)continue;let p=P(f);o.isIntersecting?(p.intersecting=!0,p.enterAt=Date.now(),o.intersectionRatio>p.scroll&&(p.scroll=o.intersectionRatio)):(p.intersecting=!1,p.enterAt!=null&&(p.ms+=Date.now()-p.enterAt,p.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let s of k.keys())T.observe(s);let E=(s=!1)=>{var o;let f=Date.now();for(let[p,l]of h)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(z(),s)try{(o=e.flush)==null||o.call(e)}catch(p){}},j=()=>{if(v.hidden)E(!0);else{let s=Date.now();for(let o of h.values())o.intersecting&&(o.enterAt=s)}},C=!1,U=s=>{if(E(!0),s!=null&&s.persisted){C=!0;return}try{T.disconnect()}catch(o){}},O=s=>{if(!(s!=null&&s.persisted)||!C)return;C=!1;let o=Date.now();for(let f of h.values())f.enterAt=f.intersecting&&!v.hidden?o:null};v.addEventListener("visibilitychange",j);let b=(K=v.defaultView)!=null?K:typeof window!="undefined"?window:void 0;b==null||b.addEventListener("pagehide",U),b==null||b.addEventListener("pageshow",O);let G=setInterval(()=>{if(v.hidden||C)return;E();let s=Date.now();for(let o of h.values())o.intersecting&&(o.enterAt=s)},je),B=[];return t.microSignals&&[...k.entries()].forEach(([s,o],f)=>{B.push(ie((p,l={})=>{try{e.track({projectId:t.apiKey,componentId:o,eventType:"micro_signal",payload:$({signalType:p},l)})}catch(g){}},s,void 0,{tabLoss:f===0}))}),()=>{E(!0),clearInterval(G),R.stop(),v.removeEventListener("visibilitychange",j),b==null||b.removeEventListener("pagehide",U),b==null||b.removeEventListener("pageshow",O);for(let s of B)s();try{T.disconnect()}catch(s){}}}return be(qe);})();
1
+ "use strict";var __sentientEngagement=(()=>{var V=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var he=Object.prototype.hasOwnProperty;var ve=(e,t)=>()=>(e&&(t=e(e=0)),t);var ye=(e,t)=>{for(var n in t)V(e,n,{get:t[n],enumerable:!0})},we=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of me(t))!he.call(e,r)&&r!==n&&V(e,r,{get:()=>t[r],enumerable:!(a=ge(t,r))||a.enumerable});return e};var be=e=>we(V({},"__esModule",{value:!0}),e);var Ie,xe,_e,X,Ae,Ee,ee,$,te,Y=ve(()=>{"use strict";Ie=Object.defineProperty,xe=Object.defineProperties,_e=Object.getOwnPropertyDescriptors,X=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,ee=(e,t,n)=>t in e?Ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$=(e,t)=>{for(var n in t||(t={}))Ae.call(t,n)&&ee(e,n,t[n]);if(X)for(var n of X(t))Ee.call(t,n)&&ee(e,n,t[n]);return e},te=(e,t)=>xe(e,_e(t))});var qe={};ye(qe,{startEngagementCapture:()=>pe});var Se=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function W(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function ke(e){return{tag:e.tagName.toLowerCase(),text:W(e).slice(0,40)}}function H(e){return e.replace(/["\\\]]/g,"\\$&")}function F(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function Z(e,t){var n;let a=e.tagName.toLowerCase();if(!a)return null;let r=((n=e.getAttribute("class"))!=null?n:"").split(/\s+/).filter(u=>/^[a-zA-Z][\w-]*$/.test(u)),c=[a,...r.map(u=>`${a}.${u}`)];for(let u of c)if(F(t,u))return u;let i=e.parentElement;if(i&&i!==t){let u=Z(i,t);if(u){for(let m of c){let w=`${u} > ${m}`;if(F(t,w))return w}let d=Array.from(i.children).filter(m=>m.tagName.toLowerCase()===a),y=d.indexOf(e),S=d.some(m=>m!==e&&W(m)!==W(e));if(y>=0&&S){let m=`${u} > ${a}:nth-of-type(${y+1})`;if(F(t,m))return m}}}return null}function Q(e,t){let n=ke(e),a=e.getAttribute("id");if(a&&F(t,`#${H(a)}`))return{v:1,id:a,fingerprint:n};for(let c of Se){let i=e.getAttribute(c);if(i&&F(t,`[${c}="${H(i)}"]`))return{v:1,dataAttr:{name:c,value:i},fingerprint:n}}let r=Z(e,t);return r?{v:1,selector:r,fingerprint:n}:null}Y();var re=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],Ce={banner:"hero",navigation:"navigation",contentinfo:"footer"};function Oe(e){let t=e.ariaRole?Ce[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 $e(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var Le=[["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]],J=[["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]],ne={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function Me(e){var t;let n=e.querySelector("h1, h2, h3");return((t=n==null?void 0:n.textContent)!=null?t:"").slice(0,160)}function oe(e){var t,n;let a=Oe(e);if(a)return{type:(t=ne[a])!=null?t:"generic",strength:"strong"};let r=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[i,u]of Le)if(u.test(r))return{type:i,strength:"strong"};for(let[i,u]of J)if(u.test(e.bodyText))return{type:i,strength:"strong"};let c=$e(e);return{type:(n=ne[c])!=null?n:"generic",strength:"weak"}}function le(e){var t,n;let a=((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim(),r=e.getAttribute("role");return $({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((n=e.className)!=null?n:"")}`,headingText:Me(e),bodyText:a.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:a.length},r?{ariaRole:r}:{})}function ae(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 He=1800*1e3;function ie(e,t,n,a){let r=[];{let c=!1,i=[],u=()=>{if(c)return;let d=Date.now();for(i.push(d);i.length>0&&d-i[0]>500;)i.shift();i.length>=3&&(c=!0,e("rage_click"))};t.addEventListener("click",u),r.push(()=>t.removeEventListener("click",u))}{let c=!1,i=u=>{if(c||!(u.target instanceof Node)||!t.contains(u.target)&&t!==u.target)return;c=!0;let d=typeof window!="undefined"?window.getSelection():null,y=d?d.toString().length:0;e("text_copy",{selectionLength:y})};document.addEventListener("copy",i),r.push(()=>document.removeEventListener("copy",i))}{let c=!1,i=!1,u=null,d=()=>{u!==null&&(clearTimeout(u),u=null)},y=()=>{c||!i||(d(),u=setTimeout(()=>{!c&&i&&(c=!0,e("scroll_hesitation"))},3e3))},S=()=>{d(),y()},m=_=>{for(let A of _)i=A.intersectionRatio>.3,i?y():d()},w=new IntersectionObserver(m,{threshold:[.3]});w.observe(t),window.addEventListener("scroll",S,{passive:!0}),r.push(()=>{w.disconnect(),window.removeEventListener("scroll",S),d()})}if((a==null?void 0:a.tabLoss)!==!1){let c=!1,i=n!=null?n:Date.now(),u=()=>{if(c||document.visibilityState!=="hidden")return;let d=Date.now()-i;d<15e3&&(c=!0,e("tab_loss",{timeOnPage:d}))};document.addEventListener("visibilitychange",u),r.push(()=>document.removeEventListener("visibilitychange",u))}return()=>{for(let c of r)c()}}function se(){return typeof navigator!="undefined"&&navigator.globalPrivacyControl===!0?!0:[typeof navigator!="undefined"?navigator.doNotTrack:void 0,typeof window!="undefined"?window.doNotTrack:void 0,typeof navigator!="undefined"?navigator.msDoNotTrack:void 0].some(e=>e==="1"||e==="yes")}Y();var ue=[100,300,1e3,3e3,1e4],Pe=250,Te=1e3,Ne=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function ce(e,t){e.n++;let n=t-e.mean;e.mean+=n/e.n,e.m2+=n*(t-e.mean)}var de=e=>e.n>1?Math.sqrt(e.m2/e.n):0;function Ke(e){var t;try{let n=e.createElement("canvas"),a=n.getContext("webgl")||n.getContext("experimental-webgl");if(!a)return"unknown";let r=a.getExtension("WEBGL_debug_renderer_info"),c=r?String((t=a.getParameter(r.UNMASKED_RENDERER_WEBGL))!=null?t:""):"";return c?/swiftshader|llvmpipe|softpipe|software|mesa offscreen/i.test(c)?"sw":"hw":"unknown"}catch(n){return"unknown"}}function De(e,t=Date.now){var n,a;let r=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0,c={n:0,mean:0,m2:0},i={n:0,mean:0,m2:0},u=[0,0,0,0,0,0],d=0,y=0,S=0,m=0,w=0,_=0,A=0,T=0,N=0,h=0,q=-1/0,K=-1/0,k=null,L=null,D=null,R=(a=r==null?void 0:r.scrollY)!=null?a:0,z=0,v=e.hidden?null:t(),M=()=>{let l=t();if(D!=null){let g=l-D,I=0;for(;I<ue.length&&g>=ue[I];)I++;u[I]++}D=l},P=()=>{d++,q=t()},E=()=>{y++,K=t()},j=()=>{k=t()},C=()=>{k!=null&&(ce(c,t()-k),k=null)},U=()=>{let l=t();S++,l-q>Pe&&l-K>Te&&m++,M()},O=()=>{w++},b=()=>{var l;let g=(l=r==null?void 0:r.scrollY)!=null?l:0;_+=Math.abs(g-R),R=g,M()},G=l=>{let g=t();A++,(l.key==="Backspace"||l.key==="Delete")&&N++,Ne.has(l.key)&&h++,L!=null&&ce(i,g-L),L=g,M()},B=l=>{let g=l.data;typeof g=="string"&&(T+=g.length),M()},s=()=>{let l=t();e.hidden?v!=null&&(z+=l-v,v=null):v==null&&(v=l)},o={passive:!0,capture:!0};e.addEventListener("mousemove",P,o),e.addEventListener("touchstart",E,o),e.addEventListener("touchmove",O,o),e.addEventListener("mousedown",j,o),e.addEventListener("mouseup",C,o),e.addEventListener("click",U,o),e.addEventListener("wheel",O,o),e.addEventListener("keydown",G,o),e.addEventListener("input",B,o),e.addEventListener("visibilitychange",s),r==null||r.addEventListener("scroll",b,o);let f=Ke(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 I=t(),x=z+(v!=null?I-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:c.n,hold_mean:Math.round(c.mean),hold_std:Math.round(de(c)),teleport:m,wheel:w,scroll_px:Math.round(_),keydowns:A,input_chars:T,ik_cv:i.mean>0?Number((de(i)/i.mean).toFixed(2)):0,backspaces:N,gaps:[...u],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",P,o),e.removeEventListener("touchstart",E,o),e.removeEventListener("touchmove",O,o),e.removeEventListener("mousedown",j,o),e.removeEventListener("mouseup",C,o),e.removeEventListener("click",U,o),e.removeEventListener("wheel",O,o),e.removeEventListener("keydown",G,o),e.removeEventListener("input",B,o),e.removeEventListener("visibilitychange",s),r==null||r.removeEventListener("scroll",b,o)}}}var Re="section, header, footer, nav, main > div, [data-sentient-section]",je=2e4,Ue="__session__";function Be(e){let t=Array.from(e.querySelectorAll(Re)),n=t.filter(a=>t.filter(r=>r!==a&&a.contains(r)).length<2);return n.filter(a=>!n.some(r=>r!==a&&r.contains(a)))}function Fe(e,t,n,a){try{fetch(`${t}/v1/section-map`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${e}`},body:JSON.stringify({pageUrl:n,sections:a})}).catch(()=>{})}catch(r){}}var fe=()=>{};function pe(e,t){var n,a,r,c,i,u,d,y,S,m,w,_,A,T,N;let h=(n=t.doc)!=null?n:typeof document!="undefined"?document:void 0;if(!h||typeof IntersectionObserver=="undefined"||se()||!t.apiKey||!t.apiKey.startsWith("pk_"))return fe;let q=((a=t.apiBase)!=null?a:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),K=Be(h);if(K.length===0)return fe;let k=new Map,L=[];for(let s of K){let o=(i=[(c=t.sectionTypes)==null?void 0:c[(r=s.getAttribute("data-sentient-id"))!=null?r:""],s.getAttribute("data-sentient-type")].find(x=>re.includes(x)))!=null?i:null,f=le(s),p=(d=o!=null?o:(u=t.typeOf)==null?void 0:u.call(t,s))!=null?d:oe(f).type,l=Q(s,h),g=l?`nc-${p}-${ae(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(s,g);let I=J.filter(([,x])=>x.test(f.bodyText)).map(([x])=>x);L.push(te($({componentId:g,semanticType:p,source:o?"markup":"auto"},l?{locator:l}:{}),{observation:$($({tag:f.tag,idClass:f.idClass.slice(0,200),headingText:f.headingText,textLength:f.textLength,actionCount:f.actionCount},f.ariaRole?{ariaRole:f.ariaRole}:{}),I.length>0?{patternFlags:I}:{})}))}let D=(T=(A=(_=(w=h.defaultView)!=null?w:typeof window!="undefined"?window:void 0)==null?void 0:_.location)==null?void 0:A.pathname)!=null?T:"/";Fe(t.apiKey,q,D,L);let R=De(h),z=()=>{let s;try{s=R.snapshot()}catch(o){return}try{e.track({projectId:t.apiKey,componentId:Ue,eventType:"interaction_stats",payload:s})}catch(o){}},v=new Map,M=s=>{let o=v.get(s);return o||(o={ms:0,scroll:0,enterAt:null,intersecting:!1},v.set(s,o)),o},P=new IntersectionObserver(s=>{for(let o of s){let f=k.get(o.target);if(!f)continue;let p=M(f);o.isIntersecting?(p.intersecting=!0,p.enterAt=Date.now(),o.intersectionRatio>p.scroll&&(p.scroll=o.intersectionRatio)):(p.intersecting=!1,p.enterAt!=null&&(p.ms+=Date.now()-p.enterAt,p.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let s of k.keys())P.observe(s);let E=(s=!1)=>{var o;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(z(),s)try{(o=e.flush)==null||o.call(e)}catch(p){}},j=()=>{if(h.hidden)E(!0);else{let s=Date.now();for(let o of v.values())o.intersecting&&(o.enterAt=s)}},C=!1,U=s=>{if(E(!0),s!=null&&s.persisted){C=!0;return}try{P.disconnect()}catch(o){}},O=s=>{if(!(s!=null&&s.persisted)||!C)return;C=!1;let o=Date.now();for(let f of v.values())f.enterAt=f.intersecting&&!h.hidden?o:null};h.addEventListener("visibilitychange",j);let b=(N=h.defaultView)!=null?N:typeof window!="undefined"?window:void 0;b==null||b.addEventListener("pagehide",U),b==null||b.addEventListener("pageshow",O);let G=setInterval(()=>{if(h.hidden||C)return;E();let s=Date.now();for(let o of v.values())o.intersecting&&(o.enterAt=s)},je),B=[];return t.microSignals&&[...k.entries()].forEach(([s,o],f)=>{B.push(ie((p,l={})=>{try{e.track({projectId:t.apiKey,componentId:o,eventType:"micro_signal",payload:$({signalType:p},l)})}catch(g){}},s,void 0,{tabLoss:f===0}))}),()=>{E(!0),clearInterval(G),R.stop(),h.removeEventListener("visibilitychange",j),b==null||b.removeEventListener("pagehide",U),b==null||b.removeEventListener("pageshow",O);for(let s of B)s();try{P.disconnect()}catch(s){}}}return be(qe);})();
@@ -1,2 +1,2 @@
1
- "use strict";var SentientSnippet=(()=>{var Rt=Object.defineProperty,Ko=Object.defineProperties,jo=Object.getOwnPropertyDescriptor,Go=Object.getOwnPropertyDescriptors,Fo=Object.getOwnPropertyNames,ur=Object.getOwnPropertySymbols;var dr=Object.prototype.hasOwnProperty,Uo=Object.prototype.propertyIsEnumerable;var cr=(e,t,n)=>t in e?Rt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t)=>{for(var n in t||(t={}))dr.call(t,n)&&cr(e,n,t[n]);if(ur)for(var n of ur(t))Uo.call(t,n)&&cr(e,n,t[n]);return e},Ke=(e,t)=>Ko(e,Go(t));var fr=(e,t)=>()=>(e&&(t=e(e=0)),t);var pr=(e,t)=>{for(var n in t)Rt(e,n,{get:t[n],enumerable:!0})},zo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Fo(t))!dr.call(e,o)&&o!==n&&Rt(e,o,{get:()=>t[o],enumerable:!(r=jo(t,o))||r.enumerable});return e};var Wo=e=>zo(Rt({},"__esModule",{value:!0}),e);var Qo,ei,ti,vr,ni,ri,Sr,F,qe,En=fr(()=>{"use strict";Qo=Object.defineProperty,ei=Object.defineProperties,ti=Object.getOwnPropertyDescriptors,vr=Object.getOwnPropertySymbols,ni=Object.prototype.hasOwnProperty,ri=Object.prototype.propertyIsEnumerable,Sr=(e,t,n)=>t in e?Qo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,F=(e,t)=>{for(var n in t||(t={}))ni.call(t,n)&&Sr(e,n,t[n]);if(vr)for(var n of vr(t))ri.call(t,n)&&Sr(e,n,t[n]);return e},qe=(e,t)=>ei(e,ti(t))});var Ir={};pr(Ir,{LOCAL_ENGINE_AVAILABLE:()=>ai,createLocalEngine:()=>li});function li(e){throw new Error("[sentient] createLocalEngine is not available in production builds. The local engine only exists under the `development` export condition.")}var ai,Tr=fr(()=>{"use strict";ai=!1});var _s={};pr(_s,{applyPersonaAttributes:()=>Qt,applyRegistrySlots:()=>nn,applySlotArms:()=>tn,applySlotAttributes:()=>en,consentWatcher:()=>Xe,parseSnippetConfig:()=>qt,planReorder:()=>on,reapply:()=>Ot,run:()=>Do,version:()=>kt});function ze(e){return e?`_${e.slice(0,12)}`:""}var We="_snt_uid";function gt(e){return`${We}${ze(e)}`}var Sn="__sntForgetGen",Vo=()=>{try{return window[Sn]}catch(e){return}};function Nt(e){var t,n;try{let r=window,o=(t=r[Sn])!=null?t:r[Sn]={};o[e]=((n=o[e])!=null?n:0)+1}catch(r){}}function fe(e){var t,n;return(n=(t=Vo())==null?void 0:t[e])!=null?n:0}var rt="_snt_snap:",Ho=["low","medium","high"];function ot(e){try{let t=localStorage.getItem(rt+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"||!Ho.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}catch(t){return null}}function He(e,t){try{localStorage.setItem(rt+e,JSON.stringify(t))}catch(n){}}function je(e){if(typeof AbortController!="function")return{clear:()=>{}};let t=new AbortController,n=setTimeout(()=>t.abort(),e);return{signal:t.signal,clear:()=>clearTimeout(n)}}function wn(e,t){return new Promise(n=>{let r=setTimeout(()=>n(!1),t),o=()=>{clearTimeout(r),n(!0)};e.then(o,o)})}function Ve(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function Dt(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 gr(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 bn(e,t,n){try{let r=(()=>{try{let s=localStorage.getItem(n);if(!s)return[];let a=JSON.parse(s);return Array.isArray(a)?a:[]}catch(s){return[]}})(),o=new Map;for(let s of r)o.set(s.id,s);for(let s of e)o.set(s.id,s);localStorage.setItem(n,JSON.stringify([...o.values()].slice(-t)))}catch(r){}}function mr(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),s=r.filter(a=>!o.has(a.id));if(s.length===r.length)return;s.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(s))}catch(n){}}var qo=500,Jo=56*1024;function Mt(e){return`_snt_retry_${e.slice(0,12)}`}var Yo={push:()=>{},flush:()=>{},destroy:()=>{}};function hr(e){var t,n,r;if(typeof window=="undefined")return Yo;let o=(t=e.flushIntervalMs)!=null?t:5e3,s=(n=e.maxBatchSize)!=null?n:20,a=(r=e.maxRetrySize)!=null?r:100,l=e.ingestUrl,i=e.apiKey,c=Mt(i),u=!1,p=fe(i),h=(...O)=>{!u&&fe(i)===p&&bn(...O)},b=[],w=new Set,S=[],K=O=>{for(let B of O)L.delete(B),!w.has(B)&&(w.add(B),S.push(B));for(;S.length>qo;){let B=S.shift();B&&w.delete(B)}mr(O,c)},L=new Set,D=()=>{for(;b.length>a;){let O=b.shift();O&&L.delete(O.id)}},_=O=>{w.has(O.id)||L.has(O.id)||(L.add(O.id),b.push(O),D())},A=O=>{for(let B of O)w.has(B.id)||(L.add(B.id),b.push(B));D()},C=gr(c,a);for(let O of C)_(O);let P=0,m=0,v=(O,B=!0)=>{if(O.length===0)return;let ne=JSON.stringify(O),ue=O.map(Me=>Me.id),Q,we=je(15e3);try{Q=fetch(l,{method:"POST",keepalive:!0,signal:we.signal,body:ne,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`}})}catch(Me){h(O,a,c),A(O),m++,P=Date.now()+Ve(m);return}Promise.resolve(Q).then(we.clear,we.clear);let ee=Me=>{if(Dt(Me)!=="retry"){if(!Me.ok&&B){let Be=O.filter(Le=>Le.eventType!=="pageview");if(Be.length>0&&Be.length<O.length){K(O.filter(Le=>Le.eventType==="pageview").map(Le=>Le.id)),v(Be,!1);return}}K(ue),m=0,P=0;return}h(O,a,c),A(O),m++,P=Date.now()+Ve(m)};Q&&typeof Q.then=="function"?Q.then(ee).catch(()=>{h(O,a,c),A(O),m++,P=Date.now()+Ve(m)}):ee(Q)},d=typeof TextEncoder!="undefined"?new TextEncoder:null,g=O=>d?d.encode(O).length:O.length,I=O=>{let B=[],ne=2;for(let ue of O){let Q=g(JSON.stringify(ue))+1;if(B.length>0&&ne+Q>Jo||B.length>=s)break;B.push(ue),ne+=Q}return B},M=()=>{try{if(Date.now()<P)return;for(;b.length>0&&!(Date.now()<P);){let O=b.filter(ne=>!w.has(ne.id));if(b.length=0,O.length===0)break;let B=I(O);if(B.length===0)break;B.length<O.length&&b.push(...O.slice(B.length)),v(B)}}catch(O){}},q=!0,J=null;J=setInterval(()=>{q&&M()},o);let Y=()=>{document.visibilityState==="hidden"&&M()},Ce=()=>{M()};return document.addEventListener("visibilitychange",Y),window.addEventListener("pagehide",Ce),{push(O){_(O),b.length>=s&&M()},flush:M,destroy(O){O!=null&&O.forget&&(u=!0),q=!1,J!==null&&(clearInterval(J),J=null),document.removeEventListener("visibilitychange",Y),window.removeEventListener("pagehide",Ce),M()}}}var Xo=200;function Bt(e){return`_snt_goal_retry_${e.slice(0,12)}`}var Zo={send:()=>{},flush:()=>{},destroy:()=>{}};function yr(e){var t,n,r;if(typeof window=="undefined")return Zo;let o=(t=e.flushIntervalMs)!=null?t:5e3,s=(n=e.maxRetrySize)!=null?n:100,a=(r=e.maxPerFlush)!=null?r:5,l=Bt(e.apiKey),i=!1,c=fe(e.apiKey),u=(...g)=>{!i&&fe(e.apiKey)===c&&bn(...g)},p=[],h=new Set,b=new Set,w=[],S=0,K=0,L=!1,D=g=>{for(h.delete(g.id),b.has(g.id)||(b.add(g.id),w.push(g.id));w.length>Xo;){let I=w.shift();I&&b.delete(I)}mr([g.id],l)},_=g=>{u([g],s,l),!b.has(g.id)&&!h.has(g.id)&&(h.add(g.id),p.push(g)),Date.now()>=S&&(K++,S=Date.now()+Ve(K))},A=g=>{let I,M=je(15e3);try{I=fetch(e.url,{method:"POST",keepalive:!0,signal:M.signal,body:g.body,headers:e.headers})}catch(J){_(g);return}let q=J=>{var Y;let Ce=Dt(J);if(Ce==="retry"){_(g);return}Ce==="dropped"&&((Y=e.onDrop)==null||Y.call(e,g,J.status)),D(g),K=0,S=0};Promise.resolve(I).then(M.clear,M.clear),I&&typeof I.then=="function"?I.then(q).catch(()=>_(g)):q(I)},C=()=>{try{if(L||Date.now()<S)return;let g=0;for(;p.length>0&&g<a&&!(Date.now()<S);){let I=p.shift();h.delete(I.id),!b.has(I.id)&&(g++,A(I))}}catch(g){}},P=gr(l,s);for(let g of P)h.has(g.id)||(h.add(g.id),p.push(g));P.length>0&&bn(P,s,l);let m=setInterval(C,o),v=()=>{document.visibilityState==="hidden"&&C()},d=()=>C();return document.addEventListener("visibilitychange",v),window.addEventListener("pagehide",d),{send(g){if(L){b.has(g.id)||u([g],s,l);return}if(!(b.has(g.id)||h.has(g.id))){if(Date.now()<S){u([g],s,l),h.add(g.id),p.push(g);return}A(g)}},flush:C,destroy(g){g!=null&&g.forget&&(i=!0),clearInterval(m),document.removeEventListener("visibilitychange",v),window.removeEventListener("pagehide",d),C(),L=!0}}}function it(e){if(typeof window=="undefined"||!e)return!1;Nt(e);let t=!1,n=gt(e);try{if(new RegExp(`(?:^|; )${n}=`).test(document.cookie)){let a=location.protocol==="https:"?"; Secure":"";document.cookie=`${n}=; max-age=0; SameSite=lax; path=/${a}`,t=!0}}catch(a){}let r=ze(e),o=[n,"_snt_graph_edges",rt+e,Mt(e),Bt(e),`_snt_graph_nodes${r}`],s=[`_snt_asgn${r}_`];for(let a of["localStorage","sessionStorage"])try{let l=window[a];for(let i of o)l.getItem(i)!==null&&(l.removeItem(i),t=!0);for(let i=l.length-1;i>=0;i--){let c=l.key(i);c&&s.some(u=>c.startsWith(u))&&(l.removeItem(c),t=!0)}}catch(l){}try{(new RegExp(`(?:^|; )${We}=[^;]`).test(document.cookie)||localStorage.getItem(We)!==null||sessionStorage.getItem(We)!==null)&&localStorage.setItem(`${We}_tomb${r}`,"1")}catch(a){}return t}En();function $t(e){return Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("|")}function br(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 $t(e.baseline);if(typeof e.baseline=="string")return e.baseline;let o={};for(let[s,a]of Object.entries((n=e.dims)!=null?n:{}))o[s]=(r=a[0])!=null?r:"";return $t(o)}function wr(e,t){var n,r;return e.dims!=null?(r=(n=br(t))!=null?n:br(kn(e)))!=null?r:{}:t}function Je(e){return e>=.3?e<.7?"medium":"high":"low"}var oi=["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 Er(e){return ii(e)!==null}function ii(e){var t;if(!e)return null;let n=e.toLowerCase();return(t=oi.find(r=>n.includes(r.toLowerCase())))!=null?t:null}function kr(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 _r(e,t){if(!e)return"direct";try{let n=new URL(e);if(t)try{if(new URL(t).host===n.host)return"direct"}catch(o){}let r=n.hostname.toLowerCase();return/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(r)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(r)?"social":"referral"}catch(n){return"direct"}}function Ar(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var si=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function Cr(e){let t={},n={};try{let r=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([o,s])=>{let a=Array.isArray(s)?s[0]:s;return a===void 0?[]:[[o,a]]});for(let[o,s]of r)o.startsWith("utm_")?o in t||(t[o]=s):si.includes(o)&&(o in n||(n[o]=s))}catch(r){}return{utmParams:t,clickIds:n}}function xr(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function _n(e){return F(F(F({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 An(e){let t=_n(e);return wr(t,kn(t))}function Or(e){return typeof e=="string"?e:$t(e)}En();var Ln;function Ut(e){Ln=typeof e=="string"&&e!==""?e:void 0}function Dr(e=document){if(Ln)return Ln;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 Ge(e,t=document){let n=Dr(t);return n&&e.setAttribute("nonce",n),e}function Mr(){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 Lr="_snt_uid",ui=365,st="_snt_uid";function ci(){return Mr()}function Cn(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function Nn(){try{return location.protocol==="https:"?"; Secure":""}catch(e){return""}}function di(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=lax; path=/${Nn()}`}catch(r){}}function Kt(e){try{return localStorage.getItem(e)}catch(t){return null}}function Pr(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function xn(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function fi(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function pi(e){try{sessionStorage.removeItem(e)}catch(t){}}function gi(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=lax; path=/${Nn()}`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function mi(e){try{localStorage.removeItem(e)}catch(t){}}function hi(e){try{document.cookie=`${e}=; max-age=0; SameSite=lax; path=/${Nn()}`}catch(t){}}var yi={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function Br(e){var t,n,r,o,s,a,l;if(typeof window=="undefined")return yi;let i=ze(e==null?void 0:e.apiKey),c=(t=e==null?void 0:e.cookieName)!=null?t:gt(e==null?void 0:e.apiKey),u=`${st}${i}`,p=`${st}_tomb${i}`,h=((n=e==null?void 0:e.cookieTTLDays)!=null?n:ui)*24*60*60,b=A=>A&&A.length>0?A:null,w=()=>{var A,C;return i&&!(e!=null&&e.cookieName)&&Kt(p)===null?(C=(A=b(Cn(Lr)))!=null?A:b(Kt(st)))!=null?C:b(xn(st)):null},S=(l=(a=(s=(o=(r=b(Cn(c)))!=null?r:b(Kt(u)))!=null?o:b(xn(u)))!=null?s:w())!=null?a:b(e==null?void 0:e.ssrSessionId))!=null?l:ci();di(c,S,h);let K=Pr(u,S),L=gi(c),D=K?!1:fi(u,S),_=!K&&!L&&!D;return{getSessionId:()=>S,isEphemeral:()=>_,destroy:()=>{S=null,hi(c),mi(u),pi(u),i&&!(e!=null&&e.cookieName)&&(Cn(Lr)!==null||Kt(st)!==null||xn(st)!==null)&&Pr(p,"1")}}}var vi=1800*1e3;function jt(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function Si(e=vi,t){let n=new Map,r=`_snt_asgn${ze(t)}_`,o=(i,c)=>`${r}${encodeURIComponent(i)}:${encodeURIComponent(c)}`,s=i=>{let c=i.slice(r.length),u=c.indexOf(":");if(u<0)return null;try{return{componentId:decodeURIComponent(c.slice(0,u)),segment:decodeURIComponent(c.slice(u+1))}}catch(p){return null}},a=()=>{try{let i=[];for(let c=0;c<localStorage.length;c++){let u=localStorage.key(c);u!=null&&u.startsWith(r)&&i.push(u)}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 a())try{let c=localStorage.getItem(i);if(!c)continue;let u=JSON.parse(c);if(l(u)){localStorage.removeItem(i);continue}let p=s(i);if(!p)continue;n.set(jt(p.componentId,p.segment),u)}catch(c){}})(),{get(i,c){let u=n.get(jt(i,c));return u?l(u)?(n.delete(jt(i,c)),null):u:null},set(i,c,u){let p=jt(i,c);n.set(p,u);try{localStorage.setItem(o(i,c),JSON.stringify(u))}catch(h){}},clear(){n.clear();for(let i of a())try{localStorage.removeItem(i)}catch(c){}}}}var Pn="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",$r="[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.",Rr=!1,Gt=!1;function bi(){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=Br({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),r=(t=n.getSessionId())!=null?t:"local",o=bi(),s=Promise.resolve().then(()=>(Tr(),Ir)).then(u=>{let p=u;return p.LOCAL_ENGINE_AVAILABLE?(Rr||(Rr=!0,console.info($r)),p):(Gt||(Gt=!0,console.error(Pn)),null)}).catch(()=>(Gt||(Gt=!0,console.error(Pn)),null)),a=null,l={low:.15,medium:.5,high:.85},i=(()=>{var u;if(e.initialPersona)return F({},e.initialPersona);let p=ot(e.apiKey||"local");return p?{persona:p.persona,confidence:(u=l[p.band])!=null?u:.15}:null})();function c(u){let p=document.documentElement;p.dataset.sentientPersona===void 0&&(p.dataset.sentientPersona=u.persona,p.dataset.sentientConfidence=Je(u.confidence))}return{isLocal:!0,async decide(u){var p,h,b;let w=await s;if(!w)return null;let S=w.createLocalEngine({sessionId:r,forcedPersona:o}).decide(u);return a=qe(F({},S),{layoutOrder:(h=(p=S.layoutOrder)!=null?p:a==null?void 0:a.layoutOrder)!=null?h:null,slots:F(F({},(b=a==null?void 0:a.slots)!=null?b:{}),S.slots)}),He(e.apiKey||"local",{v:1,persona:a.persona,band:Je(a.confidence),slots:a.slots,layoutOrder:a.layoutOrder,savedAt:Date.now()}),c(S),S},getSlotResult(u){var p,h,b;return(b=(h=a==null?void 0:a.slots[u])!=null?h:(p=e.initialSlots)==null?void 0:p[u])!=null?b:null},getSlotConfig(u){var p,h;return(h=(p=e.initialSlotConfig)==null?void 0:p[u])!=null?h:null},getSitePalette(){var u;return(u=e.initialPalette)!=null?u:null},reportSlots(){},getPersona(){let u=a!=null?a:i;return u?{persona:u.persona,confidence:u.confidence,band:Je(u.confidence)}:null},async assign(u,p){var h;let b=await s;return!b||!p||p.length===0?p!=null&&p[0]?{variantId:p[0],assignmentTtlMs:0}:null:{variantId:(h=b.createLocalEngine({sessionId:r,forcedPersona:o}).decide({components:[{id:u,variantIds:p}]}).assignments[u])!=null?h:p[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>n.destroy()}}var zt=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function On(e){let t=e.split(/[?#]/)[0]||"/";return t.length>1?t.replace(/\/+$/,"")||"/":t}function Dn(e,t){if(e===void 0||!zt.test(e))return!1;if(e==="*")return!0;let n=On(t);if(e.endsWith("/*")){let r=On(e.slice(0,-2));return n.startsWith(r==="/"?"/":`${r}/`)&&n!==r}return n===On(e)}function ht(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(ht):!1}var Nr="sentient-reveal",at="sentient-revealed",Kr=240,In=!1;function Ei(e){if(In||e.getElementById(Nr)){In=!0;return}let t=Ge(e.createElement("style"),e);t.id=Nr,t.textContent=`@media (prefers-reduced-motion: no-preference){@keyframes ${at}{from{opacity:.55;transform:translateY(2px)}to{opacity:1;transform:none}}.${at}{animation:${at} ${Kr}ms cubic-bezier(.2,.6,.2,1) both}}`,e.head.appendChild(t),In=!0}function Mn(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;Ei(r),e.classList.remove(at),e.offsetWidth,e.classList.add(at);let o=()=>{e.classList.remove(at),e.removeEventListener("animationend",o)};return e.addEventListener("animationend",o),!0}function Bn(e,t,n,r){let o=[];{let s=!1,a=[],l=()=>{if(s)return;let i=Date.now();for(a.push(i);a.length>0&&i-a[0]>500;)a.shift();a.length>=3&&(s=!0,e("rage_click"))};t.addEventListener("click",l),o.push(()=>t.removeEventListener("click",l))}{let s=!1,a=l=>{if(s||!(l.target instanceof Node)||!t.contains(l.target)&&t!==l.target)return;s=!0;let i=typeof window!="undefined"?window.getSelection():null,c=i?i.toString().length:0;e("text_copy",{selectionLength:c})};document.addEventListener("copy",a),o.push(()=>document.removeEventListener("copy",a))}{let s=!1,a=!1,l=null,i=()=>{l!==null&&(clearTimeout(l),l=null)},c=()=>{s||!a||(i(),l=setTimeout(()=>{!s&&a&&(s=!0,e("scroll_hesitation"))},3e3))},u=()=>{i(),c()},p=b=>{for(let w of b)a=w.intersectionRatio>.3,a?c():i()},h=new IntersectionObserver(p,{threshold:[.3]});h.observe(t),window.addEventListener("scroll",u,{passive:!0}),o.push(()=>{h.disconnect(),window.removeEventListener("scroll",u),i()})}if((r==null?void 0:r.tabLoss)!==!1){let s=!1,a=n!=null?n:Date.now(),l=()=>{if(s||document.visibilityState!=="hidden")return;let i=Date.now()-a;i<15e3&&(s=!0,e("tab_loss",{timeOnPage:i}))};document.addEventListener("visibilitychange",l),o.push(()=>document.removeEventListener("visibilitychange",l))}return()=>{for(let s of o)s()}}function ki(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var jr="https://api.sentient-ui.com/v1/events",pe=new Map,Gr=null;function _i(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var Ai=3;function Tn(){return Mr()}function Ft(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function Ci(){let e=new WeakMap,t=new Map,n=!1,r=(l,i,c)=>{let u=l.get(i);return c===null?u?!0:(l.set(i,new Set),!1):u?u.has(c)?!0:(u.add(c),!1):(l.set(i,new Set([c])),!1)},o=typeof window!="undefined"&&"event"in window,s=()=>{if(!o)return;let l=window.event;return typeof Event=="function"&&l instanceof Event?l:void 0},a=()=>{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 c=new MessageChannel;c.port1.onmessage=()=>{c.port1.close(),c.port2.close(),i()},c.port2.postMessage(0)}};return{firedBefore(l,i){let c=s();if(c){let p=e.get(c);return p||(p=new Map,e.set(c,p)),r(p,l,i)}let u=r(t,l,i);return!u&&!n&&(n=!0,a()),u}}}var Fr=new Set;function xi(e,t,n){let r=typeof window=="undefined"?null:window.history;if(!r)return()=>{};let o=!1,s,a=()=>{if(o)return;let c=Ft();!c||c===s||(s=c,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${c}`))},l=[];for(let c of["pushState","replaceState"]){let u=r[c],p=function(...h){let b=u.apply(this,h);return a(),b};r[c]=p,l.push([c,u,p])}window.addEventListener("popstate",a);let i=Ft();return i&&Fr.has(`${t}:${i}`)?s=i:a(),()=>{if(!o){o=!0,window.removeEventListener("popstate",a);for(let[c,u,p]of l)r[c]===p&&(r[c]=u)}}}var mt={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}};function Oi(){try{return Cr(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function Ur(e){return e.replace(/\/events\/?$/,"")}function Ye(){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 $n(e){var t;if(typeof window=="undefined")return;let n=e!=null?e:Gr;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:s,reinit:a}=r;if(!s){r.upgradeBlockedReason&&console.warn(r.upgradeBlockedReason);return}if(o.respectDoNotTrack!==!1&&Ye())return;let l=(a!=null?a:yt)(qe(F({},o),{consent:!0}));s(l);let i=(t=pe.get(n))==null?void 0:t.dispose;pe.set(n,{config:qe(F({},o),{consent:!0}),upgrade:null,dispose:i})}function Ii(e,t){var n;let r=e.preConsentBehavior==="statistical_winner",o=Ur((n=e.ingestUrl)!=null?n:jr),s={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},a=new Map,l=new Map,i={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(m,v,d){if(!r)return Promise.resolve(null);let g=a.get(m);return g?Promise.resolve(g):Rn(l,m,async()=>{try{let I=new URLSearchParams({componentId:m});for(let Y of v!=null?v:[])I.append("variantIds[]",Y);let M=je(5e3),q;try{let Y=await fetch(`${o}/winner?${I.toString()}`,{headers:s,signal:M.signal});if(!Y.ok)return v!=null&&v[0]?{variantId:v[0],assignmentTtlMs:0}:null;q=await Y.json()}finally{M.clear()}let J={variantId:q.variantId,assignmentTtlMs:0};return a.set(m,J),J}catch(I){return v!=null&&v[0]?{variantId:v[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}},c=!1,u=new Set,p=[],h=[],b=[],w=()=>{for(let[,,m]of b.splice(0))m(null);S.length=0},S=[],K=!1,L=()=>{if(c)return;K=!0;let m=pe.get(e.apiKey);(m==null?void 0:m.upgrade)===P&&pe.set(e.apiKey,{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): client released before consent; call init() again"})},D=[],_=()=>{setTimeout(()=>{var m;try{(m=D.shift())==null||m(i)}catch(v){}D.length&&_()})},A=m=>{c?D.length?D.push(m):m(i):!t&&!K&&S.length<100?S.push(m):K&&e.debug&&console.warn("[sentient] goal dropped: client released")},C={get gated(){return!c&&!t},get released(){return K&&!c},takeHeld:()=>S.splice(0),track:m=>i.track(m),goal:((m,v,d,g)=>A(I=>I.goal(m,v,d,g))),componentGoal:(m,v,d)=>i.componentGoal(m,v,d),identify:m=>i.identify(m),getAssignment:(m,v)=>i.getAssignment(m,v),assign:(m,v,d,g)=>i.assign(m,v,d,g),decide:m=>c?i.decide(m):K||t?Promise.resolve(null):new Promise(v=>b.push([m,Ie(),v])),getSlotResult:m=>i.getSlotResult(m),isSlotDecided:m=>{var v,d;return(d=(v=i.isSlotDecided)==null?void 0:v.call(i,m))!=null?d:!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,d,g)=>i.reportSlots(m,v,d,g),reportSkeleton:(m,v)=>{var d;return(d=i.reportSkeleton)==null?void 0:d.call(i,m,v)},reportDrift:(m,v,d,g)=>{var I;return(I=i.reportDrift)==null?void 0:I.call(i,m,v,d,g)},requestSlots:(m,v,d)=>{var g;return c?(g=i.requestSlots)==null?void 0:g.call(i,m,v,d):p.push([m,v,d])},decideSlots:m=>{var v;return c?(v=i.decideSlots)==null?void 0:v.call(i,m):h.push(...m)},cancelSlots:m=>{var v;if(c)return(v=i.cancelSlots)==null?void 0:v.call(i,m);let d=new Set(m);for(let g of p)g[0]=g[0].filter(I=>!d.has(I));h=h.filter(g=>!d.has(g.id))},onSlotsChanged:m=>(u.add(m),()=>{u.delete(m)}),getPersona:()=>i.getPersona(),fetchWeights:()=>i.fetchWeights(),getGraph:()=>i.getGraph(),flush:()=>i.flush(),dispose:()=>(L(),w(),i.dispose()),destroy:()=>(L(),w(),c?i.destroy():it(e.apiKey))};function P(m){var v,d,g;i=m,c=!0,S.length&&(D.push(...S.splice(0)),_());let I=Ie();for(let[M,q,J]of b.splice(0))q!==I?J(null):m.decide(M).then(J,()=>J(null));(v=m.onSlotsChanged)==null||v.call(m,()=>u.forEach(M=>M()));for(let[M,q,J]of p.splice(0))M.length>0&&((d=m.requestSlots)==null||d.call(m,M,q,J));h.length>0&&((g=m.decideSlots)==null||g.call(m,h.splice(0)))}return{proxy:C,setInner:P}}function Ie(){return typeof location=="undefined"?"":location.pathname+(/^#!?\//.test(location.hash)?location.hash:"")}function Rn(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 yt(e){var t,n,r,o,s,a,l,i,c,u;if(typeof window=="undefined")return mt;e.nonce&&Ut(e.nonce),Gr=e.apiKey||"local";let p=pe.get(e.apiKey||"local");if(p!=null&&p.dispose)try{p.dispose()}catch(f){}let h=e.respectDoNotTrack!==!1&&Ye(),b=e.consent===!1||h,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."}),b?mt:wi(e);if(b){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."}),mt;let{proxy:f,setInner:y}=Ii(e,h);return pe.set(e.apiKey,{config:e,upgrade:h?null:y}),f}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."),mt;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),mt;let S=(t=e.ingestUrl)!=null?t:jr,K=Date.now(),L=Br({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),D=Si(void 0,e.apiKey),_=!1,A=fe(e.apiKey),C=()=>!_&&fe(e.apiKey)===A,P=qe(F({},D),{set:(...f)=>{C()&&D.set(...f)}}),m=hr({ingestUrl:S,apiKey:e.apiKey}),v=Ur(S),d={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},g=new Set,I=yr({url:`${v}/goals`,apiKey:e.apiKey,headers:d,onDrop:(f,y)=>{if(!e.debug){if(g.has(y))return;g.add(y)}console.warn(`[sentient] goal dropped (HTTP ${y}) \u2014 this will not be retried. `+(y===400?"The session was not found: call init() and let the session upsert complete before firing goals.":y===401||y===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),f)}}),M=kr((n=navigator.userAgent)!=null?n:""),q=window.location.origin,J=_r((r=document.referrer)!=null?r:"",q),Y=(o=e.sessionSegment)!=null?o:`${M}:${J}`,Ce=new Map,O=new Map,B=new Map,ne=new Set,ue=new Map,Q=null,we=null,ee=null,Me=new Set,Be=new Set,Le=new Map,pn=new Map,Qn=new Set,er=new Set,tr=new Set,gn=null,It=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,nr=new Set,Tt=new Set,Lt=new Set,dt=new Map,mn=null,Pt=new Set,ft=new Map,hn=null,Mo=2,rr=new Map,Ee=!1,or=(f,y,N)=>{var z;let j=new Set,E=1;for(let x of f){y.delete(x);let T=((z=rr.get(x))!=null?z:0)+1;rr.set(x,T),T<=Mo&&(j.add(x),T>E&&(E=T))}j.size>0&&setTimeout(()=>{Ee||N(j)},Ve(E))},yn=f=>{for(let y of f)B.has(y.id)||B.set(y.id,An(y))};if(e.initialSlots)for(let[f,y]of Object.entries(e.initialSlots))B.set(f,y),ne.add(f);if(e.initialSlotConfig)for(let[f,y]of Object.entries(e.initialSlotConfig))ue.set(f,y);e.initialPalette&&(Q=e.initialPalette),e.initialVocabulary&&(we=e.initialVocabulary);let xe=ot(e.apiKey);if(xe){for(let[f,y]of Object.entries(xe.slots))B.has(f)||B.set(f,y);for(let[f,y]of Object.entries((s=xe.slotConfig)!=null?s:{}))ue.has(f)||ue.set(f,y);!Q&&xe.palette&&(Q=xe.palette),!we&&xe.vocabulary&&(we=xe.vocabulary)}let ir={low:.15,medium:.5,high:.85};if(e.initialPersona)ee=F({},e.initialPersona);else{let f=document.documentElement.dataset;f.sentientPersona?ee={persona:f.sentientPersona,confidence:(l=ir[(a=f.sentientConfidence)!=null?a:"low"])!=null?l:.15}:xe&&(ee={persona:xe.persona,confidence:(i=ir[xe.band])!=null?i:.15})}if(e.initialAssignments)for(let[f,y]of Object.entries(e.initialAssignments))P.set(f,Y,{variantId:y,assignedAt:Date.now(),segment:Y,confidence:1});let $e=Promise.resolve(),sr=L.getSessionId();if(sr){let f=Ar((c=document.referrer)!=null?c:""),{utmParams:y,clickIds:N}=Oi(),z=F(F(F(F({sessionId:sr,deviceClass:M,trafficSource:J,referrerDomain:f,utmParams:y,clickIds:N,timeOfDay:xr(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:L.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||Er((u=navigator.userAgent)!=null?u:"")},e.userId?{userId:e.userId}:{}),e.persona?{persona:e.persona}:{}),e.country?{country:e.country}:{}),e.sdk?{sdk:e.sdk.name,sdkVersion:e.sdk.version}:{}),j=async()=>{for(let E=0;;E++){if(Ee||!C())return;let x=je(5e3);try{let T=await fetch(`${v}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(z),headers:d,signal:x.signal});if(T.status===402){console.warn("[SentientUI] Session limit exceeded for this project. The bandit will stop learning until the limit resets. Upgrade at sentient-ui.com/pricing");return}if(T.ok||Dt(T)==="dropped")return}catch(T){}finally{x.clear()}if(E>=Ai){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(T=>setTimeout(T,Ve(E+1)))}};try{$e=j()}catch(E){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:m});let Bo=Ci(),pt=null,vn=!1,se={goal(f,y={},N=1,z=0){var j,E,x,T,V,G,te;let re=L.getSessionId();if(!re||Ee||!C())return;let W=_i(y)?y:{metadata:y},ge=[f,(j=W.externalId)!=null?j:"",(E=W.stepIndex)!=null?E:z,(x=W.weight)!=null?x:N].join("\0"),ke=W.value!==void 0?`${W.value}\0${(T=W.currency)!=null?T:""}`:null;if(Bo.firedBefore(ge,ke)){e.debug&&console.log(`[sentient] goal("${f}") already recorded for this action \u2014 not sent twice`);return}let de=Tn(),ae={sessionId:re,name:f,metadata:(V=W.metadata)!=null?V:{},weight:(G=W.weight)!=null?G:N,stepIndex:(te=W.stepIndex)!=null?te:z,goalId:de,value:W.value,currency:W.currency,externalId:W.externalId};e.debug&&console.log("[sentient] goal",ae);let $={id:de,body:JSON.stringify(ae)};$e.then(()=>I.send($))},componentGoal(f,y,N){var z,j,E;let x=L.getSessionId();if(!x||Ee||!C())return;let T=P.get(f,Y),V=T?null:(z=B.get(f))!=null?z:null;if(!T&&V===null){e.debug&&console.warn(`[sentient] componentGoal("${f}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}if(!T&&!ne.has(f)){e.debug&&console.warn(`[sentient] componentGoal("${f}"): slot not decided this session \u2014 not attributed`);return}let G=T?T.variantId:Or(V),te={id:Tn(),sessionId:x,projectId:e.apiKey,componentId:f,variantId:G,eventType:"goal_achieved",goalType:y,payload:F({reward:(j=N==null?void 0:N.reward)!=null?j:1,goalValue:N==null?void 0:N.value,currency:N==null?void 0:N.currency},(E=N==null?void 0:N.metadata)!=null?E:{}),timestamp:Date.now(),timeInSession:Date.now()-K,path:Ft()};e.debug&&console.log("[sentient] componentGoal",te),$e.then(()=>{!Ee&&C()&&m.push(te)})},identify(f){let y=L.getSessionId();!y||Ee||!C()||$e.then(()=>{fetch(`${v}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:y,userId:f,ephemeral:L.isEphemeral()}),headers:d}).catch(()=>{})})},track(f){let y=L.getSessionId();if(!y||Ee||!C()||f.eventType==="variant_assigned"&&B.get(f.componentId)!==void 0&&!ne.has(f.componentId)&&!P.get(f.componentId,Y))return;let N=qe(F({path:Ft()},f),{id:Tn(),sessionId:y,timestamp:Date.now(),timeInSession:Date.now()-K});e.debug&&console.log("[sentient] track",N),$e.then(()=>m.push(N))},getAssignment(f,y){return P.get(f,y)},async assign(f,y,N,z){let j=L.getSessionId();if(!j)return null;let E=P.get(f,Y);if(E&&(y!=null&&y.length||E.content!==void 0)){let x=E.ttlMs&&E.ttlMs>0?Math.max(0,E.assignedAt+E.ttlMs-Date.now()):0;return{variantId:E.variantId,assignmentTtlMs:x,content:E.content}}return Rn(Ce,f,async()=>{if(!await wn($e,2500)||Ee||!C())return null;let x=je(3e4);try{let T={sessionId:j,componentId:f,variantIds:y};z!==void 0?T.agentDataByVariant=z:N!==void 0&&(T.agentData=N);let V=await fetch(`${v}/assign`,{method:"POST",body:JSON.stringify(T),headers:d,signal:x.signal});if(!V.ok)return null;let G=await V.json();return P.set(f,Y,F({variantId:G.variantId,assignedAt:Date.now(),segment:Y,confidence:1,content:G.content},G.assignmentTtlMs&&G.assignmentTtlMs>0?{ttlMs:G.assignmentTtlMs}:{})),G}catch(T){return null}finally{x.clear()}})},async decide(f){var y,N;let z=L.getSessionId();if(!z)return null;let j=(y=f.slots)!=null?y:[],E={sessionId:z};f.sections&&f.sections.length>0&&(E.sections=f.sections.map(T=>({id:T}))),E.components=(N=f.components)!=null?N:[],j.length>0&&(E.slots=j.map(_n)),f.slotsFrom==="registry"&&(E.slotsFrom="registry",f.registrySlotIds&&(E.registrySlotIds=f.registrySlotIds),f.bootstrap===!1&&(E.bootstrap=!1),f.render&&Object.keys(f.render).length>0&&(E.render=f.render)),f.v&&(E.v=f.v),typeof f.pp=="number"&&(E.pp=f.pp),e.persona&&(E.persona=e.persona);let x=JSON.stringify(E);return Rn(O,x,async()=>{var T,V,G,te,re,W,ge,ke;if(!await wn($e,2500)||Ee||!C())return yn(j),null;let de=je(3e4);try{let ae=await fetch(`${v}/decide`,{method:"POST",body:x,headers:d,signal:de.signal});if(!ae.ok)return yn(j),null;let $=await ae.json(),me={};for(let X of j){let Oe=(T=$.slots)==null?void 0:T[X.id];if(Oe!==void 0){me[X.id]=Oe,B.set(X.id,Oe),ne.add(X.id);continue}let ar=B.get(X.id);if(ar!==void 0)me[X.id]=ar;else{let lr=An(X);me[X.id]=lr,B.set(X.id,lr)}}if($.slots)for(let[X,Oe]of Object.entries($.slots))X in me||(me[X]=Oe,B.set(X,Oe),ne.add(X));let $o=ee!=null&&ee.persona!=="unknown";$.persona&&!($.persona==="unknown"&&$o)?ee={persona:$.persona,confidence:(V=$.confidence)!=null?V:0}:ee||(ee={persona:"unknown",confidence:0});for(let[X,Oe]of Object.entries((G=$.assignments)!=null?G:{}))P.set(X,Y,{variantId:Oe,assignedAt:Date.now(),segment:Y,confidence:1});if($.slotConfig)for(let[X,Oe]of Object.entries($.slotConfig))ue.set(X,Oe);$.palette&&(Q=$.palette),$.vocabulary&&(we=$.vocabulary);for(let X of(te=f.registrySlotIds)!=null?te:[])(re=$.slotConfig)!=null&&re[X]||(ue.delete(X),B.delete(X),ne.delete(X));return C()&&He(e.apiKey,F(F(F({v:1,persona:ee.persona,band:Je(ee.confidence),slots:Object.fromEntries(B),layoutOrder:(W=$.layoutOrder)!=null?W:null,savedAt:Date.now()},ue.size>0?{slotConfig:Object.fromEntries(ue)}:{}),Q?{palette:Q}:{}),we?{vocabulary:we}:{})),F(F(F(F(F({layoutOrder:(ge=$.layoutOrder)!=null?ge:null,assignments:(ke=$.assignments)!=null?ke:{},slots:me,persona:ee.persona,confidence:ee.confidence},$.slotConfig?{slotConfig:$.slotConfig}:{}),$.goals?{goals:$.goals}:{}),$.sectionMap?{sectionMap:$.sectionMap}:{}),$.palette?{palette:$.palette}:{}),$.vocabulary?{vocabulary:$.vocabulary}:{})}catch(ae){return yn(j),null}finally{de.clear()}})},getSlotResult(f){var y;return(y=B.get(f))!=null?y:null},isSlotDecided(f){return ne.has(f)},getSlotConfig(f){var y;return(y=ue.get(f))!=null?y:null},reportSlots(f,y,N,z){var j;let E={};for(let[x,T]of Object.entries(z!=null?z:{}))for(let V of T){let G=`${x}|${V.key}`;!It.test(x)||tr.has(G)||(tr.add(G),((j=E[x])!=null?j:E[x]=[]).push(V))}Object.keys(E).length>0&&fetch(`${v}/slots/observed`,{method:"POST",headers:d,body:JSON.stringify({slotIds:Object.keys(E),authoredArms:E})}).catch(()=>{});for(let x of f)if(!(typeof x!="string"||x.length===0)){if(!It.test(x)){ki()&&!nr.has(x)&&(nr.add(x),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(x)} will not register \u2014 ids must start with a letter or digit and contain only letters, digits, '_' or '-' (max 128 chars): /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.`));continue}if(!Me.has(x)){Me.add(x),Be.add(x);let T=y==null?void 0:y[x];if(typeof T=="string"){let G=T.replace(/\s+/g," ").trim().slice(0,400);G!==""&&Le.set(x,G)}let V=N==null?void 0:N[x];V!==void 0&&pn.set(x,V)}}Be.size===0||gn!=null||(gn=setTimeout(()=>{gn=null;let x=[...Be];Be.clear();for(let T=0;T<x.length;T+=20){let V=x.slice(T,T+20),G={},te={};for(let re of V){let W=Le.get(re);W!==void 0&&(G[re]=W,Le.delete(re));let ge=pn.get(re);ge!==void 0&&(te[re]=ge,pn.delete(re))}fetch(`${v}/slots/observed`,{method:"POST",headers:d,body:JSON.stringify(F(qe(F(F({slotIds:V},Object.keys(G).length>0?{baselineTexts:G}:{}),Object.keys(te).length>0?{baselineSkeletons:te}:{}),{pagePaths:Object.fromEntries(V.map(re=>[re,location.pathname]))}),Object.keys(G).length>0&&L.getSessionId()?{sessionId:L.getSessionId()}:{}))}).catch(()=>{})}},1e3))},reportSkeleton(f,y){!It.test(f)||Qn.has(f)||(Qn.add(f),fetch(`${v}/slots/observed`,{method:"POST",headers:d,body:JSON.stringify({slotIds:[f],baselineSkeletons:{[f]:y}})}).catch(()=>{}))},reportDrift(f,y,N,z){let j=`${f}|${y}`,E=L.getSessionId();!E||er.has(j)||(er.add(j),fetch(`${v}/slots/drift`,{method:"POST",headers:d,body:JSON.stringify({sessionId:E,reports:[{slotId:f,expectedFp:y,observedFp:N,reason:z}]})}).catch(()=>{}))},requestSlots(f,y,N){var z,j;for(let E of f)Lt.has(E)||(Lt.add(E),It.test(E)?dt.set(E,{text:y==null?void 0:y[E],render:(z=N==null?void 0:N.render)==null?void 0:z[E],skeleton:(j=N==null?void 0:N.skeletons)==null?void 0:j[E]}):se.reportSlots([E]));dt.size===0||mn!=null||(mn=setTimeout(()=>{mn=null;let E=[...dt];dt.clear();for(let x=0;x<E.length;x+=50){let T=E.slice(x,x+50),V={};for(let[G,te]of T)te.render&&(V[G]=te.render);se.decide({slotsFrom:"registry",registrySlotIds:T.map(([G])=>G),bootstrap:!1,render:V}).then(G=>{var te,re;if(G){let W={},ge={},ke=[];for(let[de,ae]of T){let $=(te=G.slotConfig)==null?void 0:te[de];if($){$.needsSkeleton&&ae.skeleton&&((re=se.reportSkeleton)==null||re.call(se,de,ae.skeleton));continue}ke.push(de),ae.text&&(W[de]=ae.text),ae.skeleton&&(ge[de]=ae.skeleton)}ke.length>0&&se.reportSlots(ke,W,ge)}else or(T.map(([W])=>W),Lt,W=>{var ge;let ke={},de={},ae={};for(let[$,me]of T)W.has($)&&(me.text&&(ke[$]=me.text),me.render&&(de[$]=me.render),me.skeleton&&(ae[$]=me.skeleton));(ge=se.requestSlots)==null||ge.call(se,[...W],ke,{render:de,skeletons:ae})});Tt.forEach(W=>W())})}},0))},decideSlots(f){for(let y of f)Pt.has(y.id)||(Pt.add(y.id),ft.set(y.id,y));ft.size===0||hn!=null||(hn=setTimeout(()=>{hn=null;let y=[...ft.values()];ft.clear();for(let N=0;N<y.length;N+=30){let z=y.slice(N,N+30);se.decide({slots:z}).then(j=>{j||or(z.map(E=>E.id),Pt,E=>{var x;return(x=se.decideSlots)==null?void 0:x.call(se,z.filter(T=>E.has(T.id)))}),Tt.forEach(E=>E())})}},0))},cancelSlots(f){for(let y of f)dt.delete(y)&&Lt.delete(y),ft.delete(y)&&Pt.delete(y)},onSlotsChanged(f){return Tt.add(f),()=>{Tt.delete(f)}},getStyleVocabulary(){return we},getSitePalette(){return Q},getPersona(){return ee?{persona:ee.persona,confidence:ee.confidence,band:Je(ee.confidence)}:null},async fetchWeights(){var f;let y=je(5e3);try{let N=await fetch(`${v}/weights`,{headers:d,signal:y.signal});return N.ok?(f=(await N.json()).components)!=null?f:[]:[]}catch(N){return[]}finally{y.clear()}},getGraph(){return{pageNodes:[],capturedAt:0}},flush(){m.flush(),I.flush()},dispose(){var f;pt==null||pt(),vn=!0,Ee=!0,m.destroy(),I.destroy(),((f=pe.get(e.apiKey))==null?void 0:f.dispose)===se.dispose&&pe.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var f;pt==null||pt(),vn=!0,Ee=!0,_=!0,Nt(e.apiKey),m.destroy({forget:!0}),I.destroy({forget:!0}),L.destroy(),P.clear(),((f=pe.get(e.apiKey))==null?void 0:f.dispose)===se.dispose&&pe.delete(e.apiKey);try{localStorage.removeItem(rt+e.apiKey),localStorage.removeItem(Mt(e.apiKey)),localStorage.removeItem(Bt(e.apiKey)),localStorage.removeItem(`_snt_graph_nodes${ze(e.apiKey)}`),localStorage.removeItem("_snt_graph_edges")}catch(y){}e.debug&&console.log("[sentient] destroyed")}};if(pe.set(e.apiKey,{config:e,upgrade:null,dispose:se.dispose}),pt=xi(se,e.apiKey,f=>{$e.then(()=>{vn||Fr.add(f)})}),e.debug){let f=window;f.__sentient&&(f.__sentient.client=se)}return se}var Kn=/(^|\/)snippet(\.global)?(\.min)?\.js(\?|$)/,Ti=(()=>{var e,t;try{return(t=(e=document.currentScript)==null?void 0:e.src)!=null?t:""}catch(n){return""}})(),Li=/@\d+\.\d+\.\d+[^/]*\//;function jn(e){var t;try{let n=Ti||((t=Array.from(document.getElementsByTagName("script")).find(r=>Kn.test(r.src)))==null?void 0:t.src);for(let r of n?[n]:[]){let o=Kn.test(r)?r.replace(Kn,`$1${e}$4`):r.replace(/[^/?#]*([?#].*)?$/,e),s=(e==="consent.global.js"?"sha384-+7/RqBOFLU5bMaQ6bcBAWzG589skmxN8tedG9hkoQQ6HaQkRRBJfoRVD94e/fJcM":e==="editor.global.js"?"sha384-IM0ZvnGcXtjKNN2QYYs5mta9G2LQXVrjggdRf+qfouIEcMW1IbXvUrz4LuUtPuYi":e==="preview.global.js"?"sha384-vdxAPgchJj9TyoCfgD43y1powSvyp9HFnq+1YircrnoQ8LsCBH/RCei+cQHMjZ+r":"sha384-UrsR0kx6RZQJGK+0uvo8zOHdbMK/dVEm6nwPOPTwt8xRsce0GYhwh2zd/HQNQ+xw")||"";return Li.test(o)&&s.indexOf("sha384-")===0?{src:o,integrity:s}:{src:o}}}catch(n){}return null}var Wt=new Map;function lt(e,t,n){let r=window[t];if(r)return Promise.resolve(r);let o=Wt.get(e);return o||(o=new Promise(s=>{var i;let a=n?{src:n}:jn(e);if(!a)return s(null);let l=Ge(document.createElement("script"));Gn(l,a),l.async=!0,l.onload=()=>{var u;let c=(u=window[t])!=null?u:null;c||Wt.delete(e),s(c)},l.onerror=()=>{Wt.delete(e),s(null)},((i=document.head)!=null?i:document.documentElement).appendChild(l)}),Wt.set(e,o)),o}function Gn(e,t){t.integrity&&(e.integrity=t.integrity,e.crossOrigin="anonymous"),e.src=t.src}var zr="__sentientConsent",Pe=null,Fn=!1,Vt=new Set,Un=()=>{let e=window[zr];return typeof(e==null?void 0:e.consentWatcher)=="function"?e.consentWatcher:null},vt;function Wr(e){vt=e}function Pi(){Pe||(Pe=Un())||Fn||(Fn=!0,lt("consent.global.js",zr,vt).then(e=>{if(Fn=!1,!e)return Ri(vt!=null?vt:"consent.global.js");if(Pe=Un(),Pe)for(let t of Array.from(Vt))t()}))}function Ri(e){console.warn(`[sentient] could not load ${e} \u2014 tracking stays off. Set window.sentient.consentSrc to its URL.`)}function Xe(e){Pi();let t=null,n=()=>(!t&&(Pe!=null?Pe:Pe=Un())&&(t=Pe(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,s=!1,a=()=>{Vt.delete(a);let l=n();s||!l||(o=l.subscribe(r),r())};return n()?(o=t.subscribe(r),Promise.resolve().then(()=>{s||r()})):Vt.add(a),()=>{s=!0,Vt.delete(a),o==null||o()}}}}function Ni(e){return e.replace(/\s+/g," ").trim().slice(0,300)}function Vr(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 Di(e){let t=e.join("");return Vr(t,2166136261)+Vr(t,1523705862)}var Mi=new Set(["A","BUTTON"]),Bi=/^H([1-6])$/,$i=new Set(["P","LI","LABEL","BLOCKQUOTE","FIGCAPTION","DT","DD","TD","TH"]);var Ki=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"]);function ji(e){return Mi.has(e.tagName)||e.getAttribute("role")==="button"?!0:e.tagName==="INPUT"&&/^(submit|button)$/i.test(e.type)}function Gi(e){if(Bi.test(e.tagName)||$i.has(e.tagName))return!0;let t=e.ownerDocument.defaultView,n=t?t.getComputedStyle(e).display:"";return n!==""&&n!=="inline"&&n!=="contents"}function Fi(e,t){let n=null;for(let r=e.parentElement;r&&r!==t.parentElement;r=r.parentElement){if(ji(r)){n=r;break}if(r===t)break}if(n)return n;for(let r=e.parentElement;r;r=r.parentElement)if(r===t||Gi(r))return r;return t}function Ht(e,t=40){var n,r,o;let s=e.ownerDocument.createTreeWalker(e,4),a=[];for(let u=s.nextNode();u;u=s.nextNode())if(((n=u.nodeValue)!=null?n:"").trim()!==""&&!Ki.has((o=(r=u.parentElement)==null?void 0:r.tagName)!=null?o:"")&&(a.push(u),a.length>120))return{reason:"too_large"};if(a.length===0)return{reason:"empty"};let l=[],i=[];for(let u of a){let p=Fi(u,e),h=l.indexOf(p);h===-1&&(l.push(p),h=l.length-1),i.push(h)}if(l.length>t)return{reason:"too_large"};let c=a.map(u=>{var p;return Ni((p=u.nodeValue)!=null?p:"")});return{textNodes:a,ownerEls:l,leafToNode:i,leaves:c,fp:Di(c)}}var Hr=["cookiebot","onetrust","cookieyes","tcf","google-consent-mode","shopify"];function Ui(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(s=>typeof s=="string")||/[=|]/.test(r)||o.some(s=>/[=|]/.test(s)))return null;n[r]=o}return n}function zi(e){return!Array.isArray(e)||e.length<2||e.length>12||!e.every(t=>typeof t=="string")?null:e}function Wi(e){try{return e()}catch(t){return}}function qt(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 c=i,u=Ui(c.dims);if(!u||c.target!==void 0&&typeof c.target!="string")continue;let p=c.arms!==void 0?zi(c.arms):null,h={dims:u};typeof c.target=="string"&&(h.target=c.target),p&&(h.arms=p),n[l]=h}let r={apiKey:t.apiKey,personaAttributes:t.personaAttributes===!0,slots:n};typeof t.consent=="boolean"?r.consent=t.consent:t.consent!==void 0&&s("consent");let o=t.consentFrom;if(typeof o=="string"&&Hr.includes(o))r.consentFrom=o;else if(o&&typeof o=="object"&&!Array.isArray(o)){let l=o;typeof l.cmp=="string"&&Hr.includes(l.cmp)||l.cmp===void 0&&(typeof l.cookie=="string"||typeof l.check=="function")?r.consentFrom=l:s("consentFrom")}else o!==void 0&&s("consentFrom");function s(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),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 a=typeof t.persona=="function"?Wi(t.persona):t.persona;if(typeof a=="string"&&a.trim()!==""&&(r.persona=a),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 qr=new WeakMap;function Jr(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Yr(e,t,n){var s,a,l;let r=qr.get(e);if(r){if(r.fp!==n.fp||!Jr(r.leafToNode,n.leafToNode))return"mismatch"}else{let i=Ht(e);if(!("fp"in i)||(r={fp:i.fp,leafToNode:i.leafToNode,textNodes:i.textNodes,ownerEls:i.ownerEls,classes:i.ownerEls.map(c=>{var u;return(u=c.getAttribute("class"))!=null?u:""})},r.fp!==n.fp||!Jr(r.leafToNode,n.leafToNode)))return"mismatch";qr.set(e,r)}let o=r;for(let[i,c]of Object.entries(t.nodes)){let u=Number(i),p=o.ownerEls[u];if(p){if(typeof c.text=="string"){let h=!0;o.leafToNode.forEach((b,w)=>{b===u&&(o.textNodes[w].nodeValue=h?c.text:"",h=!1)})}c.like!==void 0&&o.classes[c.like]!==void 0&&p.setAttribute("class",o.classes[c.like]),c.hidden&&((s=p.style)==null||s.setProperty("display","none","important"))}}for(let i of Object.values((a=t.order)!=null?a:{})){let c=i.map(w=>o.ownerEls[w]).filter(w=>!!w),u=(l=c[0])==null?void 0:l.parentElement;if(!u||c.length!==i.length||c.some(w=>w.parentElement!==u))continue;let p=new Set(c),h=0;Array.from(u.children).map(w=>p.has(w)?c[h++]:w).forEach((w,S)=>{var K;u.children[S]!==w&&u.insertBefore(w,(K=u.children[S])!=null?K:null)})}return"applied"}function St(e){var n,r,o;let t=(r=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0)==null?void 0:r.location;return(o=t==null?void 0:t.pathname)!=null?o:""}function Vi(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 Jt(e,t){return!!(e!=null&&e.urlMatch)&&!St(t).includes(e.urlMatch)}var Hi=/^[a-zA-Z_][-a-zA-Z0-9_]*$/;function Xr(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)&&Hi.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 Te(e,t){if(e.urlMatch&&!St(t).includes(e.urlMatch))return null;let n=Xr(e,t);if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!Vi(r,e.fingerprint)?null:r}function Zr(e,t){return Jt(e,t)?!1:!!e.selector&&!e.dataAttr&&!e.id&&!e.fingerprint&&e.page===void 0?Qr(e,t):Te(e,t)!==null}function Qr(e,t){return Xr(e,t).length>0}function Yt(e,t){return Jt(e,t)?!1:e.page!==void 0&&zt.test(e.page)?Dn(e.page,St(t)):Qr(e,t)}var eo={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"},qi=/^(rgb|rgba|hsl|hsla|calc|var|min|max|clamp)$/i;function to(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(!qi.test((r=n[1])!=null?r:""))return!1;return!0}var zn=/^https:\/\//i;function Xt(e){return typeof e=="string"&&!/[\s\x00-\x1f\\]/.test(e)&&(zn.test(e)||e[0]==="/"&&e[1]!=="/")?e:null}var no=new Map,Fe=null;function Ji(e){return e.replace(/["\\]/g,"\\$&")}function Yi(e){var t;(!Fe||!Fe.isConnected)&&(Fe=e.querySelector("style[data-sentient-ops]"),Fe||(Fe=Ge(e.createElement("style"),e),Fe.setAttribute("data-sentient-ops",""),((t=e.head)!=null?t:e.documentElement).appendChild(Fe))),Fe.textContent=[...no.entries()].map(([n,r])=>`[data-snt-e="${Ji(n)}"]{${r}}`).join(`
2
- `)}function ro(e,t,n,r){var l;let o=!1,s=(l=t.moveBefore)!=null?l:t.moveAfter;if(s){let i=Te(s,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"&&(e.textContent=t.text),typeof t.href=="string"&&zn.test(t.href)&&e.setAttribute("href",t.href),typeof t.imageSrc=="string"&&zn.test(t.imageSrc)&&e.setAttribute("src",t.imageSrc),typeof t.imageAlt=="string"&&e.setAttribute("alt",t.imageAlt);let a=[];if(t.hidden&&a.push("display:none !important"),t.style)for(let[i,c]of Object.entries(t.style)){let u=eo[i];u&&typeof c=="string"&&to(c)&&a.push(`${u}:${c.trim()} !important`)}return a.length>0&&(e.setAttribute("data-snt-e",n),no.set(n,a.join(";")),Yi(r)),{anchorMiss:o}}var bt="data-sentient-block-arm",R=null;function wt(e){R=e!=null?e:null}var Ze=null;function Et(e){Ze=e!=null?e:null}var ao=e=>{var t;return typeof e=="string"?(t=Ze==null?void 0:Ze.entries.find(n=>n.id===e))==null?void 0:t.classes:void 0},lo=e=>{let t=typeof e=="string"?Ze==null?void 0:Ze.entries.find(n=>n.id===e):void 0;return t!=null&&t.computed.inheritsColor?t.computed.color:void 0},Re="data-sentient-blocks-hid",ut={none:"0",sm:"8px",md:"16px",lg:"24px"},Wn={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},oo={sm:"0.875em",md:"1em",lg:"1.25em"},Xi={sm:"1.25em",md:"1.5em",lg:"2em"},Zi={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},io={sm:"8px",md:"16px",lg:"32px"},Qi={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},es={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 so(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 uo(e,t){let n=ts(e,t),r=lo(e.like);return n&&r&&(n.style.color=r),n}function ts(e,t){var n,r,o,s,a,l,i,c,u,p,h,b,w,S,K,L,D,_,A,C;try{let P=ao(e.like),m=e.maxWidth==="measure"?"65ch":void 0,v=d=>(d.className=P,he(d,{"max-width":m}));switch(e.type){case"stack":case"grid":{let d=t.createElement("div");if(e.type==="stack"){let M=e;he(d,{display:"flex","flex-direction":M.direction,gap:(r=ut[(n=M.gap)!=null?n:"md"])!=null?r:ut.md,"align-items":M.align?Wn[M.align]:void 0,"justify-content":M.justify?Wn[M.justify]:void 0,"flex-wrap":M.wrap?"wrap":void 0})}else{let M=e,q=(s=ut[(o=M.gap)!=null?o:"md"])!=null?s:ut.md;he(d,{display:"grid","grid-template-columns":`repeat(auto-fit, minmax(max(200px, calc((100% - ${M.columns-1} * ${q}) / ${M.columns})), 1fr))`,gap:q,"align-items":M.align?Wn[M.align]:void 0})}P&&(d.className=P);let g=!P&&e.type==="stack"&&e.surface==="raised",I=(a=e.pad)!=null?a:g?"md":void 0;I&&he(d,{padding:(l=ut[I])!=null?l:ut.md}),g&&he(d,{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":(c=R==null?void 0:R.radius)!=null?c:"8px"});for(let M of(u=e.children)!=null?u:[]){let q=uo(M,t);q&&d.appendChild(q)}return d}case"text":{let d=t.createElement("p");return d.textContent=e.value,P?v(d):he(d,Ke(U({margin:"0","font-size":e.size?oo[e.size]:void 0,"font-weight":e.weight?es[e.weight]:void 0,"text-align":e.align},so(e.tone)),{"max-width":e.maxWidth==="measure"?"65ch":void 0}))}case"heading":{let d=t.createElement(`h${e.level}`);return d.textContent=e.value,P?v(d):he(d,{margin:"0","font-size":Xi[(p=e.size)!=null?p:"md"],"text-align":e.align,"max-width":e.maxWidth==="measure"?"65ch":void 0})}case"button":{let d=t.createElement("a");d.textContent=e.label;let g=Xt(e.href);if(g&&(d.href=g),e.tag&&d.setAttribute("data-sentient-tag",e.tag),P)return v(d);let I=(h=e.emphasis)!=null?h:"primary";return he(d,{display:"inline-block",padding:Zi[(b=e.size)!=null?b:"md"],"border-radius":(w=R==null?void 0:R.radius)!=null?w:"8px",font:"inherit","font-size":e.size?oo[e.size]:void 0,"text-decoration":I==="ghost"?"underline":"none",cursor:"pointer",background:I==="primary"?(S=R==null?void 0:R.primaryBg)!=null?S:"#111827":"transparent",color:I==="primary"?(K=R==null?void 0:R.primaryText)!=null?K:"#ffffff":(L=R==null?void 0:R.accent)!=null?L:"inherit",border:I==="secondary"?`1px solid ${(D=R==null?void 0:R.accent)!=null?D:"currentColor"}`:"none"})}case"link":{let d=t.createElement("a");d.textContent=e.label;let g=Xt(e.href);return g&&(d.href=g),e.tag&&d.setAttribute("data-sentient-tag",e.tag),P?v(d):he(d,{color:"inherit","text-decoration":"underline"})}case"image":{let d=t.createElement("img"),g=Xt(e.src);return g&&(d.src=g),d.alt=e.alt,P&&(d.className=P),he(d,{display:"block","max-width":"100%","aspect-ratio":e.ratio&&e.ratio!=="auto"?Qi[e.ratio]:void 0,"object-fit":e.fit,width:e.ratio&&e.ratio!=="auto"?"100%":void 0})}case"badge":{let d=t.createElement("span");return d.textContent=e.value,P?v(d):he(d,U({display:"inline-block",padding:"2px 10px","border-radius":"999px","font-size":"0.75em",border:`1px solid ${(_=R==null?void 0:R.border)!=null?_:"currentColor"}`},so(e.tone)))}case"spacer":return he(t.createElement("div"),{height:(A=io[e.size])!=null?A:io.md});case"divider":return he(t.createElement("hr"),{border:"none","border-top":`1px solid ${(C=R==null?void 0:R.border)!=null?C:"currentColor"}`,margin:"0",width:"100%"});default:return null}}catch(P){return null}}function co(e,t,n,r){var o,s;try{let a=new Set;for(let i of Array.from(e.children)){let c=i.getAttribute(bt);c!==null&&(t[c]===void 0?i.remove():a.add(c))}for(let[i,c]of Object.entries(t)){if(a.has(i))continue;let u="tree"in c?c:null,p=uo(u?u.tree:c,r);if(!p)continue;let h=r.createElement("div");h.setAttribute(bt,i),h.style.display="none";let b=u?ao((o=u.surface)==null?void 0:o.like):void 0;if(b){let w=r.createElement("div");w.className=b;let S=lo((s=u.surface)==null?void 0:s.like);S&&(w.style.color=S),w.appendChild(p),h.appendChild(w)}else h.appendChild(p);e.appendChild(h)}let l=n!==void 0&&t[n]!==void 0;for(let i of Array.from(e.children)){let c=i.getAttribute(bt),u=i;c!==null?u.style.display=l&&c===n?"":"none":l?u.hasAttribute(Re)||(u.setAttribute(Re,u.style.display),u.style.display="none"):u.hasAttribute(Re)&&(u.style.display=u.getAttribute(Re),u.removeAttribute(Re))}}catch(a){}}function ns(e){try{for(let t of Array.from(e.children)){let n=t;if(n.getAttribute(bt)!==null){n.remove();continue}n.hasAttribute(Re)&&(n.style.display=n.getAttribute(Re),n.removeAttribute(Re))}}catch(t){}}function Zt(e,t){try{let n=new Set;for(let r of Array.from(e.querySelectorAll(`[${bt}]`)))r.parentElement&&n.add(r.parentElement);for(let r of Array.from(e.querySelectorAll(`[${Re}]`)))r.parentElement&&n.add(r.parentElement);for(let r of n)t.has(r)||ns(r)}catch(n){}}function Vn(e,t){if(!e)return[t.documentElement];try{return Array.from(t.querySelectorAll(e))}catch(n){return[]}}function Qt(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 en(e,t,n,r){var o;for(let[s,a]of Object.entries(t)){let l=e[s];if(!l||typeof l=="string")continue;let i=Vn(a.target,n);for(let c of i)for(let[u,p]of Object.entries(l))(o=a.dims[u])!=null&&o.includes(p)&&(c.setAttribute(`data-${u}`,p),r==null||r(c,`data-${u}`))}}function tn(e,t,n,r){for(let[o,s]of Object.entries(t)){let a=e[o];if(typeof a!="string"||!s.arms||!s.arms.includes(a))continue;let l=Vn(s.target,n);for(let i of l)i.setAttribute("data-sentient-arm",a),r==null||r(i,"data-sentient-arm")}}function rs(e,t){var o,s;let n=e.ownerDocument.createTreeWalker(e,4),r=null;for(let a=n.nextNode();a!==null;a=n.nextNode()){if(((o=a.nodeValue)!=null?o:"").trim()==="")continue;let l=(s=a.parentElement)==null?void 0:s.tagName;if(!(l==="SCRIPT"||l==="STYLE"||l==="TEMPLATE")){if(r!==null){e.textContent=t;return}r=a}}r!==null?r.nodeValue=t:e.textContent=t}function nn(e,t,n,r){var l,i,c,u,p,h,b;let o=new Set,s=(l=r==null?void 0:r.contentAndOps)!=null?l:!0,a=[];for(let[w,S]of Object.entries(t)){if(Jt(S.locator,n))continue;let K;if(S.locator){let D=Te(S.locator,n);K=D?[D]:[],!D&&Yt(S.locator,n)&&a.push(w)}else K=Vn(S.target,n);let L=e[w];for(let D of K){if(L!==void 0)if(typeof L=="string")D.setAttribute("data-sentient-arm",L),(i=r==null?void 0:r.onAttr)==null||i.call(r,D,"data-sentient-arm"),s&&((c=r==null?void 0:r.onApplied)==null||c.call(r,w,L,D));else for(let[A,C]of Object.entries(L))D.setAttribute(`data-${A}`,C),(u=r==null?void 0:r.onAttr)==null||u.call(r,D,`data-${A}`);if((S.blocks||S.compose)&&!is(n)){let A=Object.fromEntries([...Object.entries((p=S.blocks)!=null?p:{}).filter(([,C])=>!ht(C)),...Object.entries((h=S.compose)!=null?h:{}).filter(([,C])=>!ht(C.tree))]);Object.keys(A).length>0&&(co(D,A,typeof L=="string"?L:void 0,n),o.add(D))}if(!s)continue;let _=D.textContent;S.edits?Yr(D,S.edits.edits,S.edits)==="mismatch"&&((b=r==null?void 0:r.onDrift)==null||b.call(r,w,S.edits.fp)):typeof S.content=="string"&&rs(D,S.content),S.ops&&ro(D,S.ops,w,n).anchorMiss&&!a.includes(w)&&a.push(w),Mn(D,Ke(U(U({previous:_},typeof L=="string"?{arm:L}:{}),(r==null?void 0:r.persona)!==void 0?{persona:r.persona}:{}),{doc:n}))}}return Zt(n,o),a}var os=/bot|crawler|spider|crawling|googlebot|bingbot|duckduckbot|baiduspider|yandexbot|slurp|gptbot|claudebot|anthropic|perplexity|ccbot|applebot|headlesschrome/i;function is(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:os.test((r=o.userAgent)!=null?r:""):!1}catch(o){return!1}}var ss=800;function rn(e,t,n){let r=[];return n.forEach(({slotId:o,arm:s,el:a},l)=>{r.push(Bn((h,b={})=>{try{e.track({projectId:t,componentId:o,variantId:s,eventType:"micro_signal",payload:U({signalType:h},b)})}catch(w){}},a,void 0,{tabLoss:l===0}));let i=null,c=0,u=()=>{c=Date.now(),i=setTimeout(()=>{try{e.track({projectId:t,componentId:o,variantId:s,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-c}})}catch(h){}i=null},ss)},p=()=>{i!==null&&(clearTimeout(i),i=null)};a.addEventListener("mouseenter",u),a.addEventListener("mouseleave",p),r.push(()=>{a.removeEventListener("mouseenter",u),a.removeEventListener("mouseleave",p),i!==null&&clearTimeout(i)})}),()=>{for(let o of r)o()}}function as(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 po(e){return e?`_snt_fired_goals_${e.slice(0,12)}`:"_snt_fired_goals"}var ls="_snt_fired_goals";function Hn(e,t){try{e==null||e.sessionStorage.removeItem(po(t)),e==null||e.sessionStorage.removeItem(ls)}catch(n){}}function fo(e){var t;return[(t=e.slotId)!=null?t:"",e.goalId,e.event,e.locator?JSON.stringify(e.locator):""].join("|")}function us(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 cs(e,t,n){try{e==null||e.sessionStorage.setItem(t,JSON.stringify([...n]))}catch(r){}}function go(e,t,n,r){var L,D;let o=(L=n.defaultView)!=null?L:typeof window!="undefined"?window:null,s=po(r),a=us(o,s),l=_=>{let A=fo(_);if(!a.has(A))try{_.slotId?t.componentGoal(_.slotId,_.goalId):t.goal(_.goalId),a.add(A),cs(o,s,a)}catch(C){}},i=e.filter(_=>_.event==="click"),c=e.filter(_=>_.event==="form_submit"),u=e.filter(_=>_.event==="url_reached"),p=e.filter(_=>_.event==="scroll_depth"),h=(_,A)=>{if(!_.locator)return!1;let C=Te(_.locator,n);return!!C&&(C===A||C.contains(A))},b=_=>{let A=_.target;if(!(!A||typeof A.closest!="function"))for(let C of i)h(C,A)&&l(C)},w=_=>{let A=_.target;if(A)for(let C of c)h(C,A)&&l(C)},S=()=>{if(u.length===0)return;let _=St(n);for(let A of u)A.urlPattern&&as(A.urlPattern,_)&&l(A)},K=()=>{var C;let _=n.documentElement,A=_.scrollHeight>0?(_.scrollTop+_.clientHeight)/_.scrollHeight:0;for(let P of p)A>=((C=P.threshold)!=null?C:.75)&&l(P);p.every(P=>a.has(fo(P)))&&n.removeEventListener("scroll",K)};return n.addEventListener("click",b,!0),n.addEventListener("submit",w,!0),(D=n.defaultView)==null||D.addEventListener("popstate",S),S(),p.length>0&&(n.addEventListener("scroll",K,{passive:!0}),K()),{checkUrl:S,teardown:()=>{var _;n.removeEventListener("click",b,!0),n.removeEventListener("submit",w,!0),(_=n.defaultView)==null||_.removeEventListener("popstate",S),p.length>0&&n.removeEventListener("scroll",K)}}}function on(e,t){if(!e||e.length<2||t.size!==e.length)return null;let n=[];for(let a of e){let l=t.get(a);if(!l||n.includes(l))return null;n.push(l)}let r=n[0].parentNode;if(!r||!n.every(a=>a.parentNode===r))return null;let o=n.slice().sort((a,l)=>a.compareDocumentPosition(l)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),s=[];for(let a=0;a<n.length;a++){let l=n[a];o[a]!==l&&(s.push({el:l,before:o[a]}),o.splice(o.indexOf(l),1),o.splice(a,0,l))}return s}var ds="__snt_editor_token";function mo(){try{return typeof sessionStorage!="undefined"?sessionStorage.getItem(ds):null}catch(e){return null}}function ho(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 s=n.slice(0,r.index)+o;history.replaceState(history.state,"",s?"#"+s:location.pathname+location.search)}}catch(n){}return t}var kt="0.32.0",ln=kt!=="0.0.0-dev"?{name:"snippet",version:kt}:void 0,_o=kt!=="0.0.0-dev"?{v:kt}:{},yo=5e3,fs=50,Ao=(()=>{try{if(typeof window=="undefined")return[];let e=window.SentientSnippet;return Array.isArray(e==null?void 0:e.q)?e.q:[]}catch(e){return[]}})(),Z=null,k=null,Se={},ve=null,be=null,_t=null,oe=null,ie=null,At=0,H=null,Qe=null,vo=!1,qn=null,sn=null,Ct=null,_e=!1,Ue=!1,un=!1,cn=0,Co=e=>fe(e)===cn,ct=null,ce=!1,De=null,Ae=[],et=null,tt=null,ye=null,ps=3e3,gs=100;function So(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 Ne(e,...t){e!=null&&e.debug&&console.log("[sentient-snippet]",...t)}function xt(e,t){return Z?(Z.personaAttributes&&H&&Qt(H.persona,H.band,e,t==null?void 0:t.onAttr),en(Se,Z.slots,e,t==null?void 0:t.onAttr),tn(Se,Z.slots,e,t==null?void 0:t.onAttr),ve?nn(Se,ve,e,U(Ke(U({},t),{onDrift:(n,r)=>{var o,s;return(s=k==null?void 0:k.reportDrift)==null?void 0:s.call(k,n,r,(o=Io[n])!=null?o:null,"fp_mismatch")}}),H?{persona:H.persona}:{})):(Zt(e,new Set),[])):[]}function xo(e){var n;let t=new Map;for(let r of(n=Z==null?void 0:Z.sections)!=null?n:[])try{let o=e.querySelectorAll(r);o.length===1&&t.set(r,o[0])}catch(o){}return t}function Jn(e,t){var n,r;try{if(!e||e.length<2)return;for(let o of(n=on(e,xo(t)))!=null?n:[])(r=o.before.parentNode)==null||r.insertBefore(o.el,o.before)}catch(o){}}function ms(e,t,n){let r=(o,s)=>t.some(([a,l])=>a===o&&l===s);try{if(Array.isArray(e.stamped))for(let o of e.stamped){if(!Array.isArray(o))continue;let[s,a,l]=o;!s||typeof a!="string"||r(s,a)||(l==null?s.removeAttribute(a):s.setAttribute(a,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 hs(){try{let e=window.__sntPP;return e&&typeof e=="object"&&typeof e.v=="number"?e:null}catch(e){return null}}function Oo(e){return e.apiBase?`${e.apiBase.replace(/\/+$/,"")}/v1/events`:void 0}function fn(e){var t;return(t=e.apiBase)!=null?t:"https://api.sentient-ui.com"}function ys(e){return Promise.resolve().then(()=>fetch(`${fn(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 Yn(e,t){let n=[],r=[];for(let o of e)try{if(typeof(o==null?void 0:o.id)!="string")continue;!o.locator||Zr(o.locator,t)?n.push(o.id):Yt(o.locator,t)&&r.push(o.id)}catch(s){}return[n,r]}var Io={};function To(e,t){var r;let n={};for(let o of e){let s=(r=De==null?void 0:De.find(c=>c.id===o))==null?void 0:r.locator,a=s?Te(s,t):null,l=a?Ht(a):null,i=l&&"fp"in l?l.fp:void 0;i&&(Io[o]=i),n[o]=Ke(U({},i?{fp:i}:{}),{forms:!1,compose:!0,content:!0})}return n}function Lo(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 Po(){if(!_e){le&&et!==Ie()&&le(!0);return}!De||et===Ie()||(et=Ie(),vs())}function vs(){ye==null||ye();let e=Z,t=De;if(!e||!t)return;let n,r,o=()=>{clearTimeout(n),clearTimeout(l),r==null||r.disconnect(),ye===o&&(ye=null)},s=null,a=i=>{let[c,u]=Yn(t,document),p=c.filter(h=>!Ae.includes(h));s!==null&&c.some(h=>!s.has(h)&&!p.includes(h))&&Ot(),s=new Set(c),p.length>0&&Ss(p).catch(()=>{}),(i||u.length===0&&!t.some(h=>!c.includes(h.id)&&!Ae.includes(h.id)))&&(o(),Ro(e,u))},l=setTimeout(()=>a(!0),ps);if(ye=o,a(),ye===o)try{r=new MutationObserver(()=>{clearTimeout(n),n=setTimeout(a,gs)}),r.observe(document.documentElement,{childList:!0,subtree:!0})}catch(i){}}function dn(e,t){if(!(!e||e.length===0||!t||!Z))try{be==null||be.teardown(),be=go(e,t,document,Z.apiKey)}catch(n){}}async function Ss(e){let t=Z,n=k;if(!t||!n)return;Ae=Ae.concat(e);let r=await n.decide(U({slotsFrom:"registry",registrySlotIds:e,render:To(e,document)},_o));if(r||(Ae=Ae.filter(s=>!e.includes(s))),!r||ce||k!==n)return;Se=U(U({},Se),r.slots),!be&&r.goals&&(t.consent!==!1||Ue)&&dn(_t=r.goals,n);let o=Lo(r.slotConfig,e);o&&(ve=U(U({},ve),o)),Ot(),Ne(t,"late decide",e),tt&&Co(t.apiKey)&&He(t.apiKey,tt=U(Ke(U({},tt),{slots:Se,savedAt:Date.now()}),ve?{slotConfig:ve}:{}))}function Ro(e,t){if(t.length!==0)try{fetch(`${fn(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 nt(){return!!(Z&&k&&Z.sectionCapture!==!1&&(Z.consent!==!1||Ue)&&!Ye())}function bs(){if(!k||!Z||!nt()||ie)return;let e=[];xt(document,{contentAndOps:_e,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),Zn();try{oe==null||oe(),oe=rn(k,Z.apiKey,e)}catch(t){}}function Zn(){if(typeof document=="undefined"||!nt())return;let e;try{if(sn&&sn.length>0){let r=new Map;for(let o of sn){if(o.urlMatch!==window.location.pathname)continue;let s=Te(o.locator,document);s&&r.set(s,o.type)}r.size>0&&(e=o=>{var s;return(s=r.get(o))!=null?s:null})}}catch(r){}let t=k,n=++At;Ct=window.location.pathname,lt("engagement.global.js","__sentientEngagement").then(r=>{if(!(!r||n!==At||k!==t||!t||!nt()))try{ie==null||ie(),ie=r.startEngagementCapture(t,U({apiKey:Z.apiKey,apiBase:Z.apiBase,doc:document,microSignals:!0},e?{typeOf:e}:{}))}catch(o){}})}function Ot(){try{let e=[];if(oe==null||oe(),oe=null,xt(document,{contentAndOps:_e,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),Jn(Qe,document),e.length>0&&nt())try{oe=rn(k,Z.apiKey,e)}catch(t){}try{typeof window!="undefined"&&Ct!==null&&window.location.pathname!==Ct&&nt()&&(ie==null||ie(),ie=null,At++,Zn())}catch(t){}}catch(e){}}function bo(){qn===null&&(qn=setTimeout(()=>{qn=null,Ot();try{be==null||be.checkUrl()}catch(e){}Po()},fs))}function No(){if(!(vo||typeof window=="undefined"||typeof history=="undefined")){vo=!0;try{let e=t=>{let n=history[t];history[t]=function(r,o,s){let a=n.call(this,r,o,s!=null?s:null);return bo(),a}};e("pushState"),e("replaceState"),window.addEventListener("popstate",bo)}catch(e){}}}function an(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 ws(e,t,n){var r;try{window.__sentientEditor={token:t,code:n,apiBase:fn(e)};let o=e.editorSrc?{src:e.editorSrc}:jn("editor.global.js");if(!o){Eo();return}let s=Ge(document.createElement("script"));Gn(s,o),s.async=!0,s.onerror=()=>Eo(),((r=document.head)!=null?r:document.documentElement).appendChild(s)}catch(o){}}var wo="sentient-editor-load-notice";function Eo(){var e;try{if(document.getElementById(wo))return;let t=document.createElement("div");t.id=wo,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;max-width:320px;padding:14px 16px;border-radius:14px;background:#111827;color:#fff;font:13px/1.45 system-ui,sans-serif;border:1px solid rgba(245,158,11,.6);cursor:pointer",t.onclick=()=>t.remove(),((e=document.body)!=null?e:document.documentElement).appendChild(t),setTimeout(()=>t.remove(),1e4)}catch(t){}}function Es(e){let t={cfg:e,apiBase:fn(e),set(n){n.slots!==void 0&&(Se=n.slots),n.slotConfig!==void 0&&(ve=n.slotConfig),n.persona!==void 0&&(H=n.persona),n.decided&&(_e=!0),n.look&&(wt(n.look.palette),Et(n.look.vocabulary))},apply:()=>xt(document),installSpaHooks:No,exposeGlobal:()=>{un=!0,Xn(e)},dbg:(...n)=>Ne(e,...n)};return lt("preview.global.js","__sentientPreview").then(n=>n?n.runPreview(t):Promise.reject()).catch(()=>(t.exposeGlobal(),Ne(e,"preview chunk unavailable \u2014 page left as-is"),!0))}function Xn(e){let t=r=>{try{ie==null||ie(),ie=null,At++,Ct=null,oe==null||oe(),oe=null,ye==null||ye(),be==null||be.teardown(),be=null,r&&Hn(typeof window!="undefined"?window:null,e.apiKey),Ue=!1,ce=!0,r?(tt=null,H=null,k?k.destroy():it(e.apiKey)):k==null||k.dispose(),k=null}catch(o){}},n={consentWatcher:Xe,goal(r,o){try{k==null||k.goal(r,o)}catch(s){}},componentGoal(r,o){try{k==null||k.componentGoal(r,o)}catch(s){}},grantConsent(){try{if(!k&&ce||k!=null&&k.released)cn=fe(e.apiKey),k=yt(U({apiKey:e.apiKey,consent:!0,preConsentBehavior:e.preConsentBehavior,debug:e.debug,persona:e.persona,ingestUrl:Oo(e)},ln?{sdk:ln}:{})),dn(_t,k);else{let r=(k==null?void 0:k.gated)===!0;$n(e.apiKey),r&&(cn=fe(e.apiKey)),dn(_t,k)}ce=!1,le==null||le()}catch(r){}Ue=!0;try{bs()}catch(r){}},revokeConsent(){t(!0)},reapply:Ot,getState(){var r,o;try{return{apiKey:e.apiKey,persona:(r=H==null?void 0:H.persona)!=null?r:null,band:(o=H==null?void 0:H.band)!=null?o:null,slots:Se,matchCounts:an(e),consent:!ce&&(e.consent!==!1||Ue)}}catch(s){return{apiKey:e.apiKey,persona:null,band:null,slots:{},matchCounts:{},consent:!1}}}};if(window.SentientSnippet=n,window.__sentientApi=n,e.consentFrom&&!ct&&!un)try{let r=Xe(e.consentFrom),o=!1,s=!1,a=()=>!!k&&!ce&&(k.gated===void 0?e.consent!==!1||Ue:!k.gated);ct=r.subscribe(()=>{try{let l=r.read();l!==null&&(s=!0);let i=l!=null?l:s?!1:null,c=a(),u=!c&&i!==!0&&r.refused();if(u&&!o&&(k!=null&&k.gated?k.destroy():it(e.apiKey),Hn(window,e.apiKey),tt=null,H=null),o=u,i===!0&&!c)n.grantConsent();else if(i===!1&&c){let p=r.refused();t(p),p&&(o=!0)}}catch(l){}})}catch(r){}for(let r of Ao.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 ko(){var e;try{if(typeof window=="undefined")return;let t=window;if(typeof((e=t.SentientSnippet)==null?void 0:e.goal)=="function")return;let n=()=>{};t.SentientSnippet={goal:n,componentGoal:n,grantConsent:n,revokeConsent:n,reapply:n,consentWatcher:Xe,getState:()=>({apiKey:"",persona:null,band:null,slots:{},matchCounts:{},consent:!1})},Ao.length=0}catch(t){}}function ks(){try{let e=window.Shopify;return typeof(e==null?void 0:e.shop)=="string"&&e.shop!==""}catch(e){return!1}}async function Do(){var e,t;try{let n=qt(window.sentient);if(!n){ko();return}Z=n,ct==null||ct(),ct=null,!n.consentFrom&&n.consent===void 0&&ks()&&(n.consentFrom="shopify"),Wr(n.consentSrc),Ut(n.nonce),un=!1,_e=!1,le=null,Qe=null,Se={},ve=null,wt(null),Et(null),Ue=!1,ce=!1,_t=null,De=null,Ae=[],et=null,tt=null,ye==null||ye(),ie==null||ie(),ie=null,At++,Ct=null;let r=ho("sentient_editor_code"),o=r?null:mo();if(r||o){ws(n,o,r),un=!0,Xn(n),Ne(n,"editor mode");return}if(typeof window!="undefined"&&/[?&]sentient_(preview|persona)=[^&]/.test(window.location.search)&&await Es(n))return;if(n.consentFrom&&n.consent===void 0)try{n.consent=Xe(n.consentFrom).read()===!0}catch(d){n.consent=!1}n.consent!==!1&&n.sectionCapture!==!1&&!Ye()&&lt("engagement.global.js","__sentientEngagement");let s=(e=n.registry)!=null?e:Object.keys(n.slots).length===0;n.registry===void 0&&!s&&Ne(n,"slots declared without registry: true, so dashboard-published components are not applied");let a=s?ys(n):null,l=hs();try{(t=l==null?void 0:l.stop)==null||t.call(l)}catch(d){}let i=n.consent!==!1&&!Ye()?ot(n.apiKey):null,c=[];i&&(H={persona:i.persona,band:i.band},Se=i.slots,i.slotConfig&&(ve=i.slotConfig),i.palette&&wt(i.palette),i.vocabulary&&Et(i.vocabulary),xt(document,U({contentAndOps:!1},l?{onAttr:(d,g)=>c.push([d,g])}:{})),i.layoutOrder&&(Qe=i.layoutOrder,Jn(Qe,document))),l&&ms(l,c,document);let u=yt(U({apiKey:n.apiKey,consent:n.consent,preConsentBehavior:n.preConsentBehavior,debug:n.debug,persona:n.persona,ingestUrl:Oo(n)},ln?{sdk:ln}:{}));k=u,cn=fe(n.apiKey),Xn(n),No();let p=Object.entries(n.slots).map(([d,g])=>({id:d,dims:g.dims})),h=_o,b={pp:l?l.v:0},w=[];if(a){let[d]=await Promise.all([So(a,yo),document.readyState==="loading"?new Promise(g=>document.addEventListener("DOMContentLoaded",g,{once:!0})):null]);De=d,d&&(Ae=w=Yn(d,document)[0]),Ne(n,"registry scope",d&&w)}let S=(d=u)=>{let g=Array.from(xo(document).keys());return d.decide(U(U(U(U({slots:p},h),b),g.length>=2?{sections:g}:{}),s?{slotsFrom:"registry",registrySlotIds:w,render:To(w,document)}:{}))},K=Ie(),L=u.gated===!0,D=!1,_=!1,A=!1,C=!1;le=(d=!1)=>{let g=k;!D||_||C||_e||ce||!g||g.gated||!d&&!A||(A=!1,C=!0,K=et=Ie(),De&&(Ae=w=Yn(De,document)[0]),S(g).then(I=>{C=!1,I&&!_e&&!ce&&k===g?v(I):(I||(Ae=[]),!_e&&(g.released||k!==g||ce)&&(A=!0))}).catch(()=>{C=!1}))};let P=S();P.then(()=>{D=!0},()=>{D=!0});let m=await So(P,yo),v=d=>{var M,q,J,Y,Ce;_=!0;let g=(k!=null?k:u).getPersona();g?H={persona:g.persona,band:g.band}:d.persona&&(H={persona:d.persona,band:"low"}),Se=d.slots,s?ve=Lo(d.slotConfig,w):d.slotConfig&&(ve=d.slotConfig),d.palette&&wt(d.palette),d.vocabulary&&Et(d.vocabulary),Qe=(M=d.layoutOrder)!=null?M:Qe;let I=()=>{let O=[],B=xt(document,{onApplied:(ne,ue,Q)=>O.push({slotId:ne,arm:ue,el:Q})});if(s||Ro(n,B),Jn(Qe,document),_e=!0,nt())try{oe==null||oe(),oe=rn(k,n.apiKey,O)}catch(ne){}};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",I,{once:!0}):I(),_t=(q=d.goals)!=null?q:null,(n.consent!==!1||Ue)&&!ce&&dn(d.goals,k),sn=(J=d.sectionMap)!=null?J:null,nt()&&Zn(),Ne(n,"applied",{persona:H,slots:Se,matches:an(n)}),!ce&&(Co(n.apiKey)&&He(n.apiKey,tt=U(U(U({v:1,persona:(Y=H==null?void 0:H.persona)!=null?Y:d.persona,band:(Ce=H==null?void 0:H.band)!=null?Ce:"low",slots:d.slots,layoutOrder:d.layoutOrder,savedAt:Date.now()},ve?{slotConfig:ve}:{}),d.palette?{palette:d.palette}:{}),d.vocabulary?{vocabulary:d.vocabulary}:{})),et=null,Po())};if(!m){Ne(n,"decide timeout/null \u2014 snapshot state stands",an(n)),P.then(d=>{if(!d){if(_e)return;Ae=[],u.released===!0||k!==u||ce||L&&Ie()!==K?(A=!0,le==null||le()):et=K;return}if(!(!d||_e||ce)){if(k!==u){A=!0,le==null||le();return}v(d),Ne(n,"late decide applied",an(n))}}).catch(()=>{});return}if(ce||k!==u){A=!0,le==null||le();return}v(m)}catch(n){ko()}}if(typeof window!="undefined"&&window.sentient){let e=window;if(!e.__sentientInitialized)e.__sentientInitialized=!0,Promise.resolve().then(()=>{Do()});else{let t=window.__sentientApi;t&&Promise.resolve().then(()=>{window.SentientSnippet=t})}}return Wo(_s);})();
1
+ "use strict";var SentientSnippet=(()=>{var Nt=Object.defineProperty,jo=Object.defineProperties,Go=Object.getOwnPropertyDescriptor,Fo=Object.getOwnPropertyDescriptors,Uo=Object.getOwnPropertyNames,cr=Object.getOwnPropertySymbols;var fr=Object.prototype.hasOwnProperty,zo=Object.prototype.propertyIsEnumerable;var dr=(e,t,n)=>t in e?Nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t)=>{for(var n in t||(t={}))fr.call(t,n)&&dr(e,n,t[n]);if(cr)for(var n of cr(t))zo.call(t,n)&&dr(e,n,t[n]);return e},Ke=(e,t)=>jo(e,Fo(t));var pr=(e,t)=>()=>(e&&(t=e(e=0)),t);var gr=(e,t)=>{for(var n in t)Nt(e,n,{get:t[n],enumerable:!0})},Wo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Uo(t))!fr.call(e,o)&&o!==n&&Nt(e,o,{get:()=>t[o],enumerable:!(r=Go(t,o))||r.enumerable});return e};var Vo=e=>Wo(Nt({},"__esModule",{value:!0}),e);var ei,ti,ni,Sr,ri,oi,br,F,qe,kn=pr(()=>{"use strict";ei=Object.defineProperty,ti=Object.defineProperties,ni=Object.getOwnPropertyDescriptors,Sr=Object.getOwnPropertySymbols,ri=Object.prototype.hasOwnProperty,oi=Object.prototype.propertyIsEnumerable,br=(e,t,n)=>t in e?ei(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,F=(e,t)=>{for(var n in t||(t={}))ri.call(t,n)&&br(e,n,t[n]);if(Sr)for(var n of Sr(t))oi.call(t,n)&&br(e,n,t[n]);return e},qe=(e,t)=>ti(e,ni(t))});var Tr={};gr(Tr,{LOCAL_ENGINE_AVAILABLE:()=>li,createLocalEngine:()=>ui});function ui(e){throw new Error("[sentient] createLocalEngine is not available in production builds. The local engine only exists under the `development` export condition.")}var li,Lr=pr(()=>{"use strict";li=!1});var As={};gr(As,{applyPersonaAttributes:()=>en,applyRegistrySlots:()=>rn,applySlotArms:()=>nn,applySlotAttributes:()=>tn,consentWatcher:()=>Xe,parseSnippetConfig:()=>Jt,planReorder:()=>sn,reapply:()=>It,run:()=>Mo,version:()=>_t});function ze(e){return e?`_${e.slice(0,12)}`:""}var We="_snt_uid";function gt(e){return`${We}${ze(e)}`}var bn="__sntForgetGen",Ho=()=>{try{return window[bn]}catch(e){return}};function Dt(e){var t,n;try{let r=window,o=(t=r[bn])!=null?t:r[bn]={};o[e]=((n=o[e])!=null?n:0)+1}catch(r){}}function fe(e){var t,n;return(n=(t=Ho())==null?void 0:t[e])!=null?n:0}var rt="_snt_snap:",qo=["low","medium","high"];function ot(e){try{let t=localStorage.getItem(rt+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"||!qo.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}catch(t){return null}}function He(e,t){try{localStorage.setItem(rt+e,JSON.stringify(t))}catch(n){}}function je(e){if(typeof AbortController!="function")return{clear:()=>{}};let t=new AbortController,n=setTimeout(()=>t.abort(),e);return{signal:t.signal,clear:()=>clearTimeout(n)}}function En(e,t){return new Promise(n=>{let r=setTimeout(()=>n(!1),t),o=()=>{clearTimeout(r),n(!0)};e.then(o,o)})}function Ve(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function Mt(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 mr(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 wn(e,t,n){try{let r=(()=>{try{let s=localStorage.getItem(n);if(!s)return[];let a=JSON.parse(s);return Array.isArray(a)?a:[]}catch(s){return[]}})(),o=new Map;for(let s of r)o.set(s.id,s);for(let s of e)o.set(s.id,s);localStorage.setItem(n,JSON.stringify([...o.values()].slice(-t)))}catch(r){}}function hr(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),s=r.filter(a=>!o.has(a.id));if(s.length===r.length)return;s.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(s))}catch(n){}}var Jo=500,Yo=56*1024;function Bt(e){return`_snt_retry_${e.slice(0,12)}`}var Xo={push:()=>{},flush:()=>{},destroy:()=>{}};function yr(e){var t,n,r;if(typeof window=="undefined")return Xo;let o=(t=e.flushIntervalMs)!=null?t:5e3,s=(n=e.maxBatchSize)!=null?n:20,a=(r=e.maxRetrySize)!=null?r:100,u=e.ingestUrl,i=e.apiKey,c=Bt(i),l=!1,p=fe(i),h=(...O)=>{!l&&fe(i)===p&&wn(...O)},b=[],w=new Set,S=[],K=O=>{for(let B of O)L.delete(B),!w.has(B)&&(w.add(B),S.push(B));for(;S.length>Jo;){let B=S.shift();B&&w.delete(B)}hr(O,c)},L=new Set,D=()=>{for(;b.length>a;){let O=b.shift();O&&L.delete(O.id)}},_=O=>{w.has(O.id)||L.has(O.id)||(L.add(O.id),b.push(O),D())},A=O=>{for(let B of O)w.has(B.id)||(L.add(B.id),b.push(B));D()},x=mr(c,a);for(let O of x)_(O);let P=0,m=0,v=(O,B=!0)=>{if(O.length===0)return;let ne=JSON.stringify(O),ue=O.map(Me=>Me.id),Q,we=je(15e3);try{Q=fetch(u,{method:"POST",keepalive:!0,signal:we.signal,body:ne,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`}})}catch(Me){h(O,a,c),A(O),m++,P=Date.now()+Ve(m);return}Promise.resolve(Q).then(we.clear,we.clear);let ee=Me=>{if(Mt(Me)!=="retry"){if(!Me.ok&&B){let Be=O.filter(Le=>Le.eventType!=="pageview");if(Be.length>0&&Be.length<O.length){K(O.filter(Le=>Le.eventType==="pageview").map(Le=>Le.id)),v(Be,!1);return}}K(ue),m=0,P=0;return}h(O,a,c),A(O),m++,P=Date.now()+Ve(m)};Q&&typeof Q.then=="function"?Q.then(ee).catch(()=>{h(O,a,c),A(O),m++,P=Date.now()+Ve(m)}):ee(Q)},d=typeof TextEncoder!="undefined"?new TextEncoder:null,g=O=>d?d.encode(O).length:O.length,I=O=>{let B=[],ne=2;for(let ue of O){let Q=g(JSON.stringify(ue))+1;if(B.length>0&&ne+Q>Yo||B.length>=s)break;B.push(ue),ne+=Q}return B},M=()=>{try{if(Date.now()<P)return;for(;b.length>0&&!(Date.now()<P);){let O=b.filter(ne=>!w.has(ne.id));if(b.length=0,O.length===0)break;let B=I(O);if(B.length===0)break;B.length<O.length&&b.push(...O.slice(B.length)),v(B)}}catch(O){}},q=!0,J=null;J=setInterval(()=>{q&&M()},o);let Y=()=>{document.visibilityState==="hidden"&&M()},xe=()=>{M()};return document.addEventListener("visibilitychange",Y),window.addEventListener("pagehide",xe),{push(O){_(O),b.length>=s&&M()},flush:M,destroy(O){O!=null&&O.forget&&(l=!0),q=!1,J!==null&&(clearInterval(J),J=null),document.removeEventListener("visibilitychange",Y),window.removeEventListener("pagehide",xe),M()}}}var Zo=200;function $t(e){return`_snt_goal_retry_${e.slice(0,12)}`}var Qo={send:()=>{},flush:()=>{},destroy:()=>{}};function vr(e){var t,n,r;if(typeof window=="undefined")return Qo;let o=(t=e.flushIntervalMs)!=null?t:5e3,s=(n=e.maxRetrySize)!=null?n:100,a=(r=e.maxPerFlush)!=null?r:5,u=$t(e.apiKey),i=!1,c=fe(e.apiKey),l=(...g)=>{!i&&fe(e.apiKey)===c&&wn(...g)},p=[],h=new Set,b=new Set,w=[],S=0,K=0,L=!1,D=g=>{for(h.delete(g.id),b.has(g.id)||(b.add(g.id),w.push(g.id));w.length>Zo;){let I=w.shift();I&&b.delete(I)}hr([g.id],u)},_=g=>{l([g],s,u),!b.has(g.id)&&!h.has(g.id)&&(h.add(g.id),p.push(g)),Date.now()>=S&&(K++,S=Date.now()+Ve(K))},A=g=>{let I,M=je(15e3);try{I=fetch(e.url,{method:"POST",keepalive:!0,signal:M.signal,body:g.body,headers:e.headers})}catch(J){_(g);return}let q=J=>{var Y;let xe=Mt(J);if(xe==="retry"){_(g);return}xe==="dropped"&&((Y=e.onDrop)==null||Y.call(e,g,J.status)),D(g),K=0,S=0};Promise.resolve(I).then(M.clear,M.clear),I&&typeof I.then=="function"?I.then(q).catch(()=>_(g)):q(I)},x=()=>{try{if(L||Date.now()<S)return;let g=0;for(;p.length>0&&g<a&&!(Date.now()<S);){let I=p.shift();h.delete(I.id),!b.has(I.id)&&(g++,A(I))}}catch(g){}},P=mr(u,s);for(let g of P)h.has(g.id)||(h.add(g.id),p.push(g));P.length>0&&wn(P,s,u);let m=setInterval(x,o),v=()=>{document.visibilityState==="hidden"&&x()},d=()=>x();return document.addEventListener("visibilitychange",v),window.addEventListener("pagehide",d),{send(g){if(L){b.has(g.id)||l([g],s,u);return}if(!(b.has(g.id)||h.has(g.id))){if(Date.now()<S){l([g],s,u),h.add(g.id),p.push(g);return}A(g)}},flush:x,destroy(g){g!=null&&g.forget&&(i=!0),clearInterval(m),document.removeEventListener("visibilitychange",v),window.removeEventListener("pagehide",d),x(),L=!0}}}function it(e){if(typeof window=="undefined"||!e)return!1;Dt(e);let t=!1,n=gt(e);try{if(new RegExp(`(?:^|; )${n}=`).test(document.cookie)){let a=location.protocol==="https:"?"; Secure":"";document.cookie=`${n}=; max-age=0; SameSite=lax; path=/${a}`,t=!0}}catch(a){}let r=ze(e),o=[n,"_snt_graph_edges",rt+e,Bt(e),$t(e),`_snt_graph_nodes${r}`],s=[`_snt_asgn${r}_`];for(let a of["localStorage","sessionStorage"])try{let u=window[a];for(let i of o)u.getItem(i)!==null&&(u.removeItem(i),t=!0);for(let i=u.length-1;i>=0;i--){let c=u.key(i);c&&s.some(l=>c.startsWith(l))&&(u.removeItem(c),t=!0)}}catch(u){}try{(new RegExp(`(?:^|; )${We}=[^;]`).test(document.cookie)||localStorage.getItem(We)!==null||sessionStorage.getItem(We)!==null)&&localStorage.setItem(`${We}_tomb${r}`,"1")}catch(a){}return t}kn();function Kt(e){return Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("|")}function wr(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 _n(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 Kt(e.baseline);if(typeof e.baseline=="string")return e.baseline;let o={};for(let[s,a]of Object.entries((n=e.dims)!=null?n:{}))o[s]=(r=a[0])!=null?r:"";return Kt(o)}function Er(e,t){var n,r;return e.dims!=null?(r=(n=wr(t))!=null?n:wr(_n(e)))!=null?r:{}:t}function Je(e){return e>=.3?e<.7?"medium":"high":"low"}var ii=["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 kr(e){return si(e)!==null}function si(e){var t;if(!e)return null;let n=e.toLowerCase();return(t=ii.find(r=>n.includes(r.toLowerCase())))!=null?t:null}function _r(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 Ar(e,t){if(!e)return"direct";try{let n=new URL(e);if(t)try{if(new URL(t).host===n.host)return"direct"}catch(o){}let r=n.hostname.toLowerCase();return/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(r)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(r)?"social":"referral"}catch(n){return"direct"}}function xr(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var ai=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function Cr(e){let t={},n={};try{let r=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([o,s])=>{let a=Array.isArray(s)?s[0]:s;return a===void 0?[]:[[o,a]]});for(let[o,s]of r)o.startsWith("utm_")?o in t||(t[o]=s):ai.includes(o)&&(o in n||(n[o]=s))}catch(r){}return{utmParams:t,clickIds:n}}function Or(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function An(e){return F(F(F({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 xn(e){let t=An(e);return Er(t,_n(t))}function Ir(e){return typeof e=="string"?e:Kt(e)}kn();var Pn;function zt(e){Pn=typeof e=="string"&&e!==""?e:void 0}function Mr(e=document){if(Pn)return Pn;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 Ge(e,t=document){let n=Mr(t);return n&&e.setAttribute("nonce",n),e}function Br(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch(e){}try{if(typeof crypto!="undefined"&&typeof crypto.getRandomValues=="function"){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,"0"),(n===3||n===5||n===7||n===9)&&(t+="-");return t}}catch(e){}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var Pr="_snt_uid",ci=365,st="_snt_uid";function di(){return Br()}function Cn(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function Dn(){try{return location.protocol==="https:"?"; Secure":""}catch(e){return""}}function fi(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=lax; path=/${Dn()}`}catch(r){}}function jt(e){try{return localStorage.getItem(e)}catch(t){return null}}function Rr(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function On(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function pi(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function gi(e){try{sessionStorage.removeItem(e)}catch(t){}}function mi(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=lax; path=/${Dn()}`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function hi(e){try{localStorage.removeItem(e)}catch(t){}}function yi(e){try{document.cookie=`${e}=; max-age=0; SameSite=lax; path=/${Dn()}`}catch(t){}}var vi={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function $r(e){var t,n,r,o,s,a,u;if(typeof window=="undefined")return vi;let i=ze(e==null?void 0:e.apiKey),c=(t=e==null?void 0:e.cookieName)!=null?t:gt(e==null?void 0:e.apiKey),l=`${st}${i}`,p=`${st}_tomb${i}`,h=((n=e==null?void 0:e.cookieTTLDays)!=null?n:ci)*24*60*60,b=A=>A&&A.length>0?A:null,w=()=>{var A,x;return i&&!(e!=null&&e.cookieName)&&jt(p)===null?(x=(A=b(Cn(Pr)))!=null?A:b(jt(st)))!=null?x:b(On(st)):null},S=(u=(a=(s=(o=(r=b(Cn(c)))!=null?r:b(jt(l)))!=null?o:b(On(l)))!=null?s:w())!=null?a:b(e==null?void 0:e.ssrSessionId))!=null?u:di();fi(c,S,h);let K=Rr(l,S),L=mi(c),D=K?!1:pi(l,S),_=!K&&!L&&!D;return{getSessionId:()=>S,isEphemeral:()=>_,destroy:()=>{S=null,yi(c),hi(l),gi(l),i&&!(e!=null&&e.cookieName)&&(Cn(Pr)!==null||jt(st)!==null||On(st)!==null)&&Rr(p,"1")}}}var Si=1800*1e3;function Gt(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function bi(e=Si,t){let n=new Map,r=`_snt_asgn${ze(t)}_`,o=(i,c)=>`${r}${encodeURIComponent(i)}:${encodeURIComponent(c)}`,s=i=>{let c=i.slice(r.length),l=c.indexOf(":");if(l<0)return null;try{return{componentId:decodeURIComponent(c.slice(0,l)),segment:decodeURIComponent(c.slice(l+1))}}catch(p){return null}},a=()=>{try{let i=[];for(let c=0;c<localStorage.length;c++){let l=localStorage.key(c);l!=null&&l.startsWith(r)&&i.push(l)}return i}catch(i){return[]}},u=i=>i.assignedAt+(i.ttlMs&&i.ttlMs>0?i.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let i of a())try{let c=localStorage.getItem(i);if(!c)continue;let l=JSON.parse(c);if(u(l)){localStorage.removeItem(i);continue}let p=s(i);if(!p)continue;n.set(Gt(p.componentId,p.segment),l)}catch(c){}})(),{get(i,c){let l=n.get(Gt(i,c));return l?u(l)?(n.delete(Gt(i,c)),null):l:null},set(i,c,l){let p=Gt(i,c);n.set(p,l);try{localStorage.setItem(o(i,c),JSON.stringify(l))}catch(h){}},clear(){n.clear();for(let i of a())try{localStorage.removeItem(i)}catch(c){}}}}var Rn="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",Kr="[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.",Nr=!1,Ft=!1;function wi(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function Ei(e){var t;let n=$r({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),r=(t=n.getSessionId())!=null?t:"local",o=wi(),s=Promise.resolve().then(()=>(Lr(),Tr)).then(l=>{let p=l;return p.LOCAL_ENGINE_AVAILABLE?(Nr||(Nr=!0,console.info(Kr)),p):(Ft||(Ft=!0,console.error(Rn)),null)}).catch(()=>(Ft||(Ft=!0,console.error(Rn)),null)),a=null,u={low:.15,medium:.5,high:.85},i=(()=>{var l;if(e.initialPersona)return F({},e.initialPersona);let p=ot(e.apiKey||"local");return p?{persona:p.persona,confidence:(l=u[p.band])!=null?l:.15}:null})();function c(l){let p=document.documentElement;p.dataset.sentientPersona===void 0&&(p.dataset.sentientPersona=l.persona,p.dataset.sentientConfidence=Je(l.confidence))}return{isLocal:!0,async decide(l){var p,h,b;let w=await s;if(!w)return null;let S=w.createLocalEngine({sessionId:r,forcedPersona:o}).decide(l);return a=qe(F({},S),{layoutOrder:(h=(p=S.layoutOrder)!=null?p:a==null?void 0:a.layoutOrder)!=null?h:null,slots:F(F({},(b=a==null?void 0:a.slots)!=null?b:{}),S.slots)}),He(e.apiKey||"local",{v:1,persona:a.persona,band:Je(a.confidence),slots:a.slots,layoutOrder:a.layoutOrder,savedAt:Date.now()}),c(S),S},getSlotResult(l){var p,h,b;return(b=(h=a==null?void 0:a.slots[l])!=null?h:(p=e.initialSlots)==null?void 0:p[l])!=null?b:null},getSlotConfig(l){var p,h;return(h=(p=e.initialSlotConfig)==null?void 0:p[l])!=null?h:null},getSitePalette(){var l;return(l=e.initialPalette)!=null?l:null},reportSlots(){},getPersona(){let l=a!=null?a:i;return l?{persona:l.persona,confidence:l.confidence,band:Je(l.confidence)}:null},async assign(l,p){var h;let b=await s;return!b||!p||p.length===0?p!=null&&p[0]?{variantId:p[0],assignmentTtlMs:0}:null:{variantId:(h=b.createLocalEngine({sessionId:r,forcedPersona:o}).decide({components:[{id:l,variantIds:p}]}).assignments[l])!=null?h:p[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>n.destroy()}}var Wt=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function In(e){let t=e.split(/[?#]/)[0]||"/";return t.length>1?t.replace(/\/+$/,"")||"/":t}function Mn(e,t){if(e===void 0||!Wt.test(e))return!1;if(e==="*")return!0;let n=In(t);if(e.endsWith("/*")){let r=In(e.slice(0,-2));return n.startsWith(r==="/"?"/":`${r}/`)&&n!==r}return n===In(e)}function ht(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(ht):!1}var Dr="sentient-reveal",at="sentient-revealed",jr=240,Tn=!1;function ki(e){if(Tn||e.getElementById(Dr)){Tn=!0;return}let t=Ge(e.createElement("style"),e);t.id=Dr,t.textContent=`@media (prefers-reduced-motion: no-preference){@keyframes ${at}{from{opacity:.55;transform:translateY(2px)}to{opacity:1;transform:none}}.${at}{animation:${at} ${jr}ms cubic-bezier(.2,.6,.2,1) both}}`,e.head.appendChild(t),Tn=!0}function Bn(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;ki(r),e.classList.remove(at),e.offsetWidth,e.classList.add(at);let o=()=>{e.classList.remove(at),e.removeEventListener("animationend",o)};return e.addEventListener("animationend",o),!0}function $n(e,t,n,r){let o=[];{let s=!1,a=[],u=()=>{if(s)return;let i=Date.now();for(a.push(i);a.length>0&&i-a[0]>500;)a.shift();a.length>=3&&(s=!0,e("rage_click"))};t.addEventListener("click",u),o.push(()=>t.removeEventListener("click",u))}{let s=!1,a=u=>{if(s||!(u.target instanceof Node)||!t.contains(u.target)&&t!==u.target)return;s=!0;let i=typeof window!="undefined"?window.getSelection():null,c=i?i.toString().length:0;e("text_copy",{selectionLength:c})};document.addEventListener("copy",a),o.push(()=>document.removeEventListener("copy",a))}{let s=!1,a=!1,u=null,i=()=>{u!==null&&(clearTimeout(u),u=null)},c=()=>{s||!a||(i(),u=setTimeout(()=>{!s&&a&&(s=!0,e("scroll_hesitation"))},3e3))},l=()=>{i(),c()},p=b=>{for(let w of b)a=w.intersectionRatio>.3,a?c():i()},h=new IntersectionObserver(p,{threshold:[.3]});h.observe(t),window.addEventListener("scroll",l,{passive:!0}),o.push(()=>{h.disconnect(),window.removeEventListener("scroll",l),i()})}if((r==null?void 0:r.tabLoss)!==!1){let s=!1,a=n!=null?n:Date.now(),u=()=>{if(s||document.visibilityState!=="hidden")return;let i=Date.now()-a;i<15e3&&(s=!0,e("tab_loss",{timeOnPage:i}))};document.addEventListener("visibilitychange",u),o.push(()=>document.removeEventListener("visibilitychange",u))}return()=>{for(let s of o)s()}}function _i(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var Gr="https://api.sentient-ui.com/v1/events",pe=new Map,Fr=null;function Ai(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var xi=3;function Ln(){return Br()}function Ut(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function Ci(){let e=new WeakMap,t=new Map,n=!1,r=(u,i,c)=>{let l=u.get(i);return c===null?l?!0:(u.set(i,new Set),!1):l?l.has(c)?!0:(l.add(c),!1):(u.set(i,new Set([c])),!1)},o=typeof window!="undefined"&&"event"in window,s=()=>{if(!o)return;let u=window.event;return typeof Event=="function"&&u instanceof Event?u:void 0},a=()=>{if(o){Promise.resolve().then(()=>{n=!1,t.clear()});return}let u=!1,i=()=>{u||(u=!0,n=!1,t.clear())};if(setTimeout(i,0),typeof MessageChannel=="function"){let c=new MessageChannel;c.port1.onmessage=()=>{c.port1.close(),c.port2.close(),i()},c.port2.postMessage(0)}};return{firedBefore(u,i){let c=s();if(c){let p=e.get(c);return p||(p=new Map,e.set(c,p)),r(p,u,i)}let l=r(t,u,i);return!l&&!n&&(n=!0,a()),l}}}var Ur=new Set;function Oi(e,t,n){let r=typeof window=="undefined"?null:window.history;if(!r)return()=>{};let o=!1,s,a=()=>{if(o)return;let c=Ut();!c||c===s||(s=c,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${c}`))},u=[];for(let c of["pushState","replaceState"]){let l=r[c],p=function(...h){let b=l.apply(this,h);return a(),b};r[c]=p,u.push([c,l,p])}window.addEventListener("popstate",a);let i=Ut();return i&&Ur.has(`${t}:${i}`)?s=i:a(),()=>{if(!o){o=!0,window.removeEventListener("popstate",a);for(let[c,l,p]of u)r[c]===p&&(r[c]=l)}}}var mt={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}};function Ii(){try{return Cr(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function zr(e){return e.replace(/\/events\/?$/,"")}function Ye(){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 Kn(e){var t;if(typeof window=="undefined")return;let n=e!=null?e:Fr;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:s,reinit:a}=r;if(!s){r.upgradeBlockedReason&&console.warn(r.upgradeBlockedReason);return}if(o.respectDoNotTrack!==!1&&Ye())return;let u=(a!=null?a:yt)(qe(F({},o),{consent:!0}));s(u);let i=(t=pe.get(n))==null?void 0:t.dispose;pe.set(n,{config:qe(F({},o),{consent:!0}),upgrade:null,dispose:i})}function Ti(e,t){var n;let r=e.preConsentBehavior==="statistical_winner",o=zr((n=e.ingestUrl)!=null?n:Gr),s={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},a=new Map,u=new Map,i={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(m,v,d){if(!r)return Promise.resolve(null);let g=a.get(m);return g?Promise.resolve(g):Nn(u,m,async()=>{try{let I=new URLSearchParams({componentId:m});for(let Y of v!=null?v:[])I.append("variantIds[]",Y);let M=je(5e3),q;try{let Y=await fetch(`${o}/winner?${I.toString()}`,{headers:s,signal:M.signal});if(!Y.ok)return v!=null&&v[0]?{variantId:v[0],assignmentTtlMs:0}:null;q=await Y.json()}finally{M.clear()}let J={variantId:q.variantId,assignmentTtlMs:0};return a.set(m,J),J}catch(I){return v!=null&&v[0]?{variantId:v[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}},c=!1,l=new Set,p=[],h=[],b=[],w=()=>{for(let[,,m]of b.splice(0))m(null);S.length=0},S=[],K=!1,L=()=>{if(c)return;K=!0;let m=pe.get(e.apiKey);(m==null?void 0:m.upgrade)===P&&pe.set(e.apiKey,{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): client released before consent; call init() again"})},D=[],_=()=>{setTimeout(()=>{var m;try{(m=D.shift())==null||m(i)}catch(v){}D.length&&_()})},A=m=>{c?D.length?D.push(m):m(i):!t&&!K&&S.length<100?S.push(m):K&&e.debug&&console.warn("[sentient] goal dropped: client released")},x={get gated(){return!c&&!t},get released(){return K&&!c},takeHeld:()=>S.splice(0),track:m=>i.track(m),goal:((m,v,d,g)=>A(I=>I.goal(m,v,d,g))),componentGoal:(m,v,d)=>i.componentGoal(m,v,d),identify:m=>i.identify(m),getAssignment:(m,v)=>i.getAssignment(m,v),assign:(m,v,d,g)=>i.assign(m,v,d,g),decide:m=>c?i.decide(m):K||t?Promise.resolve(null):new Promise(v=>b.push([m,Ie(),v])),getSlotResult:m=>i.getSlotResult(m),isSlotDecided:m=>{var v,d;return(d=(v=i.isSlotDecided)==null?void 0:v.call(i,m))!=null?d:!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,d,g)=>i.reportSlots(m,v,d,g),reportSkeleton:(m,v)=>{var d;return(d=i.reportSkeleton)==null?void 0:d.call(i,m,v)},reportDrift:(m,v,d,g)=>{var I;return(I=i.reportDrift)==null?void 0:I.call(i,m,v,d,g)},requestSlots:(m,v,d)=>{var g;return c?(g=i.requestSlots)==null?void 0:g.call(i,m,v,d):p.push([m,v,d])},decideSlots:m=>{var v;return c?(v=i.decideSlots)==null?void 0:v.call(i,m):h.push(...m)},cancelSlots:m=>{var v;if(c)return(v=i.cancelSlots)==null?void 0:v.call(i,m);let d=new Set(m);for(let g of p)g[0]=g[0].filter(I=>!d.has(I));h=h.filter(g=>!d.has(g.id))},onSlotsChanged:m=>(l.add(m),()=>{l.delete(m)}),getPersona:()=>i.getPersona(),fetchWeights:()=>i.fetchWeights(),getGraph:()=>i.getGraph(),flush:()=>i.flush(),dispose:()=>(L(),w(),i.dispose()),destroy:()=>(L(),w(),c?i.destroy():it(e.apiKey))};function P(m){var v,d,g;i=m,c=!0,S.length&&(D.push(...S.splice(0)),_());let I=Ie();for(let[M,q,J]of b.splice(0))q!==I?J(null):m.decide(M).then(J,()=>J(null));(v=m.onSlotsChanged)==null||v.call(m,()=>l.forEach(M=>M()));for(let[M,q,J]of p.splice(0))M.length>0&&((d=m.requestSlots)==null||d.call(m,M,q,J));h.length>0&&((g=m.decideSlots)==null||g.call(m,h.splice(0)))}return{proxy:x,setInner:P}}function Ie(){return typeof location=="undefined"?"":location.pathname+(/^#!?\//.test(location.hash)?location.hash:"")}function Nn(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 yt(e){var t,n,r,o,s,a,u,i,c,l;if(typeof window=="undefined")return mt;e.nonce&&zt(e.nonce),Fr=e.apiKey||"local";let p=pe.get(e.apiKey||"local");if(p!=null&&p.dispose)try{p.dispose()}catch(f){}let h=e.respectDoNotTrack!==!1&&Ye(),b=e.consent===!1||h,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."}),b?mt:Ei(e);if(b){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."}),mt;let{proxy:f,setInner:y}=Ti(e,h);return pe.set(e.apiKey,{config:e,upgrade:h?null:y}),f}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."),mt;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),mt;let S=(t=e.ingestUrl)!=null?t:Gr,K=Date.now(),L=$r({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),D=bi(void 0,e.apiKey),_=!1,A=fe(e.apiKey),x=()=>!_&&fe(e.apiKey)===A,P=qe(F({},D),{set:(...f)=>{x()&&D.set(...f)}}),m=yr({ingestUrl:S,apiKey:e.apiKey}),v=zr(S),d={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},g=new Set,I=vr({url:`${v}/goals`,apiKey:e.apiKey,headers:d,onDrop:(f,y)=>{if(!e.debug){if(g.has(y))return;g.add(y)}console.warn(`[sentient] goal dropped (HTTP ${y}) \u2014 this will not be retried. `+(y===400?"The session was not found: call init() and let the session upsert complete before firing goals.":y===401||y===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),f)}}),M=_r((n=navigator.userAgent)!=null?n:""),q=window.location.origin,J=Ar((r=document.referrer)!=null?r:"",q),Y=(o=e.sessionSegment)!=null?o:`${M}:${J}`,xe=new Map,O=new Map,B=new Map,ne=new Set,ue=new Map,Q=null,we=null,ee=null,Me=new Set,Be=new Set,Le=new Map,gn=new Map,er=new Set,tr=new Set,nr=new Set,mn=null,Tt=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,rr=new Set,Lt=new Set,Pt=new Set,dt=new Map,hn=null,Rt=new Set,ft=new Map,yn=null,Bo=2,or=new Map,Ee=!1,ir=(f,y,N)=>{var z;let j=new Set,E=1;for(let C of f){y.delete(C);let T=((z=or.get(C))!=null?z:0)+1;or.set(C,T),T<=Bo&&(j.add(C),T>E&&(E=T))}j.size>0&&setTimeout(()=>{Ee||N(j)},Ve(E))},vn=f=>{for(let y of f)B.has(y.id)||B.set(y.id,xn(y))};if(e.initialSlots)for(let[f,y]of Object.entries(e.initialSlots))B.set(f,y),ne.add(f);if(e.initialSlotConfig)for(let[f,y]of Object.entries(e.initialSlotConfig))ue.set(f,y);e.initialPalette&&(Q=e.initialPalette),e.initialVocabulary&&(we=e.initialVocabulary);let Ce=ot(e.apiKey);if(Ce){for(let[f,y]of Object.entries(Ce.slots))B.has(f)||B.set(f,y);for(let[f,y]of Object.entries((s=Ce.slotConfig)!=null?s:{}))ue.has(f)||ue.set(f,y);!Q&&Ce.palette&&(Q=Ce.palette),!we&&Ce.vocabulary&&(we=Ce.vocabulary)}let sr={low:.15,medium:.5,high:.85};if(e.initialPersona)ee=F({},e.initialPersona);else{let f=document.documentElement.dataset;f.sentientPersona?ee={persona:f.sentientPersona,confidence:(u=sr[(a=f.sentientConfidence)!=null?a:"low"])!=null?u:.15}:Ce&&(ee={persona:Ce.persona,confidence:(i=sr[Ce.band])!=null?i:.15})}if(e.initialAssignments)for(let[f,y]of Object.entries(e.initialAssignments))P.set(f,Y,{variantId:y,assignedAt:Date.now(),segment:Y,confidence:1});let $e=Promise.resolve(),ar=L.getSessionId();if(ar){let f=xr((c=document.referrer)!=null?c:""),{utmParams:y,clickIds:N}=Ii(),z=F(F(F(F({sessionId:ar,deviceClass:M,trafficSource:J,referrerDomain:f,utmParams:y,clickIds:N,timeOfDay:Or(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:L.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||kr((l=navigator.userAgent)!=null?l:"")},e.userId?{userId:e.userId}:{}),e.persona?{persona:e.persona}:{}),e.country?{country:e.country}:{}),e.sdk?{sdk:e.sdk.name,sdkVersion:e.sdk.version}:{}),j=async()=>{for(let E=0;;E++){if(Ee||!x())return;let C=je(5e3);try{let T=await fetch(`${v}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(z),headers:d,signal:C.signal});if(T.status===402){console.warn("[SentientUI] Session limit exceeded for this project. The bandit will stop learning until the limit resets. Upgrade at sentient-ui.com/pricing");return}if(T.ok||Mt(T)==="dropped")return}catch(T){}finally{C.clear()}if(E>=xi){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(T=>setTimeout(T,Ve(E+1)))}};try{$e=j()}catch(E){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:m});let $o=Ci(),pt=null,Sn=!1,se={goal(f,y={},N=1,z=0){var j,E,C,T,V,G,te;let re=L.getSessionId();if(!re||Ee||!x())return;let W=Ai(y)?y:{metadata:y},ge=[f,(j=W.externalId)!=null?j:"",(E=W.stepIndex)!=null?E:z,(C=W.weight)!=null?C:N].join("\0"),ke=W.value!==void 0?`${W.value}\0${(T=W.currency)!=null?T:""}`:null;if($o.firedBefore(ge,ke)){e.debug&&console.log(`[sentient] goal("${f}") already recorded for this action \u2014 not sent twice`);return}let de=Ln(),ae={sessionId:re,name:f,metadata:(V=W.metadata)!=null?V:{},weight:(G=W.weight)!=null?G:N,stepIndex:(te=W.stepIndex)!=null?te:z,goalId:de,value:W.value,currency:W.currency,externalId:W.externalId};e.debug&&console.log("[sentient] goal",ae);let $={id:de,body:JSON.stringify(ae)};$e.then(()=>I.send($))},componentGoal(f,y,N){var z,j,E;let C=L.getSessionId();if(!C||Ee||!x())return;let T=P.get(f,Y),V=T?null:(z=B.get(f))!=null?z:null;if(!T&&V===null){e.debug&&console.warn(`[sentient] componentGoal("${f}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}if(!T&&!ne.has(f)){e.debug&&console.warn(`[sentient] componentGoal("${f}"): slot not decided this session \u2014 not attributed`);return}let G=T?T.variantId:Ir(V),te={id:Ln(),sessionId:C,projectId:e.apiKey,componentId:f,variantId:G,eventType:"goal_achieved",goalType:y,payload:F({reward:(j=N==null?void 0:N.reward)!=null?j:1,goalValue:N==null?void 0:N.value,currency:N==null?void 0:N.currency},(E=N==null?void 0:N.metadata)!=null?E:{}),timestamp:Date.now(),timeInSession:Date.now()-K,path:Ut()};e.debug&&console.log("[sentient] componentGoal",te),$e.then(()=>{!Ee&&x()&&m.push(te)})},identify(f){let y=L.getSessionId();!y||Ee||!x()||$e.then(()=>{fetch(`${v}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:y,userId:f,ephemeral:L.isEphemeral()}),headers:d}).catch(()=>{})})},track(f){let y=L.getSessionId();if(!y||Ee||!x()||f.eventType==="variant_assigned"&&B.get(f.componentId)!==void 0&&!ne.has(f.componentId)&&!P.get(f.componentId,Y))return;let N=qe(F({path:Ut()},f),{id:Ln(),sessionId:y,timestamp:Date.now(),timeInSession:Date.now()-K});e.debug&&console.log("[sentient] track",N),$e.then(()=>m.push(N))},getAssignment(f,y){return P.get(f,y)},async assign(f,y,N,z){let j=L.getSessionId();if(!j)return null;let E=P.get(f,Y);if(E&&(y!=null&&y.length||E.content!==void 0)){let C=E.ttlMs&&E.ttlMs>0?Math.max(0,E.assignedAt+E.ttlMs-Date.now()):0;return{variantId:E.variantId,assignmentTtlMs:C,content:E.content}}return Nn(xe,f,async()=>{if(!await En($e,2500)||Ee||!x())return null;let C=je(3e4);try{let T={sessionId:j,componentId:f,variantIds:y};z!==void 0?T.agentDataByVariant=z:N!==void 0&&(T.agentData=N);let V=await fetch(`${v}/assign`,{method:"POST",body:JSON.stringify(T),headers:d,signal:C.signal});if(!V.ok)return null;let G=await V.json();return P.set(f,Y,F({variantId:G.variantId,assignedAt:Date.now(),segment:Y,confidence:1,content:G.content},G.assignmentTtlMs&&G.assignmentTtlMs>0?{ttlMs:G.assignmentTtlMs}:{})),G}catch(T){return null}finally{C.clear()}})},async decide(f){var y,N;let z=L.getSessionId();if(!z)return null;let j=(y=f.slots)!=null?y:[],E={sessionId:z};f.sections&&f.sections.length>0&&(E.sections=f.sections.map(T=>({id:T}))),E.components=(N=f.components)!=null?N:[],j.length>0&&(E.slots=j.map(An)),f.slotsFrom==="registry"&&(E.slotsFrom="registry",f.registrySlotIds&&(E.registrySlotIds=f.registrySlotIds),f.bootstrap===!1&&(E.bootstrap=!1),f.render&&Object.keys(f.render).length>0&&(E.render=f.render)),f.v&&(E.v=f.v),typeof f.pp=="number"&&(E.pp=f.pp),e.persona&&(E.persona=e.persona);let C=JSON.stringify(E);return Nn(O,C,async()=>{var T,V,G,te,re,W,ge,ke;if(!await En($e,2500)||Ee||!x())return vn(j),null;let de=je(3e4);try{let ae=await fetch(`${v}/decide`,{method:"POST",body:C,headers:d,signal:de.signal});if(!ae.ok)return vn(j),null;let $=await ae.json(),me={};for(let X of j){let Oe=(T=$.slots)==null?void 0:T[X.id];if(Oe!==void 0){me[X.id]=Oe,B.set(X.id,Oe),ne.add(X.id);continue}let lr=B.get(X.id);if(lr!==void 0)me[X.id]=lr;else{let ur=xn(X);me[X.id]=ur,B.set(X.id,ur)}}if($.slots)for(let[X,Oe]of Object.entries($.slots))X in me||(me[X]=Oe,B.set(X,Oe),ne.add(X));let Ko=ee!=null&&ee.persona!=="unknown";$.persona&&!($.persona==="unknown"&&Ko)?ee={persona:$.persona,confidence:(V=$.confidence)!=null?V:0}:ee||(ee={persona:"unknown",confidence:0});for(let[X,Oe]of Object.entries((G=$.assignments)!=null?G:{}))P.set(X,Y,{variantId:Oe,assignedAt:Date.now(),segment:Y,confidence:1});if($.slotConfig)for(let[X,Oe]of Object.entries($.slotConfig))ue.set(X,Oe);$.palette&&(Q=$.palette),$.vocabulary&&(we=$.vocabulary);for(let X of(te=f.registrySlotIds)!=null?te:[])(re=$.slotConfig)!=null&&re[X]||(ue.delete(X),B.delete(X),ne.delete(X));return x()&&He(e.apiKey,F(F(F({v:1,persona:ee.persona,band:Je(ee.confidence),slots:Object.fromEntries(B),layoutOrder:(W=$.layoutOrder)!=null?W:null,savedAt:Date.now()},ue.size>0?{slotConfig:Object.fromEntries(ue)}:{}),Q?{palette:Q}:{}),we?{vocabulary:we}:{})),F(F(F(F(F({layoutOrder:(ge=$.layoutOrder)!=null?ge:null,assignments:(ke=$.assignments)!=null?ke:{},slots:me,persona:ee.persona,confidence:ee.confidence},$.slotConfig?{slotConfig:$.slotConfig}:{}),$.goals?{goals:$.goals}:{}),$.sectionMap?{sectionMap:$.sectionMap}:{}),$.palette?{palette:$.palette}:{}),$.vocabulary?{vocabulary:$.vocabulary}:{})}catch(ae){return vn(j),null}finally{de.clear()}})},getSlotResult(f){var y;return(y=B.get(f))!=null?y:null},isSlotDecided(f){return ne.has(f)},getSlotConfig(f){var y;return(y=ue.get(f))!=null?y:null},reportSlots(f,y,N,z){var j;let E={};for(let[C,T]of Object.entries(z!=null?z:{}))for(let V of T){let G=`${C}|${V.key}`;!Tt.test(C)||nr.has(G)||(nr.add(G),((j=E[C])!=null?j:E[C]=[]).push(V))}Object.keys(E).length>0&&fetch(`${v}/slots/observed`,{method:"POST",headers:d,body:JSON.stringify({slotIds:Object.keys(E),authoredArms:E})}).catch(()=>{});for(let C of f)if(!(typeof C!="string"||C.length===0)){if(!Tt.test(C)){_i()&&!rr.has(C)&&(rr.add(C),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(C)} 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(!Me.has(C)){Me.add(C),Be.add(C);let T=y==null?void 0:y[C];if(typeof T=="string"){let G=T.replace(/\s+/g," ").trim().slice(0,400);G!==""&&Le.set(C,G)}let V=N==null?void 0:N[C];V!==void 0&&gn.set(C,V)}}Be.size===0||mn!=null||(mn=setTimeout(()=>{mn=null;let C=[...Be];Be.clear();for(let T=0;T<C.length;T+=20){let V=C.slice(T,T+20),G={},te={};for(let re of V){let W=Le.get(re);W!==void 0&&(G[re]=W,Le.delete(re));let ge=gn.get(re);ge!==void 0&&(te[re]=ge,gn.delete(re))}fetch(`${v}/slots/observed`,{method:"POST",headers:d,body:JSON.stringify(F(qe(F(F({slotIds:V},Object.keys(G).length>0?{baselineTexts:G}:{}),Object.keys(te).length>0?{baselineSkeletons:te}:{}),{pagePaths:Object.fromEntries(V.map(re=>[re,location.pathname]))}),Object.keys(G).length>0&&L.getSessionId()?{sessionId:L.getSessionId()}:{}))}).catch(()=>{})}},1e3))},reportSkeleton(f,y){!Tt.test(f)||er.has(f)||(er.add(f),fetch(`${v}/slots/observed`,{method:"POST",headers:d,body:JSON.stringify({slotIds:[f],baselineSkeletons:{[f]:y}})}).catch(()=>{}))},reportDrift(f,y,N,z){let j=`${f}|${y}`,E=L.getSessionId();!E||tr.has(j)||(tr.add(j),fetch(`${v}/slots/drift`,{method:"POST",headers:d,body:JSON.stringify({sessionId:E,reports:[{slotId:f,expectedFp:y,observedFp:N,reason:z}]})}).catch(()=>{}))},requestSlots(f,y,N){var z,j;for(let E of f)Pt.has(E)||(Pt.add(E),Tt.test(E)?dt.set(E,{text:y==null?void 0:y[E],render:(z=N==null?void 0:N.render)==null?void 0:z[E],skeleton:(j=N==null?void 0:N.skeletons)==null?void 0:j[E]}):se.reportSlots([E]));dt.size===0||hn!=null||(hn=setTimeout(()=>{hn=null;let E=[...dt];dt.clear();for(let C=0;C<E.length;C+=50){let T=E.slice(C,C+50),V={};for(let[G,te]of T)te.render&&(V[G]=te.render);se.decide({slotsFrom:"registry",registrySlotIds:T.map(([G])=>G),bootstrap:!1,render:V}).then(G=>{var te,re;if(G){let W={},ge={},ke=[];for(let[de,ae]of T){let $=(te=G.slotConfig)==null?void 0:te[de];if($){$.needsSkeleton&&ae.skeleton&&((re=se.reportSkeleton)==null||re.call(se,de,ae.skeleton));continue}ke.push(de),ae.text&&(W[de]=ae.text),ae.skeleton&&(ge[de]=ae.skeleton)}ke.length>0&&se.reportSlots(ke,W,ge)}else ir(T.map(([W])=>W),Pt,W=>{var ge;let ke={},de={},ae={};for(let[$,me]of T)W.has($)&&(me.text&&(ke[$]=me.text),me.render&&(de[$]=me.render),me.skeleton&&(ae[$]=me.skeleton));(ge=se.requestSlots)==null||ge.call(se,[...W],ke,{render:de,skeletons:ae})});Lt.forEach(W=>W())})}},0))},decideSlots(f){for(let y of f)Rt.has(y.id)||(Rt.add(y.id),ft.set(y.id,y));ft.size===0||yn!=null||(yn=setTimeout(()=>{yn=null;let y=[...ft.values()];ft.clear();for(let N=0;N<y.length;N+=30){let z=y.slice(N,N+30);se.decide({slots:z}).then(j=>{j||ir(z.map(E=>E.id),Rt,E=>{var C;return(C=se.decideSlots)==null?void 0:C.call(se,z.filter(T=>E.has(T.id)))}),Lt.forEach(E=>E())})}},0))},cancelSlots(f){for(let y of f)dt.delete(y)&&Pt.delete(y),ft.delete(y)&&Rt.delete(y)},onSlotsChanged(f){return Lt.add(f),()=>{Lt.delete(f)}},getStyleVocabulary(){return we},getSitePalette(){return Q},getPersona(){return ee?{persona:ee.persona,confidence:ee.confidence,band:Je(ee.confidence)}:null},async fetchWeights(){var f;let y=je(5e3);try{let N=await fetch(`${v}/weights`,{headers:d,signal:y.signal});return N.ok?(f=(await N.json()).components)!=null?f:[]:[]}catch(N){return[]}finally{y.clear()}},getGraph(){return{pageNodes:[],capturedAt:0}},flush(){m.flush(),I.flush()},dispose(){var f;pt==null||pt(),Sn=!0,Ee=!0,m.destroy(),I.destroy(),((f=pe.get(e.apiKey))==null?void 0:f.dispose)===se.dispose&&pe.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var f;pt==null||pt(),Sn=!0,Ee=!0,_=!0,Dt(e.apiKey),m.destroy({forget:!0}),I.destroy({forget:!0}),L.destroy(),P.clear(),((f=pe.get(e.apiKey))==null?void 0:f.dispose)===se.dispose&&pe.delete(e.apiKey);try{localStorage.removeItem(rt+e.apiKey),localStorage.removeItem(Bt(e.apiKey)),localStorage.removeItem($t(e.apiKey)),localStorage.removeItem(`_snt_graph_nodes${ze(e.apiKey)}`),localStorage.removeItem("_snt_graph_edges")}catch(y){}e.debug&&console.log("[sentient] destroyed")}};if(pe.set(e.apiKey,{config:e,upgrade:null,dispose:se.dispose}),pt=Oi(se,e.apiKey,f=>{$e.then(()=>{Sn||Ur.add(f)})}),e.debug){let f=window;f.__sentient&&(f.__sentient.client=se)}return se}var jn=/(^|\/)snippet(\.global)?(\.min)?\.js(\?|$)/,Li=(()=>{var e,t;try{return(t=(e=document.currentScript)==null?void 0:e.src)!=null?t:""}catch(n){return""}})(),Pi=/@\d+\.\d+\.\d+[^/]*\//;function Gn(e){var t;try{let n=Li||((t=Array.from(document.getElementsByTagName("script")).find(r=>jn.test(r.src)))==null?void 0:t.src);for(let r of n?[n]:[]){let o=jn.test(r)?r.replace(jn,`$1${e}$4`):r.replace(/[^/?#]*([?#].*)?$/,e),s=(e==="consent.global.js"?"sha384-+7/RqBOFLU5bMaQ6bcBAWzG589skmxN8tedG9hkoQQ6HaQkRRBJfoRVD94e/fJcM":e==="editor.global.js"?"sha384-TckbrdbT10XeIIknnJGyNuvRCArZtV5v2YteLh4WT5zWo3JQjOq40eLvQzasjQdl":e==="preview.global.js"?"sha384-vdxAPgchJj9TyoCfgD43y1powSvyp9HFnq+1YircrnoQ8LsCBH/RCei+cQHMjZ+r":"sha384-CU+t8gO/N2Dn7Y2o/b8yCMluhAX4D4sHp6d44eYOOC7780TATanFSAECAjSxzInC")||"";return Pi.test(o)&&s.indexOf("sha384-")===0?{src:o,integrity:s}:{src:o}}}catch(n){}return null}var Vt=new Map;function lt(e,t,n){let r=window[t];if(r)return Promise.resolve(r);let o=Vt.get(e);return o||(o=new Promise(s=>{var i;let a=n?{src:n}:Gn(e);if(!a)return s(null);let u=Ge(document.createElement("script"));Fn(u,a),u.async=!0,u.onload=()=>{var l;let c=(l=window[t])!=null?l:null;c||Vt.delete(e),s(c)},u.onerror=()=>{Vt.delete(e),s(null)},((i=document.head)!=null?i:document.documentElement).appendChild(u)}),Vt.set(e,o)),o}function Fn(e,t){t.integrity&&(e.integrity=t.integrity,e.crossOrigin="anonymous"),e.src=t.src}var Wr="__sentientConsent",Pe=null,Un=!1,Ht=new Set,zn=()=>{let e=window[Wr];return typeof(e==null?void 0:e.consentWatcher)=="function"?e.consentWatcher:null},vt;function Vr(e){vt=e}function Ri(){Pe||(Pe=zn())||Un||(Un=!0,lt("consent.global.js",Wr,vt).then(e=>{if(Un=!1,!e)return Ni(vt!=null?vt:"consent.global.js");if(Pe=zn(),Pe)for(let t of Array.from(Ht))t()}))}function Ni(e){console.warn(`[sentient] could not load ${e} \u2014 tracking stays off. Set window.sentient.consentSrc to its URL.`)}function Xe(e){Ri();let t=null,n=()=>(!t&&(Pe!=null?Pe:Pe=zn())&&(t=Pe(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,s=!1,a=()=>{Ht.delete(a);let u=n();s||!u||(o=u.subscribe(r),r())};return n()?(o=t.subscribe(r),Promise.resolve().then(()=>{s||r()})):Ht.add(a),()=>{s=!0,Ht.delete(a),o==null||o()}}}}function Di(e){return e.replace(/\s+/g," ").trim().slice(0,300)}function Hr(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 Mi(e){let t=e.join("");return Hr(t,2166136261)+Hr(t,1523705862)}var Bi=new Set(["A","BUTTON"]),$i=/^H([1-6])$/,Ki=new Set(["P","LI","LABEL","BLOCKQUOTE","FIGCAPTION","DT","DD","TD","TH"]);var ji=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"]);function Gi(e){return Bi.has(e.tagName)||e.getAttribute("role")==="button"?!0:e.tagName==="INPUT"&&/^(submit|button)$/i.test(e.type)}function Fi(e){if($i.test(e.tagName)||Ki.has(e.tagName))return!0;let t=e.ownerDocument.defaultView,n=t?t.getComputedStyle(e).display:"";return n!==""&&n!=="inline"&&n!=="contents"}function Ui(e,t){let n=null;for(let r=e.parentElement;r&&r!==t.parentElement;r=r.parentElement){if(Gi(r)){n=r;break}if(r===t)break}if(n)return n;for(let r=e.parentElement;r;r=r.parentElement)if(r===t||Fi(r))return r;return t}function qt(e,t=40){var n,r,o;let s=e.ownerDocument.createTreeWalker(e,4),a=[];for(let l=s.nextNode();l;l=s.nextNode())if(((n=l.nodeValue)!=null?n:"").trim()!==""&&!ji.has((o=(r=l.parentElement)==null?void 0:r.tagName)!=null?o:"")&&(a.push(l),a.length>120))return{reason:"too_large"};if(a.length===0)return{reason:"empty"};let u=[],i=[];for(let l of a){let p=Ui(l,e),h=u.indexOf(p);h===-1&&(u.push(p),h=u.length-1),i.push(h)}if(u.length>t)return{reason:"too_large"};let c=a.map(l=>{var p;return Di((p=l.nodeValue)!=null?p:"")});return{textNodes:a,ownerEls:u,leafToNode:i,leaves:c,fp:Mi(c)}}var qr=["cookiebot","onetrust","cookieyes","tcf","google-consent-mode","shopify"];function zi(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(s=>typeof s=="string")||/[=|]/.test(r)||o.some(s=>/[=|]/.test(s)))return null;n[r]=o}return n}function Wi(e){return!Array.isArray(e)||e.length<2||e.length>12||!e.every(t=>typeof t=="string")?null:e}function Vi(e){try{return e()}catch(t){return}}function Jt(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[u,i]of Object.entries(t.slots)){if(typeof i!="object"||i===null)continue;let c=i,l=zi(c.dims);if(!l||c.target!==void 0&&typeof c.target!="string")continue;let p=c.arms!==void 0?Wi(c.arms):null,h={dims:l};typeof c.target=="string"&&(h.target=c.target),p&&(h.arms=p),n[u]=h}let r={apiKey:t.apiKey,personaAttributes:t.personaAttributes===!0,slots:n};typeof t.consent=="boolean"?r.consent=t.consent:t.consent!==void 0&&s("consent");let o=t.consentFrom;if(typeof o=="string"&&qr.includes(o))r.consentFrom=o;else if(o&&typeof o=="object"&&!Array.isArray(o)){let u=o;typeof u.cmp=="string"&&qr.includes(u.cmp)||u.cmp===void 0&&(typeof u.cookie=="string"||typeof u.check=="function")?r.consentFrom=u:s("consentFrom")}else o!==void 0&&s("consentFrom");function s(u){r.consent=!1,console.warn(`[sentient] invalid ${u} \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),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 a=typeof t.persona=="function"?Vi(t.persona):t.persona;if(typeof a=="string"&&a.trim()!==""&&(r.persona=a),Array.isArray(t.sections)){let u=t.sections.filter(i=>typeof i=="string"&&i.trim()!=="").slice(0,50);u.length>=2&&(r.sections=u)}return r}var Jr=new WeakMap;function Yr(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Xr(e,t,n){var s,a,u;let r=Jr.get(e);if(r){if(r.fp!==n.fp||!Yr(r.leafToNode,n.leafToNode))return"mismatch"}else{let i=qt(e);if(!("fp"in i)||(r={fp:i.fp,leafToNode:i.leafToNode,textNodes:i.textNodes,ownerEls:i.ownerEls,classes:i.ownerEls.map(c=>{var l;return(l=c.getAttribute("class"))!=null?l:""})},r.fp!==n.fp||!Yr(r.leafToNode,n.leafToNode)))return"mismatch";Jr.set(e,r)}let o=r;for(let[i,c]of Object.entries(t.nodes)){let l=Number(i),p=o.ownerEls[l];if(p){if(typeof c.text=="string"){let h=!0;o.leafToNode.forEach((b,w)=>{b===l&&(o.textNodes[w].nodeValue=h?c.text:"",h=!1)})}c.like!==void 0&&o.classes[c.like]!==void 0&&p.setAttribute("class",o.classes[c.like]),c.hidden&&((s=p.style)==null||s.setProperty("display","none","important"))}}for(let i of Object.values((a=t.order)!=null?a:{})){let c=i.map(w=>o.ownerEls[w]).filter(w=>!!w),l=(u=c[0])==null?void 0:u.parentElement;if(!l||c.length!==i.length||c.some(w=>w.parentElement!==l))continue;let p=new Set(c),h=0;Array.from(l.children).map(w=>p.has(w)?c[h++]:w).forEach((w,S)=>{var K;l.children[S]!==w&&l.insertBefore(w,(K=l.children[S])!=null?K:null)})}return"applied"}function St(e){var n,r,o;let t=(r=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0)==null?void 0:r.location;return(o=t==null?void 0:t.pathname)!=null?o:""}function Hi(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 Yt(e,t){return!!(e!=null&&e.urlMatch)&&!St(t).includes(e.urlMatch)}var qi=/^[a-zA-Z_][-a-zA-Z0-9_]*$/;function Zr(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)&&qi.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 Te(e,t){if(e.urlMatch&&!St(t).includes(e.urlMatch))return null;let n=Zr(e,t);if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!Hi(r,e.fingerprint)?null:r}function Qr(e,t){return Yt(e,t)?!1:!!e.selector&&!e.dataAttr&&!e.id&&!e.fingerprint&&e.page===void 0?eo(e,t):Te(e,t)!==null}function eo(e,t){return Zr(e,t).length>0}function Xt(e,t){return Yt(e,t)?!1:e.page!==void 0&&Wt.test(e.page)?Mn(e.page,St(t)):eo(e,t)}var to={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"},Ji=/^(rgb|rgba|hsl|hsla|calc|var|min|max|clamp)$/i;function no(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(!Ji.test((r=n[1])!=null?r:""))return!1;return!0}function Yi(e){var r,o;let t=e.ownerDocument.createTreeWalker(e,4),n=null;for(let s=t.nextNode();s!==null;s=t.nextNode()){if(((r=s.nodeValue)!=null?r:"").trim()==="")continue;let a=(o=s.parentElement)==null?void 0:o.tagName;if(!(a==="SCRIPT"||a==="STYLE"||a==="TEMPLATE")){if(n!==null)return null;n=s}}return n}function bt(e,t){let n=Yi(e);n!==null?n.nodeValue=t:e.textContent=t}var Wn=/^https:\/\//i;function Zt(e){return typeof e=="string"&&!/[\s\x00-\x1f\\]/.test(e)&&(Wn.test(e)||e[0]==="/"&&e[1]!=="/")?e:null}var ro=new Map,Fe=null;function Xi(e){return e.replace(/["\\]/g,"\\$&")}function Zi(e){var t;(!Fe||!Fe.isConnected)&&(Fe=e.querySelector("style[data-sentient-ops]"),Fe||(Fe=Ge(e.createElement("style"),e),Fe.setAttribute("data-sentient-ops",""),((t=e.head)!=null?t:e.documentElement).appendChild(Fe))),Fe.textContent=[...ro.entries()].map(([n,r])=>`[data-snt-e="${Xi(n)}"]{${r}}`).join(`
2
+ `)}function oo(e,t,n,r){var u;let o=!1,s=(u=t.moveBefore)!=null?u:t.moveAfter;if(s){let i=Te(s,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"&&bt(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 a=[];if(t.hidden&&a.push("display:none !important"),t.style)for(let[i,c]of Object.entries(t.style)){let l=to[i];l&&typeof c=="string"&&no(c)&&a.push(`${l}:${c.trim()} !important`)}return a.length>0&&(e.setAttribute("data-snt-e",n),ro.set(n,a.join(";")),Zi(r)),{anchorMiss:o}}var wt="data-sentient-block-arm",R=null;function Et(e){R=e!=null?e:null}var Ze=null;function kt(e){Ze=e!=null?e:null}var lo=e=>{var t;return typeof e=="string"?(t=Ze==null?void 0:Ze.entries.find(n=>n.id===e))==null?void 0:t.classes:void 0},uo=e=>{let t=typeof e=="string"?Ze==null?void 0:Ze.entries.find(n=>n.id===e):void 0;return t!=null&&t.computed.inheritsColor?t.computed.color:void 0},Re="data-sentient-blocks-hid",ut={none:"0",sm:"8px",md:"16px",lg:"24px"},Vn={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},io={sm:"0.875em",md:"1em",lg:"1.25em"},Qi={sm:"1.25em",md:"1.5em",lg:"2em"},es={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},so={sm:"8px",md:"16px",lg:"32px"},ts={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},ns={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 ao(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 co(e,t){let n=rs(e,t),r=uo(e.like);return n&&r&&(n.style.color=r),n}function rs(e,t){var n,r,o,s,a,u,i,c,l,p,h,b,w,S,K,L,D,_,A,x;try{let P=lo(e.like),m=e.maxWidth==="measure"?"65ch":void 0,v=d=>(d.className=P,he(d,{"max-width":m}));switch(e.type){case"stack":case"grid":{let d=t.createElement("div");if(e.type==="stack"){let M=e;he(d,{display:"flex","flex-direction":M.direction,gap:(r=ut[(n=M.gap)!=null?n:"md"])!=null?r:ut.md,"align-items":M.align?Vn[M.align]:void 0,"justify-content":M.justify?Vn[M.justify]:void 0,"flex-wrap":M.wrap?"wrap":void 0})}else{let M=e,q=(s=ut[(o=M.gap)!=null?o:"md"])!=null?s:ut.md;he(d,{display:"grid","grid-template-columns":`repeat(auto-fit, minmax(max(200px, calc((100% - ${M.columns-1} * ${q}) / ${M.columns})), 1fr))`,gap:q,"align-items":M.align?Vn[M.align]:void 0})}P&&(d.className=P);let g=!P&&e.type==="stack"&&e.surface==="raised",I=(a=e.pad)!=null?a:g?"md":void 0;I&&he(d,{padding:(u=ut[I])!=null?u:ut.md}),g&&he(d,{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":(c=R==null?void 0:R.radius)!=null?c:"8px"});for(let M of(l=e.children)!=null?l:[]){let q=co(M,t);q&&d.appendChild(q)}return d}case"text":{let d=t.createElement("p");return d.textContent=e.value,P?v(d):he(d,Ke(U({margin:"0","font-size":e.size?io[e.size]:void 0,"font-weight":e.weight?ns[e.weight]:void 0,"text-align":e.align},ao(e.tone)),{"max-width":e.maxWidth==="measure"?"65ch":void 0}))}case"heading":{let d=t.createElement(`h${e.level}`);return d.textContent=e.value,P?v(d):he(d,{margin:"0","font-size":Qi[(p=e.size)!=null?p:"md"],"text-align":e.align,"max-width":e.maxWidth==="measure"?"65ch":void 0})}case"button":{let d=t.createElement("a");d.textContent=e.label;let g=Zt(e.href);if(g&&(d.href=g),e.tag&&d.setAttribute("data-sentient-tag",e.tag),P)return v(d);let I=(h=e.emphasis)!=null?h:"primary";return he(d,{display:"inline-block",padding:es[(b=e.size)!=null?b:"md"],"border-radius":(w=R==null?void 0:R.radius)!=null?w:"8px",font:"inherit","font-size":e.size?io[e.size]:void 0,"text-decoration":I==="ghost"?"underline":"none",cursor:"pointer",background:I==="primary"?(S=R==null?void 0:R.primaryBg)!=null?S:"#111827":"transparent",color:I==="primary"?(K=R==null?void 0:R.primaryText)!=null?K:"#ffffff":(L=R==null?void 0:R.accent)!=null?L:"inherit",border:I==="secondary"?`1px solid ${(D=R==null?void 0:R.accent)!=null?D:"currentColor"}`:"none"})}case"link":{let d=t.createElement("a");d.textContent=e.label;let g=Zt(e.href);return g&&(d.href=g),e.tag&&d.setAttribute("data-sentient-tag",e.tag),P?v(d):he(d,{color:"inherit","text-decoration":"underline"})}case"image":{let d=t.createElement("img"),g=Zt(e.src);return g&&(d.src=g),d.alt=e.alt,P&&(d.className=P),he(d,{display:"block","max-width":"100%","aspect-ratio":e.ratio&&e.ratio!=="auto"?ts[e.ratio]:void 0,"object-fit":e.fit,width:e.ratio&&e.ratio!=="auto"?"100%":void 0})}case"badge":{let d=t.createElement("span");return d.textContent=e.value,P?v(d):he(d,U({display:"inline-block",padding:"2px 10px","border-radius":"999px","font-size":"0.75em",border:`1px solid ${(_=R==null?void 0:R.border)!=null?_:"currentColor"}`},ao(e.tone)))}case"spacer":return he(t.createElement("div"),{height:(A=so[e.size])!=null?A:so.md});case"divider":return he(t.createElement("hr"),{border:"none","border-top":`1px solid ${(x=R==null?void 0:R.border)!=null?x:"currentColor"}`,margin:"0",width:"100%"});default:return null}}catch(P){return null}}function fo(e,t,n,r){var o,s;try{let a=new Set;for(let i of Array.from(e.children)){let c=i.getAttribute(wt);c!==null&&(t[c]===void 0?i.remove():a.add(c))}for(let[i,c]of Object.entries(t)){if(a.has(i))continue;let l="tree"in c?c:null,p=co(l?l.tree:c,r);if(!p)continue;let h=r.createElement("div");h.setAttribute(wt,i),h.style.display="none";let b=l?lo((o=l.surface)==null?void 0:o.like):void 0;if(b){let w=r.createElement("div");w.className=b;let S=uo((s=l.surface)==null?void 0:s.like);S&&(w.style.color=S),w.appendChild(p),h.appendChild(w)}else h.appendChild(p);e.appendChild(h)}let u=n!==void 0&&t[n]!==void 0;for(let i of Array.from(e.children)){let c=i.getAttribute(wt),l=i;c!==null?l.style.display=u&&c===n?"":"none":u?l.hasAttribute(Re)||(l.setAttribute(Re,l.style.display),l.style.display="none"):l.hasAttribute(Re)&&(l.style.display=l.getAttribute(Re),l.removeAttribute(Re))}}catch(a){}}function os(e){try{for(let t of Array.from(e.children)){let n=t;if(n.getAttribute(wt)!==null){n.remove();continue}n.hasAttribute(Re)&&(n.style.display=n.getAttribute(Re),n.removeAttribute(Re))}}catch(t){}}function Qt(e,t){try{let n=new Set;for(let r of Array.from(e.querySelectorAll(`[${wt}]`)))r.parentElement&&n.add(r.parentElement);for(let r of Array.from(e.querySelectorAll(`[${Re}]`)))r.parentElement&&n.add(r.parentElement);for(let r of n)t.has(r)||os(r)}catch(n){}}function Hn(e,t){if(!e)return[t.documentElement];try{return Array.from(t.querySelectorAll(e))}catch(n){return[]}}function en(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 tn(e,t,n,r){var o;for(let[s,a]of Object.entries(t)){let u=e[s];if(!u||typeof u=="string")continue;let i=Hn(a.target,n);for(let c of i)for(let[l,p]of Object.entries(u))(o=a.dims[l])!=null&&o.includes(p)&&(c.setAttribute(`data-${l}`,p),r==null||r(c,`data-${l}`))}}function nn(e,t,n,r){for(let[o,s]of Object.entries(t)){let a=e[o];if(typeof a!="string"||!s.arms||!s.arms.includes(a))continue;let u=Hn(s.target,n);for(let i of u)i.setAttribute("data-sentient-arm",a),r==null||r(i,"data-sentient-arm")}}function rn(e,t,n,r){var u,i,c,l,p,h,b;let o=new Set,s=(u=r==null?void 0:r.contentAndOps)!=null?u:!0,a=[];for(let[w,S]of Object.entries(t)){if(Yt(S.locator,n))continue;let K;if(S.locator){let D=Te(S.locator,n);K=D?[D]:[],!D&&Xt(S.locator,n)&&a.push(w)}else K=Hn(S.target,n);let L=e[w];for(let D of K){if(L!==void 0)if(typeof L=="string")D.setAttribute("data-sentient-arm",L),(i=r==null?void 0:r.onAttr)==null||i.call(r,D,"data-sentient-arm"),s&&((c=r==null?void 0:r.onApplied)==null||c.call(r,w,L,D));else for(let[A,x]of Object.entries(L))D.setAttribute(`data-${A}`,x),(l=r==null?void 0:r.onAttr)==null||l.call(r,D,`data-${A}`);if((S.blocks||S.compose)&&!ss(n)){let A=Object.fromEntries([...Object.entries((p=S.blocks)!=null?p:{}).filter(([,x])=>!ht(x)),...Object.entries((h=S.compose)!=null?h:{}).filter(([,x])=>!ht(x.tree))]);Object.keys(A).length>0&&(fo(D,A,typeof L=="string"?L:void 0,n),o.add(D))}if(!s)continue;let _=D.textContent;S.edits?Xr(D,S.edits.edits,S.edits)==="mismatch"&&((b=r==null?void 0:r.onDrift)==null||b.call(r,w,S.edits.fp)):typeof S.content=="string"&&bt(D,S.content),S.ops&&oo(D,S.ops,w,n).anchorMiss&&!a.includes(w)&&a.push(w),Bn(D,Ke(U(U({previous:_},typeof L=="string"?{arm:L}:{}),(r==null?void 0:r.persona)!==void 0?{persona:r.persona}:{}),{doc:n}))}}return Qt(n,o),a}var is=/bot|crawler|spider|crawling|googlebot|bingbot|duckduckbot|baiduspider|yandexbot|slurp|gptbot|claudebot|anthropic|perplexity|ccbot|applebot|headlesschrome/i;function ss(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:is.test((r=o.userAgent)!=null?r:""):!1}catch(o){return!1}}var as=800;function on(e,t,n){let r=[];return n.forEach(({slotId:o,arm:s,el:a},u)=>{r.push($n((h,b={})=>{try{e.track({projectId:t,componentId:o,variantId:s,eventType:"micro_signal",payload:U({signalType:h},b)})}catch(w){}},a,void 0,{tabLoss:u===0}));let i=null,c=0,l=()=>{c=Date.now(),i=setTimeout(()=>{try{e.track({projectId:t,componentId:o,variantId:s,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-c}})}catch(h){}i=null},as)},p=()=>{i!==null&&(clearTimeout(i),i=null)};a.addEventListener("mouseenter",l),a.addEventListener("mouseleave",p),r.push(()=>{a.removeEventListener("mouseenter",l),a.removeEventListener("mouseleave",p),i!==null&&clearTimeout(i)})}),()=>{for(let o of r)o()}}function ls(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 go(e){return e?`_snt_fired_goals_${e.slice(0,12)}`:"_snt_fired_goals"}var us="_snt_fired_goals";function qn(e,t){try{e==null||e.sessionStorage.removeItem(go(t)),e==null||e.sessionStorage.removeItem(us)}catch(n){}}function po(e){var t;return[(t=e.slotId)!=null?t:"",e.goalId,e.event,e.locator?JSON.stringify(e.locator):""].join("|")}function cs(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 ds(e,t,n){try{e==null||e.sessionStorage.setItem(t,JSON.stringify([...n]))}catch(r){}}function mo(e,t,n,r){var L,D;let o=(L=n.defaultView)!=null?L:typeof window!="undefined"?window:null,s=go(r),a=cs(o,s),u=_=>{let A=po(_);if(!a.has(A))try{_.slotId?t.componentGoal(_.slotId,_.goalId):t.goal(_.goalId),a.add(A),ds(o,s,a)}catch(x){}},i=e.filter(_=>_.event==="click"),c=e.filter(_=>_.event==="form_submit"),l=e.filter(_=>_.event==="url_reached"),p=e.filter(_=>_.event==="scroll_depth"),h=(_,A)=>{if(!_.locator)return!1;let x=Te(_.locator,n);return!!x&&(x===A||x.contains(A))},b=_=>{let A=_.target;if(!(!A||typeof A.closest!="function"))for(let x of i)h(x,A)&&u(x)},w=_=>{let A=_.target;if(A)for(let x of c)h(x,A)&&u(x)},S=()=>{if(l.length===0)return;let _=St(n);for(let A of l)A.urlPattern&&ls(A.urlPattern,_)&&u(A)},K=()=>{var x;let _=n.documentElement,A=_.scrollHeight>0?(_.scrollTop+_.clientHeight)/_.scrollHeight:0;for(let P of p)A>=((x=P.threshold)!=null?x:.75)&&u(P);p.every(P=>a.has(po(P)))&&n.removeEventListener("scroll",K)};return n.addEventListener("click",b,!0),n.addEventListener("submit",w,!0),(D=n.defaultView)==null||D.addEventListener("popstate",S),S(),p.length>0&&(n.addEventListener("scroll",K,{passive:!0}),K()),{checkUrl:S,teardown:()=>{var _;n.removeEventListener("click",b,!0),n.removeEventListener("submit",w,!0),(_=n.defaultView)==null||_.removeEventListener("popstate",S),p.length>0&&n.removeEventListener("scroll",K)}}}function sn(e,t){if(!e||e.length<2||t.size!==e.length)return null;let n=[];for(let a of e){let u=t.get(a);if(!u||n.includes(u))return null;n.push(u)}let r=n[0].parentNode;if(!r||!n.every(a=>a.parentNode===r))return null;let o=n.slice().sort((a,u)=>a.compareDocumentPosition(u)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),s=[];for(let a=0;a<n.length;a++){let u=n[a];o[a]!==u&&(s.push({el:u,before:o[a]}),o.splice(o.indexOf(u),1),o.splice(a,0,u))}return s}var fs="__snt_editor_token";function ho(){try{return typeof sessionStorage!="undefined"?sessionStorage.getItem(fs):null}catch(e){return null}}function yo(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 s=n.slice(0,r.index)+o;history.replaceState(history.state,"",s?"#"+s:location.pathname+location.search)}}catch(n){}return t}var _t="0.32.2",un=_t!=="0.0.0-dev"?{name:"snippet",version:_t}:void 0,Ao=_t!=="0.0.0-dev"?{v:_t}:{},vo=5e3,ps=50,xo=(()=>{try{if(typeof window=="undefined")return[];let e=window.SentientSnippet;return Array.isArray(e==null?void 0:e.q)?e.q:[]}catch(e){return[]}})(),Z=null,k=null,Se={},ve=null,be=null,At=null,oe=null,ie=null,xt=0,H=null,Qe=null,So=!1,Jn=null,an=null,Ct=null,_e=!1,Ue=!1,cn=!1,dn=0,Co=e=>fe(e)===dn,ct=null,ce=!1,De=null,Ae=[],et=null,tt=null,ye=null,gs=3e3,ms=100;function bo(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 Ne(e,...t){e!=null&&e.debug&&console.log("[sentient-snippet]",...t)}function Ot(e,t){return Z?(Z.personaAttributes&&H&&en(H.persona,H.band,e,t==null?void 0:t.onAttr),tn(Se,Z.slots,e,t==null?void 0:t.onAttr),nn(Se,Z.slots,e,t==null?void 0:t.onAttr),ve?rn(Se,ve,e,U(Ke(U({},t),{onDrift:(n,r)=>{var o,s;return(s=k==null?void 0:k.reportDrift)==null?void 0:s.call(k,n,r,(o=To[n])!=null?o:null,"fp_mismatch")}}),H?{persona:H.persona}:{})):(Qt(e,new Set),[])):[]}function Oo(e){var n;let t=new Map;for(let r of(n=Z==null?void 0:Z.sections)!=null?n:[])try{let o=e.querySelectorAll(r);o.length===1&&t.set(r,o[0])}catch(o){}return t}function Yn(e,t){var n,r;try{if(!e||e.length<2)return;for(let o of(n=sn(e,Oo(t)))!=null?n:[])(r=o.before.parentNode)==null||r.insertBefore(o.el,o.before)}catch(o){}}function hs(e,t,n){let r=(o,s)=>t.some(([a,u])=>a===o&&u===s);try{if(Array.isArray(e.stamped))for(let o of e.stamped){if(!Array.isArray(o))continue;let[s,a,u]=o;!s||typeof a!="string"||r(s,a)||(u==null?s.removeAttribute(a):s.setAttribute(a,u))}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 ys(){try{let e=window.__sntPP;return e&&typeof e=="object"&&typeof e.v=="number"?e:null}catch(e){return null}}function Io(e){return e.apiBase?`${e.apiBase.replace(/\/+$/,"")}/v1/events`:void 0}function pn(e){var t;return(t=e.apiBase)!=null?t:"https://api.sentient-ui.com"}function vs(e){return Promise.resolve().then(()=>fetch(`${pn(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 Xn(e,t){let n=[],r=[];for(let o of e)try{if(typeof(o==null?void 0:o.id)!="string")continue;!o.locator||Qr(o.locator,t)?n.push(o.id):Xt(o.locator,t)&&r.push(o.id)}catch(s){}return[n,r]}var To={};function Lo(e,t){var r;let n={};for(let o of e){let s=(r=De==null?void 0:De.find(c=>c.id===o))==null?void 0:r.locator,a=s?Te(s,t):null,u=a?qt(a):null,i=u&&"fp"in u?u.fp:void 0;i&&(To[o]=i),n[o]=Ke(U({},i?{fp:i}:{}),{forms:!1,compose:!0,content:!0})}return n}function Po(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 Ro(){if(!_e){le&&et!==Ie()&&le(!0);return}!De||et===Ie()||(et=Ie(),Ss())}function Ss(){ye==null||ye();let e=Z,t=De;if(!e||!t)return;let n,r,o=()=>{clearTimeout(n),clearTimeout(u),r==null||r.disconnect(),ye===o&&(ye=null)},s=null,a=i=>{let[c,l]=Xn(t,document),p=c.filter(h=>!Ae.includes(h));s!==null&&c.some(h=>!s.has(h)&&!p.includes(h))&&It(),s=new Set(c),p.length>0&&bs(p).catch(()=>{}),(i||l.length===0&&!t.some(h=>!c.includes(h.id)&&!Ae.includes(h.id)))&&(o(),No(e,l))},u=setTimeout(()=>a(!0),gs);if(ye=o,a(),ye===o)try{r=new MutationObserver(()=>{clearTimeout(n),n=setTimeout(a,ms)}),r.observe(document.documentElement,{childList:!0,subtree:!0})}catch(i){}}function fn(e,t){if(!(!e||e.length===0||!t||!Z))try{be==null||be.teardown(),be=mo(e,t,document,Z.apiKey)}catch(n){}}async function bs(e){let t=Z,n=k;if(!t||!n)return;Ae=Ae.concat(e);let r=await n.decide(U({slotsFrom:"registry",registrySlotIds:e,render:Lo(e,document)},Ao));if(r||(Ae=Ae.filter(s=>!e.includes(s))),!r||ce||k!==n)return;Se=U(U({},Se),r.slots),!be&&r.goals&&(t.consent!==!1||Ue)&&fn(At=r.goals,n);let o=Po(r.slotConfig,e);o&&(ve=U(U({},ve),o)),It(),Ne(t,"late decide",e),tt&&Co(t.apiKey)&&He(t.apiKey,tt=U(Ke(U({},tt),{slots:Se,savedAt:Date.now()}),ve?{slotConfig:ve}:{}))}function No(e,t){if(t.length!==0)try{fetch(`${pn(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 nt(){return!!(Z&&k&&Z.sectionCapture!==!1&&(Z.consent!==!1||Ue)&&!Ye())}function ws(){if(!k||!Z||!nt()||ie)return;let e=[];Ot(document,{contentAndOps:_e,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),Qn();try{oe==null||oe(),oe=on(k,Z.apiKey,e)}catch(t){}}function Qn(){if(typeof document=="undefined"||!nt())return;let e;try{if(an&&an.length>0){let r=new Map;for(let o of an){if(o.urlMatch!==window.location.pathname)continue;let s=Te(o.locator,document);s&&r.set(s,o.type)}r.size>0&&(e=o=>{var s;return(s=r.get(o))!=null?s:null})}}catch(r){}let t=k,n=++xt;Ct=window.location.pathname,lt("engagement.global.js","__sentientEngagement").then(r=>{if(!(!r||n!==xt||k!==t||!t||!nt()))try{ie==null||ie(),ie=r.startEngagementCapture(t,U({apiKey:Z.apiKey,apiBase:Z.apiBase,doc:document,microSignals:!0},e?{typeOf:e}:{}))}catch(o){}})}function It(){try{let e=[];if(oe==null||oe(),oe=null,Ot(document,{contentAndOps:_e,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),Yn(Qe,document),e.length>0&&nt())try{oe=on(k,Z.apiKey,e)}catch(t){}try{typeof window!="undefined"&&Ct!==null&&window.location.pathname!==Ct&&nt()&&(ie==null||ie(),ie=null,xt++,Qn())}catch(t){}}catch(e){}}function wo(){Jn===null&&(Jn=setTimeout(()=>{Jn=null,It();try{be==null||be.checkUrl()}catch(e){}Ro()},ps))}function Do(){if(!(So||typeof window=="undefined"||typeof history=="undefined")){So=!0;try{let e=t=>{let n=history[t];history[t]=function(r,o,s){let a=n.call(this,r,o,s!=null?s:null);return wo(),a}};e("pushState"),e("replaceState"),window.addEventListener("popstate",wo)}catch(e){}}}function ln(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 Es(e,t,n){var r;try{window.__sentientEditor={token:t,code:n,apiBase:pn(e)};let o=e.editorSrc?{src:e.editorSrc}:Gn("editor.global.js");if(!o){ko();return}let s=Ge(document.createElement("script"));Fn(s,o),s.async=!0,s.onerror=()=>ko(),((r=document.head)!=null?r:document.documentElement).appendChild(s)}catch(o){}}var Eo="sentient-editor-load-notice";function ko(){var e;try{if(document.getElementById(Eo))return;let t=document.createElement("div");t.id=Eo,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;max-width:320px;padding:14px 16px;border-radius:14px;background:#111827;color:#fff;font:13px/1.45 system-ui,sans-serif;border:1px solid rgba(245,158,11,.6);cursor:pointer",t.onclick=()=>t.remove(),((e=document.body)!=null?e:document.documentElement).appendChild(t),setTimeout(()=>t.remove(),1e4)}catch(t){}}function ks(e){let t={cfg:e,apiBase:pn(e),set(n){n.slots!==void 0&&(Se=n.slots),n.slotConfig!==void 0&&(ve=n.slotConfig),n.persona!==void 0&&(H=n.persona),n.decided&&(_e=!0),n.look&&(Et(n.look.palette),kt(n.look.vocabulary))},apply:()=>Ot(document),installSpaHooks:Do,exposeGlobal:()=>{cn=!0,Zn(e)},dbg:(...n)=>Ne(e,...n)};return lt("preview.global.js","__sentientPreview").then(n=>n?n.runPreview(t):Promise.reject()).catch(()=>(t.exposeGlobal(),Ne(e,"preview chunk unavailable \u2014 page left as-is"),!0))}function Zn(e){let t=r=>{try{ie==null||ie(),ie=null,xt++,Ct=null,oe==null||oe(),oe=null,ye==null||ye(),be==null||be.teardown(),be=null,r&&qn(typeof window!="undefined"?window:null,e.apiKey),Ue=!1,ce=!0,r?(tt=null,H=null,k?k.destroy():it(e.apiKey)):k==null||k.dispose(),k=null}catch(o){}},n={consentWatcher:Xe,goal(r,o){try{k==null||k.goal(r,o)}catch(s){}},componentGoal(r,o){try{k==null||k.componentGoal(r,o)}catch(s){}},grantConsent(){try{if(!k&&ce||k!=null&&k.released)dn=fe(e.apiKey),k=yt(U({apiKey:e.apiKey,consent:!0,preConsentBehavior:e.preConsentBehavior,debug:e.debug,persona:e.persona,ingestUrl:Io(e)},un?{sdk:un}:{})),fn(At,k);else{let r=(k==null?void 0:k.gated)===!0;Kn(e.apiKey),r&&(dn=fe(e.apiKey)),fn(At,k)}ce=!1,le==null||le()}catch(r){}Ue=!0;try{ws()}catch(r){}},revokeConsent(){t(!0)},reapply:It,getState(){var r,o;try{return{apiKey:e.apiKey,persona:(r=H==null?void 0:H.persona)!=null?r:null,band:(o=H==null?void 0:H.band)!=null?o:null,slots:Se,matchCounts:ln(e),consent:!ce&&(e.consent!==!1||Ue)}}catch(s){return{apiKey:e.apiKey,persona:null,band:null,slots:{},matchCounts:{},consent:!1}}}};if(window.SentientSnippet=n,window.__sentientApi=n,e.consentFrom&&!ct&&!cn)try{let r=Xe(e.consentFrom),o=!1,s=!1,a=()=>!!k&&!ce&&(k.gated===void 0?e.consent!==!1||Ue:!k.gated);ct=r.subscribe(()=>{try{let u=r.read();u!==null&&(s=!0);let i=u!=null?u:s?!1:null,c=a(),l=!c&&i!==!0&&r.refused();if(l&&!o&&(k!=null&&k.gated?k.destroy():it(e.apiKey),qn(window,e.apiKey),tt=null,H=null),o=l,i===!0&&!c)n.grantConsent();else if(i===!1&&c){let p=r.refused();t(p),p&&(o=!0)}}catch(u){}})}catch(r){}for(let r of xo.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 _o(){var e;try{if(typeof window=="undefined")return;let t=window;if(typeof((e=t.SentientSnippet)==null?void 0:e.goal)=="function")return;let n=()=>{};t.SentientSnippet={goal:n,componentGoal:n,grantConsent:n,revokeConsent:n,reapply:n,consentWatcher:Xe,getState:()=>({apiKey:"",persona:null,band:null,slots:{},matchCounts:{},consent:!1})},xo.length=0}catch(t){}}function _s(){try{let e=window.Shopify;return typeof(e==null?void 0:e.shop)=="string"&&e.shop!==""}catch(e){return!1}}async function Mo(){var e,t;try{let n=Jt(window.sentient);if(!n){_o();return}Z=n,ct==null||ct(),ct=null,!n.consentFrom&&n.consent===void 0&&_s()&&(n.consentFrom="shopify"),Vr(n.consentSrc),zt(n.nonce),cn=!1,_e=!1,le=null,Qe=null,Se={},ve=null,Et(null),kt(null),Ue=!1,ce=!1,At=null,De=null,Ae=[],et=null,tt=null,ye==null||ye(),ie==null||ie(),ie=null,xt++,Ct=null;let r=yo("sentient_editor_code"),o=r?null:ho();if(r||o){Es(n,o,r),cn=!0,Zn(n),Ne(n,"editor mode");return}if(typeof window!="undefined"&&/[?&]sentient_(preview|persona)=[^&]/.test(window.location.search)&&await ks(n))return;if(n.consentFrom&&n.consent===void 0)try{n.consent=Xe(n.consentFrom).read()===!0}catch(d){n.consent=!1}n.consent!==!1&&n.sectionCapture!==!1&&!Ye()&&lt("engagement.global.js","__sentientEngagement");let s=(e=n.registry)!=null?e:Object.keys(n.slots).length===0;n.registry===void 0&&!s&&Ne(n,"slots declared without registry: true, so dashboard-published components are not applied");let a=s?vs(n):null,u=ys();try{(t=u==null?void 0:u.stop)==null||t.call(u)}catch(d){}let i=n.consent!==!1&&!Ye()?ot(n.apiKey):null,c=[];i&&(H={persona:i.persona,band:i.band},Se=i.slots,i.slotConfig&&(ve=i.slotConfig),i.palette&&Et(i.palette),i.vocabulary&&kt(i.vocabulary),Ot(document,U({contentAndOps:!1},u?{onAttr:(d,g)=>c.push([d,g])}:{})),i.layoutOrder&&(Qe=i.layoutOrder,Yn(Qe,document))),u&&hs(u,c,document);let l=yt(U({apiKey:n.apiKey,consent:n.consent,preConsentBehavior:n.preConsentBehavior,debug:n.debug,persona:n.persona,ingestUrl:Io(n)},un?{sdk:un}:{}));k=l,dn=fe(n.apiKey),Zn(n),Do();let p=Object.entries(n.slots).map(([d,g])=>({id:d,dims:g.dims})),h=Ao,b={pp:u?u.v:0},w=[];if(a){let[d]=await Promise.all([bo(a,vo),document.readyState==="loading"?new Promise(g=>document.addEventListener("DOMContentLoaded",g,{once:!0})):null]);De=d,d&&(Ae=w=Xn(d,document)[0]),Ne(n,"registry scope",d&&w)}let S=(d=l)=>{let g=Array.from(Oo(document).keys());return d.decide(U(U(U(U({slots:p},h),b),g.length>=2?{sections:g}:{}),s?{slotsFrom:"registry",registrySlotIds:w,render:Lo(w,document)}:{}))},K=Ie(),L=l.gated===!0,D=!1,_=!1,A=!1,x=!1;le=(d=!1)=>{let g=k;!D||_||x||_e||ce||!g||g.gated||!d&&!A||(A=!1,x=!0,K=et=Ie(),De&&(Ae=w=Xn(De,document)[0]),S(g).then(I=>{x=!1,I&&!_e&&!ce&&k===g?v(I):(I||(Ae=[]),!_e&&(g.released||k!==g||ce)&&(A=!0))}).catch(()=>{x=!1}))};let P=S();P.then(()=>{D=!0},()=>{D=!0});let m=await bo(P,vo),v=d=>{var M,q,J,Y,xe;_=!0;let g=(k!=null?k:l).getPersona();g?H={persona:g.persona,band:g.band}:d.persona&&(H={persona:d.persona,band:"low"}),Se=d.slots,s?ve=Po(d.slotConfig,w):d.slotConfig&&(ve=d.slotConfig),d.palette&&Et(d.palette),d.vocabulary&&kt(d.vocabulary),Qe=(M=d.layoutOrder)!=null?M:Qe;let I=()=>{let O=[],B=Ot(document,{onApplied:(ne,ue,Q)=>O.push({slotId:ne,arm:ue,el:Q})});if(s||No(n,B),Yn(Qe,document),_e=!0,nt())try{oe==null||oe(),oe=on(k,n.apiKey,O)}catch(ne){}};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",I,{once:!0}):I(),At=(q=d.goals)!=null?q:null,(n.consent!==!1||Ue)&&!ce&&fn(d.goals,k),an=(J=d.sectionMap)!=null?J:null,nt()&&Qn(),Ne(n,"applied",{persona:H,slots:Se,matches:ln(n)}),!ce&&(Co(n.apiKey)&&He(n.apiKey,tt=U(U(U({v:1,persona:(Y=H==null?void 0:H.persona)!=null?Y:d.persona,band:(xe=H==null?void 0:H.band)!=null?xe:"low",slots:d.slots,layoutOrder:d.layoutOrder,savedAt:Date.now()},ve?{slotConfig:ve}:{}),d.palette?{palette:d.palette}:{}),d.vocabulary?{vocabulary:d.vocabulary}:{})),et=null,Ro())};if(!m){Ne(n,"decide timeout/null \u2014 snapshot state stands",ln(n)),P.then(d=>{if(!d){if(_e)return;Ae=[],l.released===!0||k!==l||ce||L&&Ie()!==K?(A=!0,le==null||le()):et=K;return}if(!(!d||_e||ce)){if(k!==l){A=!0,le==null||le();return}v(d),Ne(n,"late decide applied",ln(n))}}).catch(()=>{});return}if(ce||k!==l){A=!0,le==null||le();return}v(m)}catch(n){_o()}}if(typeof window!="undefined"&&window.sentient){let e=window;if(!e.__sentientInitialized)e.__sentientInitialized=!0,Promise.resolve().then(()=>{Mo()});else{let t=window.__sentientApi;t&&Promise.resolve().then(()=>{window.SentientSnippet=t})}}return Vo(As);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentientui/snippet",
3
- "version": "0.32.0",
3
+ "version": "0.32.2",
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.36.0"
44
+ "@sentientui/core": "0.36.2"
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",