tods-competition-factory 1.8.2 → 1.8.3
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/forge/generate.d.ts +11 -3
- package/dist/forge/generate.mjs +50 -42
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +12 -12
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +52 -44
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +95 -81
- package/dist/tods-competition-factory.development.cjs.js.map +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -362,7 +362,7 @@ var matchUpFormatCode = {
|
|
|
362
362
|
};
|
|
363
363
|
|
|
364
364
|
function factoryVersion() {
|
|
365
|
-
return '1.8.
|
|
365
|
+
return '1.8.3';
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
/******************************************************************************
|
|
@@ -7731,20 +7731,20 @@ var ROUND_ROBIN_WITH_PLAYOFF = 'ROUND_ROBIN_WITH_PLAYOFF';
|
|
|
7731
7731
|
var DECIDER = 'DECIDER';
|
|
7732
7732
|
var BACKDRAW = 'BACKDRAW';
|
|
7733
7733
|
var COMPASS_ATTRIBUTES = {
|
|
7734
|
-
0: { name: '
|
|
7735
|
-
'0-1': { name: '
|
|
7736
|
-
'0-2': { name: '
|
|
7737
|
-
'0-3': { name: '
|
|
7738
|
-
'0-1-1': { name: '
|
|
7739
|
-
'0-1-2': { name: '
|
|
7740
|
-
'0-2-1': { name: '
|
|
7741
|
-
'0-1-1-1': { name: '
|
|
7734
|
+
0: { name: 'East', abbreviation: 'E' },
|
|
7735
|
+
'0-1': { name: 'West', abbreviation: 'W' },
|
|
7736
|
+
'0-2': { name: 'North', abbreviation: 'N' },
|
|
7737
|
+
'0-3': { name: 'Northeast', abbreviation: 'NE' },
|
|
7738
|
+
'0-1-1': { name: 'South', abbreviation: 'S' },
|
|
7739
|
+
'0-1-2': { name: 'Southwest', abbreviation: 'SW' },
|
|
7740
|
+
'0-2-1': { name: 'Northwest', abbreviation: 'NW' },
|
|
7741
|
+
'0-1-1-1': { name: 'Southeast', abbreviation: 'SE' },
|
|
7742
7742
|
};
|
|
7743
7743
|
var OLYMPIC_ATTRIBUTES = {
|
|
7744
|
-
0: { name: '
|
|
7745
|
-
'0-1': { name: '
|
|
7746
|
-
'0-2': { name: '
|
|
7747
|
-
'0-1-1': { name: '
|
|
7744
|
+
0: { name: 'East', abbreviation: 'E' },
|
|
7745
|
+
'0-1': { name: 'West', abbreviation: 'W' },
|
|
7746
|
+
'0-2': { name: 'North', abbreviation: 'N' },
|
|
7747
|
+
'0-1-1': { name: 'South', abbreviation: 'S' },
|
|
7748
7748
|
};
|
|
7749
7749
|
// finishingPosition determination
|
|
7750
7750
|
var WIN_RATIO = 'WIN_RATIO';
|
|
@@ -25200,12 +25200,12 @@ var structureTemplate = function (_a) {
|
|
|
25200
25200
|
};
|
|
25201
25201
|
|
|
25202
25202
|
function generateRoundRobin(_a) {
|
|
25203
|
-
var _b = _a.structureName, structureName = _b === void 0 ? constantToString(MAIN) : _b, _c = _a.stageSequence, stageSequence =
|
|
25204
|
-
var
|
|
25203
|
+
var _b = _a.structureName, structureName = _b === void 0 ? constantToString(MAIN) : _b, _c = _a.groupNameBase, groupNameBase = _c === void 0 ? 'Group' : _c, _d = _a.stageSequence, stageSequence = _d === void 0 ? 1 : _d, structureOptions = _a.structureOptions, appliedPolicies = _a.appliedPolicies, seedingProfile = _a.seedingProfile, _e = _a.stage, stage = _e === void 0 ? MAIN : _e, matchUpType = _a.matchUpType, roundTarget = _a.roundTarget, structureId = _a.structureId, drawSize = _a.drawSize, idPrefix = _a.idPrefix, isMock = _a.isMock, uuids = _a.uuids;
|
|
25204
|
+
var _f = deriveGroups({
|
|
25205
25205
|
structureOptions: structureOptions,
|
|
25206
25206
|
appliedPolicies: appliedPolicies,
|
|
25207
25207
|
drawSize: drawSize,
|
|
25208
|
-
}), groupCount =
|
|
25208
|
+
}), groupCount = _f.groupCount, groupSize = _f.groupSize;
|
|
25209
25209
|
var finishingPosition = WIN_RATIO;
|
|
25210
25210
|
var maxRoundNumber;
|
|
25211
25211
|
var structures = generateRange(1, groupCount + 1).map(function (structureOrder) {
|
|
@@ -25222,7 +25222,7 @@ function generateRoundRobin(_a) {
|
|
|
25222
25222
|
return roundNumber;
|
|
25223
25223
|
})), false));
|
|
25224
25224
|
return structureTemplate({
|
|
25225
|
-
structureName: "
|
|
25225
|
+
structureName: "".concat(groupNameBase, " ").concat(structureOrder),
|
|
25226
25226
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
25227
25227
|
structureType: ITEM,
|
|
25228
25228
|
finishingPosition: finishingPosition,
|
|
@@ -42596,7 +42596,7 @@ function competitionEngineAsync(test) {
|
|
|
42596
42596
|
}
|
|
42597
42597
|
|
|
42598
42598
|
function addVoluntaryConsolationStructure$1(_a) {
|
|
42599
|
-
var _b = _a.structureName, structureName = _b === void 0 ? VOLUNTARY_CONSOLATION : _b, structureAbbreviation = _a.structureAbbreviation, drawDefinition = _a.drawDefinition, matchUpType = _a.matchUpType, structureId = _a.structureId;
|
|
42599
|
+
var _b = _a.structureName, structureName = _b === void 0 ? constantToString(VOLUNTARY_CONSOLATION) : _b, structureAbbreviation = _a.structureAbbreviation, drawDefinition = _a.drawDefinition, matchUpType = _a.matchUpType, structureId = _a.structureId;
|
|
42600
42600
|
if (!drawDefinition)
|
|
42601
42601
|
return { error: MISSING_DRAW_DEFINITION };
|
|
42602
42602
|
var structure = structureTemplate({
|
|
@@ -42801,8 +42801,8 @@ function generateQualifyingStructures(_a) {
|
|
|
42801
42801
|
var stageSequenceName = structureProfiles.length > 1 || roundTargetName ? stageSequence : '';
|
|
42802
42802
|
var qualifyingStructureName = structureName ||
|
|
42803
42803
|
(roundTargetName || stageSequenceName
|
|
42804
|
-
? "".concat(QUALIFYING, " ").concat(roundTargetName).concat(stageSequenceName)
|
|
42805
|
-
: QUALIFYING);
|
|
42804
|
+
? "".concat(constantToString(QUALIFYING), " ").concat(roundTargetName).concat(stageSequenceName)
|
|
42805
|
+
: constantToString(QUALIFYING));
|
|
42806
42806
|
if (drawType === ROUND_ROBIN) {
|
|
42807
42807
|
var _k = generateRoundRobin({
|
|
42808
42808
|
structureName: structureProfile.structureName || qualifyingStructureName,
|
|
@@ -43508,7 +43508,8 @@ function roundMatchCounts(_a) {
|
|
|
43508
43508
|
}
|
|
43509
43509
|
|
|
43510
43510
|
function firstRoundLoserConsolation(params) {
|
|
43511
|
-
var _a
|
|
43511
|
+
var _a, _b, _c, _d;
|
|
43512
|
+
var _e = params.finishingPositionOffset, finishingPositionOffset = _e === void 0 ? 0 : _e, playoffAttributes = params.playoffAttributes, _f = params.stageSequence, stageSequence = _f === void 0 ? 1 : _f, staggeredEntry = params.staggeredEntry, structureName = params.structureName, _g = params.stage, stage = _g === void 0 ? MAIN : _g, matchUpType = params.matchUpType, structureId = params.structureId, idPrefix = params.idPrefix, drawSize = params.drawSize, isMock = params.isMock, uuids = params.uuids;
|
|
43512
43513
|
var mainParams = {
|
|
43513
43514
|
finishingPositionOffset: finishingPositionOffset,
|
|
43514
43515
|
matchUpType: matchUpType,
|
|
@@ -43521,7 +43522,7 @@ function firstRoundLoserConsolation(params) {
|
|
|
43521
43522
|
? feedInMatchUps(mainParams)
|
|
43522
43523
|
: treeMatchUps(mainParams)).matchUps;
|
|
43523
43524
|
var mainStructure = structureTemplate({
|
|
43524
|
-
structureName: structureName || constantToString(MAIN),
|
|
43525
|
+
structureName: structureName || ((_a = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes['0']) === null || _a === void 0 ? void 0 : _a.name) || constantToString(MAIN),
|
|
43525
43526
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
43526
43527
|
stageSequence: stageSequence,
|
|
43527
43528
|
matchUpType: matchUpType,
|
|
@@ -43540,8 +43541,7 @@ function firstRoundLoserConsolation(params) {
|
|
|
43540
43541
|
isMock: isMock,
|
|
43541
43542
|
}).matchUps;
|
|
43542
43543
|
var consolation = constantToString(CONSOLATION);
|
|
43543
|
-
var consolationStructureName = params.consolationStructureName
|
|
43544
|
-
(structureName ? "".concat(structureName, " ").concat(consolation) : consolation);
|
|
43544
|
+
var consolationStructureName = (_d = (_c = (_b = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes['0-1']) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : params.consolationStructureName) !== null && _d !== void 0 ? _d : (structureName ? "".concat(structureName, " ").concat(consolation) : consolation);
|
|
43545
43545
|
var consolationStructure = structureTemplate({
|
|
43546
43546
|
structureName: consolationStructureName,
|
|
43547
43547
|
matchUps: consolationMatchUps,
|
|
@@ -43620,7 +43620,8 @@ function feedInLinks(_a) {
|
|
|
43620
43620
|
}
|
|
43621
43621
|
|
|
43622
43622
|
function generateCurtisConsolation(params) {
|
|
43623
|
-
var _a
|
|
43623
|
+
var _a, _b, _c, _d, _e;
|
|
43624
|
+
var playoffStructureNameBase = params.playoffStructureNameBase, finishingPositionOffset = params.finishingPositionOffset, _f = params.stageSequence, stageSequence = _f === void 0 ? 1 : _f, playoffAttributes = params.playoffAttributes, structureNameMap = params.structureNameMap, staggeredEntry = params.staggeredEntry, _g = params.stage, stage = _g === void 0 ? MAIN : _g, matchUpType = params.matchUpType, structureId = params.structureId, drawSize = params.drawSize, idPrefix = params.idPrefix, isMock = params.isMock, uuids = params.uuids;
|
|
43624
43625
|
var mainParams = {
|
|
43625
43626
|
finishingPositionOffset: finishingPositionOffset,
|
|
43626
43627
|
matchUpType: matchUpType,
|
|
@@ -43629,9 +43630,10 @@ function generateCurtisConsolation(params) {
|
|
|
43629
43630
|
isMock: isMock,
|
|
43630
43631
|
uuids: uuids,
|
|
43631
43632
|
};
|
|
43632
|
-
var
|
|
43633
|
+
var _h = staggeredEntry
|
|
43633
43634
|
? feedInMatchUps(mainParams)
|
|
43634
|
-
: treeMatchUps(mainParams), matchUps =
|
|
43635
|
+
: treeMatchUps(mainParams), matchUps = _h.matchUps, mainDrawRoundsCount = _h.roundsCount;
|
|
43636
|
+
var structureName = (_c = (_a = params.structureName) !== null && _a !== void 0 ? _a : (_b = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes['0']) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : constantToString(MAIN);
|
|
43635
43637
|
var mainStructure = structureTemplate({
|
|
43636
43638
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
43637
43639
|
structureName: structureName,
|
|
@@ -43650,6 +43652,7 @@ function generateCurtisConsolation(params) {
|
|
|
43650
43652
|
idPrefix: idPrefix && "".concat(idPrefix, "-c").concat(index),
|
|
43651
43653
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
43652
43654
|
playoffStructureNameBase: playoffStructureNameBase,
|
|
43655
|
+
playoffAttributes: playoffAttributes,
|
|
43653
43656
|
structureNameMap: structureNameMap,
|
|
43654
43657
|
stageSequence: stageSequence,
|
|
43655
43658
|
roundOffset: roundOffset,
|
|
@@ -43682,7 +43685,7 @@ function generateCurtisConsolation(params) {
|
|
|
43682
43685
|
matchUpType: matchUpType,
|
|
43683
43686
|
isMock: isMock,
|
|
43684
43687
|
}).matchUps;
|
|
43685
|
-
var defaultName = constantToString(PLAY_OFF);
|
|
43688
|
+
var defaultName = (_e = (_d = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes['3-4']) === null || _d === void 0 ? void 0 : _d.name) !== null && _e !== void 0 ? _e : constantToString(PLAY_OFF);
|
|
43686
43689
|
var mappedStructureName = (structureNameMap === null || structureNameMap === void 0 ? void 0 : structureNameMap[defaultName]) || defaultName;
|
|
43687
43690
|
var structureName_1 = playoffStructureNameBase
|
|
43688
43691
|
? "".concat(playoffStructureNameBase, " ").concat(mappedStructureName)
|
|
@@ -43714,9 +43717,10 @@ function generateCurtisConsolation(params) {
|
|
|
43714
43717
|
return __assign({ structures: structures, links: links }, SUCCESS);
|
|
43715
43718
|
}
|
|
43716
43719
|
function consolationFeedStructure(_a) {
|
|
43717
|
-
var
|
|
43720
|
+
var _b, _c;
|
|
43721
|
+
var playoffStructureNameBase = _a.playoffStructureNameBase, _d = _a.stageSequence, stageSequence = _d === void 0 ? 1 : _d, playoffAttributes = _a.playoffAttributes, structureNameMap = _a.structureNameMap, _e = _a.roundOffset, roundOffset = _e === void 0 ? 0 : _e, matchUpType = _a.matchUpType, structureId = _a.structureId, idPrefix = _a.idPrefix, drawSize = _a.drawSize, isMock = _a.isMock, index = _a.index, uuids = _a.uuids;
|
|
43718
43722
|
var consolationDrawPositions = drawSize / (2 * Math.pow(2, roundOffset));
|
|
43719
|
-
var
|
|
43723
|
+
var _f = feedInMatchUps({
|
|
43720
43724
|
finishingPositionOffset: consolationDrawPositions,
|
|
43721
43725
|
baseDrawSize: consolationDrawPositions,
|
|
43722
43726
|
isConsolation: true,
|
|
@@ -43725,8 +43729,10 @@ function consolationFeedStructure(_a) {
|
|
|
43725
43729
|
idPrefix: idPrefix,
|
|
43726
43730
|
isMock: isMock,
|
|
43727
43731
|
uuids: uuids,
|
|
43728
|
-
}), consolationMatchUps =
|
|
43729
|
-
var
|
|
43732
|
+
}), consolationMatchUps = _f.matchUps, consolationRoundsCount = _f.roundsCount;
|
|
43733
|
+
var indexedStructureName = (index === 0 && ((_b = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes['0-1']) === null || _b === void 0 ? void 0 : _b.name)) ||
|
|
43734
|
+
(index === 1 && ((_c = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes['0-3']) === null || _c === void 0 ? void 0 : _c.name));
|
|
43735
|
+
var defaultName = indexedStructureName || "".concat(constantToString(CONSOLATION), " ").concat(index + 1);
|
|
43730
43736
|
var mappedStructureName = (structureNameMap === null || structureNameMap === void 0 ? void 0 : structureNameMap[defaultName]) || defaultName;
|
|
43731
43737
|
var structureName = playoffStructureNameBase
|
|
43732
43738
|
? "".concat(playoffStructureNameBase, " ").concat(mappedStructureName)
|
|
@@ -43743,8 +43749,9 @@ function consolationFeedStructure(_a) {
|
|
|
43743
43749
|
}
|
|
43744
43750
|
|
|
43745
43751
|
function generatePlayoffStructures(params) {
|
|
43746
|
-
var _a
|
|
43747
|
-
|
|
43752
|
+
var _a;
|
|
43753
|
+
var _b = params.finishingPositionOffset, finishingPositionOffset = _b === void 0 ? 0 : _b, addNameBaseToAttributeName = params.addNameBaseToAttributeName, playoffStructureNameBase = params.playoffStructureNameBase, finishingPositionNaming = params.finishingPositionNaming, finishingPositionLimit = params.finishingPositionLimit, playoffAttributes = params.playoffAttributes, _c = params.stageSequence, stageSequence = _c === void 0 ? 1 : _c, _d = params.exitProfile, exitProfile = _d === void 0 ? '0' : _d, exitProfileLimit = params.exitProfileLimit, roundOffsetLimit = params.roundOffsetLimit, _e = params.roundOffset, roundOffset = _e === void 0 ? 0 : _e, drawDefinition = params.drawDefinition, staggeredEntry = params.staggeredEntry, // not propagated to child structurs
|
|
43754
|
+
sequenceLimit = params.sequenceLimit, _f = params.stage, stage = _f === void 0 ? MAIN : _f, structureId = params.structureId, drawSize = params.drawSize, idPrefix = params.idPrefix, isMock = params.isMock, uuids = params.uuids;
|
|
43748
43755
|
var generateStructure = !playoffAttributes || !exitProfileLimit || (playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes[exitProfile]);
|
|
43749
43756
|
if (!generateStructure ||
|
|
43750
43757
|
drawSize < 2 ||
|
|
@@ -43759,7 +43766,7 @@ function generatePlayoffStructures(params) {
|
|
|
43759
43766
|
var finishingPositionRange = "".concat(finishingPositionsFrom, "-").concat(finishingPositionsTo);
|
|
43760
43767
|
var attributeProfile = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes[exitProfile];
|
|
43761
43768
|
var base = (playoffStructureNameBase && "".concat(playoffStructureNameBase, " ")) || '';
|
|
43762
|
-
var customNaming = finishingPositionNaming === null || finishingPositionNaming === void 0 ? void 0 : finishingPositionNaming[finishingPositionRange];
|
|
43769
|
+
var customNaming = (_a = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes[finishingPositionRange]) !== null && _a !== void 0 ? _a : finishingPositionNaming === null || finishingPositionNaming === void 0 ? void 0 : finishingPositionNaming[finishingPositionRange];
|
|
43763
43770
|
var structureName = (customNaming === null || customNaming === void 0 ? void 0 : customNaming.name) ||
|
|
43764
43771
|
((attributeProfile === null || attributeProfile === void 0 ? void 0 : attributeProfile.name) &&
|
|
43765
43772
|
(addNameBaseToAttributeName
|
|
@@ -43861,7 +43868,8 @@ function generatePlayoffStructures(params) {
|
|
|
43861
43868
|
}
|
|
43862
43869
|
|
|
43863
43870
|
function feedInChampionship(params) {
|
|
43864
|
-
var
|
|
43871
|
+
var _a, _b, _c;
|
|
43872
|
+
var finishingPositionOffset = params.finishingPositionOffset, _d = params.stageSequence, stageSequence = _d === void 0 ? 1 : _d, playoffAttributes = params.playoffAttributes, policyDefinitions = params.policyDefinitions, feedsFromFinal = params.feedsFromFinal, staggeredEntry = params.staggeredEntry, structureName = params.structureName, _e = params.stage, stage = _e === void 0 ? MAIN : _e, structureId = params.structureId, matchUpType = params.matchUpType, skipRounds = params.skipRounds, feedRounds = params.feedRounds, idPrefix = params.idPrefix, drawSize = params.drawSize, isMock = params.isMock, uuids = params.uuids, fmlc = params.fmlc;
|
|
43865
43873
|
var feedPolicy = params.feedPolicy || (policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_FEED_IN]);
|
|
43866
43874
|
var mainParams = {
|
|
43867
43875
|
finishingPositionOffset: finishingPositionOffset,
|
|
@@ -43876,7 +43884,7 @@ function feedInChampionship(params) {
|
|
|
43876
43884
|
? feedInMatchUps(mainParams)
|
|
43877
43885
|
: treeMatchUps(mainParams)).matchUps;
|
|
43878
43886
|
var mainStructure = structureTemplate({
|
|
43879
|
-
structureName: structureName || constantToString(MAIN),
|
|
43887
|
+
structureName: structureName || ((_a = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes['0']) === null || _a === void 0 ? void 0 : _a.name) || constantToString(MAIN),
|
|
43880
43888
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
43881
43889
|
stageSequence: stageSequence,
|
|
43882
43890
|
matchUpType: matchUpType,
|
|
@@ -43886,7 +43894,7 @@ function feedInChampionship(params) {
|
|
|
43886
43894
|
var structures = [mainStructure];
|
|
43887
43895
|
var links = [];
|
|
43888
43896
|
var baseDrawSize = drawSize / 2;
|
|
43889
|
-
var
|
|
43897
|
+
var _f = feedInMatchUps({
|
|
43890
43898
|
finishingPositionOffset: baseDrawSize,
|
|
43891
43899
|
idPrefix: idPrefix && "".concat(idPrefix, "-c"),
|
|
43892
43900
|
isConsolation: true,
|
|
@@ -43898,10 +43906,10 @@ function feedInChampionship(params) {
|
|
|
43898
43906
|
isMock: isMock,
|
|
43899
43907
|
uuids: uuids,
|
|
43900
43908
|
fmlc: fmlc,
|
|
43901
|
-
}), consolationMatchUps =
|
|
43909
|
+
}), consolationMatchUps = _f.matchUps, roundsCount = _f.roundsCount;
|
|
43902
43910
|
if (drawSize > 2) {
|
|
43903
43911
|
var consolationStructure = structureTemplate({
|
|
43904
|
-
structureName: constantToString(CONSOLATION),
|
|
43912
|
+
structureName: (_c = (_b = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes['0-1']) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : constantToString(CONSOLATION),
|
|
43905
43913
|
matchUps: consolationMatchUps,
|
|
43906
43914
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
43907
43915
|
stage: CONSOLATION,
|
|
@@ -43923,19 +43931,19 @@ function feedInChampionship(params) {
|
|
|
43923
43931
|
|
|
43924
43932
|
function processPlayoffGroups(_a) {
|
|
43925
43933
|
var e_1, _b;
|
|
43926
|
-
var _c, _d, _e, _f, _g, _h, _j;
|
|
43927
|
-
var
|
|
43934
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
43935
|
+
var _u = _a.requireSequential, requireSequential = _u === void 0 ? true : _u, playoffMatchUpFormat = _a.playoffMatchUpFormat, playoffAttributes = _a.playoffAttributes, sourceStructureId = _a.sourceStructureId, policyDefinitions = _a.policyDefinitions, stageSequence = _a.stageSequence, drawDefinition = _a.drawDefinition, playoffGroups = _a.playoffGroups, matchUpType = _a.matchUpType, feedPolicy = _a.feedPolicy, groupCount = _a.groupCount, idPrefix = _a.idPrefix, isMock = _a.isMock, uuids = _a.uuids;
|
|
43928
43936
|
feedPolicy = feedPolicy || (policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_FEED_IN]);
|
|
43929
43937
|
var stack = 'processPlayoffGroups';
|
|
43930
43938
|
var finishingPositionOffset = 0;
|
|
43931
43939
|
var finishingPositionTargets = [];
|
|
43932
43940
|
var structures = [];
|
|
43933
43941
|
var links = [];
|
|
43934
|
-
var
|
|
43942
|
+
var _v = getPositionRangeMap({
|
|
43935
43943
|
structureId: sourceStructureId,
|
|
43936
43944
|
drawDefinition: drawDefinition,
|
|
43937
43945
|
playoffGroups: playoffGroups,
|
|
43938
|
-
}), error =
|
|
43946
|
+
}), error = _v.error, positionRangeMap = _v.positionRangeMap;
|
|
43939
43947
|
if (error)
|
|
43940
43948
|
return decorateResult({ result: { error: error }, stack: stack });
|
|
43941
43949
|
var validFinishingPositions = !positionRangeMap ||
|
|
@@ -43958,7 +43966,7 @@ function processPlayoffGroups(_a) {
|
|
|
43958
43966
|
});
|
|
43959
43967
|
}
|
|
43960
43968
|
var _loop_1 = function (playoffGroup) {
|
|
43961
|
-
var
|
|
43969
|
+
var _w;
|
|
43962
43970
|
var finishingPositions = playoffGroup.finishingPositions;
|
|
43963
43971
|
var positionsPlayedOff = positionRangeMap &&
|
|
43964
43972
|
finishingPositions
|
|
@@ -43972,16 +43980,22 @@ function processPlayoffGroups(_a) {
|
|
|
43972
43980
|
if (positionsPlayedOff) {
|
|
43973
43981
|
finishingPositionOffset = Math.min.apply(Math, __spreadArray([], __read(positionsPlayedOff), false)) - 1;
|
|
43974
43982
|
}
|
|
43983
|
+
var finishingPositionRange = positionsPlayedOff &&
|
|
43984
|
+
"".concat(Math.min.apply(Math, __spreadArray([], __read(positionsPlayedOff), false)), "-").concat(Math.max.apply(Math, __spreadArray([], __read(positionsPlayedOff), false)));
|
|
43985
|
+
var structureName = playoffGroup.structureName ||
|
|
43986
|
+
(finishingPositionRange &&
|
|
43987
|
+
((_d = (_c = playoffGroup.playoffAttributes) === null || _c === void 0 ? void 0 : _c[finishingPositionRange]) === null || _d === void 0 ? void 0 : _d.name)) ||
|
|
43988
|
+
((_f = (_e = playoffGroup.playoffAttributes) === null || _e === void 0 ? void 0 : _e['0']) === null || _f === void 0 ? void 0 : _f.name);
|
|
43975
43989
|
var playoffGroupParams = {
|
|
43976
43990
|
addNameBaseToAttributeName: playoffGroup.addNameBaseToAttributeName,
|
|
43977
43991
|
playoffStructureNameBase: playoffGroup.playoffStructureNameBase,
|
|
43978
43992
|
finishingPositionNaming: playoffGroup.finishingPositionNaming,
|
|
43979
43993
|
finishingPositionLimit: playoffGroup.finishingPositionLimit,
|
|
43980
|
-
structureId: (
|
|
43994
|
+
structureId: (_g = playoffGroup.structureId) !== null && _g !== void 0 ? _g : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
43981
43995
|
playoffAttributes: playoffGroup.playoffAttributes,
|
|
43982
43996
|
structureNameMap: playoffGroup.structureNameMap,
|
|
43983
|
-
structureName: playoffGroup.structureName,
|
|
43984
43997
|
sequenceLimit: playoffGroup.sequenceLimit,
|
|
43998
|
+
structureName: structureName,
|
|
43985
43999
|
};
|
|
43986
44000
|
var params = __assign(__assign({}, playoffGroupParams), { idPrefix: idPrefix && "".concat(idPrefix, "-po"), appliedPolicies: policyDefinitions, finishingPositionOffset: finishingPositionOffset, stage: PLAY_OFF, stageSequence: stageSequence, matchUpType: matchUpType, drawSize: drawSize, isMock: isMock, uuids: uuids });
|
|
43987
44001
|
var updateStructureAndLinks = function (_a) {
|
|
@@ -44013,10 +44027,10 @@ function processPlayoffGroups(_a) {
|
|
|
44013
44027
|
uuids: uuids,
|
|
44014
44028
|
}).matchUps;
|
|
44015
44029
|
var playoffStructure = structureTemplate({
|
|
44016
|
-
structureId: (
|
|
44017
|
-
structureName: playoffGroup.structureName,
|
|
44030
|
+
structureId: (_h = playoffGroup.structureId) !== null && _h !== void 0 ? _h : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
44018
44031
|
matchUpFormat: playoffMatchUpFormat,
|
|
44019
44032
|
stage: PLAY_OFF,
|
|
44033
|
+
structureName: structureName,
|
|
44020
44034
|
stageSequence: stageSequence,
|
|
44021
44035
|
matchUps: matchUps,
|
|
44022
44036
|
});
|
|
@@ -44035,9 +44049,9 @@ function processPlayoffGroups(_a) {
|
|
|
44035
44049
|
});
|
|
44036
44050
|
}
|
|
44037
44051
|
else if ([COMPASS, OLYMPIC, PLAY_OFF].includes(playoffDrawType)) {
|
|
44038
|
-
var structureName = playoffGroup.structureName;
|
|
44039
44052
|
var params_1 = {
|
|
44040
|
-
|
|
44053
|
+
playoffAttributes: (_j = playoffGroup.playoffAttributes) !== null && _j !== void 0 ? _j : playoffAttributes,
|
|
44054
|
+
structureId: (_k = playoffGroup.structureId) !== null && _k !== void 0 ? _k : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
44041
44055
|
playoffStructureNameBase: structureName,
|
|
44042
44056
|
idPrefix: idPrefix && "".concat(idPrefix, "-po"),
|
|
44043
44057
|
addNameBaseToAttributeName: true,
|
|
@@ -44051,22 +44065,22 @@ function processPlayoffGroups(_a) {
|
|
|
44051
44065
|
};
|
|
44052
44066
|
if (playoffDrawType === COMPASS) {
|
|
44053
44067
|
Object.assign(params_1, {
|
|
44054
|
-
playoffAttributes:
|
|
44068
|
+
playoffAttributes: (_m = (_l = playoffGroup === null || playoffGroup === void 0 ? void 0 : playoffGroup.playoffAttributes) !== null && _l !== void 0 ? _l : playoffAttributes) !== null && _m !== void 0 ? _m : COMPASS_ATTRIBUTES,
|
|
44055
44069
|
roundOffsetLimit: 3,
|
|
44056
44070
|
});
|
|
44057
44071
|
}
|
|
44058
44072
|
else if (playoffDrawType === OLYMPIC) {
|
|
44059
44073
|
Object.assign(params_1, {
|
|
44060
|
-
playoffAttributes:
|
|
44074
|
+
playoffAttributes: (_p = (_o = playoffGroup === null || playoffGroup === void 0 ? void 0 : playoffGroup.playoffAttributes) !== null && _o !== void 0 ? _o : playoffAttributes) !== null && _p !== void 0 ? _p : OLYMPIC_ATTRIBUTES,
|
|
44061
44075
|
roundOffsetLimit: 2,
|
|
44062
44076
|
});
|
|
44063
44077
|
}
|
|
44064
44078
|
var result = generatePlayoffStructures(params_1);
|
|
44065
44079
|
if (result.error)
|
|
44066
44080
|
return { value: result };
|
|
44067
|
-
if ((
|
|
44081
|
+
if ((_q = result.links) === null || _q === void 0 ? void 0 : _q.length)
|
|
44068
44082
|
links.push.apply(links, __spreadArray([], __read(result.links), false));
|
|
44069
|
-
if ((
|
|
44083
|
+
if ((_r = result.structures) === null || _r === void 0 ? void 0 : _r.length)
|
|
44070
44084
|
structures.push.apply(structures, __spreadArray([], __read(result.structures), false));
|
|
44071
44085
|
structures.sort(structureSort);
|
|
44072
44086
|
if (result.structureId) {
|
|
@@ -44094,27 +44108,27 @@ function processPlayoffGroups(_a) {
|
|
|
44094
44108
|
].includes(playoffDrawType)) {
|
|
44095
44109
|
var uuidsFMLC = [uuids === null || uuids === void 0 ? void 0 : uuids.pop(), uuids === null || uuids === void 0 ? void 0 : uuids.pop()];
|
|
44096
44110
|
var params_2 = {
|
|
44097
|
-
structureId: (
|
|
44098
|
-
structureName: playoffGroup.structureName,
|
|
44111
|
+
structureId: (_s = playoffGroup.structureId) !== null && _s !== void 0 ? _s : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
44099
44112
|
idPrefix: idPrefix && "".concat(idPrefix, "-po"),
|
|
44100
44113
|
finishingPositionOffset: finishingPositionOffset,
|
|
44101
44114
|
uuids: uuidsFMLC,
|
|
44102
44115
|
stage: PLAY_OFF,
|
|
44116
|
+
structureName: structureName,
|
|
44103
44117
|
matchUpType: matchUpType,
|
|
44104
44118
|
feedPolicy: feedPolicy,
|
|
44105
44119
|
drawSize: drawSize,
|
|
44106
44120
|
isMock: isMock,
|
|
44107
44121
|
};
|
|
44108
|
-
var additionalAttributes = (
|
|
44109
|
-
|
|
44110
|
-
|
|
44111
|
-
|
|
44112
|
-
|
|
44113
|
-
|
|
44114
|
-
|
|
44122
|
+
var additionalAttributes = (_w = {},
|
|
44123
|
+
_w[FIRST_MATCH_LOSER_CONSOLATION] = { fmlc: true, feedRounds: 1 },
|
|
44124
|
+
_w[MODIFIED_FEED_IN_CHAMPIONSHIP] = { feedRounds: 1 },
|
|
44125
|
+
_w[FEED_IN_CHAMPIONSHIP_TO_R16] = { feedsFromFinal: 3 },
|
|
44126
|
+
_w[FEED_IN_CHAMPIONSHIP_TO_QF] = { feedsFromFinal: 2 },
|
|
44127
|
+
_w[FEED_IN_CHAMPIONSHIP_TO_SF] = { feedsFromFinal: 1 },
|
|
44128
|
+
_w);
|
|
44115
44129
|
Object.assign(params_2, additionalAttributes[playoffDrawType] || {});
|
|
44116
|
-
var
|
|
44117
|
-
var
|
|
44130
|
+
var _x = feedInChampionship(params_2), champitionShipStructures = _x.structures, feedInLinks = _x.links;
|
|
44131
|
+
var _y = __read(champitionShipStructures, 1), playoffStructure = _y[0];
|
|
44118
44132
|
var playoffLink = generatePlayoffLink({
|
|
44119
44133
|
playoffStructureId: playoffStructure.structureId,
|
|
44120
44134
|
finishingPositions: finishingPositions,
|
|
@@ -44131,20 +44145,20 @@ function processPlayoffGroups(_a) {
|
|
|
44131
44145
|
finishingPositionOffset += participantsInDraw;
|
|
44132
44146
|
}
|
|
44133
44147
|
else if ([ROUND_ROBIN].includes(playoffDrawType)) {
|
|
44134
|
-
var
|
|
44148
|
+
var _z = generateRoundRobin(__assign(__assign({}, params), { structureOptions: playoffGroup.structureOptions || { groupSize: 4 } })), playoffStructures = _z.structures, playoffLinks = _z.links;
|
|
44135
44149
|
updateStructureAndLinks({ playoffStructures: playoffStructures, playoffLinks: playoffLinks });
|
|
44136
44150
|
}
|
|
44137
44151
|
else if ([FIRST_ROUND_LOSER_CONSOLATION].includes(playoffDrawType)) {
|
|
44138
|
-
var
|
|
44152
|
+
var _0 = firstRoundLoserConsolation(params), playoffStructures = _0.structures, playoffLinks = _0.links;
|
|
44139
44153
|
updateStructureAndLinks({ playoffStructures: playoffStructures, playoffLinks: playoffLinks });
|
|
44140
44154
|
}
|
|
44141
44155
|
else if ([CURTIS_CONSOLATION].includes(playoffDrawType)) {
|
|
44142
|
-
var
|
|
44156
|
+
var _1 = generateCurtisConsolation(params), playoffStructures = _1.structures, playoffLinks = _1.links;
|
|
44143
44157
|
updateStructureAndLinks({ playoffStructures: playoffStructures, playoffLinks: playoffLinks });
|
|
44144
44158
|
}
|
|
44145
44159
|
else if ([AD_HOC].includes(playoffDrawType)) {
|
|
44146
44160
|
var structure = structureTemplate({
|
|
44147
|
-
structureId: (
|
|
44161
|
+
structureId: (_t = playoffGroup.structureId) !== null && _t !== void 0 ? _t : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
44148
44162
|
structureName: playoffGroup.structureName,
|
|
44149
44163
|
finishingPosition: WIN_RATIO$1,
|
|
44150
44164
|
stage: PLAY_OFF,
|
|
@@ -44462,8 +44476,8 @@ function luckyRoundProfiles(drawSize) {
|
|
|
44462
44476
|
|
|
44463
44477
|
function getGenerators(params) {
|
|
44464
44478
|
var _a;
|
|
44465
|
-
var _b;
|
|
44466
|
-
var
|
|
44479
|
+
var _b, _c, _d, _e;
|
|
44480
|
+
var playoffAttributes = params.playoffAttributes, _f = params.stageSequence, stageSequence = _f === void 0 ? 1 : _f, structureId = params.structureId, _g = params.stage, stage = _g === void 0 ? MAIN : _g, matchUpType = params.matchUpType, drawSize = params.drawSize, uuids = params.uuids;
|
|
44467
44481
|
var appliedPolicies = getAppliedPolicies(params).appliedPolicies;
|
|
44468
44482
|
var feedPolicy = ((_b = params.policyDefinitions) === null || _b === void 0 ? void 0 : _b[POLICY_TYPE_FEED_IN]) ||
|
|
44469
44483
|
(appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_FEED_IN]);
|
|
@@ -44472,13 +44486,13 @@ function getGenerators(params) {
|
|
|
44472
44486
|
params.skipRounds ||
|
|
44473
44487
|
(drawSize <= 4 && ((feedPolicy === null || feedPolicy === void 0 ? void 0 : feedPolicy.feedMainFinal) ? 0 : 1)) ||
|
|
44474
44488
|
0;
|
|
44475
|
-
var
|
|
44489
|
+
var structureName = (_e = (_c = params.structureName) !== null && _c !== void 0 ? _c : (_d = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes['0']) === null || _d === void 0 ? void 0 : _d.name) !== null && _e !== void 0 ? _e : constantToString(MAIN);
|
|
44476
44490
|
var singleElimination = function () {
|
|
44477
44491
|
var matchUps = treeMatchUps(params).matchUps;
|
|
44478
44492
|
var structure = structureTemplate({
|
|
44479
44493
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
44480
|
-
structureName: structureName || main,
|
|
44481
44494
|
stageSequence: stageSequence,
|
|
44495
|
+
structureName: structureName,
|
|
44482
44496
|
matchUpType: matchUpType,
|
|
44483
44497
|
matchUps: matchUps,
|
|
44484
44498
|
stage: stage,
|
|
@@ -44489,9 +44503,9 @@ function getGenerators(params) {
|
|
|
44489
44503
|
_a[AD_HOC] = function () {
|
|
44490
44504
|
var structure = structureTemplate({
|
|
44491
44505
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
44492
|
-
structureName: structureName || main,
|
|
44493
44506
|
finishingPosition: WIN_RATIO,
|
|
44494
44507
|
stageSequence: stageSequence,
|
|
44508
|
+
structureName: structureName,
|
|
44495
44509
|
matchUps: [],
|
|
44496
44510
|
matchUpType: matchUpType,
|
|
44497
44511
|
stage: stage,
|
|
@@ -44502,8 +44516,8 @@ function getGenerators(params) {
|
|
|
44502
44516
|
var matchUps = luckyDraw(params).matchUps;
|
|
44503
44517
|
var structure = structureTemplate({
|
|
44504
44518
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
44505
|
-
structureName: structureName || main,
|
|
44506
44519
|
stageSequence: stageSequence,
|
|
44520
|
+
structureName: structureName,
|
|
44507
44521
|
matchUpType: matchUpType,
|
|
44508
44522
|
matchUps: matchUps,
|
|
44509
44523
|
stage: stage,
|
|
@@ -44513,10 +44527,10 @@ function getGenerators(params) {
|
|
|
44513
44527
|
_a[SINGLE_ELIMINATION] = function () { return singleElimination(); },
|
|
44514
44528
|
_a[DOUBLE_ELIMINATION] = function () { return generateDoubleElimination(params); },
|
|
44515
44529
|
_a[COMPASS] = function () {
|
|
44516
|
-
return generatePlayoffStructures(__assign(__assign({}, params), { roundOffsetLimit: 3, playoffAttributes:
|
|
44530
|
+
return generatePlayoffStructures(__assign(__assign({}, params), { roundOffsetLimit: 3, playoffAttributes: playoffAttributes !== null && playoffAttributes !== void 0 ? playoffAttributes : COMPASS_ATTRIBUTES }));
|
|
44517
44531
|
},
|
|
44518
44532
|
_a[OLYMPIC] = function () {
|
|
44519
|
-
return generatePlayoffStructures(__assign(__assign({}, params), { roundOffsetLimit: 2, playoffAttributes:
|
|
44533
|
+
return generatePlayoffStructures(__assign(__assign({}, params), { roundOffsetLimit: 2, playoffAttributes: playoffAttributes !== null && playoffAttributes !== void 0 ? playoffAttributes : OLYMPIC_ATTRIBUTES }));
|
|
44520
44534
|
},
|
|
44521
44535
|
_a[PLAY_OFF] = function () {
|
|
44522
44536
|
return generatePlayoffStructures(params);
|
|
@@ -44525,8 +44539,8 @@ function getGenerators(params) {
|
|
|
44525
44539
|
var matchUps = feedInMatchUps({ drawSize: drawSize, uuids: uuids, matchUpType: matchUpType }).matchUps;
|
|
44526
44540
|
var structure = structureTemplate({
|
|
44527
44541
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
44528
|
-
structureName: structureName || main,
|
|
44529
44542
|
stageSequence: stageSequence,
|
|
44543
|
+
structureName: structureName,
|
|
44530
44544
|
matchUpType: matchUpType,
|
|
44531
44545
|
stage: MAIN,
|
|
44532
44546
|
matchUps: matchUps,
|
|
@@ -47737,8 +47751,8 @@ function generateQualifyingStructure$1(params) {
|
|
|
47737
47751
|
var stageSequenceName = "".concat(stageSequence);
|
|
47738
47752
|
var qualifyingStructureName = structureName ||
|
|
47739
47753
|
(roundTargetName || stageSequenceName
|
|
47740
|
-
? "".concat(QUALIFYING, " ").concat(roundTargetName).concat(stageSequenceName)
|
|
47741
|
-
: QUALIFYING);
|
|
47754
|
+
? "".concat(constantToString(QUALIFYING), " ").concat(roundTargetName).concat(stageSequenceName)
|
|
47755
|
+
: constantToString(QUALIFYING));
|
|
47742
47756
|
if (drawType === ROUND_ROBIN) {
|
|
47743
47757
|
var _e = generateRoundRobin({
|
|
47744
47758
|
structureName: structureName || qualifyingStructureName,
|