@mechane-ai/elements 0.58.1 → 0.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,957 +0,0 @@
1
- import { D as e, T as t, c as n, k as r, v as i, y as a } from "./src-9EJskqB_.js";
2
- import { t as o } from "./use-scroll-tab-index-Dxpdh4W7.js";
3
- import { t as s } from "./viewer-styles-DsFYri4K.js";
4
- import { i as c, t as l } from "./code-block-BZsY2sh3.js";
5
- import { p as u } from "./src-Dxs3Buo_.js";
6
- import { t as d } from "./content-link-PnpcnTCx.js";
7
- import * as f from "@stylexjs/stylex";
8
- import { useCallback as p, useLayoutEffect as m, useRef as h, useState as g, useSyncExternalStore as _ } from "react";
9
- import { createStickToBottom as v } from "@ui-sdk/core";
10
- import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
11
- import { Check as S, Circle as C, CircleDashed as w, CircleHelp as T, Clock as E, Pause as D, Play as O, SkipBack as k, SkipForward as A, X as j } from "lucide-react";
12
- import M from "strip-ansi";
13
- import { fuzzyScore as N, matchRanges as ee, matchRanges as P, matchSegments as F, matchSegments as I } from "@ui-sdk/react/text-match";
14
- import { clamp as L, fractionOf as te, maxOnGrid as R, scrubTo as z, stepBy as ne, stepFromKey as re, valueAt as ie } from "@ui-sdk/core/number";
15
- // packages/content/src/json-viewer.tsx
16
- var B = { body: {
17
- kmVPX3: "x1mvvolr",
18
- kVQacm: "xysyzu8",
19
- kskxy: "x1phlbz0",
20
- kMv6JI: "xiard35",
21
- kGuDYH: "xy8obcc",
22
- $$css: !0
23
- } }, V = 500;
24
- function H({ value: e, name: t, path: n, depth: r, maxDepth: a, maxEntries: o }) {
25
- if (typeof e != "object" || !e) {
26
- let n = JSON.stringify(e), r = n.length > V;
27
- return /* @__PURE__ */ x("div", {
28
- className: "xeuugli x126k92a xj0a0fe",
29
- children: [
30
- /* @__PURE__ */ x("span", {
31
- className: "x153jb6y",
32
- children: [t, ": "]
33
- }),
34
- /* @__PURE__ */ b("span", {
35
- ...{
36
- 0: { className: "xbixft" },
37
- 1: { className: "x7ixh4y" }
38
- }[typeof e == "string" | 0],
39
- children: n.slice(0, V)
40
- }),
41
- r && /* @__PURE__ */ b("span", {
42
- className: "x153jb6y x1hz01jw",
43
- children: "… (value truncated)"
44
- })
45
- ]
46
- });
47
- }
48
- let s = Object.entries(e), c = Array.isArray(e) ? `${s.length} items` : `${s.length} fields`;
49
- return r >= a ? /* @__PURE__ */ x("div", {
50
- className: "xeuugli x126k92a xj0a0fe",
51
- children: [/* @__PURE__ */ x("span", {
52
- className: "x153jb6y",
53
- children: [t, ": "]
54
- }), /* @__PURE__ */ x("span", {
55
- className: "x153jb6y x1hz01jw",
56
- children: [c, " · depth limit"]
57
- })]
58
- }) : /* @__PURE__ */ x(i.Root, {
59
- defaultOpen: r === 0,
60
- className: "xeuugli x126k92a xj0a0fe",
61
- children: [/* @__PURE__ */ b(i.Trigger, {
62
- variant: "inline",
63
- children: /* @__PURE__ */ x("span", {
64
- className: "xiard35 xy8obcc",
65
- children: [
66
- /* @__PURE__ */ x("span", {
67
- className: "x153jb6y",
68
- children: [t, ": "]
69
- }),
70
- Array.isArray(e) ? "[]" : "{}",
71
- " ",
72
- /* @__PURE__ */ b("span", {
73
- className: "x153jb6y x1hz01jw",
74
- children: c
75
- })
76
- ]
77
- })
78
- }), /* @__PURE__ */ b(i.Panel, { children: /* @__PURE__ */ x("div", {
79
- className: "xo02m6d xpilrb4 x1t7ytsu x97x49r xa1dmyi xiard35 xy8obcc",
80
- children: [s.slice(0, o).map(([e, t]) => {
81
- let i = `${n}/${e.replaceAll("~", "~0").replaceAll("/", "~1")}`;
82
- return /* @__PURE__ */ b(H, {
83
- name: JSON.stringify(e),
84
- path: i,
85
- value: t,
86
- depth: r + 1,
87
- maxDepth: a,
88
- maxEntries: o
89
- }, i);
90
- }), s.length > o && /* @__PURE__ */ x("div", {
91
- className: "x153jb6y x1hz01jw",
92
- children: [s.length - o, " more entries · copy to inspect the complete value"]
93
- })]
94
- }) })]
95
- });
96
- }
97
- function ae({ value: e, label: t, maxDepth: n = 6, maxEntries: r = 50 }) {
98
- let i = o(), l = p(() => JSON.stringify(e, null, 2), [e]);
99
- return /* @__PURE__ */ x(c, {
100
- kind: "json",
101
- "aria-label": t,
102
- ...f.props(s.root),
103
- children: [/* @__PURE__ */ x("div", {
104
- ...f.props(s.header),
105
- children: [/* @__PURE__ */ b("span", {
106
- ...f.props(s.label),
107
- children: t
108
- }), /* @__PURE__ */ b(a, {
109
- label: t,
110
- value: l,
111
- children: "Copy JSON"
112
- })]
113
- }), /* @__PURE__ */ b("div", {
114
- ref: i.ref,
115
- role: "region",
116
- "aria-label": `${t} fields`,
117
- tabIndex: i.tabIndex,
118
- ...f.props(s.scrollRegion, B.body),
119
- children: /* @__PURE__ */ b(H, {
120
- name: "root",
121
- path: "",
122
- value: e,
123
- depth: 0,
124
- maxDepth: Math.max(1, n),
125
- maxEntries: Math.max(1, r)
126
- })
127
- })]
128
- });
129
- }
130
- // packages/content/src/log-viewer.tsx
131
- var oe = {
132
- kVQacm: "xysyzu8",
133
- kmVPX3: "x1mvvolr",
134
- kogj98: "x1ghz6dp",
135
- kMv6JI: "xiard35",
136
- kGuDYH: "xy8obcc",
137
- kLWn49: "x1778rvt",
138
- khDVqt: "x126k92a",
139
- kHjlTd: "xj0a0fe",
140
- kKi2Bq: "xeq4nuv",
141
- $$css: !0
142
- }, U = {
143
- output: (e) => [
144
- oe,
145
- {
146
- kskxy: e == null ? e : "x1jols5v",
147
- $$css: !0
148
- },
149
- { "--x-maxHeight": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }
150
- ],
151
- notice: {
152
- kt9PQ7: "xso031l",
153
- kfdmCh: "x1q0q8m5",
154
- kL6WhQ: "x1qndepd",
155
- $$css: !0
156
- }
157
- }, se = 2e5;
158
- function ce({ output: e, label: n, variant: r = "default", maxLines: i = 500, maxHeight: l = 320, isRunning: u = !1 }) {
159
- let d = o(), p = d.viewport, y = h(!1), [S] = g(() => {
160
- let e = v();
161
- return {
162
- ...e,
163
- subscribe: (t) => e.subscribe(t),
164
- read: () => e.get()
165
- };
166
- }), { following: C } = _(S.subscribe, S.read, S.read), w = M(e), T = w.slice(-2e5).split("\n"), E = T.slice(-Math.max(1, i)), D = T.length - E.length, O = r === "embedded", k = u && (!O || !C);
167
- return m(() => {
168
- let e = p.current;
169
- return e === null ? void 0 : S.connect(e);
170
- }, [S, p]), m(() => {
171
- !u && y.current && (y.current = !1, p.current?.focus({ preventScroll: !0 }));
172
- }, [u]), /* @__PURE__ */ x(c, {
173
- kind: "log",
174
- "aria-label": n,
175
- ...f.props(s.root, O && s.embedded),
176
- children: [
177
- /* @__PURE__ */ x("div", {
178
- ...f.props(s.header, O && s.embeddedHeader),
179
- children: [/* @__PURE__ */ x("span", {
180
- ...f.props(s.label),
181
- children: [n, u && !O && " · running"]
182
- }), /* @__PURE__ */ x("div", {
183
- ...f.props(s.actions),
184
- children: [k && /* @__PURE__ */ b(t, {
185
- variant: "ghost",
186
- onClick: () => {
187
- C ? S.release() : S.scrollToBottom();
188
- },
189
- onFocus: () => {
190
- y.current = !0;
191
- },
192
- onBlur: () => {
193
- y.current = !1;
194
- },
195
- children: C ? "Pause following" : "Follow output"
196
- }), /* @__PURE__ */ b(a, {
197
- value: e,
198
- label: n,
199
- display: O ? "icon" : "value",
200
- children: "Copy"
201
- })]
202
- })]
203
- }),
204
- D > 0 && /* @__PURE__ */ x("div", {
205
- ...f.props(s.note, U.notice),
206
- children: [D, " earlier lines omitted from this view. Copy includes the supplied output."]
207
- }),
208
- w.length > se && /* @__PURE__ */ b("div", {
209
- ...f.props(s.note, U.notice),
210
- children: "Preview limited to the last 200,000 characters. Copy includes the supplied output."
211
- }),
212
- /* @__PURE__ */ b("pre", {
213
- ref: d.ref,
214
- role: "region",
215
- "aria-label": `${n} output`,
216
- tabIndex: d.tabIndex,
217
- ...f.props(s.scrollRegion, U.output(l)),
218
- children: /* @__PURE__ */ b("span", {
219
- className: "x1lliihq",
220
- children: w.length === 0 ? "No output recorded." : E.join("\n")
221
- })
222
- })
223
- ]
224
- });
225
- }
226
- // packages/content/src/media-viewer.tsx
227
- var W = {
228
- viewport: {
229
- k1xSpc: "xrvj5dj",
230
- kgQiWS: "x1ku5rj1",
231
- kzqmXN: "xh8yej3",
232
- kOBAk4: "x186iv6y",
233
- kskxy: "xcwfpss",
234
- k7Eaqz: "xeuugli",
235
- kVQacm: "xb3r6kr",
236
- kWkggS: "x1r7kqkb",
237
- $$css: !0
238
- },
239
- placeholder: {
240
- kWkggS: "x1fa40ue",
241
- $$css: !0
242
- }
243
- };
244
- function le() {
245
- return /* @__PURE__ */ b("div", {
246
- "aria-hidden": !0,
247
- ...f.props(s.root, W.viewport, W.placeholder)
248
- });
249
- }
250
- function ue({ kind: e, src: t, label: n, widthPixels: r, heightPixels: i, onError: a }) {
251
- return /* @__PURE__ */ b("div", {
252
- ...f.props(s.root, W.viewport),
253
- children: e === "image" ? /* @__PURE__ */ b("img", {
254
- src: t,
255
- alt: n,
256
- width: r,
257
- height: i,
258
- onError: a,
259
- className: "x1lliihq xh8yej3 x5yr21d x2lwn1j x19kjcj4"
260
- }) : /* @__PURE__ */ b("video", {
261
- src: t,
262
- "aria-label": n,
263
- width: r,
264
- height: i,
265
- controls: !0,
266
- muted: !0,
267
- playsInline: !0,
268
- preload: "metadata",
269
- onError: a,
270
- className: "x1lliihq xh8yej3 x5yr21d x2lwn1j x19kjcj4"
271
- })
272
- });
273
- }
274
- // packages/content/src/playback-bar.tsx
275
- var de = [
276
- .25,
277
- .5,
278
- 1,
279
- 2,
280
- 4
281
- ], G = "Playback controls", K = 16, q = {
282
- bar: {
283
- k1xSpc: "x78zum5",
284
- kwnvtZ: "x1a02dak",
285
- kGNEyG: "x6s0dn4",
286
- kB7OPa: "x9f619",
287
- k7Eaqz: "xeuugli",
288
- kMzoRj: "xmkeg23",
289
- ksu8eU: "x1y0btm7",
290
- kVAM5u: "x1ey3b81",
291
- kaIpWk: "x1ok0vyi",
292
- kWkggS: "xpvm0e4",
293
- $$css: !0
294
- },
295
- standardBar: {
296
- k1C7PZ: "xa2sdi0",
297
- khm7nJ: "x1gkm1c7",
298
- k8WAf4: "x1hmw7ec",
299
- kg3NbH: "x5g2kb4",
300
- $$css: !0
301
- },
302
- compactBar: {
303
- k1C7PZ: "x26z182",
304
- khm7nJ: "x1gkm1c7",
305
- k8WAf4: "x10dazmo",
306
- kg3NbH: "x14w6jbu",
307
- $$css: !0
308
- }
309
- }, fe = {
310
- standard: q.standardBar,
311
- compact: q.compactBar
312
- };
313
- function pe(e) {
314
- return e != null && typeof e != "boolean";
315
- }
316
- function J(e) {
317
- return e !== void 0 && Number.isFinite(e) && e > 0;
318
- }
319
- function me(e, t) {
320
- let n = new Set(e.filter((e) => J(e)));
321
- return J(t) && n.add(t), Array.from(n).toSorted((e, t) => e - t).map((e) => ({
322
- value: String(e),
323
- label: `${e}x`
324
- }));
325
- }
326
- function he({ isPlaying: t, onPlayingChange: r, onStepBackward: i, onStepForward: a, speed: o, speeds: s = de, onSpeedChange: c, readout: l, actions: d, density: p = "standard", isDisabled: m = !1, playLabel: h = "Play", pauseLabel: g = "Pause", label: _ = G, xstyle: v }) {
327
- let y = o !== void 0 && c !== void 0, S = pe(d), C = J(o) ? o : void 0, w = y ? me(s, C) : [], T = C === void 0 ? null : String(C), E = _.trim(), j = E.length > 0 ? E : G;
328
- return /* @__PURE__ */ x("div", {
329
- role: "group",
330
- "aria-label": j,
331
- ...f.props(q.bar, fe[p], v),
332
- children: [
333
- /* @__PURE__ */ x("div", {
334
- className: "x78zum5 x6s0dn4 xunmzkg x2lah0s",
335
- children: [
336
- i !== void 0 && /* @__PURE__ */ b(e, {
337
- variant: "ghost",
338
- density: p,
339
- "aria-label": "Step backward",
340
- disabled: m,
341
- onClick: i,
342
- children: /* @__PURE__ */ b(k, { size: K })
343
- }),
344
- /* @__PURE__ */ b(e, {
345
- variant: "outline",
346
- density: p,
347
- "aria-label": t ? g : h,
348
- disabled: m,
349
- onClick: () => r(!t),
350
- children: b(t ? D : O, { size: K })
351
- }),
352
- a !== void 0 && /* @__PURE__ */ b(e, {
353
- variant: "ghost",
354
- density: p,
355
- "aria-label": "Step forward",
356
- disabled: m,
357
- onClick: a,
358
- children: /* @__PURE__ */ b(A, { size: K })
359
- })
360
- ]
361
- }),
362
- y && /* @__PURE__ */ b(u, {
363
- label: "Playback speed",
364
- density: p,
365
- disabled: m,
366
- items: w,
367
- value: T,
368
- onValueChange: (e) => {
369
- if (e === null) return;
370
- let t = Number(e);
371
- J(t) && c(t);
372
- }
373
- }),
374
- l !== void 0 && /* @__PURE__ */ b("span", {
375
- className: "x1lliihq x9f619 xeuugli x193iq5w xb3r6kr xlyipyv xss6m8b xuxw1ft x14w6jbu",
376
- children: /* @__PURE__ */ b(n, {
377
- variant: "mono",
378
- tone: "muted",
379
- children: l
380
- })
381
- }),
382
- S && /* @__PURE__ */ b("div", {
383
- className: "x78zum5 x1a02dak x6s0dn4 xunmzkg xvc5jky xeuugli",
384
- children: d
385
- })
386
- ]
387
- });
388
- }
389
- // packages/content/src/stack-trace.tsx
390
- function ge({ message: e, frames: t }) {
391
- return /* @__PURE__ */ x(c, {
392
- kind: "stack-trace",
393
- "aria-label": "Stack trace",
394
- ...f.props(s.root),
395
- children: [/* @__PURE__ */ b("p", {
396
- className: "x1ghz6dp x1mvvolr xso031l x1q0q8m5 x1qndepd xr5kp14 xk4h15q xj0a0fe",
397
- children: e
398
- }), t.length === 0 ? /* @__PURE__ */ b("p", {
399
- className: "x1ghz6dp x1mvvolr x153jb6y",
400
- children: "No frames recorded."
401
- }) : /* @__PURE__ */ b("ol", {
402
- className: "x1ghz6dp x1717udv x3ct3a4",
403
- children: t.map((e) => {
404
- let t = [
405
- e.file,
406
- e.line,
407
- e.column
408
- ].filter((e) => e !== void 0).join(":");
409
- return /* @__PURE__ */ x("li", {
410
- className: "x78zum5 xdt5ytf x1hnptsi xeuugli xj0a0fe x1mvvolr xso031l x1t1lzn6 x1q0q8m5 x1qndepd",
411
- children: [/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b(d, {
412
- href: e.href,
413
- children: e.name
414
- }), t.length > 0 && /* @__PURE__ */ b("span", {
415
- className: "x1lliihq x153jb6y xiard35 xy8obcc xj0a0fe",
416
- children: t
417
- })] }), e.code !== void 0 && /* @__PURE__ */ b(l, {
418
- code: e.code,
419
- language: e.language,
420
- filename: e.file
421
- })]
422
- }, e.id);
423
- })
424
- })]
425
- });
426
- }
427
- // packages/content/src/text-match.tsx
428
- var Y = {
429
- mark: {
430
- kWkggS: "x1dqe72f",
431
- kMwMTN: "xbixft",
432
- kaIpWk: "x1ok0vyi",
433
- kg3NbH: "x1r97e56",
434
- $$css: !0
435
- },
436
- accent: {
437
- kWkggS: "x1r8u7ye",
438
- kMwMTN: "x7ixh4y",
439
- $$css: !0
440
- },
441
- danger: {
442
- kWkggS: "xcqwzn",
443
- kMwMTN: "xr5kp14",
444
- $$css: !0
445
- }
446
- };
447
- function _e({ text: e, query: t, ranges: n, tone: r = "warning", mode: i = "contains" }) {
448
- let a = n === void 0 ? t.trim() === "" ? [] : ee(e, t, i) : [...n], o = a.length === 0 ? [{
449
- text: e,
450
- match: !1
451
- }] : F(e, a), s = r === "accent" ? Y.accent : r === "danger" ? Y.danger : void 0, c = 0;
452
- return /* @__PURE__ */ b(y, { children: o.map((e) => {
453
- let t = `${c}-${e.match ? "m" : "t"}`;
454
- return c += e.text.length, e.match ? /* @__PURE__ */ b("mark", {
455
- ...f.props(Y.mark, s),
456
- children: e.text
457
- }, t) : /* @__PURE__ */ b("span", { children: e.text }, t);
458
- }) });
459
- }
460
- // packages/content/src/timeline-scrubber.tsx
461
- var ve = .1, ye = 4, X = {
462
- root: {
463
- kVAEAm: "x1n2onr6",
464
- kHBbk8: "xc8icb0",
465
- kzqmXN: "xh8yej3",
466
- k7Eaqz: "xeuugli",
467
- kB7OPa: "x9f619",
468
- kg3NbH: "xlkn9b3",
469
- kFalU9: "x5ve5x3",
470
- kfSwDN: "x87ps6o",
471
- kk7Lky: "xwj21n9",
472
- $$css: !0
473
- },
474
- fill: {
475
- kVAEAm: "x10l6tqk",
476
- kYYq5F: "x10no89f",
477
- kLqNvP: "x1o0tod",
478
- kaIpWk: "x1ok0vyi",
479
- kWkggS: "x1pt885t",
480
- kfzvcC: "x47corl",
481
- $$css: !0
482
- },
483
- fillWidth: (e) => [{
484
- kzqmXN: e == null ? e : "x5lhr3w",
485
- $$css: !0
486
- }, { "--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }],
487
- thumb: {
488
- kVAEAm: "x10l6tqk",
489
- k87sOh: "xwa60dl",
490
- kY2c9j: "xhtitgo",
491
- kB7OPa: "x9f619",
492
- kzqmXN: "x6jxa94",
493
- kZKoxP: "x1v9usgg",
494
- k3aq6I: "x11lhmoz",
495
- kMzoRj: "xmkeg23",
496
- ksu8eU: "x1y0btm7",
497
- kVAM5u: "x159tnba",
498
- kaIpWk: "x1ok0vyi",
499
- kWkggS: "xpvm0e4",
500
- kfzvcC: "x47corl",
501
- k1ekBW: "x11xpdln",
502
- kIyJzY: "xtitasy xsn8rav",
503
- kAMwcw: "x1faw7qm",
504
- $$css: !0
505
- },
506
- thumbHover: {
507
- k3aq6I: "x11lhmoz xks79hj",
508
- $$css: !0
509
- },
510
- thumbDragging: {
511
- kWkggS: "x1r7kqkb",
512
- k3aq6I: "xt56bak",
513
- kIyJzY: "x1mq3mr6",
514
- $$css: !0
515
- },
516
- insetOffset: (e) => [{
517
- kLqNvP: e == null ? e : "x1lxsm33",
518
- $$css: !0
519
- }, { "--x-insetInlineStart": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }],
520
- markerButton: {
521
- kVAEAm: "x10l6tqk",
522
- k87sOh: "xwa60dl",
523
- k1xSpc: "x3nfvp2",
524
- kGNEyG: "x6s0dn4",
525
- kjj79g: "xl56j7k",
526
- kmVPX3: "x1717udv",
527
- kogj98: "x1ghz6dp",
528
- kMzoRj: "xc342km",
529
- kaIpWk: "x1ok0vyi",
530
- kWkggS: "xjbqb8w",
531
- kzqmXN: "xnr66md x1gtc3ja",
532
- kZKoxP: "x1f9pz31 x992rv9",
533
- k3aq6I: "x11lhmoz",
534
- kFalU9: "x5ve5x3",
535
- kfSwDN: "x87ps6o",
536
- kkrTdU: "x1ypdohk",
537
- kfzvcC: "x67bb7w",
538
- kYPGJ8: "xtgyt42",
539
- kPJHz1: "x13qnu6",
540
- k7shQP: "x9v5kkp",
541
- kZs9gx: "x19rmrnh",
542
- kiEn40: "x13iak60",
543
- ksxJu9: "x1m2itun x14a0mdr",
544
- k1ekBW: "x11xpdln",
545
- kIyJzY: "xtitasy xsn8rav",
546
- kAMwcw: "x1faw7qm",
547
- $$css: !0
548
- },
549
- markerPip: {
550
- k1xSpc: "x1lliihq",
551
- kB7OPa: "x9f619",
552
- kzqmXN: "x1v4s8kt",
553
- kZKoxP: "x1kpxq89",
554
- kaIpWk: "x1ok0vyi",
555
- kMzoRj: "xmkeg23",
556
- ksu8eU: "x1y0btm7",
557
- kVAM5u: "x11kgbel",
558
- $$css: !0
559
- },
560
- toneNeutral: {
561
- kWkggS: "x102e5jz",
562
- $$css: !0
563
- },
564
- tonePositive: {
565
- kWkggS: "xltmwy2",
566
- $$css: !0
567
- },
568
- toneWarning: {
569
- kWkggS: "xw9id30",
570
- $$css: !0
571
- },
572
- toneNegative: {
573
- kWkggS: "xqtq5zq",
574
- $$css: !0
575
- },
576
- toneAccent: {
577
- kWkggS: "x16lk066",
578
- $$css: !0
579
- }
580
- }, be = {
581
- neutral: X.toneNeutral,
582
- positive: X.tonePositive,
583
- warning: X.toneWarning,
584
- negative: X.toneNegative,
585
- accent: X.toneAccent
586
- };
587
- function xe(e, t) {
588
- try {
589
- e.setPointerCapture(t);
590
- } catch {}
591
- }
592
- function Se(e, t) {
593
- try {
594
- e.hasPointerCapture(t) && e.releasePointerCapture(t);
595
- } catch {}
596
- }
597
- function Ce(e, t) {
598
- if (!(e instanceof Element)) return;
599
- let n = e.closest("[data-marker-id]");
600
- if (!(n instanceof HTMLElement)) return;
601
- let r = n.dataset.markerId;
602
- if (r !== void 0) return t.find((e) => e.marker.id === r);
603
- }
604
- function we(e, t) {
605
- let n = R(t);
606
- return n < t.max && e >= (n + t.max) / 2 ? t.max : L(z(e, t).value, t.min, t.max);
607
- }
608
- function Te({ value: e, max: t, min: n = 0, step: r = 1, onValueChange: i, onScrubStart: a, onScrubEnd: o, markers: s, onMarkerSelect: c, formatValue: l, isDisabled: u = !1, label: d, xstyle: p }) {
609
- let m = h(null), _ = h(null), v = h(null), y = h(!1), S = h(null), C = h(null), [w, T] = g(!1), [E, D] = g(!1), O = Number.isFinite(n) ? n : 0, k = Number.isFinite(t) && t >= O ? t : O, A = Number.isFinite(r) && r > 0 ? r : 1, j = k - O, M = L(Number.isFinite(e) ? e : O, O, k), N = j > 0 ? te(M, {
610
- min: O,
611
- max: k
612
- }) * 100 : 0, ee = l === void 0 ? void 0 : l(M), P = s === void 0 ? [] : s.filter((e) => Number.isFinite(e.position)).map((e) => ({
613
- marker: e,
614
- position: L(e.position, O, k)
615
- }));
616
- function F(e) {
617
- if (j <= 0) return O;
618
- let t = _.current?.getBoundingClientRect();
619
- if (t === void 0 || t.width <= 0) return M;
620
- let n = L((e - t.left) / t.width, 0, 1);
621
- return we(ie(n, {
622
- min: O,
623
- max: k
624
- }), {
625
- min: O,
626
- max: k,
627
- step: A
628
- });
629
- }
630
- function I(e) {
631
- C.current !== e && (C.current = e, i(e));
632
- }
633
- function R(e) {
634
- if (u || e.button !== 0 || j <= 0) return;
635
- xe(e.currentTarget, e.pointerId), v.current = e.pointerId, C.current = null;
636
- let t = Ce(e.target, P);
637
- t === void 0 ? (S.current = null, y.current = !0, T(!0), a?.(), I(F(e.clientX))) : (e.preventDefault(), m.current?.focus({ preventScroll: !0 }), y.current = !1, S.current = {
638
- marker: t.marker,
639
- position: t.position,
640
- startClientX: e.clientX,
641
- startClientY: e.clientY
642
- });
643
- }
644
- function z(e) {
645
- if (u || v.current !== e.pointerId) return;
646
- let t = S.current;
647
- if (t !== null) {
648
- let n = e.clientX - t.startClientX, r = e.clientY - t.startClientY;
649
- if (Math.hypot(n, r) < ye) return;
650
- S.current = null, y.current = !0, T(!0), a?.();
651
- }
652
- y.current && I(F(e.clientX));
653
- }
654
- function B(e) {
655
- if (v.current !== e.pointerId) return;
656
- let t = S.current, n = y.current;
657
- v.current = null, S.current = null, y.current = !1, C.current = null, Se(e.currentTarget, e.pointerId), t !== null && !u ? (i(t.position), c?.(t.marker)) : n && (T(!1), o?.());
658
- }
659
- function V(e) {
660
- if (v.current !== e.pointerId) return;
661
- let t = y.current;
662
- v.current = null, S.current = null, y.current = !1, C.current = null, Se(e.currentTarget, e.pointerId), t && (T(!1), o?.());
663
- }
664
- function H(e) {
665
- if (u || e.ctrlKey || e.metaKey) return;
666
- let t = re(e.nativeEvent);
667
- if (t === null) return;
668
- if (e.preventDefault(), t.bound === "min") {
669
- M !== O && i(O);
670
- return;
671
- }
672
- if (t.bound === "max") {
673
- M !== k && i(k);
674
- return;
675
- }
676
- let n = Math.max(A, j * ve), r = L(ne(M, t, {
677
- min: O,
678
- max: k,
679
- step: A,
680
- largeStep: n
681
- }), O, k), a = t.direction > 0 && t.size === "large" && M + n >= k, o = t.direction > 0 && r <= M && M < k, s = a || o ? k : r;
682
- s !== M && i(s);
683
- }
684
- let ae = E && !u && !w;
685
- return /* @__PURE__ */ x("div", {
686
- "data-disabled": u ? "" : void 0,
687
- onPointerDown: R,
688
- onPointerMove: z,
689
- onPointerUp: B,
690
- onPointerCancel: V,
691
- onLostPointerCapture: V,
692
- onPointerEnter: () => D(!0),
693
- onPointerLeave: () => D(!1),
694
- ...f.props(X.root, p),
695
- children: [/* @__PURE__ */ b("div", {
696
- ref: m,
697
- role: "slider",
698
- tabIndex: u ? -1 : 0,
699
- "aria-label": d,
700
- "aria-valuemin": O,
701
- "aria-valuemax": k,
702
- "aria-valuenow": M,
703
- "aria-valuetext": ee,
704
- "aria-disabled": u || void 0,
705
- "data-disabled": u ? "" : void 0,
706
- "data-dragging": w ? "" : void 0,
707
- onKeyDown: H,
708
- className: "x1n2onr6 x78zum5 x6s0dn4 xh8yej3 x17tes2r x17oiadl x5ve5x3 x87ps6o x1ypdohk x1t137rt x1m8qfh3 x13qnu6 x9v5kkp x19rmrnh x7s97pk xv519k6",
709
- children: /* @__PURE__ */ x("div", {
710
- ref: _,
711
- className: "x1n2onr6 xh8yej3 xqu0tyb x1ok0vyi x1fa40ue",
712
- children: [/* @__PURE__ */ b("div", { ...f.props(X.fill, X.fillWidth(`${N}%`)) }), /* @__PURE__ */ b("div", {
713
- "aria-hidden": !0,
714
- ...f.props(X.thumb, X.insetOffset(`${N}%`), ae && X.thumbHover, w && X.thumbDragging)
715
- })]
716
- })
717
- }), P.length > 0 && /* @__PURE__ */ b("div", {
718
- className: "x10l6tqk x10no89f x1u5aj70 x1vjfegm x47corl",
719
- children: P.map(({ marker: e, position: t }) => {
720
- let n = j > 0 ? te(t, {
721
- min: O,
722
- max: k
723
- }) * 100 : 0, r = e.tone ?? "neutral";
724
- return /* @__PURE__ */ b("button", {
725
- type: "button",
726
- tabIndex: -1,
727
- "data-marker-id": e.id,
728
- "aria-label": e.label,
729
- title: e.label,
730
- disabled: u,
731
- onClick: (n) => {
732
- u || j <= 0 || n.detail !== 0 || (i(t), c?.(e));
733
- },
734
- ...f.props(X.markerButton, X.insetOffset(`${n}%`)),
735
- children: /* @__PURE__ */ b("span", {
736
- "aria-hidden": !0,
737
- ...f.props(X.markerPip, be[r])
738
- })
739
- }, e.id);
740
- })
741
- })]
742
- });
743
- }
744
- // packages/content/src/trace.tsx
745
- var Z = {
746
- pending: {
747
- kMwMTN: "x153jb6y",
748
- $$css: !0
749
- },
750
- running: {
751
- kMwMTN: "xbixft",
752
- $$css: !0
753
- },
754
- complete: {
755
- kMwMTN: "x7ixh4y",
756
- $$css: !0
757
- },
758
- failed: {
759
- kMwMTN: "xr5kp14",
760
- $$css: !0
761
- },
762
- skipped: {
763
- kMwMTN: "x153jb6y",
764
- $$css: !0
765
- },
766
- unknown: {
767
- kMwMTN: "x153jb6y",
768
- $$css: !0
769
- }
770
- }, Ee = {
771
- pending: Z.pending,
772
- running: Z.running,
773
- complete: Z.complete,
774
- failed: Z.failed,
775
- skipped: Z.skipped,
776
- unknown: Z.unknown
777
- }, De = {
778
- pending: E,
779
- running: C,
780
- complete: S,
781
- failed: j,
782
- skipped: w,
783
- unknown: T
784
- };
785
- function Oe({ label: e, children: t }) {
786
- return /* @__PURE__ */ b("ol", {
787
- "aria-label": e,
788
- className: "x1ghz6dp x1717udv x3ct3a4 xeuugli x1hz01jw xtqrqnz x1778rvt xj57cvi xbixft",
789
- children: t
790
- });
791
- }
792
- function ke({ label: e, children: t }) {
793
- return /* @__PURE__ */ b("ol", {
794
- "aria-label": e,
795
- className: "x1ghz6dp x1717udv x3ct3a4 xeuugli x1hz01jw xtqrqnz x1778rvt xj57cvi xbixft x3bg4vu",
796
- children: t
797
- });
798
- }
799
- function Ae({ id: e, label: t, status: n, statusLabel: a, description: o, detail: s, isSelected: c, onSelect: l, children: u }) {
800
- let d = De[n];
801
- return /* @__PURE__ */ x("li", {
802
- "data-item-id": e,
803
- className: "x1n2onr6 xrvj5dj x1qpdrs7 x8zbtdt x1wv5www xup0pd7",
804
- children: [/* @__PURE__ */ x("div", {
805
- "aria-hidden": !0,
806
- className: "x78zum5 xdt5ytf x6s0dn4 xunmzkg x1lk341d",
807
- children: [/* @__PURE__ */ b(d, {
808
- size: 14,
809
- ...f.props(Ee[n])
810
- }), /* @__PURE__ */ b("span", { className: "x1i1rx1s x1f6qilh x98rzlu x1fa40ue" })]
811
- }), /* @__PURE__ */ x("div", {
812
- className: "x78zum5 xdt5ytf xunmzkg xeuugli",
813
- children: [
814
- /* @__PURE__ */ b("div", {
815
- ...{
816
- 0: { className: "xk4h15q xj0a0fe" },
817
- 1: { className: "xk4h15q xj0a0fe xujl8zx xda060z" }
818
- }[c === !0 | 0],
819
- children: l === void 0 ? t : /* @__PURE__ */ b(r, {
820
- "aria-pressed": c,
821
- onClick: () => l(e),
822
- children: t
823
- })
824
- }),
825
- /* @__PURE__ */ b("span", {
826
- className: "xy8obcc xas2l8k x153jb6y xj0a0fe",
827
- children: a
828
- }),
829
- o !== void 0 && /* @__PURE__ */ b("p", {
830
- className: "x1ghz6dp x153jb6y xj0a0fe",
831
- children: o
832
- }),
833
- s !== void 0 && /* @__PURE__ */ x(i.Root, { children: [/* @__PURE__ */ b(i.Trigger, { children: "Details" }), /* @__PURE__ */ b(i.Panel, { children: s })] }),
834
- u
835
- ]
836
- })]
837
- });
838
- }
839
- var je = {
840
- Root: Oe,
841
- Item: Ae,
842
- Group: ke
843
- }, Q = {
844
- root: {
845
- k1xSpc: "x78zum5",
846
- kXwgrk: "xdt5ytf",
847
- kB7OPa: "x9f619",
848
- kzqmXN: "xh8yej3",
849
- kVQacm: "xb3r6kr",
850
- $$css: !0
851
- },
852
- rootIntrinsic: { $$css: !0 },
853
- rootFill: {
854
- kZKoxP: "x5yr21d",
855
- kAzted: "x2lwn1j",
856
- $$css: !0
857
- },
858
- stage: {
859
- kVAEAm: "x1n2onr6",
860
- kzqmXN: "xh8yej3",
861
- k7Eaqz: "xeuugli",
862
- kAzted: "x2lwn1j",
863
- kVQacm: "xb3r6kr",
864
- kWkggS: "x1r7kqkb",
865
- $$css: !0
866
- },
867
- ratio16x9: {
868
- kOBAk4: "x186iv6y",
869
- $$css: !0
870
- },
871
- ratio16x10: {
872
- kOBAk4: "x2ebxmi",
873
- $$css: !0
874
- },
875
- ratio4x3: {
876
- kOBAk4: "x1dltgaz",
877
- $$css: !0
878
- },
879
- ratioFill: {
880
- kUk6DE: "x98rzlu",
881
- kAzted: "x2lwn1j",
882
- $$css: !0
883
- },
884
- overlay: {
885
- kVAEAm: "x10l6tqk",
886
- kpwlN0: "x10a8y8t",
887
- k1xSpc: "xrvj5dj",
888
- kgQiWS: "x1ku5rj1",
889
- kmVPX3: "x1c8xbx5",
890
- kB7OPa: "x9f619",
891
- kWkggS: "x1r7kqkb",
892
- kMwMTN: "x153jb6y",
893
- kVQacm: "xysyzu8",
894
- $$css: !0
895
- }
896
- }, Me = {
897
- "16/9": Q.rootIntrinsic,
898
- "16/10": Q.rootIntrinsic,
899
- "4/3": Q.rootIntrinsic,
900
- fill: Q.rootFill
901
- }, Ne = {
902
- "16/9": Q.ratio16x9,
903
- "16/10": Q.ratio16x10,
904
- "4/3": Q.ratio4x3,
905
- fill: Q.ratioFill
906
- };
907
- function $(e) {
908
- return e != null && typeof e != "boolean";
909
- }
910
- function Pe({ headerStart: e, headerEnd: t }) {
911
- let n = $(e), r = $(t);
912
- return /* @__PURE__ */ x("div", {
913
- ...f.props(s.header),
914
- children: [n && /* @__PURE__ */ b("div", {
915
- className: "x78zum5 x1a02dak x6s0dn4 x1hnptsi x8xikuq xeuugli xbixft xj0a0fe",
916
- children: e
917
- }), r && /* @__PURE__ */ b("div", {
918
- className: "x78zum5 x1a02dak x6s0dn4 x1hnptsi xvc5jky xeuugli",
919
- children: t
920
- })]
921
- });
922
- }
923
- function Fe({ aspectRatio: e = "16/9", headerStart: t, headerEnd: n, notice: r, state: i = "ready", placeholder: a, children: c, label: l, xstyle: u }) {
924
- let d = o(), p = $(t), m = $(n), h = p || m, g = $(r), _ = $(a), v = i !== "ready" && _, y = l?.trim(), S = y !== void 0 && y.length > 0;
925
- return /* @__PURE__ */ x("div", {
926
- ...f.props(s.root, Q.root, Me[e], u),
927
- children: [
928
- h && /* @__PURE__ */ b(Pe, {
929
- headerStart: t,
930
- headerEnd: n
931
- }),
932
- g && /* @__PURE__ */ b("div", {
933
- className: "xeuugli xn9t2bk x1doqdfy xso031l x1q0q8m5 x1qndepd xpvm0e4 xy8obcc xas2l8k x153jb6y xj0a0fe",
934
- children: r
935
- }),
936
- /* @__PURE__ */ x("div", {
937
- role: S ? "region" : void 0,
938
- "aria-label": S ? y : void 0,
939
- "aria-busy": i === "pending" || void 0,
940
- "data-state": i,
941
- ...f.props(Q.stage, Ne[e]),
942
- children: [/* @__PURE__ */ b("div", {
943
- "aria-hidden": v || void 0,
944
- inert: v,
945
- className: "x10l6tqk x10a8y8t xh8yej3 x5yr21d xeuugli x2lwn1j xb3r6kr",
946
- children: c
947
- }), v && /* @__PURE__ */ b("div", {
948
- ref: d.ref,
949
- tabIndex: d.tabIndex,
950
- ...f.props(s.scrollRegion, Q.overlay),
951
- children: a
952
- })]
953
- })
954
- ]
955
- });
956
- }
957
- export { N as a, ge as c, le as d, ce as f, _e as i, he as l, je as n, P as o, ae as p, Te as r, I as s, Fe as t, ue as u };