@konoui/mjimage 0.0.60 → 0.0.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +11 -11
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +494 -476
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ const In = "MS Gothic, sans-serif", ft = {
|
|
|
9
9
|
}, nn = {
|
|
10
10
|
WIDTH: 125,
|
|
11
11
|
HEIGHT: 27.5
|
|
12
|
-
},
|
|
12
|
+
}, Ns = { BASE: 40 }, lt = ",", p = {
|
|
13
13
|
M: "m",
|
|
14
14
|
P: "p",
|
|
15
15
|
S: "s",
|
|
@@ -83,17 +83,17 @@ const In = "MS Gothic, sans-serif", ft = {
|
|
|
83
83
|
[k.N3]: "北3局",
|
|
84
84
|
[k.N4]: "北4局"
|
|
85
85
|
};
|
|
86
|
-
function
|
|
86
|
+
function S(n, t) {
|
|
87
87
|
if (!n)
|
|
88
88
|
throw new Error(t);
|
|
89
89
|
}
|
|
90
|
-
class
|
|
90
|
+
class jo {
|
|
91
91
|
constructor(t = "東", e = "2") {
|
|
92
92
|
_(this, "ctx", null);
|
|
93
93
|
_(this, "strText");
|
|
94
94
|
_(this, "numText");
|
|
95
95
|
_(this, "measure", (t, e) => {
|
|
96
|
-
this.ctx == null && (this.ctx = document.createElement("canvas").getContext("2d"),
|
|
96
|
+
this.ctx == null && (this.ctx = document.createElement("canvas").getContext("2d"), S(this.ctx, "context is null"));
|
|
97
97
|
const s = this.ctx;
|
|
98
98
|
s.font = e;
|
|
99
99
|
const r = s.measureText(t);
|
|
@@ -113,14 +113,14 @@ class Lo {
|
|
|
113
113
|
_(this, "measureTableFontContext", (t) => {
|
|
114
114
|
const e = this.measureFontContext(
|
|
115
115
|
In,
|
|
116
|
-
|
|
116
|
+
Ns.BASE * t
|
|
117
117
|
);
|
|
118
118
|
return e.textHeight = e.textWidth, e.numHeight = e.numWidth, e;
|
|
119
119
|
});
|
|
120
120
|
this.strText = t, this.numText = e;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
class
|
|
123
|
+
class Ss {
|
|
124
124
|
// Use '\0' to represent EOF
|
|
125
125
|
constructor(t) {
|
|
126
126
|
_(this, "input");
|
|
@@ -376,7 +376,7 @@ class K extends T {
|
|
|
376
376
|
return gt(this.tiles);
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
class
|
|
379
|
+
class P extends T {
|
|
380
380
|
constructor(t, e) {
|
|
381
381
|
super([t, e], b.PAIR);
|
|
382
382
|
}
|
|
@@ -459,7 +459,7 @@ const te = (n, t) => {
|
|
|
459
459
|
case b.RUN:
|
|
460
460
|
return new ut(n);
|
|
461
461
|
case b.PAIR:
|
|
462
|
-
return new
|
|
462
|
+
return new P(n[0], n[1]);
|
|
463
463
|
case b.ISOLATED:
|
|
464
464
|
return new kn(n[0]);
|
|
465
465
|
case b.HAND:
|
|
@@ -481,7 +481,7 @@ class B {
|
|
|
481
481
|
return this.tileSeparators().filter((t) => t != lt);
|
|
482
482
|
}
|
|
483
483
|
tileSeparators() {
|
|
484
|
-
const t = new
|
|
484
|
+
const t = new Ss(this.input), e = [];
|
|
485
485
|
let s = [];
|
|
486
486
|
for (this.validate(this.input); ; ) {
|
|
487
487
|
t.skipWhitespace();
|
|
@@ -539,7 +539,9 @@ class B {
|
|
|
539
539
|
throw new Error(`exceeded maximum input length(${t.length})`);
|
|
540
540
|
const e = t.charAt(t.length - 1), [s, r] = rn(e, [new w(p.BACK, 1)]);
|
|
541
541
|
if (!r)
|
|
542
|
-
throw new Error(
|
|
542
|
+
throw new Error(
|
|
543
|
+
`last character: ${e} is not type value: ${t}`
|
|
544
|
+
);
|
|
543
545
|
}
|
|
544
546
|
}
|
|
545
547
|
function sn(n) {
|
|
@@ -611,7 +613,7 @@ function Cs(n) {
|
|
|
611
613
|
}
|
|
612
614
|
return [new w(p.BACK, 0), !1];
|
|
613
615
|
}
|
|
614
|
-
function
|
|
616
|
+
function H(n, t = !1) {
|
|
615
617
|
const e = {
|
|
616
618
|
[A.E]: n,
|
|
617
619
|
[A.S]: n,
|
|
@@ -624,8 +626,8 @@ function P(n, t = !1) {
|
|
|
624
626
|
}
|
|
625
627
|
const Yt = (n) => {
|
|
626
628
|
let t = n.substring(0, 2), e = Number(n.substring(2, 3));
|
|
627
|
-
return e == 4 ? (e = 1, t =
|
|
628
|
-
},
|
|
629
|
+
return e == 4 ? (e = 1, t = Nt(t)) : e++, `${t}${e}`;
|
|
630
|
+
}, Uo = (n) => Yt(Yt(Yt(n))), Nt = (n) => {
|
|
629
631
|
let t = Number(n.toString()[0]);
|
|
630
632
|
return t = t % 4 + 1, `${t}w`;
|
|
631
633
|
}, De = (n) => {
|
|
@@ -634,12 +636,12 @@ const Yt = (n) => {
|
|
|
634
636
|
return `${e[(s + 1) % e.length]}w`;
|
|
635
637
|
}, on = (n, t, e) => {
|
|
636
638
|
const s = Math.abs(Number(n[0]) - Number(t[0]));
|
|
637
|
-
return
|
|
639
|
+
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;
|
|
638
640
|
};
|
|
639
641
|
function an(n) {
|
|
640
642
|
return typeof n > "u";
|
|
641
643
|
}
|
|
642
|
-
function
|
|
644
|
+
function Ne(n, t = 0) {
|
|
643
645
|
return {
|
|
644
646
|
a: 1,
|
|
645
647
|
c: 0,
|
|
@@ -676,7 +678,7 @@ function Rs(...n) {
|
|
|
676
678
|
return Ke(...n);
|
|
677
679
|
}
|
|
678
680
|
const { cos: xs, sin: Ms, PI: $s } = Math;
|
|
679
|
-
function
|
|
681
|
+
function Hs(n, t, e) {
|
|
680
682
|
const s = xs(n), r = Ms(n), i = {
|
|
681
683
|
a: s,
|
|
682
684
|
c: -r,
|
|
@@ -686,13 +688,13 @@ function Ps(n, t, e) {
|
|
|
686
688
|
f: 0
|
|
687
689
|
};
|
|
688
690
|
return an(t) || an(e) ? i : Ke([
|
|
689
|
-
|
|
691
|
+
Ne(t, e),
|
|
690
692
|
i,
|
|
691
|
-
|
|
693
|
+
Ne(-t, -e)
|
|
692
694
|
]);
|
|
693
695
|
}
|
|
694
|
-
function
|
|
695
|
-
return
|
|
696
|
+
function Ps(n, t = void 0, e = void 0) {
|
|
697
|
+
return Hs(n * $s / 180, t, e);
|
|
696
698
|
}
|
|
697
699
|
function Ws(n) {
|
|
698
700
|
return Bs(n);
|
|
@@ -984,18 +986,18 @@ function hn(n, t) {
|
|
|
984
986
|
const e = Mn(n, Js), s = {};
|
|
985
987
|
for (let r = 0; r < e.length; r++) {
|
|
986
988
|
if (e[r][1].length === 0)
|
|
987
|
-
return I("InvalidAttr", "Attribute '" + e[r][2] + "' has no space in starting.",
|
|
989
|
+
return I("InvalidAttr", "Attribute '" + e[r][2] + "' has no space in starting.", Ht(e[r]));
|
|
988
990
|
if (e[r][3] !== void 0 && e[r][4] === void 0)
|
|
989
|
-
return I("InvalidAttr", "Attribute '" + e[r][2] + "' is without value.",
|
|
991
|
+
return I("InvalidAttr", "Attribute '" + e[r][2] + "' is without value.", Ht(e[r]));
|
|
990
992
|
if (e[r][3] === void 0 && !t.allowBooleanAttributes)
|
|
991
|
-
return I("InvalidAttr", "boolean attribute '" + e[r][2] + "' is not allowed.",
|
|
993
|
+
return I("InvalidAttr", "boolean attribute '" + e[r][2] + "' is not allowed.", Ht(e[r]));
|
|
992
994
|
const i = e[r][2];
|
|
993
995
|
if (!qs(i))
|
|
994
|
-
return I("InvalidAttr", "Attribute '" + i + "' is an invalid name.",
|
|
996
|
+
return I("InvalidAttr", "Attribute '" + i + "' is an invalid name.", Ht(e[r]));
|
|
995
997
|
if (!s.hasOwnProperty(i))
|
|
996
998
|
s[i] = 1;
|
|
997
999
|
else
|
|
998
|
-
return I("InvalidAttr", "Attribute '" + i + "' is repeated.",
|
|
1000
|
+
return I("InvalidAttr", "Attribute '" + i + "' is repeated.", Ht(e[r]));
|
|
999
1001
|
}
|
|
1000
1002
|
return !0;
|
|
1001
1003
|
}
|
|
@@ -1047,7 +1049,7 @@ function x(n, t) {
|
|
|
1047
1049
|
col: e[e.length - 1].length + 1
|
|
1048
1050
|
};
|
|
1049
1051
|
}
|
|
1050
|
-
function
|
|
1052
|
+
function Ht(n) {
|
|
1051
1053
|
return n.startIndex + n[1].length;
|
|
1052
1054
|
}
|
|
1053
1055
|
const tr = {
|
|
@@ -1251,36 +1253,52 @@ function pr(n, t = {}) {
|
|
|
1251
1253
|
if (t.skipLike !== void 0 && t.skipLike.test(e)) return n;
|
|
1252
1254
|
if (n === "0") return 0;
|
|
1253
1255
|
if (t.hex && hr.test(e))
|
|
1254
|
-
return
|
|
1255
|
-
if (e.search(
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
if (t.leadingZeros)
|
|
1259
|
-
e = (s[1] || "") + s[3];
|
|
1260
|
-
else if (!(s[2] === "0" && s[3][0] === ".")) return n;
|
|
1261
|
-
return t.eNotation ? Number(e) : n;
|
|
1262
|
-
} else
|
|
1263
|
-
return n;
|
|
1264
|
-
} else {
|
|
1256
|
+
return wr(e, 16);
|
|
1257
|
+
if (e.search(/.+[eE].+/) !== -1)
|
|
1258
|
+
return yr(n, e, t);
|
|
1259
|
+
{
|
|
1265
1260
|
const s = dr.exec(e);
|
|
1266
1261
|
if (s) {
|
|
1267
|
-
const r = s[1], i = s[2];
|
|
1268
|
-
let o =
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1262
|
+
const r = s[1] || "", i = s[2];
|
|
1263
|
+
let o = mr(s[3]);
|
|
1264
|
+
const a = r ? (
|
|
1265
|
+
// 0., -00., 000.
|
|
1266
|
+
n[i.length + 1] === "."
|
|
1267
|
+
) : n[i.length] === ".";
|
|
1268
|
+
if (!t.leadingZeros && (i.length > 1 || i.length === 1 && !a))
|
|
1269
|
+
return n;
|
|
1272
1270
|
{
|
|
1273
|
-
const
|
|
1274
|
-
|
|
1271
|
+
const c = Number(e), l = String(c);
|
|
1272
|
+
if (c === 0 || c === -0) return c;
|
|
1273
|
+
if (l.search(/[eE]/) !== -1)
|
|
1274
|
+
return t.eNotation ? c : n;
|
|
1275
|
+
if (e.indexOf(".") !== -1)
|
|
1276
|
+
return l === "0" || l === o || l === `${r}${o}` ? c : n;
|
|
1277
|
+
let u = i ? o : e;
|
|
1278
|
+
return i ? u === l || r + u === l ? c : n : u === l || u === r + l ? c : n;
|
|
1275
1279
|
}
|
|
1276
1280
|
} else
|
|
1277
1281
|
return n;
|
|
1278
1282
|
}
|
|
1279
1283
|
}
|
|
1280
|
-
|
|
1281
|
-
|
|
1284
|
+
const gr = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
|
|
1285
|
+
function yr(n, t, e) {
|
|
1286
|
+
if (!e.eNotation) return n;
|
|
1287
|
+
const s = t.match(gr);
|
|
1288
|
+
if (s) {
|
|
1289
|
+
let r = s[1] || "";
|
|
1290
|
+
const i = s[3].indexOf("e") === -1 ? "E" : "e", o = s[2], a = r ? (
|
|
1291
|
+
// 0E.
|
|
1292
|
+
n[o.length + 1] === i
|
|
1293
|
+
) : n[o.length] === i;
|
|
1294
|
+
return o.length > 1 && a ? n : o.length === 1 && (s[3].startsWith(`.${i}`) || s[3][0] === i) ? Number(t) : e.leadingZeros && !a ? (t = (s[1] || "") + s[3], Number(t)) : n;
|
|
1295
|
+
} else
|
|
1296
|
+
return n;
|
|
1297
|
+
}
|
|
1298
|
+
function mr(n) {
|
|
1299
|
+
return n && n.indexOf(".") !== -1 && (n = n.replace(/0+$/, ""), n === "." ? n = "0" : n[0] === "." ? n = "0" + n : n[n.length - 1] === "." && (n = n.substring(0, n.length - 1))), n;
|
|
1282
1300
|
}
|
|
1283
|
-
function
|
|
1301
|
+
function wr(n, t) {
|
|
1284
1302
|
if (parseInt) return parseInt(n, t);
|
|
1285
1303
|
if (Number.parseInt) return Number.parseInt(n, t);
|
|
1286
1304
|
if (window && window.parseInt) return window.parseInt(n, t);
|
|
@@ -1293,7 +1311,7 @@ function $n(n) {
|
|
|
1293
1311
|
return !0;
|
|
1294
1312
|
} : () => !1;
|
|
1295
1313
|
}
|
|
1296
|
-
class
|
|
1314
|
+
class br {
|
|
1297
1315
|
constructor(t) {
|
|
1298
1316
|
this.options = t, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = {
|
|
1299
1317
|
apos: { regex: /&(apos|#39|#x27);/g, val: "'" },
|
|
@@ -1316,10 +1334,10 @@ class mr {
|
|
|
1316
1334
|
inr: { regex: /&(inr|#8377);/g, val: "₹" },
|
|
1317
1335
|
num_dec: { regex: /&#([0-9]{1,7});/g, val: (e, s) => String.fromCodePoint(Number.parseInt(s, 10)) },
|
|
1318
1336
|
num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (e, s) => String.fromCodePoint(Number.parseInt(s, 16)) }
|
|
1319
|
-
}, this.addExternalEntities =
|
|
1337
|
+
}, this.addExternalEntities = _r, this.parseXml = vr, this.parseTextData = Er, this.resolveNameSpace = Ar, this.buildAttributesMap = Sr, this.isItStopNode = kr, this.replaceEntitiesValue = Ir, this.readStopNodeData = Rr, this.saveTextToParentTag = Or, this.addChild = Tr, this.ignoreAttributesFn = $n(this.options.ignoreAttributes);
|
|
1320
1338
|
}
|
|
1321
1339
|
}
|
|
1322
|
-
function
|
|
1340
|
+
function _r(n) {
|
|
1323
1341
|
const t = Object.keys(n);
|
|
1324
1342
|
for (let e = 0; e < t.length; e++) {
|
|
1325
1343
|
const s = t[e];
|
|
@@ -1329,14 +1347,14 @@ function wr(n) {
|
|
|
1329
1347
|
};
|
|
1330
1348
|
}
|
|
1331
1349
|
}
|
|
1332
|
-
function
|
|
1350
|
+
function Er(n, t, e, s, r, i, o) {
|
|
1333
1351
|
if (n !== void 0 && (this.options.trimValues && !s && (n = n.trim()), n.length > 0)) {
|
|
1334
1352
|
o || (n = this.replaceEntitiesValue(n));
|
|
1335
1353
|
const a = this.options.tagValueProcessor(t, n, e, r, i);
|
|
1336
1354
|
return a == null ? n : typeof a != typeof n || a !== n ? a : this.options.trimValues ? ve(n, this.options.parseTagValue, this.options.numberParseOptions) : n.trim() === n ? ve(n, this.options.parseTagValue, this.options.numberParseOptions) : n;
|
|
1337
1355
|
}
|
|
1338
1356
|
}
|
|
1339
|
-
function
|
|
1357
|
+
function Ar(n) {
|
|
1340
1358
|
if (this.options.removeNSPrefix) {
|
|
1341
1359
|
const t = n.split(":"), e = n.charAt(0) === "/" ? "/" : "";
|
|
1342
1360
|
if (t[0] === "xmlns")
|
|
@@ -1345,10 +1363,10 @@ function _r(n) {
|
|
|
1345
1363
|
}
|
|
1346
1364
|
return n;
|
|
1347
1365
|
}
|
|
1348
|
-
const
|
|
1349
|
-
function
|
|
1366
|
+
const Nr = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
|
|
1367
|
+
function Sr(n, t, e) {
|
|
1350
1368
|
if (this.options.ignoreAttributes !== !0 && typeof n == "string") {
|
|
1351
|
-
const s = Mn(n,
|
|
1369
|
+
const s = Mn(n, Nr), r = s.length, i = {};
|
|
1352
1370
|
for (let o = 0; o < r; o++) {
|
|
1353
1371
|
const a = this.resolveNameSpace(s[o][1]);
|
|
1354
1372
|
if (this.ignoreAttributesFn(a, t))
|
|
@@ -1374,7 +1392,7 @@ function Ar(n, t, e) {
|
|
|
1374
1392
|
return i;
|
|
1375
1393
|
}
|
|
1376
1394
|
}
|
|
1377
|
-
const
|
|
1395
|
+
const vr = function(n) {
|
|
1378
1396
|
n = n.replace(/\r\n?/g, `
|
|
1379
1397
|
`);
|
|
1380
1398
|
const t = new at("!xml");
|
|
@@ -1395,7 +1413,7 @@ const Sr = function(n) {
|
|
|
1395
1413
|
let u = 0;
|
|
1396
1414
|
l && this.options.unpairedTags.indexOf(l) !== -1 ? (u = r.lastIndexOf(".", r.lastIndexOf(".") - 1), this.tagsNodeStack.pop()) : u = r.lastIndexOf("."), r = r.substring(0, u), e = this.tagsNodeStack.pop(), s = "", i = a;
|
|
1397
1415
|
} else if (n[i + 1] === "?") {
|
|
1398
|
-
let a =
|
|
1416
|
+
let a = Se(n, i, !1, "?>");
|
|
1399
1417
|
if (!a) throw new Error("Pi Tag is not closed.");
|
|
1400
1418
|
if (s = this.saveTextToParentTag(s, e, r), !(this.options.ignoreDeclaration && a.tagName === "?xml" || this.options.ignorePiTags)) {
|
|
1401
1419
|
const c = new at(a.tagName);
|
|
@@ -1418,7 +1436,7 @@ const Sr = function(n) {
|
|
|
1418
1436
|
let l = this.parseTextData(c, e.tagname, r, !0, !1, !0, !0);
|
|
1419
1437
|
l == null && (l = ""), this.options.cdataPropName ? e.add(this.options.cdataPropName, [{ [this.options.textNodeName]: c }]) : e.add(this.options.textNodeName, l), i = a + 2;
|
|
1420
1438
|
} else {
|
|
1421
|
-
let a =
|
|
1439
|
+
let a = Se(n, i, this.options.removeNSPrefix), c = a.tagName;
|
|
1422
1440
|
const l = a.rawTagName;
|
|
1423
1441
|
let u = a.tagExp, h = a.attrExpPresent, d = a.closeIndex;
|
|
1424
1442
|
this.options.transformTagName && (c = this.options.transformTagName(c)), e && s && e.tagname !== "!xml" && (s = this.saveTextToParentTag(s, e, r, !1));
|
|
@@ -1432,9 +1450,9 @@ const Sr = function(n) {
|
|
|
1432
1450
|
else if (this.options.unpairedTags.indexOf(c) !== -1)
|
|
1433
1451
|
i = a.closeIndex;
|
|
1434
1452
|
else {
|
|
1435
|
-
const
|
|
1436
|
-
if (!
|
|
1437
|
-
i =
|
|
1453
|
+
const N = this.readStopNodeData(n, l, d + 1);
|
|
1454
|
+
if (!N) throw new Error(`Unexpected end of ${l}`);
|
|
1455
|
+
i = N.i, m = N.tagContent;
|
|
1438
1456
|
}
|
|
1439
1457
|
const E = new at(c);
|
|
1440
1458
|
c !== u && h && (E[":@"] = this.buildAttributesMap(u, r, c)), m && (m = this.parseTextData(m, c, r, !0, h, !0, !0)), r = r.substr(0, r.lastIndexOf(".")), E.add(this.options.textNodeName, m), this.addChild(e, E, r, f);
|
|
@@ -1454,12 +1472,12 @@ const Sr = function(n) {
|
|
|
1454
1472
|
s += n[i];
|
|
1455
1473
|
return t.child;
|
|
1456
1474
|
};
|
|
1457
|
-
function
|
|
1475
|
+
function Tr(n, t, e, s) {
|
|
1458
1476
|
this.options.captureMetaData || (s = void 0);
|
|
1459
1477
|
const r = this.options.updateTag(t.tagname, e, t[":@"]);
|
|
1460
1478
|
r === !1 || (typeof r == "string" && (t.tagname = r), n.addChild(t, s));
|
|
1461
1479
|
}
|
|
1462
|
-
const
|
|
1480
|
+
const Ir = function(n) {
|
|
1463
1481
|
if (this.options.processEntities) {
|
|
1464
1482
|
for (let t in this.docTypeEntities) {
|
|
1465
1483
|
const e = this.docTypeEntities[t];
|
|
@@ -1478,7 +1496,7 @@ const vr = function(n) {
|
|
|
1478
1496
|
}
|
|
1479
1497
|
return n;
|
|
1480
1498
|
};
|
|
1481
|
-
function
|
|
1499
|
+
function Or(n, t, e, s) {
|
|
1482
1500
|
return n && (s === void 0 && (s = t.child.length === 0), n = this.parseTextData(
|
|
1483
1501
|
n,
|
|
1484
1502
|
t.tagname,
|
|
@@ -1488,7 +1506,7 @@ function Tr(n, t, e, s) {
|
|
|
1488
1506
|
s
|
|
1489
1507
|
), n !== void 0 && n !== "" && t.add(this.options.textNodeName, n), n = ""), n;
|
|
1490
1508
|
}
|
|
1491
|
-
function
|
|
1509
|
+
function kr(n, t, e) {
|
|
1492
1510
|
const s = "*." + e;
|
|
1493
1511
|
for (const r in n) {
|
|
1494
1512
|
const i = n[r];
|
|
@@ -1496,7 +1514,7 @@ function Ir(n, t, e) {
|
|
|
1496
1514
|
}
|
|
1497
1515
|
return !1;
|
|
1498
1516
|
}
|
|
1499
|
-
function
|
|
1517
|
+
function Cr(n, t, e = ">") {
|
|
1500
1518
|
let s, r = "";
|
|
1501
1519
|
for (let i = t; i < n.length; i++) {
|
|
1502
1520
|
let o = n[i];
|
|
@@ -1526,8 +1544,8 @@ function ht(n, t, e, s) {
|
|
|
1526
1544
|
throw new Error(s);
|
|
1527
1545
|
return r + t.length - 1;
|
|
1528
1546
|
}
|
|
1529
|
-
function
|
|
1530
|
-
const r =
|
|
1547
|
+
function Se(n, t, e, s = ">") {
|
|
1548
|
+
const r = Cr(n, t + 1, s);
|
|
1531
1549
|
if (!r) return;
|
|
1532
1550
|
let i = r.data;
|
|
1533
1551
|
const o = r.index, a = i.search(/\s/);
|
|
@@ -1546,7 +1564,7 @@ function Ne(n, t, e, s = ">") {
|
|
|
1546
1564
|
rawTagName: u
|
|
1547
1565
|
};
|
|
1548
1566
|
}
|
|
1549
|
-
function
|
|
1567
|
+
function Rr(n, t, e) {
|
|
1550
1568
|
const s = e;
|
|
1551
1569
|
let r = 1;
|
|
1552
1570
|
for (; e < n.length; e++)
|
|
@@ -1566,7 +1584,7 @@ function kr(n, t, e) {
|
|
|
1566
1584
|
else if (n.substr(e + 1, 2) === "![")
|
|
1567
1585
|
e = ht(n, "]]>", e, "StopNode is not closed.") - 2;
|
|
1568
1586
|
else {
|
|
1569
|
-
const i =
|
|
1587
|
+
const i = Se(n, e, ">");
|
|
1570
1588
|
i && ((i && i.tagName) === t && i.tagExp[i.tagExp.length - 1] !== "/" && r++, e = i.closeIndex);
|
|
1571
1589
|
}
|
|
1572
1590
|
}
|
|
@@ -1578,14 +1596,14 @@ function ve(n, t, e) {
|
|
|
1578
1596
|
return js(n) ? n : "";
|
|
1579
1597
|
}
|
|
1580
1598
|
const ye = at.getMetaDataSymbol();
|
|
1581
|
-
function
|
|
1582
|
-
return
|
|
1599
|
+
function xr(n, t) {
|
|
1600
|
+
return Hn(n, t);
|
|
1583
1601
|
}
|
|
1584
|
-
function
|
|
1602
|
+
function Hn(n, t, e) {
|
|
1585
1603
|
let s;
|
|
1586
1604
|
const r = {};
|
|
1587
1605
|
for (let i = 0; i < n.length; i++) {
|
|
1588
|
-
const o = n[i], a =
|
|
1606
|
+
const o = n[i], a = Mr(o);
|
|
1589
1607
|
let c = "";
|
|
1590
1608
|
if (e === void 0 ? c = a : c = e + "." + a, a === t.textNodeName)
|
|
1591
1609
|
s === void 0 ? s = o[a] : s += "" + o[a];
|
|
@@ -1593,22 +1611,22 @@ function Pn(n, t, e) {
|
|
|
1593
1611
|
if (a === void 0)
|
|
1594
1612
|
continue;
|
|
1595
1613
|
if (o[a]) {
|
|
1596
|
-
let l =
|
|
1597
|
-
const u =
|
|
1598
|
-
o[ye] !== void 0 && (l[ye] = o[ye]), o[":@"] ?
|
|
1614
|
+
let l = Hn(o[a], t, c);
|
|
1615
|
+
const u = Hr(l, t);
|
|
1616
|
+
o[ye] !== void 0 && (l[ye] = o[ye]), o[":@"] ? $r(l, o[":@"], c, t) : Object.keys(l).length === 1 && l[t.textNodeName] !== void 0 && !t.alwaysCreateTextNode ? l = l[t.textNodeName] : Object.keys(l).length === 0 && (t.alwaysCreateTextNode ? l[t.textNodeName] = "" : l = ""), r[a] !== void 0 && r.hasOwnProperty(a) ? (Array.isArray(r[a]) || (r[a] = [r[a]]), r[a].push(l)) : t.isArray(a, c, u) ? r[a] = [l] : r[a] = l;
|
|
1599
1617
|
}
|
|
1600
1618
|
}
|
|
1601
1619
|
}
|
|
1602
1620
|
return typeof s == "string" ? s.length > 0 && (r[t.textNodeName] = s) : s !== void 0 && (r[t.textNodeName] = s), r;
|
|
1603
1621
|
}
|
|
1604
|
-
function
|
|
1622
|
+
function Mr(n) {
|
|
1605
1623
|
const t = Object.keys(n);
|
|
1606
1624
|
for (let e = 0; e < t.length; e++) {
|
|
1607
1625
|
const s = t[e];
|
|
1608
1626
|
if (s !== ":@") return s;
|
|
1609
1627
|
}
|
|
1610
1628
|
}
|
|
1611
|
-
function
|
|
1629
|
+
function $r(n, t, e, s) {
|
|
1612
1630
|
if (t) {
|
|
1613
1631
|
const r = Object.keys(t), i = r.length;
|
|
1614
1632
|
for (let o = 0; o < i; o++) {
|
|
@@ -1617,11 +1635,11 @@ function xr(n, t, e, s) {
|
|
|
1617
1635
|
}
|
|
1618
1636
|
}
|
|
1619
1637
|
}
|
|
1620
|
-
function
|
|
1638
|
+
function Hr(n, t) {
|
|
1621
1639
|
const { textNodeName: e } = t, s = Object.keys(n).length;
|
|
1622
1640
|
return !!(s === 0 || s === 1 && (n[e] || typeof n[e] == "boolean" || n[e] === 0));
|
|
1623
1641
|
}
|
|
1624
|
-
class
|
|
1642
|
+
class Pr {
|
|
1625
1643
|
constructor(t) {
|
|
1626
1644
|
this.externalEntities = {}, this.options = er(t);
|
|
1627
1645
|
}
|
|
@@ -1641,10 +1659,10 @@ class $r {
|
|
|
1641
1659
|
if (i !== !0)
|
|
1642
1660
|
throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`);
|
|
1643
1661
|
}
|
|
1644
|
-
const s = new
|
|
1662
|
+
const s = new br(this.options);
|
|
1645
1663
|
s.addExternalEntities(this.externalEntities);
|
|
1646
1664
|
const r = s.parseXml(t);
|
|
1647
|
-
return this.options.preserveOrder || r === void 0 ? r :
|
|
1665
|
+
return this.options.preserveOrder || r === void 0 ? r : xr(r, this.options);
|
|
1648
1666
|
}
|
|
1649
1667
|
/**
|
|
1650
1668
|
* Add Entity which is not by default supported by this library
|
|
@@ -1674,21 +1692,21 @@ class $r {
|
|
|
1674
1692
|
return at.getMetaDataSymbol();
|
|
1675
1693
|
}
|
|
1676
1694
|
}
|
|
1677
|
-
const
|
|
1695
|
+
const Wr = `
|
|
1678
1696
|
`;
|
|
1679
|
-
function
|
|
1697
|
+
function Br(n, t) {
|
|
1680
1698
|
let e = "";
|
|
1681
|
-
return t.format && t.indentBy.length > 0 && (e =
|
|
1699
|
+
return t.format && t.indentBy.length > 0 && (e = Wr), Pn(n, t, "", e);
|
|
1682
1700
|
}
|
|
1683
|
-
function
|
|
1701
|
+
function Pn(n, t, e, s) {
|
|
1684
1702
|
let r = "", i = !1;
|
|
1685
1703
|
for (let o = 0; o < n.length; o++) {
|
|
1686
|
-
const a = n[o], c =
|
|
1704
|
+
const a = n[o], c = Dr(a);
|
|
1687
1705
|
if (c === void 0) continue;
|
|
1688
1706
|
let l = "";
|
|
1689
1707
|
if (e.length === 0 ? l = c : l = `${e}.${c}`, c === t.textNodeName) {
|
|
1690
1708
|
let f = a[c];
|
|
1691
|
-
|
|
1709
|
+
Kr(l, t) || (f = t.tagValueProcessor(c, f), f = Wn(f, t)), i && (r += s), r += f, i = !1;
|
|
1692
1710
|
continue;
|
|
1693
1711
|
} else if (c === t.cdataPropName) {
|
|
1694
1712
|
i && (r += s), r += `<![CDATA[${a[c][0][t.textNodeName]}]]>`, i = !1;
|
|
@@ -1704,12 +1722,12 @@ function Hn(n, t, e, s) {
|
|
|
1704
1722
|
}
|
|
1705
1723
|
let u = s;
|
|
1706
1724
|
u !== "" && (u += t.indentBy);
|
|
1707
|
-
const h = dn(a[":@"], t), d = s + `<${c}${h}`, g =
|
|
1725
|
+
const h = dn(a[":@"], t), d = s + `<${c}${h}`, g = Pn(a[c], t, l, u);
|
|
1708
1726
|
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;
|
|
1709
1727
|
}
|
|
1710
1728
|
return r;
|
|
1711
1729
|
}
|
|
1712
|
-
function
|
|
1730
|
+
function Dr(n) {
|
|
1713
1731
|
const t = Object.keys(n);
|
|
1714
1732
|
for (let e = 0; e < t.length; e++) {
|
|
1715
1733
|
const s = t[e];
|
|
@@ -1727,7 +1745,7 @@ function dn(n, t) {
|
|
|
1727
1745
|
}
|
|
1728
1746
|
return e;
|
|
1729
1747
|
}
|
|
1730
|
-
function
|
|
1748
|
+
function Kr(n, t) {
|
|
1731
1749
|
n = n.substr(0, n.length - t.textNodeName.length - 1);
|
|
1732
1750
|
let e = n.substr(n.lastIndexOf(".") + 1);
|
|
1733
1751
|
for (let s in t.stopNodes)
|
|
@@ -1742,7 +1760,7 @@ function Wn(n, t) {
|
|
|
1742
1760
|
}
|
|
1743
1761
|
return n;
|
|
1744
1762
|
}
|
|
1745
|
-
const
|
|
1763
|
+
const Lr = {
|
|
1746
1764
|
attributeNamePrefix: "@_",
|
|
1747
1765
|
attributesGroupName: !1,
|
|
1748
1766
|
textNodeName: "#text",
|
|
@@ -1777,16 +1795,16 @@ const Dr = {
|
|
|
1777
1795
|
oneListGroup: !1
|
|
1778
1796
|
};
|
|
1779
1797
|
function nt(n) {
|
|
1780
|
-
this.options = Object.assign({},
|
|
1798
|
+
this.options = Object.assign({}, Lr, n), this.options.ignoreAttributes === !0 || this.options.attributesGroupName ? this.isAttribute = function() {
|
|
1781
1799
|
return !1;
|
|
1782
|
-
} : (this.ignoreAttributesFn = $n(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute =
|
|
1800
|
+
} : (this.ignoreAttributesFn = $n(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = Ur), this.processTextOrObjNode = zr, this.options.format ? (this.indentate = jr, this.tagEndChar = `>
|
|
1783
1801
|
`, this.newLine = `
|
|
1784
1802
|
`) : (this.indentate = function() {
|
|
1785
1803
|
return "";
|
|
1786
1804
|
}, this.tagEndChar = ">", this.newLine = "");
|
|
1787
1805
|
}
|
|
1788
1806
|
nt.prototype.build = function(n) {
|
|
1789
|
-
return this.options.preserveOrder ?
|
|
1807
|
+
return this.options.preserveOrder ? Br(n, this.options) : (Array.isArray(n) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (n = {
|
|
1790
1808
|
[this.options.arrayNodeName]: n
|
|
1791
1809
|
}), this.j2x(n, 0, []).val);
|
|
1792
1810
|
};
|
|
@@ -1842,7 +1860,7 @@ nt.prototype.j2x = function(n, t, e) {
|
|
|
1842
1860
|
nt.prototype.buildAttrPairStr = function(n, t) {
|
|
1843
1861
|
return t = this.options.attributeValueProcessor(n, "" + t), t = this.replaceEntitiesValue(t), this.options.suppressBooleanAttributes && t === "true" ? " " + n : " " + n + '="' + t + '"';
|
|
1844
1862
|
};
|
|
1845
|
-
function
|
|
1863
|
+
function zr(n, t, e, s) {
|
|
1846
1864
|
const r = this.j2x(n, e + 1, s.concat(t));
|
|
1847
1865
|
return n[this.options.textNodeName] !== void 0 && Object.keys(n).length === 1 ? this.buildTextValNode(n[this.options.textNodeName], t, r.attrStr, e) : this.buildObjectNode(r.val, t, r.attrStr, e);
|
|
1848
1866
|
}
|
|
@@ -1878,10 +1896,10 @@ nt.prototype.replaceEntitiesValue = function(n) {
|
|
|
1878
1896
|
}
|
|
1879
1897
|
return n;
|
|
1880
1898
|
};
|
|
1881
|
-
function
|
|
1899
|
+
function jr(n) {
|
|
1882
1900
|
return this.options.indentBy.repeat(n);
|
|
1883
1901
|
}
|
|
1884
|
-
function
|
|
1902
|
+
function Ur(n) {
|
|
1885
1903
|
return n.startsWith(this.options.attributeNamePrefix) && n !== this.options.textNodeName ? n.substr(this.attrPrefixLen) : !1;
|
|
1886
1904
|
}
|
|
1887
1905
|
class yt {
|
|
@@ -1914,7 +1932,7 @@ class yt {
|
|
|
1914
1932
|
return `<${[
|
|
1915
1933
|
this.type,
|
|
1916
1934
|
Ln(this.attrs),
|
|
1917
|
-
|
|
1935
|
+
Yr(this.styles),
|
|
1918
1936
|
...t
|
|
1919
1937
|
].filter((e) => e != "").join(" ")}>`;
|
|
1920
1938
|
}
|
|
@@ -1976,7 +1994,7 @@ class Dn extends yt {
|
|
|
1976
1994
|
return this.attrs.stroke = e, this;
|
|
1977
1995
|
}
|
|
1978
1996
|
}
|
|
1979
|
-
class
|
|
1997
|
+
class St extends yt {
|
|
1980
1998
|
constructor(e = "") {
|
|
1981
1999
|
super("text");
|
|
1982
2000
|
_(this, "attrs");
|
|
@@ -2017,10 +2035,10 @@ class v extends yt {
|
|
|
2017
2035
|
return this.children.push(e), this;
|
|
2018
2036
|
}
|
|
2019
2037
|
rotate(e, s, r) {
|
|
2020
|
-
return this.rotateMatrix =
|
|
2038
|
+
return this.rotateMatrix = Ps(e, s, r), this;
|
|
2021
2039
|
}
|
|
2022
2040
|
translate(e, s) {
|
|
2023
|
-
return this.translateMatrix =
|
|
2041
|
+
return this.translateMatrix = Ne(e, s), this;
|
|
2024
2042
|
}
|
|
2025
2043
|
center() {
|
|
2026
2044
|
return this.children.map((e) => e.toString()).join("");
|
|
@@ -2029,7 +2047,7 @@ class v extends yt {
|
|
|
2029
2047
|
const s = [this.translateMatrix, this.rotateMatrix].filter(
|
|
2030
2048
|
(r) => r != null
|
|
2031
2049
|
);
|
|
2032
|
-
return s.length == 0 ? super.left() : super.left(
|
|
2050
|
+
return s.length == 0 ? super.left() : super.left(Xr(Rs(s)));
|
|
2033
2051
|
}
|
|
2034
2052
|
each(e, s) {
|
|
2035
2053
|
for (let r = 0; r < this.children.length; r++) {
|
|
@@ -2038,12 +2056,12 @@ class v extends yt {
|
|
|
2038
2056
|
}
|
|
2039
2057
|
}
|
|
2040
2058
|
}
|
|
2041
|
-
const
|
|
2059
|
+
const Fr = [
|
|
2042
2060
|
'xmlns="http://www.w3.org/2000/svg"',
|
|
2043
2061
|
'version="1.1"',
|
|
2044
2062
|
'xmlns:xlink="http://www.w3.org/1999/xlink"'
|
|
2045
2063
|
];
|
|
2046
|
-
class
|
|
2064
|
+
class Zr extends yt {
|
|
2047
2065
|
constructor() {
|
|
2048
2066
|
super("svg");
|
|
2049
2067
|
_(this, "children", []);
|
|
@@ -2058,16 +2076,16 @@ class Ur extends yt {
|
|
|
2058
2076
|
left(...e) {
|
|
2059
2077
|
return `<${[
|
|
2060
2078
|
this.type,
|
|
2061
|
-
...
|
|
2079
|
+
...Fr,
|
|
2062
2080
|
Ln(this.attrs),
|
|
2063
|
-
|
|
2081
|
+
Jr(this.viewBox)
|
|
2064
2082
|
].filter((s) => s != "").join(" ")}>`;
|
|
2065
2083
|
}
|
|
2066
2084
|
viewbox(e, s, r, i) {
|
|
2067
2085
|
return this.viewBox = { x: e, y: s, width: r, height: i }, this;
|
|
2068
2086
|
}
|
|
2069
2087
|
importSymbol(e) {
|
|
2070
|
-
for (const s of
|
|
2088
|
+
for (const s of qr(e))
|
|
2071
2089
|
this.add(s);
|
|
2072
2090
|
return this;
|
|
2073
2091
|
}
|
|
@@ -2090,28 +2108,28 @@ class Ur extends yt {
|
|
|
2090
2108
|
}
|
|
2091
2109
|
}
|
|
2092
2110
|
}
|
|
2093
|
-
function
|
|
2094
|
-
return new
|
|
2111
|
+
function Gr() {
|
|
2112
|
+
return new Zr();
|
|
2095
2113
|
}
|
|
2096
|
-
const
|
|
2097
|
-
function
|
|
2114
|
+
const Zo = Gr, Go = v, Vo = Bn, Jo = je, Xo = Dn, Yo = St;
|
|
2115
|
+
function Vr(n) {
|
|
2098
2116
|
return n.replace(/[A-Z]/g, (t) => "-" + t.toLowerCase());
|
|
2099
2117
|
}
|
|
2100
|
-
function
|
|
2118
|
+
function Jr(n) {
|
|
2101
2119
|
return n == null ? "" : `viewBox="${n.x} ${n.y} ${n.width} ${n.height}"`;
|
|
2102
2120
|
}
|
|
2103
|
-
function
|
|
2121
|
+
function Xr(n) {
|
|
2104
2122
|
return n == null ? "" : `transform="${Ws(n)}"`;
|
|
2105
2123
|
}
|
|
2106
2124
|
function Ln(n) {
|
|
2107
|
-
return Object.entries(n).filter(([t, e]) => e !== void 0).map(([t, e]) => `${
|
|
2125
|
+
return Object.entries(n).filter(([t, e]) => e !== void 0).map(([t, e]) => `${Vr(t)}="${e}"`).join(" ");
|
|
2108
2126
|
}
|
|
2109
|
-
function
|
|
2127
|
+
function Yr(n) {
|
|
2110
2128
|
const t = Object.entries(n).map(([e, s]) => `${e}: ${s};`).join(" ");
|
|
2111
2129
|
return t != "" ? `style="${t}"` : "";
|
|
2112
2130
|
}
|
|
2113
|
-
function*
|
|
2114
|
-
const t = new
|
|
2131
|
+
function* qr(n) {
|
|
2132
|
+
const t = new Pr({ ignoreAttributes: !1 }), e = new nt({
|
|
2115
2133
|
ignoreAttributes: !1
|
|
2116
2134
|
}), s = t.parse(n);
|
|
2117
2135
|
for (const r of s.svg.symbol) {
|
|
@@ -2158,7 +2176,7 @@ class Tt {
|
|
|
2158
2176
|
return this.image(t).dx(e).dy(s).size(r.baseWidth, r.baseHeight);
|
|
2159
2177
|
}
|
|
2160
2178
|
createTextImage(t, e, s, r) {
|
|
2161
|
-
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
|
|
2179
|
+
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 St().plain(r);
|
|
2162
2180
|
u.size(o.baseWidth, o.baseHeight).font({
|
|
2163
2181
|
family: In,
|
|
2164
2182
|
size: a
|
|
@@ -2245,7 +2263,7 @@ class zn extends Tt {
|
|
|
2245
2263
|
return i;
|
|
2246
2264
|
}
|
|
2247
2265
|
}
|
|
2248
|
-
const
|
|
2266
|
+
const Qr = (n, t) => {
|
|
2249
2267
|
const e = n.scale;
|
|
2250
2268
|
return {
|
|
2251
2269
|
[b.CHI]: function(r) {
|
|
@@ -2265,7 +2283,7 @@ const Yr = (n, t) => {
|
|
|
2265
2283
|
return { ...i, e: o };
|
|
2266
2284
|
},
|
|
2267
2285
|
[b.AN_KAN]: function(r) {
|
|
2268
|
-
|
|
2286
|
+
S(
|
|
2269
2287
|
r instanceof M,
|
|
2270
2288
|
`block type is not ankan: ${r.type}`
|
|
2271
2289
|
);
|
|
@@ -2310,7 +2328,7 @@ const Yr = (n, t) => {
|
|
|
2310
2328
|
}
|
|
2311
2329
|
};
|
|
2312
2330
|
}, Wt = (n, t, e) => {
|
|
2313
|
-
const s =
|
|
2331
|
+
const s = Qr(n, e);
|
|
2314
2332
|
let r = 0, i = 0;
|
|
2315
2333
|
const o = [];
|
|
2316
2334
|
for (const h of t) {
|
|
@@ -2324,7 +2342,7 @@ const Yr = (n, t) => {
|
|
|
2324
2342
|
g.add(h.e), l.add(g), u += h.width + n.blockMargin;
|
|
2325
2343
|
}
|
|
2326
2344
|
return { e: l, width: c, height: a };
|
|
2327
|
-
},
|
|
2345
|
+
}, qo = (n, t, e = {}, s = {
|
|
2328
2346
|
responsive: !1,
|
|
2329
2347
|
doraText: !0,
|
|
2330
2348
|
tsumoText: !0
|
|
@@ -2343,7 +2361,7 @@ const Yr = (n, t) => {
|
|
|
2343
2361
|
);
|
|
2344
2362
|
}
|
|
2345
2363
|
return t;
|
|
2346
|
-
},
|
|
2364
|
+
}, ti = (n) => {
|
|
2347
2365
|
const t = jn(), e = [];
|
|
2348
2366
|
return n.each((s, r) => {
|
|
2349
2367
|
const i = r[s];
|
|
@@ -2352,13 +2370,13 @@ const Yr = (n, t) => {
|
|
|
2352
2370
|
t.includes(a) && e.push(a);
|
|
2353
2371
|
}
|
|
2354
2372
|
}, !0), e;
|
|
2355
|
-
},
|
|
2356
|
-
const t = jn(), e =
|
|
2373
|
+
}, Qo = (n) => {
|
|
2374
|
+
const t = jn(), e = ti(n);
|
|
2357
2375
|
n.each((s, r) => {
|
|
2358
2376
|
const i = r[s];
|
|
2359
2377
|
i instanceof Kn && (t.includes(i.id()) && e.includes(i.id()) || i.remove());
|
|
2360
2378
|
}, !0);
|
|
2361
|
-
},
|
|
2379
|
+
}, ei = (n) => {
|
|
2362
2380
|
const e = [];
|
|
2363
2381
|
for (let s = 0; s < n.length; s += 6) {
|
|
2364
2382
|
const r = n.slice(s, s + 6);
|
|
@@ -2381,7 +2399,7 @@ const Yr = (n, t) => {
|
|
|
2381
2399
|
}
|
|
2382
2400
|
return new v().add(o);
|
|
2383
2401
|
}, Ut = (n, t) => {
|
|
2384
|
-
const e = new v(), s =
|
|
2402
|
+
const e = new v(), s = ei(n);
|
|
2385
2403
|
for (let r = 0; r < s.length; r++) {
|
|
2386
2404
|
let i = s[r], o = r * t.tileHeight;
|
|
2387
2405
|
const a = t.createBlockHandDiscard(new Cn(i, b.IMAGE_DISCARD)).translate(0, o);
|
|
@@ -2392,13 +2410,13 @@ const Yr = (n, t) => {
|
|
|
2392
2410
|
width: t.tileWidth * 5 + t.tileHeight * 1,
|
|
2393
2411
|
height: t.tileHeight * s.length
|
|
2394
2412
|
};
|
|
2395
|
-
},
|
|
2413
|
+
}, ni = (n, t, e) => {
|
|
2396
2414
|
const s = t.font, r = t.textWidth, i = t.textHeight, o = e.sticks.dead, a = e.sticks.reach, c = nn.WIDTH * n.scale, l = nn.HEIGHT * n.scale;
|
|
2397
2415
|
let u = r * 3, h = i;
|
|
2398
|
-
const d = (c + n.tileWidth + r - u) / 2, g = new
|
|
2416
|
+
const d = (c + n.tileWidth + r - u) / 2, g = new St().plain(e.round).font(s).x(d).y(0);
|
|
2399
2417
|
h += 25 * n.scale;
|
|
2400
|
-
const f = n.tileHeight, m = new v().size(c, f).translate(0, h), E = { family: s.family, size: s.size * 0.7 },
|
|
2401
|
-
m.add(
|
|
2418
|
+
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 St().plain(a.toString()).font(E).dx(c).dy(l), R = n.createStick(100).size(c, l).x(0).y(l + l), mt = new St().plain(o.toString()).font(E).dx(c).dy(l * 3);
|
|
2419
|
+
m.add(N), m.add(O), m.add(R), m.add(mt);
|
|
2402
2420
|
const wt = n.createImage(e.doras[0], 0, 0).x(c + r).y(0);
|
|
2403
2421
|
m.add(wt);
|
|
2404
2422
|
const bt = new v();
|
|
@@ -2407,7 +2425,7 @@ const Yr = (n, t) => {
|
|
|
2407
2425
|
width: c + n.tileWidth + r,
|
|
2408
2426
|
height: h + n.tileHeight
|
|
2409
2427
|
};
|
|
2410
|
-
},
|
|
2428
|
+
}, si = (n, t, e = 0) => {
|
|
2411
2429
|
const s = Wt(n, t.front), r = Wt(n, t.right), i = Wt(n, t.opposite), o = Wt(n, t.left), a = [s.width, r.width, i.width, o.width].reduce(
|
|
2412
2430
|
(m, E) => Math.max(m, E)
|
|
2413
2431
|
), c = Math.max(
|
|
@@ -2427,23 +2445,23 @@ const Yr = (n, t) => {
|
|
|
2427
2445
|
(c - o.width) / 2
|
|
2428
2446
|
), f = new v().size(c, l);
|
|
2429
2447
|
return f.add(u), f.add(h), f.add(d), f.add(g), { e: new v().add(f), width: c, height: l };
|
|
2430
|
-
},
|
|
2448
|
+
}, ri = (n) => {
|
|
2431
2449
|
const t = Object.values(We), e = t.indexOf(n);
|
|
2432
2450
|
return [...t.slice(e), ...t.slice(0, e)];
|
|
2433
|
-
},
|
|
2434
|
-
const s = n.tileWidth * 5 + n.tileHeight * 1, r = t.font, i = t.textWidth, o = t.textHeight, a = t.numWidth, c =
|
|
2451
|
+
}, ii = (n, t, e) => {
|
|
2452
|
+
const s = n.tileWidth * 5 + n.tileHeight * 1, r = t.font, i = t.textWidth, o = t.textHeight, a = t.numWidth, c = ni(n, t, e);
|
|
2435
2453
|
c.e.translate(
|
|
2436
2454
|
s / 2 - c.width / 2,
|
|
2437
2455
|
s / 2 - c.height / 2
|
|
2438
2456
|
);
|
|
2439
2457
|
const l = (ms, en, ws) => {
|
|
2440
|
-
const bs = `${ms} ${en}`, _s = new
|
|
2458
|
+
const bs = `${ms} ${en}`, _s = new St().plain(bs).font(r).attr(ws);
|
|
2441
2459
|
return {
|
|
2442
2460
|
e: new v().add(_s),
|
|
2443
2461
|
width: i + a * en.toString().length,
|
|
2444
2462
|
height: o
|
|
2445
2463
|
};
|
|
2446
|
-
}, [u, h, d, g] =
|
|
2464
|
+
}, [u, h, d, g] = ri(
|
|
2447
2465
|
e.frontPlace
|
|
2448
2466
|
), f = e.scores, E = l(u, f.front, {
|
|
2449
2467
|
x: s / 2,
|
|
@@ -2451,13 +2469,13 @@ const Yr = (n, t) => {
|
|
|
2451
2469
|
"dominant-baseline": "text-after-edge",
|
|
2452
2470
|
"text-anchor": "middle"
|
|
2453
2471
|
}).e;
|
|
2454
|
-
let
|
|
2472
|
+
let N = l(h, f.right, {
|
|
2455
2473
|
"dominant-baseline": "text-after-edge",
|
|
2456
2474
|
"text-anchor": "middle"
|
|
2457
2475
|
});
|
|
2458
|
-
const O = L(
|
|
2476
|
+
const O = L(N.e, N.width, N.height, 270).translate(
|
|
2459
2477
|
s,
|
|
2460
|
-
s / 2 -
|
|
2478
|
+
s / 2 - N.width
|
|
2461
2479
|
);
|
|
2462
2480
|
let R = l(d, f.opposite, {
|
|
2463
2481
|
"text-anchor": "middle",
|
|
@@ -2476,7 +2494,7 @@ const Yr = (n, t) => {
|
|
|
2476
2494
|
s / 2
|
|
2477
2495
|
), st = new v(), ys = new Dn().size(s, s).x(0).y(0).fill("none").stroke("#000000");
|
|
2478
2496
|
return st.add(ys), st.add(c.e), st.add(E), st.add(O), st.add(mt), st.add(bt), { e: st, width: s, height: s };
|
|
2479
|
-
},
|
|
2497
|
+
}, oi = (n, t) => {
|
|
2480
2498
|
const e = Ut(t.front, n), s = Ut(t.right, n), r = Ut(t.opposite, n), i = Ut(t.left, n), o = [e.height, s.height, r.height, i.height].reduce(
|
|
2481
2499
|
(O, R) => Math.max(O, R)
|
|
2482
2500
|
), a = n.tileWidth * 5 + n.tileHeight * 1, c = o, l = a + o * 2 + n.blockMargin, u = l, h = new v().size(l, u), d = l / 2 - a / 2, g = u / 2 - a / 2, f = L(e.e, a, c, 0).translate(
|
|
@@ -2490,13 +2508,13 @@ const Yr = (n, t) => {
|
|
|
2490
2508
|
a,
|
|
2491
2509
|
c,
|
|
2492
2510
|
180
|
|
2493
|
-
).translate(d, 0),
|
|
2511
|
+
).translate(d, 0), N = L(i.e, a, c, 90).translate(
|
|
2494
2512
|
0,
|
|
2495
2513
|
g
|
|
2496
2514
|
);
|
|
2497
|
-
return h.add(f), h.add(m), h.add(E), h.add(
|
|
2498
|
-
},
|
|
2499
|
-
const i = new v(), o =
|
|
2515
|
+
return h.add(f), h.add(m), h.add(E), h.add(N), { e: new v().add(h), width: l, height: u };
|
|
2516
|
+
}, ai = (n, t, e, s, r) => {
|
|
2517
|
+
const i = new v(), o = oi(n, s), a = si(n, e, o.height), c = ii(n, t, r);
|
|
2500
2518
|
return o.e.translate(
|
|
2501
2519
|
(a.width - o.width) / 2,
|
|
2502
2520
|
(a.height - o.height) / 2
|
|
@@ -2504,8 +2522,8 @@ const Yr = (n, t) => {
|
|
|
2504
2522
|
(a.width - c.width) / 2,
|
|
2505
2523
|
(a.height - c.height) / 2
|
|
2506
2524
|
), i.add(a.e), i.add(o.e), i.add(c.e), { e: i, width: a.width, height: a.height };
|
|
2507
|
-
},
|
|
2508
|
-
const i = new zn(e), o = s, { discards: a, hands: c, scoreBoard: l } =
|
|
2525
|
+
}, ta = (n, t, e = {}, s, r = { responsive: !1 }) => {
|
|
2526
|
+
const i = new zn(e), o = s, { discards: a, hands: c, scoreBoard: l } = mi(t), u = ai(i, o, c, a, l);
|
|
2509
2527
|
r.responsive || n.size(u.width, u.height), n.viewbox(0, 0, u.width, u.height), n.add(u.e);
|
|
2510
2528
|
};
|
|
2511
2529
|
var Z;
|
|
@@ -2520,17 +2538,17 @@ function Un(n) {
|
|
|
2520
2538
|
}
|
|
2521
2539
|
var me;
|
|
2522
2540
|
// @__NO_SIDE_EFFECTS__
|
|
2523
|
-
function
|
|
2541
|
+
function ci(n) {
|
|
2524
2542
|
return me == null ? void 0 : me.get(n);
|
|
2525
2543
|
}
|
|
2526
2544
|
var we;
|
|
2527
2545
|
// @__NO_SIDE_EFFECTS__
|
|
2528
|
-
function
|
|
2546
|
+
function li(n) {
|
|
2529
2547
|
return we == null ? void 0 : we.get(n);
|
|
2530
2548
|
}
|
|
2531
2549
|
var be;
|
|
2532
2550
|
// @__NO_SIDE_EFFECTS__
|
|
2533
|
-
function
|
|
2551
|
+
function ui(n, t) {
|
|
2534
2552
|
var e;
|
|
2535
2553
|
return (e = be == null ? void 0 : be.get(n)) == null ? void 0 : e.get(t);
|
|
2536
2554
|
}
|
|
@@ -2554,7 +2572,7 @@ function tt(n, t, e, s, r) {
|
|
|
2554
2572
|
lang: s.lang,
|
|
2555
2573
|
abortEarly: s.abortEarly,
|
|
2556
2574
|
abortPipeEarly: s.abortPipeEarly
|
|
2557
|
-
}, l = n.kind === "schema", u = (r == null ? void 0 : r.message) ?? n.message ?? /* @__PURE__ */
|
|
2575
|
+
}, l = n.kind === "schema", u = (r == null ? void 0 : r.message) ?? n.message ?? /* @__PURE__ */ ui(n.reference, c.lang) ?? (l ? /* @__PURE__ */ li(c.lang) : null) ?? s.message ?? /* @__PURE__ */ ci(c.lang);
|
|
2558
2576
|
u !== void 0 && (c.message = typeof u == "function" ? (
|
|
2559
2577
|
// @ts-expect-error
|
|
2560
2578
|
u(c)
|
|
@@ -2571,7 +2589,7 @@ function $t(n) {
|
|
|
2571
2589
|
};
|
|
2572
2590
|
}
|
|
2573
2591
|
// @__NO_SIDE_EFFECTS__
|
|
2574
|
-
function
|
|
2592
|
+
function hi(n, t) {
|
|
2575
2593
|
const e = [...new Set(n)];
|
|
2576
2594
|
return e.length > 1 ? `(${e.join(` ${t} `)})` : e[0] ?? "never";
|
|
2577
2595
|
}
|
|
@@ -2610,7 +2628,7 @@ function Ie(n, t) {
|
|
|
2610
2628
|
};
|
|
2611
2629
|
}
|
|
2612
2630
|
// @__NO_SIDE_EFFECTS__
|
|
2613
|
-
function
|
|
2631
|
+
function di(n, t, e) {
|
|
2614
2632
|
return typeof n.fallback == "function" ? (
|
|
2615
2633
|
// @ts-expect-error
|
|
2616
2634
|
n.fallback(t, e)
|
|
@@ -2670,7 +2688,7 @@ function Oe(n, t) {
|
|
|
2670
2688
|
kind: "schema",
|
|
2671
2689
|
type: "picklist",
|
|
2672
2690
|
reference: Oe,
|
|
2673
|
-
expects: /* @__PURE__ */
|
|
2691
|
+
expects: /* @__PURE__ */ hi(n.map(It), "|"),
|
|
2674
2692
|
async: !1,
|
|
2675
2693
|
options: n,
|
|
2676
2694
|
message: t,
|
|
@@ -2725,7 +2743,7 @@ function Ot(n, t) {
|
|
|
2725
2743
|
}
|
|
2726
2744
|
l.typed || (e.typed = !1), e.value[o] = l.value;
|
|
2727
2745
|
} else if (a.fallback !== void 0)
|
|
2728
|
-
e.value[o] = /* @__PURE__ */
|
|
2746
|
+
e.value[o] = /* @__PURE__ */ di(a);
|
|
2729
2747
|
else if (a.type !== "exact_optional" && a.type !== "optional" && a.type !== "nullish" && (tt(this, "key", e, s, {
|
|
2730
2748
|
input: void 0,
|
|
2731
2749
|
expected: `"${o}"`,
|
|
@@ -2807,7 +2825,7 @@ function fn(...n) {
|
|
|
2807
2825
|
};
|
|
2808
2826
|
}
|
|
2809
2827
|
// @__NO_SIDE_EFFECTS__
|
|
2810
|
-
function
|
|
2828
|
+
function fi(n, t, e) {
|
|
2811
2829
|
const s = n["~run"]({ value: t }, /* @__PURE__ */ Un(e));
|
|
2812
2830
|
return {
|
|
2813
2831
|
typed: s.typed,
|
|
@@ -2823,7 +2841,7 @@ const Ft = /* @__PURE__ */ D(
|
|
|
2823
2841
|
score: /* @__PURE__ */ D(/* @__PURE__ */ ne(), 25e3)
|
|
2824
2842
|
}),
|
|
2825
2843
|
{ discard: "", hand: "", score: 25e3 }
|
|
2826
|
-
),
|
|
2844
|
+
), pi = /* @__PURE__ */ Ot({
|
|
2827
2845
|
[A.E]: Ft,
|
|
2828
2846
|
[A.S]: Ft,
|
|
2829
2847
|
[A.W]: Ft,
|
|
@@ -2833,7 +2851,7 @@ const Ft = /* @__PURE__ */ D(
|
|
|
2833
2851
|
sticks: { reach: 0, dead: 0 },
|
|
2834
2852
|
doras: A.S,
|
|
2835
2853
|
front: A.E
|
|
2836
|
-
},
|
|
2854
|
+
}, gi = /* @__PURE__ */ D(
|
|
2837
2855
|
/* @__PURE__ */ Ot({
|
|
2838
2856
|
round: /* @__PURE__ */ D(
|
|
2839
2857
|
/* @__PURE__ */ Oe(Object.keys(On)),
|
|
@@ -2859,18 +2877,18 @@ const Ft = /* @__PURE__ */ D(
|
|
|
2859
2877
|
)
|
|
2860
2878
|
}),
|
|
2861
2879
|
rt
|
|
2862
|
-
),
|
|
2863
|
-
...
|
|
2864
|
-
board:
|
|
2865
|
-
}),
|
|
2866
|
-
const t =
|
|
2867
|
-
return
|
|
2868
|
-
},
|
|
2869
|
-
const t =
|
|
2880
|
+
), yi = /* @__PURE__ */ Ot({
|
|
2881
|
+
...pi.entries,
|
|
2882
|
+
board: gi
|
|
2883
|
+
}), mi = (n) => {
|
|
2884
|
+
const t = wi(n);
|
|
2885
|
+
return Ai(t);
|
|
2886
|
+
}, wi = (n) => {
|
|
2887
|
+
const t = bi(n), e = /* @__PURE__ */ fi(yi, t);
|
|
2870
2888
|
if (!e.success)
|
|
2871
2889
|
throw e.issues;
|
|
2872
2890
|
return e.output;
|
|
2873
|
-
},
|
|
2891
|
+
}, bi = (n) => {
|
|
2874
2892
|
const t = "table", e = "board", s = n.split(`
|
|
2875
2893
|
`).map((a) => a.trim()).filter((a) => a != "");
|
|
2876
2894
|
if (s.length == 0) throw new Error("empty input");
|
|
@@ -2885,17 +2903,17 @@ const Ft = /* @__PURE__ */ D(
|
|
|
2885
2903
|
const c = o.find((l) => a.startsWith(l));
|
|
2886
2904
|
if (c == null) throw new Error(`encountered unexpected line ${a}`);
|
|
2887
2905
|
if (o = o.filter((l) => !a.startsWith(l)), c == e) {
|
|
2888
|
-
const [l, u] =
|
|
2906
|
+
const [l, u] = Ei([...s]);
|
|
2889
2907
|
i.board = l;
|
|
2890
2908
|
for (let h = 0; h < u; h++) s.shift();
|
|
2891
2909
|
} else {
|
|
2892
|
-
const [l, u] =
|
|
2910
|
+
const [l, u] = _i([...s]);
|
|
2893
2911
|
i[c] = l;
|
|
2894
2912
|
for (let h = 0; h < u; h++) s.shift();
|
|
2895
2913
|
}
|
|
2896
2914
|
}
|
|
2897
2915
|
return i;
|
|
2898
|
-
}, U = (n, t) => n.replace(t, "").replace(":", "").trim(),
|
|
2916
|
+
}, U = (n, t) => n.replace(t, "").replace(":", "").trim(), _i = (n) => {
|
|
2899
2917
|
const t = "hand", e = "discard", s = "score", r = {};
|
|
2900
2918
|
let i = 0;
|
|
2901
2919
|
for (; i < n.length; i++) {
|
|
@@ -2906,7 +2924,7 @@ const Ft = /* @__PURE__ */ D(
|
|
|
2906
2924
|
else break;
|
|
2907
2925
|
}
|
|
2908
2926
|
return [r, i];
|
|
2909
|
-
},
|
|
2927
|
+
}, Ei = (n) => {
|
|
2910
2928
|
const t = "doras", e = "round", s = "front", r = "sticks", i = "reach", o = "dead", a = {};
|
|
2911
2929
|
let c = 0;
|
|
2912
2930
|
for (; c < n.length; c++) {
|
|
@@ -2924,8 +2942,8 @@ const Ft = /* @__PURE__ */ D(
|
|
|
2924
2942
|
} else break;
|
|
2925
2943
|
}
|
|
2926
2944
|
return [a, c];
|
|
2927
|
-
},
|
|
2928
|
-
const t = n.board.front, e =
|
|
2945
|
+
}, Ai = (n) => {
|
|
2946
|
+
const t = n.board.front, e = Ni(t), s = (a) => n[a].discard.replace(/\r?\n/g, ""), r = {
|
|
2929
2947
|
front: new B(s(e.front)).tiles(),
|
|
2930
2948
|
right: new B(s(e.right)).tiles(),
|
|
2931
2949
|
opposite: new B(s(e.opposite)).tiles(),
|
|
@@ -2948,10 +2966,10 @@ const Ft = /* @__PURE__ */ D(
|
|
|
2948
2966
|
}
|
|
2949
2967
|
};
|
|
2950
2968
|
return { discards: r, hands: i, scoreBoard: o };
|
|
2951
|
-
},
|
|
2969
|
+
}, Ni = (n) => ({
|
|
2952
2970
|
front: n,
|
|
2953
|
-
right:
|
|
2954
|
-
opposite:
|
|
2971
|
+
right: Nt(n),
|
|
2972
|
+
opposite: Nt(Nt(n)),
|
|
2955
2973
|
left: De(n)
|
|
2956
2974
|
});
|
|
2957
2975
|
function* z(n) {
|
|
@@ -3012,7 +3030,7 @@ class Ue {
|
|
|
3012
3030
|
const e = this.drawn, s = t.findIndex(
|
|
3013
3031
|
(r) => r.equals(e) && e.has(y.RED) == r.has(y.RED)
|
|
3014
3032
|
);
|
|
3015
|
-
|
|
3033
|
+
S(
|
|
3016
3034
|
s >= 0,
|
|
3017
3035
|
`hand has drawn: ${this.drawn} but no tile in hands: ${t.join("")}`
|
|
3018
3036
|
), t[s] = t[s].clone({ add: y.TSUMO });
|
|
@@ -3154,8 +3172,8 @@ class de {
|
|
|
3154
3172
|
for (const g of [u.patternA, u.patternB])
|
|
3155
3173
|
for (const f of [h.patternA, h.patternB]) {
|
|
3156
3174
|
const m = [this.hand.called.length, 0, 0];
|
|
3157
|
-
for (let
|
|
3158
|
-
m[
|
|
3175
|
+
for (let N = 0; N < 3; N++)
|
|
3176
|
+
m[N] += d[N] + g[N] + f[N] + r[N] + i[N];
|
|
3159
3177
|
const E = this.calcCommon(m[0], m[1], m[2], s);
|
|
3160
3178
|
E < c && (c = E);
|
|
3161
3179
|
}
|
|
@@ -3200,7 +3218,7 @@ class de {
|
|
|
3200
3218
|
return t > 4 && (e += t - 4, t = 4), t + e > 4 && (s += t + e - 4, e = 4 - t), t + e + s > i && (s = i - t - e), r && e++, 13 - t * 3 - e * 2 - s;
|
|
3201
3219
|
}
|
|
3202
3220
|
}
|
|
3203
|
-
class
|
|
3221
|
+
class Si {
|
|
3204
3222
|
constructor(t) {
|
|
3205
3223
|
_(this, "hand");
|
|
3206
3224
|
this.hand = t;
|
|
@@ -3252,7 +3270,7 @@ class Ai {
|
|
|
3252
3270
|
const r = this.hand.get(e, s);
|
|
3253
3271
|
if (r == 2) {
|
|
3254
3272
|
const i = this.hand.dec(new Array(2).fill(new w(e, s)));
|
|
3255
|
-
t.push(new
|
|
3273
|
+
t.push(new P(i[0], i[1])), this.hand.inc(i);
|
|
3256
3274
|
} else {
|
|
3257
3275
|
if (r == 0) continue;
|
|
3258
3276
|
return [];
|
|
@@ -3270,7 +3288,7 @@ class Ai {
|
|
|
3270
3288
|
if (this.hand.get(s, i) == 1)
|
|
3271
3289
|
t.push(new kn(new w(s, i)));
|
|
3272
3290
|
else if (this.hand.get(s, i) == 2 && e == !1)
|
|
3273
|
-
t.unshift(new
|
|
3291
|
+
t.unshift(new P(new w(s, i), new w(s, i))), e = !0;
|
|
3274
3292
|
else return [];
|
|
3275
3293
|
}
|
|
3276
3294
|
return [t];
|
|
@@ -3289,25 +3307,25 @@ class Ai {
|
|
|
3289
3307
|
let t = [];
|
|
3290
3308
|
for (const [e, s] of z())
|
|
3291
3309
|
if (this.hand.get(e, s) >= 2) {
|
|
3292
|
-
const r =
|
|
3293
|
-
|
|
3310
|
+
const r = new Array(2).fill(new w(e, s));
|
|
3311
|
+
s == 5 && this.hand.get(e, 0) > 0 && this.hand.get(e, s) >= 3 && (r[1] = new w(e, s, [y.RED]));
|
|
3312
|
+
const i = this.hand.dec(r), o = this.patternAll().filter((a) => a.length == 4).map((a) => (a.unshift(new P(i[0], i[1])), a));
|
|
3313
|
+
t = [...t, ...o], this.hand.inc(i);
|
|
3294
3314
|
}
|
|
3295
3315
|
return t;
|
|
3296
3316
|
}
|
|
3297
3317
|
patternAll() {
|
|
3298
|
-
|
|
3299
|
-
this.addRedPattern(p.M, this.handleNumType(
|
|
3300
|
-
this.addRedPattern(p.P, this.handleNumType(
|
|
3301
|
-
this.addRedPattern(p.S, this.handleNumType(
|
|
3318
|
+
return [
|
|
3319
|
+
this.addRedPattern(p.M, this.handleNumType(p.M)),
|
|
3320
|
+
this.addRedPattern(p.P, this.handleNumType(p.P)),
|
|
3321
|
+
this.addRedPattern(p.S, this.handleNumType(p.S)),
|
|
3302
3322
|
this.handleZ(),
|
|
3303
3323
|
this.handleBack(),
|
|
3304
3324
|
[this.hand.called.concat()]
|
|
3305
|
-
].sort((s, r) => r.length - s.length)
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
e[s] = [...e[s], ...i];
|
|
3310
|
-
return e;
|
|
3325
|
+
].sort((s, r) => r.length - s.length).reduce(
|
|
3326
|
+
(s, r) => r.length === 0 ? s : s.flatMap((i) => r.map((o) => [...i, ...o])),
|
|
3327
|
+
[[]]
|
|
3328
|
+
);
|
|
3311
3329
|
}
|
|
3312
3330
|
// handle back tiles as same unknown tiles, Not joker tile.
|
|
3313
3331
|
handleBack() {
|
|
@@ -3329,59 +3347,58 @@ class Ai {
|
|
|
3329
3347
|
// TODO similar to markDrawn
|
|
3330
3348
|
addRedPattern(t, e) {
|
|
3331
3349
|
if (!(this.hand.get(t, 0) > 0 && this.hand.get(t, 5) >= 2)) return e;
|
|
3332
|
-
const s = new w(t, 5), r = new w(t, 5, [y.RED]), i = [];
|
|
3333
|
-
let o = [-1, -1, -1];
|
|
3350
|
+
const s = new w(t, 5), r = new w(t, 5, [y.RED]), i = [], o = [];
|
|
3334
3351
|
for (let c = 0; c < e.length; c++) {
|
|
3335
3352
|
const l = e[c], u = {};
|
|
3336
3353
|
for (let h = 0; h < l.length; h++) {
|
|
3337
3354
|
const d = l[h], g = d.tiles.findIndex(
|
|
3338
3355
|
(E) => E.equals(s) && !E.has(y.RED)
|
|
3339
3356
|
), f = d.tiles.findIndex((E) => E.equals(r) && E.has(y.RED));
|
|
3340
|
-
if (f > -1 && (
|
|
3357
|
+
if (f > -1 && o.push([c, h, f]), f > -1 && g > -1 || g < 0) continue;
|
|
3341
3358
|
const m = Bt(d);
|
|
3342
3359
|
u[m] || (u[m] = !0, i.push([c, h, g]));
|
|
3343
3360
|
}
|
|
3344
3361
|
}
|
|
3362
|
+
if (o.length == 0) return e;
|
|
3345
3363
|
const a = [];
|
|
3346
3364
|
for (const [c, l, u] of i) {
|
|
3347
3365
|
const d = [...e[c]], g = d[l];
|
|
3348
3366
|
d[l] = g.clone({
|
|
3349
3367
|
replace: { idx: u, tile: r }
|
|
3350
3368
|
});
|
|
3351
|
-
const f =
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3369
|
+
const f = o.find((E) => E[0] == c);
|
|
3370
|
+
if (f == null) continue;
|
|
3371
|
+
const m = d[f[1]];
|
|
3372
|
+
m == null && console.error(f, i), d[f[1]] = m.clone({
|
|
3373
|
+
replace: { idx: f[2], tile: s }
|
|
3374
|
+
}), Bt(g) != Bt(m) && a.push(d);
|
|
3355
3375
|
}
|
|
3356
3376
|
return [...e, ...a];
|
|
3357
3377
|
}
|
|
3358
|
-
handleNumType(t) {
|
|
3359
|
-
|
|
3360
|
-
if (
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
if (this.hand.get(e,
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
new w(e, s),
|
|
3369
|
-
new w(e, s + 1),
|
|
3370
|
-
new w(e, s + 2)
|
|
3378
|
+
handleNumType(t, e = 1) {
|
|
3379
|
+
if (e > 9) return [];
|
|
3380
|
+
if (this.hand.get(t, e) == 0)
|
|
3381
|
+
return this.handleNumType(t, e + 1);
|
|
3382
|
+
const s = [];
|
|
3383
|
+
if (e <= 7 && this.hand.get(t, e) > 0 && this.hand.get(t, e + 1) > 0 && this.hand.get(t, e + 2) > 0) {
|
|
3384
|
+
const r = this.hand.dec([
|
|
3385
|
+
new w(t, e),
|
|
3386
|
+
new w(t, e + 1),
|
|
3387
|
+
new w(t, e + 2)
|
|
3371
3388
|
]);
|
|
3372
|
-
let
|
|
3373
|
-
this.hand.inc(
|
|
3374
|
-
for (const
|
|
3375
|
-
|
|
3389
|
+
let i = this.handleNumType(t, e);
|
|
3390
|
+
this.hand.inc(r), i.length == 0 && (i = [[]]);
|
|
3391
|
+
for (const o of i)
|
|
3392
|
+
o.unshift(new ut([r[0], r[1], r[2]])), s.push(o);
|
|
3376
3393
|
}
|
|
3377
|
-
if (this.hand.get(
|
|
3378
|
-
const
|
|
3379
|
-
let
|
|
3380
|
-
this.hand.inc(
|
|
3381
|
-
for (const
|
|
3382
|
-
|
|
3394
|
+
if (this.hand.get(t, e) == 3) {
|
|
3395
|
+
const r = this.hand.dec(new Array(3).fill(new w(t, e)));
|
|
3396
|
+
let i = this.handleNumType(t, e);
|
|
3397
|
+
this.hand.inc(r), i.length == 0 && (i = [[]]);
|
|
3398
|
+
for (const o of i)
|
|
3399
|
+
o.unshift(new F([r[0], r[1], r[2]])), s.push(o);
|
|
3383
3400
|
}
|
|
3384
|
-
return
|
|
3401
|
+
return s;
|
|
3385
3402
|
}
|
|
3386
3403
|
}
|
|
3387
3404
|
const Lt = [1, 2, 3, 4, 5, 6, 7], V = [1, 9], Zt = (n) => {
|
|
@@ -3415,6 +3432,7 @@ class pn {
|
|
|
3415
3432
|
finalDiscardWin: e.finalDiscardWin ?? !1,
|
|
3416
3433
|
oneShotWin: e.oneShotWin ?? !1,
|
|
3417
3434
|
roundUp8000: e.roundUp8000 ?? !1,
|
|
3435
|
+
disableCountable32000: e.disableCountable32000 ?? !1,
|
|
3418
3436
|
orig: e
|
|
3419
3437
|
};
|
|
3420
3438
|
}
|
|
@@ -3423,7 +3441,7 @@ class pn {
|
|
|
3423
3441
|
if (e.length == 0) return !1;
|
|
3424
3442
|
let s = [0, 0], r = 0;
|
|
3425
3443
|
for (let f = 0; f < e.length; f++) {
|
|
3426
|
-
const m = e[f], E = m.points.reduce((
|
|
3444
|
+
const m = e[f], E = m.points.reduce((N, O) => N + O.double, 0);
|
|
3427
3445
|
E > s[0] ? (r = f, s = [E, m.fu]) : E == s[0] && m.fu > s[1] && (r = f, s = [E, m.fu]);
|
|
3428
3446
|
}
|
|
3429
3447
|
const i = (f, m = 100) => Math.ceil(f / m) * m, o = s[1] != 25 ? i(s[1], 10) : 25, a = s[0];
|
|
@@ -3452,10 +3470,10 @@ class pn {
|
|
|
3452
3470
|
c = 2e3;
|
|
3453
3471
|
break;
|
|
3454
3472
|
}
|
|
3455
|
-
a
|
|
3473
|
+
a >= 13 && a < 26 && (c = 8e3, this.cfg.disableCountable32000 && e[r].points.length > 1 && (c = 6e3)), this.cfg.roundUp8000 && (o == 30 && a == 4 || o == 60 && a == 3) && (c = 2e3);
|
|
3456
3474
|
const l = e[r].hand.some(
|
|
3457
3475
|
(f) => f.tiles.some((m) => m.has(y.TSUMO))
|
|
3458
|
-
), u = this.cfg.orig.myWind, h = u == A.E, d =
|
|
3476
|
+
), u = this.cfg.orig.myWind, h = u == A.E, d = H(0);
|
|
3459
3477
|
if (l) {
|
|
3460
3478
|
const f = this.cfg.sticks.dead * 100;
|
|
3461
3479
|
if (h) {
|
|
@@ -3464,8 +3482,8 @@ class pn {
|
|
|
3464
3482
|
} else
|
|
3465
3483
|
for (const m of Object.values(A)) {
|
|
3466
3484
|
if (m == u) continue;
|
|
3467
|
-
const E = m == A.E ? 2 : 1,
|
|
3468
|
-
d[m] -=
|
|
3485
|
+
const E = m == A.E ? 2 : 1, N = i(c * E) + f;
|
|
3486
|
+
d[m] -= N, d[u] += N;
|
|
3469
3487
|
}
|
|
3470
3488
|
} else {
|
|
3471
3489
|
const f = this.cfg.sticks.dead * 300;
|
|
@@ -3569,7 +3587,7 @@ class pn {
|
|
|
3569
3587
|
dF1(t) {
|
|
3570
3588
|
const e = [];
|
|
3571
3589
|
return t.forEach((s) => {
|
|
3572
|
-
if (s instanceof
|
|
3590
|
+
if (s instanceof P) return;
|
|
3573
3591
|
const r = s.tiles[0];
|
|
3574
3592
|
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 }));
|
|
3575
3593
|
}), e;
|
|
@@ -3623,7 +3641,7 @@ class pn {
|
|
|
3623
3641
|
}
|
|
3624
3642
|
dC2(t) {
|
|
3625
3643
|
return t.length == 7 ? [] : t.every(
|
|
3626
|
-
(s) => s instanceof M || s instanceof K || s instanceof Y || s instanceof F || s instanceof X || s instanceof
|
|
3644
|
+
(s) => s instanceof M || s instanceof K || s instanceof Y || s instanceof F || s instanceof X || s instanceof P
|
|
3627
3645
|
) ? [{ name: "対々和", double: 2 }] : [];
|
|
3628
3646
|
}
|
|
3629
3647
|
dD2(t) {
|
|
@@ -3652,7 +3670,7 @@ class pn {
|
|
|
3652
3670
|
return [];
|
|
3653
3671
|
}
|
|
3654
3672
|
dG2(t) {
|
|
3655
|
-
return t.filter((s) => {
|
|
3673
|
+
return t.length == 7 ? [] : t.filter((s) => {
|
|
3656
3674
|
const r = s.tiles[0];
|
|
3657
3675
|
return r.t == p.Z && [5, 6, 7].includes(r.n);
|
|
3658
3676
|
}).length == 3 ? [{ name: "小三元", double: 2 }] : [];
|
|
@@ -3707,7 +3725,7 @@ class pn {
|
|
|
3707
3725
|
}
|
|
3708
3726
|
dA13(t) {
|
|
3709
3727
|
return t.length != 13 ? [] : t.some(
|
|
3710
|
-
(s) => s instanceof
|
|
3728
|
+
(s) => s instanceof P && s.tiles.some((r) => r.has(y.TSUMO) || r.has(y.RON))
|
|
3711
3729
|
) ? [{ name: "国士無双13面待ち", double: 26 }] : [{ name: "国士無双", double: 13 }];
|
|
3712
3730
|
}
|
|
3713
3731
|
dB13(t) {
|
|
@@ -3715,16 +3733,16 @@ class pn {
|
|
|
3715
3733
|
}
|
|
3716
3734
|
dC13(t) {
|
|
3717
3735
|
return t.length == 7 ? [] : t.every(
|
|
3718
|
-
(r) => r instanceof M || r instanceof F && !r.tiles.some((i) => i.has(y.RON)) || r instanceof
|
|
3736
|
+
(r) => r instanceof M || r instanceof F && !r.tiles.some((i) => i.has(y.RON)) || r instanceof P
|
|
3719
3737
|
) ? t.some(
|
|
3720
|
-
(r) => r instanceof
|
|
3738
|
+
(r) => r instanceof P && r.tiles.every((i) => i.has(y.TSUMO) || i.has(y.RON))
|
|
3721
3739
|
) ? [{ name: "四暗刻単騎待ち", double: 26 }] : [{ name: "四暗刻", double: 13 }] : [];
|
|
3722
3740
|
}
|
|
3723
3741
|
dD13(t) {
|
|
3724
3742
|
if (t.length == 13) return [];
|
|
3725
3743
|
const e = [5, 6, 7];
|
|
3726
3744
|
return t.filter(
|
|
3727
|
-
(r) => !(r instanceof
|
|
3745
|
+
(r) => !(r instanceof P) && r.tiles.some((i) => i.t == p.Z && e.includes(i.n))
|
|
3728
3746
|
).length == 3 ? [{ name: "大三元", double: 13 }] : [];
|
|
3729
3747
|
}
|
|
3730
3748
|
dE13(t) {
|
|
@@ -3744,7 +3762,7 @@ class pn {
|
|
|
3744
3762
|
if (t.length == 13) return [];
|
|
3745
3763
|
if (t.length == 7) return [];
|
|
3746
3764
|
const e = [1, 2, 3, 4];
|
|
3747
|
-
return t.filter((i) => i.tiles.some((o) => o.t == p.Z && e.includes(o.n))).length == 4 ? t.find((i) => i instanceof
|
|
3765
|
+
return t.filter((i) => i.tiles.some((o) => o.t == p.Z && e.includes(o.n))).length == 4 ? t.find((i) => i instanceof P).tiles.some((i) => i.t == p.Z && e.includes(i.n)) ? [{ name: "小四喜", double: 13 }] : [{ name: "大四喜", double: 13 }] : [];
|
|
3748
3766
|
}
|
|
3749
3767
|
dI13(t) {
|
|
3750
3768
|
const e = (s) => !!(s.equals(new w(p.Z, 6)) || s.t == p.S && [2, 3, 4, 6, 8].includes(s.n));
|
|
@@ -3785,12 +3803,12 @@ class pn {
|
|
|
3785
3803
|
}
|
|
3786
3804
|
s += ((f) => {
|
|
3787
3805
|
if (f instanceof F) return 0;
|
|
3788
|
-
if (f instanceof
|
|
3789
|
-
const m = f.tiles, E = m.findIndex((
|
|
3806
|
+
if (f instanceof P) return 2;
|
|
3807
|
+
const m = f.tiles, E = m.findIndex((N) => N.has(y.TSUMO) || N.has(y.RON));
|
|
3790
3808
|
return E == 1 || E == 0 && m[2].n == 9 || E == 2 && m[0].n == 1 ? 2 : 0;
|
|
3791
3809
|
})(o);
|
|
3792
|
-
const d = t.find((f) => f instanceof
|
|
3793
|
-
d.t == p.Z && ([5, 6, 7].includes(d.n) && (s += 2), d.n == i
|
|
3810
|
+
const d = t.find((f) => f instanceof P).tiles[0];
|
|
3811
|
+
d.t == p.Z && ([5, 6, 7].includes(d.n) && (s += 2), (d.n == i || d.n == r) && (s += 2));
|
|
3794
3812
|
let g = !1;
|
|
3795
3813
|
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;
|
|
3796
3814
|
}
|
|
@@ -3818,7 +3836,7 @@ class zt {
|
|
|
3818
3836
|
// ツモった後の14枚の手配から、牌効率に従って捨てるべき牌を返す。
|
|
3819
3837
|
// choices は、通常なら hand.hand を指定する。ただし、リーチしている場合は捨てる牌が限られているので choices で制限する。
|
|
3820
3838
|
static calcCandidates(t, e, s) {
|
|
3821
|
-
|
|
3839
|
+
S(e.length > 0, "choices to discard is zero");
|
|
3822
3840
|
const r = /* @__PURE__ */ new Map();
|
|
3823
3841
|
let i = 1 / 0;
|
|
3824
3842
|
for (const o of e) {
|
|
@@ -3872,7 +3890,7 @@ const ke = () => {
|
|
|
3872
3890
|
}
|
|
3873
3891
|
};
|
|
3874
3892
|
};
|
|
3875
|
-
function
|
|
3893
|
+
function vi(n) {
|
|
3876
3894
|
var i;
|
|
3877
3895
|
const t = ["RON", "DAI_KAN", "PON", "CHI"], e = n.map((o) => o.choices), r = Zn(e, t).map((o) => n[o]);
|
|
3878
3896
|
return {
|
|
@@ -3880,7 +3898,7 @@ function Si(n) {
|
|
|
3880
3898
|
type: Gn(t, (i = r[0]) == null ? void 0 : i.choices)
|
|
3881
3899
|
};
|
|
3882
3900
|
}
|
|
3883
|
-
function
|
|
3901
|
+
function Ti(n) {
|
|
3884
3902
|
var i;
|
|
3885
3903
|
const t = [
|
|
3886
3904
|
"TSUMO",
|
|
@@ -3899,17 +3917,17 @@ function Zn(n, t) {
|
|
|
3899
3917
|
let e = [], s = Number.POSITIVE_INFINITY;
|
|
3900
3918
|
for (let r = 0; r < n.length; r++) {
|
|
3901
3919
|
const i = n[r];
|
|
3902
|
-
if (
|
|
3903
|
-
const o =
|
|
3920
|
+
if (Ii(i, t)) {
|
|
3921
|
+
const o = Oi(t, i);
|
|
3904
3922
|
o < s ? (s = o, e = [r]) : o === s && e.push(r);
|
|
3905
3923
|
}
|
|
3906
3924
|
}
|
|
3907
3925
|
return e;
|
|
3908
3926
|
}
|
|
3909
|
-
function
|
|
3927
|
+
function Ii(n, t) {
|
|
3910
3928
|
return t.some((e) => !!n[e]);
|
|
3911
3929
|
}
|
|
3912
|
-
function
|
|
3930
|
+
function Oi(n, t) {
|
|
3913
3931
|
for (let e = 0; e < n.length; e++) {
|
|
3914
3932
|
const s = n[e];
|
|
3915
3933
|
if (t[s]) return e;
|
|
@@ -3931,7 +3949,7 @@ const Gt = () => {
|
|
|
3931
3949
|
on: (r) => n.on(r)
|
|
3932
3950
|
};
|
|
3933
3951
|
return [e, s];
|
|
3934
|
-
},
|
|
3952
|
+
}, ki = () => {
|
|
3935
3953
|
const n = ke();
|
|
3936
3954
|
return {
|
|
3937
3955
|
emit: (s) => {
|
|
@@ -3964,7 +3982,7 @@ class re {
|
|
|
3964
3982
|
class ie {
|
|
3965
3983
|
constructor(t, e) {
|
|
3966
3984
|
_(this, "pToW", {});
|
|
3967
|
-
_(this, "wToP",
|
|
3985
|
+
_(this, "wToP", H(""));
|
|
3968
3986
|
_(this, "round");
|
|
3969
3987
|
_(this, "sticks");
|
|
3970
3988
|
this.round = (e == null ? void 0 : e.round) ?? k.E1, this.sticks = structuredClone(e == null ? void 0 : e.sticks) ?? { reach: 0, dead: 0 }, this.pToW = structuredClone(t);
|
|
@@ -4012,10 +4030,10 @@ function Vn(n) {
|
|
|
4012
4030
|
}
|
|
4013
4031
|
return n;
|
|
4014
4032
|
}
|
|
4015
|
-
class
|
|
4033
|
+
class Ci {
|
|
4016
4034
|
constructor(t = !1) {
|
|
4017
4035
|
_(this, "c");
|
|
4018
|
-
_(this, "safeMap",
|
|
4036
|
+
_(this, "safeMap", H({}, !0));
|
|
4019
4037
|
this.disable = t, this.c = this.initial();
|
|
4020
4038
|
}
|
|
4021
4039
|
get(t) {
|
|
@@ -4066,7 +4084,7 @@ class Jn {
|
|
|
4066
4084
|
}
|
|
4067
4085
|
get lastTile() {
|
|
4068
4086
|
const t = this.m.at(-1);
|
|
4069
|
-
return
|
|
4087
|
+
return S(
|
|
4070
4088
|
t != null,
|
|
4071
4089
|
`lastTile is null(${t}). river: ${JSON.stringify(this.m, null, 2)}`
|
|
4072
4090
|
), t;
|
|
@@ -4083,7 +4101,7 @@ class Jn {
|
|
|
4083
4101
|
return !0;
|
|
4084
4102
|
}
|
|
4085
4103
|
}
|
|
4086
|
-
function
|
|
4104
|
+
function Ri() {
|
|
4087
4105
|
if (typeof globalThis < "u")
|
|
4088
4106
|
return globalThis;
|
|
4089
4107
|
if (typeof self < "u")
|
|
@@ -4093,15 +4111,15 @@ function ki() {
|
|
|
4093
4111
|
if (typeof global < "u")
|
|
4094
4112
|
return global;
|
|
4095
4113
|
}
|
|
4096
|
-
function
|
|
4097
|
-
const n =
|
|
4114
|
+
function xi() {
|
|
4115
|
+
const n = Ri();
|
|
4098
4116
|
if (n.__xstate__)
|
|
4099
4117
|
return n.__xstate__;
|
|
4100
4118
|
}
|
|
4101
|
-
const
|
|
4119
|
+
const Mi = (n) => {
|
|
4102
4120
|
if (typeof window > "u")
|
|
4103
4121
|
return;
|
|
4104
|
-
const t =
|
|
4122
|
+
const t = xi();
|
|
4105
4123
|
t && t.register(n);
|
|
4106
4124
|
};
|
|
4107
4125
|
class mn {
|
|
@@ -4133,8 +4151,8 @@ class mn {
|
|
|
4133
4151
|
this._last = null;
|
|
4134
4152
|
}
|
|
4135
4153
|
}
|
|
4136
|
-
const Xn = ".",
|
|
4137
|
-
function
|
|
4154
|
+
const Xn = ".", $i = "", Yn = "", Hi = "#", Pi = "*", qn = "xstate.init", Ce = "xstate.stop";
|
|
4155
|
+
function Wi(n, t) {
|
|
4138
4156
|
return {
|
|
4139
4157
|
type: `xstate.after.${n}.${t}`
|
|
4140
4158
|
};
|
|
@@ -4145,14 +4163,14 @@ function Re(n, t) {
|
|
|
4145
4163
|
output: t
|
|
4146
4164
|
};
|
|
4147
4165
|
}
|
|
4148
|
-
function
|
|
4166
|
+
function Bi(n, t) {
|
|
4149
4167
|
return {
|
|
4150
4168
|
type: `xstate.done.actor.${n}`,
|
|
4151
4169
|
output: t,
|
|
4152
4170
|
actorId: n
|
|
4153
4171
|
};
|
|
4154
4172
|
}
|
|
4155
|
-
function
|
|
4173
|
+
function Di(n, t) {
|
|
4156
4174
|
return {
|
|
4157
4175
|
type: `xstate.error.actor.${n}`,
|
|
4158
4176
|
error: t,
|
|
@@ -4170,7 +4188,7 @@ function G(n) {
|
|
|
4170
4188
|
throw n;
|
|
4171
4189
|
});
|
|
4172
4190
|
}
|
|
4173
|
-
const
|
|
4191
|
+
const Ki = typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
4174
4192
|
function ts(n, t) {
|
|
4175
4193
|
const e = wn(n), s = wn(t);
|
|
4176
4194
|
return typeof s == "string" ? typeof e == "string" ? s === e : !1 : typeof e == "string" ? e in s : Object.keys(e).every((r) => r in s ? ts(e[r], s[r]) : !1);
|
|
@@ -4196,14 +4214,14 @@ function Fe(n) {
|
|
|
4196
4214
|
return t.push(e), t;
|
|
4197
4215
|
}
|
|
4198
4216
|
function wn(n) {
|
|
4199
|
-
if (
|
|
4217
|
+
if (Eo(n))
|
|
4200
4218
|
return n.value;
|
|
4201
4219
|
if (typeof n != "string")
|
|
4202
4220
|
return n;
|
|
4203
4221
|
const t = Fe(n);
|
|
4204
|
-
return
|
|
4222
|
+
return Li(t);
|
|
4205
4223
|
}
|
|
4206
|
-
function
|
|
4224
|
+
function Li(n) {
|
|
4207
4225
|
if (n.length === 1)
|
|
4208
4226
|
return n[0];
|
|
4209
4227
|
const t = {};
|
|
@@ -4241,7 +4259,7 @@ function xe(n, t, e, s) {
|
|
|
4241
4259
|
function ns(n) {
|
|
4242
4260
|
return Array.isArray(n);
|
|
4243
4261
|
}
|
|
4244
|
-
function
|
|
4262
|
+
function zi(n) {
|
|
4245
4263
|
return n.type.startsWith("xstate.error.actor");
|
|
4246
4264
|
}
|
|
4247
4265
|
function Et(n) {
|
|
@@ -4250,7 +4268,7 @@ function Et(n) {
|
|
|
4250
4268
|
} : t);
|
|
4251
4269
|
}
|
|
4252
4270
|
function ss(n) {
|
|
4253
|
-
if (!(n === void 0 || n ===
|
|
4271
|
+
if (!(n === void 0 || n === $i))
|
|
4254
4272
|
return Q(n);
|
|
4255
4273
|
}
|
|
4256
4274
|
function Me(n, t, e) {
|
|
@@ -4275,14 +4293,14 @@ function Ze(n, t) {
|
|
|
4275
4293
|
function En(n, t) {
|
|
4276
4294
|
return `${n.sessionId}.${t}`;
|
|
4277
4295
|
}
|
|
4278
|
-
let
|
|
4279
|
-
function
|
|
4296
|
+
let ji = 0;
|
|
4297
|
+
function Ui(n, t) {
|
|
4280
4298
|
const e = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new Set(), o = {}, {
|
|
4281
4299
|
clock: a,
|
|
4282
4300
|
logger: c
|
|
4283
4301
|
} = t, l = {
|
|
4284
4302
|
schedule: (d, g, f, m, E = Math.random().toString(36).slice(2)) => {
|
|
4285
|
-
const
|
|
4303
|
+
const N = {
|
|
4286
4304
|
source: d,
|
|
4287
4305
|
target: g,
|
|
4288
4306
|
event: f,
|
|
@@ -4290,7 +4308,7 @@ function zi(n, t) {
|
|
|
4290
4308
|
id: E,
|
|
4291
4309
|
startedAt: Date.now()
|
|
4292
4310
|
}, O = En(d, E);
|
|
4293
|
-
h._snapshot._scheduledEvents[O] =
|
|
4311
|
+
h._snapshot._scheduledEvents[O] = N;
|
|
4294
4312
|
const R = a.setTimeout(() => {
|
|
4295
4313
|
delete o[O], delete h._snapshot._scheduledEvents[O], h._relay(d, g, f);
|
|
4296
4314
|
}, m);
|
|
@@ -4321,7 +4339,7 @@ function zi(n, t) {
|
|
|
4321
4339
|
_snapshot: {
|
|
4322
4340
|
_scheduledEvents: ((t == null ? void 0 : t.snapshot) && t.snapshot.scheduler) ?? {}
|
|
4323
4341
|
},
|
|
4324
|
-
_bookId: () => `x:${
|
|
4342
|
+
_bookId: () => `x:${ji++}`,
|
|
4325
4343
|
_register: (d, g) => (e.set(d, g), d),
|
|
4326
4344
|
_unregister: (d) => {
|
|
4327
4345
|
e.delete(d.sessionId);
|
|
@@ -4366,10 +4384,10 @@ function zi(n, t) {
|
|
|
4366
4384
|
source: f,
|
|
4367
4385
|
target: m,
|
|
4368
4386
|
event: E,
|
|
4369
|
-
delay:
|
|
4387
|
+
delay: N,
|
|
4370
4388
|
id: O
|
|
4371
4389
|
} = d[g];
|
|
4372
|
-
l.schedule(f, m, E,
|
|
4390
|
+
l.schedule(f, m, E, N, O);
|
|
4373
4391
|
}
|
|
4374
4392
|
},
|
|
4375
4393
|
_clock: a,
|
|
@@ -4382,7 +4400,7 @@ const Ge = 1;
|
|
|
4382
4400
|
let $ = /* @__PURE__ */ function(n) {
|
|
4383
4401
|
return n[n.NotStarted = 0] = "NotStarted", n[n.Running = 1] = "Running", n[n.Stopped = 2] = "Stopped", n;
|
|
4384
4402
|
}({});
|
|
4385
|
-
const
|
|
4403
|
+
const Fi = {
|
|
4386
4404
|
clock: {
|
|
4387
4405
|
setTimeout: (n, t) => setTimeout(n, t),
|
|
4388
4406
|
clearTimeout: (n) => clearTimeout(n)
|
|
@@ -4390,7 +4408,7 @@ const ji = {
|
|
|
4390
4408
|
logger: console.log.bind(console),
|
|
4391
4409
|
devTools: !1
|
|
4392
4410
|
};
|
|
4393
|
-
class
|
|
4411
|
+
class Zi {
|
|
4394
4412
|
/**
|
|
4395
4413
|
* Creates a new actor instance for the given logic with the provided options,
|
|
4396
4414
|
* if any.
|
|
@@ -4401,7 +4419,7 @@ class Ui {
|
|
|
4401
4419
|
constructor(t, e) {
|
|
4402
4420
|
this.logic = t, this._snapshot = void 0, this.clock = void 0, this.options = void 0, this.id = void 0, this.mailbox = new mn(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 = [];
|
|
4403
4421
|
const s = {
|
|
4404
|
-
...
|
|
4422
|
+
...Fi,
|
|
4405
4423
|
...e
|
|
4406
4424
|
}, {
|
|
4407
4425
|
clock: r,
|
|
@@ -4412,7 +4430,7 @@ class Ui {
|
|
|
4412
4430
|
systemId: l,
|
|
4413
4431
|
inspect: u
|
|
4414
4432
|
} = s;
|
|
4415
|
-
this.system = o ? o.system :
|
|
4433
|
+
this.system = o ? o.system : Ui(this, {
|
|
4416
4434
|
clock: r,
|
|
4417
4435
|
logger: i
|
|
4418
4436
|
}), u && !o && this.system.inspect(Me(u)), this.sessionId = this.system._bookId(), this.id = c ?? this.sessionId, this.logger = (e == null ? void 0 : e.logger) ?? this.system._logger, this.clock = (e == null ? void 0 : e.clock) ?? this.system._clock, this._parent = o, this._syncSnapshot = a, this.options = s, this.src = s.src ?? t, this.ref = this, this._actorScope = {
|
|
@@ -4504,7 +4522,7 @@ class Ui {
|
|
|
4504
4522
|
} catch (a) {
|
|
4505
4523
|
G(a);
|
|
4506
4524
|
}
|
|
4507
|
-
this._stopProcedure(), this._complete(), this._doneEvent =
|
|
4525
|
+
this._stopProcedure(), this._complete(), this._doneEvent = Bi(this.id, this._snapshot.output), this._parent && this.system._relay(this, this._parent, this._doneEvent);
|
|
4508
4526
|
break;
|
|
4509
4527
|
case "error":
|
|
4510
4528
|
this._error(this._snapshot.error);
|
|
@@ -4718,7 +4736,7 @@ class Ui {
|
|
|
4718
4736
|
this.observers.clear(), e && G(t);
|
|
4719
4737
|
}
|
|
4720
4738
|
_error(t) {
|
|
4721
|
-
this._stopProcedure(), this._reportError(t), this._parent && this.system._relay(this, this._parent,
|
|
4739
|
+
this._stopProcedure(), this._reportError(t), this._parent && this.system._relay(this, this._parent, Di(this.id, t));
|
|
4722
4740
|
}
|
|
4723
4741
|
// TODO: atm children don't belong entirely to the actor so
|
|
4724
4742
|
// in a way - it's not even super aware of them
|
|
@@ -4744,7 +4762,7 @@ class Ui {
|
|
|
4744
4762
|
const {
|
|
4745
4763
|
devTools: t
|
|
4746
4764
|
} = this.options;
|
|
4747
|
-
t && (typeof t == "function" ? t :
|
|
4765
|
+
t && (typeof t == "function" ? t : Mi)(this);
|
|
4748
4766
|
}
|
|
4749
4767
|
toJSON() {
|
|
4750
4768
|
return {
|
|
@@ -4768,7 +4786,7 @@ class Ui {
|
|
|
4768
4786
|
getPersistedSnapshot(t) {
|
|
4769
4787
|
return this.logic.getPersistedSnapshot(this._snapshot, t);
|
|
4770
4788
|
}
|
|
4771
|
-
[
|
|
4789
|
+
[Ki]() {
|
|
4772
4790
|
return this;
|
|
4773
4791
|
}
|
|
4774
4792
|
/**
|
|
@@ -4790,9 +4808,9 @@ class Ui {
|
|
|
4790
4808
|
}
|
|
4791
4809
|
}
|
|
4792
4810
|
function kt(n, ...[t]) {
|
|
4793
|
-
return new
|
|
4811
|
+
return new Zi(n, t);
|
|
4794
4812
|
}
|
|
4795
|
-
function
|
|
4813
|
+
function Gi(n, t, e, s, {
|
|
4796
4814
|
sendId: r
|
|
4797
4815
|
}) {
|
|
4798
4816
|
const i = typeof r == "function" ? r(e, s) : r;
|
|
@@ -4800,17 +4818,17 @@ function Fi(n, t, e, s, {
|
|
|
4800
4818
|
sendId: i
|
|
4801
4819
|
}, void 0];
|
|
4802
4820
|
}
|
|
4803
|
-
function
|
|
4821
|
+
function Vi(n, t) {
|
|
4804
4822
|
n.defer(() => {
|
|
4805
4823
|
n.system.scheduler.cancel(n.self, t.sendId);
|
|
4806
4824
|
});
|
|
4807
4825
|
}
|
|
4808
|
-
function
|
|
4826
|
+
function Ji(n) {
|
|
4809
4827
|
function t(e, s) {
|
|
4810
4828
|
}
|
|
4811
|
-
return t.type = "xstate.cancel", t.sendId = n, t.resolve =
|
|
4829
|
+
return t.type = "xstate.cancel", t.sendId = n, t.resolve = Gi, t.execute = Vi, t;
|
|
4812
4830
|
}
|
|
4813
|
-
function
|
|
4831
|
+
function Xi(n, t, e, s, {
|
|
4814
4832
|
id: r,
|
|
4815
4833
|
systemId: i,
|
|
4816
4834
|
src: o,
|
|
@@ -4843,14 +4861,14 @@ function Vi(n, t, e, s, {
|
|
|
4843
4861
|
input: d
|
|
4844
4862
|
}, void 0];
|
|
4845
4863
|
}
|
|
4846
|
-
function
|
|
4864
|
+
function Yi(n, {
|
|
4847
4865
|
actorRef: t
|
|
4848
4866
|
}) {
|
|
4849
4867
|
t && n.defer(() => {
|
|
4850
4868
|
t._processingStatus !== $.Stopped && t.start();
|
|
4851
4869
|
});
|
|
4852
4870
|
}
|
|
4853
|
-
function
|
|
4871
|
+
function qi(...[n, {
|
|
4854
4872
|
id: t,
|
|
4855
4873
|
systemId: e,
|
|
4856
4874
|
input: s,
|
|
@@ -4858,9 +4876,9 @@ function Xi(...[n, {
|
|
|
4858
4876
|
} = {}]) {
|
|
4859
4877
|
function i(o, a) {
|
|
4860
4878
|
}
|
|
4861
|
-
return i.type = "xstate.spawnChild", i.id = t, i.systemId = e, i.src = n, i.input = s, i.syncSnapshot = r, i.resolve =
|
|
4879
|
+
return i.type = "xstate.spawnChild", i.id = t, i.systemId = e, i.src = n, i.input = s, i.syncSnapshot = r, i.resolve = Xi, i.execute = Yi, i;
|
|
4862
4880
|
}
|
|
4863
|
-
function
|
|
4881
|
+
function Qi(n, t, e, s, {
|
|
4864
4882
|
actorRef: r
|
|
4865
4883
|
}) {
|
|
4866
4884
|
const i = typeof r == "function" ? r(e, s) : r, o = typeof i == "string" ? t.children[i] : i;
|
|
@@ -4871,7 +4889,7 @@ function Yi(n, t, e, s, {
|
|
|
4871
4889
|
children: a
|
|
4872
4890
|
}), o, void 0];
|
|
4873
4891
|
}
|
|
4874
|
-
function
|
|
4892
|
+
function to(n, t) {
|
|
4875
4893
|
if (t) {
|
|
4876
4894
|
if (n.system._unregister(t), t._processingStatus !== $.Running) {
|
|
4877
4895
|
n.stopChild(t);
|
|
@@ -4885,7 +4903,7 @@ function qi(n, t) {
|
|
|
4885
4903
|
function rs(n) {
|
|
4886
4904
|
function t(e, s) {
|
|
4887
4905
|
}
|
|
4888
|
-
return t.type = "xstate.stopChild", t.actorRef = n, t.resolve =
|
|
4906
|
+
return t.type = "xstate.stopChild", t.actorRef = n, t.resolve = Qi, t.execute = to, t;
|
|
4889
4907
|
}
|
|
4890
4908
|
function Ve(n, t, e, s) {
|
|
4891
4909
|
const {
|
|
@@ -4972,10 +4990,10 @@ function as(n, t) {
|
|
|
4972
4990
|
function Xe(n, t) {
|
|
4973
4991
|
return t.type === "compound" ? Ct(t).some((e) => e.type === "final" && n.has(e)) : t.type === "parallel" ? Ct(t).every((e) => Xe(n, e)) : t.type === "final";
|
|
4974
4992
|
}
|
|
4975
|
-
const fe = (n) => n[0] ===
|
|
4976
|
-
function
|
|
4993
|
+
const fe = (n) => n[0] === Hi;
|
|
4994
|
+
function eo(n, t) {
|
|
4977
4995
|
return n.transitions.get(t) || [...n.transitions.keys()].filter((s) => {
|
|
4978
|
-
if (s ===
|
|
4996
|
+
if (s === Pi)
|
|
4979
4997
|
return !0;
|
|
4980
4998
|
if (!s.endsWith(".*"))
|
|
4981
4999
|
return !1;
|
|
@@ -4990,16 +5008,16 @@ function Qi(n, t) {
|
|
|
4990
5008
|
return !0;
|
|
4991
5009
|
}).sort((s, r) => r.length - s.length).flatMap((s) => n.transitions.get(s));
|
|
4992
5010
|
}
|
|
4993
|
-
function
|
|
5011
|
+
function no(n) {
|
|
4994
5012
|
const t = n.config.after;
|
|
4995
5013
|
if (!t)
|
|
4996
5014
|
return [];
|
|
4997
5015
|
const e = (r) => {
|
|
4998
|
-
const i =
|
|
4999
|
-
return n.entry.push(
|
|
5016
|
+
const i = Wi(r, n.id), o = i.type;
|
|
5017
|
+
return n.entry.push(Co(i, {
|
|
5000
5018
|
id: o,
|
|
5001
5019
|
delay: r
|
|
5002
|
-
})), n.exit.push(
|
|
5020
|
+
})), n.exit.push(Ji(o)), o;
|
|
5003
5021
|
};
|
|
5004
5022
|
return Object.keys(t).flatMap((r) => {
|
|
5005
5023
|
const i = t[r], o = typeof i == "string" ? {
|
|
@@ -5021,7 +5039,7 @@ function to(n) {
|
|
|
5021
5039
|
});
|
|
5022
5040
|
}
|
|
5023
5041
|
function ct(n, t, e) {
|
|
5024
|
-
const s = ss(e.target), r = e.reenter ?? !1, i =
|
|
5042
|
+
const s = ss(e.target), r = e.reenter ?? !1, i = io(n, s), o = {
|
|
5025
5043
|
...e,
|
|
5026
5044
|
actions: Q(e.actions),
|
|
5027
5045
|
guard: e.guard,
|
|
@@ -5037,7 +5055,7 @@ function ct(n, t, e) {
|
|
|
5037
5055
|
};
|
|
5038
5056
|
return o;
|
|
5039
5057
|
}
|
|
5040
|
-
function
|
|
5058
|
+
function so(n) {
|
|
5041
5059
|
const t = /* @__PURE__ */ new Map();
|
|
5042
5060
|
if (n.config.on)
|
|
5043
5061
|
for (const e of Object.keys(n.config.on)) {
|
|
@@ -5070,7 +5088,7 @@ function eo(n) {
|
|
|
5070
5088
|
}
|
|
5071
5089
|
return t;
|
|
5072
5090
|
}
|
|
5073
|
-
function
|
|
5091
|
+
function ro(n, t) {
|
|
5074
5092
|
const e = typeof t == "string" ? n.states[t] : t ? n.states[t.target] : void 0;
|
|
5075
5093
|
if (!e && t)
|
|
5076
5094
|
throw new Error(
|
|
@@ -5091,7 +5109,7 @@ function no(n, t) {
|
|
|
5091
5109
|
};
|
|
5092
5110
|
return s;
|
|
5093
5111
|
}
|
|
5094
|
-
function
|
|
5112
|
+
function io(n, t) {
|
|
5095
5113
|
if (t !== void 0)
|
|
5096
5114
|
return t.map((e) => {
|
|
5097
5115
|
if (typeof e != "string")
|
|
@@ -5184,15 +5202,15 @@ function ce(n, t) {
|
|
|
5184
5202
|
return r.concat(a);
|
|
5185
5203
|
}, []));
|
|
5186
5204
|
}
|
|
5187
|
-
function
|
|
5205
|
+
function oo(n, t, e, s) {
|
|
5188
5206
|
const i = Rt(n, t).next(e, s);
|
|
5189
5207
|
return !i || !i.length ? n.next(e, s) : i;
|
|
5190
5208
|
}
|
|
5191
|
-
function
|
|
5209
|
+
function ao(n, t, e, s) {
|
|
5192
5210
|
const r = Object.keys(t), i = Rt(n, r[0]), o = Ye(i, t[r[0]], e, s);
|
|
5193
5211
|
return !o || !o.length ? n.next(e, s) : o;
|
|
5194
5212
|
}
|
|
5195
|
-
function
|
|
5213
|
+
function co(n, t, e, s) {
|
|
5196
5214
|
const r = [];
|
|
5197
5215
|
for (const i of Object.keys(t)) {
|
|
5198
5216
|
const o = t[i];
|
|
@@ -5204,9 +5222,9 @@ function oo(n, t, e, s) {
|
|
|
5204
5222
|
return r.length ? r : n.next(e, s);
|
|
5205
5223
|
}
|
|
5206
5224
|
function Ye(n, t, e, s) {
|
|
5207
|
-
return typeof t == "string" ?
|
|
5225
|
+
return typeof t == "string" ? oo(n, t, e, s) : Object.keys(t).length === 1 ? ao(n, t, e, s) : co(n, t, e, s);
|
|
5208
5226
|
}
|
|
5209
|
-
function
|
|
5227
|
+
function lo(n) {
|
|
5210
5228
|
return Object.keys(n.states).map((t) => n.states[t]).filter((t) => t.type === "history");
|
|
5211
5229
|
}
|
|
5212
5230
|
function et(n, t) {
|
|
@@ -5215,7 +5233,7 @@ function et(n, t) {
|
|
|
5215
5233
|
e = e.parent;
|
|
5216
5234
|
return e.parent === t;
|
|
5217
5235
|
}
|
|
5218
|
-
function
|
|
5236
|
+
function uo(n, t) {
|
|
5219
5237
|
const e = new Set(n), s = new Set(t);
|
|
5220
5238
|
for (const r of e)
|
|
5221
5239
|
if (s.has(r))
|
|
@@ -5231,7 +5249,7 @@ function us(n, t, e) {
|
|
|
5231
5249
|
let i = !1;
|
|
5232
5250
|
const o = /* @__PURE__ */ new Set();
|
|
5233
5251
|
for (const a of s)
|
|
5234
|
-
if (
|
|
5252
|
+
if (uo($e([r], t, e), $e([a], t, e)))
|
|
5235
5253
|
if (et(r.source, a.source))
|
|
5236
5254
|
o.add(a);
|
|
5237
5255
|
else {
|
|
@@ -5246,7 +5264,7 @@ function us(n, t, e) {
|
|
|
5246
5264
|
}
|
|
5247
5265
|
return Array.from(s);
|
|
5248
5266
|
}
|
|
5249
|
-
function
|
|
5267
|
+
function ho(n) {
|
|
5250
5268
|
const [t, ...e] = n;
|
|
5251
5269
|
for (const s of jt(t, void 0))
|
|
5252
5270
|
if (e.every((r) => et(r, s)))
|
|
@@ -5274,7 +5292,7 @@ function hs(n, t) {
|
|
|
5274
5292
|
return;
|
|
5275
5293
|
if (!n.reenter && e.every((r) => r === n.source || et(r, n.source)))
|
|
5276
5294
|
return n.source;
|
|
5277
|
-
const s =
|
|
5295
|
+
const s = ho(e.concat(n.source));
|
|
5278
5296
|
if (s)
|
|
5279
5297
|
return s;
|
|
5280
5298
|
if (!n.reenter)
|
|
@@ -5292,7 +5310,7 @@ function $e(n, t, e) {
|
|
|
5292
5310
|
}
|
|
5293
5311
|
return [...s];
|
|
5294
5312
|
}
|
|
5295
|
-
function
|
|
5313
|
+
function fo(n, t) {
|
|
5296
5314
|
if (n.length !== t.size)
|
|
5297
5315
|
return !1;
|
|
5298
5316
|
for (const e of n)
|
|
@@ -5300,18 +5318,18 @@ function uo(n, t) {
|
|
|
5300
5318
|
return !1;
|
|
5301
5319
|
return !0;
|
|
5302
5320
|
}
|
|
5303
|
-
function
|
|
5321
|
+
function He(n, t, e, s, r, i) {
|
|
5304
5322
|
if (!n.length)
|
|
5305
5323
|
return t;
|
|
5306
5324
|
const o = new Set(t._nodes);
|
|
5307
5325
|
let a = t.historyValue;
|
|
5308
5326
|
const c = us(n, o, a);
|
|
5309
5327
|
let l = t;
|
|
5310
|
-
r || ([l, a] =
|
|
5328
|
+
r || ([l, a] = mo(l, s, e, c, o, a, i, e.actionExecutor)), l = xt(l, s, e, c.flatMap((h) => h.actions), i, void 0), l = go(l, s, e, c, o, i, a, r);
|
|
5311
5329
|
const u = [...o];
|
|
5312
5330
|
l.status === "done" && (l = xt(l, s, e, u.sort((h, d) => d.order - h.order).flatMap((h) => h.exit), i, void 0));
|
|
5313
5331
|
try {
|
|
5314
|
-
return a === t.historyValue &&
|
|
5332
|
+
return a === t.historyValue && fo(t._nodes, o) ? l : pt(l, {
|
|
5315
5333
|
_nodes: u,
|
|
5316
5334
|
historyValue: a
|
|
5317
5335
|
});
|
|
@@ -5319,23 +5337,23 @@ function Pe(n, t, e, s, r, i) {
|
|
|
5319
5337
|
throw h;
|
|
5320
5338
|
}
|
|
5321
5339
|
}
|
|
5322
|
-
function
|
|
5340
|
+
function po(n, t, e, s, r) {
|
|
5323
5341
|
if (s.output === void 0)
|
|
5324
5342
|
return;
|
|
5325
5343
|
const i = Re(r.id, r.output !== void 0 && r.parent ? xe(r.output, n.context, t, e.self) : void 0);
|
|
5326
5344
|
return xe(s.output, n.context, i, e.self);
|
|
5327
5345
|
}
|
|
5328
|
-
function
|
|
5346
|
+
function go(n, t, e, s, r, i, o, a) {
|
|
5329
5347
|
let c = n;
|
|
5330
5348
|
const l = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set();
|
|
5331
|
-
|
|
5349
|
+
yo(s, o, u, l), a && u.add(n.machine.root);
|
|
5332
5350
|
const h = /* @__PURE__ */ new Set();
|
|
5333
5351
|
for (const d of [...l].sort((g, f) => g.order - f.order)) {
|
|
5334
5352
|
r.add(d);
|
|
5335
5353
|
const g = [];
|
|
5336
5354
|
g.push(...d.entry);
|
|
5337
5355
|
for (const f of d.invoke)
|
|
5338
|
-
g.push(
|
|
5356
|
+
g.push(qi(f.src, {
|
|
5339
5357
|
...f,
|
|
5340
5358
|
syncSnapshot: !!f.onSnapshot
|
|
5341
5359
|
}));
|
|
@@ -5352,13 +5370,13 @@ function fo(n, t, e, s, r, i, o, a) {
|
|
|
5352
5370
|
continue;
|
|
5353
5371
|
c = pt(c, {
|
|
5354
5372
|
status: "done",
|
|
5355
|
-
output:
|
|
5373
|
+
output: po(c, t, e, c.machine.root, E)
|
|
5356
5374
|
});
|
|
5357
5375
|
}
|
|
5358
5376
|
}
|
|
5359
5377
|
return c;
|
|
5360
5378
|
}
|
|
5361
|
-
function
|
|
5379
|
+
function yo(n, t, e, s) {
|
|
5362
5380
|
for (const r of n) {
|
|
5363
5381
|
const i = hs(r, t);
|
|
5364
5382
|
for (const a of r.target || [])
|
|
@@ -5406,13 +5424,13 @@ function ds(n, t, e, s, r) {
|
|
|
5406
5424
|
function Ee(n, t, e, s, r) {
|
|
5407
5425
|
ds(e, s, r, jt(n, t));
|
|
5408
5426
|
}
|
|
5409
|
-
function
|
|
5427
|
+
function mo(n, t, e, s, r, i, o, a) {
|
|
5410
5428
|
let c = n;
|
|
5411
5429
|
const l = $e(s, r, i);
|
|
5412
5430
|
l.sort((h, d) => d.order - h.order);
|
|
5413
5431
|
let u;
|
|
5414
5432
|
for (const h of l)
|
|
5415
|
-
for (const d of
|
|
5433
|
+
for (const d of lo(h)) {
|
|
5416
5434
|
let g;
|
|
5417
5435
|
d.history === "deep" ? g = (f) => Je(f) && et(f, h) : g = (f) => f.parent === h, u ?? (u = {
|
|
5418
5436
|
...i
|
|
@@ -5422,7 +5440,7 @@ function go(n, t, e, s, r, i, o, a) {
|
|
|
5422
5440
|
c = xt(c, t, e, [...h.exit, ...h.invoke.map((d) => rs(d.id))], o, void 0), r.delete(h);
|
|
5423
5441
|
return [c, u || i];
|
|
5424
5442
|
}
|
|
5425
|
-
function
|
|
5443
|
+
function wo(n, t) {
|
|
5426
5444
|
return n.implementations.actions[t];
|
|
5427
5445
|
}
|
|
5428
5446
|
function fs(n, t, e, s, r, i) {
|
|
@@ -5435,7 +5453,7 @@ function fs(n, t, e, s, r, i) {
|
|
|
5435
5453
|
// the existing type of `.actions` assumes non-nullable `TExpressionAction`
|
|
5436
5454
|
// it's fine to cast this here to get a common type and lack of errors in the rest of the code
|
|
5437
5455
|
// our logic below makes sure that we call those 2 "variants" correctly
|
|
5438
|
-
|
|
5456
|
+
wo(o, typeof c == "string" ? c : c.type)
|
|
5439
5457
|
), h = {
|
|
5440
5458
|
context: a.context,
|
|
5441
5459
|
event: t,
|
|
@@ -5494,7 +5512,7 @@ function Ae(n, t, e, s) {
|
|
|
5494
5512
|
}), i.push(l);
|
|
5495
5513
|
}
|
|
5496
5514
|
if (t.type === Ce)
|
|
5497
|
-
return r = pt(
|
|
5515
|
+
return r = pt(Nn(r, t, e), {
|
|
5498
5516
|
status: "stopped"
|
|
5499
5517
|
}), o(r, t, []), {
|
|
5500
5518
|
snapshot: r,
|
|
@@ -5502,7 +5520,7 @@ function Ae(n, t, e, s) {
|
|
|
5502
5520
|
};
|
|
5503
5521
|
let a = t;
|
|
5504
5522
|
if (a.type !== qn) {
|
|
5505
|
-
const l = a, u =
|
|
5523
|
+
const l = a, u = zi(l), h = Sn(l, r);
|
|
5506
5524
|
if (u && !h.length)
|
|
5507
5525
|
return r = pt(n, {
|
|
5508
5526
|
status: "error",
|
|
@@ -5511,7 +5529,7 @@ function Ae(n, t, e, s) {
|
|
|
5511
5529
|
snapshot: r,
|
|
5512
5530
|
microstates: i
|
|
5513
5531
|
};
|
|
5514
|
-
r =
|
|
5532
|
+
r = He(
|
|
5515
5533
|
h,
|
|
5516
5534
|
n,
|
|
5517
5535
|
e,
|
|
@@ -5523,27 +5541,27 @@ function Ae(n, t, e, s) {
|
|
|
5523
5541
|
}
|
|
5524
5542
|
let c = !0;
|
|
5525
5543
|
for (; r.status === "active"; ) {
|
|
5526
|
-
let l = c ?
|
|
5544
|
+
let l = c ? bo(r, a) : [];
|
|
5527
5545
|
const u = l.length ? r : void 0;
|
|
5528
5546
|
if (!l.length) {
|
|
5529
5547
|
if (!s.length)
|
|
5530
5548
|
break;
|
|
5531
|
-
a = s.shift(), l =
|
|
5549
|
+
a = s.shift(), l = Sn(a, r);
|
|
5532
5550
|
}
|
|
5533
|
-
r =
|
|
5551
|
+
r = He(l, r, e, a, !1, s), c = r !== u, o(r, a, l);
|
|
5534
5552
|
}
|
|
5535
|
-
return r.status !== "active" &&
|
|
5553
|
+
return r.status !== "active" && Nn(r, a, e), {
|
|
5536
5554
|
snapshot: r,
|
|
5537
5555
|
microstates: i
|
|
5538
5556
|
};
|
|
5539
5557
|
}
|
|
5540
|
-
function
|
|
5558
|
+
function Nn(n, t, e) {
|
|
5541
5559
|
return xt(n, t, e, Object.values(n.children).map((s) => rs(s)), [], void 0);
|
|
5542
5560
|
}
|
|
5543
|
-
function
|
|
5561
|
+
function Sn(n, t) {
|
|
5544
5562
|
return t.machine.getTransitionData(t, n);
|
|
5545
5563
|
}
|
|
5546
|
-
function
|
|
5564
|
+
function bo(n, t) {
|
|
5547
5565
|
const e = /* @__PURE__ */ new Set(), s = n._nodes.filter(Je);
|
|
5548
5566
|
for (const r of s)
|
|
5549
5567
|
t: for (const i of [r].concat(jt(r, void 0)))
|
|
@@ -5556,22 +5574,22 @@ function mo(n, t) {
|
|
|
5556
5574
|
}
|
|
5557
5575
|
return us(Array.from(e), new Set(n._nodes), n.historyValue);
|
|
5558
5576
|
}
|
|
5559
|
-
function
|
|
5577
|
+
function _o(n, t) {
|
|
5560
5578
|
const e = oe(ce(n, t));
|
|
5561
5579
|
return as(n, [...e]);
|
|
5562
5580
|
}
|
|
5563
|
-
function
|
|
5581
|
+
function Eo(n) {
|
|
5564
5582
|
return !!n && typeof n == "object" && "machine" in n && "value" in n;
|
|
5565
5583
|
}
|
|
5566
|
-
const
|
|
5584
|
+
const Ao = function(t) {
|
|
5567
5585
|
return ts(t, this.value);
|
|
5568
|
-
},
|
|
5586
|
+
}, No = function(t) {
|
|
5569
5587
|
return this.tags.has(t);
|
|
5570
|
-
},
|
|
5588
|
+
}, So = function(t) {
|
|
5571
5589
|
const e = this.machine.getTransitionData(this, t);
|
|
5572
5590
|
return !!(e != null && e.length) && // Check that at least one transition is not forbidden
|
|
5573
5591
|
e.some((s) => s.target !== void 0 || s.actions.length);
|
|
5574
|
-
},
|
|
5592
|
+
}, vo = function() {
|
|
5575
5593
|
const {
|
|
5576
5594
|
_nodes: t,
|
|
5577
5595
|
tags: e,
|
|
@@ -5587,7 +5605,7 @@ const _o = function(t) {
|
|
|
5587
5605
|
...l,
|
|
5588
5606
|
tags: Array.from(e)
|
|
5589
5607
|
};
|
|
5590
|
-
},
|
|
5608
|
+
}, To = function() {
|
|
5591
5609
|
return this._nodes.reduce((t, e) => (e.meta !== void 0 && (t[e.id] = e.meta), t), {});
|
|
5592
5610
|
};
|
|
5593
5611
|
function Qt(n, t) {
|
|
@@ -5602,11 +5620,11 @@ function Qt(n, t) {
|
|
|
5602
5620
|
tags: new Set(n._nodes.flatMap((e) => e.tags)),
|
|
5603
5621
|
children: n.children,
|
|
5604
5622
|
historyValue: n.historyValue || {},
|
|
5605
|
-
matches:
|
|
5606
|
-
hasTag:
|
|
5607
|
-
can:
|
|
5608
|
-
getMeta:
|
|
5609
|
-
toJSON:
|
|
5623
|
+
matches: Ao,
|
|
5624
|
+
hasTag: No,
|
|
5625
|
+
can: So,
|
|
5626
|
+
getMeta: To,
|
|
5627
|
+
toJSON: vo
|
|
5610
5628
|
};
|
|
5611
5629
|
}
|
|
5612
5630
|
function pt(n, t = {}) {
|
|
@@ -5615,7 +5633,7 @@ function pt(n, t = {}) {
|
|
|
5615
5633
|
...t
|
|
5616
5634
|
}, n.machine);
|
|
5617
5635
|
}
|
|
5618
|
-
function
|
|
5636
|
+
function Io(n, t) {
|
|
5619
5637
|
const {
|
|
5620
5638
|
_nodes: e,
|
|
5621
5639
|
tags: s,
|
|
@@ -5665,7 +5683,7 @@ function ps(n) {
|
|
|
5665
5683
|
}
|
|
5666
5684
|
return t ?? n;
|
|
5667
5685
|
}
|
|
5668
|
-
function
|
|
5686
|
+
function Oo(n, t, e, s, {
|
|
5669
5687
|
event: r,
|
|
5670
5688
|
id: i,
|
|
5671
5689
|
delay: o
|
|
@@ -5691,7 +5709,7 @@ function To(n, t, e, s, {
|
|
|
5691
5709
|
delay: u
|
|
5692
5710
|
}, void 0];
|
|
5693
5711
|
}
|
|
5694
|
-
function
|
|
5712
|
+
function ko(n, t) {
|
|
5695
5713
|
const {
|
|
5696
5714
|
event: e,
|
|
5697
5715
|
delay: s,
|
|
@@ -5705,12 +5723,12 @@ function Io(n, t) {
|
|
|
5705
5723
|
return;
|
|
5706
5724
|
}
|
|
5707
5725
|
}
|
|
5708
|
-
function
|
|
5726
|
+
function Co(n, t) {
|
|
5709
5727
|
function e(s, r) {
|
|
5710
5728
|
}
|
|
5711
|
-
return e.type = "xstate.raise", e.event = n, e.id = t == null ? void 0 : t.id, e.delay = t == null ? void 0 : t.delay, e.resolve =
|
|
5729
|
+
return e.type = "xstate.raise", e.event = n, e.id = t == null ? void 0 : t.id, e.delay = t == null ? void 0 : t.delay, e.resolve = Oo, e.execute = ko, e;
|
|
5712
5730
|
}
|
|
5713
|
-
function
|
|
5731
|
+
function Ro(n, {
|
|
5714
5732
|
machine: t,
|
|
5715
5733
|
context: e
|
|
5716
5734
|
}, s, r) {
|
|
@@ -5749,7 +5767,7 @@ function ko(n, {
|
|
|
5749
5767
|
}), c;
|
|
5750
5768
|
};
|
|
5751
5769
|
}
|
|
5752
|
-
function
|
|
5770
|
+
function xo(n, t, e, s, {
|
|
5753
5771
|
assignment: r
|
|
5754
5772
|
}) {
|
|
5755
5773
|
if (!t.context)
|
|
@@ -5757,7 +5775,7 @@ function Co(n, t, e, s, {
|
|
|
5757
5775
|
const i = {}, o = {
|
|
5758
5776
|
context: t.context,
|
|
5759
5777
|
event: e.event,
|
|
5760
|
-
spawn:
|
|
5778
|
+
spawn: Ro(n, t, e.event, i),
|
|
5761
5779
|
self: n.self,
|
|
5762
5780
|
system: n.system
|
|
5763
5781
|
};
|
|
@@ -5778,10 +5796,10 @@ function Co(n, t, e, s, {
|
|
|
5778
5796
|
} : t.children
|
|
5779
5797
|
}), void 0, void 0];
|
|
5780
5798
|
}
|
|
5781
|
-
function
|
|
5799
|
+
function Mo(n) {
|
|
5782
5800
|
function t(e, s) {
|
|
5783
5801
|
}
|
|
5784
|
-
return t.type = "xstate.assign", t.assignment = n, t.resolve =
|
|
5802
|
+
return t.type = "xstate.assign", t.assignment = n, t.resolve = xo, t;
|
|
5785
5803
|
}
|
|
5786
5804
|
const vn = /* @__PURE__ */ new WeakMap();
|
|
5787
5805
|
function _t(n, t, e) {
|
|
@@ -5790,7 +5808,7 @@ function _t(n, t, e) {
|
|
|
5790
5808
|
[t]: e()
|
|
5791
5809
|
}, vn.set(n, s)), s[t];
|
|
5792
5810
|
}
|
|
5793
|
-
const
|
|
5811
|
+
const $o = {}, Pt = (n) => typeof n == "string" ? {
|
|
5794
5812
|
type: n
|
|
5795
5813
|
} : typeof n == "function" ? "resolve" in n ? {
|
|
5796
5814
|
type: n.type
|
|
@@ -5803,13 +5821,13 @@ class Qe {
|
|
|
5803
5821
|
_parent: this,
|
|
5804
5822
|
_key: r,
|
|
5805
5823
|
_machine: this.machine
|
|
5806
|
-
})) :
|
|
5824
|
+
})) : $o, this.type === "compound" && !this.config.initial)
|
|
5807
5825
|
throw new Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);
|
|
5808
5826
|
this.history = this.config.history === !0 ? "shallow" : this.config.history || !1, this.entry = Q(this.config.entry).slice(), this.exit = Q(this.config.exit).slice(), this.meta = this.config.meta, this.output = this.type === "final" || !this.parent ? this.config.output : void 0, this.tags = Q(t.tags).slice();
|
|
5809
5827
|
}
|
|
5810
5828
|
/** @internal */
|
|
5811
5829
|
_initialize() {
|
|
5812
|
-
this.transitions =
|
|
5830
|
+
this.transitions = so(this), this.config.always && (this.always = Et(this.config.always).map((t) => ct(this, Yn, t))), Object.keys(this.states).forEach((t) => {
|
|
5813
5831
|
this.states[t]._initialize();
|
|
5814
5832
|
});
|
|
5815
5833
|
}
|
|
@@ -5823,13 +5841,13 @@ class Qe {
|
|
|
5823
5841
|
initial: this.initial ? {
|
|
5824
5842
|
target: this.initial.target,
|
|
5825
5843
|
source: this,
|
|
5826
|
-
actions: this.initial.actions.map(
|
|
5844
|
+
actions: this.initial.actions.map(Pt),
|
|
5827
5845
|
eventType: null,
|
|
5828
5846
|
reenter: !1,
|
|
5829
5847
|
toJSON: () => ({
|
|
5830
5848
|
target: this.initial.target.map((t) => `#${t.id}`),
|
|
5831
5849
|
source: `#${this.id}`,
|
|
5832
|
-
actions: this.initial.actions.map(
|
|
5850
|
+
actions: this.initial.actions.map(Pt),
|
|
5833
5851
|
eventType: null
|
|
5834
5852
|
})
|
|
5835
5853
|
} : void 0,
|
|
@@ -5838,10 +5856,10 @@ class Qe {
|
|
|
5838
5856
|
on: this.on,
|
|
5839
5857
|
transitions: [...this.transitions.values()].flat().map((t) => ({
|
|
5840
5858
|
...t,
|
|
5841
|
-
actions: t.actions.map(
|
|
5859
|
+
actions: t.actions.map(Pt)
|
|
5842
5860
|
})),
|
|
5843
|
-
entry: this.entry.map(
|
|
5844
|
-
exit: this.exit.map(
|
|
5861
|
+
entry: this.entry.map(Pt),
|
|
5862
|
+
exit: this.exit.map(Pt),
|
|
5845
5863
|
meta: this.meta,
|
|
5846
5864
|
order: this.order || -1,
|
|
5847
5865
|
output: this.output,
|
|
@@ -5887,16 +5905,16 @@ class Qe {
|
|
|
5887
5905
|
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), {}));
|
|
5888
5906
|
}
|
|
5889
5907
|
get after() {
|
|
5890
|
-
return _t(this, "delayedTransitions", () =>
|
|
5908
|
+
return _t(this, "delayedTransitions", () => no(this));
|
|
5891
5909
|
}
|
|
5892
5910
|
get initial() {
|
|
5893
|
-
return _t(this, "initial", () =>
|
|
5911
|
+
return _t(this, "initial", () => ro(this, this.config.initial));
|
|
5894
5912
|
}
|
|
5895
5913
|
/** @internal */
|
|
5896
5914
|
next(t, e) {
|
|
5897
5915
|
const s = e.type, r = [];
|
|
5898
5916
|
let i;
|
|
5899
|
-
const o = _t(this, `candidates-${s}`, () =>
|
|
5917
|
+
const o = _t(this, `candidates-${s}`, () => eo(this, s));
|
|
5900
5918
|
for (const a of o) {
|
|
5901
5919
|
const {
|
|
5902
5920
|
guard: c
|
|
@@ -5942,7 +5960,7 @@ ${h.message}`);
|
|
|
5942
5960
|
return Array.from(t);
|
|
5943
5961
|
}
|
|
5944
5962
|
}
|
|
5945
|
-
const
|
|
5963
|
+
const Ho = "#";
|
|
5946
5964
|
class tn {
|
|
5947
5965
|
constructor(t, e) {
|
|
5948
5966
|
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 = {
|
|
@@ -5990,7 +6008,7 @@ class tn {
|
|
|
5990
6008
|
});
|
|
5991
6009
|
}
|
|
5992
6010
|
resolveState(t) {
|
|
5993
|
-
const e =
|
|
6011
|
+
const e = _o(this.root, t.value), s = oe(ce(this.root, e));
|
|
5994
6012
|
return Qt({
|
|
5995
6013
|
_nodes: [...s],
|
|
5996
6014
|
context: t.context || {},
|
|
@@ -6037,7 +6055,7 @@ class tn {
|
|
|
6037
6055
|
children: {},
|
|
6038
6056
|
status: "active"
|
|
6039
6057
|
}, this);
|
|
6040
|
-
return typeof r == "function" ? xt(i, e, t, [
|
|
6058
|
+
return typeof r == "function" ? xt(i, e, t, [Mo(({
|
|
6041
6059
|
spawn: a,
|
|
6042
6060
|
event: c,
|
|
6043
6061
|
self: l
|
|
@@ -6052,7 +6070,7 @@ class tn {
|
|
|
6052
6070
|
* `ActorRef`.
|
|
6053
6071
|
*/
|
|
6054
6072
|
getInitialSnapshot(t, e) {
|
|
6055
|
-
const s = Qn(e), r = [], i = this.getPreInitialState(t, s, r), o =
|
|
6073
|
+
const s = Qn(e), r = [], i = this.getPreInitialState(t, s, r), o = He([{
|
|
6056
6074
|
target: [...ls(this.root)],
|
|
6057
6075
|
source: this.root,
|
|
6058
6076
|
reenter: !0,
|
|
@@ -6071,7 +6089,7 @@ class tn {
|
|
|
6071
6089
|
});
|
|
6072
6090
|
}
|
|
6073
6091
|
getStateNodeById(t) {
|
|
6074
|
-
const e = Fe(t), s = e.slice(1), r = fe(e[0]) ? e[0].slice(
|
|
6092
|
+
const e = Fe(t), s = e.slice(1), r = fe(e[0]) ? e[0].slice(Ho.length) : e[0], i = this.idMap.get(r);
|
|
6075
6093
|
if (!i)
|
|
6076
6094
|
throw new Error(`Child state node '#${r}' does not exist on machine '${this.id}'`);
|
|
6077
6095
|
return ae(i, s);
|
|
@@ -6083,7 +6101,7 @@ class tn {
|
|
|
6083
6101
|
return this.definition;
|
|
6084
6102
|
}
|
|
6085
6103
|
getPersistedSnapshot(t, e) {
|
|
6086
|
-
return
|
|
6104
|
+
return Io(t, e);
|
|
6087
6105
|
}
|
|
6088
6106
|
restoreSnapshot(t, e) {
|
|
6089
6107
|
const s = {}, r = t.children;
|
|
@@ -6124,23 +6142,23 @@ class tn {
|
|
|
6124
6142
|
return a(i.context, s), i;
|
|
6125
6143
|
}
|
|
6126
6144
|
}
|
|
6127
|
-
function
|
|
6145
|
+
function Po(n, t) {
|
|
6128
6146
|
return new tn(n, t);
|
|
6129
6147
|
}
|
|
6130
|
-
const Vt = (n) => n === !1 ? !1 : n.map((t) => t.serialize()),
|
|
6148
|
+
const Vt = (n) => n === !1 ? !1 : n.map((t) => t.serialize()), Wo = (n) => n === !1 ? !1 : n.serialize(), Bo = (n) => n === !1 ? !1 : n.map((t) => ({
|
|
6131
6149
|
tile: t.tile.toString(),
|
|
6132
6150
|
candidates: t.candidates.map((e) => e.toString()),
|
|
6133
6151
|
shanten: t.shanten
|
|
6134
|
-
})),
|
|
6152
|
+
})), Pe = (n) => JSON.parse(JSON.stringify(n)), Jt = (n) => n === !1 ? !1 : Pe(n), Tn = (n) => Po(
|
|
6135
6153
|
{
|
|
6136
6154
|
id: "Untitled",
|
|
6137
6155
|
initial: "distribute",
|
|
6138
6156
|
context: {
|
|
6139
6157
|
currentWind: A.E,
|
|
6140
|
-
oneShotMap:
|
|
6141
|
-
missingMap:
|
|
6158
|
+
oneShotMap: H(!1),
|
|
6159
|
+
missingMap: H(!1),
|
|
6142
6160
|
controller: n,
|
|
6143
|
-
genEventID:
|
|
6161
|
+
genEventID: Do()
|
|
6144
6162
|
},
|
|
6145
6163
|
states: {
|
|
6146
6164
|
distribute: {
|
|
@@ -6452,12 +6470,12 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
6452
6470
|
actions: {
|
|
6453
6471
|
updateNextWind: ({ context: t, event: e }) => {
|
|
6454
6472
|
const s = t.currentWind;
|
|
6455
|
-
t.currentWind =
|
|
6473
|
+
t.currentWind = Nt(s);
|
|
6456
6474
|
},
|
|
6457
6475
|
notify_distribution: ({ context: t, event: e }) => {
|
|
6458
6476
|
const s = t.genEventID(), r = t.controller.initialHands();
|
|
6459
6477
|
for (const i of Object.values(A)) {
|
|
6460
|
-
const o =
|
|
6478
|
+
const o = H("_____________");
|
|
6461
6479
|
o[i] = r[i].toString();
|
|
6462
6480
|
const a = {
|
|
6463
6481
|
id: s,
|
|
@@ -6488,7 +6506,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
6488
6506
|
replacementWin: s == null ? void 0 : s.replacementWin
|
|
6489
6507
|
})
|
|
6490
6508
|
),
|
|
6491
|
-
REACH:
|
|
6509
|
+
REACH: Bo(t.controller.doReach(r)),
|
|
6492
6510
|
AN_KAN: Vt(t.controller.doAnKan(r)),
|
|
6493
6511
|
SHO_KAN: Vt(t.controller.doShoKan(r)),
|
|
6494
6512
|
DISCARD: t.controller.doDiscard(r).map((c) => c.toString()),
|
|
@@ -6522,7 +6540,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
6522
6540
|
CHI: Vt(
|
|
6523
6541
|
t.controller.doChi(o, r.w, i)
|
|
6524
6542
|
),
|
|
6525
|
-
DAI_KAN:
|
|
6543
|
+
DAI_KAN: Wo(
|
|
6526
6544
|
t.controller.doDaiKan(o, r.w, i)
|
|
6527
6545
|
)
|
|
6528
6546
|
}
|
|
@@ -6569,7 +6587,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
6569
6587
|
t.controller.pollReplies(s, Object.values(A));
|
|
6570
6588
|
},
|
|
6571
6589
|
notify_choice_for_chankan: ({ context: t, event: e }) => {
|
|
6572
|
-
|
|
6590
|
+
S(
|
|
6573
6591
|
e.type == "SHO_KAN" || e.type == "AN_KAN",
|
|
6574
6592
|
`unexpected event ${e.type}`
|
|
6575
6593
|
);
|
|
@@ -6598,7 +6616,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
6598
6616
|
t.controller.pollReplies(s, Object.values(A));
|
|
6599
6617
|
},
|
|
6600
6618
|
notify_call: ({ context: t, event: e }) => {
|
|
6601
|
-
|
|
6619
|
+
S(
|
|
6602
6620
|
e.type == "CHI" || e.type == "PON" || e.type == "DAI_KAN" || e.type == "AN_KAN" || e.type == "SHO_KAN",
|
|
6603
6621
|
`unexpected event ${e.type}`
|
|
6604
6622
|
);
|
|
@@ -6617,7 +6635,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
6617
6635
|
t.controller.next();
|
|
6618
6636
|
},
|
|
6619
6637
|
notify_discard: ({ context: t, event: e }) => {
|
|
6620
|
-
|
|
6638
|
+
S(e.type == "DISCARD", `unexpected event ${e.type}`);
|
|
6621
6639
|
const s = t.genEventID(), r = t.currentWind, i = e.tile;
|
|
6622
6640
|
for (const o of Object.values(A)) {
|
|
6623
6641
|
const a = {
|
|
@@ -6653,7 +6671,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
6653
6671
|
t.controller.next();
|
|
6654
6672
|
},
|
|
6655
6673
|
notify_ron: ({ context: t, event: e }) => {
|
|
6656
|
-
|
|
6674
|
+
S(e.type == "RON");
|
|
6657
6675
|
const s = t.genEventID(), r = e.iam;
|
|
6658
6676
|
for (const i of Object.values(A)) {
|
|
6659
6677
|
const o = {
|
|
@@ -6665,13 +6683,13 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
6665
6683
|
wind: e.targetInfo.wind,
|
|
6666
6684
|
tile: e.targetInfo.tile.toString()
|
|
6667
6685
|
},
|
|
6668
|
-
ret:
|
|
6686
|
+
ret: Pe(e.ret)
|
|
6669
6687
|
};
|
|
6670
6688
|
t.controller.emit(o);
|
|
6671
6689
|
}
|
|
6672
6690
|
},
|
|
6673
6691
|
notify_tsumo: ({ context: t, event: e }) => {
|
|
6674
|
-
|
|
6692
|
+
S(e.type == "TSUMO", `unexpected event ${e.type}`);
|
|
6675
6693
|
const s = t.genEventID(), r = t.currentWind;
|
|
6676
6694
|
for (const i of Object.values(A)) {
|
|
6677
6695
|
const o = {
|
|
@@ -6680,13 +6698,13 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
6680
6698
|
iam: r,
|
|
6681
6699
|
wind: i,
|
|
6682
6700
|
lastTile: t.controller.hand(r).drawn.toString(),
|
|
6683
|
-
ret:
|
|
6701
|
+
ret: Pe(e.ret)
|
|
6684
6702
|
};
|
|
6685
6703
|
t.controller.emit(o);
|
|
6686
6704
|
}
|
|
6687
6705
|
},
|
|
6688
6706
|
notify_reach: ({ context: t, event: e }) => {
|
|
6689
|
-
|
|
6707
|
+
S(e.type == "REACH", `unexpected event ${e.type}`);
|
|
6690
6708
|
const s = t.genEventID(), r = e.iam, i = e.tile.clone({ add: y.HORIZONTAL });
|
|
6691
6709
|
t.oneShotMap[r] = !0;
|
|
6692
6710
|
for (const o of Object.values(A)) {
|
|
@@ -6701,7 +6719,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
6701
6719
|
}
|
|
6702
6720
|
},
|
|
6703
6721
|
notify_reach_accepted: ({ context: t, event: e }) => {
|
|
6704
|
-
|
|
6722
|
+
S(e.type == "REACH_ACCEPT");
|
|
6705
6723
|
const s = t.genEventID();
|
|
6706
6724
|
for (const r of Object.values(A)) {
|
|
6707
6725
|
const i = {
|
|
@@ -6740,7 +6758,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
6740
6758
|
t.oneShotMap[t.currentWind] = !1;
|
|
6741
6759
|
},
|
|
6742
6760
|
notify_end: ({ context: t, event: e }) => {
|
|
6743
|
-
const s = t.genEventID(), r =
|
|
6761
|
+
const s = t.genEventID(), r = H("");
|
|
6744
6762
|
if (e.type == "DRAWN_GAME_BY_NINE_ORPHANS") {
|
|
6745
6763
|
r[e.iam] = t.controller.hand(e.iam).toString();
|
|
6746
6764
|
for (const i of Object.values(A)) {
|
|
@@ -6752,7 +6770,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
6752
6770
|
shouldContinue: !0,
|
|
6753
6771
|
sticks: t.controller.placeManager.sticks,
|
|
6754
6772
|
scores: t.controller.scoreManager.summary,
|
|
6755
|
-
deltas:
|
|
6773
|
+
deltas: H(0),
|
|
6756
6774
|
hands: r
|
|
6757
6775
|
};
|
|
6758
6776
|
t.controller.emit(o);
|
|
@@ -6788,8 +6806,8 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
6788
6806
|
shouldContinue: !0,
|
|
6789
6807
|
sticks: t.controller.placeManager.sticks,
|
|
6790
6808
|
scores: t.controller.scoreManager.summary,
|
|
6791
|
-
deltas:
|
|
6792
|
-
hands:
|
|
6809
|
+
deltas: H(0),
|
|
6810
|
+
hands: H("")
|
|
6793
6811
|
};
|
|
6794
6812
|
t.controller.emit(a);
|
|
6795
6813
|
}
|
|
@@ -6802,7 +6820,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
6802
6820
|
const u = t.controller.hand(l);
|
|
6803
6821
|
new de(u).calc() == 0 && (i.push(l), r[l] = u.toString());
|
|
6804
6822
|
}
|
|
6805
|
-
const o = i.length == 0 || i.length == 4, a =
|
|
6823
|
+
const o = i.length == 0 || i.length == 4, a = H(0);
|
|
6806
6824
|
for (const l of Object.values(A))
|
|
6807
6825
|
i.includes(l) ? a[l] += o ? 0 : 3e3 / i.length : a[l] -= o ? 0 : 3e3 / (4 - i.length);
|
|
6808
6826
|
const c = i.length == 4 || a[A.E] > 0;
|
|
@@ -6843,7 +6861,7 @@ CHI/PON の場合は鳴ける組み合わせの一覧`
|
|
|
6843
6861
|
delays: {}
|
|
6844
6862
|
}
|
|
6845
6863
|
);
|
|
6846
|
-
function
|
|
6864
|
+
function Do(n = 0) {
|
|
6847
6865
|
let t = n;
|
|
6848
6866
|
return () => (t++).toString();
|
|
6849
6867
|
}
|
|
@@ -6888,7 +6906,7 @@ class vt {
|
|
|
6888
6906
|
return this.walls.drawable.length > 0;
|
|
6889
6907
|
}
|
|
6890
6908
|
initialHands() {
|
|
6891
|
-
const t =
|
|
6909
|
+
const t = H("");
|
|
6892
6910
|
for (let e = 0; e < 3; e++)
|
|
6893
6911
|
for (const s of Object.values(A))
|
|
6894
6912
|
for (let r = 0; r < 4; r++)
|
|
@@ -6948,8 +6966,8 @@ class pe {
|
|
|
6948
6966
|
(o) => o.handler.on((a) => this.enqueue(a))
|
|
6949
6967
|
// bind
|
|
6950
6968
|
);
|
|
6951
|
-
const s =
|
|
6952
|
-
this.observer = new
|
|
6969
|
+
const s = ki();
|
|
6970
|
+
this.observer = new Ko(s), this.observer.eventHandler.on(
|
|
6953
6971
|
(o) => this.observer.handleEvent(o)
|
|
6954
6972
|
// bind
|
|
6955
6973
|
);
|
|
@@ -7018,7 +7036,7 @@ class pe {
|
|
|
7018
7036
|
}
|
|
7019
7037
|
const r = s[0];
|
|
7020
7038
|
if (r.type == "CHOICE_AFTER_DISCARDED") {
|
|
7021
|
-
const i =
|
|
7039
|
+
const i = vi(
|
|
7022
7040
|
s
|
|
7023
7041
|
);
|
|
7024
7042
|
if (i.events.length == 0) {
|
|
@@ -7028,7 +7046,7 @@ class pe {
|
|
|
7028
7046
|
const o = i.events[0];
|
|
7029
7047
|
switch (i.type) {
|
|
7030
7048
|
case "RON":
|
|
7031
|
-
|
|
7049
|
+
S(o.choices.RON, "ron choice is none"), this.actor.send({
|
|
7032
7050
|
type: i.type,
|
|
7033
7051
|
iam: o.wind,
|
|
7034
7052
|
ret: Zt(o.choices.RON),
|
|
@@ -7039,7 +7057,7 @@ class pe {
|
|
|
7039
7057
|
});
|
|
7040
7058
|
break;
|
|
7041
7059
|
case "DAI_KAN":
|
|
7042
|
-
|
|
7060
|
+
S(o.choices.DAI_KAN, "daikan choice is none"), this.actor.send({
|
|
7043
7061
|
type: i.type,
|
|
7044
7062
|
iam: o.wind,
|
|
7045
7063
|
block: Y.from(o.choices.DAI_KAN.tiles)
|
|
@@ -7048,7 +7066,7 @@ class pe {
|
|
|
7048
7066
|
case "CHI":
|
|
7049
7067
|
case "PON":
|
|
7050
7068
|
const a = o.choices[i.type];
|
|
7051
|
-
|
|
7069
|
+
S(a, `${i.type} choice is none`), S(
|
|
7052
7070
|
i.events.length == 1,
|
|
7053
7071
|
`found more than one selected: ${JSON.stringify(i, null, 2)}`
|
|
7054
7072
|
);
|
|
@@ -7060,15 +7078,15 @@ class pe {
|
|
|
7060
7078
|
});
|
|
7061
7079
|
}
|
|
7062
7080
|
} else if (r.type == "CHOICE_AFTER_DRAWN") {
|
|
7063
|
-
const i =
|
|
7064
|
-
|
|
7081
|
+
const i = Ti(s);
|
|
7082
|
+
S(
|
|
7065
7083
|
i.events.length == 1,
|
|
7066
7084
|
`found more than one selected: ${JSON.stringify(i, null, 2)}`
|
|
7067
7085
|
);
|
|
7068
7086
|
const o = i.events[0], a = o.wind;
|
|
7069
7087
|
switch (i.type) {
|
|
7070
7088
|
case "TSUMO":
|
|
7071
|
-
|
|
7089
|
+
S(o.choices.TSUMO, "tsumo choice is none"), this.actor.send({
|
|
7072
7090
|
type: i.type,
|
|
7073
7091
|
ret: Zt(o.choices.TSUMO),
|
|
7074
7092
|
lastTile: w.from(o.drawerInfo.tile),
|
|
@@ -7077,7 +7095,7 @@ class pe {
|
|
|
7077
7095
|
break;
|
|
7078
7096
|
case "REACH":
|
|
7079
7097
|
const c = o.choices[i.type];
|
|
7080
|
-
|
|
7098
|
+
S(c, `${i.type} candidates is none`), this.actor.send({
|
|
7081
7099
|
type: "REACH",
|
|
7082
7100
|
tile: w.from(c[0].tile),
|
|
7083
7101
|
iam: a
|
|
@@ -7085,7 +7103,7 @@ class pe {
|
|
|
7085
7103
|
break;
|
|
7086
7104
|
case "DISCARD":
|
|
7087
7105
|
const l = o.choices[i.type];
|
|
7088
|
-
|
|
7106
|
+
S(l, `${i.type} choice is none`), this.actor.send({
|
|
7089
7107
|
type: i.type,
|
|
7090
7108
|
tile: w.from(l[0]).clone({ remove: y.TSUMO }),
|
|
7091
7109
|
iam: a
|
|
@@ -7093,7 +7111,7 @@ class pe {
|
|
|
7093
7111
|
break;
|
|
7094
7112
|
case "AN_KAN": {
|
|
7095
7113
|
const u = o.choices[i.type];
|
|
7096
|
-
|
|
7114
|
+
S(u, `${i.type} choice is none`), this.actor.send({
|
|
7097
7115
|
type: i.type,
|
|
7098
7116
|
block: M.from(u[0].tiles),
|
|
7099
7117
|
iam: a
|
|
@@ -7102,7 +7120,7 @@ class pe {
|
|
|
7102
7120
|
}
|
|
7103
7121
|
case "SHO_KAN": {
|
|
7104
7122
|
const u = o.choices[i.type];
|
|
7105
|
-
|
|
7123
|
+
S(u, `${i.type} choice is none`), this.actor.send({
|
|
7106
7124
|
type: i.type,
|
|
7107
7125
|
block: K.from(u[0].tiles),
|
|
7108
7126
|
iam: a
|
|
@@ -7114,7 +7132,7 @@ class pe {
|
|
|
7114
7132
|
break;
|
|
7115
7133
|
}
|
|
7116
7134
|
} else if (r.type == "CHOICE_AFTER_CALLED") {
|
|
7117
|
-
|
|
7135
|
+
S(
|
|
7118
7136
|
r.choices.DISCARD,
|
|
7119
7137
|
`discard candidate tile is none: ${JSON.stringify(
|
|
7120
7138
|
r,
|
|
@@ -7125,7 +7143,7 @@ class pe {
|
|
|
7125
7143
|
const i = r.wind, o = w.from(r.choices.DISCARD[0]);
|
|
7126
7144
|
this.actor.send({ type: "DISCARD", tile: o, iam: i });
|
|
7127
7145
|
} else if (r.type == "CHOICE_FOR_REACH_ACCEPTANCE") {
|
|
7128
|
-
const i = s.filter((a) => (
|
|
7146
|
+
const i = s.filter((a) => (S(a.type == "CHOICE_FOR_REACH_ACCEPTANCE"), a.choices.RON !== !1));
|
|
7129
7147
|
if (i.length == 0) {
|
|
7130
7148
|
this.actor.send({
|
|
7131
7149
|
type: "REACH_ACCEPT",
|
|
@@ -7154,7 +7172,7 @@ class pe {
|
|
|
7154
7172
|
return;
|
|
7155
7173
|
}
|
|
7156
7174
|
const o = i[0];
|
|
7157
|
-
|
|
7175
|
+
S(o.choices.RON, "ron choice is none"), this.actor.send({
|
|
7158
7176
|
type: "RON",
|
|
7159
7177
|
iam: o.wind,
|
|
7160
7178
|
ret: Zt(o.choices.RON),
|
|
@@ -7212,7 +7230,7 @@ class pe {
|
|
|
7212
7230
|
sticks: this.placeManager.sticks,
|
|
7213
7231
|
blindDoraMarkers: r
|
|
7214
7232
|
}).calc(t.hand);
|
|
7215
|
-
return
|
|
7233
|
+
return S(i), i;
|
|
7216
7234
|
}
|
|
7217
7235
|
doWin(t, e, s) {
|
|
7218
7236
|
if (e == null) return !1;
|
|
@@ -7225,7 +7243,7 @@ class pe {
|
|
|
7225
7243
|
} else
|
|
7226
7244
|
i.finalWallWin = !this.wall.canDraw, i.replacementWin = s == null ? void 0 : s.replacementWin;
|
|
7227
7245
|
i.oneShotWin = s == null ? void 0 : s.oneShot;
|
|
7228
|
-
const o = new
|
|
7246
|
+
const o = new Si(r), a = new pn(r, i), c = o.calc(e), l = a.calc(...c);
|
|
7229
7247
|
if (!l || l.points.length == 0) return !1;
|
|
7230
7248
|
if (r.draw == null) {
|
|
7231
7249
|
const u = zt.candidateTiles(this.hand(t)).candidates;
|
|
@@ -7262,7 +7280,7 @@ class pe {
|
|
|
7262
7280
|
return a;
|
|
7263
7281
|
}
|
|
7264
7282
|
doChi(t, e, s) {
|
|
7265
|
-
if (s == null || !s.isNum() ||
|
|
7283
|
+
if (s == null || !s.isNum() || Nt(e) != t) return !1;
|
|
7266
7284
|
const r = this.hand(t);
|
|
7267
7285
|
if (r.reached || r.hands.length < 3) return !1;
|
|
7268
7286
|
const i = s.clone({
|
|
@@ -7294,8 +7312,8 @@ class pe {
|
|
|
7294
7312
|
const R = r.get(O.t, O.n);
|
|
7295
7313
|
for (let mt = 0; mt < R; mt++) m.push(O.clone({ remove: y.RED }));
|
|
7296
7314
|
}
|
|
7297
|
-
const E = r.dec([...m, g.tiles[1], g.tiles[2]]),
|
|
7298
|
-
r.inc(E),
|
|
7315
|
+
const E = r.dec([...m, g.tiles[1], g.tiles[2]]), N = r.hands.length == 0;
|
|
7316
|
+
r.inc(E), N && o.splice(d, 1);
|
|
7299
7317
|
}
|
|
7300
7318
|
if (o.length == 0) return !1;
|
|
7301
7319
|
const h = r.get(s.t, 0) > 0 ? this.redPattern(o) : [];
|
|
@@ -7325,7 +7343,7 @@ class pe {
|
|
|
7325
7343
|
if (e instanceof X)
|
|
7326
7344
|
return s.filter((o) => !o.equals(e.tiles[0]));
|
|
7327
7345
|
const r = this.cannotDiscardTile(e), i = s.filter((o) => !r.some((a) => o.equals(a)));
|
|
7328
|
-
return
|
|
7346
|
+
return S(
|
|
7329
7347
|
i.length > 0,
|
|
7330
7348
|
`no tiles to discard. hand: ${this.hand(
|
|
7331
7349
|
t
|
|
@@ -7346,7 +7364,7 @@ class pe {
|
|
|
7346
7364
|
}
|
|
7347
7365
|
if (s.length == 0) return !1;
|
|
7348
7366
|
for (const r of s)
|
|
7349
|
-
|
|
7367
|
+
S(
|
|
7350
7368
|
r.tiles.filter((i) => i.has(y.HORIZONTAL)).length == 0,
|
|
7351
7369
|
`h op ${r.toString()}`
|
|
7352
7370
|
);
|
|
@@ -7370,7 +7388,7 @@ class pe {
|
|
|
7370
7388
|
}
|
|
7371
7389
|
if (r.length == 0) return !1;
|
|
7372
7390
|
for (const i of r)
|
|
7373
|
-
|
|
7391
|
+
S(
|
|
7374
7392
|
i.tiles.filter((o) => o.has(y.HORIZONTAL)).length == 2,
|
|
7375
7393
|
`h op ${i.toString()}`
|
|
7376
7394
|
);
|
|
@@ -7393,7 +7411,7 @@ class pe {
|
|
|
7393
7411
|
}
|
|
7394
7412
|
});
|
|
7395
7413
|
else if (C(s) && !s.has(y.RED)) {
|
|
7396
|
-
|
|
7414
|
+
S(
|
|
7397
7415
|
r.get(s.t, 0) > 0,
|
|
7398
7416
|
`hand does not have red tile: ${r.toString()}`
|
|
7399
7417
|
);
|
|
@@ -7402,7 +7420,7 @@ class pe {
|
|
|
7402
7420
|
replace: { idx: c, tile: i.clone({ add: y.RED }) }
|
|
7403
7421
|
});
|
|
7404
7422
|
}
|
|
7405
|
-
return
|
|
7423
|
+
return S(
|
|
7406
7424
|
a.tiles.filter((c) => c.has(y.HORIZONTAL)).length == 1,
|
|
7407
7425
|
`h op ${a.toString()}`
|
|
7408
7426
|
), a;
|
|
@@ -7446,9 +7464,9 @@ class gs {
|
|
|
7446
7464
|
// empty for init
|
|
7447
7465
|
_(this, "scoreManager", new re({}));
|
|
7448
7466
|
// empty for init
|
|
7449
|
-
_(this, "hands",
|
|
7467
|
+
_(this, "hands", H(new Mt("")));
|
|
7450
7468
|
// empty for init
|
|
7451
|
-
_(this, "counter", new
|
|
7469
|
+
_(this, "counter", new Ci());
|
|
7452
7470
|
_(this, "doraMarkers", []);
|
|
7453
7471
|
// empty for init
|
|
7454
7472
|
_(this, "eventHandler");
|
|
@@ -7554,11 +7572,11 @@ class gs {
|
|
|
7554
7572
|
}
|
|
7555
7573
|
}
|
|
7556
7574
|
}
|
|
7557
|
-
class
|
|
7575
|
+
class Ko extends gs {
|
|
7558
7576
|
constructor(e) {
|
|
7559
7577
|
super("observer", e);
|
|
7560
7578
|
_(this, "applied", {});
|
|
7561
|
-
this.counter.disable = !0, this.hands =
|
|
7579
|
+
this.counter.disable = !0, this.hands = H(new Mt("_____________"));
|
|
7562
7580
|
}
|
|
7563
7581
|
setHands(e) {
|
|
7564
7582
|
this.hands[e.wind] = new Mt(e.hands[e.wind]);
|
|
@@ -7688,17 +7706,17 @@ class Xt extends gs {
|
|
|
7688
7706
|
}
|
|
7689
7707
|
}
|
|
7690
7708
|
}
|
|
7691
|
-
class
|
|
7709
|
+
class ea {
|
|
7692
7710
|
constructor(t) {
|
|
7693
7711
|
_(this, "index", 0);
|
|
7694
7712
|
_(this, "histories", []);
|
|
7695
7713
|
this.histories = JSON.parse(t);
|
|
7696
7714
|
}
|
|
7697
7715
|
next() {
|
|
7698
|
-
|
|
7716
|
+
S(this.index < this.histories.length), this.index++;
|
|
7699
7717
|
}
|
|
7700
7718
|
prev() {
|
|
7701
|
-
this.index--,
|
|
7719
|
+
this.index--, S(this.index < 0);
|
|
7702
7720
|
}
|
|
7703
7721
|
start() {
|
|
7704
7722
|
pe.load(this.histories[this.index]).start();
|
|
@@ -7708,8 +7726,8 @@ class Qo {
|
|
|
7708
7726
|
this.start();
|
|
7709
7727
|
}
|
|
7710
7728
|
}
|
|
7711
|
-
const
|
|
7712
|
-
const [t, e] = Gt(), [s, r] = Gt(), [i, o] = Gt(), [a, c] = Gt(), l = ["player-1", "player-2", "player-3", "player-4"], u = n == null ? void 0 : n.playerInjection, h = (u == null ? void 0 : u.p1) ?? Xt, d = (u == null ? void 0 : u.p2) ?? Xt, g = (u == null ? void 0 : u.p3) ?? Xt, f = (u == null ? void 0 : u.p4) ?? Xt, m = new h(l[0], e), E = new d(l[1], r),
|
|
7729
|
+
const na = (n) => {
|
|
7730
|
+
const [t, e] = Gt(), [s, r] = Gt(), [i, o] = Gt(), [a, c] = Gt(), l = ["player-1", "player-2", "player-3", "player-4"], u = n == null ? void 0 : n.playerInjection, h = (u == null ? void 0 : u.p1) ?? Xt, d = (u == null ? void 0 : u.p2) ?? Xt, g = (u == null ? void 0 : u.p3) ?? Xt, f = (u == null ? void 0 : u.p4) ?? Xt, m = new h(l[0], e), E = new d(l[1], r), N = new g(l[2], o), O = new f(l[3], c), R = [
|
|
7713
7731
|
{ handler: t, id: l[0] },
|
|
7714
7732
|
{ handler: s, id: l[1] },
|
|
7715
7733
|
{ handler: i, id: l[2] },
|
|
@@ -7722,7 +7740,7 @@ const ta = (n) => {
|
|
|
7722
7740
|
}),
|
|
7723
7741
|
p1: m,
|
|
7724
7742
|
p2: E,
|
|
7725
|
-
p3:
|
|
7743
|
+
p3: N,
|
|
7726
7744
|
p4: O
|
|
7727
7745
|
};
|
|
7728
7746
|
}, ot = (n, t) => {
|
|
@@ -7750,7 +7768,7 @@ class le {
|
|
|
7750
7768
|
return s;
|
|
7751
7769
|
}
|
|
7752
7770
|
static selectMinPriority(t, e, s) {
|
|
7753
|
-
|
|
7771
|
+
S(e.length > 0);
|
|
7754
7772
|
let r = 0, i = 0;
|
|
7755
7773
|
for (let o = 0; o < e.length; o++) {
|
|
7756
7774
|
const a = le.calcPriority(t, e[o], s);
|
|
@@ -7773,7 +7791,7 @@ class le {
|
|
|
7773
7791
|
}
|
|
7774
7792
|
class Dt {
|
|
7775
7793
|
static selectTile(t, e, s) {
|
|
7776
|
-
|
|
7794
|
+
S(e.length > 0 && s.length > 0);
|
|
7777
7795
|
let r = s[0], i = Number.POSITIVE_INFINITY;
|
|
7778
7796
|
for (let o of s) {
|
|
7779
7797
|
const a = Dt.rank(t, e, o);
|
|
@@ -7815,19 +7833,19 @@ export {
|
|
|
7815
7833
|
gs as BaseActor,
|
|
7816
7834
|
T as Block,
|
|
7817
7835
|
M as BlockAnKan,
|
|
7818
|
-
|
|
7836
|
+
Si as BlockCalculator,
|
|
7819
7837
|
J as BlockChi,
|
|
7820
7838
|
Y as BlockDaiKan,
|
|
7821
7839
|
Kt as BlockHand,
|
|
7822
7840
|
kn as BlockIsolated,
|
|
7823
7841
|
Cn as BlockOther,
|
|
7824
|
-
|
|
7842
|
+
P as BlockPair,
|
|
7825
7843
|
X as BlockPon,
|
|
7826
7844
|
ut as BlockRun,
|
|
7827
7845
|
K as BlockShoKan,
|
|
7828
7846
|
F as BlockThree,
|
|
7829
7847
|
pe as Controller,
|
|
7830
|
-
|
|
7848
|
+
Ci as Counter,
|
|
7831
7849
|
pn as DoubleCalculator,
|
|
7832
7850
|
zt as Efficiency,
|
|
7833
7851
|
In as FONT_FAMILY,
|
|
@@ -7837,17 +7855,17 @@ export {
|
|
|
7837
7855
|
Bn as Image,
|
|
7838
7856
|
zn as ImageHelper,
|
|
7839
7857
|
yt as Mark,
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7858
|
+
jo as MeasureText,
|
|
7859
|
+
Go as MyG,
|
|
7860
|
+
Vo as MyImage,
|
|
7861
|
+
Xo as MyRect,
|
|
7862
|
+
Zo as MySVG,
|
|
7863
|
+
Yo as MyText,
|
|
7864
|
+
Jo as MyUse,
|
|
7847
7865
|
V as N19,
|
|
7848
7866
|
Lt as NZ,
|
|
7849
7867
|
y as OP,
|
|
7850
|
-
|
|
7868
|
+
Ko as Observer,
|
|
7851
7869
|
B as Parser,
|
|
7852
7870
|
ie as PlaceManager,
|
|
7853
7871
|
Xt as Player,
|
|
@@ -7855,48 +7873,48 @@ export {
|
|
|
7855
7873
|
k as ROUND,
|
|
7856
7874
|
On as ROUND_MAP,
|
|
7857
7875
|
Dn as Rect,
|
|
7858
|
-
|
|
7876
|
+
ea as Replayer,
|
|
7859
7877
|
Dt as RiskRank,
|
|
7860
7878
|
Jn as River,
|
|
7861
7879
|
nn as STICK_CONTEXT,
|
|
7862
|
-
|
|
7880
|
+
Gr as SVG,
|
|
7863
7881
|
re as ScoreManager,
|
|
7864
7882
|
de as ShantenCalculator,
|
|
7865
|
-
|
|
7883
|
+
Zr as Svg,
|
|
7866
7884
|
Kn as Symbol,
|
|
7867
|
-
|
|
7885
|
+
Ns as TABLE_CONTEXT,
|
|
7868
7886
|
ft as TILE_CONTEXT,
|
|
7869
7887
|
p as TYPE,
|
|
7870
|
-
|
|
7888
|
+
St as Text,
|
|
7871
7889
|
w as Tile,
|
|
7872
7890
|
je as Use,
|
|
7873
7891
|
A as WIND,
|
|
7874
7892
|
We as WIND_MAP,
|
|
7875
7893
|
vt as Wall,
|
|
7876
7894
|
on as callBlockIndex,
|
|
7877
|
-
|
|
7895
|
+
Ai as convertInput,
|
|
7878
7896
|
Tn as createControllerMachine,
|
|
7879
|
-
|
|
7897
|
+
ki as createEventEmitter,
|
|
7880
7898
|
Gt as createEventPipe,
|
|
7881
7899
|
Wt as createHand,
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7900
|
+
na as createLocalGame,
|
|
7901
|
+
ai as createTable,
|
|
7902
|
+
H as createWindMap,
|
|
7885
7903
|
Zt as deserializeWinResult,
|
|
7886
|
-
|
|
7887
|
-
|
|
7904
|
+
qo as drawBlocks,
|
|
7905
|
+
ta as drawTable,
|
|
7888
7906
|
z as forHand,
|
|
7889
|
-
|
|
7907
|
+
Do as incrementalIDGenerator,
|
|
7890
7908
|
C as isNum5,
|
|
7891
7909
|
Yt as nextRound,
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7910
|
+
Nt as nextWind,
|
|
7911
|
+
Qo as optimizeSVG,
|
|
7912
|
+
mi as parse,
|
|
7913
|
+
wi as parseTableInput,
|
|
7914
|
+
Uo as prevRound,
|
|
7897
7915
|
De as prevWind,
|
|
7898
|
-
|
|
7899
|
-
|
|
7916
|
+
vi as prioritizeDiscardedEvents,
|
|
7917
|
+
Ti as prioritizeDrawnEvents,
|
|
7900
7918
|
Vn as shuffle,
|
|
7901
7919
|
Ts as sortCalledTiles,
|
|
7902
7920
|
ue as tileSortFunc
|