vue3-math-editor 0.3.1 → 0.3.2

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.
@@ -4511,7 +4511,7 @@ function qo(e, t = /* @__PURE__ */ new Map()) {
4511
4511
  conc: /* @__PURE__ */ new Set(),
4512
4512
  charge: /* @__PURE__ */ new Set()
4513
4513
  }, c = !1, l = e.equations.filter(Xo).map((e, l) => {
4514
- let u = new Ps(l, t, n, r, i, o), d = u.equation(e);
4514
+ let u = new Fs(l, t, n, r, i, o), d = u.equation(e);
4515
4515
  for (let e of u.joinedNames(d)) a.add(e);
4516
4516
  for (let { kind: e, text: t } of u.decoratedNames(d)) s[e].add(t);
4517
4517
  return c ||= Qo(d), d;
@@ -4640,27 +4640,34 @@ function is(e) {
4640
4640
  var as = (e) => e.every((e) => e.kind === "text" && e.style === "upright"), os = (e) => /^[A-Za-z0-9_]$/.test(e) || !!Io(e) && Io(e) !== "pi", ss = (e) => {
4641
4641
  let [t, ...n] = Array.from(e);
4642
4642
  return !!t && (/^[A-Za-z]$/.test(t) || os(t)) && !/^[0-9_]$/.test(t) && n.every(os);
4643
- }, cs = (e) => e.split(",").every((e) => e.length > 0 && Array.from(e).every(os)), ls = (e) => Array.from(e).some((e) => /[A-Za-z]/.test(e) || !!Io(e)), us = (e, t) => Array.from(e).flatMap((e) => e === "," ? Array.from({ length: t }, () => F("_")) : [F(Io(e) ?? e)]), ds = (e) => e.length > 0 && e.every((e) => e.kind === "text" && e.explicit && e.style === "upright" && e.token !== "mn"), fs = /* @__PURE__ */ new Set([
4643
+ }, cs = (e) => e.split(",").every((e) => e.length > 0 && Array.from(e).every(os));
4644
+ function ls(e) {
4645
+ let [t] = e;
4646
+ if (e.length !== 1 || t.kind !== "scripts" || t.sup || !t.sub) return null;
4647
+ let n = is(t.base), r = is(t.sub);
4648
+ return n === null || r === null || !ss(n) || !cs(r) ? null : `${n},${r}`;
4649
+ }
4650
+ var us = (e) => Array.from(e).some((e) => /[A-Za-z]/.test(e) || !!Io(e)), ds = (e, t) => Array.from(e).flatMap((e) => e === "," ? Array.from({ length: t }, () => F("_")) : [F(Io(e) ?? e)]), fs = (e) => e.length > 0 && e.every((e) => e.kind === "text" && e.explicit && e.style === "upright" && e.token !== "mn"), ps = /* @__PURE__ */ new Set([
4644
4651
  "d",
4645
4652
  "ⅆ",
4646
4653
  "∂"
4647
4654
  ]);
4648
- function ps(e) {
4655
+ function ms(e) {
4649
4656
  let t = is(e);
4650
4657
  if (t !== null) {
4651
4658
  let e = /^\[.*\]$/.test(t) ? t.slice(1, -1) : t;
4652
- return ss(e) || fs.has(e);
4659
+ return ss(e) || ps.has(e);
4653
4660
  }
4654
4661
  let [n] = e;
4655
4662
  if (e.length !== 1) return !1;
4656
4663
  switch (n.kind) {
4657
4664
  case "scripts":
4658
- case "accent": return ps(n.base);
4659
- case "fenced": return n.open === "[" && n.close === "]" && n.items.length === 1 && ps(n.items[0]);
4665
+ case "accent": return ms(n.base);
4666
+ case "fenced": return n.open === "[" && n.close === "]" && n.items.length === 1 && ms(n.items[0]);
4660
4667
  default: return !1;
4661
4668
  }
4662
4669
  }
4663
- function ms(e, t) {
4670
+ function hs(e, t) {
4664
4671
  return e.flatMap((e, n) => {
4665
4672
  let r = `${t}.${n}`;
4666
4673
  return e.kind === "text" ? Array.from(e.text).flatMap((t, n) => {
@@ -4679,11 +4686,11 @@ function ms(e, t) {
4679
4686
  }];
4680
4687
  });
4681
4688
  }
4682
- var hs = (e, t) => e === "d" && t, gs = (e) => e?.kind === "char" ? e.char : "";
4683
- function _s(e, t) {
4689
+ var gs = (e, t) => e === "d" && t, _s = (e) => e?.kind === "char" ? e.char : "";
4690
+ function vs(e, t) {
4684
4691
  let n = "", r = [];
4685
4692
  for (let i = t; i < e.length; i++) {
4686
- let t = Go(gs(e[i]));
4693
+ let t = Go(_s(e[i]));
4687
4694
  if (t === void 0) break;
4688
4695
  n += t, r.push(e[i].path);
4689
4696
  }
@@ -4692,17 +4699,17 @@ function _s(e, t) {
4692
4699
  paths: r
4693
4700
  };
4694
4701
  }
4695
- function vs(e) {
4702
+ function ys(e) {
4696
4703
  if (e.kind !== "scripts" || e.sub || !e.sup) return null;
4697
4704
  let t = is(e.sup);
4698
4705
  return t !== null && /^[0-9]+$/.test(t) ? t : null;
4699
4706
  }
4700
- function ys(e) {
4707
+ function bs(e) {
4701
4708
  let [t] = e;
4702
- if (t?.kind === "char" && fs.has(t.char)) {
4703
- let { digits: n, paths: r } = _s(e, 1);
4709
+ if (t?.kind === "char" && ps.has(t.char)) {
4710
+ let { digits: n, paths: r } = vs(e, 1);
4704
4711
  if (!n) return null;
4705
- let i = hs(t.char, t.italic);
4712
+ let i = gs(t.char, t.italic);
4706
4713
  return {
4707
4714
  order: Number(n),
4708
4715
  paths: r,
@@ -4711,9 +4718,9 @@ function ys(e) {
4711
4718
  };
4712
4719
  }
4713
4720
  if (t?.kind === "node" && t.node.kind === "scripts") {
4714
- let n = vs(t.node), r = ms(t.node.base, ""), [i] = r;
4715
- if (n === null || r.length !== 1 || i.kind !== "char" || !fs.has(i.char)) return null;
4716
- let a = hs(i.char, i.italic);
4721
+ let n = ys(t.node), r = hs(t.node.base, ""), [i] = r;
4722
+ if (n === null || r.length !== 1 || i.kind !== "char" || !ps.has(i.char)) return null;
4723
+ let a = gs(i.char, i.italic);
4717
4724
  return {
4718
4725
  order: Number(n),
4719
4726
  paths: [t.path],
@@ -4723,42 +4730,42 @@ function ys(e) {
4723
4730
  }
4724
4731
  return null;
4725
4732
  }
4726
- function bs(e) {
4727
- let t = e[e.length - 1], n = t?.kind === "node" ? vs(t.node) : null, r = e.length;
4728
- for (; r > 0 && Go(gs(e[r - 1])) !== void 0;) r--;
4733
+ function xs(e) {
4734
+ let t = e[e.length - 1], n = t?.kind === "node" ? ys(t.node) : null, r = e.length;
4735
+ for (; r > 0 && Go(_s(e[r - 1])) !== void 0;) r--;
4729
4736
  let { digits: i, paths: a, head: o } = t?.kind === "node" && t.node.kind === "scripts" && n !== null ? {
4730
4737
  digits: n,
4731
4738
  paths: [t.path],
4732
- head: [...e.slice(0, -1), ...ms(t.node.base, "")]
4739
+ head: [...e.slice(0, -1), ...hs(t.node.base, "")]
4733
4740
  } : {
4734
- ..._s(e, r),
4741
+ ...vs(e, r),
4735
4742
  head: e.slice(0, r)
4736
4743
  }, [s, ...c] = o;
4737
- return !i || s?.kind !== "char" || !fs.has(s.char) || !ss(c.map((e) => e.kind === "char" ? e.char : "\0").join("")) ? null : {
4744
+ return !i || s?.kind !== "char" || !ps.has(s.char) || !ss(c.map((e) => e.kind === "char" ? e.char : "\0").join("")) ? null : {
4738
4745
  order: Number(i),
4739
4746
  paths: a,
4740
- italic: hs(s.char, s.italic)
4747
+ italic: gs(s.char, s.italic)
4741
4748
  };
4742
4749
  }
4743
- function xs(e, t) {
4744
- let n = ys(ms(e.num, `${t}.n`)), r = bs(ms(e.den, `${t}.d`));
4750
+ function Ss(e, t) {
4751
+ let n = bs(hs(e.num, `${t}.n`)), r = xs(hs(e.den, `${t}.d`));
4745
4752
  return !n || !r || n.order < 2 || n.order !== r.order ? null : {
4746
4753
  ...n,
4747
4754
  paths: [...n.paths, ...r.paths],
4748
4755
  italic: n.italic || r.italic
4749
4756
  };
4750
4757
  }
4751
- var Ss = {
4758
+ var Cs = {
4752
4759
  2: "second",
4753
4760
  3: "third"
4754
- }, Cs = (e) => Ss[e] ? `a ${Ss[e]}-order derivative` : `an order-${e} derivative`;
4755
- function ws(e) {
4761
+ }, ws = (e) => Cs[e] ? `a ${Cs[e]}-order derivative` : `an order-${e} derivative`;
4762
+ function Ts(e) {
4756
4763
  return e.map((e) => {
4757
4764
  switch (e.kind) {
4758
4765
  case "char": return e.char;
4759
4766
  case "word": return e.text;
4760
4767
  case "node": return q([e.node]);
4761
- case "bracket": return `${e.open}${ws(e.items)}${e.close}`;
4768
+ case "bracket": return `${e.open}${Ts(e.items)}${e.close}`;
4762
4769
  }
4763
4770
  }).join("");
4764
4771
  }
@@ -4786,15 +4793,15 @@ function Z(e) {
4786
4793
  }
4787
4794
  }).join("");
4788
4795
  }
4789
- var Ts = (e) => e.path.slice(0, e.path.lastIndexOf(".")), Es = (e, t) => e?.kind === "symbol" && (t === void 0 || e.value === t);
4790
- function Ds(e) {
4796
+ var Es = (e) => e.path.slice(0, e.path.lastIndexOf(".")), Ds = (e, t) => e?.kind === "symbol" && (t === void 0 || e.value === t);
4797
+ function Os(e) {
4791
4798
  let t = dt(e), n = t[t.length - 1];
4792
4799
  return n && n.end === e.length && n.exponent === null ? n : null;
4793
4800
  }
4794
- var Os = (e) => {
4801
+ var ks = (e) => {
4795
4802
  let t = e[0];
4796
4803
  return e.length === 1 && t.kind === "group" && t.open === "(" ? t.body : e;
4797
- }, ks = (e) => e.charAt(0).toUpperCase() + e.slice(1), As = /* @__PURE__ */ new Set([
4804
+ }, As = (e) => e.charAt(0).toUpperCase() + e.slice(1), js = /* @__PURE__ */ new Set([
4798
4805
  "+",
4799
4806
  "-",
4800
4807
  "=",
@@ -4810,24 +4817,24 @@ var Os = (e) => {
4810
4817
  "∨",
4811
4818
  "⊻",
4812
4819
  "¬"
4813
- ]), js = (e) => Es(e) && As.has(e.value);
4814
- function Ms(e) {
4820
+ ]), Ms = (e) => Ds(e) && js.has(e.value);
4821
+ function Ns(e) {
4815
4822
  let t = [];
4816
4823
  for (let n = 0; n < e.length; n++) {
4817
4824
  let r = e[n];
4818
- if (!Es(r, "/")) {
4825
+ if (!Ds(r, "/")) {
4819
4826
  t.push(r);
4820
4827
  continue;
4821
4828
  }
4822
4829
  let i = t.length;
4823
- for (; i > 0 && !js(t[i - 1]);) i--;
4830
+ for (; i > 0 && !Ms(t[i - 1]);) i--;
4824
4831
  let a = t.splice(i), o = n + 1;
4825
- for (; o < e.length && !js(e[o]) && !Es(e[o], "/");) o++;
4826
- t.push(De(Os(a), Os(e.slice(n + 1, o)))), n = o - 1;
4832
+ for (; o < e.length && !Ms(e[o]) && !Ds(e[o], "/");) o++;
4833
+ t.push(De(ks(a), ks(e.slice(n + 1, o)))), n = o - 1;
4827
4834
  }
4828
4835
  return t;
4829
4836
  }
4830
- var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no partial derivatives.", Ps = class {
4837
+ var Ps = "A partial derivative (∂) was read as an ordinary one: CellML has no partial derivatives.", Fs = class {
4831
4838
  line;
4832
4839
  choices;
4833
4840
  assumptions;
@@ -4849,7 +4856,7 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
4849
4856
  for (let n of Zo(e)) for (let e of z(n)) {
4850
4857
  if (e.functionName) continue;
4851
4858
  let r = 0;
4852
- for (let t = e.start; t < e.end && !Es(n[t], "_"); t++) this.italic.has(n[t]) && /^[A-Za-z]$/.test(n[t].value) && r++;
4859
+ for (let t = e.start; t < e.end && !Ds(n[t], "_"); t++) this.italic.has(n[t]) && /^[A-Za-z]$/.test(n[t].value) && r++;
4853
4860
  r >= 2 && t.push(Z(n.slice(e.start, e.end)));
4854
4861
  }
4855
4862
  return t;
@@ -4915,7 +4922,7 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
4915
4922
  case "node": n = this.node(i, e, n, t, r);
4916
4923
  }
4917
4924
  }
4918
- return Ms(t);
4925
+ return Ns(t);
4919
4926
  }
4920
4927
  decide(e, t, n, r, i) {
4921
4928
  let a = `${e}:${t}`, o = this.choices.get(a), s = i.some((e) => e.id === o) ? o : i[0].id, c = {
@@ -4945,7 +4952,7 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
4945
4952
  }
4946
4953
  slot(e, t, n) {
4947
4954
  let r = I([]);
4948
- e([r], { separate: !0 }), this.omit(t, n, `${ks(t)} (${n}) isn't supported: it was left out, as an empty slot.`, [r]);
4955
+ e([r], { separate: !0 }), this.omit(t, n, `${As(t)} (${n}) isn't supported: it was left out, as an empty slot.`, [r]);
4949
4956
  }
4950
4957
  char(e, t, n, r) {
4951
4958
  let i = e[t], a = Uo(i.char), o = a.character, s = a.italic === null ? i.style : a.italic ? "italic" : "upright";
@@ -4975,11 +4982,11 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
4975
4982
  if (o === "/") return r([F("/")]), t;
4976
4983
  if (/^[A-Za-z]$/.test(o)) {
4977
4984
  let a = F(o);
4978
- if (s === "italic" && this.italic.add(a), o === "d" && this.differentials.set(a, s === "upright" ? "upright" : "italic"), s === "upright" && Ds(n) !== null) {
4985
+ if (s === "italic" && this.italic.add(a), o === "d" && this.differentials.set(a, s === "upright" ? "upright" : "italic"), s === "upright" && Os(n) !== null) {
4979
4986
  let n = "";
4980
4987
  for (let r = t; e[r]?.kind === "char"; r++) {
4981
4988
  let t = e[r];
4982
- if (Ts(t) !== Ts(i) || !/^[A-Za-z]$/.test(t.char)) break;
4989
+ if (Es(t) !== Es(i) || !/^[A-Za-z]$/.test(t.char)) break;
4983
4990
  n += t.char;
4984
4991
  }
4985
4992
  this.notes.add(`${n} after a number was read as a variable, multiplied by it; if it is the number’s units, delete it and add them as units.`);
@@ -5001,10 +5008,10 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
5001
5008
  let c = z(n), l = c[c.length - 1];
5002
5009
  if (!l || l.end !== n.length || l.functionName || this.orders.has(i.path)) {
5003
5010
  let c = e[t - 1], l = [Oe(L(a))];
5004
- if (!this.orders.has(i.path) && c?.kind === "node" && (c.node.kind === "scripts" || c.node.kind === "accent") && ps(c.node.base)) {
5011
+ if (!this.orders.has(i.path) && c?.kind === "node" && (c.node.kind === "scripts" || c.node.kind === "accent") && ms(c.node.base)) {
5005
5012
  let { became: e } = this.digitSuperscript(i.path, {
5006
5013
  latex: `${wa([c.node])}^{${a}}`,
5007
- text: `${ws([c])}${o}`
5014
+ text: `${Ts([c])}${o}`
5008
5015
  }, n.slice(-1), a);
5009
5016
  e(l);
5010
5017
  }
@@ -5047,8 +5054,8 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
5047
5054
  for (; o(s);) s++;
5048
5055
  let c = a(s);
5049
5056
  if (!e[s] || c !== null && /^[=,;:+\-−·⋅*×/^<>≤≥≠∧∨&#′″'’]$/.test(c)) return t;
5050
- let l = n[n.length - 1], u = Ds(n), d = u !== null && !u.mantissa.includes("."), f = /^[0-9]$/.test(a(t + 1) ?? ""), p = /^[eE]$/.test(a(t + 1) ?? "") && (/^[0-9]$/.test(a(t + 2) ?? "") || /^[+\-−]$/.test(a(t + 2) ?? "") && /^[0-9]$/.test(a(t + 3) ?? ""));
5051
- return i.token !== "mo" && !o(t - 1) && !o(t + 1) && (f && (n.length === 0 || js(l) || Es(l, "/") || d) || p && d) ? (r([F(".")]), t) : n.length === 0 ? t : (r([F("·")]), this.periods.push(this.periodText(e, t)), t);
5057
+ let l = n[n.length - 1], u = Os(n), d = u !== null && !u.mantissa.includes("."), f = /^[0-9]$/.test(a(t + 1) ?? ""), p = /^[eE]$/.test(a(t + 1) ?? "") && (/^[0-9]$/.test(a(t + 2) ?? "") || /^[+\-−]$/.test(a(t + 2) ?? "") && /^[0-9]$/.test(a(t + 3) ?? ""));
5058
+ return i.token !== "mo" && !o(t - 1) && !o(t + 1) && (f && (n.length === 0 || Ms(l) || Ds(l, "/") || d) || p && d) ? (r([F(".")]), t) : n.length === 0 ? t : (r([F("·")]), this.periods.push(this.periodText(e, t)), t);
5052
5059
  }
5053
5060
  periodText(e, t) {
5054
5061
  let n = (e) => e?.kind === "char" ? /^[A-Za-z0-9.]$/.test(Uo(e.char).character) || !!Io(e.char) : !!e && e.kind !== "word", r = (e) => e?.kind === "char" && Ho(e.char), i = (t, i) => {
@@ -5057,13 +5064,13 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
5057
5064
  for (let t = 0; t < 6 && n(e[a + i]) && (a += i, e[a].kind === "char"); t++);
5058
5065
  return a;
5059
5066
  }, a = (t, n) => e.slice(t, n).map((e) => {
5060
- let t = ws([e]);
5067
+ let t = Ts([e]);
5061
5068
  return e.kind === "char" || Array.from(t).length <= 16 ? t : "…";
5062
5069
  }).join("").trim(), o = i(t, -1), s = i(t, 1), c = a(o, t), l = a(t + 1, s + 1);
5063
5070
  return `${a(o, s + 1)} as ${c}·${l}`;
5064
5071
  }
5065
5072
  scientific(e, t, n, r, i, a) {
5066
- let o = Ds(n);
5073
+ let o = Os(n);
5067
5074
  if (!o) return !1;
5068
5075
  let s = (t) => e[t]?.kind === "char" ? e[t].char : "", c = t + 1, l = /^[+\-−]$/.test(s(c)) ? s(c++) : "";
5069
5076
  if (!/^[0-9]$/.test(s(c))) return !1;
@@ -5096,7 +5103,7 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
5096
5103
  });
5097
5104
  let s = this.nextFactor(e, t + 1);
5098
5105
  if (s === t + 1) return t;
5099
- let c = I(Os(this.sequence(e.slice(t + 1, s))));
5106
+ let c = I(ks(this.sequence(e.slice(t + 1, s))));
5100
5107
  return r([c]), this.userFunction(Z(o), `${Z(o)}${Z([c])}`, [...o, c]), s - 1;
5101
5108
  }
5102
5109
  userFunction(e, t, n) {
@@ -5124,7 +5131,7 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
5124
5131
  return n(this.applied(r, a), { separate: !0 }), i > t + 1 ? i - 1 : t;
5125
5132
  }
5126
5133
  applied(e, t) {
5127
- let n = t ? Os(t) : null, r = e.sup ? [Oe(e.sup)] : [], i = Qe(e.name);
5134
+ let n = t ? ks(t) : null, r = e.sup ? [Oe(e.sup)] : [], i = Qe(e.name);
5128
5135
  if (i && n) return [I(n, i.open, i.close), ...r];
5129
5136
  let a = n && e.base ? [
5130
5137
  ...n,
@@ -5185,7 +5192,7 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
5185
5192
  if (e?.kind === "unsupported") return this.slot(i, e.what, q([a])), n;
5186
5193
  let t = this.functionHead(a.name, `${o}.fn`), r = this.row(a.argument, `${o}.a`);
5187
5194
  if (t) return i(this.applied(t, r), { separate: !0 }), n;
5188
- let s = this.row(a.name, `${o}.fn`), c = I(Os(r));
5195
+ let s = this.row(a.name, `${o}.fn`), c = I(ks(r));
5189
5196
  return i([...s, c], { separate: !0 }), this.userFunction(Z(s), q([a]), [...s, c]), n;
5190
5197
  }
5191
5198
  case "table": return this.slot(i, "a matrix", q([a])), n;
@@ -5194,21 +5201,21 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
5194
5201
  }
5195
5202
  fraction(e, t, n, r, i) {
5196
5203
  if (!e.bar) return this.slot(i, "a stacked expression without a fraction bar", q([e])), r;
5197
- let a = xs(e, t);
5204
+ let a = Ss(e, t);
5198
5205
  if (a) {
5199
5206
  for (let e of a.paths) this.orders.add(e);
5200
- let t = a.operator ? this.nextFactor(n, r + 1) : r + 1, i = q([e]) + ws(n.slice(r + 1, t)), o = Cs(a.order);
5201
- this.omit(o, i, a.italic ? `${i} looks like ${o}, which isn't supported: it was kept as a fraction.` : `${ks(o)} (${i}) isn't supported: it was kept as a fraction.`);
5207
+ let t = a.operator ? this.nextFactor(n, r + 1) : r + 1, i = q([e]) + Ts(n.slice(r + 1, t)), o = ws(a.order);
5208
+ this.omit(o, i, a.italic ? `${i} looks like ${o}, which isn't supported: it was kept as a fraction.` : `${As(o)} (${i}) isn't supported: it was kept as a fraction.`);
5202
5209
  }
5203
5210
  let o = this.row(e.num, `${t}.n`), s = this.row(e.den, `${t}.d`), c = () => (i([De(o, s)]), r);
5204
5211
  if (a) return c();
5205
5212
  let l = this.differentials.get(o[0]), u = this.differentials.get(s[0]);
5206
5213
  if (!l || !u) return c();
5207
5214
  let d = s.slice(1);
5208
- if (o[1]?.kind === "superscript" || Es(o[1], "_") || d[d.length - 1]?.kind === "superscript" || d.length === 0 || !ut(d)) return c();
5215
+ if (o[1]?.kind === "superscript" || Ds(o[1], "_") || d[d.length - 1]?.kind === "superscript" || d.length === 0 || !ut(d)) return c();
5209
5216
  let f = o.length === 1, p = f ? this.nextFactor(n, r + 1) : r + 1;
5210
5217
  if (f && p === r + 1) return c();
5211
- let m = f ? ws(n.slice(r + 1, p)) : "", h = l !== "italic" && u !== "italic", g = "derivative", ee = null;
5218
+ let m = f ? Ts(n.slice(r + 1, p)) : "", h = l !== "italic" && u !== "italic", g = "derivative", ee = null;
5212
5219
  if (!h) {
5213
5220
  let n = f ? m : Z(o.slice(1)), r = this.decide(t, "derivative", "A derivative, or a fraction?", {
5214
5221
  latex: wa([e]) + (f ? `\\,${m}` : ""),
@@ -5222,11 +5229,11 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
5222
5229
  }]);
5223
5230
  g = r.chosen, ee = r.became;
5224
5231
  }
5225
- if ((l === "partial" || u === "partial") && this.notes.add(Ns), g === "fraction") {
5232
+ if ((l === "partial" || u === "partial") && this.notes.add(Ps), g === "fraction") {
5226
5233
  let e = [De(o, s)];
5227
5234
  return i(e), ee?.(e), r;
5228
5235
  }
5229
- let _ = [Ae(Os(f ? this.sequence(n.slice(r + 1, p)) : o.slice(1)), d)];
5236
+ let _ = [Ae(ks(f ? this.sequence(n.slice(r + 1, p)) : o.slice(1)), d)];
5230
5237
  return i(_, { separate: !0 }), ee?.(_), f ? p - 1 : r;
5231
5238
  }
5232
5239
  scripts(e, t, n, r, i, a) {
@@ -5237,7 +5244,7 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
5237
5244
  }
5238
5245
  if (o === "10" && !e.sub && s && /^[+\-−]?[0-9]+$/.test(s)) {
5239
5246
  let e = i[i.length - 1];
5240
- if ((Es(e, "×") || Es(e, "·")) && Ds(i.slice(0, -1))) return i.pop(), i.push(...L(`e${s.replace("−", "-")}`)), r;
5247
+ if ((Ds(e, "×") || Ds(e, "·")) && Os(i.slice(0, -1))) return i.pop(), i.push(...L(`e${s.replace("−", "-")}`)), r;
5241
5248
  }
5242
5249
  if ((o === "e" || o === "ⅇ") && !e.sub && e.sup) {
5243
5250
  let n = this.row(e.sup, `${t}.p`);
@@ -5253,7 +5260,7 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
5253
5260
  label: "A variable called e, raised to that power"
5254
5261
  }]), l = F(s === "constant" ? "exponentiale" : "e");
5255
5262
  s === "variable" && this.italic.add(l);
5256
- let u = is(e.sup), d = u !== null && /^[0-9]+$/.test(u) && !this.orders.has(t), f = d && ds(e.sup), p = d && !f ? this.digitSuperscript(t, {
5263
+ let u = is(e.sup), d = u !== null && /^[0-9]+$/.test(u) && !this.orders.has(t), f = d && fs(e.sup), p = d && !f ? this.digitSuperscript(t, {
5257
5264
  latex: wa([e]),
5258
5265
  text: i
5259
5266
  }, [F("e")], u) : null, m = s === "variable" && (f || p?.chosen === "name"), h = m ? [
@@ -5276,7 +5283,7 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
5276
5283
  }), r;
5277
5284
  }
5278
5285
  let l = is(e.sup);
5279
- if (l !== null && /^[0-9]+$/.test(l) && ps(e.base) && !ds(e.sup) && !this.orders.has(t)) {
5286
+ if (l !== null && /^[0-9]+$/.test(l) && ms(e.base) && !fs(e.sup) && !this.orders.has(t)) {
5280
5287
  let { became: n } = this.digitSuperscript(t, {
5281
5288
  latex: wa([e]),
5282
5289
  text: q([e])
@@ -5300,7 +5307,7 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
5300
5307
  }
5301
5308
  if (r && cs(r)) {
5302
5309
  let t = n.length + 1;
5303
- n.push(F("_"), ...us(r, 1));
5310
+ n.push(F("_"), ...ds(r, 1));
5304
5311
  let i = Dt(n.map((e) => e.kind === "symbol" ? e.value : ""));
5305
5312
  if (i && [
5306
5313
  i.accent,
@@ -5326,17 +5333,17 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
5326
5333
  return i ? (this.decorated(t, i, "charge", q([e])), t.splice(0, t.length, ...i), !0) : !1;
5327
5334
  }
5328
5335
  leadingCharge(e, t) {
5329
- let n = Fs(e.sup, /,/);
5336
+ let n = Is(e.sup, /,/);
5330
5337
  if (n && n[1].length > 0 && this.charged(e, t, is(n[0]) ?? "")) return n[1];
5331
5338
  let r = is(e.sup);
5332
5339
  return r !== null && this.charged(e, t, r) ? [] : null;
5333
5340
  }
5334
5341
  superscriptPart(e, t, n, r = e.sup) {
5335
- let i = is(r), a = i !== null && cs(i) && ls(i), o = i ? Array.from(i.replace(/,/g, "")).length : 0, s = () => Oe(this.row(r, `${t}.p`)), c = () => [
5342
+ let i = is(r), a = i !== null && cs(i) && us(i), o = i ? Array.from(i.replace(/,/g, "")).length : 0, s = () => Oe(this.row(r, `${t}.p`)), c = () => [
5336
5343
  F("_"),
5337
5344
  F("_"),
5338
- ...us(i ?? "", 2)
5339
- ], l = (t) => this.charged(e, n, t), u = r === e.sup ? Fs(r, /,/) : null;
5345
+ ...ds(i ?? "", 2)
5346
+ ], l = (t) => this.charged(e, n, t), u = r === e.sup ? Is(r, /,/) : null;
5340
5347
  if (u && u[1].length > 0 && l(is(u[0]) ?? "")) return this.superscriptPart(e, t, n, u[1]), !0;
5341
5348
  if (a && as(r)) return n.push(...c()), !0;
5342
5349
  if (i !== null && l(i)) return !0;
@@ -5344,6 +5351,26 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
5344
5351
  let t = q([e]);
5345
5352
  return this.omit("a charge", t, `A charge as a superscript (${t}) isn't supported: it was left out.`, n), !1;
5346
5353
  }
5354
+ let d = i === null ? ls(r) : null;
5355
+ if (d !== null) {
5356
+ let i = r[0], a = () => [
5357
+ F("_"),
5358
+ F("_"),
5359
+ ...ds(d, 2)
5360
+ ];
5361
+ if (as(i.base) && as(i.sub)) return n.push(...a()), !0;
5362
+ let o = Z(n), c = n.map((e) => e.kind === "symbol" ? e.value : "").join(""), l = q(r), { chosen: u, became: f } = this.decide(t, "name-superscript", "Part of the name, or a power?", {
5363
+ latex: wa([e]),
5364
+ text: q([e])
5365
+ }, [{
5366
+ id: "name",
5367
+ label: `Part of the name: ${o} with the superscript ${l} (${c}__${d.replace(/,/g, "__")})`
5368
+ }, {
5369
+ id: "power",
5370
+ label: `A power: ${o} to the power ${l}`
5371
+ }]);
5372
+ return n.push(...u === "name" ? a() : [s()]), f(n), u === "name";
5373
+ }
5347
5374
  if (a && o >= 2) {
5348
5375
  let r = Z(n), a = q([e]), { chosen: o, became: l } = this.decide(t, "name-superscript", "Part of the name, or a power?", {
5349
5376
  latex: wa([e]),
@@ -5359,7 +5386,7 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
5359
5386
  }
5360
5387
  if (i !== null && /^[0-9]+(,[0-9]+)*$/.test(i)) {
5361
5388
  let e = (e) => e.kind === "text" && /^,+$/.test(e.text);
5362
- if (ds(r.filter((t) => !e(t)))) return n.push(...c()), !0;
5389
+ if (fs(r.filter((t) => !e(t)))) return n.push(...c()), !0;
5363
5390
  }
5364
5391
  if (i !== null && /^[0-9]+$/.test(i) && !this.orders.has(t)) {
5365
5392
  let { chosen: r, became: a } = this.digitSuperscript(t, {
@@ -5393,7 +5420,7 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
5393
5420
  atoms: [this.piecewise(t.node, t.path)],
5394
5421
  scripted: !1
5395
5422
  };
5396
- let n = this.sequence(e.items), r = e.open === "[" && e.close === "]" ? this.concentration(n, `[${ws(e.items)}]`) : null;
5423
+ let n = this.sequence(e.items), r = e.open === "[" && e.close === "]" ? this.concentration(n, `[${Ts(e.items)}]`) : null;
5397
5424
  return r ? {
5398
5425
  atoms: r,
5399
5426
  scripted: !0
@@ -5435,7 +5462,7 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
5435
5462
  piecewise(e, t) {
5436
5463
  let n = [], r = null;
5437
5464
  return e.rows.forEach((i, a) => {
5438
- let [o, s] = Is(i), c = `${t}.t${a}`, l = this.row(o, `${c}.v`), u = Rs(s), d = a === e.rows.length - 1;
5465
+ let [o, s] = Ls(i), c = `${t}.t${a}`, l = this.row(o, `${c}.v`), u = zs(s), d = a === e.rows.length - 1;
5439
5466
  if (u.otherwise || u.nodes.length === 0 && d && a > 0) {
5440
5467
  r = l;
5441
5468
  return;
@@ -5444,7 +5471,7 @@ var Ns = "A partial derivative (∂) was read as an ordinary one: CellML has no
5444
5471
  }), n.length === 0 ? Me([[r ?? [], []]], null) : Me(n, r);
5445
5472
  }
5446
5473
  };
5447
- function Fs(e, t, n = !1) {
5474
+ function Is(e, t, n = !1) {
5448
5475
  let r = e.map((e, t) => t);
5449
5476
  n && r.reverse();
5450
5477
  for (let i of r) {
@@ -5463,12 +5490,12 @@ function Fs(e, t, n = !1) {
5463
5490
  }
5464
5491
  return null;
5465
5492
  }
5466
- function Is(e) {
5467
- if (e.length >= 2) return [Ls(e[0]), e.slice(1).flat()];
5468
- let [t = []] = e, [n, r] = Fs(t, /&/) ?? Fs(t, /\b(if|for|when)\b/i) ?? Fs(t, /,/, !0) ?? [t, []];
5469
- return [Ls(n), r];
5470
- }
5471
5493
  function Ls(e) {
5494
+ if (e.length >= 2) return [Rs(e[0]), e.slice(1).flat()];
5495
+ let [t = []] = e, [n, r] = Is(t, /&/) ?? Is(t, /\b(if|for|when)\b/i) ?? Is(t, /,/, !0) ?? [t, []];
5496
+ return [Rs(n), r];
5497
+ }
5498
+ function Rs(e) {
5472
5499
  let t = e[e.length - 1];
5473
5500
  if (t?.kind !== "text") return e;
5474
5501
  let n = t.text.replace(/[\s\u00a0]*,[\s\u00a0]*$/, "");
@@ -5477,7 +5504,7 @@ function Ls(e) {
5477
5504
  text: n
5478
5505
  }] : []];
5479
5506
  }
5480
- function Rs(e) {
5507
+ function zs(e) {
5481
5508
  let t = q(e).replace(/[\s &]/g, "");
5482
5509
  if (/^,?(otherwise|else)$/i.test(t)) return {
5483
5510
  nodes: [],
@@ -5499,29 +5526,29 @@ function Rs(e) {
5499
5526
  }
5500
5527
  //#endregion
5501
5528
  //#region src/components/PasteReviewDialog.vue?vue&type=script&setup=true&lang.ts
5502
- var zs = { class: "review" }, Bs = {
5529
+ var Bs = { class: "review" }, Vs = {
5503
5530
  key: 0,
5504
5531
  class: "preview-number"
5505
- }, Vs = ["innerHTML"], Hs = {
5532
+ }, Hs = ["innerHTML"], Us = {
5506
5533
  key: 0,
5507
5534
  class: "review-section",
5508
5535
  "data-role": "paste-assumptions"
5509
- }, Us = ["data-kind"], Ws = [
5536
+ }, Ws = ["data-kind"], Gs = [
5510
5537
  "data-kind",
5511
5538
  "onMouseenter",
5512
5539
  "onFocusin"
5513
- ], Gs = { class: "assumption-question" }, Ks = ["innerHTML"], qs = {
5540
+ ], Ks = { class: "assumption-question" }, qs = ["innerHTML"], Js = {
5514
5541
  key: 0,
5515
5542
  class: "assumption-line"
5516
- }, Js = ["for"], Ys = {
5543
+ }, Ys = ["for"], Xs = {
5517
5544
  key: 1,
5518
5545
  class: "review-section review-omissions",
5519
5546
  "data-role": "paste-omissions"
5520
- }, Xs = { class: "review-heading" }, Zs = { class: "review-list" }, Qs = ["onMouseenter"], $s = {
5547
+ }, Zs = { class: "review-heading" }, Qs = { class: "review-list" }, $s = ["onMouseenter"], ec = {
5521
5548
  key: 2,
5522
5549
  class: "review-section",
5523
5550
  "data-role": "paste-notes"
5524
- }, ec = { class: "review-list review-notes" }, tc = /*#__PURE__*/ Ao(/* @__PURE__ */ u({
5551
+ }, tc = { class: "review-list review-notes" }, nc = /*#__PURE__*/ Ao(/* @__PURE__ */ u({
5525
5552
  __name: "PasteReviewDialog",
5526
5553
  props: {
5527
5554
  paste: {},
@@ -5636,7 +5663,7 @@ var zs = { class: "review" }, Bs = {
5636
5663
  "data-role": "paste-confirm",
5637
5664
  onClick: pe
5638
5665
  }, null, 8, ["label"])]),
5639
- default: T(() => [o("div", zs, [
5666
+ default: T(() => [o("div", Bs, [
5640
5667
  o("section", {
5641
5668
  ref_key: "previewEl",
5642
5669
  ref: le,
@@ -5646,11 +5673,11 @@ var zs = { class: "review" }, Bs = {
5646
5673
  }, [(v(!0), a(e, null, b(oe.value, (e, t) => (v(), a("div", {
5647
5674
  key: t,
5648
5675
  class: "preview-line"
5649
- }, [S.value ? (v(), a("span", Bs, x(t + 1), 1)) : i("", !0), o("div", {
5676
+ }, [S.value ? (v(), a("span", Vs, x(t + 1), 1)) : i("", !0), o("div", {
5650
5677
  class: "preview-math",
5651
5678
  innerHTML: e
5652
- }, null, 8, Vs)]))), 128))], 512),
5653
- g.value.assumptions.length ? (v(), a("section", Hs, [n[5] ||= o("h3", { class: "review-heading" }, "Check how these were read", -1), (v(!0), a(e, null, b(te.value, (t) => (v(), a(e, { key: t.kind }, [t.options.length ? (v(), a("div", {
5679
+ }, null, 8, Hs)]))), 128))], 512),
5680
+ g.value.assumptions.length ? (v(), a("section", Us, [n[5] ||= o("h3", { class: "review-heading" }, "Check how these were read", -1), (v(!0), a(e, null, b(te.value, (t) => (v(), a(e, { key: t.kind }, [t.options.length ? (v(), a("div", {
5654
5681
  key: 0,
5655
5682
  class: "assumption-all",
5656
5683
  "data-kind": t.kind
@@ -5660,7 +5687,7 @@ var zs = { class: "review" }, Bs = {
5660
5687
  size: "small",
5661
5688
  text: "",
5662
5689
  onClick: (n) => re(t.kind, e.id)
5663
- }, null, 8, ["label", "onClick"]))), 128))], 8, Us)) : i("", !0), (v(!0), a(e, null, b(t.assumptions, (t) => (v(), a("fieldset", {
5690
+ }, null, 8, ["label", "onClick"]))), 128))], 8, Ws)) : i("", !0), (v(!0), a(e, null, b(t.assumptions, (t) => (v(), a("fieldset", {
5664
5691
  key: t.id,
5665
5692
  class: "assumption",
5666
5693
  "data-kind": t.kind,
@@ -5668,13 +5695,13 @@ var zs = { class: "review" }, Bs = {
5668
5695
  onMouseleave: n[0] ||= (e) => de.value = [],
5669
5696
  onFocusin: (e) => de.value = t.atomIds,
5670
5697
  onFocusout: n[1] ||= (e) => de.value = []
5671
- }, [o("legend", Gs, [
5698
+ }, [o("legend", Ks, [
5672
5699
  o("span", {
5673
5700
  class: "fragment",
5674
5701
  innerHTML: E(t.latex)
5675
- }, null, 8, Ks),
5702
+ }, null, 8, qs),
5676
5703
  o("span", null, x(t.question), 1),
5677
- S.value ? (v(), a("span", qs, "equation " + x(t.line + 1), 1)) : i("", !0)
5704
+ S.value ? (v(), a("span", Js, "equation " + x(t.line + 1), 1)) : i("", !0)
5678
5705
  ]), (v(!0), a(e, null, b(t.options, (e) => (v(), a("div", {
5679
5706
  key: e.id,
5680
5707
  class: "assumption-option"
@@ -5692,16 +5719,16 @@ var zs = { class: "review" }, Bs = {
5692
5719
  "model-value",
5693
5720
  "data-option",
5694
5721
  "onUpdate:modelValue"
5695
- ]), o("label", { for: `${f}-${t.id}-${e.id}` }, x(e.label), 9, Js)]))), 128))], 40, Ws))), 128))], 64))), 128))])) : i("", !0),
5696
- g.value.omissions.length ? (v(), a("section", Ys, [o("h3", Xs, [n[6] ||= o("i", {
5722
+ ]), o("label", { for: `${f}-${t.id}-${e.id}` }, x(e.label), 9, Ys)]))), 128))], 40, Gs))), 128))], 64))), 128))])) : i("", !0),
5723
+ g.value.omissions.length ? (v(), a("section", Xs, [o("h3", Zs, [n[6] ||= o("i", {
5697
5724
  class: "pi pi-exclamation-triangle",
5698
5725
  "aria-hidden": "true"
5699
- }, null, -1), c(" Not supported (" + x(g.value.omissions.length) + ") ", 1)]), o("ul", Zs, [(v(!0), a(e, null, b(g.value.omissions, (t, r) => (v(), a("li", {
5726
+ }, null, -1), c(" Not supported (" + x(g.value.omissions.length) + ") ", 1)]), o("ul", Qs, [(v(!0), a(e, null, b(g.value.omissions, (t, r) => (v(), a("li", {
5700
5727
  key: r,
5701
5728
  onMouseenter: (e) => de.value = t.atomIds,
5702
5729
  onMouseleave: n[2] ||= (e) => de.value = []
5703
- }, [S.value && t.line >= 0 ? (v(), a(e, { key: 0 }, [c("Equation " + x(t.line + 1) + ": ", 1)], 64)) : i("", !0), c(x(t.message), 1)], 40, Qs))), 128))])])) : i("", !0),
5704
- g.value.notes.length ? (v(), a("section", $s, [o("ul", ec, [(v(!0), a(e, null, b(g.value.notes, (e) => (v(), a("li", { key: e }, x(e), 1))), 128))])])) : i("", !0)
5730
+ }, [S.value && t.line >= 0 ? (v(), a(e, { key: 0 }, [c("Equation " + x(t.line + 1) + ": ", 1)], 64)) : i("", !0), c(x(t.message), 1)], 40, $s))), 128))])])) : i("", !0),
5731
+ g.value.notes.length ? (v(), a("section", ec, [o("ul", tc, [(v(!0), a(e, null, b(g.value.notes, (e) => (v(), a("li", { key: e }, x(e), 1))), 128))])])) : i("", !0)
5705
5732
  ])]),
5706
5733
  _: 1
5707
5734
  }, 8, [
@@ -5713,7 +5740,7 @@ var zs = { class: "review" }, Bs = {
5713
5740
  }), [["__scopeId", "data-v-637632ac"]]);
5714
5741
  //#endregion
5715
5742
  //#region src/components/contentStable.ts
5716
- function nc(e) {
5743
+ function rc(e) {
5717
5744
  let t = null;
5718
5745
  return n(() => {
5719
5746
  let n = e(), r = JSON.stringify(n) ?? "";
@@ -5725,14 +5752,14 @@ function nc(e) {
5725
5752
  }
5726
5753
  //#endregion
5727
5754
  //#region src/editor/parse.ts
5728
- function rc(e) {
5755
+ function ic(e) {
5729
5756
  let t = [];
5730
5757
  return {
5731
- ast: dc(e, t),
5758
+ ast: fc(e, t),
5732
5759
  diagnostics: t
5733
5760
  };
5734
5761
  }
5735
- var ic = {
5762
+ var ac = {
5736
5763
  "+": "+",
5737
5764
  "-": "-",
5738
5765
  "−": "-",
@@ -5742,7 +5769,7 @@ var ic = {
5742
5769
  "×": "*",
5743
5770
  ",": ",",
5744
5771
  ...Object.fromEntries(Lt.map((e) => [e.symbol, e.symbol]))
5745
- }, ac = /^[A-Za-z_][A-Za-z0-9_]*$/, oc = [
5772
+ }, oc = /^[A-Za-z_][A-Za-z0-9_]*$/, sc = [
5746
5773
  {
5747
5774
  symbol: "∨",
5748
5775
  type: "Or"
@@ -5756,7 +5783,7 @@ var ic = {
5756
5783
  type: "And"
5757
5784
  }
5758
5785
  ];
5759
- function sc(e, t) {
5786
+ function cc(e, t) {
5760
5787
  let n = [], r = 0;
5761
5788
  for (; r < e.length;) {
5762
5789
  let i = e[r];
@@ -5830,7 +5857,7 @@ function sc(e, t) {
5830
5857
  });
5831
5858
  continue;
5832
5859
  }
5833
- let o = ic[i.value], s = [i.id];
5860
+ let o = ac[i.value], s = [i.id];
5834
5861
  o ? n.push({
5835
5862
  kind: "operator",
5836
5863
  op: o,
@@ -5851,19 +5878,19 @@ function sc(e, t) {
5851
5878
  }
5852
5879
  return n;
5853
5880
  }
5854
- function cc(e) {
5881
+ function lc(e) {
5855
5882
  if (e === "=") return "Equal";
5856
5883
  let t = Vt(e);
5857
5884
  return t?.role === "comparison" ? t.type : null;
5858
5885
  }
5859
- var lc = (e) => e === "*" ? "×" : e === "-" ? "−" : e;
5860
- function uc() {
5886
+ var uc = (e) => e === "*" ? "×" : e === "-" ? "−" : e;
5887
+ function dc() {
5861
5888
  return { type: "Placeholder" };
5862
5889
  }
5863
- function dc(e, t) {
5864
- return e.length === 0 ? uc() : new fc(sc(e, t), t).parseAll();
5890
+ function fc(e, t) {
5891
+ return e.length === 0 ? dc() : new pc(cc(e, t), t).parseAll();
5865
5892
  }
5866
- var fc = class {
5893
+ var pc = class {
5867
5894
  tokens;
5868
5895
  diagnostics;
5869
5896
  index = 0;
@@ -5876,8 +5903,8 @@ var fc = class {
5876
5903
  return e;
5877
5904
  }
5878
5905
  parseLogic(e) {
5879
- if (e === oc.length) return this.parseNot();
5880
- let { symbol: t, type: n } = oc[e], r = [this.parseLogic(e + 1)];
5906
+ if (e === sc.length) return this.parseNot();
5907
+ let { symbol: t, type: n } = sc[e], r = [this.parseLogic(e + 1)];
5881
5908
  for (; this.peekOperator(t);) this.next(), r.push(this.parseLogic(e + 1));
5882
5909
  return r.length === 1 ? r[0] : {
5883
5910
  type: n,
@@ -5893,7 +5920,7 @@ var fc = class {
5893
5920
  parseComparison() {
5894
5921
  let e = this.parseAdditive(), t = 0;
5895
5922
  for (;;) {
5896
- let n = this.peek(), r = n?.kind === "operator" ? cc(n.op) : null;
5923
+ let n = this.peek(), r = n?.kind === "operator" ? lc(n.op) : null;
5897
5924
  if (!n || !r) return e;
5898
5925
  this.next(), t++ > 0 && this.diagnostics.push({
5899
5926
  message: "Comparisons can't be chained: join them with ∧",
@@ -5966,12 +5993,12 @@ var fc = class {
5966
5993
  }
5967
5994
  parseSuperscript() {
5968
5995
  let e = this.next(), t = e.atom;
5969
- return t.kind === "superscript" ? this.child(t.sup, "Empty exponent", e.atomIds) : uc();
5996
+ return t.kind === "superscript" ? this.child(t.sup, "Empty exponent", e.atomIds) : dc();
5970
5997
  }
5971
5998
  parsePrimary() {
5972
5999
  this.skipInvalid();
5973
6000
  let e = this.peek();
5974
- if (!e || !this.startsPrimary(e)) return this.reportMissing(e), uc();
6001
+ if (!e || !this.startsPrimary(e)) return this.reportMissing(e), dc();
5975
6002
  switch (this.next(), e.kind) {
5976
6003
  case "number": return this.parseNumber(e);
5977
6004
  case "identifier": return {
@@ -5984,7 +6011,7 @@ var fc = class {
5984
6011
  };
5985
6012
  case "function": return this.parseFunction(e.name, e.atomIds);
5986
6013
  case "structure": return this.parseStructure(e.atom, e.atomIds);
5987
- default: return uc();
6014
+ default: return dc();
5988
6015
  }
5989
6016
  }
5990
6017
  parseNumber(e) {
@@ -6000,7 +6027,7 @@ var fc = class {
6000
6027
  }
6001
6028
  unitsName(e) {
6002
6029
  let t = e.atom.units.map((e) => e.kind === "symbol" ? e.value : "?").join("");
6003
- return ac.test(t) ? t : (t && this.diagnostics.push({
6030
+ return oc.test(t) ? t : (t && this.diagnostics.push({
6004
6031
  message: `"${t}" isn't a units name`,
6005
6032
  atomIds: e.atomIds
6006
6033
  }), null);
@@ -6013,7 +6040,7 @@ var fc = class {
6013
6040
  message: `${e} needs an argument`,
6014
6041
  atomIds: t,
6015
6042
  incomplete: !0
6016
- }), r = [uc()]);
6043
+ }), r = [dc()]);
6017
6044
  let a = {
6018
6045
  type: "FunctionCall",
6019
6046
  name: e,
@@ -6080,10 +6107,10 @@ var fc = class {
6080
6107
  }
6081
6108
  case "superscript": return {
6082
6109
  type: "Power",
6083
- base: uc(),
6110
+ base: dc(),
6084
6111
  exponent: this.child(e.sup)
6085
6112
  };
6086
- case "units": return uc();
6113
+ case "units": return dc();
6087
6114
  }
6088
6115
  }
6089
6116
  child(e, t, n) {
@@ -6091,13 +6118,13 @@ var fc = class {
6091
6118
  message: t,
6092
6119
  atomIds: n,
6093
6120
  incomplete: !0
6094
- }), dc(e, this.diagnostics);
6121
+ }), fc(e, this.diagnostics);
6095
6122
  }
6096
6123
  reportMissing(e) {
6097
6124
  let t = this.tokens[this.index - 1], n, r;
6098
- if (t?.kind === "operator" && t.op !== ",") n = cc(t.op) ? t.op === "=" ? "Missing right-hand side" : `Missing right-hand side of ${t.op}` : `Missing operand after ${lc(t.op)}`, r = t.atomIds;
6125
+ if (t?.kind === "operator" && t.op !== ",") n = lc(t.op) ? t.op === "=" ? "Missing right-hand side" : `Missing right-hand side of ${t.op}` : `Missing operand after ${uc(t.op)}`, r = t.atomIds;
6099
6126
  else if (t) return;
6100
- else if (e?.kind === "operator") n = cc(e.op) ? e.op === "=" ? "Missing left-hand side" : `Missing left-hand side of ${e.op}` : `Missing operand before ${lc(e.op)}`, r = e.atomIds;
6127
+ else if (e?.kind === "operator") n = lc(e.op) ? e.op === "=" ? "Missing left-hand side" : `Missing left-hand side of ${e.op}` : `Missing operand before ${uc(e.op)}`, r = e.atomIds;
6101
6128
  else if (e?.kind === "structure" && e.atom.kind === "superscript") n = "Missing base for the exponent", r = e.atomIds;
6102
6129
  else return;
6103
6130
  this.diagnostics.push({
@@ -6151,7 +6178,7 @@ var fc = class {
6151
6178
  };
6152
6179
  //#endregion
6153
6180
  //#region src/renderers/mathjson.ts
6154
- function pc(e) {
6181
+ function mc(e) {
6155
6182
  return Ye(e)?.mathJson ?? e;
6156
6183
  }
6157
6184
  function Q(e) {
@@ -6174,7 +6201,7 @@ function Q(e) {
6174
6201
  Q(e.radicand),
6175
6202
  Q(e.degree)
6176
6203
  ] : ["Sqrt", Q(e.radicand)];
6177
- case "FunctionCall": return [pc(e.name), ...e.args.map(Q)];
6204
+ case "FunctionCall": return [mc(e.name), ...e.args.map(Q)];
6178
6205
  case "Equal":
6179
6206
  case "Less":
6180
6207
  case "Greater":
@@ -6213,15 +6240,15 @@ function Q(e) {
6213
6240
  default: return null;
6214
6241
  }
6215
6242
  }
6216
- function mc(e) {
6243
+ function hc(e) {
6217
6244
  return JSON.stringify(Q(e), null, 2);
6218
6245
  }
6219
6246
  //#endregion
6220
6247
  //#region src/renderers/mathml.ts
6221
- function hc(e) {
6248
+ function gc(e) {
6222
6249
  throw Error(`Unsupported AST node: ${JSON.stringify(e)}`);
6223
6250
  }
6224
- function gc(e, t) {
6251
+ function _c(e, t) {
6225
6252
  return `
6226
6253
  <apply>
6227
6254
  <${e}/>
@@ -6229,7 +6256,7 @@ function gc(e, t) {
6229
6256
  </apply>
6230
6257
  `;
6231
6258
  }
6232
- function _c(e, t) {
6259
+ function vc(e, t) {
6233
6260
  let n = t.cellml ? ` cellml:units="${e.units ?? "dimensionless"}"` : "", [r, i] = String(e.value).split("e"), a = e.scientific ? {
6234
6261
  mantissa: e.scientific.mantissa,
6235
6262
  exponent: e.scientific.exponent
@@ -6241,14 +6268,14 @@ function _c(e, t) {
6241
6268
  }
6242
6269
  function $(e, t = {}) {
6243
6270
  switch (e.type) {
6244
- case "Number": return _c(e, t);
6271
+ case "Number": return vc(e, t);
6245
6272
  case "Identifier": return `<ci>${e.name}</ci>`;
6246
6273
  case "Constant": return `<${Ie(e.name).mathml}/>`;
6247
- case "Add": return gc("plus", e.children.map((e) => $(e, t)));
6248
- case "Multiply": return gc("times", e.children.map((e) => $(e, t)));
6249
- case "Subtract": return gc("minus", [$(e.minuend, t), $(e.subtrahend, t)]);
6250
- case "Negate": return gc("minus", [$(e.value, t)]);
6251
- case "Abs": return gc("abs", [$(e.value, t)]);
6274
+ case "Add": return _c("plus", e.children.map((e) => $(e, t)));
6275
+ case "Multiply": return _c("times", e.children.map((e) => $(e, t)));
6276
+ case "Subtract": return _c("minus", [$(e.minuend, t), $(e.subtrahend, t)]);
6277
+ case "Negate": return _c("minus", [$(e.value, t)]);
6278
+ case "Abs": return _c("abs", [$(e.value, t)]);
6252
6279
  case "Group": return $(e.value, t);
6253
6280
  case "Root": return e.degree ? `
6254
6281
  <apply>
@@ -6258,7 +6285,7 @@ function $(e, t = {}) {
6258
6285
  </degree>
6259
6286
  ${$(e.radicand, t)}
6260
6287
  </apply>
6261
- ` : gc("root", [$(e.radicand, t)]);
6288
+ ` : _c("root", [$(e.radicand, t)]);
6262
6289
  case "FunctionCall": {
6263
6290
  let n = Ye(e.name), r = e.args.map((e) => $(e, t));
6264
6291
  return n?.mathMlTag ? n.mathMlTag === "log" && r.length === 2 ? `
@@ -6269,29 +6296,29 @@ function $(e, t = {}) {
6269
6296
  </logbase>
6270
6297
  ${r[0]}
6271
6298
  </apply>
6272
- ` : gc(n.mathMlTag, r) : `
6299
+ ` : _c(n.mathMlTag, r) : `
6273
6300
  <apply>
6274
6301
  <ci>${e.name}</ci>
6275
6302
  ${r.join("\n ")}
6276
6303
  </apply>
6277
6304
  `;
6278
6305
  }
6279
- case "Divide": return gc("divide", [$(e.numerator, t), $(e.denominator, t)]);
6280
- case "Equal": return gc("eq", [$(e.left, t), $(e.right, t)]);
6306
+ case "Divide": return _c("divide", [$(e.numerator, t), $(e.denominator, t)]);
6307
+ case "Equal": return _c("eq", [$(e.left, t), $(e.right, t)]);
6281
6308
  case "Less":
6282
6309
  case "Greater":
6283
6310
  case "LessEqual":
6284
6311
  case "GreaterEqual":
6285
- case "NotEqual": return gc(Ht(e.type).mathml, [$(e.left, t), $(e.right, t)]);
6312
+ case "NotEqual": return _c(Ht(e.type).mathml, [$(e.left, t), $(e.right, t)]);
6286
6313
  case "And":
6287
6314
  case "Or":
6288
- case "Xor": return gc(Ht(e.type).mathml, e.children.map((e) => $(e, t)));
6289
- case "Not": return gc("not", [$(e.value, t)]);
6315
+ case "Xor": return _c(Ht(e.type).mathml, e.children.map((e) => $(e, t)));
6316
+ case "Not": return _c("not", [$(e.value, t)]);
6290
6317
  case "Piecewise": {
6291
6318
  let n = (e) => $(e, t), r = e.pieces.map(({ value: e, condition: t }) => `<piece>${n(e)}${n(t)}</piece>`), i = e.otherwise ? `<otherwise>${n(e.otherwise)}</otherwise>` : "";
6292
6319
  return `<piecewise>${r.join("")}${i}</piecewise>`;
6293
6320
  }
6294
- case "Power": return gc("power", [$(e.base, t), $(e.exponent, t)]);
6321
+ case "Power": return _c("power", [$(e.base, t), $(e.exponent, t)]);
6295
6322
  case "Derivative": return `
6296
6323
  <apply>
6297
6324
  <diff/>
@@ -6302,20 +6329,20 @@ function $(e, t = {}) {
6302
6329
  </apply>
6303
6330
  `;
6304
6331
  case "Placeholder": return "<ci>_</ci>";
6305
- default: return hc(e);
6332
+ default: return gc(e);
6306
6333
  }
6307
6334
  }
6308
6335
  //#endregion
6309
6336
  //#region src/renderers/presentationMathml.ts
6310
- var vc = "http://www.w3.org/1998/Math/MathML", yc = "<mo>ⅆ</mo>", bc = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
6311
- function xc(e) {
6337
+ var yc = "http://www.w3.org/1998/Math/MathML", bc = "<mo>ⅆ</mo>", xc = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
6338
+ function Sc(e) {
6312
6339
  if (e.length === 0) return "<mrow/>";
6313
6340
  let t = new Map(z(e).map((e) => [e.start, e])), n = new Map(dt(e).map((e) => [e.start, e])), r = [], i = !1;
6314
6341
  for (let a = 0; a < e.length;) {
6315
6342
  let o = e[a];
6316
6343
  if (o.kind === "superscript") {
6317
- let t = e[a - 1], n = t && !Tc(t) && r.length > 0 ? r.pop() : "<mrow/>";
6318
- r.push(`<msup>${n}${Sc(o.sup)}</msup>`), a++;
6344
+ let t = e[a - 1], n = t && !Ec(t) && r.length > 0 ? r.pop() : "<mrow/>";
6345
+ r.push(`<msup>${n}${Cc(o.sup)}</msup>`), a++;
6319
6346
  continue;
6320
6347
  }
6321
6348
  if (o.kind === "units") {
@@ -6325,64 +6352,64 @@ function xc(e) {
6325
6352
  i &&= (r.push("<mo>&#x2061;</mo>"), !1);
6326
6353
  let s = n.get(a);
6327
6354
  if (s) {
6328
- r.push(Dc(s)), a = s.end;
6355
+ r.push(Oc(s)), a = s.end;
6329
6356
  continue;
6330
6357
  }
6331
6358
  let c = t.get(a), l = c?.functionName ?? (o.kind === "function" ? o.name : null);
6332
6359
  if (l) {
6333
6360
  let t = c ? c.end : a + 1, [n, o] = [e[t], e[t + 1]];
6334
6361
  if (n?.kind === "group" && n.open === "(" && o?.kind === "superscript") {
6335
- r.push(`<msup>${Ec(l)}${Sc(o.sup)}</msup><mo>&#x2061;</mo>${Pc(n)}`), a = t + 2;
6362
+ r.push(`<msup>${Dc(l)}${Cc(o.sup)}</msup><mo>&#x2061;</mo>${Fc(n)}`), a = t + 2;
6336
6363
  continue;
6337
6364
  }
6338
- r.push(Ec(l)), i = !0, a = t;
6365
+ r.push(Dc(l)), i = !0, a = t;
6339
6366
  continue;
6340
6367
  }
6341
6368
  if (c) {
6342
- r.push(Ac(c.name)), a = c.end;
6369
+ r.push(jc(c.name)), a = c.end;
6343
6370
  continue;
6344
6371
  }
6345
- r.push(Pc(o)), a++;
6372
+ r.push(Fc(o)), a++;
6346
6373
  }
6347
6374
  return r.join("");
6348
6375
  }
6349
- var Sc = (e) => `<mrow>${xc(e)}</mrow>`;
6350
- function Cc(e) {
6351
- let t = e.filter((e) => e.length > 0), n = (e) => `<math xmlns="${vc}" display="block">${e}</math>`;
6352
- return t.length <= 1 ? n(xc(t[0] ?? [])) : n(`<mtable columnalign="left">${t.map((e) => `<mtr><mtd>${xc(e)}</mtd></mtr>`).join("")}</mtable>`);
6376
+ var Cc = (e) => `<mrow>${Sc(e)}</mrow>`;
6377
+ function wc(e) {
6378
+ let t = e.filter((e) => e.length > 0), n = (e) => `<math xmlns="${yc}" display="block">${e}</math>`;
6379
+ return t.length <= 1 ? n(Sc(t[0] ?? [])) : n(`<mtable columnalign="left">${t.map((e) => `<mtr><mtd>${Sc(e)}</mtd></mtr>`).join("")}</mtable>`);
6353
6380
  }
6354
- var wc = {
6381
+ var Tc = {
6355
6382
  "-": "−",
6356
6383
  "−": "−",
6357
6384
  "·": "⋅",
6358
6385
  "*": "⋅"
6359
- }, Tc = (e) => e.kind === "symbol" && (/^[+\-−=,·*×]$/.test(e.value) || Vt(e.value) !== void 0);
6360
- function Ec(e) {
6361
- return `<mi>${bc(Ye(e)?.latexName ?? e)}</mi>`;
6362
- }
6386
+ }, Ec = (e) => e.kind === "symbol" && (/^[+\-−=,·*×]$/.test(e.value) || Vt(e.value) !== void 0);
6363
6387
  function Dc(e) {
6388
+ return `<mi>${xc(Ye(e)?.latexName ?? e)}</mi>`;
6389
+ }
6390
+ function Oc(e) {
6364
6391
  if (e.exponent === null) return `<mn>${e.mantissa}</mn>`;
6365
6392
  let t = /^[+-]/.test(e.exponent) ? e.exponent[0] : "", n = e.exponent.slice(t.length), r = t ? `<mo>${t === "-" ? "−" : "+"}</mo>` : "";
6366
6393
  return `<mrow><mn>${e.mantissa}</mn><mo>×</mo><msup><mn>10</mn><mrow>${r}<mn>${n}</mn></mrow></msup></mrow>`;
6367
6394
  }
6368
- function Oc(e, t = !1) {
6395
+ function kc(e, t = !1) {
6369
6396
  let n = e.map((e) => Lo(e) ?? e).join("");
6370
- return t ? `<mi mathvariant="normal">${bc(n)}</mi>` : /^[0-9]+$/.test(n) ? `<mn>${n}</mn>` : Array.from(n).length === 1 ? `<mi>${bc(n)}</mi>` : `<mi mathvariant="italic">${bc(n)}</mi>`;
6397
+ return t ? `<mi mathvariant="normal">${xc(n)}</mi>` : /^[0-9]+$/.test(n) ? `<mn>${n}</mn>` : Array.from(n).length === 1 ? `<mi>${xc(n)}</mi>` : `<mi mathvariant="italic">${xc(n)}</mi>`;
6371
6398
  }
6372
- function kc({ count: e, sign: t }) {
6399
+ function Ac({ count: e, sign: t }) {
6373
6400
  let n = `<mo>${t === "+" ? "+" : "−"}</mo>`;
6374
6401
  return e === 1 ? [n] : [`<mn>${e}</mn>`, n];
6375
6402
  }
6376
- function Ac(e) {
6403
+ function jc(e) {
6377
6404
  let t = At(e).map((e) => e.value), n = Dt(t);
6378
- if (!n) return Oc(t);
6379
- let r = ([e, n], r = !1) => Oc(t.slice(e, n), r), i = (e) => e.length === 1 ? e[0] : `<mrow>${e.join("")}</mrow>`, a = (e) => i(e.flatMap((e, t) => t ? ["<mo>,</mo>", e] : [e])), o = n.parts.filter((e) => e.role === "sub").map((e) => r(e.text)), s = n.parts.filter((e) => e.role === "sup").map((e) => r(e.text, !0)), c = r(n.base);
6405
+ if (!n) return kc(t);
6406
+ let r = ([e, n], r = !1) => kc(t.slice(e, n), r), i = (e) => e.length === 1 ? e[0] : `<mrow>${e.join("")}</mrow>`, a = (e) => i(e.flatMap((e, t) => t ? ["<mo>,</mo>", e] : [e])), o = n.parts.filter((e) => e.role === "sub").map((e) => r(e.text)), s = n.parts.filter((e) => e.role === "sup").map((e) => r(e.text, !0)), c = r(n.base);
6380
6407
  if (n.accent) {
6381
6408
  let e = yt[n.accent.kind].mathml;
6382
- c = `<mover accent="true">${c}<mo>${bc(e)}</mo></mover>`;
6409
+ c = `<mover accent="true">${c}<mo>${xc(e)}</mo></mover>`;
6383
6410
  }
6384
- let l = n.charge ? kc(n.charge) : [], u = s.length ? a(s) : "";
6385
- n.conc ? (l.length && (c = `<msup>${c}${i(l)}</msup>`), c = Mc("[", "]", c)) : l.length && (u = i(s.length ? [
6411
+ let l = n.charge ? Ac(n.charge) : [], u = s.length ? a(s) : "";
6412
+ n.conc ? (l.length && (c = `<msup>${c}${i(l)}</msup>`), c = Nc("[", "]", c)) : l.length && (u = i(s.length ? [
6386
6413
  ...l,
6387
6414
  "<mo>,</mo>",
6388
6415
  ...s
@@ -6390,7 +6417,7 @@ function Ac(e) {
6390
6417
  let d = o.length ? a(o) : "";
6391
6418
  return d && u ? `<msubsup>${c}${d}${u}</msubsup>` : d ? `<msub>${c}${d}</msub>` : u ? `<msup>${c}${u}</msup>` : c;
6392
6419
  }
6393
- function jc(e) {
6420
+ function Mc(e) {
6394
6421
  let t = Ie(e);
6395
6422
  if (t) switch (t.symbol) {
6396
6423
  case "pi": return "<mi>π</mi>";
@@ -6399,31 +6426,31 @@ function jc(e) {
6399
6426
  case "notanumber": return "<mi mathvariant=\"normal\">NaN</mi>";
6400
6427
  default: return `<mi mathvariant="normal">${t.symbol}</mi>`;
6401
6428
  }
6402
- return e in wc ? `<mo>${wc[e]}</mo>` : /^[+=,×]$/.test(e) || Vt(e) ? `<mo>${bc(e)}</mo>` : /^[0-9.]$/.test(e) ? `<mn>${e}</mn>` : `<mi>${bc(Lo(e) ?? e)}</mi>`;
6429
+ return e in Tc ? `<mo>${Tc[e]}</mo>` : /^[+=,×]$/.test(e) || Vt(e) ? `<mo>${xc(e)}</mo>` : /^[0-9.]$/.test(e) ? `<mn>${e}</mn>` : `<mi>${xc(Lo(e) ?? e)}</mi>`;
6403
6430
  }
6404
- function Mc(e, t, n) {
6431
+ function Nc(e, t, n) {
6405
6432
  return `<mfenced${e === "(" && t === ")" ? "" : ` open="${e}" close="${t}"`}><mrow>${n}</mrow></mfenced>`;
6406
6433
  }
6407
- function Nc(e) {
6408
- let t = z(e), n = dt(e), r = e.length === 0 || e.length === 1 && e[0].kind === "group" || t.length === 1 && t[0].start === 0 && t[0].end === e.length || n.length === 1 && n[0].start === 0 && n[0].end === e.length, i = xc(e);
6409
- return r ? i : Mc("(", ")", i);
6410
- }
6411
6434
  function Pc(e) {
6435
+ let t = z(e), n = dt(e), r = e.length === 0 || e.length === 1 && e[0].kind === "group" || t.length === 1 && t[0].start === 0 && t[0].end === e.length || n.length === 1 && n[0].start === 0 && n[0].end === e.length, i = Sc(e);
6436
+ return r ? i : Nc("(", ")", i);
6437
+ }
6438
+ function Fc(e) {
6412
6439
  switch (e.kind) {
6413
- case "symbol": return jc(e.value);
6414
- case "fraction": return `<mfrac>${Sc(e.num)}${Sc(e.den)}</mfrac>`;
6415
- case "root": return e.index ? `<mroot>${Sc(e.body)}${Sc(e.index)}</mroot>` : `<msqrt>${xc(e.body)}</msqrt>`;
6416
- case "group": return Mc(e.open, e.close, xc(e.body));
6417
- case "derivative": return `<mfrac><mrow>${yc}${Nc(e.expr)}</mrow><mrow>${yc}${xc(e.variable)}</mrow></mfrac>`;
6440
+ case "symbol": return Mc(e.value);
6441
+ case "fraction": return `<mfrac>${Cc(e.num)}${Cc(e.den)}</mfrac>`;
6442
+ case "root": return e.index ? `<mroot>${Cc(e.body)}${Cc(e.index)}</mroot>` : `<msqrt>${Sc(e.body)}</msqrt>`;
6443
+ case "group": return Nc(e.open, e.close, Sc(e.body));
6444
+ case "derivative": return `<mfrac><mrow>${bc}${Pc(e.expr)}</mrow><mrow>${bc}${Sc(e.variable)}</mrow></mfrac>`;
6418
6445
  case "piecewise": {
6419
- let t = (e, t) => `<mtr><mtd>${xc(e)}</mtd><mtd>${t}</mtd></mtr>`, n = e.pieces.map(({ value: e, condition: n }) => t(e, xc(n)));
6446
+ let t = (e, t) => `<mtr><mtd>${Sc(e)}</mtd><mtd>${t}</mtd></mtr>`, n = e.pieces.map(({ value: e, condition: n }) => t(e, Sc(n)));
6420
6447
  return e.otherwise && n.push(t(e.otherwise, "<mtext>otherwise</mtext>")), `<mrow><mo>{</mo><mtable columnalign="left left">${n.join("")}</mtable></mrow>`;
6421
6448
  }
6422
6449
  }
6423
6450
  }
6424
6451
  //#endregion
6425
6452
  //#region src/editor/exports.ts
6426
- var Fc = [
6453
+ var Ic = [
6427
6454
  {
6428
6455
  format: "latex",
6429
6456
  label: "LaTeX"
@@ -6440,37 +6467,37 @@ var Fc = [
6440
6467
  format: "word",
6441
6468
  label: "Word equation"
6442
6469
  }
6443
- ], Ic = "http://www.w3.org/1998/Math/MathML", Lc = "http://www.cellml.org/cellml/2.0#";
6444
- function Rc(e, t, n = {}) {
6470
+ ], Lc = "http://www.w3.org/1998/Math/MathML", Rc = "http://www.cellml.org/cellml/2.0#";
6471
+ function zc(e, t, n = {}) {
6445
6472
  switch (t) {
6446
6473
  case "latex": return V(e, n);
6447
- case "mathjson": return mc(rc(e).ast);
6448
- case "mathml": return Vc(e, n);
6449
- case "word": return Cc([e]);
6474
+ case "mathjson": return hc(ic(e).ast);
6475
+ case "mathml": return Hc(e, n);
6476
+ case "word": return wc([e]);
6450
6477
  }
6451
6478
  }
6452
- function zc(e, t, n = {}) {
6479
+ function Bc(e, t, n = {}) {
6453
6480
  let r = e.filter((e) => e.length > 0);
6454
- if (r.length === 1) return Rc(r[0], t, n);
6481
+ if (r.length === 1) return zc(r[0], t, n);
6455
6482
  switch (t) {
6456
- case "latex": return `\\begin{aligned}\n${r.map((e) => Bc(e, n)).join(" \\\\\n")}\n\\end{aligned}`;
6457
- case "mathjson": return JSON.stringify(r.map((e) => Q(rc(e).ast)), null, 2);
6458
- case "mathml": return Hc(r, n);
6459
- case "word": return Cc(r);
6483
+ case "latex": return `\\begin{aligned}\n${r.map((e) => Vc(e, n)).join(" \\\\\n")}\n\\end{aligned}`;
6484
+ case "mathjson": return JSON.stringify(r.map((e) => Q(ic(e).ast)), null, 2);
6485
+ case "mathml": return Uc(r, n);
6486
+ case "word": return wc(r);
6460
6487
  }
6461
6488
  }
6462
- function Bc(e, t) {
6489
+ function Vc(e, t) {
6463
6490
  let n = e.findIndex((e) => e.kind === "symbol" && e.value === "=");
6464
6491
  return n < 0 ? `&${V(e, t)}` : `${V(e.slice(0, n), t)} &= ${V(e.slice(n + 1), t)}`;
6465
6492
  }
6466
- function Vc(e, t = {}) {
6467
- return Hc([e], t);
6493
+ function Hc(e, t = {}) {
6494
+ return Uc([e], t);
6468
6495
  }
6469
- function Hc(e, t) {
6470
- let n = e.map((e) => $(rc(e).ast, t)).join("");
6471
- return Uc(`<math ${t.cellml ? `xmlns="${Ic}" xmlns:cellml="${Lc}"` : `xmlns="${Ic}"`}>${n}</math>`);
6496
+ function Uc(e, t) {
6497
+ let n = e.map((e) => $(ic(e).ast, t)).join("");
6498
+ return Wc(`<math ${t.cellml ? `xmlns="${Lc}" xmlns:cellml="${Rc}"` : `xmlns="${Lc}"`}>${n}</math>`);
6472
6499
  }
6473
- function Uc(e, t = " ") {
6500
+ function Wc(e, t = " ") {
6474
6501
  let n = e.match(/<[^>]+>|[^<]+/g) ?? [], r = [], i = 0;
6475
6502
  for (let e = 0; e < n.length; e++) {
6476
6503
  let a = n[e];
@@ -6505,7 +6532,7 @@ function Uc(e, t = " ") {
6505
6532
  }
6506
6533
  //#endregion
6507
6534
  //#region src/editor/units.ts
6508
- function Wc(e, t, n, r = 0) {
6535
+ function Gc(e, t, n, r = 0) {
6509
6536
  if (!n) return {
6510
6537
  id: e,
6511
6538
  mathml: "",
@@ -6515,20 +6542,20 @@ function Wc(e, t, n, r = 0) {
6515
6542
  };
6516
6543
  let i = [], a = [], o = 0, s = (e) => {
6517
6544
  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++;
6518
- for (let t of Kc(e)) s(t);
6545
+ for (let t of qc(e)) s(t);
6519
6546
  };
6520
6547
  return s(n.ast), {
6521
6548
  id: e,
6522
- mathml: Vc(t, { cellml: !0 }),
6549
+ mathml: Hc(t, { cellml: !0 }),
6523
6550
  variables: i,
6524
6551
  units: a,
6525
- complete: n.diagnostics.length === 0 && r === 0 && o === 0 && !Gc(t)
6552
+ complete: n.diagnostics.length === 0 && r === 0 && o === 0 && !Kc(t)
6526
6553
  };
6527
6554
  }
6528
- function Gc(e) {
6529
- return e.some((e) => e.kind === "units" && e.units.length === 0 || A(e).some(([, e]) => Gc(e)));
6530
- }
6531
6555
  function Kc(e) {
6556
+ return e.some((e) => e.kind === "units" && e.units.length === 0 || A(e).some(([, e]) => Kc(e)));
6557
+ }
6558
+ function qc(e) {
6532
6559
  switch (e.type) {
6533
6560
  case "Add":
6534
6561
  case "Multiply":
@@ -6555,7 +6582,7 @@ function Kc(e) {
6555
6582
  default: return [];
6556
6583
  }
6557
6584
  }
6558
- function qc(e, t) {
6585
+ function Jc(e, t) {
6559
6586
  let n = [], r = t.some((e) => e.numbers?.length || e.units?.length) ? _t(e) : [], i = t.some((e) => e.variables?.length) ? gt(e) : null;
6560
6587
  for (let e of t) {
6561
6588
  for (let t of e.variables ?? []) for (let r of i?.get(t) ?? []) n.push({
@@ -6571,7 +6598,7 @@ function qc(e, t) {
6571
6598
  }
6572
6599
  return n;
6573
6600
  }
6574
- function Jc(e, t) {
6601
+ function Yc(e, t) {
6575
6602
  let n = [];
6576
6603
  if (t) for (let [r, i] of gt(e)) {
6577
6604
  if (!Object.hasOwn(t, r)) continue;
@@ -6595,7 +6622,7 @@ function Jc(e, t) {
6595
6622
  }
6596
6623
  //#endregion
6597
6624
  //#region src/editor/toolbar.ts
6598
- function Yc(e, t) {
6625
+ function Xc(e, t) {
6599
6626
  let { latexName: n, latexCommand: r } = Je[e];
6600
6627
  return {
6601
6628
  latex: r ? `\\${n}` : `\\operatorname{${n}}`,
@@ -6603,32 +6630,32 @@ function Yc(e, t) {
6603
6630
  command: Fi(e)
6604
6631
  };
6605
6632
  }
6606
- var Xc = [
6633
+ var Zc = [
6607
6634
  ["sin", "Sine"],
6608
6635
  ["cos", "Cosine"],
6609
6636
  ["tan", "Tangent"],
6610
6637
  ["sec", "Secant"],
6611
6638
  ["csc", "Cosecant"],
6612
6639
  ["cot", "Cotangent"]
6613
- ], Zc = (e, t) => Xc.map(([n, r]) => {
6640
+ ], Qc = (e, t) => Zc.map(([n, r]) => {
6614
6641
  let i = [
6615
6642
  t && "inverse",
6616
6643
  e && "hyperbolic",
6617
6644
  r.toLowerCase()
6618
6645
  ].filter(Boolean).join(" ");
6619
- return Yc(`${t ? "a" : ""}${n}${e}`, i[0].toUpperCase() + i.slice(1));
6620
- }), Qc = (e, t) => ({
6646
+ return Xc(`${t ? "a" : ""}${n}${e}`, i[0].toUpperCase() + i.slice(1));
6647
+ }), $c = (e, t) => ({
6621
6648
  latex: `\\${e}{x}`,
6622
6649
  title: `${t} over the name before the caret ( _${e}, \\${e} )`,
6623
6650
  command: Bi(e)
6624
- }), $c = (e, t) => {
6651
+ }), el = (e, t) => {
6625
6652
  let n = Tt(e, t), r = `${e === 1 ? "" : e}${t}`;
6626
6653
  return {
6627
6654
  latex: `x^{${r}}`,
6628
6655
  title: `Charge ${r.replace("-", "−")} on the name before the caret ( _${n} )`,
6629
6656
  command: Bi(n)
6630
6657
  };
6631
- }, el = [
6658
+ }, tl = [
6632
6659
  {
6633
6660
  id: "fraction",
6634
6661
  title: "Fraction ( / )",
@@ -6684,26 +6711,26 @@ var Xc = [
6684
6711
  sections: [
6685
6712
  {
6686
6713
  label: "Trigonometric",
6687
- items: Zc("", !1)
6714
+ items: Qc("", !1)
6688
6715
  },
6689
6716
  {
6690
6717
  label: "Hyperbolic",
6691
- items: Zc("h", !1)
6718
+ items: Qc("h", !1)
6692
6719
  },
6693
6720
  {
6694
6721
  label: "Inverse trigonometric",
6695
- items: Zc("", !0)
6722
+ items: Qc("", !0)
6696
6723
  },
6697
6724
  {
6698
6725
  label: "Inverse hyperbolic",
6699
- items: Zc("h", !0)
6726
+ items: Qc("h", !0)
6700
6727
  },
6701
6728
  {
6702
6729
  label: "Exponential and logarithm",
6703
6730
  items: [
6704
- Yc("exp", "Exponential"),
6705
- Yc("ln", "Natural logarithm"),
6706
- Yc("log", "Logarithm")
6731
+ Xc("exp", "Exponential"),
6732
+ Xc("ln", "Natural logarithm"),
6733
+ Xc("log", "Logarithm")
6707
6734
  ]
6708
6735
  }
6709
6736
  ]
@@ -6835,10 +6862,10 @@ var Xc = [
6835
6862
  {
6836
6863
  label: "Accents",
6837
6864
  items: [
6838
- Qc("bar", "Bar"),
6839
- Qc("hat", "Hat"),
6840
- Qc("tilde", "Tilde"),
6841
- Qc("check", "Check")
6865
+ $c("bar", "Bar"),
6866
+ $c("hat", "Hat"),
6867
+ $c("tilde", "Tilde"),
6868
+ $c("check", "Check")
6842
6869
  ]
6843
6870
  },
6844
6871
  {
@@ -6852,75 +6879,75 @@ var Xc = [
6852
6879
  {
6853
6880
  label: "Charges",
6854
6881
  items: [
6855
- $c(1, "+"),
6856
- $c(2, "+"),
6857
- $c(3, "+"),
6858
- $c(1, "-"),
6859
- $c(2, "-")
6882
+ el(1, "+"),
6883
+ el(2, "+"),
6884
+ el(3, "+"),
6885
+ el(1, "-"),
6886
+ el(2, "-")
6860
6887
  ]
6861
6888
  }
6862
6889
  ]
6863
6890
  }
6864
- ], tl = { class: "me-workbench" }, nl = [
6891
+ ], nl = { class: "me-workbench" }, rl = [
6865
6892
  "title",
6866
6893
  "data-role",
6867
6894
  "aria-haspopup",
6868
6895
  "disabled",
6869
6896
  "onClick"
6870
- ], rl = ["innerHTML"], il = {
6897
+ ], il = ["innerHTML"], al = {
6871
6898
  key: 0,
6872
6899
  class: "pi pi-chevron-down tool-chevron",
6873
6900
  "aria-hidden": "true"
6874
- }, al = ["disabled"], ol = { class: "toolbar-group toolbar-lines" }, sl = {
6901
+ }, ol = ["disabled"], sl = { class: "toolbar-group toolbar-lines" }, cl = {
6875
6902
  key: 0,
6876
6903
  class: "toolbar-group toolbar-copy"
6877
- }, cl = {
6904
+ }, ll = {
6878
6905
  key: 0,
6879
6906
  class: "gallery"
6880
- }, ll = {
6907
+ }, ul = {
6881
6908
  key: 0,
6882
6909
  class: "gallery-label"
6883
- }, ul = { class: "gallery-items" }, dl = ["title", "onClick"], fl = ["innerHTML"], pl = {
6910
+ }, dl = { class: "gallery-items" }, fl = ["title", "onClick"], pl = ["innerHTML"], ml = {
6884
6911
  class: "command-chip",
6885
6912
  "data-role": "command"
6886
- }, ml = {
6913
+ }, hl = {
6887
6914
  key: 0,
6888
6915
  class: "command-options",
6889
6916
  role: "listbox",
6890
6917
  "aria-label": "Commands"
6891
- }, hl = [
6918
+ }, gl = [
6892
6919
  "aria-selected",
6893
6920
  "data-command",
6894
6921
  "onClick"
6895
- ], gl = ["innerHTML"], _l = { class: "command-name" }, vl = { class: "command-title" }, yl = { class: "command-hint" }, bl = [
6922
+ ], _l = ["innerHTML"], vl = { class: "command-name" }, yl = { class: "command-title" }, bl = { class: "command-hint" }, xl = [
6896
6923
  "data-line",
6897
6924
  "data-line-id",
6898
6925
  "data-selected",
6899
6926
  "onFocusin",
6900
6927
  "onDragover"
6901
- ], xl = [
6928
+ ], Sl = [
6902
6929
  "draggable",
6903
6930
  "title",
6904
6931
  "onMousedown",
6905
6932
  "onDragstart"
6906
- ], Sl = { class: "line-number" }, Cl = [
6933
+ ], Cl = { class: "line-number" }, wl = [
6907
6934
  "aria-label",
6908
6935
  "title",
6909
6936
  "data-kind"
6910
- ], wl = { role: "status" }, Tl = ["data-kind", "title"], El = { class: "status-text" }, Dl = {
6937
+ ], Tl = { role: "status" }, El = ["data-kind", "title"], Dl = { class: "status-text" }, Ol = {
6911
6938
  key: 0,
6912
6939
  class: "status-more"
6913
- }, Ol = {
6940
+ }, kl = {
6914
6941
  key: 1,
6915
6942
  class: "focus-meta"
6916
- }, kl = { "data-role": "cursor" }, Al = { "data-role": "selection" }, jl = {
6943
+ }, Al = { "data-role": "cursor" }, jl = { "data-role": "selection" }, Ml = {
6917
6944
  class: "key-help",
6918
6945
  "data-role": "key-help"
6919
- }, Ml = { class: "key-hint" }, Nl = { class: "key-hint" }, Pl = { class: "key-hint" }, Fl = {
6946
+ }, Nl = { class: "key-hint" }, Pl = { class: "key-hint" }, Fl = { class: "key-hint" }, Il = {
6920
6947
  key: 0,
6921
6948
  class: "side-column",
6922
6949
  "data-role": "side"
6923
- }, Il = { "data-role": "mathml" }, Ll = { class: "output-actions" }, Rl = { "data-role": "mathjson" }, zl = { "data-role": "latex" }, Bl = { "data-role": "ast" }, Vl = "A CellML line must be an equation (… = …)", Hl = /*#__PURE__*/ Ao(/* @__PURE__ */ u({
6950
+ }, Ll = { "data-role": "mathml" }, Rl = { class: "output-actions" }, zl = { "data-role": "mathjson" }, Bl = { "data-role": "latex" }, Vl = { "data-role": "ast" }, Hl = "A CellML line must be an equation (… = …)", Ul = /*#__PURE__*/ Ao(/* @__PURE__ */ u({
6924
6951
  __name: "EquationWorkbench",
6925
6952
  props: {
6926
6953
  cellml: {
@@ -7337,7 +7364,7 @@ var Xc = [
7337
7364
  strict: "ignore"
7338
7365
  });
7339
7366
  }
7340
- let Vt = y(null), Ht = y(null), Ut = y(el.length), Wt = null;
7367
+ let Vt = y(null), Ht = y(null), Ut = y(tl.length), Wt = null;
7341
7368
  function Gt() {
7342
7369
  let e = Vt.value, t = Ht.value;
7343
7370
  if (!e || !t) return;
@@ -7349,7 +7376,7 @@ var Xc = [
7349
7376
  Ut.value = s;
7350
7377
  }
7351
7378
  let Kt = n(() => {
7352
- let e = el.slice(Ut.value);
7379
+ let e = tl.slice(Ut.value);
7353
7380
  if (!e.length) return null;
7354
7381
  let t = [];
7355
7382
  for (let n of e) if (n.command) {
@@ -7373,18 +7400,18 @@ var Xc = [
7373
7400
  function Jt(e) {
7374
7401
  if (e.length === 0) return null;
7375
7402
  let t = qt.get(e);
7376
- return t || (t = rc(e), qt.set(e, t)), t;
7403
+ return t || (t = ic(e), qt.set(e, t)), t;
7377
7404
  }
7378
7405
  let Yt = n(() => w.value.map((e) => Jt(e.root))), Xt = n(() => Yt.value[k.value] ?? null);
7379
7406
  function Zt(e, t) {
7380
7407
  let n = Yt.value[t]?.ast;
7381
7408
  return !_.cellml || !n || n.type === "Equal" ? null : {
7382
- message: Vl,
7409
+ message: Hl,
7383
7410
  atomIds: e.map((e) => e.id),
7384
7411
  incomplete: !0
7385
7412
  };
7386
7413
  }
7387
- let Qt = nc(() => _.issues), $t = nc(() => _.variableUnits ?? null), B = n(() => {
7414
+ let Qt = rc(() => _.issues), $t = rc(() => _.variableUnits ?? null), B = n(() => {
7388
7415
  let e = /* @__PURE__ */ new Map();
7389
7416
  for (let t of Qt.value) e.set(t.lineId, [...e.get(t.lineId) ?? [], t]);
7390
7417
  return e;
@@ -7394,8 +7421,8 @@ var Xc = [
7394
7421
  let e = Zt(n, t), i = [
7395
7422
  ...Yt.value[t]?.diagnostics ?? [],
7396
7423
  ...e ? [e] : [],
7397
- ...qc(n, B.value.get(D.value[t]) ?? [])
7398
- ], a = Jc(n, $t.value);
7424
+ ...Jc(n, B.value.get(D.value[t]) ?? [])
7425
+ ], a = Yc(n, $t.value);
7399
7426
  r = {
7400
7427
  all: [...i, ...a],
7401
7428
  complete: [...i.filter((e) => !e.incomplete), ...a],
@@ -7445,7 +7472,7 @@ var Xc = [
7445
7472
  let n = D.value[t], r = dn.value.get(e.root);
7446
7473
  if (!r || r.id !== n) {
7447
7474
  let i = (Se.value.get(n)?.length ?? 0) + +!!Zt(e.root, t);
7448
- r = Wc(n, e.root, Yt.value[t], i), dn.value.set(e.root, r);
7475
+ r = Gc(n, e.root, Yt.value[t], i), dn.value.set(e.root, r);
7449
7476
  }
7450
7477
  return r;
7451
7478
  })), pn = "", mn = "load";
@@ -7455,7 +7482,7 @@ var Xc = [
7455
7482
  let n = JSON.stringify(e);
7456
7483
  n !== pn && (pn = n, S("equations-change", e, { source: t }));
7457
7484
  }, { immediate: !0 });
7458
- let hn = n(() => Xt.value?.ast ?? null), gn = n(() => hn.value ? Rc(M().root, "latex", ie.value) : ""), _n = n(() => hn.value ? mc(hn.value) : ""), vn = n(() => hn.value ? Vc(M().root, ie.value) : ""), yn = n(() => Er(M().cursor)), bn = n(() => {
7485
+ let hn = n(() => Xt.value?.ast ?? null), gn = n(() => hn.value ? zc(M().root, "latex", ie.value) : ""), _n = n(() => hn.value ? hc(hn.value) : ""), vn = n(() => hn.value ? Hc(M().root, ie.value) : ""), yn = n(() => Er(M().cursor)), bn = n(() => {
7459
7486
  let e = H(M());
7460
7487
  return e ? zr(e) : null;
7461
7488
  }), xn = y(!1), Sn = y("mathml");
@@ -7498,9 +7525,9 @@ var Xc = [
7498
7525
  });
7499
7526
  async function Mn(e, t) {
7500
7527
  let n = ht.value ? mt.value.map((e) => w.value[e].root) : [H(M()) ? Rr(M()) : M().root];
7501
- n.some((e) => e.length > 0) && (await wn(zc(n, e, ie.value)), Dn.value = t, window.clearTimeout(On), On = window.setTimeout(() => Dn.value = null, 1500)), P();
7528
+ n.some((e) => e.length > 0) && (await wn(Bc(n, e, ie.value)), Dn.value = t, window.clearTimeout(On), On = window.setTimeout(() => Dn.value = null, 1500)), P();
7502
7529
  }
7503
- let Nn = n(() => Fc.map(({ format: e, label: t }) => {
7530
+ let Nn = n(() => Ic.map(({ format: e, label: t }) => {
7504
7531
  let n = e === "mathml" && _.cellml ? `${t} (CellML)` : t;
7505
7532
  return {
7506
7533
  label: n,
@@ -7510,7 +7537,7 @@ var Xc = [
7510
7537
  function Pn(e) {
7511
7538
  En.value?.toggle(e);
7512
7539
  }
7513
- return (n, d) => (v(), a("div", tl, [o("section", {
7540
+ return (n, d) => (v(), a("div", nl, [o("section", {
7514
7541
  class: m(["editor-grid", {
7515
7542
  "has-side": !!n.$slots.side,
7516
7543
  "no-outputs": !u.outputs,
@@ -7534,7 +7561,7 @@ var Xc = [
7534
7561
  ref_key: "toolsEl",
7535
7562
  ref: Vt,
7536
7563
  class: "toolbar-group toolbar-tools"
7537
- }, [(v(!0), a(e, null, b(C(el), (e, t) => (v(), a("button", {
7564
+ }, [(v(!0), a(e, null, b(C(tl), (e, t) => (v(), a("button", {
7538
7565
  key: e.id,
7539
7566
  type: "button",
7540
7567
  class: m(["tool-button", {
@@ -7548,7 +7575,7 @@ var Xc = [
7548
7575
  disabled: u.readonly,
7549
7576
  onMousedown: d[0] ||= ce(() => {}, ["prevent"]),
7550
7577
  onClick: (t) => Rt(e, t)
7551
- }, [o("span", { innerHTML: Bt(e.latex) }, null, 8, rl), e.sections ? (v(), a("i", il)) : i("", !0)], 42, nl))), 128)), o("button", {
7578
+ }, [o("span", { innerHTML: Bt(e.latex) }, null, 8, il), e.sections ? (v(), a("i", al)) : i("", !0)], 42, rl))), 128)), o("button", {
7552
7579
  ref_key: "moreEl",
7553
7580
  ref: Ht,
7554
7581
  type: "button",
@@ -7566,8 +7593,8 @@ var Xc = [
7566
7593
  }, null, -1), o("i", {
7567
7594
  class: "pi pi-chevron-down tool-chevron",
7568
7595
  "aria-hidden": "true"
7569
- }, null, -1)]], 42, al)], 512),
7570
- o("div", ol, [
7596
+ }, null, -1)]], 42, ol)], 512),
7597
+ o("div", sl, [
7571
7598
  l(C(O), {
7572
7599
  icon: "pi pi-plus",
7573
7600
  size: "small",
@@ -7616,7 +7643,7 @@ var Xc = [
7616
7643
  onClick: ke
7617
7644
  }, null, 8, ["title", "disabled"])) : i("", !0)
7618
7645
  ]),
7619
- vt.value ? (v(), a("div", sl, [l(C(O), {
7646
+ vt.value ? (v(), a("div", cl, [l(C(O), {
7620
7647
  icon: "pi pi-copy",
7621
7648
  label: jn.value,
7622
7649
  size: "small",
@@ -7643,17 +7670,17 @@ var Xc = [
7643
7670
  "data-role": "gallery",
7644
7671
  class: "me-gallery"
7645
7672
  }, {
7646
- default: T(() => [Lt.value ? (v(), a("div", cl, [(v(!0), a(e, null, b(Lt.value.sections, (t, n) => (v(), a("div", {
7673
+ default: T(() => [Lt.value ? (v(), a("div", ll, [(v(!0), a(e, null, b(Lt.value.sections, (t, n) => (v(), a("div", {
7647
7674
  key: n,
7648
7675
  class: "gallery-section"
7649
- }, [t.label ? (v(), a("div", ll, x(t.label), 1)) : i("", !0), o("div", ul, [(v(!0), a(e, null, b(t.items, (e) => (v(), a("button", {
7676
+ }, [t.label ? (v(), a("div", ul, x(t.label), 1)) : i("", !0), o("div", dl, [(v(!0), a(e, null, b(t.items, (e) => (v(), a("button", {
7650
7677
  key: e.title,
7651
7678
  type: "button",
7652
7679
  class: "tool-button",
7653
7680
  title: e.title,
7654
7681
  onMousedown: d[9] ||= ce(() => {}, ["prevent"]),
7655
7682
  onClick: (t) => zt(e.command)
7656
- }, [o("span", { innerHTML: Bt(e.latex) }, null, 8, fl)], 40, dl))), 128))])]))), 128))])) : i("", !0)]),
7683
+ }, [o("span", { innerHTML: Bt(e.latex) }, null, 8, pl)], 40, fl))), 128))])]))), 128))])) : i("", !0)]),
7657
7684
  _: 1
7658
7685
  }, 512),
7659
7686
  (v(), r(t, { to: "body" }, [j.value === null ? i("", !0) : (v(), a("div", {
@@ -7666,12 +7693,12 @@ var Xc = [
7666
7693
  style: h(Ot.value),
7667
7694
  onMousedown: d[10] ||= ce(() => {}, ["prevent"])
7668
7695
  }, [
7669
- o("span", pl, [
7696
+ o("span", ml, [
7670
7697
  d[14] ||= o("span", { class: "command-slash" }, "\\", -1),
7671
7698
  c(x(j.value), 1),
7672
7699
  d[15] ||= o("span", { class: "command-caret" }, null, -1)
7673
7700
  ]),
7674
- wt.value.length ? (v(), a("ul", ml, [(v(!0), a(e, null, b(wt.value, (e, t) => (v(), a("li", {
7701
+ wt.value.length ? (v(), a("ul", hl, [(v(!0), a(e, null, b(wt.value, (e, t) => (v(), a("li", {
7675
7702
  key: e.name,
7676
7703
  class: m(["command-option", { highlighted: t === Tt.value }]),
7677
7704
  role: "option",
@@ -7682,11 +7709,11 @@ var Xc = [
7682
7709
  o("span", {
7683
7710
  class: "command-preview",
7684
7711
  innerHTML: Bt(e.latex)
7685
- }, null, 8, gl),
7686
- o("span", _l, "\\" + x(e.name), 1),
7687
- o("span", vl, x(e.title), 1)
7688
- ], 10, hl))), 128))])) : i("", !0),
7689
- o("p", yl, [
7712
+ }, null, 8, _l),
7713
+ o("span", vl, "\\" + x(e.name), 1),
7714
+ o("span", yl, x(e.title), 1)
7715
+ ], 10, gl))), 128))])) : i("", !0),
7716
+ o("p", bl, [
7690
7717
  wt.value.length ? (v(), a(e, { key: 0 }, [
7691
7718
  d[16] ||= o("kbd", null, "↑", -1),
7692
7719
  d[17] ||= o("kbd", null, "↓", -1),
@@ -7732,7 +7759,7 @@ var Xc = [
7732
7759
  onMousedown: (e) => bt(t, e),
7733
7760
  onDragstart: (e) => lt(t, e),
7734
7761
  onDragend: dt
7735
- }, [o("span", Sl, x(t + 1), 1), on(t) ? (v(), a("i", {
7762
+ }, [o("span", Cl, x(t + 1), 1), on(t) ? (v(), a("i", {
7736
7763
  key: 0,
7737
7764
  class: m(["pi line-problem", on(t) === "has-error" ? "pi-exclamation-circle" : "pi-exclamation-triangle"]),
7738
7765
  role: "img",
@@ -7740,7 +7767,7 @@ var Xc = [
7740
7767
  title: ln(t),
7741
7768
  "data-role": "line-problem",
7742
7769
  "data-kind": on(t) === "has-error" ? "error" : "units"
7743
- }, null, 10, Cl)) : i("", !0)], 40, xl), l(jo, {
7770
+ }, null, 10, wl)) : i("", !0)], 40, Sl), l(jo, {
7744
7771
  ref_for: !0,
7745
7772
  ref: (e) => A.value[t] = e,
7746
7773
  class: "equation-field",
@@ -7771,8 +7798,8 @@ var Xc = [
7771
7798
  "onEdit",
7772
7799
  "onImport",
7773
7800
  "onPastePresentation"
7774
- ])], 42, bl))), 128))], 544),
7775
- ze.value ? (v(), r(tc, {
7801
+ ])], 42, xl))), 128))], 544),
7802
+ ze.value ? (v(), r(nc, {
7776
7803
  key: 0,
7777
7804
  paste: ze.value.paste,
7778
7805
  "greek-names": u.greekNames,
@@ -7783,7 +7810,7 @@ var Xc = [
7783
7810
  "greek-names",
7784
7811
  "typeset-names"
7785
7812
  ])) : i("", !0),
7786
- o("div", wl, [sn.value ? (v(), a("div", {
7813
+ o("div", Tl, [sn.value ? (v(), a("div", {
7787
7814
  key: 0,
7788
7815
  class: m(["status-bar", `status-${sn.value.kind}`]),
7789
7816
  "data-role": "status",
@@ -7791,15 +7818,15 @@ var Xc = [
7791
7818
  title: cn.value || void 0,
7792
7819
  onMousedown: d[11] ||= ce(() => {}, ["prevent"]),
7793
7820
  onClick: un
7794
- }, [o("span", El, x(sn.value.text), 1), sn.value.more ? (v(), a("span", Dl, "+" + x(sn.value.more) + " more", 1)) : i("", !0)], 42, Tl)) : i("", !0)]),
7795
- u.debug ? (v(), a("p", Ol, [
7821
+ }, [o("span", Dl, x(sn.value.text), 1), sn.value.more ? (v(), a("span", Ol, "+" + x(sn.value.more) + " more", 1)) : i("", !0)], 42, El)) : i("", !0)]),
7822
+ u.debug ? (v(), a("p", kl, [
7796
7823
  d[26] ||= c(" Cursor: ", -1),
7797
- o("span", kl, x(yn.value), 1),
7798
- bn.value ? (v(), a(e, { key: 0 }, [d[25] ||= c(" · Selection: ", -1), o("span", Al, x(bn.value), 1)], 64)) : i("", !0)
7824
+ o("span", Al, x(yn.value), 1),
7825
+ bn.value ? (v(), a(e, { key: 0 }, [d[25] ||= c(" · Selection: ", -1), o("span", jl, x(bn.value), 1)], 64)) : i("", !0)
7799
7826
  ])) : i("", !0),
7800
- o("details", jl, [
7827
+ o("details", Ml, [
7801
7828
  d[62] ||= o("summary", null, "Keys and typing", -1),
7802
- o("p", Ml, [
7829
+ o("p", Nl, [
7803
7830
  d[31] ||= s("<kbd data-v-9a88212c>←</kbd><kbd data-v-9a88212c>→</kbd> move through every position · <kbd data-v-9a88212c>↑</kbd><kbd data-v-9a88212c>↓</kbd> numerator/denominator, else previous/next line · <kbd data-v-9a88212c>Home</kbd><kbd data-v-9a88212c>End</kbd> start/end · <kbd data-v-9a88212c>Tab</kbd> next empty slot · <kbd data-v-9a88212c>Space</kbd> step out of a fraction, exponent or bracket · <kbd data-v-9a88212c>Enter</kbd> new line (in a piecewise: new piece; <kbd data-v-9a88212c>Backspace</kbd> in an empty piece removes it; <code data-v-9a88212c>\\otherwise</code> adds one) · ", 19),
7804
7831
  o("kbd", null, x(C(L)), 1),
7805
7832
  d[32] ||= c("+", -1),
@@ -7814,7 +7841,7 @@ var Xc = [
7814
7841
  d[30] ||= c("+click line numbers to select lines for \"Copy as\"", -1)
7815
7842
  ], 64)) : i("", !0)
7816
7843
  ]),
7817
- o("p", Nl, [
7844
+ o("p", Pl, [
7818
7845
  d[36] ||= c(" Select with ", -1),
7819
7846
  d[37] ||= o("kbd", null, "Shift", -1),
7820
7847
  d[38] ||= c("+", -1),
@@ -7839,7 +7866,7 @@ var Xc = [
7839
7866
  d[55] ||= o("code", null, "(x+1)/2", -1),
7840
7867
  d[56] ||= c(") ", -1)
7841
7868
  ]),
7842
- o("p", Pl, [d[61] ||= s(" Type letters, numbers and <code data-v-9a88212c>+ − * = ,</code> where the caret is · conditions: <code data-v-9a88212c>&lt; &gt; &lt;= &gt;= !=</code>, <code data-v-9a88212c>&amp;</code> (∧), <code data-v-9a88212c>!</code> (¬), <code data-v-9a88212c>\\or</code> (∨) · <code data-v-9a88212c>/</code> makes a fraction of what&#39;s before the caret · <code data-v-9a88212c>^</code> exponent · <code data-v-9a88212c>( )</code> and <code data-v-9a88212c>| |</code> brackets · <code data-v-9a88212c>0.25{mV}</code> a number&#39;s units · letters, digits and <code data-v-9a88212c>_</code> with no operator between them are one name (<code data-v-9a88212c>Vm_init</code>); multiply names with <code data-v-9a88212c>*</code> (<code data-v-9a88212c>a*b</code>) · a name spelling a function (<code data-v-9a88212c>sin</code>, <code data-v-9a88212c>cosh</code>, …) is that function · <code data-v-9a88212c>\\</code> commands (<code data-v-9a88212c>\\frac \\sqrt \\root \\abs \\dd \\cases \\sin \\pi \\e \\inf \\alpha</code> …) · <kbd data-v-9a88212c>Backspace</kbd>/<kbd data-v-9a88212c>Delete</kbd> delete", 41), _.history ? (v(), a(e, { key: 0 }, [
7869
+ o("p", Fl, [d[61] ||= s(" Type letters, numbers and <code data-v-9a88212c>+ − * = ,</code> where the caret is · conditions: <code data-v-9a88212c>&lt; &gt; &lt;= &gt;= !=</code>, <code data-v-9a88212c>&amp;</code> (∧), <code data-v-9a88212c>!</code> (¬), <code data-v-9a88212c>\\or</code> (∨) · <code data-v-9a88212c>/</code> makes a fraction of what&#39;s before the caret · <code data-v-9a88212c>^</code> exponent · <code data-v-9a88212c>( )</code> and <code data-v-9a88212c>| |</code> brackets · <code data-v-9a88212c>0.25{mV}</code> a number&#39;s units · letters, digits and <code data-v-9a88212c>_</code> with no operator between them are one name (<code data-v-9a88212c>Vm_init</code>); multiply names with <code data-v-9a88212c>*</code> (<code data-v-9a88212c>a*b</code>) · a name spelling a function (<code data-v-9a88212c>sin</code>, <code data-v-9a88212c>cosh</code>, …) is that function · <code data-v-9a88212c>\\</code> commands (<code data-v-9a88212c>\\frac \\sqrt \\root \\abs \\dd \\cases \\sin \\pi \\e \\inf \\alpha</code> …) · <kbd data-v-9a88212c>Backspace</kbd>/<kbd data-v-9a88212c>Delete</kbd> delete", 41), _.history ? (v(), a(e, { key: 0 }, [
7843
7870
  d[57] ||= c(" · ", -1),
7844
7871
  o("kbd", null, x(C(Me)), 1),
7845
7872
  d[58] ||= c("+", -1),
@@ -7848,7 +7875,7 @@ var Xc = [
7848
7875
  ], 64)) : i("", !0)])
7849
7876
  ])
7850
7877
  ], 512),
7851
- n.$slots.side ? (v(), a("aside", Fl, [te(n.$slots, "side", {}, void 0, !0)])) : i("", !0),
7878
+ n.$slots.side ? (v(), a("aside", Il, [te(n.$slots, "side", {}, void 0, !0)])) : i("", !0),
7852
7879
  u.outputs ? (v(), r(C(de), {
7853
7880
  key: 1,
7854
7881
  class: "output-card",
@@ -7899,26 +7926,26 @@ var Xc = [
7899
7926
  }), l(C(ve), null, {
7900
7927
  default: T(() => [
7901
7928
  l(C(_e), { value: "mathml" }, {
7902
- default: T(() => [o("pre", Il, x(vn.value), 1)]),
7929
+ default: T(() => [o("pre", Ll, x(vn.value), 1)]),
7903
7930
  _: 1
7904
7931
  }),
7905
7932
  l(C(_e), { value: "mathjson" }, {
7906
- default: T(() => [o("div", Ll, [l(C(O), {
7933
+ default: T(() => [o("div", Rl, [l(C(O), {
7907
7934
  icon: "pi pi-copy",
7908
7935
  label: xn.value ? "Copied" : "Copy MathJSON",
7909
7936
  size: "small",
7910
7937
  text: "",
7911
7938
  disabled: !_n.value,
7912
7939
  onClick: Tn
7913
- }, null, 8, ["label", "disabled"])]), o("pre", Rl, x(_n.value), 1)]),
7940
+ }, null, 8, ["label", "disabled"])]), o("pre", zl, x(_n.value), 1)]),
7914
7941
  _: 1
7915
7942
  }),
7916
7943
  l(C(_e), { value: "latex" }, {
7917
- default: T(() => [o("pre", zl, x(gn.value), 1)]),
7944
+ default: T(() => [o("pre", Bl, x(gn.value), 1)]),
7918
7945
  _: 1
7919
7946
  }),
7920
7947
  l(C(_e), { value: "ast" }, {
7921
- default: T(() => [o("pre", Bl, x(hn.value ? JSON.stringify(hn.value, null, 2) : ""), 1)]),
7948
+ default: T(() => [o("pre", Vl, x(hn.value ? JSON.stringify(hn.value, null, 2) : ""), 1)]),
7922
7949
  _: 1
7923
7950
  })
7924
7951
  ]),
@@ -7930,7 +7957,7 @@ var Xc = [
7930
7957
  })) : i("", !0)
7931
7958
  ], 34)]));
7932
7959
  }
7933
- }), [["__scopeId", "data-v-9a88212c"]]), Ul = "new units", Wl = [
7960
+ }), [["__scopeId", "data-v-9a88212c"]]), Wl = "new units", Gl = [
7934
7961
  "yotta",
7935
7962
  "zetta",
7936
7963
  "exa",
@@ -7951,15 +7978,15 @@ var Xc = [
7951
7978
  "atto",
7952
7979
  "zepto",
7953
7980
  "yocto"
7954
- ], Gl = /^[A-Za-z_][A-Za-z0-9_]*$/;
7955
- function Kl(e, t, n) {
7981
+ ], Kl = /^[A-Za-z_][A-Za-z0-9_]*$/;
7982
+ function ql(e, t, n) {
7956
7983
  let r = [], { name: i, parts: a } = e;
7957
- return i ? Gl.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) => {
7984
+ return i ? Kl.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) => {
7958
7985
  let s = a.length > 1 ? `Part ${o + 1}: ` : "";
7959
- 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 && !Wl.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`);
7960
- }), i && Gl.test(i) && ql(i, a, t) && r.push(`${i} would be made of itself, through other new units`), r;
7986
+ 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 && !Gl.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`);
7987
+ }), i && Kl.test(i) && Jl(i, a, t) && r.push(`${i} would be made of itself, through other new units`), r;
7961
7988
  }
7962
- function ql(e, t, n) {
7989
+ function Jl(e, t, n) {
7963
7990
  let r = /* @__PURE__ */ new Set(), i = (t) => {
7964
7991
  if (t === e) return !0;
7965
7992
  if (r.has(t)) return !1;
@@ -7969,17 +7996,17 @@ function ql(e, t, n) {
7969
7996
  };
7970
7997
  return t.some((t) => t.units !== e && i(t.units));
7971
7998
  }
7972
- function Jl(e, t) {
7999
+ function Yl(e, t) {
7973
8000
  return t.filter((t) => t.parts.some((t) => t.units === e)).map((e) => e.name);
7974
8001
  }
7975
- function Yl(e) {
8002
+ function Xl(e) {
7976
8003
  return e.parts.map((e) => {
7977
8004
  let t = [e.multiplier !== void 0 && e.multiplier !== 1 ? e.multiplier : ""].concat(e.prefix ?? "", e.units).filter((e) => e !== "").join(" "), n = e.exponent ?? 1;
7978
8005
  return n === 1 ? t : t.includes(" ") ? `(${t})^${n}` : `${t}^${n}`;
7979
8006
  }).join(" · ");
7980
8007
  }
7981
- var Xl = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
7982
- function Zl(e, t = "new_units") {
8008
+ var Zl = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
8009
+ function Ql(e, t = "new_units") {
7983
8010
  let n = [], r = (t, i) => {
7984
8011
  if (!(n.includes(t) || i.has(t.name))) {
7985
8012
  i.add(t.name);
@@ -7993,20 +8020,20 @@ function Zl(e, t = "new_units") {
7993
8020
  for (let t of e) r(t, /* @__PURE__ */ new Set());
7994
8021
  let i = n.map((e) => {
7995
8022
  let t = e.parts.map((e) => ` <unit${[
7996
- e.prefix ? ` prefix="${Xl(e.prefix)}"` : "",
7997
- ` units="${Xl(e.units)}"`,
8023
+ e.prefix ? ` prefix="${Zl(e.prefix)}"` : "",
8024
+ ` units="${Zl(e.units)}"`,
7998
8025
  e.exponent !== void 0 && e.exponent !== 1 ? ` exponent="${e.exponent}"` : "",
7999
8026
  e.multiplier !== void 0 && e.multiplier !== 1 ? ` multiplier="${e.multiplier}"` : ""
8000
8027
  ].join("")}/>`);
8001
8028
  return [
8002
- ` <units name="${Xl(e.name)}">`,
8029
+ ` <units name="${Zl(e.name)}">`,
8003
8030
  ...t,
8004
8031
  " </units>"
8005
8032
  ].join("\n");
8006
8033
  });
8007
8034
  return [
8008
8035
  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
8009
- `<model xmlns="http://www.cellml.org/cellml/2.0#" name="${Xl(t)}">`,
8036
+ `<model xmlns="http://www.cellml.org/cellml/2.0#" name="${Zl(t)}">`,
8010
8037
  ...i,
8011
8038
  "</model>",
8012
8039
  ""
@@ -8014,15 +8041,15 @@ function Zl(e, t = "new_units") {
8014
8041
  }
8015
8042
  //#endregion
8016
8043
  //#region src/units/UnitsDefinitionForm.vue?vue&type=script&setup=true&lang.ts
8017
- var Ql = { class: "form-name" }, $l = { class: "form-parts" }, eu = ["onUpdate:modelValue", "aria-label"], tu = ["value"], nu = [
8044
+ var $l = { class: "form-name" }, eu = { class: "form-parts" }, tu = ["onUpdate:modelValue", "aria-label"], nu = ["value"], ru = [
8018
8045
  "onUpdate:modelValue",
8019
8046
  "list",
8020
8047
  "aria-label"
8021
- ], ru = ["onUpdate:modelValue", "aria-label"], iu = ["onUpdate:modelValue", "aria-label"], au = ["id"], ou = ["value"], su = {
8048
+ ], iu = ["onUpdate:modelValue", "aria-label"], au = ["onUpdate:modelValue", "aria-label"], ou = ["id"], su = ["value"], cu = {
8022
8049
  key: 0,
8023
8050
  class: "form-problems",
8024
8051
  "data-role": "units-form-problems"
8025
- }, cu = { class: "form-actions" }, lu = /*#__PURE__*/ Ao(/* @__PURE__ */ u({
8052
+ }, lu = { class: "form-actions" }, uu = /*#__PURE__*/ Ao(/* @__PURE__ */ u({
8026
8053
  __name: "UnitsDefinitionForm",
8027
8054
  props: {
8028
8055
  definition: {},
@@ -8049,7 +8076,7 @@ var Ql = { class: "form-name" }, $l = { class: "form-parts" }, eu = ["onUpdate:m
8049
8076
  ...n !== void 0 && n !== 1 ? { multiplier: n } : {}
8050
8077
  };
8051
8078
  })
8052
- })), ee = n(() => Kl(g.value, s.others, s.known));
8079
+ })), ee = n(() => ql(g.value, s.others, s.known));
8053
8080
  function _() {
8054
8081
  m.value = !0, ee.value.length === 0 && c("save", g.value);
8055
8082
  }
@@ -8059,7 +8086,7 @@ var Ql = { class: "form-name" }, $l = { class: "form-parts" }, eu = ["onUpdate:m
8059
8086
  "data-role": "units-form",
8060
8087
  onSubmit: ce(_, ["prevent"])
8061
8088
  }, [
8062
- o("label", Ql, [r[3] ||= o("span", null, "Name", -1), E(o("input", {
8089
+ o("label", $l, [r[3] ||= o("span", null, "Name", -1), E(o("input", {
8063
8090
  "onUpdate:modelValue": r[0] ||= (e) => f.value = e,
8064
8091
  type: "text",
8065
8092
  spellcheck: "false",
@@ -8067,7 +8094,7 @@ var Ql = { class: "form-name" }, $l = { class: "form-parts" }, eu = ["onUpdate:m
8067
8094
  placeholder: "mV_per_ms",
8068
8095
  "data-role": "units-form-name"
8069
8096
  }, null, 512), [[oe, f.value]])]),
8070
- o("table", $l, [r[5] ||= o("thead", null, [o("tr", null, [
8097
+ o("table", eu, [r[5] ||= o("thead", null, [o("tr", null, [
8071
8098
  o("th", { scope: "col" }, "Prefix"),
8072
8099
  o("th", { scope: "col" }, "Units"),
8073
8100
  o("th", {
@@ -8086,10 +8113,10 @@ var Ql = { class: "form-name" }, $l = { class: "form-parts" }, eu = ["onUpdate:m
8086
8113
  o("td", null, [E(o("select", {
8087
8114
  "onUpdate:modelValue": (e) => t.prefix = e,
8088
8115
  "aria-label": `Prefix of part ${n + 1}`
8089
- }, [r[4] ||= o("option", { value: "" }, "—", -1), (v(!0), a(e, null, b(C(Wl), (e) => (v(), a("option", {
8116
+ }, [r[4] ||= o("option", { value: "" }, "—", -1), (v(!0), a(e, null, b(C(Gl), (e) => (v(), a("option", {
8090
8117
  key: e,
8091
8118
  value: e
8092
- }, x(e), 9, tu))), 128))], 8, eu), [[ae, t.prefix]])]),
8119
+ }, x(e), 9, nu))), 128))], 8, tu), [[ae, t.prefix]])]),
8093
8120
  o("td", null, [E(o("input", {
8094
8121
  "onUpdate:modelValue": (e) => t.units = e,
8095
8122
  type: "text",
@@ -8098,7 +8125,7 @@ var Ql = { class: "form-name" }, $l = { class: "form-parts" }, eu = ["onUpdate:m
8098
8125
  autocomplete: "off",
8099
8126
  placeholder: "second",
8100
8127
  "aria-label": `Units of part ${n + 1}`
8101
- }, null, 8, nu), [[oe, t.units]])]),
8128
+ }, null, 8, ru), [[oe, t.units]])]),
8102
8129
  o("td", null, [E(o("input", {
8103
8130
  "onUpdate:modelValue": (e) => t.exponent = e,
8104
8131
  class: "number",
@@ -8106,7 +8133,7 @@ var Ql = { class: "form-name" }, $l = { class: "form-parts" }, eu = ["onUpdate:m
8106
8133
  inputmode: "decimal",
8107
8134
  placeholder: "1",
8108
8135
  "aria-label": `Exponent of part ${n + 1}`
8109
- }, null, 8, ru), [[oe, t.exponent]])]),
8136
+ }, null, 8, iu), [[oe, t.exponent]])]),
8110
8137
  o("td", null, [E(o("input", {
8111
8138
  "onUpdate:modelValue": (e) => t.multiplier = e,
8112
8139
  class: "number",
@@ -8114,7 +8141,7 @@ var Ql = { class: "form-name" }, $l = { class: "form-parts" }, eu = ["onUpdate:m
8114
8141
  inputmode: "decimal",
8115
8142
  placeholder: "1",
8116
8143
  "aria-label": `Multiplier of part ${n + 1}`
8117
- }, null, 8, iu), [[oe, t.multiplier]])]),
8144
+ }, null, 8, au), [[oe, t.multiplier]])]),
8118
8145
  o("td", null, [l(C(O), {
8119
8146
  icon: "pi pi-times",
8120
8147
  size: "small",
@@ -8134,9 +8161,9 @@ var Ql = { class: "form-name" }, $l = { class: "form-parts" }, eu = ["onUpdate:m
8134
8161
  o("datalist", { id: C(te) }, [(v(!0), a(e, null, b(t.choices, (e) => (v(), a("option", {
8135
8162
  key: e,
8136
8163
  value: e
8137
- }, null, 8, ou))), 128))], 8, au),
8138
- m.value && ee.value.length ? (v(), a("ul", su, [(v(!0), a(e, null, b(ee.value, (e) => (v(), a("li", { key: e }, x(e), 1))), 128))])) : i("", !0),
8139
- o("div", cu, [
8164
+ }, null, 8, su))), 128))], 8, ou),
8165
+ m.value && ee.value.length ? (v(), a("ul", cu, [(v(!0), a(e, null, b(ee.value, (e) => (v(), a("li", { key: e }, x(e), 1))), 128))])) : i("", !0),
8166
+ o("div", lu, [
8140
8167
  l(C(O), {
8141
8168
  icon: "pi pi-plus",
8142
8169
  label: "Part",
@@ -8167,7 +8194,7 @@ var Ql = { class: "form-name" }, $l = { class: "form-parts" }, eu = ["onUpdate:m
8167
8194
  }), [["__scopeId", "data-v-effe158e"]]);
8168
8195
  //#endregion
8169
8196
  //#region src/units/panel.ts
8170
- function uu(e, t, n) {
8197
+ function du(e, t, n) {
8171
8198
  let r = [...new Set(e.flatMap((e) => e.variables))], i = Object.keys(t).filter((e) => !r.includes(e)), a = n ? new Set(n) : null;
8172
8199
  return [...r, ...i].map((e) => {
8173
8200
  let n = t[e] ?? "", i = n ? a && !a.has(n) ? "unknown" : "ok" : "missing";
@@ -8179,11 +8206,11 @@ function uu(e, t, n) {
8179
8206
  };
8180
8207
  });
8181
8208
  }
8182
- function du(e, t, n) {
8209
+ function fu(e, t, n) {
8183
8210
  let r = { ...e }, i = n.trim();
8184
8211
  return i ? r[t] = i : delete r[t], r;
8185
8212
  }
8186
- function fu(e, t) {
8213
+ function pu(e, t) {
8187
8214
  let n = [...e];
8188
8215
  for (let e of t) {
8189
8216
  let t = n.findIndex((t) => t.name === e.name);
@@ -8193,67 +8220,67 @@ function fu(e, t) {
8193
8220
  }
8194
8221
  //#endregion
8195
8222
  //#region src/units/UnitsPanel.vue?vue&type=script&setup=true&lang.ts
8196
- var pu = { class: "units-title" }, mu = { "data-role": "units-summary" }, hu = {
8223
+ var mu = { class: "units-title" }, hu = { "data-role": "units-summary" }, gu = {
8197
8224
  class: "units-section",
8198
8225
  "aria-labelledby": "units-files-title"
8199
- }, gu = { class: "section-head" }, _u = { class: "section-actions" }, vu = {
8226
+ }, _u = { class: "section-head" }, vu = { class: "section-actions" }, yu = {
8200
8227
  key: 0,
8201
8228
  class: "hint"
8202
- }, yu = {
8229
+ }, bu = {
8203
8230
  key: 1,
8204
8231
  class: "files",
8205
8232
  "data-role": "units-files"
8206
- }, bu = ["data-file"], xu = { class: "file-head" }, Su = { class: "file-name" }, Cu = { class: "file-count" }, wu = {
8233
+ }, xu = ["data-file"], Su = { class: "file-head" }, Cu = { class: "file-name" }, wu = { class: "file-count" }, Tu = {
8207
8234
  key: 0,
8208
8235
  class: "units-names"
8209
- }, Tu = {
8236
+ }, Eu = {
8210
8237
  key: 1,
8211
8238
  class: "problems",
8212
8239
  "data-role": "units-problems"
8213
- }, Eu = {
8240
+ }, Du = {
8214
8241
  class: "units-section",
8215
8242
  "aria-labelledby": "units-new-title",
8216
8243
  "data-role": "new-units"
8217
- }, Du = { class: "section-head" }, Ou = { class: "section-actions" }, ku = {
8244
+ }, Ou = { class: "section-head" }, ku = { class: "section-actions" }, Au = {
8218
8245
  key: 0,
8219
8246
  class: "hint"
8220
- }, Au = {
8247
+ }, ju = {
8221
8248
  key: 1,
8222
8249
  class: "new-units"
8223
- }, ju = ["data-units"], Mu = {
8250
+ }, Mu = ["data-units"], Nu = {
8224
8251
  key: 1,
8225
8252
  class: "new-units-row"
8226
- }, Nu = { class: "new-units-name" }, Pu = {
8253
+ }, Pu = { class: "new-units-name" }, Fu = {
8227
8254
  class: "new-units-definition",
8228
8255
  "data-role": "new-units-definition"
8229
- }, Fu = {
8256
+ }, Iu = {
8230
8257
  key: 3,
8231
8258
  class: "problems",
8232
8259
  "data-role": "new-units-problems"
8233
- }, Iu = {
8260
+ }, Lu = {
8234
8261
  class: "units-section",
8235
8262
  "aria-labelledby": "units-variables-title"
8236
- }, Lu = { class: "section-head" }, Ru = {
8263
+ }, Ru = { class: "section-head" }, zu = {
8237
8264
  key: 0,
8238
8265
  class: "missing-count",
8239
8266
  "data-role": "missing-count"
8240
- }, zu = {
8267
+ }, Bu = {
8241
8268
  key: 0,
8242
8269
  class: "hint"
8243
- }, Bu = {
8270
+ }, Vu = {
8244
8271
  key: 1,
8245
8272
  class: "variables",
8246
8273
  "data-role": "variables"
8247
- }, Vu = ["data-variable", "data-state"], Hu = {
8274
+ }, Hu = ["data-variable", "data-state"], Uu = {
8248
8275
  scope: "row",
8249
8276
  class: "variable-name"
8250
- }, Uu = [
8277
+ }, Wu = [
8251
8278
  "value",
8252
8279
  "list",
8253
8280
  "aria-label",
8254
8281
  "aria-invalid",
8255
8282
  "onChange"
8256
- ], Wu = { class: "variable-state" }, Gu = ["id"], Ku = ["value"], qu = /*#__PURE__*/ Ao(/* @__PURE__ */ u({
8283
+ ], Gu = { class: "variable-state" }, Ku = ["id"], qu = ["value"], Ju = /*#__PURE__*/ Ao(/* @__PURE__ */ u({
8257
8284
  __name: "UnitsPanel",
8258
8285
  props: /*@__PURE__*/ f({
8259
8286
  status: {},
@@ -8280,7 +8307,7 @@ var pu = { class: "units-title" }, mu = { "data-role": "units-summary" }, hu = {
8280
8307
  "update:newUnits"
8281
8308
  ],
8282
8309
  setup(t) {
8283
- let s = t, u = w(t, "sources"), d = w(t, "variableUnits"), f = w(t, "newUnits"), p = n(() => s.status === "ready"), h = n(() => uu(s.lines, d.value, p.value ? s.unitsNames : null)), g = n(() => h.value.filter((e) => e.state === "missing").length), ee = n(() => ({
8310
+ let s = t, u = w(t, "sources"), d = w(t, "variableUnits"), f = w(t, "newUnits"), p = n(() => s.status === "ready"), h = n(() => du(s.lines, d.value, p.value ? s.unitsNames : null)), g = n(() => h.value.filter((e) => e.state === "missing").length), ee = n(() => ({
8284
8311
  ready: {
8285
8312
  value: "libCellML",
8286
8313
  severity: "success"
@@ -8309,12 +8336,12 @@ var pu = { class: "units-title" }, mu = { "data-role": "units-summary" }, hu = {
8309
8336
  name: e.name,
8310
8337
  text: await e.text()
8311
8338
  })));
8312
- r.length && (u.value = fu(u.value, r));
8339
+ r.length && (u.value = pu(u.value, r));
8313
8340
  }
8314
8341
  function ae(e) {
8315
8342
  u.value = u.value.filter((t) => t.name !== e);
8316
8343
  }
8317
- let oe = (e) => s.problems.filter((t) => t.source === e), se = (e) => s.files.find((t) => t.name === e)?.units ?? [], E = y(void 0), D = n(() => E.value === void 0 || E.value === null ? null : f.value[E.value]), ce = n(() => f.value.filter((e, t) => t !== E.value)), le = n(() => p.value ? s.unitsNames.filter((e) => e !== D.value?.name) : null), ue = n(() => [.../* @__PURE__ */ new Set([...s.unitsNames, ...ce.value.map((e) => e.name)])].filter((e) => e !== D.value?.name)), fe = n(() => oe(Ul));
8344
+ let oe = (e) => s.problems.filter((t) => t.source === e), se = (e) => s.files.find((t) => t.name === e)?.units ?? [], E = y(void 0), D = n(() => E.value === void 0 || E.value === null ? null : f.value[E.value]), ce = n(() => f.value.filter((e, t) => t !== E.value)), le = n(() => p.value ? s.unitsNames.filter((e) => e !== D.value?.name) : null), ue = n(() => [.../* @__PURE__ */ new Set([...s.unitsNames, ...ce.value.map((e) => e.name)])].filter((e) => e !== D.value?.name)), fe = n(() => oe(Wl));
8318
8345
  function pe(e) {
8319
8346
  let t = [...f.value], n = E.value;
8320
8347
  if (n == null) t.push(e);
@@ -8335,7 +8362,7 @@ var pu = { class: "units-title" }, mu = { "data-role": "units-summary" }, hu = {
8335
8362
  }
8336
8363
  let he = ie();
8337
8364
  function ge(e, t) {
8338
- d.value = du(d.value, e, t.target.value);
8365
+ d.value = fu(d.value, e, t.target.value);
8339
8366
  }
8340
8367
  let _e = {
8341
8368
  ok: "",
@@ -8347,14 +8374,14 @@ var pu = { class: "units-title" }, mu = { "data-role": "units-summary" }, hu = {
8347
8374
  "data-role": "units-panel",
8348
8375
  "data-status": t.status
8349
8376
  }, {
8350
- title: T(() => [o("div", pu, [s[4] ||= o("span", null, "Units", -1), l(C(be), {
8377
+ title: T(() => [o("div", mu, [s[4] ||= o("span", null, "Units", -1), l(C(be), {
8351
8378
  severity: ee.value.severity,
8352
8379
  value: ee.value.value,
8353
8380
  "data-role": "units-status"
8354
8381
  }, null, 8, ["severity", "value"])])]),
8355
- subtitle: T(() => [o("span", mu, x(_.value), 1)]),
8382
+ subtitle: T(() => [o("span", hu, x(_.value), 1)]),
8356
8383
  content: T(() => [
8357
- o("section", hu, [o("div", gu, [s[5] ||= o("h3", { id: "units-files-title" }, "Units files", -1), o("div", _u, [
8384
+ o("section", gu, [o("div", _u, [s[5] ||= o("h3", { id: "units-files-title" }, "Units files", -1), o("div", vu, [
8358
8385
  te(n.$slots, "actions", {}, void 0, !0),
8359
8386
  l(C(O), {
8360
8387
  icon: "pi pi-folder-open",
@@ -8375,7 +8402,7 @@ var pu = { class: "units-title" }, mu = { "data-role": "units-summary" }, hu = {
8375
8402
  "data-role": "units-file-input",
8376
8403
  onChange: S
8377
8404
  }, null, 544)
8378
- ])]), u.value.length === 0 ? (v(), a("p", vu, [...s[6] ||= [
8405
+ ])]), u.value.length === 0 ? (v(), a("p", yu, [...s[6] ||= [
8379
8406
  c(" Built-in units (", -1),
8380
8407
  o("code", null, "second", -1),
8381
8408
  c(", ", -1),
@@ -8383,13 +8410,13 @@ var pu = { class: "units-title" }, mu = { "data-role": "units-summary" }, hu = {
8383
8410
  c(", ", -1),
8384
8411
  o("code", null, "volt", -1),
8385
8412
  c(", …) are always available. Load CellML files for others; only their units are kept. ", -1)
8386
- ]])) : (v(), a("ul", yu, [(v(!0), a(e, null, b(u.value, (t) => (v(), a("li", {
8413
+ ]])) : (v(), a("ul", bu, [(v(!0), a(e, null, b(u.value, (t) => (v(), a("li", {
8387
8414
  key: t.name,
8388
8415
  "data-file": t.name
8389
8416
  }, [
8390
- o("div", xu, [
8391
- o("span", Su, x(t.name), 1),
8392
- o("span", Cu, x(p.value ? ne(se(t.name).length, "units definition") : ""), 1),
8417
+ o("div", Su, [
8418
+ o("span", Cu, x(t.name), 1),
8419
+ o("span", wu, x(p.value ? ne(se(t.name).length, "units definition") : ""), 1),
8393
8420
  l(C(O), {
8394
8421
  icon: "pi pi-times",
8395
8422
  size: "small",
@@ -8401,11 +8428,11 @@ var pu = { class: "units-title" }, mu = { "data-role": "units-summary" }, hu = {
8401
8428
  onClick: (e) => ae(t.name)
8402
8429
  }, null, 8, ["aria-label", "onClick"])
8403
8430
  ]),
8404
- se(t.name).length ? (v(), a("div", wu, [(v(!0), a(e, null, b(se(t.name), (e) => (v(), a("code", { key: e }, x(e), 1))), 128))])) : i("", !0),
8405
- oe(t.name).length ? (v(), a("ul", Tu, [(v(!0), a(e, null, b(oe(t.name), (e, t) => (v(), a("li", { key: t }, x(e.message), 1))), 128))])) : i("", !0)
8406
- ], 8, bu))), 128))]))]),
8407
- o("section", Eu, [
8408
- o("div", Du, [s[7] ||= o("h3", { id: "units-new-title" }, "New units", -1), o("div", Ou, [te(n.$slots, "new-units-actions", { definitions: f.value }, void 0, !0), l(C(O), {
8431
+ se(t.name).length ? (v(), a("div", Tu, [(v(!0), a(e, null, b(se(t.name), (e) => (v(), a("code", { key: e }, x(e), 1))), 128))])) : i("", !0),
8432
+ oe(t.name).length ? (v(), a("ul", Eu, [(v(!0), a(e, null, b(oe(t.name), (e, t) => (v(), a("li", { key: t }, x(e.message), 1))), 128))])) : i("", !0)
8433
+ ], 8, xu))), 128))]))]),
8434
+ o("section", Du, [
8435
+ o("div", Ou, [s[7] ||= o("h3", { id: "units-new-title" }, "New units", -1), o("div", ku, [te(n.$slots, "new-units-actions", { definitions: f.value }, void 0, !0), l(C(O), {
8409
8436
  icon: "pi pi-plus",
8410
8437
  label: "Define units",
8411
8438
  size: "small",
@@ -8415,11 +8442,11 @@ var pu = { class: "units-title" }, mu = { "data-role": "units-summary" }, hu = {
8415
8442
  title: "Define units of your own, kept in a file apart from the units files",
8416
8443
  onClick: s[1] ||= (e) => E.value = null
8417
8444
  }, null, 8, ["disabled"])])]),
8418
- f.value.length === 0 && E.value === void 0 ? (v(), a("p", ku, " Units you define are kept in a units file of their own, apart from the files loaded. ")) : i("", !0),
8419
- f.value.length ? (v(), a("ul", Au, [(v(!0), a(e, null, b(f.value, (e, t) => (v(), a("li", {
8445
+ f.value.length === 0 && E.value === void 0 ? (v(), a("p", Au, " Units you define are kept in a units file of their own, apart from the files loaded. ")) : i("", !0),
8446
+ f.value.length ? (v(), a("ul", ju, [(v(!0), a(e, null, b(f.value, (e, t) => (v(), a("li", {
8420
8447
  key: e.name,
8421
8448
  "data-units": e.name
8422
- }, [E.value === t ? (v(), r(lu, {
8449
+ }, [E.value === t ? (v(), r(uu, {
8423
8450
  key: 0,
8424
8451
  definition: e,
8425
8452
  others: ce.value,
@@ -8432,9 +8459,9 @@ var pu = { class: "units-title" }, mu = { "data-role": "units-summary" }, hu = {
8432
8459
  "others",
8433
8460
  "known",
8434
8461
  "choices"
8435
- ])) : (v(), a("div", Mu, [
8436
- o("code", Nu, x(e.name), 1),
8437
- o("span", Pu, " = " + x(C(Yl)(e)), 1),
8462
+ ])) : (v(), a("div", Nu, [
8463
+ o("code", Pu, x(e.name), 1),
8464
+ o("span", Fu, " = " + x(C(Xl)(e)), 1),
8438
8465
  l(C(O), {
8439
8466
  icon: "pi pi-pencil",
8440
8467
  size: "small",
@@ -8457,8 +8484,8 @@ var pu = { class: "units-title" }, mu = { "data-role": "units-summary" }, hu = {
8457
8484
  rounded: "",
8458
8485
  severity: "secondary",
8459
8486
  "aria-label": `Remove ${e.name}`,
8460
- title: C(Jl)(e.name, f.value).length ? `Used by ${C(Jl)(e.name, f.value).join(", ")}` : "Remove these units",
8461
- disabled: E.value !== void 0 || C(Jl)(e.name, f.value).length > 0,
8487
+ title: C(Yl)(e.name, f.value).length ? `Used by ${C(Yl)(e.name, f.value).join(", ")}` : "Remove these units",
8488
+ disabled: E.value !== void 0 || C(Yl)(e.name, f.value).length > 0,
8462
8489
  onClick: (e) => me(t)
8463
8490
  }, null, 8, [
8464
8491
  "aria-label",
@@ -8466,8 +8493,8 @@ var pu = { class: "units-title" }, mu = { "data-role": "units-summary" }, hu = {
8466
8493
  "disabled",
8467
8494
  "onClick"
8468
8495
  ])
8469
- ]))], 8, ju))), 128))])) : i("", !0),
8470
- E.value === null ? (v(), r(lu, {
8496
+ ]))], 8, Mu))), 128))])) : i("", !0),
8497
+ E.value === null ? (v(), r(uu, {
8471
8498
  key: 2,
8472
8499
  others: ce.value,
8473
8500
  known: le.value,
@@ -8479,17 +8506,17 @@ var pu = { class: "units-title" }, mu = { "data-role": "units-summary" }, hu = {
8479
8506
  "known",
8480
8507
  "choices"
8481
8508
  ])) : i("", !0),
8482
- fe.value.length ? (v(), a("ul", Fu, [(v(!0), a(e, null, b(fe.value, (e, t) => (v(), a("li", { key: t }, x(e.message), 1))), 128))])) : i("", !0)
8509
+ fe.value.length ? (v(), a("ul", Iu, [(v(!0), a(e, null, b(fe.value, (e, t) => (v(), a("li", { key: t }, x(e.message), 1))), 128))])) : i("", !0)
8483
8510
  ]),
8484
- o("section", Iu, [
8485
- o("div", Lu, [s[8] ||= o("h3", { id: "units-variables-title" }, "Variables", -1), g.value ? (v(), a("span", Ru, x(ne(g.value, "variable")) + " without units ", 1)) : i("", !0)]),
8486
- h.value.length === 0 ? (v(), a("p", zu, " The variables in your equations are listed here, to give each one its units. ")) : (v(), a("table", Bu, [o("tbody", null, [(v(!0), a(e, null, b(h.value, (t) => (v(), a("tr", {
8511
+ o("section", Lu, [
8512
+ o("div", Ru, [s[8] ||= o("h3", { id: "units-variables-title" }, "Variables", -1), g.value ? (v(), a("span", zu, x(ne(g.value, "variable")) + " without units ", 1)) : i("", !0)]),
8513
+ h.value.length === 0 ? (v(), a("p", Bu, " The variables in your equations are listed here, to give each one its units. ")) : (v(), a("table", Vu, [o("tbody", null, [(v(!0), a(e, null, b(h.value, (t) => (v(), a("tr", {
8487
8514
  key: t.name,
8488
8515
  class: m([`state-${t.state}`, { unused: !t.used }]),
8489
8516
  "data-variable": t.name,
8490
8517
  "data-state": t.state
8491
8518
  }, [
8492
- o("th", Hu, x(t.name), 1),
8519
+ o("th", Uu, x(t.name), 1),
8493
8520
  o("td", null, [o("input", {
8494
8521
  class: "units-input",
8495
8522
  type: "text",
@@ -8501,8 +8528,8 @@ var pu = { class: "units-title" }, mu = { "data-role": "units-summary" }, hu = {
8501
8528
  "aria-label": `Units of ${t.name}`,
8502
8529
  "aria-invalid": t.state !== "ok",
8503
8530
  onChange: (e) => ge(t.name, e)
8504
- }, null, 40, Uu)]),
8505
- o("td", Wu, [t.used ? (v(), a(e, { key: 0 }, [c(x(_e[t.state]), 1)], 64)) : (v(), a(e, { key: 1 }, [s[9] ||= c(" not used ", -1), l(C(O), {
8531
+ }, null, 40, Wu)]),
8532
+ o("td", Gu, [t.used ? (v(), a(e, { key: 0 }, [c(x(_e[t.state]), 1)], 64)) : (v(), a(e, { key: 1 }, [s[9] ||= c(" not used ", -1), l(C(O), {
8506
8533
  icon: "pi pi-times",
8507
8534
  size: "small",
8508
8535
  text: "",
@@ -8510,13 +8537,13 @@ var pu = { class: "units-title" }, mu = { "data-role": "units-summary" }, hu = {
8510
8537
  severity: "secondary",
8511
8538
  "aria-label": `Forget the units of ${t.name}`,
8512
8539
  title: "Forget these units",
8513
- onClick: (e) => d.value = C(du)(d.value, t.name, "")
8540
+ onClick: (e) => d.value = C(fu)(d.value, t.name, "")
8514
8541
  }, null, 8, ["aria-label", "onClick"])], 64))])
8515
- ], 10, Vu))), 128))])])),
8542
+ ], 10, Hu))), 128))])])),
8516
8543
  o("datalist", { id: C(he) }, [(v(!0), a(e, null, b(t.unitsNames, (e) => (v(), a("option", {
8517
8544
  key: e,
8518
8545
  value: e
8519
- }, null, 8, Ku))), 128))], 8, Gu)
8546
+ }, null, 8, qu))), 128))], 8, Ku)
8520
8547
  ])
8521
8548
  ]),
8522
8549
  _: 3
@@ -8525,7 +8552,7 @@ var pu = { class: "units-title" }, mu = { "data-role": "units-summary" }, hu = {
8525
8552
  }), [["__scopeId", "data-v-ada663af"]]);
8526
8553
  //#endregion
8527
8554
  //#region src/units/libcellml.ts
8528
- function Ju(e) {
8555
+ function Yu(e) {
8529
8556
  let t = [];
8530
8557
  for (let n = 0; n < e.issueCount(); n++) {
8531
8558
  let r = e.issue(n), i = r.level(), a = r.referenceRule();
@@ -8533,14 +8560,14 @@ function Ju(e) {
8533
8560
  message: r.description(),
8534
8561
  level: i.value,
8535
8562
  rule: a?.value ?? -1
8536
- }), Yu(i), a && Yu(a), r.delete();
8563
+ }), Xu(i), a && Xu(a), r.delete();
8537
8564
  }
8538
8565
  return t;
8539
8566
  }
8540
- function Yu(e) {
8567
+ function Xu(e) {
8541
8568
  e.delete?.();
8542
8569
  }
8543
- var Xu = class {
8570
+ var Zu = class {
8544
8571
  held = [];
8545
8572
  track(e) {
8546
8573
  return e && this.held.push(e), e;
@@ -8549,16 +8576,16 @@ var Xu = class {
8549
8576
  for (let e of this.held.splice(0).reverse()) e.delete();
8550
8577
  }
8551
8578
  };
8552
- function Zu(e) {
8579
+ function Qu(e) {
8553
8580
  return Object.keys(e.Units.StandardUnit).filter((e) => /^[A-Z_]+$/.test(e)).map((e) => e.toLowerCase());
8554
8581
  }
8555
8582
  //#endregion
8556
8583
  //#region src/units/messages.ts
8557
- var Qu = /'([^']+)' is (?:in )?'([^']+)'(?: \(i\.e\. '[^']*'\))?/g;
8558
- function $u(e) {
8584
+ var $u = /'([^']+)' is (?:in )?'([^']+)'(?: \(i\.e\. '[^']*'\))?/g;
8585
+ function ed(e) {
8559
8586
  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;
8560
8587
  if (!r) return null;
8561
- let i = [...r[2].matchAll(Qu)].map(([, e, t]) => ({
8588
+ let i = [...r[2].matchAll($u)].map(([, e, t]) => ({
8562
8589
  text: e,
8563
8590
  units: t
8564
8591
  }));
@@ -8568,27 +8595,27 @@ function $u(e) {
8568
8595
  operands: i
8569
8596
  };
8570
8597
  }
8571
- function ed(e) {
8598
+ function td(e) {
8572
8599
  let [t, n] = e.operands;
8573
- 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}: ${td(t)}, ${td(n)}` : `Units don't match in ${e.expression}`;
8600
+ 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}: ${nd(t)}, ${nd(n)}` : `Units don't match in ${e.expression}`;
8574
8601
  }
8575
- var td = (e) => e.units === "dimensionless" ? `${e.text} is dimensionless` : `${e.text} is in ${e.units}`, nd = /[A-Za-z_][A-Za-z0-9_]*/g, rd = /\bd(?:\^\d+)?([A-Za-z_][A-Za-z0-9_]*)\/d([A-Za-z_][A-Za-z0-9_]*)(?:\^\d+)?/g, id = /(?<![A-Za-z_0-9.])\d+(?:\.\d*)?(?:e[+-]?\d+)?/g;
8576
- function ad(e, t) {
8602
+ var nd = (e) => e.units === "dimensionless" ? `${e.text} is dimensionless` : `${e.text} is in ${e.units}`, rd = /[A-Za-z_][A-Za-z0-9_]*/g, id = /\bd(?:\^\d+)?([A-Za-z_][A-Za-z0-9_]*)\/d([A-Za-z_][A-Za-z0-9_]*)(?:\^\d+)?/g, ad = /(?<![A-Za-z_0-9.])\d+(?:\.\d*)?(?:e[+-]?\d+)?/g;
8603
+ function od(e, t) {
8577
8604
  let n = /* @__PURE__ */ new Set(), r = (e) => {
8578
8605
  t.includes(e) && n.add(e);
8579
- }, i = e.replace(rd, (e, n, i) => t.includes(`d${n}`) || t.includes(`d${i}`) ? e : (r(n), r(i), " "));
8580
- for (let [e] of i.replace(id, " ").matchAll(nd)) r(e);
8606
+ }, i = e.replace(id, (e, n, i) => t.includes(`d${n}`) || t.includes(`d${i}`) ? e : (r(n), r(i), " "));
8607
+ for (let [e] of i.replace(ad, " ").matchAll(rd)) r(e);
8581
8608
  return [...n];
8582
8609
  }
8583
- function od(e) {
8584
- return [...e.matchAll(id)].map(([e]) => Number(e));
8610
+ function sd(e) {
8611
+ return [...e.matchAll(ad)].map(([e]) => Number(e));
8585
8612
  }
8586
8613
  //#endregion
8587
8614
  //#region src/units/check.ts
8588
- function sd(e, t) {
8615
+ function cd(e, t) {
8589
8616
  return e.variables.filter((e) => !t[e]);
8590
8617
  }
8591
- var cd = 500, ld = class {
8618
+ var ld = 500, ud = class {
8592
8619
  lc;
8593
8620
  library;
8594
8621
  cache = /* @__PURE__ */ new Map();
@@ -8605,7 +8632,7 @@ var cd = 500, ld = class {
8605
8632
  })) : [];
8606
8633
  }
8607
8634
  prechecked(e, t) {
8608
- let n = sd(e, t).map((e) => ({
8635
+ let n = cd(e, t).map((e) => ({
8609
8636
  message: `${e} has no units`,
8610
8637
  variables: [e]
8611
8638
  })), r = [.../* @__PURE__ */ new Set([...e.variables.map((e) => t[e]), ...e.units])].filter((e) => e && !this.library.isKnown(e)).map((n) => ({
@@ -8619,10 +8646,10 @@ var cd = 500, ld = class {
8619
8646
  let n = `${e.mathml}\n${e.variables.map((e) => `${e}:${t[e]}`).join(" ")}`, r = this.cache.get(n);
8620
8647
  if (r) return r;
8621
8648
  let i = this.analyse(e, t);
8622
- return this.cache.size >= cd && this.cache.delete(this.cache.keys().next().value), this.cache.set(n, i), i;
8649
+ return this.cache.size >= ld && this.cache.delete(this.cache.keys().next().value), this.cache.set(n, i), i;
8623
8650
  }
8624
8651
  analyse(e, t) {
8625
- let { lc: n } = this, r = new Xu();
8652
+ let { lc: n } = this, r = new Zu();
8626
8653
  try {
8627
8654
  let i = r.track(new n.Model());
8628
8655
  i.setName("units_check"), this.library.addTo(i, [...e.variables.map((e) => t[e]), ...e.units], r);
@@ -8635,12 +8662,12 @@ var cd = 500, ld = class {
8635
8662
  a.setMath(e.mathml), i.addComponent(a), i.linkUnits();
8636
8663
  let o = r.track(new n.Validator());
8637
8664
  o.validateModel(i);
8638
- let s = Ju(o).filter((e) => e.level === 0);
8639
- if (s.length) return s.map((e) => ({ message: `libCellML: ${dd(e.message)}` }));
8665
+ let s = Yu(o).filter((e) => e.level === 0);
8666
+ if (s.length) return s.map((e) => ({ message: `libCellML: ${fd(e.message)}` }));
8640
8667
  let c = r.track(new n.Analyser());
8641
8668
  c.analyseModel(i);
8642
- let l = Ju(c).filter((e) => e.rule === 112).map((e) => e.message);
8643
- return [...new Set(l)].map((t) => ud(t, e.variables));
8669
+ let l = Yu(c).filter((e) => e.rule === 112).map((e) => e.message);
8670
+ return [...new Set(l)].map((t) => dd(t, e.variables));
8644
8671
  } finally {
8645
8672
  r.dispose();
8646
8673
  }
@@ -8649,36 +8676,36 @@ var cd = 500, ld = class {
8649
8676
  this.cache.clear();
8650
8677
  }
8651
8678
  };
8652
- function ud(e, t) {
8653
- let n = $u(e);
8654
- if (!n) return { message: dd(e) };
8679
+ function dd(e, t) {
8680
+ let n = ed(e);
8681
+ if (!n) return { message: fd(e) };
8655
8682
  let r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
8656
8683
  for (let e of n.operands) {
8657
- let n = ad(e.text, t);
8684
+ let n = od(e.text, t);
8658
8685
  for (let e of n) r.add(e);
8659
- if (n.length === 0) for (let t of od(e.text)) i.add(t);
8686
+ if (n.length === 0) for (let t of sd(e.text)) i.add(t);
8660
8687
  }
8661
8688
  return {
8662
- message: ed(n),
8689
+ message: td(n),
8663
8690
  ...r.size ? { variables: [...r] } : {},
8664
8691
  ...i.size ? { numbers: [...i] } : {}
8665
8692
  };
8666
8693
  }
8667
- function dd(e) {
8694
+ function fd(e) {
8668
8695
  return e.replace(/ in component 'equation'/g, "").replace(/ in model 'units_check'/g, "");
8669
8696
  }
8670
8697
  //#endregion
8671
8698
  //#region src/units/library.ts
8672
- var fd = class e {
8699
+ var pd = class e {
8673
8700
  lc;
8674
8701
  names;
8675
8702
  sources;
8676
8703
  problems;
8677
8704
  standard;
8678
8705
  defined = /* @__PURE__ */ new Map();
8679
- handles = new Xu();
8706
+ handles = new Zu();
8680
8707
  constructor(e, t) {
8681
- this.lc = e, this.standard = new Set(Zu(e));
8708
+ this.lc = e, this.standard = new Set(Qu(e));
8682
8709
  let n = [], r = [], i = /* @__PURE__ */ new Map();
8683
8710
  for (let e of t) {
8684
8711
  let t = [];
@@ -8734,7 +8761,7 @@ var fd = class e {
8734
8761
  let n = new this.lc.Parser(!1);
8735
8762
  try {
8736
8763
  let r = this.handles.track(n.parseModel(e.text));
8737
- for (let r of Ju(n)) r.level === 0 && t.push({
8764
+ for (let r of Yu(n)) r.level === 0 && t.push({
8738
8765
  source: e.name,
8739
8766
  message: r.message
8740
8767
  });
@@ -8743,21 +8770,21 @@ var fd = class e {
8743
8770
  n.delete();
8744
8771
  }
8745
8772
  }
8746
- }, pd = "$libcellml";
8747
- function md(e) {
8748
- let t = e.libcellml === void 0 ? d(pd, null) : e.libcellml, r = e.delay ?? 300, i = n(() => S(e.enabled) ?? !0), a = n(() => hd(t)), o = n(() => t !== null), s = n(() => a.value !== null), c = n(() => s.value ? "ready" : o.value ? "loading" : "unavailable"), l = ne(null), u = ne([]), f = null, p, m = () => {
8773
+ }, md = "$libcellml";
8774
+ function hd(e) {
8775
+ let t = e.libcellml === void 0 ? d(md, null) : e.libcellml, r = e.delay ?? 300, i = n(() => S(e.enabled) ?? !0), a = n(() => gd(t)), o = n(() => t !== null), s = n(() => a.value !== null), c = n(() => s.value ? "ready" : o.value ? "loading" : "unavailable"), l = ne(null), u = ne([]), f = null, p, m = () => {
8749
8776
  clearTimeout(p), p = void 0, u.value = f && i.value ? f.check(S(e.lines), S(e.variableUnits)) : [];
8750
8777
  }, h = () => {
8751
8778
  f?.dispose(), l.value?.dispose(), f = null, l.value = null;
8752
8779
  }, g = n(() => {
8753
8780
  let t = S(e.newUnits) ?? [];
8754
- return t.length ? Zl(t) : "";
8781
+ return t.length ? Ql(t) : "";
8755
8782
  });
8756
8783
  return se([a, () => [...S(e.sources), ...g.value ? [{
8757
- name: Ul,
8784
+ name: Wl,
8758
8785
  text: g.value
8759
8786
  }] : []]], ([e, t]) => {
8760
- h(), e && (l.value = fd.load(e, t), f = new ld(e, l.value)), m();
8787
+ h(), e && (l.value = pd.load(e, t), f = new ud(e, l.value)), m();
8761
8788
  }, { immediate: !0 }), se(i, () => m()), se([() => S(e.lines), () => S(e.variableUnits)], () => {
8762
8789
  clearTimeout(p), p = setTimeout(m, r);
8763
8790
  }), _(() => {
@@ -8771,16 +8798,16 @@ function md(e) {
8771
8798
  files: n(() => l.value?.sources ?? []),
8772
8799
  problems: n(() => l.value?.problems ?? []),
8773
8800
  newUnitsFile: g,
8774
- unitsNames: n(() => a.value && l.value ? [...Zu(a.value), ...l.value.names] : []),
8801
+ unitsNames: n(() => a.value && l.value ? [...Qu(a.value), ...l.value.names] : []),
8775
8802
  missing: n(() => {
8776
8803
  let t = S(e.variableUnits);
8777
- return [...new Set(S(e.lines).flatMap((e) => sd(e, t)))];
8804
+ return [...new Set(S(e.lines).flatMap((e) => cd(e, t)))];
8778
8805
  }),
8779
8806
  check: m
8780
8807
  };
8781
8808
  }
8782
- function hd(e) {
8809
+ function gd(e) {
8783
8810
  return e ? "Parser" in e ? re(e) : e.status === "ready" && e.library ? re(e.library) : null : null;
8784
8811
  }
8785
8812
  //#endregion
8786
- export { Hl as EquationWorkbench, pd as LIBCELLML_KEY, qu as UnitsPanel, ia as importContentMathML, md as useUnitsChecker };
8813
+ export { Ul as EquationWorkbench, md as LIBCELLML_KEY, Ju as UnitsPanel, ia as importContentMathML, hd as useUnitsChecker };