tods-competition-factory 1.9.1 → 1.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1637,7 +1637,6 @@ function handleCaughtError$1(_a) {
1637
1637
  var globalState = {
1638
1638
  tournamentFactoryVersion: '0.0.0',
1639
1639
  timers: { default: { elapsedTime: 0 } },
1640
- iterators: { makeDeepCopy: 0 },
1641
1640
  deepCopyAttributes: {
1642
1641
  stringify: [],
1643
1642
  ignore: [],
@@ -1720,12 +1719,6 @@ function setGlobalLog(loggingFx) {
1720
1719
  function setDevContext(value) {
1721
1720
  globalState.devContext = value;
1722
1721
  }
1723
- function setDeepCopyIterations(value) {
1724
- globalState.iterators.makeDeepCopy = value;
1725
- }
1726
- function getDeepCopyIterations() {
1727
- return globalState.iterators.makeDeepCopy;
1728
- }
1729
1722
  function disableNotifications() {
1730
1723
  _globalStateProvider.disableNotifications();
1731
1724
  }
@@ -1821,7 +1814,14 @@ function handleCaughtError(_a) {
1821
1814
  }
1822
1815
  function globalLog$1(engine, log) {
1823
1816
  if (globalState.globalLog) {
1824
- return globalState.globalLog(engine, log);
1817
+ try {
1818
+ globalState.globalLog(engine, log);
1819
+ }
1820
+ catch (error) {
1821
+ console.log('globalLog error', error);
1822
+ console.log(engine, log);
1823
+ setGlobalLog(); // delete failing custom globalLog
1824
+ }
1825
1825
  }
1826
1826
  else {
1827
1827
  console.log(engine, log);
@@ -2193,18 +2193,6 @@ iteration // escape hatch - check against iteration threshold
2193
2193
  (typeof (deepCopy === null || deepCopy === void 0 ? void 0 : deepCopy.threshold) === 'number' && iteration >= deepCopy.threshold)) {
2194
2194
  return sourceObject;
2195
2195
  }
2196
- var devContext = getDevContext({ makeDeepCopy: true });
2197
- if (devContext) {
2198
- setDeepCopyIterations(iteration);
2199
- if (typeof devContext === 'object' &&
2200
- (iteration > (devContext.iterationThreshold || 15) ||
2201
- (devContext.firstIteration && iteration === 0)) &&
2202
- devContext.log &&
2203
- (!devContext.notInternalUse ||
2204
- (devContext.notInternalUse && !internalUse))) {
2205
- console.log({ devContext: devContext, iteration: iteration, internalUse: internalUse }, sourceObject);
2206
- }
2207
- }
2208
2196
  var targetObject = Array.isArray(sourceObject) ? [] : {};
2209
2197
  var sourceObjectKeys = Object.keys(sourceObject).filter(function (key) {
2210
2198
  return !internalUse ||
@@ -2958,7 +2946,7 @@ var matchUpFormatCode = {
2958
2946
  };
2959
2947
 
2960
2948
  function factoryVersion() {
2961
- return '1.9.1';
2949
+ return '1.9.3';
2962
2950
  }
2963
2951
 
2964
2952
  function getObjectTieFormat(obj) {
@@ -11712,8 +11700,8 @@ var toBePlayed = {
11712
11700
  };
11713
11701
 
11714
11702
  function modifyMatchUpScore(_a) {
11715
- var _b, e_1, _c;
11716
- var _d, _e, _f, _g, _h, _j, _k, _l;
11703
+ var e_1, _b;
11704
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l;
11717
11705
  var matchUpStatusCodes = _a.matchUpStatusCodes, removeWinningSide = _a.removeWinningSide, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, matchUpFormat = _a.matchUpFormat, matchUpStatus = _a.matchUpStatus, removeScore = _a.removeScore, winningSide = _a.winningSide, matchUpId = _a.matchUpId, matchUp = _a.matchUp, // matchUp without context
11718
11706
  event = _a.event, notes = _a.notes, score = _a.score;
11719
11707
  var stack = 'modifyMatchUpScore';
@@ -11770,16 +11758,16 @@ function modifyMatchUpScore(_a) {
11770
11758
  matchUp.matchUpStatus = MatchUpStatusEnum.InProgress;
11771
11759
  }
11772
11760
  var defaultedProcessCodes;
11773
- if ((wasDefaulted && ((_d = matchUp === null || matchUp === void 0 ? void 0 : matchUp.processCodes) === null || _d === void 0 ? void 0 : _d.length)) ||
11761
+ if ((wasDefaulted && ((_c = matchUp === null || matchUp === void 0 ? void 0 : matchUp.processCodes) === null || _c === void 0 ? void 0 : _c.length)) ||
11774
11762
  matchUpStatus === DEFAULTED) {
11775
- var appliedPolicies = (_e = getAppliedPolicies({
11763
+ var appliedPolicies = (_d = getAppliedPolicies({
11776
11764
  tournamentRecord: tournamentRecord,
11777
11765
  drawDefinition: drawDefinition,
11778
11766
  structure: structure,
11779
11767
  event: event,
11780
- })) === null || _e === void 0 ? void 0 : _e.appliedPolicies;
11768
+ })) === null || _d === void 0 ? void 0 : _d.appliedPolicies;
11781
11769
  defaultedProcessCodes =
11782
- (_g = (_f = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_SCORING]) === null || _f === void 0 ? void 0 : _f.processCodes) === null || _g === void 0 ? void 0 : _g.incompleteAssignmentsOnDefault;
11770
+ (_f = (_e = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_SCORING]) === null || _e === void 0 ? void 0 : _e.processCodes) === null || _f === void 0 ? void 0 : _f.incompleteAssignmentsOnDefault;
11783
11771
  }
11784
11772
  if (!matchUp.collectionId) {
11785
11773
  var isRoundRobin = (structure === null || structure === void 0 ? void 0 : structure.structureType) === CONTAINER;
@@ -11838,7 +11826,7 @@ function modifyMatchUpScore(_a) {
11838
11826
  var matchUpsMap = (sendInContext || defaultedProcessCodes) &&
11839
11827
  getMatchUpsMap({ drawDefinition: drawDefinition });
11840
11828
  var inContextMatchUp = matchUpsMap &&
11841
- ((_h = getAllDrawMatchUps({
11829
+ ((_g = getAllDrawMatchUps({
11842
11830
  // client will not normally be receiving participants for the first time...
11843
11831
  // ... and should therefore already have groupings / ratings / rankings for participants
11844
11832
  // participantsProfile: { withGroupings: true },
@@ -11848,23 +11836,18 @@ function modifyMatchUpScore(_a) {
11848
11836
  inContext: true,
11849
11837
  drawDefinition: drawDefinition,
11850
11838
  matchUpsMap: matchUpsMap,
11851
- }).matchUps) === null || _h === void 0 ? void 0 : _h[0]);
11839
+ }).matchUps) === null || _g === void 0 ? void 0 : _g[0]);
11852
11840
  if (sendInContext && inContextMatchUp) {
11853
11841
  updateInContextMatchUp({ tournamentId: tournamentId, inContextMatchUp: inContextMatchUp });
11854
11842
  }
11855
11843
  if (Array.isArray(defaultedProcessCodes) &&
11856
11844
  inContextMatchUp &&
11857
- !((_j = inContextMatchUp.sides) === null || _j === void 0 ? void 0 : _j.every(function (_a) {
11845
+ !((_h = inContextMatchUp.sides) === null || _h === void 0 ? void 0 : _h.every(function (_a) {
11858
11846
  var participantId = _a.participantId;
11859
11847
  return participantId;
11860
11848
  }))) {
11861
11849
  if (matchUpStatus === DEFAULTED) {
11862
- if (matchUp.processCodes) {
11863
- (_b = matchUp.processCodes).push.apply(_b, __spreadArray([], __read(defaultedProcessCodes), false));
11864
- }
11865
- else {
11866
- matchUp.processCodes = defaultedProcessCodes;
11867
- }
11850
+ matchUp.processCodes = unique(__spreadArray(__spreadArray([], __read(((_j = matchUp.processCodes) !== null && _j !== void 0 ? _j : [])), false), __read(defaultedProcessCodes), false));
11868
11851
  }
11869
11852
  else {
11870
11853
  try {
@@ -11878,7 +11861,7 @@ function modifyMatchUpScore(_a) {
11878
11861
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
11879
11862
  finally {
11880
11863
  try {
11881
- if (_o && !_o.done && (_c = _m.return)) _c.call(_m);
11864
+ if (_o && !_o.done && (_b = _m.return)) _b.call(_m);
11882
11865
  }
11883
11866
  finally { if (e_1) throw e_1.error; }
11884
11867
  }
@@ -16781,8 +16764,51 @@ var positionActionConstants = {
16781
16764
  };
16782
16765
 
16783
16766
  var _a$e;
16784
- var POLICY_POSITION_ACTIONS_DEFAULT = (_a$e = {},
16767
+ var POLICY_POSITION_ACTIONS_UNRESTRICTED = (_a$e = {},
16785
16768
  _a$e[POLICY_TYPE_POSITION_ACTIONS] = {
16769
+ policyName: 'positionActionsUnrestricted',
16770
+ // positionActions will be selectively enabled for structures matching { stages: [], stageSequences: [], structureTypes: [] }
16771
+ // enabledStructures: [] => all structures are enabled
16772
+ enabledStructures: [],
16773
+ // enables entries in other flights to be accessed as alternates
16774
+ otherFlightEntries: true,
16775
+ // enables entries with multiple qualifying roundTargets to be placed in any round
16776
+ disableRoundRestrictions: true,
16777
+ // enable specific actions even when there are active positions
16778
+ activePositionOverrides: [SEED_VALUE, REMOVE_SEED],
16779
+ },
16780
+ _a$e);
16781
+
16782
+ var _a$d;
16783
+ var POLICY_POSITION_ACTIONS_NO_MOVEMENT = (_a$d = {},
16784
+ _a$d[POLICY_TYPE_POSITION_ACTIONS] = {
16785
+ policyName: 'positionActionsNoMovement',
16786
+ // positionActions will be selectively enabled for structures matching { stages: [], stageSequences: [] }
16787
+ // enabledStructures: [] => all structures are enabled
16788
+ enabledStructures: [
16789
+ {
16790
+ stages: [], // stages: [] => applies to all stages
16791
+ stageSequences: [], // stageSequences: [] => applies to all stageSequences
16792
+ enabledActions: [SEED_VALUE, ADD_NICKNAME, ADD_PENALTY],
16793
+ disabledActions: [], // disabledActions: [] => no actions are disabled
16794
+ },
16795
+ ],
16796
+ },
16797
+ _a$d);
16798
+
16799
+ var _a$c;
16800
+ var POLICY_POSITION_ACTIONS_DISABLED = (_a$c = {},
16801
+ _a$c[POLICY_TYPE_POSITION_ACTIONS] = {
16802
+ policyName: 'positionActionsDisabled',
16803
+ // positionActions will be selectively enabled for structures matching { stages: [], stageSequences: [], structureTypes: [] }
16804
+ // enabledStructures: [] => all structures are enabled
16805
+ enabledStructures: false,
16806
+ },
16807
+ _a$c);
16808
+
16809
+ var _a$b;
16810
+ var POLICY_POSITION_ACTIONS_DEFAULT = (_a$b = {},
16811
+ _a$b[POLICY_TYPE_POSITION_ACTIONS] = {
16786
16812
  policyName: 'positionActionsDefault',
16787
16813
  // positionActions will be selectively enabled for structures matching { stages: [], stageSequences: [] }
16788
16814
  // enabledStructures: [] => all structures are enabled
@@ -16813,137 +16839,15 @@ var POLICY_POSITION_ACTIONS_DEFAULT = (_a$e = {},
16813
16839
  // enable specific actions even when there are active positions
16814
16840
  activePositionOverrides: [],
16815
16841
  },
16816
- _a$e);
16817
-
16818
- var _a$d;
16819
- var POLICY_POSITION_ACTIONS_DISABLED = (_a$d = {},
16820
- _a$d[POLICY_TYPE_POSITION_ACTIONS] = {
16821
- policyName: 'positionActionsDisabled',
16822
- // positionActions will be selectively enabled for structures matching { stages: [], stageSequences: [], structureTypes: [] }
16823
- // enabledStructures: [] => all structures are enabled
16824
- enabledStructures: false,
16825
- },
16826
- _a$d);
16827
-
16828
- var _a$c;
16829
- var POLICY_POSITION_ACTIONS_NO_MOVEMENT = (_a$c = {},
16830
- _a$c[POLICY_TYPE_POSITION_ACTIONS] = {
16831
- policyName: 'positionActionsNoMovement',
16832
- // positionActions will be selectively enabled for structures matching { stages: [], stageSequences: [] }
16833
- // enabledStructures: [] => all structures are enabled
16834
- enabledStructures: [
16835
- {
16836
- stages: [], // stages: [] => applies to all stages
16837
- stageSequences: [], // stageSequences: [] => applies to all stageSequences
16838
- enabledActions: [SEED_VALUE, ADD_NICKNAME, ADD_PENALTY],
16839
- disabledActions: [], // disabledActions: [] => no actions are disabled
16840
- },
16841
- ],
16842
- },
16843
- _a$c);
16844
-
16845
- var _a$b;
16846
- var POLICY_POSITION_ACTIONS_UNRESTRICTED = (_a$b = {},
16847
- _a$b[POLICY_TYPE_POSITION_ACTIONS] = {
16848
- policyName: 'positionActionsUnrestricted',
16849
- // positionActions will be selectively enabled for structures matching { stages: [], stageSequences: [], structureTypes: [] }
16850
- // enabledStructures: [] => all structures are enabled
16851
- enabledStructures: [],
16852
- // enables entries in other flights to be accessed as alternates
16853
- otherFlightEntries: true,
16854
- // enables entries with multiple qualifying roundTargets to be placed in any round
16855
- disableRoundRestrictions: true,
16856
- // enable specific actions even when there are active positions
16857
- activePositionOverrides: [SEED_VALUE, REMOVE_SEED],
16858
- },
16859
16842
  _a$b);
16860
16843
 
16861
- var _a$a;
16862
- var POLICY_PRIVACY_DEFAULT = (_a$a = {},
16863
- _a$a[POLICY_TYPE_PARTICIPANT] = {
16864
- policyName: 'Participant Privacy Policy',
16865
- participant: {
16866
- contacts: false,
16867
- individualParticipants: {
16868
- onlineResources: false,
16869
- participantName: true,
16870
- participantOtherName: true,
16871
- participantId: true,
16872
- participantRole: true,
16873
- participantStatus: true,
16874
- penalties: false,
16875
- representing: true,
16876
- participantRoleResponsibilities: false,
16877
- participantType: true,
16878
- person: {
16879
- addresses: false,
16880
- biographicalInformation: false,
16881
- birthDate: false,
16882
- contacts: false,
16883
- nationalityCode: true,
16884
- nativeFamilyName: false,
16885
- nativeGivenName: false,
16886
- onlineResources: false,
16887
- otherNames: true,
16888
- parentOrganisationId: false,
16889
- passportFamilyName: false,
16890
- passportGivenName: false,
16891
- personId: false,
16892
- personOtherIds: false,
16893
- previousNames: false,
16894
- sex: false,
16895
- standardFamilyName: true,
16896
- standardGivenName: true,
16897
- status: false,
16898
- tennisId: false,
16899
- wheelchair: true,
16900
- },
16901
- },
16902
- individualParticipantIds: true,
16903
- onlineResources: false,
16904
- participantName: true,
16905
- participantOtherName: true,
16906
- participantId: true,
16907
- participantRole: true,
16908
- participantStatus: true,
16909
- penalties: false,
16910
- representing: true,
16911
- participantRoleResponsibilities: false,
16912
- participantType: true,
16913
- person: {
16914
- addresses: false,
16915
- biographicalInformation: false,
16916
- birthDate: false,
16917
- contacts: false,
16918
- nationalityCode: true,
16919
- nativeFamilyName: false,
16920
- nativeGivenName: false,
16921
- onlineResources: false,
16922
- otherNames: true,
16923
- parentOrganisationId: false,
16924
- passportFamilyName: false,
16925
- passportGivenName: false,
16926
- personId: false,
16927
- personOtherIds: false,
16928
- previousNames: false,
16929
- sex: false,
16930
- standardFamilyName: true,
16931
- standardGivenName: true,
16932
- status: false,
16933
- tennisId: false,
16934
- wheelchair: true,
16935
- },
16936
- },
16937
- },
16938
- _a$a);
16939
-
16940
- var _a$9, _b$4, _c, _d, _e;
16844
+ var _a$a, _b$4, _c, _d, _e;
16941
16845
  // categoryTypes
16942
16846
  var ADULT = 'ADULT';
16943
16847
  var JUNIOR = 'JUNIOR';
16944
16848
  var WHEELCHAIR = 'WHEELCHAIR';
16945
- var POLICY_SCHEDULING_DEFAULT = (_a$9 = {},
16946
- _a$9[POLICY_TYPE_SCHEDULING] = {
16849
+ var POLICY_SCHEDULING_DEFAULT = (_a$a = {},
16850
+ _a$a[POLICY_TYPE_SCHEDULING] = {
16947
16851
  allowModificationWhenMatchUpsScheduled: {
16948
16852
  courts: false,
16949
16853
  venues: false,
@@ -17117,12 +17021,103 @@ var POLICY_SCHEDULING_DEFAULT = (_a$9 = {},
17117
17021
  ],
17118
17022
  matchUpDailyLimits: [],
17119
17023
  },
17024
+ _a$a);
17025
+
17026
+ var _a$9;
17027
+ var POLICY_PRIVACY_DEFAULT = (_a$9 = {},
17028
+ _a$9[POLICY_TYPE_PARTICIPANT] = {
17029
+ policyName: 'Participant Privacy Policy',
17030
+ participant: {
17031
+ contacts: false,
17032
+ individualParticipants: {
17033
+ onlineResources: false,
17034
+ participantName: true,
17035
+ participantOtherName: true,
17036
+ participantId: true,
17037
+ participantRole: true,
17038
+ participantStatus: true,
17039
+ penalties: false,
17040
+ representing: true,
17041
+ participantRoleResponsibilities: false,
17042
+ participantType: true,
17043
+ person: {
17044
+ addresses: false,
17045
+ biographicalInformation: false,
17046
+ birthDate: false,
17047
+ contacts: false,
17048
+ nationalityCode: true,
17049
+ nativeFamilyName: false,
17050
+ nativeGivenName: false,
17051
+ onlineResources: false,
17052
+ otherNames: true,
17053
+ parentOrganisationId: false,
17054
+ passportFamilyName: false,
17055
+ passportGivenName: false,
17056
+ personId: false,
17057
+ personOtherIds: false,
17058
+ previousNames: false,
17059
+ sex: false,
17060
+ standardFamilyName: true,
17061
+ standardGivenName: true,
17062
+ status: false,
17063
+ tennisId: false,
17064
+ wheelchair: true,
17065
+ },
17066
+ },
17067
+ individualParticipantIds: true,
17068
+ onlineResources: false,
17069
+ participantName: true,
17070
+ participantOtherName: true,
17071
+ participantId: true,
17072
+ participantRole: true,
17073
+ participantStatus: true,
17074
+ penalties: false,
17075
+ representing: true,
17076
+ participantRoleResponsibilities: false,
17077
+ participantType: true,
17078
+ person: {
17079
+ addresses: false,
17080
+ biographicalInformation: false,
17081
+ birthDate: false,
17082
+ contacts: false,
17083
+ nationalityCode: true,
17084
+ nativeFamilyName: false,
17085
+ nativeGivenName: false,
17086
+ onlineResources: false,
17087
+ otherNames: true,
17088
+ parentOrganisationId: false,
17089
+ passportFamilyName: false,
17090
+ passportGivenName: false,
17091
+ personId: false,
17092
+ personOtherIds: false,
17093
+ previousNames: false,
17094
+ sex: false,
17095
+ standardFamilyName: true,
17096
+ standardGivenName: true,
17097
+ status: false,
17098
+ tennisId: false,
17099
+ wheelchair: true,
17100
+ },
17101
+ },
17102
+ },
17120
17103
  _a$9);
17121
17104
 
17122
17105
  var _a$8, _b$3;
17123
- var POLICY_SCORING_USTA = (_a$8 = {},
17106
+ /**
17107
+ * without a SCORING_POLICY which sets { requireAllPositionsAssigned: false }, all stage:MAIN, stageSequence:1 drawPositions must be assigned **BEFORE** scoring is enabled,
17108
+ * scoring is enabled in consolation and compass/playoff structures when not all drawPositions have been filled
17109
+ */
17110
+ var POLICY_SCORING_DEFAULT = (_a$8 = {},
17124
17111
  _a$8[POLICY_TYPE_SCORING] = {
17112
+ defaultMatchUpFormat: FORMAT_STANDARD,
17113
+ allowDeletionWithScoresPresent: {
17114
+ drawDefinitions: false,
17115
+ structures: false,
17116
+ },
17125
17117
  requireAllPositionsAssigned: false,
17118
+ processCodes: {
17119
+ incompleteAssignmentsOnDefault: ['RANKING.IGNORE'],
17120
+ },
17126
17121
  stage: (_b$3 = {},
17127
17122
  _b$3[MAIN] = {
17128
17123
  stageSequence: {
@@ -17132,6 +17127,22 @@ var POLICY_SCORING_USTA = (_a$8 = {},
17132
17127
  },
17133
17128
  },
17134
17129
  _b$3),
17130
+ },
17131
+ _a$8);
17132
+
17133
+ var _a$7, _b$2;
17134
+ var POLICY_SCORING_USTA = (_a$7 = {},
17135
+ _a$7[POLICY_TYPE_SCORING] = {
17136
+ requireAllPositionsAssigned: false,
17137
+ stage: (_b$2 = {},
17138
+ _b$2[MAIN] = {
17139
+ stageSequence: {
17140
+ 1: {
17141
+ requireAllPositionsAssigned: true,
17142
+ },
17143
+ },
17144
+ },
17145
+ _b$2),
17135
17146
  defaultMatchUpFormat: FORMAT_STANDARD,
17136
17147
  matchUpFormats: [
17137
17148
  {
@@ -17214,75 +17225,47 @@ var POLICY_SCORING_USTA = (_a$8 = {},
17214
17225
  },
17215
17226
  ],
17216
17227
  },
17217
- _a$8);
17218
-
17219
- var _a$7, _b$2;
17220
- /**
17221
- * without a SCORING_POLICY which sets { requireAllPositionsAssigned: false }, all stage:MAIN, stageSequence:1 drawPositions must be assigned **BEFORE** scoring is enabled,
17222
- * scoring is enabled in consolation and compass/playoff structures when not all drawPositions have been filled
17223
- */
17224
- var POLICY_SCORING_DEFAULT = (_a$7 = {},
17225
- _a$7[POLICY_TYPE_SCORING] = {
17226
- defaultMatchUpFormat: FORMAT_STANDARD,
17227
- allowDeletionWithScoresPresent: {
17228
- drawDefinitions: false,
17229
- structures: false,
17230
- },
17231
- requireAllPositionsAssigned: false,
17232
- processCodes: {
17233
- incompleteAssignmentsOnDefault: ['RANKING.IGNORE'],
17234
- },
17235
- stage: (_b$2 = {},
17236
- _b$2[MAIN] = {
17237
- stageSequence: {
17238
- 1: {
17239
- requireAllPositionsAssigned: true,
17240
- },
17241
- },
17242
- },
17243
- _b$2),
17244
- },
17245
17228
  _a$7);
17246
17229
 
17247
- var _a$6;
17248
- var POLICY_SEEDING_ITF = (_a$6 = {},
17230
+ var _a$6, _b$1;
17231
+ var POLICY_SEEDING_DEFAULT = (_a$6 = {},
17249
17232
  _a$6[POLICY_TYPE_SEEDING] = {
17250
- seedingProfile: { positioning: CLUSTER },
17251
17233
  validSeedPositions: { ignore: true },
17252
17234
  duplicateSeedNumbers: true,
17253
17235
  drawSizeProgression: true,
17254
- policyName: 'ITF SEEDING',
17236
+ seedingProfile: {
17237
+ drawTypes: (_b$1 = {},
17238
+ _b$1[ROUND_ROBIN_WITH_PLAYOFF] = { positioning: WATERFALL },
17239
+ _b$1[ROUND_ROBIN] = { positioning: WATERFALL },
17240
+ _b$1),
17241
+ positioning: SEPARATE,
17242
+ },
17243
+ policyName: 'USTA SEEDING',
17255
17244
  seedsCountThresholds: [
17256
17245
  { drawSize: 4, minimumParticipantCount: 3, seedsCount: 2 },
17257
17246
  { drawSize: 16, minimumParticipantCount: 12, seedsCount: 4 },
17258
17247
  { drawSize: 32, minimumParticipantCount: 24, seedsCount: 8 },
17259
17248
  { drawSize: 64, minimumParticipantCount: 48, seedsCount: 16 },
17260
- { drawSize: 128, minimumParticipantCount: 97, seedsCount: 32 },
17249
+ { drawSize: 128, minimumParticipantCount: 96, seedsCount: 32 },
17261
17250
  { drawSize: 256, minimumParticipantCount: 192, seedsCount: 64 },
17262
17251
  ],
17263
17252
  },
17264
17253
  _a$6);
17265
17254
 
17266
- var _a$5, _b$1;
17267
- var POLICY_SEEDING_USTA = (_a$5 = {},
17255
+ var _a$5;
17256
+ var POLICY_SEEDING_ITF = (_a$5 = {},
17268
17257
  _a$5[POLICY_TYPE_SEEDING] = {
17258
+ seedingProfile: { positioning: CLUSTER },
17269
17259
  validSeedPositions: { ignore: true },
17270
17260
  duplicateSeedNumbers: true,
17271
17261
  drawSizeProgression: true,
17272
- seedingProfile: {
17273
- drawTypes: (_b$1 = {},
17274
- _b$1[ROUND_ROBIN_WITH_PLAYOFF] = { positioning: WATERFALL },
17275
- _b$1[ROUND_ROBIN] = { positioning: WATERFALL },
17276
- _b$1),
17277
- positioning: SEPARATE,
17278
- },
17279
- policyName: 'USTA SEEDING',
17262
+ policyName: 'ITF SEEDING',
17280
17263
  seedsCountThresholds: [
17281
17264
  { drawSize: 4, minimumParticipantCount: 3, seedsCount: 2 },
17282
17265
  { drawSize: 16, minimumParticipantCount: 12, seedsCount: 4 },
17283
17266
  { drawSize: 32, minimumParticipantCount: 24, seedsCount: 8 },
17284
17267
  { drawSize: 64, minimumParticipantCount: 48, seedsCount: 16 },
17285
- { drawSize: 128, minimumParticipantCount: 96, seedsCount: 32 },
17268
+ { drawSize: 128, minimumParticipantCount: 97, seedsCount: 32 },
17286
17269
  { drawSize: 256, minimumParticipantCount: 192, seedsCount: 64 },
17287
17270
  ],
17288
17271
  },
@@ -17300,7 +17283,7 @@ var policies = {
17300
17283
  POLICY_SCORING_DEFAULT: POLICY_SCORING_DEFAULT,
17301
17284
  POLICY_SCORING_USTA: POLICY_SCORING_USTA,
17302
17285
  POLICY_SEEDING_ITF: POLICY_SEEDING_ITF,
17303
- POLICY_SEEDING_USTA: POLICY_SEEDING_USTA,
17286
+ POLICY_SEEDING_DEFAULT: POLICY_SEEDING_DEFAULT,
17304
17287
  };
17305
17288
 
17306
17289
  var fixtures = {
@@ -29168,6 +29151,43 @@ function updateFactoryExtension(_a) {
29168
29151
  addExtension$1({ element: tournamentRecord, extension: updatedExtension });
29169
29152
  }
29170
29153
 
29154
+ function engineLogging(_a) {
29155
+ var _b, _c;
29156
+ var methodName = _a.methodName, elapsed = _a.elapsed, engine = _a.engine, params = _a.params, result = _a.result;
29157
+ var devContext = getDevContext();
29158
+ if (typeof devContext !== 'object')
29159
+ return;
29160
+ var log = { method: methodName };
29161
+ var logError = (result === null || result === void 0 ? void 0 : result.error) &&
29162
+ (devContext.errors === true ||
29163
+ (Array.isArray(devContext.errors) &&
29164
+ devContext.errors.includes(methodName)));
29165
+ var specifiedMethodParams = Array.isArray(devContext.params) && ((_b = devContext.params) === null || _b === void 0 ? void 0 : _b.includes(methodName));
29166
+ var logParams = (devContext.params && !Array.isArray(devContext.params)) ||
29167
+ specifiedMethodParams;
29168
+ var exclude = Array.isArray(devContext.exclude) &&
29169
+ devContext.exclude.includes(methodName);
29170
+ if (!exclude &&
29171
+ ![undefined, false].includes(devContext.perf) &&
29172
+ (isNaN(devContext.perf) || elapsed > devContext.perf)) {
29173
+ log.elapsed = elapsed;
29174
+ }
29175
+ if (!exclude && (logError || logParams)) {
29176
+ log.params = params;
29177
+ }
29178
+ if (!exclude &&
29179
+ (logError ||
29180
+ (devContext.result &&
29181
+ !Array.isArray(devContext.result) &&
29182
+ (!Array.isArray(devContext.params) || specifiedMethodParams)) ||
29183
+ (Array.isArray(devContext.result) &&
29184
+ ((_c = devContext.result) === null || _c === void 0 ? void 0 : _c.includes(methodName))))) {
29185
+ log.result = result;
29186
+ }
29187
+ if (Object.keys(log).length > 1)
29188
+ globalLog$1(engine, log);
29189
+ }
29190
+
29171
29191
  var _a$2;
29172
29192
  function notifySubscribers(params) {
29173
29193
  var e_1, _a;
@@ -44098,42 +44118,6 @@ function setState$4(records, deepCopyOption) {
44098
44118
  return setTournamentRecords(deepCopyOption ? makeDeepCopy(records) : records);
44099
44119
  }
44100
44120
 
44101
- function engineLogging(_a) {
44102
- var _b, _c;
44103
- var result = _a.result, methodName = _a.methodName, elapsed = _a.elapsed, params = _a.params, engine = _a.engine;
44104
- var devContext = getDevContext();
44105
- var log = { method: methodName };
44106
- var logError = (result === null || result === void 0 ? void 0 : result.error) &&
44107
- (devContext.errors === true ||
44108
- (Array.isArray(devContext.errors) &&
44109
- devContext.errors.includes(methodName)));
44110
- var specifiedMethodParams = Array.isArray(devContext.params) && ((_b = devContext.params) === null || _b === void 0 ? void 0 : _b.includes(methodName));
44111
- var logParams = (devContext.params && !Array.isArray(devContext.params)) ||
44112
- specifiedMethodParams;
44113
- var exclude = Array.isArray(devContext.exclude) &&
44114
- devContext.exclude.includes(methodName);
44115
- if (!exclude &&
44116
- ![undefined, false].includes(devContext.perf) &&
44117
- (isNaN(devContext.perf) || elapsed > devContext.perf))
44118
- log.elapsed = elapsed;
44119
- if (!exclude && (logError || logParams)) {
44120
- log.params = params;
44121
- }
44122
- if (!exclude &&
44123
- (logError ||
44124
- (devContext.result &&
44125
- !Array.isArray(devContext.result) &&
44126
- (!Array.isArray(devContext.params) || specifiedMethodParams)) ||
44127
- (Array.isArray(devContext.result) &&
44128
- ((_c = devContext.result) === null || _c === void 0 ? void 0 : _c.includes(methodName))))) {
44129
- log.result = result;
44130
- }
44131
- if (Object.keys(log).length > 1)
44132
- globalLog$1(engine, log);
44133
- if (result && devContext.makeDeepCopy)
44134
- result.deepCopyIterations = getDeepCopyIterations();
44135
- }
44136
-
44137
44121
  var competitionEngine = (function () {
44138
44122
  var engine = {
44139
44123
  getState: function (params) {
@@ -44263,11 +44247,11 @@ var competitionEngine = (function () {
44263
44247
  }
44264
44248
  function executionQueue(directives, rollbackOnError) {
44265
44249
  var e_1, _a;
44266
- var _b;
44267
44250
  if (!Array.isArray(directives))
44268
44251
  return { error: INVALID_VALUES };
44269
44252
  var tournamentRecords = getTournamentRecords();
44270
44253
  var activeTournamentId = getTournamentId();
44254
+ var start = Date.now();
44271
44255
  var snapshot = rollbackOnError && makeDeepCopy(tournamentRecords, false, true);
44272
44256
  var timeStamp;
44273
44257
  var results = [];
@@ -44279,12 +44263,8 @@ var competitionEngine = (function () {
44279
44263
  var methodName = directive.method, params = directive.params;
44280
44264
  if (!engine[methodName]) {
44281
44265
  var result_1 = { error: METHOD_NOT_FOUND, methodName: methodName };
44282
- var devContext = getDevContext();
44283
- if ((devContext.result && !Array.isArray(devContext.result)) ||
44284
- (Array.isArray(devContext.result) &&
44285
- ((_b = devContext.result) === null || _b === void 0 ? void 0 : _b.includes(methodName)))) {
44286
- console.log('ce:', result_1);
44287
- }
44266
+ var elapsed = Date.now() - start;
44267
+ engineLogging({ result: result_1, methodName: methodName, elapsed: elapsed, params: params, engine: 'ce:' });
44288
44268
  return result_1;
44289
44269
  }
44290
44270
  var result_2 = executeFunction(tournamentRecords, engine[methodName], __assign({ activeTournamentId: activeTournamentId }, params), methodName);
@@ -47094,17 +47074,6 @@ function getUnplacedParticipantIds(_a) {
47094
47074
  return participantIds.filter(function (participantId) { return !assignedParticipantIds.includes(participantId); });
47095
47075
  }
47096
47076
 
47097
- /**
47098
- *
47099
- * @param {string[]} targetParticipantIds - participantIds to be processed
47100
- * @param {string} groupKey - OPTIONAL - specify default grouping
47101
- *
47102
- * @param {boolean=} useSpecifiedGroupKey - defaults to false; use specified group key, if present
47103
- * @param {boolean=} largestFirst - defaults to true; return participantId from groupings with largest number of participantIds
47104
- *
47105
- * Creates groupings of participantIds based on policyAttributes
47106
- * Returns a participantId at random from either the specified group, the largest group, or a randomly selected group
47107
- */
47108
47077
  function getNextParticipantId(_a) {
47109
47078
  var _b;
47110
47079
  var _c = _a.useSpecifiedGroupKey, useSpecifiedGroupKey = _c === void 0 ? false : _c, targetParticipantIds = _a.targetParticipantIds, _d = _a.largestFirst, largestFirst = _d === void 0 ? true : _d, allGroups = _a.allGroups, groupKey = _a.groupKey;
@@ -47476,11 +47445,12 @@ function randomUnseededSeparation(_a) {
47476
47445
  idCollections: idCollections,
47477
47446
  participants: participants,
47478
47447
  });
47448
+ if (allGroups.error) {
47449
+ return decorateResult({ result: allGroups, stack: stack });
47450
+ }
47479
47451
  var participantIdGroups = Object.assign.apply(Object, __spreadArray([{}], __read(unseededParticipantIds.map(function (participantId) {
47480
47452
  var _a;
47481
- var groups = Object.keys(allGroups).filter(function (key) {
47482
- return allGroups[key].includes(participantId);
47483
- });
47453
+ var groups = Object.keys(allGroups).filter(function (key) { var _a; return ((_a = allGroups[key]) !== null && _a !== void 0 ? _a : []).includes(participantId); });
47484
47454
  return _a = {}, _a[participantId] = groups, _a;
47485
47455
  })), false));
47486
47456
  var unplacedParticipantIds = getUnplacedParticipantIds({
@@ -47651,7 +47621,7 @@ function positionUnseededParticipants(_a) {
47651
47621
  drawDefinition: drawDefinition,
47652
47622
  event: event,
47653
47623
  }).appliedPolicies;
47654
- var avoidance = (appliedPolicies !== null && appliedPolicies !== void 0 ? appliedPolicies : {})[POLICY_TYPE_AVOIDANCE];
47624
+ var avoidance = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_AVOIDANCE];
47655
47625
  if (structure.stage === PLAY_OFF) {
47656
47626
  // generate avoidance policies automatically for Playoffs from Round Robin Groups
47657
47627
  var groupings = entries.reduce(function (groupings, entry) {
@@ -53524,7 +53494,7 @@ var matchUpGovernor = {
53524
53494
 
53525
53495
  function attachPolicies(_a) {
53526
53496
  var _b, _c;
53527
- var drawDefinition = _a.drawDefinition, policyDefinitions = _a.policyDefinitions;
53497
+ var policyDefinitions = _a.policyDefinitions, drawDefinition = _a.drawDefinition;
53528
53498
  if (!drawDefinition) {
53529
53499
  return { error: MISSING_DRAW_DEFINITION };
53530
53500
  }
@@ -61410,11 +61380,9 @@ function replaceTieMatchUpParticipantId(params) {
61410
61380
  }
61411
61381
  if (substitution || ((_u = side.substitutions) === null || _u === void 0 ? void 0 : _u.length) === 1) {
61412
61382
  if (substitution) {
61413
- var processCodes = (_v = tieMatchUp === null || tieMatchUp === void 0 ? void 0 : tieMatchUp.processCodes) !== null && _v !== void 0 ? _v : [];
61414
- if (substitutionProcessCodes)
61415
- processCodes.push.apply(processCodes, __spreadArray([], __read(substitutionProcessCodes), false));
61416
- if (tieMatchUp)
61417
- tieMatchUp.processCodes = processCodes;
61383
+ if (substitutionProcessCodes && tieMatchUp) {
61384
+ tieMatchUp.processCodes = unique(__spreadArray(__spreadArray([], __read(((_v = tieMatchUp === null || tieMatchUp === void 0 ? void 0 : tieMatchUp.processCodes) !== null && _v !== void 0 ? _v : [])), false), __read(substitutionProcessCodes), false));
61385
+ }
61418
61386
  }
61419
61387
  else {
61420
61388
  try {
@@ -65033,54 +65001,56 @@ function prepareStage(params) {
65033
65001
  }
65034
65002
 
65035
65003
  function generateDrawDefinition(params) {
65036
- var e_1, _a, e_2, _b, e_3, _c, e_4, _d, _e, e_5, _f, e_6, _g, _h;
65037
- var _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33;
65004
+ var _a, e_1, _b, e_2, _c, e_3, _d, e_4, _e, _f, e_5, _g, e_6, _h, _j;
65005
+ var _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34;
65038
65006
  var stack = 'generateDrawDefinition';
65039
- var _34 = params.considerEventEntries, considerEventEntries = _34 === void 0 ? true : _34, // in the absence of drawSize and drawEntries, look to event.entries
65007
+ var _35 = params.considerEventEntries, considerEventEntries = _35 === void 0 ? true : _35, // in the absence of drawSize and drawEntries, look to event.entries
65040
65008
  ignoreAllowedDrawTypes = params.ignoreAllowedDrawTypes, voluntaryConsolation = params.voluntaryConsolation, hydrateCollections = params.hydrateCollections, ignoreStageSpace = params.ignoreStageSpace, tournamentRecord = params.tournamentRecord, qualifyingOnly = params.qualifyingOnly, tieFormatName = params.tieFormatName, drawEntries = params.drawEntries, addToEvent = params.addToEvent, placeByes = params.placeByes, event = params.event;
65041
- var appliedPolicies = (_j = getAppliedPolicies({
65009
+ var appliedPolicies = (_k = getAppliedPolicies({
65042
65010
  tournamentRecord: tournamentRecord,
65043
65011
  event: event,
65044
- }).appliedPolicies) !== null && _j !== void 0 ? _j : {};
65045
- var policyDefinitions = makeDeepCopy((_k = params.policyDefinitions) !== null && _k !== void 0 ? _k : {}, false, true);
65046
- var drawTypeCoercion = (_q = (_o = (_l = params.drawTypeCoercion) !== null && _l !== void 0 ? _l : (_m = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_DRAWS]) === null || _m === void 0 ? void 0 : _m.drawTypeCoercion) !== null && _o !== void 0 ? _o : (_p = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_DRAWS]) === null || _p === void 0 ? void 0 : _p.drawTypeCoercion) !== null && _q !== void 0 ? _q : true;
65012
+ }).appliedPolicies) !== null && _k !== void 0 ? _k : {};
65013
+ var policyDefinitions = makeDeepCopy((_l = params.policyDefinitions) !== null && _l !== void 0 ? _l : {}, false, true);
65014
+ var drawTypeCoercion = (_r = (_p = (_m = params.drawTypeCoercion) !== null && _m !== void 0 ? _m : (_o = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_DRAWS]) === null || _o === void 0 ? void 0 : _o.drawTypeCoercion) !== null && _p !== void 0 ? _p : (_q = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_DRAWS]) === null || _q === void 0 ? void 0 : _q.drawTypeCoercion) !== null && _r !== void 0 ? _r : true;
65047
65015
  var drawType = (drawTypeCoercion &&
65048
65016
  params.drawSize === 2 &&
65049
65017
  DrawTypeEnum.SingleElimination) ||
65050
65018
  params.drawType ||
65051
65019
  DrawTypeEnum.SingleElimination;
65052
- var seedingPolicy = (_r = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_SEEDING]) !== null && _r !== void 0 ? _r : appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_SEEDING];
65053
- var seedingProfile = (_v = (_s = params.seedingProfile) !== null && _s !== void 0 ? _s : (_u = (_t = seedingPolicy === null || seedingPolicy === void 0 ? void 0 : seedingPolicy.seedingProfile) === null || _t === void 0 ? void 0 : _t.drawTypes) === null || _u === void 0 ? void 0 : _u[drawType]) !== null && _v !== void 0 ? _v : seedingPolicy === null || seedingPolicy === void 0 ? void 0 : seedingPolicy.seedingProfile;
65020
+ var seedingPolicy = (_s = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_SEEDING]) !== null && _s !== void 0 ? _s : appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_SEEDING];
65021
+ var seedingProfile = (_w = (_t = params.seedingProfile) !== null && _t !== void 0 ? _t : (_v = (_u = seedingPolicy === null || seedingPolicy === void 0 ? void 0 : seedingPolicy.seedingProfile) === null || _u === void 0 ? void 0 : _u.drawTypes) === null || _v === void 0 ? void 0 : _v[drawType]) !== null && _w !== void 0 ? _w : seedingPolicy === null || seedingPolicy === void 0 ? void 0 : seedingPolicy.seedingProfile;
65054
65022
  // extend policyDefinitions only if a seedingProfile was specified in params
65055
65023
  if (params.seedingProfile) {
65056
65024
  if (!policyDefinitions[POLICY_TYPE_SEEDING]) {
65057
- policyDefinitions[POLICY_TYPE_SEEDING] = __assign({}, POLICY_SEEDING_USTA[POLICY_TYPE_SEEDING]);
65025
+ policyDefinitions[POLICY_TYPE_SEEDING] = __assign({}, POLICY_SEEDING_DEFAULT[POLICY_TYPE_SEEDING]);
65058
65026
  }
65059
65027
  policyDefinitions[POLICY_TYPE_SEEDING].seedingProfile = seedingProfile;
65060
65028
  }
65061
65029
  // get participants both for entry validation and for automated placement
65062
65030
  // automated placement requires them to be "inContext" for avoidance policies to work
65063
- var _35 = getParticipants$1({
65031
+ var _36 = getParticipants$1({
65064
65032
  withIndividualParticipants: true,
65033
+ convertExtensions: true,
65034
+ internalUse: true,
65065
65035
  tournamentRecord: tournamentRecord,
65066
- }), participants = _35.participants, participantMap = _35.participantMap;
65067
- var enforceGender = (_z = (_w = params.enforceGender) !== null && _w !== void 0 ? _w : (_y = (_x = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_MATCHUP_ACTIONS]) === null || _x === void 0 ? void 0 : _x.participants) === null || _y === void 0 ? void 0 : _y.enforceGender) !== null && _z !== void 0 ? _z : (_1 = (_0 = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_MATCHUP_ACTIONS]) === null || _0 === void 0 ? void 0 : _0.participants) === null || _1 === void 0 ? void 0 : _1.enforceGender;
65036
+ }), participants = _36.participants, participantMap = _36.participantMap;
65037
+ var enforceGender = (_0 = (_x = params.enforceGender) !== null && _x !== void 0 ? _x : (_z = (_y = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_MATCHUP_ACTIONS]) === null || _y === void 0 ? void 0 : _y.participants) === null || _z === void 0 ? void 0 : _z.enforceGender) !== null && _0 !== void 0 ? _0 : (_2 = (_1 = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_MATCHUP_ACTIONS]) === null || _1 === void 0 ? void 0 : _1.participants) === null || _2 === void 0 ? void 0 : _2.enforceGender;
65068
65038
  // if tournamentRecord is provided, and unless instructed to ignore valid types,
65069
65039
  // check for restrictions on allowed drawTypes
65070
65040
  var allowedDrawTypes = !ignoreAllowedDrawTypes &&
65071
65041
  tournamentRecord &&
65072
65042
  getAllowedDrawTypes({
65073
65043
  tournamentRecord: tournamentRecord,
65074
- categoryType: (_2 = event === null || event === void 0 ? void 0 : event.category) === null || _2 === void 0 ? void 0 : _2.categoryType,
65075
- categoryName: (_3 = event === null || event === void 0 ? void 0 : event.category) === null || _3 === void 0 ? void 0 : _3.categoryName,
65044
+ categoryType: (_3 = event === null || event === void 0 ? void 0 : event.category) === null || _3 === void 0 ? void 0 : _3.categoryType,
65045
+ categoryName: (_4 = event === null || event === void 0 ? void 0 : event.category) === null || _4 === void 0 ? void 0 : _4.categoryName,
65076
65046
  });
65077
65047
  if ((allowedDrawTypes === null || allowedDrawTypes === void 0 ? void 0 : allowedDrawTypes.length) && !allowedDrawTypes.includes(drawType)) {
65078
65048
  return decorateResult({ result: { error: INVALID_DRAW_TYPE }, stack: stack });
65079
65049
  }
65080
- var eventEntries = (_5 = (_4 = event === null || event === void 0 ? void 0 : event.entries) === null || _4 === void 0 ? void 0 : _4.filter(function (entry) {
65050
+ var eventEntries = (_6 = (_5 = event === null || event === void 0 ? void 0 : event.entries) === null || _5 === void 0 ? void 0 : _5.filter(function (entry) {
65081
65051
  return entry.entryStatus &&
65082
65052
  __spreadArray(__spreadArray([], __read(STRUCTURE_ENTERED_TYPES), false), [QUALIFIER], false).includes(entry.entryStatus);
65083
- })) !== null && _5 !== void 0 ? _5 : [];
65053
+ })) !== null && _6 !== void 0 ? _6 : [];
65084
65054
  var consideredEntries = ((qualifyingOnly && []) ||
65085
65055
  drawEntries ||
65086
65056
  (considerEventEntries ? eventEntries : [])).filter(function (_a) {
@@ -65124,12 +65094,12 @@ function generateDrawDefinition(params) {
65124
65094
  });
65125
65095
  }
65126
65096
  var seedsCount = typeof params.seedsCount !== 'number'
65127
- ? ensureInt((_6 = params.seedsCount) !== null && _6 !== void 0 ? _6 : 0)
65128
- : (_7 = params.seedsCount) !== null && _7 !== void 0 ? _7 : 0;
65097
+ ? ensureInt((_7 = params.seedsCount) !== null && _7 !== void 0 ? _7 : 0)
65098
+ : (_8 = params.seedsCount) !== null && _8 !== void 0 ? _8 : 0;
65129
65099
  var eventType = event === null || event === void 0 ? void 0 : event.eventType;
65130
- var matchUpType = (_8 = params.matchUpType) !== null && _8 !== void 0 ? _8 : eventType;
65100
+ var matchUpType = (_9 = params.matchUpType) !== null && _9 !== void 0 ? _9 : eventType;
65131
65101
  var existingDrawDefinition = params.drawId
65132
- ? (_9 = event === null || event === void 0 ? void 0 : event.drawDefinitions) === null || _9 === void 0 ? void 0 : _9.find(function (d) { return d.drawId === params.drawId; })
65102
+ ? (_10 = event === null || event === void 0 ? void 0 : event.drawDefinitions) === null || _10 === void 0 ? void 0 : _10.find(function (d) { return d.drawId === params.drawId; })
65133
65103
  : undefined;
65134
65104
  // drawDefinition cannot have both tieFormat and matchUpFormat
65135
65105
  var tieFormat = params.tieFormat, matchUpFormat = params.matchUpFormat;
@@ -65137,16 +65107,16 @@ function generateDrawDefinition(params) {
65137
65107
  if (matchUpType === TEAM$2 && eventType === TEAM$2) {
65138
65108
  // if there is an existingDrawDefinition which has a tieFormat on MAIN structure
65139
65109
  // use this tieFormat ONLY when no tieFormat is specified in params
65140
- var existingMainTieFormat = (_11 = (_10 = existingDrawDefinition === null || existingDrawDefinition === void 0 ? void 0 : existingDrawDefinition.structures) === null || _10 === void 0 ? void 0 : _10.find(function (_a) {
65110
+ var existingMainTieFormat = (_12 = (_11 = existingDrawDefinition === null || existingDrawDefinition === void 0 ? void 0 : existingDrawDefinition.structures) === null || _11 === void 0 ? void 0 : _11.find(function (_a) {
65141
65111
  var stage = _a.stage;
65142
65112
  return stage === MAIN;
65143
- })) === null || _11 === void 0 ? void 0 : _11.tieFormat;
65113
+ })) === null || _12 === void 0 ? void 0 : _12.tieFormat;
65144
65114
  tieFormat =
65145
65115
  tieFormat ||
65146
65116
  existingMainTieFormat ||
65147
65117
  // if tieFormatName is provided and it matches the name of the tieFormat attached to parent event...
65148
65118
  (tieFormatName &&
65149
- ((_12 = event === null || event === void 0 ? void 0 : event.tieFormat) === null || _12 === void 0 ? void 0 : _12.tieFormatName) === tieFormatName &&
65119
+ ((_13 = event === null || event === void 0 ? void 0 : event.tieFormat) === null || _13 === void 0 ? void 0 : _13.tieFormatName) === tieFormatName &&
65150
65120
  event.tieFormat) ||
65151
65121
  // if the tieFormatName is not found in the factory then will use default
65152
65122
  (tieFormatName &&
@@ -65202,7 +65172,7 @@ function generateDrawDefinition(params) {
65202
65172
  var result = checkTieFormat({ tieFormat: tieFormat });
65203
65173
  if (result.error)
65204
65174
  return decorateResult({ result: result, stack: stack });
65205
- drawDefinition.tieFormat = (_13 = result.tieFormat) !== null && _13 !== void 0 ? _13 : tieFormat;
65175
+ drawDefinition.tieFormat = (_14 = result.tieFormat) !== null && _14 !== void 0 ? _14 : tieFormat;
65206
65176
  }
65207
65177
  else if (matchUpFormat) {
65208
65178
  var result = setMatchUpFormat$1({
@@ -65222,6 +65192,12 @@ function generateDrawDefinition(params) {
65222
65192
  drawDefinition.matchUpType = matchUpType;
65223
65193
  }
65224
65194
  }
65195
+ // ---------------------------------------------------------------------------
65196
+ // Attach policies to the drawDefinition
65197
+ // if there is an avoidance policy on the event, it must be preserved in the drawDefinition
65198
+ // if there is an avoidance policy in policyDefinitions, it will override
65199
+ // avoidance policies on the event can be changed (if location used for UI)
65200
+ var policiesToAttach = __assign((_a = {}, _a[POLICY_TYPE_AVOIDANCE] = appliedPolicies[POLICY_TYPE_AVOIDANCE], _a), POLICY_SEEDING_DEFAULT);
65225
65201
  if (policyDefinitions) {
65226
65202
  if (typeof policyDefinitions !== 'object') {
65227
65203
  return decorateResult({
@@ -65231,10 +65207,9 @@ function generateDrawDefinition(params) {
65231
65207
  });
65232
65208
  }
65233
65209
  else {
65234
- var policiesToAttach = {};
65235
65210
  try {
65236
- for (var _36 = __values(Object.keys(policyDefinitions)), _37 = _36.next(); !_37.done; _37 = _36.next()) {
65237
- var key = _37.value;
65211
+ for (var _37 = __values(Object.keys(policyDefinitions)), _38 = _37.next(); !_38.done; _38 = _37.next()) {
65212
+ var key = _38.value;
65238
65213
  if (JSON.stringify(appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[key]) !==
65239
65214
  JSON.stringify(policyDefinitions[key])) {
65240
65215
  policiesToAttach[key] = policyDefinitions[key];
@@ -65244,7 +65219,7 @@ function generateDrawDefinition(params) {
65244
65219
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
65245
65220
  finally {
65246
65221
  try {
65247
- if (_37 && !_37.done && (_a = _36.return)) _a.call(_36);
65222
+ if (_38 && !_38.done && (_b = _37.return)) _b.call(_37);
65248
65223
  }
65249
65224
  finally { if (e_1) throw e_1.error; }
65250
65225
  }
@@ -65255,25 +65230,28 @@ function generateDrawDefinition(params) {
65255
65230
  }
65256
65231
  }
65257
65232
  }
65233
+ else if (policiesToAttach.avoidance) {
65234
+ attachPolicies({ drawDefinition: drawDefinition, policyDefinitions: policiesToAttach });
65235
+ }
65258
65236
  if (!appliedPolicies[POLICY_TYPE_SEEDING] &&
65259
65237
  !policyDefinitions[POLICY_TYPE_SEEDING]) {
65260
- attachPolicies({ drawDefinition: drawDefinition, policyDefinitions: POLICY_SEEDING_USTA });
65261
- Object.assign(appliedPolicies, POLICY_SEEDING_USTA);
65238
+ Object.assign(appliedPolicies, POLICY_SEEDING_DEFAULT);
65262
65239
  }
65240
+ // ---------------------------------------------------------------------------
65263
65241
  // find existing MAIN structureId if existingDrawDefinition
65264
- var structureId = (_15 = (_14 = existingDrawDefinition === null || existingDrawDefinition === void 0 ? void 0 : existingDrawDefinition.structures) === null || _14 === void 0 ? void 0 : _14.find(function (structure) { return structure.stage === MAIN && structure.stageSequence === 1; })) === null || _15 === void 0 ? void 0 : _15.structureId;
65242
+ var structureId = (_16 = (_15 = existingDrawDefinition === null || existingDrawDefinition === void 0 ? void 0 : existingDrawDefinition.structures) === null || _15 === void 0 ? void 0 : _15.find(function (structure) { return structure.stage === MAIN && structure.stageSequence === 1; })) === null || _16 === void 0 ? void 0 : _16.structureId;
65265
65243
  var entries = drawEntries !== null && drawEntries !== void 0 ? drawEntries : eventEntries;
65266
65244
  var positioningReports = [];
65267
65245
  var drawTypeResult;
65268
65246
  var conflicts = [];
65269
65247
  var generateQualifyingPlaceholder = params.qualifyingPlaceholder &&
65270
- !((_16 = params.qualifyingProfiles) === null || _16 === void 0 ? void 0 : _16.length) &&
65248
+ !((_17 = params.qualifyingProfiles) === null || _17 === void 0 ? void 0 : _17.length) &&
65271
65249
  !existingDrawDefinition;
65272
65250
  var existingQualifyingStructures = existingDrawDefinition
65273
- ? (_17 = existingDrawDefinition.structures) === null || _17 === void 0 ? void 0 : _17.filter(function (structure) { return structure.stage === QUALIFYING; })
65251
+ ? (_18 = existingDrawDefinition.structures) === null || _18 === void 0 ? void 0 : _18.filter(function (structure) { return structure.stage === QUALIFYING; })
65274
65252
  : [];
65275
65253
  var existingQualifyingPlaceholderStructureId = (existingQualifyingStructures === null || existingQualifyingStructures === void 0 ? void 0 : existingQualifyingStructures.length) === 1 &&
65276
- !((_18 = existingQualifyingStructures[0].matchUps) === null || _18 === void 0 ? void 0 : _18.length) &&
65254
+ !((_19 = existingQualifyingStructures[0].matchUps) === null || _19 === void 0 ? void 0 : _19.length) &&
65277
65255
  existingQualifyingStructures[0].structureId;
65278
65256
  if (existingQualifyingPlaceholderStructureId) {
65279
65257
  var qualifyingProfiles = params.qualifyingProfiles;
@@ -65289,24 +65267,24 @@ function generateDrawDefinition(params) {
65289
65267
  if (qualifyingResult === null || qualifyingResult === void 0 ? void 0 : qualifyingResult.error) {
65290
65268
  return qualifyingResult;
65291
65269
  }
65292
- drawDefinition.structures = (_19 = drawDefinition.structures) === null || _19 === void 0 ? void 0 : _19.filter(function (_a) {
65270
+ drawDefinition.structures = (_20 = drawDefinition.structures) === null || _20 === void 0 ? void 0 : _20.filter(function (_a) {
65293
65271
  var structureId = _a.structureId;
65294
65272
  return structureId !== existingQualifyingPlaceholderStructureId;
65295
65273
  });
65296
- drawDefinition.links = (_20 = drawDefinition.links) === null || _20 === void 0 ? void 0 : _20.filter(function (_a) {
65274
+ drawDefinition.links = (_21 = drawDefinition.links) === null || _21 === void 0 ? void 0 : _21.filter(function (_a) {
65297
65275
  var source = _a.source;
65298
65276
  return source.structureId !== existingQualifyingPlaceholderStructureId;
65299
65277
  });
65300
- var _38 = qualifyingResult !== null && qualifyingResult !== void 0 ? qualifyingResult : {}, qualifiersCount = _38.qualifiersCount, qualifyingDrawPositionsCount = _38.qualifyingDrawPositionsCount, qualifyingDetails = _38.qualifyingDetails;
65278
+ var _39 = qualifyingResult !== null && qualifyingResult !== void 0 ? qualifyingResult : {}, qualifiersCount = _39.qualifiersCount, qualifyingDrawPositionsCount = _39.qualifyingDrawPositionsCount, qualifyingDetails = _39.qualifyingDetails;
65301
65279
  if (qualifyingDrawPositionsCount) {
65302
65280
  if (qualifyingResult === null || qualifyingResult === void 0 ? void 0 : qualifyingResult.structures) {
65303
- (_21 = drawDefinition.structures) === null || _21 === void 0 ? void 0 : _21.push.apply(_21, __spreadArray([], __read(qualifyingResult.structures), false));
65281
+ (_22 = drawDefinition.structures) === null || _22 === void 0 ? void 0 : _22.push.apply(_22, __spreadArray([], __read(qualifyingResult.structures), false));
65304
65282
  }
65305
65283
  if (qualifyingResult === null || qualifyingResult === void 0 ? void 0 : qualifyingResult.links) {
65306
- (_22 = drawDefinition.links) === null || _22 === void 0 ? void 0 : _22.push.apply(_22, __spreadArray([], __read(qualifyingResult.links), false));
65284
+ (_23 = drawDefinition.links) === null || _23 === void 0 ? void 0 : _23.push.apply(_23, __spreadArray([], __read(qualifyingResult.links), false));
65307
65285
  }
65308
65286
  }
65309
- var mainStructure = (_23 = drawDefinition.structures) === null || _23 === void 0 ? void 0 : _23.find(function (_a) {
65287
+ var mainStructure = (_24 = drawDefinition.structures) === null || _24 === void 0 ? void 0 : _24.find(function (_a) {
65310
65288
  var stage = _a.stage, stageSequence = _a.stageSequence;
65311
65289
  return stage === MAIN && stageSequence === 1;
65312
65290
  });
@@ -65332,12 +65310,12 @@ function generateDrawDefinition(params) {
65332
65310
  if (result.error)
65333
65311
  return result;
65334
65312
  try {
65335
- for (var _39 = __values((drawEntries !== null && drawEntries !== void 0 ? drawEntries : []).filter(function (_a) {
65313
+ for (var _40 = __values((drawEntries !== null && drawEntries !== void 0 ? drawEntries : []).filter(function (_a) {
65336
65314
  var entryStage = _a.entryStage;
65337
65315
  return entryStage === StageTypeEnum.Qualifying;
65338
- })), _40 = _39.next(); !_40.done; _40 = _39.next()) {
65339
- var entry = _40.value;
65340
- var entryData = __assign(__assign({}, entry), { entryStage: (_24 = entry.entryStage) !== null && _24 !== void 0 ? _24 : StageTypeEnum.Main, drawDefinition: drawDefinition });
65316
+ })), _41 = _40.next(); !_41.done; _41 = _40.next()) {
65317
+ var entry = _41.value;
65318
+ var entryData = __assign(__assign({}, entry), { entryStage: (_25 = entry.entryStage) !== null && _25 !== void 0 ? _25 : StageTypeEnum.Main, drawDefinition: drawDefinition });
65341
65319
  // ignore errors (EXITING_PARTICIPANT)
65342
65320
  addDrawEntry(entryData);
65343
65321
  }
@@ -65345,23 +65323,23 @@ function generateDrawDefinition(params) {
65345
65323
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
65346
65324
  finally {
65347
65325
  try {
65348
- if (_40 && !_40.done && (_b = _39.return)) _b.call(_39);
65326
+ if (_41 && !_41.done && (_c = _40.return)) _c.call(_40);
65349
65327
  }
65350
65328
  finally { if (e_2) throw e_2.error; }
65351
65329
  }
65352
65330
  try {
65353
- for (var _41 = __values(qualifyingDetails || []), _42 = _41.next(); !_42.done; _42 = _41.next()) {
65354
- var qualifyingDetail = _42.value;
65331
+ for (var _42 = __values(qualifyingDetails || []), _43 = _42.next(); !_43.done; _43 = _42.next()) {
65332
+ var qualifyingDetail = _43.value;
65355
65333
  var qualifyingRoundNumber = qualifyingDetail.finalQualifyingRoundNumber, qualifyingStructureId = qualifyingDetail.finalQualifyingStructureId, targetEntryRound = qualifyingDetail.roundTarget, finishingPositions = qualifyingDetail.finishingPositions, linkType = qualifyingDetail.linkType;
65356
65334
  var link = mainStructure &&
65357
- ((_25 = generateQualifyingLink({
65335
+ ((_26 = generateQualifyingLink({
65358
65336
  targetStructureId: mainStructure.structureId,
65359
65337
  sourceStructureId: qualifyingStructureId,
65360
65338
  sourceRoundNumber: qualifyingRoundNumber,
65361
65339
  finishingPositions: finishingPositions,
65362
65340
  targetEntryRound: targetEntryRound,
65363
65341
  linkType: linkType,
65364
- })) === null || _25 === void 0 ? void 0 : _25.link);
65342
+ })) === null || _26 === void 0 ? void 0 : _26.link);
65365
65343
  if (link === null || link === void 0 ? void 0 : link.error)
65366
65344
  return link;
65367
65345
  if (link) {
@@ -65374,7 +65352,7 @@ function generateDrawDefinition(params) {
65374
65352
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
65375
65353
  finally {
65376
65354
  try {
65377
- if (_42 && !_42.done && (_c = _41.return)) _c.call(_41);
65355
+ if (_43 && !_43.done && (_d = _42.return)) _d.call(_42);
65378
65356
  }
65379
65357
  finally { if (e_3) throw e_3.error; }
65380
65358
  }
@@ -65395,7 +65373,7 @@ function generateDrawDefinition(params) {
65395
65373
  entry.entryStage &&
65396
65374
  entry.entryStage !== StageTypeEnum.Main)
65397
65375
  continue;
65398
- var entryData = __assign(__assign({}, entry), { ignoreStageSpace: ignoreStageSpace !== null && ignoreStageSpace !== void 0 ? ignoreStageSpace : drawType === AD_HOC, entryStage: (_26 = entry.entryStage) !== null && _26 !== void 0 ? _26 : StageTypeEnum.Main, drawDefinition: drawDefinition, drawType: drawType });
65376
+ var entryData = __assign(__assign({}, entry), { ignoreStageSpace: ignoreStageSpace !== null && ignoreStageSpace !== void 0 ? ignoreStageSpace : drawType === AD_HOC, entryStage: (_27 = entry.entryStage) !== null && _27 !== void 0 ? _27 : StageTypeEnum.Main, drawDefinition: drawDefinition, drawType: drawType });
65399
65377
  var result = addDrawEntry(entryData);
65400
65378
  if (drawEntries && result.error) {
65401
65379
  // only report errors with drawEntries
@@ -65407,7 +65385,7 @@ function generateDrawDefinition(params) {
65407
65385
  catch (e_4_1) { e_4 = { error: e_4_1 }; }
65408
65386
  finally {
65409
65387
  try {
65410
- if (entries_1_1 && !entries_1_1.done && (_d = entries_1.return)) _d.call(entries_1);
65388
+ if (entries_1_1 && !entries_1_1.done && (_e = entries_1.return)) _e.call(entries_1);
65411
65389
  }
65412
65390
  finally { if (e_4) throw e_4.error; }
65413
65391
  }
@@ -65419,13 +65397,13 @@ function generateDrawDefinition(params) {
65419
65397
  if (structureResult.error && !structureResult.conflicts) {
65420
65398
  return structureResult;
65421
65399
  }
65422
- if ((_27 = structureResult.positioningReport) === null || _27 === void 0 ? void 0 : _27.length)
65423
- positioningReports.push((_e = {}, _e[MAIN] = structureResult.positioningReport, _e));
65400
+ if ((_28 = structureResult.positioningReport) === null || _28 === void 0 ? void 0 : _28.length)
65401
+ positioningReports.push((_f = {}, _f[MAIN] = structureResult.positioningReport, _f));
65424
65402
  structureId = structureResult.structureId;
65425
65403
  if (structureResult.conflicts)
65426
65404
  conflicts = structureResult.conflicts;
65427
65405
  if (drawType === AD_HOC && params.roundsCount) {
65428
- var entries_2 = (_28 = event === null || event === void 0 ? void 0 : event.entries) === null || _28 === void 0 ? void 0 : _28.filter(function (_a) {
65406
+ var entries_2 = (_29 = event === null || event === void 0 ? void 0 : event.entries) === null || _29 === void 0 ? void 0 : _29.filter(function (_a) {
65429
65407
  var entryStage = _a.entryStage, entryStatus = _a.entryStatus;
65430
65408
  return (!entryStage || entryStage === MAIN) &&
65431
65409
  entryStatus &&
@@ -65472,8 +65450,8 @@ function generateDrawDefinition(params) {
65472
65450
  var roundTarget = 1;
65473
65451
  params.qualifyingProfiles.sort(roundTargetSort);
65474
65452
  try {
65475
- for (var _43 = __values(params.qualifyingProfiles), _44 = _43.next(); !_44.done; _44 = _43.next()) {
65476
- var roundTargetProfile = _44.value;
65453
+ for (var _44 = __values(params.qualifyingProfiles), _45 = _44.next(); !_45.done; _45 = _44.next()) {
65454
+ var roundTargetProfile = _45.value;
65477
65455
  if (!Array.isArray(roundTargetProfile.structureProfiles))
65478
65456
  return decorateResult({
65479
65457
  info: mustBeAnArray('structureProfiles'),
@@ -65481,13 +65459,13 @@ function generateDrawDefinition(params) {
65481
65459
  stack: stack,
65482
65460
  });
65483
65461
  roundTarget = roundTargetProfile.roundTarget || roundTarget;
65484
- var sortedStructureProfiles = ((_29 = roundTargetProfile.structureProfiles) === null || _29 === void 0 ? void 0 : _29.sort(sequenceSort)) || [];
65462
+ var sortedStructureProfiles = ((_30 = roundTargetProfile.structureProfiles) === null || _30 === void 0 ? void 0 : _30.sort(sequenceSort)) || [];
65485
65463
  var sequence = 1;
65486
65464
  try {
65487
65465
  for (var sortedStructureProfiles_1 = (e_6 = void 0, __values(sortedStructureProfiles)), sortedStructureProfiles_1_1 = sortedStructureProfiles_1.next(); !sortedStructureProfiles_1_1.done; sortedStructureProfiles_1_1 = sortedStructureProfiles_1.next()) {
65488
65466
  var structureProfile = sortedStructureProfiles_1_1.value;
65489
- var qualifyingRoundNumber = structureProfile.qualifyingRoundNumber, qualifyingPositions = structureProfile.qualifyingPositions, seededParticipants = structureProfile.seededParticipants, seedingScaleName = structureProfile.seedingScaleName, _45 = structureProfile.seedsCount, seedsCount_1 = _45 === void 0 ? 0 : _45, seedByRanking = structureProfile.seedByRanking, placeByes_1 = structureProfile.placeByes, drawSize_1 = structureProfile.drawSize;
65490
- var qualifyingStageResult = prepareStage(__assign(__assign(__assign({}, drawTypeResult), params), { seedingProfile: (_30 = structureProfile.seedingProfile) !== null && _30 !== void 0 ? _30 : seedingProfile, stageSequence: sequence, qualifyingRoundNumber: qualifyingRoundNumber, preparedStructureIds: preparedStructureIds, qualifyingPositions: qualifyingPositions, seededParticipants: seededParticipants, stage: QUALIFYING, seedingScaleName: seedingScaleName, appliedPolicies: appliedPolicies, drawDefinition: drawDefinition, qualifyingOnly: qualifyingOnly, seedByRanking: seedByRanking, participants: participants, roundTarget: roundTarget, seedsCount: seedsCount_1, placeByes: placeByes_1, drawSize: drawSize_1, entries: entries }));
65467
+ var qualifyingRoundNumber = structureProfile.qualifyingRoundNumber, qualifyingPositions = structureProfile.qualifyingPositions, seededParticipants = structureProfile.seededParticipants, seedingScaleName = structureProfile.seedingScaleName, _46 = structureProfile.seedsCount, seedsCount_1 = _46 === void 0 ? 0 : _46, seedByRanking = structureProfile.seedByRanking, placeByes_1 = structureProfile.placeByes, drawSize_1 = structureProfile.drawSize;
65468
+ var qualifyingStageResult = prepareStage(__assign(__assign(__assign({}, drawTypeResult), params), { seedingProfile: (_31 = structureProfile.seedingProfile) !== null && _31 !== void 0 ? _31 : seedingProfile, stageSequence: sequence, qualifyingRoundNumber: qualifyingRoundNumber, preparedStructureIds: preparedStructureIds, qualifyingPositions: qualifyingPositions, seededParticipants: seededParticipants, stage: QUALIFYING, seedingScaleName: seedingScaleName, appliedPolicies: appliedPolicies, drawDefinition: drawDefinition, qualifyingOnly: qualifyingOnly, seedByRanking: seedByRanking, participants: participants, roundTarget: roundTarget, seedsCount: seedsCount_1, placeByes: placeByes_1, drawSize: drawSize_1, entries: entries }));
65491
65469
  if (qualifyingStageResult.error) {
65492
65470
  return qualifyingStageResult;
65493
65471
  }
@@ -65495,18 +65473,18 @@ function generateDrawDefinition(params) {
65495
65473
  preparedStructureIds.push(qualifyingStageResult.structureId);
65496
65474
  }
65497
65475
  sequence += 1;
65498
- if ((_31 = qualifyingStageResult.conflicts) === null || _31 === void 0 ? void 0 : _31.length)
65476
+ if ((_32 = qualifyingStageResult.conflicts) === null || _32 === void 0 ? void 0 : _32.length)
65499
65477
  qualifyingConflicts.push.apply(qualifyingConflicts, __spreadArray([], __read(qualifyingStageResult.conflicts), false));
65500
- if ((_32 = qualifyingStageResult.positioningReport) === null || _32 === void 0 ? void 0 : _32.length)
65501
- positioningReports.push((_h = {},
65502
- _h[QUALIFYING] = qualifyingStageResult.positioningReport,
65503
- _h));
65478
+ if ((_33 = qualifyingStageResult.positioningReport) === null || _33 === void 0 ? void 0 : _33.length)
65479
+ positioningReports.push((_j = {},
65480
+ _j[QUALIFYING] = qualifyingStageResult.positioningReport,
65481
+ _j));
65504
65482
  }
65505
65483
  }
65506
65484
  catch (e_6_1) { e_6 = { error: e_6_1 }; }
65507
65485
  finally {
65508
65486
  try {
65509
- if (sortedStructureProfiles_1_1 && !sortedStructureProfiles_1_1.done && (_g = sortedStructureProfiles_1.return)) _g.call(sortedStructureProfiles_1);
65487
+ if (sortedStructureProfiles_1_1 && !sortedStructureProfiles_1_1.done && (_h = sortedStructureProfiles_1.return)) _h.call(sortedStructureProfiles_1);
65510
65488
  }
65511
65489
  finally { if (e_6) throw e_6.error; }
65512
65490
  }
@@ -65516,7 +65494,7 @@ function generateDrawDefinition(params) {
65516
65494
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
65517
65495
  finally {
65518
65496
  try {
65519
- if (_44 && !_44.done && (_f = _43.return)) _f.call(_43);
65497
+ if (_45 && !_45.done && (_g = _44.return)) _g.call(_44);
65520
65498
  }
65521
65499
  finally { if (e_5) throw e_5.error; }
65522
65500
  }
@@ -65540,7 +65518,7 @@ function generateDrawDefinition(params) {
65540
65518
  drawDefinition.links.push(link);
65541
65519
  }
65542
65520
  drawDefinition.drawName =
65543
- (_33 = params.drawName) !== null && _33 !== void 0 ? _33 : (drawType && constantToString(drawType));
65521
+ (_34 = params.drawName) !== null && _34 !== void 0 ? _34 : (drawType && constantToString(drawType));
65544
65522
  if (typeof voluntaryConsolation === 'object' && drawSize >= 4) {
65545
65523
  addVoluntaryConsolationStructure(__assign(__assign({}, voluntaryConsolation), { tournamentRecord: tournamentRecord, appliedPolicies: appliedPolicies, drawDefinition: drawDefinition, matchUpType: matchUpType }));
65546
65524
  }
@@ -67106,9 +67084,9 @@ var tournamentEngine = (function () {
67106
67084
  }
67107
67085
  function executionQueue(directives, rollbackOnError) {
67108
67086
  var e_1, _a;
67109
- var _b;
67110
67087
  if (!Array.isArray(directives))
67111
67088
  return { error: INVALID_VALUES };
67089
+ var start = Date.now();
67112
67090
  var tournamentId = getTournamentId();
67113
67091
  var tournamentRecord = getTournamentRecord(tournamentId);
67114
67092
  var snapshot = rollbackOnError && makeDeepCopy(tournamentRecord, false, true);
@@ -67121,12 +67099,8 @@ var tournamentEngine = (function () {
67121
67099
  var methodName = directive.method, params = directive.params;
67122
67100
  if (!engine[methodName]) {
67123
67101
  var result_1 = { error: METHOD_NOT_FOUND, methodName: methodName };
67124
- var devContext = getDevContext();
67125
- if ((devContext.result && !Array.isArray(devContext.result)) ||
67126
- (Array.isArray(devContext.result) &&
67127
- ((_b = devContext.result) === null || _b === void 0 ? void 0 : _b.includes(methodName)))) {
67128
- console.log('te:', result_1);
67129
- }
67102
+ var elapsed = Date.now() - start;
67103
+ engineLogging({ result: result_1, methodName: methodName, elapsed: elapsed, params: params, engine: 'te:' });
67130
67104
  return result_1;
67131
67105
  }
67132
67106
  var result_2 = executeFunction(tournamentRecord, engine[methodName], params, methodName);