@djangocfg/ui-tools 2.1.385 → 2.1.389
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 +25 -11
- package/dist/ChatRoot-EFNXQXXN.cjs +15 -0
- package/dist/{ChatRoot-JVR3M3H2.mjs.map → ChatRoot-EFNXQXXN.cjs.map} +1 -1
- package/dist/ChatRoot-FITF5RVP.mjs +6 -0
- package/dist/{ChatRoot-LXIUBOXF.cjs.map → ChatRoot-FITF5RVP.mjs.map} +1 -1
- package/dist/{DocsLayout-2P3ONDWJ.mjs → DocsLayout-EKASBSP7.mjs} +3 -3
- package/dist/{DocsLayout-2P3ONDWJ.mjs.map → DocsLayout-EKASBSP7.mjs.map} +1 -1
- package/dist/{DocsLayout-2YZNS5VK.cjs → DocsLayout-OURFYWQE.cjs} +8 -8
- package/dist/{DocsLayout-2YZNS5VK.cjs.map → DocsLayout-OURFYWQE.cjs.map} +1 -1
- package/dist/MapContainer-AKIPABJK.mjs +4 -0
- package/dist/MapContainer-AKIPABJK.mjs.map +1 -0
- package/dist/MapContainer-STVDMC36.cjs +17 -0
- package/dist/MapContainer-STVDMC36.cjs.map +1 -0
- package/dist/{chunk-HIK6BPL7.mjs → chunk-2NG4SXEP.mjs} +6 -5
- package/dist/chunk-2NG4SXEP.mjs.map +1 -0
- package/dist/chunk-4LFB7I5K.cjs +1387 -0
- package/dist/chunk-4LFB7I5K.cjs.map +1 -0
- package/dist/{MapContainer-76YL2JXL.cjs → chunk-5D2OCOPQ.cjs} +3 -2
- package/dist/chunk-5D2OCOPQ.cjs.map +1 -0
- package/dist/chunk-6ZX2G25W.mjs +1361 -0
- package/dist/chunk-6ZX2G25W.mjs.map +1 -0
- package/dist/{MapContainer-7HXBI3OH.mjs → chunk-7CWGZPO3.mjs} +3 -3
- package/dist/chunk-7CWGZPO3.mjs.map +1 -0
- package/dist/{chunk-FIRK5CEH.cjs → chunk-7IYXZUJO.cjs} +8 -4
- package/dist/chunk-7IYXZUJO.cjs.map +1 -0
- package/dist/{chunk-PEKBT75W.mjs → chunk-DMX7W4XZ.mjs} +53 -1387
- package/dist/chunk-DMX7W4XZ.mjs.map +1 -0
- package/dist/chunk-NTVBIIUD.mjs +1439 -0
- package/dist/chunk-NTVBIIUD.mjs.map +1 -0
- package/dist/{chunk-HPK3EWBF.cjs → chunk-TBSHZO5R.cjs} +50 -1409
- package/dist/chunk-TBSHZO5R.cjs.map +1 -0
- package/dist/chunk-W75B7Y6C.cjs +1478 -0
- package/dist/chunk-W75B7Y6C.cjs.map +1 -0
- package/dist/index.cjs +1269 -1790
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +660 -623
- package/dist/index.d.ts +660 -623
- package/dist/index.mjs +856 -1427
- package/dist/index.mjs.map +1 -1
- package/dist/launcher-5Y42OBSN.mjs +6 -0
- package/dist/launcher-5Y42OBSN.mjs.map +1 -0
- package/dist/launcher-PMW2YB24.cjs +59 -0
- package/dist/launcher-PMW2YB24.cjs.map +1 -0
- package/package.json +23 -18
- package/src/components/index.ts +2 -2
- package/src/index.ts +20 -2
- package/src/tools/AudioPlayer/lazy.tsx +100 -0
- package/src/tools/Chat/README.md +85 -1
- package/src/tools/Chat/components/MessageBubble.tsx +1 -1
- package/src/tools/Chat/context/ChatProvider.tsx +42 -0
- package/src/tools/Chat/index.ts +1 -1
- package/src/tools/Chat/lazy.tsx +300 -1
- package/src/tools/CodeEditor/lazy.tsx +70 -0
- package/src/tools/Map/lazy.tsx +38 -1
- package/src/tools/MarkdownEditor/lazy.tsx +42 -0
- package/src/{components/markdown → tools}/MarkdownMessage/CodeBlock.tsx +1 -1
- package/src/{components/markdown → tools}/MarkdownMessage/CollapseToggle.tsx +1 -1
- package/src/{components/markdown → tools}/MarkdownMessage/MarkdownMessage.tsx +1 -1
- package/src/{components/markdown → tools}/MarkdownMessage/components.tsx +2 -2
- package/src/tools/OpenapiViewer/components/DocsLayout/ApiIntroSection.tsx +1 -1
- package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/Header/index.tsx +1 -1
- package/src/tools/SpeechRecognition/README.md +48 -0
- package/dist/ChatRoot-JVR3M3H2.mjs +0 -5
- package/dist/ChatRoot-LXIUBOXF.cjs +0 -14
- package/dist/MapContainer-76YL2JXL.cjs.map +0 -1
- package/dist/MapContainer-7HXBI3OH.mjs.map +0 -1
- package/dist/chunk-FIRK5CEH.cjs.map +0 -1
- package/dist/chunk-HIK6BPL7.mjs.map +0 -1
- package/dist/chunk-HPK3EWBF.cjs.map +0 -1
- package/dist/chunk-PEKBT75W.mjs.map +0 -1
- package/src/components/markdown/index.ts +0 -19
- /package/src/{components/markdown → hooks}/useCollapsibleContent.ts +0 -0
- /package/src/{components/markdown → tools}/MarkdownMessage/ActionRow.tsx +0 -0
- /package/src/{components/markdown → tools}/MarkdownMessage/ChatMessageRow.tsx +0 -0
- /package/src/{components/markdown → tools}/MarkdownMessage/README.md +0 -0
- /package/src/{components/markdown → tools}/MarkdownMessage/index.ts +0 -0
- /package/src/{components/markdown → tools}/MarkdownMessage/linkRules.ts +0 -0
- /package/src/{components/markdown → tools}/MarkdownMessage/plainText.ts +0 -0
- /package/src/{components/markdown → tools}/MarkdownMessage/sanitize.ts +0 -0
- /package/src/{components/markdown → tools}/MarkdownMessage/types.ts +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkW75B7Y6C_cjs = require('./chunk-W75B7Y6C.cjs');
|
|
4
|
+
var chunk4LFB7I5K_cjs = require('./chunk-4LFB7I5K.cjs');
|
|
5
|
+
var chunkTBSHZO5R_cjs = require('./chunk-TBSHZO5R.cjs');
|
|
4
6
|
var chunkFEN5S772_cjs = require('./chunk-FEN5S772.cjs');
|
|
5
7
|
var chunkQJ6GTUCO_cjs = require('./chunk-QJ6GTUCO.cjs');
|
|
6
8
|
var chunkYDPDTOSP_cjs = require('./chunk-YDPDTOSP.cjs');
|
|
@@ -8,22 +10,24 @@ var chunkKNDLV4PI_cjs = require('./chunk-KNDLV4PI.cjs');
|
|
|
8
10
|
var chunk5I5QNGUG_cjs = require('./chunk-5I5QNGUG.cjs');
|
|
9
11
|
var chunkYW5IVWHQ_cjs = require('./chunk-YW5IVWHQ.cjs');
|
|
10
12
|
var chunk76NNDZH6_cjs = require('./chunk-76NNDZH6.cjs');
|
|
11
|
-
|
|
13
|
+
require('./chunk-ADEN3UA4.cjs');
|
|
12
14
|
var chunkYXZ6GU7H_cjs = require('./chunk-YXZ6GU7H.cjs');
|
|
13
15
|
var chunkFVVF7VCD_cjs = require('./chunk-FVVF7VCD.cjs');
|
|
16
|
+
var chunk5D2OCOPQ_cjs = require('./chunk-5D2OCOPQ.cjs');
|
|
14
17
|
var chunk7EYHNP3E_cjs = require('./chunk-7EYHNP3E.cjs');
|
|
15
|
-
var
|
|
18
|
+
var chunk7IYXZUJO_cjs = require('./chunk-7IYXZUJO.cjs');
|
|
16
19
|
var chunkT3MWM23F_cjs = require('./chunk-T3MWM23F.cjs');
|
|
17
20
|
require('./chunk-FP2RLYQZ.cjs');
|
|
18
21
|
var chunkOLISEQHS_cjs = require('./chunk-OLISEQHS.cjs');
|
|
19
|
-
var
|
|
20
|
-
var lib = require('@djangocfg/ui-core/lib');
|
|
21
|
-
var i18n = require('@djangocfg/i18n');
|
|
22
|
+
var maplibre = require('react-map-gl/maplibre');
|
|
22
23
|
var jsxRuntime = require('react/jsx-runtime');
|
|
23
|
-
var
|
|
24
|
+
var react = require('react');
|
|
25
|
+
var reactDom = require('react-dom');
|
|
24
26
|
var hooks = require('@djangocfg/ui-core/hooks');
|
|
27
|
+
var lucideReact = require('lucide-react');
|
|
25
28
|
var components = require('@djangocfg/ui-core/components');
|
|
26
|
-
var
|
|
29
|
+
var lib = require('@djangocfg/ui-core/lib');
|
|
30
|
+
var react$1 = require('@tiptap/react');
|
|
27
31
|
var StarterKit = require('@tiptap/starter-kit');
|
|
28
32
|
var Placeholder = require('@tiptap/extension-placeholder');
|
|
29
33
|
var Mention = require('@tiptap/extension-mention');
|
|
@@ -33,212 +37,871 @@ var core = require('@tiptap/core');
|
|
|
33
37
|
|
|
34
38
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
35
39
|
|
|
36
|
-
function _interopNamespace(e) {
|
|
37
|
-
if (e && e.__esModule) return e;
|
|
38
|
-
var n = Object.create(null);
|
|
39
|
-
if (e) {
|
|
40
|
-
Object.keys(e).forEach(function (k) {
|
|
41
|
-
if (k !== 'default') {
|
|
42
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
43
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function () { return e[k]; }
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
n.default = e;
|
|
51
|
-
return Object.freeze(n);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
55
40
|
var StarterKit__default = /*#__PURE__*/_interopDefault(StarterKit);
|
|
56
41
|
var Placeholder__default = /*#__PURE__*/_interopDefault(Placeholder);
|
|
57
42
|
var Mention__default = /*#__PURE__*/_interopDefault(Mention);
|
|
58
43
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
63
|
-
"div",
|
|
64
|
-
{
|
|
65
|
-
className: lib.cn(
|
|
66
|
-
"inline-block h-8 w-8 animate-spin rounded-full",
|
|
67
|
-
"border-4 border-solid border-current border-r-transparent",
|
|
68
|
-
"align-[-0.125em] motion-reduce:animate-[spin_1.5s_linear_infinite]",
|
|
69
|
-
className
|
|
70
|
-
),
|
|
71
|
-
role: "status",
|
|
72
|
-
"aria-label": loadingLabel
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
chunkOLISEQHS_cjs.__name(Spinner, "Spinner");
|
|
77
|
-
function LoadingFallback({
|
|
78
|
-
minHeight = 200,
|
|
79
|
-
showText = true,
|
|
80
|
-
text,
|
|
81
|
-
className
|
|
82
|
-
}) {
|
|
83
|
-
const t = i18n.useAppT();
|
|
84
|
-
const loadingText = text ?? t("ui.form.loading");
|
|
85
|
-
const height = typeof minHeight === "number" ? `${minHeight}px` : minHeight;
|
|
86
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
87
|
-
"div",
|
|
88
|
-
{
|
|
89
|
-
className: lib.cn(
|
|
90
|
-
"flex items-center justify-center bg-muted/30 rounded-lg",
|
|
91
|
-
className
|
|
92
|
-
),
|
|
93
|
-
style: { minHeight: height },
|
|
94
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
|
|
95
|
-
/* @__PURE__ */ jsxRuntime.jsx(Spinner, { className: "text-primary" }),
|
|
96
|
-
showText && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-3 text-sm text-muted-foreground", children: loadingText })
|
|
97
|
-
] })
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
chunkOLISEQHS_cjs.__name(LoadingFallback, "LoadingFallback");
|
|
102
|
-
function CardLoadingFallback({
|
|
103
|
-
title,
|
|
104
|
-
description,
|
|
105
|
-
minHeight = 200,
|
|
106
|
-
className
|
|
44
|
+
var DefaultPin = react.memo(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(function DefaultPin2({
|
|
45
|
+
size = 24,
|
|
46
|
+
color = "#ef4444"
|
|
107
47
|
}) {
|
|
108
|
-
const t = i18n.useAppT();
|
|
109
|
-
const cardTitle = title ?? t("ui.states.loading");
|
|
110
|
-
const height = typeof minHeight === "number" ? `${minHeight}px` : minHeight;
|
|
111
48
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
112
|
-
"
|
|
49
|
+
"svg",
|
|
113
50
|
{
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
51
|
+
width: size,
|
|
52
|
+
height: size,
|
|
53
|
+
viewBox: "0 0 24 24",
|
|
54
|
+
fill: "none",
|
|
55
|
+
style: { cursor: "pointer" },
|
|
118
56
|
children: [
|
|
119
|
-
/* @__PURE__ */ jsxRuntime.
|
|
120
|
-
|
|
121
|
-
description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: description })
|
|
122
|
-
] }),
|
|
123
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
124
|
-
"div",
|
|
57
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
58
|
+
"path",
|
|
125
59
|
{
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
60
|
+
d: "M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7z",
|
|
61
|
+
fill: color,
|
|
62
|
+
stroke: "#fff",
|
|
63
|
+
strokeWidth: "1.5"
|
|
129
64
|
}
|
|
130
|
-
)
|
|
65
|
+
),
|
|
66
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "9", r: "2.5", fill: "#fff" })
|
|
131
67
|
]
|
|
132
68
|
}
|
|
133
69
|
);
|
|
134
|
-
}
|
|
135
|
-
chunkOLISEQHS_cjs.__name(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
70
|
+
}, "DefaultPin"));
|
|
71
|
+
react.memo(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(function MapMarker2({
|
|
72
|
+
marker,
|
|
73
|
+
onClick,
|
|
74
|
+
children,
|
|
75
|
+
anchor = "bottom",
|
|
76
|
+
draggable = false,
|
|
77
|
+
onDragStart,
|
|
78
|
+
onDrag,
|
|
79
|
+
onDragEnd,
|
|
80
|
+
color,
|
|
81
|
+
size
|
|
139
82
|
}) {
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
83
|
+
const handleClick = react.useCallback(
|
|
84
|
+
(e) => {
|
|
85
|
+
e.originalEvent.stopPropagation();
|
|
86
|
+
onClick?.(marker);
|
|
87
|
+
},
|
|
88
|
+
[onClick, marker]
|
|
89
|
+
);
|
|
90
|
+
const handleDragStart = react.useCallback(
|
|
91
|
+
(e) => {
|
|
92
|
+
onDragStart?.(marker);
|
|
93
|
+
},
|
|
94
|
+
[onDragStart, marker]
|
|
95
|
+
);
|
|
96
|
+
const handleDrag = react.useCallback(
|
|
97
|
+
(e) => {
|
|
98
|
+
onDrag?.(marker, e.lngLat);
|
|
99
|
+
},
|
|
100
|
+
[onDrag, marker]
|
|
101
|
+
);
|
|
102
|
+
const handleDragEnd = react.useCallback(
|
|
103
|
+
(e) => {
|
|
104
|
+
onDragEnd?.(marker, e.lngLat);
|
|
105
|
+
},
|
|
106
|
+
[onDragEnd, marker]
|
|
107
|
+
);
|
|
143
108
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
144
|
-
|
|
109
|
+
maplibre.Marker,
|
|
145
110
|
{
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
156
|
-
"svg",
|
|
157
|
-
{
|
|
158
|
-
className: "h-5 w-5 text-muted-foreground",
|
|
159
|
-
fill: "none",
|
|
160
|
-
viewBox: "0 0 24 24",
|
|
161
|
-
stroke: "currentColor",
|
|
162
|
-
children: [
|
|
163
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
164
|
-
"path",
|
|
165
|
-
{
|
|
166
|
-
strokeLinecap: "round",
|
|
167
|
-
strokeLinejoin: "round",
|
|
168
|
-
strokeWidth: 2,
|
|
169
|
-
d: "M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"
|
|
170
|
-
}
|
|
171
|
-
),
|
|
172
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
173
|
-
"path",
|
|
174
|
-
{
|
|
175
|
-
strokeLinecap: "round",
|
|
176
|
-
strokeLinejoin: "round",
|
|
177
|
-
strokeWidth: 2,
|
|
178
|
-
d: "M15 11a3 3 0 11-6 0 3 3 0 016 0z"
|
|
179
|
-
}
|
|
180
|
-
)
|
|
181
|
-
]
|
|
182
|
-
}
|
|
183
|
-
) })
|
|
184
|
-
] }),
|
|
185
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-3 text-sm text-muted-foreground", children: loadingText })
|
|
186
|
-
] })
|
|
111
|
+
longitude: marker.longitude,
|
|
112
|
+
latitude: marker.latitude,
|
|
113
|
+
anchor,
|
|
114
|
+
draggable,
|
|
115
|
+
onClick: handleClick,
|
|
116
|
+
onDragStart: handleDragStart,
|
|
117
|
+
onDrag: handleDrag,
|
|
118
|
+
onDragEnd: handleDragEnd,
|
|
119
|
+
children: children ?? /* @__PURE__ */ jsxRuntime.jsx(DefaultPin, { color, size })
|
|
187
120
|
}
|
|
188
121
|
);
|
|
189
|
-
}
|
|
190
|
-
chunkOLISEQHS_cjs.__name(
|
|
191
|
-
|
|
122
|
+
}, "MapMarker"));
|
|
123
|
+
react.memo(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(function MapPopup2({
|
|
124
|
+
longitude,
|
|
125
|
+
latitude,
|
|
126
|
+
onClose,
|
|
192
127
|
children,
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
128
|
+
anchor = "bottom",
|
|
129
|
+
closeOnClick = true,
|
|
130
|
+
closeButton = true,
|
|
131
|
+
className,
|
|
132
|
+
maxWidth = "300px",
|
|
133
|
+
offset: offset2 = 15
|
|
199
134
|
}) {
|
|
200
|
-
|
|
201
|
-
|
|
135
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
136
|
+
maplibre.Popup,
|
|
202
137
|
{
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
138
|
+
longitude,
|
|
139
|
+
latitude,
|
|
140
|
+
anchor,
|
|
141
|
+
onClose,
|
|
142
|
+
closeOnClick,
|
|
143
|
+
closeButton,
|
|
144
|
+
className,
|
|
145
|
+
maxWidth,
|
|
146
|
+
offset: offset2,
|
|
147
|
+
children
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
}, "MapPopup"));
|
|
151
|
+
|
|
152
|
+
// src/tools/Map/layers/cluster.ts
|
|
153
|
+
var DEFAULT_COLORS = ["#51bbd6", "#f1f075", "#f28cb1"];
|
|
154
|
+
var DEFAULT_RADII = [20, 30, 40];
|
|
155
|
+
var DEFAULT_THRESHOLDS = [100, 750];
|
|
156
|
+
var DEFAULT_HOVER_COLOR = "#3b82f6";
|
|
157
|
+
function createClusterLayers(options) {
|
|
158
|
+
const {
|
|
159
|
+
sourceId,
|
|
160
|
+
colors = DEFAULT_COLORS,
|
|
161
|
+
radii = DEFAULT_RADII,
|
|
162
|
+
thresholds = DEFAULT_THRESHOLDS,
|
|
163
|
+
hoverColor = DEFAULT_HOVER_COLOR
|
|
164
|
+
} = options;
|
|
165
|
+
const cluster = {
|
|
166
|
+
id: `${sourceId}-clusters`,
|
|
167
|
+
type: "circle",
|
|
168
|
+
source: sourceId,
|
|
169
|
+
filter: ["has", "point_count"],
|
|
170
|
+
paint: {
|
|
171
|
+
"circle-color": [
|
|
172
|
+
"case",
|
|
173
|
+
["boolean", ["feature-state", "hover"], false],
|
|
174
|
+
hoverColor,
|
|
175
|
+
[
|
|
176
|
+
"step",
|
|
177
|
+
["get", "point_count"],
|
|
178
|
+
colors[0],
|
|
179
|
+
thresholds[0],
|
|
180
|
+
colors[1],
|
|
181
|
+
thresholds[1],
|
|
182
|
+
colors[2]
|
|
183
|
+
]
|
|
184
|
+
],
|
|
185
|
+
"circle-radius": [
|
|
186
|
+
"step",
|
|
187
|
+
["get", "point_count"],
|
|
188
|
+
radii[0],
|
|
189
|
+
thresholds[0],
|
|
190
|
+
radii[1],
|
|
191
|
+
thresholds[1],
|
|
192
|
+
radii[2]
|
|
193
|
+
],
|
|
194
|
+
"circle-stroke-width": 2,
|
|
195
|
+
"circle-stroke-color": "#fff"
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
const clusterCount = {
|
|
199
|
+
id: `${sourceId}-cluster-count`,
|
|
200
|
+
type: "symbol",
|
|
201
|
+
source: sourceId,
|
|
202
|
+
filter: ["has", "point_count"],
|
|
203
|
+
layout: {
|
|
204
|
+
"text-field": ["get", "point_count_abbreviated"],
|
|
205
|
+
"text-size": 12
|
|
206
|
+
},
|
|
207
|
+
paint: {
|
|
208
|
+
"text-color": "#000"
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
const unclusteredPoint = {
|
|
212
|
+
id: `${sourceId}-unclustered-point`,
|
|
213
|
+
type: "circle",
|
|
214
|
+
source: sourceId,
|
|
215
|
+
filter: ["!", ["has", "point_count"]],
|
|
216
|
+
paint: {
|
|
217
|
+
"circle-color": [
|
|
218
|
+
"case",
|
|
219
|
+
["boolean", ["feature-state", "hover"], false],
|
|
220
|
+
hoverColor,
|
|
221
|
+
colors[0]
|
|
222
|
+
],
|
|
223
|
+
"circle-radius": [
|
|
224
|
+
"case",
|
|
225
|
+
["boolean", ["feature-state", "hover"], false],
|
|
226
|
+
10,
|
|
227
|
+
8
|
|
228
|
+
],
|
|
229
|
+
"circle-stroke-width": 2,
|
|
230
|
+
"circle-stroke-color": "#fff"
|
|
207
231
|
}
|
|
208
|
-
|
|
209
|
-
return
|
|
232
|
+
};
|
|
233
|
+
return { cluster, clusterCount, unclusteredPoint };
|
|
234
|
+
}
|
|
235
|
+
chunkOLISEQHS_cjs.__name(createClusterLayers, "createClusterLayers");
|
|
236
|
+
var POPUP_STYLE_ID = "map-cluster-popup-styles";
|
|
237
|
+
function injectPopupStyles() {
|
|
238
|
+
if (typeof document === "undefined") return;
|
|
239
|
+
if (document.getElementById(POPUP_STYLE_ID)) return;
|
|
240
|
+
const style = document.createElement("style");
|
|
241
|
+
style.id = POPUP_STYLE_ID;
|
|
242
|
+
style.textContent = `
|
|
243
|
+
.maplibregl-popup.map-popup-clean .maplibregl-popup-content {
|
|
244
|
+
padding: 0 !important;
|
|
245
|
+
background: transparent !important;
|
|
246
|
+
box-shadow: none !important;
|
|
247
|
+
border-radius: 0 !important;
|
|
248
|
+
}
|
|
249
|
+
.maplibregl-popup.map-popup-clean .maplibregl-popup-tip {
|
|
250
|
+
display: none !important;
|
|
251
|
+
}
|
|
252
|
+
`;
|
|
253
|
+
document.head.appendChild(style);
|
|
254
|
+
}
|
|
255
|
+
chunkOLISEQHS_cjs.__name(injectPopupStyles, "injectPopupStyles");
|
|
256
|
+
react.memo(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(function MapCluster2({
|
|
257
|
+
sourceId,
|
|
258
|
+
data,
|
|
259
|
+
clusterRadius = 50,
|
|
260
|
+
clusterMaxZoom = 14,
|
|
261
|
+
onClusterClick,
|
|
262
|
+
onPointClick,
|
|
263
|
+
renderPopup,
|
|
264
|
+
popupAnchor = "bottom",
|
|
265
|
+
popupOffset = 15,
|
|
266
|
+
panOffsetX = 0,
|
|
267
|
+
panOffsetY = 150,
|
|
268
|
+
colors,
|
|
269
|
+
radii,
|
|
270
|
+
thresholds,
|
|
271
|
+
hoverColor
|
|
272
|
+
}) {
|
|
273
|
+
const { current: map } = maplibre.useMap();
|
|
274
|
+
const [selectedFeature, setSelectedFeature] = react.useState(null);
|
|
275
|
+
const [popupCoords, setPopupCoords] = react.useState(null);
|
|
276
|
+
react.useEffect(() => {
|
|
277
|
+
injectPopupStyles();
|
|
278
|
+
}, []);
|
|
279
|
+
const layerOptions = {
|
|
280
|
+
sourceId,
|
|
281
|
+
colors,
|
|
282
|
+
radii,
|
|
283
|
+
thresholds,
|
|
284
|
+
hoverColor
|
|
285
|
+
};
|
|
286
|
+
const { cluster, clusterCount, unclusteredPoint } = createClusterLayers(layerOptions);
|
|
287
|
+
const handleClosePopup = react.useCallback(() => {
|
|
288
|
+
setSelectedFeature(null);
|
|
289
|
+
setPopupCoords(null);
|
|
290
|
+
}, []);
|
|
291
|
+
const handleClick = react.useCallback(
|
|
292
|
+
async (event) => {
|
|
293
|
+
if (!map) return;
|
|
294
|
+
const features = map.queryRenderedFeatures(event.point, {
|
|
295
|
+
layers: [cluster.id, unclusteredPoint.id]
|
|
296
|
+
});
|
|
297
|
+
if (!features || features.length === 0) return;
|
|
298
|
+
const feature = features[0];
|
|
299
|
+
const geometry = feature.geometry;
|
|
300
|
+
if (geometry.type !== "Point") return;
|
|
301
|
+
const coordinates = geometry.coordinates;
|
|
302
|
+
const clusterId = feature.properties?.cluster_id;
|
|
303
|
+
if (clusterId) {
|
|
304
|
+
const source = map.getSource(sourceId);
|
|
305
|
+
if (!source) return;
|
|
306
|
+
try {
|
|
307
|
+
const zoom = await source.getClusterExpansionZoom(clusterId);
|
|
308
|
+
map.easeTo({
|
|
309
|
+
center: coordinates,
|
|
310
|
+
zoom,
|
|
311
|
+
duration: 500
|
|
312
|
+
});
|
|
313
|
+
onClusterClick?.(clusterId, coordinates);
|
|
314
|
+
} catch (error) {
|
|
315
|
+
console.error("Error expanding cluster:", error);
|
|
316
|
+
}
|
|
317
|
+
} else {
|
|
318
|
+
onPointClick?.(feature);
|
|
319
|
+
if (renderPopup) {
|
|
320
|
+
map.easeTo({
|
|
321
|
+
center: coordinates,
|
|
322
|
+
duration: 300,
|
|
323
|
+
offset: [panOffsetX, panOffsetY]
|
|
324
|
+
});
|
|
325
|
+
setSelectedFeature(feature);
|
|
326
|
+
setPopupCoords(coordinates);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
[map, sourceId, cluster.id, unclusteredPoint.id, onClusterClick, onPointClick, renderPopup, panOffsetX, panOffsetY]
|
|
331
|
+
);
|
|
332
|
+
const handleMapClick = react.useCallback(
|
|
333
|
+
(event) => {
|
|
334
|
+
if (!map) return;
|
|
335
|
+
const features = map.queryRenderedFeatures(event.point, {
|
|
336
|
+
layers: [cluster.id, unclusteredPoint.id]
|
|
337
|
+
});
|
|
338
|
+
if (!features || features.length === 0) {
|
|
339
|
+
handleClosePopup();
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
[map, cluster.id, unclusteredPoint.id, handleClosePopup]
|
|
343
|
+
);
|
|
344
|
+
react.useEffect(() => {
|
|
345
|
+
if (!map) return;
|
|
346
|
+
const clusterLayerId = cluster.id;
|
|
347
|
+
const pointLayerId = unclusteredPoint.id;
|
|
348
|
+
let currentHoveredId = null;
|
|
349
|
+
const clearHoverState = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
350
|
+
if (currentHoveredId !== null) {
|
|
351
|
+
map.setFeatureState(
|
|
352
|
+
{ source: sourceId, id: currentHoveredId },
|
|
353
|
+
{ hover: false }
|
|
354
|
+
);
|
|
355
|
+
currentHoveredId = null;
|
|
356
|
+
}
|
|
357
|
+
}, "clearHoverState");
|
|
358
|
+
const handleMouseMove = /* @__PURE__ */ chunkOLISEQHS_cjs.__name((e) => {
|
|
359
|
+
const features = map.queryRenderedFeatures(e.point, {
|
|
360
|
+
layers: [clusterLayerId, pointLayerId]
|
|
361
|
+
});
|
|
362
|
+
if (features.length > 0) {
|
|
363
|
+
map.getCanvas().style.cursor = "pointer";
|
|
364
|
+
const feature = features[0];
|
|
365
|
+
const featureId = feature.id;
|
|
366
|
+
if (featureId !== void 0 && featureId !== currentHoveredId) {
|
|
367
|
+
clearHoverState();
|
|
368
|
+
currentHoveredId = featureId;
|
|
369
|
+
map.setFeatureState(
|
|
370
|
+
{ source: sourceId, id: featureId },
|
|
371
|
+
{ hover: true }
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
} else {
|
|
375
|
+
map.getCanvas().style.cursor = "";
|
|
376
|
+
clearHoverState();
|
|
377
|
+
}
|
|
378
|
+
}, "handleMouseMove");
|
|
379
|
+
const handleMouseLeave = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
380
|
+
map.getCanvas().style.cursor = "";
|
|
381
|
+
clearHoverState();
|
|
382
|
+
}, "handleMouseLeave");
|
|
383
|
+
map.on("click", clusterLayerId, handleClick);
|
|
384
|
+
map.on("click", pointLayerId, handleClick);
|
|
385
|
+
map.on("click", handleMapClick);
|
|
386
|
+
map.on("mousemove", clusterLayerId, handleMouseMove);
|
|
387
|
+
map.on("mousemove", pointLayerId, handleMouseMove);
|
|
388
|
+
map.on("mouseleave", clusterLayerId, handleMouseLeave);
|
|
389
|
+
map.on("mouseleave", pointLayerId, handleMouseLeave);
|
|
390
|
+
return () => {
|
|
391
|
+
clearHoverState();
|
|
392
|
+
map.off("click", clusterLayerId, handleClick);
|
|
393
|
+
map.off("click", pointLayerId, handleClick);
|
|
394
|
+
map.off("click", handleMapClick);
|
|
395
|
+
map.off("mousemove", clusterLayerId, handleMouseMove);
|
|
396
|
+
map.off("mousemove", pointLayerId, handleMouseMove);
|
|
397
|
+
map.off("mouseleave", clusterLayerId, handleMouseLeave);
|
|
398
|
+
map.off("mouseleave", pointLayerId, handleMouseLeave);
|
|
399
|
+
};
|
|
400
|
+
}, [map, sourceId, cluster.id, unclusteredPoint.id, handleClick, handleMapClick]);
|
|
401
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
402
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
403
|
+
maplibre.Source,
|
|
404
|
+
{
|
|
405
|
+
id: sourceId,
|
|
406
|
+
type: "geojson",
|
|
407
|
+
data,
|
|
408
|
+
cluster: true,
|
|
409
|
+
clusterMaxZoom,
|
|
410
|
+
clusterRadius,
|
|
411
|
+
generateId: true,
|
|
412
|
+
children: [
|
|
413
|
+
/* @__PURE__ */ jsxRuntime.jsx(maplibre.Layer, { ...cluster }),
|
|
414
|
+
/* @__PURE__ */ jsxRuntime.jsx(maplibre.Layer, { ...clusterCount }),
|
|
415
|
+
/* @__PURE__ */ jsxRuntime.jsx(maplibre.Layer, { ...unclusteredPoint })
|
|
416
|
+
]
|
|
417
|
+
}
|
|
418
|
+
),
|
|
419
|
+
renderPopup && selectedFeature && popupCoords && /* @__PURE__ */ jsxRuntime.jsx(
|
|
420
|
+
maplibre.Popup,
|
|
421
|
+
{
|
|
422
|
+
longitude: popupCoords[0],
|
|
423
|
+
latitude: popupCoords[1],
|
|
424
|
+
anchor: popupAnchor,
|
|
425
|
+
onClose: handleClosePopup,
|
|
426
|
+
closeOnClick: false,
|
|
427
|
+
closeButton: false,
|
|
428
|
+
offset: popupOffset,
|
|
429
|
+
maxWidth: "none",
|
|
430
|
+
className: "map-popup-clean",
|
|
431
|
+
children: renderPopup(selectedFeature, handleClosePopup)
|
|
432
|
+
}
|
|
433
|
+
)
|
|
434
|
+
] });
|
|
435
|
+
}, "MapCluster"));
|
|
436
|
+
react.memo(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(function MapSource2({
|
|
437
|
+
id,
|
|
438
|
+
data,
|
|
439
|
+
type = "geojson",
|
|
440
|
+
children
|
|
441
|
+
}) {
|
|
442
|
+
return /* @__PURE__ */ jsxRuntime.jsx(maplibre.Source, { id, type, data, children });
|
|
443
|
+
}, "MapSource"));
|
|
444
|
+
react.memo(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(function MapLayer2(props) {
|
|
445
|
+
return /* @__PURE__ */ jsxRuntime.jsx(maplibre.Layer, { ...props });
|
|
446
|
+
}, "MapLayer"));
|
|
447
|
+
var _OverlayControl = class _OverlayControl {
|
|
448
|
+
constructor(redraw) {
|
|
449
|
+
chunkOLISEQHS_cjs.__publicField(this, "_map", null);
|
|
450
|
+
chunkOLISEQHS_cjs.__publicField(this, "_container", null);
|
|
451
|
+
chunkOLISEQHS_cjs.__publicField(this, "_redraw");
|
|
452
|
+
this._redraw = redraw;
|
|
453
|
+
}
|
|
454
|
+
onAdd(map) {
|
|
455
|
+
this._map = map;
|
|
456
|
+
map.on("move", this._redraw);
|
|
457
|
+
this._container = document.createElement("div");
|
|
458
|
+
this._redraw();
|
|
459
|
+
return this._container;
|
|
460
|
+
}
|
|
461
|
+
onRemove() {
|
|
462
|
+
this._container?.remove();
|
|
463
|
+
this._map?.off("move", this._redraw);
|
|
464
|
+
this._map = null;
|
|
465
|
+
}
|
|
466
|
+
getElement() {
|
|
467
|
+
return this._container;
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
chunkOLISEQHS_cjs.__name(_OverlayControl, "OverlayControl");
|
|
471
|
+
var OverlayControl = _OverlayControl;
|
|
472
|
+
function CustomOverlayComponent({ children }) {
|
|
473
|
+
const [, setVersion] = react.useState(0);
|
|
474
|
+
const ctrl = maplibre.useControl(() => {
|
|
475
|
+
const forceUpdate = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => setVersion((v) => v + 1), "forceUpdate");
|
|
476
|
+
return new OverlayControl(forceUpdate);
|
|
477
|
+
});
|
|
478
|
+
const element = ctrl.getElement();
|
|
479
|
+
if (!element) return null;
|
|
480
|
+
return reactDom.createPortal(children, element);
|
|
481
|
+
}
|
|
482
|
+
chunkOLISEQHS_cjs.__name(CustomOverlayComponent, "CustomOverlayComponent");
|
|
483
|
+
react.memo(CustomOverlayComponent);
|
|
484
|
+
var positionStyles = {
|
|
485
|
+
"top-left": { top: 10, left: 10 },
|
|
486
|
+
"top-right": { top: 10, right: 10 },
|
|
487
|
+
"bottom-left": { bottom: 10, left: 10 },
|
|
488
|
+
"bottom-right": { bottom: 10, right: 10 }
|
|
489
|
+
};
|
|
490
|
+
function LegendIcon({
|
|
491
|
+
type,
|
|
492
|
+
color
|
|
493
|
+
}) {
|
|
494
|
+
const fill = color || "#888";
|
|
495
|
+
switch (type) {
|
|
496
|
+
case "circle":
|
|
497
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", children: /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "8", r: "6", fill }) });
|
|
498
|
+
case "line":
|
|
499
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
500
|
+
"line",
|
|
501
|
+
{
|
|
502
|
+
x1: "0",
|
|
503
|
+
y1: "8",
|
|
504
|
+
x2: "16",
|
|
505
|
+
y2: "8",
|
|
506
|
+
stroke: fill,
|
|
507
|
+
strokeWidth: "3",
|
|
508
|
+
strokeLinecap: "round"
|
|
509
|
+
}
|
|
510
|
+
) });
|
|
511
|
+
case "fill":
|
|
512
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "1", y: "1", width: "14", height: "14", fill, rx: "2" }) });
|
|
513
|
+
case "symbol":
|
|
514
|
+
default:
|
|
515
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
516
|
+
"path",
|
|
517
|
+
{
|
|
518
|
+
d: "M8 1l2.5 5 5.5.8-4 3.9.9 5.3L8 13.5l-4.9 2.5.9-5.3-4-3.9 5.5-.8z",
|
|
519
|
+
fill
|
|
520
|
+
}
|
|
521
|
+
) });
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
chunkOLISEQHS_cjs.__name(LegendIcon, "LegendIcon");
|
|
525
|
+
function MapLegendComponent({
|
|
526
|
+
items,
|
|
527
|
+
position = "bottom-right",
|
|
528
|
+
title,
|
|
529
|
+
collapsible = false,
|
|
530
|
+
defaultCollapsed = false,
|
|
531
|
+
className = "",
|
|
532
|
+
style,
|
|
533
|
+
onItemClick
|
|
534
|
+
}) {
|
|
535
|
+
const [collapsed, setCollapsed] = react.useState(defaultCollapsed);
|
|
536
|
+
const containerStyle = react.useMemo(
|
|
537
|
+
() => ({
|
|
538
|
+
position: "absolute",
|
|
539
|
+
...positionStyles[position],
|
|
540
|
+
backgroundColor: "white",
|
|
541
|
+
borderRadius: 8,
|
|
542
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.15)",
|
|
543
|
+
padding: collapsed ? 8 : 12,
|
|
544
|
+
minWidth: collapsed ? "auto" : 120,
|
|
545
|
+
zIndex: 1,
|
|
546
|
+
...style
|
|
547
|
+
}),
|
|
548
|
+
[position, collapsed, style]
|
|
549
|
+
);
|
|
550
|
+
const headerStyle = react.useMemo(
|
|
551
|
+
() => ({
|
|
552
|
+
display: "flex",
|
|
553
|
+
alignItems: "center",
|
|
554
|
+
justifyContent: "space-between",
|
|
555
|
+
gap: 8,
|
|
556
|
+
cursor: collapsible ? "pointer" : "default",
|
|
557
|
+
fontWeight: 600,
|
|
558
|
+
fontSize: 12,
|
|
559
|
+
color: "#333",
|
|
560
|
+
marginBottom: collapsed ? 0 : 8
|
|
561
|
+
}),
|
|
562
|
+
[collapsible, collapsed]
|
|
563
|
+
);
|
|
564
|
+
const itemStyle = react.useMemo(
|
|
565
|
+
() => ({
|
|
566
|
+
display: "flex",
|
|
567
|
+
alignItems: "center",
|
|
568
|
+
gap: 8,
|
|
569
|
+
padding: "4px 0",
|
|
570
|
+
fontSize: 12,
|
|
571
|
+
color: "#666",
|
|
572
|
+
cursor: onItemClick ? "pointer" : "default"
|
|
573
|
+
}),
|
|
574
|
+
[onItemClick]
|
|
575
|
+
);
|
|
576
|
+
const handleHeaderClick = collapsible ? () => setCollapsed(!collapsed) : void 0;
|
|
577
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: containerStyle, children: [
|
|
578
|
+
(title || collapsible) && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: headerStyle, onClick: handleHeaderClick, children: [
|
|
579
|
+
title && /* @__PURE__ */ jsxRuntime.jsx("span", { children: title }),
|
|
580
|
+
collapsible && /* @__PURE__ */ jsxRuntime.jsx(
|
|
581
|
+
"svg",
|
|
582
|
+
{
|
|
583
|
+
width: "12",
|
|
584
|
+
height: "12",
|
|
585
|
+
viewBox: "0 0 12 12",
|
|
586
|
+
style: {
|
|
587
|
+
transform: collapsed ? "rotate(-90deg)" : "rotate(0deg)",
|
|
588
|
+
transition: "transform 0.2s"
|
|
589
|
+
},
|
|
590
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 4.5L6 7.5L9 4.5", stroke: "#666", fill: "none" })
|
|
591
|
+
}
|
|
592
|
+
)
|
|
593
|
+
] }),
|
|
594
|
+
!collapsed && /* @__PURE__ */ jsxRuntime.jsx("div", { children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
595
|
+
"div",
|
|
596
|
+
{
|
|
597
|
+
style: {
|
|
598
|
+
...itemStyle,
|
|
599
|
+
opacity: item.visible === false ? 0.5 : 1
|
|
600
|
+
},
|
|
601
|
+
onClick: onItemClick ? () => onItemClick(item) : void 0,
|
|
602
|
+
children: [
|
|
603
|
+
item.icon || /* @__PURE__ */ jsxRuntime.jsx(LegendIcon, { type: item.type, color: item.color }),
|
|
604
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label })
|
|
605
|
+
]
|
|
606
|
+
},
|
|
607
|
+
item.id
|
|
608
|
+
)) })
|
|
609
|
+
] });
|
|
610
|
+
}
|
|
611
|
+
chunkOLISEQHS_cjs.__name(MapLegendComponent, "MapLegendComponent");
|
|
612
|
+
react.memo(MapLegendComponent);
|
|
613
|
+
function useMapLayers() {
|
|
614
|
+
const { mapRef, isLoaded } = chunk5D2OCOPQ_cjs.useMapContext();
|
|
615
|
+
const addLayer = react.useCallback(
|
|
616
|
+
(layer, beforeId) => {
|
|
617
|
+
const map = mapRef.current?.getMap();
|
|
618
|
+
if (!map || !isLoaded) return;
|
|
619
|
+
if (layer.id && map.getLayer(layer.id)) {
|
|
620
|
+
map.removeLayer(layer.id);
|
|
621
|
+
}
|
|
622
|
+
map.addLayer(layer, beforeId);
|
|
623
|
+
},
|
|
624
|
+
[mapRef, isLoaded]
|
|
625
|
+
);
|
|
626
|
+
const removeLayer = react.useCallback(
|
|
627
|
+
(id) => {
|
|
628
|
+
const map = mapRef.current?.getMap();
|
|
629
|
+
if (!map || !isLoaded) return;
|
|
630
|
+
if (map.getLayer(id)) {
|
|
631
|
+
map.removeLayer(id);
|
|
632
|
+
}
|
|
633
|
+
},
|
|
634
|
+
[mapRef, isLoaded]
|
|
635
|
+
);
|
|
636
|
+
const setLayerVisibility = react.useCallback(
|
|
637
|
+
(id, visible) => {
|
|
638
|
+
const map = mapRef.current?.getMap();
|
|
639
|
+
if (!map || !isLoaded) return;
|
|
640
|
+
if (map.getLayer(id)) {
|
|
641
|
+
map.setLayoutProperty(id, "visibility", visible ? "visible" : "none");
|
|
642
|
+
}
|
|
643
|
+
},
|
|
644
|
+
[mapRef, isLoaded]
|
|
645
|
+
);
|
|
646
|
+
const setLayerFilter = react.useCallback(
|
|
647
|
+
(id, filter) => {
|
|
648
|
+
const map = mapRef.current?.getMap();
|
|
649
|
+
if (!map || !isLoaded) return;
|
|
650
|
+
if (map.getLayer(id)) {
|
|
651
|
+
map.setFilter(id, filter);
|
|
652
|
+
}
|
|
653
|
+
},
|
|
654
|
+
[mapRef, isLoaded]
|
|
655
|
+
);
|
|
656
|
+
const setLayerPaint = react.useCallback(
|
|
657
|
+
(id, property, value) => {
|
|
658
|
+
const map = mapRef.current?.getMap();
|
|
659
|
+
if (!map || !isLoaded) return;
|
|
660
|
+
if (map.getLayer(id)) {
|
|
661
|
+
map.setPaintProperty(id, property, value);
|
|
662
|
+
}
|
|
663
|
+
},
|
|
664
|
+
[mapRef, isLoaded]
|
|
665
|
+
);
|
|
666
|
+
return {
|
|
667
|
+
addLayer,
|
|
668
|
+
removeLayer,
|
|
669
|
+
setLayerVisibility,
|
|
670
|
+
setLayerFilter,
|
|
671
|
+
setLayerPaint
|
|
672
|
+
};
|
|
210
673
|
}
|
|
211
|
-
chunkOLISEQHS_cjs.__name(
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
674
|
+
chunkOLISEQHS_cjs.__name(useMapLayers, "useMapLayers");
|
|
675
|
+
var positionStyles2 = {
|
|
676
|
+
"top-left": { top: 10, left: 10 },
|
|
677
|
+
"top-right": { top: 10, right: 10 },
|
|
678
|
+
"bottom-left": { bottom: 10, left: 10 },
|
|
679
|
+
"bottom-right": { bottom: 10, right: 10 }
|
|
680
|
+
};
|
|
681
|
+
function LayerSwitcherComponent({
|
|
682
|
+
layers,
|
|
683
|
+
position = "top-right",
|
|
684
|
+
title = "Layers",
|
|
685
|
+
collapsible = true,
|
|
686
|
+
defaultCollapsed = false,
|
|
687
|
+
showToggleAll = false,
|
|
688
|
+
className = "",
|
|
689
|
+
style,
|
|
690
|
+
onChange
|
|
691
|
+
}) {
|
|
692
|
+
const { setLayerVisibility } = useMapLayers();
|
|
693
|
+
const [collapsed, setCollapsed] = react.useState(defaultCollapsed);
|
|
694
|
+
const initialVisibility = react.useMemo(() => {
|
|
695
|
+
const initial = {};
|
|
696
|
+
layers.forEach((layer) => {
|
|
697
|
+
initial[layer.id] = layer.defaultVisible !== false;
|
|
698
|
+
});
|
|
699
|
+
return initial;
|
|
700
|
+
}, [layers]);
|
|
701
|
+
const [visibility, setVisibility] = react.useState(initialVisibility);
|
|
702
|
+
const handleToggle = react.useCallback(
|
|
703
|
+
(layerId) => {
|
|
704
|
+
const newVisible = !visibility[layerId];
|
|
705
|
+
setVisibility((prev) => ({ ...prev, [layerId]: newVisible }));
|
|
706
|
+
setLayerVisibility(layerId, newVisible);
|
|
707
|
+
onChange?.(layerId, newVisible);
|
|
708
|
+
},
|
|
709
|
+
[visibility, setLayerVisibility, onChange]
|
|
710
|
+
);
|
|
711
|
+
const handleToggleAll = react.useCallback(
|
|
712
|
+
(visible) => {
|
|
713
|
+
const newVisibility = {};
|
|
714
|
+
layers.forEach((layer) => {
|
|
715
|
+
newVisibility[layer.id] = visible;
|
|
716
|
+
setLayerVisibility(layer.id, visible);
|
|
717
|
+
onChange?.(layer.id, visible);
|
|
718
|
+
});
|
|
719
|
+
setVisibility(newVisibility);
|
|
720
|
+
},
|
|
721
|
+
[layers, setLayerVisibility, onChange]
|
|
722
|
+
);
|
|
723
|
+
const allVisible = react.useMemo(() => Object.values(visibility).every(Boolean), [visibility]);
|
|
724
|
+
const noneVisible = react.useMemo(() => Object.values(visibility).every((v) => !v), [visibility]);
|
|
725
|
+
const containerStyle = react.useMemo(
|
|
726
|
+
() => ({
|
|
727
|
+
position: "absolute",
|
|
728
|
+
...positionStyles2[position],
|
|
729
|
+
backgroundColor: "white",
|
|
730
|
+
borderRadius: 8,
|
|
731
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.15)",
|
|
732
|
+
padding: collapsed ? 8 : 12,
|
|
733
|
+
minWidth: collapsed ? "auto" : 150,
|
|
734
|
+
zIndex: 1,
|
|
735
|
+
...style
|
|
736
|
+
}),
|
|
737
|
+
[position, collapsed, style]
|
|
738
|
+
);
|
|
739
|
+
const headerStyle = react.useMemo(
|
|
740
|
+
() => ({
|
|
741
|
+
display: "flex",
|
|
742
|
+
alignItems: "center",
|
|
743
|
+
justifyContent: "space-between",
|
|
744
|
+
gap: 8,
|
|
745
|
+
cursor: collapsible ? "pointer" : "default",
|
|
746
|
+
fontWeight: 600,
|
|
747
|
+
fontSize: 12,
|
|
748
|
+
color: "#333",
|
|
749
|
+
marginBottom: collapsed ? 0 : 8
|
|
750
|
+
}),
|
|
751
|
+
[collapsible, collapsed]
|
|
752
|
+
);
|
|
753
|
+
const itemStyle = react.useMemo(
|
|
754
|
+
() => ({
|
|
755
|
+
display: "flex",
|
|
756
|
+
alignItems: "center",
|
|
757
|
+
gap: 8,
|
|
758
|
+
padding: "4px 0",
|
|
759
|
+
fontSize: 12,
|
|
760
|
+
color: "#666",
|
|
761
|
+
cursor: "pointer"
|
|
762
|
+
}),
|
|
763
|
+
[]
|
|
764
|
+
);
|
|
765
|
+
const checkboxStyle = react.useMemo(
|
|
766
|
+
() => ({
|
|
767
|
+
width: 14,
|
|
768
|
+
height: 14,
|
|
769
|
+
cursor: "pointer"
|
|
770
|
+
}),
|
|
771
|
+
[]
|
|
772
|
+
);
|
|
773
|
+
const groups = react.useMemo(() => {
|
|
774
|
+
return layers.reduce(
|
|
775
|
+
(acc, layer) => {
|
|
776
|
+
const group = layer.group || "";
|
|
777
|
+
if (!acc[group]) acc[group] = [];
|
|
778
|
+
acc[group].push(layer);
|
|
779
|
+
return acc;
|
|
780
|
+
},
|
|
781
|
+
{}
|
|
782
|
+
);
|
|
783
|
+
}, [layers]);
|
|
784
|
+
const handleHeaderClick = collapsible ? () => setCollapsed(!collapsed) : void 0;
|
|
785
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: containerStyle, children: [
|
|
786
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: headerStyle, onClick: handleHeaderClick, children: [
|
|
787
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: title }),
|
|
788
|
+
collapsible && /* @__PURE__ */ jsxRuntime.jsx(
|
|
789
|
+
"svg",
|
|
790
|
+
{
|
|
791
|
+
width: "12",
|
|
792
|
+
height: "12",
|
|
793
|
+
viewBox: "0 0 12 12",
|
|
794
|
+
style: {
|
|
795
|
+
transform: collapsed ? "rotate(-90deg)" : "rotate(0deg)",
|
|
796
|
+
transition: "transform 0.2s"
|
|
797
|
+
},
|
|
798
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 4.5L6 7.5L9 4.5", stroke: "#666", fill: "none" })
|
|
799
|
+
}
|
|
800
|
+
)
|
|
801
|
+
] }),
|
|
802
|
+
!collapsed && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
803
|
+
showToggleAll && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
804
|
+
"div",
|
|
805
|
+
{
|
|
806
|
+
style: {
|
|
807
|
+
...itemStyle,
|
|
808
|
+
borderBottom: "1px solid #eee",
|
|
809
|
+
marginBottom: 4,
|
|
810
|
+
paddingBottom: 8
|
|
811
|
+
},
|
|
812
|
+
children: [
|
|
813
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
814
|
+
"button",
|
|
815
|
+
{
|
|
816
|
+
onClick: () => handleToggleAll(true),
|
|
817
|
+
disabled: allVisible,
|
|
818
|
+
style: {
|
|
819
|
+
fontSize: 10,
|
|
820
|
+
padding: "2px 6px",
|
|
821
|
+
cursor: allVisible ? "default" : "pointer",
|
|
822
|
+
opacity: allVisible ? 0.5 : 1
|
|
823
|
+
},
|
|
824
|
+
children: "All"
|
|
825
|
+
}
|
|
826
|
+
),
|
|
827
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
828
|
+
"button",
|
|
829
|
+
{
|
|
830
|
+
onClick: () => handleToggleAll(false),
|
|
831
|
+
disabled: noneVisible,
|
|
832
|
+
style: {
|
|
833
|
+
fontSize: 10,
|
|
834
|
+
padding: "2px 6px",
|
|
835
|
+
cursor: noneVisible ? "default" : "pointer",
|
|
836
|
+
opacity: noneVisible ? 0.5 : 1
|
|
837
|
+
},
|
|
838
|
+
children: "None"
|
|
839
|
+
}
|
|
840
|
+
)
|
|
841
|
+
]
|
|
842
|
+
}
|
|
843
|
+
),
|
|
844
|
+
Object.entries(groups).map(([group, groupLayers]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
845
|
+
group && /* @__PURE__ */ jsxRuntime.jsx(
|
|
846
|
+
"div",
|
|
847
|
+
{
|
|
848
|
+
style: {
|
|
849
|
+
fontSize: 10,
|
|
850
|
+
fontWeight: 600,
|
|
851
|
+
color: "#999",
|
|
852
|
+
marginTop: 8,
|
|
853
|
+
marginBottom: 4,
|
|
854
|
+
textTransform: "uppercase"
|
|
855
|
+
},
|
|
856
|
+
children: group
|
|
857
|
+
}
|
|
858
|
+
),
|
|
859
|
+
groupLayers.map((layer) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
860
|
+
"div",
|
|
861
|
+
{
|
|
862
|
+
style: itemStyle,
|
|
863
|
+
onClick: () => handleToggle(layer.id),
|
|
864
|
+
children: [
|
|
865
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
866
|
+
"input",
|
|
867
|
+
{
|
|
868
|
+
type: "checkbox",
|
|
869
|
+
checked: visibility[layer.id],
|
|
870
|
+
onChange: () => handleToggle(layer.id),
|
|
871
|
+
style: checkboxStyle
|
|
872
|
+
}
|
|
873
|
+
),
|
|
874
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: layer.label })
|
|
875
|
+
]
|
|
876
|
+
},
|
|
877
|
+
layer.id
|
|
878
|
+
))
|
|
879
|
+
] }, group || "default"))
|
|
880
|
+
] })
|
|
881
|
+
] });
|
|
220
882
|
}
|
|
221
|
-
chunkOLISEQHS_cjs.__name(
|
|
222
|
-
|
|
223
|
-
|
|
883
|
+
chunkOLISEQHS_cjs.__name(LayerSwitcherComponent, "LayerSwitcherComponent");
|
|
884
|
+
react.memo(LayerSwitcherComponent);
|
|
885
|
+
var LazyMapContainer = chunkW75B7Y6C_cjs.createLazyComponent(
|
|
886
|
+
() => import('./MapContainer-STVDMC36.cjs').then((mod) => ({ default: mod.MapContainer })),
|
|
224
887
|
{
|
|
225
888
|
displayName: "LazyMapContainer",
|
|
226
|
-
fallback: /* @__PURE__ */ jsxRuntime.jsx(MapLoadingFallback, { minHeight: 400 })
|
|
889
|
+
fallback: /* @__PURE__ */ jsxRuntime.jsx(chunkW75B7Y6C_cjs.MapLoadingFallback, { minHeight: 400 })
|
|
227
890
|
}
|
|
228
891
|
);
|
|
229
|
-
var LazyMapView = createLazyComponent(
|
|
230
|
-
() => import('./MapContainer-
|
|
892
|
+
var LazyMapView = chunkW75B7Y6C_cjs.createLazyComponent(
|
|
893
|
+
() => import('./MapContainer-STVDMC36.cjs').then((mod) => ({ default: mod.MapView })),
|
|
231
894
|
{
|
|
232
895
|
displayName: "LazyMapView",
|
|
233
|
-
fallback: /* @__PURE__ */ jsxRuntime.jsx(MapLoadingFallback, { minHeight: 400 })
|
|
896
|
+
fallback: /* @__PURE__ */ jsxRuntime.jsx(chunkW75B7Y6C_cjs.MapLoadingFallback, { minHeight: 400 })
|
|
234
897
|
}
|
|
235
898
|
);
|
|
236
|
-
var LazyMermaid = createLazyComponent(
|
|
899
|
+
var LazyMermaid = chunkW75B7Y6C_cjs.createLazyComponent(
|
|
237
900
|
() => import('./Mermaid.client-NNTI6DFX.cjs'),
|
|
238
901
|
{
|
|
239
902
|
displayName: "LazyMermaid",
|
|
240
903
|
fallback: /* @__PURE__ */ jsxRuntime.jsx(
|
|
241
|
-
CardLoadingFallback,
|
|
904
|
+
chunkW75B7Y6C_cjs.CardLoadingFallback,
|
|
242
905
|
{
|
|
243
906
|
title: "Diagram",
|
|
244
907
|
description: "Loading...",
|
|
@@ -254,7 +917,7 @@ function CodeLoadingFallback() {
|
|
|
254
917
|
] }) }) });
|
|
255
918
|
}
|
|
256
919
|
chunkOLISEQHS_cjs.__name(CodeLoadingFallback, "CodeLoadingFallback");
|
|
257
|
-
var LazyPrettyCode = createLazyComponent(
|
|
920
|
+
var LazyPrettyCode = chunkW75B7Y6C_cjs.createLazyComponent(
|
|
258
921
|
() => import('./PrettyCode.client-KOHDVPPN.cjs'),
|
|
259
922
|
{
|
|
260
923
|
displayName: "LazyPrettyCode",
|
|
@@ -268,8 +931,8 @@ function OpenapiLoadingFallback() {
|
|
|
268
931
|
] }) });
|
|
269
932
|
}
|
|
270
933
|
chunkOLISEQHS_cjs.__name(OpenapiLoadingFallback, "OpenapiLoadingFallback");
|
|
271
|
-
var LazyDocsLayout = createLazyComponent(
|
|
272
|
-
() => import('./DocsLayout-
|
|
934
|
+
var LazyDocsLayout = chunkW75B7Y6C_cjs.createLazyComponent(
|
|
935
|
+
() => import('./DocsLayout-OURFYWQE.cjs').then((mod) => ({ default: mod.DocsLayout })),
|
|
273
936
|
{
|
|
274
937
|
displayName: "LazyDocsLayout",
|
|
275
938
|
fallback: /* @__PURE__ */ jsxRuntime.jsx(OpenapiLoadingFallback, {})
|
|
@@ -279,12 +942,12 @@ var LazyOpenapiViewer = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(({ config }) =>
|
|
|
279
942
|
return /* @__PURE__ */ jsxRuntime.jsx(chunk7EYHNP3E_cjs.PlaygroundProvider, { config, children: /* @__PURE__ */ jsxRuntime.jsx(LazyDocsLayout, {}) });
|
|
280
943
|
}, "LazyOpenapiViewer");
|
|
281
944
|
LazyOpenapiViewer.displayName = "LazyOpenapiViewer";
|
|
282
|
-
var LazyJsonSchemaForm = createLazyComponent(
|
|
945
|
+
var LazyJsonSchemaForm = chunkW75B7Y6C_cjs.createLazyComponent(
|
|
283
946
|
() => import('./JsonSchemaForm-DD7CLRIG.cjs').then((mod) => ({ default: mod.JsonSchemaForm })),
|
|
284
947
|
{
|
|
285
948
|
displayName: "LazyJsonSchemaForm",
|
|
286
949
|
fallback: /* @__PURE__ */ jsxRuntime.jsx(
|
|
287
|
-
CardLoadingFallback,
|
|
950
|
+
chunkW75B7Y6C_cjs.CardLoadingFallback,
|
|
288
951
|
{
|
|
289
952
|
title: "Form",
|
|
290
953
|
description: "Loading form schema...",
|
|
@@ -300,14 +963,14 @@ function LottieLoadingFallback() {
|
|
|
300
963
|
] }) });
|
|
301
964
|
}
|
|
302
965
|
chunkOLISEQHS_cjs.__name(LottieLoadingFallback, "LottieLoadingFallback");
|
|
303
|
-
var LazyLottiePlayer = createLazyComponent(
|
|
966
|
+
var LazyLottiePlayer = chunkW75B7Y6C_cjs.createLazyComponent(
|
|
304
967
|
() => import('./LottiePlayer.client-2S7ISJ2S.cjs').then((mod) => ({ default: mod.LottiePlayer })),
|
|
305
968
|
{
|
|
306
969
|
displayName: "LazyLottiePlayer",
|
|
307
970
|
fallback: /* @__PURE__ */ jsxRuntime.jsx(LottieLoadingFallback, {})
|
|
308
971
|
}
|
|
309
972
|
);
|
|
310
|
-
var LazyPlayer = createLazyComponent(
|
|
973
|
+
var LazyPlayer = chunkW75B7Y6C_cjs.createLazyComponent(
|
|
311
974
|
() => import('./Player-PM7F7DD7.cjs').then((mod) => ({ default: mod.Player })),
|
|
312
975
|
{
|
|
313
976
|
displayName: "LazyAudioPlayer",
|
|
@@ -332,33 +995,33 @@ function VideoLoadingFallback() {
|
|
|
332
995
|
] }) });
|
|
333
996
|
}
|
|
334
997
|
chunkOLISEQHS_cjs.__name(VideoLoadingFallback, "VideoLoadingFallback");
|
|
335
|
-
var LazyVideoPlayer = createLazyComponent(
|
|
998
|
+
var LazyVideoPlayer = chunkW75B7Y6C_cjs.createLazyComponent(
|
|
336
999
|
() => import('./components-MQ6DR7TX.cjs').then((mod) => ({ default: mod.VideoPlayer })),
|
|
337
1000
|
{
|
|
338
1001
|
displayName: "LazyVideoPlayer",
|
|
339
1002
|
fallback: /* @__PURE__ */ jsxRuntime.jsx(VideoLoadingFallback, {})
|
|
340
1003
|
}
|
|
341
1004
|
);
|
|
342
|
-
var LazyJsonTree = createLazyComponent(
|
|
1005
|
+
var LazyJsonTree = chunkW75B7Y6C_cjs.createLazyComponent(
|
|
343
1006
|
() => import('./JsonTree-X6W5YEVY.cjs'),
|
|
344
1007
|
{
|
|
345
1008
|
displayName: "LazyJsonTree",
|
|
346
|
-
fallback: /* @__PURE__ */ jsxRuntime.jsx(LoadingFallback, { minHeight: 100, text: "Loading JSON viewer..." })
|
|
1009
|
+
fallback: /* @__PURE__ */ jsxRuntime.jsx(chunkW75B7Y6C_cjs.LoadingFallback, { minHeight: 100, text: "Loading JSON viewer..." })
|
|
347
1010
|
}
|
|
348
1011
|
);
|
|
349
|
-
var LazyImageViewer = createLazyComponent(
|
|
1012
|
+
var LazyImageViewer = chunkW75B7Y6C_cjs.createLazyComponent(
|
|
350
1013
|
() => import('./components-EHOGXATG.cjs').then((mod) => ({ default: mod.ImageViewer })),
|
|
351
1014
|
{
|
|
352
1015
|
displayName: "LazyImageViewer",
|
|
353
|
-
fallback: /* @__PURE__ */ jsxRuntime.jsx(LoadingFallback, { minHeight: 200, text: "Loading image viewer..." })
|
|
1016
|
+
fallback: /* @__PURE__ */ jsxRuntime.jsx(chunkW75B7Y6C_cjs.LoadingFallback, { minHeight: 200, text: "Loading image viewer..." })
|
|
354
1017
|
}
|
|
355
1018
|
);
|
|
356
|
-
var LazyCronScheduler = createLazyComponent(
|
|
1019
|
+
var LazyCronScheduler = chunkW75B7Y6C_cjs.createLazyComponent(
|
|
357
1020
|
() => import('./CronScheduler.client-WEJF4PWQ.cjs'),
|
|
358
1021
|
{
|
|
359
1022
|
displayName: "LazyCronScheduler",
|
|
360
1023
|
fallback: /* @__PURE__ */ jsxRuntime.jsx(
|
|
361
|
-
LoadingFallback,
|
|
1024
|
+
chunkW75B7Y6C_cjs.LoadingFallback,
|
|
362
1025
|
{
|
|
363
1026
|
minHeight: 120,
|
|
364
1027
|
showText: false,
|
|
@@ -367,18 +1030,11 @@ var LazyCronScheduler = createLazyComponent(
|
|
|
367
1030
|
)
|
|
368
1031
|
}
|
|
369
1032
|
);
|
|
370
|
-
var LazyTree = createLazyComponent(
|
|
1033
|
+
var LazyTree = chunkW75B7Y6C_cjs.createLazyComponent(
|
|
371
1034
|
() => import('./TreeRoot-AABP2J6Y.cjs'),
|
|
372
1035
|
{
|
|
373
1036
|
displayName: "LazyTree",
|
|
374
|
-
fallback: /* @__PURE__ */ jsxRuntime.jsx(LoadingFallback, { minHeight: 200, text: "Loading tree\u2026" })
|
|
375
|
-
}
|
|
376
|
-
);
|
|
377
|
-
var LazyChat = createLazyComponent(
|
|
378
|
-
() => import('./ChatRoot-LXIUBOXF.cjs').then((m) => ({ default: m.ChatRoot })),
|
|
379
|
-
{
|
|
380
|
-
displayName: "LazyChat",
|
|
381
|
-
fallback: /* @__PURE__ */ jsxRuntime.jsx(LoadingFallback, { minHeight: 320, text: "Loading chat\u2026" })
|
|
1037
|
+
fallback: /* @__PURE__ */ jsxRuntime.jsx(chunkW75B7Y6C_cjs.LoadingFallback, { minHeight: 200, text: "Loading tree\u2026" })
|
|
382
1038
|
}
|
|
383
1039
|
);
|
|
384
1040
|
|
|
@@ -412,7 +1068,7 @@ async function* parseSSE(response, options = {}) {
|
|
|
412
1068
|
throw new Error("SSE response has no body");
|
|
413
1069
|
}
|
|
414
1070
|
const map = options.map ?? DEFAULT_MAP;
|
|
415
|
-
const idleMs = options.idleTimeoutMs ??
|
|
1071
|
+
const idleMs = options.idleTimeoutMs ?? chunkTBSHZO5R_cjs.LIMITS.sseIdleMs;
|
|
416
1072
|
const reader = response.body.getReader();
|
|
417
1073
|
const decoder = new TextDecoder();
|
|
418
1074
|
let buffer = "";
|
|
@@ -627,7 +1283,7 @@ function createMockTransport(opts = {}) {
|
|
|
627
1283
|
async createSession(_opts) {
|
|
628
1284
|
await sleep(latency);
|
|
629
1285
|
return {
|
|
630
|
-
sessionId:
|
|
1286
|
+
sessionId: chunkTBSHZO5R_cjs.createId("s"),
|
|
631
1287
|
messages: history.length ? [...history] : void 0,
|
|
632
1288
|
hasMore: false,
|
|
633
1289
|
cursor: null,
|
|
@@ -644,12 +1300,12 @@ function createMockTransport(opts = {}) {
|
|
|
644
1300
|
throw new Error("mock transport scripted failure");
|
|
645
1301
|
}
|
|
646
1302
|
history.push({
|
|
647
|
-
id:
|
|
1303
|
+
id: chunkTBSHZO5R_cjs.createId("u"),
|
|
648
1304
|
role: "user",
|
|
649
1305
|
content,
|
|
650
1306
|
createdAt: Date.now()
|
|
651
1307
|
});
|
|
652
|
-
const messageId =
|
|
1308
|
+
const messageId = chunkTBSHZO5R_cjs.createId("a");
|
|
653
1309
|
yield { type: "message_start", messageId, sessionId: _sid };
|
|
654
1310
|
const reply = replies[turn % replies.length];
|
|
655
1311
|
turn += 1;
|
|
@@ -678,7 +1334,7 @@ function createMockTransport(opts = {}) {
|
|
|
678
1334
|
turn += 1;
|
|
679
1335
|
const text = typeof reply === "string" ? reply : reply.filter((e) => e.type === "chunk").map((e) => e.delta).join("");
|
|
680
1336
|
return {
|
|
681
|
-
id:
|
|
1337
|
+
id: chunkTBSHZO5R_cjs.createId("a"),
|
|
682
1338
|
role: "assistant",
|
|
683
1339
|
content: text || DEFAULT_REPLY,
|
|
684
1340
|
createdAt: Date.now()
|
|
@@ -863,1296 +1519,35 @@ function createPydanticAIChatTransport(opts) {
|
|
|
863
1519
|
};
|
|
864
1520
|
}
|
|
865
1521
|
chunkOLISEQHS_cjs.__name(createPydanticAIChatTransport, "createPydanticAIChatTransport");
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
const
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
"aria-hidden": "true",
|
|
893
|
-
className: lib.cn(
|
|
894
|
-
"absolute -right-1 -top-1 inline-flex min-w-[18px] h-[18px] items-center justify-center",
|
|
895
|
-
"rounded-full bg-destructive px-1 text-[10px] font-semibold leading-none text-destructive-foreground",
|
|
896
|
-
"ring-2 ring-background"
|
|
897
|
-
),
|
|
898
|
-
children: display
|
|
899
|
-
}
|
|
900
|
-
);
|
|
901
|
-
}
|
|
902
|
-
chunkOLISEQHS_cjs.__name(Badge, "Badge");
|
|
903
|
-
function PulseDot() {
|
|
904
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: "absolute right-1 top-1", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "relative inline-flex h-2.5 w-2.5", children: [
|
|
905
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute inset-0 rounded-full bg-destructive opacity-75 animate-ping" }),
|
|
906
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative inline-flex h-2.5 w-2.5 rounded-full bg-destructive ring-2 ring-background" })
|
|
907
|
-
] }) });
|
|
908
|
-
}
|
|
909
|
-
chunkOLISEQHS_cjs.__name(PulseDot, "PulseDot");
|
|
910
|
-
function Tooltip({ text, side }) {
|
|
911
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
912
|
-
"span",
|
|
913
|
-
{
|
|
914
|
-
role: "tooltip",
|
|
915
|
-
className: lib.cn(
|
|
916
|
-
"pointer-events-none absolute top-1/2 -translate-y-1/2 whitespace-nowrap",
|
|
917
|
-
"rounded-md bg-popover px-2.5 py-1 text-xs font-medium text-popover-foreground shadow-md",
|
|
918
|
-
"border border-border opacity-0 scale-95 transition-all duration-150",
|
|
919
|
-
"group-hover:opacity-100 group-hover:scale-100",
|
|
920
|
-
"group-focus-within:opacity-100 group-focus-within:scale-100",
|
|
921
|
-
side
|
|
922
|
-
),
|
|
923
|
-
children: text
|
|
924
|
-
}
|
|
1522
|
+
function useChatScroll(options) {
|
|
1523
|
+
const {
|
|
1524
|
+
containerRef,
|
|
1525
|
+
bottomRef,
|
|
1526
|
+
isStreaming = false,
|
|
1527
|
+
bottomThresholdPx = 80,
|
|
1528
|
+
messagesCount = 0
|
|
1529
|
+
} = options;
|
|
1530
|
+
const [isAtBottom, setIsAtBottom] = react.useState(true);
|
|
1531
|
+
const [unreadCount, setUnreadCount] = react.useState(0);
|
|
1532
|
+
const lastCountRef = react.useRef(messagesCount);
|
|
1533
|
+
const stickyRef = react.useRef(true);
|
|
1534
|
+
const wasStreamingRef = react.useRef(isStreaming);
|
|
1535
|
+
const scrollToBottom = react.useCallback(
|
|
1536
|
+
(smooth = false) => {
|
|
1537
|
+
const el = containerRef.current;
|
|
1538
|
+
if (!el) return;
|
|
1539
|
+
el.scrollTo({
|
|
1540
|
+
top: el.scrollHeight,
|
|
1541
|
+
behavior: smooth ? "smooth" : "auto"
|
|
1542
|
+
});
|
|
1543
|
+
stickyRef.current = true;
|
|
1544
|
+
setIsAtBottom(true);
|
|
1545
|
+
setUnreadCount(0);
|
|
1546
|
+
},
|
|
1547
|
+
[containerRef]
|
|
925
1548
|
);
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
function ChatFAB({
|
|
929
|
-
onClick,
|
|
930
|
-
ariaLabel = "Open chat",
|
|
931
|
-
icon,
|
|
932
|
-
variant = "simple",
|
|
933
|
-
size = "responsive",
|
|
934
|
-
position = "bottom-right",
|
|
935
|
-
offset: offset2 = 24,
|
|
936
|
-
zIndex = 9999,
|
|
937
|
-
pulse = false,
|
|
938
|
-
badge,
|
|
939
|
-
tooltip,
|
|
940
|
-
inline = false,
|
|
941
|
-
className,
|
|
942
|
-
style
|
|
943
|
-
}) {
|
|
944
|
-
const effectiveSize = useEffectiveFABSize(size, inline);
|
|
945
|
-
const px = SIZE_PX[effectiveSize];
|
|
946
|
-
const iconPx = ICON_PX[effectiveSize];
|
|
947
|
-
const renderedIcon = icon ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bot, { size: iconPx });
|
|
948
|
-
const baseButton = lib.cn(
|
|
949
|
-
"relative grid place-items-center rounded-full focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
950
|
-
"transition-transform hover:scale-105"
|
|
951
|
-
);
|
|
952
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
953
|
-
"div",
|
|
954
|
-
{
|
|
955
|
-
className: lib.cn("group", inline ? "relative inline-flex" : "fixed"),
|
|
956
|
-
style: inline ? void 0 : { ...positionStyle(position, offset2), zIndex },
|
|
957
|
-
children: [
|
|
958
|
-
variant === "animated" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
959
|
-
AnimatedFAB,
|
|
960
|
-
{
|
|
961
|
-
ariaLabel,
|
|
962
|
-
onClick,
|
|
963
|
-
size: px,
|
|
964
|
-
className,
|
|
965
|
-
style,
|
|
966
|
-
children: renderedIcon
|
|
967
|
-
}
|
|
968
|
-
),
|
|
969
|
-
variant === "glass" && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
970
|
-
"button",
|
|
971
|
-
{
|
|
972
|
-
type: "button",
|
|
973
|
-
"aria-label": ariaLabel,
|
|
974
|
-
onClick,
|
|
975
|
-
className: lib.cn(
|
|
976
|
-
baseButton,
|
|
977
|
-
"border border-border/40 bg-background/60 text-foreground shadow-lg backdrop-blur-xl",
|
|
978
|
-
"hover:bg-background/80",
|
|
979
|
-
className
|
|
980
|
-
),
|
|
981
|
-
style: { width: px, height: px, ...style },
|
|
982
|
-
children: [
|
|
983
|
-
renderedIcon,
|
|
984
|
-
badge !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(Badge, { value: badge }) : pulse ? /* @__PURE__ */ jsxRuntime.jsx(PulseDot, {}) : null
|
|
985
|
-
]
|
|
986
|
-
}
|
|
987
|
-
),
|
|
988
|
-
variant === "simple" && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
989
|
-
"button",
|
|
990
|
-
{
|
|
991
|
-
type: "button",
|
|
992
|
-
"aria-label": ariaLabel,
|
|
993
|
-
onClick,
|
|
994
|
-
className: lib.cn(
|
|
995
|
-
baseButton,
|
|
996
|
-
"bg-primary text-primary-foreground hover:bg-primary/90 shadow-2xl",
|
|
997
|
-
className
|
|
998
|
-
),
|
|
999
|
-
style: { width: px, height: px, ...style },
|
|
1000
|
-
children: [
|
|
1001
|
-
renderedIcon,
|
|
1002
|
-
badge !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(Badge, { value: badge }) : pulse ? /* @__PURE__ */ jsxRuntime.jsx(PulseDot, {}) : null
|
|
1003
|
-
]
|
|
1004
|
-
}
|
|
1005
|
-
),
|
|
1006
|
-
tooltip && /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { text: tooltip, side: tooltipSideClasses(position) })
|
|
1007
|
-
]
|
|
1008
|
-
}
|
|
1009
|
-
);
|
|
1010
|
-
}
|
|
1011
|
-
chunkOLISEQHS_cjs.__name(ChatFAB, "ChatFAB");
|
|
1012
|
-
function AnimatedFAB({ ariaLabel, onClick, size, className, style, children }) {
|
|
1013
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1014
|
-
/* @__PURE__ */ jsxRuntime.jsx("style", { children: ANIMATED_CSS }),
|
|
1015
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1016
|
-
"div",
|
|
1017
|
-
{
|
|
1018
|
-
className: lib.cn("cmdop-fab-anim", className),
|
|
1019
|
-
style: { width: size, height: size, ...style },
|
|
1020
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cmdop-fab-anim-glow", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cmdop-fab-anim-wrap", children: [
|
|
1021
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "cmdop-fab-anim-grad cmdop-fab-anim-grad-1" }),
|
|
1022
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "cmdop-fab-anim-grad cmdop-fab-anim-grad-2" }),
|
|
1023
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "cmdop-fab-anim-inner" }),
|
|
1024
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1025
|
-
"button",
|
|
1026
|
-
{
|
|
1027
|
-
type: "button",
|
|
1028
|
-
"aria-label": ariaLabel,
|
|
1029
|
-
onClick,
|
|
1030
|
-
className: "cmdop-fab-anim-btn",
|
|
1031
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cmdop-fab-anim-icon", children })
|
|
1032
|
-
}
|
|
1033
|
-
)
|
|
1034
|
-
] }) })
|
|
1035
|
-
}
|
|
1036
|
-
)
|
|
1037
|
-
] });
|
|
1038
|
-
}
|
|
1039
|
-
chunkOLISEQHS_cjs.__name(AnimatedFAB, "AnimatedFAB");
|
|
1040
|
-
var ANIMATED_CSS = `
|
|
1041
|
-
.cmdop-fab-anim {
|
|
1042
|
-
position: relative;
|
|
1043
|
-
pointer-events: auto;
|
|
1044
|
-
}
|
|
1045
|
-
.cmdop-fab-anim-glow {
|
|
1046
|
-
width: 100%; height: 100%;
|
|
1047
|
-
border-radius: 50%;
|
|
1048
|
-
overflow: hidden;
|
|
1049
|
-
animation:
|
|
1050
|
-
cmdop-fab-entrance 0.6s cubic-bezier(0.34, 1.45, 0.64, 1) forwards,
|
|
1051
|
-
cmdop-fab-glow-shift 8s ease-in-out 0.6s infinite;
|
|
1052
|
-
}
|
|
1053
|
-
.cmdop-fab-anim-wrap {
|
|
1054
|
-
position: relative; width: 100%; height: 100%;
|
|
1055
|
-
border-radius: 50%; overflow: hidden;
|
|
1056
|
-
}
|
|
1057
|
-
.cmdop-fab-anim-grad { position: absolute; inset: 0; border-radius: 50%; }
|
|
1058
|
-
.cmdop-fab-anim-grad-1 {
|
|
1059
|
-
background: conic-gradient(
|
|
1060
|
-
from 0deg,
|
|
1061
|
-
#fbbf24 0%, rgba(251,191,36,0) 15%,
|
|
1062
|
-
rgba(168,85,247,0) 20%, #a855f7 35%, rgba(168,85,247,0) 50%,
|
|
1063
|
-
rgba(20,184,166,0) 55%, #14b8a6 70%, rgba(20,184,166,0) 85%,
|
|
1064
|
-
rgba(236,72,153,0) 88%, #ec4899 97%, #fbbf24 100%
|
|
1065
|
-
);
|
|
1066
|
-
animation: cmdop-fab-rotate 7s linear infinite;
|
|
1067
|
-
filter: blur(1px); opacity: 0.95;
|
|
1068
|
-
}
|
|
1069
|
-
.cmdop-fab-anim-grad-2 {
|
|
1070
|
-
inset: 1px;
|
|
1071
|
-
background: conic-gradient(
|
|
1072
|
-
from 180deg,
|
|
1073
|
-
#a855f7 0%, rgba(168,85,247,0) 20%,
|
|
1074
|
-
rgba(20,184,166,0) 30%, #14b8a6 50%, rgba(20,184,166,0) 70%,
|
|
1075
|
-
rgba(251,191,36,0) 75%, #fbbf24 95%, #a855f7 100%
|
|
1076
|
-
);
|
|
1077
|
-
animation: cmdop-fab-rotate-rev 9s linear infinite;
|
|
1078
|
-
filter: blur(0.75px); opacity: 0.7;
|
|
1079
|
-
}
|
|
1080
|
-
.cmdop-fab-anim-inner {
|
|
1081
|
-
position: absolute; inset: 3px; border-radius: 50%;
|
|
1082
|
-
background: rgba(10, 10, 10, 0.65);
|
|
1083
|
-
backdrop-filter: blur(12px) saturate(1.8);
|
|
1084
|
-
-webkit-backdrop-filter: blur(12px) saturate(1.8);
|
|
1085
|
-
animation: cmdop-fab-inner-glow 5s ease-in-out infinite;
|
|
1086
|
-
}
|
|
1087
|
-
.cmdop-fab-anim-btn {
|
|
1088
|
-
position: absolute; inset: 2px;
|
|
1089
|
-
border-radius: 50%; border: none; background: transparent;
|
|
1090
|
-
cursor: pointer; display: flex; align-items: center; justify-content: center;
|
|
1091
|
-
transition: transform 0.2s;
|
|
1092
|
-
}
|
|
1093
|
-
.cmdop-fab-anim-btn:hover { transform: scale(1.06); }
|
|
1094
|
-
.cmdop-fab-anim-icon {
|
|
1095
|
-
color: #fbbf24; display: flex;
|
|
1096
|
-
filter: drop-shadow(0 0 6px rgba(251,191,36,0.8));
|
|
1097
|
-
animation: cmdop-fab-icon-pulse 2.5s ease-in-out infinite;
|
|
1098
|
-
}
|
|
1099
|
-
@keyframes cmdop-fab-rotate { to { transform: rotate(360deg); } }
|
|
1100
|
-
@keyframes cmdop-fab-rotate-rev { to { transform: rotate(-360deg); } }
|
|
1101
|
-
@keyframes cmdop-fab-entrance {
|
|
1102
|
-
0% { transform: scale(0); }
|
|
1103
|
-
50% { transform: scale(1.08); }
|
|
1104
|
-
70% { transform: scale(0.98); }
|
|
1105
|
-
100% { transform: scale(1); }
|
|
1106
|
-
}
|
|
1107
|
-
@keyframes cmdop-fab-glow-shift {
|
|
1108
|
-
0%, 100% { box-shadow: 0 0 20px rgba(251,191,36,0.5), 0 0 40px rgba(168,85,247,0.3); }
|
|
1109
|
-
33% { box-shadow: 0 0 20px rgba(168,85,247,0.5), 0 0 40px rgba(20,184,166,0.3); }
|
|
1110
|
-
66% { box-shadow: 0 0 20px rgba(20,184,166,0.5), 0 0 40px rgba(236,72,153,0.3); }
|
|
1111
|
-
}
|
|
1112
|
-
@keyframes cmdop-fab-icon-pulse {
|
|
1113
|
-
0%, 100% { opacity: 1; transform: scale(1); }
|
|
1114
|
-
50% { opacity: 0.85; transform: scale(1.15); }
|
|
1115
|
-
}
|
|
1116
|
-
@keyframes cmdop-fab-inner-glow {
|
|
1117
|
-
0%, 100% { box-shadow: inset 0 0 20px rgba(251,191,36,0.25), inset 0 0 40px rgba(168,85,247,0.15); }
|
|
1118
|
-
50% { box-shadow: inset 0 0 25px rgba(168,85,247,0.3), inset 0 0 45px rgba(20,184,166,0.2); }
|
|
1119
|
-
}
|
|
1120
|
-
`;
|
|
1121
|
-
function ChatHeader({
|
|
1122
|
-
title,
|
|
1123
|
-
icon,
|
|
1124
|
-
actions,
|
|
1125
|
-
showClose = true,
|
|
1126
|
-
onClose,
|
|
1127
|
-
closeLabel = "Close",
|
|
1128
|
-
closeSlot,
|
|
1129
|
-
className
|
|
1130
|
-
}) {
|
|
1131
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1132
|
-
"header",
|
|
1133
|
-
{
|
|
1134
|
-
className: lib.cn(
|
|
1135
|
-
"border-border bg-muted/30 flex shrink-0 items-center justify-between border-b px-4 py-2.5",
|
|
1136
|
-
className
|
|
1137
|
-
),
|
|
1138
|
-
children: [
|
|
1139
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-center gap-2 text-sm font-semibold", children: [
|
|
1140
|
-
icon ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bot, { className: "text-primary h-4 w-4 shrink-0" }),
|
|
1141
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: title })
|
|
1142
|
-
] }),
|
|
1143
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-0.5", children: [
|
|
1144
|
-
actions,
|
|
1145
|
-
closeSlot ?? (showClose && onClose && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1146
|
-
components.Button,
|
|
1147
|
-
{
|
|
1148
|
-
variant: "ghost",
|
|
1149
|
-
size: "sm",
|
|
1150
|
-
onClick: onClose,
|
|
1151
|
-
"aria-label": closeLabel,
|
|
1152
|
-
className: "-mr-1 h-7 w-7 p-0",
|
|
1153
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" })
|
|
1154
|
-
}
|
|
1155
|
-
))
|
|
1156
|
-
] })
|
|
1157
|
-
]
|
|
1158
|
-
}
|
|
1159
|
-
);
|
|
1160
|
-
}
|
|
1161
|
-
chunkOLISEQHS_cjs.__name(ChatHeader, "ChatHeader");
|
|
1162
|
-
function useChatPresence(open, exitDurationMs = 200) {
|
|
1163
|
-
const [phase, setPhase] = React.useState("hidden");
|
|
1164
|
-
const timerRef = React.useRef(null);
|
|
1165
|
-
React.useEffect(() => {
|
|
1166
|
-
if (timerRef.current) clearTimeout(timerRef.current);
|
|
1167
|
-
if (open) {
|
|
1168
|
-
setPhase("entering");
|
|
1169
|
-
timerRef.current = setTimeout(() => setPhase("visible"), 16);
|
|
1170
|
-
} else {
|
|
1171
|
-
setPhase("leaving");
|
|
1172
|
-
timerRef.current = setTimeout(() => setPhase("hidden"), exitDurationMs);
|
|
1173
|
-
}
|
|
1174
|
-
return () => {
|
|
1175
|
-
if (timerRef.current) clearTimeout(timerRef.current);
|
|
1176
|
-
};
|
|
1177
|
-
}, [open, exitDurationMs]);
|
|
1178
|
-
return phase;
|
|
1179
|
-
}
|
|
1180
|
-
chunkOLISEQHS_cjs.__name(useChatPresence, "useChatPresence");
|
|
1181
|
-
function dockPositionStyle(position, horizontal, vertical) {
|
|
1182
|
-
const [vert, horiz] = position.split("-");
|
|
1183
|
-
return { [vert]: vertical, [horiz]: horizontal };
|
|
1184
|
-
}
|
|
1185
|
-
chunkOLISEQHS_cjs.__name(dockPositionStyle, "dockPositionStyle");
|
|
1186
|
-
function ChatDock({
|
|
1187
|
-
open,
|
|
1188
|
-
onClose,
|
|
1189
|
-
children,
|
|
1190
|
-
mode = "popover",
|
|
1191
|
-
side = "right",
|
|
1192
|
-
title = "Chat",
|
|
1193
|
-
icon,
|
|
1194
|
-
headerActions,
|
|
1195
|
-
hideHeader = false,
|
|
1196
|
-
closeLabel,
|
|
1197
|
-
width,
|
|
1198
|
-
height = 720,
|
|
1199
|
-
position = "bottom-right",
|
|
1200
|
-
offset: offset2,
|
|
1201
|
-
exitDurationMs = 200,
|
|
1202
|
-
zIndex = 1e4,
|
|
1203
|
-
ariaLabel,
|
|
1204
|
-
className,
|
|
1205
|
-
mobileFullscreen = true,
|
|
1206
|
-
disablePortal = false,
|
|
1207
|
-
inline = false,
|
|
1208
|
-
reserveBodySpace
|
|
1209
|
-
}) {
|
|
1210
|
-
const phase = useChatPresence(open, exitDurationMs);
|
|
1211
|
-
const isMobile = hooks.useIsMobile();
|
|
1212
|
-
const isBelowDesktop = hooks.useIsTabletOrBelow();
|
|
1213
|
-
const effectiveMode = mode === "side" && !isBelowDesktop ? "side" : "popover";
|
|
1214
|
-
const fullscreen = mobileFullscreen && isMobile;
|
|
1215
|
-
const wantsReserve = !inline && !fullscreen && effectiveMode === "side" && (reserveBodySpace ?? true);
|
|
1216
|
-
const resolvedSideWidth = width ?? 420;
|
|
1217
|
-
React.useEffect(() => {
|
|
1218
|
-
if (!wantsReserve || phase === "hidden") return;
|
|
1219
|
-
const body = document.body;
|
|
1220
|
-
if (!body) return;
|
|
1221
|
-
const cssVar = `${resolvedSideWidth}px`;
|
|
1222
|
-
const padKey = side === "right" ? "paddingRight" : "paddingLeft";
|
|
1223
|
-
const prevPad = body.style[padKey];
|
|
1224
|
-
const prevVar = body.style.getPropertyValue("--chat-dock-reserve");
|
|
1225
|
-
body.style[padKey] = cssVar;
|
|
1226
|
-
body.style.setProperty("--chat-dock-reserve", cssVar);
|
|
1227
|
-
return () => {
|
|
1228
|
-
body.style[padKey] = prevPad;
|
|
1229
|
-
if (prevVar) body.style.setProperty("--chat-dock-reserve", prevVar);
|
|
1230
|
-
else body.style.removeProperty("--chat-dock-reserve");
|
|
1231
|
-
};
|
|
1232
|
-
}, [wantsReserve, phase, side, resolvedSideWidth]);
|
|
1233
|
-
if (phase === "hidden") return null;
|
|
1234
|
-
const animating = phase === "entering" || phase === "leaving";
|
|
1235
|
-
const horizontal = offset2?.horizontal ?? 24;
|
|
1236
|
-
const vertical = offset2?.vertical ?? 96;
|
|
1237
|
-
const resolvedWidth = width ?? (effectiveMode === "side" ? resolvedSideWidth : 480);
|
|
1238
|
-
let containerStyle;
|
|
1239
|
-
let cornerClass;
|
|
1240
|
-
const dynVH = "100dvh";
|
|
1241
|
-
if (inline) {
|
|
1242
|
-
containerStyle = {
|
|
1243
|
-
position: "relative",
|
|
1244
|
-
width: resolvedWidth,
|
|
1245
|
-
height,
|
|
1246
|
-
maxHeight: `calc(${dynVH} - 16px)`,
|
|
1247
|
-
pointerEvents: phase === "visible" ? "auto" : "none"
|
|
1248
|
-
};
|
|
1249
|
-
cornerClass = "rounded-xl border";
|
|
1250
|
-
} else if (fullscreen) {
|
|
1251
|
-
containerStyle = {
|
|
1252
|
-
position: "fixed",
|
|
1253
|
-
top: 0,
|
|
1254
|
-
[side === "left" ? "left" : "right"]: 0,
|
|
1255
|
-
width: "100vw",
|
|
1256
|
-
height: dynVH,
|
|
1257
|
-
zIndex,
|
|
1258
|
-
pointerEvents: phase === "visible" ? "auto" : "none"
|
|
1259
|
-
};
|
|
1260
|
-
cornerClass = "rounded-none border-0";
|
|
1261
|
-
} else if (effectiveMode === "side") {
|
|
1262
|
-
containerStyle = {
|
|
1263
|
-
position: "fixed",
|
|
1264
|
-
top: 0,
|
|
1265
|
-
[side]: 0,
|
|
1266
|
-
height: dynVH,
|
|
1267
|
-
zIndex,
|
|
1268
|
-
width: `min(${resolvedWidth}px, 100vw)`,
|
|
1269
|
-
pointerEvents: phase === "visible" ? "auto" : "none"
|
|
1270
|
-
};
|
|
1271
|
-
cornerClass = side === "right" ? "rounded-none border-l" : "rounded-none border-r";
|
|
1272
|
-
} else {
|
|
1273
|
-
const heightCap = `calc(${dynVH} - ${vertical + 24}px)`;
|
|
1274
|
-
containerStyle = {
|
|
1275
|
-
position: "fixed",
|
|
1276
|
-
...dockPositionStyle(position, horizontal, vertical),
|
|
1277
|
-
zIndex,
|
|
1278
|
-
width: `min(${resolvedWidth}px, calc(100vw - 32px))`,
|
|
1279
|
-
height: `min(${height}px, ${heightCap})`,
|
|
1280
|
-
minHeight: `min(320px, ${heightCap})`,
|
|
1281
|
-
pointerEvents: phase === "visible" ? "auto" : "none"
|
|
1282
|
-
};
|
|
1283
|
-
cornerClass = "rounded-xl border";
|
|
1284
|
-
}
|
|
1285
|
-
const enterClass = (() => {
|
|
1286
|
-
if (fullscreen) return "opacity-0";
|
|
1287
|
-
if (effectiveMode === "side") {
|
|
1288
|
-
return side === "right" ? "opacity-0 translate-x-4" : "opacity-0 -translate-x-4";
|
|
1289
|
-
}
|
|
1290
|
-
return "opacity-0 scale-95 translate-y-2";
|
|
1291
|
-
})();
|
|
1292
|
-
const visibleClass = "opacity-100 scale-100 translate-y-0 translate-x-0";
|
|
1293
|
-
return /* @__PURE__ */ jsxRuntime.jsx(components.Portal, { disablePortal: disablePortal || inline, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1294
|
-
"div",
|
|
1295
|
-
{
|
|
1296
|
-
role: "dialog",
|
|
1297
|
-
"aria-label": ariaLabel ?? (typeof title === "string" ? title : "Chat"),
|
|
1298
|
-
"aria-hidden": phase === "leaving",
|
|
1299
|
-
className: lib.cn(
|
|
1300
|
-
"bg-popover text-popover-foreground border-border",
|
|
1301
|
-
"flex flex-col overflow-hidden shadow-2xl",
|
|
1302
|
-
cornerClass,
|
|
1303
|
-
"transition-all duration-200 ease-out",
|
|
1304
|
-
animating ? enterClass : visibleClass,
|
|
1305
|
-
className
|
|
1306
|
-
),
|
|
1307
|
-
style: containerStyle,
|
|
1308
|
-
children: [
|
|
1309
|
-
!hideHeader && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1310
|
-
ChatHeader,
|
|
1311
|
-
{
|
|
1312
|
-
title,
|
|
1313
|
-
icon,
|
|
1314
|
-
actions: headerActions,
|
|
1315
|
-
onClose,
|
|
1316
|
-
closeLabel
|
|
1317
|
-
}
|
|
1318
|
-
),
|
|
1319
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 min-w-0 flex-1 overflow-hidden", children })
|
|
1320
|
-
]
|
|
1321
|
-
}
|
|
1322
|
-
) });
|
|
1323
|
-
}
|
|
1324
|
-
chunkOLISEQHS_cjs.__name(ChatDock, "ChatDock");
|
|
1325
|
-
var ChatHeaderActionButton = React.forwardRef(
|
|
1326
|
-
/* @__PURE__ */ chunkOLISEQHS_cjs.__name(function ChatHeaderActionButton2({ icon, ariaLabel, badge, destructive, loading, disabled, className, ...rest }, ref) {
|
|
1327
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1328
|
-
"button",
|
|
1329
|
-
{
|
|
1330
|
-
ref,
|
|
1331
|
-
type: "button",
|
|
1332
|
-
"aria-label": ariaLabel,
|
|
1333
|
-
title: ariaLabel,
|
|
1334
|
-
disabled: disabled || loading,
|
|
1335
|
-
className: lib.cn(
|
|
1336
|
-
"relative inline-flex h-7 w-7 items-center justify-center rounded-md",
|
|
1337
|
-
"text-muted-foreground transition-colors",
|
|
1338
|
-
"hover:bg-accent hover:text-foreground",
|
|
1339
|
-
"focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1340
|
-
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1341
|
-
destructive && "hover:bg-destructive/15 hover:text-destructive",
|
|
1342
|
-
loading && "animate-pulse",
|
|
1343
|
-
className
|
|
1344
|
-
),
|
|
1345
|
-
...rest,
|
|
1346
|
-
children: [
|
|
1347
|
-
icon,
|
|
1348
|
-
badge !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1349
|
-
"span",
|
|
1350
|
-
{
|
|
1351
|
-
"aria-hidden": "true",
|
|
1352
|
-
className: "absolute -right-0.5 -top-0.5 inline-flex min-w-[14px] h-[14px] items-center justify-center rounded-full bg-destructive px-1 text-[9px] font-semibold leading-none text-destructive-foreground ring-2 ring-background",
|
|
1353
|
-
children: badge > 9 ? "9+" : badge
|
|
1354
|
-
}
|
|
1355
|
-
)
|
|
1356
|
-
]
|
|
1357
|
-
}
|
|
1358
|
-
);
|
|
1359
|
-
}, "ChatHeaderActionButton")
|
|
1360
|
-
);
|
|
1361
|
-
function ChatHeaderModeToggle({
|
|
1362
|
-
mode,
|
|
1363
|
-
onToggle,
|
|
1364
|
-
expandLabel = "Dock to side",
|
|
1365
|
-
collapseLabel = "Back to popover",
|
|
1366
|
-
forceVisible = false
|
|
1367
|
-
}) {
|
|
1368
|
-
const isBelowDesktop = hooks.useIsTabletOrBelow();
|
|
1369
|
-
if (isBelowDesktop && !forceVisible) return null;
|
|
1370
|
-
const isSide = mode === "side";
|
|
1371
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1372
|
-
ChatHeaderActionButton,
|
|
1373
|
-
{
|
|
1374
|
-
icon: isSide ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelRightClose, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelRightOpen, { className: "h-3.5 w-3.5" }),
|
|
1375
|
-
ariaLabel: isSide ? collapseLabel : expandLabel,
|
|
1376
|
-
onClick: onToggle
|
|
1377
|
-
}
|
|
1378
|
-
);
|
|
1379
|
-
}
|
|
1380
|
-
chunkOLISEQHS_cjs.__name(ChatHeaderModeToggle, "ChatHeaderModeToggle");
|
|
1381
|
-
function ChatHeaderAudioToggle({
|
|
1382
|
-
muted,
|
|
1383
|
-
onToggle,
|
|
1384
|
-
unmuteLabel = "Unmute notifications",
|
|
1385
|
-
muteLabel = "Mute notifications"
|
|
1386
|
-
}) {
|
|
1387
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1388
|
-
ChatHeaderActionButton,
|
|
1389
|
-
{
|
|
1390
|
-
icon: muted ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.VolumeX, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Volume2, { className: "h-3.5 w-3.5" }),
|
|
1391
|
-
ariaLabel: muted ? unmuteLabel : muteLabel,
|
|
1392
|
-
onClick: onToggle
|
|
1393
|
-
}
|
|
1394
|
-
);
|
|
1395
|
-
}
|
|
1396
|
-
chunkOLISEQHS_cjs.__name(ChatHeaderAudioToggle, "ChatHeaderAudioToggle");
|
|
1397
|
-
function useChatReset(opts) {
|
|
1398
|
-
const { onReset, onSuccess, onError } = opts;
|
|
1399
|
-
const [isResetting, setIsResetting] = React.useState(false);
|
|
1400
|
-
const reset = React.useCallback(async () => {
|
|
1401
|
-
if (isResetting) return false;
|
|
1402
|
-
setIsResetting(true);
|
|
1403
|
-
try {
|
|
1404
|
-
const ok = await onReset();
|
|
1405
|
-
if (ok) onSuccess?.();
|
|
1406
|
-
else onError?.();
|
|
1407
|
-
return ok;
|
|
1408
|
-
} catch (err) {
|
|
1409
|
-
onError?.(err);
|
|
1410
|
-
return false;
|
|
1411
|
-
} finally {
|
|
1412
|
-
setIsResetting(false);
|
|
1413
|
-
}
|
|
1414
|
-
}, [isResetting, onReset, onSuccess, onError]);
|
|
1415
|
-
return { reset, isResetting };
|
|
1416
|
-
}
|
|
1417
|
-
chunkOLISEQHS_cjs.__name(useChatReset, "useChatReset");
|
|
1418
|
-
var DEFAULT_TITLE = "Clear conversation?";
|
|
1419
|
-
var DEFAULT_MESSAGE = "The assistant will forget this session and start a new one. This cannot be undone.";
|
|
1420
|
-
var DEFAULT_LABEL = "Clear conversation";
|
|
1421
|
-
function ChatHeaderResetButton({
|
|
1422
|
-
onReset,
|
|
1423
|
-
onSuccess,
|
|
1424
|
-
onError,
|
|
1425
|
-
confirm = true,
|
|
1426
|
-
confirmTitle = DEFAULT_TITLE,
|
|
1427
|
-
confirmMessage = DEFAULT_MESSAGE,
|
|
1428
|
-
ariaLabel = DEFAULT_LABEL
|
|
1429
|
-
}) {
|
|
1430
|
-
const { reset, isResetting } = useChatReset({ onReset, onSuccess, onError });
|
|
1431
|
-
const handleClick = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(async () => {
|
|
1432
|
-
if (confirm) {
|
|
1433
|
-
const api = typeof window !== "undefined" ? window.dialog : void 0;
|
|
1434
|
-
if (api?.confirm) {
|
|
1435
|
-
const ok = await api.confirm({
|
|
1436
|
-
title: confirmTitle,
|
|
1437
|
-
message: confirmMessage,
|
|
1438
|
-
variant: "destructive",
|
|
1439
|
-
confirmText: "Clear",
|
|
1440
|
-
cancelText: "Cancel"
|
|
1441
|
-
});
|
|
1442
|
-
if (!ok) return;
|
|
1443
|
-
} else if (typeof window !== "undefined" && typeof window.confirm === "function") {
|
|
1444
|
-
const ok = window.confirm(`${confirmTitle}
|
|
1445
|
-
|
|
1446
|
-
${confirmMessage}`);
|
|
1447
|
-
if (!ok) return;
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
await reset();
|
|
1451
|
-
}, "handleClick");
|
|
1452
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1453
|
-
ChatHeaderActionButton,
|
|
1454
|
-
{
|
|
1455
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RotateCcw, { className: "h-3.5 w-3.5" }),
|
|
1456
|
-
ariaLabel,
|
|
1457
|
-
onClick: handleClick,
|
|
1458
|
-
loading: isResetting,
|
|
1459
|
-
destructive: true
|
|
1460
|
-
}
|
|
1461
|
-
);
|
|
1462
|
-
}
|
|
1463
|
-
chunkOLISEQHS_cjs.__name(ChatHeaderResetButton, "ChatHeaderResetButton");
|
|
1464
|
-
|
|
1465
|
-
// src/tools/SpeechRecognition/core/languages-catalog.ts
|
|
1466
|
-
var WEB_SPEECH_LANGUAGES = [
|
|
1467
|
-
{ name: "Afrikaans", iso: "af", englishName: "afrikaans", dialects: [{ code: "af-ZA", region: "South Africa" }] },
|
|
1468
|
-
{ name: "\u12A0\u121B\u122D\u129B", iso: "am", englishName: "amharic", dialects: [{ code: "am-ET", region: "Ethiopia" }] },
|
|
1469
|
-
{ name: "Az\u0259rbaycanca", iso: "az", englishName: "azerbaijani", dialects: [{ code: "az-AZ", region: "Azerbaijan" }] },
|
|
1470
|
-
{
|
|
1471
|
-
name: "\u09AC\u09BE\u0982\u09B2\u09BE",
|
|
1472
|
-
iso: "bn",
|
|
1473
|
-
englishName: "bengali",
|
|
1474
|
-
dialects: [
|
|
1475
|
-
{ code: "bn-BD", region: "Bangladesh" },
|
|
1476
|
-
{ code: "bn-IN", region: "India" }
|
|
1477
|
-
]
|
|
1478
|
-
},
|
|
1479
|
-
{ name: "Bahasa Indonesia", iso: "id", englishName: "indonesian", dialects: [{ code: "id-ID", region: "Indonesia" }] },
|
|
1480
|
-
{ name: "Bahasa Melayu", iso: "ms", englishName: "malay", dialects: [{ code: "ms-MY", region: "Malaysia" }] },
|
|
1481
|
-
{ name: "Catal\xE0", iso: "ca", englishName: "catalan", dialects: [{ code: "ca-ES", region: "Spain" }] },
|
|
1482
|
-
{ name: "\u010Ce\u0161tina", iso: "cs", englishName: "czech", dialects: [{ code: "cs-CZ", region: "Czechia" }] },
|
|
1483
|
-
{ name: "Dansk", iso: "da", englishName: "danish", dialects: [{ code: "da-DK", region: "Denmark" }] },
|
|
1484
|
-
{ name: "Deutsch", iso: "de", englishName: "german", dialects: [{ code: "de-DE", region: "Germany" }] },
|
|
1485
|
-
{
|
|
1486
|
-
name: "English",
|
|
1487
|
-
iso: "en",
|
|
1488
|
-
englishName: "english",
|
|
1489
|
-
dialects: [
|
|
1490
|
-
{ code: "en-US", region: "United States" },
|
|
1491
|
-
{ code: "en-GB", region: "United Kingdom" },
|
|
1492
|
-
{ code: "en-AU", region: "Australia" },
|
|
1493
|
-
{ code: "en-CA", region: "Canada" },
|
|
1494
|
-
{ code: "en-IN", region: "India" },
|
|
1495
|
-
{ code: "en-NZ", region: "New Zealand" },
|
|
1496
|
-
{ code: "en-PH", region: "Philippines" },
|
|
1497
|
-
{ code: "en-ZA", region: "South Africa" },
|
|
1498
|
-
{ code: "en-NG", region: "Nigeria" },
|
|
1499
|
-
{ code: "en-GH", region: "Ghana" },
|
|
1500
|
-
{ code: "en-KE", region: "Kenya" },
|
|
1501
|
-
{ code: "en-TZ", region: "Tanzania" }
|
|
1502
|
-
]
|
|
1503
|
-
},
|
|
1504
|
-
{
|
|
1505
|
-
name: "Espa\xF1ol",
|
|
1506
|
-
iso: "es",
|
|
1507
|
-
englishName: "spanish",
|
|
1508
|
-
dialects: [
|
|
1509
|
-
{ code: "es-ES", region: "Espa\xF1a" },
|
|
1510
|
-
{ code: "es-MX", region: "M\xE9xico" },
|
|
1511
|
-
{ code: "es-US", region: "Estados Unidos" },
|
|
1512
|
-
{ code: "es-AR", region: "Argentina" },
|
|
1513
|
-
{ code: "es-CL", region: "Chile" },
|
|
1514
|
-
{ code: "es-CO", region: "Colombia" },
|
|
1515
|
-
{ code: "es-PE", region: "Per\xFA" },
|
|
1516
|
-
{ code: "es-VE", region: "Venezuela" },
|
|
1517
|
-
{ code: "es-EC", region: "Ecuador" },
|
|
1518
|
-
{ code: "es-GT", region: "Guatemala" },
|
|
1519
|
-
{ code: "es-CR", region: "Costa Rica" },
|
|
1520
|
-
{ code: "es-PA", region: "Panam\xE1" },
|
|
1521
|
-
{ code: "es-DO", region: "Rep. Dominicana" },
|
|
1522
|
-
{ code: "es-UY", region: "Uruguay" },
|
|
1523
|
-
{ code: "es-PY", region: "Paraguay" },
|
|
1524
|
-
{ code: "es-BO", region: "Bolivia" },
|
|
1525
|
-
{ code: "es-SV", region: "El Salvador" },
|
|
1526
|
-
{ code: "es-HN", region: "Honduras" },
|
|
1527
|
-
{ code: "es-NI", region: "Nicaragua" },
|
|
1528
|
-
{ code: "es-PR", region: "Puerto Rico" }
|
|
1529
|
-
]
|
|
1530
|
-
},
|
|
1531
|
-
{ name: "Euskara", iso: "eu", englishName: "basque", dialects: [{ code: "eu-ES", region: "Spain" }] },
|
|
1532
|
-
{ name: "Filipino", iso: "fil", englishName: "filipino tagalog", dialects: [{ code: "fil-PH", region: "Philippines" }] },
|
|
1533
|
-
{ name: "Fran\xE7ais", iso: "fr", englishName: "french", dialects: [{ code: "fr-FR", region: "France" }] },
|
|
1534
|
-
{ name: "Basa Jawa", iso: "jv", englishName: "javanese", dialects: [{ code: "jv-ID", region: "Indonesia" }] },
|
|
1535
|
-
{ name: "Galego", iso: "gl", englishName: "galician", dialects: [{ code: "gl-ES", region: "Spain" }] },
|
|
1536
|
-
{ name: "\u0A97\u0AC1\u0A9C\u0AB0\u0ABE\u0AA4\u0AC0", iso: "gu", englishName: "gujarati", dialects: [{ code: "gu-IN", region: "India" }] },
|
|
1537
|
-
{ name: "Hrvatski", iso: "hr", englishName: "croatian", dialects: [{ code: "hr-HR", region: "Croatia" }] },
|
|
1538
|
-
{ name: "IsiZulu", iso: "zu", englishName: "zulu", dialects: [{ code: "zu-ZA", region: "South Africa" }] },
|
|
1539
|
-
{ name: "\xCDslenska", iso: "is", englishName: "icelandic", dialects: [{ code: "is-IS", region: "Iceland" }] },
|
|
1540
|
-
{
|
|
1541
|
-
name: "Italiano",
|
|
1542
|
-
iso: "it",
|
|
1543
|
-
englishName: "italian",
|
|
1544
|
-
dialects: [
|
|
1545
|
-
{ code: "it-IT", region: "Italia" },
|
|
1546
|
-
{ code: "it-CH", region: "Svizzera" }
|
|
1547
|
-
]
|
|
1548
|
-
},
|
|
1549
|
-
{ name: "\u0C95\u0CA8\u0CCD\u0CA8\u0CA1", iso: "kn", englishName: "kannada", dialects: [{ code: "kn-IN", region: "India" }] },
|
|
1550
|
-
{ name: "\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A", iso: "km", englishName: "khmer cambodian", dialects: [{ code: "km-KH", region: "Cambodia" }] },
|
|
1551
|
-
{ name: "Latvie\u0161u", iso: "lv", englishName: "latvian", dialects: [{ code: "lv-LV", region: "Latvia" }] },
|
|
1552
|
-
{ name: "Lietuvi\u0173", iso: "lt", englishName: "lithuanian", dialects: [{ code: "lt-LT", region: "Lithuania" }] },
|
|
1553
|
-
{ name: "\u0D2E\u0D32\u0D2F\u0D3E\u0D33\u0D02", iso: "ml", englishName: "malayalam", dialects: [{ code: "ml-IN", region: "India" }] },
|
|
1554
|
-
{ name: "\u092E\u0930\u093E\u0920\u0940", iso: "mr", englishName: "marathi", dialects: [{ code: "mr-IN", region: "India" }] },
|
|
1555
|
-
{ name: "Magyar", iso: "hu", englishName: "hungarian", dialects: [{ code: "hu-HU", region: "Hungary" }] },
|
|
1556
|
-
{ name: "\u0EA5\u0EB2\u0EA7", iso: "lo", englishName: "lao laotian", dialects: [{ code: "lo-LA", region: "Laos" }] },
|
|
1557
|
-
{ name: "Nederlands", iso: "nl", englishName: "dutch", dialects: [{ code: "nl-NL", region: "Netherlands" }] },
|
|
1558
|
-
{ name: "\u0928\u0947\u092A\u093E\u0932\u0940 \u092D\u093E\u0937\u093E", iso: "ne", englishName: "nepali", dialects: [{ code: "ne-NP", region: "Nepal" }] },
|
|
1559
|
-
{ name: "Norsk bokm\xE5l", iso: "nb", englishName: "norwegian bokmal", dialects: [{ code: "nb-NO", region: "Norway" }] },
|
|
1560
|
-
{ name: "Polski", iso: "pl", englishName: "polish", dialects: [{ code: "pl-PL", region: "Poland" }] },
|
|
1561
|
-
{
|
|
1562
|
-
name: "Portugu\xEAs",
|
|
1563
|
-
iso: "pt",
|
|
1564
|
-
englishName: "portuguese",
|
|
1565
|
-
dialects: [
|
|
1566
|
-
{ code: "pt-BR", region: "Brasil" },
|
|
1567
|
-
{ code: "pt-PT", region: "Portugal" }
|
|
1568
|
-
]
|
|
1569
|
-
},
|
|
1570
|
-
{ name: "Rom\xE2n\u0103", iso: "ro", englishName: "romanian", dialects: [{ code: "ro-RO", region: "Romania" }] },
|
|
1571
|
-
{ name: "\u0DC3\u0DD2\u0D82\u0DC4\u0DBD", iso: "si", englishName: "sinhala sinhalese", dialects: [{ code: "si-LK", region: "Sri Lanka" }] },
|
|
1572
|
-
{ name: "Sloven\u0161\u010Dina", iso: "sl", englishName: "slovenian", dialects: [{ code: "sl-SI", region: "Slovenia" }] },
|
|
1573
|
-
{ name: "Basa Sunda", iso: "su", englishName: "sundanese", dialects: [{ code: "su-ID", region: "Indonesia" }] },
|
|
1574
|
-
{ name: "Sloven\u010Dina", iso: "sk", englishName: "slovak", dialects: [{ code: "sk-SK", region: "Slovakia" }] },
|
|
1575
|
-
{ name: "Suomi", iso: "fi", englishName: "finnish", dialects: [{ code: "fi-FI", region: "Finland" }] },
|
|
1576
|
-
{ name: "Svenska", iso: "sv", englishName: "swedish", dialects: [{ code: "sv-SE", region: "Sweden" }] },
|
|
1577
|
-
{
|
|
1578
|
-
name: "Kiswahili",
|
|
1579
|
-
iso: "sw",
|
|
1580
|
-
englishName: "swahili",
|
|
1581
|
-
dialects: [
|
|
1582
|
-
{ code: "sw-TZ", region: "Tanzania" },
|
|
1583
|
-
{ code: "sw-KE", region: "Kenya" }
|
|
1584
|
-
]
|
|
1585
|
-
},
|
|
1586
|
-
{ name: "\u10E5\u10D0\u10E0\u10D7\u10E3\u10DA\u10D8", iso: "ka", englishName: "georgian", dialects: [{ code: "ka-GE", region: "Georgia" }] },
|
|
1587
|
-
{ name: "\u0540\u0561\u0575\u0565\u0580\u0565\u0576", iso: "hy", englishName: "armenian", dialects: [{ code: "hy-AM", region: "Armenia" }] },
|
|
1588
|
-
{
|
|
1589
|
-
name: "\u0BA4\u0BAE\u0BBF\u0BB4\u0BCD",
|
|
1590
|
-
iso: "ta",
|
|
1591
|
-
englishName: "tamil",
|
|
1592
|
-
dialects: [
|
|
1593
|
-
{ code: "ta-IN", region: "\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE" },
|
|
1594
|
-
{ code: "ta-SG", region: "\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD" },
|
|
1595
|
-
{ code: "ta-LK", region: "\u0B87\u0BB2\u0B99\u0BCD\u0B95\u0BC8" },
|
|
1596
|
-
{ code: "ta-MY", region: "\u0BAE\u0BB2\u0BC7\u0B9A\u0BBF\u0BAF\u0BBE" }
|
|
1597
|
-
]
|
|
1598
|
-
},
|
|
1599
|
-
{ name: "\u0C24\u0C46\u0C32\u0C41\u0C17\u0C41", iso: "te", englishName: "telugu", dialects: [{ code: "te-IN", region: "India" }] },
|
|
1600
|
-
{ name: "Ti\u1EBFng Vi\u1EC7t", iso: "vi", englishName: "vietnamese", dialects: [{ code: "vi-VN", region: "Vietnam" }] },
|
|
1601
|
-
{ name: "T\xFCrk\xE7e", iso: "tr", englishName: "turkish", dialects: [{ code: "tr-TR", region: "T\xFCrkiye" }] },
|
|
1602
|
-
{
|
|
1603
|
-
name: "\u0627\u064F\u0631\u062F\u064F\u0648",
|
|
1604
|
-
iso: "ur",
|
|
1605
|
-
englishName: "urdu",
|
|
1606
|
-
dialects: [
|
|
1607
|
-
{ code: "ur-PK", region: "\u067E\u0627\u06A9\u0633\u062A\u0627\u0646" },
|
|
1608
|
-
{ code: "ur-IN", region: "\u0628\u06BE\u0627\u0631\u062A" }
|
|
1609
|
-
]
|
|
1610
|
-
},
|
|
1611
|
-
{ name: "\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC", iso: "el", englishName: "greek", dialects: [{ code: "el-GR", region: "Greece" }] },
|
|
1612
|
-
{ name: "\u0431\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438", iso: "bg", englishName: "bulgarian", dialects: [{ code: "bg-BG", region: "Bulgaria" }] },
|
|
1613
|
-
{ name: "\u0420\u0443\u0441\u0441\u043A\u0438\u0439", iso: "ru", englishName: "russian", dialects: [{ code: "ru-RU", region: "Russia" }] },
|
|
1614
|
-
{ name: "\u0421\u0440\u043F\u0441\u043A\u0438", iso: "sr", englishName: "serbian", dialects: [{ code: "sr-RS", region: "Serbia" }] },
|
|
1615
|
-
{ name: "\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430", iso: "uk", englishName: "ukrainian", dialects: [{ code: "uk-UA", region: "Ukraine" }] },
|
|
1616
|
-
{ name: "\uD55C\uAD6D\uC5B4", iso: "ko", englishName: "korean", dialects: [{ code: "ko-KR", region: "Korea" }] },
|
|
1617
|
-
{
|
|
1618
|
-
name: "\u4E2D\u6587",
|
|
1619
|
-
iso: "cmn",
|
|
1620
|
-
englishName: "chinese mandarin cantonese",
|
|
1621
|
-
dialects: [
|
|
1622
|
-
{ code: "cmn-Hans-CN", region: "\u666E\u901A\u8BDD (\u4E2D\u56FD\u5927\u9646)" },
|
|
1623
|
-
{ code: "cmn-Hans-HK", region: "\u666E\u901A\u8BDD (\u9999\u6E2F)" },
|
|
1624
|
-
{ code: "cmn-Hant-TW", region: "\u4E2D\u6587 (\u53F0\u7063)" },
|
|
1625
|
-
{ code: "yue-Hant-HK", region: "\u7CB5\u8A9E (\u9999\u6E2F)" }
|
|
1626
|
-
]
|
|
1627
|
-
},
|
|
1628
|
-
{ name: "\u65E5\u672C\u8A9E", iso: "ja", englishName: "japanese", dialects: [{ code: "ja-JP", region: "Japan" }] },
|
|
1629
|
-
{ name: "\u0939\u093F\u0928\u094D\u0926\u0940", iso: "hi", englishName: "hindi", dialects: [{ code: "hi-IN", region: "India" }] },
|
|
1630
|
-
{ name: "\u0E20\u0E32\u0E29\u0E32\u0E44\u0E17\u0E22", iso: "th", englishName: "thai", dialects: [{ code: "th-TH", region: "Thailand" }] }
|
|
1631
|
-
];
|
|
1632
|
-
WEB_SPEECH_LANGUAGES.flatMap(
|
|
1633
|
-
(l) => l.dialects.map((d) => d.code)
|
|
1634
|
-
);
|
|
1635
|
-
function findSpeechLanguage(tag) {
|
|
1636
|
-
if (!tag) return null;
|
|
1637
|
-
const lower = tag.toLowerCase();
|
|
1638
|
-
for (const language of WEB_SPEECH_LANGUAGES) {
|
|
1639
|
-
for (const dialect of language.dialects) {
|
|
1640
|
-
if (dialect.code.toLowerCase() === lower) return { language, dialect };
|
|
1641
|
-
}
|
|
1642
|
-
}
|
|
1643
|
-
return null;
|
|
1644
|
-
}
|
|
1645
|
-
chunkOLISEQHS_cjs.__name(findSpeechLanguage, "findSpeechLanguage");
|
|
1646
|
-
function countryFromTag(tag) {
|
|
1647
|
-
if (!tag) return null;
|
|
1648
|
-
const parts = tag.split("-");
|
|
1649
|
-
for (let i = parts.length - 1; i >= 0; i -= 1) {
|
|
1650
|
-
const p = parts[i];
|
|
1651
|
-
if (p.length === 2 && /^[A-Za-z]{2}$/.test(p)) return p.toUpperCase();
|
|
1652
|
-
}
|
|
1653
|
-
return null;
|
|
1654
|
-
}
|
|
1655
|
-
chunkOLISEQHS_cjs.__name(countryFromTag, "countryFromTag");
|
|
1656
|
-
chunkADEN3UA4_cjs.getSpeechLogger();
|
|
1657
|
-
React.createContext(null);
|
|
1658
|
-
createLazyComponent(
|
|
1659
|
-
() => import('./DictationField-AS2F33WI.cjs').then((mod) => ({
|
|
1660
|
-
default: mod.DictationField
|
|
1661
|
-
})),
|
|
1662
|
-
{
|
|
1663
|
-
displayName: "LazyDictationField",
|
|
1664
|
-
fallback: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-border/60 bg-card px-3 py-2 text-xs text-muted-foreground", children: "Loading dictation\u2026" })
|
|
1665
|
-
}
|
|
1666
|
-
);
|
|
1667
|
-
function ChatHeaderLanguageButton({
|
|
1668
|
-
ariaLabel = "Speech language",
|
|
1669
|
-
allowedTags,
|
|
1670
|
-
hideFallbackIcon,
|
|
1671
|
-
className
|
|
1672
|
-
}) {
|
|
1673
|
-
const prefs = chunkADEN3UA4_cjs.useSpeechPrefs();
|
|
1674
|
-
const active = chunkADEN3UA4_cjs.useResolvedLanguage();
|
|
1675
|
-
const options = React.useMemo(() => {
|
|
1676
|
-
const allow = allowedTags ? new Set(allowedTags) : null;
|
|
1677
|
-
const out = [];
|
|
1678
|
-
for (const lang of WEB_SPEECH_LANGUAGES) {
|
|
1679
|
-
for (const d of lang.dialects) {
|
|
1680
|
-
if (allow && !allow.has(d.code)) continue;
|
|
1681
|
-
out.push({
|
|
1682
|
-
value: d.code,
|
|
1683
|
-
// "Русский" / "Español — Argentina" / "English — United States"
|
|
1684
|
-
label: lang.dialects.length === 1 ? lang.name : `${lang.name} \u2014 ${d.region}`,
|
|
1685
|
-
// Search-only index: English name, BCP-47 tag, ISO, region.
|
|
1686
|
-
// Lets users type "russian" / "ru-RU" / "ru" / "argentina"
|
|
1687
|
-
// and still find the row regardless of native script.
|
|
1688
|
-
description: `${lang.englishName} ${d.code} ${lang.iso} ${d.region}`.toLowerCase()
|
|
1689
|
-
});
|
|
1690
|
-
}
|
|
1691
|
-
}
|
|
1692
|
-
return out;
|
|
1693
|
-
}, [allowedTags]);
|
|
1694
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1695
|
-
components.Combobox,
|
|
1696
|
-
{
|
|
1697
|
-
options,
|
|
1698
|
-
value: prefs.language ?? active,
|
|
1699
|
-
onValueChange: (v) => prefs.setLanguage(v || null),
|
|
1700
|
-
placeholder: ariaLabel,
|
|
1701
|
-
searchPlaceholder: "Search language\u2026",
|
|
1702
|
-
filterFunction: (opt, search) => {
|
|
1703
|
-
const s = search.toLowerCase();
|
|
1704
|
-
return opt.label.toLowerCase().includes(s) || opt.value.toLowerCase().includes(s) || (opt.description?.includes(s) ?? false);
|
|
1705
|
-
},
|
|
1706
|
-
contentClassName: "w-[280px]",
|
|
1707
|
-
contentStyle: { zIndex: 10001 },
|
|
1708
|
-
renderOption: (option) => {
|
|
1709
|
-
const country = countryFromTag(option.value);
|
|
1710
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
1711
|
-
country ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1712
|
-
components.Flag,
|
|
1713
|
-
{
|
|
1714
|
-
countryCode: country,
|
|
1715
|
-
className: "h-4 w-5 shrink-0 overflow-hidden rounded-[2px] border border-border/60 ring-1 ring-black/5"
|
|
1716
|
-
}
|
|
1717
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Globe, { className: "h-4 w-4 shrink-0 text-muted-foreground", "aria-hidden": true }),
|
|
1718
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm", children: option.label })
|
|
1719
|
-
] });
|
|
1720
|
-
},
|
|
1721
|
-
renderTrigger: (selected, open) => {
|
|
1722
|
-
const tag = selected?.value ?? active;
|
|
1723
|
-
const country = countryFromTag(tag);
|
|
1724
|
-
const found = findSpeechLanguage(tag);
|
|
1725
|
-
const tooltipLabel = found ? `${found.language.name}${found.language.dialects.length > 1 ? ` \u2014 ${found.dialect.region}` : ""} \xB7 ${tag}` : tag;
|
|
1726
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1727
|
-
"button",
|
|
1728
|
-
{
|
|
1729
|
-
type: "button",
|
|
1730
|
-
"aria-label": `${ariaLabel}: ${tooltipLabel}`,
|
|
1731
|
-
"aria-expanded": open,
|
|
1732
|
-
title: tooltipLabel,
|
|
1733
|
-
className: lib.cn(
|
|
1734
|
-
"inline-flex h-7 w-7 items-center justify-center rounded-md",
|
|
1735
|
-
"text-muted-foreground transition-colors",
|
|
1736
|
-
"hover:bg-accent hover:text-foreground",
|
|
1737
|
-
"focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1738
|
-
className
|
|
1739
|
-
),
|
|
1740
|
-
children: country ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1741
|
-
components.Flag,
|
|
1742
|
-
{
|
|
1743
|
-
countryCode: country,
|
|
1744
|
-
className: "h-4 w-5 overflow-hidden rounded-[2px] border border-border/60 ring-1 ring-black/5"
|
|
1745
|
-
}
|
|
1746
|
-
) : hideFallbackIcon ? null : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Globe, { className: "h-3.5 w-3.5", "aria-hidden": true })
|
|
1747
|
-
}
|
|
1748
|
-
);
|
|
1749
|
-
}
|
|
1750
|
-
}
|
|
1751
|
-
);
|
|
1752
|
-
}
|
|
1753
|
-
chunkOLISEQHS_cjs.__name(ChatHeaderLanguageButton, "ChatHeaderLanguageButton");
|
|
1754
|
-
function anchorStyle(position, fabOffset, fabClearance) {
|
|
1755
|
-
const [vert, horiz] = position.split("-");
|
|
1756
|
-
return { [vert]: fabClearance, [horiz]: fabOffset };
|
|
1757
|
-
}
|
|
1758
|
-
chunkOLISEQHS_cjs.__name(anchorStyle, "anchorStyle");
|
|
1759
|
-
function originClass(position) {
|
|
1760
|
-
if (position === "bottom-right") return "origin-bottom-right";
|
|
1761
|
-
if (position === "bottom-left") return "origin-bottom-left";
|
|
1762
|
-
if (position === "top-right") return "origin-top-right";
|
|
1763
|
-
return "origin-top-left";
|
|
1764
|
-
}
|
|
1765
|
-
chunkOLISEQHS_cjs.__name(originClass, "originClass");
|
|
1766
|
-
function ChatGreeting({
|
|
1767
|
-
open,
|
|
1768
|
-
children,
|
|
1769
|
-
onClick,
|
|
1770
|
-
onDismiss,
|
|
1771
|
-
position = "bottom-right",
|
|
1772
|
-
fabOffset = 24,
|
|
1773
|
-
fabClearance = 96,
|
|
1774
|
-
delayMs = 1500,
|
|
1775
|
-
zIndex = 9998,
|
|
1776
|
-
className,
|
|
1777
|
-
style,
|
|
1778
|
-
avatar,
|
|
1779
|
-
senderName,
|
|
1780
|
-
dismissLabel = "Dismiss",
|
|
1781
|
-
inline = false
|
|
1782
|
-
}) {
|
|
1783
|
-
const [delayed, setDelayed] = React.useState(delayMs <= 0);
|
|
1784
|
-
React.useEffect(() => {
|
|
1785
|
-
if (!open || delayMs <= 0) return;
|
|
1786
|
-
const t = setTimeout(() => setDelayed(true), delayMs);
|
|
1787
|
-
return () => clearTimeout(t);
|
|
1788
|
-
}, [open, delayMs]);
|
|
1789
|
-
const shouldShow = open && delayed;
|
|
1790
|
-
const phase = useChatPresence(shouldShow, 220);
|
|
1791
|
-
if (phase === "hidden") return null;
|
|
1792
|
-
const animating = phase === "entering" || phase === "leaving";
|
|
1793
|
-
const clickable = !!onClick;
|
|
1794
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1795
|
-
"div",
|
|
1796
|
-
{
|
|
1797
|
-
role: clickable ? "button" : "status",
|
|
1798
|
-
"aria-live": "polite",
|
|
1799
|
-
tabIndex: clickable ? 0 : -1,
|
|
1800
|
-
onClick: clickable ? onClick : void 0,
|
|
1801
|
-
onKeyDown: clickable ? (e) => {
|
|
1802
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
1803
|
-
e.preventDefault();
|
|
1804
|
-
onClick?.();
|
|
1805
|
-
}
|
|
1806
|
-
} : void 0,
|
|
1807
|
-
className: lib.cn(
|
|
1808
|
-
inline ? "relative inline-flex" : "fixed",
|
|
1809
|
-
"flex items-start gap-2.5 max-w-[280px]",
|
|
1810
|
-
"rounded-2xl border border-border bg-popover text-popover-foreground",
|
|
1811
|
-
"px-3.5 py-2.5 shadow-2xl transition-all duration-200 ease-out",
|
|
1812
|
-
clickable && "cursor-pointer hover:bg-accent/40 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1813
|
-
originClass(position),
|
|
1814
|
-
animating ? "opacity-0 scale-95 translate-y-1" : "opacity-100 scale-100 translate-y-0",
|
|
1815
|
-
className
|
|
1816
|
-
),
|
|
1817
|
-
style: {
|
|
1818
|
-
...inline ? {} : anchorStyle(position, fabOffset, fabClearance),
|
|
1819
|
-
...inline ? {} : { zIndex },
|
|
1820
|
-
pointerEvents: phase === "visible" ? "auto" : "none",
|
|
1821
|
-
...style
|
|
1822
|
-
},
|
|
1823
|
-
children: [
|
|
1824
|
-
avatar && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-0.5 shrink-0", children: avatar }),
|
|
1825
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1 text-sm leading-snug", children: [
|
|
1826
|
-
senderName && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-0.5 text-[11px] font-medium text-muted-foreground", children: senderName }),
|
|
1827
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-foreground", children })
|
|
1828
|
-
] }),
|
|
1829
|
-
onDismiss && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1830
|
-
"button",
|
|
1831
|
-
{
|
|
1832
|
-
type: "button",
|
|
1833
|
-
"aria-label": dismissLabel,
|
|
1834
|
-
onClick: (e) => {
|
|
1835
|
-
e.stopPropagation();
|
|
1836
|
-
onDismiss();
|
|
1837
|
-
},
|
|
1838
|
-
className: lib.cn(
|
|
1839
|
-
"-mr-1 -mt-1 flex h-6 w-6 shrink-0 items-center justify-center rounded-full",
|
|
1840
|
-
"text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
1841
|
-
"focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
1842
|
-
),
|
|
1843
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-3.5 w-3.5" })
|
|
1844
|
-
}
|
|
1845
|
-
)
|
|
1846
|
-
]
|
|
1847
|
-
}
|
|
1848
|
-
);
|
|
1849
|
-
}
|
|
1850
|
-
chunkOLISEQHS_cjs.__name(ChatGreeting, "ChatGreeting");
|
|
1851
|
-
var TIME_FORMAT = new Intl.DateTimeFormat(void 0, {
|
|
1852
|
-
hour: "2-digit",
|
|
1853
|
-
minute: "2-digit"
|
|
1854
|
-
});
|
|
1855
|
-
function anchorStyle2(position, fabOffset, fabClearance) {
|
|
1856
|
-
const [vert, horiz] = position.split("-");
|
|
1857
|
-
return { [vert]: fabClearance, [horiz]: fabOffset };
|
|
1858
|
-
}
|
|
1859
|
-
chunkOLISEQHS_cjs.__name(anchorStyle2, "anchorStyle");
|
|
1860
|
-
function originClass2(position) {
|
|
1861
|
-
if (position === "bottom-right") return "origin-bottom-right";
|
|
1862
|
-
if (position === "bottom-left") return "origin-bottom-left";
|
|
1863
|
-
if (position === "top-right") return "origin-top-right";
|
|
1864
|
-
return "origin-top-left";
|
|
1865
|
-
}
|
|
1866
|
-
chunkOLISEQHS_cjs.__name(originClass2, "originClass");
|
|
1867
|
-
function deriveAvatar(persona, name) {
|
|
1868
|
-
const initials = persona?.initials ?? (name ?? persona?.name ?? "?").split(/\s+/).map((p) => p[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
|
|
1869
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(components.Avatar, { className: "h-9 w-9", children: [
|
|
1870
|
-
persona?.avatarUrl ? /* @__PURE__ */ jsxRuntime.jsx(components.AvatarImage, { src: persona.avatarUrl }) : null,
|
|
1871
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.AvatarFallback, { children: initials || "?" })
|
|
1872
|
-
] });
|
|
1873
|
-
}
|
|
1874
|
-
chunkOLISEQHS_cjs.__name(deriveAvatar, "deriveAvatar");
|
|
1875
|
-
function ChatUnreadPreview({
|
|
1876
|
-
open,
|
|
1877
|
-
message,
|
|
1878
|
-
onClick,
|
|
1879
|
-
onDismiss,
|
|
1880
|
-
position = "bottom-right",
|
|
1881
|
-
fabOffset = 24,
|
|
1882
|
-
fabClearance = 96,
|
|
1883
|
-
truncate = 2,
|
|
1884
|
-
zIndex = 9998,
|
|
1885
|
-
inline = false,
|
|
1886
|
-
className,
|
|
1887
|
-
style,
|
|
1888
|
-
dismissLabel = "Mark as read",
|
|
1889
|
-
avatar,
|
|
1890
|
-
senderName
|
|
1891
|
-
}) {
|
|
1892
|
-
const shouldShow = open && !!message;
|
|
1893
|
-
const phase = useChatPresence(shouldShow, 200);
|
|
1894
|
-
if (phase === "hidden" || !message) return null;
|
|
1895
|
-
const animating = phase === "entering" || phase === "leaving";
|
|
1896
|
-
const clickable = !!onClick;
|
|
1897
|
-
const displayName = senderName ?? message.sender?.name ?? "New message";
|
|
1898
|
-
const stamp = TIME_FORMAT.format(new Date(message.createdAt));
|
|
1899
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1900
|
-
"div",
|
|
1901
|
-
{
|
|
1902
|
-
role: clickable ? "button" : "status",
|
|
1903
|
-
"aria-live": "polite",
|
|
1904
|
-
tabIndex: clickable ? 0 : -1,
|
|
1905
|
-
onClick: clickable ? onClick : void 0,
|
|
1906
|
-
onKeyDown: clickable ? (e) => {
|
|
1907
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
1908
|
-
e.preventDefault();
|
|
1909
|
-
onClick?.();
|
|
1910
|
-
}
|
|
1911
|
-
} : void 0,
|
|
1912
|
-
className: lib.cn(
|
|
1913
|
-
inline ? "relative inline-flex" : "fixed",
|
|
1914
|
-
"flex items-start gap-2.5 max-w-[300px]",
|
|
1915
|
-
"rounded-2xl border border-border bg-popover text-popover-foreground",
|
|
1916
|
-
"px-3.5 py-2.5 shadow-2xl transition-all duration-200 ease-out",
|
|
1917
|
-
clickable && "cursor-pointer hover:bg-accent/40 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1918
|
-
originClass2(position),
|
|
1919
|
-
animating ? "opacity-0 scale-95 translate-y-1" : "opacity-100 scale-100 translate-y-0",
|
|
1920
|
-
className
|
|
1921
|
-
),
|
|
1922
|
-
style: {
|
|
1923
|
-
...inline ? {} : anchorStyle2(position, fabOffset, fabClearance),
|
|
1924
|
-
...inline ? {} : { zIndex },
|
|
1925
|
-
pointerEvents: phase === "visible" ? "auto" : "none",
|
|
1926
|
-
...style
|
|
1927
|
-
},
|
|
1928
|
-
children: [
|
|
1929
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-0.5 shrink-0", children: avatar ?? deriveAvatar(message.sender, displayName) }),
|
|
1930
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1 text-sm leading-snug", children: [
|
|
1931
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline justify-between gap-2", children: [
|
|
1932
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate text-[12px] font-semibold text-foreground", children: displayName }),
|
|
1933
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 text-[10px] text-muted-foreground", children: stamp })
|
|
1934
|
-
] }),
|
|
1935
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1936
|
-
"div",
|
|
1937
|
-
{
|
|
1938
|
-
className: "text-foreground/90 mt-0.5 break-words",
|
|
1939
|
-
style: {
|
|
1940
|
-
display: "-webkit-box",
|
|
1941
|
-
WebkitLineClamp: truncate,
|
|
1942
|
-
WebkitBoxOrient: "vertical",
|
|
1943
|
-
overflow: "hidden"
|
|
1944
|
-
},
|
|
1945
|
-
children: message.content
|
|
1946
|
-
}
|
|
1947
|
-
)
|
|
1948
|
-
] }),
|
|
1949
|
-
onDismiss ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1950
|
-
"button",
|
|
1951
|
-
{
|
|
1952
|
-
type: "button",
|
|
1953
|
-
"aria-label": dismissLabel,
|
|
1954
|
-
onClick: (e) => {
|
|
1955
|
-
e.stopPropagation();
|
|
1956
|
-
onDismiss();
|
|
1957
|
-
},
|
|
1958
|
-
className: lib.cn(
|
|
1959
|
-
"-mr-1 -mt-1 flex h-6 w-6 shrink-0 items-center justify-center rounded-full",
|
|
1960
|
-
"text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
1961
|
-
"focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
1962
|
-
),
|
|
1963
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-3.5 w-3.5" })
|
|
1964
|
-
}
|
|
1965
|
-
) : null
|
|
1966
|
-
]
|
|
1967
|
-
}
|
|
1968
|
-
);
|
|
1969
|
-
}
|
|
1970
|
-
chunkOLISEQHS_cjs.__name(ChatUnreadPreview, "ChatUnreadPreview");
|
|
1971
|
-
function readDismissed(storageKey) {
|
|
1972
|
-
if (!storageKey) return false;
|
|
1973
|
-
if (typeof window === "undefined") return false;
|
|
1974
|
-
try {
|
|
1975
|
-
return window.localStorage.getItem(storageKey) === "1";
|
|
1976
|
-
} catch {
|
|
1977
|
-
return false;
|
|
1978
|
-
}
|
|
1979
|
-
}
|
|
1980
|
-
chunkOLISEQHS_cjs.__name(readDismissed, "readDismissed");
|
|
1981
|
-
function writeDismissed(storageKey) {
|
|
1982
|
-
if (!storageKey) return;
|
|
1983
|
-
if (typeof window === "undefined") return;
|
|
1984
|
-
try {
|
|
1985
|
-
window.localStorage.setItem(storageKey, "1");
|
|
1986
|
-
} catch {
|
|
1987
|
-
}
|
|
1988
|
-
}
|
|
1989
|
-
chunkOLISEQHS_cjs.__name(writeDismissed, "writeDismissed");
|
|
1990
|
-
function ChatLauncher({
|
|
1991
|
-
children,
|
|
1992
|
-
fab,
|
|
1993
|
-
dock,
|
|
1994
|
-
greeting,
|
|
1995
|
-
hotkey,
|
|
1996
|
-
defaultOpen = false,
|
|
1997
|
-
open: controlledOpen,
|
|
1998
|
-
onOpenChange,
|
|
1999
|
-
autoFocusComposerOnOpen = true,
|
|
2000
|
-
closeOnEscape = true,
|
|
2001
|
-
unreadMessage,
|
|
2002
|
-
onMarkRead,
|
|
2003
|
-
unreadPreview,
|
|
2004
|
-
audio,
|
|
2005
|
-
hideAudioToggle = false
|
|
2006
|
-
}) {
|
|
2007
|
-
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);
|
|
2008
|
-
const isControlled = controlledOpen !== void 0;
|
|
2009
|
-
const open = isControlled ? controlledOpen : uncontrolledOpen;
|
|
2010
|
-
const dockContentRef = React.useRef(null);
|
|
2011
|
-
React.useEffect(() => {
|
|
2012
|
-
if (!autoFocusComposerOnOpen || !open) return;
|
|
2013
|
-
const t = setTimeout(() => {
|
|
2014
|
-
const root = dockContentRef.current;
|
|
2015
|
-
if (!root) return;
|
|
2016
|
-
const target = root.querySelector(
|
|
2017
|
-
'textarea:not([disabled]):not([readonly]), input[type="text"]:not([disabled]):not([readonly])'
|
|
2018
|
-
);
|
|
2019
|
-
target?.focus();
|
|
2020
|
-
}, 120);
|
|
2021
|
-
return () => clearTimeout(t);
|
|
2022
|
-
}, [open, autoFocusComposerOnOpen]);
|
|
2023
|
-
const setOpen = React.useCallback(
|
|
2024
|
-
(next) => {
|
|
2025
|
-
if (!isControlled) setUncontrolledOpen(next);
|
|
2026
|
-
onOpenChange?.(next);
|
|
2027
|
-
},
|
|
2028
|
-
[isControlled, onOpenChange]
|
|
2029
|
-
);
|
|
2030
|
-
const toggleOpen = React.useCallback(() => setOpen(!open), [open, setOpen]);
|
|
2031
|
-
hooks.useHotkey(
|
|
2032
|
-
"escape",
|
|
2033
|
-
(e) => {
|
|
2034
|
-
const target = e?.target ?? null;
|
|
2035
|
-
const inEditable = !!target && (target.matches?.('input, textarea, [contenteditable="true"]') ?? false);
|
|
2036
|
-
if (inEditable) {
|
|
2037
|
-
target.blur();
|
|
2038
|
-
return;
|
|
2039
|
-
}
|
|
2040
|
-
setOpen(false);
|
|
2041
|
-
},
|
|
2042
|
-
{ enabled: closeOnEscape && open }
|
|
2043
|
-
);
|
|
2044
|
-
const greetingConfig = greeting === void 0 ? null : typeof greeting === "string" ? { content: greeting } : greeting;
|
|
2045
|
-
const [dismissed, setDismissed] = React.useState(
|
|
2046
|
-
() => readDismissed(greetingConfig?.dismissStorageKey)
|
|
2047
|
-
);
|
|
2048
|
-
React.useEffect(() => {
|
|
2049
|
-
if (!hotkey) return;
|
|
2050
|
-
const handler = /* @__PURE__ */ chunkOLISEQHS_cjs.__name((e) => {
|
|
2051
|
-
const metaOk = hotkey.meta ? e.metaKey || e.ctrlKey : !e.metaKey && !e.ctrlKey;
|
|
2052
|
-
const shiftOk = hotkey.shift ? e.shiftKey : !e.shiftKey;
|
|
2053
|
-
const altOk = hotkey.alt ? e.altKey : !e.altKey;
|
|
2054
|
-
if (!metaOk || !shiftOk || !altOk) return;
|
|
2055
|
-
if (e.key !== hotkey.key) return;
|
|
2056
|
-
e.preventDefault();
|
|
2057
|
-
setOpen(!open);
|
|
2058
|
-
}, "handler");
|
|
2059
|
-
window.addEventListener("keydown", handler);
|
|
2060
|
-
return () => window.removeEventListener("keydown", handler);
|
|
2061
|
-
}, [hotkey?.key, hotkey?.meta, hotkey?.shift, hotkey?.alt, open, setOpen, hotkey]);
|
|
2062
|
-
const greetingOpen = !!greetingConfig && !dismissed && (greetingConfig.hideOnOpen === false || !open);
|
|
2063
|
-
const fabPosition = fab?.position ?? "bottom-right";
|
|
2064
|
-
const fabOffset = fab?.offset ?? 24;
|
|
2065
|
-
const handleGreetingDismiss = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
2066
|
-
setDismissed(true);
|
|
2067
|
-
writeDismissed(greetingConfig?.dismissStorageKey);
|
|
2068
|
-
}, "handleGreetingDismiss");
|
|
2069
|
-
const handleGreetingClick = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
2070
|
-
setOpen(true);
|
|
2071
|
-
setDismissed(true);
|
|
2072
|
-
writeDismissed(greetingConfig?.dismissStorageKey);
|
|
2073
|
-
}, "handleGreetingClick");
|
|
2074
|
-
React.useEffect(() => {
|
|
2075
|
-
if (open && unreadMessage) onMarkRead?.();
|
|
2076
|
-
}, [open, unreadMessage, onMarkRead]);
|
|
2077
|
-
const unreadOpen = !open && !!unreadMessage;
|
|
2078
|
-
const handleUnreadClick = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
2079
|
-
setOpen(true);
|
|
2080
|
-
onMarkRead?.();
|
|
2081
|
-
}, "handleUnreadClick");
|
|
2082
|
-
const handleUnreadDismiss = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
2083
|
-
onMarkRead?.();
|
|
2084
|
-
}, "handleUnreadDismiss");
|
|
2085
|
-
const resolvedFab = unreadMessage && fab?.badge === void 0 ? { ...fab, badge: 1 } : fab;
|
|
2086
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2087
|
-
/* @__PURE__ */ jsxRuntime.jsx(ChatFAB, { ...resolvedFab, onClick: toggleOpen }),
|
|
2088
|
-
unreadMessage ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2089
|
-
ChatUnreadPreview,
|
|
2090
|
-
{
|
|
2091
|
-
...unreadPreview,
|
|
2092
|
-
open: unreadOpen,
|
|
2093
|
-
message: unreadMessage,
|
|
2094
|
-
onClick: handleUnreadClick,
|
|
2095
|
-
onDismiss: handleUnreadDismiss,
|
|
2096
|
-
position: fabPosition,
|
|
2097
|
-
fabOffset
|
|
2098
|
-
}
|
|
2099
|
-
) : greetingConfig ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2100
|
-
ChatGreeting,
|
|
2101
|
-
{
|
|
2102
|
-
...greetingConfig,
|
|
2103
|
-
open: greetingOpen,
|
|
2104
|
-
onClick: handleGreetingClick,
|
|
2105
|
-
onDismiss: handleGreetingDismiss,
|
|
2106
|
-
position: fabPosition,
|
|
2107
|
-
fabOffset,
|
|
2108
|
-
children: greetingConfig.content
|
|
2109
|
-
}
|
|
2110
|
-
) : null,
|
|
2111
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2112
|
-
ChatDock,
|
|
2113
|
-
{
|
|
2114
|
-
...dock,
|
|
2115
|
-
open,
|
|
2116
|
-
onClose: () => setOpen(false),
|
|
2117
|
-
headerActions: audio && !audio.isSilent && !hideAudioToggle || dock?.headerActions ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2118
|
-
dock?.headerActions,
|
|
2119
|
-
audio && !audio.isSilent && !hideAudioToggle ? /* @__PURE__ */ jsxRuntime.jsx(ChatHeaderAudioToggle, { muted: audio.muted, onToggle: audio.toggleMute }) : null
|
|
2120
|
-
] }) : void 0,
|
|
2121
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: dockContentRef, className: "flex h-full min-h-0 min-w-0 flex-col", children })
|
|
2122
|
-
}
|
|
2123
|
-
)
|
|
2124
|
-
] });
|
|
2125
|
-
}
|
|
2126
|
-
chunkOLISEQHS_cjs.__name(ChatLauncher, "ChatLauncher");
|
|
2127
|
-
function useChatScroll(options) {
|
|
2128
|
-
const {
|
|
2129
|
-
containerRef,
|
|
2130
|
-
bottomRef,
|
|
2131
|
-
isStreaming = false,
|
|
2132
|
-
bottomThresholdPx = 80,
|
|
2133
|
-
messagesCount = 0
|
|
2134
|
-
} = options;
|
|
2135
|
-
const [isAtBottom, setIsAtBottom] = React.useState(true);
|
|
2136
|
-
const [unreadCount, setUnreadCount] = React.useState(0);
|
|
2137
|
-
const lastCountRef = React.useRef(messagesCount);
|
|
2138
|
-
const stickyRef = React.useRef(true);
|
|
2139
|
-
const wasStreamingRef = React.useRef(isStreaming);
|
|
2140
|
-
const scrollToBottom = React.useCallback(
|
|
2141
|
-
(smooth = false) => {
|
|
2142
|
-
const el = containerRef.current;
|
|
2143
|
-
if (!el) return;
|
|
2144
|
-
el.scrollTo({
|
|
2145
|
-
top: el.scrollHeight,
|
|
2146
|
-
behavior: smooth ? "smooth" : "auto"
|
|
2147
|
-
});
|
|
2148
|
-
stickyRef.current = true;
|
|
2149
|
-
setIsAtBottom(true);
|
|
2150
|
-
setUnreadCount(0);
|
|
2151
|
-
},
|
|
2152
|
-
[containerRef]
|
|
2153
|
-
);
|
|
2154
|
-
const resetUnread = React.useCallback(() => setUnreadCount(0), []);
|
|
2155
|
-
React.useEffect(() => {
|
|
1549
|
+
const resetUnread = react.useCallback(() => setUnreadCount(0), []);
|
|
1550
|
+
react.useEffect(() => {
|
|
2156
1551
|
const el = containerRef.current;
|
|
2157
1552
|
if (!el) return;
|
|
2158
1553
|
const onScroll = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
@@ -2168,7 +1563,7 @@ function useChatScroll(options) {
|
|
|
2168
1563
|
el.removeEventListener("scroll", onScroll);
|
|
2169
1564
|
};
|
|
2170
1565
|
}, [containerRef, bottomThresholdPx]);
|
|
2171
|
-
|
|
1566
|
+
react.useEffect(() => {
|
|
2172
1567
|
const el = containerRef.current;
|
|
2173
1568
|
if (!el) return;
|
|
2174
1569
|
if (isStreaming) {
|
|
@@ -2201,7 +1596,7 @@ function useChatScroll(options) {
|
|
|
2201
1596
|
wasStreamingRef.current = false;
|
|
2202
1597
|
return;
|
|
2203
1598
|
}, [containerRef, isStreaming]);
|
|
2204
|
-
|
|
1599
|
+
react.useEffect(() => {
|
|
2205
1600
|
if (messagesCount > lastCountRef.current) {
|
|
2206
1601
|
if (stickyRef.current) {
|
|
2207
1602
|
const el = containerRef.current;
|
|
@@ -2212,15 +1607,15 @@ function useChatScroll(options) {
|
|
|
2212
1607
|
}
|
|
2213
1608
|
lastCountRef.current = messagesCount;
|
|
2214
1609
|
}, [containerRef, messagesCount]);
|
|
2215
|
-
|
|
1610
|
+
react.useEffect(() => {
|
|
2216
1611
|
}, [bottomRef]);
|
|
2217
1612
|
return { isAtBottom, unreadCount, scrollToBottom, resetUnread };
|
|
2218
1613
|
}
|
|
2219
1614
|
chunkOLISEQHS_cjs.__name(useChatScroll, "useChatScroll");
|
|
2220
1615
|
function useChatHistory(options) {
|
|
2221
1616
|
const { enabled = true, containerRef, topSentinelRef, hasMore, isLoadingMore, loadMore } = options;
|
|
2222
|
-
const heightBeforeRef =
|
|
2223
|
-
|
|
1617
|
+
const heightBeforeRef = react.useRef(null);
|
|
1618
|
+
react.useEffect(() => {
|
|
2224
1619
|
if (heightBeforeRef.current == null) return;
|
|
2225
1620
|
const el = containerRef.current;
|
|
2226
1621
|
if (!el) {
|
|
@@ -2235,7 +1630,7 @@ function useChatHistory(options) {
|
|
|
2235
1630
|
heightBeforeRef.current = null;
|
|
2236
1631
|
}
|
|
2237
1632
|
}, [containerRef, isLoadingMore]);
|
|
2238
|
-
|
|
1633
|
+
react.useEffect(() => {
|
|
2239
1634
|
if (!enabled || !hasMore) return;
|
|
2240
1635
|
const sentinel = topSentinelRef.current;
|
|
2241
1636
|
const root = containerRef.current;
|
|
@@ -2257,13 +1652,13 @@ function useChatHistory(options) {
|
|
|
2257
1652
|
}
|
|
2258
1653
|
chunkOLISEQHS_cjs.__name(useChatHistory, "useChatHistory");
|
|
2259
1654
|
function useChatLightbox() {
|
|
2260
|
-
const [state, setState] =
|
|
2261
|
-
const open =
|
|
1655
|
+
const [state, setState] = react.useState(null);
|
|
1656
|
+
const open = react.useCallback((att, gallery) => {
|
|
2262
1657
|
const list = gallery && gallery.length ? gallery : [att];
|
|
2263
1658
|
const idx = list.findIndex((a) => a.id === att.id);
|
|
2264
1659
|
setState({ gallery: list, index: idx === -1 ? 0 : idx });
|
|
2265
1660
|
}, []);
|
|
2266
|
-
const close =
|
|
1661
|
+
const close = react.useCallback(() => setState(null), []);
|
|
2267
1662
|
return { state, open, close };
|
|
2268
1663
|
}
|
|
2269
1664
|
chunkOLISEQHS_cjs.__name(useChatLightbox, "useChatLightbox");
|
|
@@ -2277,8 +1672,8 @@ function generate() {
|
|
|
2277
1672
|
chunkOLISEQHS_cjs.__name(generate, "generate");
|
|
2278
1673
|
function useVisitorFingerprint(opts = {}) {
|
|
2279
1674
|
const storageKey = opts.storageKey ?? DEFAULT_STORAGE_KEY;
|
|
2280
|
-
const [fp, setFp] =
|
|
2281
|
-
|
|
1675
|
+
const [fp, setFp] = react.useState(null);
|
|
1676
|
+
react.useEffect(() => {
|
|
2282
1677
|
let value = null;
|
|
2283
1678
|
try {
|
|
2284
1679
|
value = window.localStorage.getItem(storageKey);
|
|
@@ -2304,34 +1699,34 @@ function useChatDockPrefs(opts = {}) {
|
|
|
2304
1699
|
const key = opts.storageKey ?? DEFAULT_KEY;
|
|
2305
1700
|
const initial = { ...DEFAULT_DOCK_PREFS, ...opts.defaults };
|
|
2306
1701
|
const [prefs, setStored] = hooks.useLocalStorage(key, initial);
|
|
2307
|
-
const setPrefs =
|
|
1702
|
+
const setPrefs = react.useCallback(
|
|
2308
1703
|
(patch) => {
|
|
2309
1704
|
setStored((prev) => ({ ...prev, ...patch }));
|
|
2310
1705
|
},
|
|
2311
1706
|
[setStored]
|
|
2312
1707
|
);
|
|
2313
|
-
const toggleMode =
|
|
1708
|
+
const toggleMode = react.useCallback(() => {
|
|
2314
1709
|
setStored((prev) => ({ ...prev, mode: prev.mode === "side" ? "popover" : "side" }));
|
|
2315
1710
|
}, [setStored]);
|
|
2316
|
-
const toggleSide =
|
|
1711
|
+
const toggleSide = react.useCallback(() => {
|
|
2317
1712
|
setStored((prev) => ({ ...prev, side: prev.side === "right" ? "left" : "right" }));
|
|
2318
1713
|
}, [setStored]);
|
|
2319
|
-
const reset =
|
|
1714
|
+
const reset = react.useCallback(() => setStored(initial), [setStored, initial]);
|
|
2320
1715
|
return { ...prefs, setPrefs, toggleMode, toggleSide, reset };
|
|
2321
1716
|
}
|
|
2322
1717
|
chunkOLISEQHS_cjs.__name(useChatDockPrefs, "useChatDockPrefs");
|
|
2323
1718
|
function useChatUnread(opts = {}) {
|
|
2324
1719
|
const { open = false, countRoles = ["assistant"] } = opts;
|
|
2325
|
-
const ctx =
|
|
2326
|
-
const [lastSeenId, setLastSeenId] =
|
|
2327
|
-
const initialized =
|
|
2328
|
-
|
|
1720
|
+
const ctx = chunkTBSHZO5R_cjs.useChatContext();
|
|
1721
|
+
const [lastSeenId, setLastSeenId] = react.useState(null);
|
|
1722
|
+
const initialized = react.useRef(false);
|
|
1723
|
+
react.useEffect(() => {
|
|
2329
1724
|
if (initialized.current) return;
|
|
2330
1725
|
initialized.current = true;
|
|
2331
1726
|
const tail = ctx.messages[ctx.messages.length - 1];
|
|
2332
1727
|
setLastSeenId(tail?.id ?? null);
|
|
2333
1728
|
}, [ctx.messages]);
|
|
2334
|
-
|
|
1729
|
+
react.useEffect(() => {
|
|
2335
1730
|
if (!open) return;
|
|
2336
1731
|
const tail = ctx.messages[ctx.messages.length - 1];
|
|
2337
1732
|
setLastSeenId(tail?.id ?? null);
|
|
@@ -2340,7 +1735,7 @@ function useChatUnread(opts = {}) {
|
|
|
2340
1735
|
const after = seenIdx === -1 ? ctx.messages : ctx.messages.slice(seenIdx + 1);
|
|
2341
1736
|
const inbound = after.filter((m) => countRoles.includes(m.role));
|
|
2342
1737
|
const unread = inbound.length > 0 ? inbound[inbound.length - 1] : null;
|
|
2343
|
-
const markRead =
|
|
1738
|
+
const markRead = react.useCallback(() => {
|
|
2344
1739
|
const tail = ctx.messages[ctx.messages.length - 1];
|
|
2345
1740
|
setLastSeenId(tail?.id ?? null);
|
|
2346
1741
|
}, [ctx.messages]);
|
|
@@ -2397,7 +1792,7 @@ function AudioToggle({
|
|
|
2397
1792
|
}) {
|
|
2398
1793
|
const muted = useChatAudioPrefs((s) => s.muted);
|
|
2399
1794
|
const setMuted = useChatAudioPrefs((s) => s.setMuted);
|
|
2400
|
-
const ctx =
|
|
1795
|
+
const ctx = chunkTBSHZO5R_cjs.useChatContextOptional();
|
|
2401
1796
|
if (ctx && !ctx.hasAudio && !alwaysShow) return null;
|
|
2402
1797
|
const Icon = muted ? lucideReact.VolumeX : lucideReact.Volume2;
|
|
2403
1798
|
const label = muted ? "Unmute chat sounds" : "Mute chat sounds";
|
|
@@ -2417,7 +1812,22 @@ function AudioToggle({
|
|
|
2417
1812
|
);
|
|
2418
1813
|
}
|
|
2419
1814
|
chunkOLISEQHS_cjs.__name(AudioToggle, "AudioToggle");
|
|
2420
|
-
var
|
|
1815
|
+
var LazyChat = chunkW75B7Y6C_cjs.createLazyComponent(
|
|
1816
|
+
() => import('./ChatRoot-EFNXQXXN.cjs').then((m) => ({ default: m.ChatRoot })),
|
|
1817
|
+
{
|
|
1818
|
+
displayName: "LazyChat",
|
|
1819
|
+
fallback: /* @__PURE__ */ jsxRuntime.jsx(chunkW75B7Y6C_cjs.LoadingFallback, { minHeight: 320, text: "Loading chat\u2026" })
|
|
1820
|
+
}
|
|
1821
|
+
);
|
|
1822
|
+
chunkW75B7Y6C_cjs.createLazyComponent(
|
|
1823
|
+
() => import('./launcher-PMW2YB24.cjs').then((m) => ({ default: m.ChatLauncher })),
|
|
1824
|
+
{
|
|
1825
|
+
displayName: "LazyChatLauncher",
|
|
1826
|
+
// Launcher renders a floating FAB by default — no inline placeholder.
|
|
1827
|
+
fallback: null
|
|
1828
|
+
}
|
|
1829
|
+
);
|
|
1830
|
+
var LottiePlayerClient = react.lazy(
|
|
2421
1831
|
() => import('./LottiePlayer.client-2S7ISJ2S.cjs').then((mod) => ({ default: mod.LottiePlayer }))
|
|
2422
1832
|
);
|
|
2423
1833
|
var LoadingFallback5 = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center p-8", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
@@ -2425,25 +1835,25 @@ var LoadingFallback5 = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => /* @__PURE
|
|
|
2425
1835
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-gray-500", children: "Loading player..." })
|
|
2426
1836
|
] }) }), "LoadingFallback");
|
|
2427
1837
|
function LottiePlayer(props) {
|
|
2428
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1838
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(LoadingFallback5, {}), children: /* @__PURE__ */ jsxRuntime.jsx(LottiePlayerClient, { ...props }) });
|
|
2429
1839
|
}
|
|
2430
1840
|
chunkOLISEQHS_cjs.__name(LottiePlayer, "LottiePlayer");
|
|
2431
|
-
var DocsLayout =
|
|
2432
|
-
() => import('./DocsLayout-
|
|
1841
|
+
var DocsLayout = react.lazy(
|
|
1842
|
+
() => import('./DocsLayout-OURFYWQE.cjs').then((mod) => ({ default: mod.DocsLayout }))
|
|
2433
1843
|
);
|
|
2434
1844
|
var LoadingFallback6 = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground", children: "Loading API Playground..." }) }), "LoadingFallback");
|
|
2435
1845
|
var Playground = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(({ config }) => {
|
|
2436
|
-
return /* @__PURE__ */ jsxRuntime.jsx(chunk7EYHNP3E_cjs.PlaygroundProvider, { config, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1846
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunk7EYHNP3E_cjs.PlaygroundProvider, { config, children: /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(LoadingFallback6, {}), children: /* @__PURE__ */ jsxRuntime.jsx(DocsLayout, {}) }) });
|
|
2437
1847
|
}, "Playground");
|
|
2438
1848
|
var OpenapiViewer_default = Playground;
|
|
2439
|
-
var CronSchedulerClient =
|
|
1849
|
+
var CronSchedulerClient = react.lazy(() => import('./CronScheduler.client-WEJF4PWQ.cjs'));
|
|
2440
1850
|
function CronScheduler(props) {
|
|
2441
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1851
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(CronSchedulerFallback, {}), children: /* @__PURE__ */ jsxRuntime.jsx(CronSchedulerClient, { ...props }) });
|
|
2442
1852
|
}
|
|
2443
1853
|
chunkOLISEQHS_cjs.__name(CronScheduler, "CronScheduler");
|
|
2444
1854
|
function CronSchedulerFallback() {
|
|
2445
1855
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2446
|
-
LoadingFallback,
|
|
1856
|
+
chunkW75B7Y6C_cjs.LoadingFallback,
|
|
2447
1857
|
{
|
|
2448
1858
|
minHeight: 120,
|
|
2449
1859
|
showText: false,
|
|
@@ -2468,10 +1878,10 @@ chunkOLISEQHS_cjs.__name(setupMonacoWorkers, "setupMonacoWorkers");
|
|
|
2468
1878
|
|
|
2469
1879
|
// src/tools/CodeEditor/hooks/useMonaco.ts
|
|
2470
1880
|
function useMonaco() {
|
|
2471
|
-
const [monaco, setMonaco] =
|
|
2472
|
-
const [isLoading, setIsLoading] =
|
|
2473
|
-
const [error, setError] =
|
|
2474
|
-
|
|
1881
|
+
const [monaco, setMonaco] = react.useState(null);
|
|
1882
|
+
const [isLoading, setIsLoading] = react.useState(true);
|
|
1883
|
+
const [error, setError] = react.useState(null);
|
|
1884
|
+
react.useEffect(() => {
|
|
2475
1885
|
let mounted = true;
|
|
2476
1886
|
async function loadMonaco() {
|
|
2477
1887
|
try {
|
|
@@ -2499,8 +1909,8 @@ function useMonaco() {
|
|
|
2499
1909
|
chunkOLISEQHS_cjs.__name(useMonaco, "useMonaco");
|
|
2500
1910
|
function useEditorTheme(monaco, themeOverride) {
|
|
2501
1911
|
const appTheme = hooks.useResolvedTheme();
|
|
2502
|
-
const registered =
|
|
2503
|
-
|
|
1912
|
+
const registered = react.useRef(false);
|
|
1913
|
+
react.useEffect(() => {
|
|
2504
1914
|
if (!monaco || registered.current) return;
|
|
2505
1915
|
try {
|
|
2506
1916
|
const colors = _readCSSColors();
|
|
@@ -2615,7 +2025,7 @@ function _adjustBrightness(hex, amount) {
|
|
|
2615
2025
|
return `#${(r << 16 | g << 8 | b).toString(16).padStart(6, "0")}`;
|
|
2616
2026
|
}
|
|
2617
2027
|
chunkOLISEQHS_cjs.__name(_adjustBrightness, "_adjustBrightness");
|
|
2618
|
-
var Editor =
|
|
2028
|
+
var Editor = react.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(function Editor2({
|
|
2619
2029
|
value = "",
|
|
2620
2030
|
language = "plaintext",
|
|
2621
2031
|
onChange,
|
|
@@ -2628,24 +2038,24 @@ var Editor = React.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(function
|
|
|
2628
2038
|
minHeight = 100,
|
|
2629
2039
|
maxHeight = 600
|
|
2630
2040
|
}, ref) {
|
|
2631
|
-
const containerRef =
|
|
2632
|
-
const editorRef =
|
|
2041
|
+
const containerRef = react.useRef(null);
|
|
2042
|
+
const editorRef = react.useRef(null);
|
|
2633
2043
|
const { monaco, isLoading } = useMonaco();
|
|
2634
2044
|
const resolvedTheme = useEditorTheme(monaco, options.theme);
|
|
2635
|
-
const [contentHeight, setContentHeight] =
|
|
2636
|
-
const updateContentHeight =
|
|
2045
|
+
const [contentHeight, setContentHeight] = react.useState(null);
|
|
2046
|
+
const updateContentHeight = react.useCallback((editor) => {
|
|
2637
2047
|
if (!autoHeight) return;
|
|
2638
2048
|
const h = editor.getContentHeight();
|
|
2639
2049
|
setContentHeight(Math.min(Math.max(h, minHeight), maxHeight));
|
|
2640
2050
|
}, [autoHeight, minHeight, maxHeight]);
|
|
2641
|
-
const isInternalChangeRef =
|
|
2642
|
-
|
|
2051
|
+
const isInternalChangeRef = react.useRef(false);
|
|
2052
|
+
react.useImperativeHandle(ref, () => ({
|
|
2643
2053
|
getEditor: /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => editorRef.current, "getEditor"),
|
|
2644
2054
|
getValue: /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => editorRef.current?.getValue() || "", "getValue"),
|
|
2645
2055
|
setValue: /* @__PURE__ */ chunkOLISEQHS_cjs.__name((val) => editorRef.current?.setValue(val), "setValue"),
|
|
2646
2056
|
focus: /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => editorRef.current?.focus(), "focus")
|
|
2647
2057
|
}));
|
|
2648
|
-
|
|
2058
|
+
react.useEffect(() => {
|
|
2649
2059
|
if (!monaco || !containerRef.current || editorRef.current) return;
|
|
2650
2060
|
const editor = monaco.editor.create(containerRef.current, {
|
|
2651
2061
|
value,
|
|
@@ -2691,7 +2101,7 @@ var Editor = React.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(function
|
|
|
2691
2101
|
editorRef.current = null;
|
|
2692
2102
|
};
|
|
2693
2103
|
}, [monaco]);
|
|
2694
|
-
|
|
2104
|
+
react.useEffect(() => {
|
|
2695
2105
|
const editor = editorRef.current;
|
|
2696
2106
|
if (!editor) return;
|
|
2697
2107
|
if (isInternalChangeRef.current) {
|
|
@@ -2711,7 +2121,7 @@ var Editor = React.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(function
|
|
|
2711
2121
|
}
|
|
2712
2122
|
}
|
|
2713
2123
|
}, [value]);
|
|
2714
|
-
|
|
2124
|
+
react.useEffect(() => {
|
|
2715
2125
|
const editor = editorRef.current;
|
|
2716
2126
|
if (!editor || !monaco) return;
|
|
2717
2127
|
const model = editor.getModel();
|
|
@@ -2719,7 +2129,7 @@ var Editor = React.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(function
|
|
|
2719
2129
|
monaco.editor.setModelLanguage(model, language);
|
|
2720
2130
|
}
|
|
2721
2131
|
}, [language, monaco]);
|
|
2722
|
-
|
|
2132
|
+
react.useEffect(() => {
|
|
2723
2133
|
const editor = editorRef.current;
|
|
2724
2134
|
if (!editor) return;
|
|
2725
2135
|
editor.updateOptions({
|
|
@@ -2771,11 +2181,11 @@ function DiffEditor({
|
|
|
2771
2181
|
className = "",
|
|
2772
2182
|
height = "100%"
|
|
2773
2183
|
}) {
|
|
2774
|
-
const containerRef =
|
|
2775
|
-
const editorRef =
|
|
2184
|
+
const containerRef = react.useRef(null);
|
|
2185
|
+
const editorRef = react.useRef(null);
|
|
2776
2186
|
const { monaco, isLoading } = useMonaco();
|
|
2777
2187
|
const resolvedTheme = useEditorTheme(monaco, options.theme);
|
|
2778
|
-
|
|
2188
|
+
react.useEffect(() => {
|
|
2779
2189
|
if (!monaco || !containerRef.current || editorRef.current) return;
|
|
2780
2190
|
const editor = monaco.editor.createDiffEditor(containerRef.current, {
|
|
2781
2191
|
theme: resolvedTheme,
|
|
@@ -2801,7 +2211,7 @@ function DiffEditor({
|
|
|
2801
2211
|
editorRef.current = null;
|
|
2802
2212
|
};
|
|
2803
2213
|
}, [monaco]);
|
|
2804
|
-
|
|
2214
|
+
react.useEffect(() => {
|
|
2805
2215
|
const editor = editorRef.current;
|
|
2806
2216
|
if (!editor || !monaco) return;
|
|
2807
2217
|
const model = editor.getModel();
|
|
@@ -2810,7 +2220,7 @@ function DiffEditor({
|
|
|
2810
2220
|
model.modified.setValue(modified);
|
|
2811
2221
|
}
|
|
2812
2222
|
}, [original, modified, monaco]);
|
|
2813
|
-
|
|
2223
|
+
react.useEffect(() => {
|
|
2814
2224
|
const editor = editorRef.current;
|
|
2815
2225
|
if (!editor || !monaco) return;
|
|
2816
2226
|
const model = editor.getModel();
|
|
@@ -3037,9 +2447,9 @@ function getLanguageByFilename(filename) {
|
|
|
3037
2447
|
return LANGUAGE_MAP[extension] || "plaintext";
|
|
3038
2448
|
}
|
|
3039
2449
|
chunkOLISEQHS_cjs.__name(getLanguageByFilename, "getLanguageByFilename");
|
|
3040
|
-
var EditorContext =
|
|
2450
|
+
var EditorContext = react.createContext(null);
|
|
3041
2451
|
function useEditorContext() {
|
|
3042
|
-
const context =
|
|
2452
|
+
const context = react.useContext(EditorContext);
|
|
3043
2453
|
if (!context) {
|
|
3044
2454
|
throw new Error("useEditorContext must be used within EditorProvider");
|
|
3045
2455
|
}
|
|
@@ -3048,14 +2458,14 @@ function useEditorContext() {
|
|
|
3048
2458
|
chunkOLISEQHS_cjs.__name(useEditorContext, "useEditorContext");
|
|
3049
2459
|
function EditorProvider({ children, onSave }) {
|
|
3050
2460
|
const { monaco } = useMonaco();
|
|
3051
|
-
const [editor, setEditor] =
|
|
3052
|
-
const [openFiles, setOpenFiles] =
|
|
3053
|
-
const [activeFilePath, setActiveFilePath] =
|
|
3054
|
-
const activeFile =
|
|
2461
|
+
const [editor, setEditor] = react.useState(null);
|
|
2462
|
+
const [openFiles, setOpenFiles] = react.useState([]);
|
|
2463
|
+
const [activeFilePath, setActiveFilePath] = react.useState(null);
|
|
2464
|
+
const activeFile = react.useMemo(
|
|
3055
2465
|
() => openFiles.find((f) => f.path === activeFilePath) || null,
|
|
3056
2466
|
[openFiles, activeFilePath]
|
|
3057
2467
|
);
|
|
3058
|
-
const openFile =
|
|
2468
|
+
const openFile = react.useCallback(
|
|
3059
2469
|
(path, content, language) => {
|
|
3060
2470
|
setOpenFiles((files) => {
|
|
3061
2471
|
const existing = files.find((f) => f.path === path);
|
|
@@ -3076,7 +2486,7 @@ function EditorProvider({ children, onSave }) {
|
|
|
3076
2486
|
},
|
|
3077
2487
|
[]
|
|
3078
2488
|
);
|
|
3079
|
-
const closeFile =
|
|
2489
|
+
const closeFile = react.useCallback(
|
|
3080
2490
|
(path) => {
|
|
3081
2491
|
setOpenFiles((files) => {
|
|
3082
2492
|
const index = files.findIndex((f) => f.path === path);
|
|
@@ -3093,17 +2503,17 @@ function EditorProvider({ children, onSave }) {
|
|
|
3093
2503
|
},
|
|
3094
2504
|
[activeFilePath]
|
|
3095
2505
|
);
|
|
3096
|
-
const setActiveFile =
|
|
2506
|
+
const setActiveFile = react.useCallback((path) => {
|
|
3097
2507
|
setActiveFilePath(path);
|
|
3098
2508
|
}, []);
|
|
3099
|
-
const updateContent =
|
|
2509
|
+
const updateContent = react.useCallback((path, content) => {
|
|
3100
2510
|
setOpenFiles(
|
|
3101
2511
|
(files) => files.map(
|
|
3102
2512
|
(f) => f.path === path ? { ...f, content, isDirty: true } : f
|
|
3103
2513
|
)
|
|
3104
2514
|
);
|
|
3105
2515
|
}, []);
|
|
3106
|
-
const saveFile =
|
|
2516
|
+
const saveFile = react.useCallback(
|
|
3107
2517
|
async (path) => {
|
|
3108
2518
|
const file = openFiles.find((f) => f.path === path);
|
|
3109
2519
|
if (!file) return;
|
|
@@ -3118,21 +2528,21 @@ function EditorProvider({ children, onSave }) {
|
|
|
3118
2528
|
},
|
|
3119
2529
|
[openFiles, onSave]
|
|
3120
2530
|
);
|
|
3121
|
-
const isDirty =
|
|
2531
|
+
const isDirty = react.useCallback(
|
|
3122
2532
|
(path) => {
|
|
3123
2533
|
const file = openFiles.find((f) => f.path === path);
|
|
3124
2534
|
return file?.isDirty || false;
|
|
3125
2535
|
},
|
|
3126
2536
|
[openFiles]
|
|
3127
2537
|
);
|
|
3128
|
-
const getContent =
|
|
2538
|
+
const getContent = react.useCallback(
|
|
3129
2539
|
(path) => {
|
|
3130
2540
|
const file = openFiles.find((f) => f.path === path);
|
|
3131
2541
|
return file?.content || null;
|
|
3132
2542
|
},
|
|
3133
2543
|
[openFiles]
|
|
3134
2544
|
);
|
|
3135
|
-
const getFile =
|
|
2545
|
+
const getFile = react.useCallback(
|
|
3136
2546
|
(path) => {
|
|
3137
2547
|
return openFiles.find((f) => f.path === path) || null;
|
|
3138
2548
|
},
|
|
@@ -3157,8 +2567,8 @@ function EditorProvider({ children, onSave }) {
|
|
|
3157
2567
|
}
|
|
3158
2568
|
chunkOLISEQHS_cjs.__name(EditorProvider, "EditorProvider");
|
|
3159
2569
|
function useEditor() {
|
|
3160
|
-
const [editor, setEditorState] =
|
|
3161
|
-
const setEditor =
|
|
2570
|
+
const [editor, setEditorState] = react.useState(null);
|
|
2571
|
+
const setEditor = react.useCallback((editorInstance) => {
|
|
3162
2572
|
setEditorState(editorInstance);
|
|
3163
2573
|
}, []);
|
|
3164
2574
|
return {
|
|
@@ -3169,25 +2579,25 @@ function useEditor() {
|
|
|
3169
2579
|
}
|
|
3170
2580
|
chunkOLISEQHS_cjs.__name(useEditor, "useEditor");
|
|
3171
2581
|
function useLanguage(filename) {
|
|
3172
|
-
return
|
|
2582
|
+
return react.useMemo(() => {
|
|
3173
2583
|
if (!filename) return "plaintext";
|
|
3174
2584
|
const basename = filename.split("/").pop() || filename;
|
|
3175
2585
|
return getLanguageByFilename(basename);
|
|
3176
2586
|
}, [filename]);
|
|
3177
2587
|
}
|
|
3178
2588
|
chunkOLISEQHS_cjs.__name(useLanguage, "useLanguage");
|
|
3179
|
-
var MentionList =
|
|
2589
|
+
var MentionList = react.forwardRef(
|
|
3180
2590
|
({ items, command }, ref) => {
|
|
3181
|
-
const [selectedIndex, setSelectedIndex] =
|
|
3182
|
-
|
|
3183
|
-
const select =
|
|
2591
|
+
const [selectedIndex, setSelectedIndex] = react.useState(0);
|
|
2592
|
+
react.useEffect(() => setSelectedIndex(0), [items]);
|
|
2593
|
+
const select = react.useCallback(
|
|
3184
2594
|
(index) => {
|
|
3185
2595
|
const item = items[index];
|
|
3186
2596
|
if (item) command(item);
|
|
3187
2597
|
},
|
|
3188
2598
|
[items, command]
|
|
3189
2599
|
);
|
|
3190
|
-
|
|
2600
|
+
react.useImperativeHandle(ref, () => ({
|
|
3191
2601
|
onKeyDown: /* @__PURE__ */ chunkOLISEQHS_cjs.__name((event) => {
|
|
3192
2602
|
if (event.key === "ArrowUp") {
|
|
3193
2603
|
setSelectedIndex((i) => (i + items.length - 1) % items.length);
|
|
@@ -3266,7 +2676,7 @@ function createMentionSuggestion(config) {
|
|
|
3266
2676
|
}, "teardown");
|
|
3267
2677
|
return {
|
|
3268
2678
|
onStart: /* @__PURE__ */ chunkOLISEQHS_cjs.__name((props) => {
|
|
3269
|
-
component = new react.ReactRenderer(MentionList, {
|
|
2679
|
+
component = new react$1.ReactRenderer(MentionList, {
|
|
3270
2680
|
props: {
|
|
3271
2681
|
items: props.items,
|
|
3272
2682
|
command: /* @__PURE__ */ chunkOLISEQHS_cjs.__name((item) => {
|
|
@@ -3368,7 +2778,7 @@ function extractMentionIds(editor) {
|
|
|
3368
2778
|
return [...new Set(ids)];
|
|
3369
2779
|
}
|
|
3370
2780
|
chunkOLISEQHS_cjs.__name(extractMentionIds, "extractMentionIds");
|
|
3371
|
-
var MarkdownEditor =
|
|
2781
|
+
var MarkdownEditor = react.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(function MarkdownEditor2({
|
|
3372
2782
|
value,
|
|
3373
2783
|
onChange,
|
|
3374
2784
|
placeholder = "Write markdown...",
|
|
@@ -3380,18 +2790,18 @@ var MarkdownEditor = React.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(f
|
|
|
3380
2790
|
onMentionIdsChange,
|
|
3381
2791
|
onSubmit
|
|
3382
2792
|
}, ref) {
|
|
3383
|
-
const onSubmitRef =
|
|
2793
|
+
const onSubmitRef = react.useRef(onSubmit);
|
|
3384
2794
|
onSubmitRef.current = onSubmit;
|
|
3385
|
-
const isExternalUpdate =
|
|
3386
|
-
const initialMentionsDefinedRef =
|
|
3387
|
-
const warnedRef =
|
|
2795
|
+
const isExternalUpdate = react.useRef(false);
|
|
2796
|
+
const initialMentionsDefinedRef = react.useRef(mentions !== void 0);
|
|
2797
|
+
const warnedRef = react.useRef(false);
|
|
3388
2798
|
if (process.env.NODE_ENV !== "production" && !initialMentionsDefinedRef.current && mentions !== void 0 && !warnedRef.current) {
|
|
3389
2799
|
warnedRef.current = true;
|
|
3390
2800
|
console.warn(
|
|
3391
2801
|
"[MarkdownEditor] `mentions` flipped from undefined to a config after mount. Tiptap only installs the Mention extension on first render \u2014 the @-popover will NOT work for this editor instance. Pass `{ items: [] }` from the very first render and mutate `.items` in place instead."
|
|
3392
2802
|
);
|
|
3393
2803
|
}
|
|
3394
|
-
const extensions =
|
|
2804
|
+
const extensions = react.useMemo(() => {
|
|
3395
2805
|
const exts = [
|
|
3396
2806
|
StarterKit__default.default.configure({ heading: { levels: [1, 2, 3] } }),
|
|
3397
2807
|
Placeholder__default.default.configure({ placeholder }),
|
|
@@ -3431,7 +2841,7 @@ var MarkdownEditor = React.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(f
|
|
|
3431
2841
|
}
|
|
3432
2842
|
return exts;
|
|
3433
2843
|
}, [placeholder, mentions]);
|
|
3434
|
-
const editor = react.useEditor({
|
|
2844
|
+
const editor = react$1.useEditor({
|
|
3435
2845
|
immediatelyRender: false,
|
|
3436
2846
|
editable: !disabled,
|
|
3437
2847
|
extensions,
|
|
@@ -3450,7 +2860,7 @@ var MarkdownEditor = React.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(f
|
|
|
3450
2860
|
}
|
|
3451
2861
|
}
|
|
3452
2862
|
});
|
|
3453
|
-
|
|
2863
|
+
react.useEffect(() => {
|
|
3454
2864
|
if (!editor) return;
|
|
3455
2865
|
const current = getMarkdown(editor);
|
|
3456
2866
|
if (current !== value) {
|
|
@@ -3459,7 +2869,7 @@ var MarkdownEditor = React.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(f
|
|
|
3459
2869
|
isExternalUpdate.current = false;
|
|
3460
2870
|
}
|
|
3461
2871
|
}, [value, editor]);
|
|
3462
|
-
|
|
2872
|
+
react.useImperativeHandle(
|
|
3463
2873
|
ref,
|
|
3464
2874
|
() => ({
|
|
3465
2875
|
focus: /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
@@ -3475,11 +2885,11 @@ var MarkdownEditor = React.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(f
|
|
|
3475
2885
|
const wrapperClass = `markdown-editor rounded-md border border-input bg-background ${disabled ? "opacity-60" : ""} ${className}`.trim();
|
|
3476
2886
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: wrapperClass, children: [
|
|
3477
2887
|
showToolbar && editor && /* @__PURE__ */ jsxRuntime.jsx(MarkdownToolbar, { editor }),
|
|
3478
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(react.EditorContent, { editor }) })
|
|
2888
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(react$1.EditorContent, { editor }) })
|
|
3479
2889
|
] });
|
|
3480
2890
|
}, "MarkdownEditor"));
|
|
3481
2891
|
function MarkdownToolbar({ editor }) {
|
|
3482
|
-
const items =
|
|
2892
|
+
const items = react.useMemo(() => [
|
|
3483
2893
|
{ icon: lucideReact.Bold, title: "Bold", action: /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => editor.chain().focus().toggleBold().run(), "action"), active: editor.isActive("bold") },
|
|
3484
2894
|
{ icon: lucideReact.Italic, title: "Italic", action: /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => editor.chain().focus().toggleItalic().run(), "action"), active: editor.isActive("italic") },
|
|
3485
2895
|
{ icon: lucideReact.Strikethrough, title: "Strike", action: /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => editor.chain().focus().toggleStrike().run(), "action"), active: editor.isActive("strike") },
|
|
@@ -3503,6 +2913,262 @@ function MarkdownToolbar({ editor }) {
|
|
|
3503
2913
|
}
|
|
3504
2914
|
chunkOLISEQHS_cjs.__name(MarkdownToolbar, "MarkdownToolbar");
|
|
3505
2915
|
|
|
2916
|
+
Object.defineProperty(exports, "CardLoadingFallback", {
|
|
2917
|
+
enumerable: true,
|
|
2918
|
+
get: function () { return chunkW75B7Y6C_cjs.CardLoadingFallback; }
|
|
2919
|
+
});
|
|
2920
|
+
Object.defineProperty(exports, "ChatDock", {
|
|
2921
|
+
enumerable: true,
|
|
2922
|
+
get: function () { return chunkW75B7Y6C_cjs.ChatDock; }
|
|
2923
|
+
});
|
|
2924
|
+
Object.defineProperty(exports, "ChatFAB", {
|
|
2925
|
+
enumerable: true,
|
|
2926
|
+
get: function () { return chunkW75B7Y6C_cjs.ChatFAB; }
|
|
2927
|
+
});
|
|
2928
|
+
Object.defineProperty(exports, "ChatGreeting", {
|
|
2929
|
+
enumerable: true,
|
|
2930
|
+
get: function () { return chunkW75B7Y6C_cjs.ChatGreeting; }
|
|
2931
|
+
});
|
|
2932
|
+
Object.defineProperty(exports, "ChatHeader", {
|
|
2933
|
+
enumerable: true,
|
|
2934
|
+
get: function () { return chunkW75B7Y6C_cjs.ChatHeader; }
|
|
2935
|
+
});
|
|
2936
|
+
Object.defineProperty(exports, "ChatHeaderActionButton", {
|
|
2937
|
+
enumerable: true,
|
|
2938
|
+
get: function () { return chunkW75B7Y6C_cjs.ChatHeaderActionButton; }
|
|
2939
|
+
});
|
|
2940
|
+
Object.defineProperty(exports, "ChatHeaderAudioToggle", {
|
|
2941
|
+
enumerable: true,
|
|
2942
|
+
get: function () { return chunkW75B7Y6C_cjs.ChatHeaderAudioToggle; }
|
|
2943
|
+
});
|
|
2944
|
+
Object.defineProperty(exports, "ChatHeaderLanguageButton", {
|
|
2945
|
+
enumerable: true,
|
|
2946
|
+
get: function () { return chunkW75B7Y6C_cjs.ChatHeaderLanguageButton; }
|
|
2947
|
+
});
|
|
2948
|
+
Object.defineProperty(exports, "ChatHeaderModeToggle", {
|
|
2949
|
+
enumerable: true,
|
|
2950
|
+
get: function () { return chunkW75B7Y6C_cjs.ChatHeaderModeToggle; }
|
|
2951
|
+
});
|
|
2952
|
+
Object.defineProperty(exports, "ChatHeaderResetButton", {
|
|
2953
|
+
enumerable: true,
|
|
2954
|
+
get: function () { return chunkW75B7Y6C_cjs.ChatHeaderResetButton; }
|
|
2955
|
+
});
|
|
2956
|
+
Object.defineProperty(exports, "ChatLauncher", {
|
|
2957
|
+
enumerable: true,
|
|
2958
|
+
get: function () { return chunkW75B7Y6C_cjs.ChatLauncher; }
|
|
2959
|
+
});
|
|
2960
|
+
Object.defineProperty(exports, "ChatUnreadPreview", {
|
|
2961
|
+
enumerable: true,
|
|
2962
|
+
get: function () { return chunkW75B7Y6C_cjs.ChatUnreadPreview; }
|
|
2963
|
+
});
|
|
2964
|
+
Object.defineProperty(exports, "LazyWrapper", {
|
|
2965
|
+
enumerable: true,
|
|
2966
|
+
get: function () { return chunkW75B7Y6C_cjs.LazyWrapper; }
|
|
2967
|
+
});
|
|
2968
|
+
Object.defineProperty(exports, "LoadingFallback", {
|
|
2969
|
+
enumerable: true,
|
|
2970
|
+
get: function () { return chunkW75B7Y6C_cjs.LoadingFallback; }
|
|
2971
|
+
});
|
|
2972
|
+
Object.defineProperty(exports, "MapLoadingFallback", {
|
|
2973
|
+
enumerable: true,
|
|
2974
|
+
get: function () { return chunkW75B7Y6C_cjs.MapLoadingFallback; }
|
|
2975
|
+
});
|
|
2976
|
+
Object.defineProperty(exports, "Spinner", {
|
|
2977
|
+
enumerable: true,
|
|
2978
|
+
get: function () { return chunkW75B7Y6C_cjs.Spinner; }
|
|
2979
|
+
});
|
|
2980
|
+
Object.defineProperty(exports, "createLazyComponent", {
|
|
2981
|
+
enumerable: true,
|
|
2982
|
+
get: function () { return chunkW75B7Y6C_cjs.createLazyComponent; }
|
|
2983
|
+
});
|
|
2984
|
+
Object.defineProperty(exports, "useChatPresence", {
|
|
2985
|
+
enumerable: true,
|
|
2986
|
+
get: function () { return chunkW75B7Y6C_cjs.useChatPresence; }
|
|
2987
|
+
});
|
|
2988
|
+
Object.defineProperty(exports, "useChatReset", {
|
|
2989
|
+
enumerable: true,
|
|
2990
|
+
get: function () { return chunkW75B7Y6C_cjs.useChatReset; }
|
|
2991
|
+
});
|
|
2992
|
+
Object.defineProperty(exports, "Attachments", {
|
|
2993
|
+
enumerable: true,
|
|
2994
|
+
get: function () { return chunk4LFB7I5K_cjs.Attachments; }
|
|
2995
|
+
});
|
|
2996
|
+
Object.defineProperty(exports, "AttachmentsGrid", {
|
|
2997
|
+
enumerable: true,
|
|
2998
|
+
get: function () { return chunk4LFB7I5K_cjs.AttachmentsGrid; }
|
|
2999
|
+
});
|
|
3000
|
+
Object.defineProperty(exports, "AttachmentsList", {
|
|
3001
|
+
enumerable: true,
|
|
3002
|
+
get: function () { return chunk4LFB7I5K_cjs.AttachmentsList; }
|
|
3003
|
+
});
|
|
3004
|
+
Object.defineProperty(exports, "ChatRoot", {
|
|
3005
|
+
enumerable: true,
|
|
3006
|
+
get: function () { return chunk4LFB7I5K_cjs.ChatRoot; }
|
|
3007
|
+
});
|
|
3008
|
+
Object.defineProperty(exports, "Composer", {
|
|
3009
|
+
enumerable: true,
|
|
3010
|
+
get: function () { return chunk4LFB7I5K_cjs.Composer; }
|
|
3011
|
+
});
|
|
3012
|
+
Object.defineProperty(exports, "EmptyState", {
|
|
3013
|
+
enumerable: true,
|
|
3014
|
+
get: function () { return chunk4LFB7I5K_cjs.EmptyState; }
|
|
3015
|
+
});
|
|
3016
|
+
Object.defineProperty(exports, "ErrorBanner", {
|
|
3017
|
+
enumerable: true,
|
|
3018
|
+
get: function () { return chunk4LFB7I5K_cjs.ErrorBanner; }
|
|
3019
|
+
});
|
|
3020
|
+
Object.defineProperty(exports, "JumpToLatest", {
|
|
3021
|
+
enumerable: true,
|
|
3022
|
+
get: function () { return chunk4LFB7I5K_cjs.JumpToLatest; }
|
|
3023
|
+
});
|
|
3024
|
+
Object.defineProperty(exports, "MessageActions", {
|
|
3025
|
+
enumerable: true,
|
|
3026
|
+
get: function () { return chunk4LFB7I5K_cjs.MessageActions; }
|
|
3027
|
+
});
|
|
3028
|
+
Object.defineProperty(exports, "MessageBubble", {
|
|
3029
|
+
enumerable: true,
|
|
3030
|
+
get: function () { return chunk4LFB7I5K_cjs.MessageBubble; }
|
|
3031
|
+
});
|
|
3032
|
+
Object.defineProperty(exports, "MessageList", {
|
|
3033
|
+
enumerable: true,
|
|
3034
|
+
get: function () { return chunk4LFB7I5K_cjs.MessageList; }
|
|
3035
|
+
});
|
|
3036
|
+
Object.defineProperty(exports, "Sources", {
|
|
3037
|
+
enumerable: true,
|
|
3038
|
+
get: function () { return chunk4LFB7I5K_cjs.Sources; }
|
|
3039
|
+
});
|
|
3040
|
+
Object.defineProperty(exports, "StreamingIndicator", {
|
|
3041
|
+
enumerable: true,
|
|
3042
|
+
get: function () { return chunk4LFB7I5K_cjs.StreamingIndicator; }
|
|
3043
|
+
});
|
|
3044
|
+
Object.defineProperty(exports, "ToolCalls", {
|
|
3045
|
+
enumerable: true,
|
|
3046
|
+
get: function () { return chunk4LFB7I5K_cjs.ToolCalls; }
|
|
3047
|
+
});
|
|
3048
|
+
Object.defineProperty(exports, "deriveInitials", {
|
|
3049
|
+
enumerable: true,
|
|
3050
|
+
get: function () { return chunk4LFB7I5K_cjs.deriveInitials; }
|
|
3051
|
+
});
|
|
3052
|
+
Object.defineProperty(exports, "isSubmittableDraft", {
|
|
3053
|
+
enumerable: true,
|
|
3054
|
+
get: function () { return chunk4LFB7I5K_cjs.isSubmittableDraft; }
|
|
3055
|
+
});
|
|
3056
|
+
Object.defineProperty(exports, "resolvePersona", {
|
|
3057
|
+
enumerable: true,
|
|
3058
|
+
get: function () { return chunk4LFB7I5K_cjs.resolvePersona; }
|
|
3059
|
+
});
|
|
3060
|
+
Object.defineProperty(exports, "sanitizeDraft", {
|
|
3061
|
+
enumerable: true,
|
|
3062
|
+
get: function () { return chunk4LFB7I5K_cjs.sanitizeDraft; }
|
|
3063
|
+
});
|
|
3064
|
+
Object.defineProperty(exports, "useAutoFocusOnStreamEnd", {
|
|
3065
|
+
enumerable: true,
|
|
3066
|
+
get: function () { return chunk4LFB7I5K_cjs.useAutoFocusOnStreamEnd; }
|
|
3067
|
+
});
|
|
3068
|
+
Object.defineProperty(exports, "useChatBubbleStyles", {
|
|
3069
|
+
enumerable: true,
|
|
3070
|
+
get: function () { return chunk4LFB7I5K_cjs.useChatBubbleStyles; }
|
|
3071
|
+
});
|
|
3072
|
+
Object.defineProperty(exports, "useChatComposer", {
|
|
3073
|
+
enumerable: true,
|
|
3074
|
+
get: function () { return chunk4LFB7I5K_cjs.useChatComposer; }
|
|
3075
|
+
});
|
|
3076
|
+
Object.defineProperty(exports, "useChatDestructiveStyles", {
|
|
3077
|
+
enumerable: true,
|
|
3078
|
+
get: function () { return chunk4LFB7I5K_cjs.useChatDestructiveStyles; }
|
|
3079
|
+
});
|
|
3080
|
+
Object.defineProperty(exports, "useChatRoleStyles", {
|
|
3081
|
+
enumerable: true,
|
|
3082
|
+
get: function () { return chunk4LFB7I5K_cjs.useChatRoleStyles; }
|
|
3083
|
+
});
|
|
3084
|
+
Object.defineProperty(exports, "useFocusOnEmptyClick", {
|
|
3085
|
+
enumerable: true,
|
|
3086
|
+
get: function () { return chunk4LFB7I5K_cjs.useFocusOnEmptyClick; }
|
|
3087
|
+
});
|
|
3088
|
+
Object.defineProperty(exports, "useRegisterComposer", {
|
|
3089
|
+
enumerable: true,
|
|
3090
|
+
get: function () { return chunk4LFB7I5K_cjs.useRegisterComposer; }
|
|
3091
|
+
});
|
|
3092
|
+
Object.defineProperty(exports, "CHAT_EVENT_NAME", {
|
|
3093
|
+
enumerable: true,
|
|
3094
|
+
get: function () { return chunkTBSHZO5R_cjs.CHAT_EVENT_NAME; }
|
|
3095
|
+
});
|
|
3096
|
+
Object.defineProperty(exports, "CSS_VARS", {
|
|
3097
|
+
enumerable: true,
|
|
3098
|
+
get: function () { return chunkTBSHZO5R_cjs.CSS_VARS; }
|
|
3099
|
+
});
|
|
3100
|
+
Object.defineProperty(exports, "ChatProvider", {
|
|
3101
|
+
enumerable: true,
|
|
3102
|
+
get: function () { return chunkTBSHZO5R_cjs.ChatProvider; }
|
|
3103
|
+
});
|
|
3104
|
+
Object.defineProperty(exports, "DEFAULT_CHAT_SOUNDS", {
|
|
3105
|
+
enumerable: true,
|
|
3106
|
+
get: function () { return chunkTBSHZO5R_cjs.DEFAULT_CHAT_SOUNDS; }
|
|
3107
|
+
});
|
|
3108
|
+
Object.defineProperty(exports, "DEFAULT_LABELS", {
|
|
3109
|
+
enumerable: true,
|
|
3110
|
+
get: function () { return chunkTBSHZO5R_cjs.DEFAULT_LABELS; }
|
|
3111
|
+
});
|
|
3112
|
+
Object.defineProperty(exports, "DEFAULT_SIDEBAR", {
|
|
3113
|
+
enumerable: true,
|
|
3114
|
+
get: function () { return chunkTBSHZO5R_cjs.DEFAULT_SIDEBAR; }
|
|
3115
|
+
});
|
|
3116
|
+
Object.defineProperty(exports, "DEFAULT_Z_INDEX", {
|
|
3117
|
+
enumerable: true,
|
|
3118
|
+
get: function () { return chunkTBSHZO5R_cjs.DEFAULT_Z_INDEX; }
|
|
3119
|
+
});
|
|
3120
|
+
Object.defineProperty(exports, "HOTKEYS", {
|
|
3121
|
+
enumerable: true,
|
|
3122
|
+
get: function () { return chunkTBSHZO5R_cjs.HOTKEYS; }
|
|
3123
|
+
});
|
|
3124
|
+
Object.defineProperty(exports, "LIMITS", {
|
|
3125
|
+
enumerable: true,
|
|
3126
|
+
get: function () { return chunkTBSHZO5R_cjs.LIMITS; }
|
|
3127
|
+
});
|
|
3128
|
+
Object.defineProperty(exports, "STORAGE_KEYS", {
|
|
3129
|
+
enumerable: true,
|
|
3130
|
+
get: function () { return chunkTBSHZO5R_cjs.STORAGE_KEYS; }
|
|
3131
|
+
});
|
|
3132
|
+
Object.defineProperty(exports, "createId", {
|
|
3133
|
+
enumerable: true,
|
|
3134
|
+
get: function () { return chunkTBSHZO5R_cjs.createId; }
|
|
3135
|
+
});
|
|
3136
|
+
Object.defineProperty(exports, "createTokenBuffer", {
|
|
3137
|
+
enumerable: true,
|
|
3138
|
+
get: function () { return chunkTBSHZO5R_cjs.createTokenBuffer; }
|
|
3139
|
+
});
|
|
3140
|
+
Object.defineProperty(exports, "getChatLogger", {
|
|
3141
|
+
enumerable: true,
|
|
3142
|
+
get: function () { return chunkTBSHZO5R_cjs.getChatLogger; }
|
|
3143
|
+
});
|
|
3144
|
+
Object.defineProperty(exports, "initialState", {
|
|
3145
|
+
enumerable: true,
|
|
3146
|
+
get: function () { return chunkTBSHZO5R_cjs.initialState; }
|
|
3147
|
+
});
|
|
3148
|
+
Object.defineProperty(exports, "reducer", {
|
|
3149
|
+
enumerable: true,
|
|
3150
|
+
get: function () { return chunkTBSHZO5R_cjs.reducer; }
|
|
3151
|
+
});
|
|
3152
|
+
Object.defineProperty(exports, "useChat", {
|
|
3153
|
+
enumerable: true,
|
|
3154
|
+
get: function () { return chunkTBSHZO5R_cjs.useChat; }
|
|
3155
|
+
});
|
|
3156
|
+
Object.defineProperty(exports, "useChatAudio", {
|
|
3157
|
+
enumerable: true,
|
|
3158
|
+
get: function () { return chunkTBSHZO5R_cjs.useChatAudio; }
|
|
3159
|
+
});
|
|
3160
|
+
Object.defineProperty(exports, "useChatContext", {
|
|
3161
|
+
enumerable: true,
|
|
3162
|
+
get: function () { return chunkTBSHZO5R_cjs.useChatContext; }
|
|
3163
|
+
});
|
|
3164
|
+
Object.defineProperty(exports, "useChatContextOptional", {
|
|
3165
|
+
enumerable: true,
|
|
3166
|
+
get: function () { return chunkTBSHZO5R_cjs.useChatContextOptional; }
|
|
3167
|
+
});
|
|
3168
|
+
Object.defineProperty(exports, "useChatLayout", {
|
|
3169
|
+
enumerable: true,
|
|
3170
|
+
get: function () { return chunkTBSHZO5R_cjs.useChatLayout; }
|
|
3171
|
+
});
|
|
3506
3172
|
Object.defineProperty(exports, "ArrayFieldItemTemplate", {
|
|
3507
3173
|
enumerable: true,
|
|
3508
3174
|
get: function () { return chunkFEN5S772_cjs.ArrayFieldItemTemplate; }
|
|
@@ -3763,186 +3429,6 @@ Object.defineProperty(exports, "useCronWeekDays", {
|
|
|
3763
3429
|
enumerable: true,
|
|
3764
3430
|
get: function () { return chunk76NNDZH6_cjs.useCronWeekDays; }
|
|
3765
3431
|
});
|
|
3766
|
-
Object.defineProperty(exports, "Attachments", {
|
|
3767
|
-
enumerable: true,
|
|
3768
|
-
get: function () { return chunkHPK3EWBF_cjs.Attachments; }
|
|
3769
|
-
});
|
|
3770
|
-
Object.defineProperty(exports, "AttachmentsGrid", {
|
|
3771
|
-
enumerable: true,
|
|
3772
|
-
get: function () { return chunkHPK3EWBF_cjs.AttachmentsGrid; }
|
|
3773
|
-
});
|
|
3774
|
-
Object.defineProperty(exports, "AttachmentsList", {
|
|
3775
|
-
enumerable: true,
|
|
3776
|
-
get: function () { return chunkHPK3EWBF_cjs.AttachmentsList; }
|
|
3777
|
-
});
|
|
3778
|
-
Object.defineProperty(exports, "CHAT_EVENT_NAME", {
|
|
3779
|
-
enumerable: true,
|
|
3780
|
-
get: function () { return chunkHPK3EWBF_cjs.CHAT_EVENT_NAME; }
|
|
3781
|
-
});
|
|
3782
|
-
Object.defineProperty(exports, "CSS_VARS", {
|
|
3783
|
-
enumerable: true,
|
|
3784
|
-
get: function () { return chunkHPK3EWBF_cjs.CSS_VARS; }
|
|
3785
|
-
});
|
|
3786
|
-
Object.defineProperty(exports, "ChatProvider", {
|
|
3787
|
-
enumerable: true,
|
|
3788
|
-
get: function () { return chunkHPK3EWBF_cjs.ChatProvider; }
|
|
3789
|
-
});
|
|
3790
|
-
Object.defineProperty(exports, "ChatRoot", {
|
|
3791
|
-
enumerable: true,
|
|
3792
|
-
get: function () { return chunkHPK3EWBF_cjs.ChatRoot; }
|
|
3793
|
-
});
|
|
3794
|
-
Object.defineProperty(exports, "Composer", {
|
|
3795
|
-
enumerable: true,
|
|
3796
|
-
get: function () { return chunkHPK3EWBF_cjs.Composer; }
|
|
3797
|
-
});
|
|
3798
|
-
Object.defineProperty(exports, "DEFAULT_CHAT_SOUNDS", {
|
|
3799
|
-
enumerable: true,
|
|
3800
|
-
get: function () { return chunkHPK3EWBF_cjs.DEFAULT_CHAT_SOUNDS; }
|
|
3801
|
-
});
|
|
3802
|
-
Object.defineProperty(exports, "DEFAULT_LABELS", {
|
|
3803
|
-
enumerable: true,
|
|
3804
|
-
get: function () { return chunkHPK3EWBF_cjs.DEFAULT_LABELS; }
|
|
3805
|
-
});
|
|
3806
|
-
Object.defineProperty(exports, "DEFAULT_SIDEBAR", {
|
|
3807
|
-
enumerable: true,
|
|
3808
|
-
get: function () { return chunkHPK3EWBF_cjs.DEFAULT_SIDEBAR; }
|
|
3809
|
-
});
|
|
3810
|
-
Object.defineProperty(exports, "DEFAULT_Z_INDEX", {
|
|
3811
|
-
enumerable: true,
|
|
3812
|
-
get: function () { return chunkHPK3EWBF_cjs.DEFAULT_Z_INDEX; }
|
|
3813
|
-
});
|
|
3814
|
-
Object.defineProperty(exports, "EmptyState", {
|
|
3815
|
-
enumerable: true,
|
|
3816
|
-
get: function () { return chunkHPK3EWBF_cjs.EmptyState; }
|
|
3817
|
-
});
|
|
3818
|
-
Object.defineProperty(exports, "ErrorBanner", {
|
|
3819
|
-
enumerable: true,
|
|
3820
|
-
get: function () { return chunkHPK3EWBF_cjs.ErrorBanner; }
|
|
3821
|
-
});
|
|
3822
|
-
Object.defineProperty(exports, "HOTKEYS", {
|
|
3823
|
-
enumerable: true,
|
|
3824
|
-
get: function () { return chunkHPK3EWBF_cjs.HOTKEYS; }
|
|
3825
|
-
});
|
|
3826
|
-
Object.defineProperty(exports, "JumpToLatest", {
|
|
3827
|
-
enumerable: true,
|
|
3828
|
-
get: function () { return chunkHPK3EWBF_cjs.JumpToLatest; }
|
|
3829
|
-
});
|
|
3830
|
-
Object.defineProperty(exports, "LIMITS", {
|
|
3831
|
-
enumerable: true,
|
|
3832
|
-
get: function () { return chunkHPK3EWBF_cjs.LIMITS; }
|
|
3833
|
-
});
|
|
3834
|
-
Object.defineProperty(exports, "MessageActions", {
|
|
3835
|
-
enumerable: true,
|
|
3836
|
-
get: function () { return chunkHPK3EWBF_cjs.MessageActions; }
|
|
3837
|
-
});
|
|
3838
|
-
Object.defineProperty(exports, "MessageBubble", {
|
|
3839
|
-
enumerable: true,
|
|
3840
|
-
get: function () { return chunkHPK3EWBF_cjs.MessageBubble; }
|
|
3841
|
-
});
|
|
3842
|
-
Object.defineProperty(exports, "MessageList", {
|
|
3843
|
-
enumerable: true,
|
|
3844
|
-
get: function () { return chunkHPK3EWBF_cjs.MessageList; }
|
|
3845
|
-
});
|
|
3846
|
-
Object.defineProperty(exports, "STORAGE_KEYS", {
|
|
3847
|
-
enumerable: true,
|
|
3848
|
-
get: function () { return chunkHPK3EWBF_cjs.STORAGE_KEYS; }
|
|
3849
|
-
});
|
|
3850
|
-
Object.defineProperty(exports, "Sources", {
|
|
3851
|
-
enumerable: true,
|
|
3852
|
-
get: function () { return chunkHPK3EWBF_cjs.Sources; }
|
|
3853
|
-
});
|
|
3854
|
-
Object.defineProperty(exports, "StreamingIndicator", {
|
|
3855
|
-
enumerable: true,
|
|
3856
|
-
get: function () { return chunkHPK3EWBF_cjs.StreamingIndicator; }
|
|
3857
|
-
});
|
|
3858
|
-
Object.defineProperty(exports, "ToolCalls", {
|
|
3859
|
-
enumerable: true,
|
|
3860
|
-
get: function () { return chunkHPK3EWBF_cjs.ToolCalls; }
|
|
3861
|
-
});
|
|
3862
|
-
Object.defineProperty(exports, "createId", {
|
|
3863
|
-
enumerable: true,
|
|
3864
|
-
get: function () { return chunkHPK3EWBF_cjs.createId; }
|
|
3865
|
-
});
|
|
3866
|
-
Object.defineProperty(exports, "createTokenBuffer", {
|
|
3867
|
-
enumerable: true,
|
|
3868
|
-
get: function () { return chunkHPK3EWBF_cjs.createTokenBuffer; }
|
|
3869
|
-
});
|
|
3870
|
-
Object.defineProperty(exports, "deriveInitials", {
|
|
3871
|
-
enumerable: true,
|
|
3872
|
-
get: function () { return chunkHPK3EWBF_cjs.deriveInitials; }
|
|
3873
|
-
});
|
|
3874
|
-
Object.defineProperty(exports, "getChatLogger", {
|
|
3875
|
-
enumerable: true,
|
|
3876
|
-
get: function () { return chunkHPK3EWBF_cjs.getChatLogger; }
|
|
3877
|
-
});
|
|
3878
|
-
Object.defineProperty(exports, "initialState", {
|
|
3879
|
-
enumerable: true,
|
|
3880
|
-
get: function () { return chunkHPK3EWBF_cjs.initialState; }
|
|
3881
|
-
});
|
|
3882
|
-
Object.defineProperty(exports, "isSubmittableDraft", {
|
|
3883
|
-
enumerable: true,
|
|
3884
|
-
get: function () { return chunkHPK3EWBF_cjs.isSubmittableDraft; }
|
|
3885
|
-
});
|
|
3886
|
-
Object.defineProperty(exports, "reducer", {
|
|
3887
|
-
enumerable: true,
|
|
3888
|
-
get: function () { return chunkHPK3EWBF_cjs.reducer; }
|
|
3889
|
-
});
|
|
3890
|
-
Object.defineProperty(exports, "resolvePersona", {
|
|
3891
|
-
enumerable: true,
|
|
3892
|
-
get: function () { return chunkHPK3EWBF_cjs.resolvePersona; }
|
|
3893
|
-
});
|
|
3894
|
-
Object.defineProperty(exports, "sanitizeDraft", {
|
|
3895
|
-
enumerable: true,
|
|
3896
|
-
get: function () { return chunkHPK3EWBF_cjs.sanitizeDraft; }
|
|
3897
|
-
});
|
|
3898
|
-
Object.defineProperty(exports, "useAutoFocusOnStreamEnd", {
|
|
3899
|
-
enumerable: true,
|
|
3900
|
-
get: function () { return chunkHPK3EWBF_cjs.useAutoFocusOnStreamEnd; }
|
|
3901
|
-
});
|
|
3902
|
-
Object.defineProperty(exports, "useChat", {
|
|
3903
|
-
enumerable: true,
|
|
3904
|
-
get: function () { return chunkHPK3EWBF_cjs.useChat; }
|
|
3905
|
-
});
|
|
3906
|
-
Object.defineProperty(exports, "useChatAudio", {
|
|
3907
|
-
enumerable: true,
|
|
3908
|
-
get: function () { return chunkHPK3EWBF_cjs.useChatAudio; }
|
|
3909
|
-
});
|
|
3910
|
-
Object.defineProperty(exports, "useChatBubbleStyles", {
|
|
3911
|
-
enumerable: true,
|
|
3912
|
-
get: function () { return chunkHPK3EWBF_cjs.useChatBubbleStyles; }
|
|
3913
|
-
});
|
|
3914
|
-
Object.defineProperty(exports, "useChatComposer", {
|
|
3915
|
-
enumerable: true,
|
|
3916
|
-
get: function () { return chunkHPK3EWBF_cjs.useChatComposer; }
|
|
3917
|
-
});
|
|
3918
|
-
Object.defineProperty(exports, "useChatContext", {
|
|
3919
|
-
enumerable: true,
|
|
3920
|
-
get: function () { return chunkHPK3EWBF_cjs.useChatContext; }
|
|
3921
|
-
});
|
|
3922
|
-
Object.defineProperty(exports, "useChatContextOptional", {
|
|
3923
|
-
enumerable: true,
|
|
3924
|
-
get: function () { return chunkHPK3EWBF_cjs.useChatContextOptional; }
|
|
3925
|
-
});
|
|
3926
|
-
Object.defineProperty(exports, "useChatDestructiveStyles", {
|
|
3927
|
-
enumerable: true,
|
|
3928
|
-
get: function () { return chunkHPK3EWBF_cjs.useChatDestructiveStyles; }
|
|
3929
|
-
});
|
|
3930
|
-
Object.defineProperty(exports, "useChatLayout", {
|
|
3931
|
-
enumerable: true,
|
|
3932
|
-
get: function () { return chunkHPK3EWBF_cjs.useChatLayout; }
|
|
3933
|
-
});
|
|
3934
|
-
Object.defineProperty(exports, "useChatRoleStyles", {
|
|
3935
|
-
enumerable: true,
|
|
3936
|
-
get: function () { return chunkHPK3EWBF_cjs.useChatRoleStyles; }
|
|
3937
|
-
});
|
|
3938
|
-
Object.defineProperty(exports, "useFocusOnEmptyClick", {
|
|
3939
|
-
enumerable: true,
|
|
3940
|
-
get: function () { return chunkHPK3EWBF_cjs.useFocusOnEmptyClick; }
|
|
3941
|
-
});
|
|
3942
|
-
Object.defineProperty(exports, "useRegisterComposer", {
|
|
3943
|
-
enumerable: true,
|
|
3944
|
-
get: function () { return chunkHPK3EWBF_cjs.useRegisterComposer; }
|
|
3945
|
-
});
|
|
3946
3432
|
Object.defineProperty(exports, "TreeError", {
|
|
3947
3433
|
enumerable: true,
|
|
3948
3434
|
get: function () { return chunkYXZ6GU7H_cjs.TreeError; }
|
|
@@ -4081,61 +3567,61 @@ Object.defineProperty(exports, "useTreeTypeAhead", {
|
|
|
4081
3567
|
});
|
|
4082
3568
|
Object.defineProperty(exports, "ANCHOR", {
|
|
4083
3569
|
enumerable: true,
|
|
4084
|
-
get: function () { return
|
|
3570
|
+
get: function () { return chunk7IYXZUJO_cjs.ANCHOR; }
|
|
3571
|
+
});
|
|
3572
|
+
Object.defineProperty(exports, "ActionRow", {
|
|
3573
|
+
enumerable: true,
|
|
3574
|
+
get: function () { return chunk7IYXZUJO_cjs.ActionRow; }
|
|
4085
3575
|
});
|
|
4086
3576
|
Object.defineProperty(exports, "BUBBLE_SURFACE", {
|
|
4087
3577
|
enumerable: true,
|
|
4088
|
-
get: function () { return
|
|
3578
|
+
get: function () { return chunk7IYXZUJO_cjs.BUBBLE_SURFACE; }
|
|
3579
|
+
});
|
|
3580
|
+
Object.defineProperty(exports, "ChatMessageRow", {
|
|
3581
|
+
enumerable: true,
|
|
3582
|
+
get: function () { return chunk7IYXZUJO_cjs.ChatMessageRow; }
|
|
4089
3583
|
});
|
|
4090
3584
|
Object.defineProperty(exports, "DESTRUCTIVE_SURFACE", {
|
|
4091
3585
|
enumerable: true,
|
|
4092
|
-
get: function () { return
|
|
3586
|
+
get: function () { return chunk7IYXZUJO_cjs.DESTRUCTIVE_SURFACE; }
|
|
4093
3587
|
});
|
|
4094
3588
|
Object.defineProperty(exports, "MarkdownMessage", {
|
|
4095
3589
|
enumerable: true,
|
|
4096
|
-
get: function () { return
|
|
3590
|
+
get: function () { return chunk7IYXZUJO_cjs.MarkdownMessage; }
|
|
3591
|
+
});
|
|
3592
|
+
Object.defineProperty(exports, "MarkdownMessageDefault", {
|
|
3593
|
+
enumerable: true,
|
|
3594
|
+
get: function () { return chunk7IYXZUJO_cjs.MarkdownMessage_default; }
|
|
4097
3595
|
});
|
|
4098
3596
|
Object.defineProperty(exports, "Mermaid", {
|
|
4099
3597
|
enumerable: true,
|
|
4100
|
-
get: function () { return
|
|
3598
|
+
get: function () { return chunk7IYXZUJO_cjs.Mermaid_default; }
|
|
4101
3599
|
});
|
|
4102
3600
|
Object.defineProperty(exports, "PrettyCode", {
|
|
4103
3601
|
enumerable: true,
|
|
4104
|
-
get: function () { return
|
|
3602
|
+
get: function () { return chunk7IYXZUJO_cjs.PrettyCode_default; }
|
|
4105
3603
|
});
|
|
4106
3604
|
Object.defineProperty(exports, "TOGGLE", {
|
|
4107
3605
|
enumerable: true,
|
|
4108
|
-
get: function () { return
|
|
3606
|
+
get: function () { return chunk7IYXZUJO_cjs.TOGGLE; }
|
|
4109
3607
|
});
|
|
4110
3608
|
Object.defineProperty(exports, "TOOL_CALL", {
|
|
4111
3609
|
enumerable: true,
|
|
4112
|
-
get: function () { return
|
|
3610
|
+
get: function () { return chunk7IYXZUJO_cjs.TOOL_CALL; }
|
|
4113
3611
|
});
|
|
4114
3612
|
Object.defineProperty(exports, "extractTextFromChildren", {
|
|
4115
3613
|
enumerable: true,
|
|
4116
|
-
get: function () { return
|
|
3614
|
+
get: function () { return chunk7IYXZUJO_cjs.extractTextFromChildren; }
|
|
4117
3615
|
});
|
|
4118
3616
|
Object.defineProperty(exports, "useCollapsibleContent", {
|
|
4119
3617
|
enumerable: true,
|
|
4120
|
-
get: function () { return
|
|
3618
|
+
get: function () { return chunk7IYXZUJO_cjs.useCollapsibleContent; }
|
|
4121
3619
|
});
|
|
4122
3620
|
Object.defineProperty(exports, "JsonTree", {
|
|
4123
3621
|
enumerable: true,
|
|
4124
3622
|
get: function () { return chunkT3MWM23F_cjs.JsonTree_default; }
|
|
4125
3623
|
});
|
|
4126
3624
|
exports.AudioToggle = AudioToggle;
|
|
4127
|
-
exports.CardLoadingFallback = CardLoadingFallback;
|
|
4128
|
-
exports.ChatDock = ChatDock;
|
|
4129
|
-
exports.ChatFAB = ChatFAB;
|
|
4130
|
-
exports.ChatGreeting = ChatGreeting;
|
|
4131
|
-
exports.ChatHeader = ChatHeader;
|
|
4132
|
-
exports.ChatHeaderActionButton = ChatHeaderActionButton;
|
|
4133
|
-
exports.ChatHeaderAudioToggle = ChatHeaderAudioToggle;
|
|
4134
|
-
exports.ChatHeaderLanguageButton = ChatHeaderLanguageButton;
|
|
4135
|
-
exports.ChatHeaderModeToggle = ChatHeaderModeToggle;
|
|
4136
|
-
exports.ChatHeaderResetButton = ChatHeaderResetButton;
|
|
4137
|
-
exports.ChatLauncher = ChatLauncher;
|
|
4138
|
-
exports.ChatUnreadPreview = ChatUnreadPreview;
|
|
4139
3625
|
exports.CronScheduler = CronScheduler;
|
|
4140
3626
|
exports.DEFAULT_DOCK_PREFS = DEFAULT_DOCK_PREFS;
|
|
4141
3627
|
exports.DiffEditor = DiffEditor;
|
|
@@ -4155,17 +3641,12 @@ exports.LazyOpenapiViewer = LazyOpenapiViewer;
|
|
|
4155
3641
|
exports.LazyPrettyCode = LazyPrettyCode;
|
|
4156
3642
|
exports.LazyTree = LazyTree;
|
|
4157
3643
|
exports.LazyVideoPlayer = LazyVideoPlayer;
|
|
4158
|
-
exports.LazyWrapper = LazyWrapper;
|
|
4159
|
-
exports.LoadingFallback = LoadingFallback;
|
|
4160
3644
|
exports.LottiePlayer = LottiePlayer;
|
|
4161
|
-
exports.MapLoadingFallback = MapLoadingFallback;
|
|
4162
3645
|
exports.MarkdownEditor = MarkdownEditor;
|
|
4163
3646
|
exports.OpenapiViewer = OpenapiViewer_default;
|
|
4164
|
-
exports.Spinner = Spinner;
|
|
4165
3647
|
exports.TransportError = TransportError;
|
|
4166
3648
|
exports.collectImageAttachments = collectImageAttachments;
|
|
4167
3649
|
exports.createHttpTransport = createHttpTransport;
|
|
4168
|
-
exports.createLazyComponent = createLazyComponent;
|
|
4169
3650
|
exports.createMockTransport = createMockTransport;
|
|
4170
3651
|
exports.createPydanticAIChatTransport = createPydanticAIChatTransport;
|
|
4171
3652
|
exports.createPydanticAISSEMap = createPydanticAISSEMap;
|
|
@@ -4182,8 +3663,6 @@ exports.useChatAudioPrefs = useChatAudioPrefs;
|
|
|
4182
3663
|
exports.useChatDockPrefs = useChatDockPrefs;
|
|
4183
3664
|
exports.useChatHistory = useChatHistory;
|
|
4184
3665
|
exports.useChatLightbox = useChatLightbox;
|
|
4185
|
-
exports.useChatPresence = useChatPresence;
|
|
4186
|
-
exports.useChatReset = useChatReset;
|
|
4187
3666
|
exports.useChatScroll = useChatScroll;
|
|
4188
3667
|
exports.useChatUnread = useChatUnread;
|
|
4189
3668
|
exports.useEditor = useEditor;
|