tods-competition-factory 1.8.1 → 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.
@@ -362,7 +362,7 @@ var matchUpFormatCode = {
362
362
  };
363
363
 
364
364
  function factoryVersion() {
365
- return '1.8.1';
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: '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' },
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: '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' },
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';
@@ -16773,6 +16773,137 @@ var fixtures = {
16773
16773
  flagIOC: flagIOC,
16774
16774
  };
16775
16775
 
16776
+ var logColors = {
16777
+ reset: '\x1b[0m',
16778
+ bright: '\x1b[1m',
16779
+ dim: '\x1b[2m',
16780
+ red: '\x1b[31m',
16781
+ brightred: '\x1b[91m',
16782
+ green: '\x1b[32m',
16783
+ brightgreen: '\x1b[92m',
16784
+ yellow: '\x1b[33m',
16785
+ brightyellow: '\x1b[93m',
16786
+ blue: '\x1b[34m',
16787
+ brightblue: '\x1b[94m',
16788
+ lightblue: '\x1b[105m',
16789
+ magenta: '\x1b[35m',
16790
+ brightmagenta: '\x1b[95m',
16791
+ cyan: '\x1b[36m',
16792
+ brightcyan: '\x1b[96m',
16793
+ white: '\x1b[37m',
16794
+ brightwhite: '\x1b[97m',
16795
+ };
16796
+
16797
+ var globalLog = [];
16798
+ function pushGlobalLog(value, devContextOverride) {
16799
+ if (typeof value === 'string')
16800
+ value = { method: value };
16801
+ if (devContextOverride || getDevContext())
16802
+ globalLog.push(value);
16803
+ }
16804
+ function getGlobalLog(purge) {
16805
+ var globalLogCopy = globalLog.slice();
16806
+ if (purge) {
16807
+ globalLog.length = 0;
16808
+ }
16809
+ return globalLogCopy;
16810
+ }
16811
+ function printGlobalLog(purge) {
16812
+ var globalLogCopy = getGlobalLog(purge);
16813
+ var modifiedText = globalLogCopy.map(function (line) {
16814
+ var color = line.color, keyColors = line.keyColors, method = line.method, newline = line.newline;
16815
+ var methodColor = Object.keys(logColors).includes(color)
16816
+ ? logColors[color]
16817
+ : logColors.cyan;
16818
+ var bodyKeys = Object.keys(line).filter(function (key) { return !['color', 'keyColors', 'method', 'newline'].includes(key); });
16819
+ var body = bodyKeys
16820
+ .map(function (key) {
16821
+ var keyColor = keyColors &&
16822
+ Object.keys(keyColors).includes(key) &&
16823
+ logColors[keyColors[key]]
16824
+ ? logColors[keyColors[key]]
16825
+ : logColors.brightwhite;
16826
+ return "".concat(logColors.white).concat(key, ": ").concat(keyColor).concat(line[key]);
16827
+ })
16828
+ .join(', ');
16829
+ var tabs = (method === null || method === void 0 ? void 0 : method.length) < 15 ? "\t\t" : '\t';
16830
+ return [
16831
+ newline ? '\n' : '',
16832
+ methodColor,
16833
+ method,
16834
+ tabs,
16835
+ logColors.white,
16836
+ body,
16837
+ logColors.reset,
16838
+ '\n',
16839
+ ].join('');
16840
+ });
16841
+ if (modifiedText === null || modifiedText === void 0 ? void 0 : modifiedText.length)
16842
+ console.log.apply(console, __spreadArray([], __read(modifiedText), false));
16843
+ }
16844
+ function purgeGlobalLog() {
16845
+ globalLog.length = 0;
16846
+ }
16847
+
16848
+ function visualizeScheduledMatchUps(_a) {
16849
+ var scheduledMatchUps = _a.scheduledMatchUps, showGlobalLog = _a.showGlobalLog;
16850
+ purgeGlobalLog();
16851
+ var structureIds = scheduledMatchUps === null || scheduledMatchUps === void 0 ? void 0 : scheduledMatchUps.reduce(function (structureIds, _a) {
16852
+ var structureId = _a.structureId;
16853
+ return structureIds.includes(structureId)
16854
+ ? structureIds
16855
+ : structureIds.concat(structureId);
16856
+ }, []);
16857
+ var structureNames = Object.assign.apply(Object, __spreadArray([{}], __read((structureIds || []).map(function (structureId) {
16858
+ var _a;
16859
+ var _b = scheduledMatchUps.find(function (matchUp) { return matchUp.structureId === structureId; }), structureName = _b.structureName, matchUpType = _b.matchUpType;
16860
+ return _a = {},
16861
+ _a[structureId] = "".concat(structureName, " ").concat(matchUpType),
16862
+ _a;
16863
+ })), false));
16864
+ structureIds === null || structureIds === void 0 ? void 0 : structureIds.forEach(function (structureId) {
16865
+ var _a;
16866
+ pushGlobalLog({
16867
+ color: 'blue',
16868
+ method: 'draw',
16869
+ structure: structureNames[structureId],
16870
+ keyColors: {
16871
+ structure: 'magenta',
16872
+ },
16873
+ }, true);
16874
+ var structureMatchUps = scheduledMatchUps.filter(function (matchUp) { return matchUp.structureId === structureId; });
16875
+ var roundMatchUps = ((_a = getRoundMatchUps$1({
16876
+ matchUps: structureMatchUps,
16877
+ })) === null || _a === void 0 ? void 0 : _a.roundMatchUps) || [];
16878
+ Object.keys(roundMatchUps).forEach(function (roundNumber) {
16879
+ pushGlobalLog({
16880
+ roundNumber: roundNumber,
16881
+ keyColors: {
16882
+ roundNumber: 'brightcyan',
16883
+ },
16884
+ }, true);
16885
+ roundMatchUps[roundNumber].forEach(function (_a) {
16886
+ var matchUpId = _a.matchUpId, schedule = _a.schedule;
16887
+ var scheduledTime = extractTime(schedule.scheduledTime);
16888
+ pushGlobalLog({
16889
+ matchUpId: matchUpId,
16890
+ time: scheduledTime,
16891
+ date: schedule.scheduledDate,
16892
+ venue: schedule.venueId,
16893
+ keyColors: {
16894
+ time: 'brightcyan',
16895
+ date: 'brightcyan',
16896
+ matchUpId: 'yellow',
16897
+ venue: 'magenta',
16898
+ },
16899
+ }, true);
16900
+ });
16901
+ });
16902
+ });
16903
+ if (showGlobalLog)
16904
+ printGlobalLog();
16905
+ }
16906
+
16776
16907
  function calculateWinCriteria(_a) {
16777
16908
  var e_1, _b, e_2, _c, e_3, _d;
16778
16909
  var _e = _a.collectionDefinitions, collectionDefinitions = _e === void 0 ? [] : _e, _f = _a.collectionGroups, collectionGroups = _f === void 0 ? [] : _f;
@@ -22808,11 +22939,6 @@ function getStructureDrawPositionProfiles(params) {
22808
22939
  };
22809
22940
  }
22810
22941
 
22811
- function pushGlobalLog(value, devContextOverride) {
22812
- if (devContextOverride || getDevContext())
22813
- ;
22814
- }
22815
-
22816
22942
  function clearDrawPosition(params) {
22817
22943
  var inContextDrawMatchUps = params.inContextDrawMatchUps, participantId = params.participantId, drawPosition = params.drawPosition;
22818
22944
  var tournamentRecord = params.tournamentRecord, drawDefinition = params.drawDefinition, structureId = params.structureId, matchUpsMap = params.matchUpsMap, event = params.event;
@@ -23100,7 +23226,11 @@ function removeDrawPosition(_a) {
23100
23226
  initialWinningSide === targetMatchUp.winningSide;
23101
23227
  if (!noChange) {
23102
23228
  if (removedDrawPosition) {
23103
- pushGlobalLog();
23229
+ pushGlobalLog({
23230
+ method: stack,
23231
+ color: 'brightyellow',
23232
+ removedDrawPosition: removedDrawPosition,
23233
+ });
23104
23234
  }
23105
23235
  modifyMatchUpNotice({
23106
23236
  tournamentId: tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.tournamentId,
@@ -23148,7 +23278,11 @@ function removeDrawPosition(_a) {
23148
23278
  }).initialRoundNumber;
23149
23279
  // if clearing a drawPosition from a feed round the initialRoundNumber for the drawPosition must be { roundNumber: 1 }
23150
23280
  if (initialRoundNumber_1 === 1) {
23151
- pushGlobalLog();
23281
+ pushGlobalLog({
23282
+ method: stack,
23283
+ color: 'brightyellow',
23284
+ loserMatchUpDrawPosition: loserMatchUpDrawPosition,
23285
+ });
23152
23286
  drawPositionRemovals({
23153
23287
  structureId: loserMatchUp.structureId,
23154
23288
  drawPosition: loserMatchUpDrawPosition,
@@ -23546,7 +23680,7 @@ function assignDrawPositionBye$1(_a) {
23546
23680
  if (!structureId)
23547
23681
  (structureId = structure.structureId);
23548
23682
  var stack = 'assignDrawPositionBye';
23549
- pushGlobalLog();
23683
+ pushGlobalLog({ method: stack, color: 'cyan', drawPosition: drawPosition });
23550
23684
  if (!matchUpsMap) {
23551
23685
  matchUpsMap = getMatchUpsMap({ drawDefinition: drawDefinition });
23552
23686
  }
@@ -23715,7 +23849,8 @@ function assignRoundRobinBYE(_a) {
23715
23849
  function advanceDrawPosition(_a) {
23716
23850
  var _b;
23717
23851
  var drawPositionToAdvance = _a.drawPositionToAdvance, inContextDrawMatchUps = _a.inContextDrawMatchUps, sourceDrawPositions = _a.sourceDrawPositions, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, matchUpsMap = _a.matchUpsMap, matchUpId = _a.matchUpId, event = _a.event;
23718
- pushGlobalLog();
23852
+ var stack = 'advanceDrawPosition';
23853
+ pushGlobalLog({ method: stack, color: 'cyan', drawPositionToAdvance: drawPositionToAdvance });
23719
23854
  var matchUp = matchUpsMap.drawMatchUps.find(function (matchUp) { return matchUp.matchUpId === matchUpId; });
23720
23855
  var inContextMatchUp = inContextDrawMatchUps.find(function (matchUp) { return matchUp.matchUpId === matchUpId; });
23721
23856
  var structureId = inContextMatchUp === null || inContextMatchUp === void 0 ? void 0 : inContextMatchUp.structureId;
@@ -23857,8 +23992,14 @@ function advanceWinner(_a) {
23857
23992
  winningSide: undefined,
23858
23993
  drawPositions: drawPositions,
23859
23994
  });
23860
- noContextWinnerMatchUp.drawPositions.find(function (position) { return !twoDrawPositions.includes(position); });
23861
- pushGlobalLog();
23995
+ var changedDrawPosition = noContextWinnerMatchUp.drawPositions.find(function (position) { return !twoDrawPositions.includes(position); });
23996
+ pushGlobalLog({
23997
+ method: stack,
23998
+ color: 'brightyellow',
23999
+ changedDrawPosition: changedDrawPosition,
24000
+ pairedDrawPositionIsBye: pairedDrawPositionIsBye,
24001
+ drawPositionIsBye: drawPositionIsBye,
24002
+ });
23862
24003
  modifyMatchUpNotice({
23863
24004
  tournamentId: tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.tournamentId,
23864
24005
  matchUp: noContextWinnerMatchUp,
@@ -23917,7 +24058,8 @@ function advanceWinner(_a) {
23917
24058
  function assignFedDrawPositionBye(_a) {
23918
24059
  var loserTargetDrawPosition = _a.loserTargetDrawPosition, tournamentRecord = _a.tournamentRecord, loserTargetLink = _a.loserTargetLink, drawDefinition = _a.drawDefinition, loserMatchUp = _a.loserMatchUp, matchUpsMap = _a.matchUpsMap, event = _a.event;
23919
24060
  var roundNumber = loserMatchUp.roundNumber;
23920
- pushGlobalLog();
24061
+ var stack = 'assignFedDrawPositionBye';
24062
+ pushGlobalLog({ method: stack, color: 'cyan', loserTargetDrawPosition: loserTargetDrawPosition });
23921
24063
  var mappedMatchUps = (matchUpsMap === null || matchUpsMap === void 0 ? void 0 : matchUpsMap.mappedMatchUps) || {};
23922
24064
  var loserStructureMatchUps = mappedMatchUps[loserMatchUp.structureId].matchUps;
23923
24065
  var initialRoundNumber = getInitialRoundNumber({
@@ -25058,12 +25200,12 @@ var structureTemplate = function (_a) {
25058
25200
  };
25059
25201
 
25060
25202
  function generateRoundRobin(_a) {
25061
- var _b = _a.structureName, structureName = _b === void 0 ? constantToString(MAIN) : _b, _c = _a.stageSequence, stageSequence = _c === void 0 ? 1 : _c, structureOptions = _a.structureOptions, appliedPolicies = _a.appliedPolicies, seedingProfile = _a.seedingProfile, _d = _a.stage, stage = _d === void 0 ? MAIN : _d, matchUpType = _a.matchUpType, roundTarget = _a.roundTarget, structureId = _a.structureId, drawSize = _a.drawSize, idPrefix = _a.idPrefix, isMock = _a.isMock, uuids = _a.uuids;
25062
- var _e = deriveGroups({
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({
25063
25205
  structureOptions: structureOptions,
25064
25206
  appliedPolicies: appliedPolicies,
25065
25207
  drawSize: drawSize,
25066
- }), groupCount = _e.groupCount, groupSize = _e.groupSize;
25208
+ }), groupCount = _f.groupCount, groupSize = _f.groupSize;
25067
25209
  var finishingPosition = WIN_RATIO;
25068
25210
  var maxRoundNumber;
25069
25211
  var structures = generateRange(1, groupCount + 1).map(function (structureOrder) {
@@ -25080,7 +25222,7 @@ function generateRoundRobin(_a) {
25080
25222
  return roundNumber;
25081
25223
  })), false));
25082
25224
  return structureTemplate({
25083
- structureName: "Group ".concat(structureOrder),
25225
+ structureName: "".concat(groupNameBase, " ").concat(structureOrder),
25084
25226
  structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
25085
25227
  structureType: ITEM,
25086
25228
  finishingPosition: finishingPosition,
@@ -26935,18 +27077,35 @@ function attemptToSetWinningSide(params) {
26935
27077
  });
26936
27078
  }
26937
27079
 
27080
+ var keyColors = {
27081
+ drawPositionToRemove: 'green',
27082
+ iteration: 'brightred',
27083
+ winner: 'green',
27084
+ loser: 'brightred',
27085
+ };
26938
27086
  function removeDoubleExit(params) {
26939
27087
  var _a;
26940
27088
  var inContextDrawMatchUps = params.inContextDrawMatchUps, appliedPolicies = params.appliedPolicies, drawDefinition = params.drawDefinition, matchUpsMap = params.matchUpsMap, targetData = params.targetData, matchUp = params.matchUp;
26941
27089
  var _b = params.iteration, iteration = _b === void 0 ? 0 : _b;
26942
27090
  iteration += 1;
26943
27091
  var stack = 'removeDoubleExit';
26944
- pushGlobalLog();
27092
+ pushGlobalLog({
27093
+ method: stack,
27094
+ color: 'brightyellow',
27095
+ iteration: iteration,
27096
+ keyColors: keyColors,
27097
+ });
26945
27098
  var loserTargetLink = targetData.targetLinks.loserTargetLink, _c = targetData.targetMatchUps, loserMatchUp = _c.loserMatchUp, winnerMatchUp = _c.winnerMatchUp, loserTargetDrawPosition = _c.loserTargetDrawPosition;
26946
27099
  // only handles winnerMatchUps in the same structure
26947
27100
  if (winnerMatchUp && winnerMatchUp.matchUpStatus !== BYE) {
26948
- winnerMatchUp.stage; winnerMatchUp.roundNumber; winnerMatchUp.roundPosition;
26949
- pushGlobalLog();
27101
+ var stage = winnerMatchUp.stage, roundNumber = winnerMatchUp.roundNumber, roundPosition = winnerMatchUp.roundPosition;
27102
+ pushGlobalLog({
27103
+ winner: 'winner',
27104
+ stage: stage,
27105
+ roundNumber: roundNumber,
27106
+ roundPosition: roundPosition,
27107
+ keyColors: keyColors,
27108
+ });
26950
27109
  conditionallyRemoveDrawPosition(__assign(__assign({}, params), { targetMatchUp: winnerMatchUp, sourceMatchUp: matchUp, iteration: iteration }));
26951
27110
  }
26952
27111
  if (loserMatchUp && loserMatchUp.matchUpStatus !== BYE) {
@@ -26958,8 +27117,15 @@ function removeDoubleExit(params) {
26958
27117
  drawDefinition: drawDefinition,
26959
27118
  structureId: inContextLoserMatchUp.structureId,
26960
27119
  }).structure;
26961
- loserMatchUp.stage; loserMatchUp.roundNumber; loserMatchUp.roundPosition; loserMatchUp.feedRound;
26962
- pushGlobalLog();
27120
+ var stage = loserMatchUp.stage, roundNumber = loserMatchUp.roundNumber, roundPosition = loserMatchUp.roundPosition, feedRound = loserMatchUp.feedRound;
27121
+ pushGlobalLog({
27122
+ loser: 'loser',
27123
+ stage: stage,
27124
+ roundNumber: roundNumber,
27125
+ roundPosition: roundPosition,
27126
+ keyColors: keyColors,
27127
+ feedRound: feedRound,
27128
+ });
26963
27129
  if ((_a = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies.progression) === null || _a === void 0 ? void 0 : _a.doubleExitPropagateBye) {
26964
27130
  removeDirectedBye({
26965
27131
  drawPosition: loserTargetDrawPosition,
@@ -26981,7 +27147,7 @@ function conditionallyRemoveDrawPosition(params) {
26981
27147
  var _a, _b, _c, _d, _e;
26982
27148
  var inContextDrawMatchUps = params.inContextDrawMatchUps, appliedPolicies = params.appliedPolicies, drawDefinition = params.drawDefinition, sourceMatchUp = params.sourceMatchUp, targetMatchUp = params.targetMatchUp, matchUpsMap = params.matchUpsMap, structure = params.structure, iteration = params.iteration;
26983
27149
  var stack = 'conditionallyRemoveDrawPosition';
26984
- pushGlobalLog();
27150
+ pushGlobalLog({ method: stack });
26985
27151
  // only handles winnerMatchUps in the same structure
26986
27152
  var nextTargetData = positionTargets({
26987
27153
  matchUpId: targetMatchUp.matchUpId,
@@ -27025,8 +27191,16 @@ function conditionallyRemoveDrawPosition(params) {
27025
27191
  }
27026
27192
  }
27027
27193
  if (nextWinnerMatchUp && drawPositionToRemove) {
27028
- nextWinnerMatchUp.stage; nextWinnerMatchUp.roundNumber; nextWinnerMatchUp.roundPosition;
27029
- pushGlobalLog();
27194
+ var stage = nextWinnerMatchUp.stage, roundNumber = nextWinnerMatchUp.roundNumber, roundPosition = nextWinnerMatchUp.roundPosition;
27195
+ pushGlobalLog({
27196
+ method: 'removeDirectedWinner',
27197
+ drawPositionToRemove: drawPositionToRemove,
27198
+ keyColors: keyColors,
27199
+ color: 'brightgreen',
27200
+ stage: stage,
27201
+ roundNumber: roundNumber,
27202
+ roundPosition: roundPosition,
27203
+ });
27030
27204
  removeDirectedWinner({
27031
27205
  winningDrawPosition: drawPositionToRemove,
27032
27206
  winnerMatchUp: nextWinnerMatchUp,
@@ -27637,7 +27811,12 @@ function setMatchUpStatus$2(params) {
27637
27811
  return swapWinnerLoser(params);
27638
27812
  }
27639
27813
  var matchUpWinner = (winningSide && !matchUpTieId) || params.projectedWinningSide;
27640
- pushGlobalLog();
27814
+ pushGlobalLog({
27815
+ method: stack,
27816
+ activeDownstream: activeDownstream,
27817
+ matchUpWinner: matchUpWinner,
27818
+ winningSide: winningSide,
27819
+ });
27641
27820
  var result = (!activeDownstream && noDownstreamDependencies(params)) ||
27642
27821
  (matchUpWinner && winningSideWithDownstreamDependencies(params)) ||
27643
27822
  (directingMatchUpStatus && applyMatchUpValues(params)) || {
@@ -35724,7 +35903,8 @@ function getGroupedRounds(_a) {
35724
35903
  }
35725
35904
 
35726
35905
  function getMatchUpsToSchedule(_a) {
35727
- var matchUpPotentialParticipantIds = _a.matchUpPotentialParticipantIds, scheduleCompletedMatchUps = _a.scheduleCompletedMatchUps, dateScheduledMatchUpIds = _a.dateScheduledMatchUpIds, matchUpNotBeforeTimes = _a.matchUpNotBeforeTimes, orderedMatchUpIds = _a.orderedMatchUpIds, clearDate = _a.clearDate, matchUps = _a.matchUps;
35906
+ var matchUpPotentialParticipantIds = _a.matchUpPotentialParticipantIds, scheduleCompletedMatchUps = _a.scheduleCompletedMatchUps, dateScheduledMatchUpIds = _a.dateScheduledMatchUpIds, matchUpNotBeforeTimes = _a.matchUpNotBeforeTimes, matchUpScheduleTimes = _a.matchUpScheduleTimes, orderedMatchUpIds = _a.orderedMatchUpIds, clearDate = _a.clearDate, matchUps = _a.matchUps;
35907
+ var alreadyScheduledMatchUpIds = Object.keys(matchUpScheduleTimes);
35728
35908
  // this must be done to preserve the order of matchUpIds
35729
35909
  var matchUpsToSchedule = orderedMatchUpIds
35730
35910
  .map(function (matchUpId) {
@@ -35732,7 +35912,9 @@ function getMatchUpsToSchedule(_a) {
35732
35912
  })
35733
35913
  .filter(Boolean)
35734
35914
  .filter(function (matchUp) {
35735
- var alreadyScheduled = !clearDate && dateScheduledMatchUpIds.includes(matchUp.matchUpId);
35915
+ var alreadyScheduled = !clearDate &&
35916
+ (dateScheduledMatchUpIds.includes(matchUp.matchUpId) ||
35917
+ alreadyScheduledMatchUpIds.includes(matchUp.matchUpId));
35736
35918
  var doNotSchedule = [
35737
35919
  BYE,
35738
35920
  DEFAULTED,
@@ -35955,6 +36137,7 @@ function getVenueSchedulingDetails(_a) {
35955
36137
  scheduleCompletedMatchUps: scheduleCompletedMatchUps,
35956
36138
  dateScheduledMatchUpIds: dateScheduledMatchUpIds,
35957
36139
  matchUpNotBeforeTimes: matchUpNotBeforeTimes,
36140
+ matchUpScheduleTimes: matchUpScheduleTimes,
35958
36141
  orderedMatchUpIds: orderedMatchUpIds,
35959
36142
  clearDate: clearDate,
35960
36143
  matchUps: matchUps,
@@ -42413,7 +42596,7 @@ function competitionEngineAsync(test) {
42413
42596
  }
42414
42597
 
42415
42598
  function addVoluntaryConsolationStructure$1(_a) {
42416
- 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;
42417
42600
  if (!drawDefinition)
42418
42601
  return { error: MISSING_DRAW_DEFINITION };
42419
42602
  var structure = structureTemplate({
@@ -42618,8 +42801,8 @@ function generateQualifyingStructures(_a) {
42618
42801
  var stageSequenceName = structureProfiles.length > 1 || roundTargetName ? stageSequence : '';
42619
42802
  var qualifyingStructureName = structureName ||
42620
42803
  (roundTargetName || stageSequenceName
42621
- ? "".concat(QUALIFYING, " ").concat(roundTargetName).concat(stageSequenceName)
42622
- : QUALIFYING);
42804
+ ? "".concat(constantToString(QUALIFYING), " ").concat(roundTargetName).concat(stageSequenceName)
42805
+ : constantToString(QUALIFYING));
42623
42806
  if (drawType === ROUND_ROBIN) {
42624
42807
  var _k = generateRoundRobin({
42625
42808
  structureName: structureProfile.structureName || qualifyingStructureName,
@@ -43325,7 +43508,8 @@ function roundMatchCounts(_a) {
43325
43508
  }
43326
43509
 
43327
43510
  function firstRoundLoserConsolation(params) {
43328
- var _a = params.finishingPositionOffset, finishingPositionOffset = _a === void 0 ? 0 : _a, _b = params.stageSequence, stageSequence = _b === void 0 ? 1 : _b, staggeredEntry = params.staggeredEntry, structureName = params.structureName, _c = params.stage, stage = _c === void 0 ? MAIN : _c, matchUpType = params.matchUpType, structureId = params.structureId, idPrefix = params.idPrefix, drawSize = params.drawSize, isMock = params.isMock, uuids = params.uuids;
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;
43329
43513
  var mainParams = {
43330
43514
  finishingPositionOffset: finishingPositionOffset,
43331
43515
  matchUpType: matchUpType,
@@ -43338,7 +43522,7 @@ function firstRoundLoserConsolation(params) {
43338
43522
  ? feedInMatchUps(mainParams)
43339
43523
  : treeMatchUps(mainParams)).matchUps;
43340
43524
  var mainStructure = structureTemplate({
43341
- 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),
43342
43526
  structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
43343
43527
  stageSequence: stageSequence,
43344
43528
  matchUpType: matchUpType,
@@ -43357,8 +43541,7 @@ function firstRoundLoserConsolation(params) {
43357
43541
  isMock: isMock,
43358
43542
  }).matchUps;
43359
43543
  var consolation = constantToString(CONSOLATION);
43360
- var consolationStructureName = params.consolationStructureName ||
43361
- (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);
43362
43545
  var consolationStructure = structureTemplate({
43363
43546
  structureName: consolationStructureName,
43364
43547
  matchUps: consolationMatchUps,
@@ -43437,7 +43620,8 @@ function feedInLinks(_a) {
43437
43620
  }
43438
43621
 
43439
43622
  function generateCurtisConsolation(params) {
43440
- var _a = params.structureName, structureName = _a === void 0 ? constantToString(MAIN) : _a, playoffStructureNameBase = params.playoffStructureNameBase, finishingPositionOffset = params.finishingPositionOffset, _b = params.stageSequence, stageSequence = _b === void 0 ? 1 : _b, structureNameMap = params.structureNameMap, staggeredEntry = params.staggeredEntry, _c = params.stage, stage = _c === void 0 ? MAIN : _c, matchUpType = params.matchUpType, structureId = params.structureId, drawSize = params.drawSize, idPrefix = params.idPrefix, isMock = params.isMock, uuids = params.uuids;
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;
43441
43625
  var mainParams = {
43442
43626
  finishingPositionOffset: finishingPositionOffset,
43443
43627
  matchUpType: matchUpType,
@@ -43446,9 +43630,10 @@ function generateCurtisConsolation(params) {
43446
43630
  isMock: isMock,
43447
43631
  uuids: uuids,
43448
43632
  };
43449
- var _d = staggeredEntry
43633
+ var _h = staggeredEntry
43450
43634
  ? feedInMatchUps(mainParams)
43451
- : treeMatchUps(mainParams), matchUps = _d.matchUps, mainDrawRoundsCount = _d.roundsCount;
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);
43452
43637
  var mainStructure = structureTemplate({
43453
43638
  structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
43454
43639
  structureName: structureName,
@@ -43467,6 +43652,7 @@ function generateCurtisConsolation(params) {
43467
43652
  idPrefix: idPrefix && "".concat(idPrefix, "-c").concat(index),
43468
43653
  structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
43469
43654
  playoffStructureNameBase: playoffStructureNameBase,
43655
+ playoffAttributes: playoffAttributes,
43470
43656
  structureNameMap: structureNameMap,
43471
43657
  stageSequence: stageSequence,
43472
43658
  roundOffset: roundOffset,
@@ -43499,7 +43685,7 @@ function generateCurtisConsolation(params) {
43499
43685
  matchUpType: matchUpType,
43500
43686
  isMock: isMock,
43501
43687
  }).matchUps;
43502
- 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);
43503
43689
  var mappedStructureName = (structureNameMap === null || structureNameMap === void 0 ? void 0 : structureNameMap[defaultName]) || defaultName;
43504
43690
  var structureName_1 = playoffStructureNameBase
43505
43691
  ? "".concat(playoffStructureNameBase, " ").concat(mappedStructureName)
@@ -43531,9 +43717,10 @@ function generateCurtisConsolation(params) {
43531
43717
  return __assign({ structures: structures, links: links }, SUCCESS);
43532
43718
  }
43533
43719
  function consolationFeedStructure(_a) {
43534
- var playoffStructureNameBase = _a.playoffStructureNameBase, _b = _a.stageSequence, stageSequence = _b === void 0 ? 1 : _b, structureNameMap = _a.structureNameMap, _c = _a.roundOffset, roundOffset = _c === void 0 ? 0 : _c, matchUpType = _a.matchUpType, structureId = _a.structureId, idPrefix = _a.idPrefix, drawSize = _a.drawSize, isMock = _a.isMock, index = _a.index, uuids = _a.uuids;
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;
43535
43722
  var consolationDrawPositions = drawSize / (2 * Math.pow(2, roundOffset));
43536
- var _d = feedInMatchUps({
43723
+ var _f = feedInMatchUps({
43537
43724
  finishingPositionOffset: consolationDrawPositions,
43538
43725
  baseDrawSize: consolationDrawPositions,
43539
43726
  isConsolation: true,
@@ -43542,8 +43729,10 @@ function consolationFeedStructure(_a) {
43542
43729
  idPrefix: idPrefix,
43543
43730
  isMock: isMock,
43544
43731
  uuids: uuids,
43545
- }), consolationMatchUps = _d.matchUps, consolationRoundsCount = _d.roundsCount;
43546
- var defaultName = "".concat(constantToString(CONSOLATION), " ").concat(index + 1);
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);
43547
43736
  var mappedStructureName = (structureNameMap === null || structureNameMap === void 0 ? void 0 : structureNameMap[defaultName]) || defaultName;
43548
43737
  var structureName = playoffStructureNameBase
43549
43738
  ? "".concat(playoffStructureNameBase, " ").concat(mappedStructureName)
@@ -43560,8 +43749,9 @@ function consolationFeedStructure(_a) {
43560
43749
  }
43561
43750
 
43562
43751
  function generatePlayoffStructures(params) {
43563
- var _a = params.finishingPositionOffset, finishingPositionOffset = _a === void 0 ? 0 : _a, addNameBaseToAttributeName = params.addNameBaseToAttributeName, playoffStructureNameBase = params.playoffStructureNameBase, finishingPositionNaming = params.finishingPositionNaming, finishingPositionLimit = params.finishingPositionLimit, playoffAttributes = params.playoffAttributes, _b = params.stageSequence, stageSequence = _b === void 0 ? 1 : _b, _c = params.exitProfile, exitProfile = _c === void 0 ? '0' : _c, exitProfileLimit = params.exitProfileLimit, roundOffsetLimit = params.roundOffsetLimit, _d = params.roundOffset, roundOffset = _d === void 0 ? 0 : _d, drawDefinition = params.drawDefinition, staggeredEntry = params.staggeredEntry, // not propagated to child structurs
43564
- sequenceLimit = params.sequenceLimit, _e = params.stage, stage = _e === void 0 ? MAIN : _e, structureId = params.structureId, drawSize = params.drawSize, idPrefix = params.idPrefix, isMock = params.isMock, uuids = params.uuids;
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;
43565
43755
  var generateStructure = !playoffAttributes || !exitProfileLimit || (playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes[exitProfile]);
43566
43756
  if (!generateStructure ||
43567
43757
  drawSize < 2 ||
@@ -43576,7 +43766,7 @@ function generatePlayoffStructures(params) {
43576
43766
  var finishingPositionRange = "".concat(finishingPositionsFrom, "-").concat(finishingPositionsTo);
43577
43767
  var attributeProfile = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes[exitProfile];
43578
43768
  var base = (playoffStructureNameBase && "".concat(playoffStructureNameBase, " ")) || '';
43579
- 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];
43580
43770
  var structureName = (customNaming === null || customNaming === void 0 ? void 0 : customNaming.name) ||
43581
43771
  ((attributeProfile === null || attributeProfile === void 0 ? void 0 : attributeProfile.name) &&
43582
43772
  (addNameBaseToAttributeName
@@ -43678,7 +43868,8 @@ function generatePlayoffStructures(params) {
43678
43868
  }
43679
43869
 
43680
43870
  function feedInChampionship(params) {
43681
- var finishingPositionOffset = params.finishingPositionOffset, _a = params.stageSequence, stageSequence = _a === void 0 ? 1 : _a, policyDefinitions = params.policyDefinitions, feedsFromFinal = params.feedsFromFinal, staggeredEntry = params.staggeredEntry, structureName = params.structureName, _b = params.stage, stage = _b === void 0 ? MAIN : _b, 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;
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;
43682
43873
  var feedPolicy = params.feedPolicy || (policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_FEED_IN]);
43683
43874
  var mainParams = {
43684
43875
  finishingPositionOffset: finishingPositionOffset,
@@ -43693,7 +43884,7 @@ function feedInChampionship(params) {
43693
43884
  ? feedInMatchUps(mainParams)
43694
43885
  : treeMatchUps(mainParams)).matchUps;
43695
43886
  var mainStructure = structureTemplate({
43696
- 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),
43697
43888
  structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
43698
43889
  stageSequence: stageSequence,
43699
43890
  matchUpType: matchUpType,
@@ -43703,7 +43894,7 @@ function feedInChampionship(params) {
43703
43894
  var structures = [mainStructure];
43704
43895
  var links = [];
43705
43896
  var baseDrawSize = drawSize / 2;
43706
- var _c = feedInMatchUps({
43897
+ var _f = feedInMatchUps({
43707
43898
  finishingPositionOffset: baseDrawSize,
43708
43899
  idPrefix: idPrefix && "".concat(idPrefix, "-c"),
43709
43900
  isConsolation: true,
@@ -43715,10 +43906,10 @@ function feedInChampionship(params) {
43715
43906
  isMock: isMock,
43716
43907
  uuids: uuids,
43717
43908
  fmlc: fmlc,
43718
- }), consolationMatchUps = _c.matchUps, roundsCount = _c.roundsCount;
43909
+ }), consolationMatchUps = _f.matchUps, roundsCount = _f.roundsCount;
43719
43910
  if (drawSize > 2) {
43720
43911
  var consolationStructure = structureTemplate({
43721
- 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),
43722
43913
  matchUps: consolationMatchUps,
43723
43914
  structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
43724
43915
  stage: CONSOLATION,
@@ -43740,19 +43931,19 @@ function feedInChampionship(params) {
43740
43931
 
43741
43932
  function processPlayoffGroups(_a) {
43742
43933
  var e_1, _b;
43743
- var _c, _d, _e, _f, _g, _h, _j;
43744
- var _k = _a.compassAttributes, compassAttributes = _k === void 0 ? COMPASS_ATTRIBUTES : _k, _l = _a.olympicAttributes, olympicAttributes = _l === void 0 ? OLYMPIC_ATTRIBUTES : _l, _m = _a.requireSequential, requireSequential = _m === void 0 ? true : _m, playoffMatchUpFormat = _a.playoffMatchUpFormat, 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;
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;
43745
43936
  feedPolicy = feedPolicy || (policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_FEED_IN]);
43746
43937
  var stack = 'processPlayoffGroups';
43747
43938
  var finishingPositionOffset = 0;
43748
43939
  var finishingPositionTargets = [];
43749
43940
  var structures = [];
43750
43941
  var links = [];
43751
- var _o = getPositionRangeMap({
43942
+ var _v = getPositionRangeMap({
43752
43943
  structureId: sourceStructureId,
43753
43944
  drawDefinition: drawDefinition,
43754
43945
  playoffGroups: playoffGroups,
43755
- }), error = _o.error, positionRangeMap = _o.positionRangeMap;
43946
+ }), error = _v.error, positionRangeMap = _v.positionRangeMap;
43756
43947
  if (error)
43757
43948
  return decorateResult({ result: { error: error }, stack: stack });
43758
43949
  var validFinishingPositions = !positionRangeMap ||
@@ -43775,7 +43966,7 @@ function processPlayoffGroups(_a) {
43775
43966
  });
43776
43967
  }
43777
43968
  var _loop_1 = function (playoffGroup) {
43778
- var _p;
43969
+ var _w;
43779
43970
  var finishingPositions = playoffGroup.finishingPositions;
43780
43971
  var positionsPlayedOff = positionRangeMap &&
43781
43972
  finishingPositions
@@ -43789,16 +43980,22 @@ function processPlayoffGroups(_a) {
43789
43980
  if (positionsPlayedOff) {
43790
43981
  finishingPositionOffset = Math.min.apply(Math, __spreadArray([], __read(positionsPlayedOff), false)) - 1;
43791
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);
43792
43989
  var playoffGroupParams = {
43793
43990
  addNameBaseToAttributeName: playoffGroup.addNameBaseToAttributeName,
43794
43991
  playoffStructureNameBase: playoffGroup.playoffStructureNameBase,
43795
43992
  finishingPositionNaming: playoffGroup.finishingPositionNaming,
43796
43993
  finishingPositionLimit: playoffGroup.finishingPositionLimit,
43797
- structureId: (_c = playoffGroup.structureId) !== null && _c !== void 0 ? _c : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
43994
+ structureId: (_g = playoffGroup.structureId) !== null && _g !== void 0 ? _g : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
43798
43995
  playoffAttributes: playoffGroup.playoffAttributes,
43799
43996
  structureNameMap: playoffGroup.structureNameMap,
43800
- structureName: playoffGroup.structureName,
43801
43997
  sequenceLimit: playoffGroup.sequenceLimit,
43998
+ structureName: structureName,
43802
43999
  };
43803
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 });
43804
44001
  var updateStructureAndLinks = function (_a) {
@@ -43830,10 +44027,10 @@ function processPlayoffGroups(_a) {
43830
44027
  uuids: uuids,
43831
44028
  }).matchUps;
43832
44029
  var playoffStructure = structureTemplate({
43833
- structureId: (_d = playoffGroup.structureId) !== null && _d !== void 0 ? _d : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
43834
- structureName: playoffGroup.structureName,
44030
+ structureId: (_h = playoffGroup.structureId) !== null && _h !== void 0 ? _h : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
43835
44031
  matchUpFormat: playoffMatchUpFormat,
43836
44032
  stage: PLAY_OFF,
44033
+ structureName: structureName,
43837
44034
  stageSequence: stageSequence,
43838
44035
  matchUps: matchUps,
43839
44036
  });
@@ -43852,9 +44049,9 @@ function processPlayoffGroups(_a) {
43852
44049
  });
43853
44050
  }
43854
44051
  else if ([COMPASS, OLYMPIC, PLAY_OFF].includes(playoffDrawType)) {
43855
- var structureName = playoffGroup.structureName;
43856
44052
  var params_1 = {
43857
- structureId: (_e = playoffGroup.structureId) !== null && _e !== void 0 ? _e : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
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(),
43858
44055
  playoffStructureNameBase: structureName,
43859
44056
  idPrefix: idPrefix && "".concat(idPrefix, "-po"),
43860
44057
  addNameBaseToAttributeName: true,
@@ -43868,22 +44065,22 @@ function processPlayoffGroups(_a) {
43868
44065
  };
43869
44066
  if (playoffDrawType === COMPASS) {
43870
44067
  Object.assign(params_1, {
43871
- playoffAttributes: compassAttributes,
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,
43872
44069
  roundOffsetLimit: 3,
43873
44070
  });
43874
44071
  }
43875
44072
  else if (playoffDrawType === OLYMPIC) {
43876
44073
  Object.assign(params_1, {
43877
- playoffAttributes: olympicAttributes,
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,
43878
44075
  roundOffsetLimit: 2,
43879
44076
  });
43880
44077
  }
43881
44078
  var result = generatePlayoffStructures(params_1);
43882
44079
  if (result.error)
43883
44080
  return { value: result };
43884
- if ((_f = result.links) === null || _f === void 0 ? void 0 : _f.length)
44081
+ if ((_q = result.links) === null || _q === void 0 ? void 0 : _q.length)
43885
44082
  links.push.apply(links, __spreadArray([], __read(result.links), false));
43886
- if ((_g = result.structures) === null || _g === void 0 ? void 0 : _g.length)
44083
+ if ((_r = result.structures) === null || _r === void 0 ? void 0 : _r.length)
43887
44084
  structures.push.apply(structures, __spreadArray([], __read(result.structures), false));
43888
44085
  structures.sort(structureSort);
43889
44086
  if (result.structureId) {
@@ -43911,27 +44108,27 @@ function processPlayoffGroups(_a) {
43911
44108
  ].includes(playoffDrawType)) {
43912
44109
  var uuidsFMLC = [uuids === null || uuids === void 0 ? void 0 : uuids.pop(), uuids === null || uuids === void 0 ? void 0 : uuids.pop()];
43913
44110
  var params_2 = {
43914
- structureId: (_h = playoffGroup.structureId) !== null && _h !== void 0 ? _h : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
43915
- structureName: playoffGroup.structureName,
44111
+ structureId: (_s = playoffGroup.structureId) !== null && _s !== void 0 ? _s : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
43916
44112
  idPrefix: idPrefix && "".concat(idPrefix, "-po"),
43917
44113
  finishingPositionOffset: finishingPositionOffset,
43918
44114
  uuids: uuidsFMLC,
43919
44115
  stage: PLAY_OFF,
44116
+ structureName: structureName,
43920
44117
  matchUpType: matchUpType,
43921
44118
  feedPolicy: feedPolicy,
43922
44119
  drawSize: drawSize,
43923
44120
  isMock: isMock,
43924
44121
  };
43925
- var additionalAttributes = (_p = {},
43926
- _p[FIRST_MATCH_LOSER_CONSOLATION] = { fmlc: true, feedRounds: 1 },
43927
- _p[MODIFIED_FEED_IN_CHAMPIONSHIP] = { feedRounds: 1 },
43928
- _p[FEED_IN_CHAMPIONSHIP_TO_R16] = { feedsFromFinal: 3 },
43929
- _p[FEED_IN_CHAMPIONSHIP_TO_QF] = { feedsFromFinal: 2 },
43930
- _p[FEED_IN_CHAMPIONSHIP_TO_SF] = { feedsFromFinal: 1 },
43931
- _p);
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);
43932
44129
  Object.assign(params_2, additionalAttributes[playoffDrawType] || {});
43933
- var _q = feedInChampionship(params_2), champitionShipStructures = _q.structures, feedInLinks = _q.links;
43934
- var _r = __read(champitionShipStructures, 1), playoffStructure = _r[0];
44130
+ var _x = feedInChampionship(params_2), champitionShipStructures = _x.structures, feedInLinks = _x.links;
44131
+ var _y = __read(champitionShipStructures, 1), playoffStructure = _y[0];
43935
44132
  var playoffLink = generatePlayoffLink({
43936
44133
  playoffStructureId: playoffStructure.structureId,
43937
44134
  finishingPositions: finishingPositions,
@@ -43948,20 +44145,20 @@ function processPlayoffGroups(_a) {
43948
44145
  finishingPositionOffset += participantsInDraw;
43949
44146
  }
43950
44147
  else if ([ROUND_ROBIN].includes(playoffDrawType)) {
43951
- var _s = generateRoundRobin(__assign(__assign({}, params), { structureOptions: playoffGroup.structureOptions || { groupSize: 4 } })), playoffStructures = _s.structures, playoffLinks = _s.links;
44148
+ var _z = generateRoundRobin(__assign(__assign({}, params), { structureOptions: playoffGroup.structureOptions || { groupSize: 4 } })), playoffStructures = _z.structures, playoffLinks = _z.links;
43952
44149
  updateStructureAndLinks({ playoffStructures: playoffStructures, playoffLinks: playoffLinks });
43953
44150
  }
43954
44151
  else if ([FIRST_ROUND_LOSER_CONSOLATION].includes(playoffDrawType)) {
43955
- var _t = firstRoundLoserConsolation(params), playoffStructures = _t.structures, playoffLinks = _t.links;
44152
+ var _0 = firstRoundLoserConsolation(params), playoffStructures = _0.structures, playoffLinks = _0.links;
43956
44153
  updateStructureAndLinks({ playoffStructures: playoffStructures, playoffLinks: playoffLinks });
43957
44154
  }
43958
44155
  else if ([CURTIS_CONSOLATION].includes(playoffDrawType)) {
43959
- var _u = generateCurtisConsolation(params), playoffStructures = _u.structures, playoffLinks = _u.links;
44156
+ var _1 = generateCurtisConsolation(params), playoffStructures = _1.structures, playoffLinks = _1.links;
43960
44157
  updateStructureAndLinks({ playoffStructures: playoffStructures, playoffLinks: playoffLinks });
43961
44158
  }
43962
44159
  else if ([AD_HOC].includes(playoffDrawType)) {
43963
44160
  var structure = structureTemplate({
43964
- structureId: (_j = playoffGroup.structureId) !== null && _j !== void 0 ? _j : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
44161
+ structureId: (_t = playoffGroup.structureId) !== null && _t !== void 0 ? _t : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
43965
44162
  structureName: playoffGroup.structureName,
43966
44163
  finishingPosition: WIN_RATIO$1,
43967
44164
  stage: PLAY_OFF,
@@ -44279,8 +44476,8 @@ function luckyRoundProfiles(drawSize) {
44279
44476
 
44280
44477
  function getGenerators(params) {
44281
44478
  var _a;
44282
- var _b;
44283
- var _c = params.compassAttributes, compassAttributes = _c === void 0 ? COMPASS_ATTRIBUTES : _c, _d = params.olympicAttributes, olympicAttributes = _d === void 0 ? OLYMPIC_ATTRIBUTES : _d, _e = params.stageSequence, stageSequence = _e === void 0 ? 1 : _e, structureName = params.structureName, structureId = params.structureId, _f = params.stage, stage = _f === void 0 ? MAIN : _f, matchUpType = params.matchUpType, drawSize = params.drawSize, uuids = params.uuids;
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;
44284
44481
  var appliedPolicies = getAppliedPolicies(params).appliedPolicies;
44285
44482
  var feedPolicy = ((_b = params.policyDefinitions) === null || _b === void 0 ? void 0 : _b[POLICY_TYPE_FEED_IN]) ||
44286
44483
  (appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_FEED_IN]);
@@ -44289,13 +44486,13 @@ function getGenerators(params) {
44289
44486
  params.skipRounds ||
44290
44487
  (drawSize <= 4 && ((feedPolicy === null || feedPolicy === void 0 ? void 0 : feedPolicy.feedMainFinal) ? 0 : 1)) ||
44291
44488
  0;
44292
- var main = constantToString(MAIN);
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);
44293
44490
  var singleElimination = function () {
44294
44491
  var matchUps = treeMatchUps(params).matchUps;
44295
44492
  var structure = structureTemplate({
44296
44493
  structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
44297
- structureName: structureName || main,
44298
44494
  stageSequence: stageSequence,
44495
+ structureName: structureName,
44299
44496
  matchUpType: matchUpType,
44300
44497
  matchUps: matchUps,
44301
44498
  stage: stage,
@@ -44306,9 +44503,9 @@ function getGenerators(params) {
44306
44503
  _a[AD_HOC] = function () {
44307
44504
  var structure = structureTemplate({
44308
44505
  structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
44309
- structureName: structureName || main,
44310
44506
  finishingPosition: WIN_RATIO,
44311
44507
  stageSequence: stageSequence,
44508
+ structureName: structureName,
44312
44509
  matchUps: [],
44313
44510
  matchUpType: matchUpType,
44314
44511
  stage: stage,
@@ -44319,8 +44516,8 @@ function getGenerators(params) {
44319
44516
  var matchUps = luckyDraw(params).matchUps;
44320
44517
  var structure = structureTemplate({
44321
44518
  structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
44322
- structureName: structureName || main,
44323
44519
  stageSequence: stageSequence,
44520
+ structureName: structureName,
44324
44521
  matchUpType: matchUpType,
44325
44522
  matchUps: matchUps,
44326
44523
  stage: stage,
@@ -44330,10 +44527,10 @@ function getGenerators(params) {
44330
44527
  _a[SINGLE_ELIMINATION] = function () { return singleElimination(); },
44331
44528
  _a[DOUBLE_ELIMINATION] = function () { return generateDoubleElimination(params); },
44332
44529
  _a[COMPASS] = function () {
44333
- return generatePlayoffStructures(__assign(__assign({}, params), { roundOffsetLimit: 3, playoffAttributes: compassAttributes }));
44530
+ return generatePlayoffStructures(__assign(__assign({}, params), { roundOffsetLimit: 3, playoffAttributes: playoffAttributes !== null && playoffAttributes !== void 0 ? playoffAttributes : COMPASS_ATTRIBUTES }));
44334
44531
  },
44335
44532
  _a[OLYMPIC] = function () {
44336
- return generatePlayoffStructures(__assign(__assign({}, params), { roundOffsetLimit: 2, playoffAttributes: olympicAttributes }));
44533
+ return generatePlayoffStructures(__assign(__assign({}, params), { roundOffsetLimit: 2, playoffAttributes: playoffAttributes !== null && playoffAttributes !== void 0 ? playoffAttributes : OLYMPIC_ATTRIBUTES }));
44337
44534
  },
44338
44535
  _a[PLAY_OFF] = function () {
44339
44536
  return generatePlayoffStructures(params);
@@ -44342,8 +44539,8 @@ function getGenerators(params) {
44342
44539
  var matchUps = feedInMatchUps({ drawSize: drawSize, uuids: uuids, matchUpType: matchUpType }).matchUps;
44343
44540
  var structure = structureTemplate({
44344
44541
  structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
44345
- structureName: structureName || main,
44346
44542
  stageSequence: stageSequence,
44543
+ structureName: structureName,
44347
44544
  matchUpType: matchUpType,
44348
44545
  stage: MAIN,
44349
44546
  matchUps: matchUps,
@@ -47554,8 +47751,8 @@ function generateQualifyingStructure$1(params) {
47554
47751
  var stageSequenceName = "".concat(stageSequence);
47555
47752
  var qualifyingStructureName = structureName ||
47556
47753
  (roundTargetName || stageSequenceName
47557
- ? "".concat(QUALIFYING, " ").concat(roundTargetName).concat(stageSequenceName)
47558
- : QUALIFYING);
47754
+ ? "".concat(constantToString(QUALIFYING), " ").concat(roundTargetName).concat(stageSequenceName)
47755
+ : constantToString(QUALIFYING));
47559
47756
  if (drawType === ROUND_ROBIN) {
47560
47757
  var _e = generateRoundRobin({
47561
47758
  structureName: structureName || qualifyingStructureName,
@@ -69457,6 +69654,7 @@ var utilities = {
69457
69654
  UUID: UUID,
69458
69655
  UUIDS: UUIDS,
69459
69656
  validateTieFormat: validateTieFormat,
69657
+ visualizeScheduledMatchUps: visualizeScheduledMatchUps,
69460
69658
  };
69461
69659
  // END
69462
69660