@photon-ai/pho-ui 4.8.0 → 4.9.1
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/chunks/bar-chart-Metal1Vu.js +19 -0
- package/dist/chunks/bar-chart-Metal1Vu.js.map +1 -0
- package/dist/chunks/{basic-page-BqfpJgAj.js → basic-page-DzT8yecB.js} +176 -175
- package/dist/chunks/basic-page-DzT8yecB.js.map +1 -0
- package/dist/chunks/chart-D4jJKeh2.js +1338 -0
- package/dist/chunks/chart-D4jJKeh2.js.map +1 -0
- package/dist/chunks/code-block-CbcE994O.js +516 -0
- package/dist/chunks/code-block-CbcE994O.js.map +1 -0
- package/dist/chunks/line-chart-3zH_lhTW.js +22 -0
- package/dist/chunks/line-chart-3zH_lhTW.js.map +1 -0
- package/dist/components/bar-chart.js +1 -1
- package/dist/components/chart.js +8 -5
- package/dist/components/code-block.js +12 -3
- package/dist/components/line-chart.js +1 -1
- package/dist/index.js +175 -162
- package/dist/motion.js +14 -13
- package/dist/motion.js.map +1 -1
- package/dist/primitives.js +1 -1
- package/dist/sections/basic-page.js +1 -1
- package/dist/src/components/bar-chart/bar-chart.d.ts +9 -1
- package/dist/src/components/chart/chart.d.ts +25 -0
- package/dist/src/components/chart/format.d.ts +9 -5
- package/dist/src/components/chart/index.d.ts +7 -4
- package/dist/src/components/chart/scale.d.ts +2 -2
- package/dist/src/components/chart/shell.d.ts +20 -13
- package/dist/src/components/chart/skeleton.d.ts +11 -0
- package/dist/src/components/chart/theme.d.ts +8 -0
- package/dist/src/components/chart/types.d.ts +39 -2
- package/dist/src/components/chart/use-measure.d.ts +2 -1
- package/dist/src/components/code-block/code-block.d.ts +23 -11
- package/dist/src/components/code-block/highlight.d.ts +24 -0
- package/dist/src/components/code-block/index.d.ts +4 -1
- package/dist/src/components/code-block/languages.d.ts +64 -0
- package/dist/src/components/code-block/pho-theme.d.ts +18 -0
- package/dist/src/components/code-block/tokens.d.ts +14 -0
- package/dist/src/components/line-chart/line-chart.d.ts +12 -3
- package/dist/src/motion/index.d.ts +6 -0
- package/dist/src/sections/basic-page/basic-page.d.ts +2 -0
- package/package.json +4 -1
- package/src/styles/theme.css +17 -4
- package/dist/chunks/IconArrowsMinimize-BfPUGuCB.js +0 -75
- package/dist/chunks/IconArrowsMinimize-BfPUGuCB.js.map +0 -1
- package/dist/chunks/bar-chart-DIALC2_z.js +0 -190
- package/dist/chunks/bar-chart-DIALC2_z.js.map +0 -1
- package/dist/chunks/basic-page-BqfpJgAj.js.map +0 -1
- package/dist/chunks/code-block-BuFfh0zH.js +0 -197
- package/dist/chunks/code-block-BuFfh0zH.js.map +0 -1
- package/dist/chunks/legend-C0mU7dqd.js +0 -60
- package/dist/chunks/legend-C0mU7dqd.js.map +0 -1
- package/dist/chunks/line-chart-VuMYKzW3.js +0 -453
- package/dist/chunks/line-chart-VuMYKzW3.js.map +0 -1
- package/dist/chunks/use-measure-C-i54AC6.js +0 -629
- package/dist/chunks/use-measure-C-i54AC6.js.map +0 -1
- package/dist/src/components/chart/axes.d.ts +0 -22
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as _ } from "./cn-ChIgwEl3.js";
|
|
3
|
+
import { a as de } from "./button-C9VqBBIr.js";
|
|
4
|
+
import { t as z } from "./createReactComponent-BqCmnqfX.js";
|
|
5
|
+
import { t as me } from "./IconChevronDown-CZilB71T.js";
|
|
6
|
+
import { t as he } from "./IconChevronUp-CrpWSgIl.js";
|
|
7
|
+
import { n as fe } from "./copy-button-D8XyP0oR.js";
|
|
8
|
+
import { t as d } from "./scroll-area-DSwD9th7.js";
|
|
9
|
+
import { n as ye } from "./toggle-o84tawXy.js";
|
|
10
|
+
import { t as g } from "./tooltip-BTF7GChl.js";
|
|
11
|
+
import { useEffect as ge, useMemo as H, useState as F, useSyncExternalStore as xe } from "react";
|
|
12
|
+
import { Fragment as ve, jsx as o, jsxs as m } from "react/jsx-runtime";
|
|
13
|
+
var we = [
|
|
14
|
+
["path", {
|
|
15
|
+
d: "M16 4l4 0l0 4",
|
|
16
|
+
key: "svg-0"
|
|
17
|
+
}],
|
|
18
|
+
["path", {
|
|
19
|
+
d: "M14 10l6 -6",
|
|
20
|
+
key: "svg-1"
|
|
21
|
+
}],
|
|
22
|
+
["path", {
|
|
23
|
+
d: "M8 20l-4 0l0 -4",
|
|
24
|
+
key: "svg-2"
|
|
25
|
+
}],
|
|
26
|
+
["path", {
|
|
27
|
+
d: "M4 20l6 -6",
|
|
28
|
+
key: "svg-3"
|
|
29
|
+
}],
|
|
30
|
+
["path", {
|
|
31
|
+
d: "M16 20l4 0l0 -4",
|
|
32
|
+
key: "svg-4"
|
|
33
|
+
}],
|
|
34
|
+
["path", {
|
|
35
|
+
d: "M14 14l6 6",
|
|
36
|
+
key: "svg-5"
|
|
37
|
+
}],
|
|
38
|
+
["path", {
|
|
39
|
+
d: "M8 4l-4 0l0 4",
|
|
40
|
+
key: "svg-6"
|
|
41
|
+
}],
|
|
42
|
+
["path", {
|
|
43
|
+
d: "M4 4l6 6",
|
|
44
|
+
key: "svg-7"
|
|
45
|
+
}]
|
|
46
|
+
], ke = z("outline", "arrows-maximize", "ArrowsMaximize", we), be = [
|
|
47
|
+
["path", {
|
|
48
|
+
d: "M5 9l4 0l0 -4",
|
|
49
|
+
key: "svg-0"
|
|
50
|
+
}],
|
|
51
|
+
["path", {
|
|
52
|
+
d: "M3 3l6 6",
|
|
53
|
+
key: "svg-1"
|
|
54
|
+
}],
|
|
55
|
+
["path", {
|
|
56
|
+
d: "M5 15l4 0l0 4",
|
|
57
|
+
key: "svg-2"
|
|
58
|
+
}],
|
|
59
|
+
["path", {
|
|
60
|
+
d: "M3 21l6 -6",
|
|
61
|
+
key: "svg-3"
|
|
62
|
+
}],
|
|
63
|
+
["path", {
|
|
64
|
+
d: "M19 9l-4 0l0 -4",
|
|
65
|
+
key: "svg-4"
|
|
66
|
+
}],
|
|
67
|
+
["path", {
|
|
68
|
+
d: "M15 9l6 -6",
|
|
69
|
+
key: "svg-5"
|
|
70
|
+
}],
|
|
71
|
+
["path", {
|
|
72
|
+
d: "M19 15l-4 0l0 4",
|
|
73
|
+
key: "svg-6"
|
|
74
|
+
}],
|
|
75
|
+
["path", {
|
|
76
|
+
d: "M15 15l6 6",
|
|
77
|
+
key: "svg-7"
|
|
78
|
+
}]
|
|
79
|
+
], Me = z("outline", "arrows-minimize", "ArrowsMinimize", be), Ce = [
|
|
80
|
+
["path", {
|
|
81
|
+
d: "M4 6l16 0",
|
|
82
|
+
key: "svg-0"
|
|
83
|
+
}],
|
|
84
|
+
["path", {
|
|
85
|
+
d: "M4 18l5 0",
|
|
86
|
+
key: "svg-1"
|
|
87
|
+
}],
|
|
88
|
+
["path", {
|
|
89
|
+
d: "M4 12h13a3 3 0 0 1 0 6h-4l2 -2m0 4l-2 -2",
|
|
90
|
+
key: "svg-2"
|
|
91
|
+
}]
|
|
92
|
+
], Ne = z("outline", "text-wrap", "TextWrap", Ce), V = {
|
|
93
|
+
json: () => import("@shikijs/langs/json"),
|
|
94
|
+
jsonc: () => import("@shikijs/langs/jsonc"),
|
|
95
|
+
javascript: () => import("@shikijs/langs/javascript"),
|
|
96
|
+
typescript: () => import("@shikijs/langs/typescript"),
|
|
97
|
+
jsx: () => import("@shikijs/langs/jsx"),
|
|
98
|
+
tsx: () => import("@shikijs/langs/tsx"),
|
|
99
|
+
shellscript: () => import("@shikijs/langs/shellscript"),
|
|
100
|
+
python: () => import("@shikijs/langs/python"),
|
|
101
|
+
swift: () => import("@shikijs/langs/swift"),
|
|
102
|
+
go: () => import("@shikijs/langs/go"),
|
|
103
|
+
ruby: () => import("@shikijs/langs/ruby"),
|
|
104
|
+
php: () => import("@shikijs/langs/php"),
|
|
105
|
+
java: () => import("@shikijs/langs/java"),
|
|
106
|
+
kotlin: () => import("@shikijs/langs/kotlin"),
|
|
107
|
+
csharp: () => import("@shikijs/langs/csharp"),
|
|
108
|
+
rust: () => import("@shikijs/langs/rust"),
|
|
109
|
+
html: () => import("@shikijs/langs/html"),
|
|
110
|
+
css: () => import("@shikijs/langs/css"),
|
|
111
|
+
xml: () => import("@shikijs/langs/xml"),
|
|
112
|
+
yaml: () => import("@shikijs/langs/yaml"),
|
|
113
|
+
toml: () => import("@shikijs/langs/toml"),
|
|
114
|
+
dotenv: () => import("@shikijs/langs/dotenv"),
|
|
115
|
+
sql: () => import("@shikijs/langs/sql"),
|
|
116
|
+
graphql: () => import("@shikijs/langs/graphql"),
|
|
117
|
+
http: () => import("@shikijs/langs/http"),
|
|
118
|
+
markdown: () => import("@shikijs/langs/markdown"),
|
|
119
|
+
diff: () => import("@shikijs/langs/diff")
|
|
120
|
+
}, K = {
|
|
121
|
+
js: "javascript",
|
|
122
|
+
ts: "typescript",
|
|
123
|
+
bash: "shellscript",
|
|
124
|
+
sh: "shellscript",
|
|
125
|
+
shell: "shellscript",
|
|
126
|
+
zsh: "shellscript",
|
|
127
|
+
py: "python",
|
|
128
|
+
rb: "ruby",
|
|
129
|
+
kt: "kotlin",
|
|
130
|
+
cs: "csharp",
|
|
131
|
+
rs: "rust",
|
|
132
|
+
yml: "yaml",
|
|
133
|
+
md: "markdown",
|
|
134
|
+
htm: "html"
|
|
135
|
+
};
|
|
136
|
+
function v(e) {
|
|
137
|
+
return Object.hasOwn(K, e) ? K[e] : Object.hasOwn(V, e) ? e : null;
|
|
138
|
+
}
|
|
139
|
+
var Y = {
|
|
140
|
+
key: "text-pho-code-key",
|
|
141
|
+
string: "text-pho-code-string",
|
|
142
|
+
number: "text-pho-code-number",
|
|
143
|
+
keyword: "text-pho-code-keyword",
|
|
144
|
+
punctuation: "text-pho-code-punctuation",
|
|
145
|
+
comment: "text-pho-code-comment",
|
|
146
|
+
function: "text-pho-code-function",
|
|
147
|
+
type: "text-pho-code-type",
|
|
148
|
+
plain: void 0
|
|
149
|
+
};
|
|
150
|
+
function Se(e) {
|
|
151
|
+
return `var(--color-pho-code-${e})`;
|
|
152
|
+
}
|
|
153
|
+
function Te(e) {
|
|
154
|
+
const t = e?.match(/^var\(--color-pho-code-([a-z]+)\)$/)?.[1];
|
|
155
|
+
return t != null && t in Y && t !== "plain" ? t : "plain";
|
|
156
|
+
}
|
|
157
|
+
var s = (e, t) => ({
|
|
158
|
+
scope: t,
|
|
159
|
+
settings: { foreground: e === "plain" ? "var(--color-pho-code-fg)" : Se(e) }
|
|
160
|
+
}), Ee = {
|
|
161
|
+
name: "pho",
|
|
162
|
+
type: "light",
|
|
163
|
+
fg: "var(--color-pho-code-fg)",
|
|
164
|
+
bg: "var(--color-pho-code-bg)",
|
|
165
|
+
settings: [
|
|
166
|
+
s("comment", ["comment", "punctuation.definition.comment"]),
|
|
167
|
+
s("string", [
|
|
168
|
+
"string",
|
|
169
|
+
"markup.inserted",
|
|
170
|
+
"meta.diff.header.to-file",
|
|
171
|
+
"punctuation.definition.inserted"
|
|
172
|
+
]),
|
|
173
|
+
s("plain", ["meta.template.expression", "meta.embedded"]),
|
|
174
|
+
s("key", [
|
|
175
|
+
"support.type.property-name",
|
|
176
|
+
"meta.object-literal.key",
|
|
177
|
+
"entity.other.attribute-name",
|
|
178
|
+
"entity.name.tag.yaml",
|
|
179
|
+
"keyword.key.toml",
|
|
180
|
+
"variable.other.env"
|
|
181
|
+
]),
|
|
182
|
+
s("number", [
|
|
183
|
+
"constant.numeric",
|
|
184
|
+
"markup.deleted",
|
|
185
|
+
"meta.diff.header.from-file",
|
|
186
|
+
"punctuation.definition.deleted"
|
|
187
|
+
]),
|
|
188
|
+
s("keyword", [
|
|
189
|
+
"keyword",
|
|
190
|
+
"storage",
|
|
191
|
+
"constant.language",
|
|
192
|
+
"variable.language"
|
|
193
|
+
]),
|
|
194
|
+
s("plain", ["keyword.operator"]),
|
|
195
|
+
s("keyword", [
|
|
196
|
+
"keyword.operator.expression",
|
|
197
|
+
"keyword.operator.new",
|
|
198
|
+
"keyword.operator.logical.python",
|
|
199
|
+
"keyword.operator.wordlike"
|
|
200
|
+
]),
|
|
201
|
+
s("function", [
|
|
202
|
+
"entity.name.function",
|
|
203
|
+
"support.function",
|
|
204
|
+
"entity.name.command",
|
|
205
|
+
"meta.function-call.generic"
|
|
206
|
+
]),
|
|
207
|
+
s("type", [
|
|
208
|
+
"entity.name.type",
|
|
209
|
+
"entity.name.class",
|
|
210
|
+
"entity.name.tag",
|
|
211
|
+
"entity.other.inherited-class",
|
|
212
|
+
"support.type",
|
|
213
|
+
"support.class",
|
|
214
|
+
"storage.type.primitive"
|
|
215
|
+
]),
|
|
216
|
+
s("key", ["support.type.property-name"]),
|
|
217
|
+
s("punctuation", [
|
|
218
|
+
"punctuation.separator",
|
|
219
|
+
"punctuation.terminator",
|
|
220
|
+
"punctuation.accessor",
|
|
221
|
+
"punctuation.section",
|
|
222
|
+
"punctuation.definition.array",
|
|
223
|
+
"punctuation.definition.dictionary",
|
|
224
|
+
"punctuation.definition.block",
|
|
225
|
+
"punctuation.definition.parameters",
|
|
226
|
+
"punctuation.definition.arguments",
|
|
227
|
+
"punctuation.definition.tag",
|
|
228
|
+
"punctuation.definition.typeparameters",
|
|
229
|
+
"meta.brace"
|
|
230
|
+
])
|
|
231
|
+
]
|
|
232
|
+
}, C = null, U = null, N = /* @__PURE__ */ new Set(), T = /* @__PURE__ */ new Map();
|
|
233
|
+
function _e() {
|
|
234
|
+
return U ??= Promise.all([import("shiki/core"), import("shiki/engine/javascript")]).then(([{ createHighlighterCore: e }, { createJavaScriptRegexEngine: t }]) => e({
|
|
235
|
+
themes: [Ee],
|
|
236
|
+
langs: [],
|
|
237
|
+
engine: t({ forgiving: !0 })
|
|
238
|
+
})).then((e) => (C = e, e)), U;
|
|
239
|
+
}
|
|
240
|
+
function Ae(e) {
|
|
241
|
+
const t = v(e);
|
|
242
|
+
if (t == null || N.has(t)) return Promise.resolve();
|
|
243
|
+
let n = T.get(t);
|
|
244
|
+
return n == null && (n = Promise.all([_e(), V[t]()]).then(([r, a]) => r.loadLanguage(...a.default)).then(() => {
|
|
245
|
+
N.add(t);
|
|
246
|
+
}).finally(() => {
|
|
247
|
+
T.delete(t);
|
|
248
|
+
}), T.set(t, n)), n;
|
|
249
|
+
}
|
|
250
|
+
function ot(e) {
|
|
251
|
+
const t = v(e);
|
|
252
|
+
return t != null && C != null && N.has(t);
|
|
253
|
+
}
|
|
254
|
+
function Oe(e) {
|
|
255
|
+
return e.map((t) => {
|
|
256
|
+
const n = [];
|
|
257
|
+
for (const r of t) {
|
|
258
|
+
const a = Te(r.color), i = n[n.length - 1];
|
|
259
|
+
i != null && i.type === a ? i.text += r.content : n.push({
|
|
260
|
+
type: a,
|
|
261
|
+
text: r.content
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
return n;
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
function Q(e, t) {
|
|
268
|
+
const n = v(t);
|
|
269
|
+
return n == null || C == null || !N.has(n) ? null : Oe(C.codeToTokensBase(e, {
|
|
270
|
+
lang: n,
|
|
271
|
+
theme: "pho"
|
|
272
|
+
}));
|
|
273
|
+
}
|
|
274
|
+
function A(e) {
|
|
275
|
+
return e.split(`
|
|
276
|
+
`).map((t) => [{
|
|
277
|
+
type: "plain",
|
|
278
|
+
text: t
|
|
279
|
+
}]);
|
|
280
|
+
}
|
|
281
|
+
async function ze(e, t) {
|
|
282
|
+
return v(t) == null ? A(e) : (await Ae(t), Q(e, t) ?? A(e));
|
|
283
|
+
}
|
|
284
|
+
var Le = 200, h = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Set();
|
|
285
|
+
function q(e, t) {
|
|
286
|
+
const n = h.get(e);
|
|
287
|
+
if (n != null) return n;
|
|
288
|
+
if (h.size >= Le) {
|
|
289
|
+
const r = h.keys().next().value;
|
|
290
|
+
r != null && h.delete(r);
|
|
291
|
+
}
|
|
292
|
+
return h.set(e, t), t;
|
|
293
|
+
}
|
|
294
|
+
function je(e) {
|
|
295
|
+
return O.add(e), () => {
|
|
296
|
+
O.delete(e);
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
function $e() {
|
|
300
|
+
for (const e of O) e();
|
|
301
|
+
}
|
|
302
|
+
function Ie(e, t) {
|
|
303
|
+
return `${e}\0${t}`;
|
|
304
|
+
}
|
|
305
|
+
function Pe(e, t) {
|
|
306
|
+
const n = v(t), r = n != null ? Ie(n, e) : null, a = xe(je, () => {
|
|
307
|
+
if (r == null) return null;
|
|
308
|
+
const i = h.get(r);
|
|
309
|
+
if (i != null) return i;
|
|
310
|
+
const l = Q(e, t);
|
|
311
|
+
return l != null ? q(r, l) : null;
|
|
312
|
+
}, () => null);
|
|
313
|
+
return ge(() => {
|
|
314
|
+
r == null || h.has(r) || ze(e, t).then((i) => {
|
|
315
|
+
q(r, i), $e();
|
|
316
|
+
}, () => {
|
|
317
|
+
});
|
|
318
|
+
}, [
|
|
319
|
+
r,
|
|
320
|
+
e,
|
|
321
|
+
t
|
|
322
|
+
]), a;
|
|
323
|
+
}
|
|
324
|
+
var E = /("(?:[^"\\]|\\.)*")(\s*:)?|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)|\b(true|false|null)\b|([{}[\]:,])/g;
|
|
325
|
+
function Re(e) {
|
|
326
|
+
const t = [];
|
|
327
|
+
let n = 0;
|
|
328
|
+
E.lastIndex = 0;
|
|
329
|
+
for (let r = E.exec(e); r != null; r = E.exec(e)) {
|
|
330
|
+
r.index > n && t.push({
|
|
331
|
+
type: "plain",
|
|
332
|
+
text: e.slice(n, r.index)
|
|
333
|
+
});
|
|
334
|
+
const [, a, i, l, f, w] = r;
|
|
335
|
+
a != null ? (t.push({
|
|
336
|
+
type: i != null ? "key" : "string",
|
|
337
|
+
text: a
|
|
338
|
+
}), i != null && t.push({
|
|
339
|
+
type: "punctuation",
|
|
340
|
+
text: i
|
|
341
|
+
})) : l != null ? t.push({
|
|
342
|
+
type: "number",
|
|
343
|
+
text: l
|
|
344
|
+
}) : f != null ? t.push({
|
|
345
|
+
type: "keyword",
|
|
346
|
+
text: f
|
|
347
|
+
}) : w != null && t.push({
|
|
348
|
+
type: "punctuation",
|
|
349
|
+
text: w
|
|
350
|
+
}), n = r.index + r[0].length;
|
|
351
|
+
}
|
|
352
|
+
return n < e.length && t.push({
|
|
353
|
+
type: "plain",
|
|
354
|
+
text: e.slice(n)
|
|
355
|
+
}), t;
|
|
356
|
+
}
|
|
357
|
+
var Ge = "rounded-base border border-pho-secondary bg-pho-code-bg text-pho-code-fg", We = "1.25rem", Be = "0.75rem";
|
|
358
|
+
function De(e) {
|
|
359
|
+
if (e == null) return "";
|
|
360
|
+
if (typeof e == "string") return e;
|
|
361
|
+
try {
|
|
362
|
+
return JSON.stringify(e, null, 2) ?? "";
|
|
363
|
+
} catch {
|
|
364
|
+
return String(e);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
function He(e, t) {
|
|
368
|
+
return t === "json" || t === "jsonc" ? e.split(`
|
|
369
|
+
`).map((n) => Re(n)) : A(e);
|
|
370
|
+
}
|
|
371
|
+
var Fe = [
|
|
372
|
+
void 0,
|
|
373
|
+
"pr-12",
|
|
374
|
+
"pr-20",
|
|
375
|
+
"pr-28"
|
|
376
|
+
];
|
|
377
|
+
function J({ label: e, pressed: t, onPressedChange: n, children: r }) {
|
|
378
|
+
return /* @__PURE__ */ m(g.Root, { children: [/* @__PURE__ */ o(g.Trigger, { render: /* @__PURE__ */ o(ye, {
|
|
379
|
+
size: "sm",
|
|
380
|
+
pressed: t,
|
|
381
|
+
onPressedChange: n,
|
|
382
|
+
"aria-label": e,
|
|
383
|
+
className: "rounded-sm",
|
|
384
|
+
children: r
|
|
385
|
+
}) }), /* @__PURE__ */ o(g.Portal, { children: /* @__PURE__ */ o(g.Positioner, { children: /* @__PURE__ */ o(g.Popup, { children: e }) }) })] });
|
|
386
|
+
}
|
|
387
|
+
function Ke({ lines: e, lineNumbers: t, digits: n, wrap: r }) {
|
|
388
|
+
return /* @__PURE__ */ o("code", { children: e.map((a, i) => /* @__PURE__ */ m("span", {
|
|
389
|
+
"data-line": "",
|
|
390
|
+
className: _("min-h-5", t ? "flex items-start" : "block", t && !r && "min-w-max"),
|
|
391
|
+
children: [t ? /* @__PURE__ */ o("span", {
|
|
392
|
+
"data-line-number": "",
|
|
393
|
+
"aria-hidden": !0,
|
|
394
|
+
className: "text-pho-placeholder bg-pho-code-bg sticky left-0 z-[1] box-content shrink-0 pr-3 pl-3 text-right font-mono text-xs leading-5 tabular-nums select-none",
|
|
395
|
+
style: { width: `${n}ch` },
|
|
396
|
+
children: i + 1
|
|
397
|
+
}) : null, /* @__PURE__ */ o("span", {
|
|
398
|
+
className: t ? "min-w-0 flex-1" : void 0,
|
|
399
|
+
children: a.map((l, f) => l.type === "plain" ? l.text : /* @__PURE__ */ o("span", {
|
|
400
|
+
className: Y[l.type],
|
|
401
|
+
children: l.text
|
|
402
|
+
}, f))
|
|
403
|
+
})]
|
|
404
|
+
}, i)) });
|
|
405
|
+
}
|
|
406
|
+
function Ue({ code: e, language: t = "text", title: n, maxLines: r = 30, overflow: a = "scroll", wrap: i, defaultWrap: l = !1, onWrapChange: f, expandToggle: w = !0, wrapToggle: X = !0, lineNumbers: L = !1, copy: Z = !0, empty: ee = "Nothing to show.", actions: S, className: te, ...ne }) {
|
|
407
|
+
const x = H(() => De(e), [e]), y = Pe(x, t), c = H(() => {
|
|
408
|
+
const u = He(x, t);
|
|
409
|
+
return y != null && y.length === u.length ? y : u;
|
|
410
|
+
}, [
|
|
411
|
+
x,
|
|
412
|
+
t,
|
|
413
|
+
y
|
|
414
|
+
]), [re, oe] = F(l), k = i ?? re, ie = (u) => {
|
|
415
|
+
i == null && oe(u), f?.(u);
|
|
416
|
+
}, [p, j] = F(!1), b = c.length > r, $ = a === "scroll" && b && !p, ae = a === "expand" && b && !p ? c.slice(0, r) : c, M = x === "", I = a === "scroll" && w && b && !M, P = X && !M, R = Z && !M, G = n != null, W = Number(I) + Number(P) + Number(R), le = S != null || W > 0, se = typeof n == "string" ? n.toLowerCase() : "code", pe = typeof n == "string" ? n : "Code", ce = p ? `Collapse to ${r} lines` : `Show all ${c.length} lines`, ue = String(Math.max(c.length, 1)).length, B = /* @__PURE__ */ m(ve, { children: [
|
|
417
|
+
S,
|
|
418
|
+
/* @__PURE__ */ m(g.Provider, { children: [I ? /* @__PURE__ */ o(J, {
|
|
419
|
+
label: ce,
|
|
420
|
+
pressed: p,
|
|
421
|
+
onPressedChange: j,
|
|
422
|
+
children: p ? /* @__PURE__ */ o(Me, { "aria-hidden": !0 }) : /* @__PURE__ */ o(ke, { "aria-hidden": !0 })
|
|
423
|
+
}) : null, P ? /* @__PURE__ */ o(J, {
|
|
424
|
+
label: "Wrap long lines",
|
|
425
|
+
pressed: k,
|
|
426
|
+
onPressedChange: ie,
|
|
427
|
+
children: /* @__PURE__ */ o(Ne, { "aria-hidden": !0 })
|
|
428
|
+
}) : null] }),
|
|
429
|
+
R ? /* @__PURE__ */ o(fe, {
|
|
430
|
+
value: x,
|
|
431
|
+
label: se,
|
|
432
|
+
size: "md"
|
|
433
|
+
}) : null
|
|
434
|
+
] }), D = /* @__PURE__ */ o("pre", {
|
|
435
|
+
className: _("m-0 min-w-0 py-3 font-mono text-xs leading-5", L ? "pr-3 pl-0" : "px-3", !G && Fe[Math.min(W + (S != null ? 1 : 0), 3)], k ? "[overflow-wrap:anywhere] whitespace-pre-wrap" : $ ? "w-max min-w-full whitespace-pre" : "max-w-full overflow-x-auto whitespace-pre"),
|
|
436
|
+
children: /* @__PURE__ */ o(Ke, {
|
|
437
|
+
lines: ae,
|
|
438
|
+
lineNumbers: L,
|
|
439
|
+
digits: ue,
|
|
440
|
+
wrap: k
|
|
441
|
+
})
|
|
442
|
+
});
|
|
443
|
+
return /* @__PURE__ */ m("div", {
|
|
444
|
+
"data-code-block": "",
|
|
445
|
+
"data-language": t,
|
|
446
|
+
"data-overflow": a,
|
|
447
|
+
"data-highlighted": y != null && c === y ? "" : void 0,
|
|
448
|
+
className: _(Ge, "relative flex w-full min-w-0 flex-col overflow-hidden", te),
|
|
449
|
+
...ne,
|
|
450
|
+
children: [
|
|
451
|
+
G ? /* @__PURE__ */ m("div", {
|
|
452
|
+
className: "border-pho-secondary flex min-h-10 items-center gap-2 border-b py-1 pr-1.5 pl-3",
|
|
453
|
+
children: [/* @__PURE__ */ o("div", {
|
|
454
|
+
className: "text-pho-secondary min-w-0 flex-1 truncate text-xs font-medium",
|
|
455
|
+
children: n
|
|
456
|
+
}), B]
|
|
457
|
+
}) : le ? /* @__PURE__ */ o("div", {
|
|
458
|
+
className: "bg-pho-code-bg absolute top-1 right-1.5 z-10 flex items-center gap-2 rounded-sm",
|
|
459
|
+
children: B
|
|
460
|
+
}) : null,
|
|
461
|
+
M ? /* @__PURE__ */ o("p", {
|
|
462
|
+
className: "text-pho-description m-0 px-3 py-3 text-base",
|
|
463
|
+
children: ee
|
|
464
|
+
}) : $ ? /* @__PURE__ */ o("section", {
|
|
465
|
+
className: "min-w-0",
|
|
466
|
+
children: /* @__PURE__ */ m(d.Root, {
|
|
467
|
+
fade: !1,
|
|
468
|
+
"data-code-scroll": "",
|
|
469
|
+
className: "min-w-0 rounded-b-[inherit]",
|
|
470
|
+
style: { height: `calc(${r} * ${We} + ${Be} * 2)` },
|
|
471
|
+
children: [
|
|
472
|
+
/* @__PURE__ */ o(d.Viewport, {
|
|
473
|
+
tabIndex: 0,
|
|
474
|
+
"aria-label": pe,
|
|
475
|
+
children: /* @__PURE__ */ o(d.Content, { children: D })
|
|
476
|
+
}),
|
|
477
|
+
/* @__PURE__ */ o(d.Scrollbar, { children: /* @__PURE__ */ o(d.Thumb, {}) }),
|
|
478
|
+
k ? null : /* @__PURE__ */ o(d.Scrollbar, {
|
|
479
|
+
orientation: "horizontal",
|
|
480
|
+
children: /* @__PURE__ */ o(d.Thumb, {})
|
|
481
|
+
})
|
|
482
|
+
]
|
|
483
|
+
})
|
|
484
|
+
}) : D,
|
|
485
|
+
a === "expand" && b ? /* @__PURE__ */ o("div", {
|
|
486
|
+
className: "border-pho-secondary flex items-center border-t px-1.5 py-1",
|
|
487
|
+
children: /* @__PURE__ */ o(de, {
|
|
488
|
+
variant: "ghost",
|
|
489
|
+
size: "sm",
|
|
490
|
+
"aria-expanded": p,
|
|
491
|
+
prefix: p ? he : me,
|
|
492
|
+
onClick: () => j((u) => !u),
|
|
493
|
+
children: p ? "Show less" : `Show all ${c.length} lines`
|
|
494
|
+
})
|
|
495
|
+
}) : null
|
|
496
|
+
]
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
Ue.displayName = "CodeBlock";
|
|
500
|
+
export {
|
|
501
|
+
ot as a,
|
|
502
|
+
Y as c,
|
|
503
|
+
v as d,
|
|
504
|
+
Me as f,
|
|
505
|
+
Q as i,
|
|
506
|
+
V as l,
|
|
507
|
+
Re as n,
|
|
508
|
+
Ae as o,
|
|
509
|
+
ke as p,
|
|
510
|
+
ze as r,
|
|
511
|
+
Pe as s,
|
|
512
|
+
Ue as t,
|
|
513
|
+
K as u
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
//# sourceMappingURL=code-block-CbcE994O.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-block-CbcE994O.js","names":["__iconNode","__iconNode"],"sources":["../../../../node_modules/.pnpm/@tabler+icons-react@3.46.0_react@19.2.8/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowsMaximize.mjs","../../../../node_modules/.pnpm/@tabler+icons-react@3.46.0_react@19.2.8/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowsMinimize.mjs","../../../../node_modules/.pnpm/@tabler+icons-react@3.46.0_react@19.2.8/node_modules/@tabler/icons-react/dist/esm/icons/IconTextWrap.mjs","../../src/components/code-block/languages.ts","../../src/components/code-block/tokens.ts","../../src/components/code-block/pho-theme.ts","../../src/components/code-block/highlight.ts","../../src/components/code-block/tokenize-json.ts","../../src/components/code-block/code-block.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M16 4l4 0l0 4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M14 10l6 -6\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M8 20l-4 0l0 -4\", \"key\": \"svg-2\" }], [\"path\", { \"d\": \"M4 20l6 -6\", \"key\": \"svg-3\" }], [\"path\", { \"d\": \"M16 20l4 0l0 -4\", \"key\": \"svg-4\" }], [\"path\", { \"d\": \"M14 14l6 6\", \"key\": \"svg-5\" }], [\"path\", { \"d\": \"M8 4l-4 0l0 4\", \"key\": \"svg-6\" }], [\"path\", { \"d\": \"M4 4l6 6\", \"key\": \"svg-7\" }]];\nconst IconArrowsMaximize = createReactComponent(\"outline\", \"arrows-maximize\", \"ArrowsMaximize\", __iconNode);\n\nexport { __iconNode, IconArrowsMaximize as default };\n//# sourceMappingURL=IconArrowsMaximize.mjs.map\n","/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M5 9l4 0l0 -4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M3 3l6 6\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M5 15l4 0l0 4\", \"key\": \"svg-2\" }], [\"path\", { \"d\": \"M3 21l6 -6\", \"key\": \"svg-3\" }], [\"path\", { \"d\": \"M19 9l-4 0l0 -4\", \"key\": \"svg-4\" }], [\"path\", { \"d\": \"M15 9l6 -6\", \"key\": \"svg-5\" }], [\"path\", { \"d\": \"M19 15l-4 0l0 4\", \"key\": \"svg-6\" }], [\"path\", { \"d\": \"M15 15l6 6\", \"key\": \"svg-7\" }]];\nconst IconArrowsMinimize = createReactComponent(\"outline\", \"arrows-minimize\", \"ArrowsMinimize\", __iconNode);\n\nexport { __iconNode, IconArrowsMinimize as default };\n//# sourceMappingURL=IconArrowsMinimize.mjs.map\n","/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M4 6l16 0\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M4 18l5 0\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M4 12h13a3 3 0 0 1 0 6h-4l2 -2m0 4l-2 -2\", \"key\": \"svg-2\" }]];\nconst IconTextWrap = createReactComponent(\"outline\", \"text-wrap\", \"TextWrap\", __iconNode);\n\nexport { __iconNode, IconTextWrap as default };\n//# sourceMappingURL=IconTextWrap.mjs.map\n","import type { LanguageRegistration } from \"shiki/core\";\n\n/**\n * The languages a code panel can color, each a grammar fetched on first\n * use — a page that shows JSON never downloads the TypeScript grammar.\n * Keyed by the name Shiki knows the grammar by; `LANGUAGE_ALIASES` lets a\n * panel say `ts` or `sh`.\n */\nexport const CODE_GRAMMARS = {\n json: () => import(\"@shikijs/langs/json\"),\n jsonc: () => import(\"@shikijs/langs/jsonc\"),\n javascript: () => import(\"@shikijs/langs/javascript\"),\n typescript: () => import(\"@shikijs/langs/typescript\"),\n jsx: () => import(\"@shikijs/langs/jsx\"),\n tsx: () => import(\"@shikijs/langs/tsx\"),\n shellscript: () => import(\"@shikijs/langs/shellscript\"),\n python: () => import(\"@shikijs/langs/python\"),\n swift: () => import(\"@shikijs/langs/swift\"),\n go: () => import(\"@shikijs/langs/go\"),\n ruby: () => import(\"@shikijs/langs/ruby\"),\n php: () => import(\"@shikijs/langs/php\"),\n java: () => import(\"@shikijs/langs/java\"),\n kotlin: () => import(\"@shikijs/langs/kotlin\"),\n csharp: () => import(\"@shikijs/langs/csharp\"),\n rust: () => import(\"@shikijs/langs/rust\"),\n html: () => import(\"@shikijs/langs/html\"),\n css: () => import(\"@shikijs/langs/css\"),\n xml: () => import(\"@shikijs/langs/xml\"),\n yaml: () => import(\"@shikijs/langs/yaml\"),\n toml: () => import(\"@shikijs/langs/toml\"),\n dotenv: () => import(\"@shikijs/langs/dotenv\"),\n sql: () => import(\"@shikijs/langs/sql\"),\n graphql: () => import(\"@shikijs/langs/graphql\"),\n http: () => import(\"@shikijs/langs/http\"),\n markdown: () => import(\"@shikijs/langs/markdown\"),\n diff: () => import(\"@shikijs/langs/diff\"),\n} satisfies Record<string, () => Promise<{ default: LanguageRegistration[] }>>;\n\nexport type CodeGrammar = keyof typeof CODE_GRAMMARS;\n\n/** Shorter names, and the ones people reach for first. */\nexport const LANGUAGE_ALIASES = {\n js: \"javascript\",\n ts: \"typescript\",\n bash: \"shellscript\",\n sh: \"shellscript\",\n shell: \"shellscript\",\n zsh: \"shellscript\",\n py: \"python\",\n rb: \"ruby\",\n kt: \"kotlin\",\n cs: \"csharp\",\n rs: \"rust\",\n yml: \"yaml\",\n md: \"markdown\",\n htm: \"html\",\n} as const satisfies Record<string, CodeGrammar>;\n\nexport type CodeLanguageAlias = keyof typeof LANGUAGE_ALIASES;\n\n/**\n * What `language` accepts: a grammar, an alias, or `text` for none. Plain\n * text is the default — a panel colors only what it is told the shape of.\n */\nexport type CodeBlockLanguage = \"text\" | CodeGrammar | CodeLanguageAlias;\n\n/**\n * The grammar behind a `language`, or `null` for plain text and names the\n * panel does not know (which read as text instead of throwing).\n */\nexport function resolveGrammar(language: string): CodeGrammar | null {\n // Own keys only: `in` would take \"toString\" for a grammar.\n if (Object.hasOwn(LANGUAGE_ALIASES, language)) {\n return LANGUAGE_ALIASES[language as CodeLanguageAlias];\n }\n return Object.hasOwn(CODE_GRAMMARS, language)\n ? (language as CodeGrammar)\n : null;\n}\n","/**\n * The token vocabulary a code panel colors with — one class per kind, on\n * the `--color-pho-code-*` tokens, which carry light and dark. The JSON\n * tokenizer speaks the first five; Shiki's grammars reach the rest.\n */\n\nexport type CodeTokenType =\n | \"key\"\n | \"string\"\n | \"number\"\n | \"keyword\"\n | \"punctuation\"\n | \"comment\"\n | \"function\"\n | \"type\"\n | \"plain\";\n\nexport interface CodeToken {\n type: CodeTokenType;\n text: string;\n}\n\n/** One line of a highlighted body. */\nexport type CodeLine = CodeToken[];\n\n/** The class a token kind wears; `plain` wears the panel's own ink. */\nexport const CODE_TOKEN_CLASS: Record<CodeTokenType, string | undefined> = {\n key: \"text-pho-code-key\",\n string: \"text-pho-code-string\",\n number: \"text-pho-code-number\",\n keyword: \"text-pho-code-keyword\",\n punctuation: \"text-pho-code-punctuation\",\n comment: \"text-pho-code-comment\",\n function: \"text-pho-code-function\",\n type: \"text-pho-code-type\",\n plain: undefined,\n};\n","import type { ThemeRegistrationRaw } from \"shiki/core\";\nimport { CODE_TOKEN_CLASS, type CodeTokenType } from \"./tokens\";\n\n/**\n * Pho's Shiki theme — not a palette but a routing table. Every TextMate\n * scope resolves to one of the panel's token kinds, and each kind's\n * \"color\" is the design token's own variable, so the theme has no light\n * and dark of its own: the `--color-pho-code-*` tokens carry both, and\n * the renderer turns each color back into the kind's class. Only the\n * kinds a body needs to read — keys, strings, numbers, keywords,\n * punctuation, comments, calls, types. Operators, variables, and\n * everything else stay in the panel's ink.\n */\n\nexport const PHO_THEME_NAME = \"pho\";\n\n/** The color a token kind \"has\" in the theme: its token's variable. */\nexport function tokenColor(type: Exclude<CodeTokenType, \"plain\">): string {\n return `var(--color-pho-code-${type})`;\n}\n\n/** The token kind behind a Shiki color, or `plain` for the panel's ink. */\nexport function tokenTypeOf(color: string | undefined): CodeTokenType {\n const match = color?.match(/^var\\(--color-pho-code-([a-z]+)\\)$/);\n const kind = match?.[1];\n return kind != null && kind in CODE_TOKEN_CLASS && kind !== \"plain\"\n ? (kind as CodeTokenType)\n : \"plain\";\n}\n\nconst rule = (\n type: Exclude<CodeTokenType, \"plain\"> | \"plain\",\n scope: string[],\n) => ({\n scope,\n settings: {\n foreground:\n type === \"plain\" ? \"var(--color-pho-code-fg)\" : tokenColor(type),\n },\n});\n\nexport const phoTheme: ThemeRegistrationRaw = {\n name: PHO_THEME_NAME,\n type: \"light\",\n fg: \"var(--color-pho-code-fg)\",\n bg: \"var(--color-pho-code-bg)\",\n settings: [\n rule(\"comment\", [\"comment\", \"punctuation.definition.comment\"]),\n rule(\"string\", [\n \"string\",\n \"markup.inserted\",\n \"meta.diff.header.to-file\",\n \"punctuation.definition.inserted\",\n ]),\n // A template's `${…}` and any embedded code read as code again.\n rule(\"plain\", [\"meta.template.expression\", \"meta.embedded\"]),\n rule(\"key\", [\n \"support.type.property-name\",\n \"meta.object-literal.key\",\n \"entity.other.attribute-name\",\n \"entity.name.tag.yaml\",\n \"keyword.key.toml\",\n \"variable.other.env\",\n ]),\n rule(\"number\", [\n \"constant.numeric\",\n \"markup.deleted\",\n \"meta.diff.header.from-file\",\n \"punctuation.definition.deleted\",\n ]),\n rule(\"keyword\", [\n \"keyword\",\n \"storage\",\n \"constant.language\",\n \"variable.language\",\n ]),\n // Symbolic operators sit in the ink: `=`, `+`, `=>`, `&&` are shape,\n // not vocabulary. The word-shaped ones above stay keywords.\n rule(\"plain\", [\"keyword.operator\"]),\n rule(\"keyword\", [\n \"keyword.operator.expression\",\n \"keyword.operator.new\",\n \"keyword.operator.logical.python\",\n \"keyword.operator.wordlike\",\n ]),\n rule(\"function\", [\n \"entity.name.function\",\n \"support.function\",\n \"entity.name.command\",\n \"meta.function-call.generic\",\n ]),\n rule(\"type\", [\n \"entity.name.type\",\n \"entity.name.class\",\n \"entity.name.tag\",\n \"entity.other.inherited-class\",\n \"support.type\",\n \"support.class\",\n \"storage.type.primitive\",\n ]),\n // A property name is a key even though it is a `support.type`.\n rule(\"key\", [\"support.type.property-name\"]),\n rule(\"punctuation\", [\n \"punctuation.separator\",\n \"punctuation.terminator\",\n \"punctuation.accessor\",\n \"punctuation.section\",\n \"punctuation.definition.array\",\n \"punctuation.definition.dictionary\",\n \"punctuation.definition.block\",\n \"punctuation.definition.parameters\",\n \"punctuation.definition.arguments\",\n \"punctuation.definition.tag\",\n \"punctuation.definition.typeparameters\",\n \"meta.brace\",\n ]),\n ],\n};\n","import { useEffect, useSyncExternalStore } from \"react\";\nimport type { HighlighterCore, ThemedToken } from \"shiki/core\";\nimport { CODE_GRAMMARS, resolveGrammar, type CodeGrammar } from \"./languages\";\nimport { phoTheme, PHO_THEME_NAME, tokenTypeOf } from \"./pho-theme\";\nimport type { CodeLine } from \"./tokens\";\n\n/**\n * Highlighting, on Shiki — one highlighter for the whole app, made on\n * the first panel that asks and kept; grammars fetched on demand and\n * kept too. Bodies are tokenized once per (grammar, text) and remembered,\n * so a wrap toggle or a fold never re-runs a grammar.\n *\n * The result is lines of `CodeToken`s in the panel's own vocabulary\n * (`tokens.ts`), never Shiki's HTML: the panel keeps rendering its own\n * lines (the fold, `data-line`) and its own classes (the design tokens).\n *\n * Nothing here runs on the server. `useHighlight` reports `null` until a\n * body is highlighted, and a panel shows its synchronous face meanwhile —\n * plain text, or the JSON tokenizer's colors — so a page prerendered and\n * a page hydrated agree, and the colors settle in a frame later.\n */\n\nlet core: HighlighterCore | null = null;\nlet corePromise: Promise<HighlighterCore> | null = null;\nconst loadedGrammars = new Set<CodeGrammar>();\nconst loadingGrammars = new Map<CodeGrammar, Promise<void>>();\n\n/**\n * Shiki itself arrives with the first body that needs it — a page of\n * cards and rows never loads the engine — and stays for the rest.\n */\nfunction getCore(): Promise<HighlighterCore> {\n corePromise ??= Promise.all([\n import(\"shiki/core\"),\n import(\"shiki/engine/javascript\"),\n ])\n .then(([{ createHighlighterCore }, { createJavaScriptRegexEngine }]) =>\n createHighlighterCore({\n themes: [phoTheme],\n langs: [],\n // Shiki's JavaScript engine: no WebAssembly to fetch or allow, and\n // `forgiving` degrades a grammar's exotic pattern instead of\n // failing the whole body.\n engine: createJavaScriptRegexEngine({ forgiving: true }),\n }),\n )\n .then((highlighter) => {\n core = highlighter;\n return highlighter;\n });\n return corePromise;\n}\n\n/** Fetch a language's grammar ahead of the first body that needs it. */\nexport function preloadLanguage(language: string): Promise<void> {\n const grammar = resolveGrammar(language);\n if (grammar == null || loadedGrammars.has(grammar)) return Promise.resolve();\n let loading = loadingGrammars.get(grammar);\n if (loading == null) {\n loading = Promise.all([getCore(), CODE_GRAMMARS[grammar]()])\n .then(([highlighter, module]) =>\n highlighter.loadLanguage(...module.default),\n )\n .then(() => {\n loadedGrammars.add(grammar);\n })\n .finally(() => {\n loadingGrammars.delete(grammar);\n });\n loadingGrammars.set(grammar, loading);\n }\n return loading;\n}\n\n/** Whether `language` can be tokenized right now, without waiting. */\nexport function isLanguageReady(language: string): boolean {\n const grammar = resolveGrammar(language);\n return grammar != null && core != null && loadedGrammars.has(grammar);\n}\n\nfunction toLines(tokens: ThemedToken[][]): CodeLine[] {\n return tokens.map((line) => {\n const out: CodeLine = [];\n for (const token of line) {\n const type = tokenTypeOf(token.color);\n const last = out[out.length - 1];\n // Neighbors of one kind collapse into one span.\n if (last != null && last.type === type) last.text += token.content;\n else out.push({ type, text: token.content });\n }\n return out;\n });\n}\n\n/**\n * Tokenize a body with a grammar that is already loaded. `null` when the\n * language is plain text or its grammar is not here yet — see\n * `preloadLanguage` / `highlight`.\n */\nexport function highlightSync(\n code: string,\n language: string,\n): CodeLine[] | null {\n const grammar = resolveGrammar(language);\n if (grammar == null || core == null || !loadedGrammars.has(grammar)) {\n return null;\n }\n return toLines(\n core.codeToTokensBase(code, { lang: grammar, theme: PHO_THEME_NAME }),\n );\n}\n\n/** Plain lines — what a body reads as with no grammar. */\nexport function plainLines(code: string): CodeLine[] {\n return code.split(\"\\n\").map((text) => [{ type: \"plain\", text }]);\n}\n\n/**\n * Tokenize a body, fetching the highlighter and the grammar first if\n * need be. A language the panel does not know resolves to plain lines.\n */\nexport async function highlight(\n code: string,\n language: string,\n): Promise<CodeLine[]> {\n if (resolveGrammar(language) == null) return plainLines(code);\n await preloadLanguage(language);\n return highlightSync(code, language) ?? plainLines(code);\n}\n\n/* --------------------------------- store --------------------------------- */\n\n/** How many highlighted bodies to keep. A page's worth, several times. */\nconst CACHE_LIMIT = 200;\nconst cache = new Map<string, CodeLine[]>();\nconst listeners = new Set<() => void>();\n\nfunction remember(key: string, lines: CodeLine[]): CodeLine[] {\n const known = cache.get(key);\n if (known != null) return known;\n if (cache.size >= CACHE_LIMIT) {\n const oldest = cache.keys().next().value;\n if (oldest != null) cache.delete(oldest);\n }\n cache.set(key, lines);\n return lines;\n}\n\nfunction subscribe(listener: () => void) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n\nfunction notify() {\n for (const listener of listeners) listener();\n}\n\nfunction cacheKey(grammar: CodeGrammar, code: string) {\n return `${grammar}\u0000${code}`;\n}\n\n/**\n * The highlighted lines of a body, or `null` while its grammar is on the\n * way (and always for plain text). A grammar already here highlights in\n * the same render, no flash.\n */\nexport function useHighlight(\n code: string,\n language: string,\n): CodeLine[] | null {\n const grammar = resolveGrammar(language);\n const key = grammar != null ? cacheKey(grammar, code) : null;\n const lines = useSyncExternalStore(\n subscribe,\n () => {\n if (key == null) return null;\n const known = cache.get(key);\n if (known != null) return known;\n const now = highlightSync(code, language);\n return now != null ? remember(key, now) : null;\n },\n // Prerendered markup is the synchronous face; hydration agrees with it\n // and the colors settle in the render after.\n () => null,\n );\n useEffect(() => {\n if (key == null || cache.has(key)) return;\n // Remembered even if this panel is gone by then: the next one with the\n // same body reads it in its first render.\n highlight(code, language).then(\n (result) => {\n remember(key, result);\n notify();\n },\n () => {\n // A grammar that would not load: the panel keeps its plain face.\n },\n );\n }, [key, code, language]);\n return lines;\n}\n","/**\n * A tokenizer for JSON, and nothing else: keys, strings, numbers, the\n * three keywords, and punctuation. Runs one line at a time (a JSON\n * string never spans lines) so a panel can show its first N lines and\n * stop. Text that isn't JSON comes back as it is, in plain tokens.\n */\n\nexport type JsonTokenType =\n \"key\" | \"string\" | \"number\" | \"keyword\" | \"punctuation\" | \"plain\";\n\nexport interface JsonToken {\n type: JsonTokenType;\n text: string;\n}\n\n// One pass, left to right: a string (a key when a colon follows), a\n// number, a keyword, a bracket or a comma. Anything between is plain.\nconst TOKEN =\n /(\"(?:[^\"\\\\]|\\\\.)*\")(\\s*:)?|(-?\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?)|\\b(true|false|null)\\b|([{}[\\]:,])/g;\n\nexport function tokenizeJson(line: string): JsonToken[] {\n const tokens: JsonToken[] = [];\n let last = 0;\n TOKEN.lastIndex = 0;\n for (let match = TOKEN.exec(line); match != null; match = TOKEN.exec(line)) {\n if (match.index > last) {\n tokens.push({ type: \"plain\", text: line.slice(last, match.index) });\n }\n const [, string, colon, number, keyword, punctuation] = match;\n if (string != null) {\n tokens.push({ type: colon != null ? \"key\" : \"string\", text: string });\n if (colon != null) tokens.push({ type: \"punctuation\", text: colon });\n } else if (number != null) {\n tokens.push({ type: \"number\", text: number });\n } else if (keyword != null) {\n tokens.push({ type: \"keyword\", text: keyword });\n } else if (punctuation != null) {\n tokens.push({ type: \"punctuation\", text: punctuation });\n }\n last = match.index + match[0].length;\n }\n if (last < line.length) {\n tokens.push({ type: \"plain\", text: line.slice(last) });\n }\n return tokens;\n}\n","import {\n useMemo,\n useState,\n type ComponentProps,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport {\n IconArrowsMaximize,\n IconArrowsMinimize,\n IconChevronDown,\n IconChevronUp,\n IconTextWrap,\n} from \"@tabler/icons-react\";\nimport { Button } from \"../button\";\nimport { CopyButton } from \"../copy-button\";\nimport { ScrollArea } from \"../scroll-area\";\nimport { Toggle } from \"../toggle\";\nimport { Tooltip } from \"../tooltip\";\nimport { cn } from \"../../utils/cn\";\nimport { plainLines, useHighlight } from \"./highlight\";\nimport type { CodeBlockLanguage } from \"./languages\";\nimport { tokenizeJson } from \"./tokenize-json\";\nimport { CODE_TOKEN_CLASS, type CodeLine } from \"./tokens\";\n\n/**\n * Code Block — a read-only panel for a request body, a response, an\n * event's JSON, an install command. Mono text on the code surface, a title row with expand,\n * wrap, and copy controls. Past `maxLines` the body either scrolls\n * inside that height (`overflow=\"scroll\"`, the default) or folds with a\n * footer button (`overflow=\"expand\"`).\n *\n * Design notes:\n * - Wide lines scroll sideways inside the panel; the page never does.\n * Wrapping is a toggle (`wrap` / `defaultWrap`), off by default so a\n * body reads the way it was sent.\n * - `language` colors the text with Shiki's grammar for it, fetched on\n * first use, on the `--color-pho-code-*` tokens, which carry light and\n * dark. JSON has a synchronous face too — a built-in tokenizer paints\n * it in the first render, and the grammar agrees with it — so a body\n * never flashes plain. Other languages read plain for the frame their\n * grammar takes to arrive.\n * - Without a `title` there is no title row: the controls float over the\n * panel's top-right corner, the way a snippet on a page wears a copy\n * button.\n * - A body that isn't a string (an object) is pretty-printed as JSON.\n */\n\nexport type CodeBlockOverflow = \"scroll\" | \"expand\";\n\n/** The panel's chrome — the card hairline around the code surface. */\nconst CODE_BLOCK_SURFACE =\n \"rounded-base border border-pho-secondary bg-pho-code-bg text-pho-code-fg\";\n\n/** One code line is `leading-5` / `min-h-5`; the pre pads `py-3`. */\nconst LINE_H = \"1.25rem\";\nconst PAD_Y = \"0.75rem\";\n\nexport interface CodeBlockProps extends Omit<\n ComponentProps<\"div\">,\n \"title\" | \"children\"\n> {\n /** The text. An object is pretty-printed as JSON (two-space indent). */\n code?: string | object | null;\n /**\n * What the text is, so the panel can color it: `json`, `typescript`,\n * `bash`, `python`, … or `text` for none. @default \"text\"\n */\n language?: CodeBlockLanguage;\n /**\n * The title row's words — \"Request body\", \"Response\". Without one the\n * row goes and the controls float over the top-right corner.\n */\n title?: ReactNode;\n /** Past this many lines the panel folds or clips. @default 30 */\n maxLines?: number;\n /**\n * How a long body is shown past `maxLines`. `scroll` clips to that\n * height and scrolls inside, with an expand toggle in the title row.\n * `expand` folds and shows a footer button.\n * @default \"scroll\"\n */\n overflow?: CodeBlockOverflow;\n /** Wrap long lines (controlled). */\n wrap?: boolean;\n /** Wrap long lines at first (uncontrolled). @default false */\n defaultWrap?: boolean;\n onWrapChange?: (wrap: boolean) => void;\n /** The expand toggle when `overflow` is `scroll`. @default true */\n expandToggle?: boolean;\n /** The wrap toggle. @default true */\n wrapToggle?: boolean;\n /**\n * A gutter of line numbers. Off by default; turn on for a long\n * payload (about twenty lines or more).\n * @default false\n */\n lineNumbers?: boolean;\n /** The copy control. @default true */\n copy?: boolean;\n /** What the panel says with no code. @default \"Nothing to show.\" */\n empty?: ReactNode;\n /** More controls beside the built-in ones, before them. */\n actions?: ReactNode;\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction toText(code: CodeBlockProps[\"code\"]): string {\n if (code == null) return \"\";\n if (typeof code === \"string\") return code;\n try {\n return JSON.stringify(code, null, 2) ?? \"\";\n } catch {\n return String(code);\n }\n}\n\n/** The face a body has before (or without) its grammar. */\nfunction syncLines(text: string, language: CodeBlockLanguage): CodeLine[] {\n if (language === \"json\" || language === \"jsonc\") {\n return text.split(\"\\n\").map((line) => tokenizeJson(line));\n }\n return plainLines(text);\n}\n\n/** Room on the first lines for the floating controls, by how many show. */\nconst FLOATING_ROOM = [undefined, \"pr-12\", \"pr-20\", \"pr-28\"] as const;\n\nfunction HeaderToggle({\n label,\n pressed,\n onPressedChange,\n children,\n}: {\n label: string;\n pressed: boolean;\n onPressedChange: (next: boolean) => void;\n children: ReactNode;\n}) {\n return (\n <Tooltip.Root>\n <Tooltip.Trigger\n render={\n <Toggle\n size=\"sm\"\n pressed={pressed}\n onPressedChange={onPressedChange}\n aria-label={label}\n className=\"rounded-sm\"\n >\n {children}\n </Toggle>\n }\n />\n <Tooltip.Portal>\n <Tooltip.Positioner>\n <Tooltip.Popup>{label}</Tooltip.Popup>\n </Tooltip.Positioner>\n </Tooltip.Portal>\n </Tooltip.Root>\n );\n}\n\nfunction CodeLines({\n lines,\n lineNumbers,\n digits,\n wrap,\n}: {\n lines: CodeLine[];\n lineNumbers: boolean;\n digits: number;\n wrap: boolean;\n}) {\n return (\n <code>\n {lines.map((line, index) => (\n <span\n key={index}\n data-line=\"\"\n className={cn(\n \"min-h-5\",\n lineNumbers ? \"flex items-start\" : \"block\",\n lineNumbers && !wrap && \"min-w-max\",\n )}\n >\n {lineNumbers ? (\n <span\n data-line-number=\"\"\n aria-hidden\n className=\"text-pho-placeholder bg-pho-code-bg sticky left-0 z-[1] box-content shrink-0 pr-3 pl-3 text-right font-mono text-xs leading-5 tabular-nums select-none\"\n style={{ width: `${digits}ch` }}\n >\n {index + 1}\n </span>\n ) : null}\n <span className={lineNumbers ? \"min-w-0 flex-1\" : undefined}>\n {line.map((token, at) =>\n token.type === \"plain\" ? (\n token.text\n ) : (\n <span key={at} className={CODE_TOKEN_CLASS[token.type]}>\n {token.text}\n </span>\n ),\n )}\n </span>\n </span>\n ))}\n </code>\n );\n}\n\nexport function CodeBlock({\n code,\n language = \"text\",\n title,\n maxLines = 30,\n overflow = \"scroll\",\n wrap: wrapProp,\n defaultWrap = false,\n onWrapChange,\n expandToggle = true,\n wrapToggle = true,\n lineNumbers = false,\n copy = true,\n empty = \"Nothing to show.\",\n actions,\n className,\n ...props\n}: CodeBlockProps) {\n const text = useMemo(() => toText(code), [code]);\n const highlighted = useHighlight(text, language);\n const lines = useMemo(() => {\n const sync = syncLines(text, language);\n // The grammar and the split must agree on where lines are; where\n // they don't, the synchronous face stands.\n return highlighted != null && highlighted.length === sync.length\n ? highlighted\n : sync;\n }, [text, language, highlighted]);\n const [ownWrap, setOwnWrap] = useState(defaultWrap);\n const wrap = wrapProp ?? ownWrap;\n const setWrap = (next: boolean) => {\n if (wrapProp == null) setOwnWrap(next);\n onWrapChange?.(next);\n };\n const [expanded, setExpanded] = useState(false);\n const folds = lines.length > maxLines;\n const scrolling = overflow === \"scroll\" && folds && !expanded;\n const shown =\n overflow === \"expand\" && folds && !expanded\n ? lines.slice(0, maxLines)\n : lines;\n const isEmpty = text === \"\";\n const showExpandToggle =\n overflow === \"scroll\" && expandToggle && folds && !isEmpty;\n const showWrapToggle = wrapToggle && !isEmpty;\n const showCopy = copy && !isEmpty;\n const hasTitle = title != null;\n const builtIns =\n Number(showExpandToggle) + Number(showWrapToggle) + Number(showCopy);\n const hasControls = actions != null || builtIns > 0;\n const copyLabel = typeof title === \"string\" ? title.toLowerCase() : \"code\";\n const scrollLabel = typeof title === \"string\" ? title : \"Code\";\n const expandLabel = expanded\n ? `Collapse to ${maxLines} lines`\n : `Show all ${lines.length} lines`;\n const lineNoDigits = String(Math.max(lines.length, 1)).length;\n const controls = (\n <>\n {actions}\n <Tooltip.Provider>\n {showExpandToggle ? (\n <HeaderToggle\n label={expandLabel}\n pressed={expanded}\n onPressedChange={setExpanded}\n >\n {expanded ? (\n <IconArrowsMinimize aria-hidden />\n ) : (\n <IconArrowsMaximize aria-hidden />\n )}\n </HeaderToggle>\n ) : null}\n {showWrapToggle ? (\n <HeaderToggle\n label=\"Wrap long lines\"\n pressed={wrap}\n onPressedChange={setWrap}\n >\n <IconTextWrap aria-hidden />\n </HeaderToggle>\n ) : null}\n </Tooltip.Provider>\n {showCopy ? (\n <CopyButton value={text} label={copyLabel} size=\"md\" />\n ) : null}\n </>\n );\n const body = (\n <pre\n className={cn(\n \"m-0 min-w-0 py-3 font-mono text-xs leading-5\",\n lineNumbers ? \"pr-3 pl-0\" : \"px-3\",\n // Room for the floating controls on the first lines.\n !hasTitle &&\n FLOATING_ROOM[Math.min(builtIns + (actions != null ? 1 : 0), 3)],\n wrap\n ? \"[overflow-wrap:anywhere] whitespace-pre-wrap\"\n : scrolling\n ? \"w-max min-w-full whitespace-pre\"\n : \"max-w-full overflow-x-auto whitespace-pre\",\n )}\n >\n <CodeLines\n lines={shown}\n lineNumbers={lineNumbers}\n digits={lineNoDigits}\n wrap={wrap}\n />\n </pre>\n );\n return (\n <div\n data-code-block=\"\"\n data-language={language}\n data-overflow={overflow}\n data-highlighted={\n highlighted != null && lines === highlighted ? \"\" : undefined\n }\n className={cn(\n CODE_BLOCK_SURFACE,\n \"relative flex w-full min-w-0 flex-col overflow-hidden\",\n className,\n )}\n {...props}\n >\n {hasTitle ? (\n <div className=\"border-pho-secondary flex min-h-10 items-center gap-2 border-b py-1 pr-1.5 pl-3\">\n <div className=\"text-pho-secondary min-w-0 flex-1 truncate text-xs font-medium\">\n {title}\n </div>\n {controls}\n </div>\n ) : hasControls ? (\n // No title row: the controls float over the corner, on the code\n // surface so scrolled text passes under them.\n <div className=\"bg-pho-code-bg absolute top-1 right-1.5 z-10 flex items-center gap-2 rounded-sm\">\n {controls}\n </div>\n ) : null}\n {isEmpty ? (\n <p className=\"text-pho-description m-0 px-3 py-3 text-base\">{empty}</p>\n ) : scrolling ? (\n <section className=\"min-w-0\">\n <ScrollArea.Root\n fade={false}\n data-code-scroll=\"\"\n className=\"min-w-0 rounded-b-[inherit]\"\n style={{ height: `calc(${maxLines} * ${LINE_H} + ${PAD_Y} * 2)` }}\n >\n <ScrollArea.Viewport tabIndex={0} aria-label={scrollLabel}>\n <ScrollArea.Content>{body}</ScrollArea.Content>\n </ScrollArea.Viewport>\n <ScrollArea.Scrollbar>\n <ScrollArea.Thumb />\n </ScrollArea.Scrollbar>\n {wrap ? null : (\n <ScrollArea.Scrollbar orientation=\"horizontal\">\n <ScrollArea.Thumb />\n </ScrollArea.Scrollbar>\n )}\n </ScrollArea.Root>\n </section>\n ) : (\n body\n )}\n {overflow === \"expand\" && folds ? (\n <div className=\"border-pho-secondary flex items-center border-t px-1.5 py-1\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n aria-expanded={expanded}\n prefix={expanded ? IconChevronUp : IconChevronDown}\n onClick={() => setExpanded((prev) => !prev)}\n >\n {expanded ? \"Show less\" : `Show all ${lines.length} lines`}\n </Button>\n </div>\n ) : null}\n </div>\n );\n}\n\nCodeBlock.displayName = \"CodeBlock\";\n"],"x_google_ignoreList":[0,1,2],"mappings":";;;;;;;;;;;;AASA,IAAMA,KAAa;AAAA,EAAC,CAAC,QAAQ;AAAA,IAAE,GAAK;AAAA,IAAiB,KAAO;AAAA,EAAQ,CAAC;AAAA,EAAG,CAAC,QAAQ;AAAA,IAAE,GAAK;AAAA,IAAe,KAAO;AAAA,EAAQ,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;AAAA,QACjB,UAAA,gBAAA,EAAC,EAAW,MAAZ;AAAA,UACE,MAAM;AAAA,UACN,oBAAiB;AAAA,UACjB,WAAU;AAAA,UACV,OAAO,EAAE,QAAQ,QAAQ,CAAA,MAAc,EAAA,MAAY,EAAA,QAAa;AAAA,UAJlE,UAAA;AAAA,YAME,gBAAA,EAAC,EAAW,UAAZ;AAAA,cAAqB,UAAU;AAAA,cAAG,cAAY;AAAA,cAC5C,UAAA,gBAAA,EAAC,EAAW,SAAZ,EAAA,UAAqB,EAAyB,CAAA;AAAA,YAC3B,CAAA;AAAA,YACrB,gBAAA,EAAC,EAAW,WAAZ,EAAA,UACE,gBAAA,EAAC,EAAW,OAAZ,CAAmB,CAAA,EACC,CAAA;AAAA,YACrB,IAAO,OACN,gBAAA,EAAC,EAAW,WAAZ;AAAA,cAAsB,aAAY;AAAA,cAChC,UAAA,gBAAA,EAAC,EAAW,OAAZ,CAAmB,CAAA;AAAA,YACC,CAAA;AAAA,UAET;AAAA;MACV,CAAA,IAET;AAAA,MAED,MAAa,YAAY,IACxB,gBAAA,EAAC,OAAD;AAAA,QAAK,WAAU;AAAA,QACb,UAAA,gBAAA,EAAC,IAAD;AAAA,UACE,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,iBAAe;AAAA,UACf,QAAQ,IAAW,KAAgB;AAAA,UACnC,SAAA,MAAe,EAAA,CAAa,MAAS,CAAC,CAAI;AAAA,UAEzC,UAAA,IAAW,cAAc,YAAY,EAAM,MAAA;AAAA,QACtC,CAAA;AAAA,MACL,CAAA,IACH;AAAA,IACD;AAAA;AAET;AAEA,GAAU,cAAc"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { r as n, t as d } from "./chart-D4jJKeh2.js";
|
|
3
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
4
|
+
function h({ series: r, curve: t = "linear", area: l = !1, ...i }) {
|
|
5
|
+
return /* @__PURE__ */ e(d, {
|
|
6
|
+
...i,
|
|
7
|
+
children: r.map((a, o) => /* @__PURE__ */ e(n, {
|
|
8
|
+
dataKey: a.key,
|
|
9
|
+
label: a.label,
|
|
10
|
+
color: a.color,
|
|
11
|
+
dashed: a.dashed,
|
|
12
|
+
curve: t,
|
|
13
|
+
area: l && o === 0
|
|
14
|
+
}, a.key))
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
h.displayName = "LineChart";
|
|
18
|
+
export {
|
|
19
|
+
h as t
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=line-chart-3zH_lhTW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line-chart-3zH_lhTW.js","names":[],"sources":["../../src/components/line-chart/line-chart.tsx"],"sourcesContent":["import { Chart, ChartLine } from \"../chart/chart\";\nimport type { ChartBaseProps, ChartCurve, ChartDatum } from \"../chart/types\";\n\n/**\n * LineChart — series over time as lines: latency percentiles, one line\n * per destination, a min / average / max where the bounds are dashed.\n *\n * A preset on `Chart`: the `series` array becomes one `Chart.Line` per\n * entry, in order; `curve` applies to every line and `area` washes the\n * surface under the first. The marks, axes, tooltip and legend are the\n * root's.\n */\nexport interface LineChartProps<\n T extends ChartDatum,\n> extends ChartBaseProps<T> {\n /** Straight segments, or a monotone curve that never overshoots a sample. @default \"linear\" */\n curve?: ChartCurve;\n /** A soft fill under the first series (a lone one, as a rule). */\n area?: boolean;\n}\n\nexport function LineChart<T extends ChartDatum>({\n series,\n curve = \"linear\",\n area = false,\n ...props\n}: LineChartProps<T>) {\n return (\n <Chart {...props}>\n {series.map((s, index) => (\n <ChartLine\n key={s.key}\n dataKey={s.key}\n label={s.label}\n color={s.color}\n dashed={s.dashed}\n curve={curve}\n area={area && index === 0}\n />\n ))}\n </Chart>\n );\n}\n\nLineChart.displayName = \"LineChart\";\n"],"mappings":";;;AAqBA,SAAgB,EAAgC,EAC9C,QAAA,GACA,OAAA,IAAQ,UACR,MAAA,IAAO,IACP,GAAG,EAAA,GACiB;AACpB,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,GAAI;AAAA,IACR,UAAA,EAAO,IAAA,CAAK,GAAG,MACd,gBAAA,EAAC,GAAD;AAAA,MAEE,SAAS,EAAE;AAAA,MACX,OAAO,EAAE;AAAA,MACT,OAAO,EAAE;AAAA,MACT,QAAQ,EAAE;AAAA,MACH,OAAA;AAAA,MACP,MAAM,KAAQ,MAAU;AAAA,IACzB,GAPM,EAAE,GAOR,CACF;AAAA,EACI,CAAA;AAEX;AAEA,EAAU,cAAc"}
|