tods-competition-factory 1.7.14 → 1.7.16

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.7.14';
365
+ return '1.7.16';
366
366
  }
367
367
 
368
368
  /******************************************************************************
@@ -3529,31 +3529,25 @@ function validateTieFormat(params) {
3529
3529
  if (!params || !tieFormat || typeof tieFormat !== 'object') {
3530
3530
  errors.push('tieFormat must be an object');
3531
3531
  return decorateResult({
3532
- result: {
3533
- context: { tieFormat: tieFormat, errors: errors },
3534
- error: INVALID_TIE_FORMAT,
3535
- stack: stack,
3536
- },
3532
+ result: { error: INVALID_TIE_FORMAT },
3533
+ context: { tieFormat: tieFormat, errors: errors },
3534
+ stack: stack,
3537
3535
  });
3538
3536
  }
3539
3537
  if (typeof tieFormat.winCriteria !== 'object') {
3540
3538
  errors.push('tieFormat.winCriteria must be an object');
3541
3539
  return decorateResult({
3542
- result: {
3543
- context: { tieFormat: tieFormat, errors: errors },
3544
- error: INVALID_TIE_FORMAT,
3545
- stack: stack,
3546
- },
3540
+ result: { error: INVALID_TIE_FORMAT },
3541
+ context: { tieFormat: tieFormat, errors: errors },
3542
+ stack: stack,
3547
3543
  });
3548
3544
  }
3549
3545
  if (!Array.isArray(tieFormat.collectionDefinitions)) {
3550
3546
  errors.push(mustBeAnArray('tieFormat.collectionDefinitions'));
3551
3547
  return decorateResult({
3552
- result: {
3553
- context: { tieFormat: tieFormat, errors: errors },
3554
- error: INVALID_TIE_FORMAT,
3555
- stack: stack,
3556
- },
3548
+ result: { error: INVALID_TIE_FORMAT },
3549
+ context: { tieFormat: tieFormat, errors: errors },
3550
+ stack: stack,
3557
3551
  });
3558
3552
  }
3559
3553
  var aggregateValueImperative;
@@ -3587,11 +3581,9 @@ function validateTieFormat(params) {
3587
3581
  errors.push('Either non-zero valueGoal, or { aggregateValue: true } must be specified in winCriteria');
3588
3582
  }
3589
3583
  return decorateResult({
3590
- result: {
3591
- context: { tieFormat: tieFormat, errors: errors, aggregateValueImperative: aggregateValueImperative },
3592
- error: INVALID_TIE_FORMAT,
3593
- stack: stack,
3594
- },
3584
+ context: { tieFormat: tieFormat, errors: errors, aggregateValueImperative: aggregateValueImperative },
3585
+ result: { error: INVALID_TIE_FORMAT },
3586
+ stack: stack,
3595
3587
  });
3596
3588
  }
3597
3589
  var collectionIds = tieFormat.collectionDefinitions.map(function (_a) {
@@ -3604,11 +3596,9 @@ function validateTieFormat(params) {
3604
3596
  var result = { valid: valid, errors: errors };
3605
3597
  if (!valid) {
3606
3598
  return decorateResult({
3607
- result: {
3608
- context: { tieFormat: tieFormat, errors: errors },
3609
- error: INVALID_TIE_FORMAT,
3610
- stack: stack,
3611
- },
3599
+ result: { error: INVALID_TIE_FORMAT },
3600
+ context: { tieFormat: tieFormat, errors: errors },
3601
+ stack: stack,
3612
3602
  });
3613
3603
  }
3614
3604
  return result;
@@ -5932,26 +5922,27 @@ function getEvents(_a) {
5932
5922
  return { events: eventCopies };
5933
5923
  }
5934
5924
  function findEvent(_a) {
5925
+ var _b;
5935
5926
  var tournamentRecord = _a.tournamentRecord, eventId = _a.eventId, drawId = _a.drawId;
5936
5927
  var stack = 'findEvent';
5937
5928
  if (!tournamentRecord)
5938
- return __assign({ event: undefined, drawDefinition: undefined }, decorateResult({
5929
+ return decorateResult({
5939
5930
  result: { error: MISSING_TOURNAMENT_RECORD },
5940
5931
  stack: stack,
5941
- }));
5942
- var events = (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.events) || [];
5932
+ });
5933
+ var events = (_b = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.events) !== null && _b !== void 0 ? _b : [];
5943
5934
  if (drawId) {
5944
5935
  var drawDefinition_1;
5945
5936
  var event_1 = events.find(function (event) {
5946
- var _a;
5947
- var drawDefinitions = (event === null || event === void 0 ? void 0 : event.drawDefinitions) || [];
5937
+ var _a, _b;
5938
+ var drawDefinitions = (_a = event === null || event === void 0 ? void 0 : event.drawDefinitions) !== null && _a !== void 0 ? _a : [];
5948
5939
  var targetDrawDefinition = drawDefinitions.find(function (drawDefinition) { return drawDefinition.drawId === drawId; });
5949
5940
  if (targetDrawDefinition) {
5950
5941
  drawDefinition_1 = targetDrawDefinition;
5951
5942
  }
5952
5943
  else {
5953
5944
  var flightProfile = getFlightProfile({ event: event }).flightProfile;
5954
- var flight = (_a = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _a === void 0 ? void 0 : _a.find(function (flight) { return flight.drawId === drawId; });
5945
+ var flight = (_b = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _b === void 0 ? void 0 : _b.find(function (flight) { return flight.drawId === drawId; });
5955
5946
  if (flight)
5956
5947
  return {
5957
5948
  drawId: drawId,
@@ -5999,6 +5990,7 @@ function getDrawDefinition$2(_a) {
5999
5990
  }
6000
5991
 
6001
5992
  function addExtension$1(params) {
5993
+ var _a;
6002
5994
  if (typeof params !== 'object')
6003
5995
  return { error: MISSING_VALUE };
6004
5996
  var stack = 'addExtension';
@@ -6013,7 +6005,7 @@ function addExtension$1(params) {
6013
6005
  });
6014
6006
  if (!params.element.extensions)
6015
6007
  params.element.extensions = [];
6016
- var creationTime = params.creationTime !== undefined ? params.creationTime : true;
6008
+ var creationTime = (_a = params === null || params === void 0 ? void 0 : params.creationTime) !== null && _a !== void 0 ? _a : true;
6017
6009
  if (creationTime) {
6018
6010
  var createdAt = new Date().toISOString();
6019
6011
  Object.assign(params.extension, { createdAt: createdAt });
@@ -6578,7 +6570,7 @@ function publicFindVenue(_a) {
6578
6570
 
6579
6571
  function findCourt(_a) {
6580
6572
  var e_1, _b;
6581
- var _c;
6573
+ var _c, _d;
6582
6574
  var tournamentRecords = _a.tournamentRecords, tournamentRecord = _a.tournamentRecord, courtId = _a.courtId;
6583
6575
  if (!tournamentRecord)
6584
6576
  return { error: MISSING_TOURNAMENT_RECORD };
@@ -6600,9 +6592,9 @@ function findCourt(_a) {
6600
6592
  }
6601
6593
  else if (tournamentRecords) {
6602
6594
  // if tournamentRecords is provided then call is from competitionEngine
6603
- var linkedTournamentIds = getLinkedTournamentIds({
6595
+ var linkedTournamentIds = (_d = getLinkedTournamentIds({
6604
6596
  tournamentRecords: tournamentRecords,
6605
- }).linkedTournamentIds || [];
6597
+ }).linkedTournamentIds) !== null && _d !== void 0 ? _d : [];
6606
6598
  var relevantIds = linkedTournamentIds[tournamentRecord.tournamentId];
6607
6599
  try {
6608
6600
  // if there are linked tournaments search for court in all linked tournaments
@@ -15083,7 +15075,7 @@ var ratingsParameters = (_a$g = {},
15083
15075
  },
15084
15076
  _a$g);
15085
15077
 
15086
- var collectionDefinitions$h = [
15078
+ var collectionDefinitions$i = [
15087
15079
  {
15088
15080
  collectionName: "Doubles",
15089
15081
  matchUpCount: 3,
@@ -15099,17 +15091,17 @@ var collectionDefinitions$h = [
15099
15091
  matchUpValue: 1
15100
15092
  }
15101
15093
  ];
15102
- var tieFormatName$h = "COLLEGE_D3";
15103
- var winCriteria$h = {
15094
+ var tieFormatName$i = "COLLEGE_D3";
15095
+ var winCriteria$i = {
15104
15096
  valueGoal: 5
15105
15097
  };
15106
15098
  var COLLEGE_D3$1 = {
15107
- collectionDefinitions: collectionDefinitions$h,
15108
- tieFormatName: tieFormatName$h,
15109
- winCriteria: winCriteria$h
15099
+ collectionDefinitions: collectionDefinitions$i,
15100
+ tieFormatName: tieFormatName$i,
15101
+ winCriteria: winCriteria$i
15110
15102
  };
15111
15103
 
15112
- var collectionDefinitions$g = [
15104
+ var collectionDefinitions$h = [
15113
15105
  {
15114
15106
  collectionName: "Doubles",
15115
15107
  collectionValue: 1,
@@ -15125,17 +15117,17 @@ var collectionDefinitions$g = [
15125
15117
  matchUpValue: 1
15126
15118
  }
15127
15119
  ];
15128
- var tieFormatName$g = "COLLEGE_DEFAULT";
15129
- var winCriteria$g = {
15120
+ var tieFormatName$h = "COLLEGE_DEFAULT";
15121
+ var winCriteria$h = {
15130
15122
  valueGoal: 5
15131
15123
  };
15132
15124
  var COLLEGE_DEFAULT$1 = {
15133
- collectionDefinitions: collectionDefinitions$g,
15134
- tieFormatName: tieFormatName$g,
15135
- winCriteria: winCriteria$g
15125
+ collectionDefinitions: collectionDefinitions$h,
15126
+ tieFormatName: tieFormatName$h,
15127
+ winCriteria: winCriteria$h
15136
15128
  };
15137
15129
 
15138
- var collectionDefinitions$f = [
15130
+ var collectionDefinitions$g = [
15139
15131
  {
15140
15132
  collectionName: "Doubles",
15141
15133
  matchUpCount: 3,
@@ -15151,17 +15143,17 @@ var collectionDefinitions$f = [
15151
15143
  matchUpValue: 1
15152
15144
  }
15153
15145
  ];
15154
- var tieFormatName$f = "COLLEGE_JUCO";
15155
- var winCriteria$f = {
15146
+ var tieFormatName$g = "COLLEGE_JUCO";
15147
+ var winCriteria$g = {
15156
15148
  valueGoal: 5
15157
15149
  };
15158
15150
  var COLLEGE_JUCO$1 = {
15159
- collectionDefinitions: collectionDefinitions$f,
15160
- tieFormatName: tieFormatName$f,
15161
- winCriteria: winCriteria$f
15151
+ collectionDefinitions: collectionDefinitions$g,
15152
+ tieFormatName: tieFormatName$g,
15153
+ winCriteria: winCriteria$g
15162
15154
  };
15163
15155
 
15164
- var collectionDefinitions$e = [
15156
+ var collectionDefinitions$f = [
15165
15157
  {
15166
15158
  collectionName: "Doubles",
15167
15159
  matchUpCount: 1,
@@ -15177,17 +15169,17 @@ var collectionDefinitions$e = [
15177
15169
  matchUpValue: 1
15178
15170
  }
15179
15171
  ];
15180
- var tieFormatName$e = "DOMINANT_DUO";
15181
- var winCriteria$e = {
15172
+ var tieFormatName$f = "DOMINANT_DUO";
15173
+ var winCriteria$f = {
15182
15174
  valueGoal: 2
15183
15175
  };
15184
15176
  var DOMINANT_DUO_TIE_FORMAT = {
15185
- collectionDefinitions: collectionDefinitions$e,
15186
- tieFormatName: tieFormatName$e,
15187
- winCriteria: winCriteria$e
15177
+ collectionDefinitions: collectionDefinitions$f,
15178
+ tieFormatName: tieFormatName$f,
15179
+ winCriteria: winCriteria$f
15188
15180
  };
15189
15181
 
15190
- var collectionDefinitions$d = [
15182
+ var collectionDefinitions$e = [
15191
15183
  {
15192
15184
  collectionName: "Mixed Doubles",
15193
15185
  gender: "MIXED",
@@ -15213,17 +15205,17 @@ var collectionDefinitions$d = [
15213
15205
  matchUpValue: 1
15214
15206
  }
15215
15207
  ];
15216
- var tieFormatName$d = "DOMINANT_DUO_MIXED";
15217
- var winCriteria$d = {
15208
+ var tieFormatName$e = "DOMINANT_DUO_MIXED";
15209
+ var winCriteria$e = {
15218
15210
  valueGoal: 2
15219
15211
  };
15220
15212
  var DOMINANT_DUO_MIXED_TIE_FORMAT = {
15221
- collectionDefinitions: collectionDefinitions$d,
15222
- tieFormatName: tieFormatName$d,
15223
- winCriteria: winCriteria$d
15213
+ collectionDefinitions: collectionDefinitions$e,
15214
+ tieFormatName: tieFormatName$e,
15215
+ winCriteria: winCriteria$e
15224
15216
  };
15225
15217
 
15226
- var collectionDefinitions$c = [
15218
+ var collectionDefinitions$d = [
15227
15219
  {
15228
15220
  collectionGroupNumber: 1,
15229
15221
  matchUpType: "DOUBLES",
@@ -15281,18 +15273,18 @@ var collectionGroups$1 = [
15281
15273
  groupName: "Day 3"
15282
15274
  }
15283
15275
  ];
15284
- var tieFormatName$c = "LAVER_CUP";
15285
- var winCriteria$c = {
15276
+ var tieFormatName$d = "LAVER_CUP";
15277
+ var winCriteria$d = {
15286
15278
  valueGoal: 13
15287
15279
  };
15288
15280
  var LAVER_CUP_TIE_FORMAT = {
15289
- collectionDefinitions: collectionDefinitions$c,
15281
+ collectionDefinitions: collectionDefinitions$d,
15290
15282
  collectionGroups: collectionGroups$1,
15291
- tieFormatName: tieFormatName$c,
15292
- winCriteria: winCriteria$c
15283
+ tieFormatName: tieFormatName$d,
15284
+ winCriteria: winCriteria$d
15293
15285
  };
15294
15286
 
15295
- var collectionDefinitions$b = [
15287
+ var collectionDefinitions$c = [
15296
15288
  {
15297
15289
  collectionName: "Round 1",
15298
15290
  matchUpCount: 3,
@@ -15315,15 +15307,67 @@ var collectionDefinitions$b = [
15315
15307
  scoreValue: 1
15316
15308
  }
15317
15309
  ];
15318
- var tieFormatName$b = "Doubles Shuffle";
15310
+ var tieFormatName$c = "Doubles Shuffle";
15319
15311
  var unrestrictedSelections = true;
15320
- var winCriteria$b = {
15312
+ var winCriteria$c = {
15321
15313
  aggregateValue: true
15322
15314
  };
15323
15315
  var TEAM_AGGREGATION_TIE_FORMAT = {
15316
+ collectionDefinitions: collectionDefinitions$c,
15317
+ tieFormatName: tieFormatName$c,
15318
+ unrestrictedSelections: unrestrictedSelections,
15319
+ winCriteria: winCriteria$c
15320
+ };
15321
+
15322
+ var collectionDefinitions$b = [
15323
+ {
15324
+ scoreValue: 1,
15325
+ matchUpType: "SINGLES",
15326
+ collectionName: "Men's Singles",
15327
+ matchUpFormat: "SET1-S:T60",
15328
+ gender: "MALE",
15329
+ matchUpCount: 3
15330
+ },
15331
+ {
15332
+ scoreValue: 1,
15333
+ matchUpType: "SINGLES",
15334
+ collectionName: "Women's Singles",
15335
+ matchUpFormat: "SET1-S:T60",
15336
+ gender: "FEMALE",
15337
+ matchUpCount: 3
15338
+ },
15339
+ {
15340
+ scoreValue: 1,
15341
+ matchUpType: "DOUBLES",
15342
+ collectionName: "Men's Doubles",
15343
+ matchUpFormat: "SET1-S:T60",
15344
+ gender: "MALE",
15345
+ matchUpCount: 1
15346
+ },
15347
+ {
15348
+ matchUpValue: 1,
15349
+ matchUpType: "DOUBLES",
15350
+ collectionName: "Women's Doubles",
15351
+ matchUpFormat: "SET1-S:T60",
15352
+ gender: "FEMALE",
15353
+ matchUpCount: 1
15354
+ },
15355
+ {
15356
+ matchUpValue: 1,
15357
+ matchUpType: "DOUBLES",
15358
+ collectionName: "Mixed Doubles",
15359
+ matchUpFormat: "SET1-S:T60",
15360
+ gender: "MIXED",
15361
+ matchUpCount: 1
15362
+ }
15363
+ ];
15364
+ var tieFormatName$b = "Time Tennis";
15365
+ var winCriteria$b = {
15366
+ aggregateValue: true
15367
+ };
15368
+ var TIME_TENNIS_TIE_FORMAT = {
15324
15369
  collectionDefinitions: collectionDefinitions$b,
15325
15370
  tieFormatName: tieFormatName$b,
15326
- unrestrictedSelections: unrestrictedSelections,
15327
15371
  winCriteria: winCriteria$b
15328
15372
  };
15329
15373
 
@@ -16101,6 +16145,7 @@ var tieFormats = {
16101
16145
  DOMINANT_DUO_MIXED: DOMINANT_DUO_MIXED_TIE_FORMAT,
16102
16146
  LAVER_CUP: LAVER_CUP_TIE_FORMAT,
16103
16147
  TEAM_DOUBLES_3_AGGREGATION: TEAM_AGGREGATION_TIE_FORMAT,
16148
+ TIME_TENNIS: TIME_TENNIS_TIE_FORMAT,
16104
16149
  USTA_BREWER_CUP: USTA_BREWER_CUP_TIE_FORMAT,
16105
16150
  USTA_OZAKI_CUP: USTA_OZAKI_CUP_TIE_FORMAT,
16106
16151
  USTA_COLLEGE: USTA_COLLEGE_TIE_FORMAT,
@@ -22914,6 +22959,7 @@ function drawPositionRemovals(_a) {
22914
22959
  return { tasks: tasks, drawPositionCleared: drawPositionCleared, positionAssignments: positionAssignments };
22915
22960
  }
22916
22961
  function removeSubsequentRoundsParticipant(_a) {
22962
+ var _b;
22917
22963
  var inContextDrawMatchUps = _a.inContextDrawMatchUps, targetDrawPosition = _a.targetDrawPosition, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, matchUpsMap = _a.matchUpsMap, roundNumber = _a.roundNumber, structureId = _a.structureId;
22918
22964
  var structure = findStructure({ drawDefinition: drawDefinition, structureId: structureId }).structure;
22919
22965
  if (!structure)
@@ -22933,10 +22979,10 @@ function removeSubsequentRoundsParticipant(_a) {
22933
22979
  matchUp.roundNumber !== initialRoundNumber &&
22934
22980
  ((_a = matchUp.drawPositions) === null || _a === void 0 ? void 0 : _a.includes(targetDrawPosition));
22935
22981
  });
22936
- var positionAssignments = getPositionAssignments$1({
22982
+ var positionAssignments = (_b = getPositionAssignments$1({
22937
22983
  drawDefinition: drawDefinition,
22938
22984
  structureId: structureId,
22939
- }).positionAssignments || [];
22985
+ }).positionAssignments) !== null && _b !== void 0 ? _b : [];
22940
22986
  relevantMatchUps === null || relevantMatchUps === void 0 ? void 0 : relevantMatchUps.forEach(function (matchUp) {
22941
22987
  return removeDrawPosition({
22942
22988
  drawPosition: targetDrawPosition,
@@ -22952,13 +22998,13 @@ function removeSubsequentRoundsParticipant(_a) {
22952
22998
  return __assign({}, SUCCESS);
22953
22999
  }
22954
23000
  function removeDrawPosition(_a) {
22955
- var _b, _c, _d, _e, _f;
23001
+ var _b, _c, _d, _e, _f, _g, _h;
22956
23002
  var inContextDrawMatchUps = _a.inContextDrawMatchUps, positionAssignments = _a.positionAssignments, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, targetMatchUp = _a.targetMatchUp, drawPosition = _a.drawPosition, matchUpsMap = _a.matchUpsMap, structure = _a.structure, event = _a.event;
22957
23003
  var stack = 'removeDrawPosition';
22958
23004
  var initialDrawPositions = (_b = targetMatchUp.drawPositions) === null || _b === void 0 ? void 0 : _b.slice();
22959
23005
  var initialMatchUpStatus = targetMatchUp.matchUpStatus;
22960
23006
  var initialWinningSide = targetMatchUp.winningSide;
22961
- matchUpsMap = matchUpsMap || getMatchUpsMap({ drawDefinition: drawDefinition });
23007
+ matchUpsMap = matchUpsMap !== null && matchUpsMap !== void 0 ? matchUpsMap : getMatchUpsMap({ drawDefinition: drawDefinition });
22962
23008
  var mappedMatchUps = matchUpsMap.mappedMatchUps;
22963
23009
  var matchUps = mappedMatchUps[structure.structureId].matchUps;
22964
23010
  var initialRoundNumber = getInitialRoundNumber({
@@ -22968,18 +23014,18 @@ function removeDrawPosition(_a) {
22968
23014
  if (targetMatchUp.roundNumber &&
22969
23015
  initialRoundNumber &&
22970
23016
  targetMatchUp.roundNumber > initialRoundNumber) {
22971
- var drawPositions = (targetMatchUp.drawPositions || []).map(function (currentDrawPosition) {
23017
+ var drawPositions = ((_c = targetMatchUp.drawPositions) !== null && _c !== void 0 ? _c : []).map(function (currentDrawPosition) {
22972
23018
  return currentDrawPosition === drawPosition ? undefined : currentDrawPosition;
22973
23019
  });
22974
23020
  targetMatchUp.drawPositions = drawPositions;
22975
23021
  }
22976
23022
  if (targetMatchUp.matchUpType === TEAM$2) {
22977
23023
  var inContextTargetMatchUp = inContextDrawMatchUps === null || inContextDrawMatchUps === void 0 ? void 0 : inContextDrawMatchUps.find(function (matchUp) { return matchUp.matchUpId === targetMatchUp.matchUpId; });
22978
- var sides = (inContextTargetMatchUp === null || inContextTargetMatchUp === void 0 ? void 0 : inContextTargetMatchUp.sides) || [];
23024
+ var sides = (_d = inContextTargetMatchUp === null || inContextTargetMatchUp === void 0 ? void 0 : inContextTargetMatchUp.sides) !== null && _d !== void 0 ? _d : [];
22979
23025
  var drawPositionSideIndex = sides.reduce(function (index, side, i) { return (side.drawPosition === drawPosition ? i : index); }, undefined);
22980
23026
  if (drawPositionSideIndex !== undefined &&
22981
- ((_d = (_c = targetMatchUp.sides) === null || _c === void 0 ? void 0 : _c[drawPositionSideIndex]) === null || _d === void 0 ? void 0 : _d.lineUp)) {
22982
- (_e = targetMatchUp.sides) === null || _e === void 0 ? true : delete _e[drawPositionSideIndex].lineUp;
23027
+ ((_f = (_e = targetMatchUp.sides) === null || _e === void 0 ? void 0 : _e[drawPositionSideIndex]) === null || _f === void 0 ? void 0 : _f.lineUp)) {
23028
+ (_g = targetMatchUp.sides) === null || _g === void 0 ? true : delete _g[drawPositionSideIndex].lineUp;
22983
23029
  modifyMatchUpNotice({
22984
23030
  tournamentId: tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.tournamentId,
22985
23031
  context: "".concat(stack, "-TEAM"),
@@ -22994,7 +23040,7 @@ function removeDrawPosition(_a) {
22994
23040
  inContextDrawMatchUps: inContextDrawMatchUps,
22995
23041
  drawDefinition: drawDefinition,
22996
23042
  });
22997
- var winnerTargetLink = targetData.targetLinks.winnerTargetLink, _g = targetData.targetMatchUps, loserMatchUp = _g.loserMatchUp, winnerMatchUp = _g.winnerMatchUp, loserMatchUpDrawPositionIndex = _g.loserMatchUpDrawPositionIndex;
23043
+ var winnerTargetLink = targetData.targetLinks.winnerTargetLink, _j = targetData.targetMatchUps, loserMatchUp = _j.loserMatchUp, winnerMatchUp = _j.winnerMatchUp, loserMatchUpDrawPositionIndex = _j.loserMatchUpDrawPositionIndex;
22998
23044
  var matchUpAssignments = positionAssignments.filter(function (_a) {
22999
23045
  var _b;
23000
23046
  var drawPosition = _a.drawPosition;
@@ -23005,7 +23051,7 @@ function removeDrawPosition(_a) {
23005
23051
  (targetMatchUp.matchUpStatus &&
23006
23052
  [DEFAULTED, WALKOVER$2].includes(targetMatchUp.matchUpStatus) &&
23007
23053
  targetMatchUp.matcHUpStatus) ||
23008
- (((_f = targetMatchUp.drawPositions) === null || _f === void 0 ? void 0 : _f.length) === 2 && TO_BE_PLAYED) ||
23054
+ (((_h = targetMatchUp.drawPositions) === null || _h === void 0 ? void 0 : _h.length) === 2 && TO_BE_PLAYED) ||
23009
23055
  undefined;
23010
23056
  targetMatchUp.matchUpStatus = newMatchUpStatus;
23011
23057
  // if the matchUpStatus is WALKOVER then it is DOUBLE_WALKOVER produced
@@ -24132,9 +24178,7 @@ function assignMatchUpDrawPosition(_a) {
24132
24178
  }
24133
24179
  else {
24134
24180
  return decorateResult({
24135
- result: {
24136
- error: DRAW_POSITION_ASSIGNED,
24137
- },
24181
+ result: { error: DRAW_POSITION_ASSIGNED },
24138
24182
  context: { drawPosition: drawPosition },
24139
24183
  stack: stack,
24140
24184
  });
@@ -25215,8 +25259,8 @@ function getSeedGroups(_a) {
25215
25259
  if (roundRobinGroupsCount) {
25216
25260
  if (!isConvertableInteger(roundRobinGroupsCount))
25217
25261
  return __assign({ seedGroups: undefined }, decorateResult({
25218
- result: { error: INVALID_VALUES },
25219
25262
  context: { roundRobinGroupsCount: roundRobinGroupsCount },
25263
+ result: { error: INVALID_VALUES },
25220
25264
  stack: stack,
25221
25265
  }));
25222
25266
  var seedNumber_1 = 1;
@@ -25255,8 +25299,8 @@ function getSeedingThresholds(_a) {
25255
25299
  var invalid = !(validGroupsCounts === null || validGroupsCounts === void 0 ? void 0 : validGroupsCounts.includes(roundRobinGroupsCount));
25256
25300
  if (invalid) {
25257
25301
  return decorateResult({
25258
- result: { error: INVALID_VALUES },
25259
25302
  context: { roundRobinGroupsCount: roundRobinGroupsCount },
25303
+ result: { error: INVALID_VALUES },
25260
25304
  });
25261
25305
  }
25262
25306
  }
@@ -26337,7 +26381,8 @@ function directLoser(params) {
26337
26381
  }
26338
26382
  else if (loserParticipantId && isFeedRound) {
26339
26383
  // if target.roundNumber > 1 then it is a feed round and should always take the lower drawPosition
26340
- var fedDrawPosition = unfilledTargetMatchUpDrawPositions.sort(numericSort)[0];
26384
+ unfilledTargetMatchUpDrawPositions.sort(numericSort);
26385
+ var fedDrawPosition = unfilledTargetMatchUpDrawPositions[0];
26341
26386
  var result = assignDrawPosition$1({
26342
26387
  participantId: loserParticipantId,
26343
26388
  structureId: targetStructureId,
@@ -27289,7 +27334,7 @@ function swapWinnerLoser(params) {
27289
27334
  }
27290
27335
 
27291
27336
  function setMatchUpStatus$2(params) {
27292
- var _a, _b, _c, _d, _e;
27337
+ var _a, _b, _c, _d, _e, _f, _g, _h;
27293
27338
  var stack = 'setMatchUpStatus';
27294
27339
  // always clear score if DOUBLE_WALKOVER or WALKOVER
27295
27340
  if (params.matchUpStatus &&
@@ -27349,13 +27394,13 @@ function setMatchUpStatus$2(params) {
27349
27394
  else if (enableAutoCalc) {
27350
27395
  var existingDualMatchUpWinningSide = matchUp.winningSide;
27351
27396
  removeExtension$1({ name: DISABLE_AUTO_CALC, element: matchUp });
27352
- var _f = generateTieMatchUpScore({
27397
+ var _j = generateTieMatchUpScore({
27353
27398
  drawDefinition: drawDefinition,
27354
27399
  matchUpsMap: matchUpsMap,
27355
27400
  structure: structure,
27356
27401
  matchUp: matchUp,
27357
27402
  event: event,
27358
- }), projectedWinningSide = _f.winningSide, scoreStringSide1 = _f.scoreStringSide1, scoreStringSide2 = _f.scoreStringSide2, set = _f.set;
27403
+ }), projectedWinningSide = _j.winningSide, scoreStringSide1 = _j.scoreStringSide1, scoreStringSide2 = _j.scoreStringSide2, set = _j.set;
27359
27404
  var score_1 = {
27360
27405
  scoreStringSide1: scoreStringSide1,
27361
27406
  scoreStringSide2: scoreStringSide2,
@@ -27394,10 +27439,7 @@ function setMatchUpStatus$2(params) {
27394
27439
  drawDefinition: drawDefinition,
27395
27440
  });
27396
27441
  if (score && matchUp.matchUpType !== TEAM$2 && !disableScoreValidation) {
27397
- var matchUpFormat = matchUp.matchUpFormat ||
27398
- (structure === null || structure === void 0 ? void 0 : structure.matchUpFormat) ||
27399
- (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.matchUpFormat) ||
27400
- (event === null || event === void 0 ? void 0 : event.matchUpFormat);
27442
+ var matchUpFormat = (_d = (_c = (_b = matchUp.matchUpFormat) !== null && _b !== void 0 ? _b : structure === null || structure === void 0 ? void 0 : structure.matchUpFormat) !== null && _c !== void 0 ? _c : drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.matchUpFormat) !== null && _d !== void 0 ? _d : event === null || event === void 0 ? void 0 : event.matchUpFormat;
27401
27443
  var result_1 = validateScore({
27402
27444
  existingMatchUpStatus: matchUp.matchUpStatus,
27403
27445
  matchUpFormat: matchUpFormat,
@@ -27415,7 +27457,7 @@ function setMatchUpStatus$2(params) {
27415
27457
  structureId: structureId,
27416
27458
  }).positionAssignments
27417
27459
  : [];
27418
- var bothSideParticipants = ((_b = matchUp.sides) === null || _b === void 0 ? void 0 : _b.map(function (side) { return side.participantId; }).filter(Boolean).length) ===
27460
+ var bothSideParticipants = ((_e = matchUp.sides) === null || _e === void 0 ? void 0 : _e.map(function (side) { return side.participantId; }).filter(Boolean).length) ===
27419
27461
  2 ||
27420
27462
  ((assignedDrawPositions === null || assignedDrawPositions === void 0 ? void 0 : assignedDrawPositions.length) === 2 &&
27421
27463
  (positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.filter(function (assignment) {
@@ -27425,17 +27467,17 @@ function setMatchUpStatus$2(params) {
27425
27467
  particicipantsRequiredMatchUpStatuses.includes(matchUpStatus) &&
27426
27468
  !bothSideParticipants) {
27427
27469
  return decorateResult({
27428
- result: { error: INVALID_MATCHUP_STATUS },
27429
27470
  info: 'present in participantRequiredMatchUpStatuses',
27430
27471
  context: { matchUpStatus: matchUpStatus, bothSideParticipants: bothSideParticipants },
27472
+ result: { error: INVALID_MATCHUP_STATUS },
27431
27473
  });
27432
27474
  }
27433
- var appliedPolicies = (_d = (_c = getAppliedPolicies({
27475
+ var appliedPolicies = (_g = (_f = getAppliedPolicies({
27434
27476
  policyTypes: [POLICY_TYPE_PROGRESSION],
27435
27477
  tournamentRecord: tournamentRecord,
27436
27478
  drawDefinition: drawDefinition,
27437
27479
  event: event,
27438
- })) === null || _c === void 0 ? void 0 : _c.appliedPolicies) !== null && _d !== void 0 ? _d : {};
27480
+ })) === null || _f === void 0 ? void 0 : _f.appliedPolicies) !== null && _g !== void 0 ? _g : {};
27439
27481
  if (typeof params.policyDefinitions === 'object') {
27440
27482
  Object.assign(appliedPolicies, params.policyDefinitions);
27441
27483
  }
@@ -27476,12 +27518,12 @@ function setMatchUpStatus$2(params) {
27476
27518
  event: event,
27477
27519
  }).matchUp;
27478
27520
  if (dualMatchUp) {
27479
- var tieFormat = (_e = resolveTieFormat({
27521
+ var tieFormat = (_h = resolveTieFormat({
27480
27522
  matchUp: dualMatchUp,
27481
27523
  drawDefinition: drawDefinition,
27482
27524
  structure: structure,
27483
27525
  event: event,
27484
- })) === null || _e === void 0 ? void 0 : _e.tieFormat;
27526
+ })) === null || _h === void 0 ? void 0 : _h.tieFormat;
27485
27527
  var projectedWinningSide = getProjectedDualWinningSide({
27486
27528
  drawDefinition: drawDefinition,
27487
27529
  matchUpStatus: matchUpStatus,
@@ -27577,8 +27619,8 @@ function winningSideWithDownstreamDependencies(params) {
27577
27619
  }
27578
27620
  else {
27579
27621
  return decorateResult({
27580
- result: { error: CANNOT_CHANGE_WINNING_SIDE },
27581
27622
  stack: 'winningSideWithDownstreamDependencies',
27623
+ result: { error: CANNOT_CHANGE_WINNING_SIDE },
27582
27624
  context: { winningSide: winningSide, matchUp: matchUp },
27583
27625
  });
27584
27626
  }
@@ -28035,13 +28077,13 @@ function addDrawDefinition$1(params) {
28035
28077
  return decorateResult({
28036
28078
  result: {
28037
28079
  error: INVALID_DRAW_DEFINITION,
28038
- context: {
28039
- drawEntriesPresentInFlight: drawEntriesPresentInFlight,
28040
- matchingEventEntries: matchingEventEntries,
28041
- relevantFlight: relevantFlight,
28042
- },
28043
- info: 'Draw entries are not present in flight or do not match entryStatuses',
28044
28080
  },
28081
+ context: {
28082
+ drawEntriesPresentInFlight: drawEntriesPresentInFlight,
28083
+ matchingEventEntries: matchingEventEntries,
28084
+ relevantFlight: relevantFlight,
28085
+ },
28086
+ info: 'Draw entries are not present in flight or do not match entryStatuses',
28045
28087
  });
28046
28088
  }
28047
28089
  if (modifyEventEntries) {
@@ -28061,9 +28103,9 @@ function addDrawDefinition$1(params) {
28061
28103
  if (eventEntries && !matchingEventEntries)
28062
28104
  return decorateResult({
28063
28105
  result: {
28064
- error: INVALID_DRAW_DEFINITION,
28065
- context: { matchingEventEntries: matchingEventEntries, eventEntries: eventEntries },
28066
28106
  info: 'Draw entries do not match event entryStatuses',
28107
+ context: { matchingEventEntries: matchingEventEntries, eventEntries: eventEntries },
28108
+ error: INVALID_DRAW_DEFINITION,
28067
28109
  },
28068
28110
  });
28069
28111
  var flightNumbers = ((_f = (_e = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _e === void 0 ? void 0 : _e.map(function (_a) {
@@ -28238,10 +28280,8 @@ function addParticipant$1(_a) {
28238
28280
  else if (participant.individualParticipantIds.length !== 2 &&
28239
28281
  !pairOverride) {
28240
28282
  return decorateResult({
28241
- result: {
28242
- error: INVALID_PARTICIPANT_IDS,
28243
- info: 'PAIR must be 2 individualParticipantIds',
28244
- },
28283
+ info: 'PAIR must be 2 individualParticipantIds',
28284
+ result: { error: INVALID_PARTICIPANT_IDS },
28245
28285
  stack: stack,
28246
28286
  });
28247
28287
  }
@@ -32223,6 +32263,7 @@ function updateTieFormat(_a) {
32223
32263
  return decorateResult({
32224
32264
  result: { error: CANNOT_MODIFY_TIEFORMAT },
32225
32265
  info: 'matchUp is IN_PROGRESS or COMPLETE',
32266
+ stack: stack,
32226
32267
  });
32227
32268
  }
32228
32269
  }
@@ -33203,8 +33244,9 @@ function removeCollectionDefinition(params) {
33203
33244
 
33204
33245
  function addCollectionDefinition$1(_a) {
33205
33246
  var e_1, _b, e_2, _c, _d, e_3, _e;
33206
- var _f, _g, _h, _j, _k, _l, _m;
33207
- var _o = _a.updateInProgressMatchUps, updateInProgressMatchUps = _o === void 0 ? true : _o, collectionDefinition = _a.collectionDefinition, tournamentRecord = _a.tournamentRecord, referenceGender = _a.referenceGender, drawDefinition = _a.drawDefinition, tieFormatName = _a.tieFormatName, enforceGender = _a.enforceGender, structureId = _a.structureId, matchUpId = _a.matchUpId, matchUp = _a.matchUp, eventId = _a.eventId, uuids = _a.uuids, event = _a.event;
33247
+ var _f, _g, _h, _j, _k, _l, _m, _o;
33248
+ var _p = _a.updateInProgressMatchUps, updateInProgressMatchUps = _p === void 0 ? true : _p, collectionDefinition = _a.collectionDefinition, tournamentRecord = _a.tournamentRecord, referenceGender = _a.referenceGender, drawDefinition = _a.drawDefinition, tieFormatName = _a.tieFormatName, enforceGender = _a.enforceGender, structureId = _a.structureId, matchUpId = _a.matchUpId, matchUp = _a.matchUp, eventId = _a.eventId, uuids = _a.uuids, event = _a.event;
33249
+ var stack = 'addCollectionDefinition';
33208
33250
  var appliedPolicies = (_f = getAppliedPolicies({
33209
33251
  tournamentRecord: tournamentRecord,
33210
33252
  drawDefinition: drawDefinition,
@@ -33213,16 +33255,16 @@ function addCollectionDefinition$1(_a) {
33213
33255
  enforceGender =
33214
33256
  enforceGender !== null && enforceGender !== void 0 ? enforceGender : (_h = (_g = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_MATCHUP_ACTIONS]) === null || _g === void 0 ? void 0 : _g.participants) === null || _h === void 0 ? void 0 : _h.enforceGender;
33215
33257
  var checkGender = !!(enforceGender !== false && (event === null || event === void 0 ? void 0 : event.gender));
33216
- var _p = validateCollectionDefinition({
33258
+ var _q = validateCollectionDefinition({
33217
33259
  collectionDefinition: collectionDefinition,
33218
33260
  referenceGender: referenceGender,
33219
33261
  checkGender: checkGender,
33220
33262
  event: event,
33221
- }), valid = _p.valid, errors = _p.errors;
33222
- if (!valid)
33223
- return { error: INVALID_VALUES, errors: errors };
33224
- var stack = 'addCollectionDefinition';
33225
- var result = !matchUp
33263
+ }), valid = _q.valid, errors = _q.errors;
33264
+ if (!valid) {
33265
+ return decorateResult({ result: { error: INVALID_VALUES, errors: errors }, stack: stack });
33266
+ }
33267
+ var result = !(matchUp === null || matchUp === void 0 ? void 0 : matchUp.tieFormat)
33226
33268
  ? getTieFormat$1({
33227
33269
  drawDefinition: drawDefinition,
33228
33270
  structureId: structureId,
@@ -33232,14 +33274,15 @@ function addCollectionDefinition$1(_a) {
33232
33274
  })
33233
33275
  : undefined;
33234
33276
  if (result === null || result === void 0 ? void 0 : result.error)
33235
- return { error: result.error };
33277
+ return decorateResult({ result: { error: result.error }, stack: stack });
33236
33278
  var structure = result === null || result === void 0 ? void 0 : result.structure;
33237
33279
  matchUp = matchUp !== null && matchUp !== void 0 ? matchUp : result === null || result === void 0 ? void 0 : result.matchUp;
33238
- var existingTieFormat = result === null || result === void 0 ? void 0 : result.tieFormat;
33280
+ var existingTieFormat = (_j = matchUp === null || matchUp === void 0 ? void 0 : matchUp.tieFormat) !== null && _j !== void 0 ? _j : result === null || result === void 0 ? void 0 : result.tieFormat;
33239
33281
  var tieFormat = copyTieFormat(existingTieFormat);
33240
33282
  result = validateTieFormat({ tieFormat: tieFormat });
33241
- if (result === null || result === void 0 ? void 0 : result.error)
33242
- return { error: result.error };
33283
+ if (result === null || result === void 0 ? void 0 : result.error) {
33284
+ return decorateResult({ result: { error: result.error }, stack: stack });
33285
+ }
33243
33286
  if (!collectionDefinition.collectionId) {
33244
33287
  collectionDefinition.collectionId = UUID();
33245
33288
  }
@@ -33262,7 +33305,7 @@ function addCollectionDefinition$1(_a) {
33262
33305
  });
33263
33306
  // calculate new winCriteria for tieFormat
33264
33307
  // if existing winCriteria is aggregateValue, retain
33265
- var _q = calculateWinCriteria(tieFormat), aggregateValue = _q.aggregateValue, valueGoal = _q.valueGoal;
33308
+ var _r = calculateWinCriteria(tieFormat), aggregateValue = _r.aggregateValue, valueGoal = _r.valueGoal;
33266
33309
  tieFormat.winCriteria = definedAttributes({ aggregateValue: aggregateValue, valueGoal: valueGoal });
33267
33310
  // if valueGoal has changed, force renaming of the tieFormat
33268
33311
  var originalValueGoal = existingTieFormat === null || existingTieFormat === void 0 ? void 0 : existingTieFormat.winCriteria.valueGoal;
@@ -33281,19 +33324,20 @@ function addCollectionDefinition$1(_a) {
33281
33324
  var targetMatchUps = [];
33282
33325
  var prunedTieFormat = definedAttributes(tieFormat);
33283
33326
  result = validateTieFormat({ tieFormat: prunedTieFormat });
33284
- if (result === null || result === void 0 ? void 0 : result.error)
33285
- return { error: result.error };
33327
+ if (result === null || result === void 0 ? void 0 : result.error) {
33328
+ return decorateResult({ result: { error: result.error }, stack: stack });
33329
+ }
33286
33330
  if (eventId && event) {
33287
33331
  event.tieFormat = prunedTieFormat;
33288
33332
  try {
33289
33333
  // all team matchUps in the event which do not have tieFormats and where draws/strucures do not have tieFormats should have matchUps added
33290
- for (var _r = __values((_j = event.drawDefinitions) !== null && _j !== void 0 ? _j : []), _s = _r.next(); !_s.done; _s = _r.next()) {
33291
- var drawDefinition_1 = _s.value;
33334
+ for (var _s = __values((_k = event.drawDefinitions) !== null && _k !== void 0 ? _k : []), _t = _s.next(); !_t.done; _t = _s.next()) {
33335
+ var drawDefinition_1 = _t.value;
33292
33336
  if (drawDefinition_1.tieFormat)
33293
33337
  continue;
33294
33338
  try {
33295
- for (var _t = (e_2 = void 0, __values((_k = drawDefinition_1.structures) !== null && _k !== void 0 ? _k : [])), _u = _t.next(); !_u.done; _u = _t.next()) {
33296
- var structure_1 = _u.value;
33339
+ for (var _u = (e_2 = void 0, __values((_l = drawDefinition_1.structures) !== null && _l !== void 0 ? _l : [])), _v = _u.next(); !_v.done; _v = _u.next()) {
33340
+ var structure_1 = _v.value;
33297
33341
  if (structure_1.tieFormat)
33298
33342
  continue;
33299
33343
  var result_1 = updateStructureMatchUps({
@@ -33310,7 +33354,7 @@ function addCollectionDefinition$1(_a) {
33310
33354
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
33311
33355
  finally {
33312
33356
  try {
33313
- if (_u && !_u.done && (_c = _t.return)) _c.call(_t);
33357
+ if (_v && !_v.done && (_c = _u.return)) _c.call(_u);
33314
33358
  }
33315
33359
  finally { if (e_2) throw e_2.error; }
33316
33360
  }
@@ -33319,7 +33363,7 @@ function addCollectionDefinition$1(_a) {
33319
33363
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
33320
33364
  finally {
33321
33365
  try {
33322
- if (_s && !_s.done && (_b = _r.return)) _b.call(_r);
33366
+ if (_t && !_t.done && (_b = _s.return)) _b.call(_s);
33323
33367
  }
33324
33368
  finally { if (e_1) throw e_1.error; }
33325
33369
  }
@@ -33382,8 +33426,8 @@ function addCollectionDefinition$1(_a) {
33382
33426
  // all team matchUps in the drawDefinition which do not have tieFormats and where strucures do not have tieFormats should have matchUps added
33383
33427
  drawDefinition.tieFormat = prunedTieFormat;
33384
33428
  try {
33385
- for (var _v = __values((_l = drawDefinition.structures) !== null && _l !== void 0 ? _l : []), _w = _v.next(); !_w.done; _w = _v.next()) {
33386
- var structure_2 = _w.value;
33429
+ for (var _w = __values((_m = drawDefinition.structures) !== null && _m !== void 0 ? _m : []), _x = _w.next(); !_x.done; _x = _w.next()) {
33430
+ var structure_2 = _x.value;
33387
33431
  var result_3 = updateStructureMatchUps({
33388
33432
  updateInProgressMatchUps: updateInProgressMatchUps,
33389
33433
  collectionDefinition: collectionDefinition,
@@ -33398,7 +33442,7 @@ function addCollectionDefinition$1(_a) {
33398
33442
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
33399
33443
  finally {
33400
33444
  try {
33401
- if (_w && !_w.done && (_e = _v.return)) _e.call(_v);
33445
+ if (_x && !_x.done && (_e = _w.return)) _e.call(_w);
33402
33446
  }
33403
33447
  finally { if (e_3) throw e_3.error; }
33404
33448
  }
@@ -33414,7 +33458,7 @@ function addCollectionDefinition$1(_a) {
33414
33458
  else {
33415
33459
  return { error: MISSING_DRAW_DEFINITION };
33416
33460
  }
33417
- if ((_m = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies.audit) === null || _m === void 0 ? void 0 : _m[TIE_FORMAT_MODIFICATIONS]) {
33461
+ if ((_o = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies.audit) === null || _o === void 0 ? void 0 : _o[TIE_FORMAT_MODIFICATIONS]) {
33418
33462
  var auditData = definedAttributes({
33419
33463
  drawId: drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.drawId,
33420
33464
  collectionDefinition: collectionDefinition,
@@ -33741,10 +33785,8 @@ function addCollectionGroup$1(_a) {
33741
33785
  var collectionId = collectionDefinition.collectionId, collectionGroupNumber_1 = collectionDefinition.collectionGroupNumber;
33742
33786
  if (collectionGroupNumber_1 && collectionIds.includes(collectionId))
33743
33787
  return decorateResult({
33744
- result: {
33745
- error: INVALID_VALUES,
33746
- info: 'collectionIds cannot be part of other collectionGroups',
33747
- },
33788
+ info: 'collectionIds cannot be part of other collectionGroups',
33789
+ result: { error: INVALID_VALUES },
33748
33790
  stack: stack,
33749
33791
  });
33750
33792
  // TODO: calculate the total value of the collectionDefinition
@@ -33797,7 +33839,7 @@ function addCollectionGroup(params) {
33797
33839
  function modifyTieFormat$1(_a) {
33798
33840
  var e_1, _b, e_2, _c, e_3, _d;
33799
33841
  var _e = _a.updateInProgressMatchUps, updateInProgressMatchUps = _e === void 0 ? false : _e, tieFormatComparison = _a.tieFormatComparison, modifiedTieFormat = _a.modifiedTieFormat, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, structureId = _a.structureId, matchUpId = _a.matchUpId, eventId = _a.eventId, uuids = _a.uuids, event = _a.event;
33800
- var stack = 'updateTieFormat';
33842
+ var stack = 'modifyTieFormat';
33801
33843
  if (!validateTieFormat({ tieFormat: modifiedTieFormat }).valid) {
33802
33844
  return decorateResult({
33803
33845
  result: { error: INVALID_TIE_FORMAT },
@@ -33824,10 +33866,15 @@ function modifyTieFormat$1(_a) {
33824
33866
  return decorateResult({
33825
33867
  context: { invalid: comparison.invalid },
33826
33868
  result: { error: INVALID_TIE_FORMAT },
33869
+ stack: stack,
33827
33870
  });
33828
33871
  }
33829
33872
  if (!(comparison === null || comparison === void 0 ? void 0 : comparison.different)) {
33830
- return decorateResult({ result: __assign({}, SUCCESS), info: 'Nothing to do' });
33873
+ return decorateResult({
33874
+ result: __assign({}, SUCCESS),
33875
+ info: 'Nothing to do',
33876
+ stack: stack,
33877
+ });
33831
33878
  }
33832
33879
  var existingCollectionIds = tieFormat.collectionDefinitions.map(function (_a) {
33833
33880
  var collectionId = _a.collectionId;
@@ -40102,9 +40149,8 @@ function matchUpActions$2(_a) {
40102
40149
  gender_1 === ANY ||
40103
40150
  person.sex === gender_1 ||
40104
40151
  // case where one gendered member has been assigned
40105
- (gender_1 === MIXED &&
40106
- assignedGender_1 &&
40107
- person.sex !== assignedGender_1));
40152
+ (gender_1 === MIXED && !assignedGender_1) ||
40153
+ (assignedGender_1 && person.sex !== assignedGender_1));
40108
40154
  });
40109
40155
  });
40110
40156
  // if no sideNumber is provided, segregate available by sideNumber and specify sideNumber
@@ -46340,17 +46386,14 @@ function positionByes(_a) {
46340
46386
 
46341
46387
  function positionQualifiers(params) {
46342
46388
  var e_1, _a;
46343
- var structure = params.structure, structureId = params.structureId; // participants is being passed in
46344
- if (!structure)
46345
- (structure = findStructure(params).structure);
46346
- if (!structureId)
46347
- (structureId = structure.structureId);
46389
+ var _b;
46390
+ var structure = (_b = params.structure) !== null && _b !== void 0 ? _b : findStructure(params).structure;
46348
46391
  var stack = 'positionQualifiers';
46349
46392
  var qualifierDrawPositions = [];
46350
46393
  if (structure.stage === CONSOLATION) {
46351
46394
  return decorateResult({ result: { error: INVALID_STAGE }, stack: stack });
46352
46395
  }
46353
- var _b = getQualifiersData(params), unplacedRoundQualifierCounts = _b.unplacedRoundQualifierCounts, positionAssignments = _b.positionAssignments, roundDrawPositions = _b.roundDrawPositions;
46396
+ var _c = getQualifiersData(params), unplacedRoundQualifierCounts = _c.unplacedRoundQualifierCounts, positionAssignments = _c.positionAssignments, roundDrawPositions = _c.roundDrawPositions;
46354
46397
  var _loop_1 = function (roundNumber) {
46355
46398
  var unfilledDrawPositions = positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.filter(function (assignment) {
46356
46399
  return (roundDrawPositions[roundNumber].includes(assignment.drawPosition) &&
@@ -46377,8 +46420,8 @@ function positionQualifiers(params) {
46377
46420
  });
46378
46421
  };
46379
46422
  try {
46380
- for (var _c = __values(Object.keys(unplacedRoundQualifierCounts)), _d = _c.next(); !_d.done; _d = _c.next()) {
46381
- var roundNumber = _d.value;
46423
+ for (var _d = __values(Object.keys(unplacedRoundQualifierCounts)), _e = _d.next(); !_e.done; _e = _d.next()) {
46424
+ var roundNumber = _e.value;
46382
46425
  var state_1 = _loop_1(roundNumber);
46383
46426
  if (typeof state_1 === "object")
46384
46427
  return state_1.value;
@@ -46387,7 +46430,7 @@ function positionQualifiers(params) {
46387
46430
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
46388
46431
  finally {
46389
46432
  try {
46390
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
46433
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
46391
46434
  }
46392
46435
  finally { if (e_1) throw e_1.error; }
46393
46436
  }
@@ -46986,7 +47029,7 @@ function generateAndPopulatePlayoffStructures(params) {
46986
47029
  drawDefinition: drawDefinition,
46987
47030
  }).structure;
46988
47031
  if (!structure)
46989
- return decorateResult({ result: { error: STRUCTURE_NOT_FOUND } });
47032
+ return decorateResult({ result: { error: STRUCTURE_NOT_FOUND }, stack: stack });
46990
47033
  if (structure.structureType === CONTAINER || structure.structures) {
46991
47034
  return generateAndPopulateRRplayoffStructures(__assign(__assign(__assign({ sourceStructureId: structure.structureId }, params), availabilityResult), { drawDefinition: drawDefinition }));
46992
47035
  }
@@ -47779,11 +47822,11 @@ function attachStructures$1(_a) {
47779
47822
  var _b;
47780
47823
  var _c, _d, _e;
47781
47824
  var matchUpModifications = _a.matchUpModifications, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, structures = _a.structures, _f = _a.links, links = _f === void 0 ? [] : _f, event = _a.event;
47825
+ var stack = 'attachStructures';
47782
47826
  if (!drawDefinition)
47783
47827
  return { error: MISSING_DRAW_DEFINITION };
47784
47828
  if (!Array.isArray(structures) || !Array.isArray(links))
47785
- return decorateResult({ result: { error: INVALID_VALUES } });
47786
- var stack = 'attachStructures';
47829
+ return decorateResult({ result: { error: INVALID_VALUES }, stack: stack });
47787
47830
  var linkHash = function (link) {
47788
47831
  var _a;
47789
47832
  return [
@@ -48793,7 +48836,9 @@ function positionParticipantAction(params) {
48793
48836
  _b);
48794
48837
  addPositionActionTelemetry({ drawDefinition: drawDefinition, positionAction: positionAction });
48795
48838
  return decorateResult({
48796
- result: __assign(__assign({}, SUCCESS), { context: { removedParticipantId: removedParticipantId }, stack: stack }),
48839
+ context: { removedParticipantId: removedParticipantId },
48840
+ result: __assign({}, SUCCESS),
48841
+ stack: stack,
48797
48842
  });
48798
48843
  }
48799
48844
  }
@@ -49643,8 +49688,8 @@ function addEventEntries(params) {
49643
49688
  (!Array.isArray(extensions) || !extensions.every(isValidExtension))) ||
49644
49689
  (extension && !isValidExtension({ extension: extension }))) {
49645
49690
  return decorateResult({
49646
- result: { error: INVALID_VALUES },
49647
49691
  context: definedAttributes({ extension: extension, extensions: extensions }),
49692
+ result: { error: INVALID_VALUES },
49648
49693
  info: 'Invalid extension(s)',
49649
49694
  stack: stack,
49650
49695
  });
@@ -49769,8 +49814,8 @@ function addEventEntries(params) {
49769
49814
  var invalidParticipantIds = validParticipantIds.length !== participantIds.length;
49770
49815
  if (invalidParticipantIds)
49771
49816
  return decorateResult({
49772
- result: { error: INVALID_PARTICIPANT_IDS },
49773
49817
  context: { misMatchedGender: misMatchedGender, gender: event.gender },
49818
+ result: { error: INVALID_PARTICIPANT_IDS },
49774
49819
  stack: stack,
49775
49820
  });
49776
49821
  if (autoEntryPositions) {
@@ -51503,26 +51548,24 @@ function enableTieAutoCalc$1(_a) {
51503
51548
 
51504
51549
  function setOrderOfFinish$1(_a) {
51505
51550
  var e_1, _b;
51506
- var _c;
51551
+ var _c, _d;
51507
51552
  var drawDefinition = _a.drawDefinition, finishingOrder = _a.finishingOrder;
51508
51553
  if (!drawDefinition)
51509
51554
  return { error: MISSING_DRAW_DEFINITION };
51510
51555
  var stack = 'setOrderOfFinish';
51511
51556
  if (!Array.isArray(finishingOrder))
51512
51557
  return decorateResult({
51513
- result: {
51514
- error: INVALID_VALUES,
51515
- },
51516
51558
  info: mustBeAnArray('finishingOrder'),
51559
+ result: { error: INVALID_VALUES },
51517
51560
  stack: stack,
51518
51561
  });
51519
- var _d = getDrawMatchUps({
51562
+ var _e = getDrawMatchUps({
51520
51563
  inContext: true,
51521
51564
  drawDefinition: drawDefinition,
51522
- }), completedMatchUps = _d.completedMatchUps, matchUpsMap = _d.matchUpsMap;
51523
- var matchUpIds = (completedMatchUps === null || completedMatchUps === void 0 ? void 0 : completedMatchUps.map(getMatchUpId)) || [];
51565
+ }), completedMatchUps = _e.completedMatchUps, matchUpsMap = _e.matchUpsMap;
51566
+ var matchUpIds = (_c = completedMatchUps === null || completedMatchUps === void 0 ? void 0 : completedMatchUps.map(getMatchUpId)) !== null && _c !== void 0 ? _c : [];
51524
51567
  var targetMatchUpIds = finishingOrder.map(getMatchUpId);
51525
- var _e = (completedMatchUps || [])
51568
+ var _f = (completedMatchUps !== null && completedMatchUps !== void 0 ? completedMatchUps : [])
51526
51569
  .filter(function (_a) {
51527
51570
  var matchUpId = _a.matchUpId;
51528
51571
  return targetMatchUpIds.includes(matchUpId);
@@ -51543,17 +51586,15 @@ function setOrderOfFinish$1(_a) {
51543
51586
  roundNumbers: [],
51544
51587
  structureIds: [],
51545
51588
  matchUpTieIds: [],
51546
- }), matchUpTypes = _e.matchUpTypes, roundNumbers = _e.roundNumbers, structureIds = _e.structureIds, matchUpTieIds = _e.matchUpTieIds;
51589
+ }), matchUpTypes = _f.matchUpTypes, roundNumbers = _f.roundNumbers, structureIds = _f.structureIds, matchUpTieIds = _f.matchUpTieIds;
51547
51590
  // targeted matchUps must all be of the same matchUpType and have the same roundNumber and structureId
51548
51591
  if (matchUpTypes.length > 1 ||
51549
51592
  matchUpTieIds.length > 1 ||
51550
51593
  roundNumbers.length > 1 ||
51551
51594
  structureIds.length > 1) {
51552
51595
  return decorateResult({
51553
- result: {
51554
- error: INVALID_VALUES,
51555
- },
51556
51596
  info: 'matchUpType, structureId and roundNumber must be equivalent',
51597
+ result: { error: INVALID_VALUES },
51557
51598
  stack: stack,
51558
51599
  });
51559
51600
  }
@@ -51596,8 +51637,8 @@ function setOrderOfFinish$1(_a) {
51596
51637
  });
51597
51638
  try {
51598
51639
  // throw an error if an existing matchUp has an invalid orderOfFinish value
51599
- for (var _f = __values(otherCohortMatchUps || []), _g = _f.next(); !_g.done; _g = _f.next()) {
51600
- var matchUp = _g.value;
51640
+ for (var _g = __values(otherCohortMatchUps !== null && otherCohortMatchUps !== void 0 ? otherCohortMatchUps : []), _h = _g.next(); !_h.done; _h = _g.next()) {
51641
+ var matchUp = _h.value;
51601
51642
  var orderOfFinish = (matchUp || {}).orderOfFinish;
51602
51643
  if (orderOfFinish) {
51603
51644
  if (!isConvertableInteger(orderOfFinish))
@@ -51613,7 +51654,7 @@ function setOrderOfFinish$1(_a) {
51613
51654
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
51614
51655
  finally {
51615
51656
  try {
51616
- if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
51657
+ if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
51617
51658
  }
51618
51659
  finally { if (e_1) throw e_1.error; }
51619
51660
  }
@@ -51621,10 +51662,8 @@ function setOrderOfFinish$1(_a) {
51621
51662
  if (uniqueValues(orderOfFinishValues).length !== orderOfFinishValues.length ||
51622
51663
  Math.max.apply(Math, __spreadArray([], __read(orderOfFinishValues), false)) > orderOfFinishValues.length) {
51623
51664
  return decorateResult({
51624
- result: {
51625
- error: INVALID_VALUES,
51626
- },
51627
51665
  info: 'Values not unique or greater than expected number of values',
51666
+ result: { error: INVALID_VALUES },
51628
51667
  stack: stack,
51629
51668
  });
51630
51669
  }
@@ -51639,7 +51678,7 @@ function setOrderOfFinish$1(_a) {
51639
51678
  if (result.error)
51640
51679
  return decorateResult({ result: result, stack: stack });
51641
51680
  // apply the new values to targeted matchUps
51642
- (_c = result.completedMatchUps) === null || _c === void 0 ? void 0 : _c.forEach(function (matchUp) { return (matchUp.orderOfFinish = valuesMap[matchUp.matchUpId]); });
51681
+ (_d = result.completedMatchUps) === null || _d === void 0 ? void 0 : _d.forEach(function (matchUp) { return (matchUp.orderOfFinish = valuesMap[matchUp.matchUpId]); });
51643
51682
  }
51644
51683
  return __assign({}, SUCCESS);
51645
51684
  }
@@ -52546,7 +52585,7 @@ function getValidQualifiersAction(_a) {
52546
52585
  }
52547
52586
  return { validAssignmentActions: validAssignmentActions, sourceStructureIds: sourceStructureIds };
52548
52587
  }
52549
- /*
52588
+ /**
52550
52589
  if (sourceStructureIds.length > 1)
52551
52590
  return decorateResult({
52552
52591
  stack: 'getValidQualifiersSaction',
@@ -54646,10 +54685,8 @@ function addIndividualParticipantIds(_a) {
54646
54685
  if ((groupingParticipant === null || groupingParticipant === void 0 ? void 0 : groupingParticipant.participantType) &&
54647
54686
  ![TEAM, GROUP].includes(groupingParticipant.participantType)) {
54648
54687
  return decorateResult({
54649
- result: {
54650
- error: INVALID_PARTICIPANT_TYPE,
54651
- },
54652
54688
  context: { participantType: groupingParticipant.participantType },
54689
+ result: { error: INVALID_PARTICIPANT_TYPE },
54653
54690
  stack: stack,
54654
54691
  });
54655
54692
  }
@@ -56626,7 +56663,7 @@ function getTieMatchUpContext(_a) {
56626
56663
  */
56627
56664
  function assignTieMatchUpParticipantId(params) {
56628
56665
  var e_1, _a;
56629
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
56666
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
56630
56667
  var matchUpContext = getTieMatchUpContext(params);
56631
56668
  if (matchUpContext.error)
56632
56669
  return matchUpContext;
@@ -56653,12 +56690,12 @@ function assignTieMatchUpParticipantId(params) {
56653
56690
  teamParticipantId ||
56654
56691
  (params.sideNumber &&
56655
56692
  ((_d = (_c = inContextDualMatchUp === null || inContextDualMatchUp === void 0 ? void 0 : inContextDualMatchUp.sides) === null || _c === void 0 ? void 0 : _c.find(function (side) { return side.sideNumber === params.sideNumber; })) === null || _d === void 0 ? void 0 : _d.participantId));
56656
- var _q = __read(getTournamentParticipants({
56693
+ var _r = __read(getTournamentParticipants({
56657
56694
  tournamentRecord: tournamentRecord,
56658
56695
  participantFilters: {
56659
56696
  participantIds: [participantId],
56660
56697
  },
56661
- }).tournamentParticipants, 1), participantToAssign = _q[0];
56698
+ }).tournamentParticipants, 1), participantToAssign = _r[0];
56662
56699
  if (!participantToAssign) {
56663
56700
  return decorateResult({ result: { error: PARTICIPANT_NOT_FOUND }, stack: stack });
56664
56701
  }
@@ -56726,11 +56763,10 @@ function assignTieMatchUpParticipantId(params) {
56726
56763
  }
56727
56764
  var dualMatchUpSide = (_m = dualMatchUp === null || dualMatchUp === void 0 ? void 0 : dualMatchUp.sides) === null || _m === void 0 ? void 0 : _m.find(function (side) { return side.sideNumber === sideNumber; });
56728
56765
  var tieMatchUpSide = (_o = inContextTieMatchUp === null || inContextTieMatchUp === void 0 ? void 0 : inContextTieMatchUp.sides) === null || _o === void 0 ? void 0 : _o.find(function (side) { return side.sideNumber === sideNumber; });
56729
- var lineUp = (dualMatchUpSide === null || dualMatchUpSide === void 0 ? void 0 : dualMatchUpSide.lineUp) ||
56730
- ((_p = getTeamLineUp({
56731
- participantId: teamParticipantId,
56732
- drawDefinition: drawDefinition,
56733
- })) === null || _p === void 0 ? void 0 : _p.lineUp);
56766
+ var lineUp = (_p = dualMatchUpSide === null || dualMatchUpSide === void 0 ? void 0 : dualMatchUpSide.lineUp) !== null && _p !== void 0 ? _p : (_q = getTeamLineUp({
56767
+ participantId: teamParticipantId,
56768
+ drawDefinition: drawDefinition,
56769
+ })) === null || _q === void 0 ? void 0 : _q.lineUp;
56734
56770
  var targetAssignments = lineUp === null || lineUp === void 0 ? void 0 : lineUp.filter(function (participantAssignment) {
56735
56771
  var _a;
56736
56772
  return (_a = participantAssignment.collectionAssignments) === null || _a === void 0 ? void 0 : _a.find(function (assignment) {
@@ -59551,8 +59587,8 @@ function deleteDrawDefinitions(_a) {
59551
59587
  var auditTrail = [];
59552
59588
  if (!(event === null || event === void 0 ? void 0 : event.drawDefinitions))
59553
59589
  return decorateResult({
59554
- result: __assign({}, SUCCESS),
59555
59590
  info: 'event has no drawDefinition',
59591
+ result: __assign({}, SUCCESS),
59556
59592
  stack: stack,
59557
59593
  });
59558
59594
  var eventDrawIds = event.drawDefinitions.map(function (_a) {
@@ -59565,8 +59601,8 @@ function deleteDrawDefinitions(_a) {
59565
59601
  drawIds = drawIds.filter(function (drawId) { return eventDrawIds.includes(drawId); });
59566
59602
  if (!drawIds.length)
59567
59603
  return decorateResult({
59568
- result: __assign({}, SUCCESS),
59569
59604
  info: 'nothing to do; no matching drawIds in event.',
59605
+ result: __assign({}, SUCCESS),
59570
59606
  stack: stack,
59571
59607
  });
59572
59608
  var flightProfile = makeDeepCopy(getFlightProfile({ event: event }).flightProfile, false, true);
@@ -60123,6 +60159,7 @@ var DOMINANT_DUO = 'DOMINANT_DUO';
60123
60159
  var DOMINANT_DUO_MIXED = 'DOMINANT_DUO_MIXED';
60124
60160
  var LAVER_CUP = 'LAVER_CUP';
60125
60161
  var TEAM_DOUBLES_3_AGGREGATION = 'TEAM_DOUBLES_3_AGGREGATION';
60162
+ var TIME_TENNIS = 'TIME_TENNIS';
60126
60163
  var USTA_BREWER_CUP = 'USTA_BREWER_CUP';
60127
60164
  var USTA_OZAKI_CUP = 'USTA_OZAKI_CUP';
60128
60165
  var USTA_COLLEGE = 'USTA_COLLEGE';
@@ -60142,6 +60179,7 @@ var tieFormatConstants = {
60142
60179
  DOMINANT_DUO_MIXED: DOMINANT_DUO_MIXED,
60143
60180
  LAVER_CUP: LAVER_CUP,
60144
60181
  TEAM_DOUBLES_3_AGGREGATION: TEAM_DOUBLES_3_AGGREGATION,
60182
+ TIME_TENNIS: TIME_TENNIS,
60145
60183
  USTA_BREWER_CUP: USTA_BREWER_CUP,
60146
60184
  USTA_OZAKI_CUP: USTA_OZAKI_CUP,
60147
60185
  USTA_COLLEGE: USTA_COLLEGE,
@@ -60213,6 +60251,7 @@ var namedFormats = (_a = {},
60213
60251
  _a[DOMINANT_DUO] = DOMINANT_DUO_TIE_FORMAT,
60214
60252
  _a[DOMINANT_DUO_MIXED] = DOMINANT_DUO_MIXED_TIE_FORMAT,
60215
60253
  _a[TEAM_DOUBLES_3_AGGREGATION] = TEAM_AGGREGATION_TIE_FORMAT,
60254
+ _a[TIME_TENNIS] = TIME_TENNIS_TIE_FORMAT,
60216
60255
  _a[USTA_BREWER_CUP] = USTA_BREWER_CUP_TIE_FORMAT,
60217
60256
  _a[USTA_OZAKI_CUP] = USTA_OZAKI_CUP_TIE_FORMAT,
60218
60257
  _a[USTA_COLLEGE] = USTA_COLLEGE_TIE_FORMAT,
@@ -62623,6 +62662,7 @@ function addVoluntaryConsolationStructure(params) {
62623
62662
 
62624
62663
  function prepareStage(params) {
62625
62664
  var _a;
62665
+ var stack = 'prepareStage';
62626
62666
  var seedsCount = params.seedsCount;
62627
62667
  var preparedStructureIds = params.preparedStructureIds || [];
62628
62668
  var provisionalPositioning = params.provisionalPositioning, inContextDrawMatchUps = params.inContextDrawMatchUps, tournamentRecord = params.tournamentRecord, appliedPolicies = params.appliedPolicies, qualifyingOnly = params.qualifyingOnly, drawDefinition = params.drawDefinition, seedingProfile = params.seedingProfile, participants = params.participants, matchUpsMap = params.matchUpsMap, automated = params.automated, placeByes = params.placeByes, drawType = params.drawType, drawSize = params.drawSize, entries = params.entries, event = params.event, _b = params.enforcePolicyLimits, enforcePolicyLimits = _b === void 0 ? true : _b, seedAssignmentProfile = params.seedAssignmentProfile, // mainly used by mocksEngine for scenario testing
@@ -62661,7 +62701,7 @@ function prepareStage(params) {
62661
62701
  return !preparedStructureIds.includes(structureId);
62662
62702
  });
62663
62703
  if (!structure)
62664
- return decorateResult({ result: { error: STRUCTURE_NOT_FOUND } });
62704
+ return decorateResult({ result: { error: STRUCTURE_NOT_FOUND }, stack: stack });
62665
62705
  var structureId = structure === null || structure === void 0 ? void 0 : structure.structureId;
62666
62706
  var seedBlockInfo = structure
62667
62707
  ? getValidSeedBlocks({
@@ -62798,7 +62838,7 @@ function prepareStage(params) {
62798
62838
  positionAssignments = result === null || result === void 0 ? void 0 : result.positionAssignments;
62799
62839
  positioningReport = result === null || result === void 0 ? void 0 : result.positioningReport;
62800
62840
  if (result.error) {
62801
- return decorateResult({ result: result, stack: 'prepareStage' });
62841
+ return decorateResult({ result: result, stack: stack });
62802
62842
  }
62803
62843
  }
62804
62844
  return {
@@ -62988,10 +63028,8 @@ function generateDrawDefinition(params) {
62988
63028
  if (policyDefinitions) {
62989
63029
  if (typeof policyDefinitions !== 'object') {
62990
63030
  return decorateResult({
62991
- result: {
62992
- info: 'policyDefinitions must be an object',
62993
- error: INVALID_VALUES,
62994
- },
63031
+ info: 'policyDefinitions must be an object',
63032
+ result: { error: INVALID_VALUES },
62995
63033
  stack: stack,
62996
63034
  });
62997
63035
  }
@@ -63240,8 +63278,9 @@ function generateDrawDefinition(params) {
63240
63278
  var roundTargetProfile = _34.value;
63241
63279
  if (!Array.isArray(roundTargetProfile.structureProfiles))
63242
63280
  return decorateResult({
63243
- result: { error: MISSING_VALUE },
63244
63281
  info: mustBeAnArray('structureProfiles'),
63282
+ result: { error: MISSING_VALUE },
63283
+ stack: stack,
63245
63284
  });
63246
63285
  roundTarget = roundTargetProfile.roundTarget || roundTarget;
63247
63286
  var sortedStructureProfiles = ((_21 = roundTargetProfile.structureProfiles) === null || _21 === void 0 ? void 0 : _21.sort(sequenceSort)) || [];
@@ -63498,26 +63537,26 @@ function enableTieAutoCalc(params) {
63498
63537
  }
63499
63538
 
63500
63539
  function modifyEvent(_a) {
63501
- var _b;
63540
+ var _b, _c, _d, _e, _f;
63502
63541
  var tournamentRecord = _a.tournamentRecord, eventUpdates = _a.eventUpdates, eventId = _a.eventId, event = _a.event;
63503
63542
  if (!tournamentRecord)
63504
63543
  return { error: MISSING_TOURNAMENT_RECORD };
63505
63544
  if (!isString(eventId) || !isObject(eventUpdates))
63506
63545
  return { error: INVALID_VALUES };
63507
- var enteredParticipantIds = ((_b = event === null || event === void 0 ? void 0 : event.entries) === null || _b === void 0 ? void 0 : _b.filter(function (_a) {
63546
+ var enteredParticipantIds = (_c = (_b = event === null || event === void 0 ? void 0 : event.entries) === null || _b === void 0 ? void 0 : _b.filter(function (_a) {
63508
63547
  var entryStatus = _a.entryStatus;
63509
63548
  var status = entryStatus;
63510
63549
  return __spreadArray(__spreadArray([], __read(STRUCTURE_SELECTED_STATUSES), false), [ALTERNATE], false).includes(status);
63511
63550
  }).map(function (_a) {
63512
63551
  var participantId = _a.participantId;
63513
63552
  return participantId;
63514
- })) || [];
63553
+ })) !== null && _c !== void 0 ? _c : [];
63515
63554
  var enteredParticipants = enteredParticipantIds
63516
- ? getParticipants$1({
63555
+ ? (_d = getParticipants$1({
63517
63556
  participantFilters: { participantIds: enteredParticipantIds },
63518
63557
  withIndividualParticipants: true,
63519
63558
  tournamentRecord: tournamentRecord,
63520
- }).participants || []
63559
+ }).participants) !== null && _d !== void 0 ? _d : []
63521
63560
  : [];
63522
63561
  var genderAccumulator = [];
63523
63562
  var enteredParticipantTypes = enteredParticipants.reduce(function (types, participant) {
@@ -63532,7 +63571,7 @@ function modifyEvent(_a) {
63532
63571
  }, []);
63533
63572
  var enteredParticipantGenders = unique(genderAccumulator);
63534
63573
  var validGender = !enteredParticipantGenders.length ||
63535
- [MIXED, ANY].includes(eventUpdates.gender || '') ||
63574
+ [MIXED, ANY].includes((_e = eventUpdates.gender) !== null && _e !== void 0 ? _e : '') ||
63536
63575
  (enteredParticipantGenders.length === 1 &&
63537
63576
  enteredParticipantGenders[0] === eventUpdates.gender);
63538
63577
  if (eventUpdates.gender && !validGender)
@@ -63547,14 +63586,14 @@ function modifyEvent(_a) {
63547
63586
  SINGLES,
63548
63587
  TEAM$1,
63549
63588
  ];
63550
- var validEventType = validEventTypes.includes(eventUpdates.eventType || '');
63589
+ var validEventType = validEventTypes.includes((_f = eventUpdates.eventType) !== null && _f !== void 0 ? _f : '');
63551
63590
  if (eventUpdates.eventType && !validEventType)
63552
63591
  return decorateResult({
63553
63592
  context: { participantType: eventUpdates.eventType },
63554
63593
  result: { error: INVALID_VALUES },
63555
63594
  });
63556
63595
  if (eventUpdates.eventType)
63557
- event.eventType === eventUpdates.eventType;
63596
+ event.eventType = eventUpdates.eventType;
63558
63597
  if (eventUpdates.eventName)
63559
63598
  event.eventName = eventUpdates.eventName;
63560
63599
  if (eventUpdates.gender)
@@ -65876,6 +65915,7 @@ var lastNames = [
65876
65915
  "Midgely",
65877
65916
  "Mond",
65878
65917
  "Montoya",
65918
+ "Moore",
65879
65919
  "Murry",
65880
65920
  "Nagle",
65881
65921
  "Nearing",
@@ -65939,6 +65979,8 @@ var firstFemale = [
65939
65979
  "Erin",
65940
65980
  "Eva",
65941
65981
  "Evelyn",
65982
+ "Heather",
65983
+ "Helen",
65942
65984
  "Hermia",
65943
65985
  "Hypatia",
65944
65986
  "Imogen",
@@ -65946,8 +65988,6 @@ var firstFemale = [
65946
65988
  "Jasmine",
65947
65989
  "Juliana",
65948
65990
  "Juliet",
65949
- "Heather",
65950
- "Helen",
65951
65991
  "Katniss",
65952
65992
  "Leeloo",
65953
65993
  "Lenina",
@@ -65993,6 +66033,7 @@ var firstMale = [
65993
66033
  "Axel",
65994
66034
  "Barda",
65995
66035
  "Bill",
66036
+ "Bruce",
65996
66037
  "Charles",
65997
66038
  "Chris",
65998
66039
  "Darwin",
@@ -66028,6 +66069,7 @@ var firstMale = [
66028
66069
  "Michael",
66029
66070
  "Mustapha",
66030
66071
  "Neil",
66072
+ "Nikola",
66031
66073
  "Octavio",
66032
66074
  "Palmer",
66033
66075
  "Paul",
@@ -66036,12 +66078,14 @@ var firstMale = [
66036
66078
  "Rick",
66037
66079
  "Rincewind",
66038
66080
  "Roy",
66081
+ "Shannon",
66039
66082
  "Sheldon",
66040
66083
  "Stafford",
66041
66084
  "Stanislaw",
66042
66085
  "Stanley",
66043
66086
  "Syme",
66044
66087
  "Thorstein",
66088
+ "Thomas",
66045
66089
  "Tyrone",
66046
66090
  "Vizzini",
66047
66091
  "Walton",
@@ -66050,7 +66094,8 @@ var firstMale = [
66050
66094
  "Wendell",
66051
66095
  "Westley",
66052
66096
  "William",
66053
- "Winston"
66097
+ "Winston",
66098
+ "Zoran"
66054
66099
  ];
66055
66100
  var namesData$1 = {
66056
66101
  lastNames: lastNames,