vue3-math-editor 0.2.4 → 0.2.6

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.
@@ -29,7 +29,7 @@ function k(e) {
29
29
  default: return [];
30
30
  }
31
31
  }
32
- function ye(e) {
32
+ function A(e) {
33
33
  if (e === "otherwise") return { part: "otherwise" };
34
34
  let t = /^(value|cond)(\d+)$/.exec(e);
35
35
  return t ? {
@@ -37,9 +37,9 @@ function ye(e) {
37
37
  piece: Number(t[2])
38
38
  } : null;
39
39
  }
40
- function A(e, t, n) {
40
+ function j(e, t, n) {
41
41
  if (e.kind === "piecewise") {
42
- let r = ye(t);
42
+ let r = A(t);
43
43
  if (!r) throw Error(`No branch ${t} in a piecewise`);
44
44
  if (r.part === "otherwise") return {
45
45
  ...e,
@@ -62,93 +62,93 @@ function A(e, t, n) {
62
62
  [t]: n
63
63
  };
64
64
  }
65
- function be(e, t) {
65
+ function ye(e, t) {
66
66
  return k(e).find(([e]) => e === t)?.[1] ?? null;
67
67
  }
68
- function j(e, t) {
68
+ function M(e, t) {
69
69
  let n = e;
70
70
  for (let e of t) {
71
71
  let t = n[e.atom];
72
72
  if (!t) return null;
73
- let r = be(t, e.branch);
73
+ let r = ye(t, e.branch);
74
74
  if (!r) return null;
75
75
  n = r;
76
76
  }
77
77
  return n;
78
78
  }
79
- function M(e, t) {
79
+ function N(e, t) {
80
80
  return e.length === t.length && e.every((e, n) => e.atom === t[n].atom && e.branch === t[n].branch);
81
81
  }
82
- var xe = 0;
83
- function N() {
84
- return xe += 1, `a${xe}`;
82
+ var be = 0;
83
+ function P() {
84
+ return be += 1, `a${be}`;
85
85
  }
86
- function P(e) {
86
+ function F(e) {
87
87
  return {
88
88
  kind: "symbol",
89
- id: N(),
89
+ id: P(),
90
90
  value: e
91
91
  };
92
92
  }
93
- function F(e) {
93
+ function I(e) {
94
94
  return {
95
95
  kind: "function",
96
- id: N(),
96
+ id: P(),
97
97
  name: e
98
98
  };
99
99
  }
100
- function Se(e = [], t = []) {
100
+ function xe(e = [], t = []) {
101
101
  return {
102
102
  kind: "fraction",
103
- id: N(),
103
+ id: P(),
104
104
  num: e,
105
105
  den: t
106
106
  };
107
107
  }
108
- function Ce(e = []) {
108
+ function Se(e = []) {
109
109
  return {
110
110
  kind: "superscript",
111
- id: N(),
111
+ id: P(),
112
112
  sup: e
113
113
  };
114
114
  }
115
- function we(e = [], t = null) {
115
+ function Ce(e = [], t = null) {
116
116
  return {
117
117
  kind: "root",
118
- id: N(),
118
+ id: P(),
119
119
  index: t,
120
120
  body: e
121
121
  };
122
122
  }
123
- function I(e = [], t = "(", n) {
123
+ function L(e = [], t = "(", n) {
124
124
  let r = n ?? O[t] ?? t;
125
125
  return {
126
126
  kind: "group",
127
- id: N(),
127
+ id: P(),
128
128
  open: t,
129
129
  close: r,
130
130
  body: e
131
131
  };
132
132
  }
133
- function Te(e = [], t = []) {
133
+ function we(e = [], t = []) {
134
134
  return {
135
135
  kind: "derivative",
136
- id: N(),
136
+ id: P(),
137
137
  expr: e,
138
138
  variable: t
139
139
  };
140
140
  }
141
- function Ee(e = []) {
141
+ function Te(e = []) {
142
142
  return {
143
143
  kind: "units",
144
- id: N(),
144
+ id: P(),
145
145
  units: e
146
146
  };
147
147
  }
148
- function De(e = [[[], []]], t = null) {
148
+ function Ee(e = [[[], []]], t = null) {
149
149
  return {
150
150
  kind: "piecewise",
151
- id: N(),
151
+ id: P(),
152
152
  pieces: e.map(([e, t]) => ({
153
153
  value: e,
154
154
  condition: t
@@ -156,12 +156,12 @@ function De(e = [[[], []]], t = null) {
156
156
  otherwise: t
157
157
  };
158
158
  }
159
- function L(...e) {
160
- return e.flatMap((e) => typeof e == "string" ? Array.from(e).map((e) => P(e)) : [e]);
159
+ function R(...e) {
160
+ return e.flatMap((e) => typeof e == "string" ? Array.from(e).map((e) => F(e)) : [e]);
161
161
  }
162
162
  //#endregion
163
163
  //#region src/editor/constants.ts
164
- var Oe = [
164
+ var De = [
165
165
  {
166
166
  symbol: "pi",
167
167
  latex: "\\pi",
@@ -212,22 +212,22 @@ var Oe = [
212
212
  mathJson: "False",
213
213
  commands: ["false"]
214
214
  }
215
- ], ke = new Map(Oe.map((e) => [e.symbol, e])), Ae = new Map(Oe.flatMap((e) => e.commands.map((t) => [t, e]))), je = (e) => ke.get(e), Me = (e) => Ae.get(e), Ne = /* @__PURE__ */ new Map([["pi", "pi"], ["infty", "infinity"]]), Pe = /* @__PURE__ */ new Map([
215
+ ], Oe = new Map(De.map((e) => [e.symbol, e])), ke = new Map(De.flatMap((e) => e.commands.map((t) => [t, e]))), Ae = (e) => Oe.get(e), je = (e) => ke.get(e), Me = /* @__PURE__ */ new Map([["pi", "pi"], ["infty", "infinity"]]), Ne = /* @__PURE__ */ new Map([
216
216
  ["e", "exponentiale"],
217
217
  ["NaN", "notanumber"],
218
218
  ["true", "true"],
219
219
  ["false", "false"]
220
- ]), Fe = (e) => Ne.get(e), Ie = (e) => Pe.get(e), R = (e) => e?.kind === "symbol" ? e.value : null, Le = (e) => e !== null && /^[0-9]$/.test(e), Re = (e) => Le(e) || e === ".", ze = (e) => Re(R(e));
221
- function Be(e, t) {
222
- if (!ze(e[t])) return null;
220
+ ]), Pe = (e) => Me.get(e), Fe = (e) => Ne.get(e), z = (e) => e?.kind === "symbol" ? e.value : null, Ie = (e) => e !== null && /^[0-9]$/.test(e), Le = (e) => Ie(e) || e === ".", Re = (e) => Le(z(e));
221
+ function ze(e, t) {
222
+ if (!Re(e[t])) return null;
223
223
  let n = t, r = "";
224
- for (; Re(R(e[n]));) r += R(e[n++]);
225
- let i = null, a = R(e[n]);
224
+ for (; Le(z(e[n]));) r += z(e[n++]);
225
+ let i = null, a = z(e[n]);
226
226
  if (a === "e" || a === "E") {
227
- let t = n + 1, r = "", a = R(e[t]);
228
- if ((a === "+" || a === "-" || a === "−") && (r = a === "+" ? "+" : "-", t++), Le(R(e[t]))) {
227
+ let t = n + 1, r = "", a = z(e[t]);
228
+ if ((a === "+" || a === "-" || a === "−") && (r = a === "+" ? "+" : "-", t++), Ie(z(e[t]))) {
229
229
  let a = "";
230
- for (; Re(R(e[t]));) a += R(e[t++]);
230
+ for (; Le(z(e[t]));) a += z(e[t++]);
231
231
  i = r + a, n = t;
232
232
  }
233
233
  }
@@ -239,14 +239,14 @@ function Be(e, t) {
239
239
  exponent: i
240
240
  };
241
241
  }
242
- function Ve(e, t) {
243
- let n = R(e[t - 1]);
244
- if (n !== "e" && n !== "E" || !Re(R(e[t - 2]))) return !1;
242
+ function Be(e, t) {
243
+ let n = z(e[t - 1]);
244
+ if (n !== "e" && n !== "E" || !Le(z(e[t - 2]))) return !1;
245
245
  let r = t - 2;
246
- for (; Re(R(e[r - 1]));) r--;
247
- return !/^[A-Za-z_]$/.test(R(e[r - 1]) ?? "");
246
+ for (; Le(z(e[r - 1]));) r--;
247
+ return !/^[A-Za-z_]$/.test(z(e[r - 1]) ?? "");
248
248
  }
249
- var He = Object.fromEntries([
249
+ var Ve = Object.fromEntries([
250
250
  [
251
251
  "exp",
252
252
  "exp",
@@ -480,14 +480,14 @@ var He = Object.fromEntries([
480
480
  mathJson: i,
481
481
  ...a && { aliases: a }
482
482
  }]));
483
- function Ue(e) {
484
- return He[e.toLowerCase()] ?? null;
483
+ function He(e) {
484
+ return Ve[e.toLowerCase()] ?? null;
485
485
  }
486
- function We(e) {
487
- let t = Ue(e);
486
+ function Ue(e) {
487
+ let t = He(e);
488
488
  return t ? t.latexCommand ? `\\${t.latexName} ` : `\\operatorname{${t.latexName}}` : `\\operatorname{${e}}`;
489
489
  }
490
- var Ge = {
490
+ var We = {
491
491
  floor: {
492
492
  open: "⌊",
493
493
  close: "⌋",
@@ -500,12 +500,12 @@ var Ge = {
500
500
  latexOpen: "\\lceil",
501
501
  latexClose: "\\rceil"
502
502
  }
503
- }, Ke = (e) => Ge[e];
504
- function qe(e) {
505
- return Object.keys(Ge).find((t) => Ge[t].open === e);
503
+ }, Ge = (e) => We[e];
504
+ function Ke(e) {
505
+ return Object.keys(We).find((t) => We[t].open === e);
506
506
  }
507
- function Je(e) {
508
- for (let t of Object.values(Ge)) {
507
+ function qe(e) {
508
+ for (let t of Object.values(We)) {
509
509
  if (e === t.open) return t.latexOpen;
510
510
  if (e === t.close) return t.latexClose;
511
511
  }
@@ -513,78 +513,78 @@ function Je(e) {
513
513
  }
514
514
  //#endregion
515
515
  //#region src/editor/identifiers.ts
516
- var z = /* @__PURE__ */ new Set(/* @__PURE__ */ "alpha.beta.gamma.delta.epsilon.varepsilon.zeta.eta.theta.vartheta.iota.kappa.lambda.mu.nu.xi.pi.rho.sigma.tau.upsilon.phi.varphi.chi.psi.omega.Gamma.Delta.Theta.Lambda.Xi.Pi.Sigma.Upsilon.Phi.Psi.Omega".split(".")), Ye = /* @__PURE__ */ new Map();
517
- for (let e of Object.values(He)) {
518
- Ye.set(e.name, e.name), Ye.set(e.latexName, e.name);
519
- for (let t of e.aliases ?? []) Ye.set(t, e.name);
516
+ var B = /* @__PURE__ */ new Set(/* @__PURE__ */ "alpha.beta.gamma.delta.epsilon.varepsilon.zeta.eta.theta.vartheta.iota.kappa.lambda.mu.nu.xi.pi.rho.sigma.tau.upsilon.phi.varphi.chi.psi.omega.Gamma.Delta.Theta.Lambda.Xi.Pi.Sigma.Upsilon.Phi.Psi.Omega".split(".")), Je = /* @__PURE__ */ new Map();
517
+ for (let e of Object.values(Ve)) {
518
+ Je.set(e.name, e.name), Je.set(e.latexName, e.name);
519
+ for (let t of e.aliases ?? []) Je.set(t, e.name);
520
520
  }
521
- function Xe(e) {
522
- return Ye.get(e);
521
+ function Ye(e) {
522
+ return Je.get(e);
523
523
  }
524
- var Ze = (e, t) => e?.kind === "symbol" && t.test(e.value), B = (e) => e?.kind === "symbol" && z.has(e.value) && !je(e.value), Qe = (e) => Ze(e, /^[A-Za-z]$/), $e = (e) => Qe(e) || B(e), et = (e) => Ze(e, /^[A-Za-z0-9_]$/) || B(e);
525
- function tt(e, t) {
524
+ var Xe = (e, t) => e?.kind === "symbol" && t.test(e.value), V = (e) => e?.kind === "symbol" && B.has(e.value) && !Ae(e.value), Ze = (e) => Xe(e, /^[A-Za-z]$/), Qe = (e) => Ze(e) || V(e), $e = (e) => Xe(e, /^[A-Za-z0-9_]$/) || V(e);
525
+ function et(e, t) {
526
526
  let n = t;
527
- for (; n < e.length && et(e[n]);) {
528
- let r = e[n - 1], i = B(e[n]);
529
- if (n > t && (i && !Ze(r, /^_$/) || Qe(e[n]) && B(r)) || n === t && !i && !Qe(e[n])) break;
527
+ for (; n < e.length && $e(e[n]);) {
528
+ let r = e[n - 1], i = V(e[n]);
529
+ if (n > t && (i && !Xe(r, /^_$/) || Ze(e[n]) && V(r)) || n === t && !i && !Ze(e[n])) break;
530
530
  n++;
531
531
  }
532
532
  return n;
533
533
  }
534
- function nt(e) {
535
- return je(e)?.symbol;
534
+ function tt(e) {
535
+ return Ae(e)?.symbol;
536
536
  }
537
- function rt(e) {
537
+ function nt(e) {
538
538
  let t = [], n = 0;
539
539
  for (; n < e.length;) {
540
- let r = Be(e, n);
540
+ let r = ze(e, n);
541
541
  if (r) {
542
542
  n = r.end;
543
543
  continue;
544
544
  }
545
- if (!$e(e[n])) {
545
+ if (!Qe(e[n])) {
546
546
  n++;
547
547
  continue;
548
548
  }
549
549
  let i = n;
550
- n = tt(e, i);
550
+ n = et(e, i);
551
551
  let a = e.slice(i, n).map((e) => e.value).join("");
552
552
  t.push({
553
553
  start: i,
554
554
  end: n,
555
555
  name: a,
556
- functionName: Xe(a) ?? null
556
+ functionName: Ye(a) ?? null
557
557
  });
558
558
  }
559
559
  return t;
560
560
  }
561
- function it(e) {
561
+ function rt(e) {
562
562
  let t = [], n = 0;
563
563
  for (; n < e.length;) {
564
- if ($e(e[n])) {
565
- n = tt(e, n);
564
+ if (Qe(e[n])) {
565
+ n = et(e, n);
566
566
  continue;
567
567
  }
568
- let r = Be(e, n);
568
+ let r = ze(e, n);
569
569
  r ? (t.push(r), n = r.end) : n++;
570
570
  }
571
571
  return t;
572
572
  }
573
- var at = (e) => e.units.map((e) => e.kind === "symbol" ? e.value : "").join("");
574
- function ot(e) {
573
+ var it = (e) => e.units.map((e) => e.kind === "symbol" ? e.value : "").join("");
574
+ function at(e) {
575
575
  if (e.otherwise?.map((e) => e.kind === "symbol" ? e.value : "\0").join("") !== "0.0") return null;
576
- let t = e.pieces[0]?.value ?? [], n = Be(t, +(t[0]?.kind === "symbol" && t[0].value === "-")), r = t[t.length - 1];
577
- return !n || n.end !== t.length - 1 || r?.kind !== "units" ? null : at(r) || null;
576
+ let t = e.pieces[0]?.value ?? [], n = ze(t, +(t[0]?.kind === "symbol" && t[0].value === "-")), r = t[t.length - 1];
577
+ return !n || n.end !== t.length - 1 || r?.kind !== "units" ? null : it(r) || null;
578
578
  }
579
- var st = /* @__PURE__ */ new WeakMap(), ct = /^[A-Za-z][A-Za-z0-9_]*$/;
580
- function lt(e) {
581
- let t = st.get(e);
579
+ var ot = /* @__PURE__ */ new WeakMap(), st = /^[A-Za-z][A-Za-z0-9_]*$/;
580
+ function ct(e) {
581
+ let t = ot.get(e);
582
582
  if (t) return t;
583
583
  let n = /* @__PURE__ */ new Map(), r = (e, t) => {
584
584
  let r = n.get(e);
585
585
  r ? r.push(t) : n.set(e, [t]);
586
586
  }, i = (e) => {
587
- let t = new Map(rt(e).map((e) => [e.start, e]));
587
+ let t = new Map(nt(e).map((e) => [e.start, e]));
588
588
  for (let n = 0; n < e.length; n++) {
589
589
  let a = e[n], o = t.get(n);
590
590
  if (o) {
@@ -595,20 +595,20 @@ function lt(e) {
595
595
  n = o.end - 1;
596
596
  continue;
597
597
  }
598
- if (a.kind === "symbol" && ct.test(a.value) && !je(a.value) && r(a.value, [a.id]), a.kind !== "units") for (let [, e] of k(a)) i(e);
598
+ if (a.kind === "symbol" && st.test(a.value) && !Ae(a.value) && r(a.value, [a.id]), a.kind !== "units") for (let [, e] of k(a)) i(e);
599
599
  }
600
600
  };
601
- return i(e), st.set(e, n), n;
601
+ return i(e), ot.set(e, n), n;
602
602
  }
603
- function ut(e) {
603
+ function lt(e) {
604
604
  let t = [], n = (e, r = null) => {
605
- for (let n of it(e)) {
605
+ for (let n of rt(e)) {
606
606
  let i = e[n.end], a = i?.kind === "units" ? i : null, o = e.slice(n.start, n.end + +!!a).map((e) => e.id), s = e.slice(n.start, n.end).map((e) => e.id), c = Number(n.text);
607
607
  a ? t.push({
608
608
  value: c,
609
609
  atomIds: o,
610
610
  digitIds: s,
611
- units: at(a)
611
+ units: it(a)
612
612
  }) : r ? t.push({
613
613
  value: c,
614
614
  atomIds: o,
@@ -624,21 +624,21 @@ function ut(e) {
624
624
  }
625
625
  for (let t of e) if (t.kind !== "units") for (let [e, r] of k(t)) {
626
626
  let i = t.kind === "piecewise" && e === "otherwise";
627
- n(r, i ? ot(t) : null);
627
+ n(r, i ? at(t) : null);
628
628
  }
629
629
  };
630
630
  return n(e), t;
631
631
  }
632
- function dt(e, t) {
632
+ function ut(e, t) {
633
633
  let n = e[t - 1];
634
634
  if (n?.kind === "function") {
635
- let e = Ke(n.name);
635
+ let e = Ge(n.name);
636
636
  return e ? {
637
637
  start: t - 1,
638
638
  open: e.open
639
639
  } : null;
640
640
  }
641
- let r = rt(e.slice(0, t)).find((e) => e.end === t), i = r?.functionName ? Ke(r.functionName) : void 0;
641
+ let r = nt(e.slice(0, t)).find((e) => e.end === t), i = r?.functionName ? Ge(r.functionName) : void 0;
642
642
  return r && i ? {
643
643
  start: r.start,
644
644
  open: i.open
@@ -646,42 +646,42 @@ function dt(e, t) {
646
646
  }
647
647
  //#endregion
648
648
  //#region src/editor/names.ts
649
- var ft = /^([A-Za-z]+?)(\d*)$/;
650
- function pt(e) {
651
- let t = ft.exec(e);
649
+ var dt = /^([A-Za-z]+?)(\d*)$/;
650
+ function ft(e) {
651
+ let t = dt.exec(e);
652
652
  if (!t) return null;
653
653
  let [, n] = t;
654
- return z.has(n) && !je(n) ? n : null;
654
+ return B.has(n) && !Ae(n) ? n : null;
655
655
  }
656
- function mt(e, t = {}) {
657
- let n = nt(e);
658
- return n ? [P(n)] : t.greekNames === !1 ? L(e) : e.split("_").flatMap((e, t) => {
659
- let n = t > 0 ? [P("_")] : [], r = pt(e);
656
+ function pt(e, t = {}) {
657
+ let n = tt(e);
658
+ return n ? [F(n)] : t.greekNames === !1 ? R(e) : e.split("_").flatMap((e, t) => {
659
+ let n = t > 0 ? [F("_")] : [], r = ft(e);
660
660
  return r ? [
661
661
  ...n,
662
- P(r),
663
- ...L(e.slice(r.length))
664
- ] : [...n, ...L(e)];
662
+ F(r),
663
+ ...R(e.slice(r.length))
664
+ ] : [...n, ...R(e)];
665
665
  });
666
666
  }
667
- var ht = (e) => e.map((e) => `${e.atom}.${e.branch}`).join("/");
668
- function gt(e, t, n, r) {
669
- return !!e && ht(e.path) === ht(t) && e.offset >= n && e.offset <= r;
667
+ var mt = (e) => e.map((e) => `${e.atom}.${e.branch}`).join("/");
668
+ function ht(e, t, n, r) {
669
+ return !!e && mt(e.path) === mt(t) && e.offset >= n && e.offset <= r;
670
670
  }
671
- function _t(e, t = {}) {
672
- let n = /* @__PURE__ */ new Map(), r = vt(e.root, [], e, t, n);
671
+ function gt(e, t = {}) {
672
+ let n = /* @__PURE__ */ new Map(), r = _t(e.root, [], e, t, n);
673
673
  return n.size === 0 ? e : {
674
674
  ...e,
675
675
  root: r,
676
- cursor: yt(e.cursor, n),
677
- anchor: e.anchor ? yt(e.anchor, n) : e.anchor
676
+ cursor: vt(e.cursor, n),
677
+ anchor: e.anchor ? vt(e.anchor, n) : e.anchor
678
678
  };
679
679
  }
680
- function vt(e, t, n, r, i) {
681
- let a = ht(t), o = (e, i) => !r.cursorAway && (gt(n.cursor, t, e, i) || gt(n.anchor, t, e, i)), s = [];
682
- for (let t of rt(e)) {
680
+ function _t(e, t, n, r, i) {
681
+ let a = mt(t), o = (e, i) => !r.cursorAway && (ht(n.cursor, t, e, i) || ht(n.anchor, t, e, i)), s = [];
682
+ for (let t of nt(e)) {
683
683
  if (t.functionName || o(t.start, t.end)) continue;
684
- let n = e.slice(t.start, t.end), i = mt(t.name, r), a = i.length === n.length && i.every((e, t) => e.kind === "symbol" && n[t].kind === "symbol" && e.value === n[t].value), c = r.greekNames === !1 && n.some(B);
684
+ let n = e.slice(t.start, t.end), i = pt(t.name, r), a = i.length === n.length && i.every((e, t) => e.kind === "symbol" && n[t].kind === "symbol" && e.value === n[t].value), c = r.greekNames === !1 && n.some(V);
685
685
  !a && !c && s.push({
686
686
  start: t.start,
687
687
  end: t.end,
@@ -691,11 +691,11 @@ function vt(e, t, n, r, i) {
691
691
  let c = e, l = !1, u = e.map((e, a) => {
692
692
  let o = e;
693
693
  for (let [s, c] of k(e)) {
694
- let e = vt(c, [...t, {
694
+ let e = _t(c, [...t, {
695
695
  atom: a,
696
696
  branch: s
697
697
  }], n, r, i);
698
- e !== c && (o = A(o, s, e));
698
+ e !== c && (o = j(o, s, e));
699
699
  }
700
700
  return o !== e && (l = !0), o;
701
701
  });
@@ -708,7 +708,7 @@ function vt(e, t, n, r, i) {
708
708
  count: e.atoms.length
709
709
  }))), d;
710
710
  }
711
- function yt(e, t) {
711
+ function vt(e, t) {
712
712
  let n = (e, t) => {
713
713
  let n = 0;
714
714
  for (let r of t) if (e >= r.end) n += r.end - r.start - r.count;
@@ -717,13 +717,13 @@ function yt(e, t) {
717
717
  return e - n;
718
718
  }, r = [];
719
719
  for (let i = 0; i < e.path.length; i++) {
720
- let a = t.get(ht(e.path.slice(0, i))), o = e.path[i];
720
+ let a = t.get(mt(e.path.slice(0, i))), o = e.path[i];
721
721
  r.push({
722
722
  ...o,
723
723
  atom: a ? n(o.atom, a) : o.atom
724
724
  });
725
725
  }
726
- let i = t.get(ht(e.path));
726
+ let i = t.get(mt(e.path));
727
727
  return {
728
728
  path: r,
729
729
  offset: i ? n(e.offset, i) : e.offset
@@ -731,7 +731,7 @@ function yt(e, t) {
731
731
  }
732
732
  //#endregion
733
733
  //#region src/editor/nameScripts.ts
734
- function bt(e) {
734
+ function yt(e) {
735
735
  let t = e.indexOf("_");
736
736
  if (t <= 0) return null;
737
737
  let n = [], r = t;
@@ -756,7 +756,7 @@ function bt(e) {
756
756
  }
757
757
  //#endregion
758
758
  //#region src/editor/operators.ts
759
- var V = [
759
+ var bt = [
760
760
  {
761
761
  role: "comparison",
762
762
  symbol: "<",
@@ -841,7 +841,7 @@ var V = [
841
841
  "neg"
842
842
  ]
843
843
  }
844
- ], xt = new Map(V.map((e) => [e.symbol, e])), St = new Map(V.map((e) => [e.type, e])), Ct = new Map(V.flatMap((e) => e.commands.map((t) => [t, e]))), wt = (e) => xt.get(e), Tt = (e) => St.get(e), Et = (e) => Ct.get(e), Dt = {
844
+ ], xt = new Map(bt.map((e) => [e.symbol, e])), St = new Map(bt.map((e) => [e.type, e])), Ct = new Map(bt.flatMap((e) => e.commands.map((t) => [t, e]))), wt = (e) => xt.get(e), Tt = (e) => St.get(e), Et = (e) => Ct.get(e), Dt = {
845
845
  "<": "≤",
846
846
  ">": "≥",
847
847
  "¬": "≠"
@@ -878,10 +878,10 @@ var Mt = {
878
878
  "*": "\\cdot",
879
879
  "·": "\\cdot",
880
880
  "×": "\\times",
881
- ...Object.fromEntries(V.filter((e) => e.role === "logic").map((e) => [e.symbol, e.latex]))
881
+ ...Object.fromEntries(bt.filter((e) => e.role === "logic").map((e) => [e.symbol, e.latex]))
882
882
  }, Nt = {
883
883
  "=": "=",
884
- ...Object.fromEntries(V.filter((e) => e.role === "comparison").map((e) => [e.symbol, e.latex]))
884
+ ...Object.fromEntries(bt.filter((e) => e.role === "comparison").map((e) => [e.symbol, e.latex]))
885
885
  }, Pt = { "¬": "\\lnot" }, Ft = {
886
886
  "\\": "\\textbackslash{}",
887
887
  "{": "\\{",
@@ -901,7 +901,7 @@ function H(e, t) {
901
901
  return `\\htmlData{atom=${e}}{${t}}`;
902
902
  }
903
903
  function Lt(e, t) {
904
- return e === "_" ? "\\_" : z.has(e) && t.greekNames !== !1 ? `\\${e}` : `\\mathit{${e}}`;
904
+ return e === "_" ? "\\_" : B.has(e) && t.greekNames !== !1 ? `\\${e}` : `\\mathit{${e}}`;
905
905
  }
906
906
  function Rt(e, t) {
907
907
  let [n] = e;
@@ -915,7 +915,7 @@ function zt(e, t, n) {
915
915
  return `{{${Rt(r(t.base), n)}}${a ? `_{${a}}` : ""}${o ? `^{${o}}` : ""}}`;
916
916
  }
917
917
  function Bt(e, t, n, r) {
918
- return r.typesetNames === !1 || e.functionName || r.cursors?.some((t) => gt(t, n, e.start, e.end)) ? null : bt(t.map((e) => e.value));
918
+ return r.typesetNames === !1 || e.functionName || r.cursors?.some((t) => ht(t, n, e.start, e.end)) ? null : yt(t.map((e) => e.value));
919
919
  }
920
920
  function Vt(e) {
921
921
  return e === "e" || e === "E" ? `\\mathrm{${e}}` : e === "-" || e === "−" ? "{-}" : e === "+" ? "{+}" : e;
@@ -925,17 +925,17 @@ function Ht(e, t, n = {}) {
925
925
  if (t in Nt) return `\\mathrel{${H(e, Nt[t])}}`;
926
926
  if (t === ",") return `\\mathpunct{${H(e, ",")}}`;
927
927
  if (t in Pt) return H(e, Pt[t]);
928
- let r = je(t);
929
- return r ? H(e, r.latex) : /^[0-9.]$/.test(t) || /^[A-Za-z]$/.test(t) ? H(e, t) : z.has(t) && n.greekNames !== !1 ? H(e, `\\${t}`) : /^[A-Za-z]+$/.test(t) ? H(e, `\\mathit{${t}}`) : H(e, `\\text{${Array.from(t).map((e) => Ft[e] ?? e).join("")}}`);
928
+ let r = Ae(t);
929
+ return r ? H(e, r.latex) : /^[0-9.]$/.test(t) || /^[A-Za-z]$/.test(t) ? H(e, t) : B.has(t) && n.greekNames !== !1 ? H(e, `\\${t}`) : /^[A-Za-z]+$/.test(t) ? H(e, `\\mathit{${t}}`) : H(e, `\\text{${Array.from(t).map((e) => Ft[e] ?? e).join("")}}`);
930
930
  }
931
931
  function Ut(e, t = {}) {
932
932
  return Wt(e, [], t);
933
933
  }
934
934
  function Wt(e, t, n) {
935
935
  let r;
936
- if (e.length === 0) r = `\\htmlClass{me-ph${n.activeRow && M(n.activeRow, t) ? " me-ph-active" : ""}}{\\square}`;
936
+ if (e.length === 0) r = `\\htmlClass{me-ph${n.activeRow && N(n.activeRow, t) ? " me-ph-active" : ""}}{\\square}`;
937
937
  else {
938
- let i = [], a = new Map(rt(e).map((e) => [e.start, e])), o = new Map(it(e).filter((e) => e.exponent !== null).map((e) => [e.start, e]));
938
+ let i = [], a = new Map(nt(e).map((e) => [e.start, e])), o = new Map(rt(e).filter((e) => e.exponent !== null).map((e) => [e.start, e]));
939
939
  for (let r = 0; r < e.length; r++) {
940
940
  let s = e[r], c = (e) => [...t, {
941
941
  atom: r,
@@ -971,13 +971,13 @@ function Gt(e, t, n) {
971
971
  switch (e.kind) {
972
972
  case "symbol": return Ht(e.id, e.value, n);
973
973
  case "function": {
974
- let t = Ue(e.name)?.latexName ?? e.name;
974
+ let t = He(e.name)?.latexName ?? e.name;
975
975
  return `\\mathop{${H(e.id, `\\mathrm{${t}}`)}}`;
976
976
  }
977
977
  case "fraction": return H(e.id, `\\frac{${r(e.num, "num")}}{${r(e.den, "den")}}`);
978
978
  case "root": return H(e.id, e.index ? `\\sqrt[${r(e.index, "index")}]{${r(e.body, "body")}}` : `\\sqrt{${r(e.body, "body")}}`);
979
979
  case "group": {
980
- let t = Je(e.open), n = Je(e.close);
980
+ let t = qe(e.open), n = qe(e.close);
981
981
  return H(e.id, `\\left${t}${r(e.body, "body")}\\right${n}`);
982
982
  }
983
983
  case "derivative": return H(e.id, `\\frac{\\mathrm{d}${r(e.expr, "expr")}}{\\mathrm{d}${r(e.variable, "variable")}}`);
@@ -990,7 +990,7 @@ function Gt(e, t, n) {
990
990
  }
991
991
  function Kt(e, t, n) {
992
992
  if (e.length === 0) {
993
- let e = `me-ph me-units-ph${n.activeRow && M(n.activeRow, t) ? " me-ph-active" : ""}`;
993
+ let e = `me-ph me-units-ph${n.activeRow && N(n.activeRow, t) ? " me-ph-active" : ""}`;
994
994
  return `\\htmlData{row=${At(t)}}{\\htmlClass{${e}}{\\text{\\scriptsize units}}}`;
995
995
  }
996
996
  let r = e.map((e, r) => {
@@ -1050,7 +1050,7 @@ function $t(e, t) {
1050
1050
  }
1051
1051
  var en = (e) => e?.kind === "symbol" || e?.kind === "function";
1052
1052
  function tn(e, t, n, r) {
1053
- let i = j(t, n);
1053
+ let i = M(t, n);
1054
1054
  if (!i) return null;
1055
1055
  if (i.length === 0) {
1056
1056
  let t = Qt(e, n), r = t ? Xt(t) : null;
@@ -1090,7 +1090,7 @@ function nn(e, t, n) {
1090
1090
  };
1091
1091
  }
1092
1092
  function rn(e, t, n, r) {
1093
- let i = j(t, n);
1093
+ let i = M(t, n);
1094
1094
  if (!i) return 0;
1095
1095
  let a = 0, o = Infinity;
1096
1096
  for (let s = 0; s <= i.length; s++) {
@@ -1113,7 +1113,7 @@ function on(e, t, n, r) {
1113
1113
  let i = [];
1114
1114
  for (let a of Array.from(e.querySelectorAll("[data-row]"))) {
1115
1115
  let e = jt(a.getAttribute("data-row"));
1116
- if (!e || e.length <= i.length || !j(t, e) || an(a, n, r)) continue;
1116
+ if (!e || e.length <= i.length || !M(t, e) || an(a, n, r)) continue;
1117
1117
  let o = Xt(a);
1118
1118
  o && n >= o.left - 2 && n <= o.right + 2 && r >= o.top - 2 && r <= o.bottom + 2 && (i = e);
1119
1119
  }
@@ -1123,7 +1123,7 @@ function on(e, t, n, r) {
1123
1123
  };
1124
1124
  }
1125
1125
  function sn(e, t, n) {
1126
- let r = j(t, n.path);
1126
+ let r = M(t, n.path);
1127
1127
  return r ? cn(e, r.slice(n.start, n.end).map((e) => e.id)) : null;
1128
1128
  }
1129
1129
  function cn(e, t, n = 2) {
@@ -1198,9 +1198,9 @@ function hn(e) {
1198
1198
  return e.map((e) => {
1199
1199
  let t = {
1200
1200
  ...e,
1201
- id: N()
1201
+ id: P()
1202
1202
  };
1203
- for (let [n, r] of k(e)) t = A(t, n, hn(r));
1203
+ for (let [n, r] of k(e)) t = j(t, n, hn(r));
1204
1204
  return t;
1205
1205
  });
1206
1206
  }
@@ -1209,7 +1209,7 @@ var gn = {
1209
1209
  "*": "\\cdot ",
1210
1210
  "×": "\\times ",
1211
1211
  "−": "-",
1212
- ...Object.fromEntries(V.map((e) => [e.symbol, e.latex.startsWith("\\") ? `${e.latex} ` : e.latex]))
1212
+ ...Object.fromEntries(bt.map((e) => [e.symbol, e.latex.startsWith("\\") ? `${e.latex} ` : e.latex]))
1213
1213
  }, _n = {
1214
1214
  "\\": "\\textbackslash{}",
1215
1215
  "{": "\\{",
@@ -1225,12 +1225,12 @@ var gn = {
1225
1225
  function vn(e, t = {}) {
1226
1226
  if (e in gn) return gn[e];
1227
1227
  if (/^[A-Za-z0-9.+\-=,]$/.test(e)) return e;
1228
- let n = je(e);
1229
- return n ? /[a-z]$/i.test(n.latex) ? `${n.latex} ` : n.latex : z.has(e) && t.greekNames !== !1 ? `\\${e} ` : /^[A-Za-z]+$/.test(e) ? `\\mathit{${e}}` : `\\text{${Array.from(e, (e) => _n[e] ?? e).join("")}}`;
1228
+ let n = Ae(e);
1229
+ return n ? /[a-z]$/i.test(n.latex) ? `${n.latex} ` : n.latex : B.has(e) && t.greekNames !== !1 ? `\\${e} ` : /^[A-Za-z]+$/.test(e) ? `\\mathit{${e}}` : `\\text{${Array.from(e, (e) => _n[e] ?? e).join("")}}`;
1230
1230
  }
1231
1231
  var yn = (e) => e?.kind === "symbol" && (/^[+\-−=,·*×]$/.test(e.value) || wt(e.value) !== void 0);
1232
1232
  function W(e, t = {}) {
1233
- let n = new Map(rt(e).map((e) => [e.start, e])), r = new Map(it(e).filter((e) => e.exponent !== null).map((e) => [e.start, e])), i = "";
1233
+ let n = new Map(nt(e).map((e) => [e.start, e])), r = new Map(rt(e).filter((e) => e.exponent !== null).map((e) => [e.start, e])), i = "";
1234
1234
  for (let a = 0; a < e.length;) {
1235
1235
  let o = r.get(a);
1236
1236
  if (o) {
@@ -1248,38 +1248,38 @@ function W(e, t = {}) {
1248
1248
  return i.trim() || "\\square";
1249
1249
  }
1250
1250
  function bn(e, t, n) {
1251
- if (t) return We(t);
1252
- let r = nt(e);
1251
+ if (t) return Ue(t);
1252
+ let r = tt(e);
1253
1253
  if (r) return vn(r);
1254
1254
  let i = n.typesetNames === !1 ? null : xn(e, n);
1255
1255
  if (i) return i;
1256
1256
  let a = e.split("_");
1257
- return n.greekNames !== !1 && a.some((e) => pt(e)) ? a.map((e) => {
1258
- let t = pt(e);
1257
+ return n.greekNames !== !1 && a.some((e) => ft(e)) ? a.map((e) => {
1258
+ let t = ft(e);
1259
1259
  return t ? `\\${t}${e.slice(t.length) || " "}` : e.length === 1 ? e : `\\mathit{${e}}`;
1260
1260
  }).join("\\_") : e.length === 1 ? e : `\\mathit{${e.replace(/_/g, "\\_")}}`;
1261
1261
  }
1262
1262
  function xn(e, t) {
1263
- let n = mt(e, t).map((e) => e.value), r = bt(n);
1263
+ let n = pt(e, t).map((e) => e.value), r = yt(n);
1264
1264
  if (!r) return null;
1265
1265
  let i = ([e, r]) => Sn(n.slice(e, r), t), a = (e) => r.parts.filter((t) => t.role === e).map((e) => i(e.text)).join(","), o = a("sub"), s = a("sup"), c = `${i(r.base)}${o ? `_{${o}}` : ""}${s ? `^{${s}}` : ""}`;
1266
1266
  return s ? `{${c}}` : c;
1267
1267
  }
1268
1268
  function Sn(e, t) {
1269
1269
  let [n, ...r] = e;
1270
- if (n.length > 1 && z.has(n) && t.greekNames !== !1) return `\\${n}${r.join("")}`;
1270
+ if (n.length > 1 && B.has(n) && t.greekNames !== !1) return `\\${n}${r.join("")}`;
1271
1271
  let i = e.join("");
1272
1272
  return i.length === 1 || /^[0-9]+$/.test(i) ? i : `\\mathit{${i}}`;
1273
1273
  }
1274
1274
  function Cn(e, t, n) {
1275
1275
  switch (e.kind) {
1276
1276
  case "symbol": return vn(e.value, n);
1277
- case "function": return We(e.name);
1277
+ case "function": return Ue(e.name);
1278
1278
  case "fraction": return `\\frac{${W(e.num, n)}}{${W(e.den, n)}}`;
1279
1279
  case "superscript": return `${t && !yn(t) ? "" : "{}"}^{${W(e.sup, n)}}`;
1280
1280
  case "root": return e.index ? `\\sqrt[${W(e.index, n)}]{${W(e.body, n)}}` : `\\sqrt{${W(e.body, n)}}`;
1281
1281
  case "group": {
1282
- let t = Je(e.open), r = Je(e.close), i = (e) => /[a-z]$/.test(e) ? " " : "";
1282
+ let t = qe(e.open), r = qe(e.close), i = (e) => /[a-z]$/.test(e) ? " " : "";
1283
1283
  return `\\left${t}${i(t)}${W(e.body, n)}\\right${r}${i(r)}`;
1284
1284
  }
1285
1285
  case "derivative": return `\\frac{\\mathrm{d}${W(e.expr, n)}}{\\mathrm{d}${W(e.variable, n)}}`;
@@ -1394,7 +1394,7 @@ var Tn = [
1394
1394
  break;
1395
1395
  }
1396
1396
  }
1397
- return this.casesDepth--, De(e.length > 0 ? e : [[[], []]], t);
1397
+ return this.casesDepth--, Ee(e.length > 0 ? e : [[[], []]], t);
1398
1398
  }
1399
1399
  readConditionWord() {
1400
1400
  let e = this.peek();
@@ -1440,42 +1440,42 @@ var Tn = [
1440
1440
  case "|": {
1441
1441
  this.absDepth++;
1442
1442
  let e = this.readUntilChar("|");
1443
- this.absDepth--, t.push(I(e, "|"));
1443
+ this.absDepth--, t.push(L(e, "|"));
1444
1444
  return;
1445
1445
  }
1446
1446
  case ")":
1447
1447
  case "]": return;
1448
1448
  case "^":
1449
- t.push(Ce(this.readScript()));
1449
+ t.push(Se(this.readScript()));
1450
1450
  return;
1451
1451
  case "_":
1452
- t.push(P("_"), ...Mn(this.readScript(), 1));
1452
+ t.push(F("_"), ...Mn(this.readScript(), 1));
1453
1453
  return;
1454
1454
  case "/":
1455
1455
  t.push(this.readInfixFraction(t));
1456
1456
  return;
1457
1457
  case "*":
1458
- t.push(P("·"));
1458
+ t.push(F("·"));
1459
1459
  return;
1460
1460
  case "=": {
1461
1461
  let e = t[t.length - 1], n = e?.kind === "symbol" ? e.value : "", r = Ot(n === "!" ? "¬" : n);
1462
- r ? t[t.length - 1] = P(r) : n !== "=" && t.push(P("="));
1462
+ r ? t[t.length - 1] = F(r) : n !== "=" && t.push(F("="));
1463
1463
  return;
1464
1464
  }
1465
1465
  case "!":
1466
- t.push(P("¬"));
1466
+ t.push(F("¬"));
1467
1467
  return;
1468
1468
  case "&": {
1469
1469
  let e = t[t.length - 1];
1470
- (e?.kind !== "symbol" || e.value !== "∧") && t.push(P("∧"));
1470
+ (e?.kind !== "symbol" || e.value !== "∧") && t.push(F("∧"));
1471
1471
  return;
1472
1472
  }
1473
- default: t.push(P(e === "−" ? "-" : e));
1473
+ default: t.push(F(e === "−" ? "-" : e));
1474
1474
  }
1475
1475
  }
1476
1476
  pushBrackets(e, t, n) {
1477
- let r = n === "(" ? dt(e, e.length) : null;
1478
- r ? e.splice(r.start, e.length - r.start, I(t, r.open)) : e.push(I(t, n === "[" ? "(" : n));
1477
+ let r = n === "(" ? ut(e, e.length) : null;
1478
+ r ? e.splice(r.start, e.length - r.start, L(t, r.open)) : e.push(L(t, n === "[" ? "(" : n));
1479
1479
  }
1480
1480
  readUntilChar(e) {
1481
1481
  let t = this.readRow({ char: e });
@@ -1492,7 +1492,7 @@ var Tn = [
1492
1492
  close: !0,
1493
1493
  right: !0
1494
1494
  }), a = i[0];
1495
- return i.length === 1 && a.kind === "group" && a.open === "(" && (i = a.body), Se(n, i);
1495
+ return i.length === 1 && a.kind === "group" && a.open === "(" && (i = a.body), xe(n, i);
1496
1496
  }
1497
1497
  readScript() {
1498
1498
  let e = this.peek();
@@ -1500,7 +1500,7 @@ var Tn = [
1500
1500
  if (e.kind === "char" && /[0-9]/.test(e.value)) {
1501
1501
  let e = "";
1502
1502
  for (; this.peek()?.kind === "char" && /[0-9.]/.test(this.peek().value);) e += this.next().value;
1503
- return Array.from(e, (e) => P(e));
1503
+ return Array.from(e, (e) => F(e));
1504
1504
  }
1505
1505
  return this.readArgument();
1506
1506
  }
@@ -1538,7 +1538,7 @@ var Tn = [
1538
1538
  if (On.has(e)) return;
1539
1539
  let r = Et(e);
1540
1540
  if (r) {
1541
- t.push(P(r.symbol));
1541
+ t.push(F(r.symbol));
1542
1542
  return;
1543
1543
  }
1544
1544
  switch (e) {
@@ -1554,12 +1554,12 @@ var Tn = [
1554
1554
  case "dfrac":
1555
1555
  case "tfrac": {
1556
1556
  let e = this.readArgument(), n = this.readArgument(), r = (e) => e[0] !== void 0 && this.uprightD.has(e[0]);
1557
- t.push(r(e) && r(n) ? Te(e.slice(1), n.slice(1)) : Se(e, n));
1557
+ t.push(r(e) && r(n) ? we(e.slice(1), n.slice(1)) : xe(e, n));
1558
1558
  return;
1559
1559
  }
1560
1560
  case "sqrt": {
1561
1561
  let e = null;
1562
- this.peek()?.kind === "char" && this.peek().value === "[" && (this.next(), e = this.readUntilChar("]")), t.push(we(this.readArgument(), e));
1562
+ this.peek()?.kind === "char" && this.peek().value === "[" && (this.next(), e = this.readUntilChar("]")), t.push(Ce(this.readArgument(), e));
1563
1563
  return;
1564
1564
  }
1565
1565
  case "left": {
@@ -1572,7 +1572,7 @@ var Tn = [
1572
1572
  case "lfloor":
1573
1573
  case "lceil": {
1574
1574
  let n = this.readRow({ command: e === "lfloor" ? "rfloor" : "rceil" });
1575
- this.next(), t.push(I(n, e === "lfloor" ? "⌊" : "⌈"));
1575
+ this.next(), t.push(L(n, e === "lfloor" ? "⌊" : "⌈"));
1576
1576
  return;
1577
1577
  }
1578
1578
  case "rfloor":
@@ -1580,17 +1580,17 @@ var Tn = [
1580
1580
  case "right": return;
1581
1581
  case "cdot":
1582
1582
  case "ast":
1583
- t.push(P("·"));
1583
+ t.push(F("·"));
1584
1584
  return;
1585
1585
  case "times":
1586
- t.push(P("×"));
1586
+ t.push(F("×"));
1587
1587
  return;
1588
1588
  case "square":
1589
1589
  case "Box": return;
1590
1590
  case "{":
1591
1591
  case "}":
1592
1592
  case "|":
1593
- t.push(P(e));
1593
+ t.push(F(e));
1594
1594
  return;
1595
1595
  case "mathrm":
1596
1596
  case "operatorname":
@@ -1603,61 +1603,61 @@ var Tn = [
1603
1603
  return;
1604
1604
  }
1605
1605
  }
1606
- let i = Xe(e);
1606
+ let i = Ye(e);
1607
1607
  if (i) {
1608
- t.push(F(i));
1608
+ t.push(I(i));
1609
1609
  return;
1610
1610
  }
1611
- let a = Fe(e);
1612
- t.push(P(a ?? e));
1611
+ let a = Pe(e);
1612
+ t.push(F(a ?? e));
1613
1613
  }
1614
1614
  readNamed(e, t, n) {
1615
1615
  if (!t) return;
1616
1616
  if (e === "mathrm" && (t === "E" || t === "e" && this.peek()?.kind === "open")) {
1617
- n.push(P(t));
1617
+ n.push(F(t));
1618
1618
  return;
1619
1619
  }
1620
- let r = e === "mathrm" ? Ie(t) : void 0;
1620
+ let r = e === "mathrm" ? Fe(t) : void 0;
1621
1621
  if (r) {
1622
- n.push(P(r));
1622
+ n.push(F(r));
1623
1623
  return;
1624
1624
  }
1625
1625
  if (e === "mathrm" && t === "d") {
1626
- let e = P("d");
1626
+ let e = F("d");
1627
1627
  this.uprightD.add(e), n.push(e);
1628
1628
  return;
1629
1629
  }
1630
1630
  if (e === "operatorname" || e === "mathrm") {
1631
- n.push(F(Xe(t) ?? t));
1631
+ n.push(I(Ye(t) ?? t));
1632
1632
  return;
1633
1633
  }
1634
1634
  if (e === "text" || e === "textrm") {
1635
- n.push(...Array.from(t, (e) => P(e)));
1635
+ n.push(...Array.from(t, (e) => F(e)));
1636
1636
  return;
1637
1637
  }
1638
- n.push(...Array.from(t, (e) => P(e)));
1638
+ n.push(...Array.from(t, (e) => F(e)));
1639
1639
  }
1640
1640
  };
1641
1641
  function jn(e) {
1642
- let t = it(e);
1642
+ let t = rt(e);
1643
1643
  return t.length > 0 && t[t.length - 1].end === e.length;
1644
1644
  }
1645
1645
  function Mn(e, t) {
1646
- return e.flatMap((e) => e.kind === "symbol" && e.value === "," ? Array.from({ length: t }, () => P("_")) : [e]);
1646
+ return e.flatMap((e) => e.kind === "symbol" && e.value === "," ? Array.from({ length: t }, () => F("_")) : [e]);
1647
1647
  }
1648
1648
  function Nn(e) {
1649
1649
  let t = e[e.length - 1];
1650
1650
  if (t?.kind !== "superscript" || e.length < 2) return e;
1651
1651
  let n = [
1652
1652
  ...e.slice(0, -1),
1653
- P("_"),
1654
- P("_"),
1653
+ F("_"),
1654
+ F("_"),
1655
1655
  ...Mn(t.sup, 2)
1656
- ], r = rt(n);
1657
- return r.length !== 1 || r[0].start !== 0 || r[0].end !== n.length || r[0].functionName ? e : bt(n.map((e) => e.value))?.parts.filter((e) => e.role === "sup").every((e) => $e(n[e.text[0]])) ? n : e;
1656
+ ], r = nt(n);
1657
+ return r.length !== 1 || r[0].start !== 0 || r[0].end !== n.length || r[0].functionName ? e : yt(n.map((e) => e.value))?.parts.filter((e) => e.role === "sup").every((e) => Qe(n[e.text[0]])) ? n : e;
1658
1658
  }
1659
1659
  function Pn(e) {
1660
- return Ee(Array.from(e.trim(), (e) => P(e)));
1660
+ return Te(Array.from(e.trim(), (e) => F(e)));
1661
1661
  }
1662
1662
  function Fn(e) {
1663
1663
  return new An(wn(e)).readAll();
@@ -1683,7 +1683,7 @@ function Vn(e, t) {
1683
1683
  if (!(Bn(t) || t === "." || t === "e" || t === "E" || r)) break;
1684
1684
  n--;
1685
1685
  }
1686
- return n > 0 && et(e[n - 1]) ? null : e.slice(n, t).map((e) => zn(e)).join("");
1686
+ return n > 0 && $e(e[n - 1]) ? null : e.slice(n, t).map((e) => zn(e)).join("");
1687
1687
  }
1688
1688
  var Hn = /^(\d+\.?\d*|\.\d*)([eE][+-]?\d*)?$/;
1689
1689
  function Un(e, t) {
@@ -1695,7 +1695,7 @@ function Wn(e, t, n) {
1695
1695
  return r !== null && Hn.test(r + n);
1696
1696
  }
1697
1697
  function Gn(e, t) {
1698
- let n = j(e, t.path);
1698
+ let n = M(e, t.path);
1699
1699
  return n && In(n[t.offset]) ? {
1700
1700
  ...t,
1701
1701
  offset: t.offset + 1
@@ -1727,7 +1727,7 @@ function Jn(e, t, n, r) {
1727
1727
  atom: c,
1728
1728
  branch: e
1729
1729
  }], n, r);
1730
- a !== i && (l = A(l, e, a));
1730
+ a !== i && (l = j(l, e, a));
1731
1731
  }
1732
1732
  return l !== s && (o = !0), [l];
1733
1733
  });
@@ -1764,7 +1764,7 @@ function Zn(e) {
1764
1764
  };
1765
1765
  }
1766
1766
  function Qn(e, t) {
1767
- return e.offset === t.offset && M(e.path, t.path);
1767
+ return e.offset === t.offset && N(e.path, t.path);
1768
1768
  }
1769
1769
  function $n(e) {
1770
1770
  return `${e.path.map((e) => `${e.atom}.${e.branch}`).join(" › ") || "root"} @ ${e.offset}`;
@@ -1783,7 +1783,7 @@ function er(e) {
1783
1783
  }
1784
1784
  function tr(e, t) {
1785
1785
  if (t.length === 0) return null;
1786
- let n = t.slice(0, -1), r = j(e, n), { atom: i, branch: a } = t[t.length - 1];
1786
+ let n = t.slice(0, -1), r = M(e, n), { atom: i, branch: a } = t[t.length - 1];
1787
1787
  if (!r || !r[i]) throw Error("Cursor path does not resolve");
1788
1788
  return {
1789
1789
  rowPath: n,
@@ -1794,7 +1794,7 @@ function tr(e, t) {
1794
1794
  };
1795
1795
  }
1796
1796
  function nr(e, t) {
1797
- let n = j(e, t);
1797
+ let n = M(e, t);
1798
1798
  if (!n) throw Error("Cursor path does not resolve");
1799
1799
  return n;
1800
1800
  }
@@ -1881,7 +1881,7 @@ var ar = {
1881
1881
  };
1882
1882
  function or(e, t) {
1883
1883
  if (e.kind !== "piecewise") return ar[e.kind] ?? null;
1884
- let n = ye(t);
1884
+ let n = A(t);
1885
1885
  if (!n) return null;
1886
1886
  let r = n.part === "otherwise" ? "value" : n.part, i = e.pieces.map((e, t) => `${r}${t}`);
1887
1887
  return e.otherwise ? [...i, "otherwise"] : i;
@@ -1926,7 +1926,7 @@ function G(e) {
1926
1926
  }
1927
1927
  function dr(e) {
1928
1928
  let t = G(e);
1929
- return t ? j(e.root, t.path).slice(t.start, t.end) : [];
1929
+ return t ? M(e.root, t.path).slice(t.start, t.end) : [];
1930
1930
  }
1931
1931
  function fr(e) {
1932
1932
  return `${e.path.map((e) => `${e.atom}.${e.branch}`).join(" › ") || "root"} ${e.start}–${e.end}`;
@@ -1944,7 +1944,7 @@ function pr(e, t, n) {
1944
1944
  };
1945
1945
  }
1946
1946
  function mr(e, t) {
1947
- let n = e.anchor ?? e.cursor, { path: r, offset: i } = e.cursor, a = j(e.root, r), o;
1947
+ let n = e.anchor ?? e.cursor, { path: r, offset: i } = e.cursor, a = M(e.root, r), o;
1948
1948
  if (t === "forward" ? i < a.length : i > 0) {
1949
1949
  let e = i + (t === "forward" ? 1 : -1);
1950
1950
  t === "backward" && In(a[i - 1]) && (e = Math.max(0, i - 2)), t === "forward" && In(a[e]) && e++, o = {
@@ -2010,16 +2010,16 @@ function xr() {
2010
2010
  };
2011
2011
  }
2012
2012
  function K(e, t) {
2013
- let n = j(e, t);
2013
+ let n = M(e, t);
2014
2014
  if (!n) throw Error("Cursor path does not resolve");
2015
2015
  return n;
2016
2016
  }
2017
2017
  function Sr(e, t, n) {
2018
2018
  if (t.length === 0) return n(e);
2019
- let [r, ...i] = t, a = e[r.atom], o = be(a, r.branch);
2019
+ let [r, ...i] = t, a = e[r.atom], o = ye(a, r.branch);
2020
2020
  if (!o) throw Error("Cursor path does not resolve");
2021
2021
  let s = e.slice();
2022
- return s[r.atom] = A(a, r.branch, Sr(o, i, n)), s;
2022
+ return s[r.atom] = j(a, r.branch, Sr(o, i, n)), s;
2023
2023
  }
2024
2024
  function q(e, t, n, r, i, a) {
2025
2025
  return {
@@ -2091,7 +2091,7 @@ var Ar = (e, t) => [...e.rowPath, {
2091
2091
  }], jr = (e) => e.value.length === 0 && e.condition.length === 0, Mr = (e) => {
2092
2092
  let t = kr(e);
2093
2093
  if (!t) return e;
2094
- let n = ye(t.branch), { pieces: r } = t.atom, i = n.part === "otherwise" ? r.length : n.piece + 1, a = {
2094
+ let n = A(t.branch), { pieces: r } = t.atom, i = n.part === "otherwise" ? r.length : n.piece + 1, a = {
2095
2095
  ...t.atom,
2096
2096
  pieces: [
2097
2097
  ...r.slice(0, i),
@@ -2117,7 +2117,7 @@ var Ar = (e, t) => [...e.rowPath, {
2117
2117
  offset: t.atom.otherwise.length
2118
2118
  }
2119
2119
  };
2120
- let r = L("0.0");
2120
+ let r = R("0.0");
2121
2121
  return {
2122
2122
  ...q(e, t.rowPath, t.index, 1, [{
2123
2123
  ...t.atom,
@@ -2133,7 +2133,7 @@ var Ar = (e, t) => [...e.rowPath, {
2133
2133
  };
2134
2134
  };
2135
2135
  function Pr(e, t) {
2136
- let n = ye(t.branch), { pieces: r, otherwise: i } = t.atom;
2136
+ let n = A(t.branch), { pieces: r, otherwise: i } = t.atom;
2137
2137
  if (n.part === "otherwise") {
2138
2138
  if (!i || i.length > 0) return null;
2139
2139
  let n = r.length - 1;
@@ -2159,7 +2159,7 @@ function Pr(e, t) {
2159
2159
  return q(e, t.rowPath, t.index, 1, [a], o);
2160
2160
  }
2161
2161
  function Fr(e, t) {
2162
- let n = ye(t.branch), { pieces: r, otherwise: i } = t.atom;
2162
+ let n = A(t.branch), { pieces: r, otherwise: i } = t.atom;
2163
2163
  if (n.part === "otherwise") return !i || i.length > 0 ? null : q(e, t.rowPath, t.index, 1, [{
2164
2164
  ...t.atom,
2165
2165
  otherwise: null
@@ -2224,7 +2224,7 @@ function Rr(e, t, n) {
2224
2224
  };
2225
2225
  }
2226
2226
  function zr(e) {
2227
- return Ue(e)?.latexName ?? e;
2227
+ return He(e)?.latexName ?? e;
2228
2228
  }
2229
2229
  function Br(e) {
2230
2230
  return (t) => {
@@ -2240,7 +2240,7 @@ function Br(e) {
2240
2240
  function J(e) {
2241
2241
  return (t) => {
2242
2242
  let n = Ir(t), { path: r, offset: i } = n.cursor;
2243
- return q(n, r, i, 0, [P(e)], {
2243
+ return q(n, r, i, 0, [F(e)], {
2244
2244
  path: r,
2245
2245
  offset: i + 1
2246
2246
  });
@@ -2252,7 +2252,7 @@ var Vr = (e) => {
2252
2252
  if (i) return q({
2253
2253
  root: e.root,
2254
2254
  cursor: e.cursor
2255
- }, t, n - 1, 1, [P(i)], {
2255
+ }, t, n - 1, 1, [F(i)], {
2256
2256
  path: t,
2257
2257
  offset: n
2258
2258
  });
@@ -2261,7 +2261,7 @@ var Vr = (e) => {
2261
2261
  }, Hr = (e) => {
2262
2262
  let t = G(e);
2263
2263
  if (t) {
2264
- let { path: n, start: r, end: i } = t, a = De([[K(e.root, n).slice(r, i), []]], L("0.0"));
2264
+ let { path: n, start: r, end: i } = t, a = Ee([[K(e.root, n).slice(r, i), []]], R("0.0"));
2265
2265
  return q(e, n, r, i - r, [a], {
2266
2266
  path: [...n, {
2267
2267
  atom: r,
@@ -2270,7 +2270,7 @@ var Vr = (e) => {
2270
2270
  offset: 0
2271
2271
  });
2272
2272
  }
2273
- return Ur(De([[[], []]], L("0.0")), "value0")(e);
2273
+ return Ur(Ee([[[], []]], R("0.0")), "value0")(e);
2274
2274
  };
2275
2275
  function Ur(e, t) {
2276
2276
  return (n) => {
@@ -2284,12 +2284,12 @@ function Ur(e, t) {
2284
2284
  });
2285
2285
  };
2286
2286
  }
2287
- var Wr = Rr((e) => Se(Lr(e), []), "den", "num"), Gr = (e) => {
2287
+ var Wr = Rr((e) => xe(Lr(e), []), "den", "num"), Gr = (e) => {
2288
2288
  if (G(e)) return Wr(e);
2289
2289
  let t = Ir(e), { path: n, offset: r } = t.cursor, i = K(t.root, n), a = r;
2290
2290
  for (; a > 0 && !wr(i[a - 1]);) a--;
2291
2291
  let o = Lr(i.slice(a, r)), s = o.length > 0 ? "den" : "num";
2292
- return q(t, n, a, r - a, [Se(o, [])], {
2292
+ return q(t, n, a, r - a, [xe(o, [])], {
2293
2293
  path: [...n, {
2294
2294
  atom: a,
2295
2295
  branch: s
@@ -2299,8 +2299,8 @@ var Wr = Rr((e) => Se(Lr(e), []), "den", "num"), Gr = (e) => {
2299
2299
  }, Kr = (e) => {
2300
2300
  let t = G(e);
2301
2301
  if (t) {
2302
- let { path: n, start: r, end: i } = t, a = K(e.root, n).slice(r, i), o = a.length === 1 ? a : [I(a, "(")];
2303
- return q(e, n, r, i - r, [...o, Ce()], {
2302
+ let { path: n, start: r, end: i } = t, a = K(e.root, n).slice(r, i), o = a.length === 1 ? a : [L(a, "(")];
2303
+ return q(e, n, r, i - r, [...o, Se()], {
2304
2304
  path: [...n, {
2305
2305
  atom: r + o.length,
2306
2306
  branch: "sup"
@@ -2327,7 +2327,7 @@ var Wr = Rr((e) => Se(Lr(e), []), "den", "num"), Gr = (e) => {
2327
2327
  }],
2328
2328
  offset: s.sup.length
2329
2329
  }
2330
- } : Tr(s) ? Ur(Ce(), "sup")(n) : e;
2330
+ } : Tr(s) ? Ur(Se(), "sup")(n) : e;
2331
2331
  };
2332
2332
  function qr(e, t) {
2333
2333
  for (let n = e.cursor.path.length; n > 0; n--) {
@@ -2358,10 +2358,10 @@ function Jr(e) {
2358
2358
  return q(n, i.rowPath, i.index, 1, [l, ...s.slice(c)], o);
2359
2359
  };
2360
2360
  }
2361
- var Yr = (e) => Rr((t) => I(t, e), "after", "body"), Xr = (e) => {
2361
+ var Yr = (e) => Rr((t) => L(t, e), "after", "body"), Xr = (e) => {
2362
2362
  if (!G(e)) {
2363
- let { path: t, offset: n } = e.cursor, r = dt(K(e.root, t), n);
2364
- if (r) return q(e, t, r.start, n - r.start, [I([], r.open)], {
2363
+ let { path: t, offset: n } = e.cursor, r = ut(K(e.root, t), n);
2364
+ if (r) return q(e, t, r.start, n - r.start, [L([], r.open)], {
2365
2365
  path: [...t, {
2366
2366
  atom: r.start,
2367
2367
  branch: "body"
@@ -2391,12 +2391,12 @@ var Yr = (e) => Rr((t) => I(t, e), "after", "body"), Xr = (e) => {
2391
2391
  };
2392
2392
  }
2393
2393
  let i = Ir(e), a = i.cursor.offset;
2394
- return it(K(i.root, i.cursor.path).slice(0, a)).find((e) => e.end === a) ? Ur(Ee(), "units")(i) : e;
2394
+ return rt(K(i.root, i.cursor.path).slice(0, a)).find((e) => e.end === a) ? Ur(Te(), "units")(i) : e;
2395
2395
  };
2396
2396
  function Qr(e) {
2397
2397
  return (t) => {
2398
2398
  let { path: n, offset: r } = t.cursor, i = K(t.root, n);
2399
- return !G(t) && In(i[r - 1]) && Wn(i, r - 1, e) ? q(t, n, r - 1, 0, [P(e)], {
2399
+ return !G(t) && In(i[r - 1]) && Wn(i, r - 1, e) ? q(t, n, r - 1, 0, [F(e)], {
2400
2400
  path: n,
2401
2401
  offset: r + 1
2402
2402
  }) : J(e)(t);
@@ -2422,7 +2422,7 @@ var $r = (e) => {
2422
2422
  ]), ri = (e) => {
2423
2423
  if (G(e)) return di(e);
2424
2424
  let t = Dr(e);
2425
- return t?.atom.kind === "group" && t.atom.open === "|" ? Jr(["|"])(e) : Ur(I([], "|"), "body")(e);
2425
+ return t?.atom.kind === "group" && t.atom.open === "|" ? Jr(["|"])(e) : Ur(L([], "|"), "body")(e);
2426
2426
  }, ii = (e) => {
2427
2427
  if (G(e)) return vr(e, "end");
2428
2428
  let t = Dr(e);
@@ -2453,7 +2453,7 @@ var $r = (e) => {
2453
2453
  offset: a
2454
2454
  });
2455
2455
  if (i.kind === "function") {
2456
- let n = L(zr(i.name).slice(0, -1));
2456
+ let n = R(zr(i.name).slice(0, -1));
2457
2457
  return q(e, t, a, 1, n, {
2458
2458
  path: t,
2459
2459
  offset: a + n.length
@@ -2509,7 +2509,7 @@ var $r = (e) => {
2509
2509
  path: t,
2510
2510
  offset: n
2511
2511
  });
2512
- if (i.kind === "function") return q(e, t, n, 1, L(zr(i.name).slice(1)), {
2512
+ if (i.kind === "function") return q(e, t, n, 1, R(zr(i.name).slice(1)), {
2513
2513
  path: t,
2514
2514
  offset: n
2515
2515
  });
@@ -2571,13 +2571,13 @@ function ci(e) {
2571
2571
  let n = G(t);
2572
2572
  if (n) {
2573
2573
  let { path: r, start: i, end: a } = n, o = K(t.root, r).slice(i, a);
2574
- return q(t, r, i, a - i, [F(e), I(o, "(")], {
2574
+ return q(t, r, i, a - i, [I(e), L(o, "(")], {
2575
2575
  path: r,
2576
2576
  offset: i + 2
2577
2577
  });
2578
2578
  }
2579
2579
  let r = Ir(t), { path: i, offset: a } = r.cursor;
2580
- return q(r, i, a, 0, [F(e), I([], "(")], {
2580
+ return q(r, i, a, 0, [I(e), L([], "(")], {
2581
2581
  path: [...i, {
2582
2582
  atom: a + 1,
2583
2583
  branch: "body"
@@ -2586,7 +2586,7 @@ function ci(e) {
2586
2586
  });
2587
2587
  };
2588
2588
  }
2589
- var li = Rr((e) => we(e), "after", "body"), ui = Rr((e) => we(e, []), "index", "index"), di = Rr((e) => I(e, "|"), "after", "body"), fi = Rr((e) => Te(e, []), "variable", "expr"), pi = [
2589
+ var li = Rr((e) => Ce(e), "after", "body"), ui = Rr((e) => Ce(e, []), "index", "index"), di = Rr((e) => L(e, "|"), "after", "body"), fi = Rr((e) => we(e, []), "variable", "expr"), pi = [
2590
2590
  {
2591
2591
  names: ["frac", "fraction"],
2592
2592
  title: "Fraction",
@@ -2667,10 +2667,10 @@ function hi(e) {
2667
2667
  if (t) return t.command;
2668
2668
  let n = Et(e);
2669
2669
  if (n) return J(n.symbol);
2670
- let r = Me(e);
2670
+ let r = je(e);
2671
2671
  if (r) return J(r.symbol);
2672
- let i = Xe(e);
2673
- return i ? ci(i) : Br(z.has(e) ? [P(e)] : L(e));
2672
+ let i = Ye(e);
2673
+ return i ? ci(i) : Br(B.has(e) ? [F(e)] : R(e));
2674
2674
  }
2675
2675
  var gi = {
2676
2676
  Less: "Less than",
@@ -2692,26 +2692,26 @@ var gi = {
2692
2692
  }, vi = (() => {
2693
2693
  let e = [
2694
2694
  ...pi,
2695
- ...V.map((e) => ({
2695
+ ...bt.map((e) => ({
2696
2696
  names: e.commands,
2697
2697
  title: gi[e.type],
2698
2698
  latex: e.latex
2699
2699
  })),
2700
- ...Oe.map((e) => ({
2700
+ ...De.map((e) => ({
2701
2701
  names: e.commands,
2702
2702
  title: _i[e.symbol] ?? e.symbol,
2703
2703
  latex: e.latex
2704
2704
  })),
2705
- ...Object.values(He).map((e) => ({
2705
+ ...Object.values(Ve).map((e) => ({
2706
2706
  names: [
2707
2707
  e.name,
2708
2708
  e.latexName,
2709
2709
  ...e.aliases ?? []
2710
2710
  ],
2711
2711
  title: "Function",
2712
- latex: We(e.name)
2712
+ latex: Ue(e.name)
2713
2713
  })),
2714
- ...[...z].map((e) => ({
2714
+ ...[...B].map((e) => ({
2715
2715
  names: [e],
2716
2716
  title: "Greek letter",
2717
2717
  latex: `\\${e}`
@@ -2887,7 +2887,7 @@ var ji = (e) => Array.from(e.children), Y = {
2887
2887
  symbol: "∧",
2888
2888
  level: Y.And
2889
2889
  }
2890
- }, Ni = new Map(V.filter((e) => e.role === "comparison").map((e) => [e.mathml, e.symbol])), Pi = new Map(Oe.map((e) => [e.mathml, e.symbol])), Fi = new Map(Object.values(He).map((e) => [e.mathMlTag, e.name])), Ii = /^[A-Za-z_][A-Za-z0-9_]*$/, Li = class {
2890
+ }, Ni = new Map(bt.filter((e) => e.role === "comparison").map((e) => [e.mathml, e.symbol])), Pi = new Map(De.map((e) => [e.mathml, e.symbol])), Fi = new Map(Object.values(Ve).map((e) => [e.mathMlTag, e.name])), Ii = /^[A-Za-z_][A-Za-z0-9_]*$/, Li = class {
2891
2891
  problems;
2892
2892
  constructor(e) {
2893
2893
  this.problems = e;
@@ -2900,7 +2900,7 @@ var ji = (e) => Array.from(e.children), Y = {
2900
2900
  case "piecewise": return this.piecewise(e);
2901
2901
  default: {
2902
2902
  let t = Pi.get(e.localName);
2903
- return t ? X([P(t)]) : this.unsupported(`<${e.localName}>`);
2903
+ return t ? X([F(t)]) : this.unsupported(`<${e.localName}>`);
2904
2904
  }
2905
2905
  }
2906
2906
  }
@@ -2909,7 +2909,7 @@ var ji = (e) => Array.from(e.children), Y = {
2909
2909
  }
2910
2910
  identifier(e) {
2911
2911
  let t = (e.textContent ?? "").trim();
2912
- return t === "_" ? X([]) : Ii.test(t) ? (Xe(t) ? this.problems.add(`The variable ${t} has the name of a function, so it reads as one here`) : nt(t) && this.problems.add(`The variable ${t} has a reserved name, so it reads as the constant here`), X(mt(t))) : (this.problems.add(`"${t}" isn't a CellML variable name`), X(L(t)));
2912
+ return t === "_" ? X([]) : Ii.test(t) ? (Ye(t) ? this.problems.add(`The variable ${t} has the name of a function, so it reads as one here`) : tt(t) && this.problems.add(`The variable ${t} has a reserved name, so it reads as the constant here`), X(pt(t))) : (this.problems.add(`"${t}" isn't a CellML variable name`), X(R(t)));
2913
2913
  }
2914
2914
  number(e) {
2915
2915
  let t = Hi(e), n;
@@ -2919,9 +2919,9 @@ var ji = (e) => Array.from(e.children), Y = {
2919
2919
  } else n = (e.textContent ?? "").trim();
2920
2920
  let r = n.startsWith("-"), i = r ? n.slice(1) : n.replace(/^\+/, "");
2921
2921
  /^(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(i) || this.problems.add(`"${n}" isn't a number`);
2922
- let a = L(i);
2923
- return t && t !== "dimensionless" && (Ii.test(t) || this.problems.add(`"${t}" isn't a units name`), a.push(Ee(L(t)))), r ? {
2924
- row: [P("-"), ...a],
2922
+ let a = R(i);
2923
+ return t && t !== "dimensionless" && (Ii.test(t) || this.problems.add(`"${t}" isn't a units name`), a.push(Te(R(t)))), r ? {
2924
+ row: [F("-"), ...a],
2925
2925
  level: Y.Unary
2926
2926
  } : X(a);
2927
2927
  }
@@ -2936,7 +2936,7 @@ var ji = (e) => Array.from(e.children), Y = {
2936
2936
  return {
2937
2937
  row: [
2938
2938
  ...Bi(e, Y.Additive),
2939
- P(n),
2939
+ F(n),
2940
2940
  ...Bi(t, Y.Additive)
2941
2941
  ],
2942
2942
  level: Y.Comparison
@@ -2953,7 +2953,7 @@ var ji = (e) => Array.from(e.children), Y = {
2953
2953
  case "not": {
2954
2954
  let [e] = a();
2955
2955
  return e ? {
2956
- row: [P("¬"), ...Bi(e, Y.Not)],
2956
+ row: [F("¬"), ...Bi(e, Y.Not)],
2957
2957
  level: Y.Not
2958
2958
  } : this.unsupported("<not> without an operand");
2959
2959
  }
@@ -2964,7 +2964,7 @@ var ji = (e) => Array.from(e.children), Y = {
2964
2964
  case "minus": {
2965
2965
  let e = a();
2966
2966
  if (e.length === 1) return {
2967
- row: [P("-"), ...Bi(e[0], Y.Term)],
2967
+ row: [F("-"), ...Bi(e[0], Y.Term)],
2968
2968
  level: Y.Unary
2969
2969
  };
2970
2970
  if (e.length !== 2) return this.unsupported("<minus> with more than two operands");
@@ -2972,7 +2972,7 @@ var ji = (e) => Array.from(e.children), Y = {
2972
2972
  return {
2973
2973
  row: [
2974
2974
  ...Bi(t, Y.Additive),
2975
- P("-"),
2975
+ F("-"),
2976
2976
  ...Bi(n, Y.Term)
2977
2977
  ],
2978
2978
  level: Y.Additive
@@ -2984,21 +2984,21 @@ var ji = (e) => Array.from(e.children), Y = {
2984
2984
  };
2985
2985
  case "divide": {
2986
2986
  let [e, t] = a();
2987
- return !e || !t ? this.unsupported("<divide> without two operands") : X([Se(e.row, t.row)]);
2987
+ return !e || !t ? this.unsupported("<divide> without two operands") : X([xe(e.row, t.row)]);
2988
2988
  }
2989
2989
  case "power": {
2990
2990
  let [e, t] = a();
2991
- return !e || !t ? this.unsupported("<power> without two operands") : X([...Bi(e, Y.Primary), Ce(t.row)]);
2991
+ return !e || !t ? this.unsupported("<power> without two operands") : X([...Bi(e, Y.Primary), Se(t.row)]);
2992
2992
  }
2993
2993
  case "root": {
2994
2994
  let [e] = a();
2995
2995
  if (!e) return this.unsupported("<root> without an operand");
2996
2996
  let t = zi(r, "degree"), n = t ? this.inner(t) : null;
2997
- return X([we(e.row, n)]);
2997
+ return X([Ce(e.row, n)]);
2998
2998
  }
2999
2999
  case "abs": {
3000
3000
  let [e] = a();
3001
- return e ? X([I(e.row, "|")]) : this.unsupported("<abs> without an operand");
3001
+ return e ? X([L(e.row, "|")]) : this.unsupported("<abs> without an operand");
3002
3002
  }
3003
3003
  case "diff": return this.derivative(r, i);
3004
3004
  default: return this.functionCall(o, r, a());
@@ -3008,19 +3008,19 @@ var ji = (e) => Array.from(e.children), Y = {
3008
3008
  let r = Fi.get(e);
3009
3009
  if (!r) return this.unsupported(`<${e}>`);
3010
3010
  if (n.length === 0) return this.unsupported(`<${e}> without an operand`);
3011
- let i = Ke(r);
3012
- if (i && n.length === 1) return X([I(n[0].row, i.open, i.close)]);
3011
+ let i = Ge(r);
3012
+ if (i && n.length === 1) return X([L(n[0].row, i.open, i.close)]);
3013
3013
  let a = e === "log" ? zi(t, "logbase") : void 0, o = (a ? [n[0], {
3014
3014
  row: this.inner(a),
3015
3015
  level: Y.Primary
3016
- }] : n).flatMap((e, t) => t === 0 ? e.row : [P(","), ...e.row]);
3017
- return X([F(r), I(o)]);
3016
+ }] : n).flatMap((e, t) => t === 0 ? e.row : [F(","), ...e.row]);
3017
+ return X([I(r), L(o)]);
3018
3018
  }
3019
3019
  derivative(e, t) {
3020
3020
  let n = zi(e, "bvar"), [r] = t;
3021
3021
  if (!n || !r) return this.unsupported("<diff> without <bvar> and an operand");
3022
3022
  let i = ji(n).find((e) => e.localName === "ci"), a = ji(n).find((e) => e.localName === "degree");
3023
- return a && (a.textContent ?? "").trim() !== "1" ? this.unsupported("A derivative of order other than 1") : i ? X([Te(this.expression(r).row, this.expression(i).row)]) : this.unsupported("<bvar> without a <ci>");
3023
+ return a && (a.textContent ?? "").trim() !== "1" ? this.unsupported("A derivative of order other than 1") : i ? X([we(this.expression(r).row, this.expression(i).row)]) : this.unsupported("<bvar> without a <ci>");
3024
3024
  }
3025
3025
  piecewise(e) {
3026
3026
  let t = [], n = null, r = (e) => e ? this.expression(e).row : [];
@@ -3028,7 +3028,7 @@ var ji = (e) => Array.from(e.children), Y = {
3028
3028
  let [e, a] = ji(i);
3029
3029
  i.localName === "piece" ? ((!e || !a) && this.problems.add("A <piece> without a value and a condition"), t.push([r(e), r(a)])) : i.localName === "otherwise" ? (e || this.problems.add("An <otherwise> without a value"), n = r(e)) : this.problems.add(`<${i.localName}> in <piecewise> isn't supported; it was left out`);
3030
3030
  }
3031
- return t.length === 0 ? this.unsupported("A <piecewise> without a <piece>") : X([De(t, n)]);
3031
+ return t.length === 0 ? this.unsupported("A <piecewise> without a <piece>") : X([Ee(t, n)]);
3032
3032
  }
3033
3033
  inner(e) {
3034
3034
  let [t] = ji(e);
@@ -3043,12 +3043,12 @@ var ji = (e) => Array.from(e.children), Y = {
3043
3043
  level: Y.Primary
3044
3044
  });
3045
3045
  function Bi(e, t) {
3046
- return e.level < t ? [I(e.row)] : e.row;
3046
+ return e.level < t ? [L(e.row)] : e.row;
3047
3047
  }
3048
3048
  function Vi(e, t, n) {
3049
3049
  let r = [];
3050
3050
  return e.forEach((e, i) => {
3051
- i > 0 && r.push(P(t));
3051
+ i > 0 && r.push(F(t));
3052
3052
  let a = e.level === Y.Unary && (t === "+" && i > 0 || t === "·" && i === 0) ? Y.Unary : n;
3053
3053
  r.push(...Bi(e, a));
3054
3054
  }), r;
@@ -3127,7 +3127,7 @@ var Gi = (e) => e.kind ?? "error", Ki = (e) => Gi(e) !== "hint", qi = ["aria-inv
3127
3127
  top: `${t.top}px`,
3128
3128
  height: `${t.height}px`
3129
3129
  } : null, g.value = t?.placeholder ?? !1;
3130
- let n = c.cursor.path, r = e && n.length > 0 && j(c.modelValue, n)?.length ? ln(e, n) : null;
3130
+ let n = c.cursor.path, r = e && n.length > 0 && M(c.modelValue, n)?.length ? ln(e, n) : null;
3131
3131
  re.value = r ? {
3132
3132
  left: `${r.left}px`,
3133
3133
  top: `${r.top}px`,
@@ -3185,9 +3185,9 @@ var Gi = (e) => e.kind ?? "error", Ki = (e) => Gi(e) !== "hint", qi = ["aria-inv
3185
3185
  immediate: !0,
3186
3186
  deep: !0
3187
3187
  }), te(() => {
3188
- window.addEventListener("resize", de), document.addEventListener("copy", P), document.addEventListener("cut", F), document.addEventListener("paste", Se), document.fonts?.ready.then(de);
3188
+ window.addEventListener("resize", de), document.addEventListener("copy", F), document.addEventListener("cut", I), document.addEventListener("paste", xe), document.fonts?.ready.then(de);
3189
3189
  }), ee(() => {
3190
- window.removeEventListener("resize", de), document.removeEventListener("copy", P), document.removeEventListener("cut", F), document.removeEventListener("paste", Se), M();
3190
+ window.removeEventListener("resize", de), document.removeEventListener("copy", F), document.removeEventListener("cut", I), document.removeEventListener("paste", xe), N();
3191
3191
  });
3192
3192
  let me = (e, t) => {
3193
3193
  let n = u.value, r = n ? nn(n, c.modelValue, c.cursor) : null;
@@ -3260,12 +3260,12 @@ var Gi = (e) => e.kind ?? "error", Ki = (e) => Gi(e) !== "hint", qi = ["aria-inv
3260
3260
  function O(e, t) {
3261
3261
  let n = G(t) !== null, r = Ti(e);
3262
3262
  if (r !== null) {
3263
- let e = j(t.root, t.cursor.path), i = t.cursor.offset - +!!In(e?.[t.cursor.offset - 1]);
3263
+ let e = M(t.root, t.cursor.path), i = t.cursor.offset - +!!In(e?.[t.cursor.offset - 1]);
3264
3264
  return {
3265
3265
  kind: "type",
3266
3266
  text: r,
3267
3267
  replacedSelection: n,
3268
- exponentSign: !n && (r === "-" || r === "+") && !!e && Ve(e, i)
3268
+ exponentSign: !n && (r === "-" || r === "+") && !!e && Be(e, i)
3269
3269
  };
3270
3270
  }
3271
3271
  return e.key === "Backspace" ? {
@@ -3277,42 +3277,42 @@ var Gi = (e) => e.kind ?? "error", Ki = (e) => Gi(e) !== "hint", qi = ["aria-inv
3277
3277
  } : bi;
3278
3278
  }
3279
3279
  let k = null;
3280
- function ye(e) {
3280
+ function A(e) {
3281
3281
  let t = u.value;
3282
3282
  return t ? on(t, c.modelValue, e.clientX, e.clientY) : null;
3283
3283
  }
3284
- function A(e) {
3284
+ function j(e) {
3285
3285
  if (e.preventDefault(), x.value = null, e.button !== 0) return;
3286
- let t = ye(e);
3286
+ let t = A(e);
3287
3287
  if (!t) return;
3288
3288
  u.value?.focus();
3289
3289
  let n = oe();
3290
- k = e.shiftKey ? n.anchor ?? n.cursor : t, he(_r(n, k, t)), window.addEventListener("mousemove", be), window.addEventListener("mouseup", M);
3290
+ k = e.shiftKey ? n.anchor ?? n.cursor : t, he(_r(n, k, t)), window.addEventListener("mousemove", ye), window.addEventListener("mouseup", N);
3291
3291
  }
3292
- function be(e) {
3292
+ function ye(e) {
3293
3293
  if (!k) return;
3294
- let t = ye(e);
3294
+ let t = A(e);
3295
3295
  t && he(_r(oe(), k, t));
3296
3296
  }
3297
- function M() {
3298
- k = null, window.removeEventListener("mousemove", be), window.removeEventListener("mouseup", M);
3297
+ function N() {
3298
+ k = null, window.removeEventListener("mousemove", ye), window.removeEventListener("mouseup", N);
3299
3299
  }
3300
- let xe = () => !!u.value && document.activeElement === u.value;
3301
- function N(e) {
3300
+ let be = () => !!u.value && document.activeElement === u.value;
3301
+ function P(e) {
3302
3302
  let t = dr(oe());
3303
3303
  return t.length === 0 || !e.clipboardData ? !1 : (e.preventDefault(), e.clipboardData.setData("text/plain", W(t, {
3304
3304
  greekNames: c.greekNames,
3305
3305
  typesetNames: c.typesetNames
3306
3306
  })), e.clipboardData.setData(un, dn(t)), !0);
3307
3307
  }
3308
- function P(e) {
3309
- xe() && N(e);
3310
- }
3311
3308
  function F(e) {
3312
- xe() && !c.readonly && N(e) && l("edit", ai(oe()), bi);
3309
+ be() && P(e);
3313
3310
  }
3314
- function Se(e) {
3315
- if (!xe() || c.readonly || !e.clipboardData) return;
3311
+ function I(e) {
3312
+ be() && !c.readonly && P(e) && l("edit", ai(oe()), bi);
3313
+ }
3314
+ function xe(e) {
3315
+ if (!be() || c.readonly || !e.clipboardData) return;
3316
3316
  e.preventDefault();
3317
3317
  let t = e.clipboardData, n = fn(t.getData(un)), r = t.getData("text/plain");
3318
3318
  if (!n && ki(r)) {
@@ -3326,7 +3326,7 @@ var Gi = (e) => e.kind ?? "error", Ki = (e) => Gi(e) !== "hint", qi = ["aria-inv
3326
3326
  let i = n ?? Fn(r);
3327
3327
  i.length > 0 && l("edit", Br(i)(oe()), bi);
3328
3328
  }
3329
- function Ce() {
3329
+ function Se() {
3330
3330
  let e = u.value, t = e ? nn(e, c.modelValue, c.cursor) : null;
3331
3331
  if (!e || !t) return null;
3332
3332
  let n = e.getBoundingClientRect();
@@ -3334,7 +3334,7 @@ var Gi = (e) => e.kind ?? "error", Ki = (e) => Gi(e) !== "hint", qi = ["aria-inv
3334
3334
  }
3335
3335
  return r({
3336
3336
  focus: () => u.value?.focus(),
3337
- caretRect: Ce
3337
+ caretRect: Se
3338
3338
  }), (n, r) => (_(), a("div", {
3339
3339
  ref_key: "surfaceEl",
3340
3340
  ref: u,
@@ -3347,7 +3347,7 @@ var Gi = (e) => e.kind ?? "error", Ki = (e) => Gi(e) !== "hint", qi = ["aria-inv
3347
3347
  "aria-label": "Equation",
3348
3348
  "aria-invalid": t.marks.some(S(Ki)) || void 0,
3349
3349
  onKeydown: ge,
3350
- onMousedown: A,
3350
+ onMousedown: j,
3351
3351
  onMouseenter: de,
3352
3352
  onMousemove: pe,
3353
3353
  onMouseleave: r[0] ||= (e) => x.value = null,
@@ -3434,7 +3434,7 @@ var ta = {
3434
3434
  "·": "*",
3435
3435
  "×": "*",
3436
3436
  ",": ",",
3437
- ...Object.fromEntries(V.map((e) => [e.symbol, e.symbol]))
3437
+ ...Object.fromEntries(bt.map((e) => [e.symbol, e.symbol]))
3438
3438
  }, na = /^[A-Za-z_][A-Za-z0-9_]*$/, ra = [
3439
3439
  {
3440
3440
  symbol: "∨",
@@ -3461,10 +3461,10 @@ function ia(e, t) {
3461
3461
  }), r++;
3462
3462
  continue;
3463
3463
  }
3464
- if ($e(i)) {
3465
- let t = tt(e, r), i = e.slice(r, t), a = i.map((e) => e.value).join(""), o = i.map((e) => e.id);
3464
+ if (Qe(i)) {
3465
+ let t = et(e, r), i = e.slice(r, t), a = i.map((e) => e.value).join(""), o = i.map((e) => e.id);
3466
3466
  r = t;
3467
- let s = Xe(a), c = nt(a);
3467
+ let s = Ye(a), c = tt(a);
3468
3468
  n.push(s ? {
3469
3469
  kind: "function",
3470
3470
  name: s,
@@ -3488,7 +3488,7 @@ function ia(e, t) {
3488
3488
  }), r++;
3489
3489
  continue;
3490
3490
  }
3491
- let a = Be(e, r);
3491
+ let a = ze(e, r);
3492
3492
  if (a) {
3493
3493
  let i = e.slice(a.start, a.end).map((e) => e.id);
3494
3494
  r = a.end;
@@ -3528,7 +3528,7 @@ function ia(e, t) {
3528
3528
  kind: "operator",
3529
3529
  op: o,
3530
3530
  atomIds: s
3531
- }) : je(i.value) ? n.push({
3531
+ }) : Ae(i.value) ? n.push({
3532
3532
  kind: "constant",
3533
3533
  name: i.value,
3534
3534
  atomIds: s
@@ -3737,7 +3737,7 @@ var la = class {
3737
3737
  type: "Abs",
3738
3738
  value: n(e.body, "Empty absolute value")
3739
3739
  };
3740
- let t = qe(e.open);
3740
+ let t = Ke(e.open);
3741
3741
  return t ? {
3742
3742
  type: "FunctionCall",
3743
3743
  name: t,
@@ -3758,7 +3758,7 @@ var la = class {
3758
3758
  variable: n(e.variable, "Empty derivative variable")
3759
3759
  };
3760
3760
  case "piecewise": {
3761
- let t = e.otherwise ? n(e.otherwise, "Empty otherwise value") : null, r = ot(e);
3761
+ let t = e.otherwise ? n(e.otherwise, "Empty otherwise value") : null, r = at(e);
3762
3762
  return t?.type === "Number" && r && (t = {
3763
3763
  ...t,
3764
3764
  units: r
@@ -3845,13 +3845,13 @@ var la = class {
3845
3845
  //#endregion
3846
3846
  //#region src/renderers/mathjson.ts
3847
3847
  function ua(e) {
3848
- return Ue(e)?.mathJson ?? e;
3848
+ return He(e)?.mathJson ?? e;
3849
3849
  }
3850
3850
  function Z(e) {
3851
3851
  switch (e.type) {
3852
3852
  case "Number": return e.value;
3853
3853
  case "Identifier": return e.name;
3854
- case "Constant": return je(e.name).mathJson;
3854
+ case "Constant": return Ae(e.name).mathJson;
3855
3855
  case "Add": return ["Add", ...e.children.map(Z)];
3856
3856
  case "Multiply": return ["Multiply", ...e.children.map(Z)];
3857
3857
  case "Subtract": return [
@@ -3936,7 +3936,7 @@ function $(e, t = {}) {
3936
3936
  switch (e.type) {
3937
3937
  case "Number": return pa(e, t);
3938
3938
  case "Identifier": return `<ci>${e.name}</ci>`;
3939
- case "Constant": return `<${je(e.name).mathml}/>`;
3939
+ case "Constant": return `<${Ae(e.name).mathml}/>`;
3940
3940
  case "Add": return Q("plus", e.children.map((e) => $(e, t)));
3941
3941
  case "Multiply": return Q("times", e.children.map((e) => $(e, t)));
3942
3942
  case "Subtract": return Q("minus", [$(e.minuend, t), $(e.subtrahend, t)]);
@@ -3953,7 +3953,7 @@ function $(e, t = {}) {
3953
3953
  </apply>
3954
3954
  ` : Q("root", [$(e.radicand, t)]);
3955
3955
  case "FunctionCall": {
3956
- let n = Ue(e.name), r = e.args.map((e) => $(e, t));
3956
+ let n = He(e.name), r = e.args.map((e) => $(e, t));
3957
3957
  return n?.mathMlTag ? n.mathMlTag === "log" && r.length === 2 ? `
3958
3958
  <apply>
3959
3959
  <log/>
@@ -4018,14 +4018,30 @@ function _a(e, t, n = {}) {
4018
4018
  switch (t) {
4019
4019
  case "latex": return W(e, n);
4020
4020
  case "mathjson": return da(ea(e).ast);
4021
- case "mathml": return va(e, n);
4021
+ case "mathml": return ba(e, n);
4022
+ }
4023
+ }
4024
+ function va(e, t, n = {}) {
4025
+ let r = e.filter((e) => e.length > 0);
4026
+ if (r.length === 1) return _a(r[0], t, n);
4027
+ switch (t) {
4028
+ case "latex": return `\\begin{aligned}\n${r.map((e) => ya(e, n)).join(" \\\\\n")}\n\\end{aligned}`;
4029
+ case "mathjson": return JSON.stringify(r.map((e) => Z(ea(e).ast)), null, 2);
4030
+ case "mathml": return xa(r, n);
4022
4031
  }
4023
4032
  }
4024
- function va(e, t = {}) {
4025
- let n = $(ea(e).ast, t);
4026
- return ya(`<math ${t.cellml ? `xmlns="${ha}" xmlns:cellml="${ga}"` : `xmlns="${ha}"`}>${n}</math>`);
4033
+ function ya(e, t) {
4034
+ let n = e.findIndex((e) => e.kind === "symbol" && e.value === "=");
4035
+ return n < 0 ? `&${W(e, t)}` : `${W(e.slice(0, n), t)} &= ${W(e.slice(n + 1), t)}`;
4036
+ }
4037
+ function ba(e, t = {}) {
4038
+ return xa([e], t);
4039
+ }
4040
+ function xa(e, t) {
4041
+ let n = e.map((e) => $(ea(e).ast, t)).join("");
4042
+ return Sa(`<math ${t.cellml ? `xmlns="${ha}" xmlns:cellml="${ga}"` : `xmlns="${ha}"`}>${n}</math>`);
4027
4043
  }
4028
- function ya(e, t = " ") {
4044
+ function Sa(e, t = " ") {
4029
4045
  let n = e.match(/<[^>]+>|[^<]+/g) ?? [], r = [], i = 0;
4030
4046
  for (let e = 0; e < n.length; e++) {
4031
4047
  let a = n[e];
@@ -4060,7 +4076,7 @@ function ya(e, t = " ") {
4060
4076
  }
4061
4077
  //#endregion
4062
4078
  //#region src/editor/units.ts
4063
- function ba(e, t, n, r = 0) {
4079
+ function Ca(e, t, n, r = 0) {
4064
4080
  if (!n) return {
4065
4081
  id: e,
4066
4082
  mathml: "",
@@ -4070,20 +4086,20 @@ function ba(e, t, n, r = 0) {
4070
4086
  };
4071
4087
  let i = [], a = [], o = 0, s = (e) => {
4072
4088
  e.type === "Identifier" && !i.includes(e.name) && i.push(e.name), e.type === "Number" && e.units && !a.includes(e.units) && a.push(e.units), e.type === "Placeholder" && o++;
4073
- for (let t of Sa(e)) s(t);
4089
+ for (let t of Ta(e)) s(t);
4074
4090
  };
4075
4091
  return s(n.ast), {
4076
4092
  id: e,
4077
- mathml: va(t, { cellml: !0 }),
4093
+ mathml: ba(t, { cellml: !0 }),
4078
4094
  variables: i,
4079
4095
  units: a,
4080
- complete: n.diagnostics.length === 0 && r === 0 && o === 0 && !xa(t)
4096
+ complete: n.diagnostics.length === 0 && r === 0 && o === 0 && !wa(t)
4081
4097
  };
4082
4098
  }
4083
- function xa(e) {
4084
- return e.some((e) => e.kind === "units" && e.units.length === 0 || k(e).some(([, e]) => xa(e)));
4099
+ function wa(e) {
4100
+ return e.some((e) => e.kind === "units" && e.units.length === 0 || k(e).some(([, e]) => wa(e)));
4085
4101
  }
4086
- function Sa(e) {
4102
+ function Ta(e) {
4087
4103
  switch (e.type) {
4088
4104
  case "Add":
4089
4105
  case "Multiply":
@@ -4110,8 +4126,8 @@ function Sa(e) {
4110
4126
  default: return [];
4111
4127
  }
4112
4128
  }
4113
- function Ca(e, t) {
4114
- let n = [], r = t.some((e) => e.numbers?.length || e.units?.length) ? ut(e) : [], i = t.some((e) => e.variables?.length) ? lt(e) : null;
4129
+ function Ea(e, t) {
4130
+ let n = [], r = t.some((e) => e.numbers?.length || e.units?.length) ? lt(e) : [], i = t.some((e) => e.variables?.length) ? ct(e) : null;
4115
4131
  for (let e of t) {
4116
4132
  for (let t of e.variables ?? []) for (let r of i?.get(t) ?? []) n.push({
4117
4133
  message: e.message,
@@ -4126,9 +4142,9 @@ function Ca(e, t) {
4126
4142
  }
4127
4143
  return n;
4128
4144
  }
4129
- function wa(e, t) {
4145
+ function Da(e, t) {
4130
4146
  let n = [];
4131
- if (t) for (let [r, i] of lt(e)) {
4147
+ if (t) for (let [r, i] of ct(e)) {
4132
4148
  if (!Object.hasOwn(t, r)) continue;
4133
4149
  let e = t[r];
4134
4150
  for (let t of i) n.push({
@@ -4137,7 +4153,7 @@ function wa(e, t) {
4137
4153
  kind: "hint"
4138
4154
  });
4139
4155
  }
4140
- for (let r of ut(e)) {
4156
+ for (let r of lt(e)) {
4141
4157
  if (!r.units && !t) continue;
4142
4158
  let e = r.inherited ? ", as in the first piece" : "";
4143
4159
  n.push({
@@ -4150,29 +4166,29 @@ function wa(e, t) {
4150
4166
  }
4151
4167
  //#endregion
4152
4168
  //#region src/editor/toolbar.ts
4153
- function Ta(e, t) {
4154
- let { latexName: n, latexCommand: r } = He[e];
4169
+ function Oa(e, t) {
4170
+ let { latexName: n, latexCommand: r } = Ve[e];
4155
4171
  return {
4156
4172
  latex: r ? `\\${n}` : `\\operatorname{${n}}`,
4157
4173
  title: `${t} ( ${n} )`,
4158
4174
  command: ci(e)
4159
4175
  };
4160
4176
  }
4161
- var Ea = [
4177
+ var ka = [
4162
4178
  ["sin", "Sine"],
4163
4179
  ["cos", "Cosine"],
4164
4180
  ["tan", "Tangent"],
4165
4181
  ["sec", "Secant"],
4166
4182
  ["csc", "Cosecant"],
4167
4183
  ["cot", "Cotangent"]
4168
- ], Da = (e, t) => Ea.map(([n, r]) => {
4184
+ ], Aa = (e, t) => ka.map(([n, r]) => {
4169
4185
  let i = [
4170
4186
  t && "inverse",
4171
4187
  e && "hyperbolic",
4172
4188
  r.toLowerCase()
4173
4189
  ].filter(Boolean).join(" ");
4174
- return Ta(`${t ? "a" : ""}${n}${e}`, i[0].toUpperCase() + i.slice(1));
4175
- }), Oa = [
4190
+ return Oa(`${t ? "a" : ""}${n}${e}`, i[0].toUpperCase() + i.slice(1));
4191
+ }), ja = [
4176
4192
  {
4177
4193
  id: "fraction",
4178
4194
  title: "Fraction ( / )",
@@ -4228,26 +4244,26 @@ var Ea = [
4228
4244
  sections: [
4229
4245
  {
4230
4246
  label: "Trigonometric",
4231
- items: Da("", !1)
4247
+ items: Aa("", !1)
4232
4248
  },
4233
4249
  {
4234
4250
  label: "Hyperbolic",
4235
- items: Da("h", !1)
4251
+ items: Aa("h", !1)
4236
4252
  },
4237
4253
  {
4238
4254
  label: "Inverse trigonometric",
4239
- items: Da("", !0)
4255
+ items: Aa("", !0)
4240
4256
  },
4241
4257
  {
4242
4258
  label: "Inverse hyperbolic",
4243
- items: Da("h", !0)
4259
+ items: Aa("h", !0)
4244
4260
  },
4245
4261
  {
4246
4262
  label: "Exponential and logarithm",
4247
4263
  items: [
4248
- Ta("exp", "Exponential"),
4249
- Ta("ln", "Natural logarithm"),
4250
- Ta("log", "Logarithm")
4264
+ Oa("exp", "Exponential"),
4265
+ Oa("ln", "Natural logarithm"),
4266
+ Oa("log", "Logarithm")
4251
4267
  ]
4252
4268
  }
4253
4269
  ]
@@ -4371,64 +4387,66 @@ var Ea = [
4371
4387
  }
4372
4388
  ]
4373
4389
  }
4374
- ], ka = { class: "me-workbench" }, Aa = [
4390
+ ], Ma = { class: "me-workbench" }, Na = [
4375
4391
  "title",
4376
4392
  "data-role",
4377
4393
  "aria-haspopup",
4378
4394
  "disabled",
4379
4395
  "onClick"
4380
- ], ja = ["innerHTML"], Ma = {
4396
+ ], Pa = ["innerHTML"], Fa = {
4381
4397
  key: 0,
4382
4398
  class: "pi pi-chevron-down tool-chevron",
4383
4399
  "aria-hidden": "true"
4384
- }, Na = ["disabled"], Pa = { class: "toolbar-group toolbar-lines" }, Fa = {
4400
+ }, Ia = ["disabled"], La = { class: "toolbar-group toolbar-lines" }, Ra = {
4385
4401
  key: 0,
4386
4402
  class: "toolbar-group toolbar-copy"
4387
- }, Ia = {
4403
+ }, za = {
4388
4404
  key: 0,
4389
4405
  class: "gallery"
4390
- }, La = {
4406
+ }, Ba = {
4391
4407
  key: 0,
4392
4408
  class: "gallery-label"
4393
- }, Ra = { class: "gallery-items" }, za = ["title", "onClick"], Ba = ["innerHTML"], Va = {
4409
+ }, Va = { class: "gallery-items" }, Ha = ["title", "onClick"], Ua = ["innerHTML"], Wa = {
4394
4410
  class: "command-chip",
4395
4411
  "data-role": "command"
4396
- }, Ha = {
4412
+ }, Ga = {
4397
4413
  key: 0,
4398
4414
  class: "command-options",
4399
4415
  role: "listbox",
4400
4416
  "aria-label": "Commands"
4401
- }, Ua = [
4417
+ }, Ka = [
4402
4418
  "aria-selected",
4403
4419
  "data-command",
4404
4420
  "onClick"
4405
- ], Wa = ["innerHTML"], Ga = { class: "command-name" }, Ka = { class: "command-title" }, qa = { class: "command-hint" }, Ja = [
4421
+ ], qa = ["innerHTML"], Ja = { class: "command-name" }, Ya = { class: "command-title" }, Xa = { class: "command-hint" }, Za = [
4406
4422
  "data-line",
4407
4423
  "data-line-id",
4424
+ "data-selected",
4408
4425
  "onFocusin",
4409
4426
  "onDragover"
4410
- ], Ya = [
4427
+ ], Qa = [
4411
4428
  "draggable",
4412
4429
  "title",
4430
+ "onMousedown",
4413
4431
  "onDragstart"
4414
- ], Xa = { class: "line-number" }, Za = [
4432
+ ], $a = { class: "line-number" }, eo = [
4415
4433
  "aria-label",
4416
4434
  "title",
4417
4435
  "data-kind"
4418
- ], Qa = { role: "status" }, $a = ["data-kind", "title"], eo = { class: "status-text" }, to = {
4436
+ ], to = { role: "status" }, no = ["data-kind", "title"], ro = { class: "status-text" }, io = {
4419
4437
  key: 0,
4420
4438
  class: "status-more"
4421
- }, no = {
4439
+ }, ao = {
4422
4440
  key: 0,
4423
4441
  class: "focus-meta"
4424
- }, ro = { "data-role": "cursor" }, io = { "data-role": "selection" }, ao = {
4442
+ }, oo = { "data-role": "cursor" }, so = { "data-role": "selection" }, co = {
4425
4443
  class: "key-help",
4426
4444
  "data-role": "key-help"
4427
- }, oo = { class: "key-hint" }, so = { class: "key-hint" }, co = { class: "key-hint" }, lo = {
4445
+ }, lo = { class: "key-hint" }, uo = { class: "key-hint" }, fo = { class: "key-hint" }, po = {
4428
4446
  key: 0,
4429
4447
  class: "side-column",
4430
4448
  "data-role": "side"
4431
- }, uo = { "data-role": "mathml" }, fo = { class: "output-actions" }, po = { "data-role": "mathjson" }, mo = { "data-role": "latex" }, ho = { "data-role": "ast" }, go = "A CellML line must be an equation (… = …)", _o = /*#__PURE__*/ Zi(/* @__PURE__ */ u({
4449
+ }, mo = { "data-role": "mathml" }, ho = { class: "output-actions" }, go = { "data-role": "mathjson" }, _o = { "data-role": "latex" }, vo = { "data-role": "ast" }, yo = "A CellML line must be an equation (… = …)", bo = /*#__PURE__*/ Zi(/* @__PURE__ */ u({
4432
4450
  __name: "EquationWorkbench",
4433
4451
  props: {
4434
4452
  cellml: {
@@ -4449,6 +4467,10 @@ var Ea = [
4449
4467
  type: Boolean,
4450
4468
  default: !0
4451
4469
  },
4470
+ copy: {
4471
+ type: Boolean,
4472
+ default: void 0
4473
+ },
4452
4474
  history: {
4453
4475
  type: Boolean,
4454
4476
  default: !0
@@ -4473,228 +4495,249 @@ var Ea = [
4473
4495
  cellml: g.cellml,
4474
4496
  greekNames: g.greekNames,
4475
4497
  typesetNames: g.typesetNames
4476
- })), C = re([xr()]), oe = (e, t) => C.value.map((n, r) => r === e ? t : n), se = 0, T = () => `line-${++se}`, O = v([T()]), k = v(/* @__PURE__ */ new Map()), ye = v(/* @__PURE__ */ new Map()), A = v(0), be = v([]), j = v(null);
4477
- function M() {
4478
- return C.value[A.value];
4498
+ })), C = re([xr()]), oe = (e, t) => C.value.map((n, r) => r === e ? t : n), se = 0, T = () => `line-${++se}`, O = v([T()]), k = v(/* @__PURE__ */ new Map()), A = v(/* @__PURE__ */ new Map()), j = v(0), ye = v([]), M = v(null);
4499
+ function N() {
4500
+ return C.value[j.value];
4479
4501
  }
4480
- function xe(e, t) {
4481
- C.value = oe(e, N(t));
4502
+ function be(e, t) {
4503
+ C.value = oe(e, P(t));
4482
4504
  }
4483
- let N = (e, t = !1) => _t(Kn(e), {
4505
+ let P = (e, t = !1) => gt(Kn(e), {
4484
4506
  greekNames: g.greekNames,
4485
4507
  cursorAway: t
4486
4508
  });
4487
- ce(A, (e, t) => {
4509
+ ce(j, (e, t) => {
4488
4510
  let n = C.value[t];
4489
- n && (C.value = oe(t, N(n, !0)));
4511
+ n && (C.value = oe(t, P(n, !0)));
4490
4512
  }), ce(() => g.greekNames, () => {
4491
- C.value = C.value.map((e, t) => N(e, t !== A.value));
4513
+ C.value = C.value.map((e, t) => P(e, t !== j.value));
4492
4514
  });
4493
- function P() {
4494
- p(() => be.value[A.value]?.focus());
4515
+ function F() {
4516
+ p(() => ye.value[j.value]?.focus());
4495
4517
  }
4496
- let F = new Ci(), Se = v(0);
4497
- function Ce() {
4518
+ let I = new Ci(), xe = v(0);
4519
+ function Se() {
4498
4520
  return JSON.parse(JSON.stringify({
4499
4521
  equations: C.value,
4500
4522
  lineIds: O.value,
4501
- active: A.value
4523
+ active: j.value
4502
4524
  }));
4503
4525
  }
4504
- function we(e = A.value, t = bi) {
4505
- g.history && (F.checkpoint(Ce, Si(e, t)), Se.value++);
4526
+ function Ce(e = j.value, t = bi) {
4527
+ g.history && (I.checkpoint(Se, Si(e, t)), xe.value++);
4506
4528
  }
4507
- function I(e) {
4508
- e && (C.value = e.equations, O.value = e.lineIds, A.value = Math.min(e.active, e.equations.length - 1), Se.value++, P());
4529
+ function L(e) {
4530
+ e && (C.value = e.equations, O.value = e.lineIds, j.value = Math.min(e.active, e.equations.length - 1), xe.value++, F());
4509
4531
  }
4510
- let Te = () => I(F.undo(Ce())), Ee = () => I(F.redo(Ce())), De = n(() => Se.value >= 0 && F.canUndo), L = n(() => Se.value >= 0 && F.canRedo), Oe = /mac/i.test(navigator.userAgentData?.platform ?? navigator.platform), ke = Oe ? "⌘" : "Ctrl", Ae = Oe ? "⌥" : "Alt";
4511
- function je(e, t, n) {
4532
+ let we = () => L(I.undo(Se())), Te = () => L(I.redo(Se())), Ee = n(() => xe.value >= 0 && I.canUndo), R = n(() => xe.value >= 0 && I.canRedo), De = /mac/i.test(navigator.userAgentData?.platform ?? navigator.platform), Oe = De ? "⌘" : "Ctrl", ke = De ? "⌥" : "Alt";
4533
+ function Ae(e, t, n) {
4512
4534
  if (ie(t.root) === ie(C.value[e].root)) {
4513
- Ne(e, {
4535
+ Me(e, {
4514
4536
  cursor: t.cursor,
4515
4537
  anchor: t.anchor ?? null
4516
4538
  });
4517
4539
  return;
4518
4540
  }
4519
- we(e, n), xe(e, t), Me(e);
4541
+ Ce(e, n), be(e, t), je(e);
4520
4542
  }
4521
- function Me(e) {
4522
- ye.value.delete(O.value[e]), Fe.value = null;
4543
+ function je(e) {
4544
+ A.value.delete(O.value[e]), Pe.value = null, ct();
4523
4545
  }
4524
- function Ne(e, { cursor: t, anchor: n }) {
4525
- F.breakGroup(), xe(e, {
4546
+ function Me(e, { cursor: t, anchor: n }) {
4547
+ I.breakGroup(), be(e, {
4526
4548
  ...C.value[e],
4527
4549
  cursor: t,
4528
4550
  anchor: n
4529
4551
  });
4530
4552
  }
4531
- function Pe(e, t = []) {
4532
- let n = e.map((e) => N({
4553
+ function Ne(e, t = []) {
4554
+ let n = e.map((e) => P({
4533
4555
  root: e,
4534
4556
  cursor: Zn(e),
4535
4557
  anchor: null
4536
4558
  }, !0));
4537
- C.value = n.length ? n : [xr()], O.value = C.value.map(() => T()), A.value = 0, ye.value = new Map(O.value.flatMap((e, n) => t[n]?.length ? [[e, t[n]]] : [])), k.value = new Map(Wt.value.map((e) => [e.id, e.mathml]));
4559
+ C.value = n.length ? n : [xr()], O.value = C.value.map(() => T()), j.value = 0, ct(), A.value = new Map(O.value.flatMap((e, n) => t[n]?.length ? [[e, t[n]]] : [])), k.value = new Map(en.value.map((e) => [e.id, e.mathml]));
4538
4560
  }
4539
- let Fe = v(null);
4540
- function Ie(e, t) {
4561
+ let Pe = v(null);
4562
+ function Fe(e, t) {
4541
4563
  if (g.readonly) return;
4542
4564
  let n = t.equations.length;
4543
- if (n === 1) je(e, Br(t.equations[0])(C.value[e]), bi), t.problems.length && ye.value.set(O.value[e], t.problems);
4565
+ if (n === 1) Ae(e, Br(t.equations[0])(C.value[e]), bi), t.problems.length && A.value.set(O.value[e], t.problems);
4544
4566
  else if (n > 1) {
4545
- we(e), Pe(t.equations, t.lineProblems);
4546
- for (let e of Wt.value) x("line-commit", e, { reason: "paste" });
4547
- P();
4567
+ Ce(e), Ne(t.equations, t.lineProblems);
4568
+ for (let e of en.value) x("line-commit", e, { reason: "paste" });
4569
+ F();
4548
4570
  }
4549
- Fe.value = n > 1 ? `Imported ${n} equations from Content MathML, replacing the lines there were.` : n === 0 ? t.problems[0] ?? "Nothing was imported." : null;
4571
+ Pe.value = n > 1 ? `Imported ${n} equations from Content MathML, replacing the lines there were.` : n === 0 ? t.problems[0] ?? "Nothing was imported." : null;
4550
4572
  }
4551
- function R(e) {
4573
+ function z(e) {
4552
4574
  let t = Ai(e);
4553
- return t ? (Kt = "load", Pe(t.equations, t.lineProblems), j.value = null, Fe.value = null, F.clear(), Se.value++, t) : {
4575
+ return t ? (nn = "load", Ne(t.equations, t.lineProblems), M.value = null, Pe.value = null, I.clear(), xe.value++, t) : {
4554
4576
  equations: [],
4555
4577
  problems: ["The MathML isn't well-formed XML, so nothing was loaded"],
4556
4578
  lineProblems: []
4557
4579
  };
4558
4580
  }
4559
4581
  d({
4560
- setMathML: R,
4561
- focus: P
4582
+ setMathML: z,
4583
+ focus: F
4562
4584
  });
4563
- let Le = v(null), Re = v(null), ze = v(!1), Be = 0;
4564
- function Ve() {
4565
- if (Be = 0, !Le.value || !Re.value) return;
4566
- let e = Re.value.getBoundingClientRect().top - Le.value.getBoundingClientRect().top;
4567
- ze.value = e > .5, j.value !== null && dt();
4585
+ let Ie = v(null), Le = v(null), Re = v(!1), ze = 0;
4586
+ function Be() {
4587
+ if (ze = 0, !Ie.value || !Le.value) return;
4588
+ let e = Le.value.getBoundingClientRect().top - Ie.value.getBoundingClientRect().top;
4589
+ Re.value = e > .5, M.value !== null && xt();
4568
4590
  }
4569
- function He() {
4570
- Be ||= requestAnimationFrame(Ve);
4591
+ function Ve() {
4592
+ ze ||= requestAnimationFrame(Be);
4571
4593
  }
4572
4594
  te(() => {
4573
- if (g.autofocus && P(), document.addEventListener("scroll", He, {
4595
+ if (g.autofocus && F(), document.addEventListener("scroll", Ve, {
4574
4596
  capture: !0,
4575
4597
  passive: !0
4576
- }), window.addEventListener("resize", He, { passive: !0 }), Ve(), typeof ResizeObserver < "u" && V.value) {
4577
- Ct = new ResizeObserver(wt), Ct.observe(V.value);
4578
- for (let e of V.value.children) Ct.observe(e);
4598
+ }), window.addEventListener("resize", Ve, { passive: !0 }), Be(), typeof ResizeObserver < "u" && At.value) {
4599
+ Nt = new ResizeObserver(Pt), Nt.observe(At.value);
4600
+ for (let e of At.value.children) Nt.observe(e);
4579
4601
  }
4580
- wt();
4602
+ Pt();
4581
4603
  }), ee(() => {
4582
- document.removeEventListener("scroll", He, { capture: !0 }), window.removeEventListener("resize", He), Be && cancelAnimationFrame(Be), Ct?.disconnect();
4604
+ document.removeEventListener("scroll", Ve, { capture: !0 }), window.removeEventListener("resize", Ve), ze && cancelAnimationFrame(ze), Nt?.disconnect();
4583
4605
  });
4584
- function Ue(e) {
4606
+ function He(e) {
4585
4607
  if (g.readonly) return;
4586
- let t = M(), n = e(t);
4587
- n !== t && (we(), xe(A.value, n), Me(A.value)), P();
4608
+ let t = N(), n = e(t);
4609
+ n !== t && (Ce(), be(j.value, n), je(j.value)), F();
4588
4610
  }
4589
- function We(e) {
4611
+ function Ue(e) {
4590
4612
  if (g.readonly) return;
4591
- z(A.value, e), we();
4592
- let t = A.value + 1;
4613
+ B(j.value, e), Ce();
4614
+ let t = j.value + 1;
4593
4615
  C.value = [
4594
4616
  ...C.value.slice(0, t),
4595
4617
  xr(),
4596
4618
  ...C.value.slice(t)
4597
- ], O.value.splice(t, 0, T()), A.value = t, P();
4619
+ ], O.value.splice(t, 0, T()), j.value = t, F();
4598
4620
  }
4599
- function Ge(e) {
4600
- e < 0 || e >= C.value.length || (e !== A.value && z(A.value, "navigate"), F.breakGroup(), A.value = e, P());
4621
+ function We(e) {
4622
+ e < 0 || e >= C.value.length || (e !== j.value && B(j.value, "navigate"), ct(), I.breakGroup(), j.value = e, F());
4601
4623
  }
4602
- function Ke(e) {
4603
- e !== A.value && (j.value = null, z(A.value, "navigate"), A.value = e);
4624
+ function Ge(e) {
4625
+ e !== j.value && (M.value = null, ct(), B(j.value, "navigate"), j.value = e);
4604
4626
  }
4605
- let qe = v(null);
4606
- function Je(e) {
4627
+ let Ke = v(null);
4628
+ function qe(e) {
4607
4629
  let t = e.relatedTarget;
4608
- t && (qe.value?.contains(t) || t.closest("[data-me-popover]")) || (j.value = null, z(A.value, "blur"));
4630
+ t && (Ke.value?.contains(t) || t.closest("[data-me-popover]")) || (M.value = null, B(j.value, "blur"));
4609
4631
  }
4610
- function z(e, t) {
4611
- let n = Wt.value[e];
4632
+ function B(e, t) {
4633
+ let n = en.value[e];
4612
4634
  n && (k.value.get(n.id) ?? "") !== n.mathml && (k.value.set(n.id, n.mathml), x("line-commit", n, { reason: t }));
4613
4635
  }
4614
- function Ye() {
4636
+ function Je() {
4615
4637
  if (g.readonly || C.value.length <= 1) return;
4616
- we();
4617
- let e = A.value;
4618
- C.value = C.value.filter((t, n) => n !== e), O.value.splice(A.value, 1), A.value = Math.max(0, A.value - 1);
4619
- let t = M();
4620
- xe(A.value, {
4638
+ Ce();
4639
+ let e = j.value;
4640
+ C.value = C.value.filter((t, n) => n !== e), O.value.splice(j.value, 1), j.value = Math.max(0, j.value - 1);
4641
+ let t = N();
4642
+ be(j.value, {
4621
4643
  ...t,
4622
4644
  cursor: Zn(t.root),
4623
4645
  anchor: null
4624
- }), P();
4646
+ }), F();
4625
4647
  }
4626
- let Xe = n(() => !g.readonly && C.value.length > 1);
4627
- function Ze(e, t) {
4648
+ let Ye = n(() => !g.readonly && C.value.length > 1);
4649
+ function Xe(e, t) {
4628
4650
  let n = C.value.length;
4629
- if (!Xe.value || e === t || Math.min(e, t) < 0 || Math.max(e, t) >= n) return;
4630
- if (e !== A.value) {
4631
- z(A.value, "navigate");
4632
- let e = A.value;
4633
- C.value = oe(e, N(C.value[e], !0));
4651
+ if (!Ye.value || e === t || Math.min(e, t) < 0 || Math.max(e, t) >= n) return;
4652
+ if (e !== j.value) {
4653
+ B(j.value, "navigate");
4654
+ let e = j.value;
4655
+ C.value = oe(e, P(C.value[e], !0));
4634
4656
  }
4635
- we();
4657
+ Ce();
4636
4658
  let r = C.value.map((e, t) => t);
4637
- r.splice(t, 0, ...r.splice(e, 1)), C.value = r.map((e) => C.value[e]), O.value = r.map((e) => O.value[e]), A.value = t, P();
4659
+ r.splice(t, 0, ...r.splice(e, 1)), C.value = r.map((e) => C.value[e]), O.value = r.map((e) => O.value[e]), j.value = t, F();
4638
4660
  }
4639
- let B = v(null), Qe = v(null);
4640
- function $e() {
4641
- if (B.value === null || !Qe.value) return null;
4642
- let { index: e, after: t } = Qe.value, n = e + +!!t, r = n > B.value ? n - 1 : n;
4643
- return r === B.value ? null : r;
4661
+ let V = v(null), Ze = v(null);
4662
+ function Qe() {
4663
+ if (V.value === null || !Ze.value) return null;
4664
+ let { index: e, after: t } = Ze.value, n = e + +!!t, r = n > V.value ? n - 1 : n;
4665
+ return r === V.value ? null : r;
4644
4666
  }
4645
- function et(e, t) {
4646
- if (!Xe.value || !t.dataTransfer) return;
4647
- B.value = e, t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData("text/plain", `Line ${e + 1}`);
4667
+ function $e(e, t) {
4668
+ if (!Ye.value || !t.dataTransfer) return;
4669
+ V.value = e, t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData("text/plain", `Line ${e + 1}`);
4648
4670
  let n = t.currentTarget.closest(".equation-row");
4649
4671
  if (n) {
4650
4672
  let e = n.getBoundingClientRect();
4651
4673
  t.dataTransfer.setDragImage(n, t.clientX - e.left, t.clientY - e.top);
4652
4674
  }
4653
4675
  }
4654
- function tt(e, t) {
4655
- if (B.value === null) return;
4676
+ function et(e, t) {
4677
+ if (V.value === null) return;
4656
4678
  t.preventDefault(), t.dataTransfer && (t.dataTransfer.dropEffect = "move");
4657
4679
  let n = t.currentTarget.getBoundingClientRect();
4658
- Qe.value = {
4680
+ Ze.value = {
4659
4681
  index: e,
4660
4682
  after: t.clientY > n.top + n.height / 2
4661
4683
  };
4662
4684
  }
4663
- function nt(e) {
4664
- if (B.value === null) return;
4685
+ function tt(e) {
4686
+ if (V.value === null) return;
4665
4687
  e.preventDefault();
4666
- let t = B.value, n = $e();
4667
- rt(), n !== null && Ze(t, n);
4668
- }
4669
- function rt() {
4670
- B.value = null, Qe.value = null;
4688
+ let t = V.value, n = Qe();
4689
+ nt(), n !== null && Xe(t, n);
4690
+ }
4691
+ function nt() {
4692
+ V.value = null, Ze.value = null;
4693
+ }
4694
+ function rt(e) {
4695
+ return Qe() === null || Ze.value?.index !== e ? null : Ze.value.after ? "drop-after" : "drop-before";
4696
+ }
4697
+ let it = v(/* @__PURE__ */ new Set()), at = n(() => O.value.flatMap((e, t) => it.value.has(e) ? [t] : [])), ot = n(() => at.value.length > 0), st = (e) => it.value.has(O.value[e]);
4698
+ function ct() {
4699
+ it.value.size && (it.value = /* @__PURE__ */ new Set());
4700
+ }
4701
+ let lt = n(() => g.copy ?? g.outputs), ut = (e) => e.shiftKey || e.metaKey || e.ctrlKey;
4702
+ function dt(e, t) {
4703
+ if (!lt.value || !ut(t)) return;
4704
+ t.preventDefault();
4705
+ let n = O.value;
4706
+ if (t.shiftKey) {
4707
+ let [t, r] = [j.value, e].sort((e, t) => e - t);
4708
+ it.value = new Set(n.slice(t, r + 1));
4709
+ return;
4710
+ }
4711
+ let r = new Set(it.value.size ? it.value : [n[j.value]]);
4712
+ r.has(n[e]) ? r.delete(n[e]) : r.add(n[e]), it.value = r;
4671
4713
  }
4672
- function it(e) {
4673
- return $e() === null || Qe.value?.index !== e ? null : Qe.value.after ? "drop-after" : "drop-before";
4714
+ function ft(e) {
4715
+ e.target?.closest?.("[data-role=\"line-handle\"]") && ut(e) || ct();
4674
4716
  }
4675
- function at() {
4676
- let e = (j.value ?? "").trim();
4677
- j.value = null, e && Ue(hi(e));
4717
+ let pt = n(() => [Ye.value && `Drag to reorder (${ke}+↑/↓)`, lt.value && `Shift+click or ${Oe}+click to select lines to copy`].filter(Boolean).join(" · ") || void 0);
4718
+ function mt() {
4719
+ let e = (M.value ?? "").trim();
4720
+ M.value = null, e && He(hi(e));
4678
4721
  }
4679
- let ot = n(() => j.value === null ? [] : yi(j.value)), st = v(-1);
4680
- ce(j, (e) => {
4681
- st.value = e && ot.value.length ? 0 : -1, e !== null && p(dt);
4722
+ let ht = n(() => M.value === null ? [] : yi(M.value)), _t = v(-1);
4723
+ ce(M, (e) => {
4724
+ _t.value = e && ht.value.length ? 0 : -1, e !== null && p(xt);
4682
4725
  });
4683
- function ct(e) {
4684
- let t = ot.value[e];
4685
- if (!t) return at();
4686
- j.value = null, Ue(hi(t.name));
4687
- }
4688
- function lt(e) {
4689
- let t = ot.value.length;
4690
- t && (st.value = (st.value + e + t) % t);
4691
- }
4692
- let ut = v({});
4693
- function dt() {
4694
- let e = be.value[A.value]?.caretRect();
4726
+ function vt(e) {
4727
+ let t = ht.value[e];
4728
+ if (!t) return mt();
4729
+ M.value = null, He(hi(t.name));
4730
+ }
4731
+ function yt(e) {
4732
+ let t = ht.value.length;
4733
+ t && (_t.value = (_t.value + e + t) % t);
4734
+ }
4735
+ let bt = v({});
4736
+ function xt() {
4737
+ let e = ye.value[j.value]?.caretRect();
4695
4738
  if (!e) return;
4696
4739
  let t = Math.max(8, Math.min(e.left - 8, window.innerWidth - 336));
4697
- ut.value = e.bottom < window.innerHeight * .6 ? {
4740
+ bt.value = e.bottom < window.innerHeight * .6 ? {
4698
4741
  left: `${t}px`,
4699
4742
  top: `${e.bottom + 6}px`
4700
4743
  } : {
@@ -4702,85 +4745,89 @@ var Ea = [
4702
4745
  bottom: `${window.innerHeight - e.top + 6}px`
4703
4746
  };
4704
4747
  }
4705
- function ft(e) {
4706
- if (/^[a-zA-Z0-9]$/.test(e.key)) j.value += e.key;
4707
- else if (e.key === "Backspace") j.value = j.value ? j.value.slice(0, -1) : null;
4708
- else if (e.key === "ArrowDown" || e.key === "ArrowUp") lt(e.key === "ArrowDown" ? 1 : -1);
4709
- else if (e.key === "Enter" || e.key === "Tab") ct(st.value);
4710
- else if (e.key === " " || e.key === "(") at();
4711
- else if (e.key === "Escape") j.value = null;
4748
+ function St(e) {
4749
+ if (/^[a-zA-Z0-9]$/.test(e.key)) M.value += e.key;
4750
+ else if (e.key === "Backspace") M.value = M.value ? M.value.slice(0, -1) : null;
4751
+ else if (e.key === "ArrowDown" || e.key === "ArrowUp") yt(e.key === "ArrowDown" ? 1 : -1);
4752
+ else if (e.key === "Enter" || e.key === "Tab") vt(_t.value);
4753
+ else if (e.key === " " || e.key === "(") mt();
4754
+ else if (e.key === "Escape") M.value = null;
4712
4755
  else return;
4713
4756
  e.preventDefault(), e.stopPropagation();
4714
4757
  }
4715
- function pt(e) {
4758
+ function Ct(e) {
4716
4759
  if (!e.target?.closest?.("[data-role=\"side\"]")) {
4717
- if (j.value !== null) {
4718
- ft(e);
4760
+ if (M.value !== null) {
4761
+ St(e);
4762
+ return;
4763
+ }
4764
+ if (e.key === "Escape" && ot.value) {
4765
+ e.preventDefault(), e.stopPropagation(), ct();
4719
4766
  return;
4720
4767
  }
4721
4768
  if ((e.ctrlKey || e.metaKey) && !e.altKey) {
4722
4769
  let t = e.key.toLowerCase();
4723
4770
  if ((t === "z" || t === "y") && g.history) {
4724
4771
  if (e.preventDefault(), e.stopPropagation(), g.readonly) return;
4725
- t === "y" || e.shiftKey ? Ee() : Te();
4772
+ t === "y" || e.shiftKey ? Te() : we();
4726
4773
  }
4727
4774
  return;
4728
4775
  }
4729
- e.key === "\\" && !e.altKey && !g.readonly && (e.preventDefault(), e.stopPropagation(), j.value = "");
4776
+ e.key === "\\" && !e.altKey && !g.readonly && (e.preventDefault(), e.stopPropagation(), M.value = "");
4730
4777
  }
4731
4778
  }
4732
- function mt(e) {
4779
+ function wt(e) {
4733
4780
  if (!e.defaultPrevented) {
4734
4781
  if (e.altKey && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
4735
- e.preventDefault(), Ze(A.value, A.value + (e.key === "ArrowUp" ? -1 : 1));
4782
+ e.preventDefault(), Xe(j.value, j.value + (e.key === "ArrowUp" ? -1 : 1));
4736
4783
  return;
4737
4784
  }
4738
4785
  switch (e.key) {
4739
4786
  case "Enter":
4740
- e.preventDefault(), We("enter");
4787
+ e.preventDefault(), Ue("enter");
4741
4788
  return;
4742
4789
  case "ArrowUp":
4743
- e.preventDefault(), Ge(A.value - 1);
4790
+ e.preventDefault(), We(j.value - 1);
4744
4791
  return;
4745
4792
  case "ArrowDown":
4746
- e.preventDefault(), Ge(A.value + 1);
4793
+ e.preventDefault(), We(j.value + 1);
4747
4794
  return;
4748
4795
  case "Backspace":
4749
- M().root.length === 0 && (e.preventDefault(), Ye());
4796
+ N().root.length === 0 && (e.preventDefault(), Je());
4750
4797
  return;
4751
4798
  }
4752
4799
  }
4753
4800
  }
4754
- let ht = v(null), gt = v(null);
4755
- function vt(e, t) {
4801
+ let Tt = v(null), Et = v(null);
4802
+ function Dt(e, t) {
4756
4803
  if (e.command) {
4757
- Ue(e.command);
4804
+ He(e.command);
4758
4805
  return;
4759
4806
  }
4760
- gt.value?.id !== e.id && ht.value?.hide(), gt.value = e, p(() => ht.value?.toggle(t));
4807
+ Et.value?.id !== e.id && Tt.value?.hide(), Et.value = e, p(() => Tt.value?.toggle(t));
4761
4808
  }
4762
- function yt(e) {
4763
- ht.value?.hide(), Ue(e);
4809
+ function Ot(e) {
4810
+ Tt.value?.hide(), He(e);
4764
4811
  }
4765
- function bt(e) {
4812
+ function kt(e) {
4766
4813
  return le.renderToString(e, {
4767
4814
  throwOnError: !1,
4768
4815
  strict: "ignore"
4769
4816
  });
4770
4817
  }
4771
- let V = v(null), xt = v(null), St = v(Oa.length), Ct = null;
4772
- function wt() {
4773
- let e = V.value, t = xt.value;
4818
+ let At = v(null), jt = v(null), Mt = v(ja.length), Nt = null;
4819
+ function Pt() {
4820
+ let e = At.value, t = jt.value;
4774
4821
  if (!e || !t) return;
4775
4822
  let n = (e) => e.getBoundingClientRect().width, r = n(e) + .5, i = parseFloat(getComputedStyle(e).columnGap) || 0, a = [...e.querySelectorAll("[data-tool]")].map(n), o = (e, o) => {
4776
4823
  let s = [...a.slice(0, e), ...o ? [n(t)] : []];
4777
4824
  return s.reduce((e, t) => e + t, 0) + i * Math.max(0, s.length - 1) <= r;
4778
4825
  }, s = a.length;
4779
4826
  if (!o(s, !1)) for (s--; s > 0 && !o(s, !0);) s--;
4780
- St.value = s;
4827
+ Mt.value = s;
4781
4828
  }
4782
- let Tt = n(() => {
4783
- let e = Oa.slice(St.value);
4829
+ let Ft = n(() => {
4830
+ let e = ja.slice(Mt.value);
4784
4831
  if (!e.length) return null;
4785
4832
  let t = [];
4786
4833
  for (let n of e) if (n.command) {
@@ -4800,50 +4847,50 @@ var Ea = [
4800
4847
  latex: "",
4801
4848
  sections: t
4802
4849
  };
4803
- }), Et = /* @__PURE__ */ new WeakMap();
4804
- function Dt(e) {
4850
+ }), It = /* @__PURE__ */ new WeakMap();
4851
+ function H(e) {
4805
4852
  if (e.length === 0) return null;
4806
- let t = Et.get(e);
4807
- return t || (t = ea(e), Et.set(e, t)), t;
4853
+ let t = It.get(e);
4854
+ return t || (t = ea(e), It.set(e, t)), t;
4808
4855
  }
4809
- let Ot = n(() => C.value.map((e) => Dt(e.root))), kt = n(() => Ot.value[A.value] ?? null);
4810
- function At(e, t) {
4811
- let n = Ot.value[t]?.ast;
4856
+ let Lt = n(() => C.value.map((e) => H(e.root))), Rt = n(() => Lt.value[j.value] ?? null);
4857
+ function zt(e, t) {
4858
+ let n = Lt.value[t]?.ast;
4812
4859
  return !g.cellml || !n || n.type === "Equal" ? null : {
4813
- message: go,
4860
+ message: yo,
4814
4861
  atomIds: e.map((e) => e.id),
4815
4862
  incomplete: !0
4816
4863
  };
4817
4864
  }
4818
- let jt = $i(() => g.issues), Mt = $i(() => g.variableUnits ?? null), Nt = n(() => {
4865
+ let Bt = $i(() => g.issues), Vt = $i(() => g.variableUnits ?? null), Ht = n(() => {
4819
4866
  let e = /* @__PURE__ */ new Map();
4820
- for (let t of jt.value) e.set(t.lineId, [...e.get(t.lineId) ?? [], t]);
4867
+ for (let t of Bt.value) e.set(t.lineId, [...e.get(t.lineId) ?? [], t]);
4821
4868
  return e;
4822
- }), Pt = n(() => (Nt.value, Mt.value, g.cellml, /* @__PURE__ */ new WeakMap())), Ft = n(() => C.value.map((e, t) => {
4823
- let n = e.root, r = Pt.value.get(n);
4869
+ }), Ut = n(() => (Ht.value, Vt.value, g.cellml, /* @__PURE__ */ new WeakMap())), Wt = n(() => C.value.map((e, t) => {
4870
+ let n = e.root, r = Ut.value.get(n);
4824
4871
  if (!r) {
4825
- let e = At(n, t), i = [
4826
- ...Ot.value[t]?.diagnostics ?? [],
4872
+ let e = zt(n, t), i = [
4873
+ ...Lt.value[t]?.diagnostics ?? [],
4827
4874
  ...e ? [e] : [],
4828
- ...Ca(n, Nt.value.get(O.value[t]) ?? [])
4829
- ], a = wa(n, Mt.value);
4875
+ ...Ea(n, Ht.value.get(O.value[t]) ?? [])
4876
+ ], a = Da(n, Vt.value);
4830
4877
  r = {
4831
4878
  all: [...i, ...a],
4832
4879
  complete: [...i.filter((e) => !e.incomplete), ...a],
4833
4880
  hints: a
4834
- }, Pt.value.set(n, r);
4881
+ }, Ut.value.set(n, r);
4835
4882
  }
4836
4883
  return r;
4837
4884
  }));
4838
- function It(e) {
4885
+ function Gt(e) {
4839
4886
  if (g.validate === "commit") {
4840
- let t = Wt.value[e];
4887
+ let t = en.value[e];
4841
4888
  return (k.value.get(t.id) ?? "") === t.mathml ? "all" : "hints";
4842
4889
  }
4843
- return e === A.value ? "complete" : "all";
4890
+ return e === j.value ? "complete" : "all";
4844
4891
  }
4845
- let H = n(() => Ft.value.map((e, t) => e[It(t)])), Lt = n(() => H.value.map((e, t) => {
4846
- let n = [...(It(t) === "hints" ? [] : ye.value.get(O.value[t]) ?? []).map((e) => ({
4892
+ let Kt = n(() => Wt.value.map((e, t) => e[Gt(t)])), qt = n(() => Kt.value.map((e, t) => {
4893
+ let n = [...(Gt(t) === "hints" ? [] : A.value.get(O.value[t]) ?? []).map((e) => ({
4847
4894
  line: t,
4848
4895
  message: e,
4849
4896
  kind: "error"
@@ -4853,44 +4900,44 @@ var Ea = [
4853
4900
  kind: Gi(e) === "units" ? "units" : "error"
4854
4901
  }))];
4855
4902
  return n.filter((e, t) => n.findIndex((t) => t.message === e.message) === t);
4856
- })), Rt = (e) => {
4857
- let t = Lt.value[e];
4903
+ })), Jt = (e) => {
4904
+ let t = qt.value[e];
4858
4905
  return t.length ? t.some((e) => e.kind === "error") ? "has-error" : "has-units-issue" : null;
4859
- }, zt = n(() => {
4860
- let e = Lt.value.flat(), t = Lt.value[A.value][0] ?? e[0];
4906
+ }, Yt = n(() => {
4907
+ let e = qt.value.flat(), t = qt.value[j.value][0] ?? e[0];
4861
4908
  return t ? {
4862
4909
  kind: t.kind,
4863
4910
  text: `Line ${t.line + 1}: ${t.message}`,
4864
4911
  more: e.length - 1,
4865
4912
  line: t.line
4866
- } : Fe.value ? {
4913
+ } : Pe.value ? {
4867
4914
  kind: "info",
4868
- text: Fe.value
4915
+ text: Pe.value
4869
4916
  } : null;
4870
- }), Bt = n(() => Lt.value.flat().map((e) => `Line ${e.line + 1}: ${e.message}`).join("\n")), Vt = (e) => Lt.value[e].map((e) => e.message).join("\n");
4871
- function Ht() {
4872
- let e = zt.value?.line;
4873
- e !== void 0 && Ge(e);
4917
+ }), Xt = n(() => qt.value.flat().map((e) => `Line ${e.line + 1}: ${e.message}`).join("\n")), Zt = (e) => qt.value[e].map((e) => e.message).join("\n");
4918
+ function Qt() {
4919
+ let e = Yt.value?.line;
4920
+ e !== void 0 && We(e);
4874
4921
  }
4875
- let Ut = n(() => (ye.value.size, g.cellml, /* @__PURE__ */ new WeakMap())), Wt = n(() => C.value.map((e, t) => {
4876
- let n = O.value[t], r = Ut.value.get(e.root);
4922
+ let $t = n(() => (A.value.size, g.cellml, /* @__PURE__ */ new WeakMap())), en = n(() => C.value.map((e, t) => {
4923
+ let n = O.value[t], r = $t.value.get(e.root);
4877
4924
  if (!r || r.id !== n) {
4878
- let i = (ye.value.get(n)?.length ?? 0) + +!!At(e.root, t);
4879
- r = ba(n, e.root, Ot.value[t], i), Ut.value.set(e.root, r);
4925
+ let i = (A.value.get(n)?.length ?? 0) + +!!zt(e.root, t);
4926
+ r = Ca(n, e.root, Lt.value[t], i), $t.value.set(e.root, r);
4880
4927
  }
4881
4928
  return r;
4882
- })), Gt = "", Kt = "load";
4883
- ce(Wt, (e) => {
4884
- let t = Kt;
4885
- Kt = "edit";
4929
+ })), tn = "", nn = "load";
4930
+ ce(en, (e) => {
4931
+ let t = nn;
4932
+ nn = "edit";
4886
4933
  let n = JSON.stringify(e);
4887
- n !== Gt && (Gt = n, x("equations-change", e, { source: t }));
4934
+ n !== tn && (tn = n, x("equations-change", e, { source: t }));
4888
4935
  }, { immediate: !0 });
4889
- let qt = n(() => kt.value?.ast ?? null), Jt = n(() => qt.value ? _a(M().root, "latex", ae.value) : ""), Yt = n(() => qt.value ? da(qt.value) : ""), Xt = n(() => qt.value ? va(M().root, ae.value) : ""), Zt = n(() => $n(M().cursor)), Qt = n(() => {
4890
- let e = G(M());
4936
+ let rn = n(() => Rt.value?.ast ?? null), an = n(() => rn.value ? _a(N().root, "latex", ae.value) : ""), on = n(() => rn.value ? da(rn.value) : ""), sn = n(() => rn.value ? ba(N().root, ae.value) : ""), cn = n(() => $n(N().cursor)), ln = n(() => {
4937
+ let e = G(N());
4891
4938
  return e ? fr(e) : null;
4892
- }), $t = v(!1), en = v("mathml");
4893
- function tn(e) {
4939
+ }), un = v(!1), dn = v("mathml");
4940
+ function fn(e) {
4894
4941
  let t = document.createElement("textarea");
4895
4942
  t.value = e, t.setAttribute("readonly", "true"), t.style.position = "fixed", t.style.opacity = "0", document.body.appendChild(t), t.select();
4896
4943
  try {
@@ -4901,72 +4948,76 @@ var Ea = [
4901
4948
  document.body.removeChild(t);
4902
4949
  }
4903
4950
  }
4904
- async function nn(e) {
4951
+ async function pn(e) {
4905
4952
  try {
4906
4953
  if (navigator.clipboard?.writeText) {
4907
4954
  await navigator.clipboard.writeText(e);
4908
4955
  return;
4909
4956
  }
4910
4957
  } catch {}
4911
- tn(e);
4958
+ fn(e);
4912
4959
  }
4913
- async function rn() {
4914
- if (Yt.value) {
4915
- $t.value = !0;
4960
+ async function U() {
4961
+ if (on.value) {
4962
+ un.value = !0;
4916
4963
  try {
4917
- await nn(Yt.value);
4964
+ await pn(on.value);
4918
4965
  } finally {
4919
4966
  window.setTimeout(() => {
4920
- $t.value = !1;
4967
+ un.value = !1;
4921
4968
  }, 1200);
4922
4969
  }
4923
4970
  }
4924
4971
  }
4925
- let an = v(null), on = v(null), sn, cn = n(() => G(M()) !== null), ln = n(() => M().root.length > 0), un = n(() => on.value ? `Copied ${on.value}` : cn.value ? "Copy selection as" : "Copy as");
4926
- async function dn(e, t) {
4927
- let n = M(), r = G(n) ? dr(n) : n.root;
4928
- r.length > 0 && (await nn(_a(r, e, ae.value)), on.value = t, window.clearTimeout(sn), sn = window.setTimeout(() => on.value = null, 1500)), P();
4972
+ let mn = v(null), hn = v(null), gn, _n = n(() => G(N()) !== null), vn = n(() => ot.value ? at.value.some((e) => C.value[e].root.length > 0) : N().root.length > 0), yn = n(() => {
4973
+ if (hn.value) return `Copied ${hn.value}`;
4974
+ let e = at.value.length;
4975
+ return e > 1 ? `Copy ${e} lines as` : e === 1 ? `Copy line ${at.value[0] + 1} as` : _n.value ? "Copy selection as" : "Copy as";
4976
+ });
4977
+ async function W(e, t) {
4978
+ let n = ot.value ? at.value.map((e) => C.value[e].root) : [G(N()) ? dr(N()) : N().root];
4979
+ n.some((e) => e.length > 0) && (await pn(va(n, e, ae.value)), hn.value = t, window.clearTimeout(gn), gn = window.setTimeout(() => hn.value = null, 1500)), F();
4929
4980
  }
4930
- let fn = n(() => ma.map(({ format: e, label: t }) => {
4981
+ let bn = n(() => ma.map(({ format: e, label: t }) => {
4931
4982
  let n = e === "mathml" && g.cellml ? `${t} (CellML)` : t;
4932
4983
  return {
4933
4984
  label: n,
4934
- command: () => dn(e, n)
4985
+ command: () => W(e, n)
4935
4986
  };
4936
4987
  }));
4937
- function pn(e) {
4938
- an.value?.toggle(e);
4988
+ function xn(e) {
4989
+ mn.value?.toggle(e);
4939
4990
  }
4940
- return (n, d) => (_(), a("div", ka, [o("section", {
4991
+ return (n, d) => (_(), a("div", Ma, [o("section", {
4941
4992
  class: m(["editor-grid", {
4942
4993
  "has-side": !!n.$slots.side,
4943
4994
  "no-outputs": !u.outputs,
4944
4995
  readonly: u.readonly
4945
4996
  }]),
4946
- onKeydownCapture: pt
4997
+ onKeydownCapture: Ct
4947
4998
  }, [
4948
4999
  o("div", {
4949
5000
  ref_key: "panelEl",
4950
- ref: Le,
5001
+ ref: Ie,
4951
5002
  class: "editor-panel"
4952
5003
  }, [
4953
5004
  o("div", {
4954
5005
  ref_key: "toolbarEl",
4955
- ref: Re,
4956
- class: m(["toolbar", { stuck: ze.value }]),
5006
+ ref: Le,
5007
+ class: m(["toolbar", { stuck: Re.value }]),
4957
5008
  role: "toolbar",
4958
5009
  "aria-label": "Equation tools"
4959
5010
  }, [
4960
5011
  o("div", {
4961
5012
  ref_key: "toolsEl",
4962
- ref: V,
5013
+ ref: At,
4963
5014
  class: "toolbar-group toolbar-tools"
4964
- }, [(_(!0), a(e, null, y(S(Oa), (e, t) => (_(), a("button", {
5015
+ }, [(_(!0), a(e, null, y(S(ja), (e, t) => (_(), a("button", {
4965
5016
  key: e.id,
4966
5017
  type: "button",
4967
5018
  class: m(["tool-button", {
4968
5019
  "has-gallery": !!e.sections,
4969
- overflowed: t >= St.value
5020
+ overflowed: t >= Mt.value
4970
5021
  }]),
4971
5022
  title: e.title,
4972
5023
  "data-role": `toolbar-${e.id}`,
@@ -4974,27 +5025,27 @@ var Ea = [
4974
5025
  "aria-haspopup": e.sections ? "true" : void 0,
4975
5026
  disabled: u.readonly,
4976
5027
  onMousedown: d[0] ||= E(() => {}, ["prevent"]),
4977
- onClick: (t) => vt(e, t)
4978
- }, [o("span", { innerHTML: bt(e.latex) }, null, 8, ja), e.sections ? (_(), a("i", Ma)) : i("", !0)], 42, Aa))), 128)), o("button", {
5028
+ onClick: (t) => Dt(e, t)
5029
+ }, [o("span", { innerHTML: kt(e.latex) }, null, 8, Pa), e.sections ? (_(), a("i", Fa)) : i("", !0)], 42, Na))), 128)), o("button", {
4979
5030
  ref_key: "moreEl",
4980
- ref: xt,
5031
+ ref: jt,
4981
5032
  type: "button",
4982
- class: m(["tool-button has-gallery", { overflowed: !Tt.value }]),
5033
+ class: m(["tool-button has-gallery", { overflowed: !Ft.value }]),
4983
5034
  title: "More tools",
4984
5035
  "aria-label": "More tools",
4985
5036
  "aria-haspopup": "true",
4986
5037
  "data-role": "toolbar-more",
4987
5038
  disabled: u.readonly,
4988
5039
  onMousedown: d[1] ||= E(() => {}, ["prevent"]),
4989
- onClick: d[2] ||= (e) => Tt.value && vt(Tt.value, e)
5040
+ onClick: d[2] ||= (e) => Ft.value && Dt(Ft.value, e)
4990
5041
  }, [...d[13] ||= [o("i", {
4991
5042
  class: "pi pi-ellipsis-h",
4992
5043
  "aria-hidden": "true"
4993
5044
  }, null, -1), o("i", {
4994
5045
  class: "pi pi-chevron-down tool-chevron",
4995
5046
  "aria-hidden": "true"
4996
- }, null, -1)]], 42, Na)], 512),
4997
- o("div", Pa, [
5047
+ }, null, -1)]], 42, Ia)], 512),
5048
+ o("div", La, [
4998
5049
  l(S(D), {
4999
5050
  icon: "pi pi-plus",
5000
5051
  size: "small",
@@ -5004,7 +5055,7 @@ var Ea = [
5004
5055
  "data-role": "add-line",
5005
5056
  disabled: u.readonly,
5006
5057
  onMousedown: d[3] ||= E(() => {}, ["prevent"]),
5007
- onClick: d[4] ||= (e) => We("new-line")
5058
+ onClick: d[4] ||= (e) => Ue("new-line")
5008
5059
  }, null, 8, ["disabled"]),
5009
5060
  l(S(D), {
5010
5061
  icon: "pi pi-trash",
@@ -5015,19 +5066,19 @@ var Ea = [
5015
5066
  "aria-label": "Remove equation line",
5016
5067
  disabled: u.readonly || C.value.length <= 1,
5017
5068
  onMousedown: d[5] ||= E(() => {}, ["prevent"]),
5018
- onClick: Ye
5069
+ onClick: Je
5019
5070
  }, null, 8, ["disabled"]),
5020
5071
  g.history ? (_(), r(S(D), {
5021
5072
  key: 0,
5022
5073
  icon: "pi pi-undo",
5023
5074
  size: "small",
5024
5075
  text: "",
5025
- title: `Undo (${S(ke)}+Z)`,
5076
+ title: `Undo (${S(Oe)}+Z)`,
5026
5077
  "aria-label": "Undo",
5027
5078
  "data-role": "undo",
5028
- disabled: u.readonly || !De.value,
5079
+ disabled: u.readonly || !Ee.value,
5029
5080
  onMousedown: d[6] ||= E(() => {}, ["prevent"]),
5030
- onClick: Te
5081
+ onClick: we
5031
5082
  }, null, 8, ["title", "disabled"])) : i("", !0),
5032
5083
  g.history ? (_(), r(S(D), {
5033
5084
  key: 1,
@@ -5035,84 +5086,84 @@ var Ea = [
5035
5086
  class: "redo-button",
5036
5087
  size: "small",
5037
5088
  text: "",
5038
- title: `Redo (${S(ke)}+Shift+Z)`,
5089
+ title: `Redo (${S(Oe)}+Shift+Z)`,
5039
5090
  "aria-label": "Redo",
5040
5091
  "data-role": "redo",
5041
- disabled: u.readonly || !L.value,
5092
+ disabled: u.readonly || !R.value,
5042
5093
  onMousedown: d[7] ||= E(() => {}, ["prevent"]),
5043
- onClick: Ee
5094
+ onClick: Te
5044
5095
  }, null, 8, ["title", "disabled"])) : i("", !0)
5045
5096
  ]),
5046
- u.outputs ? (_(), a("div", Fa, [l(S(D), {
5097
+ lt.value ? (_(), a("div", Ra, [l(S(D), {
5047
5098
  icon: "pi pi-copy",
5048
- label: un.value,
5099
+ label: yn.value,
5049
5100
  size: "small",
5050
5101
  text: "",
5051
- title: "Copy the selection, or the whole equation, as LaTeX, MathJSON or Content MathML",
5102
+ title: "Copy the selection, the whole equation, or the lines selected (Shift+click their numbers), as LaTeX, MathJSON or Content MathML",
5052
5103
  "aria-haspopup": "true",
5053
5104
  "aria-controls": "copy-as-menu",
5054
5105
  "data-role": "copy-as",
5055
- disabled: !ln.value,
5106
+ disabled: !vn.value,
5056
5107
  onMousedown: d[8] ||= E(() => {}, ["prevent"]),
5057
- onClick: pn
5108
+ onClick: xn
5058
5109
  }, null, 8, ["label", "disabled"]), l(S(de), {
5059
5110
  id: "copy-as-menu",
5060
5111
  ref_key: "copyMenu",
5061
- ref: an,
5062
- model: fn.value,
5112
+ ref: mn,
5113
+ model: bn.value,
5063
5114
  popup: !0
5064
5115
  }, null, 8, ["model"])])) : i("", !0)
5065
5116
  ], 2),
5066
5117
  l(S(fe), {
5067
5118
  ref_key: "gallery",
5068
- ref: ht,
5119
+ ref: Tt,
5069
5120
  "data-me-popover": "",
5070
5121
  "data-role": "gallery",
5071
5122
  class: "me-gallery"
5072
5123
  }, {
5073
- default: w(() => [gt.value ? (_(), a("div", Ia, [(_(!0), a(e, null, y(gt.value.sections, (t, n) => (_(), a("div", {
5124
+ default: w(() => [Et.value ? (_(), a("div", za, [(_(!0), a(e, null, y(Et.value.sections, (t, n) => (_(), a("div", {
5074
5125
  key: n,
5075
5126
  class: "gallery-section"
5076
- }, [t.label ? (_(), a("div", La, b(t.label), 1)) : i("", !0), o("div", Ra, [(_(!0), a(e, null, y(t.items, (e) => (_(), a("button", {
5127
+ }, [t.label ? (_(), a("div", Ba, b(t.label), 1)) : i("", !0), o("div", Va, [(_(!0), a(e, null, y(t.items, (e) => (_(), a("button", {
5077
5128
  key: e.title,
5078
5129
  type: "button",
5079
5130
  class: "tool-button",
5080
5131
  title: e.title,
5081
5132
  onMousedown: d[9] ||= E(() => {}, ["prevent"]),
5082
- onClick: (t) => yt(e.command)
5083
- }, [o("span", { innerHTML: bt(e.latex) }, null, 8, Ba)], 40, za))), 128))])]))), 128))])) : i("", !0)]),
5133
+ onClick: (t) => Ot(e.command)
5134
+ }, [o("span", { innerHTML: kt(e.latex) }, null, 8, Ua)], 40, Ha))), 128))])]))), 128))])) : i("", !0)]),
5084
5135
  _: 1
5085
5136
  }, 512),
5086
- (_(), r(t, { to: "body" }, [j.value === null ? i("", !0) : (_(), a("div", {
5137
+ (_(), r(t, { to: "body" }, [M.value === null ? i("", !0) : (_(), a("div", {
5087
5138
  key: 0,
5088
5139
  class: "command-list",
5089
5140
  "data-me-popover": "",
5090
5141
  "data-role": "command-list",
5091
- style: h(ut.value),
5142
+ style: h(bt.value),
5092
5143
  onMousedown: d[10] ||= E(() => {}, ["prevent"])
5093
5144
  }, [
5094
- o("span", Va, [
5145
+ o("span", Wa, [
5095
5146
  d[14] ||= o("span", { class: "command-slash" }, "\\", -1),
5096
- c(b(j.value), 1),
5147
+ c(b(M.value), 1),
5097
5148
  d[15] ||= o("span", { class: "command-caret" }, null, -1)
5098
5149
  ]),
5099
- ot.value.length ? (_(), a("ul", Ha, [(_(!0), a(e, null, y(ot.value, (e, t) => (_(), a("li", {
5150
+ ht.value.length ? (_(), a("ul", Ga, [(_(!0), a(e, null, y(ht.value, (e, t) => (_(), a("li", {
5100
5151
  key: e.name,
5101
- class: m(["command-option", { highlighted: t === st.value }]),
5152
+ class: m(["command-option", { highlighted: t === _t.value }]),
5102
5153
  role: "option",
5103
- "aria-selected": t === st.value,
5154
+ "aria-selected": t === _t.value,
5104
5155
  "data-command": e.name,
5105
- onClick: (e) => ct(t)
5156
+ onClick: (e) => vt(t)
5106
5157
  }, [
5107
5158
  o("span", {
5108
5159
  class: "command-preview",
5109
- innerHTML: bt(e.latex)
5110
- }, null, 8, Wa),
5111
- o("span", Ga, "\\" + b(e.name), 1),
5112
- o("span", Ka, b(e.title), 1)
5113
- ], 10, Ua))), 128))])) : i("", !0),
5114
- o("p", qa, [
5115
- ot.value.length ? (_(), a(e, { key: 0 }, [
5160
+ innerHTML: kt(e.latex)
5161
+ }, null, 8, qa),
5162
+ o("span", Ja, "\\" + b(e.name), 1),
5163
+ o("span", Ya, b(e.title), 1)
5164
+ ], 10, Ka))), 128))])) : i("", !0),
5165
+ o("p", Xa, [
5166
+ ht.value.length ? (_(), a(e, { key: 0 }, [
5116
5167
  d[16] ||= o("kbd", null, "↑", -1),
5117
5168
  d[17] ||= o("kbd", null, "↓", -1),
5118
5169
  d[18] ||= c(" choose · ", -1),
@@ -5127,56 +5178,60 @@ var Ea = [
5127
5178
  ], 36))])),
5128
5179
  o("div", {
5129
5180
  ref_key: "stackEl",
5130
- ref: qe,
5181
+ ref: Ke,
5131
5182
  class: "equations-stack",
5132
- onKeydown: mt,
5133
- onFocusout: Je
5183
+ onMousedown: ft,
5184
+ onKeydown: wt,
5185
+ onFocusout: qe
5134
5186
  }, [(_(!0), a(e, null, y(C.value, (e, t) => (_(), a("div", {
5135
5187
  key: O.value[t],
5136
5188
  class: m(["equation-row", [
5137
5189
  {
5138
- active: t === A.value,
5139
- dragging: t === B.value
5190
+ active: t === j.value,
5191
+ dragging: t === V.value,
5192
+ "line-selected": st(t)
5140
5193
  },
5141
- Rt(t),
5142
- it(t)
5194
+ Jt(t),
5195
+ rt(t)
5143
5196
  ]]),
5144
5197
  "data-line": t,
5145
5198
  "data-line-id": O.value[t],
5146
- onFocusin: (e) => Ke(t),
5147
- onDragover: (e) => tt(t, e),
5148
- onDrop: nt
5199
+ "data-selected": st(t) || void 0,
5200
+ onFocusin: (e) => Ge(t),
5201
+ onDragover: (e) => et(t, e),
5202
+ onDrop: tt
5149
5203
  }, [o("div", {
5150
5204
  class: "equation-label",
5151
5205
  "data-role": "line-handle",
5152
- draggable: Xe.value ? "true" : void 0,
5153
- title: Xe.value ? `Drag to reorder (${S(Ae)}+↑/↓)` : void 0,
5154
- onDragstart: (e) => et(t, e),
5155
- onDragend: rt
5156
- }, [o("span", Xa, b(t + 1), 1), Rt(t) ? (_(), a("i", {
5206
+ draggable: Ye.value ? "true" : void 0,
5207
+ title: pt.value,
5208
+ onMousedown: (e) => dt(t, e),
5209
+ onDragstart: (e) => $e(t, e),
5210
+ onDragend: nt
5211
+ }, [o("span", $a, b(t + 1), 1), Jt(t) ? (_(), a("i", {
5157
5212
  key: 0,
5158
- class: m(["pi line-problem", Rt(t) === "has-error" ? "pi-exclamation-circle" : "pi-exclamation-triangle"]),
5213
+ class: m(["pi line-problem", Jt(t) === "has-error" ? "pi-exclamation-circle" : "pi-exclamation-triangle"]),
5159
5214
  role: "img",
5160
- "aria-label": Vt(t),
5161
- title: Vt(t),
5215
+ "aria-label": Zt(t),
5216
+ title: Zt(t),
5162
5217
  "data-role": "line-problem",
5163
- "data-kind": Rt(t) === "has-error" ? "error" : "units"
5164
- }, null, 10, Za)) : i("", !0)], 40, Ya), l(Qi, {
5218
+ "data-kind": Jt(t) === "has-error" ? "error" : "units"
5219
+ }, null, 10, eo)) : i("", !0)], 40, Qa), l(Qi, {
5165
5220
  ref_for: !0,
5166
- ref: (e) => be.value[t] = e,
5221
+ ref: (e) => ye.value[t] = e,
5167
5222
  class: "equation-field",
5168
5223
  "model-value": e.root,
5169
5224
  cursor: e.cursor,
5170
5225
  anchor: e.anchor ?? null,
5171
- active: t === A.value,
5226
+ active: t === j.value,
5172
5227
  readonly: u.readonly,
5173
- autofocus: u.autofocus && t === A.value ? !0 : void 0,
5174
- marks: H.value[t],
5228
+ autofocus: u.autofocus && t === j.value ? !0 : void 0,
5229
+ marks: Kt.value[t],
5175
5230
  "greek-names": u.greekNames,
5176
5231
  "typeset-names": u.typesetNames,
5177
- onNavigate: (e) => Ne(t, e),
5178
- onEdit: (e, n) => je(t, e, n),
5179
- onImport: (e) => Ie(t, e)
5232
+ onNavigate: (e) => Me(t, e),
5233
+ onEdit: (e, n) => Ae(t, e, n),
5234
+ onImport: (e) => Fe(t, e)
5180
5235
  }, null, 8, [
5181
5236
  "model-value",
5182
5237
  "cursor",
@@ -5190,74 +5245,81 @@ var Ea = [
5190
5245
  "onNavigate",
5191
5246
  "onEdit",
5192
5247
  "onImport"
5193
- ])], 42, Ja))), 128))], 544),
5194
- o("div", Qa, [zt.value ? (_(), a("div", {
5248
+ ])], 42, Za))), 128))], 544),
5249
+ o("div", to, [Yt.value ? (_(), a("div", {
5195
5250
  key: 0,
5196
- class: m(["status-bar", `status-${zt.value.kind}`]),
5251
+ class: m(["status-bar", `status-${Yt.value.kind}`]),
5197
5252
  "data-role": "status",
5198
- "data-kind": zt.value.kind,
5199
- title: Bt.value || void 0,
5253
+ "data-kind": Yt.value.kind,
5254
+ title: Xt.value || void 0,
5200
5255
  onMousedown: d[11] ||= E(() => {}, ["prevent"]),
5201
- onClick: Ht
5202
- }, [o("span", eo, b(zt.value.text), 1), zt.value.more ? (_(), a("span", to, "+" + b(zt.value.more) + " more", 1)) : i("", !0)], 42, $a)) : i("", !0)]),
5203
- u.debug ? (_(), a("p", no, [
5256
+ onClick: Qt
5257
+ }, [o("span", ro, b(Yt.value.text), 1), Yt.value.more ? (_(), a("span", io, "+" + b(Yt.value.more) + " more", 1)) : i("", !0)], 42, no)) : i("", !0)]),
5258
+ u.debug ? (_(), a("p", ao, [
5204
5259
  d[26] ||= c(" Cursor: ", -1),
5205
- o("span", ro, b(Zt.value), 1),
5206
- Qt.value ? (_(), a(e, { key: 0 }, [d[25] ||= c(" · Selection: ", -1), o("span", io, b(Qt.value), 1)], 64)) : i("", !0)
5260
+ o("span", oo, b(cn.value), 1),
5261
+ ln.value ? (_(), a(e, { key: 0 }, [d[25] ||= c(" · Selection: ", -1), o("span", so, b(ln.value), 1)], 64)) : i("", !0)
5207
5262
  ])) : i("", !0),
5208
- o("details", ao, [
5209
- d[58] ||= o("summary", null, "Keys and typing", -1),
5210
- o("p", oo, [
5211
- d[27] ||= s("<kbd data-v-bd4a6d07>←</kbd><kbd data-v-bd4a6d07>→</kbd> move through every position · <kbd data-v-bd4a6d07>↑</kbd><kbd data-v-bd4a6d07>↓</kbd> numerator/denominator, else previous/next line · <kbd data-v-bd4a6d07>Home</kbd><kbd data-v-bd4a6d07>End</kbd> start/end · <kbd data-v-bd4a6d07>Tab</kbd> next empty slot · <kbd data-v-bd4a6d07>Space</kbd> step out of a fraction, exponent or bracket · <kbd data-v-bd4a6d07>Enter</kbd> new line (in a piecewise: new piece; <kbd data-v-bd4a6d07>Backspace</kbd> in an empty piece removes it; <code data-v-bd4a6d07>\\otherwise</code> adds one) · ", 19),
5212
- o("kbd", null, b(S(Ae)), 1),
5213
- d[28] ||= c("+", -1),
5214
- d[29] ||= o("kbd", null, "↑", -1),
5215
- d[30] ||= o("kbd", null, "↓", -1),
5216
- d[31] ||= c(" move the line up/down, or drag it by its number ", -1)
5217
- ]),
5218
- o("p", so, [
5219
- d[32] ||= c(" Select with ", -1),
5220
- d[33] ||= o("kbd", null, "Shift", -1),
5221
- d[34] ||= c("+", -1),
5222
- d[35] ||= o("kbd", null, "←", -1),
5223
- d[36] ||= o("kbd", null, "→", -1),
5224
- d[37] ||= c(", ", -1),
5225
- d[38] ||= o("kbd", null, "Shift", -1),
5226
- d[39] ||= c("+", -1),
5227
- d[40] ||= o("kbd", null, "Home", -1),
5228
- d[41] ||= o("kbd", null, "End", -1),
5229
- d[42] ||= c(", ", -1),
5230
- o("kbd", null, b(S(ke)), 1),
5231
- d[43] ||= s("+<kbd data-v-bd4a6d07>A</kbd> or by dragging · <code data-v-bd4a6d07>/</code>, <code data-v-bd4a6d07>^</code>, <code data-v-bd4a6d07>(</code>, <code data-v-bd4a6d07>|</code>, <code data-v-bd4a6d07>\\sqrt</code>, <code data-v-bd4a6d07>\\sin</code>, … or a toolbar button then wraps the selection · typing replaces it · <kbd data-v-bd4a6d07>Esc</kbd> clears it · ", 17),
5263
+ o("details", co, [
5264
+ d[62] ||= o("summary", null, "Keys and typing", -1),
5265
+ o("p", lo, [
5266
+ d[31] ||= s("<kbd data-v-1c2a07cd>←</kbd><kbd data-v-1c2a07cd>→</kbd> move through every position · <kbd data-v-1c2a07cd>↑</kbd><kbd data-v-1c2a07cd>↓</kbd> numerator/denominator, else previous/next line · <kbd data-v-1c2a07cd>Home</kbd><kbd data-v-1c2a07cd>End</kbd> start/end · <kbd data-v-1c2a07cd>Tab</kbd> next empty slot · <kbd data-v-1c2a07cd>Space</kbd> step out of a fraction, exponent or bracket · <kbd data-v-1c2a07cd>Enter</kbd> new line (in a piecewise: new piece; <kbd data-v-1c2a07cd>Backspace</kbd> in an empty piece removes it; <code data-v-1c2a07cd>\\otherwise</code> adds one) · ", 19),
5232
5267
  o("kbd", null, b(S(ke)), 1),
5233
- d[44] ||= c("+", -1),
5234
- d[45] ||= o("kbd", null, "C", -1),
5235
- d[46] ||= c("/", -1),
5236
- d[47] ||= o("kbd", null, "X", -1),
5237
- d[48] ||= c("/", -1),
5238
- d[49] ||= o("kbd", null, "V", -1),
5239
- d[50] ||= c(" copy, cut and paste (copies as LaTeX for other apps; pastes LaTeX or plain text such as ", -1),
5240
- d[51] ||= o("code", null, "(x+1)/2", -1),
5241
- d[52] ||= c(") ", -1)
5268
+ d[32] ||= c("+", -1),
5269
+ d[33] ||= o("kbd", null, "↑", -1),
5270
+ d[34] ||= o("kbd", null, "↓", -1),
5271
+ d[35] ||= c(" move the line up/down, or drag it by its number", -1),
5272
+ lt.value ? (_(), a(e, { key: 0 }, [
5273
+ d[27] ||= c(" · ", -1),
5274
+ d[28] ||= o("kbd", null, "Shift", -1),
5275
+ d[29] ||= c("+click or ", -1),
5276
+ o("kbd", null, b(S(Oe)), 1),
5277
+ d[30] ||= c("+click line numbers to select lines for \"Copy as\"", -1)
5278
+ ], 64)) : i("", !0)
5242
5279
  ]),
5243
- o("p", co, [d[57] ||= s(" Type letters, numbers and <code data-v-bd4a6d07>+ − * = ,</code> where the caret is · conditions: <code data-v-bd4a6d07>&lt; &gt; &lt;= &gt;= !=</code>, <code data-v-bd4a6d07>&amp;</code> (∧), <code data-v-bd4a6d07>!</code> (¬), <code data-v-bd4a6d07>\\or</code> (∨) · <code data-v-bd4a6d07>/</code> makes a fraction of what&#39;s before the caret · <code data-v-bd4a6d07>^</code> exponent · <code data-v-bd4a6d07>( )</code> and <code data-v-bd4a6d07>| |</code> brackets · <code data-v-bd4a6d07>0.25{mV}</code> a number&#39;s units · letters, digits and <code data-v-bd4a6d07>_</code> with no operator between them are one name (<code data-v-bd4a6d07>Vm_init</code>); multiply names with <code data-v-bd4a6d07>*</code> (<code data-v-bd4a6d07>a*b</code>) · a name spelling a function (<code data-v-bd4a6d07>sin</code>, <code data-v-bd4a6d07>cosh</code>, …) is that function · <code data-v-bd4a6d07>\\</code> commands (<code data-v-bd4a6d07>\\frac \\sqrt \\root \\abs \\dd \\cases \\sin \\pi \\e \\inf \\alpha</code> …) · <kbd data-v-bd4a6d07>Backspace</kbd>/<kbd data-v-bd4a6d07>Delete</kbd> delete", 41), g.history ? (_(), a(e, { key: 0 }, [
5244
- d[53] ||= c(" · ", -1),
5245
- o("kbd", null, b(S(ke)), 1),
5246
- d[54] ||= c("+", -1),
5247
- d[55] ||= o("kbd", null, "Z", -1),
5248
- d[56] ||= c(" undo", -1)
5280
+ o("p", uo, [
5281
+ d[36] ||= c(" Select with ", -1),
5282
+ d[37] ||= o("kbd", null, "Shift", -1),
5283
+ d[38] ||= c("+", -1),
5284
+ d[39] ||= o("kbd", null, "←", -1),
5285
+ d[40] ||= o("kbd", null, "→", -1),
5286
+ d[41] ||= c(", ", -1),
5287
+ d[42] ||= o("kbd", null, "Shift", -1),
5288
+ d[43] ||= c("+", -1),
5289
+ d[44] ||= o("kbd", null, "Home", -1),
5290
+ d[45] ||= o("kbd", null, "End", -1),
5291
+ d[46] ||= c(", ", -1),
5292
+ o("kbd", null, b(S(Oe)), 1),
5293
+ d[47] ||= s("+<kbd data-v-1c2a07cd>A</kbd> or by dragging · <code data-v-1c2a07cd>/</code>, <code data-v-1c2a07cd>^</code>, <code data-v-1c2a07cd>(</code>, <code data-v-1c2a07cd>|</code>, <code data-v-1c2a07cd>\\sqrt</code>, <code data-v-1c2a07cd>\\sin</code>, … or a toolbar button then wraps the selection · typing replaces it · <kbd data-v-1c2a07cd>Esc</kbd> clears it · ", 17),
5294
+ o("kbd", null, b(S(Oe)), 1),
5295
+ d[48] ||= c("+", -1),
5296
+ d[49] ||= o("kbd", null, "C", -1),
5297
+ d[50] ||= c("/", -1),
5298
+ d[51] ||= o("kbd", null, "X", -1),
5299
+ d[52] ||= c("/", -1),
5300
+ d[53] ||= o("kbd", null, "V", -1),
5301
+ d[54] ||= c(" copy, cut and paste (copies as LaTeX for other apps; pastes LaTeX or plain text such as ", -1),
5302
+ d[55] ||= o("code", null, "(x+1)/2", -1),
5303
+ d[56] ||= c(") ", -1)
5304
+ ]),
5305
+ o("p", fo, [d[61] ||= s(" Type letters, numbers and <code data-v-1c2a07cd>+ − * = ,</code> where the caret is · conditions: <code data-v-1c2a07cd>&lt; &gt; &lt;= &gt;= !=</code>, <code data-v-1c2a07cd>&amp;</code> (∧), <code data-v-1c2a07cd>!</code> (¬), <code data-v-1c2a07cd>\\or</code> (∨) · <code data-v-1c2a07cd>/</code> makes a fraction of what&#39;s before the caret · <code data-v-1c2a07cd>^</code> exponent · <code data-v-1c2a07cd>( )</code> and <code data-v-1c2a07cd>| |</code> brackets · <code data-v-1c2a07cd>0.25{mV}</code> a number&#39;s units · letters, digits and <code data-v-1c2a07cd>_</code> with no operator between them are one name (<code data-v-1c2a07cd>Vm_init</code>); multiply names with <code data-v-1c2a07cd>*</code> (<code data-v-1c2a07cd>a*b</code>) · a name spelling a function (<code data-v-1c2a07cd>sin</code>, <code data-v-1c2a07cd>cosh</code>, …) is that function · <code data-v-1c2a07cd>\\</code> commands (<code data-v-1c2a07cd>\\frac \\sqrt \\root \\abs \\dd \\cases \\sin \\pi \\e \\inf \\alpha</code> …) · <kbd data-v-1c2a07cd>Backspace</kbd>/<kbd data-v-1c2a07cd>Delete</kbd> delete", 41), g.history ? (_(), a(e, { key: 0 }, [
5306
+ d[57] ||= c(" · ", -1),
5307
+ o("kbd", null, b(S(Oe)), 1),
5308
+ d[58] ||= c("+", -1),
5309
+ d[59] ||= o("kbd", null, "Z", -1),
5310
+ d[60] ||= c(" undo", -1)
5249
5311
  ], 64)) : i("", !0)])
5250
5312
  ])
5251
5313
  ], 512),
5252
- n.$slots.side ? (_(), a("aside", lo, [ne(n.$slots, "side", {}, void 0, !0)])) : i("", !0),
5314
+ n.$slots.side ? (_(), a("aside", po, [ne(n.$slots, "side", {}, void 0, !0)])) : i("", !0),
5253
5315
  u.outputs ? (_(), r(S(ue), {
5254
5316
  key: 1,
5255
5317
  class: "output-card",
5256
5318
  "data-role": "outputs"
5257
5319
  }, {
5258
5320
  content: w(() => [l(S(_e), {
5259
- value: en.value,
5260
- "onUpdate:value": d[12] ||= (e) => en.value = e
5321
+ value: dn.value,
5322
+ "onUpdate:value": d[12] ||= (e) => dn.value = e
5261
5323
  }, {
5262
5324
  default: w(() => [l(S(me), null, {
5263
5325
  default: w(() => [
@@ -5265,7 +5327,7 @@ var Ea = [
5265
5327
  value: "mathml",
5266
5328
  "data-role": "tab-mathml"
5267
5329
  }, {
5268
- default: w(() => [d[59] ||= c(" Content MathML ", -1), u.cellml ? (_(), r(S(ve), {
5330
+ default: w(() => [d[63] ||= c(" Content MathML ", -1), u.cellml ? (_(), r(S(ve), {
5269
5331
  key: 0,
5270
5332
  class: "tab-tag",
5271
5333
  severity: "secondary",
@@ -5278,21 +5340,21 @@ var Ea = [
5278
5340
  value: "mathjson",
5279
5341
  "data-role": "tab-mathjson"
5280
5342
  }, {
5281
- default: w(() => [...d[60] ||= [c("MathJSON", -1)]]),
5343
+ default: w(() => [...d[64] ||= [c("MathJSON", -1)]]),
5282
5344
  _: 1
5283
5345
  }),
5284
5346
  l(S(pe), {
5285
5347
  value: "latex",
5286
5348
  "data-role": "tab-latex"
5287
5349
  }, {
5288
- default: w(() => [...d[61] ||= [c("LaTeX", -1)]]),
5350
+ default: w(() => [...d[65] ||= [c("LaTeX", -1)]]),
5289
5351
  _: 1
5290
5352
  }),
5291
5353
  l(S(pe), {
5292
5354
  value: "ast",
5293
5355
  "data-role": "tab-ast"
5294
5356
  }, {
5295
- default: w(() => [...d[62] ||= [c("AST", -1)]]),
5357
+ default: w(() => [...d[66] ||= [c("AST", -1)]]),
5296
5358
  _: 1
5297
5359
  })
5298
5360
  ]),
@@ -5300,26 +5362,26 @@ var Ea = [
5300
5362
  }), l(S(ge), null, {
5301
5363
  default: w(() => [
5302
5364
  l(S(he), { value: "mathml" }, {
5303
- default: w(() => [o("pre", uo, b(Xt.value), 1)]),
5365
+ default: w(() => [o("pre", mo, b(sn.value), 1)]),
5304
5366
  _: 1
5305
5367
  }),
5306
5368
  l(S(he), { value: "mathjson" }, {
5307
- default: w(() => [o("div", fo, [l(S(D), {
5369
+ default: w(() => [o("div", ho, [l(S(D), {
5308
5370
  icon: "pi pi-copy",
5309
- label: $t.value ? "Copied" : "Copy MathJSON",
5371
+ label: un.value ? "Copied" : "Copy MathJSON",
5310
5372
  size: "small",
5311
5373
  text: "",
5312
- disabled: !Yt.value,
5313
- onClick: rn
5314
- }, null, 8, ["label", "disabled"])]), o("pre", po, b(Yt.value), 1)]),
5374
+ disabled: !on.value,
5375
+ onClick: U
5376
+ }, null, 8, ["label", "disabled"])]), o("pre", go, b(on.value), 1)]),
5315
5377
  _: 1
5316
5378
  }),
5317
5379
  l(S(he), { value: "latex" }, {
5318
- default: w(() => [o("pre", mo, b(Jt.value), 1)]),
5380
+ default: w(() => [o("pre", _o, b(an.value), 1)]),
5319
5381
  _: 1
5320
5382
  }),
5321
5383
  l(S(he), { value: "ast" }, {
5322
- default: w(() => [o("pre", ho, b(qt.value ? JSON.stringify(qt.value, null, 2) : ""), 1)]),
5384
+ default: w(() => [o("pre", vo, b(rn.value ? JSON.stringify(rn.value, null, 2) : ""), 1)]),
5323
5385
  _: 1
5324
5386
  })
5325
5387
  ]),
@@ -5331,7 +5393,7 @@ var Ea = [
5331
5393
  })) : i("", !0)
5332
5394
  ], 34)]));
5333
5395
  }
5334
- }), [["__scopeId", "data-v-bd4a6d07"]]), vo = "new units", yo = [
5396
+ }), [["__scopeId", "data-v-1c2a07cd"]]), xo = "new units", So = [
5335
5397
  "yotta",
5336
5398
  "zetta",
5337
5399
  "exa",
@@ -5352,15 +5414,15 @@ var Ea = [
5352
5414
  "atto",
5353
5415
  "zepto",
5354
5416
  "yocto"
5355
- ], bo = /^[A-Za-z_][A-Za-z0-9_]*$/;
5356
- function xo(e, t, n) {
5417
+ ], Co = /^[A-Za-z_][A-Za-z0-9_]*$/;
5418
+ function wo(e, t, n) {
5357
5419
  let r = [], { name: i, parts: a } = e;
5358
- return i ? bo.test(i) ? (t.some((e) => e.name === i) || n?.includes(i)) && r.push(`There are units called ${i} already`) : r.push(`${i} isn't a units name: use letters, digits and _, not starting with a digit`) : r.push("Give the units a name"), a.length === 0 && r.push("Add what the units are made of"), a.forEach((e, o) => {
5420
+ return i ? Co.test(i) ? (t.some((e) => e.name === i) || n?.includes(i)) && r.push(`There are units called ${i} already`) : r.push(`${i} isn't a units name: use letters, digits and _, not starting with a digit`) : r.push("Give the units a name"), a.length === 0 && r.push("Add what the units are made of"), a.forEach((e, o) => {
5359
5421
  let s = a.length > 1 ? `Part ${o + 1}: ` : "";
5360
- e.units ? e.units === i ? r.push(`${s}units can't be made of themselves`) : n && !n.includes(e.units) && !t.some((t) => t.name === e.units) && r.push(`${s}no units called ${e.units} are defined`) : r.push(`${s}choose the units it is made of`), e.prefix && !yo.includes(e.prefix) && r.push(`${s}${e.prefix} isn't a prefix`), e.exponent !== void 0 && !Number.isFinite(e.exponent) && r.push(`${s}the exponent must be a number`), e.multiplier !== void 0 && !Number.isFinite(e.multiplier) && r.push(`${s}the multiplier must be a number`);
5361
- }), i && bo.test(i) && So(i, a, t) && r.push(`${i} would be made of itself, through other new units`), r;
5422
+ e.units ? e.units === i ? r.push(`${s}units can't be made of themselves`) : n && !n.includes(e.units) && !t.some((t) => t.name === e.units) && r.push(`${s}no units called ${e.units} are defined`) : r.push(`${s}choose the units it is made of`), e.prefix && !So.includes(e.prefix) && r.push(`${s}${e.prefix} isn't a prefix`), e.exponent !== void 0 && !Number.isFinite(e.exponent) && r.push(`${s}the exponent must be a number`), e.multiplier !== void 0 && !Number.isFinite(e.multiplier) && r.push(`${s}the multiplier must be a number`);
5423
+ }), i && Co.test(i) && To(i, a, t) && r.push(`${i} would be made of itself, through other new units`), r;
5362
5424
  }
5363
- function So(e, t, n) {
5425
+ function To(e, t, n) {
5364
5426
  let r = /* @__PURE__ */ new Set(), i = (t) => {
5365
5427
  if (t === e) return !0;
5366
5428
  if (r.has(t)) return !1;
@@ -5370,17 +5432,17 @@ function So(e, t, n) {
5370
5432
  };
5371
5433
  return t.some((t) => t.units !== e && i(t.units));
5372
5434
  }
5373
- function Co(e, t) {
5435
+ function Eo(e, t) {
5374
5436
  return t.filter((t) => t.parts.some((t) => t.units === e)).map((e) => e.name);
5375
5437
  }
5376
- function wo(e) {
5438
+ function Do(e) {
5377
5439
  return e.parts.map((e) => {
5378
5440
  let t = [e.multiplier !== void 0 && e.multiplier !== 1 ? e.multiplier : ""].concat(e.prefix ?? "", e.units).filter((e) => e !== "").join(" "), n = e.exponent ?? 1;
5379
5441
  return n === 1 ? t : t.includes(" ") ? `(${t})^${n}` : `${t}^${n}`;
5380
5442
  }).join(" · ");
5381
5443
  }
5382
- var To = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
5383
- function Eo(e, t = "new_units") {
5444
+ var Oo = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
5445
+ function ko(e, t = "new_units") {
5384
5446
  let n = [], r = (t, i) => {
5385
5447
  if (!(n.includes(t) || i.has(t.name))) {
5386
5448
  i.add(t.name);
@@ -5394,20 +5456,20 @@ function Eo(e, t = "new_units") {
5394
5456
  for (let t of e) r(t, /* @__PURE__ */ new Set());
5395
5457
  let i = n.map((e) => {
5396
5458
  let t = e.parts.map((e) => ` <unit${[
5397
- e.prefix ? ` prefix="${To(e.prefix)}"` : "",
5398
- ` units="${To(e.units)}"`,
5459
+ e.prefix ? ` prefix="${Oo(e.prefix)}"` : "",
5460
+ ` units="${Oo(e.units)}"`,
5399
5461
  e.exponent !== void 0 && e.exponent !== 1 ? ` exponent="${e.exponent}"` : "",
5400
5462
  e.multiplier !== void 0 && e.multiplier !== 1 ? ` multiplier="${e.multiplier}"` : ""
5401
5463
  ].join("")}/>`);
5402
5464
  return [
5403
- ` <units name="${To(e.name)}">`,
5465
+ ` <units name="${Oo(e.name)}">`,
5404
5466
  ...t,
5405
5467
  " </units>"
5406
5468
  ].join("\n");
5407
5469
  });
5408
5470
  return [
5409
5471
  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
5410
- `<model xmlns="http://www.cellml.org/cellml/2.0#" name="${To(t)}">`,
5472
+ `<model xmlns="http://www.cellml.org/cellml/2.0#" name="${Oo(t)}">`,
5411
5473
  ...i,
5412
5474
  "</model>",
5413
5475
  ""
@@ -5415,15 +5477,15 @@ function Eo(e, t = "new_units") {
5415
5477
  }
5416
5478
  //#endregion
5417
5479
  //#region src/units/UnitsDefinitionForm.vue?vue&type=script&setup=true&lang.ts
5418
- var Do = { class: "form-name" }, Oo = { class: "form-parts" }, ko = ["onUpdate:modelValue", "aria-label"], Ao = ["value"], jo = [
5480
+ var Ao = { class: "form-name" }, jo = { class: "form-parts" }, Mo = ["onUpdate:modelValue", "aria-label"], No = ["value"], Po = [
5419
5481
  "onUpdate:modelValue",
5420
5482
  "list",
5421
5483
  "aria-label"
5422
- ], Mo = ["onUpdate:modelValue", "aria-label"], No = ["onUpdate:modelValue", "aria-label"], Po = ["id"], Fo = ["value"], Io = {
5484
+ ], Fo = ["onUpdate:modelValue", "aria-label"], Io = ["onUpdate:modelValue", "aria-label"], Lo = ["id"], Ro = ["value"], zo = {
5423
5485
  key: 0,
5424
5486
  class: "form-problems",
5425
5487
  "data-role": "units-form-problems"
5426
- }, Lo = { class: "form-actions" }, Ro = /*#__PURE__*/ Zi(/* @__PURE__ */ u({
5488
+ }, Bo = { class: "form-actions" }, Vo = /*#__PURE__*/ Zi(/* @__PURE__ */ u({
5427
5489
  __name: "UnitsDefinitionForm",
5428
5490
  props: {
5429
5491
  definition: {},
@@ -5450,7 +5512,7 @@ var Do = { class: "form-name" }, Oo = { class: "form-parts" }, ko = ["onUpdate:m
5450
5512
  ...n !== void 0 && n !== 1 ? { multiplier: n } : {}
5451
5513
  };
5452
5514
  })
5453
- })), te = n(() => xo(ee.value, s.others, s.known));
5515
+ })), te = n(() => wo(ee.value, s.others, s.known));
5454
5516
  function g() {
5455
5517
  m.value = !0, te.value.length === 0 && c("save", ee.value);
5456
5518
  }
@@ -5460,7 +5522,7 @@ var Do = { class: "form-name" }, Oo = { class: "form-parts" }, ko = ["onUpdate:m
5460
5522
  "data-role": "units-form",
5461
5523
  onSubmit: E(g, ["prevent"])
5462
5524
  }, [
5463
- o("label", Do, [r[3] ||= o("span", null, "Name", -1), T(o("input", {
5525
+ o("label", Ao, [r[3] ||= o("span", null, "Name", -1), T(o("input", {
5464
5526
  "onUpdate:modelValue": r[0] ||= (e) => f.value = e,
5465
5527
  type: "text",
5466
5528
  spellcheck: "false",
@@ -5468,7 +5530,7 @@ var Do = { class: "form-name" }, Oo = { class: "form-parts" }, ko = ["onUpdate:m
5468
5530
  placeholder: "mV_per_ms",
5469
5531
  "data-role": "units-form-name"
5470
5532
  }, null, 512), [[se, f.value]])]),
5471
- o("table", Oo, [r[5] ||= o("thead", null, [o("tr", null, [
5533
+ o("table", jo, [r[5] ||= o("thead", null, [o("tr", null, [
5472
5534
  o("th", { scope: "col" }, "Prefix"),
5473
5535
  o("th", { scope: "col" }, "Units"),
5474
5536
  o("th", {
@@ -5487,10 +5549,10 @@ var Do = { class: "form-name" }, Oo = { class: "form-parts" }, ko = ["onUpdate:m
5487
5549
  o("td", null, [T(o("select", {
5488
5550
  "onUpdate:modelValue": (e) => t.prefix = e,
5489
5551
  "aria-label": `Prefix of part ${n + 1}`
5490
- }, [r[4] ||= o("option", { value: "" }, "—", -1), (_(!0), a(e, null, y(S(yo), (e) => (_(), a("option", {
5552
+ }, [r[4] ||= o("option", { value: "" }, "—", -1), (_(!0), a(e, null, y(S(So), (e) => (_(), a("option", {
5491
5553
  key: e,
5492
5554
  value: e
5493
- }, b(e), 9, Ao))), 128))], 8, ko), [[oe, t.prefix]])]),
5555
+ }, b(e), 9, No))), 128))], 8, Mo), [[oe, t.prefix]])]),
5494
5556
  o("td", null, [T(o("input", {
5495
5557
  "onUpdate:modelValue": (e) => t.units = e,
5496
5558
  type: "text",
@@ -5499,7 +5561,7 @@ var Do = { class: "form-name" }, Oo = { class: "form-parts" }, ko = ["onUpdate:m
5499
5561
  autocomplete: "off",
5500
5562
  placeholder: "second",
5501
5563
  "aria-label": `Units of part ${n + 1}`
5502
- }, null, 8, jo), [[se, t.units]])]),
5564
+ }, null, 8, Po), [[se, t.units]])]),
5503
5565
  o("td", null, [T(o("input", {
5504
5566
  "onUpdate:modelValue": (e) => t.exponent = e,
5505
5567
  class: "number",
@@ -5507,7 +5569,7 @@ var Do = { class: "form-name" }, Oo = { class: "form-parts" }, ko = ["onUpdate:m
5507
5569
  inputmode: "decimal",
5508
5570
  placeholder: "1",
5509
5571
  "aria-label": `Exponent of part ${n + 1}`
5510
- }, null, 8, Mo), [[se, t.exponent]])]),
5572
+ }, null, 8, Fo), [[se, t.exponent]])]),
5511
5573
  o("td", null, [T(o("input", {
5512
5574
  "onUpdate:modelValue": (e) => t.multiplier = e,
5513
5575
  class: "number",
@@ -5515,7 +5577,7 @@ var Do = { class: "form-name" }, Oo = { class: "form-parts" }, ko = ["onUpdate:m
5515
5577
  inputmode: "decimal",
5516
5578
  placeholder: "1",
5517
5579
  "aria-label": `Multiplier of part ${n + 1}`
5518
- }, null, 8, No), [[se, t.multiplier]])]),
5580
+ }, null, 8, Io), [[se, t.multiplier]])]),
5519
5581
  o("td", null, [l(S(D), {
5520
5582
  icon: "pi pi-times",
5521
5583
  size: "small",
@@ -5535,9 +5597,9 @@ var Do = { class: "form-name" }, Oo = { class: "form-parts" }, ko = ["onUpdate:m
5535
5597
  o("datalist", { id: S(ne) }, [(_(!0), a(e, null, y(t.choices, (e) => (_(), a("option", {
5536
5598
  key: e,
5537
5599
  value: e
5538
- }, null, 8, Fo))), 128))], 8, Po),
5539
- m.value && te.value.length ? (_(), a("ul", Io, [(_(!0), a(e, null, y(te.value, (e) => (_(), a("li", { key: e }, b(e), 1))), 128))])) : i("", !0),
5540
- o("div", Lo, [
5600
+ }, null, 8, Ro))), 128))], 8, Lo),
5601
+ m.value && te.value.length ? (_(), a("ul", zo, [(_(!0), a(e, null, y(te.value, (e) => (_(), a("li", { key: e }, b(e), 1))), 128))])) : i("", !0),
5602
+ o("div", Bo, [
5541
5603
  l(S(D), {
5542
5604
  icon: "pi pi-plus",
5543
5605
  label: "Part",
@@ -5568,7 +5630,7 @@ var Do = { class: "form-name" }, Oo = { class: "form-parts" }, ko = ["onUpdate:m
5568
5630
  }), [["__scopeId", "data-v-effe158e"]]);
5569
5631
  //#endregion
5570
5632
  //#region src/units/panel.ts
5571
- function zo(e, t, n) {
5633
+ function Ho(e, t, n) {
5572
5634
  let r = [...new Set(e.flatMap((e) => e.variables))], i = Object.keys(t).filter((e) => !r.includes(e)), a = n ? new Set(n) : null;
5573
5635
  return [...r, ...i].map((e) => {
5574
5636
  let n = t[e] ?? "", i = n ? a && !a.has(n) ? "unknown" : "ok" : "missing";
@@ -5580,11 +5642,11 @@ function zo(e, t, n) {
5580
5642
  };
5581
5643
  });
5582
5644
  }
5583
- function Bo(e, t, n) {
5645
+ function Uo(e, t, n) {
5584
5646
  let r = { ...e }, i = n.trim();
5585
5647
  return i ? r[t] = i : delete r[t], r;
5586
5648
  }
5587
- function Vo(e, t) {
5649
+ function Wo(e, t) {
5588
5650
  let n = [...e];
5589
5651
  for (let e of t) {
5590
5652
  let t = n.findIndex((t) => t.name === e.name);
@@ -5594,67 +5656,67 @@ function Vo(e, t) {
5594
5656
  }
5595
5657
  //#endregion
5596
5658
  //#region src/units/UnitsPanel.vue?vue&type=script&setup=true&lang.ts
5597
- var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5659
+ var Go = { class: "units-title" }, Ko = { "data-role": "units-summary" }, qo = {
5598
5660
  class: "units-section",
5599
5661
  "aria-labelledby": "units-files-title"
5600
- }, Go = { class: "section-head" }, Ko = { class: "section-actions" }, qo = {
5662
+ }, Jo = { class: "section-head" }, Yo = { class: "section-actions" }, Xo = {
5601
5663
  key: 0,
5602
5664
  class: "hint"
5603
- }, Jo = {
5665
+ }, Zo = {
5604
5666
  key: 1,
5605
5667
  class: "files",
5606
5668
  "data-role": "units-files"
5607
- }, Yo = ["data-file"], Xo = { class: "file-head" }, Zo = { class: "file-name" }, Qo = { class: "file-count" }, $o = {
5669
+ }, Qo = ["data-file"], $o = { class: "file-head" }, es = { class: "file-name" }, ts = { class: "file-count" }, ns = {
5608
5670
  key: 0,
5609
5671
  class: "units-names"
5610
- }, es = {
5672
+ }, rs = {
5611
5673
  key: 1,
5612
5674
  class: "problems",
5613
5675
  "data-role": "units-problems"
5614
- }, ts = {
5676
+ }, is = {
5615
5677
  class: "units-section",
5616
5678
  "aria-labelledby": "units-new-title",
5617
5679
  "data-role": "new-units"
5618
- }, ns = { class: "section-head" }, rs = { class: "section-actions" }, is = {
5680
+ }, as = { class: "section-head" }, os = { class: "section-actions" }, ss = {
5619
5681
  key: 0,
5620
5682
  class: "hint"
5621
- }, as = {
5683
+ }, cs = {
5622
5684
  key: 1,
5623
5685
  class: "new-units"
5624
- }, os = ["data-units"], ss = {
5686
+ }, ls = ["data-units"], us = {
5625
5687
  key: 1,
5626
5688
  class: "new-units-row"
5627
- }, cs = { class: "new-units-name" }, ls = {
5689
+ }, ds = { class: "new-units-name" }, fs = {
5628
5690
  class: "new-units-definition",
5629
5691
  "data-role": "new-units-definition"
5630
- }, us = {
5692
+ }, ps = {
5631
5693
  key: 3,
5632
5694
  class: "problems",
5633
5695
  "data-role": "new-units-problems"
5634
- }, ds = {
5696
+ }, ms = {
5635
5697
  class: "units-section",
5636
5698
  "aria-labelledby": "units-variables-title"
5637
- }, fs = { class: "section-head" }, ps = {
5699
+ }, hs = { class: "section-head" }, gs = {
5638
5700
  key: 0,
5639
5701
  class: "missing-count",
5640
5702
  "data-role": "missing-count"
5641
- }, ms = {
5703
+ }, _s = {
5642
5704
  key: 0,
5643
5705
  class: "hint"
5644
- }, hs = {
5706
+ }, vs = {
5645
5707
  key: 1,
5646
5708
  class: "variables",
5647
5709
  "data-role": "variables"
5648
- }, gs = ["data-variable", "data-state"], _s = {
5710
+ }, ys = ["data-variable", "data-state"], bs = {
5649
5711
  scope: "row",
5650
5712
  class: "variable-name"
5651
- }, vs = [
5713
+ }, xs = [
5652
5714
  "value",
5653
5715
  "list",
5654
5716
  "aria-label",
5655
5717
  "aria-invalid",
5656
5718
  "onChange"
5657
- ], ys = { class: "variable-state" }, bs = ["id"], xs = ["value"], Ss = /*#__PURE__*/ Zi(/* @__PURE__ */ u({
5719
+ ], Ss = { class: "variable-state" }, Cs = ["id"], ws = ["value"], Ts = /*#__PURE__*/ Zi(/* @__PURE__ */ u({
5658
5720
  __name: "UnitsPanel",
5659
5721
  props: /*@__PURE__*/ f({
5660
5722
  status: {},
@@ -5681,7 +5743,7 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5681
5743
  "update:newUnits"
5682
5744
  ],
5683
5745
  setup(t) {
5684
- let s = t, u = C(t, "sources"), d = C(t, "variableUnits"), f = C(t, "newUnits"), p = n(() => s.status === "ready"), h = n(() => zo(s.lines, d.value, p.value ? s.unitsNames : null)), ee = n(() => h.value.filter((e) => e.state === "missing").length), te = n(() => ({
5746
+ let s = t, u = C(t, "sources"), d = C(t, "variableUnits"), f = C(t, "newUnits"), p = n(() => s.status === "ready"), h = n(() => Ho(s.lines, d.value, p.value ? s.unitsNames : null)), ee = n(() => h.value.filter((e) => e.state === "missing").length), te = n(() => ({
5685
5747
  ready: {
5686
5748
  value: "libCellML",
5687
5749
  severity: "success"
@@ -5710,12 +5772,12 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5710
5772
  name: e.name,
5711
5773
  text: await e.text()
5712
5774
  })));
5713
- r.length && (u.value = Vo(u.value, r));
5775
+ r.length && (u.value = Wo(u.value, r));
5714
5776
  }
5715
5777
  function oe(e) {
5716
5778
  u.value = u.value.filter((t) => t.name !== e);
5717
5779
  }
5718
- let se = (e) => s.problems.filter((t) => t.source === e), ce = (e) => s.files.find((t) => t.name === e)?.units ?? [], T = v(void 0), E = n(() => T.value === void 0 || T.value === null ? null : f.value[T.value]), le = n(() => f.value.filter((e, t) => t !== T.value)), de = n(() => p.value ? s.unitsNames.filter((e) => e !== E.value?.name) : null), fe = n(() => [.../* @__PURE__ */ new Set([...s.unitsNames, ...le.value.map((e) => e.name)])].filter((e) => e !== E.value?.name)), pe = n(() => se(vo));
5780
+ let se = (e) => s.problems.filter((t) => t.source === e), ce = (e) => s.files.find((t) => t.name === e)?.units ?? [], T = v(void 0), E = n(() => T.value === void 0 || T.value === null ? null : f.value[T.value]), le = n(() => f.value.filter((e, t) => t !== T.value)), de = n(() => p.value ? s.unitsNames.filter((e) => e !== E.value?.name) : null), fe = n(() => [.../* @__PURE__ */ new Set([...s.unitsNames, ...le.value.map((e) => e.name)])].filter((e) => e !== E.value?.name)), pe = n(() => se(xo));
5719
5781
  function me(e) {
5720
5782
  let t = [...f.value], n = T.value;
5721
5783
  if (n == null) t.push(e);
@@ -5736,7 +5798,7 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5736
5798
  }
5737
5799
  let ge = ae();
5738
5800
  function _e(e, t) {
5739
- d.value = Bo(d.value, e, t.target.value);
5801
+ d.value = Uo(d.value, e, t.target.value);
5740
5802
  }
5741
5803
  let O = {
5742
5804
  ok: "",
@@ -5748,14 +5810,14 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5748
5810
  "data-role": "units-panel",
5749
5811
  "data-status": t.status
5750
5812
  }, {
5751
- title: w(() => [o("div", Ho, [s[4] ||= o("span", null, "Units", -1), l(S(ve), {
5813
+ title: w(() => [o("div", Go, [s[4] ||= o("span", null, "Units", -1), l(S(ve), {
5752
5814
  severity: te.value.severity,
5753
5815
  value: te.value.value,
5754
5816
  "data-role": "units-status"
5755
5817
  }, null, 8, ["severity", "value"])])]),
5756
- subtitle: w(() => [o("span", Uo, b(g.value), 1)]),
5818
+ subtitle: w(() => [o("span", Ko, b(g.value), 1)]),
5757
5819
  content: w(() => [
5758
- o("section", Wo, [o("div", Go, [s[5] ||= o("h3", { id: "units-files-title" }, "Units files", -1), o("div", Ko, [
5820
+ o("section", qo, [o("div", Jo, [s[5] ||= o("h3", { id: "units-files-title" }, "Units files", -1), o("div", Yo, [
5759
5821
  ne(n.$slots, "actions", {}, void 0, !0),
5760
5822
  l(S(D), {
5761
5823
  icon: "pi pi-folder-open",
@@ -5776,7 +5838,7 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5776
5838
  "data-role": "units-file-input",
5777
5839
  onChange: x
5778
5840
  }, null, 544)
5779
- ])]), u.value.length === 0 ? (_(), a("p", qo, [...s[6] ||= [
5841
+ ])]), u.value.length === 0 ? (_(), a("p", Xo, [...s[6] ||= [
5780
5842
  c(" Built-in units (", -1),
5781
5843
  o("code", null, "second", -1),
5782
5844
  c(", ", -1),
@@ -5784,13 +5846,13 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5784
5846
  c(", ", -1),
5785
5847
  o("code", null, "volt", -1),
5786
5848
  c(", …) are always available. Load CellML files for others; only their units are kept. ", -1)
5787
- ]])) : (_(), a("ul", Jo, [(_(!0), a(e, null, y(u.value, (t) => (_(), a("li", {
5849
+ ]])) : (_(), a("ul", Zo, [(_(!0), a(e, null, y(u.value, (t) => (_(), a("li", {
5788
5850
  key: t.name,
5789
5851
  "data-file": t.name
5790
5852
  }, [
5791
- o("div", Xo, [
5792
- o("span", Zo, b(t.name), 1),
5793
- o("span", Qo, b(p.value ? re(ce(t.name).length, "units definition") : ""), 1),
5853
+ o("div", $o, [
5854
+ o("span", es, b(t.name), 1),
5855
+ o("span", ts, b(p.value ? re(ce(t.name).length, "units definition") : ""), 1),
5794
5856
  l(S(D), {
5795
5857
  icon: "pi pi-times",
5796
5858
  size: "small",
@@ -5802,11 +5864,11 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5802
5864
  onClick: (e) => oe(t.name)
5803
5865
  }, null, 8, ["aria-label", "onClick"])
5804
5866
  ]),
5805
- ce(t.name).length ? (_(), a("div", $o, [(_(!0), a(e, null, y(ce(t.name), (e) => (_(), a("code", { key: e }, b(e), 1))), 128))])) : i("", !0),
5806
- se(t.name).length ? (_(), a("ul", es, [(_(!0), a(e, null, y(se(t.name), (e, t) => (_(), a("li", { key: t }, b(e.message), 1))), 128))])) : i("", !0)
5807
- ], 8, Yo))), 128))]))]),
5808
- o("section", ts, [
5809
- o("div", ns, [s[7] ||= o("h3", { id: "units-new-title" }, "New units", -1), o("div", rs, [ne(n.$slots, "new-units-actions", { definitions: f.value }, void 0, !0), l(S(D), {
5867
+ ce(t.name).length ? (_(), a("div", ns, [(_(!0), a(e, null, y(ce(t.name), (e) => (_(), a("code", { key: e }, b(e), 1))), 128))])) : i("", !0),
5868
+ se(t.name).length ? (_(), a("ul", rs, [(_(!0), a(e, null, y(se(t.name), (e, t) => (_(), a("li", { key: t }, b(e.message), 1))), 128))])) : i("", !0)
5869
+ ], 8, Qo))), 128))]))]),
5870
+ o("section", is, [
5871
+ o("div", as, [s[7] ||= o("h3", { id: "units-new-title" }, "New units", -1), o("div", os, [ne(n.$slots, "new-units-actions", { definitions: f.value }, void 0, !0), l(S(D), {
5810
5872
  icon: "pi pi-plus",
5811
5873
  label: "Define units",
5812
5874
  size: "small",
@@ -5816,11 +5878,11 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5816
5878
  title: "Define units of your own, kept in a file apart from the units files",
5817
5879
  onClick: s[1] ||= (e) => T.value = null
5818
5880
  }, null, 8, ["disabled"])])]),
5819
- f.value.length === 0 && T.value === void 0 ? (_(), a("p", is, " Units you define are kept in a units file of their own, apart from the files loaded. ")) : i("", !0),
5820
- f.value.length ? (_(), a("ul", as, [(_(!0), a(e, null, y(f.value, (e, t) => (_(), a("li", {
5881
+ f.value.length === 0 && T.value === void 0 ? (_(), a("p", ss, " Units you define are kept in a units file of their own, apart from the files loaded. ")) : i("", !0),
5882
+ f.value.length ? (_(), a("ul", cs, [(_(!0), a(e, null, y(f.value, (e, t) => (_(), a("li", {
5821
5883
  key: e.name,
5822
5884
  "data-units": e.name
5823
- }, [T.value === t ? (_(), r(Ro, {
5885
+ }, [T.value === t ? (_(), r(Vo, {
5824
5886
  key: 0,
5825
5887
  definition: e,
5826
5888
  others: le.value,
@@ -5833,9 +5895,9 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5833
5895
  "others",
5834
5896
  "known",
5835
5897
  "choices"
5836
- ])) : (_(), a("div", ss, [
5837
- o("code", cs, b(e.name), 1),
5838
- o("span", ls, " = " + b(S(wo)(e)), 1),
5898
+ ])) : (_(), a("div", us, [
5899
+ o("code", ds, b(e.name), 1),
5900
+ o("span", fs, " = " + b(S(Do)(e)), 1),
5839
5901
  l(S(D), {
5840
5902
  icon: "pi pi-pencil",
5841
5903
  size: "small",
@@ -5858,8 +5920,8 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5858
5920
  rounded: "",
5859
5921
  severity: "secondary",
5860
5922
  "aria-label": `Remove ${e.name}`,
5861
- title: S(Co)(e.name, f.value).length ? `Used by ${S(Co)(e.name, f.value).join(", ")}` : "Remove these units",
5862
- disabled: T.value !== void 0 || S(Co)(e.name, f.value).length > 0,
5923
+ title: S(Eo)(e.name, f.value).length ? `Used by ${S(Eo)(e.name, f.value).join(", ")}` : "Remove these units",
5924
+ disabled: T.value !== void 0 || S(Eo)(e.name, f.value).length > 0,
5863
5925
  onClick: (e) => he(t)
5864
5926
  }, null, 8, [
5865
5927
  "aria-label",
@@ -5867,8 +5929,8 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5867
5929
  "disabled",
5868
5930
  "onClick"
5869
5931
  ])
5870
- ]))], 8, os))), 128))])) : i("", !0),
5871
- T.value === null ? (_(), r(Ro, {
5932
+ ]))], 8, ls))), 128))])) : i("", !0),
5933
+ T.value === null ? (_(), r(Vo, {
5872
5934
  key: 2,
5873
5935
  others: le.value,
5874
5936
  known: de.value,
@@ -5880,17 +5942,17 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5880
5942
  "known",
5881
5943
  "choices"
5882
5944
  ])) : i("", !0),
5883
- pe.value.length ? (_(), a("ul", us, [(_(!0), a(e, null, y(pe.value, (e, t) => (_(), a("li", { key: t }, b(e.message), 1))), 128))])) : i("", !0)
5945
+ pe.value.length ? (_(), a("ul", ps, [(_(!0), a(e, null, y(pe.value, (e, t) => (_(), a("li", { key: t }, b(e.message), 1))), 128))])) : i("", !0)
5884
5946
  ]),
5885
- o("section", ds, [
5886
- o("div", fs, [s[8] ||= o("h3", { id: "units-variables-title" }, "Variables", -1), ee.value ? (_(), a("span", ps, b(re(ee.value, "variable")) + " without units ", 1)) : i("", !0)]),
5887
- h.value.length === 0 ? (_(), a("p", ms, " The variables in your equations are listed here, to give each one its units. ")) : (_(), a("table", hs, [o("tbody", null, [(_(!0), a(e, null, y(h.value, (t) => (_(), a("tr", {
5947
+ o("section", ms, [
5948
+ o("div", hs, [s[8] ||= o("h3", { id: "units-variables-title" }, "Variables", -1), ee.value ? (_(), a("span", gs, b(re(ee.value, "variable")) + " without units ", 1)) : i("", !0)]),
5949
+ h.value.length === 0 ? (_(), a("p", _s, " The variables in your equations are listed here, to give each one its units. ")) : (_(), a("table", vs, [o("tbody", null, [(_(!0), a(e, null, y(h.value, (t) => (_(), a("tr", {
5888
5950
  key: t.name,
5889
5951
  class: m([`state-${t.state}`, { unused: !t.used }]),
5890
5952
  "data-variable": t.name,
5891
5953
  "data-state": t.state
5892
5954
  }, [
5893
- o("th", _s, b(t.name), 1),
5955
+ o("th", bs, b(t.name), 1),
5894
5956
  o("td", null, [o("input", {
5895
5957
  class: "units-input",
5896
5958
  type: "text",
@@ -5902,8 +5964,8 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5902
5964
  "aria-label": `Units of ${t.name}`,
5903
5965
  "aria-invalid": t.state !== "ok",
5904
5966
  onChange: (e) => _e(t.name, e)
5905
- }, null, 40, vs)]),
5906
- o("td", ys, [t.used ? (_(), a(e, { key: 0 }, [c(b(O[t.state]), 1)], 64)) : (_(), a(e, { key: 1 }, [s[9] ||= c(" not used ", -1), l(S(D), {
5967
+ }, null, 40, xs)]),
5968
+ o("td", Ss, [t.used ? (_(), a(e, { key: 0 }, [c(b(O[t.state]), 1)], 64)) : (_(), a(e, { key: 1 }, [s[9] ||= c(" not used ", -1), l(S(D), {
5907
5969
  icon: "pi pi-times",
5908
5970
  size: "small",
5909
5971
  text: "",
@@ -5911,13 +5973,13 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5911
5973
  severity: "secondary",
5912
5974
  "aria-label": `Forget the units of ${t.name}`,
5913
5975
  title: "Forget these units",
5914
- onClick: (e) => d.value = S(Bo)(d.value, t.name, "")
5976
+ onClick: (e) => d.value = S(Uo)(d.value, t.name, "")
5915
5977
  }, null, 8, ["aria-label", "onClick"])], 64))])
5916
- ], 10, gs))), 128))])])),
5978
+ ], 10, ys))), 128))])])),
5917
5979
  o("datalist", { id: S(ge) }, [(_(!0), a(e, null, y(t.unitsNames, (e) => (_(), a("option", {
5918
5980
  key: e,
5919
5981
  value: e
5920
- }, null, 8, xs))), 128))], 8, bs)
5982
+ }, null, 8, ws))), 128))], 8, Cs)
5921
5983
  ])
5922
5984
  ]),
5923
5985
  _: 3
@@ -5926,7 +5988,7 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5926
5988
  }), [["__scopeId", "data-v-ada663af"]]);
5927
5989
  //#endregion
5928
5990
  //#region src/units/libcellml.ts
5929
- function Cs(e) {
5991
+ function Es(e) {
5930
5992
  let t = [];
5931
5993
  for (let n = 0; n < e.issueCount(); n++) {
5932
5994
  let r = e.issue(n), i = r.level(), a = r.referenceRule();
@@ -5934,14 +5996,14 @@ function Cs(e) {
5934
5996
  message: r.description(),
5935
5997
  level: i.value,
5936
5998
  rule: a?.value ?? -1
5937
- }), ws(i), a && ws(a), r.delete();
5999
+ }), Ds(i), a && Ds(a), r.delete();
5938
6000
  }
5939
6001
  return t;
5940
6002
  }
5941
- function ws(e) {
6003
+ function Ds(e) {
5942
6004
  e.delete?.();
5943
6005
  }
5944
- var Ts = class {
6006
+ var Os = class {
5945
6007
  held = [];
5946
6008
  track(e) {
5947
6009
  return e && this.held.push(e), e;
@@ -5950,16 +6012,16 @@ var Ts = class {
5950
6012
  for (let e of this.held.splice(0).reverse()) e.delete();
5951
6013
  }
5952
6014
  };
5953
- function Es(e) {
6015
+ function ks(e) {
5954
6016
  return Object.keys(e.Units.StandardUnit).filter((e) => /^[A-Z_]+$/.test(e)).map((e) => e.toLowerCase());
5955
6017
  }
5956
6018
  //#endregion
5957
6019
  //#region src/units/messages.ts
5958
- var Ds = /'([^']+)' is (?:in )?'([^']+)'(?: \(i\.e\. '[^']*'\))?/g;
5959
- function Os(e) {
6020
+ var As = /'([^']+)' is (?:in )?'([^']+)'(?: \(i\.e\. '[^']*'\))?/g;
6021
+ function js(e) {
5960
6022
  let t = /^The units in '([^']+)'.* are not equivalent\. (.*)$/s.exec(e), n = /^The unit of '[^']+' in '([^']+)'.* is not dimensionless\. (.*)$/s.exec(e), r = t ?? n;
5961
6023
  if (!r) return null;
5962
- let i = [...r[2].matchAll(Ds)].map(([, e, t]) => ({
6024
+ let i = [...r[2].matchAll(As)].map(([, e, t]) => ({
5963
6025
  text: e,
5964
6026
  units: t
5965
6027
  }));
@@ -5969,27 +6031,27 @@ function Os(e) {
5969
6031
  operands: i
5970
6032
  };
5971
6033
  }
5972
- function ks(e) {
6034
+ function Ms(e) {
5973
6035
  let [t, n] = e.operands;
5974
- return e.kind === "notDimensionless" ? `${t.text} in ${e.expression} must be dimensionless, but is in ${t.units}` : n && t.units === n.units ? `The parts of ${n.text} have different units` : n ? `Units don't match in ${e.expression}: ${As(t)}, ${As(n)}` : `Units don't match in ${e.expression}`;
6036
+ return e.kind === "notDimensionless" ? `${t.text} in ${e.expression} must be dimensionless, but is in ${t.units}` : n && t.units === n.units ? `The parts of ${n.text} have different units` : n ? `Units don't match in ${e.expression}: ${Ns(t)}, ${Ns(n)}` : `Units don't match in ${e.expression}`;
5975
6037
  }
5976
- var As = (e) => e.units === "dimensionless" ? `${e.text} is dimensionless` : `${e.text} is in ${e.units}`, js = /[A-Za-z_][A-Za-z0-9_]*/g, Ms = /\bd(?:\^\d+)?([A-Za-z_][A-Za-z0-9_]*)\/d([A-Za-z_][A-Za-z0-9_]*)(?:\^\d+)?/g, Ns = /(?<![A-Za-z_0-9.])\d+(?:\.\d*)?(?:e[+-]?\d+)?/g;
5977
- function Ps(e, t) {
6038
+ var Ns = (e) => e.units === "dimensionless" ? `${e.text} is dimensionless` : `${e.text} is in ${e.units}`, Ps = /[A-Za-z_][A-Za-z0-9_]*/g, Fs = /\bd(?:\^\d+)?([A-Za-z_][A-Za-z0-9_]*)\/d([A-Za-z_][A-Za-z0-9_]*)(?:\^\d+)?/g, Is = /(?<![A-Za-z_0-9.])\d+(?:\.\d*)?(?:e[+-]?\d+)?/g;
6039
+ function Ls(e, t) {
5978
6040
  let n = /* @__PURE__ */ new Set(), r = (e) => {
5979
6041
  t.includes(e) && n.add(e);
5980
- }, i = e.replace(Ms, (e, n, i) => t.includes(`d${n}`) || t.includes(`d${i}`) ? e : (r(n), r(i), " "));
5981
- for (let [e] of i.replace(Ns, " ").matchAll(js)) r(e);
6042
+ }, i = e.replace(Fs, (e, n, i) => t.includes(`d${n}`) || t.includes(`d${i}`) ? e : (r(n), r(i), " "));
6043
+ for (let [e] of i.replace(Is, " ").matchAll(Ps)) r(e);
5982
6044
  return [...n];
5983
6045
  }
5984
- function Fs(e) {
5985
- return [...e.matchAll(Ns)].map(([e]) => Number(e));
6046
+ function Rs(e) {
6047
+ return [...e.matchAll(Is)].map(([e]) => Number(e));
5986
6048
  }
5987
6049
  //#endregion
5988
6050
  //#region src/units/check.ts
5989
- function Is(e, t) {
6051
+ function zs(e, t) {
5990
6052
  return e.variables.filter((e) => !t[e]);
5991
6053
  }
5992
- var Ls = 500, Rs = class {
6054
+ var Bs = 500, Vs = class {
5993
6055
  lc;
5994
6056
  library;
5995
6057
  cache = /* @__PURE__ */ new Map();
@@ -6006,7 +6068,7 @@ var Ls = 500, Rs = class {
6006
6068
  })) : [];
6007
6069
  }
6008
6070
  prechecked(e, t) {
6009
- let n = Is(e, t).map((e) => ({
6071
+ let n = zs(e, t).map((e) => ({
6010
6072
  message: `${e} has no units`,
6011
6073
  variables: [e]
6012
6074
  })), r = [.../* @__PURE__ */ new Set([...e.variables.map((e) => t[e]), ...e.units])].filter((e) => e && !this.library.isKnown(e)).map((n) => ({
@@ -6020,10 +6082,10 @@ var Ls = 500, Rs = class {
6020
6082
  let n = `${e.mathml}\n${e.variables.map((e) => `${e}:${t[e]}`).join(" ")}`, r = this.cache.get(n);
6021
6083
  if (r) return r;
6022
6084
  let i = this.analyse(e, t);
6023
- return this.cache.size >= Ls && this.cache.delete(this.cache.keys().next().value), this.cache.set(n, i), i;
6085
+ return this.cache.size >= Bs && this.cache.delete(this.cache.keys().next().value), this.cache.set(n, i), i;
6024
6086
  }
6025
6087
  analyse(e, t) {
6026
- let { lc: n } = this, r = new Ts();
6088
+ let { lc: n } = this, r = new Os();
6027
6089
  try {
6028
6090
  let i = r.track(new n.Model());
6029
6091
  i.setName("units_check"), this.library.addTo(i, [...e.variables.map((e) => t[e]), ...e.units], r);
@@ -6036,12 +6098,12 @@ var Ls = 500, Rs = class {
6036
6098
  a.setMath(e.mathml), i.addComponent(a), i.linkUnits();
6037
6099
  let o = r.track(new n.Validator());
6038
6100
  o.validateModel(i);
6039
- let s = Cs(o).filter((e) => e.level === 0);
6040
- if (s.length) return s.map((e) => ({ message: `libCellML: ${Bs(e.message)}` }));
6101
+ let s = Es(o).filter((e) => e.level === 0);
6102
+ if (s.length) return s.map((e) => ({ message: `libCellML: ${Us(e.message)}` }));
6041
6103
  let c = r.track(new n.Analyser());
6042
6104
  c.analyseModel(i);
6043
- let l = Cs(c).filter((e) => e.rule === 112).map((e) => e.message);
6044
- return [...new Set(l)].map((t) => zs(t, e.variables));
6105
+ let l = Es(c).filter((e) => e.rule === 112).map((e) => e.message);
6106
+ return [...new Set(l)].map((t) => Hs(t, e.variables));
6045
6107
  } finally {
6046
6108
  r.dispose();
6047
6109
  }
@@ -6050,36 +6112,36 @@ var Ls = 500, Rs = class {
6050
6112
  this.cache.clear();
6051
6113
  }
6052
6114
  };
6053
- function zs(e, t) {
6054
- let n = Os(e);
6055
- if (!n) return { message: Bs(e) };
6115
+ function Hs(e, t) {
6116
+ let n = js(e);
6117
+ if (!n) return { message: Us(e) };
6056
6118
  let r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
6057
6119
  for (let e of n.operands) {
6058
- let n = Ps(e.text, t);
6120
+ let n = Ls(e.text, t);
6059
6121
  for (let e of n) r.add(e);
6060
- if (n.length === 0) for (let t of Fs(e.text)) i.add(t);
6122
+ if (n.length === 0) for (let t of Rs(e.text)) i.add(t);
6061
6123
  }
6062
6124
  return {
6063
- message: ks(n),
6125
+ message: Ms(n),
6064
6126
  ...r.size ? { variables: [...r] } : {},
6065
6127
  ...i.size ? { numbers: [...i] } : {}
6066
6128
  };
6067
6129
  }
6068
- function Bs(e) {
6130
+ function Us(e) {
6069
6131
  return e.replace(/ in component 'equation'/g, "").replace(/ in model 'units_check'/g, "");
6070
6132
  }
6071
6133
  //#endregion
6072
6134
  //#region src/units/library.ts
6073
- var Vs = class e {
6135
+ var Ws = class e {
6074
6136
  lc;
6075
6137
  names;
6076
6138
  sources;
6077
6139
  problems;
6078
6140
  standard;
6079
6141
  defined = /* @__PURE__ */ new Map();
6080
- handles = new Ts();
6142
+ handles = new Os();
6081
6143
  constructor(e, t) {
6082
- this.lc = e, this.standard = new Set(Es(e));
6144
+ this.lc = e, this.standard = new Set(ks(e));
6083
6145
  let n = [], r = [], i = /* @__PURE__ */ new Map();
6084
6146
  for (let e of t) {
6085
6147
  let t = [];
@@ -6135,7 +6197,7 @@ var Vs = class e {
6135
6197
  let n = new this.lc.Parser(!1);
6136
6198
  try {
6137
6199
  let r = this.handles.track(n.parseModel(e.text));
6138
- for (let r of Cs(n)) r.level === 0 && t.push({
6200
+ for (let r of Es(n)) r.level === 0 && t.push({
6139
6201
  source: e.name,
6140
6202
  message: r.message
6141
6203
  });
@@ -6144,21 +6206,21 @@ var Vs = class e {
6144
6206
  n.delete();
6145
6207
  }
6146
6208
  }
6147
- }, Hs = "$libcellml";
6148
- function Us(e) {
6149
- let t = e.libcellml === void 0 ? d(Hs, null) : e.libcellml, r = e.delay ?? 300, i = n(() => x(e.enabled) ?? !0), a = n(() => Ws(t)), o = n(() => t !== null), s = n(() => a.value !== null), c = n(() => s.value ? "ready" : o.value ? "loading" : "unavailable"), l = re(null), u = re([]), f = null, p, m = () => {
6209
+ }, Gs = "$libcellml";
6210
+ function Ks(e) {
6211
+ let t = e.libcellml === void 0 ? d(Gs, null) : e.libcellml, r = e.delay ?? 300, i = n(() => x(e.enabled) ?? !0), a = n(() => qs(t)), o = n(() => t !== null), s = n(() => a.value !== null), c = n(() => s.value ? "ready" : o.value ? "loading" : "unavailable"), l = re(null), u = re([]), f = null, p, m = () => {
6150
6212
  clearTimeout(p), p = void 0, u.value = f && i.value ? f.check(x(e.lines), x(e.variableUnits)) : [];
6151
6213
  }, h = () => {
6152
6214
  f?.dispose(), l.value?.dispose(), f = null, l.value = null;
6153
6215
  }, ee = n(() => {
6154
6216
  let t = x(e.newUnits) ?? [];
6155
- return t.length ? Eo(t) : "";
6217
+ return t.length ? ko(t) : "";
6156
6218
  });
6157
6219
  return ce([a, () => [...x(e.sources), ...ee.value ? [{
6158
- name: vo,
6220
+ name: xo,
6159
6221
  text: ee.value
6160
6222
  }] : []]], ([e, t]) => {
6161
- h(), e && (l.value = Vs.load(e, t), f = new Rs(e, l.value)), m();
6223
+ h(), e && (l.value = Ws.load(e, t), f = new Vs(e, l.value)), m();
6162
6224
  }, { immediate: !0 }), ce(i, () => m()), ce([() => x(e.lines), () => x(e.variableUnits)], () => {
6163
6225
  clearTimeout(p), p = setTimeout(m, r);
6164
6226
  }), g(() => {
@@ -6172,16 +6234,16 @@ function Us(e) {
6172
6234
  files: n(() => l.value?.sources ?? []),
6173
6235
  problems: n(() => l.value?.problems ?? []),
6174
6236
  newUnitsFile: ee,
6175
- unitsNames: n(() => a.value && l.value ? [...Es(a.value), ...l.value.names] : []),
6237
+ unitsNames: n(() => a.value && l.value ? [...ks(a.value), ...l.value.names] : []),
6176
6238
  missing: n(() => {
6177
6239
  let t = x(e.variableUnits);
6178
- return [...new Set(x(e.lines).flatMap((e) => Is(e, t)))];
6240
+ return [...new Set(x(e.lines).flatMap((e) => zs(e, t)))];
6179
6241
  }),
6180
6242
  check: m
6181
6243
  };
6182
6244
  }
6183
- function Ws(e) {
6245
+ function qs(e) {
6184
6246
  return e ? "Parser" in e ? ie(e) : e.status === "ready" && e.library ? ie(e.library) : null : null;
6185
6247
  }
6186
6248
  //#endregion
6187
- export { _o as EquationWorkbench, Hs as LIBCELLML_KEY, Ss as UnitsPanel, Ai as importContentMathML, Us as useUnitsChecker };
6249
+ export { bo as EquationWorkbench, Gs as LIBCELLML_KEY, Ts as UnitsPanel, Ai as importContentMathML, Ks as useUnitsChecker };