@inkeep/agents-ui 0.0.0-dev-20260508233535 → 0.0.0-dev-20260509021601

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.
Files changed (35) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +161 -158
  3. package/dist/primitives/components/embedded-chat/use-chat-action.cjs +1 -1
  4. package/dist/primitives/components/embedded-chat/use-chat-action.js +16 -14
  5. package/dist/primitives/components/embedded-chat/use-inkeep-chat.cjs +2 -2
  6. package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +230 -219
  7. package/dist/primitives/components/embedded-chat.cjs +3 -3
  8. package/dist/primitives/components/embedded-chat.js +96 -93
  9. package/dist/primitives/hooks/use-events-api.cjs +1 -0
  10. package/dist/primitives/hooks/use-events-api.d.ts +29 -0
  11. package/dist/primitives/hooks/use-events-api.js +44 -0
  12. package/dist/primitives/index.cjs +1 -1
  13. package/dist/primitives/index.js +150 -147
  14. package/dist/primitives/providers/base-events-provider.cjs +1 -1
  15. package/dist/primitives/providers/base-events-provider.d.ts +2 -0
  16. package/dist/primitives/providers/base-events-provider.js +6 -5
  17. package/dist/primitives/providers/chat-base-events-provider.cjs +1 -0
  18. package/dist/primitives/providers/chat-base-events-provider.d.ts +12 -0
  19. package/dist/primitives/providers/chat-base-events-provider.js +68 -0
  20. package/dist/primitives/providers/feedback-provider.cjs +1 -1
  21. package/dist/primitives/providers/feedback-provider.js +13 -12
  22. package/dist/primitives/providers/index.cjs +1 -1
  23. package/dist/primitives/providers/index.d.ts +1 -0
  24. package/dist/primitives/providers/index.js +57 -54
  25. package/dist/react/embedded-chat.cjs +1 -1
  26. package/dist/react/embedded-chat.js +96 -95
  27. package/dist/react/index.cjs +1 -1
  28. package/dist/react/index.js +161 -158
  29. package/dist/styled/components/message.cjs +1 -1
  30. package/dist/styled/components/message.js +77 -74
  31. package/dist/styled/index.cjs +1 -1
  32. package/dist/styled/index.js +151 -148
  33. package/dist/types/config/ai.d.ts +5 -0
  34. package/dist/types/events.d.ts +11 -0
  35. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { InkeepEmbeddedChat as S, InkeepEmbeddedChatImpl as c, InkeepEmbeddedChatImplContent as P, InkeepEmbeddedChatProvider as v } from "./embedded-chat.js";
2
- import { InkeepSidebarChat as M } from "./sidebar-chat.js";
1
+ import { InkeepEmbeddedChat as S, InkeepEmbeddedChatImpl as c, InkeepEmbeddedChatImplContent as v, InkeepEmbeddedChatProvider as P } from "./embedded-chat.js";
2
+ import { InkeepSidebarChat as B } from "./sidebar-chat.js";
3
3
  import { InkeepEmbeddedSearchAndChat as g, InkeepEmbeddedSearchAndChatImpl as E } from "./embedded-search-and-chat.js";
4
4
  import { InkeepEmbeddedSearch as F, InkeepEmbeddedSearchImpl as H, InkeepEmbeddedSearchImplContent as w, InkeepEmbeddedSearchProvider as A } from "./embedded-search.js";
5
5
  import { InkeepModalChat as R } from "./modal.chat.js";
@@ -22,90 +22,93 @@ import { LoadingIndicator as _ } from "../styled/components/loading-indicator.js
22
22
  import { widgetToggle as oe } from "../styled/components/ui/recipes/widget-toggle.js";
23
23
  import { DefaultToolComponent as te, EmbeddedChatMessagePart as ae } from "../styled/components/message.js";
24
24
  import { DataSummaryGroup as de } from "../styled/components/data-summary-group.js";
25
- import { BaseEventsProvider as se, useBaseEvents as ie } from "../primitives/providers/base-events-provider.js";
26
- import { ChatAuthProvider as Ce, useChatAuth as he } from "../primitives/providers/chat-auth-provider.js";
27
- import { ChatFormProvider as xe, useChatForm as ue, useChatFormState as le } from "../primitives/providers/chat-form-provider.js";
28
- import { ChatHistoryProvider as be, useChatHistory as Se } from "../primitives/providers/chat-history-provider.js";
29
- import { InkeepConfigProvider as Pe, WebWidgetInteractionType as ve, useInkeepConfig as ke } from "../primitives/providers/config-provider.js";
30
- import { FeedbackProvider as Be, useMessageFeedback as ge } from "../primitives/providers/feedback-provider.js";
31
- import { FormFieldProvider as ye, useFormField as Fe } from "../primitives/providers/form-field-provider.js";
32
- import { HelpMenuProvider as we, useHelpMenu as Ae, useHelpMenuState as De } from "../primitives/providers/help-menu-provider.js";
33
- import { ChatMarkdownProvider as $e, useChatMarkdown as Te } from "../primitives/providers/markdown-provider.js";
34
- import { MessageProvider as We, useMessage as ze, useOptionalMessage as Le } from "../primitives/providers/message-provider.js";
35
- import { RootProvider as Ge } from "../primitives/providers/root-provider.js";
36
- import { SourceItemProvider as Ne, useSourceItem as Qe } from "../primitives/providers/source-item-provider.js";
37
- import { ThemeProvider as Ve } from "../primitives/providers/theme-provider.js";
38
- import { WidgetProvider as Je, useWidget as Xe } from "../primitives/providers/widget-provider.js";
39
- import { SidebarChatProvider as Ze, useInkeepSidebarChat as _e, useOptionalSidebarChat as eo, useSidebarChat as oo } from "../primitives/providers/sidebar-chat-provider.js";
40
- import { ChatBubbleProvider as to, useChatBubble as ao, useInkeepChatBubble as mo, useOptionalChatBubble as po } from "../primitives/providers/chat-bubble-provider.js";
41
- import { ikp as io, jsxFactory as no } from "../primitives/components/factory.js";
25
+ import { BaseEventsContext as se, BaseEventsProvider as ie, useBaseEvents as ne } from "../primitives/providers/base-events-provider.js";
26
+ import { ChatAuthProvider as he, useChatAuth as fe } from "../primitives/providers/chat-auth-provider.js";
27
+ import { ChatBaseEventsProvider as ue } from "../primitives/providers/chat-base-events-provider.js";
28
+ import { ChatFormProvider as Ie, useChatForm as be, useChatFormState as Se } from "../primitives/providers/chat-form-provider.js";
29
+ import { ChatHistoryProvider as ve, useChatHistory as Pe } from "../primitives/providers/chat-history-provider.js";
30
+ import { InkeepConfigProvider as Be, WebWidgetInteractionType as Me, useInkeepConfig as ge } from "../primitives/providers/config-provider.js";
31
+ import { FeedbackProvider as ye, useMessageFeedback as Fe } from "../primitives/providers/feedback-provider.js";
32
+ import { FormFieldProvider as we, useFormField as Ae } from "../primitives/providers/form-field-provider.js";
33
+ import { HelpMenuProvider as Re, useHelpMenu as $e, useHelpMenuState as Te } from "../primitives/providers/help-menu-provider.js";
34
+ import { ChatMarkdownProvider as We, useChatMarkdown as ze } from "../primitives/providers/markdown-provider.js";
35
+ import { MessageProvider as je, useMessage as Ge, useOptionalMessage as Ke } from "../primitives/providers/message-provider.js";
36
+ import { RootProvider as Qe } from "../primitives/providers/root-provider.js";
37
+ import { SourceItemProvider as Ve, useSourceItem as qe } from "../primitives/providers/source-item-provider.js";
38
+ import { ThemeProvider as Xe } from "../primitives/providers/theme-provider.js";
39
+ import { WidgetProvider as Ze, useWidget as _e } from "../primitives/providers/widget-provider.js";
40
+ import { SidebarChatProvider as oo, useInkeepSidebarChat as ro, useOptionalSidebarChat as to, useSidebarChat as ao } from "../primitives/providers/sidebar-chat-provider.js";
41
+ import { ChatBubbleProvider as po, useChatBubble as so, useInkeepChatBubble as io, useOptionalChatBubble as no } from "../primitives/providers/chat-bubble-provider.js";
42
+ import { ikp as ho, jsxFactory as fo } from "../primitives/components/factory.js";
42
43
  import * as s from "../primitives/components/embedded-chat.js";
43
44
  import * as i from "../primitives/components/sidebar-chat/index.js";
44
- import { ChatProvider as ho, useChat as fo } from "../primitives/components/embedded-chat/chat-provider.js";
45
+ import { ChatProvider as uo, useChat as lo } from "../primitives/components/embedded-chat/chat-provider.js";
45
46
  import * as n from "../primitives/components/embedded-search.js";
46
- import { SearchProvider as uo, SearchProviderImpl as lo, useSearch as Io } from "../primitives/components/embedded-search/search-provider.js";
47
+ import { SearchProvider as bo, SearchProviderImpl as So, useSearch as co } from "../primitives/components/embedded-search/search-provider.js";
47
48
  import * as C from "../primitives/components/modal.js";
48
- import { ModalProvider as So, useModal as co } from "../primitives/components/modal/modal-provider.js";
49
+ import { ModalProvider as Po, useModal as ko } from "../primitives/components/modal/modal-provider.js";
49
50
  import * as h from "../primitives/components/chat-button.js";
50
51
  import * as f from "../primitives/components/searchbar.js";
51
52
  import * as x from "../primitives/components/chat-bubble/index.js";
52
53
  import * as u from "../primitives/components/data-summaries.js";
53
54
  import * as l from "../primitives/components/chat-history/index.js";
54
- import { useBoolean as vo } from "../primitives/hooks/use-boolean.js";
55
- import { useComponentClassNames as Mo } from "../primitives/hooks/use-component-classnames.js";
56
- import { useContainerSize as go } from "../primitives/hooks/use-container-size.js";
57
- import { useInkeepOpenState as yo } from "../primitives/hooks/use-inkeep-open-state.js";
58
- import { useCopyToClipboard as Ho } from "../primitives/hooks/use-copy-to-clipboard.js";
59
- import { useInstantUpdate as Ao } from "../primitives/hooks/use-instant-update.js";
60
- import { useIsMounted as Ro } from "../primitives/hooks/use-is-mounted.js";
61
- import { useMediaQuery as To } from "../primitives/hooks/use-media-query.js";
62
- import { useResizeObserver as Wo } from "../primitives/hooks/use-resize-observer.js";
63
- import { useScrollingFades as Lo, useScrollingFadesHorizontal as jo } from "../primitives/hooks/use-scrolling-fades.js";
64
- import { useSettleAction as Ko } from "../primitives/hooks/use-settle-action.js";
65
- import { useSimpleScroll as Qo } from "../primitives/hooks/use-simple-scroll.js";
66
- import { callAll as Vo, dataAttr as qo, getInitials as Jo, getMessageContent as Xo, isCitationArtifact as Yo, isString as Zo, maybeRender as _o, toKebabCase as er } from "../primitives/utils/misc.js";
67
- import { ChatBubbleComponentIds as rr, DataSummaryComponentIds as tr, SearchBarComponentIds as ar, SidebarChatComponentIds as mr, aiChatComponentIds as dr, aiChatHistoryComponentIds as pr, aiSearchComponentIds as sr, chatButtonComponentIds as ir, componentIDs as nr, markDownComponentIds as Cr, miscellanousComponentIds as hr, modalComponentIds as fr } from "../primitives/utils/component-ids.js";
68
- import { composeRefs as ur, useComposedRefs as lr } from "../primitives/utils/compose-refs.js";
69
- import { mergeProps as br } from "../primitives/utils/merge-props.js";
70
- import { Portal as cr } from "../primitives/atoms/portal.js";
71
- import { CustomIcon as vr } from "../primitives/atoms/icons/custom-icon.js";
72
- import { BuiltInIconRenderer as Mr } from "../primitives/atoms/icons/built-in-icon-renderer.js";
73
- import { PortalWithTheme as gr } from "../primitives/atoms/portal-with-theme.js";
74
- import { Command as yr, CommandDialog as Fr, CommandEmpty as Hr, CommandInput as wr, CommandItem as Ar, CommandList as Dr, CommandLoading as Rr, CommandRoot as $r, CommandSeparator as Tr, defaultFilter as Or, useCommandState as Wr, useCommandStore as zr } from "../primitives/atoms/cmdk/index.js";
75
- import { ErrorBoundary as jr } from "../primitives/atoms/error-boundary.js";
76
- import { ColorMode as Kr, ColorModeProvider as Nr, DarkModeProvider as Qr, useColorMode as Ur, useColorModeValue as Vr } from "../color-mode/index.js";
77
- import { InkeepShadow as Jr, InkeepShadowProvider as Xr, ShadowContext as Yr, useShadow as Zr } from "../primitives/atoms/shadow/context.js";
55
+ import { useBoolean as Mo } from "../primitives/hooks/use-boolean.js";
56
+ import { useComponentClassNames as Eo } from "../primitives/hooks/use-component-classnames.js";
57
+ import { useContainerSize as Fo } from "../primitives/hooks/use-container-size.js";
58
+ import { useInkeepOpenState as wo } from "../primitives/hooks/use-inkeep-open-state.js";
59
+ import { useCopyToClipboard as Do } from "../primitives/hooks/use-copy-to-clipboard.js";
60
+ import { useInstantUpdate as $o } from "../primitives/hooks/use-instant-update.js";
61
+ import { useIsMounted as Oo } from "../primitives/hooks/use-is-mounted.js";
62
+ import { useMediaQuery as zo } from "../primitives/hooks/use-media-query.js";
63
+ import { useResizeObserver as jo } from "../primitives/hooks/use-resize-observer.js";
64
+ import { useScrollingFades as Ko, useScrollingFadesHorizontal as No } from "../primitives/hooks/use-scrolling-fades.js";
65
+ import { useSettleAction as Uo } from "../primitives/hooks/use-settle-action.js";
66
+ import { useSimpleScroll as qo } from "../primitives/hooks/use-simple-scroll.js";
67
+ import { callAll as Xo, dataAttr as Yo, getInitials as Zo, getMessageContent as _o, isCitationArtifact as er, isString as or, maybeRender as rr, toKebabCase as tr } from "../primitives/utils/misc.js";
68
+ import { ChatBubbleComponentIds as mr, DataSummaryComponentIds as dr, SearchBarComponentIds as pr, SidebarChatComponentIds as sr, aiChatComponentIds as ir, aiChatHistoryComponentIds as nr, aiSearchComponentIds as Cr, chatButtonComponentIds as hr, componentIDs as fr, markDownComponentIds as xr, miscellanousComponentIds as ur, modalComponentIds as lr } from "../primitives/utils/component-ids.js";
69
+ import { composeRefs as br, useComposedRefs as Sr } from "../primitives/utils/compose-refs.js";
70
+ import { mergeProps as vr } from "../primitives/utils/merge-props.js";
71
+ import { Portal as kr } from "../primitives/atoms/portal.js";
72
+ import { CustomIcon as Mr } from "../primitives/atoms/icons/custom-icon.js";
73
+ import { BuiltInIconRenderer as Er } from "../primitives/atoms/icons/built-in-icon-renderer.js";
74
+ import { PortalWithTheme as Fr } from "../primitives/atoms/portal-with-theme.js";
75
+ import { Command as wr, CommandDialog as Ar, CommandEmpty as Dr, CommandInput as Rr, CommandItem as $r, CommandList as Tr, CommandLoading as Or, CommandRoot as Wr, CommandSeparator as zr, defaultFilter as Lr, useCommandState as jr, useCommandStore as Gr } from "../primitives/atoms/cmdk/index.js";
76
+ import { ErrorBoundary as Nr } from "../primitives/atoms/error-boundary.js";
77
+ import { ColorMode as Ur, ColorModeProvider as Vr, DarkModeProvider as qr, useColorMode as Jr, useColorModeValue as Xr } from "../color-mode/index.js";
78
+ import { InkeepShadow as Zr, InkeepShadowProvider as _r, ShadowContext as et, useShadow as ot } from "../primitives/atoms/shadow/context.js";
78
79
  export {
79
- se as BaseEventsProvider,
80
- Mr as BuiltInIconRenderer,
81
- Ce as ChatAuthProvider,
80
+ se as BaseEventsContext,
81
+ ie as BaseEventsProvider,
82
+ Er as BuiltInIconRenderer,
83
+ he as ChatAuthProvider,
84
+ ue as ChatBaseEventsProvider,
82
85
  t as ChatBubble,
83
- rr as ChatBubbleComponentIds,
86
+ mr as ChatBubbleComponentIds,
84
87
  x as ChatBubblePrimitive,
85
- to as ChatBubbleProvider,
88
+ po as ChatBubbleProvider,
86
89
  d as ChatButton,
87
90
  K as ChatButtonImpl,
88
91
  h as ChatButtonPrimitive,
89
- xe as ChatFormProvider,
92
+ Ie as ChatFormProvider,
90
93
  o as ChatHistory,
91
94
  l as ChatHistoryPrimitive,
92
- be as ChatHistoryProvider,
93
- $e as ChatMarkdownProvider,
94
- ho as ChatProvider,
95
- Kr as ColorMode,
96
- Nr as ColorModeProvider,
97
- yr as Command,
98
- Fr as CommandDialog,
99
- Hr as CommandEmpty,
100
- wr as CommandInput,
101
- Ar as CommandItem,
102
- Dr as CommandList,
103
- Rr as CommandLoading,
104
- $r as CommandRoot,
105
- Tr as CommandSeparator,
106
- vr as CustomIcon,
107
- Qr as DarkModeProvider,
108
- tr as DataSummaryComponentIds,
95
+ ve as ChatHistoryProvider,
96
+ We as ChatMarkdownProvider,
97
+ uo as ChatProvider,
98
+ Ur as ColorMode,
99
+ Vr as ColorModeProvider,
100
+ wr as Command,
101
+ Ar as CommandDialog,
102
+ Dr as CommandEmpty,
103
+ Rr as CommandInput,
104
+ $r as CommandItem,
105
+ Tr as CommandList,
106
+ Or as CommandLoading,
107
+ Wr as CommandRoot,
108
+ zr as CommandSeparator,
109
+ Mr as CustomIcon,
110
+ qr as DarkModeProvider,
111
+ dr as DataSummaryComponentIds,
109
112
  de as DataSummaryGroup,
110
113
  u as DataSummaryPrimitive,
111
114
  te as DefaultToolComponent,
@@ -114,17 +117,17 @@ export {
114
117
  s as EmbeddedChatPrimitive,
115
118
  a as EmbeddedSearch,
116
119
  n as EmbeddedSearchPrimitive,
117
- jr as ErrorBoundary,
118
- Be as FeedbackProvider,
119
- ye as FormFieldProvider,
120
- we as HelpMenuProvider,
120
+ Nr as ErrorBoundary,
121
+ ye as FeedbackProvider,
122
+ we as FormFieldProvider,
123
+ Re as HelpMenuProvider,
121
124
  N as InkeepChatButton,
122
125
  U as InkeepChatButtonModal,
123
- Pe as InkeepConfigProvider,
126
+ Be as InkeepConfigProvider,
124
127
  S as InkeepEmbeddedChat,
125
128
  c as InkeepEmbeddedChatImpl,
126
- P as InkeepEmbeddedChatImplContent,
127
- v as InkeepEmbeddedChatProvider,
129
+ v as InkeepEmbeddedChatImplContent,
130
+ P as InkeepEmbeddedChatProvider,
128
131
  F as InkeepEmbeddedSearch,
129
132
  g as InkeepEmbeddedSearchAndChat,
130
133
  E as InkeepEmbeddedSearchAndChatImpl,
@@ -136,97 +139,97 @@ export {
136
139
  W as InkeepModalSearch,
137
140
  T as InkeepModalSearchAndChat,
138
141
  q as InkeepSearchBar,
139
- Jr as InkeepShadow,
140
- Xr as InkeepShadowProvider,
141
- M as InkeepSidebarChat,
142
+ Zr as InkeepShadow,
143
+ _r as InkeepShadowProvider,
144
+ B as InkeepSidebarChat,
142
145
  _ as LoadingIndicator,
143
- We as MessageProvider,
146
+ je as MessageProvider,
144
147
  m as Modal,
145
148
  j as ModalContent,
146
149
  C as ModalPrimitive,
147
- So as ModalProvider,
148
- cr as Portal,
149
- gr as PortalWithTheme,
150
- Ge as RootProvider,
150
+ Po as ModalProvider,
151
+ kr as Portal,
152
+ Fr as PortalWithTheme,
153
+ Qe as RootProvider,
151
154
  p as SearchBar,
152
- ar as SearchBarComponentIds,
155
+ pr as SearchBarComponentIds,
153
156
  J as SearchBarImpl,
154
157
  f as SearchBarPrimitive,
155
- uo as SearchProvider,
156
- lo as SearchProviderImpl,
158
+ bo as SearchProvider,
159
+ So as SearchProviderImpl,
157
160
  Y as Shadow,
158
- Yr as ShadowContext,
161
+ et as ShadowContext,
159
162
  r as SidebarChat,
160
- mr as SidebarChatComponentIds,
163
+ sr as SidebarChatComponentIds,
161
164
  i as SidebarChatPrimitive,
162
- Ze as SidebarChatProvider,
163
- Ne as SourceItemProvider,
164
- Ve as ThemeProvider,
165
- ve as WebWidgetInteractionType,
166
- Je as WidgetProvider,
167
- dr as aiChatComponentIds,
168
- pr as aiChatHistoryComponentIds,
169
- sr as aiSearchComponentIds,
170
- Vo as callAll,
171
- ir as chatButtonComponentIds,
172
- nr as componentIDs,
173
- ur as composeRefs,
174
- qo as dataAttr,
175
- Or as defaultFilter,
176
- Jo as getInitials,
177
- Xo as getMessageContent,
178
- io as ikp,
179
- Yo as isCitationArtifact,
180
- Zo as isString,
181
- no as jsxFactory,
182
- Cr as markDownComponentIds,
183
- _o as maybeRender,
184
- br as mergeProps,
185
- hr as miscellanousComponentIds,
186
- fr as modalComponentIds,
187
- er as toKebabCase,
188
- ie as useBaseEvents,
189
- vo as useBoolean,
190
- fo as useChat,
191
- he as useChatAuth,
192
- ao as useChatBubble,
193
- ue as useChatForm,
194
- le as useChatFormState,
195
- Se as useChatHistory,
196
- Te as useChatMarkdown,
197
- Ur as useColorMode,
198
- Vr as useColorModeValue,
199
- Wr as useCommandState,
200
- zr as useCommandStore,
201
- Mo as useComponentClassNames,
202
- lr as useComposedRefs,
203
- go as useContainerSize,
204
- Ho as useCopyToClipboard,
205
- Fe as useFormField,
206
- Ae as useHelpMenu,
207
- De as useHelpMenuState,
208
- mo as useInkeepChatBubble,
209
- ke as useInkeepConfig,
210
- yo as useInkeepOpenState,
211
- _e as useInkeepSidebarChat,
212
- Ao as useInstantUpdate,
213
- Ro as useIsMounted,
214
- To as useMediaQuery,
215
- ze as useMessage,
216
- ge as useMessageFeedback,
217
- co as useModal,
218
- po as useOptionalChatBubble,
219
- Le as useOptionalMessage,
220
- eo as useOptionalSidebarChat,
221
- Wo as useResizeObserver,
222
- Lo as useScrollingFades,
223
- jo as useScrollingFadesHorizontal,
224
- Io as useSearch,
225
- Ko as useSettleAction,
226
- Zr as useShadow,
227
- oo as useSidebarChat,
228
- Qo as useSimpleScroll,
229
- Qe as useSourceItem,
230
- Xe as useWidget,
165
+ oo as SidebarChatProvider,
166
+ Ve as SourceItemProvider,
167
+ Xe as ThemeProvider,
168
+ Me as WebWidgetInteractionType,
169
+ Ze as WidgetProvider,
170
+ ir as aiChatComponentIds,
171
+ nr as aiChatHistoryComponentIds,
172
+ Cr as aiSearchComponentIds,
173
+ Xo as callAll,
174
+ hr as chatButtonComponentIds,
175
+ fr as componentIDs,
176
+ br as composeRefs,
177
+ Yo as dataAttr,
178
+ Lr as defaultFilter,
179
+ Zo as getInitials,
180
+ _o as getMessageContent,
181
+ ho as ikp,
182
+ er as isCitationArtifact,
183
+ or as isString,
184
+ fo as jsxFactory,
185
+ xr as markDownComponentIds,
186
+ rr as maybeRender,
187
+ vr as mergeProps,
188
+ ur as miscellanousComponentIds,
189
+ lr as modalComponentIds,
190
+ tr as toKebabCase,
191
+ ne as useBaseEvents,
192
+ Mo as useBoolean,
193
+ lo as useChat,
194
+ fe as useChatAuth,
195
+ so as useChatBubble,
196
+ be as useChatForm,
197
+ Se as useChatFormState,
198
+ Pe as useChatHistory,
199
+ ze as useChatMarkdown,
200
+ Jr as useColorMode,
201
+ Xr as useColorModeValue,
202
+ jr as useCommandState,
203
+ Gr as useCommandStore,
204
+ Eo as useComponentClassNames,
205
+ Sr as useComposedRefs,
206
+ Fo as useContainerSize,
207
+ Do as useCopyToClipboard,
208
+ Ae as useFormField,
209
+ $e as useHelpMenu,
210
+ Te as useHelpMenuState,
211
+ io as useInkeepChatBubble,
212
+ ge as useInkeepConfig,
213
+ wo as useInkeepOpenState,
214
+ ro as useInkeepSidebarChat,
215
+ $o as useInstantUpdate,
216
+ Oo as useIsMounted,
217
+ zo as useMediaQuery,
218
+ Ge as useMessage,
219
+ Fe as useMessageFeedback,
220
+ ko as useModal,
221
+ no as useOptionalChatBubble,
222
+ Ke as useOptionalMessage,
223
+ to as useOptionalSidebarChat,
224
+ jo as useResizeObserver,
225
+ Ko as useScrollingFades,
226
+ No as useScrollingFadesHorizontal,
227
+ co as useSearch,
228
+ Uo as useSettleAction,
229
+ ot as useShadow,
230
+ ao as useSidebarChat,
231
+ qo as useSimpleScroll,
232
+ qe as useSourceItem,
233
+ _e as useWidget,
231
234
  oe as widgetToggle
232
235
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),ae=require("../../primitives/providers/base-events-provider.cjs"),re=require("../../primitives/providers/config-provider.cjs"),se=require("../../primitives/providers/message-provider.cjs"),C=require("../../primitives/components/embedded-chat.cjs"),ne=require("../../primitives/components/embedded-chat/chat-provider.cjs"),oe=require("../../primitives/utils/misc.cjs"),ie=require("merge-anything"),b=require("../utils.cjs"),le=require("./ui/markdown-styles.cjs"),de=require("../../primitives/components/embedded-chat/use-stream-processor.cjs"),ce=require("./data-summary-group.cjs"),o=require("react"),T=require("./embedded-chat.cjs"),d=require("lucide-react"),V=require("./ui/recipes/button.cjs"),pe={"input-streaming":"Pending","input-available":"Running","approval-requested":"Awaiting Approval","approval-responded":"Responded","output-available":"Completed","output-error":"Error","output-denied":"Denied"};function ue(t){if(!t||typeof t!="object")return!1;const a=t;return typeof a.type=="string"&&a.type.startsWith("tool-")}const me=t=>{if(!t||typeof t!="object"||!("status"in t))return;const a=t.status;return typeof a=="string"?a:void 0},xe=()=>e.jsx("div",{className:"flex space-x-1",children:[0,1,2].map(t=>e.jsx("span",{className:"animate-bounce-dot opacity-30",style:{animationDelay:`${t*.2}s`},children:"."},t))}),B=({name:t,Icon:a,props:i,componentType:n})=>e.jsxs("div",{className:"border rounded-lg bg-gray-50 dark:bg-gray-dark-800 mb-3",children:[e.jsxs("div",{className:"flex justify-between px-4 py-2 text-xs",children:[e.jsxs("div",{className:"font-medium flex items-center gap-2",children:[e.jsx(a,{className:"w-3 h-3 text-gray-600 dark:text-white-alpha-600"}),e.jsx("span",{children:t})]}),e.jsx("div",{className:"flex items-center px-1.5 py-0.5 rounded-md text-2xs uppercase tracking-wider bg-gray-200 dark:bg-white-alpha-200 font-medium text-gray-700 dark:text-white-alpha-700 font-mono",children:n})]}),e.jsx("div",{className:"px-4 py-2",children:e.jsx(K,{value:i})})]}),he=({name:t,props:a})=>e.jsx(B,{name:t,Icon:d.ComponentIcon,props:a,componentType:"component"}),fe=({name:t,props:a})=>e.jsx(B,{name:t,Icon:d.Library,props:a,componentType:"artifact"}),ge=({tool:t,componentDef:a,renderText:i,approvalId:n,messagePartsLength:x,setApprovalDelayPending:s,addToolApprovalResponse:u,sendMessage:c,conversationId:g})=>{const l=o.useRef(c);l.current=c;const m=o.useRef(u);m.current=u;const p=o.useRef(s);p.current=s;const h=o.useCallback(async(E=!0)=>{n&&(p.current({partCount:x}),m.current({id:n,approved:E}),await l.current(void 0,{body:{conversationId:g}}))},[n,x,g]),k=o.useMemo(()=>({tool:t,approve:h,renderMarkdown:i}),[t]),A=a?T.DynamicComponent:W;return e.jsx(A,{name:t.type,props:k,componentDef:a})};function F(t){return t===null?e.jsx("span",{className:"text-gray-500 dark:text-white-alpha-500 font-mono font-medium text-1xs",children:"null"}):t===void 0?e.jsx("span",{className:"text-gray-400 dark:text-white-alpha-400 italic text-xs font-medium",children:"undefined"}):typeof t=="boolean"?e.jsx("span",{className:b.cn("inline-flex font-mono font-semibold items-center px-1 py-0.5 text-1xs rounded-md border",t?"bg-inkeep-expanded-primary-50 border-inkeep-expanded-primary-200 text-inkeep-expanded-primary-600 dark:bg-inkeep-expanded-primary-950 dark:border-inkeep-expanded-primary-600 dark:text-inkeep-expanded-primary-200":"bg-gray-100 dark:bg-white-alpha-50 text-gray-700 dark:text-white-alpha-700"),children:t?"true":"false"}):typeof t=="number"?e.jsx("span",{className:"tabular-nums font-medium text-inkeep-expanded-primary-600 dark:text-inkeep-expanded-primary-200",children:String(t)}):typeof t=="string"?e.jsx("span",{className:"text-gray-800 dark:text-white-alpha-800 break-words",children:t}):e.jsx("span",{children:String(t)})}const G=({name:t,value:a,isArrayIndex:i,depth:n=0})=>{const[x,s]=o.useState(n<1),u=a!==null&&typeof a=="object"&&!Array.isArray(a),c=Array.isArray(a);if(!(u||c))return e.jsxs("div",{className:"flex items-baseline gap-2 py-1 text-xs",children:[e.jsx("span",{className:b.cn("font-medium shrink-0",i?"text-gray-300 dark:text-white-alpha-300":"text-gray-500 dark:text-white-alpha-500"),children:i?"—":t}),e.jsx("span",{className:"min-w-0",children:F(a)})]});const l=c?a.map((p,h)=>[String(h),p]):Object.entries(a);return l.length===0?e.jsxs("div",{className:"flex items-baseline gap-2 py-1 text-xs",children:[e.jsx("span",{className:"font-medium text-gray-500 dark:text-white-alpha-500 shrink-0",children:t}),e.jsx("span",{className:"text-gray-400 dark:text-white-alpha-400 italic",children:c?"empty list":"empty"})]}):e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:p=>{p.stopPropagation(),s(!x)},className:"flex items-center gap-1.5 py-1 text-xs hover:bg-gray-50 dark:hover:bg-white-alpha-50 -mx-1.5 px-1.5 rounded transition-colors w-full text-left",children:[e.jsx(d.ChevronDown,{className:b.cn("h-3.5 w-3.5 text-gray-400 dark:text-white-alpha-400 shrink-0 transition-transform",!x&&"-rotate-90")}),e.jsx("span",{className:"font-medium text-gray-500 dark:text-white-alpha-500",children:t}),!x&&e.jsx("span",{className:"text-gray-400 dark:text-white-alpha-400 text-1xs ml-1",children:c?`${l.length} item${l.length!==1?"s":""}`:`${l.length} field${l.length!==1?"s":""}`})]}),x&&e.jsx("div",{className:"border-l-2 border-gray-200 dark:border-white-alpha-200 ml-1.5 pl-3",children:l.map(([p,h])=>e.jsx(G,{name:p,value:h,isArrayIndex:c,depth:n+1},p))})]})},K=({value:t})=>{if(t==null||typeof t!="object")return e.jsx("span",{className:"text-xs",children:F(t)});const a=Array.isArray(t)?t.map((i,n)=>[String(n),i]):Object.entries(t);return a.length===0?e.jsx("div",{className:"text-xs text-gray-400 dark:text-white-alpha-400 italic",children:"No arguments"}):e.jsx("div",{className:"space-y-1",children:a.map(([i,n])=>e.jsx(G,{name:i,value:n,isArrayIndex:Array.isArray(t)},i))})},W=({props:t})=>{const{tool:a,approve:i}=t,n=a.type,x=n.startsWith("tool-")?n.slice(5):n,s=a.state,u=a.approval?.id,c=!!u,g=s==="approval-requested",l=me(a.output),[m,p]=o.useState(c),h=s?pe[s]??s:"tool";o.useEffect(()=>{g&&p(!0)},[g]);const k=()=>{switch(s){case"input-streaming":return e.jsx(d.Circle,{className:"w-3 h-3"});case"input-available":return e.jsx(d.Loader2,{className:"w-3 h-3 animate-spin"});case"approval-requested":return e.jsx(d.Clock,{className:"w-3 h-3"});case"approval-responded":return e.jsx(d.CheckCircle,{className:"w-3 h-3"});case"output-available":return e.jsx(d.CheckCircle,{className:"w-3 h-3"});case"output-error":return e.jsx(d.TriangleAlert,{className:"w-3 h-3"});case"output-denied":return e.jsx(d.XCircle,{className:"w-3 h-3"});default:return null}};return e.jsxs("div",{className:"border rounded-lg mb-3 overflow-hidden",children:[e.jsxs("button",{type:"button",className:"inline-flex items-center group gap-2 text-xs text-gray-700 dark:text-white-alpha-700 hover:text-gray-800 dark:hover:text-white-alpha-800 transition-colors cursor-pointer w-full justify-between px-4 py-2 data-[expanded=true]:border-b",onClick:()=>p(!m),"aria-expanded":m,"data-expanded":m,children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("div",{className:"font-medium flex items-center gap-2",children:[e.jsx(d.Hammer,{className:"w-3 h-3 text-gray-600 dark:text-white-alpha-600"}),e.jsx("span",{children:x})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-1.5 py-0.5 rounded-md text-2xs uppercase tracking-wider bg-gray-100 dark:bg-white-alpha-100 font-medium text-gray-700 dark:text-white-alpha-700 font-mono",children:[k(),h]}),e.jsx(d.ChevronDown,{className:"w-3.5 h-3.5 text-gray-500 dark:text-white-alpha-500 transition-all duration-200 transform rotate-0 group-data-[expanded=true]:rotate-180"})]})]}),e.jsxs("div",{"data-expanded":m,className:b.cn("overflow-hidden transition-all duration-300 ease-in-out data-[expanded=true]:opacity-100 data-[expanded=false]:max-h-0 data-[expanded=false]:opacity-0 max-w-full"),children:[e.jsx("div",{"data-expanded":m,className:b.cn("relative",'before:content-[""] before:absolute before:inset-x-0 before:top-0 before:h-3 before:pointer-events-none before:z-10','after:content-[""] after:absolute after:inset-x-0 after:bottom-0 after:h-3 after:pointer-events-none after:z-10',"before:bg-[linear-gradient(white,_transparent)] after:bg-[linear-gradient(transparent,_white)]","dark:before:bg-[linear-gradient(var(--ikp-color-gray-dark-950),_transparent)] dark:after:bg-[linear-gradient(transparent,_var(--ikp-color-gray-dark-950))]","data-[expanded=false]:before:opacity-0 data-[expanded=false]:after:opacity-0"),children:e.jsx("div",{"data-expanded":m,className:b.cn("[scrollbar-width:thin] px-4","data-[expanded=true]:max-h-48 data-[expanded=true]:overflow-y-auto"),children:a.input!=null&&e.jsx("div",{className:"text-xs py-2",children:e.jsx(K,{value:a.input})})})}),g&&u&&e.jsxs("div",{className:"flex justify-end gap-2 pt-1 pb-3 px-4",children:[e.jsx("button",{type:"button",className:b.cn(V.button({size:"xs",variant:"outline"}),"px-2 py-1 rounded-md text-xs text-gray-700 dark:text-white-alpha-700"),onClick:()=>i(!1),children:"Deny"}),e.jsxs("button",{type:"button",className:b.cn(V.button({size:"xs",variant:"primaryFilled"}),"px-2 py-1 rounded-md text-xs gap-1"),onClick:()=>i(!0),children:[e.jsx(d.Check,{className:"w-3 h-3"}),"Approve"]})]}),s==="output-available"&&l&&a.output!=null&&e.jsxs("div",{className:"flex justify-end items-center gap-1 whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 capitalize pb-3 px-4",children:[l==="approved"&&e.jsx(d.Check,{className:"w-3 h-3"}),l]}),s==="output-denied"&&e.jsxs("div",{className:"flex justify-end items-center gap-1 whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 capitalize pb-3 px-4",children:[e.jsx(d.X,{className:"w-3 h-3"}),h]})]})]})},ye=({className:t,componentStyles:a,children:i,isLast:n,...x})=>{const{message:s}=se.useMessage(),{logEvent:u}=ae.useBaseEvents(),{conversationId:c,isStreaming:g,isLoading:l,setError:m,addToolApprovalResponse:p,sendMessage:h}=ne.useChat(),{aiChatSettings:{components:k,artifacts:A,headers:E}}=re.useInkeepConfig(),X=E?.["x-emit-operations"]==="true",L=s.role==="user",q=(g||l)&&n&&s.role==="assistant",{processedParts:H,summaryTimings:J,shouldShowInitialLoading:Q,shouldShowStreamDelayLoading:Y}=de.useStreamProcessor(s.parts,q,m),[S,_]=o.useState(null),[Z,M]=o.useState(!1),y=o.useRef(null);o.useEffect(()=>{if(!S){M(!1),y.current&&(clearTimeout(y.current),y.current=null);return}return M(!1),y.current&&clearTimeout(y.current),y.current=window.setTimeout(()=>{M(!0)},1e3),()=>{y.current&&(clearTimeout(y.current),y.current=null)}},[S]),o.useEffect(()=>{S&&(!n||s.parts.length>S.partCount||!q)&&_(null)},[S,n,s.parts.length,q]);const I=o.useMemo(()=>s.parts.filter(oe.isCitationArtifact),[s.parts]),O=o.useMemo(()=>ie.merge(le.markdownStyles,a??{}),[a]),z=o.useCallback((r,f)=>{u({eventName:"assistant_message_inline_link_opened",properties:{title:f?.toString(),url:r}})},[u]),U=o.useCallback((r,f)=>{u({eventName:"assistant_code_block_copied",properties:{conversationId:c,language:r,code:f}})},[u,c]),R=o.useCallback(r=>e.jsx(C.EmbeddedChatPrimitiveMarkdown,{text:r,componentStyles:O,onLinkClick:z,onCodeCopy:U,artifacts:I}),[O,z,U,I]),ee=o.useMemo(()=>b.cn("data-[role=user]:whitespace-pre-wrap mb-3 data-[role=user]:mb-0 [&[data-role=user]>p]:mb-0 max-w-full",t),[t]),te=!L||s.parts.some(r=>r.type==="text"&&r.text?.trim());return e.jsxs(e.Fragment,{children:[!te&&e.jsx("span",{className:"text-gray-500 dark:text-white-alpha-500",children:"No message content"}),H.map((r,f)=>{const v={"data-role":s.role,"data-type":r?.type==="data-component"?r.data.type:r?.type,...x,className:ee};switch(r?.type){case"text":return e.jsx(C.PrimitiveMessagePart,{...v,children:L?r.text:R(r.text||"")},f);case"data-component":{const{type:w}=r.data;switch(w){case"text":return e.jsx("div",{...v,children:R(r.data.text||"")},f);default:{const N=r.data,{name:j,props:D}=N,P=k?.[j],$=P?T.DynamicComponent:he;return e.jsx(C.PrimitiveMessagePart,{...v,children:e.jsx($,{name:j,props:D,componentDef:P})},`${j}-${f}`)}}}case"data-artifact":{const w=r.data,{name:N,type:j,artifactSummary:D}=w;if(j==="citation"&&!D?.url)return null;const P=A?.[j],$=P?T.DynamicComponent:fe;return e.jsx(C.PrimitiveMessagePart,{...v,children:e.jsx($,{name:j,props:D,componentDef:P})},`${N}-${f}`)}case"summary-group":{const w=J.get(r.groupKey)||{isCompleted:!1};return e.jsx(C.PrimitiveMessagePart,{...v,children:e.jsx(ce.DataSummaryGroup,{summaries:r.summaries||[],isCompleted:w.isCompleted})},`${r.groupKey}-${f}`)}default:{if(!ue(r))return null;const w=r,N=r.approval?.id;return X||N?e.jsx(C.PrimitiveMessagePart,{...v,children:e.jsx(ge,{tool:w,componentDef:k?.IkpTool,renderText:R,approvalId:N,messagePartsLength:s.parts.length,setApprovalDelayPending:_,addToolApprovalResponse:p,sendMessage:h,conversationId:c})},r.toolCallId??`${r.type}-${f}`):null}}}),Q&&e.jsx(T.MessageLoading,{}),(Y||Z)&&e.jsx(xe,{})]})};exports.DefaultToolComponent=W;exports.EmbeddedChatMessagePart=ye;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),ae=require("../../primitives/providers/base-events-provider.cjs"),re=require("../../primitives/providers/config-provider.cjs"),se=require("../../primitives/providers/message-provider.cjs"),C=require("../../primitives/components/embedded-chat.cjs"),ne=require("../../primitives/components/embedded-chat/chat-provider.cjs"),oe=require("../../primitives/utils/misc.cjs"),ie=require("merge-anything"),b=require("../utils.cjs"),le=require("./ui/markdown-styles.cjs"),de=require("../../primitives/components/embedded-chat/use-stream-processor.cjs"),ce=require("./data-summary-group.cjs"),o=require("react"),T=require("./embedded-chat.cjs"),c=require("lucide-react"),V=require("./ui/recipes/button.cjs"),pe={"input-streaming":"Pending","input-available":"Running","approval-requested":"Awaiting Approval","approval-responded":"Responded","output-available":"Completed","output-error":"Error","output-denied":"Denied"};function ue(t){if(!t||typeof t!="object")return!1;const a=t;return typeof a.type=="string"&&a.type.startsWith("tool-")}const me=t=>{if(!t||typeof t!="object"||!("status"in t))return;const a=t.status;return typeof a=="string"?a:void 0},xe=()=>e.jsx("div",{className:"flex space-x-1",children:[0,1,2].map(t=>e.jsx("span",{className:"animate-bounce-dot opacity-30",style:{animationDelay:`${t*.2}s`},children:"."},t))}),B=({name:t,Icon:a,props:l,componentType:n})=>e.jsxs("div",{className:"border rounded-lg bg-gray-50 dark:bg-gray-dark-800 mb-3",children:[e.jsxs("div",{className:"flex justify-between px-4 py-2 text-xs",children:[e.jsxs("div",{className:"font-medium flex items-center gap-2",children:[e.jsx(a,{className:"w-3 h-3 text-gray-600 dark:text-white-alpha-600"}),e.jsx("span",{children:t})]}),e.jsx("div",{className:"flex items-center px-1.5 py-0.5 rounded-md text-2xs uppercase tracking-wider bg-gray-200 dark:bg-white-alpha-200 font-medium text-gray-700 dark:text-white-alpha-700 font-mono",children:n})]}),e.jsx("div",{className:"px-4 py-2",children:e.jsx(K,{value:l})})]}),he=({name:t,props:a})=>e.jsx(B,{name:t,Icon:c.ComponentIcon,props:a,componentType:"component"}),fe=({name:t,props:a})=>e.jsx(B,{name:t,Icon:c.Library,props:a,componentType:"artifact"}),ge=({tool:t,componentDef:a,renderText:l,approvalId:n,messagePartsLength:x,setApprovalDelayPending:r,addToolApprovalResponse:u,sendMessage:i,conversationId:g})=>{const d=o.useRef(i);d.current=i;const m=o.useRef(u);m.current=u;const p=o.useRef(r);p.current=r;const h=o.useCallback(async(E=!0)=>{n&&(p.current({partCount:x}),m.current({id:n,approved:E}),await d.current(void 0,{body:{conversationId:g}}))},[n,x,g]),k=o.useMemo(()=>({tool:t,approve:h,renderMarkdown:l}),[t]),A=a?T.DynamicComponent:W;return e.jsx(A,{name:t.type,props:k,componentDef:a})};function F(t){return t===null?e.jsx("span",{className:"text-gray-500 dark:text-white-alpha-500 font-mono font-medium text-1xs",children:"null"}):t===void 0?e.jsx("span",{className:"text-gray-400 dark:text-white-alpha-400 italic text-xs font-medium",children:"undefined"}):typeof t=="boolean"?e.jsx("span",{className:b.cn("inline-flex font-mono font-semibold items-center px-1 py-0.5 text-1xs rounded-md border",t?"bg-inkeep-expanded-primary-50 border-inkeep-expanded-primary-200 text-inkeep-expanded-primary-600 dark:bg-inkeep-expanded-primary-950 dark:border-inkeep-expanded-primary-600 dark:text-inkeep-expanded-primary-200":"bg-gray-100 dark:bg-white-alpha-50 text-gray-700 dark:text-white-alpha-700"),children:t?"true":"false"}):typeof t=="number"?e.jsx("span",{className:"tabular-nums font-medium text-inkeep-expanded-primary-600 dark:text-inkeep-expanded-primary-200",children:String(t)}):typeof t=="string"?e.jsx("span",{className:"text-gray-800 dark:text-white-alpha-800 break-words",children:t}):e.jsx("span",{children:String(t)})}const G=({name:t,value:a,isArrayIndex:l,depth:n=0})=>{const[x,r]=o.useState(n<1),u=a!==null&&typeof a=="object"&&!Array.isArray(a),i=Array.isArray(a);if(!(u||i))return e.jsxs("div",{className:"flex items-baseline gap-2 py-1 text-xs",children:[e.jsx("span",{className:b.cn("font-medium shrink-0",l?"text-gray-300 dark:text-white-alpha-300":"text-gray-500 dark:text-white-alpha-500"),children:l?"—":t}),e.jsx("span",{className:"min-w-0",children:F(a)})]});const d=i?a.map((p,h)=>[String(h),p]):Object.entries(a);return d.length===0?e.jsxs("div",{className:"flex items-baseline gap-2 py-1 text-xs",children:[e.jsx("span",{className:"font-medium text-gray-500 dark:text-white-alpha-500 shrink-0",children:t}),e.jsx("span",{className:"text-gray-400 dark:text-white-alpha-400 italic",children:i?"empty list":"empty"})]}):e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:p=>{p.stopPropagation(),r(!x)},className:"flex items-center gap-1.5 py-1 text-xs hover:bg-gray-50 dark:hover:bg-white-alpha-50 -mx-1.5 px-1.5 rounded transition-colors w-full text-left",children:[e.jsx(c.ChevronDown,{className:b.cn("h-3.5 w-3.5 text-gray-400 dark:text-white-alpha-400 shrink-0 transition-transform",!x&&"-rotate-90")}),e.jsx("span",{className:"font-medium text-gray-500 dark:text-white-alpha-500",children:t}),!x&&e.jsx("span",{className:"text-gray-400 dark:text-white-alpha-400 text-1xs ml-1",children:i?`${d.length} item${d.length!==1?"s":""}`:`${d.length} field${d.length!==1?"s":""}`})]}),x&&e.jsx("div",{className:"border-l-2 border-gray-200 dark:border-white-alpha-200 ml-1.5 pl-3",children:d.map(([p,h])=>e.jsx(G,{name:p,value:h,isArrayIndex:i,depth:n+1},p))})]})},K=({value:t})=>{if(t==null||typeof t!="object")return e.jsx("span",{className:"text-xs",children:F(t)});const a=Array.isArray(t)?t.map((l,n)=>[String(n),l]):Object.entries(t);return a.length===0?e.jsx("div",{className:"text-xs text-gray-400 dark:text-white-alpha-400 italic",children:"No arguments"}):e.jsx("div",{className:"space-y-1",children:a.map(([l,n])=>e.jsx(G,{name:l,value:n,isArrayIndex:Array.isArray(t)},l))})},W=({props:t})=>{const{tool:a,approve:l}=t,n=a.type,x=n.startsWith("tool-")?n.slice(5):n,r=a.state,u=a.approval?.id,i=!!u,g=r==="approval-requested",d=me(a.output),[m,p]=o.useState(i),h=r?pe[r]??r:"tool";o.useEffect(()=>{g&&p(!0)},[g]);const k=()=>{switch(r){case"input-streaming":return e.jsx(c.Circle,{className:"w-3 h-3"});case"input-available":return e.jsx(c.Loader2,{className:"w-3 h-3 animate-spin"});case"approval-requested":return e.jsx(c.Clock,{className:"w-3 h-3"});case"approval-responded":return e.jsx(c.CheckCircle,{className:"w-3 h-3"});case"output-available":return e.jsx(c.CheckCircle,{className:"w-3 h-3"});case"output-error":return e.jsx(c.TriangleAlert,{className:"w-3 h-3"});case"output-denied":return e.jsx(c.XCircle,{className:"w-3 h-3"});default:return null}};return e.jsxs("div",{className:"border rounded-lg mb-3 overflow-hidden",children:[e.jsxs("button",{type:"button",className:"inline-flex items-center group gap-2 text-xs text-gray-700 dark:text-white-alpha-700 hover:text-gray-800 dark:hover:text-white-alpha-800 transition-colors cursor-pointer w-full justify-between px-4 py-2 data-[expanded=true]:border-b",onClick:()=>p(!m),"aria-expanded":m,"data-expanded":m,children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("div",{className:"font-medium flex items-center gap-2",children:[e.jsx(c.Hammer,{className:"w-3 h-3 text-gray-600 dark:text-white-alpha-600"}),e.jsx("span",{children:x})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-1.5 py-0.5 rounded-md text-2xs uppercase tracking-wider bg-gray-100 dark:bg-white-alpha-100 font-medium text-gray-700 dark:text-white-alpha-700 font-mono",children:[k(),h]}),e.jsx(c.ChevronDown,{className:"w-3.5 h-3.5 text-gray-500 dark:text-white-alpha-500 transition-all duration-200 transform rotate-0 group-data-[expanded=true]:rotate-180"})]})]}),e.jsxs("div",{"data-expanded":m,className:b.cn("overflow-hidden transition-all duration-300 ease-in-out data-[expanded=true]:opacity-100 data-[expanded=false]:max-h-0 data-[expanded=false]:opacity-0 max-w-full"),children:[e.jsx("div",{"data-expanded":m,className:b.cn("relative",'before:content-[""] before:absolute before:inset-x-0 before:top-0 before:h-3 before:pointer-events-none before:z-10','after:content-[""] after:absolute after:inset-x-0 after:bottom-0 after:h-3 after:pointer-events-none after:z-10',"before:bg-[linear-gradient(white,_transparent)] after:bg-[linear-gradient(transparent,_white)]","dark:before:bg-[linear-gradient(var(--ikp-color-gray-dark-950),_transparent)] dark:after:bg-[linear-gradient(transparent,_var(--ikp-color-gray-dark-950))]","data-[expanded=false]:before:opacity-0 data-[expanded=false]:after:opacity-0"),children:e.jsx("div",{"data-expanded":m,className:b.cn("[scrollbar-width:thin] px-4","data-[expanded=true]:max-h-48 data-[expanded=true]:overflow-y-auto"),children:a.input!=null&&e.jsx("div",{className:"text-xs py-2",children:e.jsx(K,{value:a.input})})})}),g&&u&&e.jsxs("div",{className:"flex justify-end gap-2 pt-1 pb-3 px-4",children:[e.jsx("button",{type:"button",className:b.cn(V.button({size:"xs",variant:"outline"}),"px-2 py-1 rounded-md text-xs text-gray-700 dark:text-white-alpha-700"),onClick:()=>l(!1),children:"Deny"}),e.jsxs("button",{type:"button",className:b.cn(V.button({size:"xs",variant:"primaryFilled"}),"px-2 py-1 rounded-md text-xs gap-1"),onClick:()=>l(!0),children:[e.jsx(c.Check,{className:"w-3 h-3"}),"Approve"]})]}),r==="output-available"&&d&&a.output!=null&&e.jsxs("div",{className:"flex justify-end items-center gap-1 whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 capitalize pb-3 px-4",children:[d==="approved"&&e.jsx(c.Check,{className:"w-3 h-3"}),d]}),r==="output-denied"&&e.jsxs("div",{className:"flex justify-end items-center gap-1 whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 capitalize pb-3 px-4",children:[e.jsx(c.X,{className:"w-3 h-3"}),h]})]})]})},ye=({className:t,componentStyles:a,children:l,isLast:n,...x})=>{const{message:r}=se.useMessage(),{logEvent:u}=ae.useBaseEvents(),{conversationId:i,isStreaming:g,isLoading:d,setError:m,addToolApprovalResponse:p,sendMessage:h}=ne.useChat(),{aiChatSettings:{components:k,artifacts:A,headers:E}}=re.useInkeepConfig(),X=E?.["x-emit-operations"]==="true",$=r.role==="user",q=(g||d)&&n&&r.role==="assistant",{processedParts:H,summaryTimings:J,shouldShowInitialLoading:Q,shouldShowStreamDelayLoading:Y}=de.useStreamProcessor(r.parts,q,m),[S,L]=o.useState(null),[Z,M]=o.useState(!1),y=o.useRef(null);o.useEffect(()=>{if(!S){M(!1),y.current&&(clearTimeout(y.current),y.current=null);return}return M(!1),y.current&&clearTimeout(y.current),y.current=window.setTimeout(()=>{M(!0)},1e3),()=>{y.current&&(clearTimeout(y.current),y.current=null)}},[S]),o.useEffect(()=>{S&&(!n||r.parts.length>S.partCount||!q)&&L(null)},[S,n,r.parts.length,q]);const _=o.useMemo(()=>r.parts.filter(oe.isCitationArtifact),[r.parts]),O=o.useMemo(()=>ie.merge(le.markdownStyles,a??{}),[a]),z=o.useCallback((s,f)=>{u({eventName:"assistant_message_inline_link_opened",properties:{conversationId:i,messageId:r.id,title:f?.toString(),url:s}})},[u,i,r.id]),U=o.useCallback((s,f)=>{u({eventName:"assistant_code_block_copied",properties:{conversationId:i,messageId:r.id,language:s,code:f}})},[u,i,r.id]),R=o.useCallback(s=>e.jsx(C.EmbeddedChatPrimitiveMarkdown,{text:s,componentStyles:O,onLinkClick:z,onCodeCopy:U,artifacts:_}),[O,z,U,_]),ee=o.useMemo(()=>b.cn("data-[role=user]:whitespace-pre-wrap mb-3 data-[role=user]:mb-0 [&[data-role=user]>p]:mb-0 max-w-full",t),[t]),te=!$||r.parts.some(s=>s.type==="text"&&s.text?.trim());return e.jsxs(e.Fragment,{children:[!te&&e.jsx("span",{className:"text-gray-500 dark:text-white-alpha-500",children:"No message content"}),H.map((s,f)=>{const v={"data-role":r.role,"data-type":s?.type==="data-component"?s.data.type:s?.type,...x,className:ee};switch(s?.type){case"text":return e.jsx(C.PrimitiveMessagePart,{...v,children:$?s.text:R(s.text||"")},f);case"data-component":{const{type:w}=s.data;switch(w){case"text":return e.jsx("div",{...v,children:R(s.data.text||"")},f);default:{const N=s.data,{name:j,props:D}=N,P=k?.[j],I=P?T.DynamicComponent:he;return e.jsx(C.PrimitiveMessagePart,{...v,children:e.jsx(I,{name:j,props:D,componentDef:P})},`${j}-${f}`)}}}case"data-artifact":{const w=s.data,{name:N,type:j,artifactSummary:D}=w;if(j==="citation"&&!D?.url)return null;const P=A?.[j],I=P?T.DynamicComponent:fe;return e.jsx(C.PrimitiveMessagePart,{...v,children:e.jsx(I,{name:j,props:D,componentDef:P})},`${N}-${f}`)}case"summary-group":{const w=J.get(s.groupKey)||{isCompleted:!1};return e.jsx(C.PrimitiveMessagePart,{...v,children:e.jsx(ce.DataSummaryGroup,{summaries:s.summaries||[],isCompleted:w.isCompleted})},`${s.groupKey}-${f}`)}default:{if(!ue(s))return null;const w=s,N=s.approval?.id;return X||N?e.jsx(C.PrimitiveMessagePart,{...v,children:e.jsx(ge,{tool:w,componentDef:k?.IkpTool,renderText:R,approvalId:N,messagePartsLength:r.parts.length,setApprovalDelayPending:L,addToolApprovalResponse:p,sendMessage:h,conversationId:i})},s.toolCallId??`${s.type}-${f}`):null}}}),Q&&e.jsx(T.MessageLoading,{}),(Y||Z)&&e.jsx(xe,{})]})};exports.DefaultToolComponent=W;exports.EmbeddedChatMessagePart=ye;