@graphysdk/react-renderer 1.9.0-beta.1795708068076 → 1.9.0-beta.1795773309240

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,1569 +0,0 @@
1
- import { Bt as lr, Er as cr, Fn as dr, Fr as A, Gt as Fe, Hn as ur, Ht as E, In as hr, J as W, K as vr, Or as De, Qt as L, Rn as pr, S as mr, Sr as fr, Tt as gr, Un as re, Vt as R, f as br, ft as Cr, g as wr, jn as yr, pt as Ee, t as Nr, zn as xr, zt as ye } from "./history-chords-Buxa3waC.js";
2
- import { AUTO_COLOR as ie, PANEL_FRACTION_BOUNDS as Tr, RemoveAnnotationCommand as Le, SequenceCommand as Sr, UpdateAnnotationCommand as Z, alignUnitFractions as _r, projectAnchorToPanel as Ir, projectRegionToPanel as Pr, toFontSpec as kr } from "@graphysdk/viz-engine";
3
- import { createContext as K, useCallback as U, useContext as M, useEffect as pe, useId as fe, useLayoutEffect as Ar, useMemo as Y, useRef as Ne, useState as S } from "react";
4
- import { Fragment as Oe, jsx as t, jsxs as b } from "react/jsx-runtime";
5
- import { clamp as Be } from "lodash-es";
6
- import { assignInlineVars as He } from "@vanilla-extract/dynamic";
7
- import D from "clsx";
8
- import { createPortal as $e } from "react-dom";
9
- import { Tooltip as z } from "@base-ui/react/tooltip";
10
- import { Popover as x } from "@base-ui/react/popover";
11
- import { HexColorInput as Rr, HexColorPicker as Mr } from "react-colorful";
12
- import { NumberField as le } from "@base-ui/react/number-field";
13
- import { Radio as je } from "@base-ui/react/radio";
14
- import { RadioGroup as ze } from "@base-ui/react/radio-group";
15
- import { Select as I } from "@base-ui/react/select";
16
- import { Slider as ee } from "@base-ui/react/slider";
17
- import { Switch as xe } from "@base-ui/react/switch";
18
- import { Input as Fr } from "@base-ui/react/input";
19
- import { Menu as G } from "@base-ui/react/menu";
20
- import { Toolbar as q } from "@base-ui/react/toolbar";
21
- import './start-arrow-button.css';var ge = (e) => /* @__PURE__ */ t(W, {
22
- ...e,
23
- children: /* @__PURE__ */ t("g", {
24
- stroke: "currentColor",
25
- strokeWidth: 2,
26
- strokeLinecap: "round",
27
- strokeLinejoin: "round",
28
- children: /* @__PURE__ */ t("path", { d: "m6 9 6 6 6-6" })
29
- })
30
- }), Ve = K(null), Bn = ({ labelId: e, controlId: r, children: a }) => {
31
- const n = Y(() => {
32
- let s = null;
33
- return {
34
- labelId: e,
35
- controlId: r,
36
- claimControlId: (i) => (s ??= i, s === i)
37
- };
38
- }, [e, r]);
39
- return /* @__PURE__ */ t(Ve.Provider, {
40
- value: n,
41
- children: a
42
- });
43
- }, _ = ({ id: e, ariaLabel: r, ariaLabelledBy: a }, n = !0) => {
44
- const s = M(Ve), i = fe(), [u] = S(() => n ? s?.claimControlId(i) ?? !1 : !1), o = e ?? (u ? s?.controlId : void 0), c = a ?? (r === void 0 ? s?.labelId : void 0);
45
- return {
46
- ...o !== void 0 && { id: o },
47
- ...r !== void 0 && { "aria-label": r },
48
- ...c !== void 0 && { "aria-labelledby": c }
49
- };
50
- }, X = "_18ja6qr0", Dr = ({ children: e }) => {
51
- const { themeValues: r } = Fe();
52
- return /* @__PURE__ */ t(E, {
53
- style: Y(() => He({
54
- [re.fontFamily]: r.fontFamily,
55
- [re.textScale]: r.textScale
56
- }), [r]),
57
- children: e
58
- });
59
- };
60
- var Er = "srewh00", Lr = "srewh01", Or = {
61
- pointer: null,
62
- focus: null,
63
- last: "pointer"
64
- }, Ue = K({
65
- hovered: !1,
66
- dismissed: !1,
67
- reachedTooltipId: null,
68
- reach: () => {
69
- },
70
- release: () => {
71
- },
72
- dismiss: () => {
73
- }
74
- }), Hn = ({ className: e, children: r }) => {
75
- const [a, n] = S(!1), [s, i] = S(!1), [u, o] = S(Or), c = U((p, f) => {
76
- i(!1), o((g) => ({
77
- ...g,
78
- [f]: p,
79
- last: f
80
- }));
81
- }, []), h = U((p, f) => {
82
- o((g) => g[f] === p ? {
83
- ...g,
84
- [f]: null
85
- } : g);
86
- }, []), d = U(() => i(!0), []), l = Br(u), v = Y(() => ({
87
- hovered: a,
88
- dismissed: s,
89
- reachedTooltipId: l,
90
- reach: c,
91
- release: h,
92
- dismiss: d
93
- }), [
94
- a,
95
- s,
96
- l,
97
- c,
98
- h,
99
- d
100
- ]);
101
- return /* @__PURE__ */ t("div", {
102
- className: e,
103
- onPointerEnter: (p) => {
104
- p.pointerType !== "touch" && (n(!0), i(!1));
105
- },
106
- onPointerLeave: () => n(!1),
107
- children: /* @__PURE__ */ t(Ue.Provider, {
108
- value: v,
109
- children: r
110
- })
111
- });
112
- }, k = ({ label: e, checked: r = !1, side: a, delay: n, nameTrigger: s = !0, suppressed: i = !1, children: u }) => {
113
- const { hovered: o, dismissed: c, reachedTooltipId: h, reach: d, release: l, dismiss: v } = M(Ue), m = fe(), [p, f] = S(!1), g = o ? !c && (h === m || r && h === null) : p;
114
- pe(() => () => {
115
- l(m, "pointer"), l(m, "focus");
116
- }, [m, l]);
117
- const C = (w, y) => {
118
- y.reason === "escape-key" && (v(), y.allowPropagation()), f(w);
119
- };
120
- return /* @__PURE__ */ b(z.Root, {
121
- open: g && !i,
122
- onOpenChange: C,
123
- disableHoverablePopup: !0,
124
- children: [/* @__PURE__ */ t(z.Trigger, {
125
- render: u,
126
- delay: n,
127
- ...s ? { "aria-label": e } : {},
128
- onPointerEnter: (w) => w.pointerType !== "touch" && d(m, "pointer"),
129
- onPointerLeave: () => l(m, "pointer"),
130
- onFocus: () => d(m, "focus"),
131
- onBlur: () => l(m, "focus")
132
- }), /* @__PURE__ */ t(z.Portal, {
133
- container: R(),
134
- className: X,
135
- children: /* @__PURE__ */ t(Dr, { children: /* @__PURE__ */ t(z.Positioner, {
136
- side: a,
137
- sideOffset: 6,
138
- className: Lr,
139
- children: /* @__PURE__ */ t(z.Popup, {
140
- className: Er,
141
- children: e
142
- })
143
- }) })
144
- })]
145
- });
146
- }, Br = ({ pointer: e, focus: r, last: a }) => a === "focus" ? r ?? e : e ?? r, Hr = "woi4bh0", $r = "woi4bh1";
147
- var jr = {
148
- default: "woi4bh6 woi4bh5",
149
- tile: "woi4bh7 woi4bh5",
150
- icon: "woi4bh8 woi4bh5"
151
- }, zr = ({ label: e, icon: r, onClick: a, variant: n = "default", expanded: s, disabled: i, side: u, delay: o, tooltip: c, pressed: h, onPointerEnter: d, onPointerLeave: l, ariaLabel: v, ariaLabelledBy: m, id: p }) => {
152
- const f = _({
153
- id: p,
154
- ariaLabel: v,
155
- ariaLabelledBy: m
156
- }), g = n === "tile", C = /* @__PURE__ */ b("button", {
157
- type: "button",
158
- className: jr[n],
159
- disabled: i,
160
- "aria-expanded": s,
161
- "aria-pressed": h,
162
- onClick: a,
163
- onPointerEnter: d,
164
- onPointerLeave: l,
165
- ...f,
166
- children: [
167
- r !== void 0 && /* @__PURE__ */ t("span", {
168
- className: D("woi4bh0", n === "icon" && "woi4bh4"),
169
- children: r
170
- }),
171
- e !== void 0 && /* @__PURE__ */ t("span", {
172
- className: g ? "woi4bh3" : "woi4bh1",
173
- children: e
174
- }),
175
- s !== void 0 && n === "default" && /* @__PURE__ */ t("span", {
176
- className: "woi4bh2",
177
- "aria-hidden": "true",
178
- children: /* @__PURE__ */ t(ge, { size: "sm" })
179
- })
180
- ]
181
- });
182
- return c !== void 0 ? /* @__PURE__ */ t(k, {
183
- label: c,
184
- side: u,
185
- delay: o,
186
- nameTrigger: !1,
187
- children: C
188
- }) : n === "icon" && v !== void 0 && (u !== void 0 || o !== void 0) ? /* @__PURE__ */ t(k, {
189
- label: v,
190
- side: u,
191
- delay: o,
192
- children: C
193
- }) : C;
194
- }, Vr = {
195
- accent: "var(--graphy-editor-accent, var(--graphy-editor-default-accent))",
196
- surface: "var(--graphy-editor-surface, var(--graphy-editor-default-surface))",
197
- text: "var(--graphy-editor-text, var(--graphy-editor-default-text))",
198
- textSecondary: "color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 70%)",
199
- textDisabled: "color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 50%)",
200
- sunken: "color-mix(in srgb, var(--graphy-editor-surface, var(--graphy-editor-default-surface)), var(--graphy-editor-text, var(--graphy-editor-default-text)) 5%)",
201
- raised: "color-mix(in srgb, var(--graphy-editor-surface, var(--graphy-editor-default-surface)), var(--graphy-editor-text, var(--graphy-editor-default-text)) 7%)",
202
- border: "var(--graphy-editor-border, color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 12%))",
203
- borderWidth: "var(--graphy-editor-border-width, 1px)",
204
- fontFamily: "var(--graphy-editor-font-family, var(--graphy-font-family))",
205
- borderStrong: "color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 50%)",
206
- focus: "color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 55.00000000000001%)",
207
- focusWidth: "2px",
208
- shadow: "var(--graphy-editor-default-shadow)"
209
- }, Ur = "linear-gradient(to top right, transparent calc(50% - 1px), var(--graphy-alert) calc(50% - 1px), var(--graphy-alert) calc(50% + 1px), transparent calc(50% + 1px))", Gr = "linear-gradient(135deg, var(--graphy-white) 50%, var(--graphy-black) 50%) border-box";
210
- var Ge = "_14ty2ng0", Te = "_14ty2ng1", Wr = "_14ty2ng2", Kr = "_14ty2ng3", We = "_14ty2ng4", $n = "_14ty2ng5", jn = "_14ty2ng6", Se = "transparent", Ke = (e) => {
211
- const r = `1px solid ${Vr.borderStrong}`;
212
- return e === "transparent" ? {
213
- background: Ur,
214
- border: r
215
- } : e === ie ? {
216
- background: Gr,
217
- border: r
218
- } : {
219
- background: e,
220
- border: r
221
- };
222
- }, Yr = ({ title: e, colors: r, value: a, onChange: n, trailing: s, clearable: i = !1, names: u, side: o, delay: c, disabled: h, id: d, ariaLabel: l, ariaLabelledBy: v }) => {
223
- const m = L(), p = _({
224
- id: d,
225
- ariaLabel: l,
226
- ariaLabelledBy: v
227
- }, !1), f = s !== void 0 || i, g = (C) => {
228
- const w = C === "transparent" ? m("graph.colorDropdown.transparent") : C, y = u?.[C], T = /* @__PURE__ */ t("button", {
229
- type: "button",
230
- "aria-label": y ?? w,
231
- className: Kr,
232
- "data-active": Ye(C, a),
233
- disabled: h,
234
- onMouseDown: (O) => O.preventDefault(),
235
- onClick: () => n(C),
236
- children: /* @__PURE__ */ t("span", {
237
- className: We,
238
- style: Ke(C)
239
- })
240
- }, C);
241
- return y === void 0 ? T : /* @__PURE__ */ t(k, {
242
- label: y,
243
- side: o,
244
- delay: c,
245
- children: T
246
- }, C);
247
- };
248
- return /* @__PURE__ */ b("div", {
249
- className: Ge,
250
- children: [e !== void 0 && /* @__PURE__ */ t("div", {
251
- className: "_14ty2ng1",
252
- children: e
253
- }), /* @__PURE__ */ b("div", {
254
- className: Wr,
255
- ...p,
256
- children: [r.map(g), f && /* @__PURE__ */ b("span", {
257
- className: "_14ty2ng5",
258
- children: [
259
- /* @__PURE__ */ t("span", {
260
- className: "_14ty2ng6",
261
- "aria-hidden": "true"
262
- }),
263
- s,
264
- i && g("transparent")
265
- ]
266
- })]
267
- })]
268
- });
269
- }, Ye = (e, r) => r !== null && e.toLowerCase() === r.toLowerCase(), qr = "data-graphy-chart-chrome", zn = "data-graphy-keyboard-input", Xr = "data-graphy-chart-menu", Vn = { [Xr]: "" }, ae = (e) => ({ [qr]: e }), Jr = (e, r) => e instanceof Element && e.closest(`[data-graphy-chart-chrome="${CSS.escape(r)}"]`) !== null, Un = (e) => e instanceof Element && e.closest("[data-graphy-chart-menu]") !== null, Gn = (e) => e instanceof Element && e.closest("[data-graphy-chart-chrome]") !== null, Wn = (e, r, a) => e instanceof Node && (r.contains(e) || Jr(e, a)), Qr = "cml7ha0", qe = K(null), Kn = ({ children: e }) => {
270
- const { chartId: r } = A(), [a] = S(R), [n, s] = S(null);
271
- return a === null ? null : /* @__PURE__ */ b(Oe, { children: [$e(/* @__PURE__ */ t("div", {
272
- ref: s,
273
- className: Qr,
274
- ...ae(r)
275
- }), a), /* @__PURE__ */ t(qe.Provider, {
276
- value: n,
277
- children: e
278
- })] });
279
- }, Xe = () => M(qe), Zr = "_178jeit0", ea = "_178jeit1 _14ty2ng3", ra = "_178jeit2 _14ty2ng4", aa = "_178jeit3", ta = "_178jeit4", na = "_178jeit5", oa = "_178jeit6", sa = "_178jeit7", ia = {
280
- side: "flip",
281
- align: "shift",
282
- fallbackAxisSide: "end"
283
- }, la = ({ value: e, onChange: r, onCommit: a, popupAttributes: n, variant: s = "default" }) => {
284
- const i = L(), u = Xe(), [o, c] = S(!1), h = (v) => {
285
- c(v), v || a?.();
286
- }, d = e !== null && hr(e) ? e : "#000000", l = dr(d) ? d.toUpperCase() : "#000000";
287
- return /* @__PURE__ */ b(x.Root, {
288
- open: o,
289
- onOpenChange: h,
290
- children: [s === "chip" ? /* @__PURE__ */ t(x.Trigger, {
291
- className: ea,
292
- onMouseDown: (v) => v.preventDefault(),
293
- "aria-label": i("graph.colorDropdown.pickCustom"),
294
- children: /* @__PURE__ */ t("span", { className: ra })
295
- }) : /* @__PURE__ */ b("div", {
296
- className: Ge,
297
- children: [/* @__PURE__ */ t("div", {
298
- className: Te,
299
- children: i("graph.colorDropdown.custom")
300
- }), /* @__PURE__ */ b(x.Trigger, {
301
- className: aa,
302
- onMouseDown: (v) => v.preventDefault(),
303
- "aria-label": i("graph.colorDropdown.pickCustom"),
304
- children: [/* @__PURE__ */ t("span", {
305
- className: We,
306
- style: Ke(d)
307
- }), /* @__PURE__ */ t("span", {
308
- className: ta,
309
- children: l
310
- })]
311
- })]
312
- }), /* @__PURE__ */ t(x.Portal, {
313
- container: u ?? R(),
314
- className: X,
315
- children: /* @__PURE__ */ t(E, { children: /* @__PURE__ */ t(x.Positioner, {
316
- side: "right",
317
- align: "start",
318
- sideOffset: 18,
319
- collisionAvoidance: ia,
320
- collisionPadding: 12,
321
- disableAnchorTracking: s === "chip",
322
- className: Zr,
323
- children: /* @__PURE__ */ b(x.Popup, {
324
- className: na,
325
- onMouseDown: (v) => v.preventDefault(),
326
- ...n,
327
- children: [
328
- /* @__PURE__ */ t("div", {
329
- className: Te,
330
- children: i("graph.colorDropdown.pickColor")
331
- }),
332
- /* @__PURE__ */ t(Mr, {
333
- color: l,
334
- onChange: r,
335
- className: oa
336
- }),
337
- /* @__PURE__ */ t(Rr, {
338
- color: l,
339
- onChange: r,
340
- prefixed: !0,
341
- className: sa,
342
- onMouseDown: (v) => v.stopPropagation()
343
- })
344
- ]
345
- })
346
- }) })
347
- })]
348
- });
349
- }, Je = K(null), Yn = () => {
350
- const e = M(Je);
351
- if (!e) throw new Error("An editing section must sit inside an <EditorPanel.Root> bound to a graph — pass it a `handle`, or render the panel inside a <GraphProvider>.");
352
- return e;
353
- }, de = ({ children: e, onKeyDown: r, ...a }) => {
354
- const n = M(Je);
355
- return /* @__PURE__ */ t("div", {
356
- onKeyDown: (i) => {
357
- if (r?.(i), !n || i.defaultPrevented) return;
358
- const u = Nr(i.nativeEvent);
359
- u && (i.preventDefault(), u === "undo" ? n.undo() : n.redo());
360
- },
361
- ...a,
362
- children: e
363
- });
364
- }, ca = "_6fidqf0 uz3g760", da = "_6fidqf1 uz3g761", ua = ({ value: e, onChange: r, onCommit: a, disabled: n, ariaLabel: s, ariaLabelledBy: i, id: u }) => {
365
- const o = _({
366
- id: u,
367
- ariaLabel: s,
368
- ariaLabelledBy: i
369
- }), c = (h) => {
370
- const d = va(h.currentTarget.value);
371
- d !== void 0 && r(d);
372
- };
373
- return /* @__PURE__ */ t(de, {
374
- className: ca,
375
- children: /* @__PURE__ */ t("input", {
376
- type: "date",
377
- className: da,
378
- value: ha(e),
379
- onChange: c,
380
- onBlur: a,
381
- disabled: n,
382
- ...o
383
- })
384
- });
385
- }, ha = (e) => {
386
- if (e === null || !Number.isFinite(e)) return "";
387
- const r = new Date(e);
388
- return Number.isNaN(r.getTime()) ? "" : r.toISOString().slice(0, 10);
389
- }, va = (e) => {
390
- if (e === "") return null;
391
- const r = Date.parse(`${e}T00:00:00.000Z`);
392
- return Number.isNaN(r) ? void 0 : r;
393
- }, _e = (e) => /* @__PURE__ */ t(W, {
394
- ...e,
395
- children: /* @__PURE__ */ b("g", {
396
- stroke: "currentColor",
397
- strokeWidth: 2,
398
- strokeLinecap: "round",
399
- strokeLinejoin: "round",
400
- children: [
401
- /* @__PURE__ */ t("path", { d: "M12 3v12" }),
402
- /* @__PURE__ */ t("path", { d: "m17 8-5-5-5 5" }),
403
- /* @__PURE__ */ t("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" })
404
- ]
405
- })
406
- }), pa = "a1l6m80 woi4bh6 woi4bh5", ma = "a1l6m81 _14ty2ng3", fa = "a1l6m82", ga = ({ label: e, accept: r, onFile: a, disabled: n, id: s, variant: i = "default" }) => {
407
- const u = fe(), o = s ?? u, c = i === "chip", h = /* @__PURE__ */ t("input", {
408
- id: o,
409
- type: "file",
410
- accept: r,
411
- disabled: n,
412
- "aria-label": c ? e : void 0,
413
- className: fa,
414
- onChange: (d) => {
415
- const l = d.target.files?.[0];
416
- d.target.value = "", l !== void 0 && a(l);
417
- }
418
- });
419
- return c ? /* @__PURE__ */ t(k, {
420
- label: e,
421
- children: /* @__PURE__ */ b("label", {
422
- htmlFor: o,
423
- className: ma,
424
- children: [/* @__PURE__ */ t(_e, { size: "xs" }), h]
425
- })
426
- }) : /* @__PURE__ */ b("label", {
427
- htmlFor: o,
428
- className: pa,
429
- children: [
430
- /* @__PURE__ */ t("span", {
431
- className: Hr,
432
- children: /* @__PURE__ */ t(_e, {})
433
- }),
434
- /* @__PURE__ */ t("span", {
435
- className: $r,
436
- children: e
437
- }),
438
- h
439
- ]
440
- });
441
- }, Qe = "keyboard", ue = (e) => {
442
- const r = Ne(!1), a = Ne(!1), n = () => {
443
- r.current = !1, a.current && (a.current = !1, e?.());
444
- };
445
- return {
446
- commitAfterChange: () => {
447
- if (r.current) {
448
- a.current = !0;
449
- return;
450
- }
451
- e?.();
452
- },
453
- commitUnlessHeldKey: (s) => {
454
- if (s) {
455
- a.current = !0;
456
- return;
457
- }
458
- e?.();
459
- },
460
- gestureHandlers: {
461
- onKeyDown: () => {
462
- r.current = !0;
463
- },
464
- onKeyUp: n,
465
- onBlur: (s) => {
466
- s.relatedTarget instanceof Node && s.currentTarget.contains(s.relatedTarget) || n();
467
- }
468
- }
469
- };
470
- }, ba = "eh8dvc0", Ca = "eh8dvc1 uz3g760", wa = "eh8dvc2 uz3g761";
471
- var ya = ({ value: e, onChange: r, onCommit: a, min: n, max: s, step: i, placeholder: u, prefix: o, suffix: c, disabled: h, hasError: d, ariaLabel: l, ariaLabelledBy: v, id: m }) => {
472
- const p = _({
473
- id: m,
474
- ariaLabel: l,
475
- ariaLabelledBy: v
476
- }), { commitUnlessHeldKey: f, gestureHandlers: g } = ue(a);
477
- return /* @__PURE__ */ t(le.Root, {
478
- className: ba,
479
- value: e,
480
- onValueChange: (C) => r(C),
481
- onValueCommitted: (C, w) => {
482
- f(w.reason === Qe);
483
- },
484
- min: n,
485
- max: s,
486
- step: i,
487
- disabled: h,
488
- children: /* @__PURE__ */ b(de, {
489
- className: Ca,
490
- "data-error": d === !0,
491
- "data-disabled": h === !0 ? "" : void 0,
492
- children: [
493
- o !== void 0 && /* @__PURE__ */ t("span", {
494
- className: "eh8dvc3",
495
- children: o
496
- }),
497
- /* @__PURE__ */ t(le.Input, {
498
- className: wa,
499
- placeholder: u,
500
- ...g,
501
- "aria-invalid": d === !0 ? !0 : void 0,
502
- ...p
503
- }),
504
- c !== void 0 && /* @__PURE__ */ t("span", {
505
- className: "eh8dvc3",
506
- children: c
507
- })
508
- ]
509
- })
510
- });
511
- }, Na = "_1b7s5f0", $ = {
512
- 1: "_1b7s5f1",
513
- 2: "_1b7s5f2",
514
- 3: "_1b7s5f3",
515
- 4: "_1b7s5f4",
516
- 5: "_1b7s5f5",
517
- 6: "_1b7s5f6"
518
- }, xa = "_1b7s5f7";
519
- var Ta = 6, Sa = ({ options: e, value: r, onChange: a, onCommit: n, columns: s, itemLayout: i = "tile", disabled: u, ariaLabel: o, ariaLabelledBy: c, id: h }) => {
520
- const d = _({
521
- id: h,
522
- ariaLabel: o,
523
- ariaLabelledBy: c
524
- }), l = i === "tile", v = i === "swatch", m = i === "icon", p = i === "track", f = i === "chip", { commitAfterChange: g, gestureHandlers: C } = ue(n);
525
- return /* @__PURE__ */ t(ze, {
526
- className: D(Na, _a(s ?? e.length), m && "_1b7s5f9", p && "_1b7s5fb", f && "_1b7s5fd"),
527
- value: r,
528
- onValueChange: (w) => {
529
- a(w), g();
530
- },
531
- ...C,
532
- disabled: u,
533
- ...d,
534
- children: e.map((w) => {
535
- const y = /* @__PURE__ */ b(je.Root, {
536
- value: w.value,
537
- disabled: w.disabled,
538
- className: D(xa, v && "_1b7s5f8", m && "_1b7s5fa", p && "_1b7s5fc", f && "_1b7s5fe"),
539
- style: {
540
- gridRow: w.gridRow,
541
- gridColumn: w.gridColumn
542
- },
543
- "aria-label": l ? void 0 : w.label,
544
- children: [w.icon, l && /* @__PURE__ */ t("span", {
545
- className: "_1b7s5ff",
546
- children: w.label
547
- })]
548
- }, w.value);
549
- if (!v && !m && !f) return y;
550
- const T = (m || f) && w.value === r;
551
- return /* @__PURE__ */ t(k, {
552
- label: w.label,
553
- checked: T,
554
- children: y
555
- }, w.value);
556
- })
557
- });
558
- }, _a = (e) => {
559
- switch (Math.min(Math.max(Math.round(e), 1), Ta)) {
560
- case 1:
561
- return $[1];
562
- case 2:
563
- return $[2];
564
- case 3:
565
- return $[3];
566
- case 4:
567
- return $[4];
568
- case 5:
569
- return $[5];
570
- default:
571
- return $[6];
572
- }
573
- }, Ia = (e) => /* @__PURE__ */ t(W, {
574
- ...e,
575
- children: /* @__PURE__ */ t("g", {
576
- stroke: "currentColor",
577
- strokeWidth: 2,
578
- strokeLinecap: "round",
579
- strokeLinejoin: "round",
580
- children: /* @__PURE__ */ t("path", { d: "M20 6 9 17l-5-5" })
581
- })
582
- }), Pa = "_1g5x15w0 uz3g760", ka = "_1g5x15w1", Aa = "_1g5x15w2", Ie = "_1g5x15w3", Ra = "_1g5x15w4", Ma = "_1g5x15w5", Fa = "_1g5x15w6", Da = "_1g5x15w7";
583
- var Ea = ({ options: e, value: r, onChange: a, placeholder: n, disabled: s, hasError: i, ariaLabel: u, ariaLabelledBy: o, id: c }) => {
584
- const h = _({
585
- id: c,
586
- ariaLabel: u,
587
- ariaLabelledBy: o
588
- }), d = Xe();
589
- return /* @__PURE__ */ b(I.Root, {
590
- value: r,
591
- onValueChange: (l) => l !== null && a(l),
592
- disabled: s,
593
- items: e.map((l) => ({
594
- value: l.value,
595
- label: l.label
596
- })),
597
- children: [/* @__PURE__ */ b(I.Trigger, {
598
- className: Pa,
599
- "data-error": i === !0,
600
- ...h,
601
- children: [/* @__PURE__ */ t(I.Value, {
602
- className: ka,
603
- children: (l) => La(e, l, n)
604
- }), /* @__PURE__ */ t(I.Icon, {
605
- className: Ie,
606
- children: /* @__PURE__ */ t(ge, { size: "sm" })
607
- })]
608
- }), /* @__PURE__ */ t(I.Portal, {
609
- container: d ?? R(),
610
- className: X,
611
- children: /* @__PURE__ */ t(E, { children: /* @__PURE__ */ t(I.Positioner, {
612
- className: Ra,
613
- sideOffset: 4,
614
- alignItemWithTrigger: !1,
615
- children: /* @__PURE__ */ t(I.Popup, {
616
- className: Ma,
617
- children: e.map((l) => /* @__PURE__ */ b(I.Item, {
618
- value: l.value,
619
- disabled: l.disabled,
620
- className: Fa,
621
- children: [
622
- l.icon,
623
- /* @__PURE__ */ b("span", {
624
- className: Da,
625
- children: [/* @__PURE__ */ t(I.ItemText, { children: l.label }), l.description !== void 0 && /* @__PURE__ */ t("span", {
626
- className: "_1g5x15w8",
627
- children: l.description
628
- })]
629
- }),
630
- /* @__PURE__ */ t(I.ItemIndicator, {
631
- className: Ie,
632
- children: /* @__PURE__ */ t(Ia, { size: "sm" })
633
- })
634
- ]
635
- }, l.value))
636
- })
637
- }) })
638
- })]
639
- });
640
- }, La = (e, r, a) => r === null ? /* @__PURE__ */ t("span", {
641
- className: Aa,
642
- children: a
643
- }) : Oa(e, r), Oa = (e, r) => e.find((a) => a.value === r)?.label ?? r, Ba = "vod76w0", Ha = "vod76w1", $a = "vod76w2", ja = "vod76w3", za = "vod76w4", Va = "vod76w5";
644
- var Ua = ({ value: e, onChange: r, onCommit: a, min: n, max: s, step: i, suffix: u, formatValue: o, showValue: c = !0, disabled: h, ariaLabel: d, ariaLabelledBy: l }) => {
645
- const v = _({
646
- ariaLabel: d,
647
- ariaLabelledBy: l
648
- }, !1), m = Ga(e, u, o), { commitUnlessHeldKey: p, gestureHandlers: f } = ue(a);
649
- return /* @__PURE__ */ b("div", {
650
- className: Ba,
651
- children: [/* @__PURE__ */ t(ee.Root, {
652
- className: Ha,
653
- value: e,
654
- onValueChange: (g) => r(g),
655
- onValueCommitted: (g, C) => {
656
- p(C.reason === Qe);
657
- },
658
- min: n,
659
- max: s,
660
- step: i,
661
- disabled: h,
662
- children: /* @__PURE__ */ t(ee.Control, {
663
- className: $a,
664
- children: /* @__PURE__ */ b(ee.Track, {
665
- className: ja,
666
- children: [/* @__PURE__ */ t(ee.Indicator, { className: za }), /* @__PURE__ */ t(ee.Thumb, {
667
- className: Va,
668
- ...f,
669
- ...v
670
- })]
671
- })
672
- })
673
- }), c && /* @__PURE__ */ t("span", {
674
- className: "vod76w6",
675
- children: m
676
- })]
677
- });
678
- }, Ga = (e, r, a) => a !== void 0 ? a(e) : `${e}${r ?? ""}`, Wa = (e) => /* @__PURE__ */ t(W, {
679
- ...e,
680
- children: /* @__PURE__ */ b("g", {
681
- stroke: "currentColor",
682
- strokeWidth: 2,
683
- strokeLinecap: "round",
684
- strokeLinejoin: "round",
685
- children: [/* @__PURE__ */ t("path", { d: "M12 5v14" }), /* @__PURE__ */ t("path", { d: "M5 12h14" })]
686
- })
687
- }), Ka = "cnu9yl0", Ya = "_1n6f4bd0 cnu9yl1", qa = "_1n6f4bd1", Xa = "_1n6f4bd2", Ja = "_1n6f4bd3 uz3g761";
688
- var Qa = 1e-9, Za = (e) => {
689
- const { value: r, onChange: a, suffix: n, typeable: s = !0, decreaseLabel: i, increaseLabel: u, disabled: o, ariaLabel: c, ariaLabelledBy: h, id: d } = e, { min: l, max: v, findAbove: m, findBelow: p } = et(e), f = _({
690
- id: d,
691
- ariaLabel: c,
692
- ariaLabelledBy: h
693
- }), g = L(), C = i ?? g("editor.accessibility.decrease"), w = u ?? g("editor.accessibility.increase"), [y, T] = S(r), [O, ne] = S(r);
694
- r !== O && (ne(r), T(r));
695
- const J = r === null ? void 0 : p(r), Q = r === null ? void 0 : m(r), B = (N) => {
696
- N !== void 0 && (T(N), a(N));
697
- }, F = (N) => {
698
- const H = N === null ? null : Math.min(Math.max(N, l), v);
699
- if (H !== null && H !== r) {
700
- a(H);
701
- return;
702
- }
703
- T(r);
704
- }, we = (N) => {
705
- N.blur(), N.focus();
706
- };
707
- return /* @__PURE__ */ b("div", {
708
- className: Ka,
709
- children: [
710
- /* @__PURE__ */ t(Pe, {
711
- label: C,
712
- icon: /* @__PURE__ */ t(vr, {}),
713
- disabled: o === !0 || J === void 0,
714
- onPress: () => B(J)
715
- }),
716
- /* @__PURE__ */ t(le.Root, {
717
- className: qa,
718
- value: y,
719
- onValueChange: T,
720
- onValueCommitted: F,
721
- min: l,
722
- max: v,
723
- disabled: o,
724
- readOnly: !s,
725
- children: /* @__PURE__ */ b(de, {
726
- className: Xa,
727
- "data-disabled": o === !0 ? "" : void 0,
728
- "data-readonly": s ? void 0 : "",
729
- children: [/* @__PURE__ */ t(le.Input, {
730
- className: Ja,
731
- onKeyDown: (N) => {
732
- const H = N.currentTarget;
733
- if (N.key === "Enter") {
734
- we(H);
735
- return;
736
- }
737
- if (N.key !== "ArrowUp" && N.key !== "ArrowDown" || (N.preventBaseUIHandler(), N.preventDefault(), N.repeat)) return;
738
- const he = y ?? r;
739
- he !== null && (we(H), B(N.key === "ArrowUp" ? m(he) : p(he)));
740
- },
741
- ...f
742
- }), n !== void 0 && /* @__PURE__ */ t("span", {
743
- className: "_1n6f4bd4",
744
- children: n
745
- })]
746
- })
747
- }),
748
- /* @__PURE__ */ t(Pe, {
749
- label: w,
750
- icon: /* @__PURE__ */ t(Wa, {}),
751
- disabled: o === !0 || Q === void 0,
752
- onPress: () => B(Q)
753
- })
754
- ]
755
- });
756
- }, Pe = ({ label: e, icon: r, disabled: a, onPress: n }) => /* @__PURE__ */ t(k, {
757
- label: e,
758
- children: /* @__PURE__ */ t("button", {
759
- type: "button",
760
- className: Ya,
761
- "aria-label": e,
762
- "aria-disabled": a ? !0 : void 0,
763
- "data-disabled": a ? "" : void 0,
764
- onClick: a ? void 0 : n,
765
- children: r
766
- })
767
- }), et = (e) => {
768
- if (e.stops !== void 0) {
769
- const { stops: o } = e, c = o[0], h = o.at(-1);
770
- if (c === void 0 || h === void 0) throw new Error("A Stepper needs at least one stop: `stops` names its range, from the first to the last.");
771
- return {
772
- min: c,
773
- max: h,
774
- findAbove: (d) => o.find((l) => l > d),
775
- findBelow: (d) => o.filter((l) => l < d).at(-1)
776
- };
777
- }
778
- const { step: r, min: a, max: n } = e;
779
- if (!(r > 0)) return {
780
- min: a,
781
- max: n,
782
- findAbove: () => {
783
- },
784
- findBelow: () => {
785
- }
786
- };
787
- const s = Math.max(ke(r), ke(a)), i = (o) => Math.min(Math.max(Number(o.toFixed(s)), a), n), u = (o, c) => {
788
- const h = (o - a) / r, d = Math.round(h);
789
- return Math.abs(h - d) < Qa ? d : c(h);
790
- };
791
- return {
792
- min: a,
793
- max: n,
794
- findAbove: (o) => {
795
- if (!(o >= n))
796
- return i(a + (u(o, Math.floor) + 1) * r);
797
- },
798
- findBelow: (o) => {
799
- if (!(o <= a))
800
- return i(a + (u(o, Math.ceil) - 1) * r);
801
- }
802
- };
803
- }, ke = (e) => String(e).split(".")[1]?.length ?? 0, rt = "_1hyrlw60", at = "_1hyrlw61", tt = ({ checked: e, onChange: r, disabled: a, ariaLabel: n, ariaLabelledBy: s, id: i }) => {
804
- const u = _({
805
- id: i,
806
- ariaLabel: n,
807
- ariaLabelledBy: s
808
- });
809
- return /* @__PURE__ */ t(xe.Root, {
810
- checked: e,
811
- onCheckedChange: (o) => r(o),
812
- disabled: a,
813
- className: rt,
814
- ...u,
815
- children: /* @__PURE__ */ t(xe.Thumb, { className: at })
816
- });
817
- }, nt = "uz3g761", ot = "tpcnun0 uz3g760", st = ({ value: e, onChange: r, onCommit: a, placeholder: n, disabled: s, hasError: i, ariaLabel: u, ariaLabelledBy: o, id: c }) => {
818
- const h = _({
819
- id: c,
820
- ariaLabel: u,
821
- ariaLabelledBy: o
822
- });
823
- return /* @__PURE__ */ t(de, {
824
- className: ot,
825
- "data-error": i === !0,
826
- children: /* @__PURE__ */ t(Fr, {
827
- className: nt,
828
- value: e,
829
- onValueChange: (d) => r(d),
830
- onBlur: a,
831
- placeholder: n,
832
- disabled: s,
833
- "aria-invalid": i === !0 ? !0 : void 0,
834
- ...h
835
- })
836
- });
837
- }, it = "cnu9yl0", lt = "cnu9yl1";
838
- var ct = ({ options: e, value: r, onChange: a, onCommit: n, itemLayout: s = "inline", hasEqualWidths: i = !1, disabled: u, ariaLabel: o, ariaLabelledBy: c, id: h }) => {
839
- const d = _({
840
- id: h,
841
- ariaLabel: o,
842
- ariaLabelledBy: c
843
- }), l = s === "stacked", { commitAfterChange: v, gestureHandlers: m } = ue(n);
844
- return /* @__PURE__ */ t(ze, {
845
- className: it,
846
- value: r,
847
- onValueChange: (p) => {
848
- a(p), v();
849
- },
850
- ...m,
851
- disabled: u,
852
- ...d,
853
- children: e.map((p) => {
854
- const f = dt(p, l), g = /* @__PURE__ */ b(je.Root, {
855
- value: p.value,
856
- disabled: p.disabled,
857
- className: D(lt, l && "cnu9yl3", i && "cnu9yl2"),
858
- "aria-label": f,
859
- children: [p.icon, Ze(p, l) && /* @__PURE__ */ t("span", {
860
- className: "cnu9yl4",
861
- children: p.label
862
- })]
863
- }, p.value);
864
- return f === void 0 ? g : /* @__PURE__ */ t(k, {
865
- label: f,
866
- checked: p.value === r,
867
- children: g
868
- }, p.value);
869
- })
870
- });
871
- }, Ze = (e, r) => e.icon === void 0 || r, dt = (e, r) => {
872
- if (!Ze(e, r))
873
- return e.label;
874
- }, ut = {
875
- ToggleGroup: ct,
876
- Switch: tt,
877
- Slider: Ua,
878
- RadioGrid: Sa,
879
- Button: zr,
880
- TextField: st,
881
- NumberField: ya,
882
- Stepper: Za,
883
- Select: Ea,
884
- ColorSwatches: Yr,
885
- CustomColor: la,
886
- DateField: ua,
887
- FileInput: ga
888
- }, me = K(ut), qn = ({ controls: e, children: r }) => {
889
- const a = M(me), n = Y(() => ({
890
- ToggleGroup: e?.ToggleGroup ?? a.ToggleGroup,
891
- Switch: e?.Switch ?? a.Switch,
892
- Slider: e?.Slider ?? a.Slider,
893
- RadioGrid: e?.RadioGrid ?? a.RadioGrid,
894
- Button: e?.Button ?? a.Button,
895
- TextField: e?.TextField ?? a.TextField,
896
- NumberField: e?.NumberField ?? a.NumberField,
897
- Stepper: e?.Stepper ?? a.Stepper,
898
- Select: e?.Select ?? a.Select,
899
- ColorSwatches: e?.ColorSwatches ?? a.ColorSwatches,
900
- CustomColor: e?.CustomColor ?? a.CustomColor,
901
- DateField: e?.DateField ?? a.DateField,
902
- FileInput: e?.FileInput ?? a.FileInput
903
- }), [
904
- a,
905
- e?.ToggleGroup,
906
- e?.Switch,
907
- e?.Slider,
908
- e?.RadioGrid,
909
- e?.Button,
910
- e?.TextField,
911
- e?.NumberField,
912
- e?.Stepper,
913
- e?.Select,
914
- e?.ColorSwatches,
915
- e?.CustomColor,
916
- e?.DateField,
917
- e?.FileInput
918
- ]);
919
- return /* @__PURE__ */ t(me.Provider, {
920
- value: n,
921
- children: r
922
- });
923
- }, er = () => M(me), ht = (e, r) => {
924
- const { offsetWidth: a } = e;
925
- return a <= 0 || r <= 0 ? 1 : r / a;
926
- }, Xn = (e) => ht(e, e.getBoundingClientRect().width), vt = (e, r) => {
927
- const { offsetWidth: a, offsetHeight: n } = e;
928
- return a <= 0 || n <= 0 ? r : {
929
- width: a,
930
- height: n
931
- };
932
- }, V = (e, r) => r > 0 ? e / r : 0, pt = (e, r) => e.width <= 0 || e.height <= 0 || r.width <= 0 || r.height <= 0 ? Tr : {
933
- minX: Math.min(0, -e.x / e.width),
934
- minY: Math.min(0, -e.y / e.height),
935
- maxX: Math.max(1, (r.width - e.x) / e.width),
936
- maxY: Math.max(1, (r.height - e.y) / e.height)
937
- }, Jn = (e, r) => ({
938
- minX: Math.min(e.minX, r.x),
939
- minY: Math.min(e.minY, r.y),
940
- maxX: Math.max(e.maxX, r.x),
941
- maxY: Math.max(e.maxY, r.y)
942
- }), Qn = (e, r) => {
943
- const a = r.getBoundingClientRect(), n = vt(r, a), s = n.width + 0.5 >= e.x + e.width && n.height + 0.5 >= e.y + e.height ? n : a;
944
- return pt(e, s);
945
- }, Zn = (e) => e.anchorType !== "panel", oe = (e, r) => {
946
- const { x: a, y: n } = Ir(e, r);
947
- return {
948
- anchorType: "panel",
949
- x: V(a, r.width),
950
- y: V(n, r.height)
951
- };
952
- }, Ae = (e, r) => {
953
- const a = Pr(e, r);
954
- return {
955
- anchorType: "panel",
956
- x: V(a.x, r.width),
957
- y: V(a.y, r.height),
958
- width: V(a.width, r.width),
959
- height: V(a.height, r.height)
960
- };
961
- }, mt = K((e) => new Le({ id: e })), ft = (e, r, a, n) => {
962
- const s = (o) => o.anchorType === "annotation" && o.ref === e, i = [];
963
- for (const o of r.textAnnotations) {
964
- if (!s(o.at)) continue;
965
- const c = a.textAnnotations.find((h) => h.id === o.id);
966
- c !== void 0 && i.push(new Z({
967
- kind: "text",
968
- id: o.id,
969
- patch: { at: oe(c.at, n) }
970
- }));
971
- }
972
- for (const o of r.stickers) {
973
- if (!s(o.at)) continue;
974
- const c = a.stickers.find((h) => h.id === o.id);
975
- c !== void 0 && i.push(new Z({
976
- kind: "sticker",
977
- id: o.id,
978
- patch: { at: oe(c.at, n) }
979
- }));
980
- }
981
- for (const o of r.arrows) {
982
- const c = s(o.start), h = s(o.end);
983
- if (!c && !h) continue;
984
- const d = a.arrows.find((v) => v.id === o.id);
985
- if (d === void 0) continue;
986
- const l = {
987
- ...c ? { start: oe(d.start, n) } : {},
988
- ...h ? { end: oe(d.end, n) } : {}
989
- };
990
- i.push(new Z({
991
- kind: "arrow",
992
- id: o.id,
993
- patch: l
994
- }));
995
- }
996
- for (const o of r.shapes) {
997
- if (!s(o.region)) continue;
998
- const c = a.shapes.find((h) => h.id === o.id);
999
- c !== void 0 && i.push(new Z({
1000
- kind: "shape",
1001
- id: o.id,
1002
- patch: { region: Ae(c.region, n) }
1003
- }));
1004
- }
1005
- for (const o of r.images) {
1006
- if (!s(o.region)) continue;
1007
- const c = a.images.find((h) => h.id === o.id);
1008
- c !== void 0 && i.push(new Z({
1009
- kind: "image",
1010
- id: o.id,
1011
- patch: { region: Ae(c.region, n) }
1012
- }));
1013
- }
1014
- const u = new Le({ id: e });
1015
- return i.length === 0 ? u : new Sr({ commands: [...i, u] }, { description: u.metadata.description });
1016
- }, gt = (e) => {
1017
- const r = fr({
1018
- spec: De((a) => a.spec.annotations),
1019
- scene: mr(e),
1020
- panelRect: e
1021
- });
1022
- return U((a) => {
1023
- const n = r.current;
1024
- return ft(a, n.spec, n.scene, n.panelRect);
1025
- }, [r]);
1026
- }, eo = (e) => {
1027
- const { commands: r } = A(), a = gt(e);
1028
- return U((n) => r.dispatch(a(n)), [r, a]);
1029
- }, ro = () => M(mt), bt = () => {
1030
- const e = Ee(), { selectionStore: r } = A();
1031
- return U((a, n) => {
1032
- r.getState().clearSelection();
1033
- const s = e.getState();
1034
- s.setPlotMenu(null), s.claimInteraction({
1035
- kind: "arrow-draw",
1036
- heads: "end",
1037
- ...a,
1038
- pointer: gr(n)
1039
- });
1040
- }, [e, r]);
1041
- }, Ct = 2, ao = () => {
1042
- const e = L(), r = cr(), a = yr();
1043
- return ({ annotationId: n, anchorX: s, align: i, panelWidth: u, minWidth: o, paddingInline: c, pickedFontSize: h = null, pickedFont: d = null }) => {
1044
- if (u <= 0) return o;
1045
- const l = r.annotation.text(n).resolve(), v = r.graph().get("textScale"), m = h === null ? l.fontSize : h * v, p = lr(d) ?? l.fontFamily, f = (a.measureText(e("graph.annotations.text.placeholder"), kr({
1046
- ...l,
1047
- fontSize: m,
1048
- fontFamily: p
1049
- }, xr)).width + (c ?? l.paddingInline) * 2 + Ct) / u;
1050
- return Math.max(o, Math.min(f, wt(s, _r(i).x)));
1051
- };
1052
- }, wt = (e, r) => {
1053
- const a = r > 0 ? e / r : Number.POSITIVE_INFINITY, n = r < 1 ? (1 - e) / (1 - r) : Number.POSITIVE_INFINITY;
1054
- return Math.min(a, n);
1055
- }, yt = () => {
1056
- const e = L();
1057
- return Y(() => ({
1058
- ...Object.fromEntries(rr.map((r) => [r.color, e(`editor.canvasColors.${r.phrase}`)])),
1059
- [re.canvasDefault]: e("editor.canvasColors.canvasDefault"),
1060
- [re.canvasInverse]: e("editor.canvasColors.canvasInverse")
1061
- }), [e]);
1062
- }, Nt = () => {
1063
- const e = De((r) => r.scales.color);
1064
- return Y(() => !e || e.kind !== "visual" ? [] : [...new Set(e.palette)], [e]);
1065
- }, xt = (e) => e !== "canvasDefault" && e !== "canvasInverse", rr = [
1066
- {
1067
- color: "#000000",
1068
- phrase: "canvasBlack"
1069
- },
1070
- ...ur.filter(xt).map((e) => ({
1071
- color: re[e],
1072
- phrase: e
1073
- })),
1074
- {
1075
- color: "#ffffff",
1076
- phrase: "canvasWhite"
1077
- }
1078
- ], ar = rr.map((e) => e.color), Tt = (e) => /* @__PURE__ */ t(W, {
1079
- ...e,
1080
- children: /* @__PURE__ */ b("g", {
1081
- stroke: "currentColor",
1082
- strokeWidth: 2,
1083
- strokeLinecap: "round",
1084
- strokeLinejoin: "round",
1085
- children: [/* @__PURE__ */ t("path", { d: "M7 17 17 7" }), /* @__PURE__ */ t("path", { d: "M7 7h10v10" })]
1086
- })
1087
- }), to = (e) => /* @__PURE__ */ t(W, {
1088
- ...e,
1089
- children: /* @__PURE__ */ b("g", {
1090
- stroke: "currentColor",
1091
- strokeWidth: 2,
1092
- strokeLinecap: "round",
1093
- strokeLinejoin: "round",
1094
- children: [
1095
- /* @__PURE__ */ t("path", { d: "M4 7h16" }),
1096
- /* @__PURE__ */ t("path", { d: "M10 11v6M14 11v6" }),
1097
- /* @__PURE__ */ t("path", { d: "M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12" }),
1098
- /* @__PURE__ */ t("path", { d: "M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2" })
1099
- ]
1100
- })
1101
- });
1102
- var no = "linear-gradient(to top right, transparent calc(50% - 1px), var(--graphy-alert) calc(50% - 1px), var(--graphy-alert) calc(50% + 1px), transparent calc(50% + 1px))", St = "d0bl00";
1103
- var _t = "d0bl03", It = "d0bl04", te = (e) => /* @__PURE__ */ t(k, {
1104
- ...e,
1105
- side: "bottom"
1106
- }), Pt = 0.01, oo = (e) => ar.some((r) => r.toLowerCase() === e.toLowerCase()), kt = ({ color: e, onChange: r, open: a, onOpenChange: n, children: s, label: i, popupAttributes: u, opacity: o, onOpacityChange: c, hasTransparentOption: h = !1, hasAutomaticOption: d = !1, showTooltip: l = !1 }) => {
1107
- const v = L(), { ColorSwatches: m, Slider: p } = er(), f = yt(), g = Nt(), C = [
1108
- ...d ? [ie] : [],
1109
- ...h ? [Se] : [],
1110
- ...ar
1111
- ], w = {
1112
- ...f,
1113
- [Se]: v("graph.colorDropdown.transparent"),
1114
- [ie]: v("graph.colorDropdown.automatic")
1115
- }, y = (F) => {
1116
- r(F), n(!1);
1117
- }, T = g.length > 0, O = T ? g : C, ne = e !== null && !Re(C, e) && !Re(g, e) ? [...O, e] : O, J = /* @__PURE__ */ t(At, {
1118
- value: e,
1119
- onChange: r,
1120
- popupAttributes: u
1121
- }), Q = i ?? v("graph.toolbar.color.label"), B = /* @__PURE__ */ t(x.Trigger, {
1122
- render: /* @__PURE__ */ t(q.Button, {}),
1123
- "aria-label": Q,
1124
- className: St,
1125
- onMouseDown: (F) => F.preventDefault(),
1126
- children: s ?? /* @__PURE__ */ t("span", {
1127
- className: "d0bl01",
1128
- style: { background: e ?? "transparent" }
1129
- })
1130
- });
1131
- return /* @__PURE__ */ b(x.Root, {
1132
- open: a,
1133
- onOpenChange: n,
1134
- children: [l ? /* @__PURE__ */ t(te, {
1135
- label: Q,
1136
- suppressed: a,
1137
- children: B
1138
- }) : B, /* @__PURE__ */ t(x.Portal, {
1139
- container: R(),
1140
- className: X,
1141
- children: /* @__PURE__ */ t(E, { children: /* @__PURE__ */ t(x.Positioner, {
1142
- sideOffset: 6,
1143
- align: "start",
1144
- className: _t,
1145
- children: /* @__PURE__ */ b(x.Popup, {
1146
- className: It,
1147
- onMouseDown: (F) => F.preventDefault(),
1148
- ...u,
1149
- children: [
1150
- /* @__PURE__ */ t(m, {
1151
- title: v("graph.colorDropdown.colors"),
1152
- colors: T ? C : ne,
1153
- names: w,
1154
- value: e,
1155
- onChange: y,
1156
- trailing: T ? void 0 : J
1157
- }),
1158
- T && /* @__PURE__ */ t(m, {
1159
- title: v("graph.colorDropdown.chartColors"),
1160
- colors: ne,
1161
- names: w,
1162
- value: e,
1163
- onChange: y,
1164
- trailing: J
1165
- }),
1166
- o !== void 0 && c !== void 0 && /* @__PURE__ */ b("div", {
1167
- className: "_14ty2ng0",
1168
- children: [/* @__PURE__ */ t("div", {
1169
- className: "_14ty2ng1",
1170
- children: v("graph.colorDropdown.opacity")
1171
- }), /* @__PURE__ */ t(p, {
1172
- value: o,
1173
- onChange: c,
1174
- min: 0,
1175
- max: 1,
1176
- step: Pt,
1177
- showValue: !1,
1178
- ariaLabel: v("graph.colorDropdown.opacity")
1179
- })]
1180
- })
1181
- ]
1182
- })
1183
- }) })
1184
- })]
1185
- });
1186
- }, At = ({ value: e, onChange: r, popupAttributes: a }) => {
1187
- const { CustomColor: n } = er(), { themeValues: s } = Fe();
1188
- return /* @__PURE__ */ t(n, {
1189
- variant: "chip",
1190
- value: e === null || e === ie ? null : wr(e, s),
1191
- onChange: r,
1192
- popupAttributes: a
1193
- });
1194
- }, Re = (e, r) => e.some((a) => Ye(a, r)), Rt = "l9kff0", Mt = "l9kff1", Ft = "l9kff2", Dt = "xn24px0", Et = "xn24px1", Lt = "xn24px2", Ot = ({ children: e, popupAttributes: r }) => /* @__PURE__ */ t(G.Portal, {
1195
- container: R(),
1196
- className: X,
1197
- children: /* @__PURE__ */ t(E, { children: /* @__PURE__ */ t(G.Positioner, {
1198
- side: "bottom",
1199
- align: "start",
1200
- sideOffset: 6,
1201
- className: Dt,
1202
- children: /* @__PURE__ */ t(G.Popup, {
1203
- className: Et,
1204
- onMouseDown: (a) => a.preventDefault(),
1205
- ...r,
1206
- children: e
1207
- })
1208
- }) })
1209
- }), Bt = ({ children: e, selected: r = !1, disabled: a = !1, onClick: n }) => /* @__PURE__ */ t(G.Item, {
1210
- className: Lt,
1211
- "data-selected": r,
1212
- disabled: a,
1213
- onClick: n,
1214
- children: e
1215
- }), Ht = "d0bl03", $t = "d0bl00", jt = "_1r8zpuq0 d0bl04", zt = "_1r8zpuq1", Vt = "_1r8zpuq2";
1216
- var Ut = ({ value: e, onChange: r, label: a, open: n, onOpenChange: s, popupAttributes: i, showTooltip: u = !1 }) => {
1217
- const o = br(), c = o?.[e], h = (l) => {
1218
- l !== e && r(l), s(!1);
1219
- }, d = /* @__PURE__ */ t(x.Trigger, {
1220
- render: /* @__PURE__ */ t(q.Button, {}),
1221
- "aria-label": a,
1222
- className: $t,
1223
- onMouseDown: (l) => l.preventDefault(),
1224
- children: c === void 0 ? e : /* @__PURE__ */ t("img", {
1225
- className: Vt,
1226
- src: c,
1227
- alt: ""
1228
- })
1229
- });
1230
- return /* @__PURE__ */ b(x.Root, {
1231
- open: n,
1232
- onOpenChange: s,
1233
- children: [u ? /* @__PURE__ */ t(te, {
1234
- label: a,
1235
- suppressed: n,
1236
- children: d
1237
- }) : d, /* @__PURE__ */ t(x.Portal, {
1238
- container: R(),
1239
- className: X,
1240
- children: /* @__PURE__ */ t(E, { children: /* @__PURE__ */ t(x.Positioner, {
1241
- sideOffset: 6,
1242
- align: "start",
1243
- className: Ht,
1244
- children: /* @__PURE__ */ t(x.Popup, {
1245
- className: jt,
1246
- onMouseDown: (l) => l.preventDefault(),
1247
- ...i,
1248
- children: /* @__PURE__ */ t("div", {
1249
- className: zt,
1250
- role: "group",
1251
- "aria-label": a,
1252
- children: o !== null && Object.entries(o).map(([l, v]) => /* @__PURE__ */ t("button", {
1253
- type: "button",
1254
- "aria-label": l,
1255
- "aria-pressed": l === e,
1256
- className: "_1r8zpuq3 _14ty2ng3",
1257
- "data-active": l === e,
1258
- onClick: () => h(l),
1259
- children: /* @__PURE__ */ t("img", {
1260
- className: "_1r8zpuq4",
1261
- src: v,
1262
- alt: ""
1263
- })
1264
- }, l))
1265
- })
1266
- })
1267
- }) })
1268
- })]
1269
- });
1270
- }, Gt = ({ className: e, ...r }) => /* @__PURE__ */ t(z.Provider, { children: /* @__PURE__ */ t(q.Root, {
1271
- ...r,
1272
- className: D(Rt, e)
1273
- }) }), Wt = ({ className: e, ...r }) => /* @__PURE__ */ t(q.Group, {
1274
- ...r,
1275
- className: D(Mt, e)
1276
- }), Kt = ({ className: e, ...r }) => /* @__PURE__ */ t(q.Separator, {
1277
- ...r,
1278
- className: D(Ft, e)
1279
- }), Yt = ({ children: e }) => {
1280
- const r = R();
1281
- return r === null ? null : $e(/* @__PURE__ */ t(E, { children: e }), r);
1282
- }, P = {
1283
- Portal: Yt,
1284
- Root: Gt,
1285
- Group: Wt,
1286
- Separator: Kt,
1287
- Button: q.Button,
1288
- ColorPicker: kt,
1289
- StickerPicker: Ut,
1290
- MenuPopup: Ot,
1291
- MenuItem: Bt
1292
- }, qt = "var(--pvjfpx0)", Xt = "var(--pvjfpx1)", Jt = "pvjfpx2", Qt = "pvjfpx3", Zt = "pvjfpx4", en = "pvjfpx6 pvjfpx5", rn = "pvjfpx7 pvjfpx6 pvjfpx5", an = "pvjfpx8 pvjfpx5", j = 8, tn = ({ anchorBox: e, panelRect: r, frameWidth: a, frameHeight: n, avoidBoxes: s = [], pillWidthPx: i }) => {
1293
- const u = r.y + e.y, o = u + e.height, c = u - 8 - 44, h = o + 8, d = n - j - 44, l = j, v = Math.max(0, a - j * 2), m = r.x + e.x + e.width / 2 - l, p = (y) => y >= j && y <= d, f = Be(h <= d ? h : c, j, d);
1294
- if (s.length === 0 || i === void 0) return {
1295
- top: f,
1296
- left: l,
1297
- available: v,
1298
- centre: m
1299
- };
1300
- const g = (y) => !nn(y, l, v, m, i, s), C = Math.max(h, j);
1301
- if (p(C) && g(C)) return {
1302
- top: C,
1303
- left: l,
1304
- available: v,
1305
- centre: m
1306
- };
1307
- const w = Math.max(o, ...s.map((y) => y.y + y.height)) + 8;
1308
- return p(w) ? {
1309
- top: w,
1310
- left: l,
1311
- available: v,
1312
- centre: m
1313
- } : p(c) && g(c) ? {
1314
- top: c,
1315
- left: l,
1316
- available: v,
1317
- centre: m
1318
- } : {
1319
- top: f,
1320
- left: l,
1321
- available: v,
1322
- centre: m
1323
- };
1324
- }, nn = (e, r, a, n, s, i) => {
1325
- const u = Math.min(s, a), o = r + Be(n - u / 2, 0, Math.max(0, a - u)), c = o + u, h = e + 44;
1326
- return i.some((d) => o < d.x + d.width && c > d.x && e < d.y + d.height && h > d.y);
1327
- }, on = ({ anchorBox: e, panelRect: r, frameWidth: a, frameHeight: n, avoidBoxes: s, estimatedPillWidthPx: i, label: u, testId: o, children: c }) => {
1328
- const { chartId: h } = A(), [d, l] = S(null), [v, m] = S(null);
1329
- Ar(() => {
1330
- if (d === null) return;
1331
- const f = () => m(d.offsetWidth);
1332
- f();
1333
- const g = new ResizeObserver(f);
1334
- return g.observe(d), () => g.disconnect();
1335
- }, [d]);
1336
- const p = tn({
1337
- anchorBox: e,
1338
- panelRect: r,
1339
- frameWidth: a,
1340
- frameHeight: n,
1341
- avoidBoxes: s,
1342
- pillWidthPx: v ?? i
1343
- });
1344
- return /* @__PURE__ */ t("div", {
1345
- className: Jt,
1346
- style: {
1347
- top: p.top,
1348
- left: p.left,
1349
- width: p.available
1350
- },
1351
- children: /* @__PURE__ */ t(P.Root, {
1352
- ref: l,
1353
- "aria-label": u,
1354
- className: Qt,
1355
- "data-testid": o,
1356
- ...ae(h),
1357
- style: He({
1358
- [qt]: `${p.centre}px`,
1359
- [Xt]: `${p.available}px`
1360
- }),
1361
- children: c
1362
- })
1363
- });
1364
- }, sn = ({ label: e, trigger: r, open: a, onOpenChange: n, disabled: s = !1, children: i }) => {
1365
- const { chartId: u } = A();
1366
- return /* @__PURE__ */ b(G.Root, {
1367
- open: a,
1368
- modal: !1,
1369
- onOpenChange: n,
1370
- children: [/* @__PURE__ */ t(te, {
1371
- label: e,
1372
- suppressed: a,
1373
- children: /* @__PURE__ */ b(G.Trigger, {
1374
- render: /* @__PURE__ */ t(P.Button, {}),
1375
- "aria-label": e,
1376
- className: an,
1377
- disabled: s,
1378
- onMouseDown: (o) => o.preventDefault(),
1379
- children: [r, /* @__PURE__ */ t(ge, { size: "sm" })]
1380
- })
1381
- }), /* @__PURE__ */ t(P.MenuPopup, {
1382
- popupAttributes: ae(u),
1383
- children: i
1384
- })]
1385
- });
1386
- }, ln = (e) => {
1387
- const { chartId: r } = A();
1388
- return /* @__PURE__ */ t(P.ColorPicker, {
1389
- ...e,
1390
- popupAttributes: ae(r),
1391
- showTooltip: !0
1392
- });
1393
- }, cn = (e) => {
1394
- const { chartId: r } = A();
1395
- return /* @__PURE__ */ t(P.StickerPicker, {
1396
- ...e,
1397
- popupAttributes: ae(r),
1398
- showTooltip: !0
1399
- });
1400
- }, dn = ({ color: e, opacity: r }) => /* @__PURE__ */ t("span", {
1401
- className: Zt,
1402
- style: { background: r === void 0 ? e : pr(e, r) }
1403
- }), un = ({ label: e, onClick: r, children: a }) => /* @__PURE__ */ t(te, {
1404
- label: e,
1405
- children: /* @__PURE__ */ t(P.Button, {
1406
- "aria-label": e,
1407
- className: en,
1408
- onClick: r,
1409
- children: a
1410
- })
1411
- }), hn = ({ label: e, pressed: r, onClick: a, children: n }) => /* @__PURE__ */ t(te, {
1412
- label: e,
1413
- children: /* @__PURE__ */ t(P.Button, {
1414
- "aria-label": e,
1415
- "aria-pressed": r,
1416
- className: rn,
1417
- onClick: a,
1418
- children: n
1419
- })
1420
- }), Me = {
1421
- Root: on,
1422
- Dropdown: sn,
1423
- MenuItem: P.MenuItem,
1424
- ColorPicker: ln,
1425
- StickerPicker: cn,
1426
- Swatch: dn,
1427
- IconButton: un,
1428
- ToggleButton: hn,
1429
- Button: P.Button,
1430
- Separator: P.Separator
1431
- }, vn = { kind: "chrome-popup" }, so = () => {
1432
- const { commands: e } = A(), r = Ee(), [a, n] = S(null);
1433
- pe(() => () => e.commit(), [e]), pe(() => {
1434
- const { claimInteraction: i, releaseInteraction: u } = r.getState();
1435
- return a === null ? u("chrome-popup") : i(vn), () => u("chrome-popup");
1436
- }, [r, a]);
1437
- const s = () => {
1438
- n(null), e.commit();
1439
- };
1440
- return {
1441
- bind: (i) => ({
1442
- open: a === i,
1443
- onOpenChange: (u) => u ? n(i) : s()
1444
- }),
1445
- close: s
1446
- };
1447
- }, io = "center", ce = "textStyle", tr = /* @__PURE__ */ new Set(["paragraph", "heading"]), lo = (e) => ir(nr(e)?.fontSize) ?? null, co = (e) => or(nr(e)) ?? null, uo = (e) => {
1448
- const r = sr(e), a = mn(e);
1449
- return {
1450
- color: se(r.map((n) => fn(ve(n)?.color))),
1451
- font: se(r.map((n) => or(ve(n)))),
1452
- fontSize: se(r.map((n) => ir(ve(n)?.fontSize))),
1453
- alignment: se(a.map((n) => gn(n.attrs?.textAlign)))
1454
- };
1455
- }, ho = (e, r) => be(e, (a) => a.type === "text" ? pn(a, r) : a), vo = (e) => sr(e).length > 0, po = (e, r) => be(e, (a) => tr.has(a.type ?? "") ? {
1456
- ...a,
1457
- attrs: {
1458
- ...a.attrs,
1459
- textAlign: r
1460
- }
1461
- } : a), nr = (e) => {
1462
- if (!(e === null || !e.isEmpty))
1463
- return e.state.storedMarks?.find((r) => r.type.name === ce)?.attrs;
1464
- }, be = (e, r) => r(e.content === void 0 ? e : {
1465
- ...e,
1466
- content: e.content.map((a) => be(a, r))
1467
- }), pn = (e, r) => {
1468
- const a = e.marks ?? [], n = a.find((i) => i.type === ce), s = {
1469
- type: ce,
1470
- attrs: {
1471
- ...n?.attrs,
1472
- ...r
1473
- }
1474
- };
1475
- return {
1476
- ...e,
1477
- marks: n === void 0 ? [...a, s] : a.map((i) => i === n ? s : i)
1478
- };
1479
- }, ve = (e) => e.marks?.find((r) => r.type === ce)?.attrs, or = (e) => ye(e?.font) ?? ye(e?.fontFamily), sr = (e) => Ce(e, (r) => r.type === "text"), mn = (e) => Ce(e, (r) => tr.has(r.type ?? "")), Ce = (e, r) => [...r(e) ? [e] : [], ...(e.content ?? []).flatMap((a) => Ce(a, r))], se = (e) => {
1480
- const [r, ...a] = e;
1481
- return r === void 0 ? null : a.every((n) => n === r) ? r : null;
1482
- }, fn = (e) => typeof e == "string" && e.length > 0 ? e : void 0, ir = (e) => typeof e == "number" && Number.isFinite(e) ? e : void 0, gn = (e) => e === "left" || e === "center" || e === "right" ? e : void 0, mo = ({ annotationId: e }) => {
1483
- const r = L(), a = bt();
1484
- return Cr((n) => n.caret?.annotationId === e) ? null : /* @__PURE__ */ b(Oe, { children: [/* @__PURE__ */ t(Me.IconButton, {
1485
- label: r("graph.annotations.baseMenu.arrowFromHere"),
1486
- onClick: (n) => a({ start: {
1487
- anchorType: "annotation",
1488
- ref: e,
1489
- align: "auto"
1490
- } }, n),
1491
- children: /* @__PURE__ */ t(Tt, {
1492
- size: "sm",
1493
- title: ""
1494
- })
1495
- }), /* @__PURE__ */ t(Me.Separator, {})] });
1496
- };
1497
- export {
1498
- Vn as $,
1499
- Qn as A,
1500
- Ua as B,
1501
- gt as C,
1502
- Jn as D,
1503
- Zn as E,
1504
- er as F,
1505
- ga as G,
1506
- Ia as H,
1507
- ct as I,
1508
- Yn as J,
1509
- ua as K,
1510
- st as L,
1511
- vt as M,
1512
- ht as N,
1513
- V as O,
1514
- qn as P,
1515
- zn as Q,
1516
- tt as R,
1517
- mt as S,
1518
- ro as T,
1519
- Sa as U,
1520
- Ea as V,
1521
- ya as W,
1522
- Kn as X,
1523
- la as Y,
1524
- Xe as Z,
1525
- ar as _,
1526
- ge as _t,
1527
- ho as a,
1528
- Yr as at,
1529
- ao as b,
1530
- lo as c,
1531
- $n as ct,
1532
- Me as d,
1533
- k as dt,
1534
- Gn as et,
1535
- P as f,
1536
- Hn as ft,
1537
- Tt as g,
1538
- Bn as gt,
1539
- to as h,
1540
- X as ht,
1541
- po as i,
1542
- ae as it,
1543
- Xn as j,
1544
- pt as k,
1545
- uo as l,
1546
- jn as lt,
1547
- no as m,
1548
- Dr as mt,
1549
- io as n,
1550
- Jr as nt,
1551
- vo as o,
1552
- Se as ot,
1553
- oo as p,
1554
- Er as pt,
1555
- Je as q,
1556
- ce as r,
1557
- Un as rt,
1558
- co as s,
1559
- Ye as st,
1560
- mo as t,
1561
- Wn as tt,
1562
- so as u,
1563
- zr as ut,
1564
- yt as v,
1565
- eo as w,
1566
- bt as x,
1567
- Nt as y,
1568
- Za as z
1569
- };