@mgamadeus/ddd-agents 0.1.0-alpha.22 → 0.1.0-alpha.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/chat.js +87 -893
- package/dist/chat.js.map +1 -1
- package/dist/chunks/ConversationMessageInputComposerWidgets-BxyaFBA6.js +631 -0
- package/dist/chunks/ConversationMessageInputComposerWidgets-BxyaFBA6.js.map +1 -0
- package/dist/chunks/{WebSearchResultsConversationWidget-BvnLWHyi.js → WebSearchResultsConversationWidget-as3p5bHw.js} +147 -1125
- package/dist/chunks/WebSearchResultsConversationWidget-as3p5bHw.js.map +1 -0
- package/dist/chunks/{canvas-behaviours-BRFR1ALE.js → canvas-behaviours-AvzKSYyv.js} +4 -4
- package/dist/chunks/{canvas-behaviours-BRFR1ALE.js.map → canvas-behaviours-AvzKSYyv.js.map} +1 -1
- package/dist/chunks/canvas-reducers-Bfp_i7lc.js +88 -0
- package/dist/chunks/canvas-reducers-Bfp_i7lc.js.map +1 -0
- package/dist/chunks/{canvasBodies-9SuF6NAB.js → canvasBodies-Cvu3l38p.js} +12 -6
- package/dist/chunks/canvasBodies-Cvu3l38p.js.map +1 -0
- package/dist/chunks/canvasStorage-EvQsGdto.js +65 -0
- package/dist/chunks/canvasStorage-EvQsGdto.js.map +1 -0
- package/dist/chunks/contract-BxmMxYPF.js +96 -0
- package/dist/chunks/contract-BxmMxYPF.js.map +1 -0
- package/dist/chunks/conversation-BEF0aesf.js +31 -0
- package/dist/chunks/conversation-BEF0aesf.js.map +1 -0
- package/dist/chunks/entity-detail-name-3A82gDAp.js +15 -0
- package/dist/chunks/entity-detail-name-3A82gDAp.js.map +1 -0
- package/dist/chunks/icon-names-Di6c4zLo.js +86 -0
- package/dist/chunks/icon-names-Di6c4zLo.js.map +1 -0
- package/dist/chunks/index-7Qc_3GbG.js +1046 -0
- package/dist/chunks/index-7Qc_3GbG.js.map +1 -0
- package/dist/chunks/{ConversationMarkdown-W7NHglmL.js → widget-click-signal-sources-DulRkNvZ.js} +54 -7
- package/dist/chunks/widget-click-signal-sources-DulRkNvZ.js.map +1 -0
- package/dist/chunks/{widget-image-readiness-signal-DeOuL89j.js → widget-image-readiness-signal-D3ci53xr.js} +2 -2
- package/dist/chunks/{widget-image-readiness-signal-DeOuL89j.js.map → widget-image-readiness-signal-D3ci53xr.js.map} +1 -1
- package/dist/chunks/{widget-name-resolver-DyIY6Zu4.js → widget-name-resolver-BGN3HpoG.js} +80 -117
- package/dist/chunks/widget-name-resolver-BGN3HpoG.js.map +1 -0
- package/dist/chunks/{withPollingChangeSubscription-BLDAWF-o.js → withPollingChangeSubscription-B16htQGd.js} +2 -2
- package/dist/chunks/{withPollingChangeSubscription-BLDAWF-o.js.map → withPollingChangeSubscription-B16htQGd.js.map} +1 -1
- package/dist/client-testing.js +91 -2
- package/dist/client-testing.js.map +1 -1
- package/dist/client.js +1 -1
- package/dist/contract.js +8 -27
- package/dist/contract.js.map +1 -1
- package/dist/files/chat/Conversation.module.scss +268 -0
- package/dist/files/chat/ConversationViewBody/ConversationViewBody.module.scss +336 -0
- package/dist/files/chat/_conversation-tokens.scss +37 -0
- package/dist/files/image-render/WidgetImageRender.module.scss +22 -0
- package/dist/files/kit/ComposedViewConversationWidget.md +59 -0
- package/dist/files/kit/components/data/data.preview-fixtures.json +3298 -0
- package/dist/files/kit/components/embedding/widget.preview-fixtures.json +147 -0
- package/dist/files/kit/components/entity/entity-link.preview-fixtures.json +340 -0
- package/dist/files/kit/components/form/form.preview-fixtures.json +319 -0
- package/dist/files/kit/components/inputs/button.preview-fixtures.json +301 -0
- package/dist/files/kit/components/inputs/checkbox.preview-fixtures.json +35 -0
- package/dist/files/kit/components/inputs/date-picker.preview-fixtures.json +36 -0
- package/dist/files/kit/components/inputs/input.preview-fixtures.json +55 -0
- package/dist/files/kit/components/inputs/radio-group.preview-fixtures.json +76 -0
- package/dist/files/kit/components/inputs/select.preview-fixtures.json +314 -0
- package/dist/files/kit/components/inputs/slider.preview-fixtures.json +178 -0
- package/dist/files/kit/components/inputs/tabs.preview-fixtures.json +304 -0
- package/dist/files/kit/components/inputs/textarea.preview-fixtures.json +37 -0
- package/dist/files/kit/components/layout/layout.preview-fixtures.json +892 -0
- package/dist/files/kit/components/map/map.preview-fixtures.json +339 -0
- package/dist/files/kit/components/media/image-group.preview-fixtures.json +228 -0
- package/dist/files/kit/components/media/image.preview-fixtures.json +61 -0
- package/dist/files/kit/components/media/video-card/video-card.preview-fixtures.json +121 -0
- package/dist/files/kit/components/media/video.preview-fixtures.json +68 -0
- package/dist/files/kit/components/rich/code.preview-fixtures.json +105 -0
- package/dist/files/kit/components/rich/diagram.preview-fixtures.json +89 -0
- package/dist/files/kit/components/rich/math.preview-fixtures.json +152 -0
- package/dist/files/kit/components/rich/svg.preview-fixtures.json +243 -0
- package/dist/files/kit/components/text/badge.preview-fixtures.json +44 -0
- package/dist/files/kit/components/text/caption.preview-fixtures.json +31 -0
- package/dist/files/kit/components/text/favicon.preview-fixtures.json +69 -0
- package/dist/files/kit/components/text/label.preview-fixtures.json +48 -0
- package/dist/files/kit/components/text/link.preview-fixtures.json +103 -0
- package/dist/files/kit/components/text/markdown.preview-fixtures.json +29 -0
- package/dist/files/kit/components/text/source-ref.preview-fixtures.json +51 -0
- package/dist/files/kit/components/text/text.preview-fixtures.json +106 -0
- package/dist/files/kit/components/text/title.preview-fixtures.json +172 -0
- package/dist/files/kit/composed-view-widget-contract.json +88 -0
- package/dist/files/kit/composed-view.preview-fixtures.json +376 -0
- package/dist/files/renderer/conversation-widget-layout.module.scss +47 -0
- package/dist/files/renderer/widget-tree/composed-node-schema.json +3428 -0
- package/dist/files/styles/_conversation-widget-container.scss +6 -0
- package/dist/files/styles/_media.scss +50 -0
- package/dist/files/styles/_spacings.scss +23 -0
- package/dist/files/styles/_surfaces.scss +28 -0
- package/dist/files/widgets/ClockConversationWidget/ClockConversationWidget.md +53 -0
- package/dist/files/widgets/ClockConversationWidget/clock.preview-fixtures.json +76 -0
- package/dist/files/widgets/ConceptExplainerConversationWidget/ConceptExplainerConversationWidget.md +86 -0
- package/dist/files/widgets/ConceptExplainerConversationWidget/concept-explainer.preview-fixtures.json +23 -0
- package/dist/files/widgets/ConversationSearchResultsConversationWidget/ConversationSearchResultsConversationWidget.md +59 -0
- package/dist/files/widgets/ConversationSearchResultsConversationWidget/conversation-search-results.preview-fixtures.json +85 -0
- package/dist/files/widgets/CurrencyConverterConversationWidget/CurrencyConverterConversationWidget.md +51 -0
- package/dist/files/widgets/CurrencyConverterConversationWidget/currency-converter.preview-fixtures.json +73 -0
- package/dist/files/widgets/CustomVisualizationConversationWidget/CustomVisualizationConversationWidget.md +83 -0
- package/dist/files/widgets/CustomVisualizationConversationWidget/custom-visualization.preview-fixtures.json +227 -0
- package/dist/files/widgets/CustomVisualizationConversationWidget/sandbox-frame/custom-visualization-frame.html +188 -0
- package/dist/files/widgets/EntityMentionConversationWidget/EntityMentionConversationWidget.md +55 -0
- package/dist/files/widgets/EntityMentionConversationWidget/entity-mention.preview-fixtures.json +55 -0
- package/dist/files/widgets/MultiChoiceConversationWidget/MultiChoiceConversationWidget.md +61 -0
- package/dist/files/widgets/MultiChoiceConversationWidget/multi-choice-widget-contract.json +43 -0
- package/dist/files/widgets/MultiChoiceConversationWidget/multi-choice.preview-fixtures.json +103 -0
- package/dist/files/widgets/QuickRepliesConversationWidget/QuickRepliesConversationWidget.md +65 -0
- package/dist/files/widgets/QuickRepliesConversationWidget/quick-replies-widget-contract.json +43 -0
- package/dist/files/widgets/QuickRepliesConversationWidget/quick-replies.preview-fixtures.json +45 -0
- package/dist/files/widgets/SuggestedActions/SuggestedActions.md +60 -0
- package/dist/files/widgets/SuggestedActions/suggested-actions.preview-fixtures.json +19 -0
- package/dist/files/widgets/ToolTraceConversationWidget/ToolTraceConversationWidget.md +48 -0
- package/dist/files/widgets/ToolTraceConversationWidget/tool-trace.preview-fixtures.json +32 -0
- package/dist/files/widgets/WebSearchResultsConversationWidget/WebSearchResultsConversationWidget.md +49 -0
- package/dist/files/widgets/WebSearchResultsConversationWidget/web-search-results.preview-fixtures.json +57 -0
- package/dist/files/widgets/WritingDraftConversationWidget/WritingDraftConversationWidget.md +66 -0
- package/dist/files/widgets/WritingDraftConversationWidget/writing-draft.preview-fixtures.json +129 -0
- package/dist/image-render.js +11 -10
- package/dist/image-render.js.map +1 -1
- package/dist/index.js +32 -27
- package/dist/index.js.map +1 -1
- package/dist/kit.js +11 -2
- package/dist/kit.js.map +1 -1
- package/dist/preview.js +47 -18
- package/dist/preview.js.map +1 -1
- package/dist/provider.js +71 -0
- package/dist/provider.js.map +1 -0
- package/dist/renderer.js +142 -62
- package/dist/renderer.js.map +1 -1
- package/dist/styles.css +86 -38
- package/dist/types/client/testing/test-conversation-widgets.d.ts +25 -0
- package/dist/types/client/testing/widget-hydration-stand-ins.d.ts +42 -0
- package/dist/types/entries/chat.d.ts +12 -0
- package/dist/types/entries/client-testing.d.ts +4 -0
- package/dist/types/entries/contract.d.ts +1 -0
- package/dist/types/entries/index.d.ts +4 -3
- package/dist/types/entries/kit.d.ts +7 -0
- package/dist/types/entries/preview.d.ts +2 -0
- package/dist/types/entries/provider.d.ts +1 -0
- package/dist/types/entries/renderer.d.ts +19 -1
- package/dist/types/entries/widgets.d.ts +13 -0
- package/dist/types/kit/components/data/apex-chart-component.d.ts +3 -0
- package/dist/types/kit/components/data/chart-model.d.ts +164 -0
- package/dist/types/kit/components/data/data-value-format.d.ts +44 -0
- package/dist/types/kit/components/data/use-chart-palette.d.ts +9 -0
- package/dist/types/kit/components/data/use-number-locale.d.ts +5 -0
- package/dist/types/kit/components/map/use-google-maps-auth-failure.d.ts +18 -0
- package/dist/types/kit/entity-detail/entity-detail-bodies.d.ts +2 -0
- package/dist/types/provider/index.d.ts +1 -0
- package/dist/types/renderer/_access/ConversationWidgetGateSkeleton.d.ts +6 -0
- package/dist/types/renderer/_agent-space/use-conversation-widget-agent-space-fallback.d.ts +16 -0
- package/dist/types/renderer/canvas/entity-detail-instance.d.ts +5 -3
- package/dist/types/renderer/canvas/use-anchor-widget-agent-space-key.d.ts +17 -0
- package/dist/types/renderer/conversationWidgetRegistry.d.ts +6 -0
- package/dist/types/renderer/read-conversation-widget-variant.d.ts +22 -0
- package/dist/types/renderer/widget-hydration/use-widget-hydration.d.ts +5 -0
- package/dist/types/widgets/EntityMentionConversationWidget/stories/EntityMentionAskFlowStory.d.ts +8 -0
- package/dist/types/widgets/_shared/CardFooter.d.ts +6 -0
- package/dist/types/widgets/_shared/WidgetLabel.d.ts +8 -0
- package/dist/types/widgets/_shared/entity-update-channel.d.ts +17 -0
- package/dist/types/widgets/_shared/use-element-visible.d.ts +6 -0
- package/dist/widgets.js +120 -27
- package/dist/widgets.js.map +1 -1
- package/package.json +74 -1
- package/public-api.json +779 -0
- package/dist/chunks/ConversationMarkdown-W7NHglmL.js.map +0 -1
- package/dist/chunks/WebSearchResultsConversationWidget-BvnLWHyi.js.map +0 -1
- package/dist/chunks/canvasBodies-9SuF6NAB.js.map +0 -1
- package/dist/chunks/decide-canvas-open-Ct-wnNEJ.js +0 -20
- package/dist/chunks/decide-canvas-open-Ct-wnNEJ.js.map +0 -1
- package/dist/chunks/widget-name-resolver-DyIY6Zu4.js.map +0 -1
|
@@ -1,979 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { V as getWidgetSelfHydrationKeyFieldName, a7 as useAgentsStateSelector, a6 as useAgentsStateDispatch, ab as WidgetHydrationSlice, l as Skeleton, z as classNames, m as SkeletonText, v as WidgetText, H as HeroRow, e as HeroValue, B as Button, I as Icon, q as Text, E as escapePlainTextForText, a5 as useAgentsOwnerSettings, j as RangeSlider, $ as translateText, Q as getSandboxLegacyAliases, h as Markdown, s as TextInput, r as TextArea, a0 as useAgentsActiveAgentSpaceKey, J as getAgentsEnvironment, x as buildUnnamedAgentSpaceLabel, y as buildWidgetOfAnotherAgentSpaceExplanation, t as Tooltip, f as InteractiveSurface, C as Checkbox, w as appendAnotherAgentSpaceToOwnerText, a as ConversationSearchResultsList } from "./index-7Qc_3GbG.js";
|
|
4
|
+
import { createContext, useContext, useMemo, useEffect, useId, useRef, useCallback, useState, useLayoutEffect } from "react";
|
|
4
5
|
import { visit } from "unist-util-visit";
|
|
5
|
-
import { A as AgentsConversationClientProvider } from "./AgentsConversationClientContext-C4T7g_Qk.js";
|
|
6
|
-
import ReactMarkdown from "react-markdown";
|
|
7
|
-
import remarkGfm from "remark-gfm";
|
|
8
|
-
const SLICE_NAME = "widgetHydrationSlice";
|
|
9
|
-
const emptyMemory = () => {
|
|
10
|
-
return {
|
|
11
|
-
data: null,
|
|
12
|
-
status: "idle",
|
|
13
|
-
error: null,
|
|
14
|
-
loadingInstanceId: null,
|
|
15
|
-
inFlight: false,
|
|
16
|
-
requestId: 0,
|
|
17
|
-
lastLoadedAt: null
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
const initialState = {
|
|
21
|
-
widgets: {}
|
|
22
|
-
};
|
|
23
|
-
const readMemory = (state, key) => state.widgets[key] ?? emptyMemory();
|
|
24
|
-
const withMemory = (state, key, memory) => ({
|
|
25
|
-
...state,
|
|
26
|
-
widgets: { ...state.widgets, [key]: memory }
|
|
27
|
-
});
|
|
28
|
-
const isCurrentRequest = (memory, requestId) => memory.requestId === 0 || memory.requestId === requestId;
|
|
29
|
-
const actionType = (name2) => `${SLICE_NAME}/${name2}`;
|
|
30
|
-
const WidgetHydrationSlice = {
|
|
31
|
-
memoryEnsured: (payload) => ({ type: actionType("memoryEnsured"), payload }),
|
|
32
|
-
instanceAttached: (payload) => ({
|
|
33
|
-
type: actionType("instanceAttached"),
|
|
34
|
-
payload
|
|
35
|
-
}),
|
|
36
|
-
hydrationStarted: (payload) => ({
|
|
37
|
-
type: actionType("hydrationStarted"),
|
|
38
|
-
payload
|
|
39
|
-
}),
|
|
40
|
-
hydrationSucceeded: (payload) => ({
|
|
41
|
-
type: actionType("hydrationSucceeded"),
|
|
42
|
-
payload
|
|
43
|
-
}),
|
|
44
|
-
hydrationFailed: (payload) => ({
|
|
45
|
-
type: actionType("hydrationFailed"),
|
|
46
|
-
payload
|
|
47
|
-
}),
|
|
48
|
-
widgetReset: (payload) => ({ type: actionType("widgetReset"), payload }),
|
|
49
|
-
allWidgetsReset: () => ({ type: actionType("allWidgetsReset") })
|
|
50
|
-
};
|
|
51
|
-
const WidgetHydrationReducer = (state = initialState, action) => {
|
|
52
|
-
switch (action.type) {
|
|
53
|
-
case actionType("memoryEnsured"): {
|
|
54
|
-
const { key } = action.payload;
|
|
55
|
-
return state.widgets[key] ? state : withMemory(state, key, emptyMemory());
|
|
56
|
-
}
|
|
57
|
-
case actionType("instanceAttached"): {
|
|
58
|
-
const { key, instanceId } = action.payload;
|
|
59
|
-
return withMemory(state, key, { ...readMemory(state, key), loadingInstanceId: instanceId });
|
|
60
|
-
}
|
|
61
|
-
case actionType("hydrationStarted"): {
|
|
62
|
-
const { key, instanceId, requestId } = action.payload;
|
|
63
|
-
return withMemory(state, key, {
|
|
64
|
-
...readMemory(state, key),
|
|
65
|
-
status: "loading",
|
|
66
|
-
error: null,
|
|
67
|
-
inFlight: true,
|
|
68
|
-
loadingInstanceId: instanceId,
|
|
69
|
-
requestId
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
case actionType("hydrationSucceeded"): {
|
|
73
|
-
const { key, requestId, data } = action.payload;
|
|
74
|
-
const memory = readMemory(state, key);
|
|
75
|
-
if (!isCurrentRequest(memory, requestId)) return state.widgets[key] ? state : withMemory(state, key, memory);
|
|
76
|
-
return withMemory(state, key, {
|
|
77
|
-
...memory,
|
|
78
|
-
status: "success",
|
|
79
|
-
error: null,
|
|
80
|
-
inFlight: false,
|
|
81
|
-
data,
|
|
82
|
-
loadingInstanceId: null,
|
|
83
|
-
requestId,
|
|
84
|
-
lastLoadedAt: Date.now()
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
case actionType("hydrationFailed"): {
|
|
88
|
-
const { key, requestId, error } = action.payload;
|
|
89
|
-
const memory = readMemory(state, key);
|
|
90
|
-
if (!isCurrentRequest(memory, requestId)) return state.widgets[key] ? state : withMemory(state, key, memory);
|
|
91
|
-
return withMemory(state, key, {
|
|
92
|
-
...memory,
|
|
93
|
-
status: "error",
|
|
94
|
-
error,
|
|
95
|
-
inFlight: false,
|
|
96
|
-
loadingInstanceId: null,
|
|
97
|
-
requestId
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
case actionType("widgetReset"): {
|
|
101
|
-
const { key } = action.payload;
|
|
102
|
-
if (!(key in state.widgets)) return state;
|
|
103
|
-
const { [key]: removedMemory, ...remainingWidgets } = state.widgets;
|
|
104
|
-
return { ...state, widgets: remainingWidgets };
|
|
105
|
-
}
|
|
106
|
-
case actionType("allWidgetsReset"):
|
|
107
|
-
return { ...state, widgets: {} };
|
|
108
|
-
default:
|
|
109
|
-
return state;
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
class AgentsWidgetHydrationStateContainer {
|
|
113
|
-
constructor() {
|
|
114
|
-
this.state = {
|
|
115
|
-
AIExtensionsWidgetHydration: WidgetHydrationReducer(void 0, { type: "agents/widgetHydrationStoreCreated" })
|
|
116
|
-
};
|
|
117
|
-
this.listeners = /* @__PURE__ */ new Set();
|
|
118
|
-
this.getState = () => this.state;
|
|
119
|
-
this.subscribe = (listener) => {
|
|
120
|
-
this.listeners.add(listener);
|
|
121
|
-
return () => {
|
|
122
|
-
this.listeners.delete(listener);
|
|
123
|
-
};
|
|
124
|
-
};
|
|
125
|
-
this.dispatch = (action) => {
|
|
126
|
-
const nextHydrationState = WidgetHydrationReducer(this.state.AIExtensionsWidgetHydration, action);
|
|
127
|
-
if (nextHydrationState === this.state.AIExtensionsWidgetHydration) return action;
|
|
128
|
-
this.state = { AIExtensionsWidgetHydration: nextHydrationState };
|
|
129
|
-
for (const notifyListener of [...this.listeners]) notifyListener();
|
|
130
|
-
return action;
|
|
131
|
-
};
|
|
132
|
-
this.useSelector = (selector) => {
|
|
133
|
-
const readSelectedValue = () => selector(this.state);
|
|
134
|
-
return useSyncExternalStore(this.subscribe, readSelectedValue, readSelectedValue);
|
|
135
|
-
};
|
|
136
|
-
this.useDispatch = () => this.dispatch;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
const createAgentsWidgetHydrationStateStore = () => new AgentsWidgetHydrationStateContainer();
|
|
140
|
-
let defaultStateStore = null;
|
|
141
|
-
const getDefaultAgentsStateStore = () => {
|
|
142
|
-
defaultStateStore ??= createAgentsWidgetHydrationStateStore();
|
|
143
|
-
return defaultStateStore;
|
|
144
|
-
};
|
|
145
|
-
const readClassNamesOfValue = (value) => {
|
|
146
|
-
if (typeof value === "string") return value.length > 0 ? [value] : [];
|
|
147
|
-
if (!value) return [];
|
|
148
|
-
return Object.keys(value).filter((className) => className.length > 0 && Boolean(value[className]));
|
|
149
|
-
};
|
|
150
|
-
const classNames = (...args) => args.flatMap(readClassNamesOfValue).join(" ");
|
|
151
|
-
const TEXT_ELEMENT_BY_ROLE = {
|
|
152
|
-
title: "h4",
|
|
153
|
-
intro: "p",
|
|
154
|
-
body: "span",
|
|
155
|
-
help: "span",
|
|
156
|
-
caption: "span"
|
|
157
|
-
};
|
|
158
|
-
const readCssColor = (color) => color?.startsWith("--") ? `var(${color})` : color;
|
|
159
|
-
const readPlainReplacements = (replacements) => {
|
|
160
|
-
const plainReplacements = {};
|
|
161
|
-
for (const [name2, value] of Object.entries(replacements ?? {})) {
|
|
162
|
-
if (typeof value === "string" || typeof value === "number") plainReplacements[name2] = value;
|
|
163
|
-
}
|
|
164
|
-
return plainReplacements;
|
|
165
|
-
};
|
|
166
|
-
const useTranslatedText = (text2, translate = true, replacements, context) => {
|
|
167
|
-
const texts = useAgentsTexts();
|
|
168
|
-
if (text2 === void 0) return void 0;
|
|
169
|
-
return translate ? texts.translate(text2, readPlainReplacements(replacements), context) : text2;
|
|
170
|
-
};
|
|
171
|
-
const DefaultText = (props) => {
|
|
172
|
-
const {
|
|
173
|
-
children,
|
|
174
|
-
role = "body",
|
|
175
|
-
weight,
|
|
176
|
-
color,
|
|
177
|
-
translate = true,
|
|
178
|
-
replacements,
|
|
179
|
-
context,
|
|
180
|
-
ellipsis,
|
|
181
|
-
display,
|
|
182
|
-
textAlign,
|
|
183
|
-
textWrap,
|
|
184
|
-
allowNewLines,
|
|
185
|
-
headingLevel,
|
|
186
|
-
ariaHidden,
|
|
187
|
-
className,
|
|
188
|
-
testId: testId2
|
|
189
|
-
} = props;
|
|
190
|
-
const texts = useAgentsTexts();
|
|
191
|
-
const Element = TEXT_ELEMENT_BY_ROLE[role];
|
|
192
|
-
const content2 = typeof children === "string" && translate ? texts.translate(children, readPlainReplacements(replacements), context) : children;
|
|
193
|
-
return /* @__PURE__ */ jsx(
|
|
194
|
-
Element,
|
|
195
|
-
{
|
|
196
|
-
"data-testid": testId2,
|
|
197
|
-
role: headingLevel ? "heading" : void 0,
|
|
198
|
-
"aria-level": headingLevel,
|
|
199
|
-
"aria-hidden": ariaHidden || void 0,
|
|
200
|
-
className: classNames(
|
|
201
|
-
"agents-text",
|
|
202
|
-
`agents-text--${role}`,
|
|
203
|
-
weight && `agents-text--weight-${weight}`,
|
|
204
|
-
ellipsis && "agents-text--ellipsis",
|
|
205
|
-
allowNewLines && "agents-text--new-lines",
|
|
206
|
-
className
|
|
207
|
-
),
|
|
208
|
-
style: {
|
|
209
|
-
color: readCssColor(color),
|
|
210
|
-
display,
|
|
211
|
-
textAlign,
|
|
212
|
-
whiteSpace: textWrap === "nowrap" || ellipsis ? "nowrap" : allowNewLines ? "pre-line" : void 0
|
|
213
|
-
},
|
|
214
|
-
children: content2
|
|
215
|
-
}
|
|
216
|
-
);
|
|
217
|
-
};
|
|
218
|
-
const DefaultIcon = (props) => {
|
|
219
|
-
const { name: name2, hostIconName, size, pixelSize, color, className, style } = props;
|
|
220
|
-
const iconName = name2 ?? hostIconName;
|
|
221
|
-
return /* @__PURE__ */ jsx(
|
|
222
|
-
"span",
|
|
223
|
-
{
|
|
224
|
-
"aria-hidden": true,
|
|
225
|
-
"data-icon": iconName,
|
|
226
|
-
className: classNames("agents-icon", size && `agents-icon--${size}`, className),
|
|
227
|
-
style: { color: readCssColor(color), ...pixelSize ? { width: pixelSize, height: pixelSize } : null, ...style }
|
|
228
|
-
}
|
|
229
|
-
);
|
|
230
|
-
};
|
|
231
|
-
const DefaultButton = (props) => {
|
|
232
|
-
const {
|
|
233
|
-
children,
|
|
234
|
-
variant = "primary",
|
|
235
|
-
size = "medium",
|
|
236
|
-
onClick,
|
|
237
|
-
disabled,
|
|
238
|
-
isLoading,
|
|
239
|
-
rounded,
|
|
240
|
-
pressed,
|
|
241
|
-
onDark,
|
|
242
|
-
blurred,
|
|
243
|
-
inverted,
|
|
244
|
-
icon,
|
|
245
|
-
iconPosition = "left",
|
|
246
|
-
htmlType = "button",
|
|
247
|
-
fullWidth,
|
|
248
|
-
wrapsLabel,
|
|
249
|
-
translate,
|
|
250
|
-
replacements,
|
|
251
|
-
className,
|
|
252
|
-
testId: testId2,
|
|
253
|
-
ariaLabel
|
|
254
|
-
} = props;
|
|
255
|
-
const label2 = useTranslatedText(children, translate, replacements);
|
|
256
|
-
return /* @__PURE__ */ jsxs(
|
|
257
|
-
"button",
|
|
258
|
-
{
|
|
259
|
-
type: htmlType,
|
|
260
|
-
"aria-label": ariaLabel,
|
|
261
|
-
"aria-pressed": pressed,
|
|
262
|
-
"aria-busy": isLoading || void 0,
|
|
263
|
-
disabled: disabled || isLoading,
|
|
264
|
-
"data-testid": testId2,
|
|
265
|
-
onClick,
|
|
266
|
-
className: classNames(
|
|
267
|
-
"agents-button",
|
|
268
|
-
`agents-button--${variant}`,
|
|
269
|
-
`agents-button--${size}`,
|
|
270
|
-
rounded && "agents-button--rounded",
|
|
271
|
-
pressed && "agents-button--pressed",
|
|
272
|
-
onDark && "agents-button--on-dark",
|
|
273
|
-
blurred && "agents-button--blurred",
|
|
274
|
-
inverted && "agents-button--inverted",
|
|
275
|
-
fullWidth && "agents-button--full-width",
|
|
276
|
-
wrapsLabel && "agents-button--wraps-label",
|
|
277
|
-
className
|
|
278
|
-
),
|
|
279
|
-
children: [
|
|
280
|
-
icon && iconPosition === "left" ? /* @__PURE__ */ jsx(DefaultIcon, { name: icon, size: "small" }) : null,
|
|
281
|
-
label2,
|
|
282
|
-
icon && iconPosition === "right" ? /* @__PURE__ */ jsx(DefaultIcon, { name: icon, size: "small" }) : null
|
|
283
|
-
]
|
|
284
|
-
}
|
|
285
|
-
);
|
|
286
|
-
};
|
|
287
|
-
const DefaultInteractiveSurface = (props) => {
|
|
288
|
-
const { children, hoverable, className, style, testId: testId2 } = props;
|
|
289
|
-
return /* @__PURE__ */ jsx(
|
|
290
|
-
"div",
|
|
291
|
-
{
|
|
292
|
-
"data-testid": testId2,
|
|
293
|
-
className: classNames("agents-interactive-surface", hoverable && "agents-interactive-surface--hoverable", className),
|
|
294
|
-
style,
|
|
295
|
-
children
|
|
296
|
-
}
|
|
297
|
-
);
|
|
298
|
-
};
|
|
299
|
-
const DefaultSkeleton = (props) => {
|
|
300
|
-
const { width, height, borderRadius = 4, className, style } = props;
|
|
301
|
-
return /* @__PURE__ */ jsx(
|
|
302
|
-
"div",
|
|
303
|
-
{
|
|
304
|
-
"aria-hidden": true,
|
|
305
|
-
className: classNames("agents-skeleton", className),
|
|
306
|
-
style: { width, height, borderRadius, ...style }
|
|
307
|
-
}
|
|
308
|
-
);
|
|
309
|
-
};
|
|
310
|
-
const DefaultLoadingSpinner = (_props) => /* @__PURE__ */ jsx("span", { role: "progressbar", "aria-busy": true, className: "agents-loading-spinner" });
|
|
311
|
-
const DefaultTooltip = (props) => {
|
|
312
|
-
const { children, text: text2, replacements, placement = "top", dark } = props;
|
|
313
|
-
const [isShown, setIsShown] = useState(false);
|
|
314
|
-
const shownText = useTranslatedText(text2, true, replacements);
|
|
315
|
-
return /* @__PURE__ */ jsxs(
|
|
316
|
-
"span",
|
|
317
|
-
{
|
|
318
|
-
className: "agents-tooltip",
|
|
319
|
-
style: { position: "relative", display: "inline-flex" },
|
|
320
|
-
onMouseEnter: () => setIsShown(true),
|
|
321
|
-
onMouseLeave: () => setIsShown(false),
|
|
322
|
-
onFocus: () => setIsShown(true),
|
|
323
|
-
onBlur: () => setIsShown(false),
|
|
324
|
-
children: [
|
|
325
|
-
children,
|
|
326
|
-
shownText && isShown ? /* @__PURE__ */ jsx(
|
|
327
|
-
"span",
|
|
328
|
-
{
|
|
329
|
-
role: "tooltip",
|
|
330
|
-
className: classNames("agents-tooltip__panel", `agents-tooltip__panel--${placement}`, dark && "agents-tooltip__panel--dark"),
|
|
331
|
-
style: { position: "absolute", bottom: "100%", left: "50%", transform: "translateX(-50%)" },
|
|
332
|
-
children: shownText
|
|
333
|
-
}
|
|
334
|
-
) : null
|
|
335
|
-
]
|
|
336
|
-
}
|
|
337
|
-
);
|
|
338
|
-
};
|
|
339
|
-
const DefaultGlowFrame = (props) => {
|
|
340
|
-
const { children, className, color, borderRadius, borderWidth } = props;
|
|
341
|
-
return /* @__PURE__ */ jsx(
|
|
342
|
-
"div",
|
|
343
|
-
{
|
|
344
|
-
className: classNames("agents-glow-frame", className),
|
|
345
|
-
style: { borderRadius, borderWidth, borderStyle: borderWidth ? "solid" : void 0, borderColor: color },
|
|
346
|
-
children
|
|
347
|
-
}
|
|
348
|
-
);
|
|
349
|
-
};
|
|
350
|
-
const DefaultProgressBar = (props) => {
|
|
351
|
-
const { value, height, color, indeterminate } = props;
|
|
352
|
-
return /* @__PURE__ */ jsx(
|
|
353
|
-
"progress",
|
|
354
|
-
{
|
|
355
|
-
className: "agents-progress-bar",
|
|
356
|
-
max: 100,
|
|
357
|
-
value: indeterminate ? void 0 : value,
|
|
358
|
-
style: { height, accentColor: color, width: "100%" }
|
|
359
|
-
}
|
|
360
|
-
);
|
|
361
|
-
};
|
|
362
|
-
const DefaultSplitView = (props) => {
|
|
363
|
-
const { isSideOpen, main, side, sideToggle } = props;
|
|
364
|
-
return /* @__PURE__ */ jsxs("div", { className: "agents-split-view", style: { display: "flex", width: "100%", height: "100%" }, children: [
|
|
365
|
-
/* @__PURE__ */ jsx(
|
|
366
|
-
"div",
|
|
367
|
-
{
|
|
368
|
-
className: "agents-split-view__main",
|
|
369
|
-
style: { width: isSideOpen ? main.narrowedWidth ?? main.width : main.width, background: main.background },
|
|
370
|
-
children: main.content
|
|
371
|
-
}
|
|
372
|
-
),
|
|
373
|
-
sideToggle ? /* @__PURE__ */ jsx("button", { type: "button", className: "agents-split-view__toggle", onClick: sideToggle.onToggle, "aria-expanded": isSideOpen }) : null,
|
|
374
|
-
isSideOpen ? /* @__PURE__ */ jsx("div", { className: "agents-split-view__side", style: { width: side.narrowedWidth ?? side.width, background: side.background }, children: side.content }) : null
|
|
375
|
-
] });
|
|
376
|
-
};
|
|
377
|
-
const DefaultTrendDelta = (props) => {
|
|
378
|
-
const { current, previous = 0, higherIsBetter = true, format } = props;
|
|
379
|
-
const change = current - previous;
|
|
380
|
-
const magnitude = Math.abs(change);
|
|
381
|
-
const isGood = change === 0 ? void 0 : change > 0 === higherIsBetter;
|
|
382
|
-
return /* @__PURE__ */ jsxs(
|
|
383
|
-
"span",
|
|
384
|
-
{
|
|
385
|
-
className: classNames(
|
|
386
|
-
"agents-trend-delta",
|
|
387
|
-
isGood === true && "agents-trend-delta--good",
|
|
388
|
-
isGood === false && "agents-trend-delta--bad"
|
|
389
|
-
),
|
|
390
|
-
children: [
|
|
391
|
-
change > 0 ? "▲ " : change < 0 ? "▼ " : "",
|
|
392
|
-
format ? format(magnitude) : String(magnitude)
|
|
393
|
-
]
|
|
394
|
-
}
|
|
395
|
-
);
|
|
396
|
-
};
|
|
397
|
-
const DefaultCheckbox = (props) => {
|
|
398
|
-
const { checked, disabled, label: label2, translate, onChange, testId: testId2 } = props;
|
|
399
|
-
const translatedLabel = useTranslatedText(typeof label2 === "string" ? label2 : void 0, translate);
|
|
400
|
-
return /* @__PURE__ */ jsxs("label", { className: "agents-checkbox", "data-testid": testId2, children: [
|
|
401
|
-
/* @__PURE__ */ jsx("input", { type: "checkbox", checked: checked ?? false, disabled, onChange }),
|
|
402
|
-
typeof label2 === "string" ? translatedLabel : label2
|
|
403
|
-
] });
|
|
404
|
-
};
|
|
405
|
-
const DefaultTextInput = (props) => {
|
|
406
|
-
const { id, value, type = "text", label: label2, placeholder, maxLength, onChange, testId: testId2 } = props;
|
|
407
|
-
const translatedLabel = useTranslatedText(label2);
|
|
408
|
-
return /* @__PURE__ */ jsxs("label", { className: "agents-text-input", children: [
|
|
409
|
-
translatedLabel ? /* @__PURE__ */ jsx("span", { className: "agents-text-input__label", children: translatedLabel }) : null,
|
|
410
|
-
/* @__PURE__ */ jsx(
|
|
411
|
-
"input",
|
|
412
|
-
{
|
|
413
|
-
id,
|
|
414
|
-
type,
|
|
415
|
-
value: value ?? "",
|
|
416
|
-
placeholder,
|
|
417
|
-
maxLength,
|
|
418
|
-
"data-testid": testId2,
|
|
419
|
-
onChange: (event) => onChange?.(event.target.value)
|
|
420
|
-
}
|
|
421
|
-
)
|
|
422
|
-
] });
|
|
423
|
-
};
|
|
424
|
-
const DefaultTextArea = (props) => {
|
|
425
|
-
const { id, value, label: label2, placeholder, maxLength, rows: rows2, minRows, showsCounter, autoFocus, onChange, testId: testId2 } = props;
|
|
426
|
-
const translatedLabel = useTranslatedText(label2);
|
|
427
|
-
return /* @__PURE__ */ jsxs("label", { className: "agents-text-area", children: [
|
|
428
|
-
translatedLabel ? /* @__PURE__ */ jsx("span", { className: "agents-text-area__label", children: translatedLabel }) : null,
|
|
429
|
-
/* @__PURE__ */ jsx(
|
|
430
|
-
"textarea",
|
|
431
|
-
{
|
|
432
|
-
id,
|
|
433
|
-
value: value ?? "",
|
|
434
|
-
placeholder,
|
|
435
|
-
maxLength,
|
|
436
|
-
rows: rows2 ?? minRows,
|
|
437
|
-
autoFocus,
|
|
438
|
-
"data-testid": testId2,
|
|
439
|
-
onChange: (event) => onChange?.(event.target.value)
|
|
440
|
-
}
|
|
441
|
-
),
|
|
442
|
-
showsCounter && maxLength ? /* @__PURE__ */ jsx("span", { className: "agents-text-area__counter", children: `${(value ?? "").length} / ${maxLength}` }) : null
|
|
443
|
-
] });
|
|
444
|
-
};
|
|
445
|
-
const DefaultRangeSlider = (props) => {
|
|
446
|
-
const { value, min, max, step, onMove, onRelease } = props;
|
|
447
|
-
return /* @__PURE__ */ jsx(
|
|
448
|
-
"input",
|
|
449
|
-
{
|
|
450
|
-
type: "range",
|
|
451
|
-
className: "agents-range-slider",
|
|
452
|
-
value,
|
|
453
|
-
min,
|
|
454
|
-
max,
|
|
455
|
-
step,
|
|
456
|
-
onChange: (event) => onMove?.(Number(event.target.value)),
|
|
457
|
-
onPointerUp: (event) => onRelease?.(Number(event.currentTarget.value)),
|
|
458
|
-
onKeyUp: (event) => onRelease?.(Number(event.currentTarget.value))
|
|
459
|
-
}
|
|
460
|
-
);
|
|
461
|
-
};
|
|
462
|
-
const toIsoDay = (timestamp) => {
|
|
463
|
-
if (timestamp === void 0) return void 0;
|
|
464
|
-
const day = new Date(timestamp);
|
|
465
|
-
const month = String(day.getMonth() + 1).padStart(2, "0");
|
|
466
|
-
const dayOfMonth = String(day.getDate()).padStart(2, "0");
|
|
467
|
-
return `${day.getFullYear()}-${month}-${dayOfMonth}`;
|
|
468
|
-
};
|
|
469
|
-
const DefaultDateInput = (props) => {
|
|
470
|
-
const { value, minDate, maxDate, onChange } = props;
|
|
471
|
-
return /* @__PURE__ */ jsx(
|
|
472
|
-
"input",
|
|
473
|
-
{
|
|
474
|
-
type: "date",
|
|
475
|
-
className: "agents-date-input",
|
|
476
|
-
value: toIsoDay(value) ?? "",
|
|
477
|
-
min: toIsoDay(minDate),
|
|
478
|
-
max: toIsoDay(maxDate),
|
|
479
|
-
onChange: (event) => {
|
|
480
|
-
const [year, month, day] = event.target.value.split("-").map(Number);
|
|
481
|
-
onChange?.(event.target.value ? new Date(year, month - 1, day).getTime() : null);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
);
|
|
485
|
-
};
|
|
486
|
-
const DefaultRadioGroup = (props) => {
|
|
487
|
-
const { name: name2, value, options: options2, direction = "column", onChange } = props;
|
|
488
|
-
return /* @__PURE__ */ jsx("div", { className: "agents-radio-group", style: { display: "flex", flexDirection: direction }, children: options2.map((option2) => /* @__PURE__ */ jsxs("label", { className: "agents-radio-group__option", children: [
|
|
489
|
-
/* @__PURE__ */ jsx(
|
|
490
|
-
"input",
|
|
491
|
-
{
|
|
492
|
-
type: "radio",
|
|
493
|
-
name: name2,
|
|
494
|
-
value: option2.value,
|
|
495
|
-
checked: option2.value === value,
|
|
496
|
-
disabled: option2.disabled,
|
|
497
|
-
onChange: () => onChange(option2.value)
|
|
498
|
-
}
|
|
499
|
-
),
|
|
500
|
-
option2.label
|
|
501
|
-
] }, option2.value)) });
|
|
502
|
-
};
|
|
503
|
-
const DefaultSelect = (props) => {
|
|
504
|
-
const { id, value, options: options2, placeholder, onChange, testId: testId2 } = props;
|
|
505
|
-
return /* @__PURE__ */ jsxs(
|
|
506
|
-
"select",
|
|
507
|
-
{
|
|
508
|
-
id,
|
|
509
|
-
className: "agents-select",
|
|
510
|
-
value,
|
|
511
|
-
"data-testid": testId2,
|
|
512
|
-
onChange: (event) => onChange(event.target.value),
|
|
513
|
-
children: [
|
|
514
|
-
placeholder !== void 0 ? /* @__PURE__ */ jsx("option", { value: "", disabled: true, children: placeholder }) : null,
|
|
515
|
-
options2.map((option2) => /* @__PURE__ */ jsx("option", { value: option2.value, disabled: option2.disabled, title: option2.description, children: option2.label }, option2.value))
|
|
516
|
-
]
|
|
517
|
-
}
|
|
518
|
-
);
|
|
519
|
-
};
|
|
520
|
-
const DefaultTabs = (props) => {
|
|
521
|
-
const { options: options2, value, onChange, ariaLabel } = props;
|
|
522
|
-
return /* @__PURE__ */ jsx("div", { role: "tablist", "aria-label": ariaLabel, className: "agents-tabs", children: options2.filter((option2) => !option2.disabled).map((option2) => /* @__PURE__ */ jsx(
|
|
523
|
-
"button",
|
|
524
|
-
{
|
|
525
|
-
type: "button",
|
|
526
|
-
role: "tab",
|
|
527
|
-
"aria-selected": option2.value === value,
|
|
528
|
-
"data-testid": option2.testId,
|
|
529
|
-
className: classNames("agents-tabs__tab", option2.value === value && "agents-tabs__tab--selected"),
|
|
530
|
-
onClick: () => onChange(option2.value),
|
|
531
|
-
children: option2.label
|
|
532
|
-
},
|
|
533
|
-
option2.value
|
|
534
|
-
)) });
|
|
535
|
-
};
|
|
536
|
-
const DefaultStatusBadge = (props) => {
|
|
537
|
-
const { status, text: text2, translate, size, className } = props;
|
|
538
|
-
const shownText = useTranslatedText(text2, translate);
|
|
539
|
-
return /* @__PURE__ */ jsx(
|
|
540
|
-
"span",
|
|
541
|
-
{
|
|
542
|
-
className: classNames(
|
|
543
|
-
"agents-status-badge",
|
|
544
|
-
`agents-status-badge--${status}`,
|
|
545
|
-
size && `agents-status-badge--${size}`,
|
|
546
|
-
className
|
|
547
|
-
),
|
|
548
|
-
children: shownText
|
|
549
|
-
}
|
|
550
|
-
);
|
|
551
|
-
};
|
|
552
|
-
const DefaultMap = (props) => {
|
|
553
|
-
const { className, testId: testId2 } = props;
|
|
554
|
-
const noMapText = useTranslatedText("No map available.");
|
|
555
|
-
return /* @__PURE__ */ jsx("div", { className: classNames("agents-map-placeholder", className), "data-testid": testId2, "data-map": "none", children: noMapText });
|
|
556
|
-
};
|
|
557
|
-
const DefaultMapMarker = (_props) => null;
|
|
558
|
-
const DefaultModalLayer = (props) => {
|
|
559
|
-
const { children } = props;
|
|
560
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
561
|
-
};
|
|
562
|
-
const DefaultHeroRow = (props) => {
|
|
563
|
-
const { children, className } = props;
|
|
564
|
-
return /* @__PURE__ */ jsx("div", { "data-hero-row": "", className: classNames("agents-hero-row", className), children });
|
|
565
|
-
};
|
|
566
|
-
const DefaultHeroValue = (props) => {
|
|
567
|
-
const { children, color } = props;
|
|
568
|
-
return /* @__PURE__ */ jsx("span", { "data-hero": "", "data-hero-value": "", className: "agents-hero-value", style: { color: readCssColor(color) }, children });
|
|
569
|
-
};
|
|
570
|
-
const DefaultWidgetText = (props) => {
|
|
571
|
-
const {
|
|
572
|
-
children,
|
|
573
|
-
variant = "inherit",
|
|
574
|
-
tone,
|
|
575
|
-
color,
|
|
576
|
-
weight,
|
|
577
|
-
uppercase,
|
|
578
|
-
tabular,
|
|
579
|
-
strikethrough,
|
|
580
|
-
inline = variant === "inherit",
|
|
581
|
-
translate = typeof children === "string",
|
|
582
|
-
context,
|
|
583
|
-
replacements,
|
|
584
|
-
className,
|
|
585
|
-
testId: testId2
|
|
586
|
-
} = props;
|
|
587
|
-
const texts = useAgentsTexts();
|
|
588
|
-
const plainReplacements = {};
|
|
589
|
-
for (const [name2, value] of Object.entries(replacements ?? {})) {
|
|
590
|
-
if (value !== null && value !== void 0) plainReplacements[name2] = value;
|
|
591
|
-
}
|
|
592
|
-
const content2 = typeof children === "string" && translate ? texts.translate(children, plainReplacements, context) : children;
|
|
593
|
-
const Element = inline ? "span" : "div";
|
|
594
|
-
return /* @__PURE__ */ jsx(
|
|
595
|
-
Element,
|
|
596
|
-
{
|
|
597
|
-
"data-testid": testId2,
|
|
598
|
-
className: classNames(
|
|
599
|
-
"agents-widget-text",
|
|
600
|
-
`agents-widget-text--${variant}`,
|
|
601
|
-
tone && !color && `agents-widget-text--${tone}`,
|
|
602
|
-
weight && `agents-widget-text--weight-${weight}`,
|
|
603
|
-
uppercase && "agents-widget-text--uppercase",
|
|
604
|
-
tabular && "agents-widget-text--tabular",
|
|
605
|
-
strikethrough && "agents-widget-text--strikethrough",
|
|
606
|
-
className
|
|
607
|
-
),
|
|
608
|
-
style: color ? { color: readCssColor(color) } : void 0,
|
|
609
|
-
children: content2
|
|
610
|
-
}
|
|
611
|
-
);
|
|
612
|
-
};
|
|
613
|
-
const DefaultSkeletonText = (props) => {
|
|
614
|
-
const { width = "4.5em", height = "1em", className } = props;
|
|
615
|
-
return /* @__PURE__ */ jsx(
|
|
616
|
-
"span",
|
|
617
|
-
{
|
|
618
|
-
"aria-hidden": true,
|
|
619
|
-
className: classNames("agents-skeleton", className),
|
|
620
|
-
style: { display: "inline-block", width, height, borderRadius: 999 }
|
|
621
|
-
}
|
|
622
|
-
);
|
|
623
|
-
};
|
|
624
|
-
const STATUS_BADGE_STATUS_BY_CHIP_TONE = {
|
|
625
|
-
success: "success",
|
|
626
|
-
warning: "warning",
|
|
627
|
-
danger: "danger",
|
|
628
|
-
neutral: "neutral",
|
|
629
|
-
info: "info",
|
|
630
|
-
error: "danger"
|
|
631
|
-
};
|
|
632
|
-
const DefaultStatusChip = (props) => {
|
|
633
|
-
const { tone = "neutral", children, compact: compact2 = false, translate = true } = props;
|
|
634
|
-
return /* @__PURE__ */ jsx(
|
|
635
|
-
DefaultStatusBadge,
|
|
636
|
-
{
|
|
637
|
-
status: STATUS_BADGE_STATUS_BY_CHIP_TONE[tone],
|
|
638
|
-
text: children,
|
|
639
|
-
translate,
|
|
640
|
-
size: "small",
|
|
641
|
-
hideIcon: compact2 || tone !== "error"
|
|
642
|
-
}
|
|
643
|
-
);
|
|
644
|
-
};
|
|
645
|
-
const DefaultSegmentBar = (props) => {
|
|
646
|
-
const { segments, height = 6, className, loading = false, testId: testId2 } = props;
|
|
647
|
-
const total = segments.reduce((sum, segment) => sum + Math.max(0, segment.value), 0);
|
|
648
|
-
return /* @__PURE__ */ jsx(
|
|
649
|
-
"div",
|
|
650
|
-
{
|
|
651
|
-
className: classNames("agents-segment-bar", className),
|
|
652
|
-
style: { display: "flex", height, borderRadius: height, overflow: "hidden" },
|
|
653
|
-
"data-segment-bar": "",
|
|
654
|
-
"data-testid": testId2,
|
|
655
|
-
children: total > 0 || loading ? segments.map((segment, segmentIndex) => /* @__PURE__ */ jsx(
|
|
656
|
-
"div",
|
|
657
|
-
{
|
|
658
|
-
style: {
|
|
659
|
-
width: loading ? `${100 / segments.length}%` : `${Math.max(0, segment.value) / total * 100}%`,
|
|
660
|
-
background: segment.color,
|
|
661
|
-
opacity: segment.muted || loading ? 0.5 : void 0
|
|
662
|
-
}
|
|
663
|
-
},
|
|
664
|
-
segmentIndex
|
|
665
|
-
)) : null
|
|
666
|
-
}
|
|
667
|
-
);
|
|
668
|
-
};
|
|
669
|
-
const NO_MARKDOWN_PLUGINS = [];
|
|
670
|
-
const MarkdownImage = (imageProps) => {
|
|
671
|
-
const { src, node, ...otherProps } = imageProps;
|
|
672
|
-
return src ? /* @__PURE__ */ jsx("img", { src, ...otherProps }) : null;
|
|
673
|
-
};
|
|
674
|
-
const DefaultMarkdown = (props) => {
|
|
675
|
-
const { markdown, color, remarkPlugins = NO_MARKDOWN_PLUGINS, rehypePlugins = NO_MARKDOWN_PLUGINS, components } = props;
|
|
676
|
-
const markdownComponents = useMemo(() => ({ img: MarkdownImage, ...components }), [components]);
|
|
677
|
-
const markdownRemarkPlugins = useMemo(() => [remarkGfm, ...remarkPlugins], [remarkPlugins]);
|
|
678
|
-
return /* @__PURE__ */ jsx("div", { style: { color }, className: "agents-markdown", "data-markdown-blocks-root": true, children: /* @__PURE__ */ jsx(
|
|
679
|
-
ReactMarkdown,
|
|
680
|
-
{
|
|
681
|
-
remarkPlugins: markdownRemarkPlugins,
|
|
682
|
-
rehypePlugins,
|
|
683
|
-
components: markdownComponents,
|
|
684
|
-
children: markdown
|
|
685
|
-
}
|
|
686
|
-
) });
|
|
687
|
-
};
|
|
688
|
-
const DefaultWidgetFeatureGate = (props) => {
|
|
689
|
-
const { children } = props;
|
|
690
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
691
|
-
};
|
|
692
|
-
const DefaultConversationSearchResultsList = (props) => {
|
|
693
|
-
const { groups, onOpenConversation } = props;
|
|
694
|
-
return /* @__PURE__ */ jsx("ul", { className: "agents-conversation-search-results", children: groups.map((group, groupIndex) => /* @__PURE__ */ jsxs("li", { className: "agents-conversation-search-results__group", children: [
|
|
695
|
-
/* @__PURE__ */ jsx(DefaultText, { role: "body", weight: "bold", translate: false, children: group.title ?? "" }),
|
|
696
|
-
group.hits.map((hit, hitIndex) => /* @__PURE__ */ jsx(
|
|
697
|
-
"button",
|
|
698
|
-
{
|
|
699
|
-
type: "button",
|
|
700
|
-
className: "agents-conversation-search-results__hit",
|
|
701
|
-
onClick: () => {
|
|
702
|
-
if (group.conversationId !== void 0) onOpenConversation(group.conversationId, hit.messageId);
|
|
703
|
-
},
|
|
704
|
-
children: /* @__PURE__ */ jsx(DefaultText, { role: "help", translate: false, children: hit.excerpt ?? "" })
|
|
705
|
-
},
|
|
706
|
-
hit.messageId ?? hitIndex
|
|
707
|
-
))
|
|
708
|
-
] }, group.conversationId ?? groupIndex)) });
|
|
709
|
-
};
|
|
710
|
-
const DEFAULT_AGENTS_COMPONENTS = {
|
|
711
|
-
Text: DefaultText,
|
|
712
|
-
Button: DefaultButton,
|
|
713
|
-
Icon: DefaultIcon,
|
|
714
|
-
InteractiveSurface: DefaultInteractiveSurface,
|
|
715
|
-
Skeleton: DefaultSkeleton,
|
|
716
|
-
LoadingSpinner: DefaultLoadingSpinner,
|
|
717
|
-
Tooltip: DefaultTooltip,
|
|
718
|
-
GlowFrame: DefaultGlowFrame,
|
|
719
|
-
ProgressBar: DefaultProgressBar,
|
|
720
|
-
SplitView: DefaultSplitView,
|
|
721
|
-
TrendDelta: DefaultTrendDelta,
|
|
722
|
-
Checkbox: DefaultCheckbox,
|
|
723
|
-
TextInput: DefaultTextInput,
|
|
724
|
-
TextArea: DefaultTextArea,
|
|
725
|
-
RangeSlider: DefaultRangeSlider,
|
|
726
|
-
DateInput: DefaultDateInput,
|
|
727
|
-
RadioGroup: DefaultRadioGroup,
|
|
728
|
-
Select: DefaultSelect,
|
|
729
|
-
Tabs: DefaultTabs,
|
|
730
|
-
StatusBadge: DefaultStatusBadge,
|
|
731
|
-
Map: DefaultMap,
|
|
732
|
-
MapMarker: DefaultMapMarker,
|
|
733
|
-
ModalLayer: DefaultModalLayer,
|
|
734
|
-
HeroRow: DefaultHeroRow,
|
|
735
|
-
HeroValue: DefaultHeroValue,
|
|
736
|
-
WidgetText: DefaultWidgetText,
|
|
737
|
-
SkeletonText: DefaultSkeletonText,
|
|
738
|
-
StatusChip: DefaultStatusChip,
|
|
739
|
-
SegmentBar: DefaultSegmentBar,
|
|
740
|
-
Markdown: DefaultMarkdown,
|
|
741
|
-
WidgetFeatureGate: DefaultWidgetFeatureGate,
|
|
742
|
-
ConversationSearchResultsList: DefaultConversationSearchResultsList
|
|
743
|
-
};
|
|
744
|
-
let appEnvironment = {};
|
|
745
|
-
const environmentListeners = /* @__PURE__ */ new Set();
|
|
746
|
-
const setAgentsEnvironment = (environment) => {
|
|
747
|
-
appEnvironment = environment;
|
|
748
|
-
for (const notifyListener of environmentListeners) notifyListener();
|
|
749
|
-
};
|
|
750
|
-
const getAgentsEnvironment = () => appEnvironment;
|
|
751
|
-
const subscribeToAgentsEnvironment = (listener) => {
|
|
752
|
-
environmentListeners.add(listener);
|
|
753
|
-
return () => {
|
|
754
|
-
environmentListeners.delete(listener);
|
|
755
|
-
};
|
|
756
|
-
};
|
|
757
|
-
const substitutePlaceholders = (key, replacements) => replacements ? key.replace(
|
|
758
|
-
/%([A-Za-z0-9_]+)%/g,
|
|
759
|
-
(placeholder, name2) => name2 in replacements ? String(replacements[name2]) : placeholder
|
|
760
|
-
) : key;
|
|
761
|
-
const DEFAULT_AGENTS_TEXTS = { translate: substitutePlaceholders };
|
|
762
|
-
const translateText = (key, replacements, context) => (appEnvironment.texts ?? DEFAULT_AGENTS_TEXTS).translate(key, replacements, context);
|
|
763
|
-
const escapePlainTextForText = (text2) => appEnvironment.escapePlainTextForText ? appEnvironment.escapePlainTextForText(text2) : text2;
|
|
764
|
-
const openImageGallery = (images, startIndex) => {
|
|
765
|
-
if (appEnvironment.openImageGallery) {
|
|
766
|
-
appEnvironment.openImageGallery(images, startIndex);
|
|
767
|
-
return;
|
|
768
|
-
}
|
|
769
|
-
const startImage = images[startIndex];
|
|
770
|
-
if (startImage) window.open(startImage.url, "_blank", "noopener,noreferrer");
|
|
771
|
-
};
|
|
772
|
-
const DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME = "agentSpaceId";
|
|
773
|
-
const getWidgetSelfHydrationKeyFieldName = () => appEnvironment.widgetSelfHydrationKeyFieldName ?? DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME;
|
|
774
|
-
const appendAnotherAgentSpaceToOwnerText = (ownerText, anotherAgentSpaceKey) => appEnvironment.appendAnotherAgentSpaceToOwnerText ? appEnvironment.appendAnotherAgentSpaceToOwnerText(ownerText, anotherAgentSpaceKey) : ownerText;
|
|
775
|
-
const buildUnnamedAgentSpaceLabel = (agentSpaceKey) => appEnvironment.buildUnnamedAgentSpaceLabel ? appEnvironment.buildUnnamedAgentSpaceLabel(agentSpaceKey) : `#${agentSpaceKey}`;
|
|
776
|
-
const buildWidgetOfAnotherAgentSpaceExplanation = (agentSpaceLabel) => appEnvironment.buildWidgetOfAnotherAgentSpaceExplanation ? appEnvironment.buildWidgetOfAnotherAgentSpaceExplanation(agentSpaceLabel) : translateText("This widget shows data for %label%, not for what you currently have selected.", {
|
|
777
|
-
label: agentSpaceLabel
|
|
778
|
-
});
|
|
779
|
-
const getSandboxLegacyAliases = () => appEnvironment.sandboxLegacyAliases ?? {};
|
|
780
|
-
const DEFAULT_WIDGET_IMAGE_CAPTURE_READ_PATH_PREFIX = "/api/";
|
|
781
|
-
const getWidgetImageCaptureReadPathPrefix = () => appEnvironment.widgetImageCaptureReadPathPrefix ?? DEFAULT_WIDGET_IMAGE_CAPTURE_READ_PATH_PREFIX;
|
|
782
|
-
const getGoogleMapWidgetNames = () => appEnvironment.googleMapWidgetNames ?? [];
|
|
783
|
-
const getFurtherWidgetClickSignalSources = () => appEnvironment.furtherWidgetClickSignalSources ?? [];
|
|
784
|
-
const getFurtherCanvasBehaviours = () => appEnvironment.furtherCanvasBehaviours ?? {};
|
|
785
|
-
const getAgentDisplayName = () => appEnvironment.agentDisplayName ?? translateText("the assistant");
|
|
786
|
-
const reportRunningTurn = () => appEnvironment.reportRunningTurn?.();
|
|
787
|
-
const reportWidgetCrash = (widgetName, error, errorInfo) => {
|
|
788
|
-
appEnvironment.reportWidgetCrash?.(widgetName, error, errorInfo);
|
|
789
|
-
};
|
|
790
|
-
const AgentsEnvironmentContext = createContext(null);
|
|
791
|
-
const NO_SUBTREE_ENVIRONMENT = {};
|
|
792
|
-
const AgentsProvider = (props) => {
|
|
793
|
-
const { environment = NO_SUBTREE_ENVIRONMENT, client, children } = props;
|
|
794
|
-
const environmentTree = /* @__PURE__ */ jsx(AgentsEnvironmentContext.Provider, { value: environment, children });
|
|
795
|
-
return client ? /* @__PURE__ */ jsx(AgentsConversationClientProvider, { client, children: environmentTree }) : environmentTree;
|
|
796
|
-
};
|
|
797
|
-
const useAppEnvironment = () => useSyncExternalStore(subscribeToAgentsEnvironment, getAgentsEnvironment, getAgentsEnvironment);
|
|
798
|
-
const useAgentsComponents = () => {
|
|
799
|
-
const subtreeEnvironment = useContext(AgentsEnvironmentContext);
|
|
800
|
-
const appEnvironment2 = useAppEnvironment();
|
|
801
|
-
return useMemo(
|
|
802
|
-
() => ({ ...DEFAULT_AGENTS_COMPONENTS, ...appEnvironment2.components, ...subtreeEnvironment?.components }),
|
|
803
|
-
[appEnvironment2, subtreeEnvironment]
|
|
804
|
-
);
|
|
805
|
-
};
|
|
806
|
-
const useAgentsTexts = () => {
|
|
807
|
-
const subtreeEnvironment = useContext(AgentsEnvironmentContext);
|
|
808
|
-
const appEnvironment2 = useAppEnvironment();
|
|
809
|
-
return subtreeEnvironment?.texts ?? appEnvironment2.texts ?? DEFAULT_AGENTS_TEXTS;
|
|
810
|
-
};
|
|
811
|
-
const useAgentsEnvironment = () => {
|
|
812
|
-
const subtreeEnvironment = useContext(AgentsEnvironmentContext);
|
|
813
|
-
const appEnvironment2 = useAppEnvironment();
|
|
814
|
-
return useMemo(
|
|
815
|
-
() => subtreeEnvironment ? { ...appEnvironment2, ...subtreeEnvironment } : appEnvironment2,
|
|
816
|
-
[appEnvironment2, subtreeEnvironment]
|
|
817
|
-
);
|
|
818
|
-
};
|
|
819
|
-
const readStateStore = (environment) => environment.stateStore ?? getDefaultAgentsStateStore();
|
|
820
|
-
const useAgentsStateSelector = (selector) => readStateStore(useAgentsEnvironment()).useSelector(selector);
|
|
821
|
-
const useAgentsStateDispatch = () => readStateStore(useAgentsEnvironment()).useDispatch();
|
|
822
|
-
const NO_OWNER_SETTINGS = {};
|
|
823
|
-
const useNoOwnerSettings = () => NO_OWNER_SETTINGS;
|
|
824
|
-
const useAgentsOwnerSettings = () => {
|
|
825
|
-
const useOwnerSettings = useAgentsEnvironment().useOwnerSettings ?? useNoOwnerSettings;
|
|
826
|
-
return useOwnerSettings();
|
|
827
|
-
};
|
|
828
|
-
const useNoActiveAgentSpaceKey = () => void 0;
|
|
829
|
-
const useAgentsActiveAgentSpaceKey = () => {
|
|
830
|
-
const useActiveAgentSpaceKey = useAgentsEnvironment().useActiveAgentSpaceKey ?? useNoActiveAgentSpaceKey;
|
|
831
|
-
return useActiveAgentSpaceKey();
|
|
832
|
-
};
|
|
833
|
-
const NO_MAPS = {
|
|
834
|
-
isLoaded: false,
|
|
835
|
-
loadError: new Error("The agents environment has no maps loader."),
|
|
836
|
-
languageCode: void 0
|
|
837
|
-
};
|
|
838
|
-
const useNoMapsLoader = () => NO_MAPS;
|
|
839
|
-
const useAgentsMapsLoader = () => {
|
|
840
|
-
const useMapsLoader = useAgentsEnvironment().useMapsLoader ?? useNoMapsLoader;
|
|
841
|
-
return useMapsLoader();
|
|
842
|
-
};
|
|
843
|
-
const NO_BUDGET_UPGRADE = { canUpgrade: false, openUpgrade: () => void 0, showsFairUseWording: false };
|
|
844
|
-
const useNoBudgetLimit = () => NO_BUDGET_UPGRADE;
|
|
845
|
-
const useAgentsBudgetLimit = () => {
|
|
846
|
-
const useBudgetLimit = useAgentsEnvironment().useBudgetLimit ?? useNoBudgetLimit;
|
|
847
|
-
return useBudgetLimit();
|
|
848
|
-
};
|
|
849
|
-
const Text = (props) => {
|
|
850
|
-
const { Text: TextComponent } = useAgentsComponents();
|
|
851
|
-
return /* @__PURE__ */ jsx(TextComponent, { ...props });
|
|
852
|
-
};
|
|
853
|
-
const Button = (props) => {
|
|
854
|
-
const { Button: ButtonComponent } = useAgentsComponents();
|
|
855
|
-
return /* @__PURE__ */ jsx(ButtonComponent, { ...props });
|
|
856
|
-
};
|
|
857
|
-
const Icon = (props) => {
|
|
858
|
-
const { Icon: IconComponent } = useAgentsComponents();
|
|
859
|
-
return /* @__PURE__ */ jsx(IconComponent, { ...props });
|
|
860
|
-
};
|
|
861
|
-
const InteractiveSurface = (props) => {
|
|
862
|
-
const { InteractiveSurface: InteractiveSurfaceComponent } = useAgentsComponents();
|
|
863
|
-
return /* @__PURE__ */ jsx(InteractiveSurfaceComponent, { ...props });
|
|
864
|
-
};
|
|
865
|
-
const Skeleton = (props) => {
|
|
866
|
-
const { Skeleton: SkeletonComponent } = useAgentsComponents();
|
|
867
|
-
return /* @__PURE__ */ jsx(SkeletonComponent, { ...props });
|
|
868
|
-
};
|
|
869
|
-
const LoadingSpinner = (props) => {
|
|
870
|
-
const { LoadingSpinner: LoadingSpinnerComponent } = useAgentsComponents();
|
|
871
|
-
return /* @__PURE__ */ jsx(LoadingSpinnerComponent, { ...props });
|
|
872
|
-
};
|
|
873
|
-
const Tooltip = (props) => {
|
|
874
|
-
const { Tooltip: TooltipComponent } = useAgentsComponents();
|
|
875
|
-
return /* @__PURE__ */ jsx(TooltipComponent, { ...props });
|
|
876
|
-
};
|
|
877
|
-
const GlowFrame = (props) => {
|
|
878
|
-
const { GlowFrame: GlowFrameComponent } = useAgentsComponents();
|
|
879
|
-
return /* @__PURE__ */ jsx(GlowFrameComponent, { ...props });
|
|
880
|
-
};
|
|
881
|
-
const ProgressBar = (props) => {
|
|
882
|
-
const { ProgressBar: ProgressBarComponent } = useAgentsComponents();
|
|
883
|
-
return /* @__PURE__ */ jsx(ProgressBarComponent, { ...props });
|
|
884
|
-
};
|
|
885
|
-
const SplitView = (props) => {
|
|
886
|
-
const { SplitView: SplitViewComponent } = useAgentsComponents();
|
|
887
|
-
return /* @__PURE__ */ jsx(SplitViewComponent, { ...props });
|
|
888
|
-
};
|
|
889
|
-
const TrendDelta = (props) => {
|
|
890
|
-
const { TrendDelta: TrendDeltaComponent } = useAgentsComponents();
|
|
891
|
-
return /* @__PURE__ */ jsx(TrendDeltaComponent, { ...props });
|
|
892
|
-
};
|
|
893
|
-
const Checkbox = (props) => {
|
|
894
|
-
const { Checkbox: CheckboxComponent } = useAgentsComponents();
|
|
895
|
-
return /* @__PURE__ */ jsx(CheckboxComponent, { ...props });
|
|
896
|
-
};
|
|
897
|
-
const TextInput = (props) => {
|
|
898
|
-
const { TextInput: TextInputComponent } = useAgentsComponents();
|
|
899
|
-
return /* @__PURE__ */ jsx(TextInputComponent, { ...props });
|
|
900
|
-
};
|
|
901
|
-
const TextArea = (props) => {
|
|
902
|
-
const { TextArea: TextAreaComponent } = useAgentsComponents();
|
|
903
|
-
return /* @__PURE__ */ jsx(TextAreaComponent, { ...props });
|
|
904
|
-
};
|
|
905
|
-
const RangeSlider = (props) => {
|
|
906
|
-
const { RangeSlider: RangeSliderComponent } = useAgentsComponents();
|
|
907
|
-
return /* @__PURE__ */ jsx(RangeSliderComponent, { ...props });
|
|
908
|
-
};
|
|
909
|
-
const DateInput = (props) => {
|
|
910
|
-
const { DateInput: DateInputComponent } = useAgentsComponents();
|
|
911
|
-
return /* @__PURE__ */ jsx(DateInputComponent, { ...props });
|
|
912
|
-
};
|
|
913
|
-
const RadioGroup = (props) => {
|
|
914
|
-
const { RadioGroup: RadioGroupComponent } = useAgentsComponents();
|
|
915
|
-
return /* @__PURE__ */ jsx(RadioGroupComponent, { ...props });
|
|
916
|
-
};
|
|
917
|
-
const Select = (props) => {
|
|
918
|
-
const { Select: SelectComponent } = useAgentsComponents();
|
|
919
|
-
return /* @__PURE__ */ jsx(SelectComponent, { ...props });
|
|
920
|
-
};
|
|
921
|
-
const Tabs = (props) => {
|
|
922
|
-
const { Tabs: TabsComponent } = useAgentsComponents();
|
|
923
|
-
return /* @__PURE__ */ jsx(TabsComponent, { ...props });
|
|
924
|
-
};
|
|
925
|
-
const StatusBadge = (props) => {
|
|
926
|
-
const { StatusBadge: StatusBadgeComponent } = useAgentsComponents();
|
|
927
|
-
return /* @__PURE__ */ jsx(StatusBadgeComponent, { ...props });
|
|
928
|
-
};
|
|
929
|
-
const Map$1 = (props) => {
|
|
930
|
-
const { Map: MapComponent } = useAgentsComponents();
|
|
931
|
-
return /* @__PURE__ */ jsx(MapComponent, { ...props });
|
|
932
|
-
};
|
|
933
|
-
const MapMarker = (props) => {
|
|
934
|
-
const { MapMarker: MapMarkerComponent } = useAgentsComponents();
|
|
935
|
-
return /* @__PURE__ */ jsx(MapMarkerComponent, { ...props });
|
|
936
|
-
};
|
|
937
|
-
const ModalLayer = (props) => {
|
|
938
|
-
const { ModalLayer: ModalLayerComponent } = useAgentsComponents();
|
|
939
|
-
return /* @__PURE__ */ jsx(ModalLayerComponent, { ...props });
|
|
940
|
-
};
|
|
941
|
-
const HeroRow = (props) => {
|
|
942
|
-
const { HeroRow: HeroRowComponent } = useAgentsComponents();
|
|
943
|
-
return /* @__PURE__ */ jsx(HeroRowComponent, { ...props });
|
|
944
|
-
};
|
|
945
|
-
const HeroValue = (props) => {
|
|
946
|
-
const { HeroValue: HeroValueComponent } = useAgentsComponents();
|
|
947
|
-
return /* @__PURE__ */ jsx(HeroValueComponent, { ...props });
|
|
948
|
-
};
|
|
949
|
-
const WidgetText = (props) => {
|
|
950
|
-
const { WidgetText: WidgetTextComponent } = useAgentsComponents();
|
|
951
|
-
return /* @__PURE__ */ jsx(WidgetTextComponent, { ...props });
|
|
952
|
-
};
|
|
953
|
-
const SkeletonText = (props) => {
|
|
954
|
-
const { SkeletonText: SkeletonTextComponent } = useAgentsComponents();
|
|
955
|
-
return /* @__PURE__ */ jsx(SkeletonTextComponent, { ...props });
|
|
956
|
-
};
|
|
957
|
-
const StatusChip = (props) => {
|
|
958
|
-
const { StatusChip: StatusChipComponent } = useAgentsComponents();
|
|
959
|
-
return /* @__PURE__ */ jsx(StatusChipComponent, { ...props });
|
|
960
|
-
};
|
|
961
|
-
const SegmentBar = (props) => {
|
|
962
|
-
const { SegmentBar: SegmentBarComponent } = useAgentsComponents();
|
|
963
|
-
return /* @__PURE__ */ jsx(SegmentBarComponent, { ...props });
|
|
964
|
-
};
|
|
965
|
-
const Markdown = (props) => {
|
|
966
|
-
const { Markdown: MarkdownComponent } = useAgentsComponents();
|
|
967
|
-
return /* @__PURE__ */ jsx(MarkdownComponent, { ...props });
|
|
968
|
-
};
|
|
969
|
-
const WidgetFeatureGate = (props) => {
|
|
970
|
-
const { WidgetFeatureGate: WidgetFeatureGateComponent } = useAgentsComponents();
|
|
971
|
-
return /* @__PURE__ */ jsx(WidgetFeatureGateComponent, { ...props });
|
|
972
|
-
};
|
|
973
|
-
const ConversationSearchResultsList = (props) => {
|
|
974
|
-
const { ConversationSearchResultsList: ConversationSearchResultsListComponent } = useAgentsComponents();
|
|
975
|
-
return /* @__PURE__ */ jsx(ConversationSearchResultsListComponent, { ...props });
|
|
976
|
-
};
|
|
977
6
|
const ConversationWidgetRenderContext = createContext("conversation");
|
|
978
7
|
const useIsEmailWidgetRender = () => useContext(ConversationWidgetRenderContext) === "email";
|
|
979
8
|
const defaultConversationWidgetCallbacks = {
|
|
@@ -1129,6 +158,12 @@ const getRuntime = (key) => {
|
|
|
1129
158
|
}
|
|
1130
159
|
return entry;
|
|
1131
160
|
};
|
|
161
|
+
const abandonWidgetHydrationReads = (keys) => {
|
|
162
|
+
for (const key of keys) {
|
|
163
|
+
runtime.get(key)?.controller?.abort();
|
|
164
|
+
runtime.delete(key);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
1132
167
|
const useWidgetHydration = (type, payload, options2 = {}) => {
|
|
1133
168
|
const { forceRefresh = false, showLastDataWhileRefreshing = false } = options2;
|
|
1134
169
|
const dispatch = useAgentsStateDispatch();
|
|
@@ -1288,6 +323,9 @@ const SkeletonCircle = ({ size, className }) => {
|
|
|
1288
323
|
const SkeletonPill = ({ width = 140, height = 34, className }) => {
|
|
1289
324
|
return /* @__PURE__ */ jsx(Skeleton, { className, style: { width, height, borderRadius: 999, display: "inline-block" } });
|
|
1290
325
|
};
|
|
326
|
+
const SkeletonWidgetLabel = () => {
|
|
327
|
+
return /* @__PURE__ */ jsx(SkeletonLine, { width: 120, height: 10, radius: 4 });
|
|
328
|
+
};
|
|
1291
329
|
const surface = "agents_surface_tMwX2D";
|
|
1292
330
|
const elevated = "agents_elevated_-BbIdM";
|
|
1293
331
|
const flat = "agents_flat_namOKd";
|
|
@@ -2058,8 +1096,27 @@ const parseConceptExplainerPayload = (payload) => {
|
|
|
2058
1096
|
...step !== void 0 ? { step } : {}
|
|
2059
1097
|
};
|
|
2060
1098
|
};
|
|
1099
|
+
const readConceptExplainerNumber = (value) => {
|
|
1100
|
+
if (typeof value === "number") return Number.isFinite(value) ? value : void 0;
|
|
1101
|
+
if (typeof value !== "string") return void 0;
|
|
1102
|
+
const normalized = value.trim().replace(",", ".");
|
|
1103
|
+
if (!/^-?\d+(\.\d+)?$/.test(normalized)) return void 0;
|
|
1104
|
+
const parsedNumber = Number(normalized);
|
|
1105
|
+
return Number.isFinite(parsedNumber) ? parsedNumber : void 0;
|
|
1106
|
+
};
|
|
1107
|
+
const readConceptExplainerValue = (rawValues, aliases) => readFirst(rawValues, aliases);
|
|
2061
1108
|
const readBrowserLanguage = () => typeof navigator === "undefined" ? "en" : navigator.language || "en";
|
|
2062
1109
|
const useConceptExplainerLanguage = () => useAgentsOwnerSettings().languageCode || readBrowserLanguage();
|
|
1110
|
+
const formatConceptExplainerNumber = (value, decimals, languageCode) => {
|
|
1111
|
+
try {
|
|
1112
|
+
return new Intl.NumberFormat(languageCode, {
|
|
1113
|
+
minimumFractionDigits: decimals,
|
|
1114
|
+
maximumFractionDigits: decimals
|
|
1115
|
+
}).format(value);
|
|
1116
|
+
} catch {
|
|
1117
|
+
return value.toFixed(decimals);
|
|
1118
|
+
}
|
|
1119
|
+
};
|
|
2063
1120
|
const ConceptExplainerTextView = (props) => {
|
|
2064
1121
|
const { text: text2, ...textProps } = props;
|
|
2065
1122
|
return /* @__PURE__ */ jsx(Text, { ...textProps, replacements: text2.replacements, context: text2.context, children: text2.key });
|
|
@@ -4488,6 +3545,23 @@ const normalizeSearchHitExcerpt = (rawExcerpt) => {
|
|
|
4488
3545
|
}
|
|
4489
3546
|
return readTextFromJsonExcerpt(trimmedExcerpt) ?? rawExcerpt;
|
|
4490
3547
|
};
|
|
3548
|
+
const SAFE_ALIAS = /^[a-z0-9_-]+$/i;
|
|
3549
|
+
const pickAllowed = (values, allowed) => {
|
|
3550
|
+
if (!Array.isArray(values)) return void 0;
|
|
3551
|
+
const filtered = values.filter(
|
|
3552
|
+
(v) => typeof v === "string" && allowed.includes(v)
|
|
3553
|
+
);
|
|
3554
|
+
return filtered.length ? filtered : void 0;
|
|
3555
|
+
};
|
|
3556
|
+
const pickAllowedValue = (value, allowed) => typeof value === "string" && allowed.includes(value) ? value : void 0;
|
|
3557
|
+
const pickSafeAliases = (values) => {
|
|
3558
|
+
if (!Array.isArray(values)) return void 0;
|
|
3559
|
+
const filtered = values.filter((v) => typeof v === "string" && SAFE_ALIAS.test(v));
|
|
3560
|
+
return filtered.length ? filtered : void 0;
|
|
3561
|
+
};
|
|
3562
|
+
const pickSafeAlias = (value) => typeof value === "string" && SAFE_ALIAS.test(value) ? value : void 0;
|
|
3563
|
+
const OPAQUE_PATH_SEGMENT_ID_TOKEN = /^[A-Za-z0-9_\-+/=]+$/;
|
|
3564
|
+
const pickReviewExternalId = (value) => typeof value === "string" && value.length > 0 && OPAQUE_PATH_SEGMENT_ID_TOKEN.test(value) ? value : void 0;
|
|
4491
3565
|
const pickText = (value, maxLength = 2e3) => typeof value === "string" && value.length > 0 ? value.slice(0, maxLength) : void 0;
|
|
4492
3566
|
const MAX_GROUPS = 20;
|
|
4493
3567
|
const MAX_HITS_PER_GROUP = 6;
|
|
@@ -4905,155 +3979,103 @@ const WebSearchResultsConversationWidget = (props) => {
|
|
|
4905
3979
|
);
|
|
4906
3980
|
};
|
|
4907
3981
|
export {
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
WebSearchAnswer as b6,
|
|
5009
|
-
WebSearchSourcesList as b7,
|
|
5010
|
-
parseWebSearchResultsPayload as b8,
|
|
5011
|
-
ENTITY_MENTION_WIDGET_NAME as b9,
|
|
5012
|
-
buildEntityMentionFields as ba,
|
|
5013
|
-
normalizeEntityMentionFields as bb,
|
|
5014
|
-
entityMentionKey as bc,
|
|
5015
|
-
MAX_ENTITY_MENTIONS_PER_MESSAGE as bd,
|
|
5016
|
-
toEntityMentionWireFields as be,
|
|
5017
|
-
useIsEmailWidgetRender as bf,
|
|
5018
|
-
ConversationWidgetButton as bg,
|
|
5019
|
-
CANVAS_VIABLE_MIN_WIDTH as bh,
|
|
5020
|
-
listWidgetHydratorTypes as bi,
|
|
5021
|
-
unregisterWidgetHydrator as bj,
|
|
5022
|
-
useCanvasViable as bk,
|
|
5023
|
-
readTextNodeContent as bl,
|
|
5024
|
-
readAllowedValue as bm,
|
|
5025
|
-
ModelText as bn,
|
|
5026
|
-
DonePill as bo,
|
|
5027
|
-
ConversationWidgetActions as bp,
|
|
5028
|
-
useReportTextNodeRenderState as bq,
|
|
5029
|
-
readTextNodeRenderState as br,
|
|
5030
|
-
SkeletonPill as bs,
|
|
5031
|
-
buildFaviconUrl as bt,
|
|
5032
|
-
readSiteHostname as bu,
|
|
5033
|
-
readSafeHttpUrl as bv,
|
|
5034
|
-
DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME as c,
|
|
5035
|
-
DateInput as d,
|
|
5036
|
-
HeroValue as e,
|
|
5037
|
-
InteractiveSurface as f,
|
|
5038
|
-
MapMarker as g,
|
|
5039
|
-
Markdown as h,
|
|
5040
|
-
ModalLayer as i,
|
|
5041
|
-
RangeSlider as j,
|
|
5042
|
-
Select as k,
|
|
5043
|
-
Skeleton as l,
|
|
5044
|
-
SkeletonText as m,
|
|
5045
|
-
SplitView as n,
|
|
5046
|
-
StatusBadge as o,
|
|
5047
|
-
StatusChip as p,
|
|
5048
|
-
Text as q,
|
|
5049
|
-
TextArea as r,
|
|
5050
|
-
TextInput as s,
|
|
5051
|
-
Tooltip as t,
|
|
5052
|
-
TrendDelta as u,
|
|
5053
|
-
WidgetText as v,
|
|
5054
|
-
appendAnotherAgentSpaceToOwnerText as w,
|
|
5055
|
-
buildUnnamedAgentSpaceLabel as x,
|
|
5056
|
-
buildWidgetOfAnotherAgentSpaceExplanation as y,
|
|
5057
|
-
classNames as z
|
|
5058
|
-
};
|
|
5059
|
-
//# sourceMappingURL=WebSearchResultsConversationWidget-BvnLWHyi.js.map
|
|
3982
|
+
ConceptExplainerConversationWidget as $,
|
|
3983
|
+
readWidgetAgentSpaceKeyAttribute as A,
|
|
3984
|
+
sameCanvasAnchor as B,
|
|
3985
|
+
ConversationWidgetActions as C,
|
|
3986
|
+
shortStringHash as D,
|
|
3987
|
+
useConversationWidgetContext as E,
|
|
3988
|
+
useIsEmailWidgetRender as F,
|
|
3989
|
+
useReportWidgetRenderStatus as G,
|
|
3990
|
+
useWidgetHydration as H,
|
|
3991
|
+
useWidgetMemory as I,
|
|
3992
|
+
useWidgetRenderReporter as J,
|
|
3993
|
+
WidgetImageReadinessContext as K,
|
|
3994
|
+
WidgetImageRenderContext as L,
|
|
3995
|
+
ModelText as M,
|
|
3996
|
+
WidgetImageLiveHydrationContext as N,
|
|
3997
|
+
readFrozenHydration as O,
|
|
3998
|
+
useWidgetImageLiveHydration as P,
|
|
3999
|
+
useWidgetImageRender as Q,
|
|
4000
|
+
ReadOnlyConversationWidgetProvider as R,
|
|
4001
|
+
StandaloneConversationWidgetProvider as S,
|
|
4002
|
+
CANVAS_VIABLE_MIN_WIDTH as T,
|
|
4003
|
+
WidgetSurface as U,
|
|
4004
|
+
SkeletonCircle as V,
|
|
4005
|
+
WidgetRenderReportContext as W,
|
|
4006
|
+
SkeletonLine as X,
|
|
4007
|
+
CanvasWidgetCard as Y,
|
|
4008
|
+
CanvasWidgetSwitch as Z,
|
|
4009
|
+
ClockConversationWidget as _,
|
|
4010
|
+
registerConceptExplainerTypes as a,
|
|
4011
|
+
ConversationSearchResultsConversationWidget as a0,
|
|
4012
|
+
CurrencyConverterConversationWidget as a1,
|
|
4013
|
+
CustomVisualizationConversationWidget as a2,
|
|
4014
|
+
DonePill as a3,
|
|
4015
|
+
EntityMentionConversationWidget as a4,
|
|
4016
|
+
MultiChoiceConversationWidget as a5,
|
|
4017
|
+
QuickRepliesConversationWidget as a6,
|
|
4018
|
+
SkeletonPill as a7,
|
|
4019
|
+
SkeletonWidgetLabel as a8,
|
|
4020
|
+
SuggestedActions as a9,
|
|
4021
|
+
ConversationWidgetButton as aA,
|
|
4022
|
+
readTextNodeContent as aB,
|
|
4023
|
+
readAllowedValue as aC,
|
|
4024
|
+
useReportTextNodeRenderState as aD,
|
|
4025
|
+
readTextNodeRenderState as aE,
|
|
4026
|
+
buildFaviconUrl as aF,
|
|
4027
|
+
readSiteHostname as aG,
|
|
4028
|
+
readSafeHttpUrl as aH,
|
|
4029
|
+
ToolTraceConversationWidget as aa,
|
|
4030
|
+
WebSearchResultsConversationWidget as ab,
|
|
4031
|
+
WidgetKpiValue as ac,
|
|
4032
|
+
WritingDraftConversationWidget as ad,
|
|
4033
|
+
canvasForMessageWidget as ae,
|
|
4034
|
+
formatConceptExplainerNumber as af,
|
|
4035
|
+
normalizeSearchHitExcerpt as ag,
|
|
4036
|
+
pickAllowed as ah,
|
|
4037
|
+
pickAllowedValue as ai,
|
|
4038
|
+
pickReviewExternalId as aj,
|
|
4039
|
+
pickSafeAlias as ak,
|
|
4040
|
+
pickSafeAliases as al,
|
|
4041
|
+
pickText as am,
|
|
4042
|
+
readConceptExplainerNumber as an,
|
|
4043
|
+
readConceptExplainerValue as ao,
|
|
4044
|
+
useCanvasViable as ap,
|
|
4045
|
+
parseConversationSearchResultsPayload as aq,
|
|
4046
|
+
WebSearchAnswer as ar,
|
|
4047
|
+
WebSearchSourcesList as as,
|
|
4048
|
+
parseWebSearchResultsPayload as at,
|
|
4049
|
+
ENTITY_MENTION_WIDGET_NAME as au,
|
|
4050
|
+
buildEntityMentionFields as av,
|
|
4051
|
+
normalizeEntityMentionFields as aw,
|
|
4052
|
+
entityMentionKey as ax,
|
|
4053
|
+
MAX_ENTITY_MENTIONS_PER_MESSAGE as ay,
|
|
4054
|
+
toEntityMentionWireFields as az,
|
|
4055
|
+
registerWidgetHydrator as b,
|
|
4056
|
+
abandonWidgetHydrationReads as c,
|
|
4057
|
+
useResolvedConversationWidgetAgentSpaceKey as d,
|
|
4058
|
+
ConversationWidgetAgentSpaceFrame as e,
|
|
4059
|
+
ConversationWidgetAgentSpaceHeader as f,
|
|
4060
|
+
getWidgetHydrator as g,
|
|
4061
|
+
ConversationWidgetContext as h,
|
|
4062
|
+
ConversationWidgetRenderContext as i,
|
|
4063
|
+
buildWidgetAgentSpaceKeyProps as j,
|
|
4064
|
+
canvasInstanceIdForActiveAgentSpace as k,
|
|
4065
|
+
listWidgetHydratorTypes as l,
|
|
4066
|
+
canvasInstanceIdForAgentSpace as m,
|
|
4067
|
+
canvasInstanceIdForEntity as n,
|
|
4068
|
+
canvasInstanceIdForMessage as o,
|
|
4069
|
+
payloadHashOfInstanceId as p,
|
|
4070
|
+
canvasInstanceIdForMessagePayload as q,
|
|
4071
|
+
readConceptExplainerTypeDefinitions as r,
|
|
4072
|
+
sameCanvasIdentity as s,
|
|
4073
|
+
defaultConversationWidgetCallbacks as t,
|
|
4074
|
+
unregisterWidgetHydrator as u,
|
|
4075
|
+
entityIdOfInstanceId as v,
|
|
4076
|
+
hasWidgetHydrator as w,
|
|
4077
|
+
isCanvasAnchorLoaded as x,
|
|
4078
|
+
messageAnchor as y,
|
|
4079
|
+
pageAnchor as z
|
|
4080
|
+
};
|
|
4081
|
+
//# sourceMappingURL=WebSearchResultsConversationWidget-as3p5bHw.js.map
|