@nivaro/react 0.3.127 → 0.3.129
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/dist/components/slots/CommentsSlot.js +124 -95
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +29 -3
- package/dist/index.js +150 -147
- package/dist/shared/components/CollectionBrowserView.js +3259 -3211
- package/dist/shared/components/DataTable.js +406 -401
- package/dist/shared/components/ItemEditForm.js +4485 -4409
- package/dist/shared/components/MatrixEditor.js +548 -490
- package/dist/shared/components/MyWorkView.js +284 -274
- package/dist/shared/components/NotificationBell.js +264 -218
- package/dist/shared/components/RecordGridEditor.js +582 -472
- package/dist/shared/components/ai/AiMarkdown.js +215 -196
- package/dist/shared/components/chat/chat-core.js +331 -346
- package/dist/shared/components/chat/chat-typing.js +25 -0
- package/dist/shared/components/command-center/CommandCenterView.js +1 -1
- package/dist/shared/components/command-center/PeekPanel.js +8 -1
- package/dist/shared/components/command-center/api.js +17 -9
- package/dist/shared/components/command-center/panels/AttentionPanel.js +4 -1
- package/dist/shared/components/command-center/panels/PartnersPanel.js +2 -1
- package/dist/shared/components/item-edit/GroupSection.js +1 -1
- package/dist/shared/components/item-edit/HeaderTools.js +216 -210
- package/dist/shared/components/item-edit/InlineTableField.js +432 -429
- package/dist/shared/components/item-edit/RecordLiveSync.js +115 -108
- package/dist/shared/components/item-edit/RecordViewersChip.js +17 -16
- package/dist/shared/components/item-edit/RowComments.js +33 -30
- package/dist/shared/components/item-edit/cascade-clear-notice.js +30 -28
- package/dist/shared/components/item-edit/live-related.js +29 -16
- package/dist/shared/components/item-edit/record-opened-live.js +86 -0
- package/dist/shared/components/panels/CommentPanel.js +345 -327
- package/dist/shared/components/panels/OwnerOpenedLine.js +24 -23
- package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
- package/dist/shared/components/pipeline/TeamSuggestions.js +1 -1
- package/dist/shared/components/queue/QueueItemSheet.js +171 -130
- package/dist/shared/components/record-grid-guard.js +85 -0
- package/dist/shared/components/support/TicketDetailSheet.js +213 -174
- package/dist/shared/components/trackers/MirroredText.js +40 -0
- package/dist/shared/components/trackers/SourceTracker.js +168 -0
- package/dist/shared/components/trackers/TrackerChip.js +71 -0
- package/dist/shared/components/trackers/TrackerLinkPanel.js +1039 -0
- package/dist/shared/components/trackers/TrackerPickers.js +245 -0
- package/dist/shared/components/trackers/tracker-model.js +126 -0
- package/dist/shared/components/trackers/use-tracker-link.js +159 -0
- package/dist/shared/lib/at-risk-fields.js +14 -0
- package/dist/shared/lib/live-queries.js +9 -8
- package/dist/shared/lib/live-screen.js +77 -76
- package/dist/shared/lib/presence-hooks.js +190 -127
- package/dist/shared/lib/user-sync.js +78 -65
- package/dist/shared/lib/waiting-count.js +40 -29
- package/package.json +1 -1
|
@@ -1,334 +1,353 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { useOptionalNivaroClient as
|
|
4
|
-
import { useGlossary as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { AutolinkedText as
|
|
7
|
-
import { formatsFor as
|
|
8
|
-
import { useGlossaryHref as
|
|
9
|
-
function
|
|
1
|
+
import { jsx as a, jsxs as k } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as g, createContext as $, useState as O, useContext as S, Suspense as _, lazy as B } from "react";
|
|
3
|
+
import { useOptionalNivaroClient as I, useNavigation as P } from "../../context.js";
|
|
4
|
+
import { useGlossary as T, glossarySegments as j } from "../../lib/glossary.js";
|
|
5
|
+
import { cn as b } from "../../lib/utils.js";
|
|
6
|
+
import { AutolinkedText as E } from "../AutolinkedText.js";
|
|
7
|
+
import { formatsFor as K, rowsOfBlock as R, listOf as F, chartOf as H } from "./answer-formats.js";
|
|
8
|
+
import { useGlossaryHref as G, GlossaryMark as D } from "./GlossaryText.js";
|
|
9
|
+
function U(e) {
|
|
10
10
|
try {
|
|
11
|
-
const
|
|
12
|
-
return
|
|
11
|
+
const n = JSON.parse(e), s = n.type === "line" || n.type === "pie" ? n.type : "bar", t = Array.isArray(n.data) ? n.data.map((r) => ({ label: String((r == null ? void 0 : r.label) ?? ""), value: Number(r == null ? void 0 : r.value) })).filter((r) => r.label && Number.isFinite(r.value)).slice(0, 40) : [];
|
|
12
|
+
return t.length < 2 ? null : { type: s, title: typeof n.title == "string" ? n.title : void 0, data: t };
|
|
13
13
|
} catch {
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
const
|
|
18
|
-
function
|
|
19
|
-
return
|
|
17
|
+
const y = /^\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/;
|
|
18
|
+
function A(e) {
|
|
19
|
+
return e.trim().replace(/^\|/, "").replace(/\|$/, "").split("|").map((n) => n.trim());
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
return
|
|
23
|
-
`).flatMap((
|
|
24
|
-
const
|
|
25
|
-
return !
|
|
21
|
+
function z(e) {
|
|
22
|
+
return e.split(`
|
|
23
|
+
`).flatMap((n) => {
|
|
24
|
+
const s = n.trim();
|
|
25
|
+
return !s.startsWith("|") || !/\|\s*\|\s*[:-]{2,}/.test(s) && !/\|\s+\|\s*\S/.test(s) ? [n] : (s.match(/\|\s+\|/g) ?? []).length < 1 ? [n] : s.split(/\|\s+(?=\|)/).map((t) => t.trim().endsWith("|") ? t.trim() : `${t.trim()} |`);
|
|
26
26
|
}).join(`
|
|
27
27
|
`);
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
const
|
|
29
|
+
function C(e, n = {}) {
|
|
30
|
+
const s = n.charts !== !1, t = z(e.replace(/\r\n/g, `
|
|
31
31
|
`)).split(`
|
|
32
32
|
`), r = [];
|
|
33
|
-
let
|
|
34
|
-
const
|
|
35
|
-
|
|
33
|
+
let l = [];
|
|
34
|
+
const u = () => {
|
|
35
|
+
l.length && r.push({ kind: "p", text: l.join(" ") }), l = [];
|
|
36
36
|
};
|
|
37
|
-
for (let
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
for (
|
|
43
|
-
const
|
|
44
|
-
`),
|
|
45
|
-
r.push(
|
|
37
|
+
for (let i = 0; i < t.length; i++) {
|
|
38
|
+
const o = t[i].trim();
|
|
39
|
+
if (o.startsWith("```")) {
|
|
40
|
+
u();
|
|
41
|
+
const p = o.slice(3).trim().toLowerCase(), m = [];
|
|
42
|
+
for (i++; i < t.length && !t[i].trim().startsWith("```"); ) m.push(t[i++]);
|
|
43
|
+
const v = m.join(`
|
|
44
|
+
`), N = s && p === "chart" ? U(v) : null;
|
|
45
|
+
r.push(N ? { kind: "chart", spec: N } : { kind: "code", text: v });
|
|
46
46
|
continue;
|
|
47
47
|
}
|
|
48
|
-
if (
|
|
49
|
-
|
|
48
|
+
if (o === "") {
|
|
49
|
+
u();
|
|
50
50
|
continue;
|
|
51
51
|
}
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
|
|
52
|
+
const c = /^(#{1,4})\s+(.*)$/.exec(o);
|
|
53
|
+
if (c) {
|
|
54
|
+
u(), r.push({ kind: "h", level: c[1].length, text: c[2] });
|
|
55
55
|
continue;
|
|
56
56
|
}
|
|
57
|
-
if (
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
for (
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
if (o.startsWith("|") && i + 1 < t.length && y.test(t[i + 1].trim())) {
|
|
58
|
+
u();
|
|
59
|
+
const p = A(o), m = [];
|
|
60
|
+
for (i += 2; i < t.length && t[i].trim().startsWith("|"); )
|
|
61
|
+
y.test(t[i].trim()) || m.push(A(t[i])), i++;
|
|
62
|
+
i--, r.push({ kind: "table", header: p, rows: m });
|
|
63
63
|
continue;
|
|
64
64
|
}
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
for (;
|
|
70
|
-
const
|
|
71
|
-
if (!
|
|
72
|
-
|
|
65
|
+
const d = /^[-*•]\s+(.*)$/.exec(o);
|
|
66
|
+
if (d) {
|
|
67
|
+
u();
|
|
68
|
+
const p = [d[1]];
|
|
69
|
+
for (; i + 1 < t.length; ) {
|
|
70
|
+
const m = /^[-*•]\s+(.*)$/.exec(t[i + 1].trim());
|
|
71
|
+
if (!m) break;
|
|
72
|
+
p.push(m[1]), i++;
|
|
73
73
|
}
|
|
74
|
-
r.push({ kind: "ul", items:
|
|
74
|
+
r.push({ kind: "ul", items: p });
|
|
75
75
|
continue;
|
|
76
76
|
}
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
for (;
|
|
82
|
-
const
|
|
83
|
-
if (!
|
|
84
|
-
|
|
77
|
+
const x = /^\d+[.)]\s+(.*)$/.exec(o);
|
|
78
|
+
if (x) {
|
|
79
|
+
u();
|
|
80
|
+
const p = [x[1]];
|
|
81
|
+
for (; i + 1 < t.length; ) {
|
|
82
|
+
const m = /^\d+[.)]\s+(.*)$/.exec(t[i + 1].trim());
|
|
83
|
+
if (!m) break;
|
|
84
|
+
p.push(m[1]), i++;
|
|
85
85
|
}
|
|
86
|
-
r.push({ kind: "ol", items:
|
|
86
|
+
r.push({ kind: "ol", items: p });
|
|
87
87
|
continue;
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
l.push(o);
|
|
90
90
|
}
|
|
91
|
-
return
|
|
91
|
+
return u(), r;
|
|
92
92
|
}
|
|
93
|
-
const
|
|
94
|
-
function
|
|
95
|
-
const
|
|
96
|
-
let
|
|
97
|
-
const
|
|
98
|
-
if (!(
|
|
99
|
-
const
|
|
100
|
-
return
|
|
93
|
+
const J = /(\*\*[^*]+\*\*|`[^`]+`|\*[^*]+\*|\[[^\]]+\]\([^)]+\))/g;
|
|
94
|
+
function f(e, n = !1, s) {
|
|
95
|
+
const t = [];
|
|
96
|
+
let r = 0, l = 0;
|
|
97
|
+
const u = (h) => n ? /* @__PURE__ */ a(E, { text: h, plain: !0 }, l++) : h, i = (h) => {
|
|
98
|
+
if (!(s != null && s.terms.length)) return u(h);
|
|
99
|
+
const o = j(h, s.terms, { once: s.once });
|
|
100
|
+
return o.length === 1 && !o[0].term ? u(h) : o.map(
|
|
101
101
|
(c) => {
|
|
102
|
-
var
|
|
103
|
-
return c.term ? /* @__PURE__ */
|
|
102
|
+
var d;
|
|
103
|
+
return c.term ? /* @__PURE__ */ a(D, { term: c.term, href: (d = s.href) == null ? void 0 : d.call(s, c.term), children: c.text }, l++) : u(c.text);
|
|
104
104
|
}
|
|
105
105
|
);
|
|
106
106
|
};
|
|
107
|
-
for (const
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
const c =
|
|
111
|
-
if (c.startsWith("**"))
|
|
107
|
+
for (const h of e.matchAll(J)) {
|
|
108
|
+
const o = h.index ?? 0;
|
|
109
|
+
o > r && t.push(i(e.slice(r, o)));
|
|
110
|
+
const c = h[0];
|
|
111
|
+
if (c.startsWith("**")) t.push(/* @__PURE__ */ a("strong", { children: i(c.slice(2, -2)) }, l++));
|
|
112
112
|
else if (c.startsWith("`"))
|
|
113
|
-
|
|
114
|
-
/* @__PURE__ */
|
|
113
|
+
t.push(
|
|
114
|
+
/* @__PURE__ */ a(
|
|
115
115
|
"code",
|
|
116
116
|
{
|
|
117
117
|
className: "rounded bg-black/[0.06] px-1 py-px font-mono text-[0.92em] dark:bg-white/10",
|
|
118
118
|
children: c.slice(1, -1)
|
|
119
119
|
},
|
|
120
|
-
|
|
120
|
+
l++
|
|
121
121
|
)
|
|
122
122
|
);
|
|
123
123
|
else if (c.startsWith("[")) {
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
} else
|
|
127
|
-
|
|
124
|
+
const d = /^\[([^\]]+)\]\(([^)]+)\)$/.exec(c);
|
|
125
|
+
d && Q(d[2]) ? t.push(/* @__PURE__ */ a(Y, { href: d[2], label: d[1] }, l++)) : d && W(d[2]) ? t.push(/* @__PURE__ */ a(q, { href: d[2], label: d[1] }, l++)) : t.push(c);
|
|
126
|
+
} else t.push(/* @__PURE__ */ a("em", { children: c.slice(1, -1) }, l++));
|
|
127
|
+
r = o + c.length;
|
|
128
128
|
}
|
|
129
|
-
return
|
|
129
|
+
return r < e.length && t.push(i(e.slice(r))), t;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
if (!/^https?:\/\/\S+$/i.test(
|
|
131
|
+
function W(e) {
|
|
132
|
+
if (!/^https?:\/\/\S+$/i.test(e)) return null;
|
|
133
133
|
try {
|
|
134
|
-
const
|
|
135
|
-
return
|
|
134
|
+
const n = new URL(e);
|
|
135
|
+
return n.username || n.password ? null : n.hostname || null;
|
|
136
136
|
} catch {
|
|
137
137
|
return null;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
const
|
|
142
|
-
return /* @__PURE__ */
|
|
140
|
+
function q({ href: e, label: n }) {
|
|
141
|
+
const s = W(e) ?? "", t = n.trim() === e || n.trim() === s;
|
|
142
|
+
return /* @__PURE__ */ k(
|
|
143
143
|
"a",
|
|
144
144
|
{
|
|
145
|
-
href:
|
|
145
|
+
href: e,
|
|
146
146
|
"data-ai-link": "external",
|
|
147
147
|
className: "underline underline-offset-2",
|
|
148
148
|
target: "_blank",
|
|
149
149
|
rel: "noopener noreferrer nofollow",
|
|
150
|
-
"data-tip":
|
|
150
|
+
"data-tip": e,
|
|
151
151
|
children: [
|
|
152
|
-
|
|
153
|
-
!
|
|
152
|
+
t ? s : n,
|
|
153
|
+
!t && /* @__PURE__ */ k("span", { className: "ml-1 whitespace-nowrap text-[0.85em] opacity-70", children: [
|
|
154
154
|
"(",
|
|
155
|
-
|
|
155
|
+
s,
|
|
156
156
|
" ↗)"
|
|
157
157
|
] })
|
|
158
158
|
]
|
|
159
159
|
}
|
|
160
160
|
);
|
|
161
161
|
}
|
|
162
|
-
function
|
|
163
|
-
if (!/^\/(?![\\/])/.test(
|
|
164
|
-
for (let
|
|
165
|
-
const
|
|
166
|
-
if (
|
|
162
|
+
function Q(e) {
|
|
163
|
+
if (!/^\/(?![\\/])/.test(e)) return !1;
|
|
164
|
+
for (let n = 0; n < e.length; n++) {
|
|
165
|
+
const s = e.charCodeAt(n);
|
|
166
|
+
if (s <= 32 || s === 127 || s === 92) return !1;
|
|
167
167
|
}
|
|
168
168
|
return !0;
|
|
169
169
|
}
|
|
170
|
-
function
|
|
171
|
-
return
|
|
170
|
+
function V(e, n) {
|
|
171
|
+
return n && n !== "/help-videos" && /^\/help-videos(?=[?#/]|$)/.test(e) ? `${n}${e.slice(12)}` : e;
|
|
172
|
+
}
|
|
173
|
+
const L = $(!1);
|
|
174
|
+
function X(e) {
|
|
175
|
+
return e.replace(/!\[([^\]]*)\]\(([^)\s]+)\)/g, (n, s, t) => `[${s.replace(/[[\]]/g, "").trim() || "image"}](${t})`);
|
|
172
176
|
}
|
|
173
|
-
function
|
|
174
|
-
const
|
|
175
|
-
return /* @__PURE__ */
|
|
177
|
+
function Y({ href: e, label: n }) {
|
|
178
|
+
const s = S(L), t = P();
|
|
179
|
+
if (s) return /* @__PURE__ */ a("span", { "data-ai-link": "plain", children: n });
|
|
180
|
+
const r = V(e, t.helpVideosPath);
|
|
181
|
+
return /* @__PURE__ */ a(
|
|
176
182
|
"a",
|
|
177
183
|
{
|
|
178
|
-
href:
|
|
184
|
+
href: r,
|
|
179
185
|
"data-ai-link": "in-app",
|
|
180
186
|
className: "underline underline-offset-2",
|
|
181
|
-
onClick: (
|
|
182
|
-
|
|
187
|
+
onClick: (l) => {
|
|
188
|
+
l.defaultPrevented || l.button !== 0 || l.metaKey || l.ctrlKey || l.shiftKey || l.altKey || (l.preventDefault(), t.navigate(r));
|
|
183
189
|
},
|
|
184
|
-
children:
|
|
190
|
+
children: n
|
|
185
191
|
}
|
|
186
192
|
);
|
|
187
193
|
}
|
|
188
|
-
function
|
|
189
|
-
header:
|
|
190
|
-
rows:
|
|
191
|
-
autolink:
|
|
194
|
+
function Z({
|
|
195
|
+
header: e,
|
|
196
|
+
rows: n,
|
|
197
|
+
autolink: s
|
|
192
198
|
}) {
|
|
193
|
-
const
|
|
194
|
-
return /* @__PURE__ */
|
|
195
|
-
/* @__PURE__ */
|
|
199
|
+
const t = e.length;
|
|
200
|
+
return /* @__PURE__ */ k("div", { "data-ai-table": !0, className: "my-1.5", children: [
|
|
201
|
+
/* @__PURE__ */ a("ul", { className: "flex flex-col gap-1.5 sm:hidden", children: n.map((r, l) => (
|
|
196
202
|
// biome-ignore lint/suspicious/noArrayIndexKey: static content
|
|
197
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ k(
|
|
198
204
|
"li",
|
|
199
205
|
{
|
|
200
206
|
className: "rounded-lg border border-black/10 bg-background/60 px-2.5 py-2 dark:border-white/10",
|
|
201
207
|
children: [
|
|
202
|
-
/* @__PURE__ */
|
|
203
|
-
|
|
204
|
-
(
|
|
208
|
+
/* @__PURE__ */ a("div", { className: "font-semibold leading-snug", children: f(r[0] ?? "", s) }),
|
|
209
|
+
r.slice(1, t).map(
|
|
210
|
+
(u, i) => u ? (
|
|
205
211
|
// biome-ignore lint/suspicious/noArrayIndexKey: static content
|
|
206
|
-
/* @__PURE__ */
|
|
212
|
+
/* @__PURE__ */ k(
|
|
207
213
|
"div",
|
|
208
214
|
{
|
|
209
215
|
className: "mt-1 grid grid-cols-[minmax(0,34%)_1fr] gap-2 text-[0.94em] leading-snug",
|
|
210
216
|
children: [
|
|
211
|
-
/* @__PURE__ */
|
|
212
|
-
/* @__PURE__ */
|
|
217
|
+
/* @__PURE__ */ a("span", { className: "text-muted-foreground", children: e[i + 1] }),
|
|
218
|
+
/* @__PURE__ */ a("span", { className: "min-w-0 break-words", children: f(u, s) })
|
|
213
219
|
]
|
|
214
220
|
},
|
|
215
|
-
|
|
221
|
+
i
|
|
216
222
|
)
|
|
217
223
|
) : null
|
|
218
224
|
)
|
|
219
225
|
]
|
|
220
226
|
},
|
|
221
|
-
|
|
227
|
+
l
|
|
222
228
|
)
|
|
223
229
|
)) }),
|
|
224
|
-
/* @__PURE__ */
|
|
225
|
-
/* @__PURE__ */
|
|
230
|
+
/* @__PURE__ */ a("div", { className: "hidden overflow-x-auto sm:block", children: /* @__PURE__ */ k("table", { className: "w-auto min-w-[50%] text-left", children: [
|
|
231
|
+
/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ a("tr", { className: "border-b border-black/10 text-[0.85em] uppercase tracking-wide text-muted-foreground dark:border-white/10", children: e.map((r, l) => (
|
|
226
232
|
// biome-ignore lint/suspicious/noArrayIndexKey: static content
|
|
227
|
-
/* @__PURE__ */
|
|
233
|
+
/* @__PURE__ */ a("th", { className: "py-1 pr-4 font-medium", children: f(r) }, l)
|
|
228
234
|
)) }) }),
|
|
229
|
-
/* @__PURE__ */
|
|
235
|
+
/* @__PURE__ */ a("tbody", { className: "divide-y divide-black/5 dark:divide-white/10", children: n.map((r, l) => (
|
|
230
236
|
// biome-ignore lint/suspicious/noArrayIndexKey: static content
|
|
231
|
-
/* @__PURE__ */
|
|
237
|
+
/* @__PURE__ */ a("tr", { className: "align-top", children: e.map((u, i) => (
|
|
232
238
|
// biome-ignore lint/suspicious/noArrayIndexKey: static content
|
|
233
|
-
/* @__PURE__ */
|
|
234
|
-
)) },
|
|
239
|
+
/* @__PURE__ */ a("td", { className: "max-w-[28rem] py-1 pr-4", children: f(r[i] ?? "", s) }, i)
|
|
240
|
+
)) }, l)
|
|
235
241
|
)) })
|
|
236
242
|
] }) })
|
|
237
243
|
] });
|
|
238
244
|
}
|
|
239
|
-
const
|
|
240
|
-
function
|
|
241
|
-
const
|
|
242
|
-
return /* @__PURE__ */
|
|
243
|
-
|
|
245
|
+
const ee = B(() => import("./AiChart.js").then((e) => ({ default: e.AiChart })));
|
|
246
|
+
function te({ spec: e }) {
|
|
247
|
+
const n = S(M);
|
|
248
|
+
return /* @__PURE__ */ a(
|
|
249
|
+
_,
|
|
244
250
|
{
|
|
245
|
-
fallback: /* @__PURE__ */
|
|
251
|
+
fallback: /* @__PURE__ */ a(
|
|
246
252
|
"div",
|
|
247
253
|
{
|
|
248
254
|
"data-ai-chart-loading": !0,
|
|
249
255
|
className: "my-2 w-full",
|
|
250
|
-
style: { height:
|
|
256
|
+
style: { height: e.type === "pie" ? 220 : 200 }
|
|
251
257
|
}
|
|
252
258
|
),
|
|
253
|
-
children: /* @__PURE__ */
|
|
259
|
+
children: /* @__PURE__ */ a(ee, { spec: e, onPoint: n })
|
|
254
260
|
}
|
|
255
261
|
);
|
|
256
262
|
}
|
|
257
|
-
function
|
|
258
|
-
switch (
|
|
263
|
+
function w({ b: e, link: n, gl: s }) {
|
|
264
|
+
switch (e.kind) {
|
|
259
265
|
case "h":
|
|
260
|
-
return /* @__PURE__ */
|
|
266
|
+
return /* @__PURE__ */ a("p", { className: b("font-semibold", e.level <= 2 ? "text-[1.05em]" : ""), children: f(e.text, n, s) });
|
|
261
267
|
case "ul":
|
|
262
|
-
return /* @__PURE__ */
|
|
268
|
+
return /* @__PURE__ */ a("ul", { className: "list-disc space-y-0.5 pl-5", children: e.items.map((t, r) => (
|
|
263
269
|
// biome-ignore lint/suspicious/noArrayIndexKey: static content
|
|
264
|
-
/* @__PURE__ */
|
|
270
|
+
/* @__PURE__ */ a("li", { children: f(t, n, s) }, r)
|
|
265
271
|
)) });
|
|
266
272
|
case "ol":
|
|
267
|
-
return /* @__PURE__ */
|
|
273
|
+
return /* @__PURE__ */ a("ol", { className: "list-decimal space-y-0.5 pl-5", children: e.items.map((t, r) => (
|
|
268
274
|
// biome-ignore lint/suspicious/noArrayIndexKey: static content
|
|
269
|
-
/* @__PURE__ */
|
|
275
|
+
/* @__PURE__ */ a("li", { children: f(t, n, s) }, r)
|
|
270
276
|
)) });
|
|
271
277
|
case "code":
|
|
272
|
-
return /* @__PURE__ */
|
|
278
|
+
return /* @__PURE__ */ a("pre", { className: "overflow-x-auto rounded-md bg-black/[0.05] p-2 font-mono text-[0.9em] dark:bg-white/10", children: e.text });
|
|
273
279
|
case "table":
|
|
274
|
-
return /* @__PURE__ */
|
|
280
|
+
return /* @__PURE__ */ a(Z, { header: e.header, rows: e.rows, autolink: n });
|
|
275
281
|
case "chart":
|
|
276
|
-
return /* @__PURE__ */
|
|
282
|
+
return /* @__PURE__ */ a(te, { spec: e.spec });
|
|
277
283
|
default:
|
|
278
|
-
return /* @__PURE__ */
|
|
284
|
+
return /* @__PURE__ */ a("p", { children: f(e.text, n, s) });
|
|
279
285
|
}
|
|
280
286
|
}
|
|
281
|
-
const
|
|
282
|
-
function
|
|
283
|
-
const
|
|
284
|
-
if (
|
|
285
|
-
const
|
|
286
|
-
if (!
|
|
287
|
-
if (
|
|
288
|
-
if (
|
|
289
|
-
const
|
|
290
|
-
return
|
|
291
|
-
}, [
|
|
292
|
-
return
|
|
293
|
-
/* @__PURE__ */
|
|
287
|
+
const ne = { table: "Table", chart: "Chart", list: "List" };
|
|
288
|
+
function re({ b: e, link: n, gl: s }) {
|
|
289
|
+
const t = g(() => K(e), [e]), [r, l] = O(t[0]), u = g(() => {
|
|
290
|
+
if (r === t[0]) return e;
|
|
291
|
+
const i = R(e);
|
|
292
|
+
if (!i) return e;
|
|
293
|
+
if (r === "table") return { kind: "table", header: i.header, rows: i.rows };
|
|
294
|
+
if (r === "list") return { kind: "ul", items: F(i) };
|
|
295
|
+
const h = H(i);
|
|
296
|
+
return h ? { kind: "chart", spec: h } : e;
|
|
297
|
+
}, [e, r, t]);
|
|
298
|
+
return t.length < 2 ? /* @__PURE__ */ a(w, { b: e, link: n, gl: s }) : /* @__PURE__ */ k("div", { "data-ai-switchable": r, children: [
|
|
299
|
+
/* @__PURE__ */ a("fieldset", { className: "mb-0.5 flex min-w-0 justify-end gap-0.5", "aria-label": "Show as", children: t.map((i) => /* @__PURE__ */ a(
|
|
294
300
|
"button",
|
|
295
301
|
{
|
|
296
302
|
type: "button",
|
|
297
|
-
onClick: () =>
|
|
298
|
-
"aria-pressed":
|
|
299
|
-
"data-ai-format":
|
|
300
|
-
className:
|
|
303
|
+
onClick: () => l(i),
|
|
304
|
+
"aria-pressed": i === r,
|
|
305
|
+
"data-ai-format": i,
|
|
306
|
+
className: b(
|
|
301
307
|
"rounded px-1.5 py-px text-[10.5px] font-medium transition-colors",
|
|
302
|
-
|
|
308
|
+
i === r ? "bg-accent text-foreground" : "text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
303
309
|
),
|
|
304
|
-
children:
|
|
310
|
+
children: ne[i]
|
|
305
311
|
},
|
|
306
|
-
|
|
312
|
+
i
|
|
307
313
|
)) }),
|
|
308
|
-
/* @__PURE__ */
|
|
314
|
+
/* @__PURE__ */ a(w, { b: u, link: n, gl: s })
|
|
309
315
|
] });
|
|
310
316
|
}
|
|
311
|
-
const
|
|
312
|
-
function
|
|
313
|
-
content:
|
|
314
|
-
className:
|
|
315
|
-
autolink:
|
|
316
|
-
switchable:
|
|
317
|
-
onChartPoint:
|
|
317
|
+
const M = $(void 0);
|
|
318
|
+
function me({
|
|
319
|
+
content: e,
|
|
320
|
+
className: n,
|
|
321
|
+
autolink: s,
|
|
322
|
+
switchable: t,
|
|
323
|
+
onChartPoint: r,
|
|
324
|
+
mirrored: l
|
|
318
325
|
}) {
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
326
|
+
const u = g(
|
|
327
|
+
() => l ? C(X(e), { charts: !1 }) : C(e),
|
|
328
|
+
[e, l]
|
|
329
|
+
), i = I(), h = l ? !1 : s ?? i != null, o = T(), c = G(), d = o.length ? { terms: o, once: /* @__PURE__ */ new Set(), href: c } : void 0;
|
|
330
|
+
return /* @__PURE__ */ a(L.Provider, { value: !!l, children: /* @__PURE__ */ a(M.Provider, { value: r, children: /* @__PURE__ */ a(
|
|
331
|
+
"div",
|
|
332
|
+
{
|
|
333
|
+
"data-ai-markdown": !0,
|
|
334
|
+
"data-ai-mirrored": l ? "" : void 0,
|
|
335
|
+
className: b("space-y-1.5 [&_strong]:font-semibold", n),
|
|
336
|
+
children: u.map((x, p) => {
|
|
337
|
+
const m = `${x.kind}-${p}`;
|
|
338
|
+
return t && !l && ie.has(x.kind) ? /* @__PURE__ */ a(re, { b: x, link: h, gl: d }, m) : /* @__PURE__ */ a(w, { b: x, link: h, gl: d }, m);
|
|
339
|
+
})
|
|
340
|
+
}
|
|
341
|
+
) }) });
|
|
324
342
|
}
|
|
325
|
-
const
|
|
343
|
+
const ie = /* @__PURE__ */ new Set(["table", "chart", "ul", "ol"]);
|
|
326
344
|
export {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
345
|
+
me as AiMarkdown,
|
|
346
|
+
W as externalHost,
|
|
347
|
+
V as inAppHref,
|
|
348
|
+
Q as isSafeAppPath,
|
|
349
|
+
X as mirroredMarkdown,
|
|
350
|
+
C as parseAiMarkdown,
|
|
351
|
+
U as parseChartSpec,
|
|
352
|
+
f as renderInline
|
|
334
353
|
};
|