@sentientui/react 0.12.1 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { SentientConfig, SentientClient, MicroSignalType, ComponentGoalOptions } from '@sentientui/core';
3
+ import { SentientConfig, SlotResult, SentientClient, MicroSignalType, ComponentGoalOptions } from '@sentientui/core';
4
4
  export { deriveSessionSegment as detectSegment } from '@sentientui/core';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
 
@@ -60,6 +60,27 @@ type AdaptiveProviderProps = {
60
60
  * `useLayoutOrder()` returns this on first render so there is no layout shift.
61
61
  */
62
62
  initialLayoutOrder?: string[] | null;
63
+ /**
64
+ * SSR-preloaded slot results from `loadAdaptiveDecision()` (the `slots`
65
+ * field of its result). Guarantees `useAdaptiveTokens`/`AdaptiveGroup`
66
+ * render the decided arm in server HTML — zero flicker, hydration-safe.
67
+ */
68
+ initialSlots?: Record<string, SlotResult>;
69
+ /**
70
+ * Persona decided during SSR (`persona` + `confidence` fields of
71
+ * `loadAdaptiveDecision()`'s result). Adopted by the core client;
72
+ * rendered into html attributes only by `SentientPersonaScript`.
73
+ */
74
+ initialPersona?: {
75
+ persona: string;
76
+ confidence: number;
77
+ };
78
+ /**
79
+ * Base URL of the Sentient API (no trailing slash). Read by the devtools
80
+ * panel for /v1/explain and by future client helpers. Defaults to the
81
+ * hosted API.
82
+ */
83
+ apiBaseUrl?: string;
63
84
  /**
64
85
  * Session ID generated during SSR (the `sessionId` field returned by
65
86
  * `loadAdaptiveAssignments` / `loadAdaptiveDecision`). When provided and no
@@ -74,6 +95,13 @@ type AdaptiveProviderProps = {
74
95
  * sessions without client-side geo lookup.
75
96
  */
76
97
  country?: string;
98
+ /**
99
+ * Keyless local mode. 'auto' (default) simulates decisions on-device in
100
+ * development builds when no valid API key is configured; `true` forces the
101
+ * local engine; `false` restores the silent keyless no-op.
102
+ * @see SentientConfig.localMode
103
+ */
104
+ localMode?: 'auto' | boolean;
77
105
  /**
78
106
  * Enable DOM graph scanning + page-structure sync. When `true`, the provider
79
107
  * dynamically loads `@sentientui/core/graph` and uses its graph-capable
@@ -99,8 +127,12 @@ declare function useInitialAssignments(): Record<string, string>;
99
127
  /**
100
128
  * Returns the persona-specific section order from SSR, or null when no
101
129
  * sections were declared on AdaptiveRoot or reliability is below threshold.
130
+ * Devtools/testing can force it via `window.__sentient_layout_override`;
131
+ * consumers re-render when the devtools notifies an override change.
102
132
  */
103
133
  declare function useLayoutOrder(): string[] | null;
134
+ /** Internal: configured API base URL (devtools fetches /v1/explain against this, never a relative URL). */
135
+ declare function useAdaptiveApiBaseUrl(): string;
104
136
 
105
137
  type ScrollDepthGoal = {
106
138
  type: 'scroll_depth';
@@ -127,6 +159,7 @@ type WeightedCompositeGoal = {
127
159
  steps: WeightedStep[];
128
160
  };
129
161
  type GoalConfig = ScrollDepthGoal | ClickGoal | FormSubmitGoal | CompositeGoal | WeightedCompositeGoal;
162
+
130
163
  /** Maps a detected micro-signal to a named session goal (`client.goal`). */
131
164
  type MicroSignalGoalConfig = string | {
132
165
  name: string;
@@ -186,6 +219,12 @@ type AssignmentState = {
186
219
  /**
187
220
  * Returns a sticky variant assignment for a component.
188
221
  *
222
+ * @deprecated Since 0.13.0 — use {@link useAdaptive} instead. `useAssignment`
223
+ * only SELECTS a variant; it wires no exposure tracking, no goal listeners,
224
+ * and no micro-signals, so components using it directly accumulate no
225
+ * learning signal. It keeps working (it is `useAdaptive`'s internal
226
+ * selection engine) but will move to internal-only in 1.0.0.
227
+ *
189
228
  * First render reads the local SDK cache; if empty, falls back to a
190
229
  * deterministic default and asynchronously calls `/v1/assign`. The server
191
230
  * picks the actual variant via Thompson Sampling and the result replaces the fallback
@@ -211,6 +250,107 @@ type FireGoal = (goalType: string, opts?: ComponentGoalOptions) => void;
211
250
  */
212
251
  declare function useAdaptiveGoal(componentId: string): FireGoal;
213
252
 
253
+ type SentientPersonaScriptProps = {
254
+ /** Publishable API key — selects the localStorage snapshot in the fallback path. */
255
+ apiKey: string;
256
+ /**
257
+ * SSR-decided persona (from `loadAdaptiveDecision`). When present the
258
+ * script embeds the literal values; when absent it reads the local
259
+ * decision snapshot (SPA / return-visit path).
260
+ */
261
+ persona?: {
262
+ persona: string;
263
+ confidence: number;
264
+ } | null;
265
+ };
266
+ /**
267
+ * Single writer of the Rung-1a `<html>` attributes
268
+ * (`data-sentient-persona`, `data-sentient-confidence`), executed pre-paint.
269
+ *
270
+ * `AdaptiveRoot` renders this automatically as its first child. For Pages
271
+ * Router / Remix, render it yourself in `_document` / the root layout.
272
+ *
273
+ * IMPORTANT (install docs): add `suppressHydrationWarning` to your `<html>`
274
+ * element — this script mutates documentElement before React hydrates it
275
+ * (the same pattern next-themes uses). The client SDK adopts the attributes
276
+ * as truth and never rewrites them mid-session.
277
+ */
278
+ declare function SentientPersonaScript(props: SentientPersonaScriptProps): JSX.Element;
279
+
280
+ type UseAdaptiveTokensOptions = {
281
+ goal?: string | GoalConfig;
282
+ };
283
+ type UseAdaptiveTokensResult = {
284
+ tokens: Record<string, string>;
285
+ /** Spread on the slot's element: `data-<dim>` per dim + `data-sentient-slot`. */
286
+ props: Record<string, string>;
287
+ };
288
+ /**
289
+ * Rung 1b — adaptive design tokens. Declares a bounded token space; the
290
+ * optimizer picks per persona; values apply as element-scoped data
291
+ * attributes so they serialize through SSR markup (zero flicker,
292
+ * hydration-safe). First value of each dim = baseline.
293
+ *
294
+ * ```tsx
295
+ * const t = useAdaptiveTokens('hero', { tone: ['calm', 'urgent'] });
296
+ * return <section {...t.props} className="hero">…</section>;
297
+ * // CSS: .hero[data-tone="urgent"] .cta { … }
298
+ * ```
299
+ */
300
+ declare function useAdaptiveTokens(id: string, dims: Record<string, readonly string[]>, opts?: UseAdaptiveTokensOptions): UseAdaptiveTokensResult;
301
+
302
+ type UseAdaptiveBind = {
303
+ ref: (el: HTMLElement | null) => void;
304
+ 'data-sentient-id': string;
305
+ 'data-sentient-variant': string;
306
+ };
307
+ type UseAdaptiveResult<T> = {
308
+ variant: string;
309
+ value: T;
310
+ /** Spread on the rendered element — wires exposure, goal listeners, and micro-signals. */
311
+ bind: UseAdaptiveBind;
312
+ fireGoal: (goalType?: string, opts?: ComponentGoalOptions) => void;
313
+ };
314
+ /**
315
+ * Rung 2 — headless, measurement-complete variant swap. Supersedes
316
+ * `useAssignment` (which selects a variant but wires no measurement).
317
+ *
318
+ * `goal` is REQUIRED: without one the optimizer accumulates exposures with
319
+ * zero rewards and cannot learn. `bind` MUST be attached to the rendered
320
+ * element — dev mode warns loudly when a slot renders unbound.
321
+ *
322
+ * ```tsx
323
+ * const { value, bind } = useAdaptive('buy-box', {
324
+ * variants: { calm: <CalmBuyBox/>, urgent: <UrgentBuyBox/> }, // first key = baseline
325
+ * goal: 'buy_click',
326
+ * });
327
+ * return <div {...bind}>{value}</div>;
328
+ * ```
329
+ */
330
+ declare function useAdaptive<T>(id: string, config: {
331
+ variants: Record<string, T>;
332
+ goal: string | GoalConfig;
333
+ }): UseAdaptiveResult<T>;
334
+
335
+ type AdaptiveGroupProps = {
336
+ id: string;
337
+ /** Arrangement id → ordered child keys. FIRST key = baseline default. */
338
+ arrangements: Record<string, string[]>;
339
+ /** Explicit baseline arrangement id (defaults to the first declared). */
340
+ baseline?: string;
341
+ /** Optional slot-scoped goal — credited via componentGoal(group id). */
342
+ goal?: string | GoalConfig;
343
+ /** Keyed children — every key referenced by an arrangement must exist. */
344
+ children: ReactNode;
345
+ };
346
+ /**
347
+ * Rung 3 — bounded mini-layout. Reorders KEYED children into the decided
348
+ * arrangement (enumerated-arms slot: arms = Object.keys(arrangements)).
349
+ * Declared orders only — never free permutation, never show/hide.
350
+ * Fail-safe: unknown arrangement or key mismatch renders declaration order.
351
+ */
352
+ declare function AdaptiveGroup(props: AdaptiveGroupProps): JSX.Element;
353
+
214
354
  /** Per-component weights store with isolated subscriptions. */
215
355
  type VariantWeight = {
216
356
  variantId: string;
@@ -297,4 +437,4 @@ declare function renderAgentJsonLdBody(feed: AgentFeed): string;
297
437
  /** Render the feed as Markdown for agents that negotiate `text/markdown`. */
298
438
  declare function renderAgentMarkdown(feed: AgentFeed): string;
299
439
 
300
- export { Adaptive, type AdaptiveProps, AdaptiveProvider, type AdaptiveProviderProps, AdaptiveText, type AdaptiveTextProps, type AgentBlock, type AgentFeed, type AssignmentState, type ClickGoal, type ComponentWeights, type CompositeGoal, type FireGoal, type FormSubmitGoal, type GoalConfig, type MicroSignalGoalConfig, type MicroSignalGoals, type ScrollDepthGoal, type SsrFallback, type VariantWeight, type WeightedCompositeGoal, type WeightedStep, buildAgentFeed, defineAgentContent, getAgentContent, getWeights, renderAgentJsonLd, renderAgentJsonLdBody, renderAgentMarkdown, subscribe as subscribeWeights, update as updateWeights, useAdaptiveGoal, useAssignment, useInitialAssignments, useLayoutOrder, useSentient };
440
+ export { Adaptive, AdaptiveGroup, type AdaptiveGroupProps, type AdaptiveProps, AdaptiveProvider, type AdaptiveProviderProps, AdaptiveText, type AdaptiveTextProps, type AgentBlock, type AgentFeed, type AssignmentState, type ClickGoal, type ComponentWeights, type CompositeGoal, type FireGoal, type FormSubmitGoal, type GoalConfig, type MicroSignalGoalConfig, type MicroSignalGoals, type ScrollDepthGoal, SentientPersonaScript, type SentientPersonaScriptProps, type SsrFallback, type UseAdaptiveBind, type UseAdaptiveResult, type UseAdaptiveTokensOptions, type UseAdaptiveTokensResult, type VariantWeight, type WeightedCompositeGoal, type WeightedStep, buildAgentFeed, defineAgentContent, getAgentContent, getWeights, renderAgentJsonLd, renderAgentJsonLdBody, renderAgentMarkdown, subscribe as subscribeWeights, update as updateWeights, useAdaptive, useAdaptiveApiBaseUrl, useAdaptiveGoal, useAdaptiveTokens, useAssignment, useInitialAssignments, useLayoutOrder, useSentient };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { SentientConfig, SentientClient, MicroSignalType, ComponentGoalOptions } from '@sentientui/core';
3
+ import { SentientConfig, SlotResult, SentientClient, MicroSignalType, ComponentGoalOptions } from '@sentientui/core';
4
4
  export { deriveSessionSegment as detectSegment } from '@sentientui/core';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
 
@@ -60,6 +60,27 @@ type AdaptiveProviderProps = {
60
60
  * `useLayoutOrder()` returns this on first render so there is no layout shift.
61
61
  */
62
62
  initialLayoutOrder?: string[] | null;
63
+ /**
64
+ * SSR-preloaded slot results from `loadAdaptiveDecision()` (the `slots`
65
+ * field of its result). Guarantees `useAdaptiveTokens`/`AdaptiveGroup`
66
+ * render the decided arm in server HTML — zero flicker, hydration-safe.
67
+ */
68
+ initialSlots?: Record<string, SlotResult>;
69
+ /**
70
+ * Persona decided during SSR (`persona` + `confidence` fields of
71
+ * `loadAdaptiveDecision()`'s result). Adopted by the core client;
72
+ * rendered into html attributes only by `SentientPersonaScript`.
73
+ */
74
+ initialPersona?: {
75
+ persona: string;
76
+ confidence: number;
77
+ };
78
+ /**
79
+ * Base URL of the Sentient API (no trailing slash). Read by the devtools
80
+ * panel for /v1/explain and by future client helpers. Defaults to the
81
+ * hosted API.
82
+ */
83
+ apiBaseUrl?: string;
63
84
  /**
64
85
  * Session ID generated during SSR (the `sessionId` field returned by
65
86
  * `loadAdaptiveAssignments` / `loadAdaptiveDecision`). When provided and no
@@ -74,6 +95,13 @@ type AdaptiveProviderProps = {
74
95
  * sessions without client-side geo lookup.
75
96
  */
76
97
  country?: string;
98
+ /**
99
+ * Keyless local mode. 'auto' (default) simulates decisions on-device in
100
+ * development builds when no valid API key is configured; `true` forces the
101
+ * local engine; `false` restores the silent keyless no-op.
102
+ * @see SentientConfig.localMode
103
+ */
104
+ localMode?: 'auto' | boolean;
77
105
  /**
78
106
  * Enable DOM graph scanning + page-structure sync. When `true`, the provider
79
107
  * dynamically loads `@sentientui/core/graph` and uses its graph-capable
@@ -99,8 +127,12 @@ declare function useInitialAssignments(): Record<string, string>;
99
127
  /**
100
128
  * Returns the persona-specific section order from SSR, or null when no
101
129
  * sections were declared on AdaptiveRoot or reliability is below threshold.
130
+ * Devtools/testing can force it via `window.__sentient_layout_override`;
131
+ * consumers re-render when the devtools notifies an override change.
102
132
  */
103
133
  declare function useLayoutOrder(): string[] | null;
134
+ /** Internal: configured API base URL (devtools fetches /v1/explain against this, never a relative URL). */
135
+ declare function useAdaptiveApiBaseUrl(): string;
104
136
 
105
137
  type ScrollDepthGoal = {
106
138
  type: 'scroll_depth';
@@ -127,6 +159,7 @@ type WeightedCompositeGoal = {
127
159
  steps: WeightedStep[];
128
160
  };
129
161
  type GoalConfig = ScrollDepthGoal | ClickGoal | FormSubmitGoal | CompositeGoal | WeightedCompositeGoal;
162
+
130
163
  /** Maps a detected micro-signal to a named session goal (`client.goal`). */
131
164
  type MicroSignalGoalConfig = string | {
132
165
  name: string;
@@ -186,6 +219,12 @@ type AssignmentState = {
186
219
  /**
187
220
  * Returns a sticky variant assignment for a component.
188
221
  *
222
+ * @deprecated Since 0.13.0 — use {@link useAdaptive} instead. `useAssignment`
223
+ * only SELECTS a variant; it wires no exposure tracking, no goal listeners,
224
+ * and no micro-signals, so components using it directly accumulate no
225
+ * learning signal. It keeps working (it is `useAdaptive`'s internal
226
+ * selection engine) but will move to internal-only in 1.0.0.
227
+ *
189
228
  * First render reads the local SDK cache; if empty, falls back to a
190
229
  * deterministic default and asynchronously calls `/v1/assign`. The server
191
230
  * picks the actual variant via Thompson Sampling and the result replaces the fallback
@@ -211,6 +250,107 @@ type FireGoal = (goalType: string, opts?: ComponentGoalOptions) => void;
211
250
  */
212
251
  declare function useAdaptiveGoal(componentId: string): FireGoal;
213
252
 
253
+ type SentientPersonaScriptProps = {
254
+ /** Publishable API key — selects the localStorage snapshot in the fallback path. */
255
+ apiKey: string;
256
+ /**
257
+ * SSR-decided persona (from `loadAdaptiveDecision`). When present the
258
+ * script embeds the literal values; when absent it reads the local
259
+ * decision snapshot (SPA / return-visit path).
260
+ */
261
+ persona?: {
262
+ persona: string;
263
+ confidence: number;
264
+ } | null;
265
+ };
266
+ /**
267
+ * Single writer of the Rung-1a `<html>` attributes
268
+ * (`data-sentient-persona`, `data-sentient-confidence`), executed pre-paint.
269
+ *
270
+ * `AdaptiveRoot` renders this automatically as its first child. For Pages
271
+ * Router / Remix, render it yourself in `_document` / the root layout.
272
+ *
273
+ * IMPORTANT (install docs): add `suppressHydrationWarning` to your `<html>`
274
+ * element — this script mutates documentElement before React hydrates it
275
+ * (the same pattern next-themes uses). The client SDK adopts the attributes
276
+ * as truth and never rewrites them mid-session.
277
+ */
278
+ declare function SentientPersonaScript(props: SentientPersonaScriptProps): JSX.Element;
279
+
280
+ type UseAdaptiveTokensOptions = {
281
+ goal?: string | GoalConfig;
282
+ };
283
+ type UseAdaptiveTokensResult = {
284
+ tokens: Record<string, string>;
285
+ /** Spread on the slot's element: `data-<dim>` per dim + `data-sentient-slot`. */
286
+ props: Record<string, string>;
287
+ };
288
+ /**
289
+ * Rung 1b — adaptive design tokens. Declares a bounded token space; the
290
+ * optimizer picks per persona; values apply as element-scoped data
291
+ * attributes so they serialize through SSR markup (zero flicker,
292
+ * hydration-safe). First value of each dim = baseline.
293
+ *
294
+ * ```tsx
295
+ * const t = useAdaptiveTokens('hero', { tone: ['calm', 'urgent'] });
296
+ * return <section {...t.props} className="hero">…</section>;
297
+ * // CSS: .hero[data-tone="urgent"] .cta { … }
298
+ * ```
299
+ */
300
+ declare function useAdaptiveTokens(id: string, dims: Record<string, readonly string[]>, opts?: UseAdaptiveTokensOptions): UseAdaptiveTokensResult;
301
+
302
+ type UseAdaptiveBind = {
303
+ ref: (el: HTMLElement | null) => void;
304
+ 'data-sentient-id': string;
305
+ 'data-sentient-variant': string;
306
+ };
307
+ type UseAdaptiveResult<T> = {
308
+ variant: string;
309
+ value: T;
310
+ /** Spread on the rendered element — wires exposure, goal listeners, and micro-signals. */
311
+ bind: UseAdaptiveBind;
312
+ fireGoal: (goalType?: string, opts?: ComponentGoalOptions) => void;
313
+ };
314
+ /**
315
+ * Rung 2 — headless, measurement-complete variant swap. Supersedes
316
+ * `useAssignment` (which selects a variant but wires no measurement).
317
+ *
318
+ * `goal` is REQUIRED: without one the optimizer accumulates exposures with
319
+ * zero rewards and cannot learn. `bind` MUST be attached to the rendered
320
+ * element — dev mode warns loudly when a slot renders unbound.
321
+ *
322
+ * ```tsx
323
+ * const { value, bind } = useAdaptive('buy-box', {
324
+ * variants: { calm: <CalmBuyBox/>, urgent: <UrgentBuyBox/> }, // first key = baseline
325
+ * goal: 'buy_click',
326
+ * });
327
+ * return <div {...bind}>{value}</div>;
328
+ * ```
329
+ */
330
+ declare function useAdaptive<T>(id: string, config: {
331
+ variants: Record<string, T>;
332
+ goal: string | GoalConfig;
333
+ }): UseAdaptiveResult<T>;
334
+
335
+ type AdaptiveGroupProps = {
336
+ id: string;
337
+ /** Arrangement id → ordered child keys. FIRST key = baseline default. */
338
+ arrangements: Record<string, string[]>;
339
+ /** Explicit baseline arrangement id (defaults to the first declared). */
340
+ baseline?: string;
341
+ /** Optional slot-scoped goal — credited via componentGoal(group id). */
342
+ goal?: string | GoalConfig;
343
+ /** Keyed children — every key referenced by an arrangement must exist. */
344
+ children: ReactNode;
345
+ };
346
+ /**
347
+ * Rung 3 — bounded mini-layout. Reorders KEYED children into the decided
348
+ * arrangement (enumerated-arms slot: arms = Object.keys(arrangements)).
349
+ * Declared orders only — never free permutation, never show/hide.
350
+ * Fail-safe: unknown arrangement or key mismatch renders declaration order.
351
+ */
352
+ declare function AdaptiveGroup(props: AdaptiveGroupProps): JSX.Element;
353
+
214
354
  /** Per-component weights store with isolated subscriptions. */
215
355
  type VariantWeight = {
216
356
  variantId: string;
@@ -297,4 +437,4 @@ declare function renderAgentJsonLdBody(feed: AgentFeed): string;
297
437
  /** Render the feed as Markdown for agents that negotiate `text/markdown`. */
298
438
  declare function renderAgentMarkdown(feed: AgentFeed): string;
299
439
 
300
- export { Adaptive, type AdaptiveProps, AdaptiveProvider, type AdaptiveProviderProps, AdaptiveText, type AdaptiveTextProps, type AgentBlock, type AgentFeed, type AssignmentState, type ClickGoal, type ComponentWeights, type CompositeGoal, type FireGoal, type FormSubmitGoal, type GoalConfig, type MicroSignalGoalConfig, type MicroSignalGoals, type ScrollDepthGoal, type SsrFallback, type VariantWeight, type WeightedCompositeGoal, type WeightedStep, buildAgentFeed, defineAgentContent, getAgentContent, getWeights, renderAgentJsonLd, renderAgentJsonLdBody, renderAgentMarkdown, subscribe as subscribeWeights, update as updateWeights, useAdaptiveGoal, useAssignment, useInitialAssignments, useLayoutOrder, useSentient };
440
+ export { Adaptive, AdaptiveGroup, type AdaptiveGroupProps, type AdaptiveProps, AdaptiveProvider, type AdaptiveProviderProps, AdaptiveText, type AdaptiveTextProps, type AgentBlock, type AgentFeed, type AssignmentState, type ClickGoal, type ComponentWeights, type CompositeGoal, type FireGoal, type FormSubmitGoal, type GoalConfig, type MicroSignalGoalConfig, type MicroSignalGoals, type ScrollDepthGoal, SentientPersonaScript, type SentientPersonaScriptProps, type SsrFallback, type UseAdaptiveBind, type UseAdaptiveResult, type UseAdaptiveTokensOptions, type UseAdaptiveTokensResult, type VariantWeight, type WeightedCompositeGoal, type WeightedStep, buildAgentFeed, defineAgentContent, getAgentContent, getWeights, renderAgentJsonLd, renderAgentJsonLdBody, renderAgentMarkdown, subscribe as subscribeWeights, update as updateWeights, useAdaptive, useAdaptiveApiBaseUrl, useAdaptiveGoal, useAdaptiveTokens, useAssignment, useInitialAssignments, useLayoutOrder, useSentient };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- "use strict";var Pe=Object.create;var K=Object.defineProperty,Me=Object.defineProperties,Te=Object.getOwnPropertyDescriptor,We=Object.getOwnPropertyDescriptors,De=Object.getOwnPropertyNames,re=Object.getOwnPropertySymbols,Ne=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable;var oe=(e,t,n)=>t in e?K(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,M=(e,t)=>{for(var n in t||(t={}))se.call(t,n)&&oe(e,n,t[n]);if(re)for(var n of re(t))je.call(t,n)&&oe(e,n,t[n]);return e},$=(e,t)=>Me(e,We(t));var Ke=(e,t)=>{for(var n in t)K(e,n,{get:t[n],enumerable:!0})},ae=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of De(t))!se.call(e,i)&&i!==n&&K(e,i,{get:()=>t[i],enumerable:!(o=Te(t,i))||o.enumerable});return e};var Ve=(e,t,n)=>(n=e!=null?Pe(Ne(e)):{},ae(t||!e||!e.__esModule?K(n,"default",{value:e,enumerable:!0}):n,e)),$e=e=>ae(K({},"__esModule",{value:!0}),e);var et={};Ke(et,{Adaptive:()=>we,AdaptiveProvider:()=>ge,AdaptiveText:()=>xe,buildAgentFeed:()=>Ge,defineAgentContent:()=>Le,detectSegment:()=>te.deriveSessionSegment,getAgentContent:()=>ne,getWeights:()=>X,renderAgentJsonLd:()=>Oe,renderAgentJsonLdBody:()=>ie,renderAgentMarkdown:()=>_e,subscribeWeights:()=>B,updateWeights:()=>H,useAdaptiveGoal:()=>Ee,useAssignment:()=>Y,useInitialAssignments:()=>U,useLayoutOrder:()=>pe,useSentient:()=>G});module.exports=$e(et);var p=require("react"),N=require("@sentientui/core");var le=new Map,J=new Map;function B(e,t){let n=J.get(e);return n||(n=new Set,J.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&J.delete(e)}}function H(e,t){le.set(e,t);let n=J.get(e);if(n)for(let o of n)try{o(t)}catch(i){}}function X(e){var t;return(t=le.get(e))!=null?t:null}var Je=!1,ce=new Set;function ee(){return Je}function ue(e){return ce.add(e),()=>{ce.delete(e)}}function de(e){return{track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},fetchWeights:()=>Promise.resolve([]),getAssignment:(t,n)=>e.getAssignment(t,n),assign:(t,n,o,i)=>e.assign(t,n,o,i),getGraph:()=>e.getGraph(),destroy:()=>e.destroy()}}var me=require("react/jsx-runtime");function Be(){var e,t;if(typeof window=="undefined")return"desktop:direct";try{let n=(0,N.detectDeviceClass)((e=navigator.userAgent)!=null?e:""),o=(0,N.detectTrafficSource)((t=document.referrer)!=null?t:"",window.location.origin);return`${n}:${o}`}catch(n){return"desktop:direct"}}var T=(0,p.createContext)({client:null,apiKey:"",initialAssignments:{},sessionSegment:"desktop:direct",ssrFallback:"first",onAssignment:void 0,initialLayoutOrder:null});function ge(e){var C;let[t,n]=(0,p.useState)(null),[o]=(0,p.useState)(()=>{var d;return(d=e.sessionSegment)!=null?d:Be()}),[i,A]=(0,p.useState)(ee());(0,p.useEffect)(()=>ue(()=>A(ee())),[]),(0,p.useEffect)(()=>{if(e.consent===!1&&!e.preConsentBehavior){n(a=>(a==null||a.destroy(),null));return}let d={apiKey:e.apiKey,context:e.context,debug:e.debug,initialAssignments:e.initialAssignments,sessionSegment:o,consent:e.consent,preConsentBehavior:e.preConsentBehavior,respectDoNotTrack:e.respectDoNotTrack,ssrSessionId:e.ssrSessionId,country:e.country},s=!1,b=null;return e.enableGraph?import("@sentientui/core/graph").then(({init:a})=>{s||(b=a($(M({},d),{graph:!0})),n(b))}):(b=(0,N.init)(d),n(b)),()=>{s=!0,b==null||b.destroy()}},[e.consent]),(0,p.useEffect)(()=>{if(!t)return;let d=!1,s=async()=>{if(d)return;let a;try{a=await t.fetchWeights()}catch(g){return}if(!d)for(let g of a){let h={componentId:g.componentId,updatedAt:g.updatedAt,variants:g.variants.map(I=>{var u;return{variantId:I.variantId,pulls:I.pulls,avgReward:(u=I.avgReward)!=null?u:0}})};H(g.componentId,h)}};s();let b=setInterval(()=>{s()},6e4);return()=>{d=!0,clearInterval(b)}},[t]);let l=(C=e.ssrFallback)!=null?C:"first",m=(0,p.useMemo)(()=>t&&i?de(t):t,[t,i]),O=(0,p.useMemo)(()=>{var d,s;return{client:m,apiKey:e.apiKey,initialAssignments:(d=e.initialAssignments)!=null?d:{},sessionSegment:o,ssrFallback:l,onAssignment:e.onAssignment,initialLayoutOrder:(s=e.initialLayoutOrder)!=null?s:null}},[m,e.apiKey,e.initialAssignments,o,l,e.onAssignment,e.initialLayoutOrder]);return(0,me.jsx)(T.Provider,{value:O,children:e.children})}function G(){return(0,p.useContext)(T).client}function z(){return(0,p.useContext)(T).apiKey}function U(){return(0,p.useContext)(T).initialAssignments}function q(){return(0,p.useContext)(T).sessionSegment}function fe(){return(0,p.useContext)(T).ssrFallback}function Q(){return(0,p.useContext)(T).onAssignment}function pe(){let e=(0,p.useContext)(T).initialLayoutOrder;if(typeof window!="undefined"){let t=window.__sentient_layout_override;if(t)return t}return e}var v=require("react"),be=require("@sentientui/core");var _=require("react");function He(e){var n;if(typeof window=="undefined")return null;let t=(n=window.__sentient_overrides)==null?void 0:n[e];if(t)return t;try{let o=new URLSearchParams(window.location.search);for(let i of o.getAll("sentient_variant")){let A=i.indexOf(":");if(A!==-1&&i.slice(0,A)===e)return i.slice(A+1)}}catch(o){}return null}function ve(e,t){var o;let n=null;for(let i of e.variants)t.includes(i.variantId)&&(!n||i.avgReward>n.avgReward)&&(n={variantId:i.variantId,avgReward:i.avgReward});return(o=n==null?void 0:n.variantId)!=null?o:null}function Y(e,t,n,o){let i=U(),A=fe(),l=G(),m=q(),O=Q(),C=(0,_.useRef)(null),d=He(e),s=d&&t.includes(d)?d:null,b=(0,_.useRef)(null);s&&b.current!==s&&(b.current=s,console.info(`[sentient] override active: ${e} -> ${s}`));let a=(()=>{var r,c;if(s)return{variantId:s,content:null,isLoading:!1};if(!l){let f=i[e];return f&&t.includes(f)?{variantId:f,content:null,isLoading:!1}:A==="first"&&t.length>0?{variantId:t[0],content:null,isLoading:!1}:{variantId:null,content:null,isLoading:!0}}let u=l.getAssignment(e,m);if(u&&(t.includes(u.variantId)||u.content))return{variantId:u.variantId,content:(r=u.content)!=null?r:null,isLoading:!1};let S=X(e);if(S){let f=ve(S,t);if(f)return{variantId:f,content:null,isLoading:!1}}return{variantId:(c=t[0])!=null?c:null,content:null,isLoading:!1}})(),[g,h]=(0,_.useState)(a),I=u=>{O&&C.current!==u&&(C.current=u,O(e,u))};return(0,_.useEffect)(()=>{var S;if(s||!l)return;let u=l.getAssignment(e,m);if(u&&(t.includes(u.variantId)||u.content)){h({variantId:u.variantId,content:(S=u.content)!=null?S:null,isLoading:!1}),I(u.variantId);return}h(r=>{var c;return r.variantId?r:{variantId:(c=t[0])!=null?c:null,content:null,isLoading:!1}})},[s,l,e,m]),(0,_.useEffect)(()=>{if(s||!l)return;let u=l.getAssignment(e,m);if(u&&t.includes(u.variantId))return;let S=!1;return l.assign(e,t,n,o).then(r=>{var c;S||r&&(!t.includes(r.variantId)&&!r.content||(h({variantId:r.variantId,content:(c=r.content)!=null?c:null,isLoading:!1}),I(r.variantId)))}),()=>{S=!0}},[s,l,e,m]),(0,_.useEffect)(()=>{if(!s&&l)return B(e,u=>{var c;let S=l.getAssignment(e,m);if(S&&(t.includes(S.variantId)||S.content)){h({variantId:S.variantId,content:(c=S.content)!=null?c:null,isLoading:!1});return}let r=ve(u,t);r&&h({variantId:r,content:null,isLoading:!1})})},[s,l,e,m]),s?{variantId:s,content:null,isLoading:!1}:g}var ye=new Map,Xe=new Set;function he(){for(let e of Xe)e()}function Ae(e){return ye.set(e.id,e),he(),()=>{ye.delete(e.id),he()}}var ke=require("react/jsx-runtime");function ze(e){return typeof e=="string"?{type:"click"}:e}var Ue=3e4;function qe(e,t){try{let n=`_snt_pv_${e}_${t}`;return sessionStorage.getItem(n)?!1:(sessionStorage.setItem(n,"1"),!0)}catch(n){return!0}}function Qe(e){if(!(e instanceof Element))return!1;let t=e.tagName.toLowerCase();return t==="a"||t==="button"?!0:e.getAttribute("role")==="button"}function Se(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 o=e;for(;o&&o!==t;){if(Qe(o))return!0;o=o.parentElement}return!1}function Ye(e){var u,S;let t=G(),n=z(),o=(0,v.useMemo)(()=>Object.keys(e.variants),[e.variants]),{variantId:i,content:A}=Y(e.id,o,e.agentData,e.agentDataByVariant),l=(0,v.useRef)(null),[m,O]=(0,v.useState)(!1);(0,v.useEffect)(()=>{O(!0)},[]);let C=(0,v.useRef)(!1),d=(0,v.useRef)(new Set),s=(0,v.useRef)(null),b=typeof e.goal=="string"?e.goal:JSON.stringify(e.goal),a=(0,v.useMemo)(()=>ze(e.goal),[b]),g=typeof e.goal=="string"?e.goal:a.type;if((0,v.useEffect)(()=>Ae({id:e.id,variantIds:o,goal:g}),[e.id,o,g]),(0,v.useEffect)(()=>{var f,R;if(!t||!i||!n||s.current===i)return;let r=(R=(f=l.current)==null?void 0:f.innerHTML)!=null?R:"";if(!r)return;s.current=i;let c=r!==""&&qe(e.id,i);t.track({projectId:n,componentId:e.id,variantId:i,eventType:"variant_assigned",payload:c?{previewHtml:r.slice(0,Ue)}:{}})},[t,i,n,e.id,m,A]),(0,v.useEffect)(()=>{C.current=!1,d.current=new Set},[i,a]),(0,v.useEffect)(()=>{if(!t||!i)return;let r=l.current;if(!r)return;let c=null,f=0,R=()=>{f=Date.now(),c=setTimeout(()=>{t.track({projectId:n,componentId:e.id,variantId:i,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-f}}),c=null},800)},w=()=>{c!==null&&(clearTimeout(c),c=null)};return r.addEventListener("mouseenter",R),r.addEventListener("mouseleave",w),()=>{r.removeEventListener("mouseenter",R),r.removeEventListener("mouseleave",w),c!==null&&clearTimeout(c)}},[t,i,n,e.id]),(0,v.useEffect)(()=>{if(!t||!i)return;let r=l.current;if(!r)return;let c=Date.now();return(0,be.attachMicroSignalDetectors)((f,R={})=>{var y,x,L;t.track({projectId:n,componentId:e.id,variantId:i,eventType:"micro_signal",payload:M({signalType:f},R)});let w=(y=e.microSignalGoals)==null?void 0:y[f];if(!w||d.current.has(f))return;d.current.add(f);let D=typeof w=="string"?w:w.name,k=typeof w=="string"?1:(x=w.weight)!=null?x:1,E=typeof w=="string"?0:(L=w.stepIndex)!=null?L:0;t.goal(D,M({signalType:f},R),k,E)},r,c)},[t,i,n,e.id,e.microSignalGoals]),(0,v.useEffect)(()=>{if(!t||!i)return;let r=l.current;if(!r)return;if(a.type==="weighted_composite"){let k=new Set,E=[];return a.steps.forEach(({goal:y,name:x,weight:L},j)=>{let Z=()=>{k.has(j)||(k.add(j),t.track({projectId:n,componentId:e.id,variantId:i,eventType:"goal_achieved",goalType:x,payload:{reward:L}}),t.goal(x,{},L,j))};if(y.type==="click"){let F=P=>{let V=P.target;V instanceof Element&&Se(V,r,y.selector)&&Z()};r.addEventListener("click",F),E.push(()=>r.removeEventListener("click",F));return}if(y.type==="form_submit"){let F=P=>{P.target instanceof HTMLFormElement&&r.contains(P.target)&&Z()};r.addEventListener("submit",F),E.push(()=>r.removeEventListener("submit",F));return}if(y.type==="scroll_depth"){let F=Math.max(0,Math.min(1,y.threshold)),P=new IntersectionObserver(V=>{for(let Fe of V)if(Fe.intersectionRatio>=F){Z(),P.disconnect();break}},{threshold:[F]});P.observe(r),E.push(()=>P.disconnect())}}),()=>{for(let y of E)y()}}let c=()=>{C.current||(C.current=!0,t.track({projectId:n,componentId:e.id,variantId:i,eventType:"goal_achieved",goalType:g,payload:{reward:1}}),t.goal(g,{componentId:e.id,variantId:i},1,0))},f=a.type==="composite"?a.all:[a],R=new Set(f.map((k,E)=>E)),w=k=>{R.delete(k),R.size===0&&c()},D=[];return f.forEach((k,E)=>{if(k.type==="click"){let y=x=>{let L=x.target;L instanceof Element&&Se(L,r,k.selector)&&(a.type==="composite"?w(E):c())};r.addEventListener("click",y),D.push(()=>r.removeEventListener("click",y));return}if(k.type==="form_submit"){let y=x=>{x.target instanceof HTMLFormElement&&r.contains(x.target)&&(a.type==="composite"?w(E):c())};r.addEventListener("submit",y),D.push(()=>r.removeEventListener("submit",y));return}if(k.type==="scroll_depth"){let y=Math.max(0,Math.min(1,k.threshold)),x=new IntersectionObserver(L=>{for(let j of L)if(j.intersectionRatio>=y){a.type==="composite"?w(E):c(),x.disconnect();break}},{threshold:[y]});x.observe(r),D.push(()=>x.disconnect());return}}),()=>{for(let k of D)k()}},[t,i,n,e.id,a,g]),e.clientOnly&&(!m||!t)||!i)return null;let h=(u=e.variants[i])!=null?u:null,I=h===null?A:null;return((S=process==null?void 0:process.env)==null?void 0:S.NODE_ENV)!=="production"&&h===null&&I===null&&console.warn(`[sentient] <Adaptive id="${e.id}"> was assigned variant "${i}" but no matching key exists in props.variants. If this is a dashboard-managed text variant, use <AdaptiveText id="${e.id}"> instead.`),(0,ke.jsx)("div",{ref:l,"data-sentient-id":e.id,"data-sentient-variant":i,children:h!=null?h:I})}var we=(0,v.memo)(Ye,(e,t)=>{if(e.id!==t.id||JSON.stringify(e.goal)!==JSON.stringify(t.goal)||e.microSignalGoals!==t.microSignalGoals)return!1;if(e.variants===t.variants)return!0;let n=Object.keys(e.variants),o=Object.keys(t.variants);return n.length!==o.length?!1:n.every(i=>i in t.variants)});var W=require("react");var Ce=require("react/jsx-runtime");function xe({id:e,default:t,component:n="span",className:o}){let i=G(),A=z(),l=Q(),m=q(),O=(0,W.useRef)(null),[C,d]=(0,W.useState)(()=>{var a,g;return(g=(a=i==null?void 0:i.getAssignment(e,m))==null?void 0:a.content)!=null?g:null}),[s,b]=(0,W.useState)(()=>{var a,g;return(g=(a=i==null?void 0:i.getAssignment(e,m))==null?void 0:a.variantId)!=null?g:null});return(0,W.useEffect)(()=>{var g;if(!i||((g=i.getAssignment(e,m))==null?void 0:g.content)!==void 0)return;let a=!1;return i.assign(e).then(h=>{var I;if(!a){if(!h){((I=process==null?void 0:process.env)==null?void 0:I.NODE_ENV)!=="production"&&console.warn(`[sentient] <AdaptiveText id="${e}"> assignment failed \u2014 showing default text.`);return}b(h.variantId),h.content&&d(h.content)}}),()=>{a=!0}},[i,e,m]),(0,W.useEffect)(()=>{!i||!s||!A||O.current!==s&&(O.current=s,i.track({projectId:A,componentId:e,variantId:s,eventType:"variant_assigned",payload:{}}),l==null||l(e,s))},[i,s,A,e,l]),(0,Ce.jsx)(n,{className:o,children:C!=null?C:t})}var Ie=require("react");function Ee(e){let t=G();return(0,Ie.useCallback)((n,o)=>{t==null||t.componentGoal(e,n,o)},[t,e])}var te=require("@sentientui/core");var Ze=["page","blocks","layoutOrder"],Re=new Map;function Le(e,t){Re.set(e,t)}function ne(e){return Re.get(e)}function Ge(e){var i,A;let t=(A=(i=e.content)!=null?i:ne(e.page))!=null?A:{},n={};for(let[l,m]of Object.entries(t))Ze.includes(l)||(n[l]=m);let o=$(M({},n),{page:e.page,blocks:e.blocks});return e.layoutOrder&&(o.layoutOrder=e.layoutOrder),o}function Oe(e){return`<script type="application/ld+json">${ie(e)}</script>`}function ie(e){return JSON.stringify(M({"@context":"https://schema.org","@type":"WebPage"},e)).replace(/</g,"\\u003c")}function _e(e){let t=[];e.title&&t.push(`# ${e.title}`,""),e.summary&&t.push(String(e.summary),"");for(let[n,o]of Object.entries(e))["page","title","summary","blocks","layoutOrder"].includes(n)||t.push(`## ${n}`,"","```json",JSON.stringify(o,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 at=Object.create;var V=Object.defineProperty,lt=Object.defineProperties,ct=Object.getOwnPropertyDescriptor,ut=Object.getOwnPropertyDescriptors,dt=Object.getOwnPropertyNames,fe=Object.getOwnPropertySymbols,gt=Object.getPrototypeOf,me=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable;var pe=(e,t,n)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,G=(e,t)=>{for(var n in t||(t={}))me.call(t,n)&&pe(e,n,t[n]);if(fe)for(var n of fe(t))ft.call(t,n)&&pe(e,n,t[n]);return e},H=(e,t)=>lt(e,ut(t));var pt=(e,t)=>{for(var n in t)V(e,n,{get:t[n],enumerable:!0})},ve=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of dt(t))!me.call(e,i)&&i!==n&&V(e,i,{get:()=>t[i],enumerable:!(o=ct(t,i))||o.enumerable});return e};var mt=(e,t,n)=>(n=e!=null?at(gt(e)):{},ve(t||!e||!e.__esModule?V(n,"default",{value:e,enumerable:!0}):n,e)),vt=e=>ve(V({},"__esModule",{value:!0}),e);var Et={};pt(Et,{Adaptive:()=>Me,AdaptiveGroup:()=>Qe,AdaptiveProvider:()=>Ce,AdaptiveText:()=>We,SentientPersonaScript:()=>Ue,buildAgentFeed:()=>tt,defineAgentContent:()=>et,detectSegment:()=>ae.deriveSessionSegment,getAgentContent:()=>le,getWeights:()=>Q,renderAgentJsonLd:()=>nt,renderAgentJsonLdBody:()=>ce,renderAgentMarkdown:()=>it,subscribeWeights:()=>X,updateWeights:()=>q,useAdaptive:()=>qe,useAdaptiveApiBaseUrl:()=>Le,useAdaptiveGoal:()=>je,useAdaptiveTokens:()=>Je,useAssignment:()=>N,useInitialAssignments:()=>ee,useLayoutOrder:()=>Ge,useSentient:()=>_});module.exports=vt(Et);var b=require("react"),$=require("@sentientui/core");var ye=new Map,z=new Map;function X(e,t){let n=z.get(e);return n||(n=new Set,z.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&z.delete(e)}}function q(e,t){ye.set(e,t);let n=z.get(e);if(n)for(let o of n)try{o(t)}catch(i){}}function Q(e){var t;return(t=ye.get(e))!=null?t:null}var yt={on:!1,listeners:new Set};function Se(){if(typeof window=="undefined")return yt;let e=window;return e.__sentient_preview||(e.__sentient_preview={on:!1,listeners:new Set}),e.__sentient_preview}function oe(){return Se().on}function he(e){let t=Se().listeners;return t.add(e),()=>{t.delete(e)}}function we(e){return{isLocal:e.isLocal,track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},fetchWeights:()=>Promise.resolve([]),getAssignment:(t,n)=>e.getAssignment(t,n),assign:(t,n,o,i)=>e.assign(t,n,o,i),decide:()=>Promise.resolve(null),getSlotResult:t=>e.getSlotResult(t),getPersona:()=>e.getPersona(),getGraph:()=>e.getGraph(),destroy:()=>e.destroy()}}var be="sentient:overrides-changed";function Ae(){var e;return typeof window=="undefined"?0:(e=window.__sentient_overrides_version)!=null?e:0}function Y(e){return typeof window=="undefined"?()=>{}:(window.addEventListener(be,e),()=>window.removeEventListener(be,e))}function xe(e){typeof window!="undefined"&&(window.__sentient_devtools_config=e)}var St={components:new Map,slots:new Map,sections:[],listeners:new Set};function K(){if(typeof window=="undefined")return St;let e=window;return e.__sentient_registry||(e.__sentient_registry={components:new Map,slots:new Map,sections:[],listeners:new Set}),e.__sentient_registry}function J(){for(let e of K().listeners)e()}function T(e){return K().components.set(e.id,e),J(),()=>{K().components.delete(e.id),J()}}function Z(e){return K().slots.set(e.id,e),J(),()=>{K().slots.delete(e.id),J()}}function ke(e){K().sections=[...e],J()}var Oe=require("react/jsx-runtime");function ht(){var e,t;if(typeof window=="undefined")return"desktop:direct";try{let n=(0,$.detectDeviceClass)((e=navigator.userAgent)!=null?e:""),o=(0,$.detectTrafficSource)((t=document.referrer)!=null?t:"",window.location.origin);return`${n}:${o}`}catch(n){return"desktop:direct"}}var _e="https://api.sentient-ui.com/v1",O=(0,b.createContext)({client:null,apiKey:"",initialAssignments:{},sessionSegment:"desktop:direct",ssrFallback:"first",onAssignment:void 0,initialLayoutOrder:null,initialSlots:{},initialPersona:null,apiBaseUrl:_e});function Ce(e){var h,c;let[t,n]=(0,b.useState)(null),[o]=(0,b.useState)(()=>{var v;return(v=e.sessionSegment)!=null?v:ht()}),[i,p]=(0,b.useState)(oe());(0,b.useEffect)(()=>he(()=>p(oe())),[]),(0,b.useEffect)(()=>{if(e.consent===!1&&!e.preConsentBehavior){n(l=>(l==null||l.destroy(),null));return}let v={apiKey:e.apiKey,context:e.context,debug:e.debug,initialAssignments:e.initialAssignments,sessionSegment:o,consent:e.consent,preConsentBehavior:e.preConsentBehavior,respectDoNotTrack:e.respectDoNotTrack,ssrSessionId:e.ssrSessionId,country:e.country,localMode:e.localMode,initialSlots:e.initialSlots,initialPersona:e.initialPersona,ingestUrl:e.apiBaseUrl?`${e.apiBaseUrl.replace(/\/$/,"")}/events`:void 0},u=!1,a=null;return e.enableGraph?import("@sentientui/core/graph").then(({init:l})=>{u||(a=l(H(G({},v),{graph:!0})),n(a))}):(a=(0,$.init)(v),n(a)),()=>{u=!0,a==null||a.destroy()}},[e.consent]),(0,b.useEffect)(()=>{if(!t)return;let v=!1,u=async()=>{if(v)return;let l;try{l=await t.fetchWeights()}catch(y){return}if(!v)for(let y of l){let w={componentId:y.componentId,updatedAt:y.updatedAt,variants:y.variants.map(S=>{var m;return{variantId:S.variantId,pulls:S.pulls,avgReward:(m=S.avgReward)!=null?m:0}})};q(y.componentId,w)}};u();let a=setInterval(()=>{u()},6e4);return()=>{v=!0,clearInterval(a)}},[t]);let r=(h=e.ssrFallback)!=null?h:"first",s=(c=e.apiBaseUrl)!=null?c:_e;(0,b.useEffect)(()=>{var v;typeof process!="undefined"&&((v=process.env)==null?void 0:v.NODE_ENV)==="production"||xe({apiKey:e.apiKey,apiBaseUrl:s,isLocal:(t==null?void 0:t.isLocal)===!0})},[t,e.apiKey,s]),(0,b.useEffect)(()=>{e.initialLayoutOrder&&e.initialLayoutOrder.length>0&&ke(e.initialLayoutOrder)},[e.initialLayoutOrder]);let g=(0,b.useMemo)(()=>t&&i?we(t):t,[t,i]),d=(0,b.useMemo)(()=>{var v,u,a,l;return{client:g,apiKey:e.apiKey,initialAssignments:(v=e.initialAssignments)!=null?v:{},sessionSegment:o,ssrFallback:r,onAssignment:e.onAssignment,initialLayoutOrder:(u=e.initialLayoutOrder)!=null?u:null,initialSlots:(a=e.initialSlots)!=null?a:{},initialPersona:(l=e.initialPersona)!=null?l:null,apiBaseUrl:s}},[g,e.apiKey,e.initialAssignments,o,r,e.onAssignment,e.initialLayoutOrder,e.initialSlots,e.initialPersona,s]);return(0,Oe.jsx)(O.Provider,{value:d,children:e.children})}function _(){return(0,b.useContext)(O).client}function I(){return(0,b.useContext)(O).apiKey}function ee(){return(0,b.useContext)(O).initialAssignments}function te(){return(0,b.useContext)(O).sessionSegment}function Re(){return(0,b.useContext)(O).ssrFallback}function ne(){return(0,b.useContext)(O).onAssignment}function Ge(){let e=(0,b.useContext)(O).initialLayoutOrder,t=(0,b.useSyncExternalStore)(Y,()=>{var n;return typeof window=="undefined"?null:(n=window.__sentient_layout_override)!=null?n:null},()=>null);return t!=null?t:e}function Ee(){return(0,b.useContext)(O).initialSlots}function Le(){return(0,b.useContext)(O).apiBaseUrl}var x=require("react"),Te=require("@sentientui/core");var P=require("react");function wt(e){var n;if(typeof window=="undefined")return null;let t=(n=window.__sentient_overrides)==null?void 0:n[e];if(t)return t;try{let o=new URLSearchParams(window.location.search);for(let i of o.getAll("sentient_variant")){let p=i.indexOf(":");if(p!==-1&&i.slice(0,p)===e)return i.slice(p+1)}}catch(o){}return null}function Ie(e,t){var o;let n=null;for(let i of e.variants)t.includes(i.variantId)&&(!n||i.avgReward>n.avgReward)&&(n={variantId:i.variantId,avgReward:i.avgReward});return(o=n==null?void 0:n.variantId)!=null?o:null}function N(e,t,n,o){let i=ee(),p=Re(),r=_(),s=te(),g=ne(),d=(0,P.useRef)(null),h=wt(e),c=h&&t.includes(h)?h:null,v=(0,P.useRef)(null);c&&v.current!==c&&(v.current=c,console.info(`[sentient] override active: ${e} -> ${c}`));let u=(()=>{var m,f;if(c)return{variantId:c,content:null,isLoading:!1};if(!r){let A=i[e];return A&&t.includes(A)?{variantId:A,content:null,isLoading:!1}:p==="first"&&t.length>0?{variantId:t[0],content:null,isLoading:!1}:{variantId:null,content:null,isLoading:!0}}let w=r.getAssignment(e,s);if(w&&(t.includes(w.variantId)||w.content))return{variantId:w.variantId,content:(m=w.content)!=null?m:null,isLoading:!1};let S=Q(e);if(S){let A=Ie(S,t);if(A)return{variantId:A,content:null,isLoading:!1}}return{variantId:(f=t[0])!=null?f:null,content:null,isLoading:!1}})(),[a,l]=(0,P.useState)(u),y=w=>{g&&d.current!==w&&(d.current=w,g(e,w))};return(0,P.useEffect)(()=>{var S;if(c||!r)return;let w=r.getAssignment(e,s);if(w&&(t.includes(w.variantId)||w.content)){l({variantId:w.variantId,content:(S=w.content)!=null?S:null,isLoading:!1}),y(w.variantId);return}l(m=>{var f;return m.variantId?m:{variantId:(f=t[0])!=null?f:null,content:null,isLoading:!1}})},[c,r,e,s]),(0,P.useEffect)(()=>{if(c||!r)return;let w=r.getAssignment(e,s);if(w&&t.includes(w.variantId))return;let S=!1;return r.assign(e,t,n,o).then(m=>{var f;S||m&&(!t.includes(m.variantId)&&!m.content||(l({variantId:m.variantId,content:(f=m.content)!=null?f:null,isLoading:!1}),y(m.variantId)))}),()=>{S=!0}},[c,r,e,s]),(0,P.useEffect)(()=>{if(!c&&r)return X(e,w=>{var f;let S=r.getAssignment(e,s);if(S&&(t.includes(S.variantId)||S.content)){l({variantId:S.variantId,content:(f=S.content)!=null?f:null,isLoading:!1});return}let m=Ie(w,t);m&&l({variantId:m,content:null,isLoading:!1})})},[c,r,e,s]),c?{variantId:c,content:null,isLoading:!1}:a}function E(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}function M(e){return typeof e=="string"?{type:"click"}:e}function D(e){return typeof e=="string"?e:e.type}var bt=3e4;function At(e,t){try{let n=`_snt_pv_${e}_${t}`;return sessionStorage.getItem(n)?!1:(sessionStorage.setItem(n,"1"),!0)}catch(n){return!0}}function xt(e){if(!(e instanceof Element))return!1;let t=e.tagName.toLowerCase();return t==="a"||t==="button"?!0:e.getAttribute("role")==="button"}function Pe(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 o=e;for(;o&&o!==t;){if(xt(o))return!0;o=o.parentElement}return!1}function W(e,t,n){if(t.type==="weighted_composite"){let s=new Set,g=[];return t.steps.forEach(({goal:d,name:h,weight:c},v)=>{let u=()=>{s.has(v)||(s.add(v),n.fireStep(h,c,v))};if(d.type==="click"){let a=l=>{let y=l.target;y instanceof Element&&Pe(y,e,d.selector)&&u()};e.addEventListener("click",a),g.push(()=>e.removeEventListener("click",a));return}if(d.type==="form_submit"){let a=l=>{l.target instanceof HTMLFormElement&&e.contains(l.target)&&u()};e.addEventListener("submit",a),g.push(()=>e.removeEventListener("submit",a));return}if(d.type==="scroll_depth"){let a=Math.max(0,Math.min(1,d.threshold)),l=new IntersectionObserver(y=>{for(let w of y)if(w.intersectionRatio>=a){u(),l.disconnect();break}},{threshold:[a]});l.observe(e),g.push(()=>l.disconnect())}}),()=>{for(let d of g)d()}}let o=t.type==="composite"?t.all:[t],i=new Set(o.map((s,g)=>g)),p=s=>{i.delete(s),i.size===0&&n.fireGoal()},r=[];return o.forEach((s,g)=>{if(s.type==="click"){let d=h=>{let c=h.target;c instanceof Element&&Pe(c,e,s.selector)&&(t.type==="composite"?p(g):n.fireGoal())};e.addEventListener("click",d),r.push(()=>e.removeEventListener("click",d));return}if(s.type==="form_submit"){let d=h=>{h.target instanceof HTMLFormElement&&e.contains(h.target)&&(t.type==="composite"?p(g):n.fireGoal())};e.addEventListener("submit",d),r.push(()=>e.removeEventListener("submit",d));return}if(s.type==="scroll_depth"){let d=Math.max(0,Math.min(1,s.threshold)),h=new IntersectionObserver(c=>{for(let v of c)if(v.intersectionRatio>=d){t.type==="composite"?p(g):n.fireGoal(),h.disconnect();break}},{threshold:[d]});h.observe(e),r.push(()=>h.disconnect());return}}),()=>{for(let s of r)s()}}function F(e,t,n,o,i){var s;let p=(s=i==null?void 0:i.innerHTML)!=null?s:"",r=p!==""&&At(n,o);e.track({projectId:t,componentId:n,variantId:o,eventType:"variant_assigned",payload:r?{previewHtml:p.slice(0,bt)}:{}})}var De=require("react/jsx-runtime");function kt(e){var w;let t=_(),n=I(),o=(0,x.useMemo)(()=>Object.keys(e.variants),[e.variants]),{variantId:i,content:p}=N(e.id,o,e.agentData,e.agentDataByVariant),r=(0,x.useRef)(null),[s,g]=(0,x.useState)(!1);(0,x.useEffect)(()=>{g(!0)},[]);let d=(0,x.useRef)(!1),h=(0,x.useRef)(new Set),c=(0,x.useRef)(null),v=typeof e.goal=="string"?e.goal:JSON.stringify(e.goal),u=(0,x.useMemo)(()=>M(e.goal),[v]),a=typeof e.goal=="string"?e.goal:u.type;if((0,x.useEffect)(()=>T({id:e.id,variantIds:o,goal:a}),[e.id,o,a]),(0,x.useEffect)(()=>{var m,f;!t||!i||!n||c.current===i||!((f=(m=r.current)==null?void 0:m.innerHTML)!=null&&f)||(c.current=i,F(t,n,e.id,i,r.current))},[t,i,n,e.id,s,p]),(0,x.useEffect)(()=>{d.current=!1,h.current=new Set},[i,u]),(0,x.useEffect)(()=>{if(!t||!i)return;let S=r.current;if(!S)return;let m=null,f=0,A=()=>{f=Date.now(),m=setTimeout(()=>{t.track({projectId:n,componentId:e.id,variantId:i,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-f}}),m=null},800)},C=()=>{m!==null&&(clearTimeout(m),m=null)};return S.addEventListener("mouseenter",A),S.addEventListener("mouseleave",C),()=>{S.removeEventListener("mouseenter",A),S.removeEventListener("mouseleave",C),m!==null&&clearTimeout(m)}},[t,i,n,e.id]),(0,x.useEffect)(()=>{if(!t||!i)return;let S=r.current;if(!S)return;let m=Date.now();return(0,Te.attachMicroSignalDetectors)((f,A={})=>{var ue,de,ge;t.track({projectId:n,componentId:e.id,variantId:i,eventType:"micro_signal",payload:G({signalType:f},A)});let C=(ue=e.microSignalGoals)==null?void 0:ue[f];if(!C||h.current.has(f))return;h.current.add(f);let rt=typeof C=="string"?C:C.name,ot=typeof C=="string"?1:(de=C.weight)!=null?de:1,st=typeof C=="string"?0:(ge=C.stepIndex)!=null?ge:0;t.goal(rt,G({signalType:f},A),ot,st)},S,m)},[t,i,n,e.id,e.microSignalGoals]),(0,x.useEffect)(()=>{if(!t||!i)return;let S=r.current;if(S)return W(S,u,{fireGoal:()=>{d.current||(d.current=!0,t.track({projectId:n,componentId:e.id,variantId:i,eventType:"goal_achieved",goalType:a,payload:{reward:1}}),t.goal(a,{componentId:e.id,variantId:i},1,0))},fireStep:(m,f,A)=>{t.track({projectId:n,componentId:e.id,variantId:i,eventType:"goal_achieved",goalType:m,payload:{reward:f}}),t.goal(m,{},f,A)}})},[t,i,n,e.id,u,a]),e.clientOnly&&(!s||!t)||!i)return null;let l=(w=e.variants[i])!=null?w:null,y=l===null?p:null;return E()&&l===null&&y===null&&console.warn(`[sentient] <Adaptive id="${e.id}"> was assigned variant "${i}" but no matching key exists in props.variants. If this is a dashboard-managed text variant, use <AdaptiveText id="${e.id}"> instead.`),(0,De.jsx)("div",{ref:r,"data-sentient-id":e.id,"data-sentient-variant":i,children:l!=null?l:y})}var Me=(0,x.memo)(kt,(e,t)=>{if(e.id!==t.id||JSON.stringify(e.goal)!==JSON.stringify(t.goal)||e.microSignalGoals!==t.microSignalGoals)return!1;if(e.variants===t.variants)return!0;let n=Object.keys(e.variants),o=Object.keys(t.variants);return n.length!==o.length?!1:n.every(i=>i in t.variants)});var B=require("react");var Fe=require("react/jsx-runtime");function We({id:e,default:t,component:n="span",className:o}){let i=_(),p=I(),r=ne(),s=te(),g=(0,B.useRef)(null),[d,h]=(0,B.useState)(()=>{var u,a;return(a=(u=i==null?void 0:i.getAssignment(e,s))==null?void 0:u.content)!=null?a:null}),[c,v]=(0,B.useState)(()=>{var u,a;return(a=(u=i==null?void 0:i.getAssignment(e,s))==null?void 0:u.variantId)!=null?a:null});return(0,B.useEffect)(()=>{var a;if(!i||((a=i.getAssignment(e,s))==null?void 0:a.content)!==void 0)return;let u=!1;return i.assign(e).then(l=>{if(!u){if(!l){E()&&console.warn(`[sentient] <AdaptiveText id="${e}"> assignment failed \u2014 showing default text.`);return}v(l.variantId),l.content&&h(l.content)}}),()=>{u=!0}},[i,e,s]),(0,B.useEffect)(()=>{!i||!c||!p||g.current!==c&&(g.current=c,i.track({projectId:p,componentId:e,variantId:c,eventType:"variant_assigned",payload:{}}),r==null||r(e,c))},[i,c,p,e,r]),(0,Fe.jsx)(n,{className:o,children:d!=null?d:t})}var Be=require("react");function je(e){let t=_();return(0,Be.useCallback)((n,o)=>{t==null||t.componentGoal(e,n,o)},[t,e])}var $e=require("@sentientui/core"),Ne=require("@sentientui/policy"),Ve=require("react/jsx-runtime");function Ke(e){return JSON.stringify(e).replace(/</g,"\\u003c")}function _t(e){return e.persona?'(function(){try{var d=document.documentElement;if(d.hasAttribute("data-sentient-persona"))return;d.setAttribute("data-sentient-persona",'+Ke(e.persona.persona)+');d.setAttribute("data-sentient-confidence",'+Ke((0,Ne.confidenceBand)(e.persona.confidence))+");}catch(e){}})();":(0,$e.renderPrePaintScript)(e.apiKey)}function Ue(e){return(0,Ve.jsx)("script",{"data-sentient-persona-script":"",dangerouslySetInnerHTML:{__html:_t(e)}})}var L=require("react"),He=require("@sentientui/policy");var U=require("react"),j=require("@sentientui/core"),Ct=require("@sentientui/policy");function ie(e,t){var h;(0,U.useSyncExternalStore)(Y,Ae,()=>0);let n=_(),o=Ee(),[,i]=(0,U.useReducer)(c=>c+1,0),p=typeof window!="undefined"?(h=window.__sentient_slot_overrides)==null?void 0:h[e]:void 0,r=p===void 0?o[e]:void 0,s=p===void 0&&r===void 0&&n?n.getSlotResult(e):null,g=(n==null?void 0:n.isLocal)===!0&&p===void 0&&r===void 0&&s===null;if((0,U.useEffect)(()=>{if(!g||!n)return;let c=!1;return n.decide({slots:[t]}).then(v=>{!c&&v&&i()}),()=>{c=!0}},[n,e,g]),p!==void 0)return{result:p,arm:(0,j.armOfResult)(p),source:"override"};if(r!==void 0)return{result:r,arm:(0,j.armOfResult)(r),source:"preloaded"};if(s!==null)return{result:s,arm:(0,j.armOfResult)(s),source:"client"};let d=(0,j.baselineResultFor)(t);return{result:d,arm:(0,j.armOfResult)(d),source:"baseline"}}var se=new Set;function Rt(e){return typeof CSS!="undefined"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/"/g,'\\"')}function Je(e,t,n){let o=_(),i=I(),p=(0,L.useMemo)(()=>({id:e,dims:t}),[e]),{result:r,arm:s}=ie(e,p),g=(0,L.useMemo)(()=>typeof r=="string"?{}:r,[s]);if(E()&&!se.has(e)){let u=(0,He.validateSlotDecl)({id:e,dims:Object.fromEntries(Object.entries(t).map(([l,y])=>[l,[...y]]))}),a=Object.values(t).reduce((l,y)=>l*y.length,1);u.ok?a>4&&(se.add(e),console.warn(`[sentient] useAdaptiveTokens("${e}") declares ${a} combinations \u2014 more than the recommended 4. Each extra combination needs more traffic to learn; consider fewer dims/values.`)):(se.add(e),console.warn(`[sentient] useAdaptiveTokens("${e}"): invalid declaration \u2014 ${u.reason}. Serving baseline.`))}let d=(n==null?void 0:n.goal)===void 0?null:typeof n.goal=="string"?n.goal:JSON.stringify(n.goal),h=(0,L.useMemo)(()=>Object.entries(t).flatMap(([u,a])=>a.map(l=>`${u}=${l}`)),[e]);(0,L.useEffect)(()=>T({id:e,variantIds:h,goal:n!=null&&n.goal?D(n.goal):void 0}),[e,h,d]),(0,L.useEffect)(()=>Z({id:e,dims:t}),[e]);let c=(0,L.useRef)(null);(0,L.useEffect)(()=>{!o||c.current===s||(c.current=s,F(o,i,e,s,null))},[o,i,e,s]),(0,L.useEffect)(()=>{if(!o||!(n!=null&&n.goal))return;let u=document.querySelector(`[data-sentient-slot="${Rt(e)}"]`);if(!u){E()&&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 a=D(n.goal),l=!1;return W(u,M(n.goal),{fireGoal:()=>{l||(l=!0,o.componentGoal(e,a))},fireStep:(y,w)=>{o.componentGoal(e,y,{reward:w})}})},[o,e,d,s]);let v=(0,L.useMemo)(()=>{let u={"data-sentient-slot":e};for(let[a,l]of Object.entries(g))u[`data-${a}`]=l;return u},[e,g]);return{tokens:g,props:v}}var k=require("react"),Xe=require("@sentientui/core");var ze=new Set;function qe(e,t){var m;if(E()&&!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 n=_(),o=I(),i=(0,k.useMemo)(()=>Object.keys(t.variants),[e]),{variantId:p}=N(e,i),r=(m=p!=null?p:i[0])!=null?m:"",s=t.variants[r],[g,d]=(0,k.useState)(null),h=(0,k.useRef)(null),c=(0,k.useCallback)(f=>{h.current=f,d(f)},[]),v=typeof t.goal=="string"?t.goal:JSON.stringify(t.goal),u=(0,k.useMemo)(()=>M(t.goal),[v]),a=D(t.goal);(0,k.useEffect)(()=>T({id:e,variantIds:i,goal:a}),[e,i,a]);let l=(0,k.useRef)(null);(0,k.useEffect)(()=>{!n||!r||!g||l.current!==r&&(l.current=r,F(n,o,e,r,g))},[n,o,e,r,g]);let y=(0,k.useRef)(!1);(0,k.useEffect)(()=>{y.current=!1},[r,v]),(0,k.useEffect)(()=>{if(!(!n||!r||!g))return W(g,u,{fireGoal:()=>{y.current||(y.current=!0,n.track({projectId:o,componentId:e,variantId:r,eventType:"goal_achieved",goalType:a,payload:{reward:1}}),n.goal(a,{componentId:e,variantId:r},1,0))},fireStep:(f,A,C)=>{n.track({projectId:o,componentId:e,variantId:r,eventType:"goal_achieved",goalType:f,payload:{reward:A}}),n.goal(f,{},A,C)}})},[n,g,r,o,e,u,a]),(0,k.useEffect)(()=>{if(!n||!r||!g)return;let f=Date.now();return(0,Xe.attachMicroSignalDetectors)((A,C={})=>{n.track({projectId:o,componentId:e,variantId:r,eventType:"micro_signal",payload:G({signalType:A},C)})},g,f)},[n,g,r,o,e]),(0,k.useEffect)(()=>{if(!E()||!n)return;let f=setTimeout(()=>{!h.current&&!ze.has(e)&&(ze.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(f)},[n,e]);let w=(0,k.useCallback)((f,A)=>{n==null||n.componentGoal(e,f!=null?f:a,A)},[n,e,a]),S=(0,k.useMemo)(()=>({ref:c,"data-sentient-id":e,"data-sentient-variant":r}),[c,e,r]);return{variant:r,value:s,bind:S,fireGoal:w}}var R=require("react");var Ye=require("react/jsx-runtime"),re=new Set;function Qe(e){var l;let t=_(),n=I(),o=(0,R.useRef)(null),i=(0,R.useMemo)(()=>Object.keys(e.arrangements),[e.id]),p=(0,R.useMemo)(()=>G({id:e.id,arms:i},e.baseline!==void 0?{baseline:e.baseline}:{}),[e.id,i,e.baseline]),{arm:r}=ie(e.id,p);E()&&e.baseline!==void 0&&e.baseline!==i[0]&&!re.has(e.id+":baseline")&&(re.add(e.id+":baseline"),console.warn(`[sentient] <AdaptiveGroup id="${e.id}">: baseline "${e.baseline}" is not the first-declared arrangement ("${i[0]}"). The first arrangement should usually be the page's real incumbent (the holdout sees it).`));let s=R.Children.toArray(e.children).filter(R.isValidElement),g=new Map;for(let y of s)g.set(String((l=y.key)!=null?l:"").replace(/^\.\$/,""),y);let d=e.arrangements[r],h=d!==void 0&&d.length===s.length&&d.every(y=>g.has(y));E()&&d!==void 0&&!h&&!re.has(e.id+":keys")&&(re.add(e.id+":keys"),console.warn(`[sentient] <AdaptiveGroup id="${e.id}">: arrangement "${r}" [${d.join(", ")}] does not match the children's keys \u2014 rendering declaration order (fail-safe).`));let c=h?d.map(y=>g.get(y)):s,v=e.goal!==void 0?D(e.goal):void 0;(0,R.useEffect)(()=>T({id:e.id,variantIds:i,goal:v}),[e.id,i,v]),(0,R.useEffect)(()=>Z({id:e.id,arms:Object.keys(e.arrangements)}),[e.id]);let u=(0,R.useRef)(null);(0,R.useEffect)(()=>{!t||u.current===r||(u.current=r,F(t,n,e.id,r,o.current))},[t,n,e.id,r]);let a=e.goal===void 0?null:typeof e.goal=="string"?e.goal:JSON.stringify(e.goal);return(0,R.useEffect)(()=>{if(!t||e.goal===void 0)return;let y=o.current;if(!y)return;let w=D(e.goal),S=!1;return W(y,M(e.goal),{fireGoal:()=>{S||(S=!0,t.componentGoal(e.id,w))},fireStep:(m,f)=>{t.componentGoal(e.id,m,{reward:f})}})},[t,e.id,a,r]),(0,Ye.jsx)("div",{ref:o,"data-sentient-id":e.id,"data-sentient-variant":r,children:c})}var ae=require("@sentientui/core");var Gt=["page","blocks","layoutOrder"],Ze=new Map;function et(e,t){Ze.set(e,t)}function le(e){return Ze.get(e)}function tt(e){var i,p;let t=(p=(i=e.content)!=null?i:le(e.page))!=null?p:{},n={};for(let[r,s]of Object.entries(t))Gt.includes(r)||(n[r]=s);let o=H(G({},n),{page:e.page,blocks:e.blocks});return e.layoutOrder&&(o.layoutOrder=e.layoutOrder),o}function nt(e){return`<script type="application/ld+json">${ce(e)}</script>`}function ce(e){return JSON.stringify(G({"@context":"https://schema.org","@type":"WebPage"},e)).replace(/</g,"\\u003c")}function it(e){let t=[];e.title&&t.push(`# ${e.title}`,""),e.summary&&t.push(String(e.summary),"");for(let[n,o]of Object.entries(e))["page","title","summary","blocks","layoutOrder"].includes(n)||t.push(`## ${n}`,"","```json",JSON.stringify(o,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
- `}0&&(module.exports={Adaptive,AdaptiveProvider,AdaptiveText,buildAgentFeed,defineAgentContent,detectSegment,getAgentContent,getWeights,renderAgentJsonLd,renderAgentJsonLdBody,renderAgentMarkdown,subscribeWeights,updateWeights,useAdaptiveGoal,useAssignment,useInitialAssignments,useLayoutOrder,useSentient});
4
+ `}0&&(module.exports={Adaptive,AdaptiveGroup,AdaptiveProvider,AdaptiveText,SentientPersonaScript,buildAgentFeed,defineAgentContent,detectSegment,getAgentContent,getWeights,renderAgentJsonLd,renderAgentJsonLdBody,renderAgentMarkdown,subscribeWeights,updateWeights,useAdaptive,useAdaptiveApiBaseUrl,useAdaptiveGoal,useAdaptiveTokens,useAssignment,useInitialAssignments,useLayoutOrder,useSentient});
5
5
  //# sourceMappingURL=index.js.map