@uipath/apollo-wind 2.67.1 → 2.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/components/forms/metadata-form.cjs +40 -44
  2. package/dist/components/forms/metadata-form.js +40 -44
  3. package/dist/components/ui/code-block.cjs +375 -0
  4. package/dist/components/ui/code-block.d.ts +38 -0
  5. package/dist/components/ui/code-block.js +307 -0
  6. package/dist/components/ui/index.cjs +268 -191
  7. package/dist/components/ui/index.d.ts +7 -0
  8. package/dist/components/ui/index.js +7 -0
  9. package/dist/components/ui/json-tree-view/JsonTree.cjs +2 -2
  10. package/dist/components/ui/json-tree-view/JsonTree.js +1 -1
  11. package/dist/components/ui/json-tree-view/JsonTree.types.d.ts +26 -0
  12. package/dist/components/ui/json-tree-view/JsonTreeRow.cjs +13 -10
  13. package/dist/components/ui/json-tree-view/JsonTreeRow.js +14 -11
  14. package/dist/components/ui/json-tree-view/JsonTreeToolbar.cjs +22 -11
  15. package/dist/components/ui/json-tree-view/JsonTreeToolbar.d.ts +6 -1
  16. package/dist/components/ui/json-tree-view/JsonTreeToolbar.js +22 -11
  17. package/dist/components/ui/json-tree-view/NodeKey.cjs +4 -0
  18. package/dist/components/ui/json-tree-view/NodeKey.js +4 -0
  19. package/dist/components/ui/json-tree-view/RowActions.cjs +23 -17
  20. package/dist/components/ui/json-tree-view/RowActions.d.ts +4 -1
  21. package/dist/components/ui/json-tree-view/RowActions.js +23 -17
  22. package/dist/components/ui/json-tree-view/buildJsonTree.cjs +99 -44
  23. package/dist/components/ui/json-tree-view/buildJsonTree.d.ts +15 -2
  24. package/dist/components/ui/json-tree-view/buildJsonTree.js +97 -45
  25. package/dist/components/ui/json-tree-view/index.cjs +26 -23
  26. package/dist/components/ui/json-tree-view/index.d.ts +2 -2
  27. package/dist/components/ui/json-tree-view/index.js +2 -2
  28. package/dist/components/ui/live-region.cjs +106 -0
  29. package/dist/components/ui/live-region.d.ts +31 -0
  30. package/dist/components/ui/live-region.js +72 -0
  31. package/dist/components/ui/loading-dots.cjs +95 -0
  32. package/dist/components/ui/loading-dots.d.ts +21 -0
  33. package/dist/components/ui/loading-dots.js +55 -0
  34. package/dist/components/ui/markdown.cjs +428 -0
  35. package/dist/components/ui/markdown.d.ts +55 -0
  36. package/dist/components/ui/markdown.js +378 -0
  37. package/dist/components/ui/panel-tabs.cjs +99 -0
  38. package/dist/components/ui/panel-tabs.d.ts +34 -0
  39. package/dist/components/ui/panel-tabs.js +53 -0
  40. package/dist/components/ui/thinking-indicator.cjs +146 -0
  41. package/dist/components/ui/thinking-indicator.d.ts +38 -0
  42. package/dist/components/ui/thinking-indicator.js +106 -0
  43. package/dist/components/ui/tool-call.cjs +359 -0
  44. package/dist/components/ui/tool-call.d.ts +75 -0
  45. package/dist/components/ui/tool-call.js +301 -0
  46. package/dist/index.cjs +334 -246
  47. package/dist/index.d.ts +15 -1
  48. package/dist/index.js +9 -2
  49. package/dist/styles.css +239 -0
  50. package/dist/tailwind.utilities.css +21 -0
  51. package/package.json +7 -1
  52. /package/dist/{components/ui/json-tree-view → lib}/clipboard.cjs +0 -0
  53. /package/dist/{components/ui/json-tree-view → lib}/clipboard.d.ts +0 -0
  54. /package/dist/{components/ui/json-tree-view → lib}/clipboard.js +0 -0
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ "use client";
3
+ var __webpack_require__ = {};
4
+ (()=>{
5
+ __webpack_require__.d = (exports1, definition)=>{
6
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ get: definition[key]
9
+ });
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.r = (exports1)=>{
17
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
18
+ value: 'Module'
19
+ });
20
+ Object.defineProperty(exports1, '__esModule', {
21
+ value: true
22
+ });
23
+ };
24
+ })();
25
+ var __webpack_exports__ = {};
26
+ __webpack_require__.r(__webpack_exports__);
27
+ __webpack_require__.d(__webpack_exports__, {
28
+ thinkingIndicatorVariants: ()=>thinkingIndicatorVariants,
29
+ DEFAULT_THINKING_INDICATOR_STRINGS: ()=>DEFAULT_THINKING_INDICATOR_STRINGS,
30
+ ThinkingIndicator: ()=>ThinkingIndicator
31
+ });
32
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
33
+ const external_class_variance_authority_namespaceObject = require("class-variance-authority");
34
+ const external_lucide_react_namespaceObject = require("lucide-react");
35
+ const external_react_namespaceObject = require("react");
36
+ const index_cjs_namespaceObject = require("../../lib/index.cjs");
37
+ const REDUCED_MOTION_QUERY = '(prefers-reduced-motion: reduce)';
38
+ function getPrefersReducedMotion() {
39
+ if ("u" < typeof window || 'function' != typeof window.matchMedia) return false;
40
+ return window.matchMedia(REDUCED_MOTION_QUERY).matches;
41
+ }
42
+ function usePrefersReducedMotion() {
43
+ const [reduced, setReduced] = external_react_namespaceObject.useState(getPrefersReducedMotion);
44
+ external_react_namespaceObject.useEffect(()=>{
45
+ if ('function' != typeof window.matchMedia) return;
46
+ const mql = window.matchMedia(REDUCED_MOTION_QUERY);
47
+ const onChange = ()=>setReduced(mql.matches);
48
+ mql.addEventListener('change', onChange);
49
+ return ()=>mql.removeEventListener('change', onChange);
50
+ }, []);
51
+ return reduced;
52
+ }
53
+ const thinkingIndicatorVariants = (0, external_class_variance_authority_namespaceObject.cva)('inline-flex max-w-full min-w-0 items-center text-muted-foreground', {
54
+ variants: {
55
+ size: {
56
+ sm: 'gap-1.5 text-xs [&_[data-slot=thinking-indicator-icon]]:size-3.5',
57
+ md: 'gap-2 text-sm [&_[data-slot=thinking-indicator-icon]]:size-4'
58
+ }
59
+ },
60
+ defaultVariants: {
61
+ size: 'md'
62
+ }
63
+ });
64
+ const DEFAULT_THINKING_INDICATOR_STRINGS = {
65
+ label: 'Thinking'
66
+ };
67
+ const ThinkingIndicator = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, size = 'md', label, messages, interval = 2500, strings, icon, 'aria-label': ariaLabel, ...props }, ref)=>{
68
+ const text = {
69
+ ...DEFAULT_THINKING_INDICATOR_STRINGS,
70
+ ...strings
71
+ };
72
+ const staticLabel = label ?? text.label;
73
+ const name = ariaLabel ?? staticLabel;
74
+ const labels = messages && messages.length > 0 ? messages : [
75
+ staticLabel
76
+ ];
77
+ const reducedMotion = usePrefersReducedMotion();
78
+ const rotates = labels.length > 1 && !reducedMotion && interval > 0;
79
+ const rotationKey = `${rotates}\u0000${labels.join('\u0000')}`;
80
+ const [index, setIndex] = external_react_namespaceObject.useState(0);
81
+ const [prevRotationKey, setPrevRotationKey] = external_react_namespaceObject.useState(rotationKey);
82
+ if (rotationKey !== prevRotationKey) {
83
+ setPrevRotationKey(rotationKey);
84
+ setIndex(0);
85
+ }
86
+ external_react_namespaceObject.useEffect(()=>{
87
+ if (!rotates) return;
88
+ const id = window.setInterval(()=>{
89
+ setIndex((current)=>(current + 1) % labels.length);
90
+ }, interval);
91
+ return ()=>window.clearInterval(id);
92
+ }, [
93
+ rotates,
94
+ labels.length,
95
+ interval,
96
+ rotationKey
97
+ ]);
98
+ const activeIndex = index < labels.length ? index : 0;
99
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
100
+ ref: ref,
101
+ "data-slot": "thinking-indicator",
102
+ "data-size": size,
103
+ role: "status",
104
+ "aria-label": name,
105
+ className: (0, index_cjs_namespaceObject.cn)(thinkingIndicatorVariants({
106
+ size
107
+ }), className),
108
+ ...props,
109
+ children: [
110
+ null !== icon && false !== icon && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
111
+ "data-slot": "thinking-indicator-icon",
112
+ "aria-hidden": "true",
113
+ className: "inline-flex shrink-0 items-center justify-center [&>svg]:size-full",
114
+ children: icon ?? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Sparkles, {
115
+ className: "text-primary animate-pulse motion-reduce:animate-none"
116
+ })
117
+ }),
118
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
119
+ "data-slot": "thinking-indicator-label",
120
+ "aria-hidden": "true",
121
+ className: "grid min-w-0",
122
+ children: labels.map((item, i)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
123
+ "data-active": i === activeIndex,
124
+ className: "shimmer col-start-1 row-start-1 truncate transition-opacity duration-300 data-[active=false]:opacity-0 motion-reduce:transition-none",
125
+ children: item
126
+ }, i))
127
+ }),
128
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
129
+ className: "sr-only",
130
+ children: name
131
+ })
132
+ ]
133
+ });
134
+ });
135
+ ThinkingIndicator.displayName = 'ThinkingIndicator';
136
+ exports.DEFAULT_THINKING_INDICATOR_STRINGS = __webpack_exports__.DEFAULT_THINKING_INDICATOR_STRINGS;
137
+ exports.ThinkingIndicator = __webpack_exports__.ThinkingIndicator;
138
+ exports.thinkingIndicatorVariants = __webpack_exports__.thinkingIndicatorVariants;
139
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
140
+ "DEFAULT_THINKING_INDICATOR_STRINGS",
141
+ "ThinkingIndicator",
142
+ "thinkingIndicatorVariants"
143
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
144
+ Object.defineProperty(exports, '__esModule', {
145
+ value: true
146
+ });
@@ -0,0 +1,38 @@
1
+ import { type VariantProps } from 'class-variance-authority';
2
+ import * as React from 'react';
3
+ declare const thinkingIndicatorVariants: (props?: ({
4
+ size?: "sm" | "md" | null | undefined;
5
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
+ export interface ThinkingIndicatorStrings {
7
+ /** Default visible label, and the accessible name unless `label` or `aria-label` is set. */
8
+ label: string;
9
+ }
10
+ export declare const DEFAULT_THINKING_INDICATOR_STRINGS: ThinkingIndicatorStrings;
11
+ export interface ThinkingIndicatorProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'>, VariantProps<typeof thinkingIndicatorVariants> {
12
+ /** A single label. Also the accessible name when `messages` rotate. */
13
+ label?: string;
14
+ /** Labels to cycle through. The first shows immediately; reduced motion keeps it there. */
15
+ messages?: string[];
16
+ /** Milliseconds each of `messages` stays on screen. */
17
+ interval?: number;
18
+ /** Overrides for any subset of the English strings. An explicit `aria-label` wins over both. */
19
+ strings?: Partial<ThinkingIndicatorStrings>;
20
+ /**
21
+ * Replaces the pulsing sparkle; `null` or `false` shows the label alone. A custom icon brings
22
+ * its own colour and animation and is sized by the indicator's `size`.
23
+ */
24
+ icon?: React.ReactNode;
25
+ }
26
+ /**
27
+ * A "the assistant is working" row for a conversation: a pulsing sparkle and a shimmering label.
28
+ * Pass `messages` to cycle through progress labels ("Searching", "Reading files") every
29
+ * `interval` ms with a crossfade.
30
+ *
31
+ * Screen readers get one stable name (`label`, else `strings.label`) on a `role="status"` root,
32
+ * and the visual label is `aria-hidden`. Rotating labels are decoration, so announcing each one
33
+ * would only add noise. Announce real progress with `LiveRegion` instead.
34
+ *
35
+ * Under `prefers-reduced-motion` the icon and shimmer are static and the labels do not rotate.
36
+ */
37
+ declare const ThinkingIndicator: React.ForwardRefExoticComponent<ThinkingIndicatorProps & React.RefAttributes<HTMLDivElement>>;
38
+ export { ThinkingIndicator, thinkingIndicatorVariants };
@@ -0,0 +1,106 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { cva } from "class-variance-authority";
4
+ import { Sparkles } from "lucide-react";
5
+ import { forwardRef, useEffect, useState } from "react";
6
+ import { cn } from "../../lib/index.js";
7
+ const REDUCED_MOTION_QUERY = '(prefers-reduced-motion: reduce)';
8
+ function getPrefersReducedMotion() {
9
+ if ("u" < typeof window || 'function' != typeof window.matchMedia) return false;
10
+ return window.matchMedia(REDUCED_MOTION_QUERY).matches;
11
+ }
12
+ function usePrefersReducedMotion() {
13
+ const [reduced, setReduced] = useState(getPrefersReducedMotion);
14
+ useEffect(()=>{
15
+ if ('function' != typeof window.matchMedia) return;
16
+ const mql = window.matchMedia(REDUCED_MOTION_QUERY);
17
+ const onChange = ()=>setReduced(mql.matches);
18
+ mql.addEventListener('change', onChange);
19
+ return ()=>mql.removeEventListener('change', onChange);
20
+ }, []);
21
+ return reduced;
22
+ }
23
+ const thinkingIndicatorVariants = cva('inline-flex max-w-full min-w-0 items-center text-muted-foreground', {
24
+ variants: {
25
+ size: {
26
+ sm: 'gap-1.5 text-xs [&_[data-slot=thinking-indicator-icon]]:size-3.5',
27
+ md: 'gap-2 text-sm [&_[data-slot=thinking-indicator-icon]]:size-4'
28
+ }
29
+ },
30
+ defaultVariants: {
31
+ size: 'md'
32
+ }
33
+ });
34
+ const DEFAULT_THINKING_INDICATOR_STRINGS = {
35
+ label: 'Thinking'
36
+ };
37
+ const ThinkingIndicator = /*#__PURE__*/ forwardRef(({ className, size = 'md', label, messages, interval = 2500, strings, icon, 'aria-label': ariaLabel, ...props }, ref)=>{
38
+ const text = {
39
+ ...DEFAULT_THINKING_INDICATOR_STRINGS,
40
+ ...strings
41
+ };
42
+ const staticLabel = label ?? text.label;
43
+ const name = ariaLabel ?? staticLabel;
44
+ const labels = messages && messages.length > 0 ? messages : [
45
+ staticLabel
46
+ ];
47
+ const reducedMotion = usePrefersReducedMotion();
48
+ const rotates = labels.length > 1 && !reducedMotion && interval > 0;
49
+ const rotationKey = `${rotates}\u0000${labels.join('\u0000')}`;
50
+ const [index, setIndex] = useState(0);
51
+ const [prevRotationKey, setPrevRotationKey] = useState(rotationKey);
52
+ if (rotationKey !== prevRotationKey) {
53
+ setPrevRotationKey(rotationKey);
54
+ setIndex(0);
55
+ }
56
+ useEffect(()=>{
57
+ if (!rotates) return;
58
+ const id = window.setInterval(()=>{
59
+ setIndex((current)=>(current + 1) % labels.length);
60
+ }, interval);
61
+ return ()=>window.clearInterval(id);
62
+ }, [
63
+ rotates,
64
+ labels.length,
65
+ interval,
66
+ rotationKey
67
+ ]);
68
+ const activeIndex = index < labels.length ? index : 0;
69
+ return /*#__PURE__*/ jsxs("div", {
70
+ ref: ref,
71
+ "data-slot": "thinking-indicator",
72
+ "data-size": size,
73
+ role: "status",
74
+ "aria-label": name,
75
+ className: cn(thinkingIndicatorVariants({
76
+ size
77
+ }), className),
78
+ ...props,
79
+ children: [
80
+ null !== icon && false !== icon && /*#__PURE__*/ jsx("span", {
81
+ "data-slot": "thinking-indicator-icon",
82
+ "aria-hidden": "true",
83
+ className: "inline-flex shrink-0 items-center justify-center [&>svg]:size-full",
84
+ children: icon ?? /*#__PURE__*/ jsx(Sparkles, {
85
+ className: "text-primary animate-pulse motion-reduce:animate-none"
86
+ })
87
+ }),
88
+ /*#__PURE__*/ jsx("span", {
89
+ "data-slot": "thinking-indicator-label",
90
+ "aria-hidden": "true",
91
+ className: "grid min-w-0",
92
+ children: labels.map((item, i)=>/*#__PURE__*/ jsx("span", {
93
+ "data-active": i === activeIndex,
94
+ className: "shimmer col-start-1 row-start-1 truncate transition-opacity duration-300 data-[active=false]:opacity-0 motion-reduce:transition-none",
95
+ children: item
96
+ }, i))
97
+ }),
98
+ /*#__PURE__*/ jsx("span", {
99
+ className: "sr-only",
100
+ children: name
101
+ })
102
+ ]
103
+ });
104
+ });
105
+ ThinkingIndicator.displayName = 'ThinkingIndicator';
106
+ export { DEFAULT_THINKING_INDICATOR_STRINGS, ThinkingIndicator, thinkingIndicatorVariants };
@@ -0,0 +1,359 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ ToolCallInput: ()=>ToolCallInput,
28
+ ToolCall: ()=>ToolCall,
29
+ ToolCallOutput: ()=>ToolCallOutput,
30
+ ToolCallError: ()=>ToolCallError,
31
+ DEFAULT_TOOL_CALL_STRINGS: ()=>DEFAULT_TOOL_CALL_STRINGS,
32
+ toolCallVariants: ()=>toolCallVariants,
33
+ ToolCallHeader: ()=>ToolCallHeader,
34
+ ToolCallContent: ()=>ToolCallContent,
35
+ ToolCallSection: ()=>ToolCallSection
36
+ });
37
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
38
+ const external_class_variance_authority_namespaceObject = require("class-variance-authority");
39
+ const external_lucide_react_namespaceObject = require("lucide-react");
40
+ const external_react_namespaceObject = require("react");
41
+ const index_cjs_namespaceObject = require("../../lib/index.cjs");
42
+ const external_collapsible_cjs_namespaceObject = require("./collapsible.cjs");
43
+ const external_json_tree_view_index_cjs_namespaceObject = require("./json-tree-view/index.cjs");
44
+ const DEFAULT_TOOL_CALL_STRINGS = {
45
+ pending: 'Pending',
46
+ executing: 'Running',
47
+ completed: 'Completed',
48
+ failed: 'Failed',
49
+ running: (name)=>`Running '${name}'`,
50
+ ran: (name, duration)=>duration ? `Ran '${name}' for ${duration}` : `Ran '${name}'`,
51
+ input: 'Input',
52
+ output: 'Output',
53
+ errors: 'Errors'
54
+ };
55
+ const ToolCallContext = /*#__PURE__*/ external_react_namespaceObject.createContext(null);
56
+ function useToolCallContext(component) {
57
+ const context = external_react_namespaceObject.useContext(ToolCallContext);
58
+ if (!context) throw new Error(`${component} must be used within a ToolCall`);
59
+ return context;
60
+ }
61
+ function mergeStrings(overrides) {
62
+ const merged = {
63
+ ...DEFAULT_TOOL_CALL_STRINGS
64
+ };
65
+ if (!overrides) return merged;
66
+ for (const key of Object.keys(overrides)){
67
+ const value = overrides[key];
68
+ if (void 0 !== value) merged[key] = value;
69
+ }
70
+ return merged;
71
+ }
72
+ const useIsomorphicLayoutEffect = "u" < typeof window ? external_react_namespaceObject.useEffect : external_react_namespaceObject.useLayoutEffect;
73
+ const TOGGLE_CLASSES = 'flex w-full min-w-0 items-center gap-2 rounded p-1 text-left transition-colors hover:text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring motion-reduce:transition-none';
74
+ const toolCallVariants = (0, external_class_variance_authority_namespaceObject.cva)('group/tool-call flex w-full min-w-0 flex-col text-muted-foreground', {
75
+ variants: {
76
+ size: {
77
+ sm: 'p-2 text-xs',
78
+ md: 'p-3 text-sm'
79
+ }
80
+ },
81
+ defaultVariants: {
82
+ size: 'md'
83
+ }
84
+ });
85
+ const ToolCall = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, status, size = 'md', open, defaultOpen, onOpenChange, strings, jsonTreeStrings, ...props }, ref)=>{
86
+ const [contentCount, setContentCount] = external_react_namespaceObject.useState(0);
87
+ const registerContent = external_react_namespaceObject.useCallback(()=>{
88
+ setContentCount((count)=>count + 1);
89
+ return ()=>setContentCount((count)=>count - 1);
90
+ }, []);
91
+ const context = external_react_namespaceObject.useMemo(()=>({
92
+ status,
93
+ strings: mergeStrings(strings),
94
+ jsonTreeStrings,
95
+ hasContent: contentCount > 0,
96
+ registerContent
97
+ }), [
98
+ status,
99
+ strings,
100
+ jsonTreeStrings,
101
+ contentCount,
102
+ registerContent
103
+ ]);
104
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ToolCallContext.Provider, {
105
+ value: context,
106
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_collapsible_cjs_namespaceObject.Collapsible, {
107
+ asChild: true,
108
+ open: open,
109
+ defaultOpen: defaultOpen,
110
+ onOpenChange: onOpenChange,
111
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
112
+ ref: ref,
113
+ "data-slot": "tool-call",
114
+ "data-status": status,
115
+ "data-size": size,
116
+ className: (0, index_cjs_namespaceObject.cn)(toolCallVariants({
117
+ size
118
+ }), className),
119
+ ...props
120
+ })
121
+ })
122
+ });
123
+ });
124
+ ToolCall.displayName = 'ToolCall';
125
+ const STATUS_ICONS = {
126
+ pending: external_lucide_react_namespaceObject.Clock,
127
+ executing: external_lucide_react_namespaceObject.Loader2,
128
+ completed: external_lucide_react_namespaceObject.CircleCheck,
129
+ failed: external_lucide_react_namespaceObject.CircleX
130
+ };
131
+ const toolCallStatusIconVariants = (0, external_class_variance_authority_namespaceObject.cva)('size-5 shrink-0 group-data-[size=sm]/tool-call:size-4', {
132
+ variants: {
133
+ status: {
134
+ pending: 'text-muted-foreground',
135
+ executing: 'animate-spin text-primary motion-reduce:animate-none',
136
+ completed: 'text-success',
137
+ failed: 'text-destructive'
138
+ }
139
+ }
140
+ });
141
+ const ToolCallHeader = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, name, duration, ...props }, ref)=>{
142
+ const { status, strings, hasContent } = useToolCallContext('ToolCallHeader');
143
+ const StatusIcon = STATUS_ICONS[status];
144
+ const finished = 'completed' === status || 'failed' === status;
145
+ const line = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
146
+ children: [
147
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(StatusIcon, {
148
+ "data-slot": "tool-call-status-icon",
149
+ "aria-hidden": "true",
150
+ className: toolCallStatusIconVariants({
151
+ status
152
+ })
153
+ }),
154
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
155
+ "data-slot": "tool-call-status",
156
+ className: "sr-only",
157
+ children: strings[status]
158
+ }),
159
+ ' ',
160
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
161
+ "data-slot": "tool-call-label",
162
+ className: "min-w-0 wrap-break-word",
163
+ children: finished ? strings.ran(name, duration) : strings.running(name)
164
+ })
165
+ ]
166
+ });
167
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
168
+ ref: ref,
169
+ "data-slot": "tool-call-header",
170
+ className: (0, index_cjs_namespaceObject.cn)('flex min-w-0', className),
171
+ ...props,
172
+ children: hasContent ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_collapsible_cjs_namespaceObject.CollapsibleTrigger, {
173
+ "data-slot": "tool-call-toggle",
174
+ className: (0, index_cjs_namespaceObject.cn)('group/tool-call-toggle', TOGGLE_CLASSES),
175
+ children: [
176
+ line,
177
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronDown, {
178
+ "aria-hidden": "true",
179
+ className: "size-4 shrink-0 transition-transform motion-reduce:transition-none group-data-[state=open]/tool-call-toggle:rotate-180"
180
+ })
181
+ ]
182
+ }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
183
+ className: "flex min-w-0 items-center gap-2 p-1",
184
+ children: line
185
+ })
186
+ });
187
+ });
188
+ ToolCallHeader.displayName = 'ToolCallHeader';
189
+ const ToolCallContent = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, ...props }, ref)=>{
190
+ const { registerContent } = useToolCallContext('ToolCallContent');
191
+ useIsomorphicLayoutEffect(()=>registerContent(), [
192
+ registerContent
193
+ ]);
194
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_collapsible_cjs_namespaceObject.CollapsibleContent, {
195
+ ref: ref,
196
+ "data-slot": "tool-call-content",
197
+ className: (0, index_cjs_namespaceObject.cn)('mt-2 ml-3 flex min-w-0 flex-col border-l pl-3 group-data-[size=sm]/tool-call:ml-2 group-data-[size=sm]/tool-call:pl-2', className),
198
+ ...props
199
+ });
200
+ });
201
+ ToolCallContent.displayName = 'ToolCallContent';
202
+ const ToolCallSection = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, title, open, defaultOpen = false, onOpenChange, children, ...props }, ref)=>{
203
+ useToolCallContext('ToolCallSection');
204
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_collapsible_cjs_namespaceObject.Collapsible, {
205
+ asChild: true,
206
+ open: open,
207
+ defaultOpen: defaultOpen,
208
+ onOpenChange: onOpenChange,
209
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
210
+ ref: ref,
211
+ "data-slot": "tool-call-section",
212
+ className: (0, index_cjs_namespaceObject.cn)('flex min-w-0 flex-col', className),
213
+ ...props,
214
+ children: [
215
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_collapsible_cjs_namespaceObject.CollapsibleTrigger, {
216
+ "data-slot": "tool-call-section-toggle",
217
+ className: (0, index_cjs_namespaceObject.cn)('group/tool-call-section-toggle', TOGGLE_CLASSES),
218
+ children: [
219
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronRight, {
220
+ "aria-hidden": "true",
221
+ className: "size-4 shrink-0 transition-transform motion-reduce:transition-none group-data-[state=open]/tool-call-section-toggle:rotate-90"
222
+ }),
223
+ title
224
+ ]
225
+ }),
226
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_collapsible_cjs_namespaceObject.CollapsibleContent, {
227
+ "data-slot": "tool-call-section-content",
228
+ className: "ml-7 min-w-0",
229
+ children: children
230
+ })
231
+ ]
232
+ })
233
+ });
234
+ });
235
+ ToolCallSection.displayName = 'ToolCallSection';
236
+ function isJsonContainer(value) {
237
+ if (Array.isArray(value)) return true;
238
+ if ('object' != typeof value || null === value) return false;
239
+ const prototype = Object.getPrototypeOf(value);
240
+ return prototype === Object.prototype || null === prototype;
241
+ }
242
+ const VIRTUALIZE_NODE_COUNT = 200;
243
+ function countNodes(nodes) {
244
+ let count = 0;
245
+ const stack = [
246
+ ...nodes
247
+ ];
248
+ while(stack.length > 0){
249
+ const node = stack.pop();
250
+ count += 1;
251
+ if (node.children) stack.push(...node.children);
252
+ }
253
+ return count;
254
+ }
255
+ function ToolCallJsonValue({ value }) {
256
+ const { jsonTreeStrings } = useToolCallContext('ToolCallJsonValue');
257
+ const nodes = external_react_namespaceObject.useMemo(()=>(0, external_json_tree_view_index_cjs_namespaceObject.buildJsonTree)({
258
+ value
259
+ }), [
260
+ value
261
+ ]);
262
+ const [opened, setOpened] = external_react_namespaceObject.useState({});
263
+ const collapsed = external_react_namespaceObject.useMemo(()=>Object.fromEntries((0, external_json_tree_view_index_cjs_namespaceObject.collectContainerPaths)(nodes).map(({ path })=>[
264
+ path,
265
+ !opened[path]
266
+ ])), [
267
+ nodes,
268
+ opened
269
+ ]);
270
+ const toggle = external_react_namespaceObject.useCallback((path)=>setOpened((prev)=>({
271
+ ...prev,
272
+ [path]: !prev[path]
273
+ })), []);
274
+ const virtualized = external_react_namespaceObject.useMemo(()=>countNodes(nodes) > VIRTUALIZE_NODE_COUNT, [
275
+ nodes
276
+ ]);
277
+ const [scrollElement, setScrollElement] = external_react_namespaceObject.useState(null);
278
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
279
+ ref: setScrollElement,
280
+ "data-slot": "tool-call-value",
281
+ className: "my-2 max-h-80 overflow-auto rounded-md border bg-background",
282
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_json_tree_view_index_cjs_namespaceObject.JsonTreeView, {
283
+ nodes: nodes,
284
+ collapsed: collapsed,
285
+ onToggleCollapsed: toggle,
286
+ readOnly: true,
287
+ strings: jsonTreeStrings,
288
+ virtualized: virtualized,
289
+ scrollElement: virtualized ? scrollElement : void 0
290
+ })
291
+ });
292
+ }
293
+ function ToolCallTextValue({ value }) {
294
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
295
+ tabIndex: 0,
296
+ "data-slot": "tool-call-value",
297
+ className: "my-2 max-h-45 overflow-y-auto rounded bg-muted px-3 py-2 text-xs wrap-break-word whitespace-pre-wrap outline-hidden focus-visible:ring-2 focus-visible:ring-ring",
298
+ children: String(value)
299
+ });
300
+ }
301
+ function ToolCallValue({ value, renderValue }) {
302
+ const custom = renderValue?.(value);
303
+ if (void 0 !== custom) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {
304
+ children: custom
305
+ });
306
+ if (!isJsonContainer(value)) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ToolCallTextValue, {
307
+ value: value
308
+ });
309
+ if (0 === Object.keys(value).length) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ToolCallTextValue, {
310
+ value: Array.isArray(value) ? '[]' : '{}'
311
+ });
312
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ToolCallJsonValue, {
313
+ value: value
314
+ });
315
+ }
316
+ function createValueSection(slot, titleKey, displayName) {
317
+ const Section = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ value, renderValue, ...props }, ref)=>{
318
+ const { strings } = useToolCallContext(displayName);
319
+ if (null == value) return null;
320
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ToolCallSection, {
321
+ ref: ref,
322
+ "data-slot": `tool-call-${slot}`,
323
+ title: strings[titleKey],
324
+ ...props,
325
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ToolCallValue, {
326
+ value: value,
327
+ renderValue: renderValue
328
+ })
329
+ });
330
+ });
331
+ Section.displayName = displayName;
332
+ return Section;
333
+ }
334
+ const ToolCallInput = createValueSection('input', 'input', 'ToolCallInput');
335
+ const ToolCallOutput = createValueSection('output', 'output', 'ToolCallOutput');
336
+ const ToolCallError = createValueSection('error', 'errors', 'ToolCallError');
337
+ exports.DEFAULT_TOOL_CALL_STRINGS = __webpack_exports__.DEFAULT_TOOL_CALL_STRINGS;
338
+ exports.ToolCall = __webpack_exports__.ToolCall;
339
+ exports.ToolCallContent = __webpack_exports__.ToolCallContent;
340
+ exports.ToolCallError = __webpack_exports__.ToolCallError;
341
+ exports.ToolCallHeader = __webpack_exports__.ToolCallHeader;
342
+ exports.ToolCallInput = __webpack_exports__.ToolCallInput;
343
+ exports.ToolCallOutput = __webpack_exports__.ToolCallOutput;
344
+ exports.ToolCallSection = __webpack_exports__.ToolCallSection;
345
+ exports.toolCallVariants = __webpack_exports__.toolCallVariants;
346
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
347
+ "DEFAULT_TOOL_CALL_STRINGS",
348
+ "ToolCall",
349
+ "ToolCallContent",
350
+ "ToolCallError",
351
+ "ToolCallHeader",
352
+ "ToolCallInput",
353
+ "ToolCallOutput",
354
+ "ToolCallSection",
355
+ "toolCallVariants"
356
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
357
+ Object.defineProperty(exports, '__esModule', {
358
+ value: true
359
+ });