tods-competition-factory 2.0.0-beta.8 → 2.0.1
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.
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.d.ts +18 -2
- package/dist/tods-competition-factory.development.cjs.js +178 -123
- package/dist/tods-competition-factory.development.cjs.js.map +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js.map +1 -1
- package/package.json +2 -2
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
function factoryVersion() {
|
|
6
|
-
return '2.0.
|
|
6
|
+
return '2.0.1';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
/******************************************************************************
|
|
@@ -214,7 +214,9 @@ function numericSort(a, b) {
|
|
|
214
214
|
function ensureInt(val) {
|
|
215
215
|
if (typeof val === 'number')
|
|
216
216
|
return parseInt(val.toString());
|
|
217
|
-
|
|
217
|
+
if (typeof val === 'string')
|
|
218
|
+
return parseInt(val);
|
|
219
|
+
return 0;
|
|
218
220
|
}
|
|
219
221
|
|
|
220
222
|
function isPowerOf2(n) {
|
|
@@ -12997,6 +12999,16 @@ function stringSort(a, b) {
|
|
|
12997
12999
|
return (a || '').localeCompare(b || '');
|
|
12998
13000
|
}
|
|
12999
13001
|
|
|
13002
|
+
function getTournamentPublishStatus(_a) {
|
|
13003
|
+
var _b, _c, _d;
|
|
13004
|
+
var tournamentRecord = _a.tournamentRecord, _e = _a.status, status = _e === void 0 ? PUBLIC : _e;
|
|
13005
|
+
var itemType = "".concat(PUBLISH, ".").concat(STATUS$1);
|
|
13006
|
+
return (_d = (_c = (_b = getTournamentTimeItem({
|
|
13007
|
+
tournamentRecord: tournamentRecord,
|
|
13008
|
+
itemType: itemType,
|
|
13009
|
+
})) === null || _b === void 0 ? void 0 : _b.timeItem) === null || _c === void 0 ? void 0 : _c.itemValue) === null || _d === void 0 ? void 0 : _d[status];
|
|
13010
|
+
}
|
|
13011
|
+
|
|
13000
13012
|
function getEventPublishStatus(_a) {
|
|
13001
13013
|
var _b, _c, _d;
|
|
13002
13014
|
var event = _a.event, _e = _a.status, status = _e === void 0 ? PUBLIC : _e;
|
|
@@ -13017,7 +13029,7 @@ function getDrawPublishStatus(_a) {
|
|
|
13017
13029
|
|
|
13018
13030
|
function getPublishState(_a) {
|
|
13019
13031
|
var e_1, _b, e_2, _c, e_3, _d, e_4, _e;
|
|
13020
|
-
var _f, _g, _h, _j, _k;
|
|
13032
|
+
var _f, _g, _h, _j, _k, _l, _m;
|
|
13021
13033
|
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, eventIds = _a.eventIds, eventId = _a.eventId, drawIds = _a.drawIds, drawId = _a.drawId, event = _a.event;
|
|
13022
13034
|
if (eventId && !event) {
|
|
13023
13035
|
return { error: EVENT_NOT_FOUND };
|
|
@@ -13057,6 +13069,7 @@ function getPublishState(_a) {
|
|
|
13057
13069
|
return {
|
|
13058
13070
|
publishState: __assign({ status: {
|
|
13059
13071
|
published: !!((_f = pubStatus.status.publishedDrawIds) === null || _f === void 0 ? void 0 : _f.includes(drawId)),
|
|
13072
|
+
drawDetail: (_g = pubStatus.status.drawDetails) === null || _g === void 0 ? void 0 : _g[drawId],
|
|
13060
13073
|
} }, SUCCESS),
|
|
13061
13074
|
};
|
|
13062
13075
|
}
|
|
@@ -13070,6 +13083,7 @@ function getPublishState(_a) {
|
|
|
13070
13083
|
publishState[drawId_1] = {
|
|
13071
13084
|
status: {
|
|
13072
13085
|
published: !!pubStatus.status.publishedDrawIds.includes(drawId_1),
|
|
13086
|
+
drawDetail: (_h = pubStatus.status.drawDetails) === null || _h === void 0 ? void 0 : _h[drawId_1],
|
|
13073
13087
|
},
|
|
13074
13088
|
};
|
|
13075
13089
|
return __assign(__assign({}, SUCCESS), { publishState: publishState });
|
|
@@ -13092,19 +13106,21 @@ function getPublishState(_a) {
|
|
|
13092
13106
|
}
|
|
13093
13107
|
else {
|
|
13094
13108
|
var publishState = {};
|
|
13109
|
+
var pubStatus = getTournamentPublishStatus({ tournamentRecord: tournamentRecord });
|
|
13110
|
+
publishState.tournament = pubStatus;
|
|
13095
13111
|
try {
|
|
13096
|
-
for (var
|
|
13097
|
-
var event_2 =
|
|
13098
|
-
var
|
|
13099
|
-
publishState[event_2.eventId] =
|
|
13100
|
-
if (
|
|
13101
|
-
return
|
|
13112
|
+
for (var _o = __values((_j = tournamentRecord.events) !== null && _j !== void 0 ? _j : []), _p = _o.next(); !_p.done; _p = _o.next()) {
|
|
13113
|
+
var event_2 = _p.value;
|
|
13114
|
+
var pubStatus_1 = getPubStatus({ event: event_2 });
|
|
13115
|
+
publishState[event_2.eventId] = pubStatus_1;
|
|
13116
|
+
if (pubStatus_1.error)
|
|
13117
|
+
return pubStatus_1;
|
|
13102
13118
|
try {
|
|
13103
|
-
for (var
|
|
13104
|
-
var drawId_2 =
|
|
13119
|
+
for (var _q = (e_4 = void 0, __values((_k = event_2.drawDefinitions) !== null && _k !== void 0 ? _k : [])), _r = _q.next(); !_r.done; _r = _q.next()) {
|
|
13120
|
+
var drawId_2 = _r.value.drawId;
|
|
13105
13121
|
if (!isString(drawId_2))
|
|
13106
13122
|
return { error: INVALID_VALUES };
|
|
13107
|
-
var published = (
|
|
13123
|
+
var published = (_m = (_l = pubStatus_1.publishState) === null || _l === void 0 ? void 0 : _l.publishedDrawIds) === null || _m === void 0 ? void 0 : _m.includes(drawId_2);
|
|
13108
13124
|
if (published) {
|
|
13109
13125
|
publishState[drawId_2] = { status: { published: published } };
|
|
13110
13126
|
}
|
|
@@ -13113,7 +13129,7 @@ function getPublishState(_a) {
|
|
|
13113
13129
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
13114
13130
|
finally {
|
|
13115
13131
|
try {
|
|
13116
|
-
if (
|
|
13132
|
+
if (_r && !_r.done && (_e = _q.return)) _e.call(_q);
|
|
13117
13133
|
}
|
|
13118
13134
|
finally { if (e_4) throw e_4.error; }
|
|
13119
13135
|
}
|
|
@@ -13122,7 +13138,7 @@ function getPublishState(_a) {
|
|
|
13122
13138
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
13123
13139
|
finally {
|
|
13124
13140
|
try {
|
|
13125
|
-
if (
|
|
13141
|
+
if (_p && !_p.done && (_d = _o.return)) _d.call(_o);
|
|
13126
13142
|
}
|
|
13127
13143
|
finally { if (e_3) throw e_3.error; }
|
|
13128
13144
|
}
|
|
@@ -13166,12 +13182,14 @@ function getPubStatus(_a) {
|
|
|
13166
13182
|
var publishedDrawIds = (drawDetails && Object.keys(drawDetails).filter(function (drawId) { return getDrawPublishStatus({ drawDetails: drawDetails, drawId: drawId }); })) ||
|
|
13167
13183
|
eventPubStatus.drawIds ||
|
|
13168
13184
|
[];
|
|
13169
|
-
return
|
|
13185
|
+
return {
|
|
13186
|
+
status: {
|
|
13170
13187
|
published: publishedDrawIds.length > 0,
|
|
13171
13188
|
publishedDrawIds: publishedDrawIds,
|
|
13172
13189
|
publishedSeeding: publishedSeeding,
|
|
13173
13190
|
drawDetails: drawDetails,
|
|
13174
|
-
}
|
|
13191
|
+
},
|
|
13192
|
+
};
|
|
13175
13193
|
}
|
|
13176
13194
|
|
|
13177
13195
|
function addStructureParticipation(_a) {
|
|
@@ -29413,6 +29431,35 @@ function deriveQualifyingPositions(_a) {
|
|
|
29413
29431
|
return qualifyingPositions;
|
|
29414
29432
|
}
|
|
29415
29433
|
|
|
29434
|
+
function getCoercedDrawType(params) {
|
|
29435
|
+
var drawTypeCoercion = params.drawTypeCoercion, enforceMinimumDrawSize = params.enforceMinimumDrawSize;
|
|
29436
|
+
var drawSize = ensureInt(params.drawSize);
|
|
29437
|
+
var drawType = (drawTypeCoercion &&
|
|
29438
|
+
(typeof drawTypeCoercion === 'boolean' || drawTypeCoercion <= 2) &&
|
|
29439
|
+
drawSize === 2 &&
|
|
29440
|
+
SINGLE_ELIMINATION) ||
|
|
29441
|
+
params.drawType ||
|
|
29442
|
+
SINGLE_ELIMINATION;
|
|
29443
|
+
var multiStructure = MULTI_STRUCTURE_DRAWS.includes(drawType);
|
|
29444
|
+
if (drawSize && multiStructure) {
|
|
29445
|
+
if (drawTypeCoercion && ((typeof drawTypeCoercion === 'boolean' && drawSize < 4) || drawSize <= drawTypeCoercion)) {
|
|
29446
|
+
drawType = SINGLE_ELIMINATION;
|
|
29447
|
+
}
|
|
29448
|
+
else if (drawSize < 4 && enforceMinimumDrawSize) {
|
|
29449
|
+
return __assign(__assign({}, decorateResult({
|
|
29450
|
+
context: {
|
|
29451
|
+
enforceMinimumDrawSize: enforceMinimumDrawSize,
|
|
29452
|
+
drawSize: drawSize,
|
|
29453
|
+
drawType: drawType,
|
|
29454
|
+
},
|
|
29455
|
+
result: { error: INVALID_DRAW_SIZE },
|
|
29456
|
+
stack: 'getCoercedDrawType',
|
|
29457
|
+
})), { drawType: drawType });
|
|
29458
|
+
}
|
|
29459
|
+
}
|
|
29460
|
+
return { drawType: drawType };
|
|
29461
|
+
}
|
|
29462
|
+
|
|
29416
29463
|
// first iteration only links to a single playoff structure
|
|
29417
29464
|
// future iteration should allow structureOptions to specify
|
|
29418
29465
|
// groups of finishing drawPositions which playoff
|
|
@@ -29776,10 +29823,19 @@ function generateDrawStructuresAndLinks(params) {
|
|
|
29776
29823
|
var e_1, _a, e_2, _b;
|
|
29777
29824
|
var _c, _d, _e, _f, _g, _h, _j;
|
|
29778
29825
|
var _k = params || {}, _l = _k.enforceMinimumDrawSize, enforceMinimumDrawSize = _l === void 0 ? true : _l, overwriteExisting = _k.overwriteExisting, appliedPolicies = _k.appliedPolicies, staggeredEntry = _k.staggeredEntry, // optional - specifies main structure FEED_IN for drawTypes CURTIS_CONSOLATION, FEED_IN_CHAMPIONSHIPS, FMLC
|
|
29779
|
-
drawDefinition = _k.drawDefinition, tieFormat = _k.tieFormat,
|
|
29826
|
+
drawDefinition = _k.drawDefinition, tieFormat = _k.tieFormat, isMock = _k.isMock, uuids = _k.uuids;
|
|
29827
|
+
var drawSize = ensureInt(params.drawSize);
|
|
29780
29828
|
var drawTypeCoercion = (_c = params.drawTypeCoercion) !== null && _c !== void 0 ? _c : getDrawTypeCoercion({ appliedPolicies: appliedPolicies, drawType: params.drawType });
|
|
29781
29829
|
var stack = 'generateDrawStructuresAndLinks';
|
|
29782
|
-
var
|
|
29830
|
+
var coercedDrawType = getCoercedDrawType({
|
|
29831
|
+
drawType: params.drawType,
|
|
29832
|
+
enforceMinimumDrawSize: enforceMinimumDrawSize,
|
|
29833
|
+
drawTypeCoercion: drawTypeCoercion,
|
|
29834
|
+
drawSize: drawSize,
|
|
29835
|
+
});
|
|
29836
|
+
if (coercedDrawType.error)
|
|
29837
|
+
return coercedDrawType;
|
|
29838
|
+
var drawType = coercedDrawType.drawType;
|
|
29783
29839
|
var structures = [], links = [];
|
|
29784
29840
|
var matchUpType = (_d = params === null || params === void 0 ? void 0 : params.matchUpType) !== null && _d !== void 0 ? _d : SINGLES;
|
|
29785
29841
|
var existingQualifyingStructures = (_e = drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.structures) === null || _e === void 0 ? void 0 : _e.filter(function (_a) {
|
|
@@ -29865,7 +29921,6 @@ function generateDrawStructuresAndLinks(params) {
|
|
|
29865
29921
|
// check that drawSize is a valid value
|
|
29866
29922
|
var invalidDrawSize = drawType !== AD_HOC &&
|
|
29867
29923
|
(!drawSize ||
|
|
29868
|
-
isNaN(drawSize) ||
|
|
29869
29924
|
drawSize < 2 ||
|
|
29870
29925
|
(!staggeredEntry &&
|
|
29871
29926
|
![FEED_IN$1, LUCKY_DRAW].includes(drawType) &&
|
|
@@ -29878,24 +29933,6 @@ function generateDrawStructuresAndLinks(params) {
|
|
|
29878
29933
|
stack: stack,
|
|
29879
29934
|
});
|
|
29880
29935
|
}
|
|
29881
|
-
var multiStructure = MULTI_STRUCTURE_DRAWS.includes(drawType);
|
|
29882
|
-
if (drawSize && ensureInt(drawSize) < 4 && multiStructure) {
|
|
29883
|
-
if (drawTypeCoercion) {
|
|
29884
|
-
drawType = SINGLE_ELIMINATION;
|
|
29885
|
-
}
|
|
29886
|
-
else if (enforceMinimumDrawSize) {
|
|
29887
|
-
return decorateResult({
|
|
29888
|
-
context: {
|
|
29889
|
-
enforceMinimumDrawSize: enforceMinimumDrawSize,
|
|
29890
|
-
invalidDrawSize: invalidDrawSize,
|
|
29891
|
-
drawSize: drawSize,
|
|
29892
|
-
drawType: drawType,
|
|
29893
|
-
},
|
|
29894
|
-
result: { error: INVALID_DRAW_SIZE },
|
|
29895
|
-
stack: stack,
|
|
29896
|
-
});
|
|
29897
|
-
}
|
|
29898
|
-
}
|
|
29899
29936
|
var _o = getGenerators(params), generators = _o.generators, error = _o.error;
|
|
29900
29937
|
if (error) {
|
|
29901
29938
|
return { error: error };
|
|
@@ -32093,8 +32130,8 @@ var tieFormatDefaults = function (params) {
|
|
|
32093
32130
|
|
|
32094
32131
|
function drawMatic(params) {
|
|
32095
32132
|
var e_1, _a, e_2, _b;
|
|
32096
|
-
var _c, _d, _e, _f, _g, _h, _j, _k;
|
|
32097
|
-
var restrictEntryStatus = params.restrictEntryStatus,
|
|
32133
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
32134
|
+
var restrictEntryStatus = params.restrictEntryStatus, enableDoubleRobin = params.enableDoubleRobin, _m = params.adHocRatings, adHocRatings = _m === void 0 ? {} : _m, generateMatchUps = params.generateMatchUps, tournamentRecord = params.tournamentRecord, encounterValue = params.encounterValue, sameTeamValue = params.sameTeamValue, drawDefinition = params.drawDefinition, scaleAccessor = params.scaleAccessor, maxIterations = params.maxIterations, roundsCount = params.roundsCount, matchUpIds = params.matchUpIds, scaleName = params.scaleName, // custom rating name to seed dynamic ratings
|
|
32098
32135
|
idPrefix = params.idPrefix, salted = params.salted, event = params.event;
|
|
32099
32136
|
if (roundsCount && typeof roundsCount !== 'number') {
|
|
32100
32137
|
return { error: INVALID_VALUES, info: 'roundsCount must be a number' };
|
|
@@ -32124,7 +32161,9 @@ function drawMatic(params) {
|
|
|
32124
32161
|
else {
|
|
32125
32162
|
participantIds = enteredParticipantIds;
|
|
32126
32163
|
}
|
|
32127
|
-
if (roundsCount &&
|
|
32164
|
+
if (roundsCount &&
|
|
32165
|
+
roundsCount > participantIds.length - 1 &&
|
|
32166
|
+
(!enableDoubleRobin || roundsCount > (participantIds.length - 1) * 2)) {
|
|
32128
32167
|
return { error: INVALID_VALUES, info: 'Not enough participants for roundsCount' };
|
|
32129
32168
|
}
|
|
32130
32169
|
// if no structureId is specified find the latest AD_HOC stage which has matchUps
|
|
@@ -32168,15 +32207,15 @@ function drawMatic(params) {
|
|
|
32168
32207
|
adHocRatings[participantId] = scaleValue;
|
|
32169
32208
|
};
|
|
32170
32209
|
try {
|
|
32171
|
-
for (var
|
|
32172
|
-
var participantId =
|
|
32210
|
+
for (var _o = __values(participantIds !== null && participantIds !== void 0 ? participantIds : []), _p = _o.next(); !_p.done; _p = _o.next()) {
|
|
32211
|
+
var participantId = _p.value;
|
|
32173
32212
|
_loop_1(participantId);
|
|
32174
32213
|
}
|
|
32175
32214
|
}
|
|
32176
32215
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
32177
32216
|
finally {
|
|
32178
32217
|
try {
|
|
32179
|
-
if (
|
|
32218
|
+
if (_p && !_p.done && (_a = _o.return)) _a.call(_o);
|
|
32180
32219
|
}
|
|
32181
32220
|
finally { if (e_1) throw e_1.error; }
|
|
32182
32221
|
}
|
|
@@ -32186,8 +32225,8 @@ function drawMatic(params) {
|
|
|
32186
32225
|
var roundResults = [];
|
|
32187
32226
|
var roundNumber;
|
|
32188
32227
|
try {
|
|
32189
|
-
for (var
|
|
32190
|
-
var iteration =
|
|
32228
|
+
for (var _q = __values(generateRange(1, (roundsCount !== null && roundsCount !== void 0 ? roundsCount : 1) + 1)), _r = _q.next(); !_r.done; _r = _q.next()) {
|
|
32229
|
+
var iteration = _r.value;
|
|
32191
32230
|
var result = generateDrawMaticRound({
|
|
32192
32231
|
ignoreLastRoundNumber: true,
|
|
32193
32232
|
tournamentParticipants: tournamentParticipants,
|
|
@@ -32211,7 +32250,7 @@ function drawMatic(params) {
|
|
|
32211
32250
|
return result;
|
|
32212
32251
|
var roundMatchUps = result.matchUps, roundResult = __rest(result, ["matchUps"]);
|
|
32213
32252
|
roundResults.push(__assign(__assign({}, roundResult), { iteration: iteration, matchUpsCount: roundMatchUps === null || roundMatchUps === void 0 ? void 0 : roundMatchUps.length }));
|
|
32214
|
-
roundNumber = ((roundResult === null || roundResult === void 0 ? void 0 : roundResult.roundNumber)
|
|
32253
|
+
roundNumber = ((_l = roundResult === null || roundResult === void 0 ? void 0 : roundResult.roundNumber) !== null && _l !== void 0 ? _l : 1) + 1;
|
|
32215
32254
|
if (roundMatchUps === null || roundMatchUps === void 0 ? void 0 : roundMatchUps.length) {
|
|
32216
32255
|
matchUps.push.apply(matchUps, __spreadArray([], __read(roundMatchUps), false));
|
|
32217
32256
|
}
|
|
@@ -32220,7 +32259,7 @@ function drawMatic(params) {
|
|
|
32220
32259
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
32221
32260
|
finally {
|
|
32222
32261
|
try {
|
|
32223
|
-
if (
|
|
32262
|
+
if (_r && !_r.done && (_b = _q.return)) _b.call(_q);
|
|
32224
32263
|
}
|
|
32225
32264
|
finally { if (e_2) throw e_2.error; }
|
|
32226
32265
|
}
|
|
@@ -32528,7 +32567,7 @@ function generateDrawDefinition(params) {
|
|
|
32528
32567
|
var _a, e_1, _b, e_2, _c, e_3, _d, e_4, _e, _f, e_5, _g, e_6, _h, _j;
|
|
32529
32568
|
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;
|
|
32530
32569
|
var stack = 'generateDrawDefinition';
|
|
32531
|
-
var _35 = params.
|
|
32570
|
+
var _35 = params.enforceMinimumDrawSize, enforceMinimumDrawSize = _35 === void 0 ? true : _35, _36 = params.considerEventEntries, considerEventEntries = _36 === void 0 ? true : _36, // in the absence of drawSize and drawEntries, look to event.entries
|
|
32532
32571
|
ignoreAllowedDrawTypes = params.ignoreAllowedDrawTypes, voluntaryConsolation = params.voluntaryConsolation, hydrateCollections = params.hydrateCollections, ignoreStageSpace = params.ignoreStageSpace, tournamentRecord = params.tournamentRecord, qualifyingOnly = params.qualifyingOnly, tieFormatName = params.tieFormatName, drawEntries = params.drawEntries, placeByes = params.placeByes, event = params.event;
|
|
32533
32572
|
var isMock = (_k = params.isMock) !== null && _k !== void 0 ? _k : true;
|
|
32534
32573
|
var idPrefix = params.idPrefix;
|
|
@@ -32537,49 +32576,23 @@ function generateDrawDefinition(params) {
|
|
|
32537
32576
|
event: event,
|
|
32538
32577
|
}).appliedPolicies) !== null && _l !== void 0 ? _l : {};
|
|
32539
32578
|
var policyDefinitions = makeDeepCopy((_m = params.policyDefinitions) !== null && _m !== void 0 ? _m : {}, false, true);
|
|
32540
|
-
var drawTypeCoercion = (_o = params.drawTypeCoercion) !== null && _o !== void 0 ? _o : getDrawTypeCoercion({
|
|
32541
|
-
drawType: params.drawType,
|
|
32542
|
-
policyDefinitions: policyDefinitions,
|
|
32543
|
-
appliedPolicies: appliedPolicies,
|
|
32544
|
-
});
|
|
32545
|
-
var drawType = (drawTypeCoercion && params.drawSize === 2 && SINGLE_ELIMINATION) || params.drawType || SINGLE_ELIMINATION;
|
|
32546
|
-
var seedingPolicy = (_p = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_SEEDING]) !== null && _p !== void 0 ? _p : appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_SEEDING];
|
|
32547
|
-
var seedingProfile = (_t = (_q = params.seedingProfile) !== null && _q !== void 0 ? _q : (_s = (_r = seedingPolicy === null || seedingPolicy === void 0 ? void 0 : seedingPolicy.seedingProfile) === null || _r === void 0 ? void 0 : _r.drawTypes) === null || _s === void 0 ? void 0 : _s[drawType]) !== null && _t !== void 0 ? _t : seedingPolicy === null || seedingPolicy === void 0 ? void 0 : seedingPolicy.seedingProfile;
|
|
32548
|
-
// extend policyDefinitions only if a seedingProfile was specified in params
|
|
32549
|
-
if (params.seedingProfile) {
|
|
32550
|
-
if (!policyDefinitions[POLICY_TYPE_SEEDING]) {
|
|
32551
|
-
policyDefinitions[POLICY_TYPE_SEEDING] = __assign({}, POLICY_SEEDING_DEFAULT[POLICY_TYPE_SEEDING]);
|
|
32552
|
-
}
|
|
32553
|
-
policyDefinitions[POLICY_TYPE_SEEDING].seedingProfile = seedingProfile;
|
|
32554
|
-
}
|
|
32555
32579
|
// get participants both for entry validation and for automated placement
|
|
32556
32580
|
// automated placement requires them to be "inContext" for avoidance policies to work
|
|
32557
|
-
var
|
|
32581
|
+
var _37 = getParticipants({
|
|
32558
32582
|
withIndividualParticipants: true,
|
|
32559
32583
|
convertExtensions: true,
|
|
32560
32584
|
internalUse: true,
|
|
32561
32585
|
tournamentRecord: tournamentRecord,
|
|
32562
|
-
}), participants =
|
|
32563
|
-
var
|
|
32564
|
-
//
|
|
32565
|
-
// check for restrictions on allowed drawTypes
|
|
32566
|
-
var allowedDrawTypes = !ignoreAllowedDrawTypes &&
|
|
32567
|
-
tournamentRecord &&
|
|
32568
|
-
getAllowedDrawTypes({
|
|
32569
|
-
tournamentRecord: tournamentRecord,
|
|
32570
|
-
categoryType: (_0 = event === null || event === void 0 ? void 0 : event.category) === null || _0 === void 0 ? void 0 : _0.categoryType,
|
|
32571
|
-
categoryName: (_1 = event === null || event === void 0 ? void 0 : event.category) === null || _1 === void 0 ? void 0 : _1.categoryName,
|
|
32572
|
-
});
|
|
32573
|
-
if ((allowedDrawTypes === null || allowedDrawTypes === void 0 ? void 0 : allowedDrawTypes.length) && !allowedDrawTypes.includes(drawType)) {
|
|
32574
|
-
return decorateResult({ result: { error: INVALID_DRAW_TYPE }, stack: stack });
|
|
32575
|
-
}
|
|
32576
|
-
var eventEntries = (_3 = (_2 = event === null || event === void 0 ? void 0 : event.entries) === null || _2 === void 0 ? void 0 : _2.filter(function (entry) { return entry.entryStatus && __spreadArray(__spreadArray([], __read(STRUCTURE_SELECTED_STATUSES), false), [QUALIFIER], false).includes(entry.entryStatus); })) !== null && _3 !== void 0 ? _3 : [];
|
|
32586
|
+
}), participants = _37.participants, participantMap = _37.participantMap;
|
|
32587
|
+
var eventEntries = (_p = (_o = event === null || event === void 0 ? void 0 : event.entries) === null || _o === void 0 ? void 0 : _o.filter(function (entry) { return entry.entryStatus && __spreadArray(__spreadArray([], __read(STRUCTURE_SELECTED_STATUSES), false), [QUALIFIER], false).includes(entry.entryStatus); })) !== null && _p !== void 0 ? _p : [];
|
|
32588
|
+
// -------------------- BEGIN PARAMETER DERIVATION AND VALIDATION -------------------------
|
|
32577
32589
|
var consideredEntries = ((qualifyingOnly && []) ||
|
|
32578
32590
|
drawEntries ||
|
|
32579
32591
|
(considerEventEntries ? eventEntries : [])).filter(function (_a) {
|
|
32580
32592
|
var entryStage = _a.entryStage;
|
|
32581
32593
|
return !entryStage || entryStage === MAIN;
|
|
32582
32594
|
});
|
|
32595
|
+
var enforceGender = (_t = (_q = params.enforceGender) !== null && _q !== void 0 ? _q : (_s = (_r = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_MATCHUP_ACTIONS]) === null || _r === void 0 ? void 0 : _r.participants) === null || _s === void 0 ? void 0 : _s.enforceGender) !== null && _t !== void 0 ? _t : (_v = (_u = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_MATCHUP_ACTIONS]) === null || _u === void 0 ? void 0 : _u.participants) === null || _v === void 0 ? void 0 : _v.enforceGender;
|
|
32583
32596
|
// entries participantTypes must correspond with eventType
|
|
32584
32597
|
// this is only possible if the event is provided
|
|
32585
32598
|
var validEntriesResult = event &&
|
|
@@ -32596,23 +32609,56 @@ function generateDrawDefinition(params) {
|
|
|
32596
32609
|
return decorateResult({ result: validEntriesResult, stack: stack });
|
|
32597
32610
|
var derivedDrawSize = !params.drawSize &&
|
|
32598
32611
|
consideredEntries.length &&
|
|
32599
|
-
![AD_HOC, DOUBLE_ELIMINATION, FEED_IN$1, ROUND_ROBIN, ROUND_ROBIN_WITH_PLAYOFF].includes(drawType) &&
|
|
32612
|
+
![AD_HOC, DOUBLE_ELIMINATION, FEED_IN$1, ROUND_ROBIN, ROUND_ROBIN_WITH_PLAYOFF].includes((_w = params.drawType) !== null && _w !== void 0 ? _w : '') &&
|
|
32600
32613
|
nextPowerOf2(consideredEntries.length);
|
|
32601
32614
|
// coersion of drawSize and seedsCount to integers
|
|
32602
|
-
var drawSize = derivedDrawSize ||
|
|
32603
|
-
|
|
32604
|
-
|
|
32615
|
+
var drawSize = derivedDrawSize || (params.drawSize && ensureInt(params.drawSize)) || false; // required for isNaN check
|
|
32616
|
+
var drawTypeCoercion = (_x = params.drawTypeCoercion) !== null && _x !== void 0 ? _x : getDrawTypeCoercion({
|
|
32617
|
+
drawType: params.drawType,
|
|
32618
|
+
policyDefinitions: policyDefinitions,
|
|
32619
|
+
appliedPolicies: appliedPolicies,
|
|
32620
|
+
});
|
|
32621
|
+
var coercedDrawType = getCoercedDrawType({
|
|
32622
|
+
drawType: params.drawType,
|
|
32623
|
+
enforceMinimumDrawSize: enforceMinimumDrawSize,
|
|
32624
|
+
drawTypeCoercion: drawTypeCoercion,
|
|
32625
|
+
drawSize: drawSize,
|
|
32626
|
+
});
|
|
32627
|
+
if (coercedDrawType.error)
|
|
32628
|
+
return coercedDrawType;
|
|
32629
|
+
var drawType = coercedDrawType.drawType;
|
|
32630
|
+
var seedingPolicy = (_y = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_SEEDING]) !== null && _y !== void 0 ? _y : appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_SEEDING];
|
|
32631
|
+
var seedingProfile = (_2 = (_z = params.seedingProfile) !== null && _z !== void 0 ? _z : (_1 = (_0 = seedingPolicy === null || seedingPolicy === void 0 ? void 0 : seedingPolicy.seedingProfile) === null || _0 === void 0 ? void 0 : _0.drawTypes) === null || _1 === void 0 ? void 0 : _1[drawType]) !== null && _2 !== void 0 ? _2 : seedingPolicy === null || seedingPolicy === void 0 ? void 0 : seedingPolicy.seedingProfile;
|
|
32632
|
+
// extend policyDefinitions only if a seedingProfile was specified in params
|
|
32633
|
+
if (params.seedingProfile) {
|
|
32634
|
+
if (!policyDefinitions[POLICY_TYPE_SEEDING]) {
|
|
32635
|
+
policyDefinitions[POLICY_TYPE_SEEDING] = __assign({}, POLICY_SEEDING_DEFAULT[POLICY_TYPE_SEEDING]);
|
|
32636
|
+
}
|
|
32637
|
+
policyDefinitions[POLICY_TYPE_SEEDING].seedingProfile = seedingProfile;
|
|
32638
|
+
}
|
|
32639
|
+
// if tournamentRecord is provided, and unless instructed to ignore valid types,
|
|
32640
|
+
// check for restrictions on allowed drawTypes
|
|
32641
|
+
var allowedDrawTypes = !ignoreAllowedDrawTypes &&
|
|
32642
|
+
tournamentRecord &&
|
|
32643
|
+
getAllowedDrawTypes({
|
|
32644
|
+
tournamentRecord: tournamentRecord,
|
|
32645
|
+
categoryType: (_3 = event === null || event === void 0 ? void 0 : event.category) === null || _3 === void 0 ? void 0 : _3.categoryType,
|
|
32646
|
+
categoryName: (_4 = event === null || event === void 0 ? void 0 : event.category) === null || _4 === void 0 ? void 0 : _4.categoryName,
|
|
32647
|
+
});
|
|
32648
|
+
if ((allowedDrawTypes === null || allowedDrawTypes === void 0 ? void 0 : allowedDrawTypes.length) && !allowedDrawTypes.includes(drawType)) {
|
|
32649
|
+
return decorateResult({ result: { error: INVALID_DRAW_TYPE }, stack: stack });
|
|
32650
|
+
}
|
|
32605
32651
|
if (isNaN(drawSize) && drawType !== AD_HOC) {
|
|
32606
32652
|
return decorateResult({
|
|
32607
32653
|
result: { error: MISSING_DRAW_SIZE },
|
|
32608
32654
|
stack: stack,
|
|
32609
32655
|
});
|
|
32610
32656
|
}
|
|
32611
|
-
|
|
32657
|
+
// -------------------- END OF PARAMETER DERIVATION AND VALIDATION -------------------------
|
|
32612
32658
|
var eventType = event === null || event === void 0 ? void 0 : event.eventType;
|
|
32613
|
-
var matchUpType = (
|
|
32659
|
+
var matchUpType = (_5 = params.matchUpType) !== null && _5 !== void 0 ? _5 : eventType;
|
|
32614
32660
|
var existingDrawDefinition = params.drawId
|
|
32615
|
-
? (
|
|
32661
|
+
? (_6 = event === null || event === void 0 ? void 0 : event.drawDefinitions) === null || _6 === void 0 ? void 0 : _6.find(function (d) { return d.drawId === params.drawId; })
|
|
32616
32662
|
: undefined;
|
|
32617
32663
|
// drawDefinition cannot have both tieFormat and matchUpFormat
|
|
32618
32664
|
var tieFormat = params.tieFormat, matchUpFormat = params.matchUpFormat;
|
|
@@ -32620,15 +32666,15 @@ function generateDrawDefinition(params) {
|
|
|
32620
32666
|
if (matchUpType === TEAM$1 && eventType === TEAM$1) {
|
|
32621
32667
|
// if there is an existingDrawDefinition which has a tieFormat on MAIN structure
|
|
32622
32668
|
// use this tieFormat ONLY when no tieFormat is specified in params
|
|
32623
|
-
var existingMainTieFormat = (
|
|
32669
|
+
var existingMainTieFormat = (_8 = (_7 = existingDrawDefinition === null || existingDrawDefinition === void 0 ? void 0 : existingDrawDefinition.structures) === null || _7 === void 0 ? void 0 : _7.find(function (_a) {
|
|
32624
32670
|
var stage = _a.stage;
|
|
32625
32671
|
return stage === MAIN;
|
|
32626
|
-
})) === null ||
|
|
32672
|
+
})) === null || _8 === void 0 ? void 0 : _8.tieFormat;
|
|
32627
32673
|
tieFormat =
|
|
32628
32674
|
tieFormat ||
|
|
32629
32675
|
existingMainTieFormat ||
|
|
32630
32676
|
// if tieFormatName is provided and it matches the name of the tieFormat attached to parent event...
|
|
32631
|
-
(tieFormatName && ((
|
|
32677
|
+
(tieFormatName && ((_9 = event === null || event === void 0 ? void 0 : event.tieFormat) === null || _9 === void 0 ? void 0 : _9.tieFormatName) === tieFormatName && event.tieFormat) ||
|
|
32632
32678
|
// if the tieFormatName is not found in the factory then will use default
|
|
32633
32679
|
(tieFormatName &&
|
|
32634
32680
|
tieFormatDefaults({
|
|
@@ -32682,7 +32728,7 @@ function generateDrawDefinition(params) {
|
|
|
32682
32728
|
var result = checkTieFormat({ tieFormat: tieFormat });
|
|
32683
32729
|
if (result.error)
|
|
32684
32730
|
return decorateResult({ result: result, stack: stack });
|
|
32685
|
-
drawDefinition.tieFormat = (
|
|
32731
|
+
drawDefinition.tieFormat = (_10 = result.tieFormat) !== null && _10 !== void 0 ? _10 : tieFormat;
|
|
32686
32732
|
}
|
|
32687
32733
|
else if (matchUpFormat) {
|
|
32688
32734
|
var result = setMatchUpMatchUpFormat({
|
|
@@ -32720,8 +32766,8 @@ function generateDrawDefinition(params) {
|
|
|
32720
32766
|
}
|
|
32721
32767
|
else {
|
|
32722
32768
|
try {
|
|
32723
|
-
for (var
|
|
32724
|
-
var key =
|
|
32769
|
+
for (var _38 = __values(Object.keys(policyDefinitions)), _39 = _38.next(); !_39.done; _39 = _38.next()) {
|
|
32770
|
+
var key = _39.value;
|
|
32725
32771
|
if (JSON.stringify(appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[key]) !== JSON.stringify(policyDefinitions[key])) {
|
|
32726
32772
|
policiesToAttach[key] = policyDefinitions[key];
|
|
32727
32773
|
}
|
|
@@ -32730,7 +32776,7 @@ function generateDrawDefinition(params) {
|
|
|
32730
32776
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
32731
32777
|
finally {
|
|
32732
32778
|
try {
|
|
32733
|
-
if (
|
|
32779
|
+
if (_39 && !_39.done && (_b = _38.return)) _b.call(_38);
|
|
32734
32780
|
}
|
|
32735
32781
|
finally { if (e_1) throw e_1.error; }
|
|
32736
32782
|
}
|
|
@@ -32756,17 +32802,17 @@ function generateDrawDefinition(params) {
|
|
|
32756
32802
|
}
|
|
32757
32803
|
// ---------------------------------------------------------------------------
|
|
32758
32804
|
// find existing MAIN structureId if existingDrawDefinition
|
|
32759
|
-
var structureId = (
|
|
32805
|
+
var structureId = (_12 = (_11 = existingDrawDefinition === null || existingDrawDefinition === void 0 ? void 0 : existingDrawDefinition.structures) === null || _11 === void 0 ? void 0 : _11.find(function (structure) { return structure.stage === MAIN && structure.stageSequence === 1; })) === null || _12 === void 0 ? void 0 : _12.structureId;
|
|
32760
32806
|
var entries = drawEntries !== null && drawEntries !== void 0 ? drawEntries : eventEntries;
|
|
32761
32807
|
var positioningReports = [];
|
|
32762
32808
|
var drawTypeResult;
|
|
32763
32809
|
var conflicts = [];
|
|
32764
|
-
var generateQualifyingPlaceholder = params.qualifyingPlaceholder && !((
|
|
32810
|
+
var generateQualifyingPlaceholder = params.qualifyingPlaceholder && !((_13 = params.qualifyingProfiles) === null || _13 === void 0 ? void 0 : _13.length) && !existingDrawDefinition;
|
|
32765
32811
|
var existingQualifyingStructures = existingDrawDefinition
|
|
32766
|
-
? (
|
|
32812
|
+
? (_14 = existingDrawDefinition.structures) === null || _14 === void 0 ? void 0 : _14.filter(function (structure) { return structure.stage === QUALIFYING; })
|
|
32767
32813
|
: [];
|
|
32768
32814
|
var existingQualifyingPlaceholderStructureId = (existingQualifyingStructures === null || existingQualifyingStructures === void 0 ? void 0 : existingQualifyingStructures.length) === 1 &&
|
|
32769
|
-
!((
|
|
32815
|
+
!((_15 = existingQualifyingStructures[0].matchUps) === null || _15 === void 0 ? void 0 : _15.length) &&
|
|
32770
32816
|
existingQualifyingStructures[0].structureId;
|
|
32771
32817
|
if (existingQualifyingPlaceholderStructureId) {
|
|
32772
32818
|
var qualifyingProfiles = params.qualifyingProfiles;
|
|
@@ -32782,24 +32828,24 @@ function generateDrawDefinition(params) {
|
|
|
32782
32828
|
if (qualifyingResult === null || qualifyingResult === void 0 ? void 0 : qualifyingResult.error) {
|
|
32783
32829
|
return qualifyingResult;
|
|
32784
32830
|
}
|
|
32785
|
-
drawDefinition.structures = (
|
|
32831
|
+
drawDefinition.structures = (_16 = drawDefinition.structures) === null || _16 === void 0 ? void 0 : _16.filter(function (_a) {
|
|
32786
32832
|
var structureId = _a.structureId;
|
|
32787
32833
|
return structureId !== existingQualifyingPlaceholderStructureId;
|
|
32788
32834
|
});
|
|
32789
|
-
drawDefinition.links = (
|
|
32835
|
+
drawDefinition.links = (_17 = drawDefinition.links) === null || _17 === void 0 ? void 0 : _17.filter(function (_a) {
|
|
32790
32836
|
var source = _a.source;
|
|
32791
32837
|
return source.structureId !== existingQualifyingPlaceholderStructureId;
|
|
32792
32838
|
});
|
|
32793
|
-
var
|
|
32839
|
+
var _40 = qualifyingResult !== null && qualifyingResult !== void 0 ? qualifyingResult : {}, qualifiersCount = _40.qualifiersCount, qualifyingDrawPositionsCount = _40.qualifyingDrawPositionsCount, qualifyingDetails = _40.qualifyingDetails;
|
|
32794
32840
|
if (qualifyingDrawPositionsCount) {
|
|
32795
32841
|
if (qualifyingResult === null || qualifyingResult === void 0 ? void 0 : qualifyingResult.structures) {
|
|
32796
|
-
(
|
|
32842
|
+
(_18 = drawDefinition.structures) === null || _18 === void 0 ? void 0 : _18.push.apply(_18, __spreadArray([], __read(qualifyingResult.structures), false));
|
|
32797
32843
|
}
|
|
32798
32844
|
if (qualifyingResult === null || qualifyingResult === void 0 ? void 0 : qualifyingResult.links) {
|
|
32799
|
-
(
|
|
32845
|
+
(_19 = drawDefinition.links) === null || _19 === void 0 ? void 0 : _19.push.apply(_19, __spreadArray([], __read(qualifyingResult.links), false));
|
|
32800
32846
|
}
|
|
32801
32847
|
}
|
|
32802
|
-
var mainStructure = (
|
|
32848
|
+
var mainStructure = (_20 = drawDefinition.structures) === null || _20 === void 0 ? void 0 : _20.find(function (_a) {
|
|
32803
32849
|
var stage = _a.stage, stageSequence = _a.stageSequence;
|
|
32804
32850
|
return stage === MAIN && stageSequence === 1;
|
|
32805
32851
|
});
|
|
@@ -32825,12 +32871,12 @@ function generateDrawDefinition(params) {
|
|
|
32825
32871
|
if (result.error)
|
|
32826
32872
|
return result;
|
|
32827
32873
|
try {
|
|
32828
|
-
for (var
|
|
32874
|
+
for (var _41 = __values((drawEntries !== null && drawEntries !== void 0 ? drawEntries : []).filter(function (_a) {
|
|
32829
32875
|
var entryStage = _a.entryStage;
|
|
32830
32876
|
return entryStage === QUALIFYING;
|
|
32831
|
-
})),
|
|
32832
|
-
var entry =
|
|
32833
|
-
var entryData = __assign(__assign({}, entry), { entryStage: (
|
|
32877
|
+
})), _42 = _41.next(); !_42.done; _42 = _41.next()) {
|
|
32878
|
+
var entry = _42.value;
|
|
32879
|
+
var entryData = __assign(__assign({}, entry), { entryStage: (_21 = entry.entryStage) !== null && _21 !== void 0 ? _21 : MAIN, drawDefinition: drawDefinition });
|
|
32834
32880
|
// ignore errors (EXITING_PARTICIPANT)
|
|
32835
32881
|
addDrawEntry(entryData);
|
|
32836
32882
|
}
|
|
@@ -32838,23 +32884,23 @@ function generateDrawDefinition(params) {
|
|
|
32838
32884
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
32839
32885
|
finally {
|
|
32840
32886
|
try {
|
|
32841
|
-
if (
|
|
32887
|
+
if (_42 && !_42.done && (_c = _41.return)) _c.call(_41);
|
|
32842
32888
|
}
|
|
32843
32889
|
finally { if (e_2) throw e_2.error; }
|
|
32844
32890
|
}
|
|
32845
32891
|
try {
|
|
32846
|
-
for (var
|
|
32847
|
-
var qualifyingDetail =
|
|
32892
|
+
for (var _43 = __values(qualifyingDetails || []), _44 = _43.next(); !_44.done; _44 = _43.next()) {
|
|
32893
|
+
var qualifyingDetail = _44.value;
|
|
32848
32894
|
var qualifyingRoundNumber = qualifyingDetail.finalQualifyingRoundNumber, qualifyingStructureId = qualifyingDetail.finalQualifyingStructureId, targetEntryRound = qualifyingDetail.roundTarget, finishingPositions = qualifyingDetail.finishingPositions, linkType = qualifyingDetail.linkType;
|
|
32849
32895
|
var link = mainStructure &&
|
|
32850
|
-
((
|
|
32896
|
+
((_22 = generateQualifyingLink({
|
|
32851
32897
|
targetStructureId: mainStructure.structureId,
|
|
32852
32898
|
sourceStructureId: qualifyingStructureId,
|
|
32853
32899
|
sourceRoundNumber: qualifyingRoundNumber,
|
|
32854
32900
|
finishingPositions: finishingPositions,
|
|
32855
32901
|
targetEntryRound: targetEntryRound,
|
|
32856
32902
|
linkType: linkType,
|
|
32857
|
-
})) === null ||
|
|
32903
|
+
})) === null || _22 === void 0 ? void 0 : _22.link);
|
|
32858
32904
|
if (link === null || link === void 0 ? void 0 : link.error)
|
|
32859
32905
|
return link;
|
|
32860
32906
|
if (link) {
|
|
@@ -32867,7 +32913,7 @@ function generateDrawDefinition(params) {
|
|
|
32867
32913
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
32868
32914
|
finally {
|
|
32869
32915
|
try {
|
|
32870
|
-
if (
|
|
32916
|
+
if (_44 && !_44.done && (_d = _43.return)) _d.call(_43);
|
|
32871
32917
|
}
|
|
32872
32918
|
finally { if (e_3) throw e_3.error; }
|
|
32873
32919
|
}
|
|
@@ -32886,7 +32932,7 @@ function generateDrawDefinition(params) {
|
|
|
32886
32932
|
// if drawEntries and entryStage !== stage ignore
|
|
32887
32933
|
if (drawEntries && entry.entryStage && entry.entryStage !== MAIN)
|
|
32888
32934
|
continue;
|
|
32889
|
-
var entryData = __assign(__assign({}, entry), { ignoreStageSpace: ignoreStageSpace !== null && ignoreStageSpace !== void 0 ? ignoreStageSpace : drawType === AD_HOC, entryStage: (
|
|
32935
|
+
var entryData = __assign(__assign({}, entry), { ignoreStageSpace: ignoreStageSpace !== null && ignoreStageSpace !== void 0 ? ignoreStageSpace : drawType === AD_HOC, entryStage: (_23 = entry.entryStage) !== null && _23 !== void 0 ? _23 : MAIN, drawDefinition: drawDefinition, drawType: drawType });
|
|
32890
32936
|
var result = addDrawEntry(entryData);
|
|
32891
32937
|
if (drawEntries && result.error) {
|
|
32892
32938
|
// only report errors with drawEntries
|
|
@@ -32903,8 +32949,7 @@ function generateDrawDefinition(params) {
|
|
|
32903
32949
|
finally { if (e_4) throw e_4.error; }
|
|
32904
32950
|
}
|
|
32905
32951
|
// temporary until seeding is supported in LUCKY_DRAW
|
|
32906
|
-
|
|
32907
|
-
seedsCount = 0;
|
|
32952
|
+
var seedsCount = drawType === LUCKY_DRAW ? 0 : ensureInt((_24 = params.seedsCount) !== null && _24 !== void 0 ? _24 : 0);
|
|
32908
32953
|
var structureResult = prepareStage(__assign(__assign(__assign({}, drawTypeResult), params), { qualifyingOnly: !drawSize || qualifyingOnly, // ooo!! If there is no drawSize then MAIN is not being generated
|
|
32909
32954
|
appliedPolicies: appliedPolicies, drawDefinition: drawDefinition, seedingProfile: seedingProfile, participants: participants, stage: MAIN, seedsCount: seedsCount, placeByes: placeByes, drawSize: drawSize, entries: entries }));
|
|
32910
32955
|
if (structureResult.error && !structureResult.conflicts) {
|
|
@@ -32923,7 +32968,7 @@ function generateDrawDefinition(params) {
|
|
|
32923
32968
|
var participantIds = entries_2 === null || entries_2 === void 0 ? void 0 : entries_2.map(getParticipantId);
|
|
32924
32969
|
var matchUpsCount_1 = entries_2 ? Math.floor(entries_2.length / 2) : 0;
|
|
32925
32970
|
if (params.automated) {
|
|
32926
|
-
var
|
|
32971
|
+
var _45 = (_27 = params.drawMatic) !== null && _27 !== void 0 ? _27 : {}, restrictEntryStatus = _45.restrictEntryStatus, generateMatchUps = _45.generateMatchUps, structureId_1 = _45.structureId, matchUpIds = _45.matchUpIds, scaleName = _45.scaleName;
|
|
32927
32972
|
var result = drawMatic({
|
|
32928
32973
|
eventType: (_29 = (_28 = params.drawMatic) === null || _28 === void 0 ? void 0 : _28.eventType) !== null && _29 !== void 0 ? _29 : matchUpType,
|
|
32929
32974
|
generateMatchUps: generateMatchUps !== null && generateMatchUps !== void 0 ? generateMatchUps : true,
|
|
@@ -32975,8 +33020,8 @@ function generateDrawDefinition(params) {
|
|
|
32975
33020
|
var roundTarget = 1;
|
|
32976
33021
|
params.qualifyingProfiles.sort(roundTargetSort);
|
|
32977
33022
|
try {
|
|
32978
|
-
for (var
|
|
32979
|
-
var roundTargetProfile =
|
|
33023
|
+
for (var _46 = __values(params.qualifyingProfiles), _47 = _46.next(); !_47.done; _47 = _46.next()) {
|
|
33024
|
+
var roundTargetProfile = _47.value;
|
|
32980
33025
|
if (!Array.isArray(roundTargetProfile.structureProfiles))
|
|
32981
33026
|
return decorateResult({
|
|
32982
33027
|
info: mustBeAnArray('structureProfiles'),
|
|
@@ -32989,8 +33034,8 @@ function generateDrawDefinition(params) {
|
|
|
32989
33034
|
try {
|
|
32990
33035
|
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()) {
|
|
32991
33036
|
var structureProfile = sortedStructureProfiles_1_1.value;
|
|
32992
|
-
var qualifyingRoundNumber = structureProfile.qualifyingRoundNumber, qualifyingPositions = structureProfile.qualifyingPositions, seededParticipants = structureProfile.seededParticipants, seedingScaleName = structureProfile.seedingScaleName,
|
|
32993
|
-
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:
|
|
33037
|
+
var qualifyingRoundNumber = structureProfile.qualifyingRoundNumber, qualifyingPositions = structureProfile.qualifyingPositions, seededParticipants = structureProfile.seededParticipants, seedingScaleName = structureProfile.seedingScaleName, _48 = structureProfile.seedsCount, seedsCount = _48 === void 0 ? 0 : _48, seedByRanking = structureProfile.seedByRanking, placeByes_1 = structureProfile.placeByes, drawSize_1 = structureProfile.drawSize;
|
|
33038
|
+
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, placeByes: placeByes_1, drawSize: drawSize_1, entries: entries }));
|
|
32994
33039
|
if (qualifyingStageResult.error) {
|
|
32995
33040
|
return qualifyingStageResult;
|
|
32996
33041
|
}
|
|
@@ -33019,7 +33064,7 @@ function generateDrawDefinition(params) {
|
|
|
33019
33064
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
33020
33065
|
finally {
|
|
33021
33066
|
try {
|
|
33022
|
-
if (
|
|
33067
|
+
if (_47 && !_47.done && (_g = _46.return)) _g.call(_46);
|
|
33023
33068
|
}
|
|
33024
33069
|
finally { if (e_5) throw e_5.error; }
|
|
33025
33070
|
}
|
|
@@ -48579,9 +48624,11 @@ function generateAddress(addressAttributes) {
|
|
|
48579
48624
|
|
|
48580
48625
|
var lastNames = [
|
|
48581
48626
|
"Abbey",
|
|
48582
|
-
"Assange",
|
|
48583
48627
|
"Ahern",
|
|
48584
48628
|
"Ampleforth",
|
|
48629
|
+
"Ananiadis",
|
|
48630
|
+
"Andelic",
|
|
48631
|
+
"Assange",
|
|
48585
48632
|
"Atreides",
|
|
48586
48633
|
"Austen",
|
|
48587
48634
|
"Bach",
|
|
@@ -48618,6 +48665,7 @@ var lastNames = [
|
|
|
48618
48665
|
"Escher",
|
|
48619
48666
|
"Eyre",
|
|
48620
48667
|
"Faulkner",
|
|
48668
|
+
"Fulcher",
|
|
48621
48669
|
"Fukuoka",
|
|
48622
48670
|
"Godel",
|
|
48623
48671
|
"Goldstein",
|
|
@@ -48683,6 +48731,7 @@ var lastNames = [
|
|
|
48683
48731
|
"Watson",
|
|
48684
48732
|
"Wolin",
|
|
48685
48733
|
"Wirt",
|
|
48734
|
+
"Waschuk",
|
|
48686
48735
|
"Wormwood"
|
|
48687
48736
|
];
|
|
48688
48737
|
var firstFemale = [
|
|
@@ -48761,10 +48810,12 @@ var firstMale = [
|
|
|
48761
48810
|
"August",
|
|
48762
48811
|
"Axel",
|
|
48763
48812
|
"Barda",
|
|
48813
|
+
"Barry",
|
|
48764
48814
|
"Bill",
|
|
48765
48815
|
"Bruce",
|
|
48766
48816
|
"Charles",
|
|
48767
48817
|
"Chris",
|
|
48818
|
+
"Constantine",
|
|
48768
48819
|
"Darwin",
|
|
48769
48820
|
"David",
|
|
48770
48821
|
"Derrick",
|
|
@@ -54647,7 +54698,9 @@ var query$4 = {
|
|
|
54647
54698
|
getCourtInfo: getCourtInfo,
|
|
54648
54699
|
getDrawData: getDrawData,
|
|
54649
54700
|
getEventData: getEventData,
|
|
54701
|
+
getEventPublishStatus: getEventPublishStatus,
|
|
54650
54702
|
getPublishState: getPublishState,
|
|
54703
|
+
getTournamentPublishStatus: getTournamentPublishStatus,
|
|
54651
54704
|
getVenueData: getVenueData
|
|
54652
54705
|
};
|
|
54653
54706
|
|
|
@@ -54658,7 +54711,9 @@ var index$8 = {
|
|
|
54658
54711
|
getCourtInfo: getCourtInfo,
|
|
54659
54712
|
getDrawData: getDrawData,
|
|
54660
54713
|
getEventData: getEventData,
|
|
54714
|
+
getEventPublishStatus: getEventPublishStatus,
|
|
54661
54715
|
getPublishState: getPublishState,
|
|
54716
|
+
getTournamentPublishStatus: getTournamentPublishStatus,
|
|
54662
54717
|
getVenueData: getVenueData,
|
|
54663
54718
|
mutate: mutate$4,
|
|
54664
54719
|
publishEvent: publishEvent,
|