@konoui/mjimage 0.0.50 → 0.0.52

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.
Files changed (3) hide show
  1. package/dist/index.cjs +11 -11
  2. package/dist/index.js +217 -217
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  var ws = Object.defineProperty;
2
2
  var bs = (n, t, e) => t in n ? ws(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
3
  var _ = (n, t, e) => bs(n, typeof t != "symbol" ? t + "" : t, e);
4
- const En = "MS Gothic, sans-serif", dt = {
4
+ const Nn = "MS Gothic, sans-serif", dt = {
5
5
  WIDTH: 66,
6
6
  HEIGHT: 90,
7
7
  TEXT_SCALE: 0.8,
8
8
  BLOCK_MARGIN_SCALE: 0.3
9
- }, qe = {
9
+ }, Ye = {
10
10
  WIDTH: 125,
11
11
  HEIGHT: 27.5
12
12
  }, _s = { BASE: 40 }, ct = ",", p = {
@@ -65,7 +65,7 @@ const En = "MS Gothic, sans-serif", dt = {
65
65
  [A.S]: "南",
66
66
  [A.W]: "西",
67
67
  [A.N]: "北"
68
- }, Nn = {
68
+ }, Sn = {
69
69
  [k.E1]: "東1局",
70
70
  [k.E2]: "東2局",
71
71
  [k.E3]: "東3局",
@@ -112,7 +112,7 @@ class Wo {
112
112
  });
113
113
  _(this, "measureTableFontContext", (t) => {
114
114
  const e = this.measureFontContext(
115
- En,
115
+ Nn,
116
116
  _s.BASE * t
117
117
  );
118
118
  return e.textHeight = e.textWidth, e.numHeight = e.numWidth, e;
@@ -287,7 +287,7 @@ class T {
287
287
  return e && (s[e.idx] = e.tile), qt(s, this._type);
288
288
  }
289
289
  }
290
- const gt = (n) => {
290
+ const pt = (n) => {
291
291
  let t = "";
292
292
  for (const e of n) {
293
293
  if (e.t == p.BACK) return n.join("");
@@ -311,7 +311,7 @@ class J extends T {
311
311
  return T.deserialize({ tiles: t, type: b.CHI });
312
312
  }
313
313
  toString() {
314
- return gt(this.tiles);
314
+ return pt(this.tiles);
315
315
  }
316
316
  }
317
317
  class X extends T {
@@ -322,7 +322,7 @@ class X extends T {
322
322
  return T.deserialize({ tiles: t, type: b.PON });
323
323
  }
324
324
  toString() {
325
- return gt(this.tiles);
325
+ return pt(this.tiles);
326
326
  }
327
327
  }
328
328
  class M extends T {
@@ -358,7 +358,7 @@ class q extends T {
358
358
  return T.deserialize({ tiles: t, type: b.DAI_KAN });
359
359
  }
360
360
  toString() {
361
- return gt(this.tiles);
361
+ return pt(this.tiles);
362
362
  }
363
363
  }
364
364
  class K extends T {
@@ -373,7 +373,7 @@ class K extends T {
373
373
  return r.splice(s, 0, e.clone({ add: y.HORIZONTAL })), new K(r);
374
374
  }
375
375
  toString() {
376
- return gt(this.tiles);
376
+ return pt(this.tiles);
377
377
  }
378
378
  }
379
379
  class P extends T {
@@ -381,7 +381,7 @@ class P extends T {
381
381
  super([t, e], b.PAIR);
382
382
  }
383
383
  toString() {
384
- return gt(this.tiles);
384
+ return pt(this.tiles);
385
385
  }
386
386
  static from(t) {
387
387
  return T.deserialize({ tiles: t, type: b.PAIR });
@@ -395,7 +395,7 @@ class Z extends T {
395
395
  return T.deserialize({ tiles: t, type: b.THREE });
396
396
  }
397
397
  toString() {
398
- return gt(this.tiles);
398
+ return pt(this.tiles);
399
399
  }
400
400
  }
401
401
  class lt extends T {
@@ -406,10 +406,10 @@ class lt extends T {
406
406
  return T.deserialize({ tiles: t, type: b.RUN });
407
407
  }
408
408
  toString() {
409
- return gt(this.tiles);
409
+ return pt(this.tiles);
410
410
  }
411
411
  }
412
- class Sn extends T {
412
+ class vn extends T {
413
413
  constructor(t) {
414
414
  super([t], b.ISOLATED);
415
415
  }
@@ -434,7 +434,7 @@ class Dt extends T {
434
434
  return He(this.tiles);
435
435
  }
436
436
  }
437
- class vn extends T {
437
+ class Tn extends T {
438
438
  constructor(t, e) {
439
439
  super(t, e);
440
440
  }
@@ -461,11 +461,11 @@ const qt = (n, t) => {
461
461
  case b.PAIR:
462
462
  return new P(n[0], n[1]);
463
463
  case b.ISOLATED:
464
- return new Sn(n[0]);
464
+ return new vn(n[0]);
465
465
  case b.HAND:
466
466
  return new Dt(n);
467
467
  default:
468
- return new vn(n, t);
468
+ return new Tn(n, t);
469
469
  }
470
470
  };
471
471
  class D {
@@ -491,7 +491,7 @@ class D {
491
491
  e.push(ct), t.readChar();
492
492
  continue;
493
493
  }
494
- const [i, o] = Qe(r, s);
494
+ const [i, o] = tn(r, s);
495
495
  if (o) {
496
496
  if (i == p.BACK) {
497
497
  e.push(new w(i, 0)), t.readChar();
@@ -505,7 +505,7 @@ class D {
505
505
  s.push(a), t.readChar();
506
506
  continue;
507
507
  }
508
- const [l, u] = Tn(r);
508
+ const [l, u] = In(r);
509
509
  if (!u)
510
510
  throw new Error(
511
511
  `encounter unexpected number. n: ${l}, current: ${r}, input: ${t.input}`
@@ -524,25 +524,25 @@ class D {
524
524
  if (t.length == 0) return s;
525
525
  for (const o of t) {
526
526
  if (o == ct) {
527
- const a = Ye(e), c = qt(e, a);
527
+ const a = Qe(e), c = qt(e, a);
528
528
  s.push(c), e = [];
529
529
  continue;
530
530
  }
531
531
  e.push(o);
532
532
  }
533
- const r = Ye(e), i = qt(e, r);
533
+ const r = Qe(e), i = qt(e, r);
534
534
  return s.push(i), e = [], s;
535
535
  }
536
536
  validate(t) {
537
537
  if (t.length == 0) return;
538
538
  if (t.length > this.maxInputLength)
539
539
  throw new Error(`exceeded maximum input length(${t.length})`);
540
- const e = t.charAt(t.length - 1), [s, r] = Qe(e, [new w(p.BACK, 1)]);
540
+ const e = t.charAt(t.length - 1), [s, r] = tn(e, [new w(p.BACK, 1)]);
541
541
  if (!r)
542
542
  throw new Error(`last character(${e}) is not type value`);
543
543
  }
544
544
  }
545
- function Ye(n) {
545
+ function Qe(n) {
546
546
  if (n.length === 0) return b.UNKNOWN;
547
547
  if (n.length === 1)
548
548
  return n[0].has(y.DORA) ? b.IMAGE_DORA : n[0].has(y.TSUMO) ? b.TSUMO : b.HAND;
@@ -574,7 +574,7 @@ function Ts(n, t) {
574
574
  return s.isNum() && s.n == 0 ? s.clone({ n: 5, add: y.RED }) : s;
575
575
  });
576
576
  }
577
- function Qe(n, t) {
577
+ function tn(n, t) {
578
578
  const [e, s] = Ss(n);
579
579
  if (s) return [e, !0];
580
580
  if ((n === "w" || n === "d") && t.length > 0) {
@@ -586,7 +586,7 @@ function Qe(n, t) {
586
586
  }
587
587
  return [p.BACK, !1];
588
588
  }
589
- function Tn(n) {
589
+ function In(n) {
590
590
  const t = Number(n), e = 0 <= t && t <= 9;
591
591
  return [t, e];
592
592
  }
@@ -598,7 +598,7 @@ function Is(n) {
598
598
  const r = n.peekCharN(s);
599
599
  if (t.includes(r)) e.push(r);
600
600
  else {
601
- const [i, o] = Tn(r);
601
+ const [i, o] = In(r);
602
602
  if (!o) break;
603
603
  for (const c of e) n.readChar();
604
604
  const a = new w(p.BACK, i, e);
@@ -624,18 +624,18 @@ function H(n, t = !1) {
624
624
  }
625
625
  const Jt = (n) => {
626
626
  let t = n.substring(0, 2), e = Number(n.substring(2, 3));
627
- return e == 4 ? (e = 1, t = ft(t)) : e++, `${t}${e}`;
628
- }, Do = (n) => Jt(Jt(Jt(n))), ft = (n) => {
627
+ return e == 4 ? (e = 1, t = Et(t)) : e++, `${t}${e}`;
628
+ }, Do = (n) => Jt(Jt(Jt(n))), Et = (n) => {
629
629
  let t = Number(n.toString()[0]);
630
630
  return t = t % 4 + 1, `${t}w`;
631
- }, In = (n) => {
631
+ }, Pe = (n) => {
632
632
  let t = Number(n.toString()[0]);
633
633
  return t = t % 2 + 1, `${t}w`;
634
- }, tn = (n, t, e) => {
634
+ }, en = (n, t, e) => {
635
635
  const s = Math.abs(Number(n[0]) - Number(t[0]));
636
636
  return S(s == 1 || s == 2 || s == 3), e == b.PON ? s == 3 ? 0 : s == 2 ? 1 : 2 : s == 3 ? 0 : s == 1 ? 3 : 2;
637
637
  };
638
- function en(n) {
638
+ function nn(n) {
639
639
  return typeof n > "u";
640
640
  }
641
641
  function _e(n, t = 0) {
@@ -648,7 +648,7 @@ function _e(n, t = 0) {
648
648
  f: t
649
649
  };
650
650
  }
651
- function Pe(...n) {
651
+ function We(...n) {
652
652
  n = Array.isArray(n[0]) ? n[0] : n;
653
653
  const t = (e, s) => ({
654
654
  a: e.a * s.a + e.c * s.b,
@@ -667,12 +667,12 @@ function Pe(...n) {
667
667
  return t(n[0], n[1]);
668
668
  default: {
669
669
  const [e, s, ...r] = n, i = t(e, s);
670
- return Pe(i, ...r);
670
+ return We(i, ...r);
671
671
  }
672
672
  }
673
673
  }
674
674
  function Os(...n) {
675
- return Pe(...n);
675
+ return We(...n);
676
676
  }
677
677
  const { cos: ks, sin: Cs, PI: xs } = Math;
678
678
  function Rs(n, t, e) {
@@ -684,7 +684,7 @@ function Rs(n, t, e) {
684
684
  d: s,
685
685
  f: 0
686
686
  };
687
- return en(t) || en(e) ? i : Pe([
687
+ return nn(t) || nn(e) ? i : We([
688
688
  _e(t, e),
689
689
  i,
690
690
  _e(-t, -e)
@@ -812,7 +812,7 @@ function kn(n, t) {
812
812
  }
813
813
  return e;
814
814
  }
815
- const We = function(n) {
815
+ const De = function(n) {
816
816
  const t = Bs.exec(n);
817
817
  return !(t === null || typeof t > "u");
818
818
  };
@@ -831,11 +831,11 @@ function Ls(n, t) {
831
831
  n[0] === "\uFEFF" && (n = n.substr(1));
832
832
  for (let i = 0; i < n.length; i++)
833
833
  if (n[i] === "<" && n[i + 1] === "?") {
834
- if (i += 2, i = sn(n, i), i.err) return i;
834
+ if (i += 2, i = rn(n, i), i.err) return i;
835
835
  } else if (n[i] === "<") {
836
836
  let o = i;
837
837
  if (i++, n[i] === "!") {
838
- i = rn(n, i);
838
+ i = on(n, i);
839
839
  continue;
840
840
  } else {
841
841
  let a = !1;
@@ -855,7 +855,7 @@ function Ls(n, t) {
855
855
  if (i = l.index, u[u.length - 1] === "/") {
856
856
  const h = i - u.length;
857
857
  u = u.substring(0, u.length - 1);
858
- const d = on(u, t);
858
+ const d = an(u, t);
859
859
  if (d === !0)
860
860
  s = !0;
861
861
  else
@@ -880,7 +880,7 @@ function Ls(n, t) {
880
880
  }
881
881
  } else return I("InvalidTag", "Closing tag '" + c + "' doesn't have proper closing.", R(n, i));
882
882
  else {
883
- const h = on(u, t);
883
+ const h = an(u, t);
884
884
  if (h !== !0)
885
885
  return I(h.err.code, h.err.msg, R(n, i - u.length + h.err.line));
886
886
  if (r === !0)
@@ -890,10 +890,10 @@ function Ls(n, t) {
890
890
  for (i++; i < n.length; i++)
891
891
  if (n[i] === "<")
892
892
  if (n[i + 1] === "!") {
893
- i++, i = rn(n, i);
893
+ i++, i = on(n, i);
894
894
  continue;
895
895
  } else if (n[i + 1] === "?") {
896
- if (i = sn(n, ++i), i.err) return i;
896
+ if (i = rn(n, ++i), i.err) return i;
897
897
  } else
898
898
  break;
899
899
  else if (n[i] === "&") {
@@ -901,12 +901,12 @@ function Ls(n, t) {
901
901
  if (h == -1)
902
902
  return I("InvalidChar", "char '&' is not expected.", R(n, i));
903
903
  i = h;
904
- } else if (r === !0 && !nn(n[i]))
904
+ } else if (r === !0 && !sn(n[i]))
905
905
  return I("InvalidXml", "Extra text at the end", R(n, i));
906
906
  n[i] === "<" && i--;
907
907
  }
908
908
  } else {
909
- if (nn(n[i]))
909
+ if (sn(n[i]))
910
910
  continue;
911
911
  return I("InvalidChar", "char '" + n[i] + "' is not expected.", R(n, i));
912
912
  }
@@ -918,11 +918,11 @@ function Ls(n, t) {
918
918
  } else return I("InvalidXml", "Start tag expected.", 1);
919
919
  return !0;
920
920
  }
921
- function nn(n) {
921
+ function sn(n) {
922
922
  return n === " " || n === " " || n === `
923
923
  ` || n === "\r";
924
924
  }
925
- function sn(n, t) {
925
+ function rn(n, t) {
926
926
  const e = t;
927
927
  for (; t < n.length; t++)
928
928
  if (n[t] == "?" || n[t] == " ") {
@@ -937,7 +937,7 @@ function sn(n, t) {
937
937
  }
938
938
  return t;
939
939
  }
940
- function rn(n, t) {
940
+ function on(n, t) {
941
941
  if (n.length > t + 5 && n[t + 1] === "-" && n[t + 2] === "-") {
942
942
  for (t += 3; t < n.length; t++)
943
943
  if (n[t] === "-" && n[t + 1] === "-" && n[t + 2] === ">") {
@@ -979,7 +979,7 @@ function Zs(n, t) {
979
979
  };
980
980
  }
981
981
  const Us = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
982
- function on(n, t) {
982
+ function an(n, t) {
983
983
  const e = kn(n, Us), s = {};
984
984
  for (let r = 0; r < e.length; r++) {
985
985
  if (e[r][1].length === 0)
@@ -1033,10 +1033,10 @@ function I(n, t, e) {
1033
1033
  };
1034
1034
  }
1035
1035
  function Js(n) {
1036
- return We(n);
1036
+ return De(n);
1037
1037
  }
1038
1038
  function Xs(n) {
1039
- return We(n);
1039
+ return De(n);
1040
1040
  }
1041
1041
  function R(n, t) {
1042
1042
  const e = n.substring(0, t).split(/\r?\n/);
@@ -1170,7 +1170,7 @@ function ir(n, t) {
1170
1170
  return n[t + 1] === "!" && n[t + 2] === "N" && n[t + 3] === "O" && n[t + 4] === "T" && n[t + 5] === "A" && n[t + 6] === "T" && n[t + 7] === "I" && n[t + 8] === "O" && n[t + 9] === "N";
1171
1171
  }
1172
1172
  function or(n) {
1173
- if (We(n))
1173
+ if (De(n))
1174
1174
  return n;
1175
1175
  throw new Error(`Invalid entity name ${n}`);
1176
1176
  }
@@ -1634,14 +1634,14 @@ function Rn(n, t, e, s) {
1634
1634
  r += s + `<!--${a[c][0][t.textNodeName]}-->`, i = !0;
1635
1635
  continue;
1636
1636
  } else if (c[0] === "?") {
1637
- const f = an(a[":@"], t), m = c === "?xml" ? "" : s;
1637
+ const f = cn(a[":@"], t), m = c === "?xml" ? "" : s;
1638
1638
  let E = a[c][0][t.textNodeName];
1639
1639
  E = E.length !== 0 ? " " + E : "", r += m + `<${c}${E}${f}?>`, i = !0;
1640
1640
  continue;
1641
1641
  }
1642
1642
  let u = s;
1643
1643
  u !== "" && (u += t.indentBy);
1644
- const h = an(a[":@"], t), d = s + `<${c}${h}`, g = Rn(a[c], t, l, u);
1644
+ const h = cn(a[":@"], t), d = s + `<${c}${h}`, g = Rn(a[c], t, l, u);
1645
1645
  t.unpairedTags.indexOf(c) !== -1 ? t.suppressUnpairedNode ? r += d + ">" : r += d + "/>" : (!g || g.length === 0) && t.suppressEmptyNode ? r += d + "/>" : g && g.endsWith(">") ? r += d + `>${g}${s}</${c}>` : (r += d + ">", g && s !== "" && (g.includes("/>") || g.includes("</")) ? r += s + t.indentBy + g + s : r += g, r += `</${c}>`), i = !0;
1646
1646
  }
1647
1647
  return r;
@@ -1654,7 +1654,7 @@ function Mr(n) {
1654
1654
  return s;
1655
1655
  }
1656
1656
  }
1657
- function an(n, t) {
1657
+ function cn(n, t) {
1658
1658
  let e = "";
1659
1659
  if (n && !t.ignoreAttributes)
1660
1660
  for (let s in n) {
@@ -1821,7 +1821,7 @@ function Wr(n) {
1821
1821
  function Dr(n) {
1822
1822
  return n.startsWith(this.options.attributeNamePrefix) && n !== this.options.textNodeName ? n.substr(this.attrPrefixLen) : !1;
1823
1823
  }
1824
- class yt {
1824
+ class gt {
1825
1825
  constructor(t) {
1826
1826
  _(this, "type");
1827
1827
  _(this, "attrs", {});
@@ -1878,7 +1878,7 @@ class yt {
1878
1878
  return this.toString();
1879
1879
  }
1880
1880
  }
1881
- class $n extends yt {
1881
+ class $n extends gt {
1882
1882
  constructor(e) {
1883
1883
  super("image");
1884
1884
  _(this, "attrs", {});
@@ -1888,7 +1888,7 @@ class $n extends yt {
1888
1888
  return this.attrs.href = e, this;
1889
1889
  }
1890
1890
  }
1891
- class De extends yt {
1891
+ class Be extends gt {
1892
1892
  constructor(e) {
1893
1893
  super("use");
1894
1894
  _(this, "attrs", {});
@@ -1901,7 +1901,7 @@ class De extends yt {
1901
1901
  return e == null ? e : `#${e}`;
1902
1902
  }
1903
1903
  }
1904
- class Hn extends yt {
1904
+ class Hn extends gt {
1905
1905
  constructor() {
1906
1906
  super("rect");
1907
1907
  _(this, "attrs", {});
@@ -1913,7 +1913,7 @@ class Hn extends yt {
1913
1913
  return this.attrs.stroke = e, this;
1914
1914
  }
1915
1915
  }
1916
- class Nt extends yt {
1916
+ class Nt extends gt {
1917
1917
  constructor(e = "") {
1918
1918
  super("text");
1919
1919
  _(this, "attrs");
@@ -1930,7 +1930,7 @@ class Nt extends yt {
1930
1930
  return this._text;
1931
1931
  }
1932
1932
  }
1933
- let Pn = class extends yt {
1933
+ let Pn = class extends gt {
1934
1934
  constructor(e) {
1935
1935
  super("symbol");
1936
1936
  _(this, "raw");
@@ -1943,7 +1943,7 @@ let Pn = class extends yt {
1943
1943
  return this.raw;
1944
1944
  }
1945
1945
  };
1946
- class v extends yt {
1946
+ class v extends gt {
1947
1947
  constructor() {
1948
1948
  super("g");
1949
1949
  _(this, "children", []);
@@ -1980,7 +1980,7 @@ const Br = [
1980
1980
  'version="1.1"',
1981
1981
  'xmlns:xlink="http://www.w3.org/1999/xlink"'
1982
1982
  ];
1983
- class Kr extends yt {
1983
+ class Kr extends gt {
1984
1984
  constructor() {
1985
1985
  super("svg");
1986
1986
  _(this, "children", []);
@@ -2030,7 +2030,7 @@ class Kr extends yt {
2030
2030
  function zr() {
2031
2031
  return new Kr();
2032
2032
  }
2033
- const Ko = zr, zo = v, Lo = $n, jo = De, Fo = Hn, Zo = Nt;
2033
+ const Ko = zr, zo = v, Lo = $n, jo = Be, Fo = Hn, Zo = Nt;
2034
2034
  function Lr(n) {
2035
2035
  return n.replace(/[A-Z]/g, (t) => "-" + t.toLowerCase());
2036
2036
  }
@@ -2088,7 +2088,7 @@ class vt {
2088
2088
  // image wrapper
2089
2089
  image(t) {
2090
2090
  let e = new $n().load(this.buildURL(t));
2091
- return this.svgSprite && (e = new De().use(vt.buildID(t))), t instanceof w && t.has(y.COLOR_GRAYSCALE) && e.css({ filter: "contrast(65%)" }), e;
2091
+ return this.svgSprite && (e = new Be().use(vt.buildID(t))), t instanceof w && t.has(y.COLOR_GRAYSCALE) && e.css({ filter: "contrast(65%)" }), e;
2092
2092
  }
2093
2093
  createImage(t, e, s) {
2094
2094
  const r = W(t, this.scale);
@@ -2097,7 +2097,7 @@ class vt {
2097
2097
  createTextImage(t, e, s, r) {
2098
2098
  const i = this.createImage(t, e, s), o = W(t, this.scale), a = o.baseHeight * 0.2, c = o.baseWidth, l = o.baseHeight, u = new Nt().plain(r);
2099
2099
  u.size(o.baseWidth, o.baseHeight).font({
2100
- family: En,
2100
+ family: Nn,
2101
2101
  size: a
2102
2102
  }).dx(c).dy(l);
2103
2103
  const h = new v();
@@ -2284,7 +2284,7 @@ const Gr = (n, t) => {
2284
2284
  const t = Bn(), e = [];
2285
2285
  return n.each((s, r) => {
2286
2286
  const i = r[s];
2287
- if (i instanceof De) {
2287
+ if (i instanceof Be) {
2288
2288
  const a = i.attr("href").substring(1);
2289
2289
  t.includes(a) && e.push(a);
2290
2290
  }
@@ -2321,7 +2321,7 @@ const Gr = (n, t) => {
2321
2321
  const e = new v(), s = Jr(n);
2322
2322
  for (let r = 0; r < s.length; r++) {
2323
2323
  let i = s[r], o = r * t.tileHeight;
2324
- const a = t.createBlockHandDiscard(new vn(i, b.IMAGE_DISCARD)).translate(0, o);
2324
+ const a = t.createBlockHandDiscard(new Tn(i, b.IMAGE_DISCARD)).translate(0, o);
2325
2325
  e.add(a);
2326
2326
  }
2327
2327
  return {
@@ -2330,17 +2330,17 @@ const Gr = (n, t) => {
2330
2330
  height: t.tileHeight * s.length
2331
2331
  };
2332
2332
  }, Xr = (n, t, e) => {
2333
- const s = t.font, r = t.textWidth, i = t.textHeight, o = e.sticks.dead, a = e.sticks.reach, c = qe.WIDTH * n.scale, l = qe.HEIGHT * n.scale;
2333
+ const s = t.font, r = t.textWidth, i = t.textHeight, o = e.sticks.dead, a = e.sticks.reach, c = Ye.WIDTH * n.scale, l = Ye.HEIGHT * n.scale;
2334
2334
  let u = r * 3, h = i;
2335
2335
  const d = (c + n.tileWidth + r - u) / 2, g = new Nt().plain(e.round).font(s).x(d).y(0);
2336
2336
  h += 25 * n.scale;
2337
- const f = n.tileHeight, m = new v().size(c, f).translate(0, h), E = { family: s.family, size: s.size * 0.7 }, N = n.createStick(1e3).size(c, l).x(0).y(0), O = new Nt().plain(a.toString()).font(E).dx(c).dy(l), x = n.createStick(100).size(c, l).x(0).y(l + l), mt = new Nt().plain(o.toString()).font(E).dx(c).dy(l * 3);
2338
- m.add(N), m.add(O), m.add(x), m.add(mt);
2339
- const wt = n.createImage(e.doras[0], 0, 0).x(c + r).y(0);
2340
- m.add(wt);
2341
- const bt = new v();
2342
- return bt.add(g), bt.add(g), bt.add(m), {
2343
- e: bt,
2337
+ const f = n.tileHeight, m = new v().size(c, f).translate(0, h), E = { family: s.family, size: s.size * 0.7 }, N = n.createStick(1e3).size(c, l).x(0).y(0), O = new Nt().plain(a.toString()).font(E).dx(c).dy(l), x = n.createStick(100).size(c, l).x(0).y(l + l), yt = new Nt().plain(o.toString()).font(E).dx(c).dy(l * 3);
2338
+ m.add(N), m.add(O), m.add(x), m.add(yt);
2339
+ const mt = n.createImage(e.doras[0], 0, 0).x(c + r).y(0);
2340
+ m.add(mt);
2341
+ const wt = new v();
2342
+ return wt.add(g), wt.add(g), wt.add(m), {
2343
+ e: wt,
2344
2344
  width: c + n.tileWidth + r,
2345
2345
  height: h + n.tileHeight
2346
2346
  };
@@ -2373,11 +2373,11 @@ const Gr = (n, t) => {
2373
2373
  s / 2 - c.width / 2,
2374
2374
  s / 2 - c.height / 2
2375
2375
  );
2376
- const l = (ps, Xe, gs) => {
2377
- const ys = `${ps} ${Xe}`, ms = new Nt().plain(ys).font(r).attr(gs);
2376
+ const l = (ps, qe, gs) => {
2377
+ const ys = `${ps} ${qe}`, ms = new Nt().plain(ys).font(r).attr(gs);
2378
2378
  return {
2379
2379
  e: new v().add(ms),
2380
- width: i + a * Xe.toString().length,
2380
+ width: i + a * qe.toString().length,
2381
2381
  height: o
2382
2382
  };
2383
2383
  }, [u, h, d, g] = Yr(
@@ -2400,19 +2400,19 @@ const Gr = (n, t) => {
2400
2400
  "text-anchor": "middle",
2401
2401
  "dominant-baseline": "text-after-edge"
2402
2402
  });
2403
- const mt = z(x.e, x.width, x.height, 180).translate(
2403
+ const yt = z(x.e, x.width, x.height, 180).translate(
2404
2404
  s / 2 - x.width,
2405
2405
  -x.height
2406
2406
  );
2407
- let wt = l(g, f.left, {
2407
+ let mt = l(g, f.left, {
2408
2408
  "dominant-baseline": "ideographic",
2409
2409
  "text-anchor": "middle"
2410
2410
  });
2411
- const bt = z(wt.e, wt.width, wt.height, 90).translate(
2412
- -wt.height,
2411
+ const wt = z(mt.e, mt.width, mt.height, 90).translate(
2412
+ -mt.height,
2413
2413
  s / 2
2414
2414
  ), nt = new v(), fs = new Hn().size(s, s).x(0).y(0).fill("none").stroke("#000000");
2415
- return nt.add(fs), nt.add(c.e), nt.add(E), nt.add(O), nt.add(mt), nt.add(bt), { e: nt, width: s, height: s };
2415
+ return nt.add(fs), nt.add(c.e), nt.add(E), nt.add(O), nt.add(yt), nt.add(wt), { e: nt, width: s, height: s };
2416
2416
  }, ti = (n, t) => {
2417
2417
  const e = Lt(t.front, n), s = Lt(t.right, n), r = Lt(t.opposite, n), i = Lt(t.left, n), o = [e.height, s.height, r.height, i.height].reduce(
2418
2418
  (O, x) => Math.max(O, x)
@@ -2723,7 +2723,7 @@ function te(n) {
2723
2723
  };
2724
2724
  }
2725
2725
  // @__NO_SIDE_EFFECTS__
2726
- function cn(...n) {
2726
+ function ln(...n) {
2727
2727
  return {
2728
2728
  ...n[0],
2729
2729
  pipe: n,
@@ -2773,17 +2773,17 @@ const jt = /* @__PURE__ */ B(
2773
2773
  }, li = /* @__PURE__ */ B(
2774
2774
  /* @__PURE__ */ It({
2775
2775
  round: /* @__PURE__ */ B(
2776
- /* @__PURE__ */ ve(Object.keys(Nn)),
2776
+ /* @__PURE__ */ ve(Object.keys(Sn)),
2777
2777
  st.round
2778
2778
  ),
2779
2779
  sticks: /* @__PURE__ */ B(
2780
2780
  /* @__PURE__ */ It({
2781
2781
  reach: /* @__PURE__ */ B(
2782
- /* @__PURE__ */ cn(/* @__PURE__ */ Qt(), /* @__PURE__ */ Se(0, ""), /* @__PURE__ */ Ne(9, "")),
2782
+ /* @__PURE__ */ ln(/* @__PURE__ */ Qt(), /* @__PURE__ */ Se(0, ""), /* @__PURE__ */ Ne(9, "")),
2783
2783
  st.sticks.reach
2784
2784
  ),
2785
2785
  dead: /* @__PURE__ */ B(
2786
- /* @__PURE__ */ cn(/* @__PURE__ */ Qt(), /* @__PURE__ */ Se(0, ""), /* @__PURE__ */ Ne(9, "")),
2786
+ /* @__PURE__ */ ln(/* @__PURE__ */ Qt(), /* @__PURE__ */ Se(0, ""), /* @__PURE__ */ Ne(9, "")),
2787
2787
  st.sticks.dead
2788
2788
  )
2789
2789
  }),
@@ -2873,7 +2873,7 @@ const jt = /* @__PURE__ */ B(
2873
2873
  opposite: new D(n[e.opposite].hand).parse(),
2874
2874
  left: new D(n[e.left].hand).parse()
2875
2875
  }, o = {
2876
- round: Nn[n.board.round],
2876
+ round: Sn[n.board.round],
2877
2877
  frontPlace: $e[t],
2878
2878
  sticks: n.board.sticks,
2879
2879
  doras: new D(n.board.doras).tiles(),
@@ -2887,9 +2887,9 @@ const jt = /* @__PURE__ */ B(
2887
2887
  return { discards: r, hands: i, scoreBoard: o };
2888
2888
  }, mi = (n) => ({
2889
2889
  front: n,
2890
- right: ft(n),
2891
- opposite: ft(ft(n)),
2892
- left: In(n)
2890
+ right: Et(n),
2891
+ opposite: Et(Et(n)),
2892
+ left: Pe(n)
2893
2893
  });
2894
2894
  function* L(n) {
2895
2895
  const t = n != null && n.filterBy && n.filterBy.length > 0 ? n == null ? void 0 : n.filterBy : Object.values(p);
@@ -2900,7 +2900,7 @@ function* L(n) {
2900
2900
  yield [e, r];
2901
2901
  }
2902
2902
  }
2903
- class Be {
2903
+ class Ke {
2904
2904
  constructor(t, e = !1) {
2905
2905
  _(this, "data");
2906
2906
  this.data = {
@@ -3042,7 +3042,7 @@ class Be {
3042
3042
  throw new Error(`unexpected input ${t}`);
3043
3043
  }
3044
3044
  clone() {
3045
- const t = new Be(this.toString());
3045
+ const t = new Ke(this.toString());
3046
3046
  return t.data.reached = this.data.reached, t;
3047
3047
  }
3048
3048
  }
@@ -3203,7 +3203,7 @@ class wi {
3203
3203
  const r = s == p.Z ? Bt : V;
3204
3204
  for (let i of r)
3205
3205
  if (this.hand.get(s, i) == 1)
3206
- t.push(new Sn(new w(s, i)));
3206
+ t.push(new vn(new w(s, i)));
3207
3207
  else if (this.hand.get(s, i) == 2 && e == !1)
3208
3208
  t.unshift(new P(new w(s, i), new w(s, i))), e = !0;
3209
3209
  else return [];
@@ -3299,14 +3299,14 @@ const Bt = [1, 2, 3, 4, 5, 6, 7], V = [1, 9], Ft = (n) => {
3299
3299
  }
3300
3300
  };
3301
3301
  };
3302
- class ln {
3302
+ class un {
3303
3303
  constructor(t, e) {
3304
3304
  _(this, "hand");
3305
3305
  _(this, "cfg");
3306
3306
  this.hand = t, this.cfg = {
3307
- doras: e.doraMarkers.map((s) => hn(s)),
3307
+ doras: e.doraMarkers.map((s) => dn(s)),
3308
3308
  // convert to dora
3309
- blindDoras: e.blindDoraMarkers == null ? [] : e.blindDoraMarkers.map((s) => hn(s)),
3309
+ blindDoras: e.blindDoraMarkers == null ? [] : e.blindDoraMarkers.map((s) => dn(s)),
3310
3310
  roundWind: w.from(e.round.substring(0, 2)),
3311
3311
  myWind: w.from(e.myWind),
3312
3312
  reached: e.reached ?? 0,
@@ -3468,14 +3468,14 @@ class ln {
3468
3468
  ) ? [] : [{ name: "断么九", double: 1 }];
3469
3469
  }
3470
3470
  dE1(t) {
3471
- return this.minus() != 0 ? [] : un(t) == 1 ? [{ name: "一盃口", double: 1 }] : [];
3471
+ return this.minus() != 0 ? [] : hn(t) == 1 ? [{ name: "一盃口", double: 1 }] : [];
3472
3472
  }
3473
3473
  dF1(t) {
3474
3474
  const e = [];
3475
3475
  return t.forEach((s) => {
3476
3476
  if (s instanceof P) return;
3477
3477
  const r = s.tiles[0];
3478
- r.t == p.Z && (r.equals(this.cfg.myWind) ? e.push({ name: "自風", double: 1 }) : r.equals(this.cfg.roundWind) ? e.push({ name: "場風", double: 1 }) : r.n == 5 ? e.push({ name: "白", double: 1 }) : r.n == 6 ? e.push({ name: "發", double: 1 }) : r.n == 7 && e.push({ name: "中", double: 1 }));
3478
+ r.t == p.Z && (r.equals(this.cfg.myWind) && e.push({ name: "自風", double: 1 }), r.equals(this.cfg.roundWind) ? e.push({ name: "場風", double: 1 }) : r.n == 5 ? e.push({ name: "白", double: 1 }) : r.n == 6 ? e.push({ name: "發", double: 1 }) : r.n == 7 && e.push({ name: "中", double: 1 }));
3479
3479
  }), e;
3480
3480
  }
3481
3481
  dG1(t) {
@@ -3600,7 +3600,7 @@ class ln {
3600
3600
  return t.length == 7 ? [] : t.some((s) => s instanceof lt || s instanceof J) ? t.some((s) => s.tiles[0].t == p.Z) ? [] : t.every((s) => s.tiles.some((r) => V.includes(r.n))) ? [{ name: "純全帯么九色", double: 3 - this.minus() }] : [] : [];
3601
3601
  }
3602
3602
  dC3(t) {
3603
- return this.minus() != 0 ? [] : un(t) == 2 ? [{ name: "ニ盃口", double: 3 }] : [];
3603
+ return this.minus() != 0 ? [] : hn(t) == 2 ? [{ name: "ニ盃口", double: 3 }] : [];
3604
3604
  }
3605
3605
  dA6(t) {
3606
3606
  if (t.some((e) => e.tiles[0].t == p.Z)) return [];
@@ -3700,7 +3700,7 @@ class ln {
3700
3700
  return !a && s == 20 && (g = !0), c && !g && (s += 2), !c && !a && (s += 10), !c && !a && s == 30 && (g = !0), a && s == 20 && (s = 30), s;
3701
3701
  }
3702
3702
  }
3703
- const Ln = (n) => n.tiles.reduce((t, e) => `${t}${e.n}${e.t}`, ""), un = (n) => {
3703
+ const Ln = (n) => n.tiles.reduce((t, e) => `${t}${e.n}${e.t}`, ""), hn = (n) => {
3704
3704
  const t = {};
3705
3705
  for (const s of n) {
3706
3706
  if (!(s instanceof lt)) continue;
@@ -3711,7 +3711,7 @@ const Ln = (n) => n.tiles.reduce((t, e) => `${t}${e.n}${e.t}`, ""), un = (n) =>
3711
3711
  for (const s in t)
3712
3712
  t[s] >= 2 && e++;
3713
3713
  return e;
3714
- }, rt = (n) => [...n.tiles].sort(ae)[0], hn = (n) => {
3714
+ }, rt = (n) => [...n.tiles].sort(ae)[0], dn = (n) => {
3715
3715
  const t = n.n, e = n.t;
3716
3716
  return new w(e, t % 9 + 1);
3717
3717
  };
@@ -3873,7 +3873,7 @@ class ne {
3873
3873
  }
3874
3874
  update() {
3875
3875
  for (let t in this.pToW) {
3876
- const e = ft(this.pToW[t]);
3876
+ const e = Pe(this.pToW[t]);
3877
3877
  this.pToW[t] = e, this.wToP[e] = t;
3878
3878
  }
3879
3879
  }
@@ -4005,7 +4005,7 @@ const Ii = (n) => {
4005
4005
  const t = Ti();
4006
4006
  t && t.register(n);
4007
4007
  };
4008
- class dn {
4008
+ class fn {
4009
4009
  constructor(t) {
4010
4010
  this._process = t, this._active = !1, this._current = null, this._last = null;
4011
4011
  }
@@ -4073,10 +4073,10 @@ function G(n) {
4073
4073
  }
4074
4074
  const $i = typeof Symbol == "function" && Symbol.observable || "@@observable";
4075
4075
  function qn(n, t) {
4076
- const e = fn(n), s = fn(t);
4076
+ const e = pn(n), s = pn(t);
4077
4077
  return typeof s == "string" ? typeof e == "string" ? s === e : !1 : typeof e == "string" ? e in s : Object.keys(e).every((r) => r in s ? qn(e[r], s[r]) : !1);
4078
4078
  }
4079
- function Ke(n) {
4079
+ function ze(n) {
4080
4080
  if (Qn(n))
4081
4081
  return n;
4082
4082
  const t = [];
@@ -4096,12 +4096,12 @@ function Ke(n) {
4096
4096
  }
4097
4097
  return t.push(e), t;
4098
4098
  }
4099
- function fn(n) {
4099
+ function pn(n) {
4100
4100
  if (go(n))
4101
4101
  return n.value;
4102
4102
  if (typeof n != "string")
4103
4103
  return n;
4104
- const t = Ke(n);
4104
+ const t = ze(n);
4105
4105
  return Hi(t);
4106
4106
  }
4107
4107
  function Hi(n) {
@@ -4118,7 +4118,7 @@ function Hi(n) {
4118
4118
  }
4119
4119
  return t;
4120
4120
  }
4121
- function pn(n, t) {
4121
+ function gn(n, t) {
4122
4122
  const e = {}, s = Object.keys(n);
4123
4123
  for (let r = 0; r < s.length; r++) {
4124
4124
  const i = s[r];
@@ -4145,7 +4145,7 @@ function Qn(n) {
4145
4145
  function Pi(n) {
4146
4146
  return n.type.startsWith("xstate.error.actor");
4147
4147
  }
4148
- function At(n) {
4148
+ function _t(n) {
4149
4149
  return Yn(n).map((t) => typeof t > "u" || typeof t == "string" ? {
4150
4150
  target: t
4151
4151
  } : t);
@@ -4163,17 +4163,17 @@ function Ce(n, t, e) {
4163
4163
  complete: (a = s ? n.complete : e) == null ? void 0 : a.bind(r)
4164
4164
  };
4165
4165
  }
4166
- function gn(n, t) {
4166
+ function yn(n, t) {
4167
4167
  return `${t}.${n}`;
4168
4168
  }
4169
- function ze(n, t) {
4169
+ function Le(n, t) {
4170
4170
  const e = t.match(/^xstate\.invoke\.(\d+)\.(.*)/);
4171
4171
  if (!e)
4172
4172
  return n.implementations.actors[t];
4173
4173
  const [, s, r] = e, o = n.getStateNodeById(r).config.invoke;
4174
4174
  return (Array.isArray(o) ? o[s] : o).src;
4175
4175
  }
4176
- function yn(n, t) {
4176
+ function mn(n, t) {
4177
4177
  return `${n.sessionId}.${t}`;
4178
4178
  }
4179
4179
  let Wi = 0;
@@ -4190,7 +4190,7 @@ function Di(n, t) {
4190
4190
  delay: m,
4191
4191
  id: E,
4192
4192
  startedAt: Date.now()
4193
- }, O = yn(d, E);
4193
+ }, O = mn(d, E);
4194
4194
  h._snapshot._scheduledEvents[O] = N;
4195
4195
  const x = a.setTimeout(() => {
4196
4196
  delete o[O], delete h._snapshot._scheduledEvents[O], h._relay(d, g, f);
@@ -4198,7 +4198,7 @@ function Di(n, t) {
4198
4198
  o[O] = x;
4199
4199
  },
4200
4200
  cancel: (d, g) => {
4201
- const f = yn(d, g), m = o[f];
4201
+ const f = mn(d, g), m = o[f];
4202
4202
  delete o[f], delete h._snapshot._scheduledEvents[f], m !== void 0 && a.clearTimeout(m);
4203
4203
  },
4204
4204
  cancelAll: (d) => {
@@ -4279,7 +4279,7 @@ function Di(n, t) {
4279
4279
  return h;
4280
4280
  }
4281
4281
  let me = !1;
4282
- const Le = 1;
4282
+ const je = 1;
4283
4283
  let $ = /* @__PURE__ */ function(n) {
4284
4284
  return n[n.NotStarted = 0] = "NotStarted", n[n.Running = 1] = "Running", n[n.Stopped = 2] = "Stopped", n;
4285
4285
  }({});
@@ -4300,7 +4300,7 @@ class Ki {
4300
4300
  * @param options Actor options
4301
4301
  */
4302
4302
  constructor(t, e) {
4303
- this.logic = t, this._snapshot = void 0, this.clock = void 0, this.options = void 0, this.id = void 0, this.mailbox = new dn(this._process.bind(this)), this.observers = /* @__PURE__ */ new Set(), this.eventListeners = /* @__PURE__ */ new Map(), this.logger = void 0, this._processingStatus = $.NotStarted, this._parent = void 0, this._syncSnapshot = void 0, this.ref = void 0, this._actorScope = void 0, this._systemId = void 0, this.sessionId = void 0, this.system = void 0, this._doneEvent = void 0, this.src = void 0, this._deferred = [];
4303
+ this.logic = t, this._snapshot = void 0, this.clock = void 0, this.options = void 0, this.id = void 0, this.mailbox = new fn(this._process.bind(this)), this.observers = /* @__PURE__ */ new Set(), this.eventListeners = /* @__PURE__ */ new Map(), this.logger = void 0, this._processingStatus = $.NotStarted, this._parent = void 0, this._syncSnapshot = void 0, this.ref = void 0, this._actorScope = void 0, this._systemId = void 0, this.sessionId = void 0, this.system = void 0, this._doneEvent = void 0, this.src = void 0, this._deferred = [];
4304
4304
  const s = {
4305
4305
  ...Bi,
4306
4306
  ...e
@@ -4627,7 +4627,7 @@ class Ki {
4627
4627
  // right now, they are being stopped within the machine's transition
4628
4628
  // but that could throw and leave us with "orphaned" active actors
4629
4629
  _stopProcedure() {
4630
- return this._processingStatus !== $.Running ? this : (this.system.scheduler.cancelAll(this), this.mailbox.clear(), this.mailbox = new dn(this._process.bind(this)), this._processingStatus = $.Stopped, this.system._unregister(this), this);
4630
+ return this._processingStatus !== $.Running ? this : (this.system.scheduler.cancelAll(this), this.mailbox.clear(), this.mailbox = new fn(this._process.bind(this)), this._processingStatus = $.Stopped, this.system._unregister(this), this);
4631
4631
  }
4632
4632
  /** @internal */
4633
4633
  _send(t) {
@@ -4649,7 +4649,7 @@ class Ki {
4649
4649
  }
4650
4650
  toJSON() {
4651
4651
  return {
4652
- xstate$$type: Le,
4652
+ xstate$$type: je,
4653
4653
  id: this.id
4654
4654
  };
4655
4655
  }
@@ -4718,7 +4718,7 @@ function Fi(n, t, e, s, {
4718
4718
  input: a,
4719
4719
  syncSnapshot: c
4720
4720
  }) {
4721
- const l = typeof o == "string" ? ze(t.machine, o) : o, u = typeof r == "function" ? r(e) : r;
4721
+ const l = typeof o == "string" ? Le(t.machine, o) : o, u = typeof r == "function" ? r(e) : r;
4722
4722
  let h, d;
4723
4723
  return l && (d = typeof a == "function" ? a({
4724
4724
  context: t.context,
@@ -4731,7 +4731,7 @@ function Fi(n, t, e, s, {
4731
4731
  syncSnapshot: c,
4732
4732
  systemId: i,
4733
4733
  input: d
4734
- })), [pt(t, {
4734
+ })), [ft(t, {
4735
4735
  children: {
4736
4736
  ...t.children,
4737
4737
  [u]: h
@@ -4768,7 +4768,7 @@ function Gi(n, t, e, s, {
4768
4768
  let a = t.children;
4769
4769
  return o && (a = {
4770
4770
  ...a
4771
- }, delete a[o.id]), [pt(t, {
4771
+ }, delete a[o.id]), [ft(t, {
4772
4772
  children: a
4773
4773
  }), o, void 0];
4774
4774
  }
@@ -4788,14 +4788,14 @@ function es(n) {
4788
4788
  }
4789
4789
  return t.type = "xstate.stopChild", t.actorRef = n, t.resolve = Gi, t.execute = Vi, t;
4790
4790
  }
4791
- function je(n, t, e, s) {
4791
+ function Fe(n, t, e, s) {
4792
4792
  const {
4793
4793
  machine: r
4794
4794
  } = s, i = typeof n == "function", o = i ? n : r.implementations.guards[typeof n == "string" ? n : n.type];
4795
4795
  if (!i && !o)
4796
4796
  throw new Error(`Guard '${typeof n == "string" ? n : n.type}' is not implemented.'.`);
4797
4797
  if (typeof o != "function")
4798
- return je(o, t, e, s);
4798
+ return Fe(o, t, e, s);
4799
4799
  const a = {
4800
4800
  context: t,
4801
4801
  event: e
@@ -4810,7 +4810,7 @@ function je(n, t, e, s) {
4810
4810
  // this holds all params
4811
4811
  ) : o(a, c);
4812
4812
  }
4813
- const Fe = (n) => n.type === "atomic" || n.type === "final";
4813
+ const Ze = (n) => n.type === "atomic" || n.type === "final";
4814
4814
  function kt(n) {
4815
4815
  return Object.values(n.states).filter((t) => t.type !== "history");
4816
4816
  }
@@ -4827,11 +4827,11 @@ function se(n) {
4827
4827
  const t = new Set(n), e = ss(t);
4828
4828
  for (const s of t)
4829
4829
  if (s.type === "compound" && (!e.get(s) || !e.get(s).length))
4830
- mn(s).forEach((r) => t.add(r));
4830
+ wn(s).forEach((r) => t.add(r));
4831
4831
  else if (s.type === "parallel") {
4832
4832
  for (const r of kt(s))
4833
4833
  if (r.type !== "history" && !t.has(r)) {
4834
- const i = mn(r);
4834
+ const i = wn(r);
4835
4835
  for (const o of i)
4836
4836
  t.add(o);
4837
4837
  }
@@ -4850,7 +4850,7 @@ function ns(n, t) {
4850
4850
  if (n.type === "compound") {
4851
4851
  const r = e[0];
4852
4852
  if (r) {
4853
- if (Fe(r))
4853
+ if (Ze(r))
4854
4854
  return r.key;
4855
4855
  } else
4856
4856
  return {};
@@ -4870,8 +4870,8 @@ function rs(n, t) {
4870
4870
  const e = se(t);
4871
4871
  return ns(n, ss(e));
4872
4872
  }
4873
- function Ze(n, t) {
4874
- return t.type === "compound" ? kt(t).some((e) => e.type === "final" && n.has(e)) : t.type === "parallel" ? kt(t).every((e) => Ze(n, e)) : t.type === "final";
4873
+ function Ue(n, t) {
4874
+ return t.type === "compound" ? kt(t).some((e) => e.type === "final" && n.has(e)) : t.type === "parallel" ? kt(t).every((e) => Ue(n, e)) : t.type === "final";
4875
4875
  }
4876
4876
  const ue = (n) => n[0] === ki;
4877
4877
  function Ji(n, t) {
@@ -4945,24 +4945,24 @@ function qi(n) {
4945
4945
  if (e === Vn)
4946
4946
  throw new Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');
4947
4947
  const s = n.config.on[e];
4948
- t.set(e, At(s).map((r) => at(n, e, r)));
4948
+ t.set(e, _t(s).map((r) => at(n, e, r)));
4949
4949
  }
4950
4950
  if (n.config.onDone) {
4951
4951
  const e = `xstate.done.state.${n.id}`;
4952
- t.set(e, At(n.config.onDone).map((s) => at(n, e, s)));
4952
+ t.set(e, _t(n.config.onDone).map((s) => at(n, e, s)));
4953
4953
  }
4954
4954
  for (const e of n.invoke) {
4955
4955
  if (e.onDone) {
4956
4956
  const s = `xstate.done.actor.${e.id}`;
4957
- t.set(s, At(e.onDone).map((r) => at(n, s, r)));
4957
+ t.set(s, _t(e.onDone).map((r) => at(n, s, r)));
4958
4958
  }
4959
4959
  if (e.onError) {
4960
4960
  const s = `xstate.error.actor.${e.id}`;
4961
- t.set(s, At(e.onError).map((r) => at(n, s, r)));
4961
+ t.set(s, _t(e.onError).map((r) => at(n, s, r)));
4962
4962
  }
4963
4963
  if (e.onSnapshot) {
4964
4964
  const s = `xstate.snapshot.${e.id}`;
4965
- t.set(s, At(e.onSnapshot).map((r) => at(n, s, r)));
4965
+ t.set(s, _t(e.onSnapshot).map((r) => at(n, s, r)));
4966
4966
  }
4967
4967
  }
4968
4968
  for (const e of n.after) {
@@ -5023,7 +5023,7 @@ function is(n) {
5023
5023
  function ht(n) {
5024
5024
  return n.type === "history";
5025
5025
  }
5026
- function mn(n) {
5026
+ function wn(n) {
5027
5027
  const t = os(n);
5028
5028
  for (const e of t)
5029
5029
  for (const s of zt(e, n))
@@ -5059,7 +5059,7 @@ function re(n, t) {
5059
5059
  return n.machine.getStateNodeById(t);
5060
5060
  } catch {
5061
5061
  }
5062
- const e = Ke(t).slice();
5062
+ const e = ze(t).slice();
5063
5063
  let s = n;
5064
5064
  for (; e.length; ) {
5065
5065
  const r = e.shift();
@@ -5090,7 +5090,7 @@ function to(n, t, e, s) {
5090
5090
  return !i || !i.length ? n.next(e, s) : i;
5091
5091
  }
5092
5092
  function eo(n, t, e, s) {
5093
- const r = Object.keys(t), i = Ct(n, r[0]), o = Ue(i, t[r[0]], e, s);
5093
+ const r = Object.keys(t), i = Ct(n, r[0]), o = Ge(i, t[r[0]], e, s);
5094
5094
  return !o || !o.length ? n.next(e, s) : o;
5095
5095
  }
5096
5096
  function no(n, t, e, s) {
@@ -5099,12 +5099,12 @@ function no(n, t, e, s) {
5099
5099
  const o = t[i];
5100
5100
  if (!o)
5101
5101
  continue;
5102
- const a = Ct(n, i), c = Ue(a, o, e, s);
5102
+ const a = Ct(n, i), c = Ge(a, o, e, s);
5103
5103
  c && r.push(...c);
5104
5104
  }
5105
5105
  return r.length ? r : n.next(e, s);
5106
5106
  }
5107
- function Ue(n, t, e, s) {
5107
+ function Ge(n, t, e, s) {
5108
5108
  return typeof t == "string" ? to(n, t, e, s) : Object.keys(t).length === 1 ? eo(n, t, e, s) : no(n, t, e, s);
5109
5109
  }
5110
5110
  function so(n) {
@@ -5153,7 +5153,7 @@ function io(n) {
5153
5153
  if (e.every((r) => tt(r, s)))
5154
5154
  return s;
5155
5155
  }
5156
- function Ge(n, t) {
5156
+ function Ve(n, t) {
5157
5157
  if (!n.target)
5158
5158
  return [];
5159
5159
  const e = /* @__PURE__ */ new Set();
@@ -5163,14 +5163,14 @@ function Ge(n, t) {
5163
5163
  for (const r of t[s.id])
5164
5164
  e.add(r);
5165
5165
  else
5166
- for (const r of Ge(is(s), t))
5166
+ for (const r of Ve(is(s), t))
5167
5167
  e.add(r);
5168
5168
  else
5169
5169
  e.add(s);
5170
5170
  return [...e];
5171
5171
  }
5172
5172
  function cs(n, t) {
5173
- const e = Ge(n, t);
5173
+ const e = Ve(n, t);
5174
5174
  if (!e)
5175
5175
  return;
5176
5176
  if (!n.reenter && e.every((r) => r === n.source || tt(r, n.source)))
@@ -5212,7 +5212,7 @@ function Re(n, t, e, s, r, i) {
5212
5212
  const u = [...o];
5213
5213
  l.status === "done" && (l = xt(l, s, e, u.sort((h, d) => d.order - h.order).flatMap((h) => h.exit), i, void 0));
5214
5214
  try {
5215
- return a === t.historyValue && oo(t._nodes, o) ? l : pt(l, {
5215
+ return a === t.historyValue && oo(t._nodes, o) ? l : ft(l, {
5216
5216
  _nodes: u,
5217
5217
  historyValue: a
5218
5218
  });
@@ -5247,11 +5247,11 @@ function co(n, t, e, s, r, i, o, a) {
5247
5247
  if (c = xt(c, t, e, g, i, d.invoke.map((f) => f.id)), d.type === "final") {
5248
5248
  const f = d.parent;
5249
5249
  let m = (f == null ? void 0 : f.type) === "parallel" ? f : f == null ? void 0 : f.parent, E = m || d;
5250
- for ((f == null ? void 0 : f.type) === "compound" && i.push(Oe(f.id, d.output !== void 0 ? ke(d.output, c.context, t, e.self) : void 0)); (m == null ? void 0 : m.type) === "parallel" && !h.has(m) && Ze(r, m); )
5250
+ for ((f == null ? void 0 : f.type) === "compound" && i.push(Oe(f.id, d.output !== void 0 ? ke(d.output, c.context, t, e.self) : void 0)); (m == null ? void 0 : m.type) === "parallel" && !h.has(m) && Ue(r, m); )
5251
5251
  h.add(m), i.push(Oe(m.id)), E = m, m = m.parent;
5252
5252
  if (m)
5253
5253
  continue;
5254
- c = pt(c, {
5254
+ c = ft(c, {
5255
5255
  status: "done",
5256
5256
  output: ao(c, t, e, c.machine.root, E)
5257
5257
  });
@@ -5267,42 +5267,42 @@ function lo(n, t, e, s) {
5267
5267
  (r.source !== a || // we know that the domain can't lie within the source
5268
5268
  // if it's different than the source then it's outside of it and it means that the target has to be entered as well
5269
5269
  r.source !== i || // reentering transitions always enter the target, even if it's the source itself
5270
- r.reenter) && (s.add(a), e.add(a)), Et(a, t, e, s);
5271
- const o = Ge(r, t);
5270
+ r.reenter) && (s.add(a), e.add(a)), At(a, t, e, s);
5271
+ const o = Ve(r, t);
5272
5272
  for (const a of o) {
5273
5273
  const c = zt(a, i);
5274
5274
  (i == null ? void 0 : i.type) === "parallel" && c.push(i), ls(s, t, e, c, !r.source.parent && r.reenter ? void 0 : i);
5275
5275
  }
5276
5276
  }
5277
5277
  }
5278
- function Et(n, t, e, s) {
5278
+ function At(n, t, e, s) {
5279
5279
  var r;
5280
5280
  if (ht(n))
5281
5281
  if (t[n.id]) {
5282
5282
  const i = t[n.id];
5283
5283
  for (const o of i)
5284
- s.add(o), Et(o, t, e, s);
5284
+ s.add(o), At(o, t, e, s);
5285
5285
  for (const o of i)
5286
5286
  we(o, n.parent, s, t, e);
5287
5287
  } else {
5288
5288
  const i = is(n);
5289
5289
  for (const o of i.target)
5290
- s.add(o), i === ((r = n.parent) == null ? void 0 : r.initial) && e.add(n.parent), Et(o, t, e, s);
5290
+ s.add(o), i === ((r = n.parent) == null ? void 0 : r.initial) && e.add(n.parent), At(o, t, e, s);
5291
5291
  for (const o of i.target)
5292
5292
  we(o, n.parent, s, t, e);
5293
5293
  }
5294
5294
  else if (n.type === "compound") {
5295
5295
  const [i] = n.initial.target;
5296
- ht(i) || (s.add(i), e.add(i)), Et(i, t, e, s), we(i, n, s, t, e);
5296
+ ht(i) || (s.add(i), e.add(i)), At(i, t, e, s), we(i, n, s, t, e);
5297
5297
  } else if (n.type === "parallel")
5298
5298
  for (const i of kt(n).filter((o) => !ht(o)))
5299
- [...s].some((o) => tt(o, i)) || (ht(i) || (s.add(i), e.add(i)), Et(i, t, e, s));
5299
+ [...s].some((o) => tt(o, i)) || (ht(i) || (s.add(i), e.add(i)), At(i, t, e, s));
5300
5300
  }
5301
5301
  function ls(n, t, e, s, r) {
5302
5302
  for (const i of s)
5303
5303
  if ((!r || tt(i, r)) && n.add(i), i.type === "parallel")
5304
5304
  for (const o of kt(i).filter((a) => !ht(a)))
5305
- [...n].some((a) => tt(a, o)) || (n.add(o), Et(o, t, e, n));
5305
+ [...n].some((a) => tt(a, o)) || (n.add(o), At(o, t, e, n));
5306
5306
  }
5307
5307
  function we(n, t, e, s, r) {
5308
5308
  ls(e, s, r, zt(n, t));
@@ -5315,7 +5315,7 @@ function uo(n, t, e, s, r, i, o, a) {
5315
5315
  for (const h of l)
5316
5316
  for (const d of so(h)) {
5317
5317
  let g;
5318
- d.history === "deep" ? g = (f) => Fe(f) && tt(f, h) : g = (f) => f.parent === h, u ?? (u = {
5318
+ d.history === "deep" ? g = (f) => Ze(f) && tt(f, h) : g = (f) => f.parent === h, u ?? (u = {
5319
5319
  ...i
5320
5320
  }), u[d.id] = Array.from(r).filter(g);
5321
5321
  }
@@ -5395,7 +5395,7 @@ function be(n, t, e, s) {
5395
5395
  }), i.push(l);
5396
5396
  }
5397
5397
  if (t.type === Ie)
5398
- return r = pt(wn(r, t, e), {
5398
+ return r = ft(bn(r, t, e), {
5399
5399
  status: "stopped"
5400
5400
  }), o(r, t, []), {
5401
5401
  snapshot: r,
@@ -5403,9 +5403,9 @@ function be(n, t, e, s) {
5403
5403
  };
5404
5404
  let a = t;
5405
5405
  if (a.type !== Jn) {
5406
- const l = a, u = Pi(l), h = bn(l, r);
5406
+ const l = a, u = Pi(l), h = _n(l, r);
5407
5407
  if (u && !h.length)
5408
- return r = pt(n, {
5408
+ return r = ft(n, {
5409
5409
  status: "error",
5410
5410
  error: l.error
5411
5411
  }), o(r, l, []), {
@@ -5429,28 +5429,28 @@ function be(n, t, e, s) {
5429
5429
  if (!l.length) {
5430
5430
  if (!s.length)
5431
5431
  break;
5432
- a = s.shift(), l = bn(a, r);
5432
+ a = s.shift(), l = _n(a, r);
5433
5433
  }
5434
5434
  r = Re(l, r, e, a, !1, s), c = r !== u, o(r, a, l);
5435
5435
  }
5436
- return r.status !== "active" && wn(r, a, e), {
5436
+ return r.status !== "active" && bn(r, a, e), {
5437
5437
  snapshot: r,
5438
5438
  microstates: i
5439
5439
  };
5440
5440
  }
5441
- function wn(n, t, e) {
5441
+ function bn(n, t, e) {
5442
5442
  return xt(n, t, e, Object.values(n.children).map((s) => es(s)), [], void 0);
5443
5443
  }
5444
- function bn(n, t) {
5444
+ function _n(n, t) {
5445
5445
  return t.machine.getTransitionData(t, n);
5446
5446
  }
5447
5447
  function fo(n, t) {
5448
- const e = /* @__PURE__ */ new Set(), s = n._nodes.filter(Fe);
5448
+ const e = /* @__PURE__ */ new Set(), s = n._nodes.filter(Ze);
5449
5449
  for (const r of s)
5450
5450
  t: for (const i of [r].concat(zt(r, void 0)))
5451
5451
  if (i.always) {
5452
5452
  for (const o of i.always)
5453
- if (o.guard === void 0 || je(o.guard, n.context, t, n)) {
5453
+ if (o.guard === void 0 || Fe(o.guard, n.context, t, n)) {
5454
5454
  e.add(o);
5455
5455
  break t;
5456
5456
  }
@@ -5510,7 +5510,7 @@ function Xt(n, t) {
5510
5510
  toJSON: bo
5511
5511
  };
5512
5512
  }
5513
- function pt(n, t = {}) {
5513
+ function ft(n, t = {}) {
5514
5514
  return Xt({
5515
5515
  ...n,
5516
5516
  ...t
@@ -5554,7 +5554,7 @@ function hs(n) {
5554
5554
  t ?? (t = Array.isArray(n) ? n.slice() : {
5555
5555
  ...n
5556
5556
  }), t[e] = {
5557
- xstate$$type: Le,
5557
+ xstate$$type: je,
5558
5558
  id: s.id
5559
5559
  };
5560
5560
  else {
@@ -5617,7 +5617,7 @@ function vo(n, {
5617
5617
  }, s, r) {
5618
5618
  const i = (o, a) => {
5619
5619
  if (typeof o == "string") {
5620
- const c = ze(t, o);
5620
+ const c = Le(t, o);
5621
5621
  if (!c)
5622
5622
  throw new Error(`Actor logic '${o}' not implemented in machine '${t.id}'`);
5623
5623
  const l = Ot(c, {
@@ -5671,7 +5671,7 @@ function To(n, t, e, s, {
5671
5671
  a[l] = typeof u == "function" ? u(o, s) : u;
5672
5672
  }
5673
5673
  const c = Object.assign({}, t.context, a);
5674
- return [pt(t, {
5674
+ return [ft(t, {
5675
5675
  context: c,
5676
5676
  children: Object.keys(i).length ? {
5677
5677
  ...t.children,
@@ -5684,12 +5684,12 @@ function Io(n) {
5684
5684
  }
5685
5685
  return t.type = "xstate.assign", t.assignment = n, t.resolve = To, t;
5686
5686
  }
5687
- const _n = /* @__PURE__ */ new WeakMap();
5688
- function _t(n, t, e) {
5689
- let s = _n.get(n);
5687
+ const An = /* @__PURE__ */ new WeakMap();
5688
+ function bt(n, t, e) {
5689
+ let s = An.get(n);
5690
5690
  return s ? t in s || (s[t] = e()) : (s = {
5691
5691
  [t]: e()
5692
- }, _n.set(n, s)), s[t];
5692
+ }, An.set(n, s)), s[t];
5693
5693
  }
5694
5694
  const Oo = {}, Ht = (n) => typeof n == "string" ? {
5695
5695
  type: n
@@ -5698,9 +5698,9 @@ const Oo = {}, Ht = (n) => typeof n == "string" ? {
5698
5698
  } : {
5699
5699
  type: n.name
5700
5700
  } : n;
5701
- class Ve {
5701
+ class Je {
5702
5702
  constructor(t, e) {
5703
- if (this.config = t, this.key = void 0, this.id = void 0, this.type = void 0, this.path = void 0, this.states = void 0, this.history = void 0, this.entry = void 0, this.exit = void 0, this.parent = void 0, this.machine = void 0, this.meta = void 0, this.output = void 0, this.order = -1, this.description = void 0, this.tags = [], this.transitions = void 0, this.always = void 0, this.parent = e._parent, this.key = e._key, this.machine = e._machine, this.path = this.parent ? this.parent.path.concat(this.key) : [], this.id = this.config.id || [this.machine.id, ...this.path].join(Gn), this.type = this.config.type || (this.config.states && Object.keys(this.config.states).length ? "compound" : this.config.history ? "history" : "atomic"), this.description = this.config.description, this.order = this.machine.idMap.size, this.machine.idMap.set(this.id, this), this.states = this.config.states ? pn(this.config.states, (s, r) => new Ve(s, {
5703
+ if (this.config = t, this.key = void 0, this.id = void 0, this.type = void 0, this.path = void 0, this.states = void 0, this.history = void 0, this.entry = void 0, this.exit = void 0, this.parent = void 0, this.machine = void 0, this.meta = void 0, this.output = void 0, this.order = -1, this.description = void 0, this.tags = [], this.transitions = void 0, this.always = void 0, this.parent = e._parent, this.key = e._key, this.machine = e._machine, this.path = this.parent ? this.parent.path.concat(this.key) : [], this.id = this.config.id || [this.machine.id, ...this.path].join(Gn), this.type = this.config.type || (this.config.states && Object.keys(this.config.states).length ? "compound" : this.config.history ? "history" : "atomic"), this.description = this.config.description, this.order = this.machine.idMap.size, this.machine.idMap.set(this.id, this), this.states = this.config.states ? gn(this.config.states, (s, r) => new Je(s, {
5704
5704
  _parent: this,
5705
5705
  _key: r,
5706
5706
  _machine: this.machine
@@ -5710,7 +5710,7 @@ class Ve {
5710
5710
  }
5711
5711
  /** @internal */
5712
5712
  _initialize() {
5713
- this.transitions = qi(this), this.config.always && (this.always = At(this.config.always).map((t) => at(this, Vn, t))), Object.keys(this.states).forEach((t) => {
5713
+ this.transitions = qi(this), this.config.always && (this.always = _t(this.config.always).map((t) => at(this, Vn, t))), Object.keys(this.states).forEach((t) => {
5714
5714
  this.states[t]._initialize();
5715
5715
  });
5716
5716
  }
@@ -5735,7 +5735,7 @@ class Ve {
5735
5735
  })
5736
5736
  } : void 0,
5737
5737
  history: this.history,
5738
- states: pn(this.states, (t) => t.definition),
5738
+ states: gn(this.states, (t) => t.definition),
5739
5739
  on: this.on,
5740
5740
  transitions: [...this.transitions.values()].flat().map((t) => ({
5741
5741
  ...t,
@@ -5757,11 +5757,11 @@ class Ve {
5757
5757
  }
5758
5758
  /** The logic invoked as actors by this state node. */
5759
5759
  get invoke() {
5760
- return _t(this, "invoke", () => Y(this.config.invoke).map((t, e) => {
5760
+ return bt(this, "invoke", () => Y(this.config.invoke).map((t, e) => {
5761
5761
  const {
5762
5762
  src: s,
5763
5763
  systemId: r
5764
- } = t, i = t.id ?? gn(this.id, e), o = typeof s == "string" ? s : `xstate.invoke.${gn(this.id, e)}`;
5764
+ } = t, i = t.id ?? yn(this.id, e), o = typeof s == "string" ? s : `xstate.invoke.${yn(this.id, e)}`;
5765
5765
  return {
5766
5766
  ...t,
5767
5767
  src: o,
@@ -5785,26 +5785,26 @@ class Ve {
5785
5785
  }
5786
5786
  /** The mapping of events to transitions. */
5787
5787
  get on() {
5788
- return _t(this, "on", () => [...this.transitions].flatMap(([e, s]) => s.map((r) => [e, r])).reduce((e, [s, r]) => (e[s] = e[s] || [], e[s].push(r), e), {}));
5788
+ return bt(this, "on", () => [...this.transitions].flatMap(([e, s]) => s.map((r) => [e, r])).reduce((e, [s, r]) => (e[s] = e[s] || [], e[s].push(r), e), {}));
5789
5789
  }
5790
5790
  get after() {
5791
- return _t(this, "delayedTransitions", () => Xi(this));
5791
+ return bt(this, "delayedTransitions", () => Xi(this));
5792
5792
  }
5793
5793
  get initial() {
5794
- return _t(this, "initial", () => Yi(this, this.config.initial));
5794
+ return bt(this, "initial", () => Yi(this, this.config.initial));
5795
5795
  }
5796
5796
  /** @internal */
5797
5797
  next(t, e) {
5798
5798
  const s = e.type, r = [];
5799
5799
  let i;
5800
- const o = _t(this, `candidates-${s}`, () => Ji(this, s));
5800
+ const o = bt(this, `candidates-${s}`, () => Ji(this, s));
5801
5801
  for (const a of o) {
5802
5802
  const {
5803
5803
  guard: c
5804
5804
  } = a, l = t.context;
5805
5805
  let u = !1;
5806
5806
  try {
5807
- u = !c || je(c, l, e, t);
5807
+ u = !c || Fe(c, l, e, t);
5808
5808
  } catch (h) {
5809
5809
  const d = typeof c == "string" ? c : typeof c == "object" ? c.type : void 0;
5810
5810
  throw new Error(`Unable to evaluate guard ${d ? `'${d}' ` : ""}in transition for event '${s}' in state node '${this.id}':
@@ -5819,7 +5819,7 @@ ${h.message}`);
5819
5819
  }
5820
5820
  /** All the event types accepted by this state node and its descendants. */
5821
5821
  get events() {
5822
- return _t(this, "events", () => {
5822
+ return bt(this, "events", () => {
5823
5823
  const {
5824
5824
  states: t
5825
5825
  } = this, e = new Set(this.ownEvents);
@@ -5844,14 +5844,14 @@ ${h.message}`);
5844
5844
  }
5845
5845
  }
5846
5846
  const ko = "#";
5847
- class Je {
5847
+ class Xe {
5848
5848
  constructor(t, e) {
5849
5849
  this.config = t, this.version = void 0, this.schemas = void 0, this.implementations = void 0, this.__xstatenode = !0, this.idMap = /* @__PURE__ */ new Map(), this.root = void 0, this.id = void 0, this.states = void 0, this.events = void 0, this.id = t.id || "(machine)", this.implementations = {
5850
5850
  actors: (e == null ? void 0 : e.actors) ?? {},
5851
5851
  actions: (e == null ? void 0 : e.actions) ?? {},
5852
5852
  delays: (e == null ? void 0 : e.delays) ?? {},
5853
5853
  guards: (e == null ? void 0 : e.guards) ?? {}
5854
- }, this.version = this.config.version, this.schemas = this.config.schemas, this.transition = this.transition.bind(this), this.getInitialSnapshot = this.getInitialSnapshot.bind(this), this.getPersistedSnapshot = this.getPersistedSnapshot.bind(this), this.restoreSnapshot = this.restoreSnapshot.bind(this), this.start = this.start.bind(this), this.root = new Ve(t, {
5854
+ }, this.version = this.config.version, this.schemas = this.config.schemas, this.transition = this.transition.bind(this), this.getInitialSnapshot = this.getInitialSnapshot.bind(this), this.getPersistedSnapshot = this.getPersistedSnapshot.bind(this), this.restoreSnapshot = this.restoreSnapshot.bind(this), this.start = this.start.bind(this), this.root = new Je(t, {
5855
5855
  _key: this.id,
5856
5856
  _machine: this
5857
5857
  }), this.root._initialize(), this.states = this.root.states, this.events = this.root.events;
@@ -5871,7 +5871,7 @@ class Je {
5871
5871
  actors: r,
5872
5872
  delays: i
5873
5873
  } = this.implementations;
5874
- return new Je(this.config, {
5874
+ return new Xe(this.config, {
5875
5875
  actions: {
5876
5876
  ...e,
5877
5877
  ...t.actions
@@ -5896,7 +5896,7 @@ class Je {
5896
5896
  _nodes: [...s],
5897
5897
  context: t.context || {},
5898
5898
  children: {},
5899
- status: Ze(s, this.root) ? "done" : t.status || "active",
5899
+ status: Ue(s, this.root) ? "done" : t.status || "active",
5900
5900
  output: t.output,
5901
5901
  error: t.error,
5902
5902
  historyValue: t.historyValue
@@ -5923,7 +5923,7 @@ class Je {
5923
5923
  return be(t, e, s, []).microstates;
5924
5924
  }
5925
5925
  getTransitionData(t, e) {
5926
- return Ue(this.root, t.value, t, e) || [];
5926
+ return Ge(this.root, t.value, t, e) || [];
5927
5927
  }
5928
5928
  /**
5929
5929
  * The initial state _before_ evaluating any microsteps. This "pre-initial"
@@ -5972,7 +5972,7 @@ class Je {
5972
5972
  });
5973
5973
  }
5974
5974
  getStateNodeById(t) {
5975
- const e = Ke(t), s = e.slice(1), r = ue(e[0]) ? e[0].slice(ko.length) : e[0], i = this.idMap.get(r);
5975
+ const e = ze(t), s = e.slice(1), r = ue(e[0]) ? e[0].slice(ko.length) : e[0], i = this.idMap.get(r);
5976
5976
  if (!i)
5977
5977
  throw new Error(`Child state node '#${r}' does not exist on machine '${this.id}'`);
5978
5978
  return re(i, s);
@@ -5989,7 +5989,7 @@ class Je {
5989
5989
  restoreSnapshot(t, e) {
5990
5990
  const s = {}, r = t.children;
5991
5991
  Object.keys(r).forEach((c) => {
5992
- const l = r[c], u = l.snapshot, h = l.src, d = typeof h == "string" ? ze(this, h) : h;
5992
+ const l = r[c], u = l.snapshot, h = l.src, d = typeof h == "string" ? Le(this, h) : h;
5993
5993
  if (!d)
5994
5994
  return;
5995
5995
  const g = Ot(d, {
@@ -6013,7 +6013,7 @@ class Je {
6013
6013
  for (const u in c) {
6014
6014
  const h = c[u];
6015
6015
  if (h && typeof h == "object") {
6016
- if ("xstate$$type" in h && h.xstate$$type === Le) {
6016
+ if ("xstate$$type" in h && h.xstate$$type === je) {
6017
6017
  c[u] = l[h.id];
6018
6018
  continue;
6019
6019
  }
@@ -6026,13 +6026,13 @@ class Je {
6026
6026
  }
6027
6027
  }
6028
6028
  function Co(n, t) {
6029
- return new Je(n, t);
6029
+ return new Xe(n, t);
6030
6030
  }
6031
6031
  const Ut = (n) => n === !1 ? !1 : n.map((t) => t.serialize()), xo = (n) => n === !1 ? !1 : n.serialize(), Ro = (n) => n === !1 ? !1 : n.map((t) => ({
6032
6032
  tile: t.tile.toString(),
6033
6033
  candidates: t.candidates.map((e) => e.toString()),
6034
6034
  shanten: t.shanten
6035
- })), Me = (n) => JSON.parse(JSON.stringify(n)), Gt = (n) => n === !1 ? !1 : Me(n), An = (n) => Co(
6035
+ })), Me = (n) => JSON.parse(JSON.stringify(n)), Gt = (n) => n === !1 ? !1 : Me(n), En = (n) => Co(
6036
6036
  {
6037
6037
  id: "Untitled",
6038
6038
  initial: "distribute",
@@ -6353,7 +6353,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
6353
6353
  actions: {
6354
6354
  updateNextWind: ({ context: t, event: e }) => {
6355
6355
  const s = t.currentWind;
6356
- t.currentWind = ft(s);
6356
+ t.currentWind = Et(s);
6357
6357
  },
6358
6358
  notify_distribution: ({ context: t, event: e }) => {
6359
6359
  const s = t.genEventID(), r = t.controller.initialHands();
@@ -6839,7 +6839,7 @@ class he {
6839
6839
  constructor(t, e) {
6840
6840
  _(this, "wall", new St());
6841
6841
  _(this, "playerIDs");
6842
- _(this, "actor", Ot(An(this), {}));
6842
+ _(this, "actor", Ot(En(this), {}));
6843
6843
  _(this, "observer");
6844
6844
  _(this, "handlers", {});
6845
6845
  _(this, "mailBox", {});
@@ -7104,11 +7104,11 @@ class he {
7104
7104
  );
7105
7105
  }
7106
7106
  startGame() {
7107
- for (; console.debug(`start========${this.placeManager.round}=============`), this.start(), this.wall = new St(), this.observer.applied = {}, this.mailBox = {}, this.actor = Ot(An(this)), !this.placeManager.is(k.W1); )
7107
+ for (; console.debug(`start========${this.placeManager.round}=============`), this.start(), this.wall = new St(), this.observer.applied = {}, this.mailBox = {}, this.actor = Ot(En(this)), !this.placeManager.is(k.W1); )
7108
7108
  ;
7109
7109
  }
7110
7110
  finalResult(t, e) {
7111
- const s = this.hand(e), r = s.reached ? this.wall.blindDoraMarkers : void 0, i = new ln(s, {
7111
+ const s = this.hand(e), r = s.reached ? this.wall.blindDoraMarkers : void 0, i = new un(s, {
7112
7112
  ...t.boardContext,
7113
7113
  sticks: this.placeManager.sticks,
7114
7114
  blindDoraMarkers: r
@@ -7126,7 +7126,7 @@ class he {
7126
7126
  } else
7127
7127
  i.finalWallWin = !this.wall.canDraw, i.replacementWin = s == null ? void 0 : s.replacementWin;
7128
7128
  i.oneShotWin = s == null ? void 0 : s.oneShot;
7129
- const o = new wi(r), a = new ln(r, i), c = o.calc(e), l = a.calc(...c);
7129
+ const o = new wi(r), a = new un(r, i), c = o.calc(e), l = a.calc(...c);
7130
7130
  if (!l || l.points.length == 0) return !1;
7131
7131
  if (r.draw == null) {
7132
7132
  const u = Kt.candidateTiles(this.hand(t)).candidates;
@@ -7139,7 +7139,7 @@ class he {
7139
7139
  if (s == null || t == e) return !1;
7140
7140
  const r = this.hand(t);
7141
7141
  if (r.reached || r.hands.length < 3 || r.get(s.t, s.n) < 2) return !1;
7142
- const i = s.clone({ removeAll: !0 }), o = tn(t, e, b.PON), a = [], c = new X([i, i, i]).clone({
7142
+ const i = s.clone({ removeAll: !0 }), o = en(t, e, b.PON), a = [], c = new X([i, i, i]).clone({
7143
7143
  replace: { idx: o, tile: s.clone({ add: y.HORIZONTAL }) }
7144
7144
  });
7145
7145
  let l = c;
@@ -7163,7 +7163,7 @@ class he {
7163
7163
  return a;
7164
7164
  }
7165
7165
  doChi(t, e, s) {
7166
- if (s == null || !s.isNum() || ft(e) != t) return !1;
7166
+ if (s == null || !s.isNum() || Et(e) != t) return !1;
7167
7167
  const r = this.hand(t);
7168
7168
  if (r.reached || r.hands.length < 3) return !1;
7169
7169
  const i = s.clone({
@@ -7193,7 +7193,7 @@ class he {
7193
7193
  const g = o[d], f = this.cannotDiscardTile(g), m = [];
7194
7194
  for (const O of f) {
7195
7195
  const x = r.get(O.t, O.n);
7196
- for (let mt = 0; mt < x; mt++) m.push(O.clone({ remove: y.RED }));
7196
+ for (let yt = 0; yt < x; yt++) m.push(O.clone({ remove: y.RED }));
7197
7197
  }
7198
7198
  const E = r.dec([...m, g.tiles[1], g.tiles[2]]), N = r.hands.length == 0;
7199
7199
  r.inc(E), N && o.splice(d, 1);
@@ -7282,7 +7282,7 @@ class he {
7282
7282
  if (r.reached || t == e) return !1;
7283
7283
  const i = s.clone({ removeAll: !0 });
7284
7284
  if (r.get(i.t, i.n) != 3) return !1;
7285
- const o = tn(t, e, b.DAI_KAN);
7285
+ const o = en(t, e, b.DAI_KAN);
7286
7286
  let a = new q([i, i, i, i]).clone({
7287
7287
  replace: { idx: o, tile: i.clone({ add: y.HORIZONTAL }) }
7288
7288
  });
@@ -7324,7 +7324,7 @@ class he {
7324
7324
  return this.wall.initialHands();
7325
7325
  }
7326
7326
  }
7327
- class Rt extends Be {
7327
+ class Rt extends Ke {
7328
7328
  isBackHand() {
7329
7329
  for (const t of Object.values(p))
7330
7330
  if (t != p.BACK && this.sum(t) > 0)
@@ -7527,7 +7527,7 @@ class $o extends ds {
7527
7527
  case "END_GAME":
7528
7528
  for (const r of Object.values(A))
7529
7529
  console.debug(
7530
- `${this.placeManager.playerID(r)}(${In(r)})`,
7530
+ `${this.placeManager.playerID(r)}(${Pe(r)})`,
7531
7531
  `end hand: ${this.hand(r).toString()}`
7532
7532
  );
7533
7533
  console.debug(
@@ -7720,8 +7720,8 @@ export {
7720
7720
  J as BlockChi,
7721
7721
  q as BlockDaiKan,
7722
7722
  Dt as BlockHand,
7723
- Sn as BlockIsolated,
7724
- vn as BlockOther,
7723
+ vn as BlockIsolated,
7724
+ Tn as BlockOther,
7725
7725
  P as BlockPair,
7726
7726
  X as BlockPon,
7727
7727
  lt as BlockRun,
@@ -7729,15 +7729,15 @@ export {
7729
7729
  Z as BlockThree,
7730
7730
  he as Controller,
7731
7731
  Si as Counter,
7732
- ln as DoubleCalculator,
7732
+ un as DoubleCalculator,
7733
7733
  Kt as Efficiency,
7734
- En as FONT_FAMILY,
7734
+ Nn as FONT_FAMILY,
7735
7735
  v as G,
7736
- Be as Hand,
7736
+ Ke as Hand,
7737
7737
  ct as INPUT_SEPARATOR,
7738
7738
  $n as Image,
7739
7739
  Dn as ImageHelper,
7740
- yt as Mark,
7740
+ gt as Mark,
7741
7741
  Wo as MeasureText,
7742
7742
  zo as MyG,
7743
7743
  Lo as MyImage,
@@ -7754,12 +7754,12 @@ export {
7754
7754
  Vt as Player,
7755
7755
  oe as PlayerEfficiency,
7756
7756
  k as ROUND,
7757
- Nn as ROUND_MAP,
7757
+ Sn as ROUND_MAP,
7758
7758
  Hn as Rect,
7759
7759
  Jo as Replayer,
7760
7760
  Wt as RiskRank,
7761
7761
  Un as River,
7762
- qe as STICK_CONTEXT,
7762
+ Ye as STICK_CONTEXT,
7763
7763
  zr as SVG,
7764
7764
  ee as ScoreManager,
7765
7765
  le as ShantenCalculator,
@@ -7770,13 +7770,13 @@ export {
7770
7770
  p as TYPE,
7771
7771
  Nt as Text,
7772
7772
  w as Tile,
7773
- De as Use,
7773
+ Be as Use,
7774
7774
  A as WIND,
7775
7775
  $e as WIND_MAP,
7776
7776
  St as Wall,
7777
- tn as callBlockIndex,
7777
+ en as callBlockIndex,
7778
7778
  yi as convertInput,
7779
- An as createControllerMachine,
7779
+ En as createControllerMachine,
7780
7780
  Ni as createEventEmitter,
7781
7781
  Zt as createEventPipe,
7782
7782
  Pt as createHand,
@@ -7790,12 +7790,12 @@ export {
7790
7790
  Mo as incrementalIDGenerator,
7791
7791
  C as isNum5,
7792
7792
  Jt as nextRound,
7793
- ft as nextWind,
7793
+ Et as nextWind,
7794
7794
  Go as optimizeSVG,
7795
7795
  hi as parse,
7796
7796
  di as parseTableInput,
7797
7797
  Do as prevRound,
7798
- In as prevWind,
7798
+ Pe as prevWind,
7799
7799
  bi as prioritizeDiscardedEvents,
7800
7800
  _i as prioritizeDrawnEvents,
7801
7801
  Zn as shuffle,