@sentientui/react 0.44.2 → 0.44.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- "use strict";var $r=Object.create;var je=Object.defineProperty,Br=Object.defineProperties,Ur=Object.getOwnPropertyDescriptor,Wr=Object.getOwnPropertyDescriptors,Kr=Object.getOwnPropertyNames,ze=Object.getOwnPropertySymbols,Jr=Object.getPrototypeOf,wt=Object.prototype.hasOwnProperty,an=Object.prototype.propertyIsEnumerable;var sn=(e,t,n)=>t in e?je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p=(e,t)=>{for(var n in t||(t={}))wt.call(t,n)&&sn(e,n,t[n]);if(ze)for(var n of ze(t))an.call(t,n)&&sn(e,n,t[n]);return e},M=(e,t)=>Br(e,Wr(t));var $e=(e,t)=>{var n={};for(var r in e)wt.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ze)for(var r of ze(e))t.indexOf(r)<0&&an.call(e,r)&&(n[r]=e[r]);return n};var Hr=(e,t)=>{for(var n in t)je(e,n,{get:t[n],enumerable:!0})},ln=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Kr(t))!wt.call(e,i)&&i!==n&&je(e,i,{get:()=>t[i],enumerable:!(r=Ur(t,i))||r.enumerable});return e};var Be=(e,t,n)=>(n=e!=null?$r(Jr(e)):{},ln(t||!e||!e.__esModule?je(n,"default",{value:e,enumerable:!0}):n,e)),Xr=e=>ln(je({},"__esModule",{value:!0}),e);var Ai={};Hr(Ai,{Adaptive:()=>gr,AdaptiveGroup:()=>Er,AdaptiveProvider:()=>Fn,AdaptiveSlot:()=>De,AdaptiveText:()=>mr,SentientPersonaScript:()=>br,buildAgentFeed:()=>Ir,consentWatcher:()=>Vr.consentWatcher,defineAgentContent:()=>Tr,detectSegment:()=>Kt.deriveSessionSegment,getAgentContent:()=>Jt,grantConsent:()=>Fr.grantConsent,renderAgentJsonLd:()=>Dr,renderAgentJsonLdBody:()=>Ht,renderAgentMarkdown:()=>Lr,renderBlocks:()=>ke,renderCompose:()=>lt,useAdaptive:()=>Gr,useAdaptiveApiBaseUrl:()=>Kn,useAdaptiveGoal:()=>Le,useAdaptivePersona:()=>kr,useAdaptiveTokens:()=>Cr,useAssignment:()=>ot,useGoal:()=>vr,useInitialAssignments:()=>et,useLayoutOrder:()=>jn,usePageGoal:()=>yr,useSentient:()=>j,useSessionSegment:()=>Ie});module.exports=Xr(Ai);var _=require("react"),Qe=require("@sentientui/core");var un=new Map,qe=new Map;function cn(e,t){let n=qe.get(e);return n||(n=new Set,qe.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&qe.delete(e)}}function dn(e,t){un.set(e,t);let n=qe.get(e);if(n)for(let r of n)try{r(t)}catch(i){}}function xt(e){var t;return(t=un.get(e))!=null?t:null}var zr={on:!1,listeners:new Set};function kt(){if(typeof window=="undefined")return zr;let e=window;return e.__sentient_preview||(e.__sentient_preview={on:!1,listeners:new Set}),e.__sentient_preview}function fn(e){let t=kt();if(t.on!==e){t.on=e;for(let n of t.listeners)n()}}function Rt(){return kt().on}function gn(e){let t=kt().listeners;return t.add(e),()=>{t.delete(e)}}function mn(e){return{isLocal:e.isLocal,track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},fetchWeights:()=>Promise.resolve([]),getAssignment:(t,n)=>e.getAssignment(t,n),isUnified:t=>{var n,r;return(r=(n=e.isUnified)==null?void 0:n.call(e,t))!=null?r:!1},assign:(t,n,r,i,o)=>e.assign(t,n,r,i,o),decide:()=>Promise.resolve(null),getSlotResult:t=>e.getSlotResult(t),getSlotConfig:t=>e.getSlotConfig(t),getSitePalette:()=>e.getSitePalette(),reportSlots:t=>e.reportSlots(t),getPersona:()=>e.getPersona(),getGraph:()=>e.getGraph(),flush:()=>e.flush(),dispose:()=>e.dispose(),destroy:()=>e.destroy()}}var At="sentient:overrides-changed";function pn(){var e;return typeof window=="undefined"?0:(e=window.__sentient_overrides_version)!=null?e:0}function Ct(){var t;if(typeof window=="undefined")return;let e=window;e.__sentient_overrides_version=((t=e.__sentient_overrides_version)!=null?t:0)+1,window.dispatchEvent(new Event(At))}function ee(e){return typeof window=="undefined"?()=>{}:(window.addEventListener(At,e),()=>window.removeEventListener(At,e))}function yn(e){typeof window!="undefined"&&(window.__sentient_devtools_config=e)}function F(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}function ne(e){return typeof e=="string"?{type:"click"}:e}function ye(e){return typeof e=="string"?e:e.type}function ce(e){if(typeof e!="string"&&(e.type==="click"||e.type==="form_submit"||e.type==="scroll_depth"))return e.value}var _t=new Set,Ot=!1;function vn(e){if(_t.has(e))return!0;if(_t.add(e),!Ot){Ot=!0;let t=()=>{Ot=!1,_t.clear()};if(typeof MessageChannel=="function"){let n=new MessageChannel;n.port1.onmessage=()=>{n.port1.close(),n.port2.close(),t()},n.port2.postMessage(0)}else setTimeout(t,0)}return!1}function qr(e){if(!(e instanceof Element))return!1;let t=e.tagName.toLowerCase();return t==="a"||t==="button"?!0:e.getAttribute("role")==="button"}function Sn(e,t,n){if(n){try{let i=e;for(;i&&i!==t;){if(i.matches(n))return!0;i=i.parentElement}}catch(i){}return!1}let r=e;for(;r&&r!==t;){if(qr(r))return!0;r=r.parentElement}return!1}function de(e,t,n,r){if(t.type==="weighted_composite"){let s=new Set,y=[];return t.steps.forEach(({goal:c,name:b,weight:x},d)=>{let m=(S=!1)=>{s.has(d)||S&&r!==void 0&&vn(`step\0${b}\0${x}\0${d}`)||(s.add(d),n.fireStep(b,x,d))};if(c.type==="click"){let S=v=>{let g=v.target;g instanceof Element&&Sn(g,e,c.selector)&&m()};e.addEventListener("click",S),y.push(()=>e.removeEventListener("click",S));return}if(c.type==="form_submit"){let S=v=>{v.target instanceof HTMLFormElement&&e.contains(v.target)&&m()};e.addEventListener("submit",S),y.push(()=>e.removeEventListener("submit",S));return}if(c.type==="scroll_depth"){let S=Math.max(0,Math.min(1,c.threshold)),v=new IntersectionObserver(g=>{for(let h of g)if(h.intersectionRatio>=S){m(!0),v.disconnect();break}},{threshold:[S]});v.observe(e),y.push(()=>v.disconnect())}}),()=>{for(let c of y)c()}}let i=t.type==="composite"?t.all:[t],o=new Set(i.map((s,y)=>y)),l=()=>{r!==void 0&&vn(r)||n.fireGoal()},a=(s,y=!1)=>{o.delete(s),o.size===0&&(y?l():n.fireGoal())},u=[];return i.forEach((s,y)=>{if(s.type==="click"){let c=b=>{let x=b.target;x instanceof Element&&Sn(x,e,s.selector)&&(t.type==="composite"?a(y):n.fireGoal())};e.addEventListener("click",c),u.push(()=>e.removeEventListener("click",c));return}if(s.type==="form_submit"){let c=b=>{b.target instanceof HTMLFormElement&&e.contains(b.target)&&(t.type==="composite"?a(y):n.fireGoal())};e.addEventListener("submit",c),u.push(()=>e.removeEventListener("submit",c));return}if(s.type==="scroll_depth"){let c=Math.max(0,Math.min(1,s.threshold)),b=new IntersectionObserver(x=>{for(let d of x)if(d.intersectionRatio>=c){t.type==="composite"?a(y,!0):l(),b.disconnect();break}},{threshold:[c]});b.observe(e),u.push(()=>b.disconnect());return}}),()=>{for(let s of u)s()}}var hn=new Set,bn=new Set;function Yr(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,100);if(t&&t===e)return`${t}-steps`;let n=5381;for(let r=0;r<e.length;r++)n=(n<<5)+n+e.charCodeAt(r)>>>0;return`${t||"component"}-${n.toString(36)}-steps`}var Zr=12;function Qr(e,t){let n=new Set,r=[];for(let o of t.steps){let l=o.name;!l||l.length>128||l.startsWith("funnel:")||n.has(l)||r.length===Zr||(n.add(l),r.push({goalId:l,weight:Math.min(1,Math.max(0,o.weight||0))}))}let i=[...r].sort((o,l)=>o.weight-l.weight);return(r.length<t.steps.length||i.some((o,l)=>o!==r[l]))&&F()&&console.warn(`[SentientUI] "${e}": weighted_composite steps adjusted for its funnel (skipped invalid/repeated/over-12 steps, or ordered by weight)`),i}function fe(e,t,n,r,i){let o=(i==null?void 0:i.type)==="weighted_composite"?i:null,l=r!=null?r:o?Yr(n):void 0;if(!l)return;let a=`${l}|${n}`;if(bn.has(a))return;bn.add(a);let u=o&&!hn.has(l)?Qr(n,o):null,s=u!==null&&u.length>=2;s&&hn.add(l),!(!s&&r===void 0)&&e.track({projectId:t,componentId:n,eventType:"funnel_declared",payload:s?{funnelId:l,steps:u}:{funnelId:l}})}function ve(e,t,n,r){e.track({projectId:t,componentId:n,variantId:r,eventType:"variant_assigned",payload:{}})}var ei={components:new Map,slots:new Map,sections:[],listeners:new Set,version:0};function be(){if(typeof window=="undefined")return ei;let e=window;return e.__sentient_registry||(e.__sentient_registry={components:new Map,slots:new Map,sections:[],listeners:new Set,version:0}),e.__sentient_registry}function Ue(){be().version+=1;for(let e of be().listeners)e()}var wn=()=>{};function Ye(e){return F()?(be().components.set(e.id,e),Ue(),()=>{be().components.delete(e.id),Ue()}):wn}function Ge(e){return F()?(be().slots.set(e.id,e),Ue(),()=>{be().slots.delete(e.id),Ue()}):wn}function Gt(e){F()&&(be().sections=[...e],Ue())}var xn="0.44.2",Et=xn!=="0.0.0-dev"?{name:"react",version:xn}:void 0;function ti(){let e=window;return e.__sentient_slot_config_overrides||(e.__sentient_slot_config_overrides={}),e.__sentient_slot_config_overrides}function Ee(e,t){ti()[e]=t}function kn(e){window.__sentient_vocabulary_override=e}function Rn(){var e;return typeof window=="undefined"?null:(e=window.__sentient_vocabulary_override)!=null?e:null}function ni(){let e=window;return e.__sentient_slot_overrides||(e.__sentient_slot_overrides={}),e.__sentient_slot_overrides}function Pe(e,t){ni()[e]=t}function An(e){let t=null;try{let n=location.hash.slice(1),r=RegExp("(^|[?&])"+e+"=([^&]*)").exec(n);if(r){t=r[2];let i=n.slice(r.index+r[0].length);r[1]!="&"&&i[0]=="&"&&(i=r[1]+i.slice(1));let o=n.slice(0,r.index)+i;history.replaceState(history.state,"",o?"#"+o:location.pathname+location.search)}}catch(n){}return t}var Nt="__snt_editor_token",Ne=null,Pt=!1;function Cn(){return Pt}function ri(){try{return sessionStorage.getItem(Nt)}catch(e){return null}}function Ze(e){if(Ne)return Ne;let t=typeof window=="undefined"?null:An("sentient_editor_code");if(!t){let n=typeof window=="undefined"?null:ri();return Pt=!!n,Ne=Promise.resolve(n?{token:n,fresh:!1}:null),Ne}return Pt=!0,Ne=fetch(`${e}/editor/exchange`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:t})}).then(async n=>{let r=n.ok?(await n.json()).token:void 0;if(!r)return{error:n.ok?500:n.status};try{sessionStorage.setItem(Nt,r)}catch(i){}return{token:r,fresh:!0}}).catch(()=>({error:0})),Ne}function _n(){try{sessionStorage.removeItem(Nt)}catch(e){}}var On="sentient_preview_cell",Gn="sentient_refresh_region",Tt="sentient-cell-preview-bar",we="__preview__",Te=null;function En(e){if((Te==null?void 0:Te.slotId)!==e)return null;let t=Te;return Te=null,t}function Pn(e,t){e.session.then(n=>{if(!n||!("token"in n))throw new Error("no editor session");return fetch(`${e.base}/editor/region-skeleton`,{method:"POST",headers:{authorization:`Bearer ${n.token}`,"content-type":"application/json"},body:JSON.stringify(p({slotId:e.slotId},t))})}).then(n=>xe(n.ok?"Region refreshed \u2014 you can regenerate its versions now.":"Couldn\u2019t refresh this region \u2014 reopen the link from your dashboard.")).catch(()=>xe("Couldn\u2019t refresh this region \u2014 check your connection and reopen the link from your dashboard."))}function Nn(e){if(typeof window=="undefined"||typeof document=="undefined"||document.getElementById(Tt))return;let t,n;try{let u=new URLSearchParams(window.location.search);t=u.get(On),n=u.get(Gn)}catch(u){return}if(!t&&!n)return;let r=(e!=null?e:"https://api.sentient-ui.com/v1").replace(/\/$/,""),i=Ze(r);if(!Cn())return;if(n){Te={slotId:n,session:i,base:r},Ee(n,{kind:"arms"}),Pe(n,we),Ct();return}if(!t)return;let o=t.lastIndexOf("~");if(o<=0)return;let l=t.slice(0,o),a=t.slice(o+1);i.then(u=>u?"token"in u?fetch(`${r}/editor/cell-preview?slotId=${encodeURIComponent(l)}&persona=${encodeURIComponent(a)}`,{headers:{authorization:`Bearer ${u.token}`}}):(xe(u.error===401?"This preview link has expired \u2014 reopen it from your dashboard.":"Couldn\u2019t load this preview \u2014 reopen it from your dashboard."),null):null).then(async u=>{if(!u)return;if(!u.ok){xe(u.status===401?"This preview link has expired \u2014 reopen it from your dashboard.":"Couldn\u2019t load this preview \u2014 reopen it from your dashboard.");return}let s=await u.json();if(s.vocabulary&&Array.isArray(s.vocabulary.entries)&&kn(s.vocabulary),s.compose!=null)Ee(l,{kind:"arms",compose:{[we]:s.compose}}),Pe(l,we);else if(s.edits!=null&&typeof s.skeletonFp=="string"&&Array.isArray(s.leafToNode))Ee(l,{kind:"arms",edits:{edits:s.edits,fp:s.skeletonFp,leafToNode:s.leafToNode}}),Pe(l,we);else if(s.blocks!=null)Ee(l,{kind:"arms",blocks:{[we]:s.blocks}}),Pe(l,we);else if(s.content!=null)Ee(l,{kind:"arms",content:s.content}),Pe(l,we);else{xe("Nothing to preview in that square yet.");return}Ct(),xe(`Previewing \u201C${s.slotName}\u201D for ${s.personaDisplay}${s.status==="review"?" \u2014 waiting for your approval":""}. Nothing is being tracked.`),setTimeout(()=>{var y;try{(y=document.querySelector(`[data-sentient-slot="${l}"]`))==null||y.scrollIntoView({block:"center"})}catch(c){}},300)}).catch(()=>xe("Couldn\u2019t load this preview \u2014 check your connection and reopen it from your dashboard."))}function xe(e){var i;if(document.getElementById(Tt))return;let t=document.createElement("div");t.id=Tt,Object.assign(t.style,{position:"fixed",bottom:"16px",left:"50%",transform:"translateX(-50%)",zIndex:"2147483647",display:"flex",alignItems:"center",gap:"10px",padding:"10px 14px",borderRadius:"12px",maxWidth:"90vw",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)"});let n=document.createElement("span");n.textContent=e;let r=document.createElement("button");r.textContent="Exit preview",Object.assign(r.style,{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.35)",background:"transparent",color:"#fff",font:"12px system-ui, sans-serif",cursor:"pointer"}),r.onclick=()=>{_n();let o=new URL(window.location.href);o.searchParams.delete(On),o.searchParams.delete(Gn),window.location.assign(o.toString())},t.append(n,r),((i=document.body)!=null?i:document.documentElement).append(t)}var Tn=!1;function In(e){if(Tn||typeof window=="undefined")return;Tn=!0;let t=(e!=null?e:"https://api.sentient-ui.com/v1").replace(/\/$/,"");Ze(t).then(n=>{!n||!("token"in n)||!n.fresh||ii(t,n.token)})}function ii(e,t){let n=()=>{window.setTimeout(()=>{import("@sentientui/core/style-sample").then(({sampleStyleVocabulary:r})=>fetch(`${e}/editor/style-vocabulary`,{method:"POST",headers:{authorization:`Bearer ${t}`,"content-type":"application/json"},body:JSON.stringify(r(document))})).catch(()=>{})},1e3)};document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}var Jn=require("react/jsx-runtime");function oi(){var e,t;if(typeof window=="undefined")return"desktop:direct";try{return(0,Qe.deriveSessionSegment)({userAgent:(e=navigator.userAgent)!=null?e:"",referer:(t=document.referrer)!=null?t:"",appOrigin:window.location.origin})}catch(n){return"desktop:direct"}}var Ln="https://api.sentient-ui.com/v1",Z=(0,_.createContext)({client:null,apiKey:"",initialAssignments:{},initialUnified:[],sessionSegment:"desktop:direct",ssrFallback:"first",onAssignment:void 0,initialLayoutOrder:null,initialSlots:{},initialSlotConfig:{},initialPalette:null,initialVocabulary:null,initialPersona:null,apiBaseUrl:Ln,debug:!1}),Dn=!1,It=new Set;function si(e,t,n){let r=(0,_.useRef)(n);r.current=n;let[i,o]=(0,_.useState)(null),[l,a]=(0,_.useState)(!1),u=(0,_.useRef)(e);u.current=e;let s=e===void 0?"":typeof e=="string"?e:JSON.stringify(M(p({},e),{check:typeof e.check,refused:typeof e.refused}));return(0,_.useEffect)(()=>{let y=u.current;if(y===void 0||typeof window=="undefined")return;let c,b=!1;return import("@sentientui/core/consent").then(({consentWatcher:x,forgetVisitor:d})=>{if(b)return;let m=x(typeof y=="object"&&y.cmp===void 0&&y.check?p(M(p({},y),{check:()=>u.current.check()}),y.refused?{refused:()=>{var g,h;return((h=(g=u.current).refused)==null?void 0:h.call(g))===!0}}:{}):y),S=!1,v=()=>{let g=m.refused()&&m.read()!==!0;g&&!S&&(d(t),r.current()),S=g,a(g);let h=m.read();h!==null&&It.add(t),o(h!=null?h:It.has(t)?!1:null)};v(),c=m.subscribe(v)}),()=>{b=!0,c==null||c()}},[s,t]),{granted:i,refused:l}}function Fn(e){var P,R,C,f,A,U;let[t,n]=(0,_.useState)(null),[r]=(0,_.useState)(()=>{var w;return(w=e.sessionSegment)!=null?w:oi()}),[i,o]=(0,_.useState)(Rt());(0,_.useEffect)(()=>gn(()=>o(Rt())),[]),(0,_.useEffect)(()=>{Nn(e.apiBaseUrl),typeof window!="undefined"&&/[?&]sentient_preview=[^&]*(:|%3A)/i.test(window.location.search)&&(fn(!0),import("@sentientui/react/version-preview").then(w=>w.maybeStartVersionPreview(e.apiKey,e.apiBaseUrl)).catch(()=>{})),In(e.apiBaseUrl)},[]);let l=(0,_.useRef)(()=>{}),a=si(e.consentFrom,e.apiKey,()=>l.current()),u=e.consentFrom?(P=a.granted)!=null?P:It.has(e.apiKey)?!1:e.consent===!0:e.consent,s=e.consentFrom?a.refused:!0,y=(0,_.useRef)(s);y.current=s;let c=(0,_.useRef)(null),b=(0,_.useRef)(!1),x=(0,_.useRef)([]),d=(0,_.useRef)(!1);l.current=()=>{var G;x.current=[],d.current=!0;let w=c.current;w!=null&&w.gated?w.dispose():(G=w==null?void 0:w.takeHeld)==null||G.call(w)},(0,_.useEffect)(()=>{var q,Ve;if(y.current&&u===!1&&(x.current=[]),u===!1&&b.current&&(y.current&&((q=c.current)==null||q.destroy()),c.current=null,b.current=!1),u===!1&&!e.preConsentBehavior){y.current&&((Ve=c.current)==null||Ve.destroy()),c.current=null,n(null);return}let w=u!==!1;w&&(d.current=!1);let G=X=>{!w&&d.current&&X.gated&&X.dispose()},V=p({apiKey:e.apiKey,context:e.context,debug:e.debug,initialAssignments:e.initialAssignments,initialUnified:e.initialUnified,sessionSegment:r,consent:u,preConsentBehavior:e.preConsentBehavior,respectDoNotTrack:e.respectDoNotTrack,ssrSessionId:e.ssrSessionId,cookieDomain:e.cookieDomain,country:e.country,persona:e.persona,internal:e.internal,stageAttributes:e.stageAttributes,localMode:e.localMode,initialSlots:e.initialSlots,initialSlotConfig:e.initialSlotConfig,initialPalette:e.initialPalette,initialVocabulary:e.initialVocabulary,initialPersona:e.initialPersona,ingestUrl:e.apiBaseUrl?`${e.apiBaseUrl.replace(/\/$/,"")}/events`:void 0,nonce:e.nonce},Et?{sdk:Et}:{}),L=!1,T=null,H=null,W=X=>{for(let le of x.current.splice(0))setTimeout(()=>{if(c.current!==X){d.current||x.current.push(le);return}try{le(X)}catch(Me){}},0)},B=X=>{e.engagement===!1||!w||import("@sentientui/core/engagement").then(({startEngagementCapture:le})=>{L||(H=le(X,{apiKey:e.apiKey,sectionTypes:e.sectionTypes,apiBase:e.apiBaseUrl?e.apiBaseUrl.replace(/\/$/,""):void 0}))})};return e.enableGraph!==!1?import("@sentientui/core/graph").then(({init:X})=>{L||(T=X(M(p({},V),{graph:!0,captureDomText:e.captureDomText===!0,sectionTypes:e.sectionTypes})),G(T),c.current=T,b.current=w,W(T),n(T),B(T))}):(T=(0,Qe.init)(V),G(T),c.current=T,b.current=w,W(T),n(T),B(T)),()=>{var X,le;L=!0,H==null||H(),x.current=x.current.concat((le=(X=T==null?void 0:T.takeHeld)==null?void 0:X.call(T))!=null?le:[]),T==null||T.dispose()}},[u]),(0,_.useEffect)(()=>{if(!t)return;let w=!1,G=async()=>{if(w)return;let L;try{L=await t.fetchWeights()}catch(T){return}if(!w)for(let T of L){let H={componentId:T.componentId,updatedAt:T.updatedAt,variants:T.variants.map(W=>{var B;return{variantId:W.variantId,pulls:W.pulls,avgReward:(B=W.avgReward)!=null?B:0}})};dn(T.componentId,H)}};G();let V=setInterval(()=>{G()},6e4);return()=>{w=!0,clearInterval(V)}},[t]);let m=(R=e.ssrFallback)!=null?R:"first",S=((C=e.apiBaseUrl)!=null?C:Ln).replace(/\/$/,""),v=(0,_.useRef)(null);(0,_.useEffect)(()=>{var V;if(typeof process!="undefined"&&((V=process.env)==null?void 0:V.NODE_ENV)==="production")return;let w={apiKey:e.apiKey,context:e.context,country:e.country,persona:e.persona,internal:e.internal,apiBaseUrl:S},G=v.current;if(v.current=w,G!==null)for(let L of["apiKey","context","country","persona","internal","apiBaseUrl"])Object.is(G[L],w[L])||console.warn(`[sentient] AdaptiveProvider: \`${L}\` changed after initialisation, but the SDK client is stable for the session and only re-inits on \`consent\` \u2014 the new value is ignored. Remount the provider (e.g. via a changing \`key\` prop) to apply it.`)},[e.apiKey,e.context,e.country,e.persona,e.internal,S]),(0,_.useEffect)(()=>{var w;typeof process!="undefined"&&((w=process.env)==null?void 0:w.NODE_ENV)==="production"||yn({apiKey:e.apiKey,apiBaseUrl:S,isLocal:(t==null?void 0:t.isLocal)===!0})},[t,e.apiKey,S]);let g=(f=e.identity)==null?void 0:f.userId,h=(A=e.identity)==null?void 0:A.userHash,k=(U=e.identity)==null?void 0:U.email;(0,_.useEffect)(()=>{t&&g&&t.identify(g,{userHash:h,email:k})},[t,g,h,k]),(0,_.useEffect)(()=>{let w=e.initialLayoutOrder;if(w&&w.length>0){Gt(w);return}e.declaredSections&&e.declaredSections.length>0&&Gt(e.declaredSections)},[e.initialLayoutOrder,e.declaredSections]),(0,_.useEffect)(()=>{!F()||e.consent!==void 0||e.consentFrom!==void 0||Dn||(Dn=!0,console.warn('[SentientUI] No consent gate: every visitor is tracked from first paint. Pass consentFrom="<your CMP>" (or consent={true} to silence). https://sentient-ui.com/docs#consent'))},[]),(0,_.useEffect)(()=>{if(!F())return;let w=e.declaredSections;if(!w||w.length===0||typeof document=="undefined")return;let G=new Set(Array.from(document.querySelectorAll("[data-sentient-id]"),L=>L.getAttribute("data-sentient-id"))),V=w.filter(L=>!G.has(L));V.length>0&&console.warn(`[SentientUI] Declared section${V.length>1?"s":""} ${V.map(L=>`"${L}"`).join(", ")} ${V.length>1?"have":"has"} no matching data-sentient-id element, so the layout engine cannot learn what they are and will serve the same order to every persona. Add data-sentient-id="<sectionId>" to each section's element.`)},[e.declaredSections]);let O=(0,_.useMemo)(()=>t&&i?mn(t):t,[t,i]),N=(0,_.useMemo)(()=>{var w,G,V,L,T,H,W,B,q;return{client:O,apiKey:e.apiKey,initialAssignments:(w=e.initialAssignments)!=null?w:{},initialUnified:(G=e.initialUnified)!=null?G:ai,sessionSegment:r,ssrFallback:m,onAssignment:e.onAssignment,initialLayoutOrder:(V=e.initialLayoutOrder)!=null?V:null,initialSlots:(L=e.initialSlots)!=null?L:{},initialSlotConfig:(T=e.initialSlotConfig)!=null?T:{},initialPalette:(H=e.initialPalette)!=null?H:null,initialVocabulary:(W=e.initialVocabulary)!=null?W:null,initialPersona:(B=e.initialPersona)!=null?B:null,apiBaseUrl:S,debug:(q=e.debug)!=null?q:!1}},[O,e.apiKey,e.initialAssignments,e.initialUnified,r,m,e.onAssignment,e.initialLayoutOrder,e.initialSlots,e.initialSlotConfig,e.initialPalette,e.initialVocabulary,e.initialPersona,S,e.debug]);return(0,Jn.jsx)(Z.Provider,{value:N,children:e.children})}function j(){return(0,_.useContext)(Z).client}function ie(){return(0,_.useContext)(Z).apiKey}function et(){return(0,_.useContext)(Z).initialAssignments}var ai=[];function tt(){return(0,_.useContext)(Z).initialUnified}function Ie(){return(0,_.useContext)(Z).sessionSegment}function Vn(){return(0,_.useContext)(Z).ssrFallback}function nt(){return(0,_.useContext)(Z).onAssignment}function Mn(){return(0,_.useContext)(Z).debug}function jn(){let e=(0,_.useContext)(Z).initialLayoutOrder,t=(0,_.useSyncExternalStore)(ee,()=>{var n;return typeof window=="undefined"?null:(n=window.__sentient_layout_override)!=null?n:null},()=>null);return t!=null?t:e}function rt(){return(0,_.useContext)(Z).initialSlots}function $n(){return(0,_.useContext)(Z).initialPersona}function Bn(){return(0,_.useContext)(Z).initialSlotConfig}function Un(){return(0,_.useContext)(Z).initialPalette}function Wn(){return(0,_.useContext)(Z).initialVocabulary}function Kn(){return(0,_.useContext)(Z).apiBaseUrl}var me=require("react");var K=require("react"),zn=require("@sentientui/core");var oe=require("react"),it=require("@sentientui/policy");function Se(e){var n;if(typeof window=="undefined")return null;let t=(n=window.__sentient_overrides)==null?void 0:n[e];if(t)return t;if(!window.location.search)return null;try{let r=new URLSearchParams(window.location.search);for(let i of r.getAll("sentient_variant")){let o=i.indexOf(":");if(o!==-1&&i.slice(0,o)===e)return i.slice(o+1)}}catch(r){}return null}function ot(e,t,n,r,i){let o=et(),l=Vn(),a=j(),u=Ie(),s=nt(),y=Mn(),c=(0,oe.useRef)(null),b=(0,oe.useSyncExternalStore)(ee,()=>Se(e),()=>null),x=b&&t.includes(b)?b:null,d=(0,oe.useRef)(null);(0,oe.useEffect)(()=>{y&&x&&d.current!==x&&(d.current=x,console.info(`[sentient] override active: ${e} -> ${x}`))},[y,x,e]);let[m,S]=(0,oe.useState)(()=>{var k,O;if(x)return{variantId:x,content:null,isLoading:!1,settled:!0};if(!a){let N=o[e];return N&&t.includes(N)?{variantId:N,content:null,isLoading:!1,settled:!0}:l==="first"&&t.length>0?{variantId:t[0],content:null,isLoading:!1,settled:!1}:{variantId:null,content:null,isLoading:!0,settled:!1}}let g=a.getAssignment(e,u);if(g&&(t.includes(g.variantId)||g.content))return{variantId:g.variantId,content:(k=g.content)!=null?k:null,isLoading:!1,settled:!0};let h=xt(e);if(h){let N=(0,it.pickFromWeights)(h.variants,t);if(N)return{variantId:N,content:null,isLoading:!1,settled:!0}}return{variantId:(O=t[0])!=null?O:null,content:null,isLoading:!1,settled:!1}}),v=g=>{s&&c.current!==g&&(c.current=g,s(e,g))};return(0,oe.useEffect)(()=>{var k;if(x||!a)return;let g=a.getAssignment(e,u);if(g&&(t.includes(g.variantId)||g.content)){S({variantId:g.variantId,content:(k=g.content)!=null?k:null,isLoading:!1,settled:!0}),v(g.variantId);return}let h=xt(e);if(h&&m.settled&&m.variantId&&m.variantId===(0,it.pickFromWeights)(h.variants,t)){v(m.variantId);return}S(O=>{var N;return O.variantId?O:{variantId:(N=t[0])!=null?N:null,content:null,isLoading:!1,settled:!1}})},[x,a,e,u]),(0,oe.useEffect)(()=>{if(x||!a)return;let g=a.getAssignment(e,u);if(g&&t.includes(g.variantId))return;let h=!1,k=i==null?void 0:i.onUnified;return(k?a.assign(e,t,n,r,{unified:!0}):a.assign(e,t,n,r)).then(N=>{var P;if(!h&&N){if(N.unified===!0){k==null||k();return}!t.includes(N.variantId)&&!N.content||(S({variantId:N.variantId,content:(P=N.content)!=null?P:null,isLoading:!1,settled:!0}),v(N.variantId))}}),()=>{h=!0}},[x,a,e,u]),(0,oe.useEffect)(()=>{if(!x&&a)return cn(e,g=>{var O;let h=a.getAssignment(e,u);if(h&&(t.includes(h.variantId)||h.content)){S({variantId:h.variantId,content:(O=h.content)!=null?O:null,isLoading:!1,settled:!0}),v(h.variantId);return}let k=(0,it.pickFromWeights)(g.variants,t);k&&(S({variantId:k,content:null,isLoading:!1,settled:!0}),v(k))})},[x,a,e,u]),x?{variantId:x,content:null,isLoading:!1,settled:!0,isOverride:!0}:m}var Hn=new Set,Xn=new Map;function Dt(e,t,n,r){let i=r;if(r){let l=Xn.get(t);l&&l!==n?(F()&&console.warn(`[SentientUI] useGoal('${n}'): '${l}' is already primary on this page`),i=!1):Xn.set(t,n)}let o=`${t}|${n}|${i?"primary":""}`;Hn.has(o)||(Hn.add(o),e.track({projectId:t,componentId:"__session__",eventType:"goal_declared",payload:i?{goalId:n,primary:!0}:{goalId:n}}))}function st(e,t,n){e&&!e.gated&&t&&typeof n=="string"&&n&&Dt(e,t,n,!1)}function at(e,t,n){let r=j(),i=ie(),o=Object.keys(t).join("\0"),l=(0,K.useMemo)(()=>Object.keys(t),[o]),{variantId:a,content:u,isOverride:s=!1,settled:y}=ot(e,l,n.agentData,n.agentDataByVariant,n.onUnified?{onUnified:n.onUnified}:void 0),[c,b]=(0,K.useState)(null),x=(0,K.useRef)(null),d=(0,K.useCallback)(f=>{x.current=f,b(f)},[]),m=n.goal,S=typeof m=="string"?m:JSON.stringify(m),v=(0,K.useMemo)(()=>m?ne(m):null,[S]),g=m?ye(m):"";(0,K.useEffect)(()=>Ye({id:e,variantIds:l,goal:g}),[e,l,g]);let h=(0,K.useRef)(null);(0,K.useEffect)(()=>{s||y&&(!r||!a||!i||!c||h.current!==a&&(h.current=a,ve(r,i,e,a)))},[r,a,i,e,c,s,y]);let k=(0,K.useRef)(!1),O=(0,K.useRef)(new Set);(0,K.useEffect)(()=>{k.current=!1,O.current=new Set},[a,v]);let N=n.funnel;(0,K.useEffect)(()=>{s||!y||!r||!v||fe(r,i,e,N,v)},[r,i,e,N,v,s,y]),(0,K.useEffect)(()=>{!s&&y&&st(r,i,m)},[r,i,m,s,y]);let P=n.cursorSignal===!0;(0,K.useEffect)(()=>{if(!P||s||!y||!r||!a||!c)return;let f=null,A=0,U=()=>{A=Date.now(),f=setTimeout(()=>{r.track({projectId:i,componentId:e,variantId:a,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-A}}),f=null},800)},w=()=>{f!==null&&(clearTimeout(f),f=null)};return c.addEventListener("mouseenter",U),c.addEventListener("mouseleave",w),()=>{c.removeEventListener("mouseenter",U),c.removeEventListener("mouseleave",w),f!==null&&clearTimeout(f)}},[P,r,a,i,e,c,s,y]);let R=(0,K.useRef)(n.microSignalGoals);R.current=n.microSignalGoals;let C=n.microSignalGoals?JSON.stringify(n.microSignalGoals):"";return(0,K.useEffect)(()=>{if(s||!y||!r||!a||!c)return;let f=Date.now();return(0,zn.attachMicroSignalDetectors)((A,U={})=>{var T,H,W;r.track({projectId:i,componentId:e,variantId:a,eventType:"micro_signal",payload:p({signalType:A},U)});let w=(T=R.current)==null?void 0:T[A];if(!w||O.current.has(A))return;O.current.add(A);let G=typeof w=="string"?w:w.name,V=typeof w=="string"?1:(H=w.weight)!=null?H:1,L=typeof w=="string"?0:(W=w.stepIndex)!=null?W:0;r.goal(G,{metadata:p({signalType:A},U),weight:V,stepIndex:L})},c,f)},[r,a,i,e,c,C,s,y]),(0,K.useEffect)(()=>{if(s||!y||!r||!a||!c||!v)return;let f=ce(v);return de(c,v,{fireGoal:()=>{k.current||(k.current=!0,r.track({projectId:i,componentId:e,variantId:a,eventType:"goal_achieved",goalType:g,payload:p({reward:1},f!==void 0?{goalValue:f}:{})}),r.goal(g,p({metadata:{componentId:e,variantId:a},weight:1,stepIndex:0},f!==void 0?{value:f}:{})))},fireStep:(A,U,w)=>{r.track({projectId:i,componentId:e,variantId:a,eventType:"goal_achieved",goalType:A,payload:{reward:U}}),r.goal(A,{metadata:{},weight:U,stepIndex:w})}},g)},[r,a,i,e,c,v,g,s,y]),{client:r,variantIds:l,variantId:a,content:u,settled:y,isOverride:s,goalLabel:g,ref:d,nodeRef:x}}var D=require("react"),Ae=require("@sentientui/core"),Ut=require("@sentientui/core/region");var te=require("react"),Yn=require("@sentientui/core");var qn=new Set,li={kind:"arms"};function Zn(e,t){var O,N,P;let n=j(),r=(0,te.useRef)(t==null?void 0:t.baselineText);r.current=t==null?void 0:t.baselineText;let i=(0,te.useRef)(t==null?void 0:t.render);i.current=t==null?void 0:t.render;let o=(0,te.useRef)(t==null?void 0:t.skeleton);o.current=t==null?void 0:t.skeleton;let l=rt(),a=Bn(),u=Un(),s=Wn(),y=(0,te.useSyncExternalStore)(ee,()=>{var R;return typeof window!="undefined"?(R=window.__sentient_slot_config_overrides)==null?void 0:R[e]:void 0},()=>{}),c=(0,te.useSyncExternalStore)(ee,()=>{var R;return typeof window!="undefined"?(R=window.__sentient_slot_overrides)==null?void 0:R[e]:void 0},()=>{}),b=R=>R==null?"":(0,Yn.armOfResult)(R),x=(0,te.useCallback)(R=>{var C,f;return(f=(C=n==null?void 0:n.onSlotsChanged)==null?void 0:C.call(n,R))!=null?f:(()=>{})},[n]);(0,te.useSyncExternalStore)(x,()=>{var R;return(R=n==null?void 0:n.getSlotConfig(e))!=null?R:null},()=>null),(0,te.useSyncExternalStore)(x,()=>b(n==null?void 0:n.getSlotResult(e)),()=>"");let d=y===void 0?a[e]:void 0,m=y===void 0&&d===void 0&&n?n.getSlotConfig(e):null,S=(O=u!=null?u:n==null?void 0:n.getSitePalette())!=null?O:null,v=(P=s!=null?s:(N=n==null?void 0:n.getStyleVocabulary)==null?void 0:N.call(n))!=null?P:null,g=(()=>{var R,C,f;if(y!==void 0)return{config:y,arm:b(c),palette:S,vocabulary:(R=Rn())!=null?R:v,source:"override"};if(t!=null&&t.forcedArm)return{config:li,arm:t.forcedArm,palette:S,vocabulary:v,source:"override"};if(d!==void 0)return{config:d,arm:b((C=l[e])!=null?C:n==null?void 0:n.getSlotResult(e)),palette:S,vocabulary:v,source:"preloaded"};if(m!==null){let A=n!=null&&n.isSlotDecided?n.isSlotDecided(e):!0;return{config:m,arm:b((f=n==null?void 0:n.getSlotResult(e))!=null?f:l[e]),palette:S,vocabulary:v,source:A?"client":"seeded"}}return{config:null,arm:"",palette:S,vocabulary:v,source:"none"}})(),h=(t==null?void 0:t.defer)===!0,k=g.source==="preloaded"||g.source==="override";return(0,te.useEffect)(()=>{var V,L,T,H,W;if(!n||n.isLocal===!0||k||h)return;let R=g.source==="none",C=R&&(L=(V=r.current)==null?void 0:V.call(r))!=null?L:null,f=C!=null&&C!==""?{[e]:C}:void 0,A=(T=i.current)==null?void 0:T.call(i),U=R&&(W=(H=o.current)==null?void 0:H.call(o))!=null?W:null,w=p(p({},A?{render:{[e]:A}}:{}),U?{skeletons:{[e]:U}}:{}),G=Object.keys(w).length>0;return n.requestSlots?G?n.requestSlots([e],f,w):f?n.requestSlots([e],f):n.requestSlots([e]):R&&(U?n.reportSlots([e],f!=null?f:{},{[e]:U}):f?n.reportSlots([e],f):n.reportSlots([e])),()=>{var B;return(B=n.cancelSlots)==null?void 0:B.call(n,[e])}},[n,k,g.source,e,h]),(0,te.useEffect)(()=>{!F()||(n==null?void 0:n.isLocal)!==!0||g.source!=="none"||qn.has(e)||(qn.add(e),console.warn(`[sentient] <Adaptive id="${e}"> is rendering its baseline children: in local/keyless mode <Adaptive> serves ONLY what you pass as \`initialSlotConfig\` (there is no registry to decide from). Pass initialSlotConfig/initialSlots to <AdaptiveProvider> to preview arms locally.`))},[n,g.source,e]),g}var We=require("react");var $=require("react/jsx-runtime");function Lt(e){return typeof e=="string"&&!/[\s\x00-\x1f\\]/.test(e)&&(/^https:\/\//i.test(e)||e[0]==="/"&&e[1]!=="/")?e:void 0}var he={none:"0",sm:"8px",md:"16px",lg:"24px"},Ft={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},nr={sm:"0.875em",md:"1em",lg:"1.25em"},ui={sm:"1.25em",md:"1.5em",lg:"2em"},Qn={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},er={sm:"8px",md:"16px",lg:"32px"},ci={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},di={normal:"400",medium:"500",bold:"700"};function tr(e,t){return p(p({},e==="muted"?t!=null&&t.muted?{color:t.muted}:{opacity:.7}:{}),e==="accent"?p({fontWeight:600},t!=null&&t.accent?{color:t.accent}:{}):{})}function rr(e,t,n){var i,o,l,a;let r=t==null?void 0:t.accent;return M(p({display:"inline-block",padding:(i=Qn[n!=null?n:"md"])!=null?i:Qn.md,borderRadius:(o=t==null?void 0:t.radius)!=null?o:"8px",font:"inherit"},n?{fontSize:nr[n]}:{}),{textDecoration:e==="ghost"?"underline":"none",cursor:"pointer",background:e==="primary"?(l=t==null?void 0:t.primaryBg)!=null?l:"#111827":"transparent",color:e==="primary"?(a=t==null?void 0:t.primaryText)!=null?a:"#ffffff":r!=null?r:"inherit",border:e==="secondary"?`1px solid ${r!=null?r:"currentColor"}`:"none"})}function fi({node:e,opts:t}){var i,o,l,a,u;let n=(i=e.emphasis)!=null?i:"primary",r={padding:"8px 10px",font:"inherit",border:`1px solid ${(l=(o=t.palette)==null?void 0:o.border)!=null?l:"currentColor"}`,borderRadius:(u=(a=t.palette)==null?void 0:a.radius)!=null?u:"8px"};return(0,$.jsxs)("form",{onSubmit:s=>{var b,x,d;s.preventDefault();let y=new FormData(s.currentTarget),c={};for(let m of e.fields)c[m.name]=String((b=y.get(m.name))!=null?b:"");(x=t.onFormGoal)==null||x.call(t,e.submitGoal);try{(d=t.onFormSubmit)==null||d.call(t,c)}catch(m){}},style:{display:"flex",flexDirection:"column",gap:"12px"},children:[e.fields.map(s=>{var y,c;return(0,$.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:"4px",font:"inherit"},children:[s.label,s.kind==="textarea"?(0,$.jsx)("textarea",{name:s.name,required:s.required,placeholder:s.placeholder,rows:3,style:r}):s.kind==="select"?(0,$.jsx)("select",{name:s.name,required:s.required,style:r,children:((y=s.options)!=null?y:[]).map(b=>(0,$.jsx)("option",{value:b,children:b},b))}):(0,$.jsx)("input",{name:s.name,type:(c=s.inputType)!=null?c:"text",required:s.required,placeholder:s.placeholder,style:r})]},s.name)}),(0,$.jsx)("button",{type:"submit",style:rr(n,t.palette),children:e.submitLabel})]})}function gi(e,t){var r,i;let n=e.like;return n?(i=(r=t.vocabulary)==null?void 0:r.entries.find(o=>o.id===n))==null?void 0:i.classes:void 0}function ir(e,t){var r;let n=e?(r=t.vocabulary)==null?void 0:r.entries.find(i=>i.id===e):void 0;return n!=null&&n.computed.inheritsColor?n.computed.color:void 0}function ke(e,t){var i;let n=mi(e,t),r=ir(e.like,t);return n&&r?(0,We.cloneElement)(n,{style:M(p({},(i=n.props.style)!=null?i:{}),{color:r})}):n}function mi(e,t){var n,r,i,o,l,a,u,s,y,c,b,x,d,m,S,v,g,h,k,O,N,P,R;try{let C=gi(e,t);switch(e.type){case"stack":{let f=(r=he[(n=e.gap)!=null?n:"md"])!=null?r:he.md,A=e.surface==="raised"&&!C,U=(i=e.pad)!=null?i:A?"md":void 0;return(0,$.jsx)("div",M(p({},C?{className:C}:{}),{style:p(p(p(p(p({display:"flex",flexDirection:e.direction,gap:f},e.align?{alignItems:Ft[e.align]}:{}),e.justify?{justifyContent:Ft[e.justify]}:{}),e.wrap?{flexWrap:"wrap"}:{}),U?{padding:(o=he[U])!=null?o:he.md}:{}),A?M(p(p({},(l=t.palette)!=null&&l.surface?{background:t.palette.surface}:{}),(a=t.palette)!=null&&a.surface&&((u=t.palette)!=null&&u.surfaceText)?{color:t.palette.surfaceText}:{}),{border:`1px solid ${(y=(s=t.palette)==null?void 0:s.border)!=null?y:"currentColor"}`,borderRadius:(b=(c=t.palette)==null?void 0:c.radius)!=null?b:"8px"}):{}),children:((x=e.children)!=null?x:[]).map((w,G)=>{let V=ke(w,t);return V===null?null:(0,$.jsx)(We.Fragment,{children:V},G)})}))}case"grid":{let f=(m=he[(d=e.gap)!=null?d:"md"])!=null?m:he.md;return(0,$.jsx)("div",M(p({},C?{className:C}:{}),{style:p(p({display:"grid",gridTemplateColumns:`repeat(auto-fit, minmax(max(200px, calc((100% - ${e.columns-1} * ${f}) / ${e.columns})), 1fr))`,gap:f},e.align?{alignItems:Ft[e.align]}:{}),e.pad?{padding:(S=he[e.pad])!=null?S:he.md}:{}),children:((v=e.children)!=null?v:[]).map((A,U)=>{let w=ke(A,t);return w===null?null:(0,$.jsx)(We.Fragment,{children:w},U)})}))}case"text":return C?(0,$.jsx)("p",{className:C,style:e.maxWidth==="measure"?{maxWidth:"65ch"}:void 0,children:e.value}):(0,$.jsx)("p",{style:p(p(p(p(p({margin:0},e.size?{fontSize:nr[e.size]}:{}),e.weight?{fontWeight:di[e.weight]}:{}),e.align?{textAlign:e.align}:{}),e.maxWidth==="measure"?{maxWidth:"65ch"}:{}),tr(e.tone,t.palette)),children:e.value});case"heading":{let f=`h${e.level}`;return C?(0,$.jsx)(f,{className:C,style:e.maxWidth==="measure"?{maxWidth:"65ch"}:void 0,children:e.value}):(0,$.jsx)(f,{style:p(p({margin:0,fontSize:ui[(g=e.size)!=null?g:"md"]},e.align?{textAlign:e.align}:{}),e.maxWidth==="measure"?{maxWidth:"65ch"}:{}),children:e.value})}case"button":{let f=(h=e.emphasis)!=null?h:"primary";return(0,$.jsx)("a",M(p(p({href:Lt(e.href)},e.tag?{"data-sentient-tag":e.tag}:{}),C?{className:C}:{style:rr(f,t.palette,e.size)}),{children:e.label}))}case"link":return(0,$.jsx)("a",M(p(p({href:Lt(e.href)},e.tag?{"data-sentient-tag":e.tag}:{}),C?{className:C}:{style:{color:"inherit",textDecoration:"underline"}}),{children:e.label}));case"image":return(0,$.jsx)("img",M(p({src:Lt(e.src),alt:e.alt},C?{className:C}:{}),{style:p(p({display:"block",maxWidth:"100%"},e.ratio&&e.ratio!=="auto"?{aspectRatio:ci[e.ratio],width:"100%"}:{}),e.fit?{objectFit:e.fit}:{})}));case"badge":return C?(0,$.jsx)("span",{className:C,children:e.value}):(0,$.jsx)("span",{style:p({display:"inline-block",padding:"2px 10px",borderRadius:"999px",fontSize:"0.75em",border:`1px solid ${(O=(k=t.palette)==null?void 0:k.border)!=null?O:"currentColor"}`},tr(e.tone,t.palette)),children:e.value});case"spacer":return(0,$.jsx)("div",{style:{height:(N=er[e.size])!=null?N:er.md}});case"divider":return(0,$.jsx)("hr",{style:{border:"none",borderTop:`1px solid ${(R=(P=t.palette)==null?void 0:P.border)!=null?R:"currentColor"}`,margin:0,width:"100%"}});case"form":return(0,$.jsx)(fi,{node:e,opts:t});default:return null}}catch(C){return null}}function lt(e,t){var o,l,a,u;let n=ke(e.tree,t);if(n===null)return null;let r=(o=e.surface)!=null&&o.like?(a=(l=t.vocabulary)==null?void 0:l.entries.find(s=>s.id===e.surface.like))==null?void 0:a.classes:void 0,i=ir((u=e.surface)==null?void 0:u.like,t);return r?(0,$.jsx)("div",M(p({className:r},i?{style:{color:i}}:{}),{children:n})):n}var ge=require("react"),ut=require("@sentientui/core/region");function ct(e){return typeof e=="string"&&e.trim()!==""||typeof e=="number"}function dt(e){let t=e.props;if(t.dangerouslySetInnerHTML==null)return t.children}function Re(e){return ct(e)?1:Array.isArray(e)?e.reduce((t,n)=>t+Re(n),0):(0,ge.isValidElement)(e)?Re(dt(e)):0}function pi(e,t){return Array.isArray(t)?(0,ge.cloneElement)(e,void 0,...t):(0,ge.cloneElement)(e,void 0,t)}function Vt(e,t){if(ct(e))return t;if(Array.isArray(e))return e.map(n=>Vt(n,t));if((0,ge.isValidElement)(e)){let n=dt(e);return Re(n)===0?e:pi(e,Vt(n,t))}return e}function or(e,t){return Re(e)===1?Vt(e,t):null}var re=e=>e.join("/");function Mt(e,t,n){if(ct(e)){n.leafPaths.push(t),n.texts.push((0,ut.normalizeLeafText)(String(e)));return}if(Array.isArray(e)){e.forEach((r,i)=>Mt(r,[...t,i],n));return}(0,ge.isValidElement)(e)&&(n.elements.set(re(t),e),Mt(dt(e),[...t,"c"],n))}function $t(e){let t={leafPaths:[],texts:[],elements:new Map};return Mt(e,[],t),t}function yi(e){return $t(e).texts}function sr(e){let t=yi(e);return t.length===0?null:(0,ut.skeletonFingerprint)(t)}function vi(e){let t=[];return e.forEach((n,r)=>{n==="c"&&t.push(e.slice(0,r))}),t}function ar(e,t){let n=t.reduce((i,o)=>Math.max(i,o+1),0),r=[];for(let i=0;i<n;i++){let o=t.flatMap((a,u)=>a===i?[vi(e.leafPaths[u])]:[]);if(o.length===0){r.push(null);continue}let l=o[0];for(let a of o.slice(1)){let u=new Set(a.map(re));l=l.filter(s=>u.has(re(s)))}r.push(l.length>0?l[l.length-1]:null)}return r}function jt(e){var n;let t=(n=e==null?void 0:e.props)==null?void 0:n.className;return typeof t=="string"?t:void 0}function Bt(e,t){let n=$t(t);if(n.texts.length!==e.leaves.length||n.texts.some((o,l)=>o!==e.leaves[l]))return null;let r=ar(n,e.leafToNode),i=e.nodes.map((o,l)=>{let a=r[l],u=a?n.elements.get(re(a)):void 0,s=!!u&&(typeof u.type=="string"||jt(u)!==void 0);return M(p({},o),{restylable:s})});return M(p({},e),{nodes:i})}function lr(e,t,n){var d;let r=$t(e);if(r.leafPaths.length!==n.length)return null;let i=n.reduce((m,S)=>Math.max(m,S+1),0);for(let m of Object.keys(t.nodes))if(!/^\d+$/.test(m)||Number(m)>=i)return null;let o=ar(r,n),l=new Map;n.forEach((m,S)=>{l.has(m)||l.set(m,S)});let a=new Map(r.leafPaths.map((m,S)=>[re(m),S])),u=new Set,s=new Map,y=!1;for(let[m,S]of Object.entries(t.nodes)){let v=Number(m),g=o[v];if(S.hidden&&(g?u.add(re(g)):y=!0),S.like!==void 0){let h=o[S.like],k=g?r.elements.get(re(g)):void 0,O=h?jt(r.elements.get(re(h))):void 0;!g||O===void 0||jt(k)===void 0?y=!0:s.set(re(g),O)}}let c=new Map(Object.entries((d=t.order)!=null?d:{})),b=(m,S)=>{var v;if(ct(m)){let g=a.get(re(S));if(g===void 0)return m;let h=n[g],k=(v=t.nodes[String(h)])==null?void 0:v.text;return k===void 0?m:l.get(h)===g?k:""}if(Array.isArray(m)){let g=m.map((h,k)=>b(h,[...S,k]));for(let[h,k]of c){let O=k.map(R=>{let C=o[R];return!C||C.length!==S.length+1||re(C.slice(0,-1))!==re(S)?-1:C[C.length-1]});if(O.some(R=>R<0))continue;let N=[...O].sort((R,C)=>R-C),P=[...g];N.forEach((R,C)=>{g[R]=P[O[C]]}),c.delete(h)}return g}if((0,ge.isValidElement)(m)){let g=re(S);if(u.has(g))return null;let h=dt(m);if(Re(h)===0)return m;let k=b(h,[...S,"c"]),O=s.get(g),N=O!==void 0?{className:O}:void 0;return Array.isArray(k)?(0,ge.cloneElement)(m,N,...k):(0,ge.cloneElement)(m,N,k)}return m},x=b(e,[]);return y||c.size>0?null:x}var fr=require("react/jsx-runtime"),ur=new Set,cr=new Set,dr=new Set,ft="authored.";function De({id:e,children:t,variants:n,onFormSubmit:r,goal:i,className:o,as:l="div",reportBaselineText:a=!0,funnel:u,microSignalGoals:s,clientOnly:y,agentDataByVariant:c,agentData:b,variantsOnly:x=!1}){var en,tn;let d=j(),m=ie(),S=(0,D.useRef)(null),[v,g]=(0,D.useState)(!1);(0,D.useEffect)(()=>{g(!0)},[]);let h=y===!0&&(!v||!d),k=(0,D.useMemo)(()=>sr(t),[t]),O=n?Object.keys(n).join("|"):"",N=(0,D.useMemo)(()=>p({fp:k!=null?k:"0000000000000000",forms:!!r,compose:!0,content:Re(t)===1,ops:!1},O!==""?{authored:O.split("|"),children:!x}:{}),[k,t,r,O,x]),P=()=>{var Y;let E=S.current;if(!E||!a)return null;let I=(0,Ut.captureRegionSkeleton)(E);return I.skeleton?(Y=Bt(I.skeleton,t))!=null?Y:M(p({},I.skeleton),{editable:!1,nodes:I.skeleton.nodes.map(J=>M(p({},J),{restylable:!1}))}):{status:I.reason}},R=(0,D.useSyncExternalStore)(ee,()=>n?Se(e):null,()=>null),C=R===null||!n?null:Object.prototype.hasOwnProperty.call(n,R)?`${ft}${R}`:x?`${ft}${Object.keys(n)[0]}`:"baseline",{config:f,arm:A,palette:U,vocabulary:w,source:G}=Zn(e,{forcedArm:C,baselineText:a?()=>{var E,I;return(I=(E=S.current)==null?void 0:E.textContent)!=null?I:null}:void 0,render:()=>N,skeleton:P,defer:h}),V=A!==""?(en=f==null?void 0:f.blocks)==null?void 0:en[A]:void 0,L=A!==""?(tn=f==null?void 0:f.compose)==null?void 0:tn[A]:void 0,T=(V!==void 0&&(0,Ae.containsFormBlock)(V)||L!==void 0&&(0,Ae.containsFormBlock)(L.tree))&&!r;(0,D.useEffect)(()=>{!T||!F()||ur.has(e)||(ur.add(e),console.warn(`[sentient] AdaptiveSlot "${e}" was served a form arm but has no onFormSubmit handler \u2014 rendering its baseline children instead. Pass onFormSubmit to render generated forms.`))},[T,e]);let H=E=>{!d||G==="override"||(G!=="seeded"&&d.componentGoal(e,E),d.goal(E,{metadata:{componentId:e,arm:A},weight:1,stepIndex:0}))},W=t,B=!1,q=A.startsWith(ft)?A.slice(ft.length):null;if((f==null?void 0:f.blocked)==="variant_history")B=!0;else if(q!==null)n&&Object.prototype.hasOwnProperty.call(n,q)?W=n[q]:B=!0;else if(L!==void 0){let E=T?null:lt(L,{palette:U,vocabulary:w,onFormSubmit:r,onFormGoal:H});E===null?B=!0:W=E}else if(V!==void 0){let E=T?null:ke(V,{palette:U,vocabulary:w,onFormSubmit:r,onFormGoal:H});E===null?B=!0:W=E}else if((f==null?void 0:f.edits)!==void 0&&G!=="none"){let E=f.edits,I=E.fp===k?lr(t,E.edits,E.leafToNode):null;I===null?B=!0:W=I}else if((f==null?void 0:f.content)!==void 0&&G!=="none"){let E=or(t,f.content);E===null?B=!0:W=E}let Ve=B&&V===void 0&&L===void 0&&(f==null?void 0:f.edits)===void 0&&q===null&&(f==null?void 0:f.blocked)===void 0;(0,D.useEffect)(()=>{(f==null?void 0:f.blocked)!=="variant_history"||!F()||dr.has(e)||(dr.add(e),console.warn(`[sentient] <Adaptive id="${e}"> has results from its earlier variants experiment, so it is showing your original until you migrate it: Components \u2192 "${e}" \u2192 Migrate. Deploying code never switches an experiment.`))},[f==null?void 0:f.blocked,e]);let X=q!==null&&!B?q:null;(0,D.useEffect)(()=>{var ue;if(!X||!a||!d)return;let E=S.current;if(!E)return;let I=(0,Ut.captureRegionSkeleton)(E),Y=I.skeleton?Bt(I.skeleton,n==null?void 0:n[X]):null,J=(ue=E.textContent)==null?void 0:ue.trim();d.reportSlots([],void 0,void 0,{[e]:[p(p({key:X},J?{text:J}:{}),Y?{skeleton:Y}:{})]})},[X,d,e,h]);let le=B&&(f==null?void 0:f.edits)!==void 0&&(G==="preloaded"||G==="client");(0,D.useEffect)(()=>{var E;!le||!(f!=null&&f.edits)||(E=d==null?void 0:d.reportDrift)==null||E.call(d,e,f.edits.fp,k,f.edits.fp===k?"unaddressable":"fp_mismatch")},[le,e,k,d]);let Me=W===t;(0,D.useEffect)(()=>{var I;if(!(f!=null&&f.needsSkeleton)||!Me)return;let E=P();E&&((I=d==null?void 0:d.reportSkeleton)==null||I.call(d,e,E))},[f==null?void 0:f.needsSkeleton,Me,e,d,h]),(0,D.useEffect)(()=>{if(!Me)return;let E=En(e);if(!E)return;let I=P();Pn(E,I&&"status"in I?{status:I.status}:{skeleton:I})},[e,Me,h]),(0,D.useEffect)(()=>{!Ve||!F()||cr.has(e)||(cr.add(e),console.warn(`[sentient] <Adaptive id="${e}"> was served a text version, but its children have several separate texts or none Sentient can reach \u2014 rendering the original instead. Regenerate the version (new versions edit each text in place), or put a single text inline.`))},[Ve,e]);let yt=f!=null&&f.blocks?Object.keys(f.blocks).sort().join("|"):"",vt=n?[...x?[]:["baseline"],...O.split("|")].join("|"):"";(0,D.useEffect)(()=>vt!==""?Ye({id:e,variantIds:vt.split("|")}):Ge({id:e,arms:yt===""?void 0:yt.split("|")}),[e,yt,vt]);let Xt=(0,D.useRef)(null);(0,D.useEffect)(()=>{!d||G==="none"||G==="seeded"||G==="override"||A===""||B||Xt.current!==A&&(Xt.current=A,ve(d,m,e,A))},[d,m,e,A,G,B]);let pe=G!=="none"&&G!=="seeded"&&!B,St=pe?A:"",zt=i===void 0?null:typeof i=="string"?i:JSON.stringify(i);(0,D.useEffect)(()=>{G!=="override"&&st(d,m,i)},[d,m,i,G]),(0,D.useEffect)(()=>{if(!d||!i||G==="override")return;let E=S.current;if(!E)return;let I=ye(i),Y=ce(i),J=!1;return de(E,ne(i),{fireGoal:()=>{J||(J=!0,pe&&(Y!==void 0?d.componentGoal(e,I,{value:Y}):d.componentGoal(e,I)),d.goal(I,p({metadata:{componentId:e,arm:St},weight:1,stepIndex:0},Y!==void 0?{value:Y}:{})))},fireStep:(ue,Xe,bt)=>{pe&&d.componentGoal(e,ue,{reward:Xe}),d.goal(ue,{metadata:{componentId:e,arm:St},weight:Xe,stepIndex:bt})}},I)},[d,e,zt,A,G,B,pe,St,h]);let ht=(0,D.useMemo)(()=>i?ne(i):null,[zt]);(0,D.useEffect)(()=>{G==="override"||!d||!ht||fe(d,m,e,u,ht)},[d,m,e,u,ht,G]);let qt=(0,D.useRef)(s);qt.current=s;let Yt=(0,D.useRef)(new Set),Mr=s?JSON.stringify(s):"";(0,D.useEffect)(()=>{if(!d||G==="override"||!pe||A==="")return;let E=S.current;if(E)return(0,Ae.attachMicroSignalDetectors)((I,Y={})=>{var nn,rn,on;d.track({projectId:m,componentId:e,variantId:A,eventType:"micro_signal",payload:p({signalType:I},Y)});let J=(nn=qt.current)==null?void 0:nn[I];if(!J||Yt.current.has(I))return;Yt.current.add(I);let ue=typeof J=="string"?J:J.name,Xe=typeof J=="string"?1:(rn=J.weight)!=null?rn:1,bt=typeof J=="string"?0:(on=J.stepIndex)!=null?on:0;d.goal(ue,{metadata:p({componentId:e,arm:A,signalType:I},Y),weight:Xe,stepIndex:bt})},E,Date.now())},[d,m,e,A,G,pe,Mr,h]);let Zt=(0,D.useRef)({agentData:b,agentDataByVariant:c});Zt.current={agentData:b,agentDataByVariant:c};let Qt=(0,D.useRef)(null);(0,D.useEffect)(()=>{var ue;if(!d||G==="override"||!pe||A===""||Qt.current===A)return;let{agentData:E,agentDataByVariant:I}=Zt.current,Y=q!=null?q:A,J=I!==void 0?Object.prototype.hasOwnProperty.call(I,Y)?I[Y]:void 0:E;J!==void 0&&(Qt.current=A,(ue=d.reportAgentData)==null||ue.call(d,e,A,J))},[d,e,A,pe,q,G]);let He=(0,D.useRef)(null);(0,D.useEffect)(()=>{let E=S.current;if(E){if(He.current===null){He.current=A;return}He.current!==A&&(He.current=A,(0,Ae.reveal)(E))}},[A,h]);let jr=(0,D.useMemo)(()=>p({"data-sentient-slot":e},A!==""?{"data-sentient-arm":A}:{}),[e,A]);return h?null:(0,fr.jsx)(l,M(p({ref:S,className:o},jr),{children:W}))}var Ce=require("react/jsx-runtime");function Si(e){var y,c;let{client:t,variantId:n,content:r,ref:i}=at(e.id,e.variants,{goal:e.goal,funnel:e.funnel,microSignalGoals:e.microSignalGoals,agentData:e.agentData,agentDataByVariant:e.agentDataByVariant,cursorSignal:!0,onUnified:e.onUnified}),[o,l]=(0,me.useState)(!1);(0,me.useEffect)(()=>{l(!0)},[]);let a=(y=e.as)!=null?y:"div";if(e.clientOnly&&(!o||!t)||!n)return null;let u=(c=e.variants[n])!=null?c:null,s=u===null?r:null;return F()&&u===null&&s===null&&console.warn(`[sentient] <Adaptive id="${e.id}"> was assigned variant "${n}" but no matching key exists in props.variants. If this is a dashboard-managed text variant, use <AdaptiveText id="${e.id}"> instead.`),(0,Ce.jsx)(a,{ref:i,className:e.className,"data-sentient-id":e.id,"data-sentient-variant":n,children:u!=null?u:s})}var hi=(0,me.memo)(Si,(e,t)=>{if(e.id!==t.id||e.goal!==t.goal&&JSON.stringify(e.goal)!==JSON.stringify(t.goal)||e.microSignalGoals!==t.microSignalGoals||e.funnel!==t.funnel||e.clientOnly!==t.clientOnly||e.as!==t.as||e.className!==t.className||e.agentData!==t.agentData||e.agentDataByVariant!==t.agentDataByVariant||e.onUnified!==t.onUnified)return!1;if(e.variants===t.variants)return!0;let n=Object.keys(e.variants),r=Object.keys(t.variants);return n.length!==r.length?!1:n.every(i=>i in t.variants&&Object.is(e.variants[i],t.variants[i]))});function gr(e){if(e.variants===void 0)return(0,Ce.jsx)(De,p({},e));let t=e;if(t.children!=null){let n=t,{variants:r}=n,i=$e(n,["variants"]);return(0,Ce.jsx)(De,M(p({},i),{children:t.children,variants:r}))}return(0,Ce.jsx)(bi,p({},t))}function bi(e){var c;let[t,n]=(0,me.useState)(null),{id:r}=e,i=(0,me.useCallback)(()=>n(r),[r]),o=j(),l=tt().includes(r)||((c=o==null?void 0:o.isUnified)==null?void 0:c.call(o,r))===!0;if(t!==r&&!l)return(0,Ce.jsx)(hi,M(p({},e),{onUnified:i}));let b=e,{variants:a,children:u}=b,s=$e(b,["variants","children"]),y=Object.keys(a)[0];return(0,Ce.jsx)(De,M(p({},s),{variants:a,variantsOnly:!0,children:y!==void 0?a[y]:null}))}var z=require("react");var pr=require("react/jsx-runtime");function mr({id:e,default:t,component:n="span",className:r,goal:i}){var N;let o=j(),l=ie(),a=nt(),u=Ie(),s=(0,z.useRef)(null),y=(0,z.useRef)(null),c=(0,z.useSyncExternalStore)(ee,()=>Se(e),()=>null),[b,x]=(0,z.useState)(()=>{var P,R;return(R=(P=o==null?void 0:o.getAssignment(e,u))==null?void 0:P.content)!=null?R:null}),[d,m]=(0,z.useState)(()=>{var P,R;return(R=(P=o==null?void 0:o.getAssignment(e,u))==null?void 0:P.variantId)!=null?R:null});(0,z.useEffect)(()=>{if(c||!o)return;let P=o.getAssignment(e,u);if((P==null?void 0:P.content)!==void 0){m(P.variantId),x(P.content);return}let R=!1;return o.assign(e).then(C=>{if(!R){if(!C){F()&&console.warn(`[sentient] <AdaptiveText id="${e}"> assignment failed \u2014 showing default text.`);return}m(C.variantId),C.content&&x(C.content)}}),()=>{R=!0}},[o,e,u,c]),(0,z.useEffect)(()=>{c||!o||!d||!l||s.current!==d&&(s.current=d,o.track({projectId:l,componentId:e,variantId:d,eventType:"variant_assigned",payload:{}}),a==null||a(e,d))},[o,d,l,e,a,c]);let S=i===void 0?"":typeof i=="string"?i:JSON.stringify(i),v=(0,z.useMemo)(()=>i===void 0?null:ne(i),[S]),g=i===void 0?null:typeof i=="string"?i:v.type,h=(0,z.useRef)(!1);(0,z.useEffect)(()=>{h.current=!1},[d,S]),(0,z.useEffect)(()=>{c||!o||!l||fe(o,l,e,void 0,v)},[o,l,e,v,c]),(0,z.useEffect)(()=>{if(c||!o||!d||!l||!v||!g)return;let P=y.current;if(!P)return;let R=ce(v);return de(P,v,{fireGoal:()=>{h.current||(h.current=!0,o.track({projectId:l,componentId:e,variantId:d,eventType:"goal_achieved",goalType:g,payload:p({reward:1},R!==void 0?{goalValue:R}:{})}),o.goal(g,p({metadata:{componentId:e,variantId:d},weight:1,stepIndex:0},R!==void 0?{value:R}:{})))},fireStep:(C,f,A)=>{o.track({projectId:l,componentId:e,variantId:d,eventType:"goal_achieved",goalType:C,payload:{reward:f}}),o.goal(C,{metadata:{},weight:f,stepIndex:A})}})},[o,d,l,e,v,g,c]);let k=b!=null?b:t;if(c){let P=o==null?void 0:o.getAssignment(e,u);k=P&&P.variantId===c&&(N=P.content)!=null?N:t}return(0,pr.jsx)(n,{ref:P=>{y.current=P},className:r,children:k})}var gt=require("react");function Ke(e){var t,n;return p(p(p({metadata:(t=e==null?void 0:e.metadata)!=null?t:{},weight:(n=e==null?void 0:e.reward)!=null?n:1,stepIndex:0},(e==null?void 0:e.value)!==void 0?{value:e.value}:{}),(e==null?void 0:e.currency)!==void 0?{currency:e.currency}:{}),(e==null?void 0:e.externalId)!==void 0?{externalId:e.externalId}:{})}function Le(e){let t=j(),n=(0,gt.useRef)(new Set);return(0,gt.useCallback)((r,i)=>{if(!Se(e)){if(i!=null&&i.once){if(n.current.has(r))return;n.current.add(r)}t==null||t.componentGoal(e,r,i),t==null||t.goal(r,Ke(i))}},[t,e])}var Je=require("react");function yr(e,t={}){let u=t,{componentId:n}=u,r=$e(u,["componentId"]),i=j(),o=Le(n!=null?n:""),l=(0,Je.useRef)(!1),a=(0,Je.useRef)(r);a.current=r,(0,Je.useEffect)(()=>{if(!(!i||l.current||i.gated)){if(l.current=!0,n){o(e,a.current);return}i.goal(e,Ke(a.current))}},[i,n,e,o])}var Fe=require("react");function vr(e,t={}){let{primary:n=!1,componentId:r}=t,i=j(),o=ie(),l=Le(r!=null?r:""),a=(0,Fe.useRef)(!1);return(0,Fe.useEffect)(()=>{!i||i.gated||!o||Dt(i,o,e,n)},[i,o,e,n]),(0,Fe.useCallback)(u=>{if(u!=null&&u.once){if(a.current)return;a.current=!0}if(r){l(e,u);return}i==null||i.goal(e,Ke(u))},[i,r,l,e])}var Sr=require("@sentientui/core"),hr=require("@sentientui/policy"),wr=require("react/jsx-runtime");function Wt(e){return JSON.stringify(e).replace(/</g,"\\u003c")}function wi(e){return e.persona?"(function(){try{var d=document.documentElement;"+(e.stage?'if(!d.hasAttribute("data-sentient-stage"))d.setAttribute("data-sentient-stage",'+Wt(e.stage)+");":"")+'if(d.hasAttribute("data-sentient-persona"))return;d.setAttribute("data-sentient-persona",'+Wt(e.persona.persona)+');d.setAttribute("data-sentient-confidence",'+Wt((0,hr.confidenceBand)(e.persona.confidence))+");}catch(e){}})();":(0,Sr.renderPrePaintScript)(e.apiKey,e.stageAttributes?{stage:!0}:void 0)}function br(e){return!e.persona&&(e.consent===!1||e.consentFrom!==void 0&&e.consent!==!0)?null:(0,wr.jsx)("script",{"data-sentient-persona-script":"",nonce:e.nonce,dangerouslySetInnerHTML:{__html:wi(e)}})}var ae=require("react"),Ar=require("@sentientui/policy");var se=require("react"),_e=require("@sentientui/core"),xr=require("@sentientui/policy");function mt(e,t){let n=j(),r=rt(),[,i]=(0,se.useReducer)(c=>c+1,0),o=(0,se.useSyncExternalStore)(ee,()=>{var c;return typeof window!="undefined"?(c=window.__sentient_slot_overrides)==null?void 0:c[e]:void 0},()=>{}),l=o===void 0?r[e]:void 0,a=o===void 0&&l===void 0&&n?n.getSlotResult(e):null,u=(n==null?void 0:n.isLocal)===!0&&o===void 0&&l===void 0&&a===null;(0,se.useEffect)(()=>{if(!u||!n)return;let c=!1;return n.decide({slots:[t]}).then(b=>{!c&&b&&i()}),()=>{c=!0}},[n,e,u]);let s=(()=>{if(o!==void 0)return{result:o,arm:(0,_e.armOfResult)(o),source:"override"};if(l!==void 0)return{result:l,arm:(0,_e.armOfResult)(l),source:"preloaded"};if(a!==null){let b=n!=null&&n.isSlotDecided?n.isSlotDecided(e):!0;return{result:a,arm:(0,_e.armOfResult)(a),source:b?"client":"seeded"}}let c=(0,_e.baselineResultFor)(t);return{result:c,arm:(0,_e.armOfResult)(c),source:"baseline"}})(),y=s.source==="preloaded"||s.source==="override";return(0,se.useEffect)(()=>{var b;if(!n||n.isLocal===!0||y||!n.decideSlots)return;let c=(b=n.onSlotsChanged)==null?void 0:b.call(n,i);return n.decideSlots([t]),()=>{var x;(x=n.cancelSlots)==null||x.call(n,[e]),c==null||c()}},[n,e,y]),s}function xi(){var t;if(typeof window=="undefined")return null;let e=window.__sentient_persona_override;if(e!=null&&e.persona)return{persona:e.persona,confidence:(t=e.confidence)!=null?t:1};try{let n=new URLSearchParams(window.location.search).get("sentient_persona");if(n)return{persona:n,confidence:1}}catch(n){}return null}function kr(){let e=j(),t=$n();(0,se.useSyncExternalStore)(ee,pn,()=>0);let[n,r]=(0,se.useState)(!1);(0,se.useEffect)(()=>r(!0),[]);let i=a=>({persona:a.persona,confidence:a.confidence,band:(0,xr.confidenceBand)(a.confidence)});if(!n)return t?i(t):null;let o=xi();if(o)return i(o);if(t)return i(t);let l=e?e.getPersona():null;return l?i(l):null}var Rr=new Set;function ki(e){return typeof CSS!="undefined"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/[\\"]/g,"\\$&")}function Cr(e,t,n){let r=j(),i=ie(),o=JSON.stringify(t),l=(0,ae.useMemo)(()=>({id:e,dims:t}),[e,o]),{result:a,arm:u,source:s}=mt(e,l),y=(0,ae.useMemo)(()=>typeof a=="string"?{}:a,[u]);if(F()&&!Rr.has(e)){Rr.add(e);let m=(0,Ar.validateSlotDecl)({id:e,dims:Object.fromEntries(Object.entries(t).map(([v,g])=>[v,[...g]]))}),S=Object.values(t).reduce((v,g)=>v*g.length,1);m.ok?S>4&&console.warn(`[sentient] useAdaptiveTokens("${e}") declares ${S} combinations \u2014 more than the recommended 4. Each extra combination needs more traffic to learn; consider fewer dims/values.`):console.warn(`[sentient] useAdaptiveTokens("${e}"): invalid declaration \u2014 ${m.reason}. Serving baseline.`)}let c=(n==null?void 0:n.goal)===void 0?null:typeof n.goal=="string"?n.goal:JSON.stringify(n.goal);(0,ae.useEffect)(()=>Ge({id:e,dims:t}),[e]);let b=(0,ae.useRef)(null);(0,ae.useEffect)(()=>{!r||s==="baseline"||s==="seeded"||s==="override"||b.current===u||(b.current=u,ve(r,i,e,u))},[r,i,e,u,s]);let x=n==null?void 0:n.funnel;(0,ae.useEffect)(()=>{var m;!r||s==="override"||fe(r,i,e,x,ne((m=n==null?void 0:n.goal)!=null?m:"click"))},[r,i,e,x,c,s]),(0,ae.useEffect)(()=>{if(!r||!(n!=null&&n.goal)||s==="override"||s==="baseline"||s==="seeded")return;let m=document.querySelector(`[data-sentient-slot="${ki(e)}"]`);if(!m){F()&&console.warn(`[sentient] useAdaptiveTokens("${e}"): a goal is declared but no element carries the returned props \u2014 spread {...props} on the slot's element.`);return}let S=ye(n.goal),v=ce(n.goal),g=!1;return de(m,ne(n.goal),{fireGoal:()=>{g||(g=!0,v!==void 0?r.componentGoal(e,S,{value:v}):r.componentGoal(e,S),r.goal(S,p({metadata:{componentId:e,arm:u},weight:1,stepIndex:0},v!==void 0?{value:v}:{})))},fireStep:(h,k,O)=>{r.componentGoal(e,h,{reward:k}),r.goal(h,{metadata:{componentId:e,arm:u},weight:k,stepIndex:O})}},S)},[r,e,c,u,s]);let d=(0,ae.useMemo)(()=>{let m={"data-sentient-slot":e};for(let[S,v]of Object.entries(y))m[`data-${S}`]=v;return m},[e,y]);return{tokens:y,props:d}}var Oe=require("react");var _r=new Set,Or=new Set;function Gr(e,t){var d,m;if(F()&&!t.goal)throw new Error(`[sentient] useAdaptive("${e}"): a goal is required \u2014 without one the optimizer accumulates exposures with no rewards and cannot learn. Pass e.g. goal: 'buy_click'.`);let{client:n,variantIds:r,variantId:i,isOverride:o,goalLabel:l,ref:a,nodeRef:u}=at(e,t.variants,{goal:t.goal,funnel:t.funnel,microSignalGoals:t.microSignalGoals}),s=(d=i!=null?i:r[0])!=null?d:"",y=t.variants[s],c=tt().includes(e)||((m=n==null?void 0:n.isUnified)==null?void 0:m.call(n,e))===!0;(0,Oe.useEffect)(()=>{!c||!F()||Or.has(e)||(Or.add(e),console.warn(`[sentient] useAdaptive("${e}"): this component was moved to the shared track, which useAdaptive cannot render yet. It keeps showing the frozen result and learns nothing \u2014 render it with <Adaptive id="${e}" variants={...}> instead.`))},[c,e]),(0,Oe.useEffect)(()=>{if(!F()||!n)return;let S=setTimeout(()=>{!u.current&&!_r.has(e)&&(_r.add(e),console.warn(`[sentient] useAdaptive("${e}"): bind was never attached \u2014 spread {...bind} on the rendered element, otherwise exposure and goal tracking cannot work and the optimizer learns nothing.`))},0);return()=>clearTimeout(S)},[n,e]);let b=(0,Oe.useCallback)((S,v)=>{var h,k;if(o)return;let g=S!=null?S:l;g&&(n==null||n.componentGoal(e,g,v),n==null||n.goal(g,p(p(p({metadata:(h=v==null?void 0:v.metadata)!=null?h:{},weight:(k=v==null?void 0:v.reward)!=null?k:1,stepIndex:0},(v==null?void 0:v.value)!==void 0?{value:v.value}:{}),(v==null?void 0:v.currency)!==void 0?{currency:v.currency}:{}),(v==null?void 0:v.externalId)!==void 0?{externalId:v.externalId}:{})))},[n,e,l,o]),x=(0,Oe.useMemo)(()=>({ref:a,"data-sentient-id":e,"data-sentient-variant":s}),[a,e,s]);return{variant:s,value:y,bind:x,fireGoal:b}}var Q=require("react");var Pr=require("react/jsx-runtime"),pt=new Set;function Er(e){var g;let t=j(),n=ie(),r=(0,Q.useRef)(null),i=Object.keys(e.arrangements).join(" "),o=(0,Q.useMemo)(()=>Object.keys(e.arrangements),[i]),l=(0,Q.useMemo)(()=>p({id:e.id,arms:o},e.baseline!==void 0?{baseline:e.baseline}:{}),[e.id,o,e.baseline]),{arm:a,source:u}=mt(e.id,l);F()&&e.baseline!==void 0&&e.baseline!==o[0]&&!pt.has(e.id+":baseline")&&(pt.add(e.id+":baseline"),console.warn(`[sentient] <AdaptiveGroup id="${e.id}">: baseline "${e.baseline}" is not the first-declared arrangement ("${o[0]}"). The first arrangement should usually be the page's real incumbent (the holdout sees it).`));let s=Q.Children.toArray(e.children).filter(Q.isValidElement),y=new Map;for(let h of s)y.set(String((g=h.key)!=null?g:"").replace(/^\.\$/,""),h);let c=e.arrangements[a],b=c!==void 0&&c.length===s.length&&c.every(h=>y.has(h));F()&&c!==void 0&&!b&&!pt.has(e.id+":keys")&&(pt.add(e.id+":keys"),console.warn(`[sentient] <AdaptiveGroup id="${e.id}">: arrangement "${a}" [${c.join(", ")}] does not match the children's keys \u2014 rendering declaration order (fail-safe).`));let x=b?c.map(h=>y.get(h)):s;(0,Q.useEffect)(()=>Ge({id:e.id,arms:Object.keys(e.arrangements)}),[e.id]);let d=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{!t||u==="baseline"||u==="seeded"||u==="override"||d.current===a||(d.current=a,ve(t,n,e.id,a))},[t,n,e.id,a,u]);let m=e.funnel,S=e.goal===void 0||typeof e.goal=="string"?"":JSON.stringify(e.goal);(0,Q.useEffect)(()=>{var h;!t||u==="override"||fe(t,n,e.id,m,ne((h=e.goal)!=null?h:"click"))},[t,n,e.id,m,S,u]);let v=e.goal===void 0?null:typeof e.goal=="string"?e.goal:JSON.stringify(e.goal);return(0,Q.useEffect)(()=>{if(!t||e.goal===void 0||u==="override"||u==="baseline"||u==="seeded")return;let h=r.current;if(!h)return;let k=ye(e.goal),O=ce(e.goal),N=!1;return de(h,ne(e.goal),{fireGoal:()=>{N||(N=!0,O!==void 0?t.componentGoal(e.id,k,{value:O}):t.componentGoal(e.id,k),t.goal(k,p({metadata:{componentId:e.id,arm:a},weight:1,stepIndex:0},O!==void 0?{value:O}:{})))},fireStep:(P,R,C)=>{t.componentGoal(e.id,P,{reward:R}),t.goal(P,{metadata:{componentId:e.id,arm:a},weight:R,stepIndex:C})}},k)},[t,e.id,v,a,u]),(0,Pr.jsx)("div",{ref:r,"data-sentient-id":e.id,"data-sentient-variant":a,children:x})}var Kt=require("@sentientui/core");var Ri=["page","blocks","layoutOrder"],Nr=new Map;function Tr(e,t){Nr.set(e,t)}function Jt(e){return Nr.get(e)}function Ir(e){var i,o;let t=(o=(i=e.content)!=null?i:Jt(e.page))!=null?o:{},n={};for(let[l,a]of Object.entries(t))Ri.includes(l)||(n[l]=a);let r=M(p({},n),{page:e.page,blocks:e.blocks});return e.layoutOrder&&(r.layoutOrder=e.layoutOrder),r}function Dr(e){return`<script type="application/ld+json">${Ht(e)}</script>`}function Ht(e){return JSON.stringify(p({"@context":"https://schema.org","@type":"WebPage"},e)).replace(/</g,"\\u003c")}function Lr(e){let t=[];e.title&&t.push(`# ${e.title}`,""),e.summary&&t.push(String(e.summary),"");for(let[n,r]of Object.entries(e))["page","title","summary","blocks","layoutOrder"].includes(n)||t.push(`## ${n}`,"","```json",JSON.stringify(r,null,2),"```","");if(e.blocks.length>0){t.push("## blocks","");for(let n of e.blocks)t.push(`- **${n.id}** \u2192 variant \`${n.variant}\``),n.content!==void 0&&t.push(""," ```json",JSON.stringify(n.content,null,2)," ```");t.push("")}return t.join(`
2
+ "use strict";var $r=Object.create;var je=Object.defineProperty,Br=Object.defineProperties,Ur=Object.getOwnPropertyDescriptor,Wr=Object.getOwnPropertyDescriptors,Kr=Object.getOwnPropertyNames,ze=Object.getOwnPropertySymbols,Jr=Object.getPrototypeOf,wt=Object.prototype.hasOwnProperty,an=Object.prototype.propertyIsEnumerable;var sn=(e,t,n)=>t in e?je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p=(e,t)=>{for(var n in t||(t={}))wt.call(t,n)&&sn(e,n,t[n]);if(ze)for(var n of ze(t))an.call(t,n)&&sn(e,n,t[n]);return e},V=(e,t)=>Br(e,Wr(t));var $e=(e,t)=>{var n={};for(var r in e)wt.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ze)for(var r of ze(e))t.indexOf(r)<0&&an.call(e,r)&&(n[r]=e[r]);return n};var Hr=(e,t)=>{for(var n in t)je(e,n,{get:t[n],enumerable:!0})},ln=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Kr(t))!wt.call(e,i)&&i!==n&&je(e,i,{get:()=>t[i],enumerable:!(r=Ur(t,i))||r.enumerable});return e};var Be=(e,t,n)=>(n=e!=null?$r(Jr(e)):{},ln(t||!e||!e.__esModule?je(n,"default",{value:e,enumerable:!0}):n,e)),Xr=e=>ln(je({},"__esModule",{value:!0}),e);var Ai={};Hr(Ai,{Adaptive:()=>gr,AdaptiveGroup:()=>Er,AdaptiveProvider:()=>Fn,AdaptiveSlot:()=>De,AdaptiveText:()=>mr,SentientPersonaScript:()=>br,buildAgentFeed:()=>Ir,consentWatcher:()=>Vr.consentWatcher,defineAgentContent:()=>Tr,detectSegment:()=>Kt.deriveSessionSegment,getAgentContent:()=>Jt,grantConsent:()=>Fr.grantConsent,renderAgentJsonLd:()=>Dr,renderAgentJsonLdBody:()=>Ht,renderAgentMarkdown:()=>Lr,renderBlocks:()=>ke,renderCompose:()=>lt,useAdaptive:()=>Gr,useAdaptiveApiBaseUrl:()=>Kn,useAdaptiveGoal:()=>Le,useAdaptivePersona:()=>kr,useAdaptiveTokens:()=>Cr,useAssignment:()=>ot,useGoal:()=>vr,useInitialAssignments:()=>et,useLayoutOrder:()=>jn,usePageGoal:()=>yr,useSentient:()=>M,useSessionSegment:()=>Ie});module.exports=Xr(Ai);var _=require("react"),Qe=require("@sentientui/core");var un=new Map,qe=new Map;function cn(e,t){let n=qe.get(e);return n||(n=new Set,qe.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&qe.delete(e)}}function dn(e,t){un.set(e,t);let n=qe.get(e);if(n)for(let r of n)try{r(t)}catch(i){}}function xt(e){var t;return(t=un.get(e))!=null?t:null}var zr={on:!1,listeners:new Set};function kt(){if(typeof window=="undefined")return zr;let e=window;return e.__sentient_preview||(e.__sentient_preview={on:!1,listeners:new Set}),e.__sentient_preview}function fn(e){let t=kt();if(t.on!==e){t.on=e;for(let n of t.listeners)n()}}function Rt(){return kt().on}function gn(e){let t=kt().listeners;return t.add(e),()=>{t.delete(e)}}function mn(e){return{isLocal:e.isLocal,track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},fetchWeights:()=>Promise.resolve([]),getAssignment:(t,n)=>e.getAssignment(t,n),isUnified:t=>{var n,r;return(r=(n=e.isUnified)==null?void 0:n.call(e,t))!=null?r:!1},assign:(t,n,r,i,o)=>e.assign(t,n,r,i,o),decide:()=>Promise.resolve(null),getSlotResult:t=>e.getSlotResult(t),getSlotConfig:t=>e.getSlotConfig(t),getSitePalette:()=>e.getSitePalette(),reportSlots:t=>e.reportSlots(t),getPersona:()=>e.getPersona(),getGraph:()=>e.getGraph(),flush:()=>e.flush(),dispose:()=>e.dispose(),destroy:()=>e.destroy()}}var At="sentient:overrides-changed";function pn(){var e;return typeof window=="undefined"?0:(e=window.__sentient_overrides_version)!=null?e:0}function Ct(){var t;if(typeof window=="undefined")return;let e=window;e.__sentient_overrides_version=((t=e.__sentient_overrides_version)!=null?t:0)+1,window.dispatchEvent(new Event(At))}function ee(e){return typeof window=="undefined"?()=>{}:(window.addEventListener(At,e),()=>window.removeEventListener(At,e))}function yn(e){typeof window!="undefined"&&(window.__sentient_devtools_config=e)}function D(){try{return process.env.NODE_ENV!=="production"}catch(e){return!0}}function ne(e){return typeof e=="string"?{type:"click"}:e}function ye(e){return typeof e=="string"?e:e.type}function ce(e){if(typeof e!="string"&&(e.type==="click"||e.type==="form_submit"||e.type==="scroll_depth"))return e.value}var _t=new Set,Ot=!1;function vn(e){if(_t.has(e))return!0;if(_t.add(e),!Ot){Ot=!0;let t=()=>{Ot=!1,_t.clear()};if(typeof MessageChannel=="function"){let n=new MessageChannel;n.port1.onmessage=()=>{n.port1.close(),n.port2.close(),t()},n.port2.postMessage(0)}else setTimeout(t,0)}return!1}function qr(e){if(!(e instanceof Element))return!1;let t=e.tagName.toLowerCase();return t==="a"||t==="button"?!0:e.getAttribute("role")==="button"}function Sn(e,t,n){if(n){try{let i=e;for(;i&&i!==t;){if(i.matches(n))return!0;i=i.parentElement}}catch(i){}return!1}let r=e;for(;r&&r!==t;){if(qr(r))return!0;r=r.parentElement}return!1}function de(e,t,n,r){if(t.type==="weighted_composite"){let s=new Set,y=[];return t.steps.forEach(({goal:c,name:b,weight:w},d)=>{let m=(S=!1)=>{s.has(d)||S&&r!==void 0&&vn(`step\0${b}\0${w}\0${d}`)||(s.add(d),n.fireStep(b,w,d))};if(c.type==="click"){let S=v=>{let g=v.target;g instanceof Element&&Sn(g,e,c.selector)&&m()};e.addEventListener("click",S),y.push(()=>e.removeEventListener("click",S));return}if(c.type==="form_submit"){let S=v=>{v.target instanceof HTMLFormElement&&e.contains(v.target)&&m()};e.addEventListener("submit",S),y.push(()=>e.removeEventListener("submit",S));return}if(c.type==="scroll_depth"){let S=Math.max(0,Math.min(1,c.threshold)),v=new IntersectionObserver(g=>{for(let h of g)if(h.intersectionRatio>=S){m(!0),v.disconnect();break}},{threshold:[S]});v.observe(e),y.push(()=>v.disconnect())}}),()=>{for(let c of y)c()}}let i=t.type==="composite"?t.all:[t],o=new Set(i.map((s,y)=>y)),l=()=>{r!==void 0&&vn(r)||n.fireGoal()},a=(s,y=!1)=>{o.delete(s),o.size===0&&(y?l():n.fireGoal())},u=[];return i.forEach((s,y)=>{if(s.type==="click"){let c=b=>{let w=b.target;w instanceof Element&&Sn(w,e,s.selector)&&(t.type==="composite"?a(y):n.fireGoal())};e.addEventListener("click",c),u.push(()=>e.removeEventListener("click",c));return}if(s.type==="form_submit"){let c=b=>{b.target instanceof HTMLFormElement&&e.contains(b.target)&&(t.type==="composite"?a(y):n.fireGoal())};e.addEventListener("submit",c),u.push(()=>e.removeEventListener("submit",c));return}if(s.type==="scroll_depth"){let c=Math.max(0,Math.min(1,s.threshold)),b=new IntersectionObserver(w=>{for(let d of w)if(d.intersectionRatio>=c){t.type==="composite"?a(y,!0):l(),b.disconnect();break}},{threshold:[c]});b.observe(e),u.push(()=>b.disconnect());return}}),()=>{for(let s of u)s()}}var hn=new Set,bn=new Set;function Yr(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,100);if(t&&t===e)return`${t}-steps`;let n=5381;for(let r=0;r<e.length;r++)n=(n<<5)+n+e.charCodeAt(r)>>>0;return`${t||"component"}-${n.toString(36)}-steps`}var Zr=12;function Qr(e,t){let n=new Set,r=[];for(let o of t.steps){let l=o.name;!l||l.length>128||l.startsWith("funnel:")||n.has(l)||r.length===Zr||(n.add(l),r.push({goalId:l,weight:Math.min(1,Math.max(0,o.weight||0))}))}let i=[...r].sort((o,l)=>o.weight-l.weight);return(r.length<t.steps.length||i.some((o,l)=>o!==r[l]))&&D()&&console.warn(`[SentientUI] "${e}": weighted_composite steps adjusted for its funnel (skipped invalid/repeated/over-12 steps, or ordered by weight)`),i}function fe(e,t,n,r,i){let o=(i==null?void 0:i.type)==="weighted_composite"?i:null,l=r!=null?r:o?Yr(n):void 0;if(!l)return;let a=`${l}|${n}`;if(bn.has(a))return;bn.add(a);let u=o&&!hn.has(l)?Qr(n,o):null,s=u!==null&&u.length>=2;s&&hn.add(l),!(!s&&r===void 0)&&e.track({projectId:t,componentId:n,eventType:"funnel_declared",payload:s?{funnelId:l,steps:u}:{funnelId:l}})}function ve(e,t,n,r){e.track({projectId:t,componentId:n,variantId:r,eventType:"variant_assigned",payload:{}})}var ei={components:new Map,slots:new Map,sections:[],listeners:new Set,version:0};function be(){if(typeof window=="undefined")return ei;let e=window;return e.__sentient_registry||(e.__sentient_registry={components:new Map,slots:new Map,sections:[],listeners:new Set,version:0}),e.__sentient_registry}function Ue(){be().version+=1;for(let e of be().listeners)e()}var wn=()=>{};function Ye(e){return D()?(be().components.set(e.id,e),Ue(),()=>{be().components.delete(e.id),Ue()}):wn}function Ge(e){return D()?(be().slots.set(e.id,e),Ue(),()=>{be().slots.delete(e.id),Ue()}):wn}function Gt(e){D()&&(be().sections=[...e],Ue())}var xn="0.44.3",Et=xn!=="0.0.0-dev"?{name:"react",version:xn}:void 0;function ti(){let e=window;return e.__sentient_slot_config_overrides||(e.__sentient_slot_config_overrides={}),e.__sentient_slot_config_overrides}function Ee(e,t){ti()[e]=t}function kn(e){window.__sentient_vocabulary_override=e}function Rn(){var e;return typeof window=="undefined"?null:(e=window.__sentient_vocabulary_override)!=null?e:null}function ni(){let e=window;return e.__sentient_slot_overrides||(e.__sentient_slot_overrides={}),e.__sentient_slot_overrides}function Pe(e,t){ni()[e]=t}function An(e){let t=null;try{let n=location.hash.slice(1),r=RegExp("(^|[?&])"+e+"=([^&]*)").exec(n);if(r){t=r[2];let i=n.slice(r.index+r[0].length);r[1]!="&"&&i[0]=="&"&&(i=r[1]+i.slice(1));let o=n.slice(0,r.index)+i;history.replaceState(history.state,"",o?"#"+o:location.pathname+location.search)}}catch(n){}return t}var Nt="__snt_editor_token",Ne=null,Pt=!1;function Cn(){return Pt}function ri(){try{return sessionStorage.getItem(Nt)}catch(e){return null}}function Ze(e){if(Ne)return Ne;let t=typeof window=="undefined"?null:An("sentient_editor_code");if(!t){let n=typeof window=="undefined"?null:ri();return Pt=!!n,Ne=Promise.resolve(n?{token:n,fresh:!1}:null),Ne}return Pt=!0,Ne=fetch(`${e}/editor/exchange`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:t})}).then(async n=>{let r=n.ok?(await n.json()).token:void 0;if(!r)return{error:n.ok?500:n.status};try{sessionStorage.setItem(Nt,r)}catch(i){}return{token:r,fresh:!0}}).catch(()=>({error:0})),Ne}function _n(){try{sessionStorage.removeItem(Nt)}catch(e){}}var On="sentient_preview_cell",Gn="sentient_refresh_region",Tt="sentient-cell-preview-bar",we="__preview__",Te=null;function En(e){if((Te==null?void 0:Te.slotId)!==e)return null;let t=Te;return Te=null,t}function Pn(e,t){e.session.then(n=>{if(!n||!("token"in n))throw new Error("no editor session");return fetch(`${e.base}/editor/region-skeleton`,{method:"POST",headers:{authorization:`Bearer ${n.token}`,"content-type":"application/json"},body:JSON.stringify(p({slotId:e.slotId},t))})}).then(n=>xe(n.ok?"Region refreshed \u2014 you can regenerate its versions now.":"Couldn\u2019t refresh this region \u2014 reopen the link from your dashboard.")).catch(()=>xe("Couldn\u2019t refresh this region \u2014 check your connection and reopen the link from your dashboard."))}function Nn(e){if(typeof window=="undefined"||typeof document=="undefined"||document.getElementById(Tt))return;let t,n;try{let u=new URLSearchParams(window.location.search);t=u.get(On),n=u.get(Gn)}catch(u){return}if(!t&&!n)return;let r=(e!=null?e:"https://api.sentient-ui.com/v1").replace(/\/$/,""),i=Ze(r);if(!Cn())return;if(n){Te={slotId:n,session:i,base:r},Ee(n,{kind:"arms"}),Pe(n,we),Ct();return}if(!t)return;let o=t.lastIndexOf("~");if(o<=0)return;let l=t.slice(0,o),a=t.slice(o+1);i.then(u=>u?"token"in u?fetch(`${r}/editor/cell-preview?slotId=${encodeURIComponent(l)}&persona=${encodeURIComponent(a)}`,{headers:{authorization:`Bearer ${u.token}`}}):(xe(u.error===401?"This preview link has expired \u2014 reopen it from your dashboard.":"Couldn\u2019t load this preview \u2014 reopen it from your dashboard."),null):null).then(async u=>{if(!u)return;if(!u.ok){xe(u.status===401?"This preview link has expired \u2014 reopen it from your dashboard.":"Couldn\u2019t load this preview \u2014 reopen it from your dashboard.");return}let s=await u.json();if(s.vocabulary&&Array.isArray(s.vocabulary.entries)&&kn(s.vocabulary),s.compose!=null)Ee(l,{kind:"arms",compose:{[we]:s.compose}}),Pe(l,we);else if(s.edits!=null&&typeof s.skeletonFp=="string"&&Array.isArray(s.leafToNode))Ee(l,{kind:"arms",edits:{edits:s.edits,fp:s.skeletonFp,leafToNode:s.leafToNode}}),Pe(l,we);else if(s.blocks!=null)Ee(l,{kind:"arms",blocks:{[we]:s.blocks}}),Pe(l,we);else if(s.content!=null)Ee(l,{kind:"arms",content:s.content}),Pe(l,we);else{xe("Nothing to preview in that square yet.");return}Ct(),xe(`Previewing \u201C${s.slotName}\u201D for ${s.personaDisplay}${s.status==="review"?" \u2014 waiting for your approval":""}. Nothing is being tracked.`),setTimeout(()=>{var y;try{(y=document.querySelector(`[data-sentient-slot="${l}"]`))==null||y.scrollIntoView({block:"center"})}catch(c){}},300)}).catch(()=>xe("Couldn\u2019t load this preview \u2014 check your connection and reopen it from your dashboard."))}function xe(e){var i;if(document.getElementById(Tt))return;let t=document.createElement("div");t.id=Tt,Object.assign(t.style,{position:"fixed",bottom:"16px",left:"50%",transform:"translateX(-50%)",zIndex:"2147483647",display:"flex",alignItems:"center",gap:"10px",padding:"10px 14px",borderRadius:"12px",maxWidth:"90vw",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)"});let n=document.createElement("span");n.textContent=e;let r=document.createElement("button");r.textContent="Exit preview",Object.assign(r.style,{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.35)",background:"transparent",color:"#fff",font:"12px system-ui, sans-serif",cursor:"pointer"}),r.onclick=()=>{_n();let o=new URL(window.location.href);o.searchParams.delete(On),o.searchParams.delete(Gn),window.location.assign(o.toString())},t.append(n,r),((i=document.body)!=null?i:document.documentElement).append(t)}var Tn=!1;function In(e){if(Tn||typeof window=="undefined")return;Tn=!0;let t=(e!=null?e:"https://api.sentient-ui.com/v1").replace(/\/$/,"");Ze(t).then(n=>{!n||!("token"in n)||!n.fresh||ii(t,n.token)})}function ii(e,t){let n=()=>{window.setTimeout(()=>{import("@sentientui/core/style-sample").then(({sampleStyleVocabulary:r})=>fetch(`${e}/editor/style-vocabulary`,{method:"POST",headers:{authorization:`Bearer ${t}`,"content-type":"application/json"},body:JSON.stringify(r(document))})).catch(()=>{})},1e3)};document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}var Jn=require("react/jsx-runtime");function oi(){var e,t;if(typeof window=="undefined")return"desktop:direct";try{return(0,Qe.deriveSessionSegment)({userAgent:(e=navigator.userAgent)!=null?e:"",referer:(t=document.referrer)!=null?t:"",appOrigin:window.location.origin})}catch(n){return"desktop:direct"}}var Ln="https://api.sentient-ui.com/v1",Z=(0,_.createContext)({client:null,apiKey:"",initialAssignments:{},initialUnified:[],sessionSegment:"desktop:direct",ssrFallback:"first",onAssignment:void 0,initialLayoutOrder:null,initialSlots:{},initialSlotConfig:{},initialPalette:null,initialVocabulary:null,initialPersona:null,apiBaseUrl:Ln,debug:!1}),Dn=!1,It=new Set;function si(e,t,n){let r=(0,_.useRef)(n);r.current=n;let[i,o]=(0,_.useState)(null),[l,a]=(0,_.useState)(!1),u=(0,_.useRef)(e);u.current=e;let s=e===void 0?"":typeof e=="string"?e:JSON.stringify(V(p({},e),{check:typeof e.check,refused:typeof e.refused}));return(0,_.useEffect)(()=>{let y=u.current;if(y===void 0||typeof window=="undefined")return;let c,b=!1;return import("@sentientui/core/consent").then(({consentWatcher:w,forgetVisitor:d})=>{if(b)return;let m=w(typeof y=="object"&&y.cmp===void 0&&y.check?p(V(p({},y),{check:()=>u.current.check()}),y.refused?{refused:()=>{var g,h;return((h=(g=u.current).refused)==null?void 0:h.call(g))===!0}}:{}):y),S=!1,v=()=>{let g=m.refused()&&m.read()!==!0;g&&!S&&(d(t),r.current()),S=g,a(g);let h=m.read();h!==null&&It.add(t),o(h!=null?h:It.has(t)?!1:null)};v(),c=m.subscribe(v)}),()=>{b=!0,c==null||c()}},[s,t]),{granted:i,refused:l}}function Fn(e){var P,R,C,f,A,U;let[t,n]=(0,_.useState)(null),[r]=(0,_.useState)(()=>{var k;return(k=e.sessionSegment)!=null?k:oi()}),[i,o]=(0,_.useState)(Rt());(0,_.useEffect)(()=>gn(()=>o(Rt())),[]),(0,_.useEffect)(()=>{Nn(e.apiBaseUrl),typeof window!="undefined"&&/[?&]sentient_preview=[^&]*(:|%3A)/i.test(window.location.search)&&(fn(!0),import("@sentientui/react/version-preview").then(k=>k.maybeStartVersionPreview(e.apiKey,e.apiBaseUrl)).catch(()=>{})),In(e.apiBaseUrl)},[]);let l=(0,_.useRef)(()=>{}),a=si(e.consentFrom,e.apiKey,()=>l.current()),u=e.consentFrom?(P=a.granted)!=null?P:It.has(e.apiKey)?!1:e.consent===!0:e.consent,s=e.consentFrom?a.refused:!0,y=(0,_.useRef)(s);y.current=s;let c=(0,_.useRef)(null),b=(0,_.useRef)(!1),w=(0,_.useRef)([]),d=(0,_.useRef)(!1);l.current=()=>{var G;w.current=[],d.current=!0;let k=c.current;k!=null&&k.gated?k.dispose():(G=k==null?void 0:k.takeHeld)==null||G.call(k)},(0,_.useEffect)(()=>{var q,Ve;if(y.current&&u===!1&&(w.current=[]),u===!1&&b.current&&(y.current&&((q=c.current)==null||q.destroy()),c.current=null,b.current=!1),u===!1&&!e.preConsentBehavior){y.current&&((Ve=c.current)==null||Ve.destroy()),c.current=null,n(null);return}let k=u!==!1;k&&(d.current=!1);let G=X=>{!k&&d.current&&X.gated&&X.dispose()},F=p({apiKey:e.apiKey,context:e.context,debug:e.debug,initialAssignments:e.initialAssignments,initialUnified:e.initialUnified,sessionSegment:r,consent:u,preConsentBehavior:e.preConsentBehavior,respectDoNotTrack:e.respectDoNotTrack,ssrSessionId:e.ssrSessionId,cookieDomain:e.cookieDomain,country:e.country,persona:e.persona,internal:e.internal,stageAttributes:e.stageAttributes,localMode:e.localMode,initialSlots:e.initialSlots,initialSlotConfig:e.initialSlotConfig,initialPalette:e.initialPalette,initialVocabulary:e.initialVocabulary,initialPersona:e.initialPersona,ingestUrl:e.apiBaseUrl?`${e.apiBaseUrl.replace(/\/$/,"")}/events`:void 0,nonce:e.nonce},Et?{sdk:Et}:{}),j=!1,T=null,H=null,W=X=>{for(let le of w.current.splice(0))setTimeout(()=>{if(c.current!==X){d.current||w.current.push(le);return}try{le(X)}catch(Me){}},0)},B=X=>{e.engagement===!1||!k||import("@sentientui/core/engagement").then(({startEngagementCapture:le})=>{j||(H=le(X,{apiKey:e.apiKey,sectionTypes:e.sectionTypes,apiBase:e.apiBaseUrl?e.apiBaseUrl.replace(/\/$/,""):void 0}))})};return e.enableGraph!==!1?import("@sentientui/core/graph").then(({init:X})=>{j||(T=X(V(p({},F),{graph:!0,captureDomText:e.captureDomText===!0,sectionTypes:e.sectionTypes})),G(T),c.current=T,b.current=k,W(T),n(T),B(T))}):(T=(0,Qe.init)(F),G(T),c.current=T,b.current=k,W(T),n(T),B(T)),()=>{var X,le;j=!0,H==null||H(),w.current=w.current.concat((le=(X=T==null?void 0:T.takeHeld)==null?void 0:X.call(T))!=null?le:[]),T==null||T.dispose()}},[u]),(0,_.useEffect)(()=>{if(!t)return;let k=!1,G=async()=>{if(k)return;let j;try{j=await t.fetchWeights()}catch(T){return}if(!k)for(let T of j){let H={componentId:T.componentId,updatedAt:T.updatedAt,variants:T.variants.map(W=>{var B;return{variantId:W.variantId,pulls:W.pulls,avgReward:(B=W.avgReward)!=null?B:0}})};dn(T.componentId,H)}};G();let F=setInterval(()=>{G()},6e4);return()=>{k=!0,clearInterval(F)}},[t]);let m=(R=e.ssrFallback)!=null?R:"first",S=((C=e.apiBaseUrl)!=null?C:Ln).replace(/\/$/,""),v=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(!D())return;let k={apiKey:e.apiKey,context:e.context,country:e.country,persona:e.persona,internal:e.internal,apiBaseUrl:S},G=v.current;if(v.current=k,G!==null)for(let F of["apiKey","context","country","persona","internal","apiBaseUrl"])Object.is(G[F],k[F])||console.warn(`[sentient] AdaptiveProvider: \`${F}\` changed after initialisation, but the SDK client is stable for the session and only re-inits on \`consent\` \u2014 the new value is ignored. Remount the provider (e.g. via a changing \`key\` prop) to apply it.`)},[e.apiKey,e.context,e.country,e.persona,e.internal,S]),(0,_.useEffect)(()=>{D()&&yn({apiKey:e.apiKey,apiBaseUrl:S,isLocal:(t==null?void 0:t.isLocal)===!0})},[t,e.apiKey,S]);let g=(f=e.identity)==null?void 0:f.userId,h=(A=e.identity)==null?void 0:A.userHash,x=(U=e.identity)==null?void 0:U.email;(0,_.useEffect)(()=>{t&&g&&t.identify(g,{userHash:h,email:x})},[t,g,h,x]),(0,_.useEffect)(()=>{let k=e.initialLayoutOrder;if(k&&k.length>0){Gt(k);return}e.declaredSections&&e.declaredSections.length>0&&Gt(e.declaredSections)},[e.initialLayoutOrder,e.declaredSections]),(0,_.useEffect)(()=>{!D()||e.consent!==void 0||e.consentFrom!==void 0||Dn||(Dn=!0,console.warn('[SentientUI] No consent gate: every visitor is tracked from first paint. Pass consentFrom="<your CMP>" (or consent={true} to silence). https://sentient-ui.com/docs#consent'))},[]),(0,_.useEffect)(()=>{if(!D())return;let k=e.declaredSections;if(!k||k.length===0||typeof document=="undefined")return;let G=new Set(Array.from(document.querySelectorAll("[data-sentient-id]"),j=>j.getAttribute("data-sentient-id"))),F=k.filter(j=>!G.has(j));F.length>0&&console.warn(`[SentientUI] Declared section${F.length>1?"s":""} ${F.map(j=>`"${j}"`).join(", ")} ${F.length>1?"have":"has"} no matching data-sentient-id element, so the layout engine cannot learn what they are and will serve the same order to every persona. Add data-sentient-id="<sectionId>" to each section's element.`)},[e.declaredSections]);let O=(0,_.useMemo)(()=>t&&i?mn(t):t,[t,i]),N=(0,_.useMemo)(()=>{var k,G,F,j,T,H,W,B,q;return{client:O,apiKey:e.apiKey,initialAssignments:(k=e.initialAssignments)!=null?k:{},initialUnified:(G=e.initialUnified)!=null?G:ai,sessionSegment:r,ssrFallback:m,onAssignment:e.onAssignment,initialLayoutOrder:(F=e.initialLayoutOrder)!=null?F:null,initialSlots:(j=e.initialSlots)!=null?j:{},initialSlotConfig:(T=e.initialSlotConfig)!=null?T:{},initialPalette:(H=e.initialPalette)!=null?H:null,initialVocabulary:(W=e.initialVocabulary)!=null?W:null,initialPersona:(B=e.initialPersona)!=null?B:null,apiBaseUrl:S,debug:(q=e.debug)!=null?q:!1}},[O,e.apiKey,e.initialAssignments,e.initialUnified,r,m,e.onAssignment,e.initialLayoutOrder,e.initialSlots,e.initialSlotConfig,e.initialPalette,e.initialVocabulary,e.initialPersona,S,e.debug]);return(0,Jn.jsx)(Z.Provider,{value:N,children:e.children})}function M(){return(0,_.useContext)(Z).client}function ie(){return(0,_.useContext)(Z).apiKey}function et(){return(0,_.useContext)(Z).initialAssignments}var ai=[];function tt(){return(0,_.useContext)(Z).initialUnified}function Ie(){return(0,_.useContext)(Z).sessionSegment}function Vn(){return(0,_.useContext)(Z).ssrFallback}function nt(){return(0,_.useContext)(Z).onAssignment}function Mn(){return(0,_.useContext)(Z).debug}function jn(){let e=(0,_.useContext)(Z).initialLayoutOrder,t=(0,_.useSyncExternalStore)(ee,()=>{var n;return typeof window=="undefined"?null:(n=window.__sentient_layout_override)!=null?n:null},()=>null);return t!=null?t:e}function rt(){return(0,_.useContext)(Z).initialSlots}function $n(){return(0,_.useContext)(Z).initialPersona}function Bn(){return(0,_.useContext)(Z).initialSlotConfig}function Un(){return(0,_.useContext)(Z).initialPalette}function Wn(){return(0,_.useContext)(Z).initialVocabulary}function Kn(){return(0,_.useContext)(Z).apiBaseUrl}var me=require("react");var K=require("react"),zn=require("@sentientui/core");var oe=require("react"),it=require("@sentientui/policy");function Se(e){var n;if(typeof window=="undefined")return null;let t=(n=window.__sentient_overrides)==null?void 0:n[e];if(t)return t;if(!window.location.search)return null;try{let r=new URLSearchParams(window.location.search);for(let i of r.getAll("sentient_variant")){let o=i.indexOf(":");if(o!==-1&&i.slice(0,o)===e)return i.slice(o+1)}}catch(r){}return null}function ot(e,t,n,r,i){let o=et(),l=Vn(),a=M(),u=Ie(),s=nt(),y=Mn(),c=(0,oe.useRef)(null),b=(0,oe.useSyncExternalStore)(ee,()=>Se(e),()=>null),w=b&&t.includes(b)?b:null,d=(0,oe.useRef)(null);(0,oe.useEffect)(()=>{y&&w&&d.current!==w&&(d.current=w,console.info(`[sentient] override active: ${e} -> ${w}`))},[y,w,e]);let[m,S]=(0,oe.useState)(()=>{var x,O;if(w)return{variantId:w,content:null,isLoading:!1,settled:!0};if(!a){let N=o[e];return N&&t.includes(N)?{variantId:N,content:null,isLoading:!1,settled:!0}:l==="first"&&t.length>0?{variantId:t[0],content:null,isLoading:!1,settled:!1}:{variantId:null,content:null,isLoading:!0,settled:!1}}let g=a.getAssignment(e,u);if(g&&(t.includes(g.variantId)||g.content))return{variantId:g.variantId,content:(x=g.content)!=null?x:null,isLoading:!1,settled:!0};let h=xt(e);if(h){let N=(0,it.pickFromWeights)(h.variants,t);if(N)return{variantId:N,content:null,isLoading:!1,settled:!0}}return{variantId:(O=t[0])!=null?O:null,content:null,isLoading:!1,settled:!1}}),v=g=>{s&&c.current!==g&&(c.current=g,s(e,g))};return(0,oe.useEffect)(()=>{var x;if(w||!a)return;let g=a.getAssignment(e,u);if(g&&(t.includes(g.variantId)||g.content)){S({variantId:g.variantId,content:(x=g.content)!=null?x:null,isLoading:!1,settled:!0}),v(g.variantId);return}let h=xt(e);if(h&&m.settled&&m.variantId&&m.variantId===(0,it.pickFromWeights)(h.variants,t)){v(m.variantId);return}S(O=>{var N;return O.variantId?O:{variantId:(N=t[0])!=null?N:null,content:null,isLoading:!1,settled:!1}})},[w,a,e,u]),(0,oe.useEffect)(()=>{if(w||!a)return;let g=a.getAssignment(e,u);if(g&&t.includes(g.variantId))return;let h=!1,x=i==null?void 0:i.onUnified;return(x?a.assign(e,t,n,r,{unified:!0}):a.assign(e,t,n,r)).then(N=>{var P;if(!h&&N){if(N.unified===!0){x==null||x();return}!t.includes(N.variantId)&&!N.content||(S({variantId:N.variantId,content:(P=N.content)!=null?P:null,isLoading:!1,settled:!0}),v(N.variantId))}}),()=>{h=!0}},[w,a,e,u]),(0,oe.useEffect)(()=>{if(!w&&a)return cn(e,g=>{var O;let h=a.getAssignment(e,u);if(h&&(t.includes(h.variantId)||h.content)){S({variantId:h.variantId,content:(O=h.content)!=null?O:null,isLoading:!1,settled:!0}),v(h.variantId);return}let x=(0,it.pickFromWeights)(g.variants,t);x&&(S({variantId:x,content:null,isLoading:!1,settled:!0}),v(x))})},[w,a,e,u]),w?{variantId:w,content:null,isLoading:!1,settled:!0,isOverride:!0}:m}var Hn=new Set,Xn=new Map;function Dt(e,t,n,r){let i=r;if(r){let l=Xn.get(t);l&&l!==n?(D()&&console.warn(`[SentientUI] useGoal('${n}'): '${l}' is already primary on this page`),i=!1):Xn.set(t,n)}let o=`${t}|${n}|${i?"primary":""}`;Hn.has(o)||(Hn.add(o),e.track({projectId:t,componentId:"__session__",eventType:"goal_declared",payload:i?{goalId:n,primary:!0}:{goalId:n}}))}function st(e,t,n){e&&!e.gated&&t&&typeof n=="string"&&n&&Dt(e,t,n,!1)}function at(e,t,n){let r=M(),i=ie(),o=Object.keys(t).join("\0"),l=(0,K.useMemo)(()=>Object.keys(t),[o]),{variantId:a,content:u,isOverride:s=!1,settled:y}=ot(e,l,n.agentData,n.agentDataByVariant,n.onUnified?{onUnified:n.onUnified}:void 0),[c,b]=(0,K.useState)(null),w=(0,K.useRef)(null),d=(0,K.useCallback)(f=>{w.current=f,b(f)},[]),m=n.goal,S=typeof m=="string"?m:JSON.stringify(m),v=(0,K.useMemo)(()=>m?ne(m):null,[S]),g=m?ye(m):"";(0,K.useEffect)(()=>Ye({id:e,variantIds:l,goal:g}),[e,l,g]);let h=(0,K.useRef)(null);(0,K.useEffect)(()=>{s||y&&(!r||!a||!i||!c||h.current!==a&&(h.current=a,ve(r,i,e,a)))},[r,a,i,e,c,s,y]);let x=(0,K.useRef)(!1),O=(0,K.useRef)(new Set);(0,K.useEffect)(()=>{x.current=!1,O.current=new Set},[a,v]);let N=n.funnel;(0,K.useEffect)(()=>{s||!y||!r||!v||fe(r,i,e,N,v)},[r,i,e,N,v,s,y]),(0,K.useEffect)(()=>{!s&&y&&st(r,i,m)},[r,i,m,s,y]);let P=n.cursorSignal===!0;(0,K.useEffect)(()=>{if(!P||s||!y||!r||!a||!c)return;let f=null,A=0,U=()=>{A=Date.now(),f=setTimeout(()=>{r.track({projectId:i,componentId:e,variantId:a,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-A}}),f=null},800)},k=()=>{f!==null&&(clearTimeout(f),f=null)};return c.addEventListener("mouseenter",U),c.addEventListener("mouseleave",k),()=>{c.removeEventListener("mouseenter",U),c.removeEventListener("mouseleave",k),f!==null&&clearTimeout(f)}},[P,r,a,i,e,c,s,y]);let R=(0,K.useRef)(n.microSignalGoals);R.current=n.microSignalGoals;let C=n.microSignalGoals?JSON.stringify(n.microSignalGoals):"";return(0,K.useEffect)(()=>{if(s||!y||!r||!a||!c)return;let f=Date.now();return(0,zn.attachMicroSignalDetectors)((A,U={})=>{var T,H,W;r.track({projectId:i,componentId:e,variantId:a,eventType:"micro_signal",payload:p({signalType:A},U)});let k=(T=R.current)==null?void 0:T[A];if(!k||O.current.has(A))return;O.current.add(A);let G=typeof k=="string"?k:k.name,F=typeof k=="string"?1:(H=k.weight)!=null?H:1,j=typeof k=="string"?0:(W=k.stepIndex)!=null?W:0;r.goal(G,{metadata:p({signalType:A},U),weight:F,stepIndex:j})},c,f)},[r,a,i,e,c,C,s,y]),(0,K.useEffect)(()=>{if(s||!y||!r||!a||!c||!v)return;let f=ce(v);return de(c,v,{fireGoal:()=>{x.current||(x.current=!0,r.track({projectId:i,componentId:e,variantId:a,eventType:"goal_achieved",goalType:g,payload:p({reward:1},f!==void 0?{goalValue:f}:{})}),r.goal(g,p({metadata:{componentId:e,variantId:a},weight:1,stepIndex:0},f!==void 0?{value:f}:{})))},fireStep:(A,U,k)=>{r.track({projectId:i,componentId:e,variantId:a,eventType:"goal_achieved",goalType:A,payload:{reward:U}}),r.goal(A,{metadata:{},weight:U,stepIndex:k})}},g)},[r,a,i,e,c,v,g,s,y]),{client:r,variantIds:l,variantId:a,content:u,settled:y,isOverride:s,goalLabel:g,ref:d,nodeRef:w}}var L=require("react"),Ae=require("@sentientui/core"),Ut=require("@sentientui/core/region");var te=require("react"),Yn=require("@sentientui/core");var qn=new Set,li={kind:"arms"};function Zn(e,t){var O,N,P;let n=M(),r=(0,te.useRef)(t==null?void 0:t.baselineText);r.current=t==null?void 0:t.baselineText;let i=(0,te.useRef)(t==null?void 0:t.render);i.current=t==null?void 0:t.render;let o=(0,te.useRef)(t==null?void 0:t.skeleton);o.current=t==null?void 0:t.skeleton;let l=rt(),a=Bn(),u=Un(),s=Wn(),y=(0,te.useSyncExternalStore)(ee,()=>{var R;return typeof window!="undefined"?(R=window.__sentient_slot_config_overrides)==null?void 0:R[e]:void 0},()=>{}),c=(0,te.useSyncExternalStore)(ee,()=>{var R;return typeof window!="undefined"?(R=window.__sentient_slot_overrides)==null?void 0:R[e]:void 0},()=>{}),b=R=>R==null?"":(0,Yn.armOfResult)(R),w=(0,te.useCallback)(R=>{var C,f;return(f=(C=n==null?void 0:n.onSlotsChanged)==null?void 0:C.call(n,R))!=null?f:(()=>{})},[n]);(0,te.useSyncExternalStore)(w,()=>{var R;return(R=n==null?void 0:n.getSlotConfig(e))!=null?R:null},()=>null),(0,te.useSyncExternalStore)(w,()=>b(n==null?void 0:n.getSlotResult(e)),()=>"");let d=y===void 0?a[e]:void 0,m=y===void 0&&d===void 0&&n?n.getSlotConfig(e):null,S=(O=u!=null?u:n==null?void 0:n.getSitePalette())!=null?O:null,v=(P=s!=null?s:(N=n==null?void 0:n.getStyleVocabulary)==null?void 0:N.call(n))!=null?P:null,g=(()=>{var R,C,f;if(y!==void 0)return{config:y,arm:b(c),palette:S,vocabulary:(R=Rn())!=null?R:v,source:"override"};if(t!=null&&t.forcedArm)return{config:li,arm:t.forcedArm,palette:S,vocabulary:v,source:"override"};if(d!==void 0)return{config:d,arm:b((C=l[e])!=null?C:n==null?void 0:n.getSlotResult(e)),palette:S,vocabulary:v,source:"preloaded"};if(m!==null){let A=n!=null&&n.isSlotDecided?n.isSlotDecided(e):!0;return{config:m,arm:b((f=n==null?void 0:n.getSlotResult(e))!=null?f:l[e]),palette:S,vocabulary:v,source:A?"client":"seeded"}}return{config:null,arm:"",palette:S,vocabulary:v,source:"none"}})(),h=(t==null?void 0:t.defer)===!0,x=g.source==="preloaded"||g.source==="override";return(0,te.useEffect)(()=>{var F,j,T,H,W;if(!n||n.isLocal===!0||x||h)return;let R=g.source==="none",C=R&&(j=(F=r.current)==null?void 0:F.call(r))!=null?j:null,f=C!=null&&C!==""?{[e]:C}:void 0,A=(T=i.current)==null?void 0:T.call(i),U=R&&(W=(H=o.current)==null?void 0:H.call(o))!=null?W:null,k=p(p({},A?{render:{[e]:A}}:{}),U?{skeletons:{[e]:U}}:{}),G=Object.keys(k).length>0;return n.requestSlots?G?n.requestSlots([e],f,k):f?n.requestSlots([e],f):n.requestSlots([e]):R&&(U?n.reportSlots([e],f!=null?f:{},{[e]:U}):f?n.reportSlots([e],f):n.reportSlots([e])),()=>{var B;return(B=n.cancelSlots)==null?void 0:B.call(n,[e])}},[n,x,g.source,e,h]),(0,te.useEffect)(()=>{!D()||(n==null?void 0:n.isLocal)!==!0||g.source!=="none"||qn.has(e)||(qn.add(e),console.warn(`[sentient] <Adaptive id="${e}"> is rendering its baseline children: in local/keyless mode <Adaptive> serves ONLY what you pass as \`initialSlotConfig\` (there is no registry to decide from). Pass initialSlotConfig/initialSlots to <AdaptiveProvider> to preview arms locally.`))},[n,g.source,e]),g}var We=require("react");var $=require("react/jsx-runtime");function Lt(e){return typeof e=="string"&&!/[\s\x00-\x1f\\]/.test(e)&&(/^https:\/\//i.test(e)||e[0]==="/"&&e[1]!=="/")?e:void 0}var he={none:"0",sm:"8px",md:"16px",lg:"24px"},Ft={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},nr={sm:"0.875em",md:"1em",lg:"1.25em"},ui={sm:"1.25em",md:"1.5em",lg:"2em"},Qn={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},er={sm:"8px",md:"16px",lg:"32px"},ci={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},di={normal:"400",medium:"500",bold:"700"};function tr(e,t){return p(p({},e==="muted"?t!=null&&t.muted?{color:t.muted}:{opacity:.7}:{}),e==="accent"?p({fontWeight:600},t!=null&&t.accent?{color:t.accent}:{}):{})}function rr(e,t,n){var i,o,l,a;let r=t==null?void 0:t.accent;return V(p({display:"inline-block",padding:(i=Qn[n!=null?n:"md"])!=null?i:Qn.md,borderRadius:(o=t==null?void 0:t.radius)!=null?o:"8px",font:"inherit"},n?{fontSize:nr[n]}:{}),{textDecoration:e==="ghost"?"underline":"none",cursor:"pointer",background:e==="primary"?(l=t==null?void 0:t.primaryBg)!=null?l:"#111827":"transparent",color:e==="primary"?(a=t==null?void 0:t.primaryText)!=null?a:"#ffffff":r!=null?r:"inherit",border:e==="secondary"?`1px solid ${r!=null?r:"currentColor"}`:"none"})}function fi({node:e,opts:t}){var i,o,l,a,u;let n=(i=e.emphasis)!=null?i:"primary",r={padding:"8px 10px",font:"inherit",border:`1px solid ${(l=(o=t.palette)==null?void 0:o.border)!=null?l:"currentColor"}`,borderRadius:(u=(a=t.palette)==null?void 0:a.radius)!=null?u:"8px"};return(0,$.jsxs)("form",{onSubmit:s=>{var b,w,d;s.preventDefault();let y=new FormData(s.currentTarget),c={};for(let m of e.fields)c[m.name]=String((b=y.get(m.name))!=null?b:"");(w=t.onFormGoal)==null||w.call(t,e.submitGoal);try{(d=t.onFormSubmit)==null||d.call(t,c)}catch(m){}},style:{display:"flex",flexDirection:"column",gap:"12px"},children:[e.fields.map(s=>{var y,c;return(0,$.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:"4px",font:"inherit"},children:[s.label,s.kind==="textarea"?(0,$.jsx)("textarea",{name:s.name,required:s.required,placeholder:s.placeholder,rows:3,style:r}):s.kind==="select"?(0,$.jsx)("select",{name:s.name,required:s.required,style:r,children:((y=s.options)!=null?y:[]).map(b=>(0,$.jsx)("option",{value:b,children:b},b))}):(0,$.jsx)("input",{name:s.name,type:(c=s.inputType)!=null?c:"text",required:s.required,placeholder:s.placeholder,style:r})]},s.name)}),(0,$.jsx)("button",{type:"submit",style:rr(n,t.palette),children:e.submitLabel})]})}function gi(e,t){var r,i;let n=e.like;return n?(i=(r=t.vocabulary)==null?void 0:r.entries.find(o=>o.id===n))==null?void 0:i.classes:void 0}function ir(e,t){var r;let n=e?(r=t.vocabulary)==null?void 0:r.entries.find(i=>i.id===e):void 0;return n!=null&&n.computed.inheritsColor?n.computed.color:void 0}function ke(e,t){var i;let n=mi(e,t),r=ir(e.like,t);return n&&r?(0,We.cloneElement)(n,{style:V(p({},(i=n.props.style)!=null?i:{}),{color:r})}):n}function mi(e,t){var n,r,i,o,l,a,u,s,y,c,b,w,d,m,S,v,g,h,x,O,N,P,R;try{let C=gi(e,t);switch(e.type){case"stack":{let f=(r=he[(n=e.gap)!=null?n:"md"])!=null?r:he.md,A=e.surface==="raised"&&!C,U=(i=e.pad)!=null?i:A?"md":void 0;return(0,$.jsx)("div",V(p({},C?{className:C}:{}),{style:p(p(p(p(p({display:"flex",flexDirection:e.direction,gap:f},e.align?{alignItems:Ft[e.align]}:{}),e.justify?{justifyContent:Ft[e.justify]}:{}),e.wrap?{flexWrap:"wrap"}:{}),U?{padding:(o=he[U])!=null?o:he.md}:{}),A?V(p(p({},(l=t.palette)!=null&&l.surface?{background:t.palette.surface}:{}),(a=t.palette)!=null&&a.surface&&((u=t.palette)!=null&&u.surfaceText)?{color:t.palette.surfaceText}:{}),{border:`1px solid ${(y=(s=t.palette)==null?void 0:s.border)!=null?y:"currentColor"}`,borderRadius:(b=(c=t.palette)==null?void 0:c.radius)!=null?b:"8px"}):{}),children:((w=e.children)!=null?w:[]).map((k,G)=>{let F=ke(k,t);return F===null?null:(0,$.jsx)(We.Fragment,{children:F},G)})}))}case"grid":{let f=(m=he[(d=e.gap)!=null?d:"md"])!=null?m:he.md;return(0,$.jsx)("div",V(p({},C?{className:C}:{}),{style:p(p({display:"grid",gridTemplateColumns:`repeat(auto-fit, minmax(max(200px, calc((100% - ${e.columns-1} * ${f}) / ${e.columns})), 1fr))`,gap:f},e.align?{alignItems:Ft[e.align]}:{}),e.pad?{padding:(S=he[e.pad])!=null?S:he.md}:{}),children:((v=e.children)!=null?v:[]).map((A,U)=>{let k=ke(A,t);return k===null?null:(0,$.jsx)(We.Fragment,{children:k},U)})}))}case"text":return C?(0,$.jsx)("p",{className:C,style:e.maxWidth==="measure"?{maxWidth:"65ch"}:void 0,children:e.value}):(0,$.jsx)("p",{style:p(p(p(p(p({margin:0},e.size?{fontSize:nr[e.size]}:{}),e.weight?{fontWeight:di[e.weight]}:{}),e.align?{textAlign:e.align}:{}),e.maxWidth==="measure"?{maxWidth:"65ch"}:{}),tr(e.tone,t.palette)),children:e.value});case"heading":{let f=`h${e.level}`;return C?(0,$.jsx)(f,{className:C,style:e.maxWidth==="measure"?{maxWidth:"65ch"}:void 0,children:e.value}):(0,$.jsx)(f,{style:p(p({margin:0,fontSize:ui[(g=e.size)!=null?g:"md"]},e.align?{textAlign:e.align}:{}),e.maxWidth==="measure"?{maxWidth:"65ch"}:{}),children:e.value})}case"button":{let f=(h=e.emphasis)!=null?h:"primary";return(0,$.jsx)("a",V(p(p({href:Lt(e.href)},e.tag?{"data-sentient-tag":e.tag}:{}),C?{className:C}:{style:rr(f,t.palette,e.size)}),{children:e.label}))}case"link":return(0,$.jsx)("a",V(p(p({href:Lt(e.href)},e.tag?{"data-sentient-tag":e.tag}:{}),C?{className:C}:{style:{color:"inherit",textDecoration:"underline"}}),{children:e.label}));case"image":return(0,$.jsx)("img",V(p({src:Lt(e.src),alt:e.alt},C?{className:C}:{}),{style:p(p({display:"block",maxWidth:"100%"},e.ratio&&e.ratio!=="auto"?{aspectRatio:ci[e.ratio],width:"100%"}:{}),e.fit?{objectFit:e.fit}:{})}));case"badge":return C?(0,$.jsx)("span",{className:C,children:e.value}):(0,$.jsx)("span",{style:p({display:"inline-block",padding:"2px 10px",borderRadius:"999px",fontSize:"0.75em",border:`1px solid ${(O=(x=t.palette)==null?void 0:x.border)!=null?O:"currentColor"}`},tr(e.tone,t.palette)),children:e.value});case"spacer":return(0,$.jsx)("div",{style:{height:(N=er[e.size])!=null?N:er.md}});case"divider":return(0,$.jsx)("hr",{style:{border:"none",borderTop:`1px solid ${(R=(P=t.palette)==null?void 0:P.border)!=null?R:"currentColor"}`,margin:0,width:"100%"}});case"form":return(0,$.jsx)(fi,{node:e,opts:t});default:return null}}catch(C){return null}}function lt(e,t){var o,l,a,u;let n=ke(e.tree,t);if(n===null)return null;let r=(o=e.surface)!=null&&o.like?(a=(l=t.vocabulary)==null?void 0:l.entries.find(s=>s.id===e.surface.like))==null?void 0:a.classes:void 0,i=ir((u=e.surface)==null?void 0:u.like,t);return r?(0,$.jsx)("div",V(p({className:r},i?{style:{color:i}}:{}),{children:n})):n}var ge=require("react"),ut=require("@sentientui/core/region");function ct(e){return typeof e=="string"&&e.trim()!==""||typeof e=="number"}function dt(e){let t=e.props;if(t.dangerouslySetInnerHTML==null)return t.children}function Re(e){return ct(e)?1:Array.isArray(e)?e.reduce((t,n)=>t+Re(n),0):(0,ge.isValidElement)(e)?Re(dt(e)):0}function pi(e,t){return Array.isArray(t)?(0,ge.cloneElement)(e,void 0,...t):(0,ge.cloneElement)(e,void 0,t)}function Vt(e,t){if(ct(e))return t;if(Array.isArray(e))return e.map(n=>Vt(n,t));if((0,ge.isValidElement)(e)){let n=dt(e);return Re(n)===0?e:pi(e,Vt(n,t))}return e}function or(e,t){return Re(e)===1?Vt(e,t):null}var re=e=>e.join("/");function Mt(e,t,n){if(ct(e)){n.leafPaths.push(t),n.texts.push((0,ut.normalizeLeafText)(String(e)));return}if(Array.isArray(e)){e.forEach((r,i)=>Mt(r,[...t,i],n));return}(0,ge.isValidElement)(e)&&(n.elements.set(re(t),e),Mt(dt(e),[...t,"c"],n))}function $t(e){let t={leafPaths:[],texts:[],elements:new Map};return Mt(e,[],t),t}function yi(e){return $t(e).texts}function sr(e){let t=yi(e);return t.length===0?null:(0,ut.skeletonFingerprint)(t)}function vi(e){let t=[];return e.forEach((n,r)=>{n==="c"&&t.push(e.slice(0,r))}),t}function ar(e,t){let n=t.reduce((i,o)=>Math.max(i,o+1),0),r=[];for(let i=0;i<n;i++){let o=t.flatMap((a,u)=>a===i?[vi(e.leafPaths[u])]:[]);if(o.length===0){r.push(null);continue}let l=o[0];for(let a of o.slice(1)){let u=new Set(a.map(re));l=l.filter(s=>u.has(re(s)))}r.push(l.length>0?l[l.length-1]:null)}return r}function jt(e){var n;let t=(n=e==null?void 0:e.props)==null?void 0:n.className;return typeof t=="string"?t:void 0}function Bt(e,t){let n=$t(t);if(n.texts.length!==e.leaves.length||n.texts.some((o,l)=>o!==e.leaves[l]))return null;let r=ar(n,e.leafToNode),i=e.nodes.map((o,l)=>{let a=r[l],u=a?n.elements.get(re(a)):void 0,s=!!u&&(typeof u.type=="string"||jt(u)!==void 0);return V(p({},o),{restylable:s})});return V(p({},e),{nodes:i})}function lr(e,t,n){var d;let r=$t(e);if(r.leafPaths.length!==n.length)return null;let i=n.reduce((m,S)=>Math.max(m,S+1),0);for(let m of Object.keys(t.nodes))if(!/^\d+$/.test(m)||Number(m)>=i)return null;let o=ar(r,n),l=new Map;n.forEach((m,S)=>{l.has(m)||l.set(m,S)});let a=new Map(r.leafPaths.map((m,S)=>[re(m),S])),u=new Set,s=new Map,y=!1;for(let[m,S]of Object.entries(t.nodes)){let v=Number(m),g=o[v];if(S.hidden&&(g?u.add(re(g)):y=!0),S.like!==void 0){let h=o[S.like],x=g?r.elements.get(re(g)):void 0,O=h?jt(r.elements.get(re(h))):void 0;!g||O===void 0||jt(x)===void 0?y=!0:s.set(re(g),O)}}let c=new Map(Object.entries((d=t.order)!=null?d:{})),b=(m,S)=>{var v;if(ct(m)){let g=a.get(re(S));if(g===void 0)return m;let h=n[g],x=(v=t.nodes[String(h)])==null?void 0:v.text;return x===void 0?m:l.get(h)===g?x:""}if(Array.isArray(m)){let g=m.map((h,x)=>b(h,[...S,x]));for(let[h,x]of c){let O=x.map(R=>{let C=o[R];return!C||C.length!==S.length+1||re(C.slice(0,-1))!==re(S)?-1:C[C.length-1]});if(O.some(R=>R<0))continue;let N=[...O].sort((R,C)=>R-C),P=[...g];N.forEach((R,C)=>{g[R]=P[O[C]]}),c.delete(h)}return g}if((0,ge.isValidElement)(m)){let g=re(S);if(u.has(g))return null;let h=dt(m);if(Re(h)===0)return m;let x=b(h,[...S,"c"]),O=s.get(g),N=O!==void 0?{className:O}:void 0;return Array.isArray(x)?(0,ge.cloneElement)(m,N,...x):(0,ge.cloneElement)(m,N,x)}return m},w=b(e,[]);return y||c.size>0?null:w}var fr=require("react/jsx-runtime"),ur=new Set,cr=new Set,dr=new Set,ft="authored.";function De({id:e,children:t,variants:n,onFormSubmit:r,goal:i,className:o,as:l="div",reportBaselineText:a=!0,funnel:u,microSignalGoals:s,clientOnly:y,agentDataByVariant:c,agentData:b,variantsOnly:w=!1}){var en,tn;let d=M(),m=ie(),S=(0,L.useRef)(null),[v,g]=(0,L.useState)(!1);(0,L.useEffect)(()=>{g(!0)},[]);let h=y===!0&&(!v||!d),x=(0,L.useMemo)(()=>sr(t),[t]),O=n?Object.keys(n).join("|"):"",N=(0,L.useMemo)(()=>p({fp:x!=null?x:"0000000000000000",forms:!!r,compose:!0,content:Re(t)===1,ops:!1},O!==""?{authored:O.split("|"),children:!w}:{}),[x,t,r,O,w]),P=()=>{var Y;let E=S.current;if(!E||!a)return null;let I=(0,Ut.captureRegionSkeleton)(E);return I.skeleton?(Y=Bt(I.skeleton,t))!=null?Y:V(p({},I.skeleton),{editable:!1,nodes:I.skeleton.nodes.map(J=>V(p({},J),{restylable:!1}))}):{status:I.reason}},R=(0,L.useSyncExternalStore)(ee,()=>n?Se(e):null,()=>null),C=R===null||!n?null:Object.prototype.hasOwnProperty.call(n,R)?`${ft}${R}`:w?`${ft}${Object.keys(n)[0]}`:"baseline",{config:f,arm:A,palette:U,vocabulary:k,source:G}=Zn(e,{forcedArm:C,baselineText:a?()=>{var E,I;return(I=(E=S.current)==null?void 0:E.textContent)!=null?I:null}:void 0,render:()=>N,skeleton:P,defer:h}),F=A!==""?(en=f==null?void 0:f.blocks)==null?void 0:en[A]:void 0,j=A!==""?(tn=f==null?void 0:f.compose)==null?void 0:tn[A]:void 0,T=(F!==void 0&&(0,Ae.containsFormBlock)(F)||j!==void 0&&(0,Ae.containsFormBlock)(j.tree))&&!r;(0,L.useEffect)(()=>{!T||!D()||ur.has(e)||(ur.add(e),console.warn(`[sentient] AdaptiveSlot "${e}" was served a form arm but has no onFormSubmit handler \u2014 rendering its baseline children instead. Pass onFormSubmit to render generated forms.`))},[T,e]);let H=E=>{!d||G==="override"||(G!=="seeded"&&d.componentGoal(e,E),d.goal(E,{metadata:{componentId:e,arm:A},weight:1,stepIndex:0}))},W=t,B=!1,q=A.startsWith(ft)?A.slice(ft.length):null;if((f==null?void 0:f.blocked)==="variant_history")B=!0;else if(q!==null)n&&Object.prototype.hasOwnProperty.call(n,q)?W=n[q]:B=!0;else if(j!==void 0){let E=T?null:lt(j,{palette:U,vocabulary:k,onFormSubmit:r,onFormGoal:H});E===null?B=!0:W=E}else if(F!==void 0){let E=T?null:ke(F,{palette:U,vocabulary:k,onFormSubmit:r,onFormGoal:H});E===null?B=!0:W=E}else if((f==null?void 0:f.edits)!==void 0&&G!=="none"){let E=f.edits,I=E.fp===x?lr(t,E.edits,E.leafToNode):null;I===null?B=!0:W=I}else if((f==null?void 0:f.content)!==void 0&&G!=="none"){let E=or(t,f.content);E===null?B=!0:W=E}let Ve=B&&F===void 0&&j===void 0&&(f==null?void 0:f.edits)===void 0&&q===null&&(f==null?void 0:f.blocked)===void 0;(0,L.useEffect)(()=>{(f==null?void 0:f.blocked)!=="variant_history"||!D()||dr.has(e)||(dr.add(e),console.warn(`[sentient] <Adaptive id="${e}"> has results from its earlier variants experiment, so it is showing your original until you migrate it: Components \u2192 "${e}" \u2192 Migrate. Deploying code never switches an experiment.`))},[f==null?void 0:f.blocked,e]);let X=q!==null&&!B?q:null;(0,L.useEffect)(()=>{var ue;if(!X||!a||!d)return;let E=S.current;if(!E)return;let I=(0,Ut.captureRegionSkeleton)(E),Y=I.skeleton?Bt(I.skeleton,n==null?void 0:n[X]):null,J=(ue=E.textContent)==null?void 0:ue.trim();d.reportSlots([],void 0,void 0,{[e]:[p(p({key:X},J?{text:J}:{}),Y?{skeleton:Y}:{})]})},[X,d,e,h]);let le=B&&(f==null?void 0:f.edits)!==void 0&&(G==="preloaded"||G==="client");(0,L.useEffect)(()=>{var E;!le||!(f!=null&&f.edits)||(E=d==null?void 0:d.reportDrift)==null||E.call(d,e,f.edits.fp,x,f.edits.fp===x?"unaddressable":"fp_mismatch")},[le,e,x,d]);let Me=W===t;(0,L.useEffect)(()=>{var I;if(!(f!=null&&f.needsSkeleton)||!Me)return;let E=P();E&&((I=d==null?void 0:d.reportSkeleton)==null||I.call(d,e,E))},[f==null?void 0:f.needsSkeleton,Me,e,d,h]),(0,L.useEffect)(()=>{if(!Me)return;let E=En(e);if(!E)return;let I=P();Pn(E,I&&"status"in I?{status:I.status}:{skeleton:I})},[e,Me,h]),(0,L.useEffect)(()=>{!Ve||!D()||cr.has(e)||(cr.add(e),console.warn(`[sentient] <Adaptive id="${e}"> was served a text version, but its children have several separate texts or none Sentient can reach \u2014 rendering the original instead. Regenerate the version (new versions edit each text in place), or put a single text inline.`))},[Ve,e]);let yt=f!=null&&f.blocks?Object.keys(f.blocks).sort().join("|"):"",vt=n?[...w?[]:["baseline"],...O.split("|")].join("|"):"";(0,L.useEffect)(()=>vt!==""?Ye({id:e,variantIds:vt.split("|")}):Ge({id:e,arms:yt===""?void 0:yt.split("|")}),[e,yt,vt]);let Xt=(0,L.useRef)(null);(0,L.useEffect)(()=>{!d||G==="none"||G==="seeded"||G==="override"||A===""||B||Xt.current!==A&&(Xt.current=A,ve(d,m,e,A))},[d,m,e,A,G,B]);let pe=G!=="none"&&G!=="seeded"&&!B,St=pe?A:"",zt=i===void 0?null:typeof i=="string"?i:JSON.stringify(i);(0,L.useEffect)(()=>{G!=="override"&&st(d,m,i)},[d,m,i,G]),(0,L.useEffect)(()=>{if(!d||!i||G==="override")return;let E=S.current;if(!E)return;let I=ye(i),Y=ce(i),J=!1;return de(E,ne(i),{fireGoal:()=>{J||(J=!0,pe&&(Y!==void 0?d.componentGoal(e,I,{value:Y}):d.componentGoal(e,I)),d.goal(I,p({metadata:{componentId:e,arm:St},weight:1,stepIndex:0},Y!==void 0?{value:Y}:{})))},fireStep:(ue,Xe,bt)=>{pe&&d.componentGoal(e,ue,{reward:Xe}),d.goal(ue,{metadata:{componentId:e,arm:St},weight:Xe,stepIndex:bt})}},I)},[d,e,zt,A,G,B,pe,St,h]);let ht=(0,L.useMemo)(()=>i?ne(i):null,[zt]);(0,L.useEffect)(()=>{G==="override"||!d||!ht||fe(d,m,e,u,ht)},[d,m,e,u,ht,G]);let qt=(0,L.useRef)(s);qt.current=s;let Yt=(0,L.useRef)(new Set),Mr=s?JSON.stringify(s):"";(0,L.useEffect)(()=>{if(!d||G==="override"||!pe||A==="")return;let E=S.current;if(E)return(0,Ae.attachMicroSignalDetectors)((I,Y={})=>{var nn,rn,on;d.track({projectId:m,componentId:e,variantId:A,eventType:"micro_signal",payload:p({signalType:I},Y)});let J=(nn=qt.current)==null?void 0:nn[I];if(!J||Yt.current.has(I))return;Yt.current.add(I);let ue=typeof J=="string"?J:J.name,Xe=typeof J=="string"?1:(rn=J.weight)!=null?rn:1,bt=typeof J=="string"?0:(on=J.stepIndex)!=null?on:0;d.goal(ue,{metadata:p({componentId:e,arm:A,signalType:I},Y),weight:Xe,stepIndex:bt})},E,Date.now())},[d,m,e,A,G,pe,Mr,h]);let Zt=(0,L.useRef)({agentData:b,agentDataByVariant:c});Zt.current={agentData:b,agentDataByVariant:c};let Qt=(0,L.useRef)(null);(0,L.useEffect)(()=>{var ue;if(!d||G==="override"||!pe||A===""||Qt.current===A)return;let{agentData:E,agentDataByVariant:I}=Zt.current,Y=q!=null?q:A,J=I!==void 0?Object.prototype.hasOwnProperty.call(I,Y)?I[Y]:void 0:E;J!==void 0&&(Qt.current=A,(ue=d.reportAgentData)==null||ue.call(d,e,A,J))},[d,e,A,pe,q,G]);let He=(0,L.useRef)(null);(0,L.useEffect)(()=>{let E=S.current;if(E){if(He.current===null){He.current=A;return}He.current!==A&&(He.current=A,(0,Ae.reveal)(E))}},[A,h]);let jr=(0,L.useMemo)(()=>p({"data-sentient-slot":e},A!==""?{"data-sentient-arm":A}:{}),[e,A]);return h?null:(0,fr.jsx)(l,V(p({ref:S,className:o},jr),{children:W}))}var Ce=require("react/jsx-runtime");function Si(e){var y,c;let{client:t,variantId:n,content:r,ref:i}=at(e.id,e.variants,{goal:e.goal,funnel:e.funnel,microSignalGoals:e.microSignalGoals,agentData:e.agentData,agentDataByVariant:e.agentDataByVariant,cursorSignal:!0,onUnified:e.onUnified}),[o,l]=(0,me.useState)(!1);(0,me.useEffect)(()=>{l(!0)},[]);let a=(y=e.as)!=null?y:"div";if(e.clientOnly&&(!o||!t)||!n)return null;let u=(c=e.variants[n])!=null?c:null,s=u===null?r:null;return D()&&u===null&&s===null&&console.warn(`[sentient] <Adaptive id="${e.id}"> was assigned variant "${n}" but no matching key exists in props.variants. If this is a dashboard-managed text variant, use <AdaptiveText id="${e.id}"> instead.`),(0,Ce.jsx)(a,{ref:i,className:e.className,"data-sentient-id":e.id,"data-sentient-variant":n,children:u!=null?u:s})}var hi=(0,me.memo)(Si,(e,t)=>{if(e.id!==t.id||e.goal!==t.goal&&JSON.stringify(e.goal)!==JSON.stringify(t.goal)||e.microSignalGoals!==t.microSignalGoals||e.funnel!==t.funnel||e.clientOnly!==t.clientOnly||e.as!==t.as||e.className!==t.className||e.agentData!==t.agentData||e.agentDataByVariant!==t.agentDataByVariant||e.onUnified!==t.onUnified)return!1;if(e.variants===t.variants)return!0;let n=Object.keys(e.variants),r=Object.keys(t.variants);return n.length!==r.length?!1:n.every(i=>i in t.variants&&Object.is(e.variants[i],t.variants[i]))});function gr(e){if(e.variants===void 0)return(0,Ce.jsx)(De,p({},e));let t=e;if(t.children!=null){let n=t,{variants:r}=n,i=$e(n,["variants"]);return(0,Ce.jsx)(De,V(p({},i),{children:t.children,variants:r}))}return(0,Ce.jsx)(bi,p({},t))}function bi(e){var c;let[t,n]=(0,me.useState)(null),{id:r}=e,i=(0,me.useCallback)(()=>n(r),[r]),o=M(),l=tt().includes(r)||((c=o==null?void 0:o.isUnified)==null?void 0:c.call(o,r))===!0;if(t!==r&&!l)return(0,Ce.jsx)(hi,V(p({},e),{onUnified:i}));let b=e,{variants:a,children:u}=b,s=$e(b,["variants","children"]),y=Object.keys(a)[0];return(0,Ce.jsx)(De,V(p({},s),{variants:a,variantsOnly:!0,children:y!==void 0?a[y]:null}))}var z=require("react");var pr=require("react/jsx-runtime");function mr({id:e,default:t,component:n="span",className:r,goal:i}){var N;let o=M(),l=ie(),a=nt(),u=Ie(),s=(0,z.useRef)(null),y=(0,z.useRef)(null),c=(0,z.useSyncExternalStore)(ee,()=>Se(e),()=>null),[b,w]=(0,z.useState)(()=>{var P,R;return(R=(P=o==null?void 0:o.getAssignment(e,u))==null?void 0:P.content)!=null?R:null}),[d,m]=(0,z.useState)(()=>{var P,R;return(R=(P=o==null?void 0:o.getAssignment(e,u))==null?void 0:P.variantId)!=null?R:null});(0,z.useEffect)(()=>{if(c||!o)return;let P=o.getAssignment(e,u);if((P==null?void 0:P.content)!==void 0){m(P.variantId),w(P.content);return}let R=!1;return o.assign(e).then(C=>{if(!R){if(!C){D()&&console.warn(`[sentient] <AdaptiveText id="${e}"> assignment failed \u2014 showing default text.`);return}m(C.variantId),C.content&&w(C.content)}}),()=>{R=!0}},[o,e,u,c]),(0,z.useEffect)(()=>{c||!o||!d||!l||s.current!==d&&(s.current=d,o.track({projectId:l,componentId:e,variantId:d,eventType:"variant_assigned",payload:{}}),a==null||a(e,d))},[o,d,l,e,a,c]);let S=i===void 0?"":typeof i=="string"?i:JSON.stringify(i),v=(0,z.useMemo)(()=>i===void 0?null:ne(i),[S]),g=i===void 0?null:typeof i=="string"?i:v.type,h=(0,z.useRef)(!1);(0,z.useEffect)(()=>{h.current=!1},[d,S]),(0,z.useEffect)(()=>{c||!o||!l||fe(o,l,e,void 0,v)},[o,l,e,v,c]),(0,z.useEffect)(()=>{if(c||!o||!d||!l||!v||!g)return;let P=y.current;if(!P)return;let R=ce(v);return de(P,v,{fireGoal:()=>{h.current||(h.current=!0,o.track({projectId:l,componentId:e,variantId:d,eventType:"goal_achieved",goalType:g,payload:p({reward:1},R!==void 0?{goalValue:R}:{})}),o.goal(g,p({metadata:{componentId:e,variantId:d},weight:1,stepIndex:0},R!==void 0?{value:R}:{})))},fireStep:(C,f,A)=>{o.track({projectId:l,componentId:e,variantId:d,eventType:"goal_achieved",goalType:C,payload:{reward:f}}),o.goal(C,{metadata:{},weight:f,stepIndex:A})}})},[o,d,l,e,v,g,c]);let x=b!=null?b:t;if(c){let P=o==null?void 0:o.getAssignment(e,u);x=P&&P.variantId===c&&(N=P.content)!=null?N:t}return(0,pr.jsx)(n,{ref:P=>{y.current=P},className:r,children:x})}var gt=require("react");function Ke(e){var t,n;return p(p(p({metadata:(t=e==null?void 0:e.metadata)!=null?t:{},weight:(n=e==null?void 0:e.reward)!=null?n:1,stepIndex:0},(e==null?void 0:e.value)!==void 0?{value:e.value}:{}),(e==null?void 0:e.currency)!==void 0?{currency:e.currency}:{}),(e==null?void 0:e.externalId)!==void 0?{externalId:e.externalId}:{})}function Le(e){let t=M(),n=(0,gt.useRef)(new Set);return(0,gt.useCallback)((r,i)=>{if(!Se(e)){if(i!=null&&i.once){if(n.current.has(r))return;n.current.add(r)}t==null||t.componentGoal(e,r,i),t==null||t.goal(r,Ke(i))}},[t,e])}var Je=require("react");function yr(e,t={}){let u=t,{componentId:n}=u,r=$e(u,["componentId"]),i=M(),o=Le(n!=null?n:""),l=(0,Je.useRef)(!1),a=(0,Je.useRef)(r);a.current=r,(0,Je.useEffect)(()=>{if(!(!i||l.current||i.gated)){if(l.current=!0,n){o(e,a.current);return}i.goal(e,Ke(a.current))}},[i,n,e,o])}var Fe=require("react");function vr(e,t={}){let{primary:n=!1,componentId:r}=t,i=M(),o=ie(),l=Le(r!=null?r:""),a=(0,Fe.useRef)(!1);return(0,Fe.useEffect)(()=>{!i||i.gated||!o||Dt(i,o,e,n)},[i,o,e,n]),(0,Fe.useCallback)(u=>{if(u!=null&&u.once){if(a.current)return;a.current=!0}if(r){l(e,u);return}i==null||i.goal(e,Ke(u))},[i,r,l,e])}var Sr=require("@sentientui/core"),hr=require("@sentientui/policy"),wr=require("react/jsx-runtime");function Wt(e){return JSON.stringify(e).replace(/</g,"\\u003c")}function wi(e){return e.persona?"(function(){try{var d=document.documentElement;"+(e.stage?'if(!d.hasAttribute("data-sentient-stage"))d.setAttribute("data-sentient-stage",'+Wt(e.stage)+");":"")+'if(d.hasAttribute("data-sentient-persona"))return;d.setAttribute("data-sentient-persona",'+Wt(e.persona.persona)+');d.setAttribute("data-sentient-confidence",'+Wt((0,hr.confidenceBand)(e.persona.confidence))+");}catch(e){}})();":(0,Sr.renderPrePaintScript)(e.apiKey,e.stageAttributes?{stage:!0}:void 0)}function br(e){return!e.persona&&(e.consent===!1||e.consentFrom!==void 0&&e.consent!==!0)?null:(0,wr.jsx)("script",{"data-sentient-persona-script":"",nonce:e.nonce,dangerouslySetInnerHTML:{__html:wi(e)}})}var ae=require("react"),Ar=require("@sentientui/policy");var se=require("react"),_e=require("@sentientui/core"),xr=require("@sentientui/policy");function mt(e,t){let n=M(),r=rt(),[,i]=(0,se.useReducer)(c=>c+1,0),o=(0,se.useSyncExternalStore)(ee,()=>{var c;return typeof window!="undefined"?(c=window.__sentient_slot_overrides)==null?void 0:c[e]:void 0},()=>{}),l=o===void 0?r[e]:void 0,a=o===void 0&&l===void 0&&n?n.getSlotResult(e):null,u=(n==null?void 0:n.isLocal)===!0&&o===void 0&&l===void 0&&a===null;(0,se.useEffect)(()=>{if(!u||!n)return;let c=!1;return n.decide({slots:[t]}).then(b=>{!c&&b&&i()}),()=>{c=!0}},[n,e,u]);let s=(()=>{if(o!==void 0)return{result:o,arm:(0,_e.armOfResult)(o),source:"override"};if(l!==void 0)return{result:l,arm:(0,_e.armOfResult)(l),source:"preloaded"};if(a!==null){let b=n!=null&&n.isSlotDecided?n.isSlotDecided(e):!0;return{result:a,arm:(0,_e.armOfResult)(a),source:b?"client":"seeded"}}let c=(0,_e.baselineResultFor)(t);return{result:c,arm:(0,_e.armOfResult)(c),source:"baseline"}})(),y=s.source==="preloaded"||s.source==="override";return(0,se.useEffect)(()=>{var b;if(!n||n.isLocal===!0||y||!n.decideSlots)return;let c=(b=n.onSlotsChanged)==null?void 0:b.call(n,i);return n.decideSlots([t]),()=>{var w;(w=n.cancelSlots)==null||w.call(n,[e]),c==null||c()}},[n,e,y]),s}function xi(){var t;if(typeof window=="undefined")return null;let e=window.__sentient_persona_override;if(e!=null&&e.persona)return{persona:e.persona,confidence:(t=e.confidence)!=null?t:1};try{let n=new URLSearchParams(window.location.search).get("sentient_persona");if(n)return{persona:n,confidence:1}}catch(n){}return null}function kr(){let e=M(),t=$n();(0,se.useSyncExternalStore)(ee,pn,()=>0);let[n,r]=(0,se.useState)(!1);(0,se.useEffect)(()=>r(!0),[]);let i=a=>({persona:a.persona,confidence:a.confidence,band:(0,xr.confidenceBand)(a.confidence)});if(!n)return t?i(t):null;let o=xi();if(o)return i(o);if(t)return i(t);let l=e?e.getPersona():null;return l?i(l):null}var Rr=new Set;function ki(e){return typeof CSS!="undefined"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/[\\"]/g,"\\$&")}function Cr(e,t,n){let r=M(),i=ie(),o=JSON.stringify(t),l=(0,ae.useMemo)(()=>({id:e,dims:t}),[e,o]),{result:a,arm:u,source:s}=mt(e,l),y=(0,ae.useMemo)(()=>typeof a=="string"?{}:a,[u]);if(D()&&!Rr.has(e)){Rr.add(e);let m=(0,Ar.validateSlotDecl)({id:e,dims:Object.fromEntries(Object.entries(t).map(([v,g])=>[v,[...g]]))}),S=Object.values(t).reduce((v,g)=>v*g.length,1);m.ok?S>4&&console.warn(`[sentient] useAdaptiveTokens("${e}") declares ${S} combinations \u2014 more than the recommended 4. Each extra combination needs more traffic to learn; consider fewer dims/values.`):console.warn(`[sentient] useAdaptiveTokens("${e}"): invalid declaration \u2014 ${m.reason}. Serving baseline.`)}let c=(n==null?void 0:n.goal)===void 0?null:typeof n.goal=="string"?n.goal:JSON.stringify(n.goal);(0,ae.useEffect)(()=>Ge({id:e,dims:t}),[e]);let b=(0,ae.useRef)(null);(0,ae.useEffect)(()=>{!r||s==="baseline"||s==="seeded"||s==="override"||b.current===u||(b.current=u,ve(r,i,e,u))},[r,i,e,u,s]);let w=n==null?void 0:n.funnel;(0,ae.useEffect)(()=>{var m;!r||s==="override"||fe(r,i,e,w,ne((m=n==null?void 0:n.goal)!=null?m:"click"))},[r,i,e,w,c,s]),(0,ae.useEffect)(()=>{if(!r||!(n!=null&&n.goal)||s==="override"||s==="baseline"||s==="seeded")return;let m=document.querySelector(`[data-sentient-slot="${ki(e)}"]`);if(!m){D()&&console.warn(`[sentient] useAdaptiveTokens("${e}"): a goal is declared but no element carries the returned props \u2014 spread {...props} on the slot's element.`);return}let S=ye(n.goal),v=ce(n.goal),g=!1;return de(m,ne(n.goal),{fireGoal:()=>{g||(g=!0,v!==void 0?r.componentGoal(e,S,{value:v}):r.componentGoal(e,S),r.goal(S,p({metadata:{componentId:e,arm:u},weight:1,stepIndex:0},v!==void 0?{value:v}:{})))},fireStep:(h,x,O)=>{r.componentGoal(e,h,{reward:x}),r.goal(h,{metadata:{componentId:e,arm:u},weight:x,stepIndex:O})}},S)},[r,e,c,u,s]);let d=(0,ae.useMemo)(()=>{let m={"data-sentient-slot":e};for(let[S,v]of Object.entries(y))m[`data-${S}`]=v;return m},[e,y]);return{tokens:y,props:d}}var Oe=require("react");var _r=new Set,Or=new Set;function Gr(e,t){var d,m;if(D()&&!t.goal)throw new Error(`[sentient] useAdaptive("${e}"): a goal is required \u2014 without one the optimizer accumulates exposures with no rewards and cannot learn. Pass e.g. goal: 'buy_click'.`);let{client:n,variantIds:r,variantId:i,isOverride:o,goalLabel:l,ref:a,nodeRef:u}=at(e,t.variants,{goal:t.goal,funnel:t.funnel,microSignalGoals:t.microSignalGoals}),s=(d=i!=null?i:r[0])!=null?d:"",y=t.variants[s],c=tt().includes(e)||((m=n==null?void 0:n.isUnified)==null?void 0:m.call(n,e))===!0;(0,Oe.useEffect)(()=>{!c||!D()||Or.has(e)||(Or.add(e),console.warn(`[sentient] useAdaptive("${e}"): this component was moved to the shared track, which useAdaptive cannot render yet. It keeps showing the frozen result and learns nothing \u2014 render it with <Adaptive id="${e}" variants={...}> instead.`))},[c,e]),(0,Oe.useEffect)(()=>{if(!D()||!n)return;let S=setTimeout(()=>{!u.current&&!_r.has(e)&&(_r.add(e),console.warn(`[sentient] useAdaptive("${e}"): bind was never attached \u2014 spread {...bind} on the rendered element, otherwise exposure and goal tracking cannot work and the optimizer learns nothing.`))},0);return()=>clearTimeout(S)},[n,e]);let b=(0,Oe.useCallback)((S,v)=>{var h,x;if(o)return;let g=S!=null?S:l;g&&(n==null||n.componentGoal(e,g,v),n==null||n.goal(g,p(p(p({metadata:(h=v==null?void 0:v.metadata)!=null?h:{},weight:(x=v==null?void 0:v.reward)!=null?x:1,stepIndex:0},(v==null?void 0:v.value)!==void 0?{value:v.value}:{}),(v==null?void 0:v.currency)!==void 0?{currency:v.currency}:{}),(v==null?void 0:v.externalId)!==void 0?{externalId:v.externalId}:{})))},[n,e,l,o]),w=(0,Oe.useMemo)(()=>({ref:a,"data-sentient-id":e,"data-sentient-variant":s}),[a,e,s]);return{variant:s,value:y,bind:w,fireGoal:b}}var Q=require("react");var Pr=require("react/jsx-runtime"),pt=new Set;function Er(e){var g;let t=M(),n=ie(),r=(0,Q.useRef)(null),i=Object.keys(e.arrangements).join(" "),o=(0,Q.useMemo)(()=>Object.keys(e.arrangements),[i]),l=(0,Q.useMemo)(()=>p({id:e.id,arms:o},e.baseline!==void 0?{baseline:e.baseline}:{}),[e.id,o,e.baseline]),{arm:a,source:u}=mt(e.id,l);D()&&e.baseline!==void 0&&e.baseline!==o[0]&&!pt.has(e.id+":baseline")&&(pt.add(e.id+":baseline"),console.warn(`[sentient] <AdaptiveGroup id="${e.id}">: baseline "${e.baseline}" is not the first-declared arrangement ("${o[0]}"). The first arrangement should usually be the page's real incumbent (the holdout sees it).`));let s=Q.Children.toArray(e.children).filter(Q.isValidElement),y=new Map;for(let h of s)y.set(String((g=h.key)!=null?g:"").replace(/^\.\$/,""),h);let c=e.arrangements[a],b=c!==void 0&&c.length===s.length&&c.every(h=>y.has(h));D()&&c!==void 0&&!b&&!pt.has(e.id+":keys")&&(pt.add(e.id+":keys"),console.warn(`[sentient] <AdaptiveGroup id="${e.id}">: arrangement "${a}" [${c.join(", ")}] does not match the children's keys \u2014 rendering declaration order (fail-safe).`));let w=b?c.map(h=>y.get(h)):s;(0,Q.useEffect)(()=>Ge({id:e.id,arms:Object.keys(e.arrangements)}),[e.id]);let d=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{!t||u==="baseline"||u==="seeded"||u==="override"||d.current===a||(d.current=a,ve(t,n,e.id,a))},[t,n,e.id,a,u]);let m=e.funnel,S=e.goal===void 0||typeof e.goal=="string"?"":JSON.stringify(e.goal);(0,Q.useEffect)(()=>{var h;!t||u==="override"||fe(t,n,e.id,m,ne((h=e.goal)!=null?h:"click"))},[t,n,e.id,m,S,u]);let v=e.goal===void 0?null:typeof e.goal=="string"?e.goal:JSON.stringify(e.goal);return(0,Q.useEffect)(()=>{if(!t||e.goal===void 0||u==="override"||u==="baseline"||u==="seeded")return;let h=r.current;if(!h)return;let x=ye(e.goal),O=ce(e.goal),N=!1;return de(h,ne(e.goal),{fireGoal:()=>{N||(N=!0,O!==void 0?t.componentGoal(e.id,x,{value:O}):t.componentGoal(e.id,x),t.goal(x,p({metadata:{componentId:e.id,arm:a},weight:1,stepIndex:0},O!==void 0?{value:O}:{})))},fireStep:(P,R,C)=>{t.componentGoal(e.id,P,{reward:R}),t.goal(P,{metadata:{componentId:e.id,arm:a},weight:R,stepIndex:C})}},x)},[t,e.id,v,a,u]),(0,Pr.jsx)("div",{ref:r,"data-sentient-id":e.id,"data-sentient-variant":a,children:w})}var Kt=require("@sentientui/core");var Ri=["page","blocks","layoutOrder"],Nr=new Map;function Tr(e,t){Nr.set(e,t)}function Jt(e){return Nr.get(e)}function Ir(e){var i,o;let t=(o=(i=e.content)!=null?i:Jt(e.page))!=null?o:{},n={};for(let[l,a]of Object.entries(t))Ri.includes(l)||(n[l]=a);let r=V(p({},n),{page:e.page,blocks:e.blocks});return e.layoutOrder&&(r.layoutOrder=e.layoutOrder),r}function Dr(e){return`<script type="application/ld+json">${Ht(e)}</script>`}function Ht(e){return JSON.stringify(p({"@context":"https://schema.org","@type":"WebPage"},e)).replace(/</g,"\\u003c")}function Lr(e){let t=[];e.title&&t.push(`# ${e.title}`,""),e.summary&&t.push(String(e.summary),"");for(let[n,r]of Object.entries(e))["page","title","summary","blocks","layoutOrder"].includes(n)||t.push(`## ${n}`,"","```json",JSON.stringify(r,null,2),"```","");if(e.blocks.length>0){t.push("## blocks","");for(let n of e.blocks)t.push(`- **${n.id}** \u2192 variant \`${n.variant}\``),n.content!==void 0&&t.push(""," ```json",JSON.stringify(n.content,null,2)," ```");t.push("")}return t.join(`
3
3
  `).trimEnd()+`
4
4
  `}var Fr=require("@sentientui/core"),Vr=require("@sentientui/core/consent");0&&(module.exports={Adaptive,AdaptiveGroup,AdaptiveProvider,AdaptiveSlot,AdaptiveText,SentientPersonaScript,buildAgentFeed,consentWatcher,defineAgentContent,detectSegment,getAgentContent,grantConsent,renderAgentJsonLd,renderAgentJsonLdBody,renderAgentMarkdown,renderBlocks,renderCompose,useAdaptive,useAdaptiveApiBaseUrl,useAdaptiveGoal,useAdaptivePersona,useAdaptiveTokens,useAssignment,useGoal,useInitialAssignments,useLayoutOrder,usePageGoal,useSentient,useSessionSegment});
5
5
  //# sourceMappingURL=index.js.map