@mgamadeus/ddd-agents 0.1.0-alpha.26 → 0.1.0-alpha.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index-7Qc_3GbG.js","sources":["../../src/renderer/widget-hydration/widget-hydration.reducer.ts","../../src/renderer/widget-hydration/widget-hydration-state-store.ts","../../src/provider/class-names.ts","../../src/provider/components/default-components.tsx","../../src/provider/environment.ts","../../src/provider/AgentsProvider.tsx","../../src/provider/components/index.tsx"],"sourcesContent":["import type { AgentsStateAction } from \"../../provider/environment\";\nimport { WidgetHydrationSliceState, WidgetMemory } from \"./widget-hydration.types\";\n\n/**\n * The widget hydration state: one memory per hydration key. A plain reducer under the key\n * `AIExtensionsWidgetHydration` of a state store: the app's own (`AgentsEnvironment.stateStore`, the host application mounts it in\n * its Redux store) or, without one, the package's default store (`widget-hydration-state-store.ts`).\n */\n\nconst SLICE_NAME = \"widgetHydrationSlice\";\n\nconst emptyMemory = (): WidgetMemory => {\n return {\n data: null,\n status: \"idle\",\n error: null,\n loadingInstanceId: null,\n inFlight: false,\n requestId: 0,\n lastLoadedAt: null,\n };\n};\n\nconst initialState: WidgetHydrationSliceState = {\n widgets: {},\n};\n\nconst readMemory = (state: WidgetHydrationSliceState, key: string): WidgetMemory => state.widgets[key] ?? emptyMemory();\n\nconst withMemory = (state: WidgetHydrationSliceState, key: string, memory: WidgetMemory): WidgetHydrationSliceState => ({\n ...state,\n widgets: { ...state.widgets, [key]: memory },\n});\n\n/** Does a result still belong to the request the memory tracks? (0 = the memory was reset since.) */\nconst isCurrentRequest = (memory: WidgetMemory, requestId: number): boolean =>\n memory.requestId === 0 || memory.requestId === requestId;\n\ninterface MemoryEnsuredPayload {\n key: string;\n}\ninterface InstanceAttachedPayload {\n key: string;\n instanceId: string;\n}\ninterface HydrationStartedPayload {\n key: string;\n instanceId: string;\n requestId: number;\n}\ninterface HydrationSucceededPayload {\n key: string;\n requestId: number;\n data: unknown;\n}\ninterface HydrationFailedPayload {\n key: string;\n requestId: number;\n error: string;\n}\ninterface WidgetResetPayload {\n key: string;\n}\n\nconst actionType = (name: string): string => `${SLICE_NAME}/${name}`;\n\n/** The action creators (the action types are the ones the former Redux Toolkit slice used). */\nexport const WidgetHydrationSlice = {\n memoryEnsured: (payload: MemoryEnsuredPayload): AgentsStateAction => ({ type: actionType(\"memoryEnsured\"), payload }),\n instanceAttached: (payload: InstanceAttachedPayload): AgentsStateAction => ({\n type: actionType(\"instanceAttached\"),\n payload,\n }),\n hydrationStarted: (payload: HydrationStartedPayload): AgentsStateAction => ({\n type: actionType(\"hydrationStarted\"),\n payload,\n }),\n hydrationSucceeded: (payload: HydrationSucceededPayload): AgentsStateAction => ({\n type: actionType(\"hydrationSucceeded\"),\n payload,\n }),\n hydrationFailed: (payload: HydrationFailedPayload): AgentsStateAction => ({\n type: actionType(\"hydrationFailed\"),\n payload,\n }),\n widgetReset: (payload: WidgetResetPayload): AgentsStateAction => ({ type: actionType(\"widgetReset\"), payload }),\n allWidgetsReset: (): AgentsStateAction => ({ type: actionType(\"allWidgetsReset\") }),\n};\n\nexport const WidgetHydrationReducer = (\n state: WidgetHydrationSliceState = initialState,\n action: AgentsStateAction,\n): WidgetHydrationSliceState => {\n switch (action.type) {\n case actionType(\"memoryEnsured\"): {\n const { key } = action.payload as MemoryEnsuredPayload;\n return state.widgets[key] ? state : withMemory(state, key, emptyMemory());\n }\n case actionType(\"instanceAttached\"): {\n const { key, instanceId } = action.payload as InstanceAttachedPayload;\n return withMemory(state, key, { ...readMemory(state, key), loadingInstanceId: instanceId });\n }\n case actionType(\"hydrationStarted\"): {\n const { key, instanceId, requestId } = action.payload as HydrationStartedPayload;\n return withMemory(state, key, {\n ...readMemory(state, key),\n status: \"loading\",\n error: null,\n inFlight: true,\n loadingInstanceId: instanceId,\n requestId,\n });\n }\n case actionType(\"hydrationSucceeded\"): {\n const { key, requestId, data } = action.payload as HydrationSucceededPayload;\n const memory = readMemory(state, key);\n if (!isCurrentRequest(memory, requestId)) return state.widgets[key] ? state : withMemory(state, key, memory);\n return withMemory(state, key, {\n ...memory,\n status: \"success\",\n error: null,\n inFlight: false,\n data,\n loadingInstanceId: null,\n requestId,\n lastLoadedAt: Date.now(),\n });\n }\n case actionType(\"hydrationFailed\"): {\n const { key, requestId, error } = action.payload as HydrationFailedPayload;\n const memory = readMemory(state, key);\n if (!isCurrentRequest(memory, requestId)) return state.widgets[key] ? state : withMemory(state, key, memory);\n return withMemory(state, key, {\n ...memory,\n status: \"error\",\n error,\n inFlight: false,\n loadingInstanceId: null,\n requestId,\n });\n }\n case actionType(\"widgetReset\"): {\n const { key } = action.payload as WidgetResetPayload;\n if (!(key in state.widgets)) return state;\n const { [key]: removedMemory, ...remainingWidgets } = state.widgets;\n return { ...state, widgets: remainingWidgets };\n }\n case actionType(\"allWidgetsReset\"):\n return { ...state, widgets: {} };\n default:\n return state;\n }\n};\n","import { useSyncExternalStore } from \"react\";\nimport type { AgentsStateAction, AgentsStateStore } from \"../../provider/environment\";\nimport { WidgetHydrationReducer } from \"./widget-hydration.reducer\";\nimport type { WidgetHydrationSliceState } from \"./widget-hydration.types\";\n\n/** The state of the package's default store: the widget hydration state under the key package code reads. */\nexport interface AgentsWidgetHydrationState {\n AIExtensionsWidgetHydration: WidgetHydrationSliceState;\n}\n\n/**\n * The package's own state store (widget hydration is one store per app): the widget hydration reducer\n * behind `useSyncExternalStore`, no Redux. Package code reads and dispatches through it whenever the app supplies no\n * `AgentsEnvironment.stateStore` (the host application supplies its Redux store, which mounts the same reducer). Actions the\n * reducer does not know (the app's \"a chat surface is open\" action) change nothing.\n */\nexport class AgentsWidgetHydrationStateContainer implements AgentsStateStore {\n protected state: AgentsWidgetHydrationState = {\n AIExtensionsWidgetHydration: WidgetHydrationReducer(undefined, { type: \"agents/widgetHydrationStoreCreated\" }),\n };\n protected readonly listeners = new Set<() => void>();\n\n getState = (): AgentsWidgetHydrationState => this.state;\n\n subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n };\n\n dispatch = (action: AgentsStateAction): AgentsStateAction => {\n const nextHydrationState = WidgetHydrationReducer(this.state.AIExtensionsWidgetHydration, action);\n if (nextHydrationState === this.state.AIExtensionsWidgetHydration) return action;\n this.state = { AIExtensionsWidgetHydration: nextHydrationState };\n for (const notifyListener of [...this.listeners]) notifyListener();\n return action;\n };\n\n /** `AgentsStateStore.useSelector`: one value of the state, re-rendering when it changes. */\n useSelector = <Selected,>(selector: (state: AgentsWidgetHydrationState) => Selected): Selected => {\n const readSelectedValue = () => selector(this.state);\n return useSyncExternalStore(this.subscribe, readSelectedValue, readSelectedValue);\n };\n\n /** `AgentsStateStore.useDispatch`. */\n useDispatch = (): ((action: AgentsStateAction) => AgentsStateAction) => this.dispatch;\n}\n\n/** A new widget hydration store (a test, a second app on one page). */\nexport const createAgentsWidgetHydrationStateStore = (): AgentsStateStore =>\n new AgentsWidgetHydrationStateContainer();\n\nlet defaultStateStore: AgentsStateStore | null = null;\n\n/** The one default store of the page, created on first use. */\nexport const getDefaultAgentsStateStore = (): AgentsStateStore => {\n defaultStateStore ??= createAgentsWidgetHydrationStateStore();\n return defaultStateStore;\n};\n","type ClassNameValue = string | undefined | null | false | Readonly<Record<string, boolean | undefined | null>>;\n\n/** The class names one argument contributes: a set string, or every key of an object whose value is truthy. */\nconst readClassNamesOfValue = (value: ClassNameValue): string[] => {\n if (typeof value === \"string\") return value.length > 0 ? [value] : [];\n if (!value) return [];\n return Object.keys(value).filter((className) => className.length > 0 && Boolean(value[className]));\n};\n\n/**\n * Joins the class names that are set, skipping empty and falsy values; an object adds each key whose value is truthy\n * (`classNames(styles.card, { [styles.selected]: isSelected })`), in argument order, as the `classnames` package does.\n */\nexport const classNames = (...args: ClassNameValue[]): string => args.flatMap(readClassNamesOfValue).join(\" \");\n","import { useMemo, useState } from \"react\";\nimport ReactMarkdown, { type Components } from \"react-markdown\";\nimport remarkGfm from \"remark-gfm\";\nimport type { PluggableList } from \"unified\";\nimport type {\n AgentsButtonProps,\n AgentsCheckboxProps,\n AgentsComponents,\n AgentsConversationSearchResultsListProps,\n AgentsHeroRowProps,\n AgentsHeroValueProps,\n AgentsMarkdownProps,\n AgentsSegmentBarProps,\n AgentsSkeletonTextProps,\n AgentsStatusBadgeStatus,\n AgentsStatusChipProps,\n AgentsStatusChipTone,\n AgentsWidgetFeatureGateProps,\n AgentsWidgetTextProps,\n AgentsDateInputProps,\n AgentsGlowFrameProps,\n AgentsIconProps,\n AgentsInteractiveSurfaceProps,\n AgentsLoadingSpinnerProps,\n AgentsMapMarkerProps,\n AgentsMapProps,\n AgentsModalLayerProps,\n AgentsProgressBarProps,\n AgentsRadioGroupProps,\n AgentsRangeSliderProps,\n AgentsSelectProps,\n AgentsSkeletonProps,\n AgentsSplitViewProps,\n AgentsStatusBadgeProps,\n AgentsTabsProps,\n AgentsTextAreaProps,\n AgentsTextInputProps,\n AgentsTextProps,\n AgentsTextReplacements,\n AgentsTooltipProps,\n AgentsTrendDeltaProps,\n} from \"./types\";\nimport { useAgentsTexts } from \"../AgentsProvider\";\nimport { classNames } from \"../class-names\";\n\nconst TEXT_ELEMENT_BY_ROLE = {\n title: \"h4\",\n intro: \"p\",\n body: \"span\",\n help: \"span\",\n caption: \"span\",\n} as const;\n\n/** `--token` stands for `var(--token)`; any other value is a CSS colour. */\nconst readCssColor = (color: string | undefined): string | undefined =>\n color?.startsWith(\"--\") ? `var(${color})` : color;\n\nconst readPlainReplacements = (replacements?: AgentsTextReplacements): Record<string, string | number> => {\n const plainReplacements: Record<string, string | number> = {};\n for (const [name, value] of Object.entries(replacements ?? {})) {\n if (typeof value === \"string\" || typeof value === \"number\") plainReplacements[name] = value;\n }\n return plainReplacements;\n};\n\nconst useTranslatedText = (\n text: string | undefined,\n translate = true,\n replacements?: AgentsTextReplacements,\n context?: string,\n): string | undefined => {\n const texts = useAgentsTexts();\n if (text === undefined) return undefined;\n return translate ? texts.translate(text, readPlainReplacements(replacements), context) : text;\n};\n\n/** The package's own text: an element per role, styled by `agents-text--*` classes of the package stylesheet. */\nconst DefaultText = (props: AgentsTextProps) => {\n const {\n children,\n role = \"body\",\n weight,\n color,\n translate = true,\n replacements,\n context,\n ellipsis,\n display,\n textAlign,\n textWrap,\n allowNewLines,\n headingLevel,\n ariaHidden,\n className,\n testId,\n } = props;\n const texts = useAgentsTexts();\n const Element = TEXT_ELEMENT_BY_ROLE[role];\n const content =\n typeof children === \"string\" && translate\n ? texts.translate(children, readPlainReplacements(replacements), context)\n : children;\n return (\n <Element\n data-testid={testId}\n role={headingLevel ? \"heading\" : undefined}\n aria-level={headingLevel}\n aria-hidden={ariaHidden || undefined}\n className={classNames(\n \"agents-text\",\n `agents-text--${role}`,\n weight && `agents-text--weight-${weight}`,\n ellipsis && \"agents-text--ellipsis\",\n allowNewLines && \"agents-text--new-lines\",\n className,\n )}\n style={{\n color: readCssColor(color),\n display,\n textAlign,\n whiteSpace: textWrap === \"nowrap\" || ellipsis ? \"nowrap\" : allowNewLines ? \"pre-line\" : undefined,\n }}\n >\n {content}\n </Element>\n );\n};\n\nconst DefaultIcon = (props: AgentsIconProps) => {\n const { name, hostIconName, size, pixelSize, color, className, style } = props;\n const iconName = name ?? hostIconName;\n return (\n <span\n aria-hidden\n data-icon={iconName}\n className={classNames(\"agents-icon\", size && `agents-icon--${size}`, className)}\n style={{ color: readCssColor(color), ...(pixelSize ? { width: pixelSize, height: pixelSize } : null), ...style }}\n />\n );\n};\n\nconst DefaultButton = (props: AgentsButtonProps) => {\n const {\n children,\n variant = \"primary\",\n size = \"medium\",\n onClick,\n disabled,\n isLoading,\n rounded,\n pressed,\n onDark,\n blurred,\n inverted,\n icon,\n iconPosition = \"left\",\n htmlType = \"button\",\n fullWidth,\n wrapsLabel,\n translate,\n replacements,\n className,\n testId,\n ariaLabel,\n } = props;\n const label = useTranslatedText(children, translate, replacements);\n return (\n <button\n type={htmlType}\n aria-label={ariaLabel}\n aria-pressed={pressed}\n aria-busy={isLoading || undefined}\n disabled={disabled || isLoading}\n data-testid={testId}\n onClick={onClick}\n className={classNames(\n \"agents-button\",\n `agents-button--${variant}`,\n `agents-button--${size}`,\n rounded && \"agents-button--rounded\",\n pressed && \"agents-button--pressed\",\n onDark && \"agents-button--on-dark\",\n blurred && \"agents-button--blurred\",\n inverted && \"agents-button--inverted\",\n fullWidth && \"agents-button--full-width\",\n wrapsLabel && \"agents-button--wraps-label\",\n className,\n )}\n >\n {icon && iconPosition === \"left\" ? <DefaultIcon name={icon} size=\"small\" /> : null}\n {label}\n {icon && iconPosition === \"right\" ? <DefaultIcon name={icon} size=\"small\" /> : null}\n </button>\n );\n};\n\nconst DefaultInteractiveSurface = (props: AgentsInteractiveSurfaceProps) => {\n const { children, hoverable, className, style, testId } = props;\n return (\n <div\n data-testid={testId}\n className={classNames(\"agents-interactive-surface\", hoverable && \"agents-interactive-surface--hoverable\", className)}\n style={style}\n >\n {children}\n </div>\n );\n};\n\nconst DefaultSkeleton = (props: AgentsSkeletonProps) => {\n const { width, height, borderRadius = 4, className, style } = props;\n return (\n <div\n aria-hidden\n className={classNames(\"agents-skeleton\", className)}\n style={{ width, height, borderRadius, ...style }}\n />\n );\n};\n\nconst DefaultLoadingSpinner = (_props: AgentsLoadingSpinnerProps) => (\n <span role=\"progressbar\" aria-busy className=\"agents-loading-spinner\" />\n);\n\nconst DefaultTooltip = (props: AgentsTooltipProps) => {\n const { children, text, replacements, placement = \"top\", dark } = props;\n const [isShown, setIsShown] = useState(false);\n const shownText = useTranslatedText(text, true, replacements);\n return (\n <span\n className=\"agents-tooltip\"\n style={{ position: \"relative\", display: \"inline-flex\" }}\n onMouseEnter={() => setIsShown(true)}\n onMouseLeave={() => setIsShown(false)}\n onFocus={() => setIsShown(true)}\n onBlur={() => setIsShown(false)}\n >\n {children}\n {shownText && isShown ? (\n <span\n role=\"tooltip\"\n className={classNames(\"agents-tooltip__panel\", `agents-tooltip__panel--${placement}`, dark && \"agents-tooltip__panel--dark\")}\n style={{ position: \"absolute\", bottom: \"100%\", left: \"50%\", transform: \"translateX(-50%)\" }}\n >\n {shownText}\n </span>\n ) : null}\n </span>\n );\n};\n\nconst DefaultGlowFrame = (props: AgentsGlowFrameProps) => {\n const { children, className, color, borderRadius, borderWidth } = props;\n return (\n <div\n className={classNames(\"agents-glow-frame\", className)}\n style={{ borderRadius, borderWidth, borderStyle: borderWidth ? \"solid\" : undefined, borderColor: color }}\n >\n {children}\n </div>\n );\n};\n\nconst DefaultProgressBar = (props: AgentsProgressBarProps) => {\n const { value, height, color, indeterminate } = props;\n return (\n <progress\n className=\"agents-progress-bar\"\n max={100}\n value={indeterminate ? undefined : value}\n style={{ height, accentColor: color, width: \"100%\" }}\n />\n );\n};\n\nconst DefaultSplitView = (props: AgentsSplitViewProps) => {\n const { isSideOpen, main, side, sideToggle } = props;\n return (\n <div className=\"agents-split-view\" style={{ display: \"flex\", width: \"100%\", height: \"100%\" }}>\n <div\n className=\"agents-split-view__main\"\n style={{ width: isSideOpen ? (main.narrowedWidth ?? main.width) : main.width, background: main.background }}\n >\n {main.content}\n </div>\n {sideToggle ? (\n <button type=\"button\" className=\"agents-split-view__toggle\" onClick={sideToggle.onToggle} aria-expanded={isSideOpen} />\n ) : null}\n {isSideOpen ? (\n <div className=\"agents-split-view__side\" style={{ width: side.narrowedWidth ?? side.width, background: side.background }}>\n {side.content}\n </div>\n ) : null}\n </div>\n );\n};\n\nconst DefaultTrendDelta = (props: AgentsTrendDeltaProps) => {\n const { current, previous = 0, higherIsBetter = true, format } = props;\n const change = current - previous;\n const magnitude = Math.abs(change);\n const isGood = change === 0 ? undefined : (change > 0) === higherIsBetter;\n return (\n <span\n className={classNames(\n \"agents-trend-delta\",\n isGood === true && \"agents-trend-delta--good\",\n isGood === false && \"agents-trend-delta--bad\",\n )}\n >\n {change > 0 ? \"▲ \" : change < 0 ? \"▼ \" : \"\"}\n {format ? format(magnitude) : String(magnitude)}\n </span>\n );\n};\n\nconst DefaultCheckbox = (props: AgentsCheckboxProps) => {\n const { checked, disabled, label, translate, onChange, testId } = props;\n const translatedLabel = useTranslatedText(typeof label === \"string\" ? label : undefined, translate);\n return (\n <label className=\"agents-checkbox\" data-testid={testId}>\n <input type=\"checkbox\" checked={checked ?? false} disabled={disabled} onChange={onChange} />\n {typeof label === \"string\" ? translatedLabel : label}\n </label>\n );\n};\n\nconst DefaultTextInput = (props: AgentsTextInputProps) => {\n const { id, value, type = \"text\", label, placeholder, maxLength, onChange, testId } = props;\n const translatedLabel = useTranslatedText(label);\n return (\n <label className=\"agents-text-input\">\n {translatedLabel ? <span className=\"agents-text-input__label\">{translatedLabel}</span> : null}\n <input\n id={id}\n type={type}\n value={value ?? \"\"}\n placeholder={placeholder}\n maxLength={maxLength}\n data-testid={testId}\n onChange={(event) => onChange?.(event.target.value)}\n />\n </label>\n );\n};\n\nconst DefaultTextArea = (props: AgentsTextAreaProps) => {\n const { id, value, label, placeholder, maxLength, rows, minRows, showsCounter, autoFocus, onChange, testId } = props;\n const translatedLabel = useTranslatedText(label);\n return (\n <label className=\"agents-text-area\">\n {translatedLabel ? <span className=\"agents-text-area__label\">{translatedLabel}</span> : null}\n <textarea\n id={id}\n value={value ?? \"\"}\n placeholder={placeholder}\n maxLength={maxLength}\n rows={rows ?? minRows}\n autoFocus={autoFocus}\n data-testid={testId}\n onChange={(event) => onChange?.(event.target.value)}\n />\n {showsCounter && maxLength ? (\n <span className=\"agents-text-area__counter\">{`${(value ?? \"\").length} / ${maxLength}`}</span>\n ) : null}\n </label>\n );\n};\n\nconst DefaultRangeSlider = (props: AgentsRangeSliderProps) => {\n const { value, min, max, step, onMove, onRelease } = props;\n return (\n <input\n type=\"range\"\n className=\"agents-range-slider\"\n value={value}\n min={min}\n max={max}\n step={step}\n onChange={(event) => onMove?.(Number(event.target.value))}\n onPointerUp={(event) => onRelease?.(Number(event.currentTarget.value))}\n onKeyUp={(event) => onRelease?.(Number(event.currentTarget.value))}\n />\n );\n};\n\nconst toIsoDay = (timestamp: number | undefined): string | undefined => {\n if (timestamp === undefined) return undefined;\n const day = new Date(timestamp);\n const month = String(day.getMonth() + 1).padStart(2, \"0\");\n const dayOfMonth = String(day.getDate()).padStart(2, \"0\");\n return `${day.getFullYear()}-${month}-${dayOfMonth}`;\n};\n\nconst DefaultDateInput = (props: AgentsDateInputProps) => {\n const { value, minDate, maxDate, onChange } = props;\n return (\n <input\n type=\"date\"\n className=\"agents-date-input\"\n value={toIsoDay(value) ?? \"\"}\n min={toIsoDay(minDate)}\n max={toIsoDay(maxDate)}\n onChange={(event) => {\n const [year, month, day] = event.target.value.split(\"-\").map(Number);\n onChange?.(event.target.value ? new Date(year, month - 1, day).getTime() : null);\n }}\n />\n );\n};\n\nconst DefaultRadioGroup = (props: AgentsRadioGroupProps) => {\n const { name, value, options, direction = \"column\", onChange } = props;\n return (\n <div className=\"agents-radio-group\" style={{ display: \"flex\", flexDirection: direction }}>\n {options.map((option) => (\n <label key={option.value} className=\"agents-radio-group__option\">\n <input\n type=\"radio\"\n name={name}\n value={option.value}\n checked={option.value === value}\n disabled={option.disabled}\n onChange={() => onChange(option.value)}\n />\n {option.label}\n </label>\n ))}\n </div>\n );\n};\n\nconst DefaultSelect = (props: AgentsSelectProps) => {\n const { id, value, options, placeholder, onChange, testId } = props;\n return (\n <select\n id={id}\n className=\"agents-select\"\n value={value}\n data-testid={testId}\n onChange={(event) => onChange(event.target.value)}\n >\n {placeholder !== undefined ? (\n <option value=\"\" disabled>\n {placeholder}\n </option>\n ) : null}\n {options.map((option) => (\n <option key={option.value} value={option.value} disabled={option.disabled} title={option.description}>\n {option.label}\n </option>\n ))}\n </select>\n );\n};\n\nconst DefaultTabs = (props: AgentsTabsProps) => {\n const { options, value, onChange, ariaLabel } = props;\n return (\n <div role=\"tablist\" aria-label={ariaLabel} className=\"agents-tabs\">\n {options\n .filter((option) => !option.disabled)\n .map((option) => (\n <button\n key={option.value}\n type=\"button\"\n role=\"tab\"\n aria-selected={option.value === value}\n data-testid={option.testId}\n className={classNames(\"agents-tabs__tab\", option.value === value && \"agents-tabs__tab--selected\")}\n onClick={() => onChange(option.value)}\n >\n {option.label}\n </button>\n ))}\n </div>\n );\n};\n\nconst DefaultStatusBadge = (props: AgentsStatusBadgeProps) => {\n const { status, text, translate, size, className } = props;\n const shownText = useTranslatedText(text, translate);\n return (\n <span\n className={classNames(\n \"agents-status-badge\",\n `agents-status-badge--${status}`,\n size && `agents-status-badge--${size}`,\n className,\n )}\n >\n {shownText}\n </span>\n );\n};\n\n/** No map without the app's map: a placeholder that says so. */\nconst DefaultMap = (props: AgentsMapProps) => {\n const { className, testId } = props;\n const noMapText = useTranslatedText(\"No map available.\");\n return (\n <div className={classNames(\"agents-map-placeholder\", className)} data-testid={testId} data-map=\"none\">\n {noMapText}\n </div>\n );\n};\n\nconst DefaultMapMarker = (_props: AgentsMapMarkerProps) => null;\n\nconst DefaultModalLayer = (props: AgentsModalLayerProps) => {\n const { children } = props;\n return <>{children}</>;\n};\n\nconst DefaultHeroRow = (props: AgentsHeroRowProps) => {\n const { children, className } = props;\n return (\n <div data-hero-row=\"\" className={classNames(\"agents-hero-row\", className)}>\n {children}\n </div>\n );\n};\n\nconst DefaultHeroValue = (props: AgentsHeroValueProps) => {\n const { children, color } = props;\n return (\n <span data-hero=\"\" data-hero-value=\"\" className=\"agents-hero-value\" style={{ color: readCssColor(color) }}>\n {children}\n </span>\n );\n};\n\nconst DefaultWidgetText = (props: AgentsWidgetTextProps) => {\n const {\n children,\n variant = \"inherit\",\n tone,\n color,\n weight,\n uppercase,\n tabular,\n strikethrough,\n inline = variant === \"inherit\",\n translate = typeof children === \"string\",\n context,\n replacements,\n className,\n testId,\n } = props;\n const texts = useAgentsTexts();\n const plainReplacements: Record<string, string | number> = {};\n for (const [name, value] of Object.entries(replacements ?? {})) {\n if (value !== null && value !== undefined) plainReplacements[name] = value;\n }\n const content =\n typeof children === \"string\" && translate ? texts.translate(children, plainReplacements, context) : children;\n const Element = inline ? \"span\" : \"div\";\n return (\n <Element\n data-testid={testId}\n className={classNames(\n \"agents-widget-text\",\n `agents-widget-text--${variant}`,\n tone && !color && `agents-widget-text--${tone}`,\n weight && `agents-widget-text--weight-${weight}`,\n uppercase && \"agents-widget-text--uppercase\",\n tabular && \"agents-widget-text--tabular\",\n strikethrough && \"agents-widget-text--strikethrough\",\n className,\n )}\n style={color ? { color: readCssColor(color) } : undefined}\n >\n {content}\n </Element>\n );\n};\n\nconst DefaultSkeletonText = (props: AgentsSkeletonTextProps) => {\n const { width = \"4.5em\", height = \"1em\", className } = props;\n return (\n <span\n aria-hidden\n className={classNames(\"agents-skeleton\", className)}\n style={{ display: \"inline-block\", width, height, borderRadius: 999 }}\n />\n );\n};\n\nconst STATUS_BADGE_STATUS_BY_CHIP_TONE: Record<AgentsStatusChipTone, AgentsStatusBadgeStatus> = {\n success: \"success\",\n warning: \"warning\",\n danger: \"danger\",\n neutral: \"neutral\",\n info: \"info\",\n error: \"danger\",\n};\n\nconst DefaultStatusChip = (props: AgentsStatusChipProps) => {\n const { tone = \"neutral\", children, compact = false, translate = true } = props;\n return (\n <DefaultStatusBadge\n status={STATUS_BADGE_STATUS_BY_CHIP_TONE[tone]}\n text={children}\n translate={translate}\n size=\"small\"\n hideIcon={compact || tone !== \"error\"}\n />\n );\n};\n\nconst DefaultSegmentBar = (props: AgentsSegmentBarProps) => {\n const { segments, height = 6, className, loading = false, testId } = props;\n const total = segments.reduce((sum, segment) => sum + Math.max(0, segment.value), 0);\n return (\n <div\n className={classNames(\"agents-segment-bar\", className)}\n style={{ display: \"flex\", height, borderRadius: height, overflow: \"hidden\" }}\n data-segment-bar=\"\"\n data-testid={testId}\n >\n {total > 0 || loading\n ? segments.map((segment, segmentIndex) => (\n <div\n key={segmentIndex}\n style={{\n width: loading\n ? `${100 / segments.length}%`\n : `${(Math.max(0, segment.value) / total) * 100}%`,\n background: segment.color,\n opacity: segment.muted || loading ? 0.5 : undefined,\n }}\n />\n ))\n : null}\n </div>\n );\n};\n\nconst NO_MARKDOWN_PLUGINS: PluggableList = [];\n\n/** Drops an image without a source: streamed Markdown emits a partial `![alt](` that would fetch the page itself. */\nconst MarkdownImage: Components[\"img\"] = (imageProps) => {\n const { src, node, ...otherProps } = imageProps;\n return src ? <img src={src} {...otherProps} /> : null;\n};\n\nconst DefaultMarkdown = (props: AgentsMarkdownProps) => {\n const { markdown, color, remarkPlugins = NO_MARKDOWN_PLUGINS, rehypePlugins = NO_MARKDOWN_PLUGINS, components } = props;\n const markdownComponents = useMemo(() => ({ img: MarkdownImage, ...components }) as Components, [components]);\n const markdownRemarkPlugins = useMemo(() => [remarkGfm, ...remarkPlugins], [remarkPlugins]);\n return (\n <div style={{ color }} className=\"agents-markdown\" data-markdown-blocks-root>\n <ReactMarkdown\n remarkPlugins={markdownRemarkPlugins}\n rehypePlugins={rehypePlugins}\n components={markdownComponents}\n >\n {markdown}\n </ReactMarkdown>\n </div>\n );\n};\n\n/** Without an app gate every widget is available. */\nconst DefaultWidgetFeatureGate = (props: AgentsWidgetFeatureGateProps) => {\n const { children } = props;\n return <>{children}</>;\n};\n\nconst DefaultConversationSearchResultsList = (props: AgentsConversationSearchResultsListProps) => {\n const { groups, onOpenConversation } = props;\n return (\n <ul className=\"agents-conversation-search-results\">\n {groups.map((group, groupIndex) => (\n <li key={group.conversationId ?? groupIndex} className=\"agents-conversation-search-results__group\">\n <DefaultText role=\"body\" weight=\"bold\" translate={false}>\n {group.title ?? \"\"}\n </DefaultText>\n {group.hits.map((hit, hitIndex) => (\n <button\n key={hit.messageId ?? hitIndex}\n type=\"button\"\n className=\"agents-conversation-search-results__hit\"\n onClick={() => {\n if (group.conversationId !== undefined) onOpenConversation(group.conversationId, hit.messageId);\n }}\n >\n <DefaultText role=\"help\" translate={false}>\n {hit.excerpt ?? \"\"}\n </DefaultText>\n </button>\n ))}\n </li>\n ))}\n </ul>\n );\n};\n\n/** The package default of every replaceable component. */\nexport const DEFAULT_AGENTS_COMPONENTS: AgentsComponents = {\n Text: DefaultText,\n Button: DefaultButton,\n Icon: DefaultIcon,\n InteractiveSurface: DefaultInteractiveSurface,\n Skeleton: DefaultSkeleton,\n LoadingSpinner: DefaultLoadingSpinner,\n Tooltip: DefaultTooltip,\n GlowFrame: DefaultGlowFrame,\n ProgressBar: DefaultProgressBar,\n SplitView: DefaultSplitView,\n TrendDelta: DefaultTrendDelta,\n Checkbox: DefaultCheckbox,\n TextInput: DefaultTextInput,\n TextArea: DefaultTextArea,\n RangeSlider: DefaultRangeSlider,\n DateInput: DefaultDateInput,\n RadioGroup: DefaultRadioGroup,\n Select: DefaultSelect,\n Tabs: DefaultTabs,\n StatusBadge: DefaultStatusBadge,\n Map: DefaultMap,\n MapMarker: DefaultMapMarker,\n ModalLayer: DefaultModalLayer,\n HeroRow: DefaultHeroRow,\n HeroValue: DefaultHeroValue,\n WidgetText: DefaultWidgetText,\n SkeletonText: DefaultSkeletonText,\n StatusChip: DefaultStatusChip,\n SegmentBar: DefaultSegmentBar,\n Markdown: DefaultMarkdown,\n WidgetFeatureGate: DefaultWidgetFeatureGate,\n ConversationSearchResultsList: DefaultConversationSearchResultsList,\n};\n","import type { ComponentType, ErrorInfo, ReactNode } from \"react\";\nimport type { AgentsComponents } from \"./components/types\";\nimport type { ConversationWidgetStatePartition } from \"../renderer/conversation-widget-state-partition\";\nimport type { ChatAssistantCategory } from \"../chat/chat-assistant-identity\";\nimport type { ComposedNodeSchemaApplicationPart } from \"../renderer/widget-tree/composed-node-schema\";\nimport type { CanvasBehaviour } from \"../renderer/canvas/canvas-behaviours\";\n\n/** Translates interface copy. The key is the English source text. */\nexport interface AgentsTexts {\n translate: (key: string, replacements?: Record<string, string | number>, context?: string) => string;\n}\n\n/** One image of a gallery the app opens over the page. */\nexport interface AgentsGalleryImage {\n /** Identifies the image within the gallery. */\n id: string;\n url: string;\n name?: string;\n}\n\n/** An action the package dispatches into the state store. */\nexport interface AgentsStateAction {\n type: string;\n payload?: unknown;\n}\n\n/**\n * A state store as React hooks: the package keeps its widget hydration state in it, and an app's older chat state\n * partitions are read through it (`defaultChatStatePartition`). Without an app store the package uses its own.\n */\nexport interface AgentsStateStore {\n useSelector: <Selected>(selector: (state: any) => Selected) => Selected;\n useDispatch: () => (action: AgentsStateAction) => unknown;\n}\n\n/** The owner's language and the active agent space's date and time settings. Every field may be missing. */\nexport interface AgentsOwnerSettings {\n /** The owner's language (`de`). */\n languageCode?: string | null;\n /** The owner's locale (`de-DE`). */\n locale?: string | null;\n /** The date locale of the active agent space (`de-DE`). */\n dateLocale?: string | null;\n /** The time zone of the active agent space. */\n timeZone?: string | null;\n /** The active agent space writes times with AM/PM. */\n usesAmPm?: boolean | null;\n}\n\n/** What the error card of a reached budget offers (the error card's upgrade data). */\nexport interface AgentsBudgetLimit {\n /** An upgrade lifts the limit: the card offers it. */\n canUpgrade: boolean;\n /** Opens the app's upgrade flow. */\n openUpgrade: () => void;\n /** The app presents the budget as a fair-use allowance (the card uses that wording). */\n showsFairUseWording: boolean;\n}\n\n/** The badge of a named assistant's icon (its intro card, its openings). */\nexport interface AgentsAssistantIconBadgeProps {\n /** The icon's name in the app's icon set (`ChatAssistantIdentity.iconClass`). */\n iconName: string;\n color: string;\n backgroundColor: string;\n /** Larger on the intro card than on an opening. */\n isLarge?: boolean;\n}\n\n/** The background of a chat with a named assistant's category (or with none, the overview of every category). */\nexport interface AgentsAssistantBackgroundProps {\n category?: ChatAssistantCategory;\n /** The category's alias; undefined for a chat without a category. */\n categoryAlias?: string;\n}\n\n/** The state of the app's map script loader. */\nexport interface AgentsMapsLoaderState {\n isLoaded: boolean;\n loadError: Error | undefined;\n languageCode: string | undefined;\n}\n\n/**\n * Further names of the sandbox and readiness signals that an app declares beside the package's own (`AGENTS_VISUALIZATION`,\n * `--agents-*`, `__AGENTS_WIDGET_IMAGE_V1__`, `__AGENTS_WIDGET_PREVIEW_V1__`): the names its stored visualization scripts,\n * its skill texts or its headless capture already use. Every list is optional; the package's names always exist.\n */\nexport type AgentsSandboxLegacyAliases = {\n /** Further names of the sandbox global, e.g. the name stored scripts of the app read. */\n visualizationGlobalNames?: string[];\n /** Further prefixes of the frame's theme variables, e.g. `--app-` (each variable is set under every prefix). */\n themeVariablePrefixes?: string[];\n /** Further names of the image-capture readiness signal on `window`. */\n imageReadinessGlobalNames?: string[];\n /** Further names of the preview readiness signal on `window`. */\n previewReadinessGlobalNames?: string[];\n};\n\n/**\n * Everything an app supplies to the package. Every member is optional: the package has a default for each.\n * An app sets it once at start (`setAgentsEnvironment`) or per subtree (`AgentsProvider`); the functions are read\n * from the app-wide environment only.\n */\nexport interface AgentsEnvironment {\n /**\n * The state store hooks (see `AgentsStateStore`). Default: the package's own widget hydration store (one per page,\n * `createAgentsWidgetHydrationStateStore`). An app supplies its own to keep the hydration state in its store\n * (host application: its Redux store, which mounts `WidgetHydrationReducer` under `AIExtensionsWidgetHydration`).\n */\n stateStore?: AgentsStateStore;\n /**\n * The partition of the app's own chat state a widget provider reads when its host passes neither a chat store nor a\n * partition (host application: the AI-Extensions chat's slice). Default: none — such a provider keeps a store of its own.\n */\n defaultChatStatePartition?: ConversationWidgetStatePartition;\n /** A React hook returning the owner's settings. Default: none known (the browser's language stands in). */\n useOwnerSettings?: () => AgentsOwnerSettings;\n /**\n * A React hook returning the key of the agent space the owner works in. The key of an agent space is what the\n * client knows it by: the id of the space, unless the app's backend hands out another key\n * (`AgentSpace::getWidgetSelfHydrationKey()`). Default: no agent space.\n */\n useActiveAgentSpaceKey?: () => number | undefined;\n /** Reads the display name of an agent space (the header of a widget of another agent space). Default: no name. */\n readAgentSpaceName?: (agentSpaceKey: number, signal: AbortSignal) => Promise<string | undefined>;\n /**\n * The field of a widget block that carries the key of the block's agent space, as the app's backend writes it\n * (`WidgetBlockFieldNames::WIDGET_SELF_HYDRATION_KEY`). An app whose stored conversations use another field name\n * declares it here and in its backend class. Default: `agentSpaceId`.\n */\n widgetSelfHydrationKeyFieldName?: string;\n /**\n * The owner's text for a click on a widget of another agent space than the active one: returns the text with the\n * suffix the app's backend reads that agent space from\n * (`WidgetBlockFieldNames::OWNER_TEXT_SUFFIX_PATTERN_OF_ANOTHER_SPACE`). Default: the text unchanged.\n */\n appendAnotherAgentSpaceToOwnerText?: (ownerText: string, anotherAgentSpaceKey: number) => string;\n /** The label of an agent space whose name is not known. Default: `#<key>`. */\n buildUnnamedAgentSpaceLabel?: (agentSpaceKey: number) => string;\n /**\n * The sentence that tells the owner that a widget shows another agent space than the active one; `agentSpaceLabel`\n * is its name or the label above. Default: a sentence that names no kind of agent space.\n */\n buildWidgetOfAnotherAgentSpaceExplanation?: (agentSpaceLabel: string) => string;\n /** The name the owner knows the agent by, for the interface texts that name it. Default: `the assistant`. */\n agentDisplayName?: string;\n /** A React hook returning what the error card of a reached budget offers. Default: no upgrade, the plain wording. */\n useBudgetLimit?: () => AgentsBudgetLimit;\n /** A React hook returning the map script loader's state. Default: no maps. */\n useMapsLoader?: () => AgentsMapsLoaderState;\n /**\n * The action that tells the app whether an agent chat surface is open (dispatched into the state store when the\n * first surface mounts and the last unmounts). Default: nothing is dispatched.\n */\n buildChatSurfaceOpenChangedAction?: (isOpen: boolean) => AgentsStateAction;\n components?: Partial<AgentsComponents>;\n texts?: AgentsTexts;\n /**\n * Prepares a plain text (a model's words, a business name) for the app's `Text`, `Button` and `StatusBadge`\n * replacements, which may read a string as markup. Default: the text unchanged.\n */\n escapePlainTextForText?: (text: string) => string;\n /** Opens the images in the app's lightbox, starting at `startIndex`. Default: the start image in a new tab. */\n openImageGallery?: (images: AgentsGalleryImage[], startIndex: number) => void;\n /** Reports a widget that crashed while rendering. Default: nothing (the crash is logged to the console). */\n reportWidgetCrash?: (widgetName: string, error: Error, errorInfo: ErrorInfo) => void;\n /**\n * The footer under an assistant message (host application: the admin's forensics panel, which gates itself). Receives the\n * message as the message view got it. Default: none.\n */\n MessageFooter?: ComponentType<{ message?: unknown }>;\n /**\n * The colour theme class of a named assistant's category (the assistant identity and theme). Default:\n * none — the generic chat colours.\n */\n readAssistantThemeClassName?: (categoryAlias: string) => string;\n /** The badge of a named assistant's icon. Default: none. */\n AssistantIconBadge?: ComponentType<AgentsAssistantIconBadgeProps>;\n /** The chat's own background when the host paints none (host application: the category illustrations). Default: none. */\n AssistantBackground?: ComponentType<AgentsAssistantBackgroundProps>;\n /**\n * Wraps the body of an open canvas (host application: page components inside a canvas must not mirror their filters into\n * the page URL). Default: no wrapper.\n */\n CanvasBodyContainer?: ComponentType<{ children: ReactNode }>;\n /**\n * Tells the app that a turn of the agent runs in an open chat (the host application keeps the tab \"ambient active\" then);\n * returns the release the chat calls when the turn ends. Default: nothing.\n */\n reportRunningTurn?: () => () => void;\n /**\n * Further names of the CustomVisualization sandbox (its global, its theme variable prefixes) and of the image and\n * preview readiness signals, beside the package's own names (see `AgentsSandboxLegacyAliases`). An app whose stored\n * scripts or capture read older names declares them here. Default: none — only the package's names exist.\n */\n sandboxLegacyAliases?: AgentsSandboxLegacyAliases;\n /**\n * The app's part of the ComposedView node schema: the node types, widgets (which embed, at which size), data sources\n * and entity types its own classes declare, as its backend generates them beside the package's\n * `composed-node-schema.json`. The tree readers and the kit read the package's schema with this part added\n * (`getComposedNodeSchema`). Default: none — only the package's own types exist.\n */\n composedNodeSchemaApplicationPart?: ComposedNodeSchemaApplicationPart;\n /**\n * The path prefix of the app's API reads a live widget image capture lets through (same origin, GET only, sent with\n * the capture's bearer; every other request of the capture fails it). Default: `/api/`.\n */\n widgetImageCaptureReadPathPrefix?: string;\n /**\n * The app's widgets that draw a Google map: a widget image capture of one of them, or of a `ComposedView` that embeds\n * one, may load the Maps SDK (the narrow transport exception of the capture; the twin of the backend's list that opens\n * the capture page's CSP). A `ComposedView` holding a `Map` node always may. Default: none.\n */\n googleMapWidgetNames?: string[];\n /**\n * Further `signalSource`s a widget click of the app posts (`injectSignal`), beside the package's own\n * (`FRONTEND_WIDGET_CLICK`, `OWNER_ACTION_CONFIRM`): the message list reads every one of them as the owner's answer to\n * a widget, so an answered widget never comes back interactive after a reload. Default: none.\n */\n furtherWidgetClickSignalSources?: string[];\n /**\n * The canvases of the app's widgets (canvas id → behaviour), beside the package's own (`packageCanvasBehaviours`):\n * every canvas an app widget lists in `opensCanvases`. The app registers each one's body with `registerCanvasBodies`\n * and, when gated, its requirement with `registerCanvasFeatureFlags`. A package canvas id here is ignored. Default:\n * none.\n */\n furtherCanvasBehaviours?: Readonly<Record<string, CanvasBehaviour>>;\n}\n\nlet appEnvironment: AgentsEnvironment = {};\nconst environmentListeners = new Set<() => void>();\n\n/** Sets the app-wide environment. Call it once before the first render; a later call re-renders the readers. */\nexport const setAgentsEnvironment = (environment: AgentsEnvironment): void => {\n appEnvironment = environment;\n for (const notifyListener of environmentListeners) notifyListener();\n};\n\nexport const getAgentsEnvironment = (): AgentsEnvironment => appEnvironment;\n\nexport const subscribeToAgentsEnvironment = (listener: () => void): (() => void) => {\n environmentListeners.add(listener);\n return () => {\n environmentListeners.delete(listener);\n };\n};\n\nconst substitutePlaceholders = (key: string, replacements?: Record<string, string | number>): string =>\n replacements\n ? key.replace(/%([A-Za-z0-9_]+)%/g, (placeholder, name: string) =>\n name in replacements ? String(replacements[name]) : placeholder,\n )\n : key;\n\n/** The package default: the English key with its placeholders substituted. */\nexport const DEFAULT_AGENTS_TEXTS: AgentsTexts = { translate: substitutePlaceholders };\n\n/** Translates an interface text through the app-wide environment, for a string a component hands on (a label). */\nexport const translateText = (key: string, replacements?: Record<string, string | number>, context?: string): string =>\n (appEnvironment.texts ?? DEFAULT_AGENTS_TEXTS).translate(key, replacements, context);\n\n/** A plain text as the app's text components take it (`AgentsEnvironment.escapePlainTextForText`). */\nexport const escapePlainTextForText = (text: string): string =>\n appEnvironment.escapePlainTextForText ? appEnvironment.escapePlainTextForText(text) : text;\n\n/** Opens an image gallery over the page (`AgentsEnvironment.openImageGallery`). */\nexport const openImageGallery = (images: AgentsGalleryImage[], startIndex: number): void => {\n if (appEnvironment.openImageGallery) {\n appEnvironment.openImageGallery(images, startIndex);\n return;\n }\n const startImage = images[startIndex];\n if (startImage) window.open(startImage.url, \"_blank\", \"noopener,noreferrer\");\n};\n\n/** The block field of the package's backend default (`WidgetBlockFieldNames::WIDGET_SELF_HYDRATION_KEY`). */\nexport const DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME = \"agentSpaceId\";\n\n/** The field of a widget block that carries the key of its agent space (`AgentsEnvironment.widgetSelfHydrationKeyFieldName`). */\nexport const getWidgetSelfHydrationKeyFieldName = (): string =>\n appEnvironment.widgetSelfHydrationKeyFieldName ?? DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME;\n\n/** The owner's text for a click on a widget of another agent space (`AgentsEnvironment.appendAnotherAgentSpaceToOwnerText`). */\nexport const appendAnotherAgentSpaceToOwnerText = (ownerText: string, anotherAgentSpaceKey: number): string =>\n appEnvironment.appendAnotherAgentSpaceToOwnerText\n ? appEnvironment.appendAnotherAgentSpaceToOwnerText(ownerText, anotherAgentSpaceKey)\n : ownerText;\n\n/** The label of an agent space without a known name (`AgentsEnvironment.buildUnnamedAgentSpaceLabel`). */\nexport const buildUnnamedAgentSpaceLabel = (agentSpaceKey: number): string =>\n appEnvironment.buildUnnamedAgentSpaceLabel ? appEnvironment.buildUnnamedAgentSpaceLabel(agentSpaceKey) : `#${agentSpaceKey}`;\n\n/** The sentence under a widget of another agent space (`AgentsEnvironment.buildWidgetOfAnotherAgentSpaceExplanation`). */\nexport const buildWidgetOfAnotherAgentSpaceExplanation = (agentSpaceLabel: string): string =>\n appEnvironment.buildWidgetOfAnotherAgentSpaceExplanation\n ? appEnvironment.buildWidgetOfAnotherAgentSpaceExplanation(agentSpaceLabel)\n : translateText(\"This widget shows data for %label%, not for what you currently have selected.\", {\n label: agentSpaceLabel,\n });\n\n/** The further sandbox and readiness names the app declares (`AgentsEnvironment.sandboxLegacyAliases`). */\nexport const getSandboxLegacyAliases = (): AgentsSandboxLegacyAliases => appEnvironment.sandboxLegacyAliases ?? {};\n\n/** The package default of `AgentsEnvironment.widgetImageCaptureReadPathPrefix`. */\nexport const DEFAULT_WIDGET_IMAGE_CAPTURE_READ_PATH_PREFIX = \"/api/\";\n\n/** The path prefix of the API reads a live widget image capture lets through (`AgentsEnvironment.widgetImageCaptureReadPathPrefix`). */\nexport const getWidgetImageCaptureReadPathPrefix = (): string =>\n appEnvironment.widgetImageCaptureReadPathPrefix ?? DEFAULT_WIDGET_IMAGE_CAPTURE_READ_PATH_PREFIX;\n\n/** The app's widgets that draw a Google map (`AgentsEnvironment.googleMapWidgetNames`). */\nexport const getGoogleMapWidgetNames = (): readonly string[] => appEnvironment.googleMapWidgetNames ?? [];\n\n/** The app's further widget click signal sources (`AgentsEnvironment.furtherWidgetClickSignalSources`). */\nexport const getFurtherWidgetClickSignalSources = (): readonly string[] =>\n appEnvironment.furtherWidgetClickSignalSources ?? [];\n\n/** The canvases of the app's widgets (`AgentsEnvironment.furtherCanvasBehaviours`). */\nexport const getFurtherCanvasBehaviours = (): Readonly<Record<string, CanvasBehaviour>> =>\n appEnvironment.furtherCanvasBehaviours ?? {};\n\n/** The name the owner knows the agent by (`AgentsEnvironment.agentDisplayName`). */\nexport const getAgentDisplayName = (): string => appEnvironment.agentDisplayName ?? translateText(\"the assistant\");\n\n/** Reports a running turn of an open chat (`AgentsEnvironment.reportRunningTurn`); returns the release. */\nexport const reportRunningTurn = (): (() => void) | undefined => appEnvironment.reportRunningTurn?.();\n\n/** Reports a crashed widget (`AgentsEnvironment.reportWidgetCrash`). */\nexport const reportWidgetCrash = (widgetName: string, error: Error, errorInfo: ErrorInfo): void => {\n appEnvironment.reportWidgetCrash?.(widgetName, error, errorInfo);\n};\n","import { createContext, type ReactNode, useContext, useMemo, useSyncExternalStore } from \"react\";\nimport type { AgentsConversationClient } from \"../client/AgentsConversationClient\";\nimport { AgentsConversationClientProvider } from \"../client/AgentsConversationClientContext\";\nimport { getDefaultAgentsStateStore } from \"../renderer/widget-hydration/widget-hydration-state-store\";\nimport { DEFAULT_AGENTS_COMPONENTS } from \"./components/default-components\";\nimport type { AgentsComponents } from \"./components/types\";\nimport {\n type AgentsBudgetLimit,\n type AgentsEnvironment,\n type AgentsMapsLoaderState,\n type AgentsOwnerSettings,\n type AgentsStateAction,\n type AgentsTexts,\n DEFAULT_AGENTS_TEXTS,\n getAgentsEnvironment,\n subscribeToAgentsEnvironment,\n} from \"./environment\";\n\nconst AgentsEnvironmentContext = createContext<AgentsEnvironment | null>(null);\n\nexport interface AgentsProviderProps {\n /** The subtree's environment; members it leaves out fall back to the app-wide one, then to the defaults. */\n environment?: AgentsEnvironment;\n /** The conversation client the chat below reads and sends through (the one required input of a chat). */\n client?: AgentsConversationClient;\n children: ReactNode;\n}\n\nconst NO_SUBTREE_ENVIRONMENT: AgentsEnvironment = {};\n\n/**\n * Supplies an environment and the conversation client to one subtree. `<AgentsProvider client={client}><AgentChat />\n * </AgentsProvider>` is a whole chat with the package defaults.\n */\nexport const AgentsProvider = (props: AgentsProviderProps) => {\n const { environment = NO_SUBTREE_ENVIRONMENT, client, children } = props;\n const environmentTree = <AgentsEnvironmentContext.Provider value={environment}>{children}</AgentsEnvironmentContext.Provider>;\n return client ? (\n <AgentsConversationClientProvider client={client}>{environmentTree}</AgentsConversationClientProvider>\n ) : (\n environmentTree\n );\n};\n\nconst useAppEnvironment = (): AgentsEnvironment =>\n useSyncExternalStore(subscribeToAgentsEnvironment, getAgentsEnvironment, getAgentsEnvironment);\n\n/** The components package code renders: the subtree's replacements over the app's over the package defaults. */\nexport const useAgentsComponents = (): AgentsComponents => {\n const subtreeEnvironment = useContext(AgentsEnvironmentContext);\n const appEnvironment = useAppEnvironment();\n return useMemo(\n () => ({ ...DEFAULT_AGENTS_COMPONENTS, ...appEnvironment.components, ...subtreeEnvironment?.components }),\n [appEnvironment, subtreeEnvironment],\n );\n};\n\nexport const useAgentsTexts = (): AgentsTexts => {\n const subtreeEnvironment = useContext(AgentsEnvironmentContext);\n const appEnvironment = useAppEnvironment();\n return subtreeEnvironment?.texts ?? appEnvironment.texts ?? DEFAULT_AGENTS_TEXTS;\n};\n\n/** The environment of this subtree: its own members over the app-wide ones. */\nexport const useAgentsEnvironment = (): AgentsEnvironment => {\n const subtreeEnvironment = useContext(AgentsEnvironmentContext);\n const appEnvironment = useAppEnvironment();\n return useMemo(\n () => (subtreeEnvironment ? { ...appEnvironment, ...subtreeEnvironment } : appEnvironment),\n [appEnvironment, subtreeEnvironment],\n );\n};\n\n/** The app's state store, else the package's own widget hydration store. */\nconst readStateStore = (environment: AgentsEnvironment) => environment.stateStore ?? getDefaultAgentsStateStore();\n\n/** Reads from the state store (`AgentsEnvironment.stateStore`, else the package's default store). */\nexport const useAgentsStateSelector = <Selected,>(selector: (state: any) => Selected): Selected =>\n readStateStore(useAgentsEnvironment()).useSelector(selector);\n\n/** The dispatch of the state store (`AgentsEnvironment.stateStore`, else the package's default store). */\nexport const useAgentsStateDispatch = (): ((action: AgentsStateAction) => unknown) =>\n readStateStore(useAgentsEnvironment()).useDispatch();\n\nconst NO_OWNER_SETTINGS: AgentsOwnerSettings = {};\nconst useNoOwnerSettings = (): AgentsOwnerSettings => NO_OWNER_SETTINGS;\n\n/** The owner's language and the active agent space's date and time settings (`AgentsEnvironment.useOwnerSettings`). */\nexport const useAgentsOwnerSettings = (): AgentsOwnerSettings => {\n const useOwnerSettings = useAgentsEnvironment().useOwnerSettings ?? useNoOwnerSettings;\n return useOwnerSettings();\n};\n\nconst useNoActiveAgentSpaceKey = (): number | undefined => undefined;\n\n/** The key of the agent space the owner works in (`AgentsEnvironment.useActiveAgentSpaceKey`). */\nexport const useAgentsActiveAgentSpaceKey = (): number | undefined => {\n const useActiveAgentSpaceKey = useAgentsEnvironment().useActiveAgentSpaceKey ?? useNoActiveAgentSpaceKey;\n return useActiveAgentSpaceKey();\n};\n\nconst NO_MAPS: AgentsMapsLoaderState = {\n isLoaded: false,\n loadError: new Error(\"The agents environment has no maps loader.\"),\n languageCode: undefined,\n};\nconst useNoMapsLoader = (): AgentsMapsLoaderState => NO_MAPS;\n\n/** The map script loader's state (`AgentsEnvironment.useMapsLoader`). */\nexport const useAgentsMapsLoader = (): AgentsMapsLoaderState => {\n const useMapsLoader = useAgentsEnvironment().useMapsLoader ?? useNoMapsLoader;\n return useMapsLoader();\n};\n\nconst NO_BUDGET_UPGRADE: AgentsBudgetLimit = { canUpgrade: false, openUpgrade: () => undefined, showsFairUseWording: false };\nconst useNoBudgetLimit = (): AgentsBudgetLimit => NO_BUDGET_UPGRADE;\n\n/** What the error card of a reached budget offers (`AgentsEnvironment.useBudgetLimit`). */\nexport const useAgentsBudgetLimit = (): AgentsBudgetLimit => {\n const useBudgetLimit = useAgentsEnvironment().useBudgetLimit ?? useNoBudgetLimit;\n return useBudgetLimit();\n};\n","import { useAgentsComponents } from \"../AgentsProvider\";\nimport type {\n AgentsButtonProps,\n AgentsCheckboxProps,\n AgentsDateInputProps,\n AgentsGlowFrameProps,\n AgentsIconProps,\n AgentsInteractiveSurfaceProps,\n AgentsLoadingSpinnerProps,\n AgentsMapMarkerProps,\n AgentsMapProps,\n AgentsModalLayerProps,\n AgentsProgressBarProps,\n AgentsRadioGroupProps,\n AgentsRangeSliderProps,\n AgentsSelectProps,\n AgentsSkeletonProps,\n AgentsSplitViewProps,\n AgentsStatusBadgeProps,\n AgentsTabsProps,\n AgentsTextAreaProps,\n AgentsTextInputProps,\n AgentsTextProps,\n AgentsTooltipProps,\n AgentsTrendDeltaProps,\n AgentsHeroRowProps,\n AgentsHeroValueProps,\n AgentsWidgetTextProps,\n AgentsSkeletonTextProps,\n AgentsStatusChipProps,\n AgentsSegmentBarProps,\n AgentsMarkdownProps,\n AgentsWidgetFeatureGateProps,\n AgentsConversationSearchResultsListProps,\n} from \"./types\";\n\n/**\n * The components package code imports. Each renders the app's replacement when the environment has one, else the\n * package default — package code never imports an app's component library.\n */\nexport const Text = (props: AgentsTextProps) => {\n const { Text: TextComponent } = useAgentsComponents();\n return <TextComponent {...props} />;\n};\n\nexport const Button = (props: AgentsButtonProps) => {\n const { Button: ButtonComponent } = useAgentsComponents();\n return <ButtonComponent {...props} />;\n};\n\nexport const Icon = (props: AgentsIconProps) => {\n const { Icon: IconComponent } = useAgentsComponents();\n return <IconComponent {...props} />;\n};\n\nexport const InteractiveSurface = (props: AgentsInteractiveSurfaceProps) => {\n const { InteractiveSurface: InteractiveSurfaceComponent } = useAgentsComponents();\n return <InteractiveSurfaceComponent {...props} />;\n};\n\nexport const Skeleton = (props: AgentsSkeletonProps) => {\n const { Skeleton: SkeletonComponent } = useAgentsComponents();\n return <SkeletonComponent {...props} />;\n};\n\nexport const LoadingSpinner = (props: AgentsLoadingSpinnerProps) => {\n const { LoadingSpinner: LoadingSpinnerComponent } = useAgentsComponents();\n return <LoadingSpinnerComponent {...props} />;\n};\n\nexport const Tooltip = (props: AgentsTooltipProps) => {\n const { Tooltip: TooltipComponent } = useAgentsComponents();\n return <TooltipComponent {...props} />;\n};\n\nexport const GlowFrame = (props: AgentsGlowFrameProps) => {\n const { GlowFrame: GlowFrameComponent } = useAgentsComponents();\n return <GlowFrameComponent {...props} />;\n};\n\nexport const ProgressBar = (props: AgentsProgressBarProps) => {\n const { ProgressBar: ProgressBarComponent } = useAgentsComponents();\n return <ProgressBarComponent {...props} />;\n};\n\nexport const SplitView = (props: AgentsSplitViewProps) => {\n const { SplitView: SplitViewComponent } = useAgentsComponents();\n return <SplitViewComponent {...props} />;\n};\n\nexport const TrendDelta = (props: AgentsTrendDeltaProps) => {\n const { TrendDelta: TrendDeltaComponent } = useAgentsComponents();\n return <TrendDeltaComponent {...props} />;\n};\n\nexport const Checkbox = (props: AgentsCheckboxProps) => {\n const { Checkbox: CheckboxComponent } = useAgentsComponents();\n return <CheckboxComponent {...props} />;\n};\n\nexport const TextInput = (props: AgentsTextInputProps) => {\n const { TextInput: TextInputComponent } = useAgentsComponents();\n return <TextInputComponent {...props} />;\n};\n\nexport const TextArea = (props: AgentsTextAreaProps) => {\n const { TextArea: TextAreaComponent } = useAgentsComponents();\n return <TextAreaComponent {...props} />;\n};\n\nexport const RangeSlider = (props: AgentsRangeSliderProps) => {\n const { RangeSlider: RangeSliderComponent } = useAgentsComponents();\n return <RangeSliderComponent {...props} />;\n};\n\nexport const DateInput = (props: AgentsDateInputProps) => {\n const { DateInput: DateInputComponent } = useAgentsComponents();\n return <DateInputComponent {...props} />;\n};\n\nexport const RadioGroup = (props: AgentsRadioGroupProps) => {\n const { RadioGroup: RadioGroupComponent } = useAgentsComponents();\n return <RadioGroupComponent {...props} />;\n};\n\nexport const Select = (props: AgentsSelectProps) => {\n const { Select: SelectComponent } = useAgentsComponents();\n return <SelectComponent {...props} />;\n};\n\nexport const Tabs = (props: AgentsTabsProps) => {\n const { Tabs: TabsComponent } = useAgentsComponents();\n return <TabsComponent {...props} />;\n};\n\nexport const StatusBadge = (props: AgentsStatusBadgeProps) => {\n const { StatusBadge: StatusBadgeComponent } = useAgentsComponents();\n return <StatusBadgeComponent {...props} />;\n};\n\nexport const Map = (props: AgentsMapProps) => {\n const { Map: MapComponent } = useAgentsComponents();\n return <MapComponent {...props} />;\n};\n\nexport const MapMarker = (props: AgentsMapMarkerProps) => {\n const { MapMarker: MapMarkerComponent } = useAgentsComponents();\n return <MapMarkerComponent {...props} />;\n};\n\nexport const ModalLayer = (props: AgentsModalLayerProps) => {\n const { ModalLayer: ModalLayerComponent } = useAgentsComponents();\n return <ModalLayerComponent {...props} />;\n};\n\nexport const HeroRow = (props: AgentsHeroRowProps) => {\n const { HeroRow: HeroRowComponent } = useAgentsComponents();\n return <HeroRowComponent {...props} />;\n};\n\nexport const HeroValue = (props: AgentsHeroValueProps) => {\n const { HeroValue: HeroValueComponent } = useAgentsComponents();\n return <HeroValueComponent {...props} />;\n};\n\nexport const WidgetText = (props: AgentsWidgetTextProps) => {\n const { WidgetText: WidgetTextComponent } = useAgentsComponents();\n return <WidgetTextComponent {...props} />;\n};\n\nexport const SkeletonText = (props: AgentsSkeletonTextProps) => {\n const { SkeletonText: SkeletonTextComponent } = useAgentsComponents();\n return <SkeletonTextComponent {...props} />;\n};\n\nexport const StatusChip = (props: AgentsStatusChipProps) => {\n const { StatusChip: StatusChipComponent } = useAgentsComponents();\n return <StatusChipComponent {...props} />;\n};\n\nexport const SegmentBar = (props: AgentsSegmentBarProps) => {\n const { SegmentBar: SegmentBarComponent } = useAgentsComponents();\n return <SegmentBarComponent {...props} />;\n};\n\nexport const Markdown = (props: AgentsMarkdownProps) => {\n const { Markdown: MarkdownComponent } = useAgentsComponents();\n return <MarkdownComponent {...props} />;\n};\n\nexport const WidgetFeatureGate = (props: AgentsWidgetFeatureGateProps) => {\n const { WidgetFeatureGate: WidgetFeatureGateComponent } = useAgentsComponents();\n return <WidgetFeatureGateComponent {...props} />;\n};\n\nexport const ConversationSearchResultsList = (props: AgentsConversationSearchResultsListProps) => {\n const { ConversationSearchResultsList: ConversationSearchResultsListComponent } = useAgentsComponents();\n return <ConversationSearchResultsListComponent {...props} />;\n};\n\nexport type * from \"./types\";\nexport { AGENTS_ICON_NAMES, isAgentsIconName } from \"./icon-names\";\n"],"names":["appEnvironment"],"mappings":";;;;;;AASA,MAAM,aAAa;AAEnB,MAAM,cAAc,MAAoB;AACtC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,mBAAmB;AAAA,IACnB,UAAU;AAAA,IACV,WAAW;AAAA,IACX,cAAc;AAAA,EAAA;AAElB;AAEA,MAAM,eAA0C;AAAA,EAC9C,SAAS,CAAA;AACX;AAEA,MAAM,aAAa,CAAC,OAAkC,QAA8B,MAAM,QAAQ,GAAG,KAAK,YAAA;AAE1G,MAAM,aAAa,CAAC,OAAkC,KAAa,YAAqD;AAAA,EACtH,GAAG;AAAA,EACH,SAAS,EAAE,GAAG,MAAM,SAAS,CAAC,GAAG,GAAG,OAAA;AACtC;AAGA,MAAM,mBAAmB,CAAC,QAAsB,cAC9C,OAAO,cAAc,KAAK,OAAO,cAAc;AA4BjD,MAAM,aAAa,CA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,MAAA,CAAO;AACtC;AAEO,MAAM,YAAY,CAAC,UAAgC;AACxD,QAAM,EAAE,WAAW,mBAAA,IAAuB,oBAAA;AAC1C,SAAO,oBAAC,oBAAA,EAAoB,GAAG,MAAA,CAAO;AACxC;AAEO,MAAM,aAAa,CAAC,UAAiC;AAC1D,QAAM,EAAE,YAAY,oBAAA,IAAwB,oBAAA;AAC5C,SAAO,oBAAC,qBAAA,EAAqB,GAAG,MAAA,CAAO;AACzC;AAEO,MAAM,eAAe,CAAC,UAAmC;AAC9D,QAAM,EAAE,cAAc,sBAAA,IAA0B,oBAAA;AAChD,SAAO,oBAAC,uBAAA,EAAuB,GAAG,MAAA,CAAO;AAC3C;AAEO,MAAM,aAAa,CAAC,UAAiC;AAC1D,QAAM,EAAE,YAAY,oBAAA,IAAwB,oBAAA;AAC5C,SAAO,oBAAC,qBAAA,EAAqB,GAAG,MAAA,CAAO;AACzC;AAEO,MAAM,aAAa,CAAC,UAAiC;AAC1D,QAAM,EAAE,YAAY,oBAAA,IAAwB,oBAAA;AAC5C,SAAO,oBAAC,qBAAA,EAAqB,GAAG,MAAA,CAAO;AACzC;AAEO,MAAM,WAAW,CAAC,UAA+B;AACtD,QAAM,EAAE,UAAU,kBAAA,IAAsB,oBAAA;AACxC,SAAO,oBAAC,mBAAA,EAAmB,GAAG,MAAA,CAAO;AACvC;AAEO,MAAM,oBAAoB,CAAC,UAAwC;AACxE,QAAM,EAAE,mBAAmB,2BAAA,IAA+B,oBAAA;AAC1D,SAAO,oBAAC,4BAAA,EAA4B,GAAG,MAAA,CAAO;AAChD;AAEO,MAAM,gCAAgC,CAAC,UAAoD;AAChG,QAAM,EAAE,+BAA+B,uCAAA,IAA2C,oBAAA;AAClF,SAAO,oBAAC,wCAAA,EAAwC,GAAG,MAAA,CAAO;AAC5D;"}
1
+ {"version":3,"file":"index-7Qc_3GbG.js","sources":["../../src/renderer/widget-hydration/widget-hydration.reducer.ts","../../src/renderer/widget-hydration/widget-hydration-state-store.ts","../../src/provider/class-names.ts","../../src/provider/components/default-components.tsx","../../src/provider/environment.ts","../../src/provider/AgentsProvider.tsx","../../src/provider/components/index.tsx"],"sourcesContent":["import type { AgentsStateAction } from \"../../provider/environment\";\nimport { WidgetHydrationSliceState, WidgetMemory } from \"./widget-hydration.types\";\n\n/**\n * The widget hydration state: one memory per hydration key. A plain reducer under the key\n * `AIExtensionsWidgetHydration` of a state store: the app's own (`AgentsEnvironment.stateStore`, the host application mounts it in\n * its Redux store) or, without one, the package's default store (`widget-hydration-state-store.ts`).\n */\n\nconst SLICE_NAME = \"widgetHydrationSlice\";\n\nconst emptyMemory = (): WidgetMemory => {\n return {\n data: null,\n status: \"idle\",\n error: null,\n loadingInstanceId: null,\n inFlight: false,\n requestId: 0,\n lastLoadedAt: null,\n };\n};\n\nconst initialState: WidgetHydrationSliceState = {\n widgets: {},\n};\n\nconst readMemory = (state: WidgetHydrationSliceState, key: string): WidgetMemory => state.widgets[key] ?? emptyMemory();\n\nconst withMemory = (state: WidgetHydrationSliceState, key: string, memory: WidgetMemory): WidgetHydrationSliceState => ({\n ...state,\n widgets: { ...state.widgets, [key]: memory },\n});\n\n/** Does a result still belong to the request the memory tracks? (0 = the memory was reset since.) */\nconst isCurrentRequest = (memory: WidgetMemory, requestId: number): boolean =>\n memory.requestId === 0 || memory.requestId === requestId;\n\ninterface MemoryEnsuredPayload {\n key: string;\n}\ninterface InstanceAttachedPayload {\n key: string;\n instanceId: string;\n}\ninterface HydrationStartedPayload {\n key: string;\n instanceId: string;\n requestId: number;\n}\ninterface HydrationSucceededPayload {\n key: string;\n requestId: number;\n data: unknown;\n}\ninterface HydrationFailedPayload {\n key: string;\n requestId: number;\n error: string;\n}\ninterface WidgetResetPayload {\n key: string;\n}\n\nconst actionType = (name: string): string => `${SLICE_NAME}/${name}`;\n\n/** The action creators (the action types are the ones the former Redux Toolkit slice used). */\nexport const WidgetHydrationSlice = {\n memoryEnsured: (payload: MemoryEnsuredPayload): AgentsStateAction => ({ type: actionType(\"memoryEnsured\"), payload }),\n instanceAttached: (payload: InstanceAttachedPayload): AgentsStateAction => ({\n type: actionType(\"instanceAttached\"),\n payload,\n }),\n hydrationStarted: (payload: HydrationStartedPayload): AgentsStateAction => ({\n type: actionType(\"hydrationStarted\"),\n payload,\n }),\n hydrationSucceeded: (payload: HydrationSucceededPayload): AgentsStateAction => ({\n type: actionType(\"hydrationSucceeded\"),\n payload,\n }),\n hydrationFailed: (payload: HydrationFailedPayload): AgentsStateAction => ({\n type: actionType(\"hydrationFailed\"),\n payload,\n }),\n widgetReset: (payload: WidgetResetPayload): AgentsStateAction => ({ type: actionType(\"widgetReset\"), payload }),\n allWidgetsReset: (): AgentsStateAction => ({ type: actionType(\"allWidgetsReset\") }),\n};\n\nexport const WidgetHydrationReducer = (\n state: WidgetHydrationSliceState = initialState,\n action: AgentsStateAction,\n): WidgetHydrationSliceState => {\n switch (action.type) {\n case actionType(\"memoryEnsured\"): {\n const { key } = action.payload as MemoryEnsuredPayload;\n return state.widgets[key] ? state : withMemory(state, key, emptyMemory());\n }\n case actionType(\"instanceAttached\"): {\n const { key, instanceId } = action.payload as InstanceAttachedPayload;\n return withMemory(state, key, { ...readMemory(state, key), loadingInstanceId: instanceId });\n }\n case actionType(\"hydrationStarted\"): {\n const { key, instanceId, requestId } = action.payload as HydrationStartedPayload;\n return withMemory(state, key, {\n ...readMemory(state, key),\n status: \"loading\",\n error: null,\n inFlight: true,\n loadingInstanceId: instanceId,\n requestId,\n });\n }\n case actionType(\"hydrationSucceeded\"): {\n const { key, requestId, data } = action.payload as HydrationSucceededPayload;\n const memory = readMemory(state, key);\n if (!isCurrentRequest(memory, requestId)) return state.widgets[key] ? state : withMemory(state, key, memory);\n return withMemory(state, key, {\n ...memory,\n status: \"success\",\n error: null,\n inFlight: false,\n data,\n loadingInstanceId: null,\n requestId,\n lastLoadedAt: Date.now(),\n });\n }\n case actionType(\"hydrationFailed\"): {\n const { key, requestId, error } = action.payload as HydrationFailedPayload;\n const memory = readMemory(state, key);\n if (!isCurrentRequest(memory, requestId)) return state.widgets[key] ? state : withMemory(state, key, memory);\n return withMemory(state, key, {\n ...memory,\n status: \"error\",\n error,\n inFlight: false,\n loadingInstanceId: null,\n requestId,\n });\n }\n case actionType(\"widgetReset\"): {\n const { key } = action.payload as WidgetResetPayload;\n if (!(key in state.widgets)) return state;\n const { [key]: removedMemory, ...remainingWidgets } = state.widgets;\n return { ...state, widgets: remainingWidgets };\n }\n case actionType(\"allWidgetsReset\"):\n return { ...state, widgets: {} };\n default:\n return state;\n }\n};\n","import { useSyncExternalStore } from \"react\";\nimport type { AgentsStateAction, AgentsStateStore } from \"../../provider/environment\";\nimport { WidgetHydrationReducer } from \"./widget-hydration.reducer\";\nimport type { WidgetHydrationSliceState } from \"./widget-hydration.types\";\n\n/** The state of the package's default store: the widget hydration state under the key package code reads. */\nexport interface AgentsWidgetHydrationState {\n AIExtensionsWidgetHydration: WidgetHydrationSliceState;\n}\n\n/**\n * The package's own state store (widget hydration is one store per app): the widget hydration reducer\n * behind `useSyncExternalStore`, no Redux. Package code reads and dispatches through it whenever the app supplies no\n * `AgentsEnvironment.stateStore` (the host application supplies its Redux store, which mounts the same reducer). Actions the\n * reducer does not know (the app's \"a chat surface is open\" action) change nothing.\n */\nexport class AgentsWidgetHydrationStateContainer implements AgentsStateStore {\n protected state: AgentsWidgetHydrationState = {\n AIExtensionsWidgetHydration: WidgetHydrationReducer(undefined, { type: \"agents/widgetHydrationStoreCreated\" }),\n };\n protected readonly listeners = new Set<() => void>();\n\n getState = (): AgentsWidgetHydrationState => this.state;\n\n subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n };\n\n dispatch = (action: AgentsStateAction): AgentsStateAction => {\n const nextHydrationState = WidgetHydrationReducer(this.state.AIExtensionsWidgetHydration, action);\n if (nextHydrationState === this.state.AIExtensionsWidgetHydration) return action;\n this.state = { AIExtensionsWidgetHydration: nextHydrationState };\n for (const notifyListener of [...this.listeners]) notifyListener();\n return action;\n };\n\n /** `AgentsStateStore.useSelector`: one value of the state, re-rendering when it changes. */\n useSelector = <Selected,>(selector: (state: AgentsWidgetHydrationState) => Selected): Selected => {\n const readSelectedValue = () => selector(this.state);\n return useSyncExternalStore(this.subscribe, readSelectedValue, readSelectedValue);\n };\n\n /** `AgentsStateStore.useDispatch`. */\n useDispatch = (): ((action: AgentsStateAction) => AgentsStateAction) => this.dispatch;\n}\n\n/** A new widget hydration store (a test, a second app on one page). */\nexport const createAgentsWidgetHydrationStateStore = (): AgentsStateStore =>\n new AgentsWidgetHydrationStateContainer();\n\nlet defaultStateStore: AgentsStateStore | null = null;\n\n/** The one default store of the page, created on first use. */\nexport const getDefaultAgentsStateStore = (): AgentsStateStore => {\n defaultStateStore ??= createAgentsWidgetHydrationStateStore();\n return defaultStateStore;\n};\n","type ClassNameValue = string | undefined | null | false | Readonly<Record<string, boolean | undefined | null>>;\n\n/** The class names one argument contributes: a set string, or every key of an object whose value is truthy. */\nconst readClassNamesOfValue = (value: ClassNameValue): string[] => {\n if (typeof value === \"string\") return value.length > 0 ? [value] : [];\n if (!value) return [];\n return Object.keys(value).filter((className) => className.length > 0 && Boolean(value[className]));\n};\n\n/**\n * Joins the class names that are set, skipping empty and falsy values; an object adds each key whose value is truthy\n * (`classNames(styles.card, { [styles.selected]: isSelected })`), in argument order, as the `classnames` package does.\n */\nexport const classNames = (...args: ClassNameValue[]): string => args.flatMap(readClassNamesOfValue).join(\" \");\n","import { useMemo, useState } from \"react\";\nimport ReactMarkdown, { type Components } from \"react-markdown\";\nimport remarkGfm from \"remark-gfm\";\nimport type { PluggableList } from \"unified\";\nimport type {\n AgentsButtonProps,\n AgentsCheckboxProps,\n AgentsComponents,\n AgentsConversationSearchResultsListProps,\n AgentsHeroRowProps,\n AgentsHeroValueProps,\n AgentsMarkdownProps,\n AgentsSegmentBarProps,\n AgentsSkeletonTextProps,\n AgentsStatusBadgeStatus,\n AgentsStatusChipProps,\n AgentsStatusChipTone,\n AgentsWidgetFeatureGateProps,\n AgentsWidgetTextProps,\n AgentsDateInputProps,\n AgentsGlowFrameProps,\n AgentsIconProps,\n AgentsInteractiveSurfaceProps,\n AgentsLoadingSpinnerProps,\n AgentsMapMarkerProps,\n AgentsMapProps,\n AgentsModalLayerProps,\n AgentsProgressBarProps,\n AgentsRadioGroupProps,\n AgentsRangeSliderProps,\n AgentsSelectProps,\n AgentsSkeletonProps,\n AgentsSplitViewProps,\n AgentsStatusBadgeProps,\n AgentsTabsProps,\n AgentsTextAreaProps,\n AgentsTextInputProps,\n AgentsTextProps,\n AgentsTextReplacements,\n AgentsTooltipProps,\n AgentsTrendDeltaProps,\n} from \"./types\";\nimport { useAgentsTexts } from \"../AgentsProvider\";\nimport { classNames } from \"../class-names\";\n\nconst TEXT_ELEMENT_BY_ROLE = {\n title: \"h4\",\n intro: \"p\",\n body: \"span\",\n help: \"span\",\n caption: \"span\",\n} as const;\n\n/** `--token` stands for `var(--token)`; any other value is a CSS colour. */\nconst readCssColor = (color: string | undefined): string | undefined =>\n color?.startsWith(\"--\") ? `var(${color})` : color;\n\nconst readPlainReplacements = (replacements?: AgentsTextReplacements): Record<string, string | number> => {\n const plainReplacements: Record<string, string | number> = {};\n for (const [name, value] of Object.entries(replacements ?? {})) {\n if (typeof value === \"string\" || typeof value === \"number\") plainReplacements[name] = value;\n }\n return plainReplacements;\n};\n\nconst useTranslatedText = (\n text: string | undefined,\n translate = true,\n replacements?: AgentsTextReplacements,\n context?: string,\n): string | undefined => {\n const texts = useAgentsTexts();\n if (text === undefined) return undefined;\n return translate ? texts.translate(text, readPlainReplacements(replacements), context) : text;\n};\n\n/** The package's own text: an element per role, styled by `agents-text--*` classes of the package stylesheet. */\nconst DefaultText = (props: AgentsTextProps) => {\n const {\n children,\n role = \"body\",\n weight,\n color,\n translate = true,\n replacements,\n context,\n ellipsis,\n display,\n textAlign,\n textWrap,\n allowNewLines,\n headingLevel,\n ariaHidden,\n className,\n testId,\n } = props;\n const texts = useAgentsTexts();\n const Element = TEXT_ELEMENT_BY_ROLE[role];\n const content =\n typeof children === \"string\" && translate\n ? texts.translate(children, readPlainReplacements(replacements), context)\n : children;\n return (\n <Element\n data-testid={testId}\n role={headingLevel ? \"heading\" : undefined}\n aria-level={headingLevel}\n aria-hidden={ariaHidden || undefined}\n className={classNames(\n \"agents-text\",\n `agents-text--${role}`,\n weight && `agents-text--weight-${weight}`,\n ellipsis && \"agents-text--ellipsis\",\n allowNewLines && \"agents-text--new-lines\",\n className,\n )}\n style={{\n color: readCssColor(color),\n display,\n textAlign,\n whiteSpace: textWrap === \"nowrap\" || ellipsis ? \"nowrap\" : allowNewLines ? \"pre-line\" : undefined,\n }}\n >\n {content}\n </Element>\n );\n};\n\nconst DefaultIcon = (props: AgentsIconProps) => {\n const { name, hostIconName, size, pixelSize, color, className, style } = props;\n const iconName = name ?? hostIconName;\n return (\n <span\n aria-hidden\n data-icon={iconName}\n className={classNames(\"agents-icon\", size && `agents-icon--${size}`, className)}\n style={{ color: readCssColor(color), ...(pixelSize ? { width: pixelSize, height: pixelSize } : null), ...style }}\n />\n );\n};\n\nconst DefaultButton = (props: AgentsButtonProps) => {\n const {\n children,\n variant = \"primary\",\n size = \"medium\",\n onClick,\n disabled,\n isLoading,\n rounded,\n pressed,\n onDark,\n blurred,\n inverted,\n icon,\n iconPosition = \"left\",\n htmlType = \"button\",\n fullWidth,\n wrapsLabel,\n translate,\n replacements,\n className,\n testId,\n ariaLabel,\n } = props;\n const label = useTranslatedText(children, translate, replacements);\n return (\n <button\n type={htmlType}\n aria-label={ariaLabel}\n aria-pressed={pressed}\n aria-busy={isLoading || undefined}\n disabled={disabled || isLoading}\n data-testid={testId}\n onClick={onClick}\n className={classNames(\n \"agents-button\",\n `agents-button--${variant}`,\n `agents-button--${size}`,\n rounded && \"agents-button--rounded\",\n pressed && \"agents-button--pressed\",\n onDark && \"agents-button--on-dark\",\n blurred && \"agents-button--blurred\",\n inverted && \"agents-button--inverted\",\n fullWidth && \"agents-button--full-width\",\n wrapsLabel && \"agents-button--wraps-label\",\n className,\n )}\n >\n {icon && iconPosition === \"left\" ? <DefaultIcon name={icon} size=\"small\" /> : null}\n {label}\n {icon && iconPosition === \"right\" ? <DefaultIcon name={icon} size=\"small\" /> : null}\n </button>\n );\n};\n\nconst DefaultInteractiveSurface = (props: AgentsInteractiveSurfaceProps) => {\n const { children, hoverable, className, style, testId } = props;\n return (\n <div\n data-testid={testId}\n className={classNames(\"agents-interactive-surface\", hoverable && \"agents-interactive-surface--hoverable\", className)}\n style={style}\n >\n {children}\n </div>\n );\n};\n\nconst DefaultSkeleton = (props: AgentsSkeletonProps) => {\n const { width, height, borderRadius = 4, className, style } = props;\n return (\n <div\n aria-hidden\n className={classNames(\"agents-skeleton\", className)}\n style={{ width, height, borderRadius, ...style }}\n />\n );\n};\n\nconst DefaultLoadingSpinner = (_props: AgentsLoadingSpinnerProps) => (\n <span role=\"progressbar\" aria-busy className=\"agents-loading-spinner\" />\n);\n\nconst DefaultTooltip = (props: AgentsTooltipProps) => {\n const { children, text, replacements, placement = \"top\", dark } = props;\n const [isShown, setIsShown] = useState(false);\n const shownText = useTranslatedText(text, true, replacements);\n return (\n <span\n className=\"agents-tooltip\"\n style={{ position: \"relative\", display: \"inline-flex\" }}\n onMouseEnter={() => setIsShown(true)}\n onMouseLeave={() => setIsShown(false)}\n onFocus={() => setIsShown(true)}\n onBlur={() => setIsShown(false)}\n >\n {children}\n {shownText && isShown ? (\n <span\n role=\"tooltip\"\n className={classNames(\"agents-tooltip__panel\", `agents-tooltip__panel--${placement}`, dark && \"agents-tooltip__panel--dark\")}\n style={{ position: \"absolute\", bottom: \"100%\", left: \"50%\", transform: \"translateX(-50%)\" }}\n >\n {shownText}\n </span>\n ) : null}\n </span>\n );\n};\n\nconst DefaultGlowFrame = (props: AgentsGlowFrameProps) => {\n const { children, className, color, borderRadius, borderWidth } = props;\n return (\n <div\n className={classNames(\"agents-glow-frame\", className)}\n style={{ borderRadius, borderWidth, borderStyle: borderWidth ? \"solid\" : undefined, borderColor: color }}\n >\n {children}\n </div>\n );\n};\n\nconst DefaultProgressBar = (props: AgentsProgressBarProps) => {\n const { value, height, color, indeterminate } = props;\n return (\n <progress\n className=\"agents-progress-bar\"\n max={100}\n value={indeterminate ? undefined : value}\n style={{ height, accentColor: color, width: \"100%\" }}\n />\n );\n};\n\nconst DefaultSplitView = (props: AgentsSplitViewProps) => {\n const { isSideOpen, main, side, sideToggle } = props;\n return (\n <div className=\"agents-split-view\" style={{ display: \"flex\", width: \"100%\", height: \"100%\" }}>\n <div\n className=\"agents-split-view__main\"\n style={{ width: isSideOpen ? (main.narrowedWidth ?? main.width) : main.width, background: main.background }}\n >\n {main.content}\n </div>\n {sideToggle ? (\n <button type=\"button\" className=\"agents-split-view__toggle\" onClick={sideToggle.onToggle} aria-expanded={isSideOpen} />\n ) : null}\n {isSideOpen ? (\n <div className=\"agents-split-view__side\" style={{ width: side.narrowedWidth ?? side.width, background: side.background }}>\n {side.content}\n </div>\n ) : null}\n </div>\n );\n};\n\nconst DefaultTrendDelta = (props: AgentsTrendDeltaProps) => {\n const { current, previous = 0, higherIsBetter = true, format } = props;\n const change = current - previous;\n const magnitude = Math.abs(change);\n const isGood = change === 0 ? undefined : (change > 0) === higherIsBetter;\n return (\n <span\n className={classNames(\n \"agents-trend-delta\",\n isGood === true && \"agents-trend-delta--good\",\n isGood === false && \"agents-trend-delta--bad\",\n )}\n >\n {change > 0 ? \"▲ \" : change < 0 ? \"▼ \" : \"\"}\n {format ? format(magnitude) : String(magnitude)}\n </span>\n );\n};\n\nconst DefaultCheckbox = (props: AgentsCheckboxProps) => {\n const { checked, disabled, label, translate, onChange, testId } = props;\n const translatedLabel = useTranslatedText(typeof label === \"string\" ? label : undefined, translate);\n return (\n <label className=\"agents-checkbox\" data-testid={testId}>\n <input type=\"checkbox\" checked={checked ?? false} disabled={disabled} onChange={onChange} />\n {typeof label === \"string\" ? translatedLabel : label}\n </label>\n );\n};\n\nconst DefaultTextInput = (props: AgentsTextInputProps) => {\n const { id, value, type = \"text\", label, placeholder, maxLength, onChange, testId } = props;\n const translatedLabel = useTranslatedText(label);\n return (\n <label className=\"agents-text-input\">\n {translatedLabel ? <span className=\"agents-text-input__label\">{translatedLabel}</span> : null}\n <input\n id={id}\n type={type}\n value={value ?? \"\"}\n placeholder={placeholder}\n maxLength={maxLength}\n data-testid={testId}\n onChange={(event) => onChange?.(event.target.value)}\n />\n </label>\n );\n};\n\nconst DefaultTextArea = (props: AgentsTextAreaProps) => {\n const { id, value, label, placeholder, maxLength, rows, minRows, showsCounter, autoFocus, onChange, testId } = props;\n const translatedLabel = useTranslatedText(label);\n return (\n <label className=\"agents-text-area\">\n {translatedLabel ? <span className=\"agents-text-area__label\">{translatedLabel}</span> : null}\n <textarea\n id={id}\n value={value ?? \"\"}\n placeholder={placeholder}\n maxLength={maxLength}\n rows={rows ?? minRows}\n autoFocus={autoFocus}\n data-testid={testId}\n onChange={(event) => onChange?.(event.target.value)}\n />\n {showsCounter && maxLength ? (\n <span className=\"agents-text-area__counter\">{`${(value ?? \"\").length} / ${maxLength}`}</span>\n ) : null}\n </label>\n );\n};\n\nconst DefaultRangeSlider = (props: AgentsRangeSliderProps) => {\n const { value, min, max, step, onMove, onRelease } = props;\n return (\n <input\n type=\"range\"\n className=\"agents-range-slider\"\n value={value}\n min={min}\n max={max}\n step={step}\n onChange={(event) => onMove?.(Number(event.target.value))}\n onPointerUp={(event) => onRelease?.(Number(event.currentTarget.value))}\n onKeyUp={(event) => onRelease?.(Number(event.currentTarget.value))}\n />\n );\n};\n\nconst toIsoDay = (timestamp: number | undefined): string | undefined => {\n if (timestamp === undefined) return undefined;\n const day = new Date(timestamp);\n const month = String(day.getMonth() + 1).padStart(2, \"0\");\n const dayOfMonth = String(day.getDate()).padStart(2, \"0\");\n return `${day.getFullYear()}-${month}-${dayOfMonth}`;\n};\n\nconst DefaultDateInput = (props: AgentsDateInputProps) => {\n const { value, minDate, maxDate, onChange } = props;\n return (\n <input\n type=\"date\"\n className=\"agents-date-input\"\n value={toIsoDay(value) ?? \"\"}\n min={toIsoDay(minDate)}\n max={toIsoDay(maxDate)}\n onChange={(event) => {\n const [year, month, day] = event.target.value.split(\"-\").map(Number);\n onChange?.(event.target.value ? new Date(year, month - 1, day).getTime() : null);\n }}\n />\n );\n};\n\nconst DefaultRadioGroup = (props: AgentsRadioGroupProps) => {\n const { name, value, options, direction = \"column\", onChange } = props;\n return (\n <div className=\"agents-radio-group\" style={{ display: \"flex\", flexDirection: direction }}>\n {options.map((option) => (\n <label key={option.value} className=\"agents-radio-group__option\">\n <input\n type=\"radio\"\n name={name}\n value={option.value}\n checked={option.value === value}\n disabled={option.disabled}\n onChange={() => onChange(option.value)}\n />\n {option.label}\n </label>\n ))}\n </div>\n );\n};\n\nconst DefaultSelect = (props: AgentsSelectProps) => {\n const { id, value, options, placeholder, onChange, testId } = props;\n return (\n <select\n id={id}\n className=\"agents-select\"\n value={value}\n data-testid={testId}\n onChange={(event) => onChange(event.target.value)}\n >\n {placeholder !== undefined ? (\n <option value=\"\" disabled>\n {placeholder}\n </option>\n ) : null}\n {options.map((option) => (\n <option key={option.value} value={option.value} disabled={option.disabled} title={option.description}>\n {option.label}\n </option>\n ))}\n </select>\n );\n};\n\nconst DefaultTabs = (props: AgentsTabsProps) => {\n const { options, value, onChange, ariaLabel } = props;\n return (\n <div role=\"tablist\" aria-label={ariaLabel} className=\"agents-tabs\">\n {options\n .filter((option) => !option.disabled)\n .map((option) => (\n <button\n key={option.value}\n type=\"button\"\n role=\"tab\"\n aria-selected={option.value === value}\n data-testid={option.testId}\n className={classNames(\"agents-tabs__tab\", option.value === value && \"agents-tabs__tab--selected\")}\n onClick={() => onChange(option.value)}\n >\n {option.label}\n </button>\n ))}\n </div>\n );\n};\n\nconst DefaultStatusBadge = (props: AgentsStatusBadgeProps) => {\n const { status, text, translate, size, className } = props;\n const shownText = useTranslatedText(text, translate);\n return (\n <span\n className={classNames(\n \"agents-status-badge\",\n `agents-status-badge--${status}`,\n size && `agents-status-badge--${size}`,\n className,\n )}\n >\n {shownText}\n </span>\n );\n};\n\n/** No map without the app's map: a placeholder that says so. */\nconst DefaultMap = (props: AgentsMapProps) => {\n const { className, testId } = props;\n const noMapText = useTranslatedText(\"No map available.\");\n return (\n <div className={classNames(\"agents-map-placeholder\", className)} data-testid={testId} data-map=\"none\">\n {noMapText}\n </div>\n );\n};\n\nconst DefaultMapMarker = (_props: AgentsMapMarkerProps) => null;\n\nconst DefaultModalLayer = (props: AgentsModalLayerProps) => {\n const { children } = props;\n return <>{children}</>;\n};\n\nconst DefaultHeroRow = (props: AgentsHeroRowProps) => {\n const { children, className } = props;\n return (\n <div data-hero-row=\"\" className={classNames(\"agents-hero-row\", className)}>\n {children}\n </div>\n );\n};\n\nconst DefaultHeroValue = (props: AgentsHeroValueProps) => {\n const { children, color } = props;\n return (\n <span data-hero=\"\" data-hero-value=\"\" className=\"agents-hero-value\" style={{ color: readCssColor(color) }}>\n {children}\n </span>\n );\n};\n\nconst DefaultWidgetText = (props: AgentsWidgetTextProps) => {\n const {\n children,\n variant = \"inherit\",\n tone,\n color,\n weight,\n uppercase,\n tabular,\n strikethrough,\n inline = variant === \"inherit\",\n translate = typeof children === \"string\",\n context,\n replacements,\n className,\n testId,\n } = props;\n const texts = useAgentsTexts();\n const plainReplacements: Record<string, string | number> = {};\n for (const [name, value] of Object.entries(replacements ?? {})) {\n if (value !== null && value !== undefined) plainReplacements[name] = value;\n }\n const content =\n typeof children === \"string\" && translate ? texts.translate(children, plainReplacements, context) : children;\n const Element = inline ? \"span\" : \"div\";\n return (\n <Element\n data-testid={testId}\n className={classNames(\n \"agents-widget-text\",\n `agents-widget-text--${variant}`,\n tone && !color && `agents-widget-text--${tone}`,\n weight && `agents-widget-text--weight-${weight}`,\n uppercase && \"agents-widget-text--uppercase\",\n tabular && \"agents-widget-text--tabular\",\n strikethrough && \"agents-widget-text--strikethrough\",\n className,\n )}\n style={color ? { color: readCssColor(color) } : undefined}\n >\n {content}\n </Element>\n );\n};\n\nconst DefaultSkeletonText = (props: AgentsSkeletonTextProps) => {\n const { width = \"4.5em\", height = \"1em\", className } = props;\n return (\n <span\n aria-hidden\n className={classNames(\"agents-skeleton\", className)}\n style={{ display: \"inline-block\", width, height, borderRadius: 999 }}\n />\n );\n};\n\nconst STATUS_BADGE_STATUS_BY_CHIP_TONE: Record<AgentsStatusChipTone, AgentsStatusBadgeStatus> = {\n success: \"success\",\n warning: \"warning\",\n danger: \"danger\",\n neutral: \"neutral\",\n info: \"info\",\n error: \"danger\",\n};\n\nconst DefaultStatusChip = (props: AgentsStatusChipProps) => {\n const { tone = \"neutral\", children, compact = false, translate = true } = props;\n return (\n <DefaultStatusBadge\n status={STATUS_BADGE_STATUS_BY_CHIP_TONE[tone]}\n text={children}\n translate={translate}\n size=\"small\"\n hideIcon={compact || tone !== \"error\"}\n />\n );\n};\n\nconst DefaultSegmentBar = (props: AgentsSegmentBarProps) => {\n const { segments, height = 6, className, loading = false, testId } = props;\n const total = segments.reduce((sum, segment) => sum + Math.max(0, segment.value), 0);\n return (\n <div\n className={classNames(\"agents-segment-bar\", className)}\n style={{ display: \"flex\", height, borderRadius: height, overflow: \"hidden\" }}\n data-segment-bar=\"\"\n data-testid={testId}\n >\n {total > 0 || loading\n ? segments.map((segment, segmentIndex) => (\n <div\n key={segmentIndex}\n style={{\n width: loading\n ? `${100 / segments.length}%`\n : `${(Math.max(0, segment.value) / total) * 100}%`,\n background: segment.color,\n opacity: segment.muted || loading ? 0.5 : undefined,\n }}\n />\n ))\n : null}\n </div>\n );\n};\n\nconst NO_MARKDOWN_PLUGINS: PluggableList = [];\n\n/** Drops an image without a source: streamed Markdown emits a partial `![alt](` that would fetch the page itself. */\nconst MarkdownImage: Components[\"img\"] = (imageProps) => {\n const { src, node, ...otherProps } = imageProps;\n return src ? <img src={src} {...otherProps} /> : null;\n};\n\nconst DefaultMarkdown = (props: AgentsMarkdownProps) => {\n const { markdown, color, remarkPlugins = NO_MARKDOWN_PLUGINS, rehypePlugins = NO_MARKDOWN_PLUGINS, components } = props;\n const markdownComponents = useMemo(() => ({ img: MarkdownImage, ...components }) as Components, [components]);\n const markdownRemarkPlugins = useMemo(() => [remarkGfm, ...remarkPlugins], [remarkPlugins]);\n return (\n <div style={{ color }} className=\"agents-markdown\" data-markdown-blocks-root>\n <ReactMarkdown\n remarkPlugins={markdownRemarkPlugins}\n rehypePlugins={rehypePlugins}\n components={markdownComponents}\n >\n {markdown}\n </ReactMarkdown>\n </div>\n );\n};\n\n/** Without an app gate every widget is available. */\nconst DefaultWidgetFeatureGate = (props: AgentsWidgetFeatureGateProps) => {\n const { children } = props;\n return <>{children}</>;\n};\n\nconst DefaultConversationSearchResultsList = (props: AgentsConversationSearchResultsListProps) => {\n const { groups, onOpenConversation } = props;\n return (\n <ul className=\"agents-conversation-search-results\">\n {groups.map((group, groupIndex) => (\n <li key={group.conversationId ?? groupIndex} className=\"agents-conversation-search-results__group\">\n <DefaultText role=\"body\" weight=\"bold\" translate={false}>\n {group.title ?? \"\"}\n </DefaultText>\n {group.hits.map((hit, hitIndex) => (\n <button\n key={hit.messageId ?? hitIndex}\n type=\"button\"\n className=\"agents-conversation-search-results__hit\"\n onClick={() => {\n if (group.conversationId !== undefined) onOpenConversation(group.conversationId, hit.messageId);\n }}\n >\n <DefaultText role=\"help\" translate={false}>\n {hit.excerpt ?? \"\"}\n </DefaultText>\n </button>\n ))}\n </li>\n ))}\n </ul>\n );\n};\n\n/** The package default of every replaceable component. */\nexport const DEFAULT_AGENTS_COMPONENTS: AgentsComponents = {\n Text: DefaultText,\n Button: DefaultButton,\n Icon: DefaultIcon,\n InteractiveSurface: DefaultInteractiveSurface,\n Skeleton: DefaultSkeleton,\n LoadingSpinner: DefaultLoadingSpinner,\n Tooltip: DefaultTooltip,\n GlowFrame: DefaultGlowFrame,\n ProgressBar: DefaultProgressBar,\n SplitView: DefaultSplitView,\n TrendDelta: DefaultTrendDelta,\n Checkbox: DefaultCheckbox,\n TextInput: DefaultTextInput,\n TextArea: DefaultTextArea,\n RangeSlider: DefaultRangeSlider,\n DateInput: DefaultDateInput,\n RadioGroup: DefaultRadioGroup,\n Select: DefaultSelect,\n Tabs: DefaultTabs,\n StatusBadge: DefaultStatusBadge,\n Map: DefaultMap,\n MapMarker: DefaultMapMarker,\n ModalLayer: DefaultModalLayer,\n HeroRow: DefaultHeroRow,\n HeroValue: DefaultHeroValue,\n WidgetText: DefaultWidgetText,\n SkeletonText: DefaultSkeletonText,\n StatusChip: DefaultStatusChip,\n SegmentBar: DefaultSegmentBar,\n Markdown: DefaultMarkdown,\n WidgetFeatureGate: DefaultWidgetFeatureGate,\n ConversationSearchResultsList: DefaultConversationSearchResultsList,\n};\n","import type { ComponentType, ErrorInfo, ReactNode } from \"react\";\nimport type { AgentsComponents } from \"./components/types\";\nimport type { ConversationWidgetStatePartition } from \"../renderer/conversation-widget-state-partition\";\nimport type { ChatAssistantCategory } from \"../chat/chat-assistant-identity\";\nimport type { ComposedNodeSchemaApplicationPart } from \"../renderer/widget-tree/composed-node-schema\";\nimport type { CanvasBehaviour } from \"../renderer/canvas/canvas-behaviours\";\n\n/** Translates interface copy. The key is the English source text. */\nexport interface AgentsTexts {\n translate: (key: string, replacements?: Record<string, string | number>, context?: string) => string;\n}\n\n/** One image of a gallery the app opens over the page. */\nexport interface AgentsGalleryImage {\n /** Identifies the image within the gallery. */\n id: string;\n url: string;\n name?: string;\n}\n\n/**\n * An action the package dispatches into the state store. The index signature is the shape of redux 5's\n * `UnknownAction`, so a host store that registers the package's reducers keeps the action type react-redux 9 expects.\n */\nexport interface AgentsStateAction {\n type: string;\n payload?: unknown;\n [extraProps: string]: unknown;\n}\n\n/**\n * A state store as React hooks: the package keeps its widget hydration state in it, and an app's older chat state\n * partitions are read through it (`defaultChatStatePartition`). Without an app store the package uses its own.\n */\nexport interface AgentsStateStore {\n useSelector: <Selected>(selector: (state: any) => Selected) => Selected;\n useDispatch: () => (action: AgentsStateAction) => unknown;\n}\n\n/** The owner's language and the active agent space's date and time settings. Every field may be missing. */\nexport interface AgentsOwnerSettings {\n /** The owner's language (`de`). */\n languageCode?: string | null;\n /** The owner's locale (`de-DE`). */\n locale?: string | null;\n /** The date locale of the active agent space (`de-DE`). */\n dateLocale?: string | null;\n /** The time zone of the active agent space. */\n timeZone?: string | null;\n /** The active agent space writes times with AM/PM. */\n usesAmPm?: boolean | null;\n}\n\n/** What the error card of a reached budget offers (the error card's upgrade data). */\nexport interface AgentsBudgetLimit {\n /** An upgrade lifts the limit: the card offers it. */\n canUpgrade: boolean;\n /** Opens the app's upgrade flow. */\n openUpgrade: () => void;\n /** The app presents the budget as a fair-use allowance (the card uses that wording). */\n showsFairUseWording: boolean;\n}\n\n/** The badge of a named assistant's icon (its intro card, its openings). */\nexport interface AgentsAssistantIconBadgeProps {\n /** The icon's name in the app's icon set (`ChatAssistantIdentity.iconClass`). */\n iconName: string;\n color: string;\n backgroundColor: string;\n /** Larger on the intro card than on an opening. */\n isLarge?: boolean;\n}\n\n/** The background of a chat with a named assistant's category (or with none, the overview of every category). */\nexport interface AgentsAssistantBackgroundProps {\n category?: ChatAssistantCategory;\n /** The category's alias; undefined for a chat without a category. */\n categoryAlias?: string;\n}\n\n/** The state of the app's map script loader. */\nexport interface AgentsMapsLoaderState {\n isLoaded: boolean;\n loadError: Error | undefined;\n languageCode: string | undefined;\n}\n\n/**\n * Further names of the sandbox and readiness signals that an app declares beside the package's own (`AGENTS_VISUALIZATION`,\n * `--agents-*`, `__AGENTS_WIDGET_IMAGE_V1__`, `__AGENTS_WIDGET_PREVIEW_V1__`): the names its stored visualization scripts,\n * its skill texts or its headless capture already use. Every list is optional; the package's names always exist.\n */\nexport type AgentsSandboxLegacyAliases = {\n /** Further names of the sandbox global, e.g. the name stored scripts of the app read. */\n visualizationGlobalNames?: string[];\n /** Further prefixes of the frame's theme variables, e.g. `--app-` (each variable is set under every prefix). */\n themeVariablePrefixes?: string[];\n /** Further names of the image-capture readiness signal on `window`. */\n imageReadinessGlobalNames?: string[];\n /** Further names of the preview readiness signal on `window`. */\n previewReadinessGlobalNames?: string[];\n};\n\n/**\n * Everything an app supplies to the package. Every member is optional: the package has a default for each.\n * An app sets it once at start (`setAgentsEnvironment`) or per subtree (`AgentsProvider`); the functions are read\n * from the app-wide environment only.\n */\nexport interface AgentsEnvironment {\n /**\n * The state store hooks (see `AgentsStateStore`). Default: the package's own widget hydration store (one per page,\n * `createAgentsWidgetHydrationStateStore`). An app supplies its own to keep the hydration state in its store\n * (host application: its Redux store, which mounts `WidgetHydrationReducer` under `AIExtensionsWidgetHydration`).\n */\n stateStore?: AgentsStateStore;\n /**\n * The partition of the app's own chat state a widget provider reads when its host passes neither a chat store nor a\n * partition (host application: the AI-Extensions chat's slice). Default: none — such a provider keeps a store of its own.\n */\n defaultChatStatePartition?: ConversationWidgetStatePartition;\n /** A React hook returning the owner's settings. Default: none known (the browser's language stands in). */\n useOwnerSettings?: () => AgentsOwnerSettings;\n /**\n * A React hook returning the key of the agent space the owner works in. The key of an agent space is what the\n * client knows it by: the id of the space, unless the app's backend hands out another key\n * (`AgentSpace::getWidgetSelfHydrationKey()`). Default: no agent space.\n */\n useActiveAgentSpaceKey?: () => number | undefined;\n /** Reads the display name of an agent space (the header of a widget of another agent space). Default: no name. */\n readAgentSpaceName?: (agentSpaceKey: number, signal: AbortSignal) => Promise<string | undefined>;\n /**\n * The field of a widget block that carries the key of the block's agent space, as the app's backend writes it\n * (`WidgetBlockFieldNames::WIDGET_SELF_HYDRATION_KEY`). An app whose stored conversations use another field name\n * declares it here and in its backend class. Default: `agentSpaceId`.\n */\n widgetSelfHydrationKeyFieldName?: string;\n /**\n * The owner's text for a click on a widget of another agent space than the active one: returns the text with the\n * suffix the app's backend reads that agent space from\n * (`WidgetBlockFieldNames::OWNER_TEXT_SUFFIX_PATTERN_OF_ANOTHER_SPACE`). Default: the text unchanged.\n */\n appendAnotherAgentSpaceToOwnerText?: (ownerText: string, anotherAgentSpaceKey: number) => string;\n /** The label of an agent space whose name is not known. Default: `#<key>`. */\n buildUnnamedAgentSpaceLabel?: (agentSpaceKey: number) => string;\n /**\n * The sentence that tells the owner that a widget shows another agent space than the active one; `agentSpaceLabel`\n * is its name or the label above. Default: a sentence that names no kind of agent space.\n */\n buildWidgetOfAnotherAgentSpaceExplanation?: (agentSpaceLabel: string) => string;\n /** The name the owner knows the agent by, for the interface texts that name it. Default: `the assistant`. */\n agentDisplayName?: string;\n /** A React hook returning what the error card of a reached budget offers. Default: no upgrade, the plain wording. */\n useBudgetLimit?: () => AgentsBudgetLimit;\n /** A React hook returning the map script loader's state. Default: no maps. */\n useMapsLoader?: () => AgentsMapsLoaderState;\n /**\n * The action that tells the app whether an agent chat surface is open (dispatched into the state store when the\n * first surface mounts and the last unmounts). Default: nothing is dispatched.\n */\n buildChatSurfaceOpenChangedAction?: (isOpen: boolean) => AgentsStateAction;\n components?: Partial<AgentsComponents>;\n texts?: AgentsTexts;\n /**\n * Prepares a plain text (a model's words, a business name) for the app's `Text`, `Button` and `StatusBadge`\n * replacements, which may read a string as markup. Default: the text unchanged.\n */\n escapePlainTextForText?: (text: string) => string;\n /** Opens the images in the app's lightbox, starting at `startIndex`. Default: the start image in a new tab. */\n openImageGallery?: (images: AgentsGalleryImage[], startIndex: number) => void;\n /** Reports a widget that crashed while rendering. Default: nothing (the crash is logged to the console). */\n reportWidgetCrash?: (widgetName: string, error: Error, errorInfo: ErrorInfo) => void;\n /**\n * The footer under an assistant message (host application: the admin's forensics panel, which gates itself). Receives the\n * message as the message view got it. Default: none.\n */\n MessageFooter?: ComponentType<{ message?: unknown }>;\n /**\n * The colour theme class of a named assistant's category (the assistant identity and theme). Default:\n * none — the generic chat colours.\n */\n readAssistantThemeClassName?: (categoryAlias: string) => string;\n /** The badge of a named assistant's icon. Default: none. */\n AssistantIconBadge?: ComponentType<AgentsAssistantIconBadgeProps>;\n /** The chat's own background when the host paints none (host application: the category illustrations). Default: none. */\n AssistantBackground?: ComponentType<AgentsAssistantBackgroundProps>;\n /**\n * Wraps the body of an open canvas (host application: page components inside a canvas must not mirror their filters into\n * the page URL). Default: no wrapper.\n */\n CanvasBodyContainer?: ComponentType<{ children: ReactNode }>;\n /**\n * Tells the app that a turn of the agent runs in an open chat (the host application keeps the tab \"ambient active\" then);\n * returns the release the chat calls when the turn ends. Default: nothing.\n */\n reportRunningTurn?: () => () => void;\n /**\n * Further names of the CustomVisualization sandbox (its global, its theme variable prefixes) and of the image and\n * preview readiness signals, beside the package's own names (see `AgentsSandboxLegacyAliases`). An app whose stored\n * scripts or capture read older names declares them here. Default: none — only the package's names exist.\n */\n sandboxLegacyAliases?: AgentsSandboxLegacyAliases;\n /**\n * The app's part of the ComposedView node schema: the node types, widgets (which embed, at which size), data sources\n * and entity types its own classes declare, as its backend generates them beside the package's\n * `composed-node-schema.json`. The tree readers and the kit read the package's schema with this part added\n * (`getComposedNodeSchema`). Default: none — only the package's own types exist.\n */\n composedNodeSchemaApplicationPart?: ComposedNodeSchemaApplicationPart;\n /**\n * The path prefix of the app's API reads a live widget image capture lets through (same origin, GET only, sent with\n * the capture's bearer; every other request of the capture fails it). Default: `/api/`.\n */\n widgetImageCaptureReadPathPrefix?: string;\n /**\n * The app's widgets that draw a Google map: a widget image capture of one of them, or of a `ComposedView` that embeds\n * one, may load the Maps SDK (the narrow transport exception of the capture; the twin of the backend's list that opens\n * the capture page's CSP). A `ComposedView` holding a `Map` node always may. Default: none.\n */\n googleMapWidgetNames?: string[];\n /**\n * Further `signalSource`s a widget click of the app posts (`injectSignal`), beside the package's own\n * (`FRONTEND_WIDGET_CLICK`, `OWNER_ACTION_CONFIRM`): the message list reads every one of them as the owner's answer to\n * a widget, so an answered widget never comes back interactive after a reload. Default: none.\n */\n furtherWidgetClickSignalSources?: string[];\n /**\n * The canvases of the app's widgets (canvas id → behaviour), beside the package's own (`packageCanvasBehaviours`):\n * every canvas an app widget lists in `opensCanvases`. The app registers each one's body with `registerCanvasBodies`\n * and, when gated, its requirement with `registerCanvasFeatureFlags`. A package canvas id here is ignored. Default:\n * none.\n */\n furtherCanvasBehaviours?: Readonly<Record<string, CanvasBehaviour>>;\n}\n\nlet appEnvironment: AgentsEnvironment = {};\nconst environmentListeners = new Set<() => void>();\n\n/** Sets the app-wide environment. Call it once before the first render; a later call re-renders the readers. */\nexport const setAgentsEnvironment = (environment: AgentsEnvironment): void => {\n appEnvironment = environment;\n for (const notifyListener of environmentListeners) notifyListener();\n};\n\nexport const getAgentsEnvironment = (): AgentsEnvironment => appEnvironment;\n\nexport const subscribeToAgentsEnvironment = (listener: () => void): (() => void) => {\n environmentListeners.add(listener);\n return () => {\n environmentListeners.delete(listener);\n };\n};\n\nconst substitutePlaceholders = (key: string, replacements?: Record<string, string | number>): string =>\n replacements\n ? key.replace(/%([A-Za-z0-9_]+)%/g, (placeholder, name: string) =>\n name in replacements ? String(replacements[name]) : placeholder,\n )\n : key;\n\n/** The package default: the English key with its placeholders substituted. */\nexport const DEFAULT_AGENTS_TEXTS: AgentsTexts = { translate: substitutePlaceholders };\n\n/** Translates an interface text through the app-wide environment, for a string a component hands on (a label). */\nexport const translateText = (key: string, replacements?: Record<string, string | number>, context?: string): string =>\n (appEnvironment.texts ?? DEFAULT_AGENTS_TEXTS).translate(key, replacements, context);\n\n/** A plain text as the app's text components take it (`AgentsEnvironment.escapePlainTextForText`). */\nexport const escapePlainTextForText = (text: string): string =>\n appEnvironment.escapePlainTextForText ? appEnvironment.escapePlainTextForText(text) : text;\n\n/** Opens an image gallery over the page (`AgentsEnvironment.openImageGallery`). */\nexport const openImageGallery = (images: AgentsGalleryImage[], startIndex: number): void => {\n if (appEnvironment.openImageGallery) {\n appEnvironment.openImageGallery(images, startIndex);\n return;\n }\n const startImage = images[startIndex];\n if (startImage) window.open(startImage.url, \"_blank\", \"noopener,noreferrer\");\n};\n\n/** The block field of the package's backend default (`WidgetBlockFieldNames::WIDGET_SELF_HYDRATION_KEY`). */\nexport const DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME = \"agentSpaceId\";\n\n/** The field of a widget block that carries the key of its agent space (`AgentsEnvironment.widgetSelfHydrationKeyFieldName`). */\nexport const getWidgetSelfHydrationKeyFieldName = (): string =>\n appEnvironment.widgetSelfHydrationKeyFieldName ?? DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME;\n\n/** The owner's text for a click on a widget of another agent space (`AgentsEnvironment.appendAnotherAgentSpaceToOwnerText`). */\nexport const appendAnotherAgentSpaceToOwnerText = (ownerText: string, anotherAgentSpaceKey: number): string =>\n appEnvironment.appendAnotherAgentSpaceToOwnerText\n ? appEnvironment.appendAnotherAgentSpaceToOwnerText(ownerText, anotherAgentSpaceKey)\n : ownerText;\n\n/** The label of an agent space without a known name (`AgentsEnvironment.buildUnnamedAgentSpaceLabel`). */\nexport const buildUnnamedAgentSpaceLabel = (agentSpaceKey: number): string =>\n appEnvironment.buildUnnamedAgentSpaceLabel ? appEnvironment.buildUnnamedAgentSpaceLabel(agentSpaceKey) : `#${agentSpaceKey}`;\n\n/** The sentence under a widget of another agent space (`AgentsEnvironment.buildWidgetOfAnotherAgentSpaceExplanation`). */\nexport const buildWidgetOfAnotherAgentSpaceExplanation = (agentSpaceLabel: string): string =>\n appEnvironment.buildWidgetOfAnotherAgentSpaceExplanation\n ? appEnvironment.buildWidgetOfAnotherAgentSpaceExplanation(agentSpaceLabel)\n : translateText(\"This widget shows data for %label%, not for what you currently have selected.\", {\n label: agentSpaceLabel,\n });\n\n/** The further sandbox and readiness names the app declares (`AgentsEnvironment.sandboxLegacyAliases`). */\nexport const getSandboxLegacyAliases = (): AgentsSandboxLegacyAliases => appEnvironment.sandboxLegacyAliases ?? {};\n\n/** The package default of `AgentsEnvironment.widgetImageCaptureReadPathPrefix`. */\nexport const DEFAULT_WIDGET_IMAGE_CAPTURE_READ_PATH_PREFIX = \"/api/\";\n\n/** The path prefix of the API reads a live widget image capture lets through (`AgentsEnvironment.widgetImageCaptureReadPathPrefix`). */\nexport const getWidgetImageCaptureReadPathPrefix = (): string =>\n appEnvironment.widgetImageCaptureReadPathPrefix ?? DEFAULT_WIDGET_IMAGE_CAPTURE_READ_PATH_PREFIX;\n\n/** The app's widgets that draw a Google map (`AgentsEnvironment.googleMapWidgetNames`). */\nexport const getGoogleMapWidgetNames = (): readonly string[] => appEnvironment.googleMapWidgetNames ?? [];\n\n/** The app's further widget click signal sources (`AgentsEnvironment.furtherWidgetClickSignalSources`). */\nexport const getFurtherWidgetClickSignalSources = (): readonly string[] =>\n appEnvironment.furtherWidgetClickSignalSources ?? [];\n\n/** The canvases of the app's widgets (`AgentsEnvironment.furtherCanvasBehaviours`). */\nexport const getFurtherCanvasBehaviours = (): Readonly<Record<string, CanvasBehaviour>> =>\n appEnvironment.furtherCanvasBehaviours ?? {};\n\n/** The name the owner knows the agent by (`AgentsEnvironment.agentDisplayName`). */\nexport const getAgentDisplayName = (): string => appEnvironment.agentDisplayName ?? translateText(\"the assistant\");\n\n/** Reports a running turn of an open chat (`AgentsEnvironment.reportRunningTurn`); returns the release. */\nexport const reportRunningTurn = (): (() => void) | undefined => appEnvironment.reportRunningTurn?.();\n\n/** Reports a crashed widget (`AgentsEnvironment.reportWidgetCrash`). */\nexport const reportWidgetCrash = (widgetName: string, error: Error, errorInfo: ErrorInfo): void => {\n appEnvironment.reportWidgetCrash?.(widgetName, error, errorInfo);\n};\n","import { createContext, type ReactNode, useContext, useMemo, useSyncExternalStore } from \"react\";\nimport type { AgentsConversationClient } from \"../client/AgentsConversationClient\";\nimport { AgentsConversationClientProvider } from \"../client/AgentsConversationClientContext\";\nimport { getDefaultAgentsStateStore } from \"../renderer/widget-hydration/widget-hydration-state-store\";\nimport { DEFAULT_AGENTS_COMPONENTS } from \"./components/default-components\";\nimport type { AgentsComponents } from \"./components/types\";\nimport {\n type AgentsBudgetLimit,\n type AgentsEnvironment,\n type AgentsMapsLoaderState,\n type AgentsOwnerSettings,\n type AgentsStateAction,\n type AgentsTexts,\n DEFAULT_AGENTS_TEXTS,\n getAgentsEnvironment,\n subscribeToAgentsEnvironment,\n} from \"./environment\";\n\nconst AgentsEnvironmentContext = createContext<AgentsEnvironment | null>(null);\n\nexport interface AgentsProviderProps {\n /** The subtree's environment; members it leaves out fall back to the app-wide one, then to the defaults. */\n environment?: AgentsEnvironment;\n /** The conversation client the chat below reads and sends through (the one required input of a chat). */\n client?: AgentsConversationClient;\n children: ReactNode;\n}\n\nconst NO_SUBTREE_ENVIRONMENT: AgentsEnvironment = {};\n\n/**\n * Supplies an environment and the conversation client to one subtree. `<AgentsProvider client={client}><AgentChat />\n * </AgentsProvider>` is a whole chat with the package defaults.\n */\nexport const AgentsProvider = (props: AgentsProviderProps) => {\n const { environment = NO_SUBTREE_ENVIRONMENT, client, children } = props;\n const environmentTree = <AgentsEnvironmentContext.Provider value={environment}>{children}</AgentsEnvironmentContext.Provider>;\n return client ? (\n <AgentsConversationClientProvider client={client}>{environmentTree}</AgentsConversationClientProvider>\n ) : (\n environmentTree\n );\n};\n\nconst useAppEnvironment = (): AgentsEnvironment =>\n useSyncExternalStore(subscribeToAgentsEnvironment, getAgentsEnvironment, getAgentsEnvironment);\n\n/** The components package code renders: the subtree's replacements over the app's over the package defaults. */\nexport const useAgentsComponents = (): AgentsComponents => {\n const subtreeEnvironment = useContext(AgentsEnvironmentContext);\n const appEnvironment = useAppEnvironment();\n return useMemo(\n () => ({ ...DEFAULT_AGENTS_COMPONENTS, ...appEnvironment.components, ...subtreeEnvironment?.components }),\n [appEnvironment, subtreeEnvironment],\n );\n};\n\nexport const useAgentsTexts = (): AgentsTexts => {\n const subtreeEnvironment = useContext(AgentsEnvironmentContext);\n const appEnvironment = useAppEnvironment();\n return subtreeEnvironment?.texts ?? appEnvironment.texts ?? DEFAULT_AGENTS_TEXTS;\n};\n\n/** The environment of this subtree: its own members over the app-wide ones. */\nexport const useAgentsEnvironment = (): AgentsEnvironment => {\n const subtreeEnvironment = useContext(AgentsEnvironmentContext);\n const appEnvironment = useAppEnvironment();\n return useMemo(\n () => (subtreeEnvironment ? { ...appEnvironment, ...subtreeEnvironment } : appEnvironment),\n [appEnvironment, subtreeEnvironment],\n );\n};\n\n/** The app's state store, else the package's own widget hydration store. */\nconst readStateStore = (environment: AgentsEnvironment) => environment.stateStore ?? getDefaultAgentsStateStore();\n\n/** Reads from the state store (`AgentsEnvironment.stateStore`, else the package's default store). */\nexport const useAgentsStateSelector = <Selected,>(selector: (state: any) => Selected): Selected =>\n readStateStore(useAgentsEnvironment()).useSelector(selector);\n\n/** The dispatch of the state store (`AgentsEnvironment.stateStore`, else the package's default store). */\nexport const useAgentsStateDispatch = (): ((action: AgentsStateAction) => unknown) =>\n readStateStore(useAgentsEnvironment()).useDispatch();\n\nconst NO_OWNER_SETTINGS: AgentsOwnerSettings = {};\nconst useNoOwnerSettings = (): AgentsOwnerSettings => NO_OWNER_SETTINGS;\n\n/** The owner's language and the active agent space's date and time settings (`AgentsEnvironment.useOwnerSettings`). */\nexport const useAgentsOwnerSettings = (): AgentsOwnerSettings => {\n const useOwnerSettings = useAgentsEnvironment().useOwnerSettings ?? useNoOwnerSettings;\n return useOwnerSettings();\n};\n\nconst useNoActiveAgentSpaceKey = (): number | undefined => undefined;\n\n/** The key of the agent space the owner works in (`AgentsEnvironment.useActiveAgentSpaceKey`). */\nexport const useAgentsActiveAgentSpaceKey = (): number | undefined => {\n const useActiveAgentSpaceKey = useAgentsEnvironment().useActiveAgentSpaceKey ?? useNoActiveAgentSpaceKey;\n return useActiveAgentSpaceKey();\n};\n\nconst NO_MAPS: AgentsMapsLoaderState = {\n isLoaded: false,\n loadError: new Error(\"The agents environment has no maps loader.\"),\n languageCode: undefined,\n};\nconst useNoMapsLoader = (): AgentsMapsLoaderState => NO_MAPS;\n\n/** The map script loader's state (`AgentsEnvironment.useMapsLoader`). */\nexport const useAgentsMapsLoader = (): AgentsMapsLoaderState => {\n const useMapsLoader = useAgentsEnvironment().useMapsLoader ?? useNoMapsLoader;\n return useMapsLoader();\n};\n\nconst NO_BUDGET_UPGRADE: AgentsBudgetLimit = { canUpgrade: false, openUpgrade: () => undefined, showsFairUseWording: false };\nconst useNoBudgetLimit = (): AgentsBudgetLimit => NO_BUDGET_UPGRADE;\n\n/** What the error card of a reached budget offers (`AgentsEnvironment.useBudgetLimit`). */\nexport const useAgentsBudgetLimit = (): AgentsBudgetLimit => {\n const useBudgetLimit = useAgentsEnvironment().useBudgetLimit ?? useNoBudgetLimit;\n return useBudgetLimit();\n};\n","import { useAgentsComponents } from \"../AgentsProvider\";\nimport type {\n AgentsButtonProps,\n AgentsCheckboxProps,\n AgentsDateInputProps,\n AgentsGlowFrameProps,\n AgentsIconProps,\n AgentsInteractiveSurfaceProps,\n AgentsLoadingSpinnerProps,\n AgentsMapMarkerProps,\n AgentsMapProps,\n AgentsModalLayerProps,\n AgentsProgressBarProps,\n AgentsRadioGroupProps,\n AgentsRangeSliderProps,\n AgentsSelectProps,\n AgentsSkeletonProps,\n AgentsSplitViewProps,\n AgentsStatusBadgeProps,\n AgentsTabsProps,\n AgentsTextAreaProps,\n AgentsTextInputProps,\n AgentsTextProps,\n AgentsTooltipProps,\n AgentsTrendDeltaProps,\n AgentsHeroRowProps,\n AgentsHeroValueProps,\n AgentsWidgetTextProps,\n AgentsSkeletonTextProps,\n AgentsStatusChipProps,\n AgentsSegmentBarProps,\n AgentsMarkdownProps,\n AgentsWidgetFeatureGateProps,\n AgentsConversationSearchResultsListProps,\n} from \"./types\";\n\n/**\n * The components package code imports. Each renders the app's replacement when the environment has one, else the\n * package default — package code never imports an app's component library.\n */\nexport const Text = (props: AgentsTextProps) => {\n const { Text: TextComponent } = useAgentsComponents();\n return <TextComponent {...props} />;\n};\n\nexport const Button = (props: AgentsButtonProps) => {\n const { Button: ButtonComponent } = useAgentsComponents();\n return <ButtonComponent {...props} />;\n};\n\nexport const Icon = (props: AgentsIconProps) => {\n const { Icon: IconComponent } = useAgentsComponents();\n return <IconComponent {...props} />;\n};\n\nexport const InteractiveSurface = (props: AgentsInteractiveSurfaceProps) => {\n const { InteractiveSurface: InteractiveSurfaceComponent } = useAgentsComponents();\n return <InteractiveSurfaceComponent {...props} />;\n};\n\nexport const Skeleton = (props: AgentsSkeletonProps) => {\n const { Skeleton: SkeletonComponent } = useAgentsComponents();\n return <SkeletonComponent {...props} />;\n};\n\nexport const LoadingSpinner = (props: AgentsLoadingSpinnerProps) => {\n const { LoadingSpinner: LoadingSpinnerComponent } = useAgentsComponents();\n return <LoadingSpinnerComponent {...props} />;\n};\n\nexport const Tooltip = (props: AgentsTooltipProps) => {\n const { Tooltip: TooltipComponent } = useAgentsComponents();\n return <TooltipComponent {...props} />;\n};\n\nexport const GlowFrame = (props: AgentsGlowFrameProps) => {\n const { GlowFrame: GlowFrameComponent } = useAgentsComponents();\n return <GlowFrameComponent {...props} />;\n};\n\nexport const ProgressBar = (props: AgentsProgressBarProps) => {\n const { ProgressBar: ProgressBarComponent } = useAgentsComponents();\n return <ProgressBarComponent {...props} />;\n};\n\nexport const SplitView = (props: AgentsSplitViewProps) => {\n const { SplitView: SplitViewComponent } = useAgentsComponents();\n return <SplitViewComponent {...props} />;\n};\n\nexport const TrendDelta = (props: AgentsTrendDeltaProps) => {\n const { TrendDelta: TrendDeltaComponent } = useAgentsComponents();\n return <TrendDeltaComponent {...props} />;\n};\n\nexport const Checkbox = (props: AgentsCheckboxProps) => {\n const { Checkbox: CheckboxComponent } = useAgentsComponents();\n return <CheckboxComponent {...props} />;\n};\n\nexport const TextInput = (props: AgentsTextInputProps) => {\n const { TextInput: TextInputComponent } = useAgentsComponents();\n return <TextInputComponent {...props} />;\n};\n\nexport const TextArea = (props: AgentsTextAreaProps) => {\n const { TextArea: TextAreaComponent } = useAgentsComponents();\n return <TextAreaComponent {...props} />;\n};\n\nexport const RangeSlider = (props: AgentsRangeSliderProps) => {\n const { RangeSlider: RangeSliderComponent } = useAgentsComponents();\n return <RangeSliderComponent {...props} />;\n};\n\nexport const DateInput = (props: AgentsDateInputProps) => {\n const { DateInput: DateInputComponent } = useAgentsComponents();\n return <DateInputComponent {...props} />;\n};\n\nexport const RadioGroup = (props: AgentsRadioGroupProps) => {\n const { RadioGroup: RadioGroupComponent } = useAgentsComponents();\n return <RadioGroupComponent {...props} />;\n};\n\nexport const Select = (props: AgentsSelectProps) => {\n const { Select: SelectComponent } = useAgentsComponents();\n return <SelectComponent {...props} />;\n};\n\nexport const Tabs = (props: AgentsTabsProps) => {\n const { Tabs: TabsComponent } = useAgentsComponents();\n return <TabsComponent {...props} />;\n};\n\nexport const StatusBadge = (props: AgentsStatusBadgeProps) => {\n const { StatusBadge: StatusBadgeComponent } = useAgentsComponents();\n return <StatusBadgeComponent {...props} />;\n};\n\nexport const Map = (props: AgentsMapProps) => {\n const { Map: MapComponent } = useAgentsComponents();\n return <MapComponent {...props} />;\n};\n\nexport const MapMarker = (props: AgentsMapMarkerProps) => {\n const { MapMarker: MapMarkerComponent } = useAgentsComponents();\n return <MapMarkerComponent {...props} />;\n};\n\nexport const ModalLayer = (props: AgentsModalLayerProps) => {\n const { ModalLayer: ModalLayerComponent } = useAgentsComponents();\n return <ModalLayerComponent {...props} />;\n};\n\nexport const HeroRow = (props: AgentsHeroRowProps) => {\n const { HeroRow: HeroRowComponent } = useAgentsComponents();\n return <HeroRowComponent {...props} />;\n};\n\nexport const HeroValue = (props: AgentsHeroValueProps) => {\n const { HeroValue: HeroValueComponent } = useAgentsComponents();\n return <HeroValueComponent {...props} />;\n};\n\nexport const WidgetText = (props: AgentsWidgetTextProps) => {\n const { WidgetText: WidgetTextComponent } = useAgentsComponents();\n return <WidgetTextComponent {...props} />;\n};\n\nexport const SkeletonText = (props: AgentsSkeletonTextProps) => {\n const { SkeletonText: SkeletonTextComponent } = useAgentsComponents();\n return <SkeletonTextComponent {...props} />;\n};\n\nexport const StatusChip = (props: AgentsStatusChipProps) => {\n const { StatusChip: StatusChipComponent } = useAgentsComponents();\n return <StatusChipComponent {...props} />;\n};\n\nexport const SegmentBar = (props: AgentsSegmentBarProps) => {\n const { SegmentBar: SegmentBarComponent } = useAgentsComponents();\n return <SegmentBarComponent {...props} />;\n};\n\nexport const Markdown = (props: AgentsMarkdownProps) => {\n const { Markdown: MarkdownComponent } = useAgentsComponents();\n return <MarkdownComponent {...props} />;\n};\n\nexport const WidgetFeatureGate = (props: AgentsWidgetFeatureGateProps) => {\n const { WidgetFeatureGate: WidgetFeatureGateComponent } = useAgentsComponents();\n return <WidgetFeatureGateComponent {...props} />;\n};\n\nexport const ConversationSearchResultsList = (props: AgentsConversationSearchResultsListProps) => {\n const { ConversationSearchResultsList: ConversationSearchResultsListComponent } = useAgentsComponents();\n return <ConversationSearchResultsListComponent {...props} />;\n};\n\nexport type * from \"./types\";\nexport { AGENTS_ICON_NAMES, isAgentsIconName } from \"./icon-names\";\n"],"names":["appEnvironment"],"mappings":";;;;;;AASA,MAAM,aAAa;AAEnB,MAAM,cAAc,MAAoB;AACtC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,mBAAmB;AAAA,IACnB,UAAU;AAAA,IACV,WAAW;AAAA,IACX,cAAc;AAAA,EAAA;AAElB;AAEA,MAAM,eAA0C;AAAA,EAC9C,SAAS,CAAA;AACX;AAEA,MAAM,aAAa,CAAC,OAAkC,QAA8B,MAAM,QAAQ,GAAG,KAAK,YAAA;AAE1G,MAAM,aAAa,CAAC,OAAkC,KAAa,YAAqD;AAAA,EACtH,GAAG;AAAA,EACH,SAAS,EAAE,GAAG,MAAM,SAAS,CAAC,GAAG,GAAG,OAAA;AACtC;AAGA,MAAM,mBAAmB,CAAC,QAAsB,cAC9C,OAAO,cAAc,KAAK,OAAO,cAAc;AA4BjD,MAAM,aAAa,CAAC,SAAyB,GAAG,UAAU,IAAI,IAAI;AAG3D,MAAM,uBAAuB;AAAA,EAClC,eAAe,CAAC,aAAsD,EAAE,MAAM,WAAW,eAAe,GAAG;EAC3G,kBAAkB,CAAC,aAAyD;AAAA,IAC1E,MAA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M,aAAa,CAAC,UAAiC;AAC1D,QAAM,EAAE,YAAY,oBAAA,IAAwB,oBAAA;AAC5C,SAAO,oBAAC,qBAAA,EAAqB,GAAG,MAAA,CAAO;AACzC;AAEO,MAAM,eAAe,CAAC,UAAmC;AAC9D,QAAM,EAAE,cAAc,sBAAA,IAA0B,oBAAA;AAChD,SAAO,oBAAC,uBAAA,EAAuB,GAAG,MAAA,CAAO;AAC3C;AAEO,MAAM,aAAa,CAAC,UAAiC;AAC1D,QAAM,EAAE,YAAY,oBAAA,IAAwB,oBAAA;AAC5C,SAAO,oBAAC,qBAAA,EAAqB,GAAG,MAAA,CAAO;AACzC;AAEO,MAAM,aAAa,CAAC,UAAiC;AAC1D,QAAM,EAAE,YAAY,oBAAA,IAAwB,oBAAA;AAC5C,SAAO,oBAAC,qBAAA,EAAqB,GAAG,MAAA,CAAO;AACzC;AAEO,MAAM,WAAW,CAAC,UAA+B;AACtD,QAAM,EAAE,UAAU,kBAAA,IAAsB,oBAAA;AACxC,SAAO,oBAAC,mBAAA,EAAmB,GAAG,MAAA,CAAO;AACvC;AAEO,MAAM,oBAAoB,CAAC,UAAwC;AACxE,QAAM,EAAE,mBAAmB,2BAAA,IAA+B,oBAAA;AAC1D,SAAO,oBAAC,4BAAA,EAA4B,GAAG,MAAA,CAAO;AAChD;AAEO,MAAM,gCAAgC,CAAC,UAAoD;AAChG,QAAM,EAAE,+BAA+B,uCAAA,IAA2C,oBAAA;AAClF,SAAO,oBAAC,wCAAA,EAAwC,GAAG,MAAA,CAAO;AAC5D;"}
@@ -15,10 +15,14 @@ export interface AgentsGalleryImage {
15
15
  url: string;
16
16
  name?: string;
17
17
  }
18
- /** An action the package dispatches into the state store. */
18
+ /**
19
+ * An action the package dispatches into the state store. The index signature is the shape of redux 5's
20
+ * `UnknownAction`, so a host store that registers the package's reducers keeps the action type react-redux 9 expects.
21
+ */
19
22
  export interface AgentsStateAction {
20
23
  type: string;
21
24
  payload?: unknown;
25
+ [extraProps: string]: unknown;
22
26
  }
23
27
  /**
24
28
  * A state store as React hooks: the package keeps its widget hydration state in it, and an app's older chat state
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mgamadeus/ddd-agents",
3
- "version": "0.1.0-alpha.26",
3
+ "version": "0.1.0-alpha.28",
4
4
  "description": "The web frontend of the ddd-agents module: the agent chat, the widget renderer and the composed-view kit.",
5
5
  "keywords": [
6
6
  "ddd",