tods-competition-factory 1.8.29 → 1.8.31

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.
@@ -2929,7 +2929,7 @@ var matchUpFormatCode = {
2929
2929
  };
2930
2930
 
2931
2931
  function factoryVersion() {
2932
- return '1.8.29';
2932
+ return '1.8.31';
2933
2933
  }
2934
2934
 
2935
2935
  function getObjectTieFormat(obj) {
@@ -3588,8 +3588,7 @@ function genderValidityCheck(_a) {
3588
3588
  var stack = 'genderValidityCheck';
3589
3589
  if (referenceGender &&
3590
3590
  gender &&
3591
- [GenderEnum.Male, GenderEnum.Female].includes(referenceGender) &&
3592
- [GenderEnum.Male, GenderEnum.Female].includes(gender)) {
3591
+ [GenderEnum.Male, GenderEnum.Female].includes(referenceGender)) {
3593
3592
  var valid = gender === referenceGender;
3594
3593
  return valid
3595
3594
  ? { valid: true }
@@ -10762,8 +10761,11 @@ function updateAssignmentParticipantResults(_a) {
10762
10761
  }
10763
10762
 
10764
10763
  function addParticipantGroupings(_a) {
10765
- var participantsProfile = _a.participantsProfile, _b = _a.participants, participants = _b === void 0 ? [] : _b;
10766
- var participantsWithGroupings = makeDeepCopy(participants, participantsProfile === null || participantsProfile === void 0 ? void 0 : participantsProfile.convertExtensions, true);
10764
+ var participantsProfile = _a.participantsProfile, _b = _a.participants, participants = _b === void 0 ? [] : _b, deepCopy = _a.deepCopy;
10765
+ var groupMap = new Map();
10766
+ var participantsWithGroupings = deepCopy !== false
10767
+ ? makeDeepCopy(participants, participantsProfile === null || participantsProfile === void 0 ? void 0 : participantsProfile.convertExtensions, true)
10768
+ : participants;
10767
10769
  var teamParticipants = participantsWithGroupings.filter(function (participant) { return participant.participantType === TEAM; });
10768
10770
  var groupParticipants = participantsWithGroupings.filter(function (participant) { return participant.participantType === GROUP; });
10769
10771
  // should pairParticipants only consider those that are in the same event as current draw?
@@ -10783,6 +10785,11 @@ function addParticipantGroupings(_a) {
10783
10785
  if (individualParticipantId === participantId_1 &&
10784
10786
  !((_a = participant.teamParticipantIds) === null || _a === void 0 ? void 0 : _a.includes(team.participantId))) {
10785
10787
  participant.teamParticipantIds.push(team.participantId);
10788
+ if (!groupMap.get(team.participantId))
10789
+ groupMap.set(team.participantId, {
10790
+ participantName: team.participantName,
10791
+ participantId: team.participantId,
10792
+ });
10786
10793
  participant.teams.push({
10787
10794
  participantRoleResponsibilities: team.participantRoleResponsibilities,
10788
10795
  participantOtherName: team.participantOtherName,
@@ -10817,7 +10824,7 @@ function addParticipantGroupings(_a) {
10817
10824
  });
10818
10825
  }
10819
10826
  });
10820
- return participantsWithGroupings;
10827
+ return { participantsWithGroupings: participantsWithGroupings, groupInfo: Object.fromEntries(groupMap) };
10821
10828
  }
10822
10829
 
10823
10830
  var extractor = function (object) { return function (attr) { return object[attr]; }; };
@@ -11504,6 +11511,7 @@ function getAllDrawMatchUps(params) {
11504
11511
  return { matchUps: matchUps, matchUpsMap: matchUpsMap };
11505
11512
  }
11506
11513
  function getDrawMatchUps(params) {
11514
+ var _a;
11507
11515
  if (!(params === null || params === void 0 ? void 0 : params.drawDefinition))
11508
11516
  return { error: MISSING_DRAW_DEFINITION };
11509
11517
  var tournamentParticipants = params.tournamentParticipants, contextContent = params.contextContent, matchUpsMap = params.matchUpsMap;
@@ -11524,14 +11532,15 @@ function getDrawMatchUps(params) {
11524
11532
  // getParticipants() calls allEventMatchUps()
11525
11533
  // ...so participants must be sourced directly from tournamentRecord
11526
11534
  // ...and groupings must be added independent of that
11535
+ var groupInfo;
11527
11536
  if (!(tournamentParticipants === null || tournamentParticipants === void 0 ? void 0 : tournamentParticipants.length) && tournamentRecord) {
11528
11537
  tournamentParticipants = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants;
11529
11538
  if ((inContext || (participantsProfile === null || participantsProfile === void 0 ? void 0 : participantsProfile.withGroupings)) &&
11530
11539
  (tournamentParticipants === null || tournamentParticipants === void 0 ? void 0 : tournamentParticipants.length)) {
11531
- tournamentParticipants = addParticipantGroupings({
11540
+ (_a = addParticipantGroupings({
11532
11541
  participants: tournamentParticipants,
11533
11542
  participantsProfile: participantsProfile,
11534
- });
11543
+ }), tournamentParticipants = _a.participantsWithGroupings, groupInfo = _a.groupInfo);
11535
11544
  }
11536
11545
  }
11537
11546
  var structures = getDrawStructures({ drawDefinition: drawDefinition }).structures;
@@ -11585,7 +11594,7 @@ function getDrawMatchUps(params) {
11585
11594
  }
11586
11595
  return matchUps;
11587
11596
  };
11588
- var matchUpGroups = __assign({ abandonedMatchUps: applyFilter(allAbandonedMatchUps), completedMatchUps: applyFilter(allCompletedMatchUps), upcomingMatchUps: applyFilter(allUpcomingMatchUps), pendingMatchUps: applyFilter(allPendingMatchUps), byeMatchUps: applyFilter(allByeMatchUps), matchUpsMap: matchUpsMap }, SUCCESS);
11597
+ var drawMatchUpsResult = __assign(__assign({ abandonedMatchUps: applyFilter(allAbandonedMatchUps), completedMatchUps: applyFilter(allCompletedMatchUps), upcomingMatchUps: applyFilter(allUpcomingMatchUps), pendingMatchUps: applyFilter(allPendingMatchUps), byeMatchUps: applyFilter(allByeMatchUps), matchUpsMap: matchUpsMap }, SUCCESS), { groupInfo: groupInfo });
11589
11598
  if (nextMatchUps) {
11590
11599
  var nextFilter = typeof nextMatchUps === 'object' || {
11591
11600
  abandoned: true,
@@ -11601,7 +11610,7 @@ function getDrawMatchUps(params) {
11601
11610
  drawDefinition: drawDefinition,
11602
11611
  });
11603
11612
  }
11604
- return matchUpGroups;
11613
+ return drawMatchUpsResult;
11605
11614
  }
11606
11615
 
11607
11616
  var toBePlayed = {
@@ -17727,11 +17736,11 @@ function initializeParticipantId(_a) {
17727
17736
  }
17728
17737
 
17729
17738
  function hydrateParticipants(_a) {
17730
- var e_1, _b;
17731
- var _c;
17739
+ var _b, e_1, _c;
17740
+ var _d;
17732
17741
  var participantsProfile = _a.participantsProfile, useParticipantMap = _a.useParticipantMap, tournamentRecord = _a.tournamentRecord, contextProfile = _a.contextProfile, inContext = _a.inContext;
17733
17742
  if (useParticipantMap) {
17734
- var participantMap = (_c = getParticipantMap(__assign(__assign(__assign({}, participantsProfile), contextProfile), { tournamentRecord: tournamentRecord }))) === null || _c === void 0 ? void 0 : _c.participantMap;
17743
+ var participantMap = (_d = getParticipantMap(__assign(__assign(__assign({}, participantsProfile), contextProfile), { tournamentRecord: tournamentRecord }))) === null || _d === void 0 ? void 0 : _d.participantMap;
17735
17744
  return { participantMap: participantMap };
17736
17745
  }
17737
17746
  var participants = makeDeepCopy(tournamentRecord.participants, false, true) || [];
@@ -17739,18 +17748,20 @@ function hydrateParticipants(_a) {
17739
17748
  participants.forEach(function (participant) {
17740
17749
  return addNationalityCode(__assign({ participant: participant }, participantsProfile));
17741
17750
  });
17751
+ var groupInfo;
17742
17752
  if ((inContext || (participantsProfile === null || participantsProfile === void 0 ? void 0 : participantsProfile.withGroupings)) &&
17743
17753
  (participants === null || participants === void 0 ? void 0 : participants.length)) {
17744
- participants = addParticipantGroupings({
17754
+ (_b = addParticipantGroupings({
17745
17755
  participantsProfile: participantsProfile,
17756
+ deepCopy: false,
17746
17757
  participants: participants,
17747
- });
17758
+ }), participants = _b.participantsWithGroupings, groupInfo = _b.groupInfo);
17748
17759
  }
17749
17760
  if ((participantsProfile === null || participantsProfile === void 0 ? void 0 : participantsProfile.withScaleValues) && (participants === null || participants === void 0 ? void 0 : participants.length)) {
17750
17761
  try {
17751
17762
  for (var participants_1 = __values(participants), participants_1_1 = participants_1.next(); !participants_1_1.done; participants_1_1 = participants_1.next()) {
17752
17763
  var participant = participants_1_1.value;
17753
- var _d = getScaleValues({ participant: participant }), ratings = _d.ratings, rankings = _d.rankings;
17764
+ var _e = getScaleValues({ participant: participant }), ratings = _e.ratings, rankings = _e.rankings;
17754
17765
  participant.rankings = rankings;
17755
17766
  participant.ratings = ratings;
17756
17767
  }
@@ -17758,12 +17769,12 @@ function hydrateParticipants(_a) {
17758
17769
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
17759
17770
  finally {
17760
17771
  try {
17761
- if (participants_1_1 && !participants_1_1.done && (_b = participants_1.return)) _b.call(participants_1);
17772
+ if (participants_1_1 && !participants_1_1.done && (_c = participants_1.return)) _c.call(participants_1);
17762
17773
  }
17763
17774
  finally { if (e_1) throw e_1.error; }
17764
17775
  }
17765
17776
  }
17766
- return { participants: participants };
17777
+ return { participants: participants, groupInfo: groupInfo };
17767
17778
  }
17768
17779
 
17769
17780
  function allTournamentMatchUps(params) {
@@ -17828,6 +17839,7 @@ function allDrawMatchUps$1(params) {
17828
17839
  var scheduleVisibilityFilters = params.scheduleVisibilityFilters, tournamentAppliedPolicies = params.tournamentAppliedPolicies, participantsProfile = params.participantsProfile, afterRecoveryTimes = params.afterRecoveryTimes, policyDefinitions = params.policyDefinitions, useParticipantMap = params.useParticipantMap, tournamentRecord = params.tournamentRecord, contextFilters = params.contextFilters, contextProfile = params.contextProfile, drawDefinition = params.drawDefinition, matchUpFilters = params.matchUpFilters, nextMatchUps = params.nextMatchUps, inContext = params.inContext, context = params.context, event = params.event;
17829
17840
  var _e = event !== null && event !== void 0 ? event : {}, eventId = _e.eventId, eventName = _e.eventName, eventType = _e.eventType, category = _e.category, gender = _e.gender, matchUpFormat = _e.matchUpFormat;
17830
17841
  var additionalContext = __assign(__assign({}, context), { eventId: eventId, eventType: eventType, eventName: eventName, category: category, gender: gender, matchUpFormat: matchUpFormat, indoorOutDoor: (_c = event === null || event === void 0 ? void 0 : event.indoorOutdoor) !== null && _c !== void 0 ? _c : tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.indoorOutdoor, surfaceCategory: (_d = event === null || event === void 0 ? void 0 : event.surfaceCategory) !== null && _d !== void 0 ? _d : tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.surfaceCategory, endDate: event === null || event === void 0 ? void 0 : event.endDate });
17842
+ var groupInfo;
17831
17843
  if (!(tournamentParticipants === null || tournamentParticipants === void 0 ? void 0 : tournamentParticipants.length) && !participantMap && tournamentRecord) {
17832
17844
  (_a = hydrateParticipants({
17833
17845
  participantsProfile: participantsProfile,
@@ -17836,7 +17848,7 @@ function allDrawMatchUps$1(params) {
17836
17848
  tournamentRecord: tournamentRecord,
17837
17849
  contextProfile: contextProfile,
17838
17850
  inContext: inContext,
17839
- }), _b = _a.participants, tournamentParticipants = _b === void 0 ? [] : _b, participantMap = _a.participantMap);
17851
+ }), _b = _a.participants, tournamentParticipants = _b === void 0 ? [] : _b, participantMap = _a.participantMap, groupInfo = _a.groupInfo);
17840
17852
  }
17841
17853
  if (contextProfile && !contextContent) {
17842
17854
  contextContent = getContextContent({
@@ -17847,7 +17859,7 @@ function allDrawMatchUps$1(params) {
17847
17859
  event: event,
17848
17860
  });
17849
17861
  }
17850
- return getAllDrawMatchUps({
17862
+ var allDrawMatchUpsResult = getAllDrawMatchUps({
17851
17863
  context: additionalContext,
17852
17864
  tournamentAppliedPolicies: tournamentAppliedPolicies,
17853
17865
  scheduleVisibilityFilters: scheduleVisibilityFilters,
@@ -17866,6 +17878,7 @@ function allDrawMatchUps$1(params) {
17866
17878
  inContext: inContext,
17867
17879
  event: event,
17868
17880
  });
17881
+ return __assign(__assign({}, allDrawMatchUpsResult), { groupInfo: groupInfo });
17869
17882
  }
17870
17883
  function allEventMatchUps(params) {
17871
17884
  var _a, _b, _c, _d, _e;
@@ -17895,6 +17908,7 @@ function allEventMatchUps(params) {
17895
17908
  event: event,
17896
17909
  });
17897
17910
  }
17911
+ var groupInfo;
17898
17912
  if (!(participants === null || participants === void 0 ? void 0 : participants.length) && !participantMap && tournamentRecord) {
17899
17913
  var hydratedParticipantResult = hydrateParticipants({
17900
17914
  participantsProfile: participantsProfile,
@@ -17906,6 +17920,7 @@ function allEventMatchUps(params) {
17906
17920
  });
17907
17921
  participantMap = hydratedParticipantResult.participantMap;
17908
17922
  participants = (_d = hydratedParticipantResult.participants) !== null && _d !== void 0 ? _d : [];
17923
+ groupInfo = hydratedParticipantResult.groupInfo;
17909
17924
  }
17910
17925
  var drawDefinitions = (_e = event.drawDefinitions) !== null && _e !== void 0 ? _e : [];
17911
17926
  var scheduleTiming = getScheduleTiming({
@@ -17935,7 +17950,7 @@ function allEventMatchUps(params) {
17935
17950
  }).matchUps;
17936
17951
  return matchUps !== null && matchUps !== void 0 ? matchUps : [];
17937
17952
  });
17938
- return { matchUps: matchUps };
17953
+ return { matchUps: matchUps, groupInfo: groupInfo };
17939
17954
  }
17940
17955
  function tournamentMatchUps(params) {
17941
17956
  var _a, _b, _c;
@@ -17952,7 +17967,7 @@ function tournamentMatchUps(params) {
17952
17967
  tournamentRecord: tournamentRecord,
17953
17968
  contextProfile: contextProfile,
17954
17969
  inContext: inContext,
17955
- }), participants = _e.participants, participantMap = _e.participantMap;
17970
+ }), participants = _e.participants, participantMap = _e.participantMap, groupInfo = _e.groupInfo;
17956
17971
  if (contextProfile && !contextContent)
17957
17972
  contextContent = getContextContent({
17958
17973
  policyDefinitions: policyDefinitions,
@@ -17989,17 +18004,20 @@ function tournamentMatchUps(params) {
17989
18004
  event: event,
17990
18005
  });
17991
18006
  });
17992
- return eventsDrawsMatchUps.reduce(function (matchUps, eventMatchUps) {
18007
+ var eventsDrawMatchUpsResult = eventsDrawsMatchUps.reduce(function (matchUps, eventMatchUps) {
17993
18008
  var keys = eventMatchUps &&
17994
18009
  Object.keys(eventMatchUps).filter(function (key) { return !['success', 'matchUpsMap'].includes(key); });
17995
18010
  keys === null || keys === void 0 ? void 0 : keys.forEach(function (key) {
17996
- if (!matchUps[key])
17997
- matchUps[key] = [];
17998
- matchUps[key] = matchUps[key].concat(eventMatchUps[key]);
17999
- matchUps.matchUpsCount += eventMatchUps[key].length;
18011
+ if (Array.isArray(eventMatchUps[key])) {
18012
+ if (!matchUps[key])
18013
+ matchUps[key] = [];
18014
+ matchUps[key] = matchUps[key].concat(eventMatchUps[key]);
18015
+ matchUps.matchUpsCount += eventMatchUps[key].length;
18016
+ }
18000
18017
  });
18001
18018
  return matchUps;
18002
18019
  }, { matchUpsCount: 0 });
18020
+ return __assign(__assign({}, eventsDrawMatchUpsResult), { groupInfo: groupInfo });
18003
18021
  }
18004
18022
  function eventMatchUps(params) {
18005
18023
  var _a;
@@ -18017,6 +18035,7 @@ function eventMatchUps(params) {
18017
18035
  indoorOutDoor: (_b = event.indoorOutdoor) !== null && _b !== void 0 ? _b : tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.indoorOutdoor,
18018
18036
  surfaceCategory: (_c = event.surfaceCategory) !== null && _c !== void 0 ? _c : tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.surfaceCategory,
18019
18037
  }));
18038
+ var groupInfo;
18020
18039
  if (!tournamentParticipants && tournamentRecord) {
18021
18040
  (_a = hydrateParticipants({
18022
18041
  participantsProfile: participantsProfile,
@@ -18025,7 +18044,7 @@ function eventMatchUps(params) {
18025
18044
  tournamentRecord: tournamentRecord,
18026
18045
  contextProfile: contextProfile,
18027
18046
  inContext: inContext,
18028
- }), tournamentParticipants = _a.participants, participantMap = _a.participantMap);
18047
+ }), tournamentParticipants = _a.participants, participantMap = _a.participantMap, groupInfo = _a.groupInfo);
18029
18048
  }
18030
18049
  if (contextProfile && !contextContent)
18031
18050
  contextContent = getContextContent({
@@ -18035,8 +18054,8 @@ function eventMatchUps(params) {
18035
18054
  event: event,
18036
18055
  });
18037
18056
  var drawDefinitions = (_d = event.drawDefinitions) !== null && _d !== void 0 ? _d : [];
18038
- return drawDefinitions.reduce(function (matchUps, drawDefinition) {
18039
- var drawMatchUps = getDrawMatchUps({
18057
+ var eventResult = drawDefinitions.reduce(function (results, drawDefinition) {
18058
+ var drawMatchUpsResult = getDrawMatchUps({
18040
18059
  context: additionalContext,
18041
18060
  tournamentAppliedPolicies: tournamentAppliedPolicies,
18042
18061
  scheduleVisibilityFilters: scheduleVisibilityFilters,
@@ -18055,14 +18074,17 @@ function eventMatchUps(params) {
18055
18074
  inContext: inContext,
18056
18075
  event: event,
18057
18076
  });
18058
- var keys = Object.keys(drawMatchUps);
18077
+ var keys = Object.keys(drawMatchUpsResult);
18059
18078
  keys === null || keys === void 0 ? void 0 : keys.forEach(function (key) {
18060
- if (!matchUps[key])
18061
- matchUps[key] = [];
18062
- matchUps[key] = matchUps[key].concat(drawMatchUps[key]);
18079
+ if (Array.isArray(drawMatchUpsResult[key])) {
18080
+ if (!results[key])
18081
+ results[key] = [];
18082
+ results[key] = results[key].concat(drawMatchUpsResult[key]);
18083
+ }
18063
18084
  });
18064
- return matchUps;
18085
+ return results;
18065
18086
  }, {});
18087
+ return __assign(__assign(__assign({}, eventResult), SUCCESS), { groupInfo: groupInfo });
18066
18088
  }
18067
18089
  function drawMatchUps$1(_a) {
18068
18090
  var _b;
@@ -18077,6 +18099,7 @@ function drawMatchUps$1(_a) {
18077
18099
  indoorOutDoor: (_d = event === null || event === void 0 ? void 0 : event.indoorOutdoor) !== null && _d !== void 0 ? _d : tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.indoorOutdoor,
18078
18100
  surfaceCategory: (_e = event === null || event === void 0 ? void 0 : event.surfaceCategory) !== null && _e !== void 0 ? _e : tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.surfaceCategory,
18079
18101
  }));
18102
+ var groupInfo;
18080
18103
  if (!(tournamentParticipants === null || tournamentParticipants === void 0 ? void 0 : tournamentParticipants.length) && tournamentRecord) {
18081
18104
  (_b = hydrateParticipants({
18082
18105
  participantsProfile: participantsProfile,
@@ -18085,7 +18108,7 @@ function drawMatchUps$1(_a) {
18085
18108
  tournamentRecord: tournamentRecord,
18086
18109
  contextProfile: contextProfile,
18087
18110
  inContext: inContext,
18088
- }), tournamentParticipants = _b.participants, participantMap = _b.participantMap);
18111
+ }), tournamentParticipants = _b.participants, participantMap = _b.participantMap, groupInfo = _b.groupInfo);
18089
18112
  }
18090
18113
  if (event && contextProfile && !contextContent)
18091
18114
  contextContent = getContextContent({
@@ -18095,7 +18118,7 @@ function drawMatchUps$1(_a) {
18095
18118
  drawDefinition: drawDefinition,
18096
18119
  event: event,
18097
18120
  });
18098
- return getDrawMatchUps({
18121
+ var drawMatchUpsResult = getDrawMatchUps({
18099
18122
  context: additionalContext,
18100
18123
  tournamentAppliedPolicies: tournamentAppliedPolicies,
18101
18124
  scheduleVisibilityFilters: scheduleVisibilityFilters,
@@ -18114,6 +18137,7 @@ function drawMatchUps$1(_a) {
18114
18137
  inContext: inContext,
18115
18138
  event: event,
18116
18139
  });
18140
+ return __assign(__assign({}, drawMatchUpsResult), { groupInfo: groupInfo });
18117
18141
  }
18118
18142
 
18119
18143
  function addFinishingRounds(_a) {
@@ -18324,15 +18348,22 @@ function competitionMatchUps(_a) {
18324
18348
  inContext: inContext,
18325
18349
  });
18326
18350
  });
18327
- return tournamentsMatchUps.reduce(function (groupings, matchUpGroupings) {
18351
+ var groupInfo = {};
18352
+ var competitionMatchUpsResult = tournamentsMatchUps.reduce(function (groupings, matchUpGroupings) {
18328
18353
  var keys = Object.keys(matchUpGroupings);
18329
18354
  keys.forEach(function (key) {
18330
- if (!groupings[key])
18331
- groupings[key] = [];
18332
- groupings[key] = groupings[key].concat(matchUpGroupings[key]);
18355
+ if (Array.isArray(matchUpGroupings[key])) {
18356
+ if (!groupings[key])
18357
+ groupings[key] = [];
18358
+ groupings[key] = groupings[key].concat(matchUpGroupings[key]);
18359
+ }
18360
+ if (key === 'groupInfo') {
18361
+ Object.assign(groupInfo, matchUpGroupings[key]);
18362
+ }
18333
18363
  });
18334
18364
  return groupings;
18335
18365
  }, {});
18366
+ return __assign(__assign({}, competitionMatchUpsResult), { groupInfo: groupInfo });
18336
18367
  }
18337
18368
 
18338
18369
  /**
@@ -32873,13 +32904,14 @@ function publicFindMatchUp(params) {
32873
32904
  }
32874
32905
  function findMatchUp(_a) {
32875
32906
  var _b;
32876
- var _c, _d, _e, _f;
32907
+ var _c, _d, _e, _f, _g, _h;
32877
32908
  var participantsProfile = _a.participantsProfile, afterRecoveryTimes = _a.afterRecoveryTimes, tournamentRecord = _a.tournamentRecord, contextContent = _a.contextContent, contextProfile = _a.contextProfile, drawDefinition = _a.drawDefinition, nextMatchUps = _a.nextMatchUps, matchUpId = _a.matchUpId, inContext = _a.inContext, eventId = _a.eventId, drawId = _a.drawId, event = _a.event;
32878
32909
  if (!tournamentRecord)
32879
32910
  return { error: MISSING_TOURNAMENT_RECORD };
32880
32911
  if (typeof matchUpId !== 'string')
32881
32912
  return { error: MISSING_MATCHUP_ID };
32882
- if (!drawDefinition || !event || nextMatchUps) {
32913
+ // brute force
32914
+ if (!drawDefinition || !event) {
32883
32915
  var matchUps = (_c = allTournamentMatchUps({ tournamentRecord: tournamentRecord, nextMatchUps: nextMatchUps }).matchUps) !== null && _c !== void 0 ? _c : [];
32884
32916
  var inContextMatchUp = matchUps.find(function (matchUp) { return matchUp.matchUpId === matchUpId; });
32885
32917
  if (!inContextMatchUp)
@@ -32904,24 +32936,44 @@ function findMatchUp(_a) {
32904
32936
  eventId: eventId !== null && eventId !== void 0 ? eventId : event === null || event === void 0 ? void 0 : event.eventId,
32905
32937
  drawId: drawId,
32906
32938
  };
32907
- var _g = hydrateParticipants({
32939
+ var _j = hydrateParticipants({
32908
32940
  participantsProfile: participantsProfile,
32909
32941
  tournamentRecord: tournamentRecord,
32910
32942
  contextProfile: contextProfile,
32911
32943
  inContext: inContext,
32912
- }).participants, tournamentParticipants = _g === void 0 ? [] : _g;
32913
- var _h = findDrawMatchUp({
32914
- context: inContext ? additionalContext : undefined,
32915
- tournamentParticipants: tournamentParticipants,
32916
- afterRecoveryTimes: afterRecoveryTimes,
32917
- contextContent: contextContent,
32918
- drawDefinition: drawDefinition,
32919
- contextProfile: contextProfile,
32920
- matchUpId: matchUpId,
32921
- inContext: inContext,
32922
- event: event,
32923
- }), matchUp = _h.matchUp, structure = _h.structure;
32924
- return { matchUp: matchUp, structure: structure, drawDefinition: drawDefinition };
32944
+ }).participants, tournamentParticipants = _j === void 0 ? [] : _j;
32945
+ if (nextMatchUps) {
32946
+ var matchUps = (_g = allDrawMatchUps$1({
32947
+ context: inContext ? additionalContext : undefined,
32948
+ participants: tournamentParticipants,
32949
+ afterRecoveryTimes: afterRecoveryTimes,
32950
+ contextContent: contextContent,
32951
+ contextProfile: contextProfile,
32952
+ drawDefinition: drawDefinition,
32953
+ nextMatchUps: nextMatchUps,
32954
+ inContext: inContext,
32955
+ event: event,
32956
+ }).matchUps) !== null && _g !== void 0 ? _g : [];
32957
+ var inContextMatchUp_1 = matchUps.find(function (matchUp) { return matchUp.matchUpId === matchUpId; });
32958
+ if (!inContextMatchUp_1)
32959
+ return { error: MATCHUP_NOT_FOUND };
32960
+ var structure = (_h = drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.structures) === null || _h === void 0 ? void 0 : _h.find(function (structure) { return structure.structureId === inContextMatchUp_1.structureId; });
32961
+ return { drawDefinition: drawDefinition, structure: structure, matchUp: inContextMatchUp_1 };
32962
+ }
32963
+ else {
32964
+ var _k = findDrawMatchUp({
32965
+ context: inContext ? additionalContext : undefined,
32966
+ tournamentParticipants: tournamentParticipants,
32967
+ afterRecoveryTimes: afterRecoveryTimes,
32968
+ contextContent: contextContent,
32969
+ drawDefinition: drawDefinition,
32970
+ contextProfile: contextProfile,
32971
+ matchUpId: matchUpId,
32972
+ inContext: inContext,
32973
+ event: event,
32974
+ }), matchUp = _k.matchUp, structure = _k.structure;
32975
+ return { matchUp: matchUp, structure: structure, drawDefinition: drawDefinition };
32976
+ }
32925
32977
  }
32926
32978
 
32927
32979
  function resetTieFormat$1(_a) {
@@ -34508,7 +34560,7 @@ function competitionScheduleMatchUps(params) {
34508
34560
  params.matchUpFilters.excludeMatchUpStatuses = [COMPLETED$1];
34509
34561
  }
34510
34562
  }
34511
- var _l = competitionMatchUps(__assign(__assign({}, params), { matchUpFilters: params.matchUpFilters, contextFilters: params.contextFilters })), completedMatchUps = _l.completedMatchUps, upcomingMatchUps = _l.upcomingMatchUps, pendingMatchUps = _l.pendingMatchUps;
34563
+ var _l = competitionMatchUps(__assign(__assign({}, params), { matchUpFilters: params.matchUpFilters, contextFilters: params.contextFilters })), completedMatchUps = _l.completedMatchUps, upcomingMatchUps = _l.upcomingMatchUps, pendingMatchUps = _l.pendingMatchUps, groupInfo = _l.groupInfo;
34512
34564
  var relevantMatchUps = __spreadArray(__spreadArray([], __read((upcomingMatchUps !== null && upcomingMatchUps !== void 0 ? upcomingMatchUps : [])), false), __read((pendingMatchUps !== null && pendingMatchUps !== void 0 ? pendingMatchUps : [])), false);
34513
34565
  var dateMatchUps = sortDateMatchUps
34514
34566
  ? scheduledSortedMatchUps({ matchUps: relevantMatchUps, schedulingProfile: schedulingProfile })
@@ -34524,6 +34576,7 @@ function competitionScheduleMatchUps(params) {
34524
34576
  ? allCompletedMatchUps
34525
34577
  : completedMatchUps, // completed matchUps for the filter date
34526
34578
  dateMatchUps: dateMatchUps, // all incomplete matchUps for the filter date
34579
+ groupInfo: groupInfo,
34527
34580
  venues: venues,
34528
34581
  };
34529
34582
  if (withCourtGridRows) {
@@ -34534,7 +34587,7 @@ function competitionScheduleMatchUps(params) {
34534
34587
  result.courtPrefix = courtPrefix; // pass through for access to internal defaults by consumer
34535
34588
  result.rows = rows;
34536
34589
  }
34537
- return result;
34590
+ return __assign(__assign({}, result), SUCCESS);
34538
34591
  function getCourtMatchUps(_a) {
34539
34592
  var courtId = _a.courtId;
34540
34593
  var matchUpsToConsider = courtCompletedMatchUps
@@ -45099,8 +45152,9 @@ function randomUnseededSeparation(_a) {
45099
45152
  var positionAssignments = structureAssignedDrawPositions({ structure: structure }).positionAssignments;
45100
45153
  var participantsWithGroupings = addParticipantGroupings({
45101
45154
  participantsProfile: { convertExtensions: true },
45155
+ deepCopy: false,
45102
45156
  participants: participants,
45103
- });
45157
+ }).participantsWithGroupings;
45104
45158
  var unassignedPositions = positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.filter(function (assignment) { return !assignment.participantId; });
45105
45159
  var allDrawPositions = positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.map(function (assignment) { return assignment.drawPosition; });
45106
45160
  var isRoundRobin = (structure === null || structure === void 0 ? void 0 : structure.structureType) === CONTAINER;