@heroui/agent 0.2.0-beta.8 → 0.2.0-beta.9
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/CHANGELOG.md +5 -0
- package/dist/chart-content-BBHQVMP4.js +1 -0
- package/dist/chunk-2XBFFSW2.js +1 -0
- package/dist/chunk-64RI74L5.js +1 -0
- package/dist/chunk-6ZJJN322.js +1 -0
- package/dist/chunk-7KCGPNEN.js +1 -0
- package/dist/chunk-BBB5EHDN.js +5 -0
- package/dist/chunk-CR3H7AVI.js +1 -0
- package/dist/chunk-HCLXS4HQ.js +1 -0
- package/dist/chunk-MXLGM4WV.js +1 -0
- package/dist/chunk-OA3TG5CS.js +1 -0
- package/dist/chunk-PZJ4NC3J.js +1 -0
- package/dist/chunk-RNNGE7KM.js +1 -0
- package/dist/chunk-S6OIAJSC.js +1 -0
- package/dist/chunk-SUDHJNTJ.js +2 -0
- package/dist/chunk-WUAFMD7Z.js +2 -0
- package/dist/component-renderer-GG6JVRUG.js +1 -0
- package/dist/composer-draft-NSKK65F3.js +1 -0
- package/dist/composer-image-draft-KAGTNQR7.js +1 -0
- package/dist/contracts.d.ts +1 -1
- package/dist/contracts.js +2 -2445
- package/dist/embed-runtime-GYXK7V6N.js +5 -0
- package/dist/index.js +1 -31
- package/dist/interactive-map-surface-WC2LPCR7.js +1 -0
- package/dist/internal/client-tools.js +1 -0
- package/dist/internal/models.js +1 -0
- package/dist/internal/runtime.js +1 -0
- package/dist/internal/theme.js +1 -0
- package/dist/next.js +1 -25
- package/dist/server.js +1 -136
- package/package.json +4 -4
- package/dist/chart-content-E4NPTUPR.js +0 -2696
- package/dist/chunk-3FG5NRTX.js +0 -9
- package/dist/chunk-CMZDZGUZ.js +0 -1132
- package/dist/chunk-DS4X5K2R.js +0 -56
- package/dist/chunk-FNGGMHVR.js +0 -625
- package/dist/chunk-G6GFNSG4.js +0 -284
- package/dist/chunk-Q7LGTVBL.js +0 -43
- package/dist/chunk-TOOT6SZ2.js +0 -74
- package/dist/chunk-UUPU3MYB.js +0 -42
- package/dist/chunk-VJA52U5P.js +0 -137
- package/dist/chunk-W7SCMB3O.js +0 -1285
- package/dist/component-renderer-MDDQMQTU.js +0 -10629
- package/dist/composer-draft-DTQAEO5K.js +0 -20
- package/dist/composer-image-draft-IVJ352E6.js +0 -174
- package/dist/embed-runtime-VVAGDPYY.js +0 -9422
- package/dist/interactive-map-surface-67KHT3VB.js +0 -362
package/dist/chunk-G6GFNSG4.js
DELETED
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
mergeClassNames
|
|
3
|
-
} from "./chunk-3FG5NRTX.js";
|
|
4
|
-
|
|
5
|
-
// ../agent-ui/src/components/display-information/scroll-shadow/scroll-shadow.tsx
|
|
6
|
-
import { useCallback, useEffect, useRef } from "react";
|
|
7
|
-
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
function ScrollShadow({
|
|
9
|
-
children,
|
|
10
|
-
className,
|
|
11
|
-
offset = 0,
|
|
12
|
-
size = 32,
|
|
13
|
-
style,
|
|
14
|
-
...props
|
|
15
|
-
}) {
|
|
16
|
-
const ref = useRef(null);
|
|
17
|
-
const previousVisibility = useRef(null);
|
|
18
|
-
const frame = useRef(null);
|
|
19
|
-
const updateVisibility = useCallback(() => {
|
|
20
|
-
const element = ref.current;
|
|
21
|
-
if (!element) return;
|
|
22
|
-
const hasScrollBefore = element.scrollLeft > offset;
|
|
23
|
-
const hasScrollAfter = element.scrollLeft + element.clientWidth + offset < element.scrollWidth;
|
|
24
|
-
const visibility = hasScrollBefore && hasScrollAfter ? "both" : hasScrollBefore ? "left" : hasScrollAfter ? "right" : "none";
|
|
25
|
-
if (previousVisibility.current === visibility) return;
|
|
26
|
-
previousVisibility.current = visibility;
|
|
27
|
-
if (frame.current !== null) cancelAnimationFrame(frame.current);
|
|
28
|
-
frame.current = requestAnimationFrame(() => {
|
|
29
|
-
frame.current = null;
|
|
30
|
-
delete element.dataset["leftScroll"];
|
|
31
|
-
delete element.dataset["rightScroll"];
|
|
32
|
-
delete element.dataset["leftRightScroll"];
|
|
33
|
-
if (visibility === "both") element.dataset["leftRightScroll"] = "true";
|
|
34
|
-
else if (visibility !== "none") element.dataset[`${visibility}Scroll`] = "true";
|
|
35
|
-
});
|
|
36
|
-
}, [offset]);
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
const element = ref.current;
|
|
39
|
-
if (!element) return;
|
|
40
|
-
updateVisibility();
|
|
41
|
-
element.addEventListener("scroll", updateVisibility, { passive: true });
|
|
42
|
-
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(updateVisibility);
|
|
43
|
-
observer?.observe(element);
|
|
44
|
-
return () => {
|
|
45
|
-
element.removeEventListener("scroll", updateVisibility);
|
|
46
|
-
observer?.disconnect();
|
|
47
|
-
if (frame.current !== null) cancelAnimationFrame(frame.current);
|
|
48
|
-
frame.current = null;
|
|
49
|
-
previousVisibility.current = null;
|
|
50
|
-
};
|
|
51
|
-
}, [updateVisibility]);
|
|
52
|
-
return /* @__PURE__ */ jsx(
|
|
53
|
-
"div",
|
|
54
|
-
{
|
|
55
|
-
ref,
|
|
56
|
-
className: mergeClassNames("aui-scroll-shadow", className),
|
|
57
|
-
"data-slot": "agent-ui-scroll-shadow",
|
|
58
|
-
style: { "--scroll-shadow-size": `${size}px`, ...style },
|
|
59
|
-
...props,
|
|
60
|
-
children
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// ../agent-ui/src/components/actions/action-button.tsx
|
|
66
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
67
|
-
function ActionButton({
|
|
68
|
-
className,
|
|
69
|
-
size = "sm",
|
|
70
|
-
variant = "secondary",
|
|
71
|
-
...props
|
|
72
|
-
}) {
|
|
73
|
-
return /* @__PURE__ */ jsx2(
|
|
74
|
-
"button",
|
|
75
|
-
{
|
|
76
|
-
className: mergeClassNames("aui-button", className),
|
|
77
|
-
"data-size": size,
|
|
78
|
-
"data-slot": "agent-ui-action-button",
|
|
79
|
-
"data-variant": variant,
|
|
80
|
-
type: "button",
|
|
81
|
-
...props
|
|
82
|
-
}
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// ../agent-ui/src/components/display-information/code-block.tsx
|
|
87
|
-
import { Button } from "@heroui/react";
|
|
88
|
-
import { useEffect as useEffect2, useRef as useRef2, useState } from "react";
|
|
89
|
-
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
90
|
-
var COPY_RESET_DELAY = 2e3;
|
|
91
|
-
var DEFAULT_DARK_THEME = "github-dark";
|
|
92
|
-
var DEFAULT_LIGHT_THEME = "github-light";
|
|
93
|
-
var languageLoaders = {
|
|
94
|
-
bash: () => import("shiki/langs/bash.mjs"),
|
|
95
|
-
css: () => import("shiki/langs/css.mjs"),
|
|
96
|
-
html: () => import("shiki/langs/html.mjs"),
|
|
97
|
-
javascript: () => import("shiki/langs/javascript.mjs"),
|
|
98
|
-
json: () => import("shiki/langs/json.mjs"),
|
|
99
|
-
jsx: () => import("shiki/langs/jsx.mjs"),
|
|
100
|
-
markdown: () => import("shiki/langs/markdown.mjs"),
|
|
101
|
-
python: () => import("shiki/langs/python.mjs"),
|
|
102
|
-
shellscript: () => import("shiki/langs/shellscript.mjs"),
|
|
103
|
-
sql: () => import("shiki/langs/sql.mjs"),
|
|
104
|
-
tsx: () => import("shiki/langs/tsx.mjs"),
|
|
105
|
-
typescript: () => import("shiki/langs/typescript.mjs")
|
|
106
|
-
};
|
|
107
|
-
var highlighters = /* @__PURE__ */ new Map();
|
|
108
|
-
function normalizeLanguage(language) {
|
|
109
|
-
const aliases = {
|
|
110
|
-
js: "javascript",
|
|
111
|
-
md: "markdown",
|
|
112
|
-
py: "python",
|
|
113
|
-
sh: "shellscript",
|
|
114
|
-
shell: "shellscript",
|
|
115
|
-
ts: "typescript"
|
|
116
|
-
};
|
|
117
|
-
const normalized = language.toLowerCase();
|
|
118
|
-
if (normalized in languageLoaders) return normalized;
|
|
119
|
-
return aliases[normalized] ?? null;
|
|
120
|
-
}
|
|
121
|
-
async function createLanguageHighlighter(language) {
|
|
122
|
-
const [{ createHighlighterCore }, { createJavaScriptRegexEngine }, lightTheme, darkTheme, grammar] = await Promise.all([
|
|
123
|
-
import("shiki/core"),
|
|
124
|
-
import("shiki/engine/javascript"),
|
|
125
|
-
import("shiki/themes/github-light.mjs"),
|
|
126
|
-
import("shiki/themes/github-dark.mjs"),
|
|
127
|
-
languageLoaders[language]()
|
|
128
|
-
]);
|
|
129
|
-
return createHighlighterCore({
|
|
130
|
-
engine: createJavaScriptRegexEngine(),
|
|
131
|
-
langs: [grammar.default],
|
|
132
|
-
themes: [lightTheme.default, darkTheme.default]
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
async function highlightCode(code, language) {
|
|
136
|
-
const normalized = normalizeLanguage(language);
|
|
137
|
-
if (!normalized) return null;
|
|
138
|
-
const existing = highlighters.get(normalized);
|
|
139
|
-
const highlighterPromise = existing ?? createLanguageHighlighter(normalized);
|
|
140
|
-
if (!existing) highlighters.set(normalized, highlighterPromise);
|
|
141
|
-
const highlighter = await highlighterPromise;
|
|
142
|
-
return highlighter.codeToHtml(code, {
|
|
143
|
-
defaultColor: false,
|
|
144
|
-
lang: normalized,
|
|
145
|
-
themes: { dark: DEFAULT_DARK_THEME, light: DEFAULT_LIGHT_THEME }
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
async function copyText(text) {
|
|
149
|
-
try {
|
|
150
|
-
await navigator.clipboard.writeText(text);
|
|
151
|
-
return true;
|
|
152
|
-
} catch {
|
|
153
|
-
const textarea = document.createElement("textarea");
|
|
154
|
-
textarea.value = text;
|
|
155
|
-
textarea.setAttribute("readonly", "");
|
|
156
|
-
textarea.style.position = "fixed";
|
|
157
|
-
textarea.style.opacity = "0";
|
|
158
|
-
document.body.append(textarea);
|
|
159
|
-
textarea.select();
|
|
160
|
-
try {
|
|
161
|
-
return document.execCommand?.("copy") ?? false;
|
|
162
|
-
} catch {
|
|
163
|
-
return false;
|
|
164
|
-
} finally {
|
|
165
|
-
textarea.remove();
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
function CodeGlyph() {
|
|
170
|
-
return /* @__PURE__ */ jsx3("svg", { "aria-hidden": "true", fill: "none", viewBox: "0 0 16 16", children: /* @__PURE__ */ jsx3(
|
|
171
|
-
"path",
|
|
172
|
-
{
|
|
173
|
-
clipRule: "evenodd",
|
|
174
|
-
d: "M10.218 3.216a.75.75 0 0 0-1.436-.431l-3 10a.75.75 0 0 0 1.436.43zM4.53 4.97a.75.75 0 0 1 0 1.06L2.56 8l1.97 1.97a.75.75 0 0 1-1.06 1.06l-2.5-2.5a.75.75 0 0 1 0-1.06l2.5-2.5a.75.75 0 0 1 1.06 0m6.94 6.06a.75.75 0 0 1 0-1.06L13.44 8l-1.97-1.97a.75.75 0 0 1 1.06-1.06l2.5 2.5a.75.75 0 0 1 0 1.06l-2.5 2.5a.75.75 0 0 1-1.06 0",
|
|
175
|
-
fill: "currentColor",
|
|
176
|
-
fillRule: "evenodd"
|
|
177
|
-
}
|
|
178
|
-
) });
|
|
179
|
-
}
|
|
180
|
-
function CopyGlyph() {
|
|
181
|
-
return /* @__PURE__ */ jsx3("svg", { "aria-hidden": "true", fill: "none", viewBox: "0 0 16 16", children: /* @__PURE__ */ jsx3(
|
|
182
|
-
"path",
|
|
183
|
-
{
|
|
184
|
-
clipRule: "evenodd",
|
|
185
|
-
d: "M12 2.5H8A1.5 1.5 0 0 0 6.5 4v1H8a3 3 0 0 1 3 3v1.5h1A1.5 1.5 0 0 0 13.5 8V4A1.5 1.5 0 0 0 12 2.5M11 11h1a3 3 0 0 0 3-3V4a3 3 0 0 0-3-3H8a3 3 0 0 0-3 3v1H4a3 3 0 0 0-3 3v4a3 3 0 0 0 3 3h4a3 3 0 0 0 3-3zM4 6.5h4A1.5 1.5 0 0 1 9.5 8v4A1.5 1.5 0 0 1 8 13.5H4A1.5 1.5 0 0 1 2.5 12V8A1.5 1.5 0 0 1 4 6.5",
|
|
186
|
-
fill: "currentColor",
|
|
187
|
-
fillRule: "evenodd"
|
|
188
|
-
}
|
|
189
|
-
) });
|
|
190
|
-
}
|
|
191
|
-
function CheckGlyph() {
|
|
192
|
-
return /* @__PURE__ */ jsx3("svg", { "aria-hidden": "true", fill: "none", viewBox: "0 0 16 16", children: /* @__PURE__ */ jsx3(
|
|
193
|
-
"path",
|
|
194
|
-
{
|
|
195
|
-
clipRule: "evenodd",
|
|
196
|
-
d: "M13.488 3.43a.75.75 0 0 1 .081 1.058l-6 7a.75.75 0 0 1-1.1.042l-3.5-3.5A.75.75 0 0 1 4.03 6.97l2.928 2.927 5.473-6.385a.75.75 0 0 1 1.057-.081",
|
|
197
|
-
fill: "currentColor",
|
|
198
|
-
fillRule: "evenodd"
|
|
199
|
-
}
|
|
200
|
-
) });
|
|
201
|
-
}
|
|
202
|
-
function CodeBlock({ code, language = "text" }) {
|
|
203
|
-
const highlightKey = `${language}:${code}`;
|
|
204
|
-
const [highlighted, setHighlighted] = useState(null);
|
|
205
|
-
const [copied, setCopied] = useState(false);
|
|
206
|
-
const resetTimeout = useRef2(null);
|
|
207
|
-
useEffect2(() => {
|
|
208
|
-
let cancelled = false;
|
|
209
|
-
async function highlight() {
|
|
210
|
-
try {
|
|
211
|
-
const html = await highlightCode(code, language);
|
|
212
|
-
if (!cancelled) setHighlighted(html ? { html, key: highlightKey } : null);
|
|
213
|
-
} catch {
|
|
214
|
-
if (!cancelled) setHighlighted(null);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
void highlight();
|
|
218
|
-
return () => {
|
|
219
|
-
cancelled = true;
|
|
220
|
-
};
|
|
221
|
-
}, [code, highlightKey, language]);
|
|
222
|
-
useEffect2(
|
|
223
|
-
() => () => {
|
|
224
|
-
if (resetTimeout.current !== null) window.clearTimeout(resetTimeout.current);
|
|
225
|
-
},
|
|
226
|
-
[]
|
|
227
|
-
);
|
|
228
|
-
const copy = async () => {
|
|
229
|
-
if (await copyText(code)) {
|
|
230
|
-
setCopied(true);
|
|
231
|
-
if (resetTimeout.current !== null) window.clearTimeout(resetTimeout.current);
|
|
232
|
-
resetTimeout.current = window.setTimeout(() => {
|
|
233
|
-
setCopied(false);
|
|
234
|
-
resetTimeout.current = null;
|
|
235
|
-
}, COPY_RESET_DELAY);
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
return /* @__PURE__ */ jsxs("div", { className: "aui-code", "data-slot": "agent-ui-code-block", children: [
|
|
239
|
-
/* @__PURE__ */ jsxs("header", { className: "aui-code__header", "data-slot": "agent-ui-code-header", children: [
|
|
240
|
-
/* @__PURE__ */ jsxs("span", { className: "aui-code__language", children: [
|
|
241
|
-
/* @__PURE__ */ jsx3(CodeGlyph, {}),
|
|
242
|
-
/* @__PURE__ */ jsx3("span", { children: language.toUpperCase() })
|
|
243
|
-
] }),
|
|
244
|
-
/* @__PURE__ */ jsx3(
|
|
245
|
-
Button,
|
|
246
|
-
{
|
|
247
|
-
isIconOnly: true,
|
|
248
|
-
"aria-label": copied ? "Code copied" : "Copy code",
|
|
249
|
-
className: "aui-code__copy",
|
|
250
|
-
"data-slot": "agent-ui-code-copy",
|
|
251
|
-
size: "sm",
|
|
252
|
-
variant: "ghost",
|
|
253
|
-
onPress: copy,
|
|
254
|
-
children: /* @__PURE__ */ jsxs(
|
|
255
|
-
"span",
|
|
256
|
-
{
|
|
257
|
-
className: "aui-code__copy-swap",
|
|
258
|
-
"data-copied": copied || void 0,
|
|
259
|
-
"data-slot": "agent-ui-code-copy-icon",
|
|
260
|
-
children: [
|
|
261
|
-
/* @__PURE__ */ jsx3("span", { className: "aui-code__copy-icon aui-code__copy-icon--copy", children: /* @__PURE__ */ jsx3(CopyGlyph, {}) }),
|
|
262
|
-
/* @__PURE__ */ jsx3("span", { className: "aui-code__copy-icon aui-code__copy-icon--check", children: /* @__PURE__ */ jsx3(CheckGlyph, {}) })
|
|
263
|
-
]
|
|
264
|
-
}
|
|
265
|
-
)
|
|
266
|
-
}
|
|
267
|
-
)
|
|
268
|
-
] }),
|
|
269
|
-
highlighted?.key === highlightKey ? /* @__PURE__ */ jsx3(
|
|
270
|
-
"div",
|
|
271
|
-
{
|
|
272
|
-
className: "aui-code__content",
|
|
273
|
-
dangerouslySetInnerHTML: { __html: highlighted.html },
|
|
274
|
-
"data-slot": "agent-ui-code"
|
|
275
|
-
}
|
|
276
|
-
) : /* @__PURE__ */ jsx3("div", { className: "aui-code__content", "data-slot": "agent-ui-code", children: /* @__PURE__ */ jsx3("pre", { children: /* @__PURE__ */ jsx3("code", { children: code }) }) })
|
|
277
|
-
] });
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
export {
|
|
281
|
-
ActionButton,
|
|
282
|
-
ScrollShadow,
|
|
283
|
-
CodeBlock
|
|
284
|
-
};
|
package/dist/chunk-Q7LGTVBL.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// ../agent-ui/src/utils/inline-markdown.tsx
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
var INLINE_TOKEN = /(\*\*[^*\n]+\*\*|\*[^*\s][^*\n]*\*|_[^_\s][^_\n]*_|`[^`\n]+`|\[[^\]\n]+\]\([^\s)\n]+\))/g;
|
|
4
|
-
var LINK_TOKEN = /^\[([^\]]+)\]\(([^\s)]+)\)$/;
|
|
5
|
-
var BARE_DOMAIN = /^(?:[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?\.)+[a-z]{2,63}(?::\d{1,5})?(?:[/?#][^\s]*)?$/i;
|
|
6
|
-
function resolveLinkHref(target) {
|
|
7
|
-
const href = /^https?:\/\//i.test(target) ? target : BARE_DOMAIN.test(target) ? `https://${target}` : void 0;
|
|
8
|
-
if (!href) return void 0;
|
|
9
|
-
try {
|
|
10
|
-
const url = new URL(href);
|
|
11
|
-
return url.protocol === "http:" || url.protocol === "https:" ? href : void 0;
|
|
12
|
-
} catch {
|
|
13
|
-
return void 0;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
function renderInlineMarkdown(text) {
|
|
17
|
-
const parts = text.split(INLINE_TOKEN);
|
|
18
|
-
if (parts.length === 1) return text;
|
|
19
|
-
const occurrences = /* @__PURE__ */ new Map();
|
|
20
|
-
return parts.map((part) => {
|
|
21
|
-
const occurrence = (occurrences.get(part) ?? 0) + 1;
|
|
22
|
-
const key = `${part}:${occurrence}`;
|
|
23
|
-
occurrences.set(part, occurrence);
|
|
24
|
-
if (part.startsWith("**") && part.endsWith("**") && part.length > 4)
|
|
25
|
-
return /* @__PURE__ */ jsx("strong", { children: part.slice(2, -2) }, key);
|
|
26
|
-
if (part.startsWith("*") && part.endsWith("*") && part.length > 2)
|
|
27
|
-
return /* @__PURE__ */ jsx("em", { children: part.slice(1, -1) }, key);
|
|
28
|
-
if (part.startsWith("_") && part.endsWith("_") && part.length > 2)
|
|
29
|
-
return /* @__PURE__ */ jsx("em", { children: part.slice(1, -1) }, key);
|
|
30
|
-
if (part.startsWith("`") && part.endsWith("`") && part.length > 2)
|
|
31
|
-
return /* @__PURE__ */ jsx("code", { children: part.slice(1, -1) }, key);
|
|
32
|
-
const link = LINK_TOKEN.exec(part);
|
|
33
|
-
const target = link?.[2];
|
|
34
|
-
const href = target ? resolveLinkHref(target) : void 0;
|
|
35
|
-
if (link && href)
|
|
36
|
-
return /* @__PURE__ */ jsx("a", { href, rel: "noopener noreferrer", target: "_blank", children: link[1] }, key);
|
|
37
|
-
return part;
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export {
|
|
42
|
-
renderInlineMarkdown
|
|
43
|
-
};
|
package/dist/chunk-TOOT6SZ2.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
mergeClassNames
|
|
3
|
-
} from "./chunk-3FG5NRTX.js";
|
|
4
|
-
|
|
5
|
-
// ../agent-ui/src/components/display-information/card/card.tsx
|
|
6
|
-
import { createContext, useContext } from "react";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
var CardVariantContext = createContext(void 0);
|
|
9
|
-
function CardVariantProvider({ children, variant }) {
|
|
10
|
-
return /* @__PURE__ */ jsx(CardVariantContext, { value: variant, children });
|
|
11
|
-
}
|
|
12
|
-
function Card({
|
|
13
|
-
actions,
|
|
14
|
-
children,
|
|
15
|
-
className,
|
|
16
|
-
"data-component-kind": componentKind,
|
|
17
|
-
description,
|
|
18
|
-
footer,
|
|
19
|
-
legend,
|
|
20
|
-
title,
|
|
21
|
-
variant
|
|
22
|
-
}) {
|
|
23
|
-
const inheritedVariant = useContext(CardVariantContext);
|
|
24
|
-
const hasHeader = title != null || description != null || legend != null || actions != null;
|
|
25
|
-
const resolvedVariant = inheritedVariant ?? variant ?? "surface";
|
|
26
|
-
return /* @__PURE__ */ jsxs(
|
|
27
|
-
"section",
|
|
28
|
-
{
|
|
29
|
-
className: mergeClassNames("aui-card", className),
|
|
30
|
-
"data-component-kind": componentKind,
|
|
31
|
-
"data-has-footer": footer != null,
|
|
32
|
-
"data-has-header": hasHeader,
|
|
33
|
-
"data-slot": "agent-ui-card",
|
|
34
|
-
"data-variant": resolvedVariant,
|
|
35
|
-
children: [
|
|
36
|
-
hasHeader ? /* @__PURE__ */ jsxs(
|
|
37
|
-
"header",
|
|
38
|
-
{
|
|
39
|
-
className: "aui-card__header",
|
|
40
|
-
"data-has-actions": actions != null,
|
|
41
|
-
"data-slot": "agent-ui-card-header",
|
|
42
|
-
children: [
|
|
43
|
-
/* @__PURE__ */ jsxs("span", { className: "aui-card__heading", "data-slot": "agent-ui-card-heading", children: [
|
|
44
|
-
title != null ? /* @__PURE__ */ jsx("span", { className: "aui-card__title", "data-slot": "agent-ui-card-title", children: title }) : null,
|
|
45
|
-
description != null ? /* @__PURE__ */ jsx("span", { className: "aui-card__description", "data-slot": "agent-ui-card-description", children: description }) : null
|
|
46
|
-
] }),
|
|
47
|
-
actions != null ? /* @__PURE__ */ jsx("span", { className: "aui-card__actions", "data-slot": "agent-ui-card-actions", children: actions }) : null,
|
|
48
|
-
legend
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
-
) : null,
|
|
52
|
-
/* @__PURE__ */ jsx("div", { className: "aui-card__content", "data-slot": "agent-ui-card-content", children }),
|
|
53
|
-
footer != null ? /* @__PURE__ */ jsx("footer", { className: "aui-card__footer", "data-slot": "agent-ui-card-footer", children: footer }) : null
|
|
54
|
-
]
|
|
55
|
-
}
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// ../agent-ui/src/utils/overlay-portal.ts
|
|
60
|
-
function resolveOverlayPortalContainer(node) {
|
|
61
|
-
if (!node) return void 0;
|
|
62
|
-
const overlayRoot = node.closest("[data-agent-overlay-root], dialog");
|
|
63
|
-
if (overlayRoot) {
|
|
64
|
-
return overlayRoot.querySelector("[data-agent-overlay-portal]") ?? overlayRoot;
|
|
65
|
-
}
|
|
66
|
-
const root = node.getRootNode();
|
|
67
|
-
return typeof ShadowRoot !== "undefined" && root instanceof ShadowRoot ? root : void 0;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export {
|
|
71
|
-
CardVariantProvider,
|
|
72
|
-
Card,
|
|
73
|
-
resolveOverlayPortalContainer
|
|
74
|
-
};
|
package/dist/chunk-UUPU3MYB.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// src/embed/composer-prompt-draft.ts
|
|
2
|
-
var AGENT_COMPOSER_DRAFT_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
3
|
-
function readAgentComposerPromptDraft(key, now = Date.now()) {
|
|
4
|
-
if (typeof window === "undefined") return "";
|
|
5
|
-
try {
|
|
6
|
-
const raw = window.localStorage.getItem(key);
|
|
7
|
-
if (!raw) return "";
|
|
8
|
-
const parsed = JSON.parse(raw);
|
|
9
|
-
const isFresh = typeof parsed.savedAt === "number" && now - parsed.savedAt <= AGENT_COMPOSER_DRAFT_MAX_AGE_MS;
|
|
10
|
-
if (!isFresh || typeof parsed.prompt !== "string" || !parsed.prompt.trim()) {
|
|
11
|
-
window.localStorage.removeItem(key);
|
|
12
|
-
return "";
|
|
13
|
-
}
|
|
14
|
-
return parsed.prompt;
|
|
15
|
-
} catch {
|
|
16
|
-
try {
|
|
17
|
-
window.localStorage.removeItem(key);
|
|
18
|
-
} catch {
|
|
19
|
-
}
|
|
20
|
-
return "";
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function saveAgentComposerPromptDraft(key, prompt, now = Date.now()) {
|
|
24
|
-
if (typeof window === "undefined") return;
|
|
25
|
-
try {
|
|
26
|
-
if (!prompt.trim()) {
|
|
27
|
-
window.localStorage.removeItem(key);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
window.localStorage.setItem(
|
|
31
|
-
key,
|
|
32
|
-
JSON.stringify({ prompt, savedAt: now })
|
|
33
|
-
);
|
|
34
|
-
} catch {
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export {
|
|
39
|
-
AGENT_COMPOSER_DRAFT_MAX_AGE_MS,
|
|
40
|
-
readAgentComposerPromptDraft,
|
|
41
|
-
saveAgentComposerPromptDraft
|
|
42
|
-
};
|
package/dist/chunk-VJA52U5P.js
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
// ../agent-ui/src/components/display-information/map/map-utils.ts
|
|
2
|
-
var MAX_MERCATOR_LATITUDE = 85.051129;
|
|
3
|
-
var TILE_SIZE = 256;
|
|
4
|
-
var TILE_RADIUS_X = 3;
|
|
5
|
-
var TILE_RADIUS_Y = 2;
|
|
6
|
-
function getMapSelectionCenter(locations, selectedLocationId, fallback) {
|
|
7
|
-
const selectedLocation = locations.find((location) => location.id === selectedLocationId);
|
|
8
|
-
return selectedLocation ? { latitude: selectedLocation.latitude, longitude: selectedLocation.longitude } : fallback;
|
|
9
|
-
}
|
|
10
|
-
function clamp(value, min, max) {
|
|
11
|
-
return Math.min(Math.max(value, min), max);
|
|
12
|
-
}
|
|
13
|
-
function project({ latitude, longitude }, zoom) {
|
|
14
|
-
const scale = TILE_SIZE * 2 ** zoom;
|
|
15
|
-
const clampedLatitude = clamp(latitude, -MAX_MERCATOR_LATITUDE, MAX_MERCATOR_LATITUDE);
|
|
16
|
-
const latitudeRadians = clampedLatitude * Math.PI / 180;
|
|
17
|
-
const sinLatitude = Math.sin(latitudeRadians);
|
|
18
|
-
return {
|
|
19
|
-
x: (longitude + 180) / 360 * scale,
|
|
20
|
-
y: (0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI)) * scale
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function wrapWorldDelta(delta, worldSize) {
|
|
24
|
-
if (delta > worldSize / 2) return delta - worldSize;
|
|
25
|
-
if (delta < -worldSize / 2) return delta + worldSize;
|
|
26
|
-
return delta;
|
|
27
|
-
}
|
|
28
|
-
function resolveLongitudeCenter(locations) {
|
|
29
|
-
if (locations.length === 1) return locations[0].longitude;
|
|
30
|
-
const longitudes = locations.map((location) => (location.longitude + 360) % 360).sort((first, second) => first - second);
|
|
31
|
-
let largestGap = -1;
|
|
32
|
-
let arcStart = longitudes[0];
|
|
33
|
-
for (let index = 0; index < longitudes.length; index += 1) {
|
|
34
|
-
const current = longitudes[index];
|
|
35
|
-
const next = index === longitudes.length - 1 ? longitudes[0] + 360 : longitudes[index + 1];
|
|
36
|
-
const gap = next - current;
|
|
37
|
-
if (gap > largestGap) {
|
|
38
|
-
largestGap = gap;
|
|
39
|
-
arcStart = next % 360;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
const center = (arcStart + (360 - largestGap) / 2) % 360;
|
|
43
|
-
return center > 180 ? center - 360 : center;
|
|
44
|
-
}
|
|
45
|
-
function resolveCenter(locations, center) {
|
|
46
|
-
if (center) return center;
|
|
47
|
-
let minLatitude = locations[0].latitude;
|
|
48
|
-
let maxLatitude = locations[0].latitude;
|
|
49
|
-
for (const location of locations.slice(1)) {
|
|
50
|
-
minLatitude = Math.min(minLatitude, location.latitude);
|
|
51
|
-
maxLatitude = Math.max(maxLatitude, location.latitude);
|
|
52
|
-
}
|
|
53
|
-
return {
|
|
54
|
-
latitude: (minLatitude + maxLatitude) / 2,
|
|
55
|
-
longitude: resolveLongitudeCenter(locations)
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function resolveZoom(locations, center, zoom, maximumZoom) {
|
|
59
|
-
if (zoom !== void 0) return clamp(zoom, 1, maximumZoom);
|
|
60
|
-
if (locations.length === 1) return Math.min(14, maximumZoom);
|
|
61
|
-
for (let candidate = Math.min(16, maximumZoom); candidate >= 2; candidate -= 1) {
|
|
62
|
-
const centerPoint = project(center, candidate);
|
|
63
|
-
const worldSize = TILE_SIZE * 2 ** candidate;
|
|
64
|
-
const first = project(locations[0], candidate);
|
|
65
|
-
const firstX = wrapWorldDelta(first.x - centerPoint.x, worldSize);
|
|
66
|
-
const firstY = first.y - centerPoint.y;
|
|
67
|
-
let minX = firstX;
|
|
68
|
-
let maxX = firstX;
|
|
69
|
-
let minY = firstY;
|
|
70
|
-
let maxY = firstY;
|
|
71
|
-
for (const location of locations.slice(1)) {
|
|
72
|
-
const point = project(location, candidate);
|
|
73
|
-
const pointX = wrapWorldDelta(point.x - centerPoint.x, worldSize);
|
|
74
|
-
const pointY = point.y - centerPoint.y;
|
|
75
|
-
minX = Math.min(minX, pointX);
|
|
76
|
-
maxX = Math.max(maxX, pointX);
|
|
77
|
-
minY = Math.min(minY, pointY);
|
|
78
|
-
maxY = Math.max(maxY, pointY);
|
|
79
|
-
}
|
|
80
|
-
if (maxX - minX <= 420 && maxY - minY <= 190) return candidate;
|
|
81
|
-
}
|
|
82
|
-
return Math.min(2, maximumZoom);
|
|
83
|
-
}
|
|
84
|
-
function createMapLayout(component, maximumZoom = 18) {
|
|
85
|
-
maximumZoom = Number.isFinite(maximumZoom) ? clamp(Math.floor(maximumZoom), 1, 18) : 18;
|
|
86
|
-
const center = resolveCenter(component.locations, component.viewport?.center);
|
|
87
|
-
const zoom = resolveZoom(component.locations, center, component.viewport?.zoom, maximumZoom);
|
|
88
|
-
const centerPoint = project(center, zoom);
|
|
89
|
-
const centerTileX = Math.floor(centerPoint.x / TILE_SIZE);
|
|
90
|
-
const centerTileY = Math.floor(centerPoint.y / TILE_SIZE);
|
|
91
|
-
const tileCount = 2 ** zoom;
|
|
92
|
-
const tiles = [];
|
|
93
|
-
for (let y = centerTileY - TILE_RADIUS_Y; y <= centerTileY + TILE_RADIUS_Y; y += 1) {
|
|
94
|
-
if (y < 0 || y >= tileCount) continue;
|
|
95
|
-
for (let x = centerTileX - TILE_RADIUS_X; x <= centerTileX + TILE_RADIUS_X; x += 1) {
|
|
96
|
-
const wrappedX = (x % tileCount + tileCount) % tileCount;
|
|
97
|
-
tiles.push({
|
|
98
|
-
key: `${zoom}-${x}-${y}`,
|
|
99
|
-
x: x * TILE_SIZE - centerPoint.x,
|
|
100
|
-
xIndex: wrappedX,
|
|
101
|
-
y: y * TILE_SIZE - centerPoint.y,
|
|
102
|
-
yIndex: y,
|
|
103
|
-
zoom
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return {
|
|
108
|
-
center,
|
|
109
|
-
points: component.locations.map((location) => {
|
|
110
|
-
const point = project(location, zoom);
|
|
111
|
-
const worldSize = TILE_SIZE * 2 ** zoom;
|
|
112
|
-
return {
|
|
113
|
-
id: location.id,
|
|
114
|
-
x: wrapWorldDelta(point.x - centerPoint.x, worldSize),
|
|
115
|
-
y: point.y - centerPoint.y
|
|
116
|
-
};
|
|
117
|
-
}),
|
|
118
|
-
tiles,
|
|
119
|
-
zoom
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
function getInitialMapLocationId(component) {
|
|
123
|
-
if (component.initialLocationId && component.locations.some((location) => location.id === component.initialLocationId)) {
|
|
124
|
-
return component.initialLocationId;
|
|
125
|
-
}
|
|
126
|
-
let best = component.locations[0];
|
|
127
|
-
for (const location of component.locations.slice(1)) {
|
|
128
|
-
if ((location.relevance ?? -1) > (best.relevance ?? -1)) best = location;
|
|
129
|
-
}
|
|
130
|
-
return best.id;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export {
|
|
134
|
-
getMapSelectionCenter,
|
|
135
|
-
createMapLayout,
|
|
136
|
-
getInitialMapLocationId
|
|
137
|
-
};
|