@nice2dev/ui-math 1.0.27 → 1.0.29

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/index.mjs CHANGED
@@ -1,11 +1,81 @@
1
- var R = Object.defineProperty;
2
- var T = (e, r, t) => r in e ? R(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
- var S = (e, r, t) => T(e, typeof r != "symbol" ? r + "" : r, t);
4
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
5
- import we, { useContext, createContext, memo, useState, useEffect, useMemo, useRef, useCallback } from "react";
6
- const _e = (e, r) => r, te = createContext(_e);
7
- function Zt() {
8
- return { t: useContext(te) };
1
+ var T = Object.defineProperty;
2
+ var A = (e, r, t) => r in e ? T(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
+ var S = (e, r, t) => A(e, typeof r != "symbol" ? r + "" : r, t);
4
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
5
+ import Ce$1, { forwardRef, useContext, createContext, memo, useState, useEffect, useMemo, useRef, useCallback } from "react";
6
+ const ke = forwardRef(
7
+ ({
8
+ menubar: e,
9
+ toolbar: r,
10
+ sidebar: t,
11
+ sidebarWidth: a = 220,
12
+ rightSidebar: o,
13
+ rightSidebarWidth: n = 280,
14
+ children: i,
15
+ bottomPanel: c,
16
+ bottomPanelHeight: f,
17
+ statusBar: s,
18
+ height: d = "100%",
19
+ flush: p = !1,
20
+ className: m,
21
+ style: x,
22
+ id: h,
23
+ "data-testid": y
24
+ }, b) => {
25
+ const l = `nice-app-shell__sidebar${p ? " nice-app-shell__sidebar--flush" : ""}`;
26
+ return /* @__PURE__ */ jsxs(
27
+ "div",
28
+ {
29
+ ref: b,
30
+ id: h,
31
+ "data-testid": y,
32
+ className: `nice-app-shell${m ? ` ${m}` : ""}`,
33
+ style: { height: d, ...x },
34
+ children: [
35
+ e != null && /* @__PURE__ */ jsx(
36
+ "div",
37
+ {
38
+ className: `nice-app-shell__menubar${p ? " nice-app-shell__chrome--flush" : ""}`,
39
+ children: e
40
+ }
41
+ ),
42
+ r != null && /* @__PURE__ */ jsx(
43
+ "div",
44
+ {
45
+ className: `nice-app-shell__toolbar${p ? " nice-app-shell__chrome--flush" : ""}`,
46
+ children: r
47
+ }
48
+ ),
49
+ /* @__PURE__ */ jsxs("div", { className: "nice-app-shell__body", children: [
50
+ t != null && /* @__PURE__ */ jsx("aside", { className: l, style: p ? void 0 : { width: a }, children: t }),
51
+ /* @__PURE__ */ jsx("main", { className: "nice-app-shell__content", children: i }),
52
+ o != null && /* @__PURE__ */ jsx(
53
+ "aside",
54
+ {
55
+ className: `${l} nice-app-shell__sidebar--right`,
56
+ style: p ? void 0 : { width: n },
57
+ children: o
58
+ }
59
+ )
60
+ ] }),
61
+ c != null && /* @__PURE__ */ jsx(
62
+ "div",
63
+ {
64
+ className: `nice-app-shell__bottom${p ? " nice-app-shell__bottom--flush" : ""}`,
65
+ style: f != null ? { height: f } : void 0,
66
+ children: c
67
+ }
68
+ ),
69
+ s != null && /* @__PURE__ */ jsx("div", { className: "nice-app-shell__status", children: s })
70
+ ]
71
+ }
72
+ );
73
+ }
74
+ );
75
+ ke.displayName = "NiceAppShell";
76
+ const Qe = (e, r) => r, te$1 = createContext(Qe);
77
+ function Gt() {
78
+ return { t: useContext(te$1) };
9
79
  }
10
80
  createContext({
11
81
  dir: "ltr",
@@ -15,7 +85,7 @@ createContext({
15
85
  });
16
86
  createContext(null);
17
87
  createContext(null);
18
- const ee = {
88
+ const se = {
19
89
  radius: "md",
20
90
  shadow: "md",
21
91
  fill: "solid",
@@ -34,7 +104,7 @@ const ee = {
34
104
  };
35
105
  createContext({
36
106
  displayStyle: "default",
37
- variantConfig: ee,
107
+ variantConfig: se,
38
108
  setDisplayStyle: () => {
39
109
  }
40
110
  });
@@ -50,71 +120,71 @@ createContext({
50
120
  getAccessMode: () => "full"
51
121
  });
52
122
  createContext(null);
53
- const qt = process.env.NODE_ENV === "development";
54
- let O = {
55
- enabled: qt,
123
+ const sr = process.env.NODE_ENV === "development";
124
+ let V = {
125
+ enabled: sr,
56
126
  slowRenderThreshold: 16
57
127
  };
58
- const Ne = [], Y = /* @__PURE__ */ new Map(), Ee = /* @__PURE__ */ new Map();
59
- function Ut() {
60
- Ne.length = 0, Y.clear(), Ee.clear();
128
+ const Oe = [], te = /* @__PURE__ */ new Map(), We = /* @__PURE__ */ new Map();
129
+ function cr() {
130
+ Oe.length = 0, te.clear(), We.clear();
61
131
  }
62
- function Kt(e) {
63
- const r = O.slowRenderThreshold;
64
- return Ne.filter((t) => t.actualDuration > r);
132
+ function lr(e) {
133
+ const r = V.slowRenderThreshold;
134
+ return Oe.filter((t) => t.actualDuration > r);
65
135
  }
66
- function J(e) {
136
+ function ee(e) {
67
137
  return e < 1 ? `${(e * 1e3).toFixed(0)}μs` : e < 1e3 ? `${e.toFixed(2)}ms` : `${(e / 1e3).toFixed(2)}s`;
68
138
  }
69
- function va() {
70
- const e = Array.from(Y.values()), r = Kt(), t = e.reduce((n, i) => n + i.renderCount, 0), a = e.length > 0 ? e.reduce((n, i) => n + i.avgRenderTime, 0) / e.length : 0, o = Array.from(Ee.values());
139
+ function Fa() {
140
+ const e = Array.from(te.values()), r = lr(), t = e.reduce((n, i) => n + i.renderCount, 0), a = e.length > 0 ? e.reduce((n, i) => n + i.avgRenderTime, 0) / e.length : 0, o = Array.from(We.values());
71
141
  return { stats: e, slowRenders: r, totalRenders: t, avgRenderTime: a, marks: o };
72
142
  }
73
- function Gt() {
74
- const e = va();
143
+ function dr() {
144
+ const e = Fa();
75
145
  console.group(
76
146
  "%c[Nice2Dev Performance Report]",
77
147
  "color: var(--nice-info, #6366f1); font-weight: bold; font-size: 14px"
78
- ), console.log(`Total renders: ${e.totalRenders}`), console.log(`Average render time: ${J(e.avgRenderTime)}`), console.log(`Slow renders: ${e.slowRenders.length}`), console.group("Component Stats"), console.table(
148
+ ), console.log(`Total renders: ${e.totalRenders}`), console.log(`Average render time: ${ee(e.avgRenderTime)}`), console.log(`Slow renders: ${e.slowRenders.length}`), console.group("Component Stats"), console.table(
79
149
  e.stats.sort((r, t) => t.totalRenderTime - r.totalRenderTime).map((r) => ({
80
150
  Name: r.componentName,
81
151
  Renders: r.renderCount,
82
- "Avg Time": J(r.avgRenderTime),
83
- "Max Time": J(r.maxRenderTime),
84
- "Total Time": J(r.totalRenderTime),
152
+ "Avg Time": ee(r.avgRenderTime),
153
+ "Max Time": ee(r.maxRenderTime),
154
+ "Total Time": ee(r.totalRenderTime),
85
155
  "Slow Renders": r.slowRenderCount
86
156
  }))
87
157
  ), console.groupEnd(), e.slowRenders.length > 0 && (console.group("Slow Renders (last 10)"), console.table(
88
158
  e.slowRenders.slice(-10).map((r) => ({
89
159
  Component: r.componentName,
90
160
  Phase: r.phase,
91
- Duration: J(r.actualDuration),
161
+ Duration: ee(r.actualDuration),
92
162
  Time: new Date(r.timestamp).toLocaleTimeString()
93
163
  }))
94
164
  ), console.groupEnd()), e.marks.length > 0 && (console.group("Custom Marks"), console.table(
95
165
  e.marks.filter((r) => r.duration).map((r) => ({
96
166
  Name: r.name,
97
- Duration: J(r.duration)
167
+ Duration: ee(r.duration)
98
168
  }))
99
169
  ), console.groupEnd()), console.groupEnd();
100
170
  }
101
- const wa = memo(
171
+ const Pa = memo(
102
172
  ({ position: e = "bottom-right", defaultCollapsed: r = !0 }) => {
103
173
  const [t, a] = useState(r), [o, n] = useState([]), [i, c] = useState({ used: 0, total: 0 });
104
174
  if (useEffect(() => {
105
175
  const s = () => {
106
- const m = Array.from(Y.values());
107
- n(m.sort((g, w) => w.totalRenderTime - g.totalRenderTime).slice(0, 10));
108
- const u = window.performance;
109
- u.memory && c({
110
- used: u.memory.usedJSHeapSize / 1024 / 1024,
111
- total: u.memory.totalJSHeapSize / 1024 / 1024
176
+ const p = Array.from(te.values());
177
+ n(p.sort((x, h) => h.totalRenderTime - x.totalRenderTime).slice(0, 10));
178
+ const m = window.performance;
179
+ m.memory && c({
180
+ used: m.memory.usedJSHeapSize / 1024 / 1024,
181
+ total: m.memory.totalJSHeapSize / 1024 / 1024
112
182
  });
113
183
  };
114
184
  s();
115
185
  const d = setInterval(s, 2e3);
116
186
  return () => clearInterval(d);
117
- }, []), !O.enabled)
187
+ }, []), !V.enabled)
118
188
  return null;
119
189
  const f = {
120
190
  position: "fixed",
@@ -182,7 +252,7 @@ const wa = memo(
182
252
  style: {
183
253
  color: s.avgRenderTime > 16 ? "var(--color-warning, #f59e0b)" : "var(--color-success, #22c55e)"
184
254
  },
185
- children: J(s.avgRenderTime)
255
+ children: ee(s.avgRenderTime)
186
256
  }
187
257
  ),
188
258
  /* @__PURE__ */ jsxs(
@@ -200,7 +270,7 @@ const wa = memo(
200
270
  /* @__PURE__ */ jsx(
201
271
  "button",
202
272
  {
203
- onClick: Gt,
273
+ onClick: dr,
204
274
  style: {
205
275
  flex: 1,
206
276
  padding: "4px 8px",
@@ -217,7 +287,7 @@ const wa = memo(
217
287
  /* @__PURE__ */ jsx(
218
288
  "button",
219
289
  {
220
- onClick: Ut,
290
+ onClick: cr,
221
291
  style: {
222
292
  flex: 1,
223
293
  padding: "4px 8px",
@@ -238,19 +308,19 @@ const wa = memo(
238
308
  );
239
309
  }
240
310
  );
241
- wa.displayName = "ProfilerOverlay";
311
+ Pa.displayName = "ProfilerOverlay";
242
312
  process.env.NODE_ENV;
243
313
  createContext(null);
244
- const ct = createContext({
314
+ const wt = createContext({
245
315
  enabled: !0,
246
316
  active: !1,
247
317
  run: () => {
248
318
  }
249
319
  });
250
- function Ra() {
251
- return useContext(ct);
320
+ function Qa() {
321
+ return useContext(wt);
252
322
  }
253
- function El(e, r) {
323
+ function Jl(e, r) {
254
324
  if (!e)
255
325
  return null;
256
326
  if (e === !0)
@@ -260,7 +330,7 @@ function El(e, r) {
260
330
  const t = e.steps ?? r;
261
331
  return t && t.length > 0 ? t : null;
262
332
  }
263
- function Pa(e, r) {
333
+ function Za(e, r) {
264
334
  return e.map((t) => ({
265
335
  target: t.target,
266
336
  title: t.titleKey ? r(t.titleKey, t.title ?? "") : t.title ?? "",
@@ -272,7 +342,7 @@ function Pa(e, r) {
272
342
  disableInteraction: t.disableInteraction
273
343
  }));
274
344
  }
275
- const Ll = ({
345
+ const Yl = ({
276
346
  steps: e,
277
347
  autoStart: r,
278
348
  label: t,
@@ -281,7 +351,7 @@ const Ll = ({
281
351
  style: n,
282
352
  "data-testid": i
283
353
  }) => {
284
- const { enabled: c, run: f } = Ra(), { t: s } = Zt();
354
+ const { enabled: c, run: f } = Qa(), { t: s } = Gt();
285
355
  if (!c || !e || e.length === 0)
286
356
  return null;
287
357
  const d = t ?? s("tutorial.startAria", "Start tutorial");
@@ -294,14 +364,14 @@ const Ll = ({
294
364
  "data-testid": i,
295
365
  "aria-label": d,
296
366
  title: d,
297
- onClick: () => f(Pa(e, s), { autoStart: r }),
367
+ onClick: () => f(Za(e, s), { autoStart: r }),
298
368
  children: "?"
299
369
  }
300
370
  );
301
- }, St = "nice-tutorial-button-styles";
302
- if (typeof document < "u" && !document.getElementById(St)) {
371
+ }, Rt = "nice-tutorial-button-styles";
372
+ if (typeof document < "u" && !document.getElementById(Rt)) {
303
373
  const e = document.createElement("style");
304
- e.id = St, e.textContent = `
374
+ e.id = Rt, e.textContent = `
305
375
  .nice-tutorial-button {
306
376
  display: inline-flex;
307
377
  align-items: center;
@@ -332,7 +402,7 @@ if (typeof document < "u" && !document.getElementById(St)) {
332
402
  createContext(null);
333
403
  createContext(null);
334
404
  createContext(null);
335
- const fe = {
405
+ const Me = {
336
406
  space1: "4px",
337
407
  space2: "8px",
338
408
  space3: "12px",
@@ -340,7 +410,7 @@ const fe = {
340
410
  space5: "20px",
341
411
  space6: "24px",
342
412
  space8: "32px"
343
- }, me = {
413
+ }, Ae = {
344
414
  fontFamily: "'Inter', system-ui, -apple-system, sans-serif",
345
415
  fontSizeXs: "0.75rem",
346
416
  fontSizeSm: "0.8125rem",
@@ -352,25 +422,25 @@ const fe = {
352
422
  fontWeightSemibold: 600,
353
423
  fontWeightBold: 700,
354
424
  lineHeight: 1.5
355
- }, pe = { fast: "120ms ease", normal: "200ms ease", slow: "300ms ease" }, dt = (e) => ({
425
+ }, Ce = { fast: "120ms ease", normal: "200ms ease", slow: "300ms ease" }, Mt = (e) => ({
356
426
  color: e,
357
427
  radiusSm: "4px",
358
428
  radiusMd: "6px",
359
429
  radiusLg: "8px",
360
430
  radiusXl: "12px",
361
431
  radiusFull: "9999px"
362
- }), yr = {
432
+ }), Tr = {
363
433
  sm: "0 1px 2px rgba(0,0,0,0.05)",
364
434
  md: "0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)",
365
435
  lg: "0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)",
366
436
  xl: "0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)"
367
- }, bn = {
437
+ }, Rn = {
368
438
  sm: "0 1px 2px rgba(0,0,0,0.3)",
369
439
  md: "0 4px 6px -1px rgba(0,0,0,0.4)",
370
440
  lg: "0 10px 15px -3px rgba(0,0,0,0.4)",
371
441
  xl: "0 20px 25px -5px rgba(0,0,0,0.4)"
372
442
  };
373
- function z(e, r, t, a, o) {
443
+ function F(e, r, t, a, o) {
374
444
  return {
375
445
  name: e,
376
446
  darkMode: "light",
@@ -386,14 +456,14 @@ function z(e, r, t, a, o) {
386
456
  canvas: t.canvas ?? t.primary
387
457
  },
388
458
  text: { ...a, inverse: a.inverse ?? "#ffffff" },
389
- borders: dt(o),
390
- shadows: yr,
391
- spacing: fe,
392
- typography: me,
393
- transitions: pe
459
+ borders: Mt(o),
460
+ shadows: Tr,
461
+ spacing: Me,
462
+ typography: Ae,
463
+ transitions: Ce
394
464
  };
395
465
  }
396
- function V(e, r, t, a, o) {
466
+ function j(e, r, t, a, o) {
397
467
  return {
398
468
  name: e,
399
469
  darkMode: "dark",
@@ -409,14 +479,14 @@ function V(e, r, t, a, o) {
409
479
  canvas: t.canvas ?? t.primary
410
480
  },
411
481
  text: { ...a, inverse: a.inverse ?? "#0f172a" },
412
- borders: dt(o),
413
- shadows: bn,
414
- spacing: fe,
415
- typography: me,
416
- transitions: pe
482
+ borders: Mt(o),
483
+ shadows: Rn,
484
+ spacing: Me,
485
+ typography: Ae,
486
+ transitions: Ce
417
487
  };
418
488
  }
419
- z(
489
+ F(
420
490
  "Slate",
421
491
  {
422
492
  primary: "#64748b",
@@ -430,7 +500,7 @@ z(
430
500
  { primary: "#1e293b", secondary: "#475569", muted: "#94a3b8" },
431
501
  "#cbd5e1"
432
502
  );
433
- z(
503
+ F(
434
504
  "Zinc",
435
505
  {
436
506
  primary: "#71717a",
@@ -444,7 +514,7 @@ z(
444
514
  { primary: "#18181b", secondary: "#3f3f46", muted: "#a1a1aa" },
445
515
  "#d4d4d8"
446
516
  );
447
- z(
517
+ F(
448
518
  "Stone",
449
519
  {
450
520
  primary: "#78716c",
@@ -458,7 +528,7 @@ z(
458
528
  { primary: "#1c1917", secondary: "#44403c", muted: "#a8a29e" },
459
529
  "#d6d3d1"
460
530
  );
461
- z(
531
+ F(
462
532
  "Cool Gray",
463
533
  {
464
534
  primary: "#6b7280",
@@ -472,7 +542,7 @@ z(
472
542
  { primary: "#111827", secondary: "#374151", muted: "#9ca3af" },
473
543
  "#d1d5db"
474
544
  );
475
- z(
545
+ F(
476
546
  "Warm Gray",
477
547
  {
478
548
  primary: "#7c7568",
@@ -486,7 +556,7 @@ z(
486
556
  { primary: "#1f1d19", secondary: "#4a463d", muted: "#a09888" },
487
557
  "#d4d0c8"
488
558
  );
489
- z(
559
+ F(
490
560
  "Silver",
491
561
  {
492
562
  primary: "#94a3b8",
@@ -500,7 +570,7 @@ z(
500
570
  { primary: "#334155", secondary: "#64748b", muted: "#94a3b8" },
501
571
  "#cbd5e1"
502
572
  );
503
- z(
573
+ F(
504
574
  "Charcoal",
505
575
  {
506
576
  primary: "#374151",
@@ -514,7 +584,7 @@ z(
514
584
  { primary: "#111827", secondary: "#374151", muted: "#6b7280" },
515
585
  "#d1d5db"
516
586
  );
517
- z(
587
+ F(
518
588
  "Ivory",
519
589
  {
520
590
  primary: "#92876d",
@@ -528,7 +598,7 @@ z(
528
598
  { primary: "#2b2517", secondary: "#5c5340", muted: "#9c9280" },
529
599
  "#ddd8c4"
530
600
  );
531
- z(
601
+ F(
532
602
  "Rose",
533
603
  {
534
604
  primary: "#e11d48",
@@ -542,7 +612,7 @@ z(
542
612
  { primary: "#4c0519", secondary: "#881337", muted: "#f43f5e" },
543
613
  "#fda4af"
544
614
  );
545
- z(
615
+ F(
546
616
  "Emerald",
547
617
  {
548
618
  primary: "#059669",
@@ -556,7 +626,7 @@ z(
556
626
  { primary: "#064e3b", secondary: "#065f46", muted: "#34d399" },
557
627
  "#6ee7b7"
558
628
  );
559
- z(
629
+ F(
560
630
  "Amber",
561
631
  {
562
632
  primary: "#d97706",
@@ -570,7 +640,7 @@ z(
570
640
  { primary: "#451a03", secondary: "#78350f", muted: "#f59e0b" },
571
641
  "#fcd34d"
572
642
  );
573
- z(
643
+ F(
574
644
  "Violet",
575
645
  {
576
646
  primary: "#7c3aed",
@@ -584,7 +654,7 @@ z(
584
654
  { primary: "#2e1065", secondary: "#4c1d95", muted: "#a78bfa" },
585
655
  "#c4b5fd"
586
656
  );
587
- z(
657
+ F(
588
658
  "Teal",
589
659
  {
590
660
  primary: "#0d9488",
@@ -598,7 +668,7 @@ z(
598
668
  { primary: "#134e4a", secondary: "#115e59", muted: "#2dd4bf" },
599
669
  "#5eead4"
600
670
  );
601
- z(
671
+ F(
602
672
  "Indigo",
603
673
  {
604
674
  primary: "#4f46e5",
@@ -612,7 +682,7 @@ z(
612
682
  { primary: "#1e1b4b", secondary: "#312e81", muted: "#818cf8" },
613
683
  "#a5b4fc"
614
684
  );
615
- z(
685
+ F(
616
686
  "Cyan",
617
687
  {
618
688
  primary: "#0891b2",
@@ -626,7 +696,7 @@ z(
626
696
  { primary: "#164e63", secondary: "#155e75", muted: "#22d3ee" },
627
697
  "#67e8f9"
628
698
  );
629
- z(
699
+ F(
630
700
  "Lime",
631
701
  {
632
702
  primary: "#65a30d",
@@ -640,7 +710,7 @@ z(
640
710
  { primary: "#1a2e05", secondary: "#365314", muted: "#84cc16" },
641
711
  "#bef264"
642
712
  );
643
- z(
713
+ F(
644
714
  "Pink",
645
715
  {
646
716
  primary: "#db2777",
@@ -654,7 +724,7 @@ z(
654
724
  { primary: "#500724", secondary: "#831843", muted: "#f472b6" },
655
725
  "#f9a8d4"
656
726
  );
657
- z(
727
+ F(
658
728
  "Orange",
659
729
  {
660
730
  primary: "#ea580c",
@@ -668,7 +738,7 @@ z(
668
738
  { primary: "#431407", secondary: "#7c2d12", muted: "#fb923c" },
669
739
  "#fdba74"
670
740
  );
671
- z(
741
+ F(
672
742
  "Fuchsia",
673
743
  {
674
744
  primary: "#c026d3",
@@ -682,7 +752,7 @@ z(
682
752
  { primary: "#4a044e", secondary: "#701a75", muted: "#d946ef" },
683
753
  "#e879f9"
684
754
  );
685
- z(
755
+ F(
686
756
  "Sky",
687
757
  {
688
758
  primary: "#0284c7",
@@ -696,7 +766,7 @@ z(
696
766
  { primary: "#0c4a6e", secondary: "#075985", muted: "#38bdf8" },
697
767
  "#7dd3fc"
698
768
  );
699
- z(
769
+ F(
700
770
  "Ruby",
701
771
  {
702
772
  primary: "#be123c",
@@ -710,7 +780,7 @@ z(
710
780
  { primary: "#4c0519", secondary: "#881337", muted: "#fb7185" },
711
781
  "#fda4af"
712
782
  );
713
- z(
783
+ F(
714
784
  "Coral",
715
785
  {
716
786
  primary: "#f97316",
@@ -724,7 +794,7 @@ z(
724
794
  { primary: "#431407", secondary: "#9a3412", muted: "#fb923c" },
725
795
  "#fdba74"
726
796
  );
727
- V(
797
+ j(
728
798
  "Midnight",
729
799
  {
730
800
  primary: "#818cf8",
@@ -738,7 +808,7 @@ V(
738
808
  { primary: "#f1f5f9", secondary: "#94a3b8", muted: "#475569" },
739
809
  "#1e293b"
740
810
  );
741
- V(
811
+ j(
742
812
  "Obsidian",
743
813
  {
744
814
  primary: "#a78bfa",
@@ -752,7 +822,7 @@ V(
752
822
  { primary: "#fafafa", secondary: "#a1a1aa", muted: "#52525b" },
753
823
  "#3f3f46"
754
824
  );
755
- V(
825
+ j(
756
826
  "Eclipse",
757
827
  {
758
828
  primary: "#c084fc",
@@ -766,7 +836,7 @@ V(
766
836
  { primary: "#f5f3ff", secondary: "#a78bfa", muted: "#6d5eac" },
767
837
  "#3b3266"
768
838
  );
769
- V(
839
+ j(
770
840
  "Onyx",
771
841
  {
772
842
  primary: "#60a5fa",
@@ -780,7 +850,7 @@ V(
780
850
  { primary: "#ffffff", secondary: "#a3a3a3", muted: "#525252" },
781
851
  "#262626"
782
852
  );
783
- V(
853
+ j(
784
854
  "Carbon",
785
855
  {
786
856
  primary: "#38bdf8",
@@ -794,7 +864,7 @@ V(
794
864
  { primary: "#f4f4f4", secondary: "#c6c6c6", muted: "#6f6f6f" },
795
865
  "#525252"
796
866
  );
797
- V(
867
+ j(
798
868
  "Cosmos",
799
869
  {
800
870
  primary: "#6366f1",
@@ -808,7 +878,7 @@ V(
808
878
  { primary: "#e5e7eb", secondary: "#9ca3af", muted: "#4b5563" },
809
879
  "#374151"
810
880
  );
811
- V(
881
+ j(
812
882
  "Nebula",
813
883
  {
814
884
  primary: "#e879f9",
@@ -822,7 +892,7 @@ V(
822
892
  { primary: "#fae8ff", secondary: "#d8b4fe", muted: "#7c3aed" },
823
893
  "#581c87"
824
894
  );
825
- V(
895
+ j(
826
896
  "Abyss",
827
897
  {
828
898
  primary: "#22d3ee",
@@ -836,7 +906,7 @@ V(
836
906
  { primary: "#e0f2fe", secondary: "#7dd3fc", muted: "#0369a1" },
837
907
  "#075985"
838
908
  );
839
- V(
909
+ j(
840
910
  "Shadow",
841
911
  {
842
912
  primary: "#a3a3a3",
@@ -850,7 +920,7 @@ V(
850
920
  { primary: "#e5e5e5", secondary: "#a3a3a3", muted: "#525252" },
851
921
  "#404040"
852
922
  );
853
- V(
923
+ j(
854
924
  "Emerald Dark",
855
925
  {
856
926
  primary: "#34d399",
@@ -864,7 +934,7 @@ V(
864
934
  { primary: "#ecfdf5", secondary: "#6ee7b7", muted: "#047857" },
865
935
  "#047857"
866
936
  );
867
- z(
937
+ F(
868
938
  "Forest",
869
939
  {
870
940
  primary: "#166534",
@@ -878,7 +948,7 @@ z(
878
948
  { primary: "#052e16", secondary: "#166534", muted: "#4ade80" },
879
949
  "#86efac"
880
950
  );
881
- z(
951
+ F(
882
952
  "Ocean",
883
953
  {
884
954
  primary: "#0369a1",
@@ -892,7 +962,7 @@ z(
892
962
  { primary: "#0c4a6e", secondary: "#0369a1", muted: "#38bdf8" },
893
963
  "#7dd3fc"
894
964
  );
895
- z(
965
+ F(
896
966
  "Desert",
897
967
  {
898
968
  primary: "#b45309",
@@ -906,7 +976,7 @@ z(
906
976
  { primary: "#422006", secondary: "#713f12", muted: "#ca8a04" },
907
977
  "#fde047"
908
978
  );
909
- z(
979
+ F(
910
980
  "Sunset",
911
981
  {
912
982
  primary: "#ea580c",
@@ -920,7 +990,7 @@ z(
920
990
  { primary: "#431407", secondary: "#9a3412", muted: "#f97316" },
921
991
  "#fdba74"
922
992
  );
923
- z(
993
+ F(
924
994
  "Aurora",
925
995
  {
926
996
  primary: "#0d9488",
@@ -934,7 +1004,7 @@ z(
934
1004
  { primary: "#134e4a", secondary: "#115e59", muted: "#2dd4bf" },
935
1005
  "#5eead4"
936
1006
  );
937
- z(
1007
+ F(
938
1008
  "Lavender",
939
1009
  {
940
1010
  primary: "#7e22ce",
@@ -948,7 +1018,7 @@ z(
948
1018
  { primary: "#3b0764", secondary: "#581c87", muted: "#a855f7" },
949
1019
  "#d8b4fe"
950
1020
  );
951
- z(
1021
+ F(
952
1022
  "Autumn",
953
1023
  {
954
1024
  primary: "#c2410c",
@@ -962,7 +1032,7 @@ z(
962
1032
  { primary: "#450a0a", secondary: "#7f1d1d", muted: "#f87171" },
963
1033
  "#fca5a5"
964
1034
  );
965
- z(
1035
+ F(
966
1036
  "Spring",
967
1037
  {
968
1038
  primary: "#16a34a",
@@ -976,7 +1046,7 @@ z(
976
1046
  { primary: "#14532d", secondary: "#166534", muted: "#4ade80" },
977
1047
  "#86efac"
978
1048
  );
979
- z(
1049
+ F(
980
1050
  "Arctic",
981
1051
  {
982
1052
  primary: "#0ea5e9",
@@ -990,7 +1060,7 @@ z(
990
1060
  { primary: "#0c4a6e", secondary: "#0369a1", muted: "#7dd3fc" },
991
1061
  "#bae6fd"
992
1062
  );
993
- z(
1063
+ F(
994
1064
  "Tropical",
995
1065
  {
996
1066
  primary: "#0d9488",
@@ -1004,7 +1074,7 @@ z(
1004
1074
  { primary: "#064e3b", secondary: "#065f46", muted: "#6ee7b7" },
1005
1075
  "#a7f3d0"
1006
1076
  );
1007
- z(
1077
+ F(
1008
1078
  "Pastel Rose",
1009
1079
  {
1010
1080
  primary: "#f472b6",
@@ -1018,7 +1088,7 @@ z(
1018
1088
  { primary: "#831843", secondary: "#9d174d", muted: "#f9a8d4" },
1019
1089
  "#f9a8d4"
1020
1090
  );
1021
- z(
1091
+ F(
1022
1092
  "Pastel Sky",
1023
1093
  {
1024
1094
  primary: "#38bdf8",
@@ -1032,7 +1102,7 @@ z(
1032
1102
  { primary: "#075985", secondary: "#0369a1", muted: "#7dd3fc" },
1033
1103
  "#bae6fd"
1034
1104
  );
1035
- z(
1105
+ F(
1036
1106
  "Pastel Mint",
1037
1107
  {
1038
1108
  primary: "#34d399",
@@ -1046,7 +1116,7 @@ z(
1046
1116
  { primary: "#065f46", secondary: "#047857", muted: "#6ee7b7" },
1047
1117
  "#a7f3d0"
1048
1118
  );
1049
- z(
1119
+ F(
1050
1120
  "Pastel Peach",
1051
1121
  {
1052
1122
  primary: "#fb923c",
@@ -1060,7 +1130,7 @@ z(
1060
1130
  { primary: "#7c2d12", secondary: "#9a3412", muted: "#fdba74" },
1061
1131
  "#fed7aa"
1062
1132
  );
1063
- z(
1133
+ F(
1064
1134
  "Pastel Lavender",
1065
1135
  {
1066
1136
  primary: "#a78bfa",
@@ -1074,7 +1144,7 @@ z(
1074
1144
  { primary: "#4c1d95", secondary: "#5b21b6", muted: "#c4b5fd" },
1075
1145
  "#ddd6fe"
1076
1146
  );
1077
- z(
1147
+ F(
1078
1148
  "Pastel Lemon",
1079
1149
  {
1080
1150
  primary: "#facc15",
@@ -1088,7 +1158,7 @@ z(
1088
1158
  { primary: "#713f12", secondary: "#854d0e", muted: "#fde047" },
1089
1159
  "#fef08a"
1090
1160
  );
1091
- z(
1161
+ F(
1092
1162
  "Pastel Sage",
1093
1163
  {
1094
1164
  primary: "#86efac",
@@ -1102,7 +1172,7 @@ z(
1102
1172
  { primary: "#166534", secondary: "#15803d", muted: "#86efac" },
1103
1173
  "#bbf7d0"
1104
1174
  );
1105
- z(
1175
+ F(
1106
1176
  "Pastel Coral",
1107
1177
  {
1108
1178
  primary: "#fb7185",
@@ -1116,7 +1186,7 @@ z(
1116
1186
  { primary: "#881337", secondary: "#9f1239", muted: "#fda4af" },
1117
1187
  "#fecdd3"
1118
1188
  );
1119
- z(
1189
+ F(
1120
1190
  "Banking",
1121
1191
  {
1122
1192
  primary: "#1e3a5f",
@@ -1130,7 +1200,7 @@ z(
1130
1200
  { primary: "#0f172a", secondary: "#334155", muted: "#94a3b8" },
1131
1201
  "#cbd5e1"
1132
1202
  );
1133
- z(
1203
+ F(
1134
1204
  "Healthcare",
1135
1205
  {
1136
1206
  primary: "#0891b2",
@@ -1144,7 +1214,7 @@ z(
1144
1214
  { primary: "#134e4a", secondary: "#1a6b6a", muted: "#80cbc4" },
1145
1215
  "#b2dfdb"
1146
1216
  );
1147
- z(
1217
+ F(
1148
1218
  "Legal",
1149
1219
  {
1150
1220
  primary: "#1e293b",
@@ -1158,7 +1228,7 @@ z(
1158
1228
  { primary: "#0f172a", secondary: "#44403c", muted: "#a8a29e" },
1159
1229
  "#d6d3d1"
1160
1230
  );
1161
- z(
1231
+ F(
1162
1232
  "Tech Startup",
1163
1233
  {
1164
1234
  primary: "#7c3aed",
@@ -1172,7 +1242,7 @@ z(
1172
1242
  { primary: "#1e1b4b", secondary: "#4c1d95", muted: "#a78bfa" },
1173
1243
  "#c4b5fd"
1174
1244
  );
1175
- z(
1245
+ F(
1176
1246
  "Enterprise",
1177
1247
  {
1178
1248
  primary: "#1e40af",
@@ -1186,7 +1256,7 @@ z(
1186
1256
  { primary: "#1e3a5f", secondary: "#1e40af", muted: "#60a5fa" },
1187
1257
  "#93c5fd"
1188
1258
  );
1189
- z(
1259
+ F(
1190
1260
  "Government",
1191
1261
  {
1192
1262
  primary: "#1d4ed8",
@@ -1200,7 +1270,7 @@ z(
1200
1270
  { primary: "#0f172a", secondary: "#1e293b", muted: "#64748b" },
1201
1271
  "#cbd5e1"
1202
1272
  );
1203
- z(
1273
+ F(
1204
1274
  "Education",
1205
1275
  {
1206
1276
  primary: "#059669",
@@ -1214,7 +1284,7 @@ z(
1214
1284
  { primary: "#064e3b", secondary: "#065f46", muted: "#6ee7b7" },
1215
1285
  "#a7f3d0"
1216
1286
  );
1217
- z(
1287
+ F(
1218
1288
  "Real Estate",
1219
1289
  {
1220
1290
  primary: "#92400e",
@@ -1228,7 +1298,7 @@ z(
1228
1298
  { primary: "#422006", secondary: "#713f12", muted: "#d97706" },
1229
1299
  "#fcd34d"
1230
1300
  );
1231
- z(
1301
+ F(
1232
1302
  "Nord",
1233
1303
  {
1234
1304
  primary: "#5e81ac",
@@ -1242,7 +1312,7 @@ z(
1242
1312
  { primary: "#2e3440", secondary: "#3b4252", muted: "#4c566a" },
1243
1313
  "#d8dee9"
1244
1314
  );
1245
- V(
1315
+ j(
1246
1316
  "Dracula",
1247
1317
  {
1248
1318
  primary: "#bd93f9",
@@ -1256,7 +1326,7 @@ V(
1256
1326
  { primary: "#f8f8f2", secondary: "#c0c0c0", muted: "#6272a4" },
1257
1327
  "#44475a"
1258
1328
  );
1259
- z(
1329
+ F(
1260
1330
  "Solarized Light",
1261
1331
  {
1262
1332
  primary: "#268bd2",
@@ -1270,7 +1340,7 @@ z(
1270
1340
  { primary: "#073642", secondary: "#586e75", muted: "#93a1a1" },
1271
1341
  "#eee8d5"
1272
1342
  );
1273
- V(
1343
+ j(
1274
1344
  "Solarized Dark",
1275
1345
  {
1276
1346
  primary: "#268bd2",
@@ -1284,7 +1354,7 @@ V(
1284
1354
  { primary: "#eee8d5", secondary: "#93a1a1", muted: "#586e75" },
1285
1355
  "#073642"
1286
1356
  );
1287
- V(
1357
+ j(
1288
1358
  "Monokai",
1289
1359
  {
1290
1360
  primary: "#66d9ef",
@@ -1298,7 +1368,7 @@ V(
1298
1368
  { primary: "#f8f8f2", secondary: "#cfcfc2", muted: "#75715e" },
1299
1369
  "#3e3d32"
1300
1370
  );
1301
- V(
1371
+ j(
1302
1372
  "One Dark",
1303
1373
  {
1304
1374
  primary: "#61afef",
@@ -1312,7 +1382,7 @@ V(
1312
1382
  { primary: "#abb2bf", secondary: "#828997", muted: "#545862" },
1313
1383
  "#3e4452"
1314
1384
  );
1315
- V(
1385
+ j(
1316
1386
  "Synthwave",
1317
1387
  {
1318
1388
  primary: "#ff7edb",
@@ -1326,7 +1396,7 @@ V(
1326
1396
  { primary: "#f0e4fc", secondary: "#b4a0cc", muted: "#6c5c84" },
1327
1397
  "#4a3866"
1328
1398
  );
1329
- z(
1399
+ F(
1330
1400
  "Vaporwave",
1331
1401
  {
1332
1402
  primary: "#ff71ce",
@@ -1340,7 +1410,7 @@ z(
1340
1410
  { primary: "#4a1a4e", secondary: "#7b3f7d", muted: "#c080c0" },
1341
1411
  "#d8a8e8"
1342
1412
  );
1343
- V(
1413
+ j(
1344
1414
  "Terminal Green",
1345
1415
  {
1346
1416
  primary: "#00ff41",
@@ -1354,7 +1424,7 @@ V(
1354
1424
  { primary: "#00ff41", secondary: "#00cc33", muted: "#008822" },
1355
1425
  "#003300"
1356
1426
  );
1357
- z(
1427
+ F(
1358
1428
  "Sepia",
1359
1429
  {
1360
1430
  primary: "#8b6914",
@@ -1368,7 +1438,7 @@ z(
1368
1438
  { primary: "#3e2723", secondary: "#5d4037", muted: "#a1887f" },
1369
1439
  "#d7ccc8"
1370
1440
  );
1371
- z(
1441
+ F(
1372
1442
  "Vintage",
1373
1443
  {
1374
1444
  primary: "#8d6e63",
@@ -1382,7 +1452,7 @@ z(
1382
1452
  { primary: "#3e2723", secondary: "#5d4037", muted: "#a1887f" },
1383
1453
  "#bcaaa4"
1384
1454
  );
1385
- V(
1455
+ j(
1386
1456
  "Cyberpunk",
1387
1457
  {
1388
1458
  primary: "#00f0ff",
@@ -1396,7 +1466,7 @@ V(
1396
1466
  { primary: "#e0fbfc", secondary: "#80d4dd", muted: "#3a6b72" },
1397
1467
  "#1c3a44"
1398
1468
  );
1399
- V(
1469
+ j(
1400
1470
  "Neon",
1401
1471
  {
1402
1472
  primary: "#ff00ff",
@@ -1410,7 +1480,7 @@ V(
1410
1480
  { primary: "#ffffff", secondary: "#cccccc", muted: "#666666" },
1411
1481
  "#333333"
1412
1482
  );
1413
- V(
1483
+ j(
1414
1484
  "Retrowave",
1415
1485
  {
1416
1486
  primary: "#f77fbe",
@@ -1424,7 +1494,7 @@ V(
1424
1494
  { primary: "#ffe6f7", secondary: "#c9a0c9", muted: "#6b4c7a" },
1425
1495
  "#4a2d66"
1426
1496
  );
1427
- z(
1497
+ F(
1428
1498
  "Christmas",
1429
1499
  {
1430
1500
  primary: "#c41e3a",
@@ -1438,7 +1508,7 @@ z(
1438
1508
  { primary: "#3b0a0a", secondary: "#7f1d1d", muted: "#dc6868" },
1439
1509
  "#e8a0a0"
1440
1510
  );
1441
- V(
1511
+ j(
1442
1512
  "Halloween",
1443
1513
  {
1444
1514
  primary: "#ff6600",
@@ -1452,7 +1522,7 @@ V(
1452
1522
  { primary: "#ffedd5", secondary: "#fdba74", muted: "#9a5c28" },
1453
1523
  "#5c3400"
1454
1524
  );
1455
- z(
1525
+ F(
1456
1526
  "Valentine",
1457
1527
  {
1458
1528
  primary: "#e11d48",
@@ -1466,7 +1536,7 @@ z(
1466
1536
  { primary: "#4c0519", secondary: "#881337", muted: "#f9a8d4" },
1467
1537
  "#fda4af"
1468
1538
  );
1469
- z(
1539
+ F(
1470
1540
  "Easter",
1471
1541
  {
1472
1542
  primary: "#a78bfa",
@@ -1480,7 +1550,7 @@ z(
1480
1550
  { primary: "#581c87", secondary: "#6d28d9", muted: "#c4b5fd" },
1481
1551
  "#ddd6fe"
1482
1552
  );
1483
- z(
1553
+ F(
1484
1554
  "Summer Beach",
1485
1555
  {
1486
1556
  primary: "#0ea5e9",
@@ -1494,7 +1564,7 @@ z(
1494
1564
  { primary: "#0c4a6e", secondary: "#0369a1", muted: "#7dd3fc" },
1495
1565
  "#fcd34d"
1496
1566
  );
1497
- z(
1567
+ F(
1498
1568
  "Winter Frost",
1499
1569
  {
1500
1570
  primary: "#3b82f6",
@@ -1508,7 +1578,7 @@ z(
1508
1578
  { primary: "#1e3a5f", secondary: "#1e40af", muted: "#93c5fd" },
1509
1579
  "#bfdbfe"
1510
1580
  );
1511
- z(
1581
+ F(
1512
1582
  "Cherry Blossom",
1513
1583
  {
1514
1584
  primary: "#ec4899",
@@ -1522,7 +1592,7 @@ z(
1522
1592
  { primary: "#831843", secondary: "#9d174d", muted: "#f9a8d4" },
1523
1593
  "#fbcfe8"
1524
1594
  );
1525
- z(
1595
+ F(
1526
1596
  "Harvest",
1527
1597
  {
1528
1598
  primary: "#b45309",
@@ -1536,7 +1606,7 @@ z(
1536
1606
  { primary: "#451a03", secondary: "#78350f", muted: "#d97706" },
1537
1607
  "#fcd34d"
1538
1608
  );
1539
- z(
1609
+ F(
1540
1610
  "Japanese Zen",
1541
1611
  {
1542
1612
  primary: "#6b7280",
@@ -1550,7 +1620,7 @@ z(
1550
1620
  { primary: "#2c2c2c", secondary: "#5c5c5c", muted: "#a0998a" },
1551
1621
  "#d5cec0"
1552
1622
  );
1553
- z(
1623
+ F(
1554
1624
  "Moroccan",
1555
1625
  {
1556
1626
  primary: "#c2410c",
@@ -1564,7 +1634,7 @@ z(
1564
1634
  { primary: "#3a1a00", secondary: "#7c2d12", muted: "#d97706" },
1565
1635
  "#f5d0a0"
1566
1636
  );
1567
- z(
1637
+ F(
1568
1638
  "Scandinavian",
1569
1639
  {
1570
1640
  primary: "#4b5563",
@@ -1578,7 +1648,7 @@ z(
1578
1648
  { primary: "#111827", secondary: "#374151", muted: "#9ca3af" },
1579
1649
  "#e5e7eb"
1580
1650
  );
1581
- z(
1651
+ F(
1582
1652
  "Mediterranean",
1583
1653
  {
1584
1654
  primary: "#1e40af",
@@ -1592,7 +1662,7 @@ z(
1592
1662
  { primary: "#1e3a5f", secondary: "#2563eb", muted: "#93c5fd" },
1593
1663
  "#bfdbfe"
1594
1664
  );
1595
- z(
1665
+ F(
1596
1666
  "Chinese New Year",
1597
1667
  {
1598
1668
  primary: "#dc2626",
@@ -1606,7 +1676,7 @@ z(
1606
1676
  { primary: "#450a0a", secondary: "#991b1b", muted: "#f87171" },
1607
1677
  "#fca5a5"
1608
1678
  );
1609
- z(
1679
+ F(
1610
1680
  "Indian Festive",
1611
1681
  {
1612
1682
  primary: "#d97706",
@@ -1620,7 +1690,7 @@ z(
1620
1690
  { primary: "#451a03", secondary: "#92400e", muted: "#f59e0b" },
1621
1691
  "#fcd34d"
1622
1692
  );
1623
- z(
1693
+ F(
1624
1694
  "Brazilian Carnival",
1625
1695
  {
1626
1696
  primary: "#16a34a",
@@ -1634,7 +1704,7 @@ z(
1634
1704
  { primary: "#052e16", secondary: "#166534", muted: "#4ade80" },
1635
1705
  "#86efac"
1636
1706
  );
1637
- z(
1707
+ F(
1638
1708
  "African Earth",
1639
1709
  {
1640
1710
  primary: "#92400e",
@@ -1648,7 +1718,7 @@ z(
1648
1718
  { primary: "#2b1a0e", secondary: "#5c3d1e", muted: "#a08060" },
1649
1719
  "#d4b896"
1650
1720
  );
1651
- V(
1721
+ j(
1652
1722
  "High Contrast Dark",
1653
1723
  {
1654
1724
  primary: "#ffff00",
@@ -1662,7 +1732,7 @@ V(
1662
1732
  { primary: "#ffffff", secondary: "#ffffff", muted: "#cccccc" },
1663
1733
  "#ffffff"
1664
1734
  );
1665
- z(
1735
+ F(
1666
1736
  "Monochrome",
1667
1737
  {
1668
1738
  primary: "#404040",
@@ -1676,7 +1746,7 @@ z(
1676
1746
  { primary: "#1a1a1a", secondary: "#404040", muted: "#808080" },
1677
1747
  "#c0c0c0"
1678
1748
  );
1679
- z(
1749
+ F(
1680
1750
  "Enhanced Contrast",
1681
1751
  {
1682
1752
  primary: "#0050b3",
@@ -1690,7 +1760,7 @@ z(
1690
1760
  { primary: "#000000", secondary: "#1a1a1a", muted: "#595959" },
1691
1761
  "#8c8c8c"
1692
1762
  );
1693
- z(
1763
+ F(
1694
1764
  "Minimalist",
1695
1765
  {
1696
1766
  primary: "#18181b",
@@ -1704,7 +1774,7 @@ z(
1704
1774
  { primary: "#0a0a0a", secondary: "#404040", muted: "#a3a3a3" },
1705
1775
  "#e5e5e5"
1706
1776
  );
1707
- V(
1777
+ j(
1708
1778
  "Warm Dark",
1709
1779
  {
1710
1780
  primary: "#f59e0b",
@@ -1718,7 +1788,7 @@ V(
1718
1788
  { primary: "#fafaf9", secondary: "#d6d3d1", muted: "#78716c" },
1719
1789
  "#57534e"
1720
1790
  );
1721
- V(
1791
+ j(
1722
1792
  "Soft Dark",
1723
1793
  {
1724
1794
  primary: "#a78bfa",
@@ -1732,7 +1802,7 @@ V(
1732
1802
  { primary: "#e8e8f0", secondary: "#a0a0b8", muted: "#5c5c74" },
1733
1803
  "#3e3e58"
1734
1804
  );
1735
- z(
1805
+ F(
1736
1806
  "Coffee",
1737
1807
  {
1738
1808
  primary: "#6f4e37",
@@ -1746,7 +1816,7 @@ z(
1746
1816
  { primary: "#2c1a0e", secondary: "#5c3d28", muted: "#a08868" },
1747
1817
  "#d4c4a8"
1748
1818
  );
1749
- z(
1819
+ F(
1750
1820
  "Wine",
1751
1821
  {
1752
1822
  primary: "#7f1d1d",
@@ -1761,6 +1831,7 @@ z(
1761
1831
  "#e8a0a0"
1762
1832
  );
1763
1833
  createContext(null);
1834
+ createContext(null);
1764
1835
  const translations = {
1765
1836
  en: {
1766
1837
  "calculator.matrixA": "Matrix A",
@@ -1924,7 +1995,7 @@ function NiceI18nProvider({ locale: e = "en", overrides: r, children: t }) {
1924
1995
  const o = { ...translations.en, ...translations[e], ...r };
1925
1996
  return { locale: e, t: (i, c) => o[i] ?? c ?? i };
1926
1997
  }, [e, r]);
1927
- return we.createElement(I18nContext.Provider, { value: a }, t);
1998
+ return Ce$1.createElement(I18nContext.Provider, { value: a }, t);
1928
1999
  }
1929
2000
  function useNiceTranslation() {
1930
2001
  return useContext(I18nContext);
@@ -2277,13 +2348,6 @@ function useMathEditor() {
2277
2348
  return e;
2278
2349
  }
2279
2350
  const styles$3 = {
2280
- container: {
2281
- display: "flex",
2282
- flexDirection: "column",
2283
- height: "100%",
2284
- fontFamily: "'Inter', sans-serif",
2285
- fontSize: "14px"
2286
- },
2287
2351
  toolbar: {
2288
2352
  display: "flex",
2289
2353
  gap: "8px",
@@ -2293,11 +2357,6 @@ const styles$3 = {
2293
2357
  flexWrap: "wrap",
2294
2358
  alignItems: "center"
2295
2359
  },
2296
- main: {
2297
- display: "flex",
2298
- flex: 1,
2299
- overflow: "hidden"
2300
- },
2301
2360
  sidebar: {
2302
2361
  width: "200px",
2303
2362
  borderRight: "1px solid var(--nice-border, #e0e0e0)",
@@ -2379,62 +2438,61 @@ function NiceMathEditor({
2379
2438
  style: o,
2380
2439
  tutorial: n
2381
2440
  }) {
2382
- const { t: i } = useNiceTranslation(), [c, f] = useState(r), [s, d] = useState("input"), m = useRef(null), u = useCallback(
2441
+ const { t: i } = useNiceTranslation(), [c, f] = useState(r), [s, d] = useState("input"), p = useRef(null), m = useCallback(
2383
2442
  (b) => {
2384
2443
  f(b), t == null || t(b);
2385
2444
  },
2386
2445
  [t]
2387
- ), g = useCallback(
2446
+ ), x = useCallback(
2388
2447
  (b) => {
2389
- const l = m.current;
2448
+ const l = p.current;
2390
2449
  if (!l) {
2391
- u(c + b);
2450
+ m(c + b);
2392
2451
  return;
2393
2452
  }
2394
- const p = l.selectionStart, h = l.selectionEnd, k = c.slice(0, p) + b + c.slice(h);
2395
- u(k), setTimeout(() => {
2396
- l.focus(), l.selectionStart = l.selectionEnd = p + b.length;
2453
+ const u = l.selectionStart, v = l.selectionEnd, C = c.slice(0, u) + b + c.slice(v);
2454
+ m(C), setTimeout(() => {
2455
+ l.focus(), l.selectionStart = l.selectionEnd = u + b.length;
2397
2456
  }, 0);
2398
2457
  },
2399
- [c, u]
2400
- ), w = useCallback(
2458
+ [c, m]
2459
+ ), h = useCallback(
2401
2460
  (b) => {
2402
- g(b.latex);
2461
+ x(b.latex);
2403
2462
  },
2404
- [g]
2463
+ [x]
2405
2464
  ), y = {
2406
2465
  service: e,
2407
2466
  latex: c,
2408
- setLatex: u,
2409
- insertSymbol: g,
2410
- insertTemplate: w,
2467
+ setLatex: m,
2468
+ insertSymbol: x,
2469
+ insertTemplate: h,
2411
2470
  mode: s,
2412
2471
  setMode: d
2413
2472
  };
2414
2473
  return /* @__PURE__ */ jsx(MathEditorContext.Provider, { value: y, children: /* @__PURE__ */ jsxs(
2415
- "div",
2474
+ ke,
2416
2475
  {
2476
+ flush: !0,
2417
2477
  className: `nice-math-editor ${a ?? ""}`,
2418
- style: { position: "relative", ...styles$3.container, ...o },
2478
+ style: { position: "relative", ...o },
2479
+ toolbar: /* @__PURE__ */ jsx(Toolbar$1, {}),
2480
+ sidebar: /* @__PURE__ */ jsx(SymbolPalette, {}),
2419
2481
  children: [
2420
- /* @__PURE__ */ jsx("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 30 }, children: /* @__PURE__ */ jsx(Ll, { steps: El(n, MATH_EDITOR_TOUR) }) }),
2421
- /* @__PURE__ */ jsx(Toolbar$1, {}),
2422
- /* @__PURE__ */ jsxs("div", { style: styles$3.main, children: [
2423
- /* @__PURE__ */ jsx(SymbolPalette, {}),
2424
- /* @__PURE__ */ jsx("div", { style: styles$3.editor, children: s === "input" ? /* @__PURE__ */ jsxs(Fragment, { children: [
2425
- /* @__PURE__ */ jsx(
2426
- "textarea",
2427
- {
2428
- ref: m,
2429
- value: c,
2430
- onChange: (b) => u(b.target.value),
2431
- placeholder: i("editor.latexPlaceholder", "Enter LaTeX equation..."),
2432
- style: styles$3.input
2433
- }
2434
- ),
2435
- /* @__PURE__ */ jsx(LatexPreview, { latex: c })
2436
- ] }) : /* @__PURE__ */ jsx(HandwritingCanvas, {}) })
2437
- ] })
2482
+ /* @__PURE__ */ jsx("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 30 }, children: /* @__PURE__ */ jsx(Yl, { steps: Jl(n, MATH_EDITOR_TOUR) }) }),
2483
+ /* @__PURE__ */ jsx("div", { style: styles$3.editor, children: s === "input" ? /* @__PURE__ */ jsxs(Fragment, { children: [
2484
+ /* @__PURE__ */ jsx(
2485
+ "textarea",
2486
+ {
2487
+ ref: p,
2488
+ value: c,
2489
+ onChange: (b) => m(b.target.value),
2490
+ placeholder: i("editor.latexPlaceholder", "Enter LaTeX equation..."),
2491
+ style: styles$3.input
2492
+ }
2493
+ ),
2494
+ /* @__PURE__ */ jsx(LatexPreview, { latex: c })
2495
+ ] }) : /* @__PURE__ */ jsx(HandwritingCanvas, {}) })
2438
2496
  ]
2439
2497
  }
2440
2498
  ) });
@@ -2601,58 +2659,58 @@ function LatexPreview({ latex: e }) {
2601
2659
  ] });
2602
2660
  }
2603
2661
  function HandwritingCanvas() {
2604
- const { t: e } = useNiceTranslation(), { setLatex: r, setMode: t } = useMathEditor(), a = useRef(null), [o, n] = useState([]), [i, c] = useState([]), [f, s] = useState(!1), [d, m] = useState(!1), u = (l) => {
2605
- const p = a.current;
2606
- if (!p)
2662
+ const { t: e } = useNiceTranslation(), { setLatex: r, setMode: t } = useMathEditor(), a = useRef(null), [o, n] = useState([]), [i, c] = useState([]), [f, s] = useState(!1), [d, p] = useState(!1), m = (l) => {
2663
+ const u = a.current;
2664
+ if (!u)
2607
2665
  return;
2608
2666
  s(!0);
2609
- const h = p.getBoundingClientRect();
2667
+ const v = u.getBoundingClientRect();
2610
2668
  c([
2611
2669
  {
2612
- x: l.clientX - h.left,
2613
- y: l.clientY - h.top,
2670
+ x: l.clientX - v.left,
2671
+ y: l.clientY - v.top,
2614
2672
  pressure: l.pressure,
2615
2673
  timestamp: Date.now()
2616
2674
  }
2617
2675
  ]);
2618
- }, g = (l) => {
2676
+ }, x = (l) => {
2619
2677
  if (!f)
2620
2678
  return;
2621
- const p = a.current, h = p == null ? void 0 : p.getContext("2d");
2622
- if (!p || !h)
2679
+ const u = a.current, v = u == null ? void 0 : u.getContext("2d");
2680
+ if (!u || !v)
2623
2681
  return;
2624
- const k = p.getBoundingClientRect(), x = {
2625
- x: l.clientX - k.left,
2626
- y: l.clientY - k.top,
2682
+ const C = u.getBoundingClientRect(), g = {
2683
+ x: l.clientX - C.left,
2684
+ y: l.clientY - C.top,
2627
2685
  pressure: l.pressure,
2628
2686
  timestamp: Date.now()
2629
2687
  };
2630
- if (c((v) => [...v, x]), i.length > 0) {
2631
- const v = i[i.length - 1];
2632
- h.beginPath(), h.moveTo(v.x, v.y), h.lineTo(x.x, x.y), h.strokeStyle = "var(--nice-text, #000)", h.lineWidth = 2, h.lineCap = "round", h.stroke();
2688
+ if (c((w) => [...w, g]), i.length > 0) {
2689
+ const w = i[i.length - 1];
2690
+ v.beginPath(), v.moveTo(w.x, w.y), v.lineTo(g.x, g.y), v.strokeStyle = "var(--nice-text, #000)", v.lineWidth = 2, v.lineCap = "round", v.stroke();
2633
2691
  }
2634
- }, w = () => {
2692
+ }, h = () => {
2635
2693
  if (f) {
2636
2694
  if (s(!1), i.length > 1) {
2637
2695
  const l = {
2638
2696
  id: Date.now().toString(),
2639
2697
  points: [...i]
2640
2698
  };
2641
- n((p) => [...p, l]);
2699
+ n((u) => [...u, l]);
2642
2700
  }
2643
2701
  c([]);
2644
2702
  }
2645
2703
  }, y = () => {
2646
- const l = a.current, p = l == null ? void 0 : l.getContext("2d");
2647
- p && l && p.clearRect(0, 0, l.width, l.height), n([]);
2704
+ const l = a.current, u = l == null ? void 0 : l.getContext("2d");
2705
+ u && l && u.clearRect(0, 0, l.width, l.height), n([]);
2648
2706
  }, b = async () => {
2649
2707
  if (o.length !== 0) {
2650
- m(!0);
2708
+ p(!0);
2651
2709
  try {
2652
2710
  const l = await recognizeHandwriting(o);
2653
2711
  r(l.latex), t("input");
2654
2712
  } finally {
2655
- m(!1);
2713
+ p(!1);
2656
2714
  }
2657
2715
  }
2658
2716
  };
@@ -2665,10 +2723,10 @@ function HandwritingCanvas() {
2665
2723
  {
2666
2724
  ref: a,
2667
2725
  style: styles$3.canvas,
2668
- onPointerDown: u,
2669
- onPointerMove: g,
2670
- onPointerUp: w,
2671
- onPointerLeave: w
2726
+ onPointerDown: m,
2727
+ onPointerMove: x,
2728
+ onPointerUp: h,
2729
+ onPointerLeave: h
2672
2730
  }
2673
2731
  ),
2674
2732
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "8px", marginTop: "12px" }, children: [
@@ -2908,10 +2966,10 @@ class GraphService {
2908
2966
  compute2DParametric(r, t, a, o, n) {
2909
2967
  const i = this.parser.parse(r), c = this.parser.parse(t), f = [], s = (a.max - a.min) / o;
2910
2968
  for (let d = 0; d <= o; d++) {
2911
- const m = a.min + d * s;
2969
+ const p = a.min + d * s;
2912
2970
  try {
2913
- const u = i({ t: m, ...n }), g = c({ t: m, ...n });
2914
- Number.isFinite(u) && Number.isFinite(g) && f.push({ x: u, y: g });
2971
+ const m = i({ t: p, ...n }), x = c({ t: p, ...n });
2972
+ Number.isFinite(m) && Number.isFinite(x) && f.push({ x: m, y: x });
2915
2973
  } catch {
2916
2974
  }
2917
2975
  }
@@ -2925,8 +2983,8 @@ class GraphService {
2925
2983
  try {
2926
2984
  const d = n({ theta: s, t: s, ...o });
2927
2985
  if (Number.isFinite(d)) {
2928
- const m = d * Math.cos(s), u = d * Math.sin(s);
2929
- i.push({ x: m, y: u });
2986
+ const p = d * Math.cos(s), m = d * Math.sin(s);
2987
+ i.push({ x: p, y: m });
2930
2988
  }
2931
2989
  } catch {
2932
2990
  }
@@ -2937,50 +2995,50 @@ class GraphService {
2937
2995
  compute3DSurface(r, t, a, o, n) {
2938
2996
  const i = this.parser.parse(r), c = [], f = (t.max - t.min) / o, s = (a.max - a.min) / o;
2939
2997
  for (let d = 0; d <= o; d++) {
2940
- const m = [], u = t.min + d * f;
2941
- for (let g = 0; g <= o; g++) {
2942
- const w = a.min + g * s;
2998
+ const p = [], m = t.min + d * f;
2999
+ for (let x = 0; x <= o; x++) {
3000
+ const h = a.min + x * s;
2943
3001
  try {
2944
- const y = i({ x: u, y: w, ...n });
2945
- Number.isFinite(y) ? m.push({ x: u, y: w, z: y }) : m.push({ x: u, y: w, z: 0 });
3002
+ const y = i({ x: m, y: h, ...n });
3003
+ Number.isFinite(y) ? p.push({ x: m, y: h, z: y }) : p.push({ x: m, y: h, z: 0 });
2946
3004
  } catch {
2947
- m.push({ x: u, y: w, z: 0 });
3005
+ p.push({ x: m, y: h, z: 0 });
2948
3006
  }
2949
3007
  }
2950
- c.push(m);
3008
+ c.push(p);
2951
3009
  }
2952
3010
  return c;
2953
3011
  }
2954
3012
  /** Export plot data as SVG */
2955
3013
  exportSVG(r, t, a, o) {
2956
- const i = a - 80, c = o - 40 * 2, f = (m) => 40 + (m - t.xRange.min) / (t.xRange.max - t.xRange.min) * i, s = (m) => o - 40 - (m - t.yRange.min) / (t.yRange.max - t.yRange.min) * c, d = [
3014
+ const i = a - 80, c = o - 40 * 2, f = (p) => 40 + (p - t.xRange.min) / (t.xRange.max - t.xRange.min) * i, s = (p) => o - 40 - (p - t.yRange.min) / (t.yRange.max - t.yRange.min) * c, d = [
2957
3015
  `<svg xmlns="http://www.w3.org/2000/svg" width="${a}" height="${o}">`,
2958
3016
  `<rect width="100%" height="100%" fill="rgb(${t.backgroundColor.r},${t.backgroundColor.g},${t.backgroundColor.b})"/>`
2959
3017
  ];
2960
3018
  if (t.showGrid) {
2961
3019
  d.push('<g stroke="var(--nice-border, #ddd)" stroke-width="0.5">');
2962
- for (let m = Math.ceil(t.xRange.min); m <= t.xRange.max; m++) {
2963
- const u = f(m);
2964
- d.push(`<line x1="${u}" y1="40" x2="${u}" y2="${o - 40}"/>`);
3020
+ for (let p = Math.ceil(t.xRange.min); p <= t.xRange.max; p++) {
3021
+ const m = f(p);
3022
+ d.push(`<line x1="${m}" y1="40" x2="${m}" y2="${o - 40}"/>`);
2965
3023
  }
2966
- for (let m = Math.ceil(t.yRange.min); m <= t.yRange.max; m++) {
2967
- const u = s(m);
2968
- d.push(`<line x1="40" y1="${u}" x2="${a - 40}" y2="${u}"/>`);
3024
+ for (let p = Math.ceil(t.yRange.min); p <= t.yRange.max; p++) {
3025
+ const m = s(p);
3026
+ d.push(`<line x1="40" y1="${m}" x2="${a - 40}" y2="${m}"/>`);
2969
3027
  }
2970
3028
  d.push("</g>");
2971
3029
  }
2972
3030
  if (t.showAxes) {
2973
3031
  d.push('<g stroke="var(--nice-text, #333)" stroke-width="1">');
2974
- const m = s(0), u = f(0);
2975
- d.push(`<line x1="40" y1="${m}" x2="${a - 40}" y2="${m}"/>`), d.push(`<line x1="${u}" y1="40" x2="${u}" y2="${o - 40}"/>`), d.push("</g>");
3032
+ const p = s(0), m = f(0);
3033
+ d.push(`<line x1="40" y1="${p}" x2="${a - 40}" y2="${p}"/>`), d.push(`<line x1="${m}" y1="40" x2="${m}" y2="${o - 40}"/>`), d.push("</g>");
2976
3034
  }
2977
- for (const m of r.filter((u) => u.visible))
2978
- if (m.type === "2d-function") {
2979
- const u = this.compute2DFunction(m.expression, t.xRange, m.resolution || 200);
2980
- if (u.length > 0) {
2981
- const g = u.map((w, y) => `${y === 0 ? "M" : "L"}${f(w.x)},${s(w.y)}`).join(" ");
3035
+ for (const p of r.filter((m) => m.visible))
3036
+ if (p.type === "2d-function") {
3037
+ const m = this.compute2DFunction(p.expression, t.xRange, p.resolution || 200);
3038
+ if (m.length > 0) {
3039
+ const x = m.map((h, y) => `${y === 0 ? "M" : "L"}${f(h.x)},${s(h.y)}`).join(" ");
2982
3040
  d.push(
2983
- `<path d="${g}" fill="none" stroke="rgb(${m.color.r},${m.color.g},${m.color.b})" stroke-width="${m.lineWidth}"/>`
3041
+ `<path d="${x}" fill="none" stroke="rgb(${p.color.r},${p.color.g},${p.color.b})" stroke-width="${p.lineWidth}"/>`
2984
3042
  );
2985
3043
  }
2986
3044
  }
@@ -3189,38 +3247,38 @@ function NiceGraphPlotter({
3189
3247
  minValue: -5,
3190
3248
  maxValue: 5,
3191
3249
  speed: 1
3192
- }), m = useCallback(() => {
3250
+ }), p = useCallback(() => {
3193
3251
  i(e.getPlots());
3194
- }, [e]), u = useCallback((p) => {
3195
- f((h) => ({ ...h, ...p }));
3196
- }, []), g = useCallback((p) => {
3197
- d((h) => ({ ...h, ...p }));
3198
- }, []), w = useCallback(
3199
- (p) => {
3200
- e.addPlot(p), m();
3252
+ }, [e]), m = useCallback((u) => {
3253
+ f((v) => ({ ...v, ...u }));
3254
+ }, []), x = useCallback((u) => {
3255
+ d((v) => ({ ...v, ...u }));
3256
+ }, []), h = useCallback(
3257
+ (u) => {
3258
+ e.addPlot(u), p();
3201
3259
  },
3202
- [e, m]
3260
+ [e, p]
3203
3261
  ), y = useCallback(
3204
- (p) => {
3205
- e.removePlot(p), m();
3262
+ (u) => {
3263
+ e.removePlot(u), p();
3206
3264
  },
3207
- [e, m]
3265
+ [e, p]
3208
3266
  ), b = useCallback(
3209
- (p, h) => {
3210
- e.updatePlot(p, h), m();
3267
+ (u, v) => {
3268
+ e.updatePlot(u, v), p();
3211
3269
  },
3212
- [e, m]
3270
+ [e, p]
3213
3271
  ), l = {
3214
3272
  service: e,
3215
3273
  plots: n,
3216
3274
  view: c,
3217
- setView: u,
3218
- addPlot: w,
3275
+ setView: m,
3276
+ addPlot: h,
3219
3277
  removePlot: y,
3220
3278
  updatePlot: b,
3221
3279
  animation: s,
3222
- setAnimation: g,
3223
- refresh: m
3280
+ setAnimation: x,
3281
+ refresh: p
3224
3282
  };
3225
3283
  return /* @__PURE__ */ jsx(GraphContext.Provider, { value: l, children: /* @__PURE__ */ jsxs("div", { className: a, style: { ...styles$2.container, ...o }, children: [
3226
3284
  /* @__PURE__ */ jsxs("div", { style: styles$2.sidebar, children: [
@@ -3286,7 +3344,7 @@ function PlotControls() {
3286
3344
  "select",
3287
3345
  {
3288
3346
  onChange: (s) => {
3289
- const d = FUNCTION_PRESETS.find((m) => m.name === s.target.value);
3347
+ const d = FUNCTION_PRESETS.find((p) => p.name === s.target.value);
3290
3348
  d && r({
3291
3349
  type: d.type,
3292
3350
  expression: d.expression,
@@ -3388,8 +3446,8 @@ function PlotList() {
3388
3446
  }
3389
3447
  function GraphToolbar({ width: e, height: r }) {
3390
3448
  const { t } = useNiceTranslation(), { service: a, plots: o, view: n, setView: i } = useGraph(), c = () => {
3391
- const s = a.exportSVG(o, n, e, r), d = new Blob([s], { type: "image/svg+xml" }), m = URL.createObjectURL(d), u = document.createElement("a");
3392
- u.href = m, u.download = "graph.svg", u.click(), URL.revokeObjectURL(m);
3449
+ const s = a.exportSVG(o, n, e, r), d = new Blob([s], { type: "image/svg+xml" }), p = URL.createObjectURL(d), m = document.createElement("a");
3450
+ m.href = p, m.download = "graph.svg", m.click(), URL.revokeObjectURL(p);
3393
3451
  }, f = async () => {
3394
3452
  const s = await a.exportPNG(o, n, e, r), d = document.createElement("a");
3395
3453
  d.href = s, d.download = "graph.png", d.click();
@@ -3493,32 +3551,32 @@ function Canvas2D({ width: e, height: r }) {
3493
3551
  if (!f || !s)
3494
3552
  return;
3495
3553
  s.fillStyle = `rgb(${n.backgroundColor.r},${n.backgroundColor.g},${n.backgroundColor.b})`, s.fillRect(0, 0, e, r);
3496
- const d = e - c * 2, m = r - c * 2, u = (y) => c + (y - n.xRange.min) / (n.xRange.max - n.xRange.min) * d, g = (y) => r - c - (y - n.yRange.min) / (n.yRange.max - n.yRange.min) * m;
3554
+ const d = e - c * 2, p = r - c * 2, m = (y) => c + (y - n.xRange.min) / (n.xRange.max - n.xRange.min) * d, x = (y) => r - c - (y - n.yRange.min) / (n.yRange.max - n.yRange.min) * p;
3497
3555
  if (n.showGrid) {
3498
3556
  s.strokeStyle = "var(--nice-border, #e0e0e0)", s.lineWidth = 0.5;
3499
3557
  for (let y = Math.ceil(n.xRange.min); y <= n.xRange.max; y++) {
3500
- const b = u(y);
3558
+ const b = m(y);
3501
3559
  s.beginPath(), s.moveTo(b, c), s.lineTo(b, r - c), s.stroke();
3502
3560
  }
3503
3561
  for (let y = Math.ceil(n.yRange.min); y <= n.yRange.max; y++) {
3504
- const b = g(y);
3562
+ const b = x(y);
3505
3563
  s.beginPath(), s.moveTo(c, b), s.lineTo(e - c, b), s.stroke();
3506
3564
  }
3507
3565
  }
3508
3566
  if (n.showAxes) {
3509
3567
  s.strokeStyle = "var(--nice-text, #333)", s.lineWidth = 1;
3510
- const y = g(0);
3568
+ const y = x(0);
3511
3569
  s.beginPath(), s.moveTo(c, y), s.lineTo(e - c, y), s.stroke();
3512
- const b = u(0);
3570
+ const b = m(0);
3513
3571
  if (s.beginPath(), s.moveTo(b, c), s.lineTo(b, r - c), s.stroke(), n.showLabels) {
3514
3572
  s.fillStyle = "var(--nice-text, #333)", s.font = "12px sans-serif", s.textAlign = "center", s.fillText("x", e - c + 15, y + 4), s.fillText("y", b, c - 10), s.font = "10px sans-serif";
3515
3573
  for (let l = Math.ceil(n.xRange.min); l <= n.xRange.max; l++)
3516
- l !== 0 && s.fillText(String(l), u(l), y + 15);
3574
+ l !== 0 && s.fillText(String(l), m(l), y + 15);
3517
3575
  for (let l = Math.ceil(n.yRange.min); l <= n.yRange.max; l++)
3518
- l !== 0 && (s.textAlign = "right", s.fillText(String(l), b - 5, g(l) + 4));
3576
+ l !== 0 && (s.textAlign = "right", s.fillText(String(l), b - 5, x(l) + 4));
3519
3577
  }
3520
3578
  }
3521
- const w = i.isPlaying ? { [i.parameter]: i.currentValue } : {};
3579
+ const h = i.isPlaying ? { [i.parameter]: i.currentValue } : {};
3522
3580
  for (const y of o.filter((b) => b.visible)) {
3523
3581
  const b = `rgb(${y.color.r},${y.color.g},${y.color.b})`;
3524
3582
  s.strokeStyle = b, s.lineWidth = y.lineWidth || 2;
@@ -3529,7 +3587,7 @@ function Canvas2D({ width: e, height: r }) {
3529
3587
  y.expression,
3530
3588
  n.xRange,
3531
3589
  y.resolution || 200,
3532
- w
3590
+ h
3533
3591
  );
3534
3592
  break;
3535
3593
  case "2d-parametric":
@@ -3538,7 +3596,7 @@ function Canvas2D({ width: e, height: r }) {
3538
3596
  y.expressionY || "sin(t)",
3539
3597
  y.parameterRange || { min: 0, max: 2 * Math.PI },
3540
3598
  y.resolution || 200,
3541
- w
3599
+ h
3542
3600
  );
3543
3601
  break;
3544
3602
  case "2d-polar":
@@ -3546,20 +3604,20 @@ function Canvas2D({ width: e, height: r }) {
3546
3604
  y.expression,
3547
3605
  y.parameterRange || { min: 0, max: 2 * Math.PI },
3548
3606
  y.resolution || 200,
3549
- w
3607
+ h
3550
3608
  );
3551
3609
  break;
3552
3610
  }
3553
3611
  if (l.length > 0) {
3554
3612
  s.beginPath();
3555
- let p = !1;
3556
- for (const h of l) {
3557
- const k = u(h.x), x = g(h.y);
3558
- if (x < 0 || x > r) {
3559
- p = !1;
3613
+ let u = !1;
3614
+ for (const v of l) {
3615
+ const C = m(v.x), g = x(v.y);
3616
+ if (g < 0 || g > r) {
3617
+ u = !1;
3560
3618
  continue;
3561
3619
  }
3562
- p ? s.lineTo(k, x) : (s.moveTo(k, x), p = !0);
3620
+ u ? s.lineTo(C, g) : (s.moveTo(C, g), u = !0);
3563
3621
  }
3564
3622
  s.stroke();
3565
3623
  }
@@ -4195,32 +4253,32 @@ function NiceCalculator({
4195
4253
  className: r,
4196
4254
  style: t
4197
4255
  }) {
4198
- const [a, o] = useState("0"), [n, i] = useState("standard"), [c, f] = useState([]), [s, d] = useState(!1), m = useCallback(
4256
+ const [a, o] = useState("0"), [n, i] = useState("standard"), [c, f] = useState([]), [s, d] = useState(!1), p = useCallback(
4199
4257
  (y) => {
4200
4258
  s && /[0-9.]/.test(y) ? (o(y), d(!1)) : (o((b) => b === "0" && y !== "." ? y : b + y), d(!1));
4201
4259
  },
4202
4260
  [s]
4203
- ), u = useCallback(() => {
4261
+ ), m = useCallback(() => {
4204
4262
  o("0"), d(!1);
4205
- }, []), g = useCallback(() => {
4263
+ }, []), x = useCallback(() => {
4206
4264
  try {
4207
4265
  const y = e.evaluate(a), b = e.format(y);
4208
4266
  e.addHistory(a, b, n), f(e.getHistory()), o(b), d(!0);
4209
4267
  } catch {
4210
4268
  o("Error"), d(!0);
4211
4269
  }
4212
- }, [a, n, e]), w = {
4270
+ }, [a, n, e]), h = {
4213
4271
  service: e,
4214
4272
  display: a,
4215
4273
  setDisplay: o,
4216
4274
  mode: n,
4217
4275
  setMode: i,
4218
4276
  history: c,
4219
- calculate: g,
4220
- appendDigit: m,
4221
- clear: u
4277
+ calculate: x,
4278
+ appendDigit: p,
4279
+ clear: m
4222
4280
  };
4223
- return /* @__PURE__ */ jsx(CalculatorContext.Provider, { value: w, children: /* @__PURE__ */ jsxs("div", { className: r, style: { ...styles$1.container, ...t }, children: [
4281
+ return /* @__PURE__ */ jsx(CalculatorContext.Provider, { value: h, children: /* @__PURE__ */ jsxs("div", { className: r, style: { ...styles$1.container, ...t }, children: [
4224
4282
  /* @__PURE__ */ jsx(ModeSelector, {}),
4225
4283
  /* @__PURE__ */ jsx(Display, {}),
4226
4284
  n === "standard" && /* @__PURE__ */ jsx(StandardKeypad, {}),
@@ -4405,9 +4463,9 @@ function ProgrammerKeypad() {
4405
4463
  ] });
4406
4464
  }
4407
4465
  function MatrixMode() {
4408
- const { t: e } = useNiceTranslation(), [r, t] = useState(MatrixOps.create(2, 2)), [a, o] = useState(MatrixOps.create(2, 2)), [n, i] = useState(""), c = (s, d, m, u, g) => {
4409
- const w = { ...s, data: s.data.map((y) => [...y]) };
4410
- w.data[m][u] = parseFloat(g) || 0, d(w);
4466
+ const { t: e } = useNiceTranslation(), [r, t] = useState(MatrixOps.create(2, 2)), [a, o] = useState(MatrixOps.create(2, 2)), [n, i] = useState(""), c = (s, d, p, m, x) => {
4467
+ const h = { ...s, data: s.data.map((y) => [...y]) };
4468
+ h.data[p][m] = parseFloat(x) || 0, d(h);
4411
4469
  }, f = [
4412
4470
  { label: "A + B", fn: () => MatrixOps.toString(MatrixOps.add(r, a)) },
4413
4471
  { label: "A - B", fn: () => MatrixOps.toString(MatrixOps.subtract(r, a)) },
@@ -4424,7 +4482,7 @@ function MatrixMode() {
4424
4482
  MatrixInput,
4425
4483
  {
4426
4484
  matrix: r,
4427
- onChange: (s, d, m) => c(r, t, s, d, m)
4485
+ onChange: (s, d, p) => c(r, t, s, d, p)
4428
4486
  }
4429
4487
  )
4430
4488
  ] }),
@@ -4434,7 +4492,7 @@ function MatrixMode() {
4434
4492
  MatrixInput,
4435
4493
  {
4436
4494
  matrix: a,
4437
- onChange: (s, d, m) => c(a, o, s, d, m)
4495
+ onChange: (s, d, p) => c(a, o, s, d, p)
4438
4496
  }
4439
4497
  )
4440
4498
  ] })
@@ -4570,12 +4628,12 @@ function CalculusMode() {
4570
4628
  ] });
4571
4629
  }
4572
4630
  function UnitsMode() {
4573
- const { t: e } = useNiceTranslation(), { service: r } = useCalculator(), [t, a] = useState("1"), [o, n] = useState("m"), [i, c] = useState("ft"), [f, s] = useState("Length"), [d, m] = useState(""), u = r.getUnitCategories(), g = r.getUnitsByCategory(f), w = () => {
4631
+ const { t: e } = useNiceTranslation(), { service: r } = useCalculator(), [t, a] = useState("1"), [o, n] = useState("m"), [i, c] = useState("ft"), [f, s] = useState("Length"), [d, p] = useState(""), m = r.getUnitCategories(), x = r.getUnitsByCategory(f), h = () => {
4574
4632
  try {
4575
4633
  const y = r.convertUnits(parseFloat(t), o, i);
4576
- m(`${t} ${o} = ${r.format(y)} ${i}`);
4634
+ p(`${t} ${o} = ${r.format(y)} ${i}`);
4577
4635
  } catch (y) {
4578
- m(y.message);
4636
+ p(y.message);
4579
4637
  }
4580
4638
  };
4581
4639
  return /* @__PURE__ */ jsxs("div", { style: { padding: "12px", backgroundColor: "var(--nice-bg-secondary, #252525)" }, children: [
@@ -4597,7 +4655,7 @@ function UnitsMode() {
4597
4655
  border: "1px solid var(--nice-text-secondary, #555)",
4598
4656
  borderRadius: "4px"
4599
4657
  },
4600
- children: u.map((y) => /* @__PURE__ */ jsx("option", { value: y, children: y }, y))
4658
+ children: m.map((y) => /* @__PURE__ */ jsx("option", { value: y, children: y }, y))
4601
4659
  }
4602
4660
  ),
4603
4661
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "8px", alignItems: "center", marginBottom: "12px" }, children: [
@@ -4629,7 +4687,7 @@ function UnitsMode() {
4629
4687
  border: "1px solid var(--nice-text-secondary, #555)",
4630
4688
  borderRadius: "4px"
4631
4689
  },
4632
- children: g.map((y) => /* @__PURE__ */ jsxs("option", { value: y.symbol, children: [
4690
+ children: x.map((y) => /* @__PURE__ */ jsxs("option", { value: y.symbol, children: [
4633
4691
  y.name,
4634
4692
  " (",
4635
4693
  y.symbol,
@@ -4653,7 +4711,7 @@ function UnitsMode() {
4653
4711
  border: "1px solid var(--nice-text-secondary, #555)",
4654
4712
  borderRadius: "4px"
4655
4713
  },
4656
- children: g.map((y) => /* @__PURE__ */ jsxs("option", { value: y.symbol, children: [
4714
+ children: x.map((y) => /* @__PURE__ */ jsxs("option", { value: y.symbol, children: [
4657
4715
  y.name,
4658
4716
  " (",
4659
4717
  y.symbol,
@@ -4665,7 +4723,7 @@ function UnitsMode() {
4665
4723
  /* @__PURE__ */ jsx(
4666
4724
  "button",
4667
4725
  {
4668
- onClick: w,
4726
+ onClick: h,
4669
4727
  style: {
4670
4728
  width: "100%",
4671
4729
  padding: "12px",
@@ -4730,11 +4788,11 @@ const GeoMath = {
4730
4788
  },
4731
4789
  /** Circle-line intersection */
4732
4790
  circleLineIntersection(e, r, t, a) {
4733
- const o = a.x - t.x, n = a.y - t.y, i = t.x - e.x, c = t.y - e.y, f = o * o + n * n, s = 2 * (i * o + c * n), d = i * i + c * c - r * r, m = s * s - 4 * f * d;
4734
- if (m < 0)
4791
+ const o = a.x - t.x, n = a.y - t.y, i = t.x - e.x, c = t.y - e.y, f = o * o + n * n, s = 2 * (i * o + c * n), d = i * i + c * c - r * r, p = s * s - 4 * f * d;
4792
+ if (p < 0)
4735
4793
  return [];
4736
- const u = Math.sqrt(m), g = (-s - u) / (2 * f), w = (-s + u) / (2 * f), y = [];
4737
- return g >= 0 && g <= 1 && y.push({ x: t.x + g * o, y: t.y + g * n }), w >= 0 && w <= 1 && Math.abs(w - g) > 1e-10 && y.push({ x: t.x + w * o, y: t.y + w * n }), y;
4794
+ const m = Math.sqrt(p), x = (-s - m) / (2 * f), h = (-s + m) / (2 * f), y = [];
4795
+ return x >= 0 && x <= 1 && y.push({ x: t.x + x * o, y: t.y + x * n }), h >= 0 && h <= 1 && Math.abs(h - x) > 1e-10 && y.push({ x: t.x + h * o, y: t.y + h * n }), y;
4738
4796
  },
4739
4797
  /** Circle-circle intersection */
4740
4798
  circleCircleIntersection(e, r, t, a) {
@@ -5004,9 +5062,9 @@ class GeometryService {
5004
5062
  return [];
5005
5063
  const n = [], i = (s) => {
5006
5064
  if (s.type === "line" || s.type === "segment" || s.type === "ray") {
5007
- const d = s, m = this.getPoint(d.point1Id ?? d.originId), u = this.getPoint(d.point2Id ?? d.throughId);
5008
- if (m && u)
5009
- return [m, u];
5065
+ const d = s, p = this.getPoint(d.point1Id ?? d.originId), m = this.getPoint(d.point2Id ?? d.throughId);
5066
+ if (p && m)
5067
+ return [p, m];
5010
5068
  }
5011
5069
  return null;
5012
5070
  }, c = i(a), f = i(o);
@@ -5020,19 +5078,19 @@ class GeometryService {
5020
5078
  if (a.type === "circle" && f) {
5021
5079
  const s = a, d = this.getPoint(s.centerId);
5022
5080
  if (d) {
5023
- const m = GeoMath.circleLineIntersection(d, s.radius, f[0], f[1]);
5024
- for (const u of m) {
5025
- const g = this.createPoint(u.x, u.y);
5026
- g.dependencies = [r, t], g.color = { r: 255, g: 0, b: 0 }, n.push(g);
5081
+ const p = GeoMath.circleLineIntersection(d, s.radius, f[0], f[1]);
5082
+ for (const m of p) {
5083
+ const x = this.createPoint(m.x, m.y);
5084
+ x.dependencies = [r, t], x.color = { r: 255, g: 0, b: 0 }, n.push(x);
5027
5085
  }
5028
5086
  }
5029
5087
  }
5030
5088
  if (a.type === "circle" && o.type === "circle") {
5031
- const s = a, d = o, m = this.getPoint(s.centerId), u = this.getPoint(d.centerId);
5032
- if (m && u) {
5033
- const g = GeoMath.circleCircleIntersection(m, s.radius, u, d.radius);
5034
- for (const w of g) {
5035
- const y = this.createPoint(w.x, w.y);
5089
+ const s = a, d = o, p = this.getPoint(s.centerId), m = this.getPoint(d.centerId);
5090
+ if (p && m) {
5091
+ const x = GeoMath.circleCircleIntersection(p, s.radius, m, d.radius);
5092
+ for (const h of x) {
5093
+ const y = this.createPoint(h.x, h.y);
5036
5094
  y.dependencies = [r, t], y.color = { r: 255, g: 0, b: 0 }, n.push(y);
5037
5095
  }
5038
5096
  }
@@ -5107,9 +5165,9 @@ class GeometryService {
5107
5165
  case "segment": {
5108
5166
  const f = this.getPoint(i.point1Id), s = this.getPoint(i.point2Id);
5109
5167
  if (f && s) {
5110
- const d = n(f.x, f.y), m = n(s.x, s.y);
5168
+ const d = n(f.x, f.y), p = n(s.x, s.y);
5111
5169
  o.push(
5112
- `<line x1="${d.x}" y1="${d.y}" x2="${m.x}" y2="${m.y}" stroke="${c}" stroke-width="${i.width}"/>`
5170
+ `<line x1="${d.x}" y1="${d.y}" x2="${p.x}" y2="${p.y}" stroke="${c}" stroke-width="${i.width}"/>`
5113
5171
  );
5114
5172
  }
5115
5173
  break;
@@ -5117,9 +5175,9 @@ class GeometryService {
5117
5175
  case "circle": {
5118
5176
  const f = this.getPoint(i.centerId);
5119
5177
  if (f) {
5120
- const s = n(f.x, f.y), d = i.radius * a.scale, m = i.fill ? `rgba(${i.fill.r},${i.fill.g},${i.fill.b},${i.fill.a ?? 0.2})` : "none";
5178
+ const s = n(f.x, f.y), d = i.radius * a.scale, p = i.fill ? `rgba(${i.fill.r},${i.fill.g},${i.fill.b},${i.fill.a ?? 0.2})` : "none";
5121
5179
  o.push(
5122
- `<circle cx="${s.x}" cy="${s.y}" r="${d}" fill="${m}" stroke="${c}" stroke-width="${i.width}"/>`
5180
+ `<circle cx="${s.x}" cy="${s.y}" r="${d}" fill="${p}" stroke="${c}" stroke-width="${i.width}"/>`
5123
5181
  );
5124
5182
  }
5125
5183
  break;
@@ -5127,9 +5185,9 @@ class GeometryService {
5127
5185
  case "polygon": {
5128
5186
  const f = i.pointIds.map((s) => this.getPoint(s)).filter(Boolean);
5129
5187
  if (f.length > 0) {
5130
- const d = f.map((u) => n(u.x, u.y)).map((u, g) => `${g === 0 ? "M" : "L"}${u.x},${u.y}`).join(" ") + " Z", m = i.fill ? `rgba(${i.fill.r},${i.fill.g},${i.fill.b},${i.fill.a ?? 0.2})` : "none";
5188
+ const d = f.map((m) => n(m.x, m.y)).map((m, x) => `${x === 0 ? "M" : "L"}${m.x},${m.y}`).join(" ") + " Z", p = i.fill ? `rgba(${i.fill.r},${i.fill.g},${i.fill.b},${i.fill.a ?? 0.2})` : "none";
5131
5189
  o.push(
5132
- `<path d="${d}" fill="${m}" stroke="${c}" stroke-width="${i.width}"/>`
5190
+ `<path d="${d}" fill="${p}" stroke="${c}" stroke-width="${i.width}"/>`
5133
5191
  );
5134
5192
  }
5135
5193
  break;
@@ -5213,7 +5271,7 @@ function NiceGeometry({
5213
5271
  className: a,
5214
5272
  style: o
5215
5273
  }) {
5216
- const [n, i] = useState([]), [c, f] = useState("point"), [s, d] = useState([]), [m, u] = useState({
5274
+ const [n, i] = useState([]), [c, f] = useState("point"), [s, d] = useState([]), [p, m] = useState({
5217
5275
  centerX: 0,
5218
5276
  centerY: 0,
5219
5277
  scale: 40,
@@ -5223,24 +5281,24 @@ function NiceGeometry({
5223
5281
  snapToGrid: !0,
5224
5282
  snapToPoints: !0,
5225
5283
  backgroundColor: { r: 255, g: 255, b: 255 }
5226
- }), g = useCallback(() => {
5284
+ }), x = useCallback(() => {
5227
5285
  i(e.getAllElements());
5228
- }, [e]), w = useCallback((b) => {
5229
- u((l) => ({ ...l, ...b }));
5286
+ }, [e]), h = useCallback((b) => {
5287
+ m((l) => ({ ...l, ...b }));
5230
5288
  }, []);
5231
5289
  useEffect(() => {
5232
- g();
5233
- }, [g]);
5290
+ x();
5291
+ }, [x]);
5234
5292
  const y = {
5235
5293
  service: e,
5236
5294
  elements: n,
5237
5295
  tool: c,
5238
5296
  setTool: f,
5239
- view: m,
5240
- setView: w,
5297
+ view: p,
5298
+ setView: h,
5241
5299
  selectedIds: s,
5242
5300
  setSelectedIds: d,
5243
- refresh: g
5301
+ refresh: x
5244
5302
  };
5245
5303
  return /* @__PURE__ */ jsx(GeometryContext.Provider, { value: y, children: /* @__PURE__ */ jsxs("div", { className: a, style: { ...styles.container, ...o }, children: [
5246
5304
  /* @__PURE__ */ jsx(Toolbar, {}),
@@ -5284,157 +5342,157 @@ function Toolbar() {
5284
5342
  )) });
5285
5343
  }
5286
5344
  function Canvas({ width: e, height: r }) {
5287
- const t = useRef(null), { service: a, elements: o, tool: n, view: i, selectedIds: c, setSelectedIds: f, refresh: s } = useGeometry(), [d, m] = useState([]), u = useCallback(
5345
+ const t = useRef(null), { service: a, elements: o, tool: n, view: i, selectedIds: c, setSelectedIds: f, refresh: s } = useGeometry(), [d, p] = useState([]), m = useCallback(
5288
5346
  (b, l) => {
5289
- const p = (b - e / 2) / i.scale + i.centerX, h = -(l - r / 2) / i.scale + i.centerY;
5347
+ const u = (b - e / 2) / i.scale + i.centerX, v = -(l - r / 2) / i.scale + i.centerY;
5290
5348
  return i.snapToGrid ? {
5291
- x: Math.round(p / i.gridSpacing) * i.gridSpacing,
5292
- y: Math.round(h / i.gridSpacing) * i.gridSpacing
5293
- } : { x: p, y: h };
5349
+ x: Math.round(u / i.gridSpacing) * i.gridSpacing,
5350
+ y: Math.round(v / i.gridSpacing) * i.gridSpacing
5351
+ } : { x: u, y: v };
5294
5352
  },
5295
5353
  [e, r, i]
5296
- ), g = useCallback(
5354
+ ), x = useCallback(
5297
5355
  (b, l) => ({
5298
5356
  x: e / 2 + (b - i.centerX) * i.scale,
5299
5357
  y: r / 2 - (l - i.centerY) * i.scale
5300
5358
  }),
5301
5359
  [e, r, i]
5302
- ), w = useCallback(
5360
+ ), h = useCallback(
5303
5361
  (b) => {
5304
- var h;
5305
- const l = (h = t.current) == null ? void 0 : h.getBoundingClientRect();
5362
+ var v;
5363
+ const l = (v = t.current) == null ? void 0 : v.getBoundingClientRect();
5306
5364
  if (!l)
5307
5365
  return;
5308
- const p = u(b.clientX - l.left, b.clientY - l.top);
5366
+ const u = m(b.clientX - l.left, b.clientY - l.top);
5309
5367
  switch (n) {
5310
5368
  case "point": {
5311
- a.createPoint(p.x, p.y), s();
5369
+ a.createPoint(u.x, u.y), s();
5312
5370
  break;
5313
5371
  }
5314
5372
  case "segment":
5315
5373
  case "line":
5316
5374
  case "ray": {
5317
- const k = y(p);
5318
- if (k)
5319
- m((x) => {
5320
- const v = [...x, k.id];
5321
- return v.length === 2 ? (n === "segment" ? a.createSegment(v[0], v[1]) : n === "line" ? a.createLine(v[0], v[1]) : n === "ray" && a.createRay(v[0], v[1]), s(), []) : v;
5375
+ const C = y(u);
5376
+ if (C)
5377
+ p((g) => {
5378
+ const w = [...g, C.id];
5379
+ return w.length === 2 ? (n === "segment" ? a.createSegment(w[0], w[1]) : n === "line" ? a.createLine(w[0], w[1]) : n === "ray" && a.createRay(w[0], w[1]), s(), []) : w;
5322
5380
  });
5323
5381
  else {
5324
- const x = a.createPoint(p.x, p.y);
5325
- m((v) => {
5326
- const C = [...v, x.id];
5327
- return C.length === 2 ? (n === "segment" ? a.createSegment(C[0], C[1]) : n === "line" ? a.createLine(C[0], C[1]) : n === "ray" && a.createRay(C[0], C[1]), s(), []) : C;
5382
+ const g = a.createPoint(u.x, u.y);
5383
+ p((w) => {
5384
+ const k = [...w, g.id];
5385
+ return k.length === 2 ? (n === "segment" ? a.createSegment(k[0], k[1]) : n === "line" ? a.createLine(k[0], k[1]) : n === "ray" && a.createRay(k[0], k[1]), s(), []) : k;
5328
5386
  }), s();
5329
5387
  }
5330
5388
  break;
5331
5389
  }
5332
5390
  case "circle": {
5333
- const k = y(p);
5334
- if (k)
5335
- m((x) => {
5336
- if (x.length === 0)
5337
- return [k.id];
5338
- const v = a.getPoint(x[0]);
5339
- if (v) {
5340
- const C = GeoMath.distance(v, p);
5341
- a.createCircle(x[0], C), s();
5391
+ const C = y(u);
5392
+ if (C)
5393
+ p((g) => {
5394
+ if (g.length === 0)
5395
+ return [C.id];
5396
+ const w = a.getPoint(g[0]);
5397
+ if (w) {
5398
+ const k = GeoMath.distance(w, u);
5399
+ a.createCircle(g[0], k), s();
5342
5400
  }
5343
5401
  return [];
5344
5402
  });
5345
5403
  else if (d.length === 1) {
5346
- const x = a.getPoint(d[0]);
5347
- if (x) {
5348
- const v = GeoMath.distance(x, p);
5349
- a.createCircle(d[0], v), s(), m([]);
5404
+ const g = a.getPoint(d[0]);
5405
+ if (g) {
5406
+ const w = GeoMath.distance(g, u);
5407
+ a.createCircle(d[0], w), s(), p([]);
5350
5408
  }
5351
5409
  } else {
5352
- const x = a.createPoint(p.x, p.y);
5353
- m([x.id]), s();
5410
+ const g = a.createPoint(u.x, u.y);
5411
+ p([g.id]), s();
5354
5412
  }
5355
5413
  break;
5356
5414
  }
5357
5415
  case "midpoint": {
5358
- const k = y(p);
5359
- k && m((x) => {
5360
- const v = [...x, k.id];
5361
- return v.length === 2 ? (a.createMidpoint(v[0], v[1]), s(), []) : v;
5416
+ const C = y(u);
5417
+ C && p((g) => {
5418
+ const w = [...g, C.id];
5419
+ return w.length === 2 ? (a.createMidpoint(w[0], w[1]), s(), []) : w;
5362
5420
  });
5363
5421
  break;
5364
5422
  }
5365
5423
  case "select": {
5366
- const k = y(p);
5367
- f(k ? [k.id] : []);
5424
+ const C = y(u);
5425
+ f(C ? [C.id] : []);
5368
5426
  break;
5369
5427
  }
5370
5428
  }
5371
5429
  },
5372
- [n, a, s, u, d, f]
5430
+ [n, a, s, m, d, f]
5373
5431
  ), y = (b) => {
5374
- for (const p of o)
5375
- if (p.type === "point" && GeoMath.distance(p, b) < 0.5)
5376
- return p;
5432
+ for (const u of o)
5433
+ if (u.type === "point" && GeoMath.distance(u, b) < 0.5)
5434
+ return u;
5377
5435
  };
5378
5436
  return useEffect(() => {
5379
5437
  const b = t.current, l = b == null ? void 0 : b.getContext("2d");
5380
5438
  if (!(!b || !l)) {
5381
5439
  if (l.fillStyle = `rgb(${i.backgroundColor.r},${i.backgroundColor.g},${i.backgroundColor.b})`, l.fillRect(0, 0, e, r), i.showGrid) {
5382
5440
  l.strokeStyle = "var(--nice-border, #e0e0e0)", l.lineWidth = 0.5;
5383
- const p = i.gridSpacing * i.scale, h = (e / 2 - i.centerX * i.scale) % p, k = (r / 2 + i.centerY * i.scale) % p;
5384
- for (let x = h; x < e; x += p)
5385
- l.beginPath(), l.moveTo(x, 0), l.lineTo(x, r), l.stroke();
5386
- for (let x = k; x < r; x += p)
5387
- l.beginPath(), l.moveTo(0, x), l.lineTo(e, x), l.stroke();
5441
+ const u = i.gridSpacing * i.scale, v = (e / 2 - i.centerX * i.scale) % u, C = (r / 2 + i.centerY * i.scale) % u;
5442
+ for (let g = v; g < e; g += u)
5443
+ l.beginPath(), l.moveTo(g, 0), l.lineTo(g, r), l.stroke();
5444
+ for (let g = C; g < r; g += u)
5445
+ l.beginPath(), l.moveTo(0, g), l.lineTo(e, g), l.stroke();
5388
5446
  }
5389
5447
  if (i.showAxes) {
5390
- const p = g(0, 0);
5391
- l.strokeStyle = "var(--nice-text, #333)", l.lineWidth = 1, l.beginPath(), l.moveTo(0, p.y), l.lineTo(e, p.y), l.stroke(), l.beginPath(), l.moveTo(p.x, 0), l.lineTo(p.x, r), l.stroke();
5448
+ const u = x(0, 0);
5449
+ l.strokeStyle = "var(--nice-text, #333)", l.lineWidth = 1, l.beginPath(), l.moveTo(0, u.y), l.lineTo(e, u.y), l.stroke(), l.beginPath(), l.moveTo(u.x, 0), l.lineTo(u.x, r), l.stroke();
5392
5450
  }
5393
- for (const p of o) {
5394
- if (!p.visible)
5451
+ for (const u of o) {
5452
+ if (!u.visible)
5395
5453
  continue;
5396
- const h = `rgb(${p.color.r},${p.color.g},${p.color.b})`, k = c.includes(p.id);
5397
- switch (p.type) {
5454
+ const v = `rgb(${u.color.r},${u.color.g},${u.color.b})`, C = c.includes(u.id);
5455
+ switch (u.type) {
5398
5456
  case "point": {
5399
- const x = g(p.x, p.y);
5400
- l.beginPath(), l.arc(x.x, x.y, k ? p.size + 2 : p.size, 0, 2 * Math.PI), l.fillStyle = k ? "var(--nice-primary-hover, #1976d2)" : h, l.fill(), p.label && (l.fillStyle = "var(--nice-text, #333)", l.font = "12px sans-serif", l.fillText(p.label, x.x + 8, x.y - 8));
5457
+ const g = x(u.x, u.y);
5458
+ l.beginPath(), l.arc(g.x, g.y, C ? u.size + 2 : u.size, 0, 2 * Math.PI), l.fillStyle = C ? "var(--nice-primary-hover, #1976d2)" : v, l.fill(), u.label && (l.fillStyle = "var(--nice-text, #333)", l.font = "12px sans-serif", l.fillText(u.label, g.x + 8, g.y - 8));
5401
5459
  break;
5402
5460
  }
5403
5461
  case "segment": {
5404
- const x = a.getPoint(p.point1Id), v = a.getPoint(p.point2Id);
5405
- if (x && v) {
5406
- const C = g(x.x, x.y), M = g(v.x, v.y);
5407
- l.strokeStyle = h, l.lineWidth = p.width, l.beginPath(), l.moveTo(C.x, C.y), l.lineTo(M.x, M.y), l.stroke();
5462
+ const g = a.getPoint(u.point1Id), w = a.getPoint(u.point2Id);
5463
+ if (g && w) {
5464
+ const k = x(g.x, g.y), M = x(w.x, w.y);
5465
+ l.strokeStyle = v, l.lineWidth = u.width, l.beginPath(), l.moveTo(k.x, k.y), l.lineTo(M.x, M.y), l.stroke();
5408
5466
  }
5409
5467
  break;
5410
5468
  }
5411
5469
  case "line": {
5412
- const x = a.getPoint(p.point1Id), v = a.getPoint(p.point2Id);
5413
- if (x && v) {
5414
- const C = v.x - x.x, M = v.y - x.y, P = -1e3, j = 1e3, $ = g(x.x + P * C, x.y + P * M), B = g(x.x + j * C, x.y + j * M);
5415
- l.strokeStyle = h, l.lineWidth = p.width, l.beginPath(), l.moveTo($.x, $.y), l.lineTo(B.x, B.y), l.stroke();
5470
+ const g = a.getPoint(u.point1Id), w = a.getPoint(u.point2Id);
5471
+ if (g && w) {
5472
+ const k = w.x - g.x, M = w.y - g.y, P = -1e3, $ = 1e3, B = x(g.x + P * k, g.y + P * M), R = x(g.x + $ * k, g.y + $ * M);
5473
+ l.strokeStyle = v, l.lineWidth = u.width, l.beginPath(), l.moveTo(B.x, B.y), l.lineTo(R.x, R.y), l.stroke();
5416
5474
  }
5417
5475
  break;
5418
5476
  }
5419
5477
  case "circle": {
5420
- const x = a.getPoint(p.centerId);
5421
- if (x) {
5422
- const v = g(x.x, x.y), C = p.radius * i.scale;
5423
- l.beginPath(), l.arc(v.x, v.y, C, 0, 2 * Math.PI), p.fill && (l.fillStyle = `rgba(${p.fill.r},${p.fill.g},${p.fill.b},${p.fill.a ?? 0.2})`, l.fill()), l.strokeStyle = h, l.lineWidth = p.width, l.stroke();
5478
+ const g = a.getPoint(u.centerId);
5479
+ if (g) {
5480
+ const w = x(g.x, g.y), k = u.radius * i.scale;
5481
+ l.beginPath(), l.arc(w.x, w.y, k, 0, 2 * Math.PI), u.fill && (l.fillStyle = `rgba(${u.fill.r},${u.fill.g},${u.fill.b},${u.fill.a ?? 0.2})`, l.fill()), l.strokeStyle = v, l.lineWidth = u.width, l.stroke();
5424
5482
  }
5425
5483
  break;
5426
5484
  }
5427
5485
  case "polygon": {
5428
- const x = p.pointIds.map((v) => a.getPoint(v)).filter(Boolean);
5429
- if (x.length > 0) {
5486
+ const g = u.pointIds.map((w) => a.getPoint(w)).filter(Boolean);
5487
+ if (g.length > 0) {
5430
5488
  l.beginPath();
5431
- const v = g(x[0].x, x[0].y);
5432
- l.moveTo(v.x, v.y);
5433
- for (let C = 1; C < x.length; C++) {
5434
- const M = g(x[C].x, x[C].y);
5489
+ const w = x(g[0].x, g[0].y);
5490
+ l.moveTo(w.x, w.y);
5491
+ for (let k = 1; k < g.length; k++) {
5492
+ const M = x(g[k].x, g[k].y);
5435
5493
  l.lineTo(M.x, M.y);
5436
5494
  }
5437
- l.closePath(), p.fill && (l.fillStyle = `rgba(${p.fill.r},${p.fill.g},${p.fill.b},${p.fill.a ?? 0.2})`, l.fill()), l.strokeStyle = h, l.lineWidth = p.width, l.stroke();
5495
+ l.closePath(), u.fill && (l.fillStyle = `rgba(${u.fill.r},${u.fill.g},${u.fill.b},${u.fill.a ?? 0.2})`, l.fill()), l.strokeStyle = v, l.lineWidth = u.width, l.stroke();
5438
5496
  }
5439
5497
  break;
5440
5498
  }
@@ -5442,23 +5500,23 @@ function Canvas({ width: e, height: r }) {
5442
5500
  }
5443
5501
  if (d.length > 0) {
5444
5502
  l.fillStyle = "rgba(25, 118, 210, 0.3)";
5445
- for (const p of d) {
5446
- const h = a.getPoint(p);
5447
- if (h) {
5448
- const k = g(h.x, h.y);
5449
- l.beginPath(), l.arc(k.x, k.y, 12, 0, 2 * Math.PI), l.fill();
5503
+ for (const u of d) {
5504
+ const v = a.getPoint(u);
5505
+ if (v) {
5506
+ const C = x(v.x, v.y);
5507
+ l.beginPath(), l.arc(C.x, C.y, 12, 0, 2 * Math.PI), l.fill();
5450
5508
  }
5451
5509
  }
5452
5510
  }
5453
5511
  }
5454
- }, [o, i, e, r, c, d, a, g]), /* @__PURE__ */ jsx(
5512
+ }, [o, i, e, r, c, d, a, x]), /* @__PURE__ */ jsx(
5455
5513
  "canvas",
5456
5514
  {
5457
5515
  ref: t,
5458
5516
  width: e,
5459
5517
  height: r,
5460
5518
  style: styles.canvas,
5461
- onClick: w
5519
+ onClick: h
5462
5520
  }
5463
5521
  );
5464
5522
  }