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