Initial Modpack Upload
This commit is contained in:
1 parent
268b0650aa
commit
3d8b956ee4
1429 files changed
+820128
No files matched your search
@@ -0,0 +1,381 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var generator_elimination_exports = {};
|
||||
__export(generator_elimination_exports, {
|
||||
Elimination: () => Elimination
|
||||
});
|
||||
module.exports = __toCommonJS(generator_elimination_exports);
|
||||
var import_lib = require("../../lib");
|
||||
class ElimNode {
|
||||
constructor(options) {
|
||||
this.children = null;
|
||||
this.user = options.user || null;
|
||||
this.state = options.state || "";
|
||||
this.result = options.result || "";
|
||||
this.score = options.score || null;
|
||||
this.losersBracketNode = options.losersBracketNode || null;
|
||||
this.losersBracketIndex = options.losersBracketIndex || 0;
|
||||
this.parent = options.parent || null;
|
||||
this.fromNode = options.fromNode || null;
|
||||
}
|
||||
setChildren(children) {
|
||||
if (this.children) {
|
||||
for (const child of this.children)
|
||||
child.parent = null;
|
||||
}
|
||||
if (children) {
|
||||
for (const child of children)
|
||||
child.parent = this;
|
||||
}
|
||||
this.children = children;
|
||||
}
|
||||
traverse(multiCallback) {
|
||||
const queue = [this];
|
||||
let node;
|
||||
while (node = queue.shift()) {
|
||||
multiCallback(node);
|
||||
if (node.children)
|
||||
queue.push(...node.children);
|
||||
}
|
||||
}
|
||||
find(multiCallback) {
|
||||
const queue = [this];
|
||||
let node;
|
||||
while (node = queue.shift()) {
|
||||
const value = multiCallback(node);
|
||||
if (value) {
|
||||
return value;
|
||||
}
|
||||
if (node.children)
|
||||
queue.push(...node.children);
|
||||
}
|
||||
return void 0;
|
||||
}
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
[Symbol.iterator]() {
|
||||
const results = [this];
|
||||
for (const result of results) {
|
||||
if (result.children)
|
||||
results.push(...result.children);
|
||||
}
|
||||
return results[Symbol.iterator]();
|
||||
}
|
||||
toJSON() {
|
||||
const node = {};
|
||||
if (!this.children) {
|
||||
node.team = this.user || (this.losersBracketIndex <= 1 ? `(loser's bracket)` : `(loser's bracket ${this.losersBracketIndex})`);
|
||||
} else {
|
||||
node.children = this.children.map((child) => child.toJSON());
|
||||
node.state = this.state || "unavailable";
|
||||
if (node.state === "finished") {
|
||||
node.team = this.user;
|
||||
node.result = this.result;
|
||||
node.score = this.score;
|
||||
}
|
||||
}
|
||||
return node;
|
||||
}
|
||||
}
|
||||
const nameMap = [
|
||||
"",
|
||||
"Single",
|
||||
"Double",
|
||||
"Triple",
|
||||
"Quadruple",
|
||||
"Quintuple",
|
||||
"Sextuple"
|
||||
// Feel free to add more
|
||||
];
|
||||
class Elimination {
|
||||
constructor(maxSubtrees) {
|
||||
this.name = "Elimination";
|
||||
this.isDrawingSupported = false;
|
||||
this.isBracketFrozen = false;
|
||||
this.players = [];
|
||||
maxSubtrees = maxSubtrees || 1;
|
||||
if (typeof maxSubtrees === "string" && maxSubtrees.toLowerCase() === "infinity") {
|
||||
maxSubtrees = Infinity;
|
||||
} else if (typeof maxSubtrees !== "number") {
|
||||
maxSubtrees = parseInt(maxSubtrees);
|
||||
}
|
||||
if (!maxSubtrees || maxSubtrees < 1)
|
||||
maxSubtrees = 1;
|
||||
this.maxSubtrees = maxSubtrees;
|
||||
this.treeRoot = null;
|
||||
if (nameMap[maxSubtrees]) {
|
||||
this.name = `${nameMap[maxSubtrees]} ${this.name}`;
|
||||
} else if (maxSubtrees === Infinity) {
|
||||
this.name = `N-${this.name}`;
|
||||
} else {
|
||||
this.name = `${maxSubtrees}-tuple ${this.name}`;
|
||||
}
|
||||
}
|
||||
getPendingBracketData(players) {
|
||||
return {
|
||||
type: "tree",
|
||||
rootNode: null
|
||||
};
|
||||
}
|
||||
getBracketData() {
|
||||
return {
|
||||
type: "tree",
|
||||
rootNode: this.treeRoot.toJSON()
|
||||
};
|
||||
}
|
||||
freezeBracket(players) {
|
||||
if (!players.length)
|
||||
throw new Error(`No players in tournament`);
|
||||
this.players = players;
|
||||
this.isBracketFrozen = true;
|
||||
let tree = null;
|
||||
for (const user of import_lib.Utils.shuffle(players)) {
|
||||
if (!tree) {
|
||||
tree = {
|
||||
root: new ElimNode({ user }),
|
||||
currentLayerLeafNodes: [],
|
||||
nextLayerLeafNodes: []
|
||||
};
|
||||
tree.currentLayerLeafNodes.push(tree.root);
|
||||
continue;
|
||||
}
|
||||
const targetNode = tree.currentLayerLeafNodes.shift();
|
||||
if (!targetNode)
|
||||
throw new Error(`TypeScript bug: no ! in checkJs`);
|
||||
const newLeftChild = new ElimNode({ user: targetNode.user });
|
||||
tree.nextLayerLeafNodes.push(newLeftChild);
|
||||
const newRightChild = new ElimNode({ user });
|
||||
tree.nextLayerLeafNodes.push(newRightChild);
|
||||
targetNode.setChildren([newLeftChild, newRightChild]);
|
||||
targetNode.user = null;
|
||||
if (tree.currentLayerLeafNodes.length === 0) {
|
||||
tree.currentLayerLeafNodes = tree.nextLayerLeafNodes;
|
||||
tree.nextLayerLeafNodes = [];
|
||||
}
|
||||
}
|
||||
this.maxSubtrees = Math.min(this.maxSubtrees, players.length - 1);
|
||||
for (let losersBracketIndex = 1; losersBracketIndex < this.maxSubtrees; losersBracketIndex++) {
|
||||
const matchesByDepth = {};
|
||||
const queue = [{ node: tree.root, depth: 0 }];
|
||||
let frame;
|
||||
while (frame = queue.shift()) {
|
||||
if (!frame.node.children || frame.node.losersBracketNode)
|
||||
continue;
|
||||
if (!matchesByDepth[frame.depth])
|
||||
matchesByDepth[frame.depth] = [];
|
||||
matchesByDepth[frame.depth].push(frame.node);
|
||||
queue.push({ node: frame.node.children[0], depth: frame.depth + 1 });
|
||||
queue.push({ node: frame.node.children[1], depth: frame.depth + 1 });
|
||||
}
|
||||
const newTree = {
|
||||
root: new ElimNode({ losersBracketIndex, fromNode: matchesByDepth[0][0] }),
|
||||
currentLayerLeafNodes: [],
|
||||
nextLayerLeafNodes: []
|
||||
};
|
||||
newTree.currentLayerLeafNodes.push(newTree.root);
|
||||
for (const depth in matchesByDepth) {
|
||||
if (depth === "0")
|
||||
continue;
|
||||
const matchesThisDepth = matchesByDepth[depth];
|
||||
let n = 0;
|
||||
for (; n < matchesThisDepth.length - 1; n += 2) {
|
||||
const oldLeaf = newTree.currentLayerLeafNodes.shift();
|
||||
if (!oldLeaf)
|
||||
throw new Error(`TypeScript bug: no ! in checkJs`);
|
||||
const oldLeafFromNode = oldLeaf.fromNode;
|
||||
oldLeaf.fromNode = null;
|
||||
const newBranch = new ElimNode({ losersBracketIndex });
|
||||
oldLeaf.setChildren([new ElimNode({ losersBracketIndex, fromNode: oldLeafFromNode }), newBranch]);
|
||||
const newLeftChild = new ElimNode({ losersBracketIndex, fromNode: matchesThisDepth[n] });
|
||||
newTree.nextLayerLeafNodes.push(newLeftChild);
|
||||
const newRightChild = new ElimNode({ losersBracketIndex, fromNode: matchesThisDepth[n + 1] });
|
||||
newTree.nextLayerLeafNodes.push(newRightChild);
|
||||
newBranch.setChildren([newLeftChild, newRightChild]);
|
||||
}
|
||||
if (n < matchesThisDepth.length) {
|
||||
const oldLeaf = newTree.currentLayerLeafNodes.shift();
|
||||
const oldLeafFromNode = oldLeaf.fromNode;
|
||||
oldLeaf.fromNode = null;
|
||||
const newLeaf = new ElimNode({ fromNode: matchesThisDepth[n] });
|
||||
newTree.nextLayerLeafNodes.push(newLeaf);
|
||||
oldLeaf.setChildren([new ElimNode({ fromNode: oldLeafFromNode }), newLeaf]);
|
||||
}
|
||||
newTree.currentLayerLeafNodes = newTree.nextLayerLeafNodes;
|
||||
newTree.nextLayerLeafNodes = [];
|
||||
}
|
||||
newTree.root.traverse((node) => {
|
||||
if (node.fromNode) {
|
||||
node.fromNode.losersBracketNode = node;
|
||||
node.fromNode = null;
|
||||
}
|
||||
});
|
||||
const newRoot = new ElimNode({});
|
||||
newRoot.setChildren([tree.root, newTree.root]);
|
||||
tree.root = newRoot;
|
||||
}
|
||||
tree.root.traverse((node) => {
|
||||
if (node.children && node.children[0].user && node.children[1].user) {
|
||||
node.state = "available";
|
||||
}
|
||||
});
|
||||
this.treeRoot = tree.root;
|
||||
}
|
||||
disqualifyUser(user) {
|
||||
if (!this.isBracketFrozen)
|
||||
return "BracketNotFrozen";
|
||||
const found = this.treeRoot.find((node) => {
|
||||
if (node.state === "available") {
|
||||
if (!node.children)
|
||||
throw new Error(`no children`);
|
||||
if (node.children[0].user === user) {
|
||||
return {
|
||||
match: [user, node.children[1].user],
|
||||
result: "loss",
|
||||
score: [0, 1]
|
||||
};
|
||||
} else if (node.children[1].user === user) {
|
||||
return {
|
||||
match: [node.children[0].user, user],
|
||||
result: "win",
|
||||
score: [1, 0]
|
||||
};
|
||||
}
|
||||
}
|
||||
return void 0;
|
||||
});
|
||||
if (found) {
|
||||
const error = this.setMatchResult(found.match, found.result, found.score);
|
||||
if (error) {
|
||||
throw new Error(`Unexpected ${error} from setMatchResult([${found.match.join(", ")}], ${found.result})`);
|
||||
}
|
||||
}
|
||||
user.unlinkUser();
|
||||
}
|
||||
getAvailableMatches() {
|
||||
if (!this.isBracketFrozen)
|
||||
return "BracketNotFrozen";
|
||||
const matches = [];
|
||||
this.treeRoot.traverse((node) => {
|
||||
if (node.state !== "available")
|
||||
return;
|
||||
const p1 = node.children[0].user;
|
||||
const p2 = node.children[1].user;
|
||||
if (!p1.isBusy && !p2.isBusy) {
|
||||
matches.push([p1, p2]);
|
||||
}
|
||||
});
|
||||
return matches;
|
||||
}
|
||||
setMatchResult([p1, p2], result, score) {
|
||||
if (!this.isBracketFrozen)
|
||||
return "BracketNotFrozen";
|
||||
if (!["win", "loss"].includes(result))
|
||||
return "InvalidMatchResult";
|
||||
if (!this.players.includes(p1) || !this.players.includes(p2))
|
||||
return "UserNotAdded";
|
||||
const targetNode = this.treeRoot.find((node) => {
|
||||
if (node.state === "available" && (node.children[0].user === p1 && node.children[1].user === p2)) {
|
||||
return node;
|
||||
}
|
||||
return void 0;
|
||||
});
|
||||
if (!targetNode)
|
||||
return "InvalidMatch";
|
||||
if (!targetNode.children)
|
||||
throw new Error(`invalid available state`);
|
||||
targetNode.state = "finished";
|
||||
targetNode.result = result;
|
||||
targetNode.score = score.slice();
|
||||
const winner = targetNode.children[result === "win" ? 0 : 1].user;
|
||||
const loser = targetNode.children[result === "loss" ? 0 : 1].user;
|
||||
targetNode.user = winner;
|
||||
if (!winner || !loser)
|
||||
throw new Error(`invalid available state`);
|
||||
if (loser.losses === this.maxSubtrees) {
|
||||
loser.isEliminated = true;
|
||||
loser.sendRoom(`|tournament|update|{"isJoined":false}`);
|
||||
loser.unlinkUser();
|
||||
}
|
||||
if (targetNode.parent) {
|
||||
const parent = targetNode.parent;
|
||||
if (loser.losses <= winner.losses && !loser.isDisqualified) {
|
||||
const newNode = new ElimNode({ state: "available", losersBracketNode: targetNode.losersBracketNode });
|
||||
newNode.setChildren([targetNode, new ElimNode({ user: loser })]);
|
||||
parent.setChildren([newNode, parent.children[1]]);
|
||||
return;
|
||||
}
|
||||
const userA = parent.children[0].user;
|
||||
const userB = parent.children[1].user;
|
||||
if (userA && userB) {
|
||||
parent.state = "available";
|
||||
let error = "";
|
||||
if (userA.isDisqualified) {
|
||||
error = this.setMatchResult([userA, userB], "loss", [0, 1]);
|
||||
} else if (userB.isDisqualified) {
|
||||
error = this.setMatchResult([userA, userB], "win", [1, 0]);
|
||||
}
|
||||
if (error) {
|
||||
throw new Error(`Unexpected ${error} from setMatchResult([${userA},${userB}], ...)`);
|
||||
}
|
||||
}
|
||||
} else if (loser.losses < this.maxSubtrees && !loser.isDisqualified) {
|
||||
const newRoot = new ElimNode({ state: "available" });
|
||||
newRoot.setChildren([targetNode, new ElimNode({ user: loser })]);
|
||||
this.treeRoot = newRoot;
|
||||
}
|
||||
if (targetNode.losersBracketNode) {
|
||||
targetNode.losersBracketNode.user = loser;
|
||||
const userA = targetNode.losersBracketNode.parent.children[0].user;
|
||||
const userB = targetNode.losersBracketNode.parent.children[1].user;
|
||||
if (userA && userB) {
|
||||
targetNode.losersBracketNode.parent.state = "available";
|
||||
let error = "";
|
||||
if (userA.isDisqualified) {
|
||||
error = this.setMatchResult([userA, userB], "loss", [0, 1]);
|
||||
} else if (userB.isDisqualified) {
|
||||
error = this.setMatchResult([userA, userB], "win", [1, 0]);
|
||||
}
|
||||
if (error) {
|
||||
throw new Error(`Unexpected ${error} from setMatchResult([${userA}, ${userB}], ...)`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
isTournamentEnded() {
|
||||
return this.treeRoot.state === "finished";
|
||||
}
|
||||
getResults() {
|
||||
if (!this.isTournamentEnded())
|
||||
return "TournamentNotEnded";
|
||||
const results = [];
|
||||
let currentNode = this.treeRoot;
|
||||
for (let n = 0; n < this.maxSubtrees; ++n) {
|
||||
results.push([currentNode.user]);
|
||||
if (!currentNode.children)
|
||||
break;
|
||||
currentNode = currentNode.children[currentNode.result === "loss" ? 0 : 1];
|
||||
if (!currentNode)
|
||||
break;
|
||||
}
|
||||
if (this.players.length - 1 === this.maxSubtrees && currentNode) {
|
||||
results.push([currentNode.user]);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=generator-elimination.js.map
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../../../server/tournaments/generator-elimination.ts"],
|
||||
"sourcesContent": ["import {Utils} from '../../lib';\r\n\r\ninterface ElimTree {\r\n\troot: ElimNode;\r\n\tcurrentLayerLeafNodes: ElimNode[];\r\n\tnextLayerLeafNodes: ElimNode[];\r\n}\r\n\r\nimport type {TournamentPlayer} from './index';\r\n\r\n/**\r\n * There are two types of elim nodes, player nodes\r\n * and match nodes.\r\n *\r\n * Player nodes are leaf nodes: .children = none\r\n *\r\n * Match nodes are non-leaf nodes, and will always have two children.\r\n */\r\nclass ElimNode {\r\n\tchildren: [ElimNode, ElimNode] | null;\r\n\t/**\r\n\t * In a player node, the player (null if it's an unfilled loser's bracket node).\r\n\t *\r\n\t * In a match node, the winner if it exists, otherwise null.\r\n\t */\r\n\tuser: TournamentPlayer | null;\r\n\t/**\r\n\t * Only relevant to match nodes. (Player nodes are always '')\r\n\t *\r\n\t * 'available' = ready for battles - will have two children, both with users; this.user is null\r\n\t *\r\n\t * 'finished' = battle already over - will have two children, both with users; this.user is winner\r\n\t *\r\n\t * '' = unavailable\r\n\t */\r\n\tstate: 'available' | 'finished' | '';\r\n\tresult: 'win' | 'loss' | '';\r\n\tscore: number[] | null;\r\n\t/**\r\n\t * Only relevant to match nodes in double+ elimination.\r\n\t *\r\n\t * The loser of this battle will be put in target player node.\r\n\t */\r\n\tlosersBracketNode: ElimNode | null;\r\n\t/**\r\n\t * 0 = winner's bracket\r\n\t * 1 = loser's bracket\r\n\t * 2 = second loser's bracket\r\n\t * etc\r\n\t * (always 0 in single elimination)\r\n\t */\r\n\tlosersBracketIndex: number;\r\n\tparent: ElimNode | null;\r\n\t/**\r\n\t * Only used while building the tree\r\n\t */\r\n\tfromNode: ElimNode | null;\r\n\tconstructor(options: Partial<ElimNode>) {\r\n\t\tthis.children = null;\r\n\t\tthis.user = options.user || null;\r\n\t\tthis.state = options.state || '';\r\n\t\tthis.result = options.result || '';\r\n\t\tthis.score = options.score || null;\r\n\t\tthis.losersBracketNode = options.losersBracketNode || null;\r\n\t\tthis.losersBracketIndex = options.losersBracketIndex || 0;\r\n\t\tthis.parent = options.parent || null;\r\n\t\tthis.fromNode = options.fromNode || null;\r\n\t}\r\n\tsetChildren(children: [ElimNode, ElimNode] | null) {\r\n\t\tif (this.children) {\r\n\t\t\tfor (const child of this.children) child.parent = null;\r\n\t\t}\r\n\t\tif (children) {\r\n\t\t\tfor (const child of children) child.parent = this;\r\n\t\t}\r\n\t\tthis.children = children;\r\n\t}\r\n\ttraverse(multiCallback: (node: ElimNode) => void) {\r\n\t\tconst queue: ElimNode[] = [this];\r\n\t\tlet node;\r\n\t\twhile ((node = queue.shift())) {\r\n\t\t\tmultiCallback(node);\r\n\t\t\tif (node.children) queue.push(...node.children);\r\n\t\t}\r\n\t}\r\n\tfind<T>(multiCallback: (node: ElimNode) => (T | void)) {\r\n\t\tconst queue: ElimNode[] = [this];\r\n\t\tlet node;\r\n\t\twhile ((node = queue.shift())) {\r\n\t\t\tconst value = multiCallback(node);\r\n\t\t\tif (value) {\r\n\t\t\t\treturn value;\r\n\t\t\t}\r\n\t\t\tif (node.children) queue.push(...node.children);\r\n\t\t}\r\n\t\treturn undefined;\r\n\t}\r\n\t// eslint-disable-next-line no-restricted-globals\r\n\t[Symbol.iterator]() {\r\n\t\tconst results: ElimNode[] = [this];\r\n\t\tfor (const result of results) {\r\n\t\t\tif (result.children) results.push(...result.children);\r\n\t\t}\r\n\t\t// eslint-disable-next-line no-restricted-globals\r\n\t\treturn results[Symbol.iterator]();\r\n\t}\r\n\ttoJSON() {\r\n\t\tconst node: any = {};\r\n\r\n\t\tif (!this.children) {\r\n\t\t\tnode.team = this.user || (\r\n\t\t\t\tthis.losersBracketIndex <= 1 ? `(loser's bracket)` : `(loser's bracket ${this.losersBracketIndex})`\r\n\t\t\t);\r\n\t\t} else {\r\n\t\t\tnode.children = this.children.map(child => child.toJSON());\r\n\t\t\tnode.state = this.state || 'unavailable';\r\n\t\t\tif (node.state === 'finished') {\r\n\t\t\t\tnode.team = this.user;\r\n\t\t\t\tnode.result = this.result;\r\n\t\t\t\tnode.score = this.score;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn node;\r\n\t}\r\n}\r\n\r\nconst nameMap = [\r\n\t\"\",\r\n\t\"Single\",\r\n\t\"Double\",\r\n\t\"Triple\",\r\n\t\"Quadruple\",\r\n\t\"Quintuple\",\r\n\t\"Sextuple\",\r\n\t// Feel free to add more\r\n];\r\n\r\nexport class Elimination {\r\n\treadonly name: string;\r\n\treadonly isDrawingSupported: boolean;\r\n\tisBracketFrozen: boolean;\r\n\tplayers: TournamentPlayer[];\r\n\tmaxSubtrees: number;\r\n\ttreeRoot: ElimNode;\r\n\tconstructor(maxSubtrees: number | string) {\r\n\t\tthis.name = \"Elimination\";\r\n\t\tthis.isDrawingSupported = false;\r\n\t\tthis.isBracketFrozen = false;\r\n\t\tthis.players = [];\r\n\r\n\t\tmaxSubtrees = maxSubtrees || 1;\r\n\t\tif (typeof maxSubtrees === 'string' && maxSubtrees.toLowerCase() === 'infinity') {\r\n\t\t\tmaxSubtrees = Infinity;\r\n\t\t} else if (typeof maxSubtrees !== 'number') {\r\n\t\t\tmaxSubtrees = parseInt(maxSubtrees);\r\n\t\t}\r\n\t\tif (!maxSubtrees || maxSubtrees < 1) maxSubtrees = 1;\r\n\r\n\t\tthis.maxSubtrees = maxSubtrees;\r\n\t\tthLine truncated
|
||||
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAoB;AAkBpB,MAAM,SAAS;AAAA,EAuCd,YAAY,SAA4B;AACvC,SAAK,WAAW;AAChB,SAAK,OAAO,QAAQ,QAAQ;AAC5B,SAAK,QAAQ,QAAQ,SAAS;AAC9B,SAAK,SAAS,QAAQ,UAAU;AAChC,SAAK,QAAQ,QAAQ,SAAS;AAC9B,SAAK,oBAAoB,QAAQ,qBAAqB;AACtD,SAAK,qBAAqB,QAAQ,sBAAsB;AACxD,SAAK,SAAS,QAAQ,UAAU;AAChC,SAAK,WAAW,QAAQ,YAAY;AAAA,EACrC;AAAA,EACA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O,CAAC;AAAA,QACzE;AAEA,gBAAQ,wBAAwB,QAAQ;AACxC,gBAAQ,qBAAqB,CAAC;AAAA,MAC/B;AAEA,cAAQ,KAAK,SAAS,UAAQ;AAC7B,YAAI,KAAK,UAAU;AAClB,eAAK,SAAS,oBAAoB;AAClC,eAAK,WAAW;AAAA,QACjB;AAAA,MACD,CAAC;AAED,YAAM,UAAU,IAAI,SAAS,CAAC,CAAC;AAC/B,cAAQ,YAAY,CAAC,KAAK,MAAM,QAAQ,IAAI,CAAC;AAC7C,WAAK,OAAO;AAAA,IACb;AAEA,SAAK,KAAK,SAAS,UAAQ;AAC1B,UAAI,KAAK,YAAY,KAAK,SAAS,CAAC,EAAE,QAAQ,KAAK,SAAS,CAAC,EAAE,MAAM;AACpE,aAAK,QAAQ;AAAA,MACd;AAAA,IACD,CAAC;AAED,SAAK,WAAW,KAAK;AAAA,EACtB;AAAA,EAEA,eALine truncated
|
||||
"names": []
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var generator_round_robin_exports = {};
|
||||
__export(generator_round_robin_exports, {
|
||||
RoundRobin: () => RoundRobin
|
||||
});
|
||||
module.exports = __toCommonJS(generator_round_robin_exports);
|
||||
var import_utils = require("../../lib/utils");
|
||||
class RoundRobin {
|
||||
constructor(isDoubles) {
|
||||
this.name = "Round Robin";
|
||||
this.isDrawingSupported = true;
|
||||
this.isDoubles = !!isDoubles;
|
||||
this.isBracketFrozen = false;
|
||||
this.players = [];
|
||||
this.matches = [];
|
||||
this.totalPendingMatches = -1;
|
||||
this.perPlayerPendingMatches = -1;
|
||||
if (isDoubles)
|
||||
this.name = "Double " + this.name;
|
||||
}
|
||||
getPendingBracketData(players) {
|
||||
return {
|
||||
type: "table",
|
||||
tableHeaders: {
|
||||
cols: players.slice(0),
|
||||
rows: players.slice(0)
|
||||
},
|
||||
tableContents: players.map(
|
||||
(p1, row) => players.map((p2, col) => {
|
||||
if (!this.isDoubles && col >= row)
|
||||
return null;
|
||||
if (p1 === p2)
|
||||
return null;
|
||||
return {
|
||||
state: "unavailable"
|
||||
};
|
||||
})
|
||||
),
|
||||
scores: players.map((player) => 0)
|
||||
};
|
||||
}
|
||||
getBracketData() {
|
||||
const players = this.players;
|
||||
return {
|
||||
type: "table",
|
||||
tableHeaders: {
|
||||
cols: players.slice(0),
|
||||
rows: players.slice(0)
|
||||
},
|
||||
tableContents: players.map(
|
||||
(p1, row) => players.map((p2, col) => {
|
||||
if (!this.isDoubles && col >= row)
|
||||
return null;
|
||||
if (p1 === p2)
|
||||
return null;
|
||||
const match = this.matches[row][col];
|
||||
if (!match)
|
||||
return null;
|
||||
const cell = {
|
||||
state: match.state
|
||||
};
|
||||
if (match.state === "finished" && match.score) {
|
||||
cell.result = match.result;
|
||||
cell.score = match.score.slice(0);
|
||||
}
|
||||
return cell;
|
||||
})
|
||||
),
|
||||
scores: players.map((player) => player.score)
|
||||
};
|
||||
}
|
||||
freezeBracket(players) {
|
||||
this.players = players;
|
||||
this.isBracketFrozen = true;
|
||||
this.matches = players.map(
|
||||
(p1, row) => players.map((p2, col) => {
|
||||
if (!this.isDoubles && col >= row)
|
||||
return null;
|
||||
if (p1 === p2)
|
||||
return null;
|
||||
return { state: "available" };
|
||||
})
|
||||
);
|
||||
this.matchesPerPlayer = players.length - 1;
|
||||
this.totalPendingMatches = players.length * this.matchesPerPlayer / 2;
|
||||
if (this.isDoubles) {
|
||||
this.totalPendingMatches *= 2;
|
||||
this.matchesPerPlayer *= 2;
|
||||
}
|
||||
}
|
||||
disqualifyUser(user) {
|
||||
if (!this.isBracketFrozen)
|
||||
return "BracketNotFrozen";
|
||||
const playerIndex = this.players.indexOf(user);
|
||||
for (const [col, match] of this.matches[playerIndex].entries()) {
|
||||
if (!match || match.state !== "available")
|
||||
continue;
|
||||
const p2 = this.players[col];
|
||||
match.state = "finished";
|
||||
match.result = "loss";
|
||||
match.score = [0, 1];
|
||||
p2.score += 1;
|
||||
p2.games += 1;
|
||||
this.totalPendingMatches--;
|
||||
}
|
||||
for (const [row, challenges] of this.matches.entries()) {
|
||||
const match = challenges[playerIndex];
|
||||
if (!match || match.state !== "available")
|
||||
continue;
|
||||
const p1 = this.players[row];
|
||||
match.state = "finished";
|
||||
match.result = "win";
|
||||
match.score = [1, 0];
|
||||
p1.score += 1;
|
||||
p1.games += 1;
|
||||
this.totalPendingMatches--;
|
||||
}
|
||||
user.unlinkUser();
|
||||
}
|
||||
getAvailableMatches() {
|
||||
if (!this.isBracketFrozen)
|
||||
return "BracketNotFrozen";
|
||||
const matches = [];
|
||||
for (const [row, challenges] of this.matches.entries()) {
|
||||
const p1 = this.players[row];
|
||||
for (const [col, match] of challenges.entries()) {
|
||||
const p2 = this.players[col];
|
||||
if (!match)
|
||||
continue;
|
||||
if (match.state === "available" && !p1.isBusy && !p2.isBusy) {
|
||||
matches.push([p1, p2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
setMatchResult([p1, p2], result, score) {
|
||||
if (!this.isBracketFrozen)
|
||||
return "BracketNotFrozen";
|
||||
if (!["win", "loss", "draw"].includes(result))
|
||||
return "InvalidMatchResult";
|
||||
const row = this.players.indexOf(p1);
|
||||
const col = this.players.indexOf(p2);
|
||||
if (row < 0 || col < 0)
|
||||
return "UserNotAdded";
|
||||
const match = this.matches[row][col];
|
||||
if (!match || match.state !== "available")
|
||||
return "InvalidMatch";
|
||||
match.state = "finished";
|
||||
match.result = result;
|
||||
match.score = score.slice(0);
|
||||
this.totalPendingMatches--;
|
||||
}
|
||||
isTournamentEnded() {
|
||||
return this.isBracketFrozen && this.totalPendingMatches === 0;
|
||||
}
|
||||
getResults() {
|
||||
if (!this.isTournamentEnded())
|
||||
return "TournamentNotEnded";
|
||||
const sortedScores = import_utils.Utils.sortBy([...this.players], (p) => -p.score);
|
||||
const results = [];
|
||||
let currentScore = sortedScores[0].score;
|
||||
let currentRank = [];
|
||||
results.push(currentRank);
|
||||
for (const player of sortedScores) {
|
||||
if (player.score < currentScore) {
|
||||
currentScore = player.score;
|
||||
currentRank = [];
|
||||
results.push(currentRank);
|
||||
}
|
||||
currentRank.push(player);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=generator-round-robin.js.map
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../../../server/tournaments/generator-round-robin.ts"],
|
||||
"sourcesContent": ["interface Match {\r\n\tstate: string;\r\n\tscore?: number[];\r\n\tresult?: string;\r\n}\r\n\r\nimport {Utils} from '../../lib/utils';\r\nimport type {TournamentPlayer} from './index';\r\n\r\nexport class RoundRobin {\r\n\treadonly name: string;\r\n\treadonly isDrawingSupported: boolean;\r\n\treadonly isDoubles: boolean;\r\n\tisBracketFrozen: boolean;\r\n\tplayers: TournamentPlayer[];\r\n\tmatches: (Match | null)[][];\r\n\ttotalPendingMatches: number;\r\n\tperPlayerPendingMatches: number;\r\n\tmatchesPerPlayer?: number;\r\n\tconstructor(isDoubles: string) {\r\n\t\tthis.name = \"Round Robin\";\r\n\t\tthis.isDrawingSupported = true;\r\n\t\tthis.isDoubles = !!isDoubles;\r\n\t\tthis.isBracketFrozen = false;\r\n\t\tthis.players = [];\r\n\r\n\t\tthis.matches = [];\r\n\t\tthis.totalPendingMatches = -1;\r\n\t\tthis.perPlayerPendingMatches = -1;\r\n\r\n\t\tif (isDoubles) this.name = \"Double \" + this.name;\r\n\t}\r\n\r\n\tgetPendingBracketData(players: TournamentPlayer[]) {\r\n\t\treturn {\r\n\t\t\ttype: 'table',\r\n\t\t\ttableHeaders: {\r\n\t\t\t\tcols: players.slice(0),\r\n\t\t\t\trows: players.slice(0),\r\n\t\t\t},\r\n\t\t\ttableContents: players.map(\r\n\t\t\t\t(p1, row) => players.map((p2, col) => {\r\n\t\t\t\t\tif (!this.isDoubles && col >= row) return null;\r\n\t\t\t\t\tif (p1 === p2) return null;\r\n\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\tstate: 'unavailable',\r\n\t\t\t\t\t};\r\n\t\t\t\t})\r\n\t\t\t),\r\n\t\t\tscores: players.map(player => 0),\r\n\t\t};\r\n\t}\r\n\tgetBracketData() {\r\n\t\tconst players = this.players;\r\n\t\treturn {\r\n\t\t\ttype: 'table',\r\n\t\t\ttableHeaders: {\r\n\t\t\t\tcols: players.slice(0),\r\n\t\t\t\trows: players.slice(0),\r\n\t\t\t},\r\n\t\t\ttableContents: players.map(\r\n\t\t\t\t(p1, row) => players.map((p2, col) => {\r\n\t\t\t\t\tif (!this.isDoubles && col >= row) return null;\r\n\t\t\t\t\tif (p1 === p2) return null;\r\n\t\t\t\t\tconst match = this.matches[row][col];\r\n\t\t\t\t\tif (!match) return null;\r\n\r\n\t\t\t\t\tconst cell: any = {\r\n\t\t\t\t\t\tstate: match.state,\r\n\t\t\t\t\t};\r\n\t\t\t\t\tif (match.state === 'finished' && match.score) {\r\n\t\t\t\t\t\tcell.result = match.result;\r\n\t\t\t\t\t\tcell.score = match.score.slice(0);\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn cell;\r\n\t\t\t\t})\r\n\t\t\t),\r\n\t\t\tscores: players.map(player => player.score),\r\n\t\t};\r\n\t}\r\n\tfreezeBracket(players: TournamentPlayer[]) {\r\n\t\tthis.players = players;\r\n\t\tthis.isBracketFrozen = true;\r\n\r\n\t\tthis.matches = players.map(\r\n\t\t\t(p1, row) => players.map((p2, col) => {\r\n\t\t\t\tif (!this.isDoubles && col >= row) return null;\r\n\t\t\t\tif (p1 === p2) return null;\r\n\r\n\t\t\t\treturn {state: 'available'};\r\n\t\t\t})\r\n\t\t);\r\n\t\tthis.matchesPerPlayer = players.length - 1;\r\n\t\t// total matches = total players * matches per player / players per match\r\n\t\t// alternatively: the (playercount)th triangular number\r\n\t\tthis.totalPendingMatches = players.length * this.matchesPerPlayer / 2;\r\n\t\tif (this.isDoubles) {\r\n\t\t\tthis.totalPendingMatches *= 2;\r\n\t\t\tthis.matchesPerPlayer *= 2;\r\n\t\t}\r\n\t}\r\n\r\n\tdisqualifyUser(user: TournamentPlayer) {\r\n\t\tif (!this.isBracketFrozen) return 'BracketNotFrozen';\r\n\r\n\t\tconst playerIndex = this.players.indexOf(user);\r\n\r\n\t\tfor (const [col, match] of this.matches[playerIndex].entries()) {\r\n\t\t\tif (!match || match.state !== 'available') continue;\r\n\t\t\tconst p2 = this.players[col];\r\n\t\t\tmatch.state = 'finished';\r\n\t\t\tmatch.result = 'loss';\r\n\t\t\tmatch.score = [0, 1];\r\n\t\t\tp2.score += 1;\r\n\t\t\tp2.games += 1;\r\n\t\t\tthis.totalPendingMatches--;\r\n\t\t}\r\n\r\n\t\tfor (const [row, challenges] of this.matches.entries()) {\r\n\t\t\tconst match = challenges[playerIndex];\r\n\t\t\tif (!match || match.state !== 'available') continue;\r\n\t\t\tconst p1 = this.players[row];\r\n\t\t\tmatch.state = 'finished';\r\n\t\t\tmatch.result = 'win';\r\n\t\t\tmatch.score = [1, 0];\r\n\t\t\tp1.score += 1;\r\n\t\t\tp1.games += 1;\r\n\t\t\tthis.totalPendingMatches--;\r\n\t\t}\r\n\r\n\t\tuser.unlinkUser();\r\n\t}\r\n\r\n\tgetAvailableMatches() {\r\n\t\tif (!this.isBracketFrozen) return 'BracketNotFrozen';\r\n\r\n\t\tconst matches: [TournamentPlayer, TournamentPlayer][] = [];\r\n\t\tfor (const [row, challenges] of this.matches.entries()) {\r\n\t\t\tconst p1 = this.players[row];\r\n\t\t\tfor (const [col, match] of challenges.entries()) {\r\n\t\t\t\tconst p2 = this.players[col];\r\n\t\t\t\tif (!match) continue;\r\n\t\t\t\tif (match.state === 'available' && !p1.isBusy && !p2.isBusy) {\r\n\t\t\t\t\tmatches.push([p1, p2]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn matches;\r\n\t}\r\n\tsetMatchResult([p1, p2]: [TournamentPlayer, TournamentPlayer], result: string, score: number[]) {\r\n\t\tif (!this.isBracketFrozen) return 'BracketNotFrozen';\r\n\r\n\t\tif (!['win', 'loss', 'draw'].includes(result)) return 'InvalidMatchResult';\r\n\r\n\t\tconst row = this.players.indexOf(p1);\Line truncated
|
||||
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,mBAAoB;AAGb,MAAM,WAAW;AAAA,EAUvB,YAAY,WAAmB;AAC9B,SAAK,OAAO;AACZ,SAAK,qBAAqB;AAC1B,SAAK,YAAY,CAAC,CAAC;AACnB,SAAK,kBAAkB;AACvB,SAAK,UAAU,CAAC;AAEhB,SAAK,UAAU,CAAC;AAChB,SAAK,sBAAsB;AAC3B,SAAK,0BAA0B;AAE/B,QAAI;AAAW,WAAK,OAAO,YAAY,KAAK;AAAA,EAC7C;AAAA,EAEA,sBAAsB,SAA6B;AAClD,WAAO;AAAA,MACN,MAAM;AAAA,MACN,cAAc;AAAA,QACb,MAAM,QAAQ,MAAM,CAAC;AAAA,QACrB,MAAM,QAAQ,MAAM,CAAC;AAAA,MACtB;AAAA,MACA,eAAe,QAAQ;AAAA,QACtB,CAAC,IAAI,QAAQ,QAAQ,IAAI,CAAC,IAAI,QAAQ;AACrC,cAAI,CAAC,KAA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
||||
"version": 3,
|
||||
"sources": ["../../../../server/tournaments/index.ts"],
|
||||
"sourcesContent": ["\r\nimport {Elimination} from './generator-elimination';\r\nimport {RoundRobin} from './generator-round-robin';\r\nimport {Utils} from '../../lib';\r\nimport {SampleTeams, teamData} from '../chat-plugins/sample-teams';\r\nimport {PRNG} from '../../sim/prng';\r\n\r\nexport interface TournamentRoomSettings {\r\n\tallowModjoin?: boolean;\r\n\tallowScouting?: boolean;\r\n\tannouncements?: boolean;\r\n\tautodq?: number;\r\n\tautostart?: number | boolean;\r\n\tforcePublic?: boolean;\r\n\tforceTimer?: boolean;\r\n\tplayerCap?: number;\r\n\tshowSampleTeams?: boolean;\r\n\trecentToursLength?: number;\r\n\trecentTours?: {name: string, baseFormat: string, time: number}[];\r\n\tblockRecents?: boolean;\r\n}\r\n\r\ntype Generator = RoundRobin | Elimination;\r\n\r\nconst BRACKET_MINIMUM_UPDATE_INTERVAL = 2 * 1000;\r\nconst AUTO_DISQUALIFY_WARNING_TIMEOUT = 30 * 1000;\r\nconst MAX_AUTO_DISQUALIFY_TIMEOUT = 60 * 60 * 1000;\r\nconst AUTO_START_MINIMUM_TIMEOUT = 30 * 1000;\r\nconst MAX_REASON_LENGTH = 300;\r\nconst MAX_CUSTOM_NAME_LENGTH = 100;\r\nconst TOURBAN_DURATION = 14 * 24 * 60 * 60 * 1000;\r\n\r\nPunishments.addRoomPunishmentType({\r\n\ttype: 'TOURBAN',\r\n\tdesc: 'banned from tournaments',\r\n});\r\n\r\nconst TournamentGenerators = {\r\n\t__proto__: null,\r\n\troundrobin: RoundRobin,\r\n\telimination: Elimination,\r\n};\r\n\r\nfunction usersToNames(users: TournamentPlayer[]) {\r\n\treturn users.map(user => user.name);\r\n}\r\n\r\nexport class TournamentPlayer extends Rooms.RoomGamePlayer<Tournament> {\r\n\treadonly availableMatches: Set<TournamentPlayer>;\r\n\tisBusy: boolean;\r\n\tinProgressMatch: {to: TournamentPlayer, room: GameRoom} | null;\r\n\tpendingChallenge: {\r\n\t\tfrom?: TournamentPlayer,\r\n\t\tto?: TournamentPlayer,\r\n\t\tteam: string,\r\n\t\thidden: boolean,\r\n\t\tinviteOnly: boolean,\r\n\t} | null;\r\n\tisDisqualified: boolean;\r\n\tisEliminated: boolean;\r\n\tautoDisqualifyWarned: boolean;\r\n\tlastActionTime: number;\r\n\twins: number;\r\n\tlosses: number;\r\n\tgames: number;\r\n\tscore: number;\r\n\tconstructor(user: User | string | null, game: Tournament, num: number) {\r\n\t\tsuper(user, game, num);\r\n\t\tthis.availableMatches = new Set();\r\n\t\tthis.isBusy = false;\r\n\t\tthis.inProgressMatch = null;\r\n\t\tthis.pendingChallenge = null;\r\n\t\tthis.isDisqualified = false;\r\n\t\tthis.isEliminated = false;\r\n\t\tthis.autoDisqualifyWarned = false;\r\n\t\tthis.lastActionTime = 0;\r\n\r\n\t\tthis.wins = 0;\r\n\t\tthis.losses = 0;\r\n\t\tthis.games = 0;\r\n\t\tthis.score = 0;\r\n\t}\r\n}\r\n\r\nexport class Tournament extends Rooms.RoomGame<TournamentPlayer> {\r\n\treadonly isTournament: true;\r\n\treadonly completedMatches: Set<RoomID>;\r\n\t/** Format ID not including custom rules */\r\n\treadonly baseFormat: ID;\r\n\t/**\r\n\t * Full format specifier, including custom rules (such as 'gen7challengecup1v1@@@speciesclause')\r\n\t */\r\n\tfullFormat: string;\r\n\tname: string;\r\n\tcustomRules: string[];\r\n\tgenerator: Generator;\r\n\tisRated: boolean;\r\n\tallowScouting: boolean;\r\n\tallowModjoin: boolean;\r\n\tforceTimer: boolean;\r\n\tautostartcap: boolean;\r\n\tforcePublic: boolean;\r\n\tisTournamentStarted: boolean;\r\n\tisBracketInvalidated: boolean;\r\n\tlastBracketUpdate: number;\r\n\tbracketUpdateTimer: NodeJS.Timeout | null;\r\n\tbracketCache: AnyObject | null;\r\n\tisAvailableMatchesInvalidated: boolean;\r\n\tavailableMatchesCache: {\r\n\t\tchallenges: Map<TournamentPlayer, TournamentPlayer[]>, challengeBys: Map<TournamentPlayer, TournamentPlayer[]>,\r\n\t};\r\n\tautoDisqualifyTimeout: number;\r\n\tautoDisqualifyTimer: NodeJS.Timeout | null;\r\n\tautoStartTimeout: number;\r\n\tautoStartTimer: NodeJS.Timeout | null;\r\n\r\n\tisEnded: boolean;\r\n\tconstructor(\r\n\t\troom: ChatRoom, format: Format, generator: Generator,\r\n\t\tplayerCap: string | undefined, isRated: boolean, name: string | undefined\r\n\t) {\r\n\t\tsuper(room);\r\n\t\tthis.gameid = 'tournament' as ID;\r\n\t\tconst formatId = toID(format);\r\n\r\n\t\tthis.title = format.name + ' tournament';\r\n\t\tthis.isTournament = true;\r\n\t\tthis.completedMatches = new Set();\r\n\t\tthis.allowRenames = false;\r\n\t\tthis.playerCap = (playerCap ? parseInt(playerCap) : Config.tourdefaultplayercap) || 0;\r\n\r\n\t\tthis.baseFormat = formatId;\r\n\t\tthis.fullFormat = formatId;\r\n\t\t// This will sometimes be sent alone in updates as \"format\", if the tour doesn't have a custom name\r\n\t\tthis.name = name || formatId;\r\n\t\tthis.customRules = [];\r\n\t\tthis.generator = generator;\r\n\t\tthis.isRated = isRated;\r\n\t\tthis.allowScouting = true;\r\n\t\tthis.allowModjoin = false;\r\n\t\tthis.forceTimer = false;\r\n\t\tthis.autostartcap = false;\r\n\t\tthis.forcePublic = false;\r\n\t\tif (Config.tourdefaultplayercap && this.playerCap > Config.tourdefaultplayercap) {\r\n\t\t\tMonitor.log(`[TourMonitor] Room ${room.roomid} starting a tour over default cap (${this.playerCap})`);\r\n\t\t}\r\n\r\n\t\tthis.isTournamLine truncated
|
||||
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mCAA0B;AAC1B,mCAAyB;AACzB,iBAAoB;AACpB,0BAAoC;AACpC,kBAAmB;AAmBnB,MAAM,kCAAkC,IAAI;AAC5C,MAAM,kCAAkC,KAAK;AAC7C,MAAM,8BAA8B,KAAK,KAAK;AAC9C,M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