@juki-team/commons 0.1.40 → 0.1.41
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/cjs/index.cjs +1522 -1522
- package/dist/esm/index.js +1522 -1522
- package/package.json +19 -12
package/dist/cjs/index.cjs
CHANGED
|
@@ -1380,21 +1380,6 @@ const COURSE_ROLE = {
|
|
|
1380
1380
|
[CourseRole.SUPER_ADMIN]: { value: CourseRole.SUPER_ADMIN, label: 'super admin', level: 0 },
|
|
1381
1381
|
};
|
|
1382
1382
|
|
|
1383
|
-
const isWorksheetAssignment = (assignment) => {
|
|
1384
|
-
return assignment.type === exports.AssignmentClass.WORKSHEET;
|
|
1385
|
-
};
|
|
1386
|
-
const isCourseAssignment = (assignment) => {
|
|
1387
|
-
return assignment.type === exports.AssignmentClass.COURSE;
|
|
1388
|
-
};
|
|
1389
|
-
const isContestAssignment = (assignment) => {
|
|
1390
|
-
return assignment.type === exports.AssignmentClass.CONTEST;
|
|
1391
|
-
};
|
|
1392
|
-
|
|
1393
|
-
const getAssignmentCommentKey = (classKey, cycleKey, sessionKey, assignmentKey) => `class:${classKey}|cycle:${cycleKey}|session:${sessionKey}|assignment:${assignmentKey}`;
|
|
1394
|
-
const getAssignmentUserCommentKey = (classKey, cycleKey, sessionKey, assignmentKey, userNickname, userCompany) => `class:${classKey}|cycle:${cycleKey}|session:${sessionKey}|assignment:${assignmentKey}|user_nickname:${userNickname}|user_company:${userCompany}`;
|
|
1395
|
-
const getProblemCommentKey = (problemKey) => `problem:${problemKey}`;
|
|
1396
|
-
const getContestCommentKey = (contestKey) => `contest:${contestKey}`;
|
|
1397
|
-
|
|
1398
1383
|
function isStringJson(str) {
|
|
1399
1384
|
try {
|
|
1400
1385
|
if (typeof str === 'string') {
|
|
@@ -1582,484 +1567,384 @@ const areArraysDifferent = (a, b) => {
|
|
|
1582
1567
|
return false;
|
|
1583
1568
|
};
|
|
1584
1569
|
|
|
1585
|
-
const
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
const
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
const
|
|
1607
|
-
switch (true) {
|
|
1608
|
-
case (document?.members?.rankAdministrators === exports.EntityMembersRank.NONE || document?.members?.rankAdministrators === exports.EntityMembersRank.CLOSE)
|
|
1609
|
-
&& document?.members?.rankManagers === exports.EntityMembersRank.OPEN
|
|
1610
|
-
&& (document?.members?.rankGuests === exports.EntityMembersRank.NONE || document?.members?.rankGuests === exports.EntityMembersRank.CLOSE || document?.members?.rankGuests === exports.EntityMembersRank.OPEN)
|
|
1611
|
-
&& document?.members?.rankSpectators === exports.EntityMembersRank.OPEN
|
|
1612
|
-
&& (document?.members?.rankParticipants === exports.EntityMembersRank.NONE || document?.members?.rankParticipants === exports.EntityMembersRank.CLOSE || document?.members?.rankParticipants === exports.EntityMembersRank.OPEN):
|
|
1613
|
-
return exports.EntityAccess.EXPOSED;
|
|
1614
|
-
case (document?.members?.rankAdministrators === exports.EntityMembersRank.NONE || document?.members?.rankAdministrators === exports.EntityMembersRank.CLOSE)
|
|
1615
|
-
&& document?.members?.rankManagers === exports.EntityMembersRank.CLOSE
|
|
1616
|
-
&& (document?.members?.rankGuests === exports.EntityMembersRank.NONE || document?.members?.rankGuests === exports.EntityMembersRank.CLOSE || document?.members?.rankGuests === exports.EntityMembersRank.OPEN)
|
|
1617
|
-
&& document?.members?.rankSpectators === exports.EntityMembersRank.OPEN
|
|
1618
|
-
&& (document?.members?.rankParticipants === exports.EntityMembersRank.NONE || document?.members?.rankParticipants === exports.EntityMembersRank.CLOSE || document?.members?.rankParticipants === exports.EntityMembersRank.OPEN):
|
|
1619
|
-
return exports.EntityAccess.PUBLIC;
|
|
1620
|
-
case (document?.members?.rankAdministrators === exports.EntityMembersRank.NONE || document?.members?.rankAdministrators === exports.EntityMembersRank.CLOSE)
|
|
1621
|
-
&& document?.members?.rankManagers === exports.EntityMembersRank.CLOSE
|
|
1622
|
-
&& (document?.members?.rankGuests === exports.EntityMembersRank.NONE || document?.members?.rankGuests === exports.EntityMembersRank.CLOSE || document?.members?.rankGuests === exports.EntityMembersRank.OPEN)
|
|
1623
|
-
&& document?.members?.rankSpectators === exports.EntityMembersRank.CLOSE
|
|
1624
|
-
&& (document?.members?.rankParticipants === exports.EntityMembersRank.NONE || document?.members?.rankParticipants === exports.EntityMembersRank.CLOSE || document?.members?.rankParticipants === exports.EntityMembersRank.OPEN):
|
|
1625
|
-
return exports.EntityAccess.RESTRICTED;
|
|
1626
|
-
case document?.members?.rankAdministrators === exports.EntityMembersRank.NONE
|
|
1627
|
-
&& document?.members?.rankManagers === exports.EntityMembersRank.NONE
|
|
1628
|
-
&& document?.members?.rankGuests === exports.EntityMembersRank.NONE
|
|
1629
|
-
&& document?.members?.rankSpectators === exports.EntityMembersRank.NONE
|
|
1630
|
-
&& document?.members?.rankParticipants === exports.EntityMembersRank.NONE:
|
|
1631
|
-
return exports.EntityAccess.PRIVATE;
|
|
1632
|
-
default:
|
|
1633
|
-
return exports.EntityAccess.PRIVATE;
|
|
1634
|
-
}
|
|
1635
|
-
};
|
|
1636
|
-
const isUserMember = (member) => {
|
|
1637
|
-
return typeof member.userId === 'string';
|
|
1638
|
-
};
|
|
1639
|
-
const isTeamMember = (member) => {
|
|
1640
|
-
return typeof member.teamId === 'string';
|
|
1641
|
-
};
|
|
1642
|
-
const toEntityMembersDTO = (members) => {
|
|
1643
|
-
return {
|
|
1644
|
-
rankAdministrators: members.rankAdministrators,
|
|
1645
|
-
administrators: Object.keys(members.administrators),
|
|
1646
|
-
rankManagers: members.rankManagers,
|
|
1647
|
-
managers: Object.keys(members.managers),
|
|
1648
|
-
rankParticipants: members.rankParticipants,
|
|
1649
|
-
participants: Object.keys(members.participants),
|
|
1650
|
-
rankGuests: members.rankGuests,
|
|
1651
|
-
guests: Object.keys(members.guests),
|
|
1652
|
-
rankSpectators: members.rankSpectators,
|
|
1653
|
-
spectators: Object.keys(members.spectators),
|
|
1654
|
-
};
|
|
1655
|
-
};
|
|
1570
|
+
const YEARS = range(1970, 2100);
|
|
1571
|
+
const MONTH_NAMES = [
|
|
1572
|
+
'January',
|
|
1573
|
+
'February',
|
|
1574
|
+
'March',
|
|
1575
|
+
'April',
|
|
1576
|
+
'May',
|
|
1577
|
+
'June',
|
|
1578
|
+
'July',
|
|
1579
|
+
'August',
|
|
1580
|
+
'September',
|
|
1581
|
+
'October',
|
|
1582
|
+
'November',
|
|
1583
|
+
'December',
|
|
1584
|
+
];
|
|
1585
|
+
const DAY_NAMES = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
1586
|
+
const HOURS = range(0, 24);
|
|
1587
|
+
const MINUTES = range(0, 60);
|
|
1588
|
+
const SECONDS = range(0, 60);
|
|
1589
|
+
const MILLISECONDS = range(0, 1000);
|
|
1590
|
+
const MAX_DATE = new Date(8640000000000000);
|
|
1591
|
+
const MIN_DATE = new Date(0);
|
|
1656
1592
|
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1593
|
+
const SUPPORT_EMAIL = 'support@juki.app';
|
|
1594
|
+
const JUKI_APP_EMAIL_TEMPLATE = `<div style="width: 100%; background: #F2F2F2;">
|
|
1595
|
+
<div style="background: #164066; width: 100%;">
|
|
1596
|
+
<div style="height: 56px; color: white; width: 100px; margin: 0 auto">
|
|
1597
|
+
<img
|
|
1598
|
+
src="https://images.juki.pub/assets/juki-app-horizontal-white-logo.svg"
|
|
1599
|
+
alt="juki app logo"
|
|
1600
|
+
height="56px"
|
|
1601
|
+
style="padding:10px; box-sizing: border-box"
|
|
1602
|
+
/>
|
|
1603
|
+
</div>
|
|
1604
|
+
</div>
|
|
1605
|
+
<div style="padding: 24px; color: #333333; font-family: sans-serif; font-size: 16px; line-height: 24px;">
|
|
1606
|
+
<div style="max-width: 520px; margin: 0 auto; padding: 24px; background: white; border-radius: 6px;">
|
|
1607
|
+
<section style="padding: 0 0 1em 0; border-bottom: 1px solid #828282;">
|
|
1608
|
+
{{content}}
|
|
1609
|
+
</section>
|
|
1610
|
+
<div style="font-size: 14px; text-align: center; color: #828282; line-height: 16px; padding-top: 1em">
|
|
1611
|
+
<p style="margin: 0;">
|
|
1612
|
+
Si tú no realizaste la solicitud, escribenos a
|
|
1613
|
+
<a href="mailto:${SUPPORT_EMAIL}" style="color: #2468A6; text-decoration: none;">
|
|
1614
|
+
${SUPPORT_EMAIL}
|
|
1615
|
+
</a>
|
|
1616
|
+
</p>
|
|
1617
|
+
<p style="margin: 0;">
|
|
1618
|
+
Este mensaje fue enviado por el equipo de
|
|
1619
|
+
<a href="https://juki.app" style="color: #2468A6; text-decoration: none;">
|
|
1620
|
+
juki.app
|
|
1621
|
+
</a>
|
|
1622
|
+
</p>
|
|
1623
|
+
</div>
|
|
1624
|
+
</div>
|
|
1625
|
+
</div>
|
|
1626
|
+
</div>`;
|
|
1661
1627
|
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
}
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
}
|
|
1680
|
-
};
|
|
1681
|
-
const clearAsyncInterval = (intervalIndex) => {
|
|
1682
|
-
if (asyncIntervals[intervalIndex]) {
|
|
1683
|
-
asyncIntervals[intervalIndex] = false;
|
|
1684
|
-
}
|
|
1685
|
-
};
|
|
1628
|
+
const EMPTY_DOCUMENT_MEMBERS = () => ({
|
|
1629
|
+
access: exports.EntityAccess.PRIVATE,
|
|
1630
|
+
managers: {},
|
|
1631
|
+
spectators: {},
|
|
1632
|
+
});
|
|
1633
|
+
const EMPTY_ENTITY_MEMBERS = () => ({
|
|
1634
|
+
rankAdministrators: exports.EntityMembersRank.CLOSE,
|
|
1635
|
+
administrators: {},
|
|
1636
|
+
rankManagers: exports.EntityMembersRank.CLOSE,
|
|
1637
|
+
managers: {},
|
|
1638
|
+
rankGuests: exports.EntityMembersRank.CLOSE,
|
|
1639
|
+
guests: {},
|
|
1640
|
+
rankSpectators: exports.EntityMembersRank.CLOSE,
|
|
1641
|
+
spectators: {},
|
|
1642
|
+
rankParticipants: exports.EntityMembersRank.CLOSE,
|
|
1643
|
+
participants: {},
|
|
1644
|
+
});
|
|
1686
1645
|
|
|
1687
|
-
const
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
}
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1646
|
+
const JUDGE = {
|
|
1647
|
+
// [Judge.CUSTOMER]: {
|
|
1648
|
+
// value: Judge.CUSTOMER,
|
|
1649
|
+
// label: '',
|
|
1650
|
+
// logo: 'https://images.juki.pub/c/juki-judge-logo-horizontal-color.svg',
|
|
1651
|
+
// logoSize: [ 883.991, 435 ],
|
|
1652
|
+
// url: '',
|
|
1653
|
+
// // getLoginUrl: () => '',
|
|
1654
|
+
// // getProfileUrl: () => '',
|
|
1655
|
+
// // getSubmitUrl: () => '',
|
|
1656
|
+
// // getSubmissionUrl: () => '',
|
|
1657
|
+
// // getProblemUrl: (key: string) => `/problem/view/${key}`,
|
|
1658
|
+
// // getUserSubmissionsUrl: () => '',
|
|
1659
|
+
// },
|
|
1660
|
+
[exports.Judge.JUKI_JUDGE]: {
|
|
1661
|
+
value: exports.Judge.JUKI_JUDGE,
|
|
1662
|
+
label: 'Juki Judge',
|
|
1663
|
+
logo: 'https://images.juki.pub/c/juki-judge-logo-horizontal-color.svg',
|
|
1664
|
+
logoSize: [883.991, 435],
|
|
1665
|
+
url: 'https://judge.juki.app',
|
|
1666
|
+
// getLoginUrl: () => '',
|
|
1667
|
+
// getProfileUrl: () => '',
|
|
1668
|
+
// getSubmitUrl: () => '',
|
|
1669
|
+
// getSubmissionUrl: () => '',
|
|
1670
|
+
// getProblemUrl: (key: string) => `https://judge.juki.app/problem/view/${key}`,
|
|
1671
|
+
// getUserSubmissionsUrl: () => '',
|
|
1672
|
+
},
|
|
1673
|
+
[exports.Judge.CODEFORCES]: {
|
|
1674
|
+
value: exports.Judge.CODEFORCES,
|
|
1675
|
+
label: 'Codeforces',
|
|
1676
|
+
logo: 'https://images.juki.pub/c/codeforces-logo-horizontal-color.svg',
|
|
1677
|
+
logoSize: [1232.75, 145.12],
|
|
1678
|
+
url: 'https://codeforces.com',
|
|
1679
|
+
// getLoginUrl: () => 'https://codeforces.com/enter',
|
|
1680
|
+
// getProfileUrl: () => '',
|
|
1681
|
+
// getSubmitUrl: () => 'https://codeforces.com/problemset/submit',
|
|
1682
|
+
// getSubmissionUrl: (problemKey: string, submissionId: string) => {
|
|
1683
|
+
// const [ contestId ] = problemKey.split('-');
|
|
1684
|
+
// return `https://codeforces.com/problemset/submission/${contestId}/${submissionId}`;
|
|
1685
|
+
// },
|
|
1686
|
+
// getProblemUrl: (problemKey: string) => {
|
|
1687
|
+
// const [ contestId, index ] = problemKey.split('-');
|
|
1688
|
+
// return `https://codeforces.com/problemset/problem/${contestId}/${index}`;
|
|
1689
|
+
// },
|
|
1690
|
+
// getUserSubmissionsUrl: () => '',
|
|
1691
|
+
},
|
|
1692
|
+
[exports.Judge.CODEFORCES_GYM]: {
|
|
1693
|
+
value: exports.Judge.CODEFORCES_GYM,
|
|
1694
|
+
label: 'Codeforces Gym',
|
|
1695
|
+
logo: 'https://images.juki.pub/c/codeforces-logo-horizontal-color.svg',
|
|
1696
|
+
logoSize: [1232.75, 145.12],
|
|
1697
|
+
url: 'https://codeforces.com',
|
|
1698
|
+
// getLoginUrl: () => 'https://codeforces.com/enter',
|
|
1699
|
+
// getProfileUrl: () => '',
|
|
1700
|
+
// getSubmitUrl: (problemKey: string) => {
|
|
1701
|
+
// const [ gymContestId, index ] = problemKey.split('-');
|
|
1702
|
+
// return `https://codeforces.com/gym/${gymContestId}/submit`;
|
|
1703
|
+
// },
|
|
1704
|
+
// getSubmissionUrl: (problemKey: string, submissionId: string) => {
|
|
1705
|
+
// const [ gymContestId ] = problemKey.split('-');
|
|
1706
|
+
// return `https://codeforces.com/gym/${gymContestId}/submission/${submissionId}`;
|
|
1707
|
+
// },
|
|
1708
|
+
// getProblemUrl: (problemKey: string) => {
|
|
1709
|
+
// const [ gymContestId, index ] = problemKey.split('-');
|
|
1710
|
+
// return `https://codeforces.com/gym/${gymContestId}/problem/${index}`;
|
|
1711
|
+
// },
|
|
1712
|
+
// getUserSubmissionsUrl: () => '',
|
|
1713
|
+
},
|
|
1714
|
+
[exports.Judge.JV_UMSA]: {
|
|
1715
|
+
value: exports.Judge.JV_UMSA,
|
|
1716
|
+
label: 'Juez Virtual UMSA',
|
|
1717
|
+
logo: 'https://images.juki.pub/c/codeforces-logo-horizontal-color.svg',
|
|
1718
|
+
logoSize: [1232.75, 145.12],
|
|
1719
|
+
url: 'https://jv.umsa.bo',
|
|
1720
|
+
// getLoginUrl: () => 'https://jv.umsa.bo/oj/login.php',
|
|
1721
|
+
// getProfileUrl: () => 'https://jv.umsa.bo/oj/userInfo.php',
|
|
1722
|
+
// getSubmitUrl: (problemKey: string) => {
|
|
1723
|
+
// // single problem: '1019'
|
|
1724
|
+
// // cib problem: '1019-A'
|
|
1725
|
+
// const isContestProblem = problemKey.includes('-');
|
|
1726
|
+
// // A -> 0, B -> 1, C -> 2, D -> 3, E -> 4, F -> 5, G -> 6, H -> 7, I -> 8, J -> 9
|
|
1727
|
+
// const params = problemKey.split('-');
|
|
1728
|
+
// return isContestProblem
|
|
1729
|
+
// ? `https://jv.umsa.bo/oj/submitpage.php?cid=${params[0]}&pid=${params[1].charCodeAt(0) - 65}`
|
|
1730
|
+
// : `https://jv.umsa.bo/oj/submitpage.php?id=${problemKey}`;
|
|
1731
|
+
// },
|
|
1732
|
+
// getSubmissionUrl: (problemKey: string, submissionId: string, username: string) => {
|
|
1733
|
+
// // return `https://jv.umsa.bo/status.php?problem_id=&user_id=${username}&language=-1&jresult=-1`;
|
|
1734
|
+
// return `https://jv.umsa.bo/oj/showsource.php?id=${submissionId}`;
|
|
1735
|
+
// },
|
|
1736
|
+
// getProblemUrl: (problemKey: string) => {
|
|
1737
|
+
// const isContestProblem = problemKey.includes('-');
|
|
1738
|
+
// const params = problemKey.split('-');
|
|
1739
|
+
// return isContestProblem
|
|
1740
|
+
// ? `https://jv.umsa.bo/oj/problem.php?cid=${params[0]}&pid=${params[1].charCodeAt(0) - 65}`
|
|
1741
|
+
// : `https://jv.umsa.bo/oj/problem.php?id=${problemKey}`;
|
|
1742
|
+
// },
|
|
1743
|
+
// getUserSubmissionsUrl: (username: string) => `https://jv.umsa.bo/oj/status.php?user_id=${username}`,
|
|
1744
|
+
},
|
|
1745
|
+
[exports.Judge.UVA_ONLINE_JUDGE]: {
|
|
1746
|
+
value: exports.Judge.UVA_ONLINE_JUDGE,
|
|
1747
|
+
label: 'Uva Online Judge',
|
|
1748
|
+
logo: 'https://images.juki.pub/c/uva-online-judge-logo-color.png',
|
|
1749
|
+
logoSize: [150, 135.994],
|
|
1750
|
+
url: 'https://onlinejudge.org',
|
|
1751
|
+
},
|
|
1752
|
+
[exports.Judge.AT_CODER]: {
|
|
1753
|
+
value: exports.Judge.AT_CODER,
|
|
1754
|
+
label: 'AtCoder',
|
|
1755
|
+
logo: 'https://images.juki.pub/c/at-coder-logo-color.png',
|
|
1756
|
+
logoSize: [762.997, 675],
|
|
1757
|
+
url: 'https://atcoder.jp',
|
|
1758
|
+
},
|
|
1759
|
+
[exports.Judge.CODECHEF]: {
|
|
1760
|
+
value: exports.Judge.CODECHEF,
|
|
1761
|
+
label: 'Codechef',
|
|
1762
|
+
logo: 'https://images.juki.pub/c/codechef-logo-color.svg',
|
|
1763
|
+
logoSize: [1207.7, 453.17],
|
|
1764
|
+
url: 'https://www.codechef.com',
|
|
1765
|
+
},
|
|
1766
|
+
[exports.Judge.TOPCODER]: {
|
|
1767
|
+
value: exports.Judge.TOPCODER,
|
|
1768
|
+
label: 'Topcoder',
|
|
1769
|
+
logo: 'https://images.juki.pub/c/topcoder-logo-color.png',
|
|
1770
|
+
logoSize: [971.99, 415.99],
|
|
1771
|
+
url: 'https://www.topcoder.com',
|
|
1772
|
+
},
|
|
1773
|
+
[exports.Judge.LEETCODE]: {
|
|
1774
|
+
value: exports.Judge.LEETCODE,
|
|
1775
|
+
label: 'LeetCode',
|
|
1776
|
+
logo: 'https://images.juki.pub/assets/leetcode-logo-color.svg',
|
|
1777
|
+
logoSize: [95, 111],
|
|
1778
|
+
url: 'https://leetcode.com',
|
|
1779
|
+
// getProblemUrl: (problemKey: string) => {
|
|
1780
|
+
// return `https://leetcode.com/problems/${problemKey.replace('PL-', '')}`;
|
|
1781
|
+
// },
|
|
1782
|
+
// getProfileUrl: (userNickname: string) => {
|
|
1783
|
+
// return `https://leetcode.com/u/${userNickname}`;
|
|
1784
|
+
// },
|
|
1785
|
+
// getSubmissionUrl: (problemKey: string, submissionId: string, username: string, submissionRunId: string) => {
|
|
1786
|
+
// return `https://leetcode.com/problems/${problemKey.replace('PL-', '')}/submissions/${submissionRunId}`;
|
|
1787
|
+
// },
|
|
1788
|
+
},
|
|
1776
1789
|
};
|
|
1777
|
-
const
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
}
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
}
|
|
1790
|
+
const RUNNER_ACCEPTED_PROBLEM_MODES = [
|
|
1791
|
+
exports.ProblemScoringMode.TOTAL,
|
|
1792
|
+
exports.ProblemScoringMode.SUBTASK,
|
|
1793
|
+
exports.ProblemScoringMode.PARTIAL,
|
|
1794
|
+
];
|
|
1795
|
+
const RUNNER_ACCEPTED_PROBLEM_TYPES = [
|
|
1796
|
+
exports.ProblemType.STANDARD,
|
|
1797
|
+
exports.ProblemType.DYNAMIC,
|
|
1798
|
+
];
|
|
1799
|
+
const RUNNER_ACCEPTED_PROGRAMMING_LANGUAGES = [
|
|
1800
|
+
exports.CodeLanguage.C_11,
|
|
1801
|
+
exports.CodeLanguage.CPP_11,
|
|
1802
|
+
exports.CodeLanguage.CPP_20,
|
|
1803
|
+
exports.CodeLanguage.JAVA_21,
|
|
1804
|
+
exports.CodeLanguage.PYTHON_3,
|
|
1805
|
+
exports.CodeLanguage.PYTHON_PYPY_3,
|
|
1806
|
+
exports.CodeLanguage.JAVASCRIPT_NODE_JS_22,
|
|
1807
|
+
exports.CodeLanguage.PSEUDOCODE_PSEINT,
|
|
1808
|
+
];
|
|
1809
|
+
const ACCEPTED_PROGRAMMING_LANGUAGES = [
|
|
1810
|
+
...RUNNER_ACCEPTED_PROGRAMMING_LANGUAGES,
|
|
1811
|
+
];
|
|
1812
|
+
const PROBLEM_VERDICT = {
|
|
1813
|
+
[exports.ProblemVerdict.NONE]: { value: exports.ProblemVerdict.NONE, label: 'none', color: '#555555' },
|
|
1814
|
+
[exports.ProblemVerdict.PENDING]: { value: exports.ProblemVerdict.PENDING, label: 'pending', color: '#79B6FD' },
|
|
1815
|
+
[exports.ProblemVerdict.HIDDEN]: { value: exports.ProblemVerdict.HIDDEN, label: 'hidden', color: '#555555' },
|
|
1816
|
+
[exports.ProblemVerdict.AC]: { value: exports.ProblemVerdict.AC, label: 'accepted', color: '#43D787' },
|
|
1817
|
+
[exports.ProblemVerdict.PE]: { value: exports.ProblemVerdict.PE, label: 'presentation error', color: '#55db93' },
|
|
1818
|
+
[exports.ProblemVerdict.PA]: { value: exports.ProblemVerdict.PA, label: 'partial accepted', color: '#55db93' },
|
|
1819
|
+
[exports.ProblemVerdict.CE]: { value: exports.ProblemVerdict.CE, label: 'compilation error', color: '#FE9F9F' },
|
|
1820
|
+
[exports.ProblemVerdict.RE]: { value: exports.ProblemVerdict.RE, label: 'runtime error', color: '#FE9F9F' },
|
|
1821
|
+
[exports.ProblemVerdict.TLE]: { value: exports.ProblemVerdict.TLE, label: 'time limit exceed', color: '#FE9F9F' },
|
|
1822
|
+
[exports.ProblemVerdict.MLE]: { value: exports.ProblemVerdict.MLE, label: 'memory limit exceed', color: '#FE9F9F' },
|
|
1823
|
+
[exports.ProblemVerdict.WA]: { value: exports.ProblemVerdict.WA, label: 'wrong answer', color: '#FE9F9F' },
|
|
1809
1824
|
};
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
};
|
|
1851
|
-
Date.prototype.changeMonth = function (monthIndex) {
|
|
1852
|
-
const newDate = new Date(this);
|
|
1853
|
-
newDate.setMonth(monthIndex);
|
|
1854
|
-
return newDate;
|
|
1855
|
-
};
|
|
1856
|
-
Date.prototype.changeDay = function (date) {
|
|
1857
|
-
const newDate = new Date(this);
|
|
1858
|
-
newDate.setDate(date);
|
|
1859
|
-
return newDate;
|
|
1860
|
-
};
|
|
1861
|
-
Date.prototype.changeHours = function (hours) {
|
|
1862
|
-
const newDate = new Date(this);
|
|
1863
|
-
newDate.setHours(hours);
|
|
1864
|
-
return newDate;
|
|
1865
|
-
};
|
|
1866
|
-
Date.prototype.changeMinutes = function (minutes) {
|
|
1867
|
-
const newDate = new Date(this);
|
|
1868
|
-
newDate.setMinutes(minutes);
|
|
1869
|
-
return newDate;
|
|
1870
|
-
};
|
|
1871
|
-
Date.prototype.changeSeconds = function (seconds) {
|
|
1872
|
-
const newDate = new Date(this);
|
|
1873
|
-
newDate.setSeconds(seconds);
|
|
1874
|
-
return newDate;
|
|
1875
|
-
};
|
|
1876
|
-
Date.prototype.changeMilliseconds = function (milliseconds) {
|
|
1877
|
-
const newDate = new Date(this);
|
|
1878
|
-
newDate.setMilliseconds(milliseconds);
|
|
1879
|
-
return newDate;
|
|
1880
|
-
};
|
|
1881
|
-
Date.prototype.decreaseYear = function (count = 1) {
|
|
1882
|
-
return this.changeYear(this.getFullYear() - count);
|
|
1883
|
-
};
|
|
1884
|
-
Date.prototype.increaseYear = function (count = 1) {
|
|
1885
|
-
return this.changeYear(this.getFullYear() + count);
|
|
1886
|
-
};
|
|
1887
|
-
Date.prototype.decreaseMonth = function () {
|
|
1888
|
-
const newDate = new Date(this);
|
|
1889
|
-
newDate.setMonth(newDate.getMonth() - 1);
|
|
1890
|
-
return newDate;
|
|
1891
|
-
};
|
|
1892
|
-
Date.prototype.increaseMonth = function () {
|
|
1893
|
-
const newDate = new Date(this);
|
|
1894
|
-
newDate.setMonth(newDate.getMonth() + 1);
|
|
1895
|
-
return newDate;
|
|
1896
|
-
};
|
|
1897
|
-
Date.prototype.increaseDay = function () {
|
|
1898
|
-
const newDate = new Date(this);
|
|
1899
|
-
newDate.setDate(newDate.getDate() + 1);
|
|
1900
|
-
return newDate;
|
|
1901
|
-
};
|
|
1902
|
-
Date.prototype.decreaseDay = function () {
|
|
1903
|
-
const newDate = new Date(this);
|
|
1904
|
-
newDate.setDate(newDate.getDate() - 1);
|
|
1905
|
-
return newDate;
|
|
1906
|
-
};
|
|
1907
|
-
Date.prototype.startOfYear = function () {
|
|
1908
|
-
const newDate = new Date(this);
|
|
1909
|
-
newDate.setMonth(0);
|
|
1910
|
-
return newDate.startOfMonth();
|
|
1911
|
-
};
|
|
1912
|
-
Date.prototype.endOfYear = function () {
|
|
1913
|
-
const nextMonth = this.increaseYear().startOfYear();
|
|
1914
|
-
return new Date(nextMonth.getTime() - 1);
|
|
1915
|
-
};
|
|
1916
|
-
Date.prototype.startOfMonth = function () {
|
|
1917
|
-
const newDate = new Date(this);
|
|
1918
|
-
newDate.setDate(1);
|
|
1919
|
-
return newDate.startOfDay();
|
|
1920
|
-
};
|
|
1921
|
-
Date.prototype.endOfMonth = function () {
|
|
1922
|
-
const nextMonth = this.increaseMonth().startOfMonth();
|
|
1923
|
-
return new Date(nextMonth.getTime() - 1);
|
|
1924
|
-
};
|
|
1925
|
-
Date.prototype.startOfWeek = function () {
|
|
1926
|
-
const newDate = new Date(this);
|
|
1927
|
-
while (newDate.getDay()) {
|
|
1928
|
-
newDate.setDate(newDate.getDate() - 1);
|
|
1929
|
-
}
|
|
1930
|
-
return newDate.startOfDay();
|
|
1931
|
-
};
|
|
1932
|
-
Date.prototype.endOfWeek = function () {
|
|
1933
|
-
const newDate = new Date(this);
|
|
1934
|
-
while (newDate.getDay() < 6) {
|
|
1935
|
-
newDate.setDate(newDate.getDate() - 1);
|
|
1936
|
-
}
|
|
1937
|
-
return newDate.endOfDay();
|
|
1938
|
-
};
|
|
1939
|
-
Date.prototype.startOfDay = function () {
|
|
1940
|
-
const newDate = new Date(this);
|
|
1941
|
-
newDate.setHours(0, 0, 0, 0);
|
|
1942
|
-
return newDate;
|
|
1943
|
-
};
|
|
1944
|
-
Date.prototype.endOfDay = function () {
|
|
1945
|
-
const newDate = new Date(this);
|
|
1946
|
-
newDate.setHours(23, 59, 59, 999);
|
|
1947
|
-
return newDate;
|
|
1948
|
-
};
|
|
1949
|
-
Date.prototype.startOfHour = function () {
|
|
1950
|
-
const newDate = new Date(this);
|
|
1951
|
-
newDate.setMinutes(0, 0, 0);
|
|
1952
|
-
return newDate;
|
|
1953
|
-
};
|
|
1954
|
-
Date.prototype.endOfHour = function () {
|
|
1955
|
-
const newDate = new Date(this);
|
|
1956
|
-
newDate.setMinutes(59, 59, 999);
|
|
1957
|
-
return newDate;
|
|
1958
|
-
};
|
|
1959
|
-
Date.prototype.startOfMinute = function () {
|
|
1960
|
-
const newDate = new Date(this);
|
|
1961
|
-
newDate.setSeconds(0, 0);
|
|
1962
|
-
return newDate;
|
|
1963
|
-
};
|
|
1964
|
-
Date.prototype.endOfMinute = function () {
|
|
1965
|
-
const newDate = new Date(this);
|
|
1966
|
-
newDate.setSeconds(59, 999);
|
|
1967
|
-
return newDate;
|
|
1825
|
+
const PROBLEM_VERDICTS = [
|
|
1826
|
+
exports.ProblemVerdict.NONE,
|
|
1827
|
+
exports.ProblemVerdict.PENDING,
|
|
1828
|
+
exports.ProblemVerdict.AC,
|
|
1829
|
+
exports.ProblemVerdict.PE,
|
|
1830
|
+
exports.ProblemVerdict.PA,
|
|
1831
|
+
exports.ProblemVerdict.CE,
|
|
1832
|
+
exports.ProblemVerdict.RE,
|
|
1833
|
+
exports.ProblemVerdict.TLE,
|
|
1834
|
+
exports.ProblemVerdict.MLE,
|
|
1835
|
+
exports.ProblemVerdict.WA,
|
|
1836
|
+
];
|
|
1837
|
+
const SUBMISSION_RUN_STATUS = {
|
|
1838
|
+
[exports.SubmissionRunStatus.NONE]: { value: exports.SubmissionRunStatus.NONE, label: 'none' }, // status
|
|
1839
|
+
[exports.SubmissionRunStatus.RECEIVED]: { value: exports.SubmissionRunStatus.RECEIVED, label: 'received' }, // state
|
|
1840
|
+
[exports.SubmissionRunStatus.COMPILING]: { value: exports.SubmissionRunStatus.COMPILING, label: 'compiling' }, // state
|
|
1841
|
+
[exports.SubmissionRunStatus.COMPILED]: { value: exports.SubmissionRunStatus.COMPILED, label: 'compiled' }, // status
|
|
1842
|
+
[exports.SubmissionRunStatus.COMPILATION_ERROR]: { value: exports.SubmissionRunStatus.COMPILATION_ERROR, label: 'compilation error' }, // status
|
|
1843
|
+
[exports.SubmissionRunStatus.FETCHING_TEST_CASES]: {
|
|
1844
|
+
value: exports.SubmissionRunStatus.FETCHING_TEST_CASES,
|
|
1845
|
+
label: 'fetching test cases',
|
|
1846
|
+
}, // state
|
|
1847
|
+
[exports.SubmissionRunStatus.RUNNING_TEST_CASE]: { value: exports.SubmissionRunStatus.RUNNING_TEST_CASE, label: 'running test case' }, // state
|
|
1848
|
+
[exports.SubmissionRunStatus.RUNNING_TEST_CASES]: {
|
|
1849
|
+
value: exports.SubmissionRunStatus.RUNNING_TEST_CASES,
|
|
1850
|
+
label: 'running test cases',
|
|
1851
|
+
}, // state
|
|
1852
|
+
[exports.SubmissionRunStatus.RUNNING_SAMPLE_TEST_CASES]: {
|
|
1853
|
+
value: exports.SubmissionRunStatus.RUNNING_SAMPLE_TEST_CASES,
|
|
1854
|
+
label: 'running sample cases',
|
|
1855
|
+
}, // state
|
|
1856
|
+
[exports.SubmissionRunStatus.EXECUTED_TEST_CASE]: {
|
|
1857
|
+
value: exports.SubmissionRunStatus.EXECUTED_TEST_CASE,
|
|
1858
|
+
label: 'executed test case',
|
|
1859
|
+
}, // status
|
|
1860
|
+
[exports.SubmissionRunStatus.FAILED_TEST_CASE]: { value: exports.SubmissionRunStatus.FAILED_TEST_CASE, label: 'failed test case' }, // status
|
|
1861
|
+
[exports.SubmissionRunStatus.JUDGING_TEST_CASE]: { value: exports.SubmissionRunStatus.JUDGING_TEST_CASE, label: 'judging test case' }, // state
|
|
1862
|
+
[exports.SubmissionRunStatus.GRADING]: { value: exports.SubmissionRunStatus.GRADING, label: 'grading' }, // status
|
|
1863
|
+
[exports.SubmissionRunStatus.FAILED]: { value: exports.SubmissionRunStatus.FAILED, label: 'failed' }, // status
|
|
1864
|
+
[exports.SubmissionRunStatus.COMPLETED]: { value: exports.SubmissionRunStatus.COMPLETED, label: 'completed' }, // status
|
|
1968
1865
|
};
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
return newDate;
|
|
1866
|
+
const RUNNER_TYPE = {
|
|
1867
|
+
[exports.RunnerType.HIGH_PERFORMANCE]: { value: exports.RunnerType.HIGH_PERFORMANCE, label: 'high performance' },
|
|
1868
|
+
[exports.RunnerType.LOW_PERFORMANCE]: { value: exports.RunnerType.LOW_PERFORMANCE, label: 'low performance' },
|
|
1973
1869
|
};
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1870
|
+
|
|
1871
|
+
const PROBLEM_INPUT = {
|
|
1872
|
+
[exports.ProblemInput.STANDARD]: { value: exports.ProblemInput.STANDARD, label: 'standard' },
|
|
1873
|
+
[exports.ProblemInput.INTERACTIVE]: { value: exports.ProblemInput.INTERACTIVE, label: 'interactive' },
|
|
1978
1874
|
};
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1875
|
+
const PROBLEM_OUTPUT = {
|
|
1876
|
+
[exports.ProblemOutput.STANDARD]: { value: exports.ProblemOutput.STANDARD, label: 'standard' },
|
|
1877
|
+
[exports.ProblemOutput.DYNAMIC]: { value: exports.ProblemOutput.DYNAMIC, label: 'dynamic' },
|
|
1878
|
+
[exports.ProblemOutput.INTERACTIVE]: { value: exports.ProblemOutput.INTERACTIVE, label: 'interactive' },
|
|
1982
1879
|
};
|
|
1983
|
-
|
|
1984
|
-
|
|
1880
|
+
const PROBLEM_MODES = [exports.ProblemScoringMode.TOTAL, exports.ProblemScoringMode.SUBTASK, exports.ProblemScoringMode.PARTIAL];
|
|
1881
|
+
const PROBLEM_MODE = {
|
|
1882
|
+
[exports.ProblemScoringMode.TOTAL]: {
|
|
1883
|
+
value: exports.ProblemScoringMode.TOTAL,
|
|
1884
|
+
label: 'total',
|
|
1885
|
+
description: 'if all test cases are Accepted the result is Accepted '
|
|
1886
|
+
+ 'otherwise it will be Runtime Error, Time Limited Exceeded, Memory Limited Exceeded, Wrong Answer or Presentation Error in that order.',
|
|
1887
|
+
},
|
|
1888
|
+
[exports.ProblemScoringMode.SUBTASK]: {
|
|
1889
|
+
value: exports.ProblemScoringMode.SUBTASK,
|
|
1890
|
+
label: 'subtask',
|
|
1891
|
+
description: 'the test cases are grouped and each group of test cases is assigned a score, '
|
|
1892
|
+
+ 'if all test cases in a group are Accepted then the score assigned to that group of test cases is added to total score, '
|
|
1893
|
+
+ 'if total score is equal to the sum of the assigned scores of all groups of test cases then the result is Accepted, '
|
|
1894
|
+
+ 'otherwise if the total score is greater than zero the result is Partial Accepted with the total accumulated score, '
|
|
1895
|
+
+ 'otherwise it will be Runtime Error, Time Limited Exceeded, Memory Limited Exceeded, Wrong Answer or Presentation Error in that order.',
|
|
1896
|
+
},
|
|
1897
|
+
[exports.ProblemScoringMode.PARTIAL]: {
|
|
1898
|
+
value: exports.ProblemScoringMode.PARTIAL,
|
|
1899
|
+
label: 'partial',
|
|
1900
|
+
description: 'the test cases are grouped and each group is associated with X points, '
|
|
1901
|
+
+ 'and each test case in a group scores X points ',
|
|
1902
|
+
},
|
|
1985
1903
|
};
|
|
1986
|
-
|
|
1987
|
-
|
|
1904
|
+
const PROBLEM_TYPES = [exports.ProblemType.STANDARD, exports.ProblemType.DYNAMIC, exports.ProblemType.INTERACTIVE];
|
|
1905
|
+
const PROBLEM_TYPE = {
|
|
1906
|
+
[exports.ProblemType.STANDARD]: {
|
|
1907
|
+
value: exports.ProblemType.STANDARD,
|
|
1908
|
+
label: 'standard',
|
|
1909
|
+
description: 'The contestant submit a single source code in one of the allowed programming languages. '
|
|
1910
|
+
+ 'The source code is either standalone or to be compiled. '
|
|
1911
|
+
+ 'The resulting user\'s executable does I/O standard input and output. '
|
|
1912
|
+
+ 'The output produced by the contestant\'s program is then compared to the correct output using a simple diff algorithm.',
|
|
1913
|
+
},
|
|
1914
|
+
[exports.ProblemType.INTERACTIVE]: {
|
|
1915
|
+
value: exports.ProblemType.INTERACTIVE, label: 'interactive', description: 'developing..',
|
|
1916
|
+
},
|
|
1917
|
+
[exports.ProblemType.DYNAMIC]: {
|
|
1918
|
+
value: exports.ProblemType.DYNAMIC,
|
|
1919
|
+
label: 'dynamic',
|
|
1920
|
+
description: 'The contestant submit a single source code in one of the allowed programming languages. '
|
|
1921
|
+
+ 'The user\'s source code is either standalone or to be compiled. '
|
|
1922
|
+
+ 'The resulting user\'s executable does I/O standard input and output. '
|
|
1923
|
+
+ 'The output produced by the contestant\'s program is saved. '
|
|
1924
|
+
+ 'The problem editor save a single source code in C++ 17. '
|
|
1925
|
+
+ 'The editor\'s source code can read judge input filepath argv[1], judge output filepath argv[2], user\'s output filepath argv[3], user\'s error filepath argv[4], user\'s log filepath argv[5], user\'s source filepath argv[6] and submission information filepath argv[7] (companyId, submitId, runId, userId, contestId, problemId, language, userNickname, timestamp). '
|
|
1926
|
+
+ 'The resulting editor\'s executable should be "AC" or a number between 1 and 100 for partial accepted',
|
|
1927
|
+
},
|
|
1988
1928
|
};
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
}
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
}
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
}
|
|
1998
|
-
Date.prototype.isSameMinute = function (date) {
|
|
1999
|
-
return this.isSameHour(date) && this.getMinutes() === date.getMinutes();
|
|
2000
|
-
};
|
|
2001
|
-
Date.prototype.isSameSecond = function (date) {
|
|
2002
|
-
return this.isSameMinute(date) && this.getSeconds() === date.getSeconds();
|
|
2003
|
-
};
|
|
2004
|
-
Date.prototype.isSameMillisecond = function (date) {
|
|
2005
|
-
return this.isEqual(date);
|
|
2006
|
-
};
|
|
2007
|
-
Date.prototype.isValidDate = function () {
|
|
2008
|
-
return this instanceof Date && !isNaN(this.getTime());
|
|
2009
|
-
};
|
|
2010
|
-
Date.prototype.isYearAfter = function (date) {
|
|
2011
|
-
return this.getFullYear() > date.getFullYear();
|
|
2012
|
-
};
|
|
2013
|
-
Date.prototype.isMonthAfter = function (date) {
|
|
2014
|
-
return this.isYearAfter(date) || (this.isSameYear(date) && this.getMonth() > date.getMonth());
|
|
2015
|
-
};
|
|
2016
|
-
Date.prototype.isDayAfter = function (date) {
|
|
2017
|
-
return this.isMonthAfter(date) || (this.isSameMonth(date) && this.getDate() > date.getDate());
|
|
2018
|
-
};
|
|
2019
|
-
Date.prototype.isHoursAfter = function (date) {
|
|
2020
|
-
return this.isDayAfter(date) || (this.isSameDay(date) && this.getHours() > date.getHours());
|
|
2021
|
-
};
|
|
2022
|
-
Date.prototype.isMinutesAfter = function (date) {
|
|
2023
|
-
return this.isHoursAfter(date) || (this.isSameHour(date) && this.getMinutes() > date.getMinutes());
|
|
2024
|
-
};
|
|
2025
|
-
Date.prototype.isSecondsAfter = function (date) {
|
|
2026
|
-
return this.isMinutesAfter(date) || (this.isSameMinute(date) && this.getSeconds() > date.getSeconds());
|
|
2027
|
-
};
|
|
2028
|
-
Date.prototype.isMillisecondsAfter = function (date) {
|
|
2029
|
-
return this.isSecondsAfter(date) || (this.isSameSecond(date) && this.getMilliseconds() > date.getMilliseconds());
|
|
2030
|
-
};
|
|
2031
|
-
Date.prototype.isAfter = function (date) {
|
|
2032
|
-
return this.getTime() > date.getTime();
|
|
2033
|
-
};
|
|
2034
|
-
Date.prototype.isYearBefore = function (date) {
|
|
2035
|
-
return this.getFullYear() < date.getFullYear();
|
|
2036
|
-
};
|
|
2037
|
-
Date.prototype.isMonthBefore = function (date) {
|
|
2038
|
-
return this.isYearBefore(date) || (this.isSameYear(date) && this.getMonth() < date.getMonth());
|
|
2039
|
-
};
|
|
2040
|
-
Date.prototype.isDayBefore = function (date) {
|
|
2041
|
-
return this.isMonthBefore(date) || (this.isSameMonth(date) && this.getDate() < date.getDate());
|
|
2042
|
-
};
|
|
2043
|
-
Date.prototype.isHoursBefore = function (date) {
|
|
2044
|
-
return this.isDayBefore(date) || (this.isSameDay(date) && this.getHours() < date.getHours());
|
|
2045
|
-
};
|
|
2046
|
-
Date.prototype.isMinutesBefore = function (date) {
|
|
2047
|
-
return this.isHoursBefore(date) || (this.isSameHour(date) && this.getMinutes() < date.getMinutes());
|
|
2048
|
-
};
|
|
2049
|
-
Date.prototype.isSecondsBefore = function (date) {
|
|
2050
|
-
return this.isMinutesBefore(date) || (this.isSameMinute(date) && this.getSeconds() < date.getSeconds());
|
|
2051
|
-
};
|
|
2052
|
-
Date.prototype.isMillisecondsBefore = function (date) {
|
|
2053
|
-
return this.isSecondsBefore(date) || (this.isSameSecond(date) && this.getMilliseconds() < date.getMilliseconds());
|
|
2054
|
-
};
|
|
2055
|
-
Date.prototype.isBefore = function (date) {
|
|
2056
|
-
return this.getTime() < date.getTime();
|
|
2057
|
-
};
|
|
2058
|
-
Date.prototype.isWithinInterval = function ({ start, end }, cmp = '[]') {
|
|
2059
|
-
return (cmp.charAt(0) === '[' ? this.isEqual(start) || this.isAfter(start) : this.isAfter(start)) &&
|
|
2060
|
-
(cmp.charAt(1) === '[' ? this.isEqual(end) || this.isBefore(end) : this.isBefore(end));
|
|
1929
|
+
const PROBLEM_ROLE = {
|
|
1930
|
+
[exports.Role.RESTRICTED]: { value: exports.Role.RESTRICTED, label: 'restricted', level: 7 },
|
|
1931
|
+
[exports.Role.GUEST]: { value: exports.Role.GUEST, label: 'guest', level: 6 },
|
|
1932
|
+
[exports.Role.REGULAR]: { value: exports.Role.REGULAR, label: 'regular', level: 5 },
|
|
1933
|
+
[exports.Role.CREATOR]: { value: exports.Role.CREATOR, label: 'creator', level: 4 },
|
|
1934
|
+
[exports.Role.MANAGER]: { value: exports.Role.MANAGER, label: 'manager', level: 3 },
|
|
1935
|
+
[exports.Role.MASTER]: { value: exports.Role.MASTER, label: 'master', level: 2 },
|
|
1936
|
+
[exports.Role.ADMIN]: { value: exports.Role.ADMIN, label: 'admin', level: 1 },
|
|
1937
|
+
[exports.Role.SUPER_ADMIN]: { value: exports.Role.SUPER_ADMIN, label: 'super admin', level: 0 },
|
|
2061
1938
|
};
|
|
2062
1939
|
|
|
1940
|
+
const _TYPE = ':type';
|
|
1941
|
+
const _KEY = ':key';
|
|
1942
|
+
const _TAB = ':tab';
|
|
1943
|
+
const _SUB_TAB = ':subTab?';
|
|
1944
|
+
const _SUB_SUB_TAB = ':subSubTab?';
|
|
1945
|
+
const PAGE = 'page';
|
|
1946
|
+
const PAGE_SIZE = 'size';
|
|
1947
|
+
|
|
2063
1948
|
const ERROR = {
|
|
2064
1949
|
// Http Errors
|
|
2065
1950
|
[exports.ErrorCode.ERR500]: { value: exports.ErrorCode.ERR500, message: 'internal server error', status: 500 },
|
|
@@ -2217,1134 +2102,1249 @@ const ERROR = {
|
|
|
2217
2102
|
[exports.ErrorCode.ERR0820]: { value: exports.ErrorCode.ERR0820, message: 'file is archived', status: 400 },
|
|
2218
2103
|
};
|
|
2219
2104
|
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
super(message);
|
|
2224
|
-
this.message = message;
|
|
2225
|
-
this.code = code;
|
|
2226
|
-
if (custom?.stack) {
|
|
2227
|
-
this.stack = custom.stack;
|
|
2228
|
-
}
|
|
2229
|
-
if (custom?.data) {
|
|
2230
|
-
this.data = custom.data;
|
|
2231
|
-
}
|
|
2232
|
-
}
|
|
2233
|
-
}
|
|
2234
|
-
|
|
2235
|
-
/* eslint-disable no-extend-native */
|
|
2236
|
-
Number.prototype.padStart = function (maxLength, fillString = '0') {
|
|
2237
|
-
return (this + '').padStart(maxLength, fillString);
|
|
2105
|
+
const FILE_TYPE = {
|
|
2106
|
+
[exports.FileType.FILE]: { value: exports.FileType.FILE, label: 'file' },
|
|
2107
|
+
[exports.FileType.FOLDER]: { value: exports.FileType.FOLDER, label: 'folder' },
|
|
2238
2108
|
};
|
|
2239
|
-
|
|
2240
|
-
|
|
2109
|
+
const FILE_ROLE = {
|
|
2110
|
+
[exports.Role.RESTRICTED]: { value: exports.Role.RESTRICTED, label: 'restricted', level: 5 },
|
|
2111
|
+
[exports.Role.GUEST]: { value: exports.Role.GUEST, label: 'guest', level: 4 },
|
|
2112
|
+
[exports.Role.REGULAR]: { value: exports.Role.REGULAR, label: 'regular', level: 3 },
|
|
2113
|
+
[exports.Role.MASTER]: { value: exports.Role.MASTER, label: 'master', level: 2 },
|
|
2114
|
+
[exports.Role.ADMIN]: { value: exports.Role.ADMIN, label: 'admin', level: 1 },
|
|
2115
|
+
[exports.Role.SUPER_ADMIN]: { value: exports.Role.SUPER_ADMIN, label: 'super admin', level: 0 },
|
|
2241
2116
|
};
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
stack: err?.stack || error.stack,
|
|
2252
|
-
data: err?.data || null,
|
|
2253
|
-
});
|
|
2254
|
-
}
|
|
2255
|
-
function errorsResponse(message, ...errors) {
|
|
2256
|
-
return {
|
|
2257
|
-
success: false,
|
|
2258
|
-
message: message,
|
|
2259
|
-
errors: errors.map(error => ({
|
|
2260
|
-
code: error.code,
|
|
2261
|
-
message: error.message,
|
|
2262
|
-
detail: error.stack || new Error().stack || '',
|
|
2263
|
-
data: error.data,
|
|
2264
|
-
})),
|
|
2265
|
-
};
|
|
2266
|
-
}
|
|
2267
|
-
function contentResponse(message, content) {
|
|
2268
|
-
return {
|
|
2269
|
-
success: true,
|
|
2270
|
-
message,
|
|
2271
|
-
content,
|
|
2272
|
-
};
|
|
2273
|
-
}
|
|
2274
|
-
function contentsResponse(message, contents, meta) {
|
|
2275
|
-
return {
|
|
2276
|
-
success: true,
|
|
2277
|
-
message,
|
|
2278
|
-
contents,
|
|
2279
|
-
meta,
|
|
2280
|
-
};
|
|
2281
|
-
}
|
|
2282
|
-
const cleanRequest = (responseText) => {
|
|
2283
|
-
if (!isStringJson(responseText)) {
|
|
2284
|
-
// this occurs when the endpoint don't exits or server is down
|
|
2285
|
-
const response = {
|
|
2286
|
-
success: false,
|
|
2287
|
-
message: ERROR[exports.ErrorCode.ERR9999].message,
|
|
2288
|
-
errors: [{ code: exports.ErrorCode.ERR9999, detail: '', message: ERROR[exports.ErrorCode.ERR9999].message }],
|
|
2289
|
-
};
|
|
2290
|
-
consoleError({ message: 'response is not string json, success false on cleaning request', responseText, response });
|
|
2291
|
-
// jukiApiManager.reportError({ message: 'success false on cleaning request', responseText, response });
|
|
2292
|
-
return response;
|
|
2293
|
-
}
|
|
2294
|
-
const responseJson = JSON.parse(responseText);
|
|
2295
|
-
if (typeof responseJson.success === 'boolean') {
|
|
2296
|
-
if (responseJson.success === true && typeof responseJson.message === 'string' && responseJson.content) { // V1
|
|
2297
|
-
return {
|
|
2298
|
-
success: true,
|
|
2299
|
-
message: responseJson.message,
|
|
2300
|
-
content: responseJson.content,
|
|
2301
|
-
};
|
|
2302
|
-
}
|
|
2303
|
-
else if (responseJson.success === true && typeof responseJson.message === 'string' && Array.isArray(responseJson.contents) && responseJson.meta) { // V1
|
|
2304
|
-
return {
|
|
2305
|
-
success: true,
|
|
2306
|
-
message: responseJson.message,
|
|
2307
|
-
contents: responseJson.contents,
|
|
2308
|
-
meta: responseJson.meta,
|
|
2309
|
-
};
|
|
2310
|
-
}
|
|
2311
|
-
else if (responseJson.success === false && typeof responseJson.message === 'string' && Array.isArray(responseJson.errors)) { // V1
|
|
2312
|
-
const response = {
|
|
2313
|
-
success: false,
|
|
2314
|
-
message: responseJson.message,
|
|
2315
|
-
errors: responseJson.errors,
|
|
2316
|
-
};
|
|
2317
|
-
consoleError({ message: 'success false on cleaning request', responseText, response });
|
|
2318
|
-
// jukiApiManager.reportError({ message: 'success false on cleaning request', responseText, response });
|
|
2319
|
-
return response;
|
|
2320
|
-
}
|
|
2321
|
-
}
|
|
2322
|
-
const response = {
|
|
2323
|
-
success: false,
|
|
2324
|
-
message: ERROR[exports.ErrorCode.ERR9998].message,
|
|
2325
|
-
errors: [{ code: exports.ErrorCode.ERR9998, detail: '', message: ERROR[exports.ErrorCode.ERR9998].message }],
|
|
2326
|
-
};
|
|
2327
|
-
consoleError({ message: 'success false on cleaning request', responseText, response });
|
|
2328
|
-
// jukiApiManager.reportError({ message: 'success false on cleaning request', responseText, response });
|
|
2329
|
-
return response;
|
|
2117
|
+
const ENTITY_STATE = {
|
|
2118
|
+
[exports.EntityState.RELEASED]: {
|
|
2119
|
+
value: exports.EntityState.RELEASED,
|
|
2120
|
+
label: 'released',
|
|
2121
|
+
},
|
|
2122
|
+
[exports.EntityState.ARCHIVED]: {
|
|
2123
|
+
value: exports.EntityState.ARCHIVED,
|
|
2124
|
+
label: 'archived',
|
|
2125
|
+
},
|
|
2330
2126
|
};
|
|
2331
|
-
const
|
|
2332
|
-
|
|
2127
|
+
const ENTITY_ACCESS = {
|
|
2128
|
+
[exports.EntityAccess.PRIVATE]: {
|
|
2129
|
+
value: exports.EntityAccess.PRIVATE,
|
|
2130
|
+
label: 'private',
|
|
2131
|
+
description: 'the record will be visible and editable only to the owner',
|
|
2132
|
+
},
|
|
2133
|
+
[exports.EntityAccess.RESTRICTED]: {
|
|
2134
|
+
value: exports.EntityAccess.RESTRICTED,
|
|
2135
|
+
label: 'restricted',
|
|
2136
|
+
description: 'the record will be visible to viewers and the owner and editable to editors and the owner',
|
|
2137
|
+
},
|
|
2138
|
+
[exports.EntityAccess.PUBLIC]: {
|
|
2139
|
+
value: exports.EntityAccess.PUBLIC,
|
|
2140
|
+
label: 'public',
|
|
2141
|
+
description: 'the record will be visible to anyone and editable to editors and the owner',
|
|
2142
|
+
},
|
|
2143
|
+
[exports.EntityAccess.EXPOSED]: {
|
|
2144
|
+
value: exports.EntityAccess.EXPOSED,
|
|
2145
|
+
label: 'exposed',
|
|
2146
|
+
description: 'the record will be visible and editable to anyone',
|
|
2147
|
+
},
|
|
2333
2148
|
};
|
|
2334
2149
|
|
|
2335
|
-
const
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
}
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
&& event?.event === exports.WebSocketMessageEvent.PING;
|
|
2150
|
+
const SYSTEM_ROLE = {
|
|
2151
|
+
[SystemRole.GUEST]: { value: SystemRole.GUEST, label: 'guest', level: 5 },
|
|
2152
|
+
[SystemRole.REGULAR]: { value: SystemRole.REGULAR, label: 'regular', level: 4 },
|
|
2153
|
+
[SystemRole.MANAGER]: { value: SystemRole.MANAGER, label: 'manager', level: 3 },
|
|
2154
|
+
[SystemRole.MASTER]: { value: SystemRole.MASTER, label: 'master', level: 2 },
|
|
2155
|
+
[SystemRole.ADMIN]: { value: SystemRole.ADMIN, label: 'admin', level: 1 },
|
|
2156
|
+
[SystemRole.SUPER_ADMIN]: { value: SystemRole.SUPER_ADMIN, label: 'super admin', level: 0 },
|
|
2343
2157
|
};
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2158
|
+
|
|
2159
|
+
const MEMBER_ROLE = {
|
|
2160
|
+
[MemberRole.COACH]: { value: MemberRole.COACH, label: 'coach' },
|
|
2161
|
+
[MemberRole.CO_COACH]: { value: MemberRole.CO_COACH, label: 'co-coach' },
|
|
2162
|
+
[MemberRole.STAFF]: { value: MemberRole.STAFF, label: 'staff' },
|
|
2163
|
+
[MemberRole.ATTENDEE]: { value: MemberRole.ATTENDEE, label: 'attendee' },
|
|
2164
|
+
[MemberRole.RESERVE]: { value: MemberRole.RESERVE, label: 'reserve' },
|
|
2165
|
+
[MemberRole.CONTESTANT]: { value: MemberRole.CONTESTANT, label: 'contestant' },
|
|
2347
2166
|
};
|
|
2348
|
-
const
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
}
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
};
|
|
2356
|
-
const isChatCompletionsWebSocketEventDTO = (event) => {
|
|
2357
|
-
return isWebsocketSubscription(event)
|
|
2358
|
-
&& event?.event === exports.WebSocketMessageEvent.CHAT_COMPLETIONS;
|
|
2167
|
+
const TEAM_ROLE = {
|
|
2168
|
+
[TeamRole.RESTRICTED]: { value: TeamRole.RESTRICTED, label: 'restricted', level: 5 },
|
|
2169
|
+
[TeamRole.GUEST]: { value: TeamRole.GUEST, label: 'guest', level: 4 },
|
|
2170
|
+
[TeamRole.REGULAR]: { value: TeamRole.REGULAR, label: 'regular', level: 3 },
|
|
2171
|
+
[TeamRole.MANAGER]: { value: TeamRole.MANAGER, label: 'manager', level: 2 },
|
|
2172
|
+
[TeamRole.ADMIN]: { value: TeamRole.ADMIN, label: 'admin', level: 1 },
|
|
2173
|
+
[TeamRole.SUPER_ADMIN]: { value: TeamRole.SUPER_ADMIN, label: 'super admin', level: 0 },
|
|
2359
2174
|
};
|
|
2360
|
-
|
|
2361
|
-
const
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2175
|
+
|
|
2176
|
+
const ONE_SECOND = 1000;
|
|
2177
|
+
const SEC_30 = ONE_SECOND * 30;
|
|
2178
|
+
const SEC_60 = ONE_SECOND * 60;
|
|
2179
|
+
const SEC_90 = ONE_SECOND * 90;
|
|
2180
|
+
const SEC_120 = ONE_SECOND * 120;
|
|
2181
|
+
const ONE_MINUTE = ONE_SECOND * 60;
|
|
2182
|
+
const ONE_HOUR = ONE_MINUTE * 60;
|
|
2183
|
+
const ONE_DAY = ONE_HOUR * 24;
|
|
2184
|
+
const ONE_WEEK = ONE_DAY * 7;
|
|
2185
|
+
|
|
2186
|
+
const USER_STATUS = {
|
|
2187
|
+
[UserStatus.ACTIVE]: { value: UserStatus.ACTIVE, label: 'active' },
|
|
2188
|
+
[UserStatus.REPORTED]: { value: UserStatus.REPORTED, label: 'reported' },
|
|
2189
|
+
[UserStatus.ARCHIVED]: { value: UserStatus.ARCHIVED, label: 'archived' },
|
|
2365
2190
|
};
|
|
2366
|
-
const
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2191
|
+
const USER_ROLE = {
|
|
2192
|
+
[UserRole.RESTRICTED]: { value: UserRole.RESTRICTED, label: 'restricted', level: 6 },
|
|
2193
|
+
[UserRole.GUEST]: { value: UserRole.GUEST, label: 'guest', level: 5 },
|
|
2194
|
+
[UserRole.LIMITED]: { value: UserRole.LIMITED, label: 'limited', level: 4 },
|
|
2195
|
+
[UserRole.REGULAR]: { value: UserRole.REGULAR, label: 'regular', level: 3 },
|
|
2196
|
+
[UserRole.MANAGER]: { value: UserRole.MANAGER, label: 'manager', level: 2 },
|
|
2197
|
+
[UserRole.ADMIN]: { value: UserRole.ADMIN, label: 'admin', level: 1 },
|
|
2198
|
+
[UserRole.SUPER_ADMIN]: { value: UserRole.SUPER_ADMIN, label: 'super admin', level: 0 },
|
|
2370
2199
|
};
|
|
2371
|
-
const
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2200
|
+
const EMPTY_USER_PERMISSIONS = {
|
|
2201
|
+
users: {
|
|
2202
|
+
create: false,
|
|
2203
|
+
manage: false,
|
|
2204
|
+
administrate: false,
|
|
2205
|
+
},
|
|
2206
|
+
problems: {
|
|
2207
|
+
create: false,
|
|
2208
|
+
manage: false,
|
|
2209
|
+
},
|
|
2210
|
+
submissions: {
|
|
2211
|
+
manage: false,
|
|
2212
|
+
},
|
|
2213
|
+
contests: {
|
|
2214
|
+
create: false,
|
|
2215
|
+
manage: false,
|
|
2216
|
+
},
|
|
2217
|
+
company: {
|
|
2218
|
+
manage: false,
|
|
2219
|
+
administrate: false,
|
|
2220
|
+
},
|
|
2221
|
+
services: {
|
|
2222
|
+
administrate: false,
|
|
2223
|
+
},
|
|
2375
2224
|
};
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2225
|
+
|
|
2226
|
+
const CHANNEL_PUBLISH_SUBSCRIPTIONS = 'pub:subscriptions';
|
|
2227
|
+
const CHANNEL_SUBSCRIBE_NOTIFICATIONS = 'sub:notifications';
|
|
2228
|
+
const CHANNEL_SUBSCRIBE_CLIENT = (clientId) => `sub:client:${clientId}`;
|
|
2229
|
+
const CHANNEL_PUBLISH_MESSAGES = 'pub:messages';
|
|
2230
|
+
const CHANNEL_PRESENCE_CLIENT = 'pre:client';
|
|
2231
|
+
|
|
2232
|
+
const NEW_PAGE_SHEET = () => ({
|
|
2233
|
+
id: uuid.v4(),
|
|
2234
|
+
type: exports.WorksheetType.NEW_PAGE,
|
|
2235
|
+
title: '',
|
|
2236
|
+
points: 0,
|
|
2237
|
+
});
|
|
2238
|
+
const ASPECT_RATIO = {
|
|
2239
|
+
[exports.AspectRatio.RATIO_21_9]: {
|
|
2240
|
+
aspectRatio: exports.AspectRatio.RATIO_21_9,
|
|
2241
|
+
width: 2520,
|
|
2242
|
+
height: 1080,
|
|
2243
|
+
decimal: 21 / 9,
|
|
2244
|
+
label: 'ultrawide',
|
|
2245
|
+
},
|
|
2246
|
+
[exports.AspectRatio.RATIO_20_9]: {
|
|
2247
|
+
aspectRatio: exports.AspectRatio.RATIO_20_9,
|
|
2248
|
+
width: 2400,
|
|
2249
|
+
height: 1080,
|
|
2250
|
+
decimal: 20 / 9,
|
|
2251
|
+
label: 'mobile wide',
|
|
2252
|
+
},
|
|
2253
|
+
[exports.AspectRatio.RATIO_16_9]: {
|
|
2254
|
+
aspectRatio: exports.AspectRatio.RATIO_16_9,
|
|
2255
|
+
width: 1920,
|
|
2256
|
+
height: 1080,
|
|
2257
|
+
decimal: 16 / 9,
|
|
2258
|
+
label: 'widescreen',
|
|
2259
|
+
},
|
|
2260
|
+
[exports.AspectRatio.RATIO_16_10]: {
|
|
2261
|
+
aspectRatio: exports.AspectRatio.RATIO_16_10,
|
|
2262
|
+
width: 1920,
|
|
2263
|
+
height: 1200,
|
|
2264
|
+
decimal: 16 / 10,
|
|
2265
|
+
label: 'widescreen tall',
|
|
2266
|
+
},
|
|
2267
|
+
[exports.AspectRatio.RATIO_3_2]: {
|
|
2268
|
+
aspectRatio: exports.AspectRatio.RATIO_3_2,
|
|
2269
|
+
width: 1440,
|
|
2270
|
+
height: 960,
|
|
2271
|
+
decimal: 3 / 2,
|
|
2272
|
+
label: 'balanced',
|
|
2273
|
+
},
|
|
2274
|
+
[exports.AspectRatio.RATIO_4_3]: {
|
|
2275
|
+
aspectRatio: exports.AspectRatio.RATIO_4_3,
|
|
2276
|
+
width: 1024,
|
|
2277
|
+
height: 768,
|
|
2278
|
+
decimal: 4 / 3,
|
|
2279
|
+
label: 'standard',
|
|
2280
|
+
},
|
|
2281
|
+
[exports.AspectRatio.RATIO_5_4]: {
|
|
2282
|
+
aspectRatio: exports.AspectRatio.RATIO_5_4,
|
|
2283
|
+
width: 1280,
|
|
2284
|
+
height: 1024,
|
|
2285
|
+
decimal: 5 / 4,
|
|
2286
|
+
label: 'square old',
|
|
2287
|
+
},
|
|
2288
|
+
[exports.AspectRatio.RATIO_1_1]: {
|
|
2289
|
+
aspectRatio: exports.AspectRatio.RATIO_1_1,
|
|
2290
|
+
width: 1000,
|
|
2291
|
+
height: 1000,
|
|
2292
|
+
decimal: 1,
|
|
2293
|
+
label: 'square',
|
|
2294
|
+
},
|
|
2380
2295
|
};
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2296
|
+
|
|
2297
|
+
exports.ContestProblemBlockedByType = void 0;
|
|
2298
|
+
(function (ContestProblemBlockedByType) {
|
|
2299
|
+
ContestProblemBlockedByType["UNMET_PREREQUISITES"] = "UNMET_PREREQUISITES";
|
|
2300
|
+
ContestProblemBlockedByType["MAX_ACCEPTED_SUBMISSIONS_ACHIEVED"] = "MAX_ACCEPTED_SUBMISSIONS_ACHIEVED";
|
|
2301
|
+
ContestProblemBlockedByType["START_TIME_IN_THE_FUTURE"] = "START_TIME_IN_THE_FUTURE";
|
|
2302
|
+
ContestProblemBlockedByType["END_TIME_IN_THE_PAST"] = "END_TIME_IN_THE_PAST";
|
|
2303
|
+
})(exports.ContestProblemBlockedByType || (exports.ContestProblemBlockedByType = {}));
|
|
2304
|
+
|
|
2305
|
+
exports.MemberType = void 0;
|
|
2306
|
+
(function (MemberType) {
|
|
2307
|
+
MemberType["USER"] = "USER";
|
|
2308
|
+
MemberType["TEAM"] = "TEAM";
|
|
2309
|
+
})(exports.MemberType || (exports.MemberType = {}));
|
|
2310
|
+
|
|
2311
|
+
const isWorksheetAssignment = (assignment) => {
|
|
2312
|
+
return assignment.type === exports.AssignmentClass.WORKSHEET;
|
|
2384
2313
|
};
|
|
2385
|
-
const
|
|
2386
|
-
return
|
|
2387
|
-
&& event?.event === exports.WebSocketSubscriptionEvent.UNSUBSCRIBE_GET_DATA;
|
|
2314
|
+
const isCourseAssignment = (assignment) => {
|
|
2315
|
+
return assignment.type === exports.AssignmentClass.COURSE;
|
|
2388
2316
|
};
|
|
2389
|
-
const
|
|
2390
|
-
return
|
|
2391
|
-
&& event?.event === exports.WebSocketSubscriptionEvent.SUBSCRIBE_PROBLEM_CRAWLED;
|
|
2317
|
+
const isContestAssignment = (assignment) => {
|
|
2318
|
+
return assignment.type === exports.AssignmentClass.CONTEST;
|
|
2392
2319
|
};
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2320
|
+
|
|
2321
|
+
const getAssignmentCommentKey = (classKey, cycleKey, sessionKey, assignmentKey) => `class:${classKey}|cycle:${cycleKey}|session:${sessionKey}|assignment:${assignmentKey}`;
|
|
2322
|
+
const getAssignmentUserCommentKey = (classKey, cycleKey, sessionKey, assignmentKey, userNickname, userCompany) => `class:${classKey}|cycle:${cycleKey}|session:${sessionKey}|assignment:${assignmentKey}|user_nickname:${userNickname}|user_company:${userCompany}`;
|
|
2323
|
+
const getProblemCommentKey = (problemKey) => `problem:${problemKey}`;
|
|
2324
|
+
const getContestCommentKey = (contestKey) => `contest:${contestKey}`;
|
|
2325
|
+
|
|
2326
|
+
const isEndlessContest = (settings) => {
|
|
2327
|
+
return settings?.startTimestamp === MIN_DATE.getTime()
|
|
2328
|
+
&& settings?.frozenTimestamp === MAX_DATE.getTime()
|
|
2329
|
+
&& settings?.quietTimestamp === MAX_DATE.getTime()
|
|
2330
|
+
&& settings?.endTimestamp === MAX_DATE.getTime()
|
|
2331
|
+
&& settings?.penalty === 0;
|
|
2396
2332
|
};
|
|
2397
|
-
const
|
|
2398
|
-
return
|
|
2399
|
-
&&
|
|
2333
|
+
const isGlobalContest = (settings) => {
|
|
2334
|
+
return settings?.startTimestamp === 0
|
|
2335
|
+
&& settings?.frozenTimestamp === 0
|
|
2336
|
+
&& settings?.quietTimestamp === 0
|
|
2337
|
+
&& settings?.endTimestamp === 0
|
|
2338
|
+
&& settings?.penalty === 0;
|
|
2400
2339
|
};
|
|
2401
|
-
const
|
|
2402
|
-
return
|
|
2403
|
-
&& event?.event === exports.WebSocketSubscriptionEvent.UNSUBSCRIBE_SUBMISSIONS_CRAWL;
|
|
2340
|
+
const isPastContest = (settings) => {
|
|
2341
|
+
return Date.now() > (settings?.endTimestamp ?? 0);
|
|
2404
2342
|
};
|
|
2405
|
-
const
|
|
2406
|
-
return
|
|
2407
|
-
&& event?.event === exports.WebSocketSubscriptionEvent.SUBSCRIBE_CONTEST_CHANGES;
|
|
2343
|
+
const isFutureContest = (settings) => {
|
|
2344
|
+
return (settings?.startTimestamp ?? 0) > Date.now();
|
|
2408
2345
|
};
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2346
|
+
|
|
2347
|
+
const getDocumentAccess = (document) => {
|
|
2348
|
+
switch (true) {
|
|
2349
|
+
case (document?.members?.rankAdministrators === exports.EntityMembersRank.NONE || document?.members?.rankAdministrators === exports.EntityMembersRank.CLOSE)
|
|
2350
|
+
&& document?.members?.rankManagers === exports.EntityMembersRank.OPEN
|
|
2351
|
+
&& (document?.members?.rankGuests === exports.EntityMembersRank.NONE || document?.members?.rankGuests === exports.EntityMembersRank.CLOSE || document?.members?.rankGuests === exports.EntityMembersRank.OPEN)
|
|
2352
|
+
&& document?.members?.rankSpectators === exports.EntityMembersRank.OPEN
|
|
2353
|
+
&& (document?.members?.rankParticipants === exports.EntityMembersRank.NONE || document?.members?.rankParticipants === exports.EntityMembersRank.CLOSE || document?.members?.rankParticipants === exports.EntityMembersRank.OPEN):
|
|
2354
|
+
return exports.EntityAccess.EXPOSED;
|
|
2355
|
+
case (document?.members?.rankAdministrators === exports.EntityMembersRank.NONE || document?.members?.rankAdministrators === exports.EntityMembersRank.CLOSE)
|
|
2356
|
+
&& document?.members?.rankManagers === exports.EntityMembersRank.CLOSE
|
|
2357
|
+
&& (document?.members?.rankGuests === exports.EntityMembersRank.NONE || document?.members?.rankGuests === exports.EntityMembersRank.CLOSE || document?.members?.rankGuests === exports.EntityMembersRank.OPEN)
|
|
2358
|
+
&& document?.members?.rankSpectators === exports.EntityMembersRank.OPEN
|
|
2359
|
+
&& (document?.members?.rankParticipants === exports.EntityMembersRank.NONE || document?.members?.rankParticipants === exports.EntityMembersRank.CLOSE || document?.members?.rankParticipants === exports.EntityMembersRank.OPEN):
|
|
2360
|
+
return exports.EntityAccess.PUBLIC;
|
|
2361
|
+
case (document?.members?.rankAdministrators === exports.EntityMembersRank.NONE || document?.members?.rankAdministrators === exports.EntityMembersRank.CLOSE)
|
|
2362
|
+
&& document?.members?.rankManagers === exports.EntityMembersRank.CLOSE
|
|
2363
|
+
&& (document?.members?.rankGuests === exports.EntityMembersRank.NONE || document?.members?.rankGuests === exports.EntityMembersRank.CLOSE || document?.members?.rankGuests === exports.EntityMembersRank.OPEN)
|
|
2364
|
+
&& document?.members?.rankSpectators === exports.EntityMembersRank.CLOSE
|
|
2365
|
+
&& (document?.members?.rankParticipants === exports.EntityMembersRank.NONE || document?.members?.rankParticipants === exports.EntityMembersRank.CLOSE || document?.members?.rankParticipants === exports.EntityMembersRank.OPEN):
|
|
2366
|
+
return exports.EntityAccess.RESTRICTED;
|
|
2367
|
+
case document?.members?.rankAdministrators === exports.EntityMembersRank.NONE
|
|
2368
|
+
&& document?.members?.rankManagers === exports.EntityMembersRank.NONE
|
|
2369
|
+
&& document?.members?.rankGuests === exports.EntityMembersRank.NONE
|
|
2370
|
+
&& document?.members?.rankSpectators === exports.EntityMembersRank.NONE
|
|
2371
|
+
&& document?.members?.rankParticipants === exports.EntityMembersRank.NONE:
|
|
2372
|
+
return exports.EntityAccess.PRIVATE;
|
|
2373
|
+
default:
|
|
2374
|
+
return exports.EntityAccess.PRIVATE;
|
|
2375
|
+
}
|
|
2412
2376
|
};
|
|
2413
|
-
const
|
|
2414
|
-
return
|
|
2415
|
-
&& event?.event === exports.WebSocketSubscriptionEvent.SUBSCRIBE_CLIENT_TRACK;
|
|
2377
|
+
const isUserMember = (member) => {
|
|
2378
|
+
return typeof member.userId === 'string';
|
|
2416
2379
|
};
|
|
2417
|
-
const
|
|
2418
|
-
return
|
|
2419
|
-
&& event?.event === exports.WebSocketSubscriptionEvent.UNSUBSCRIBE_CLIENT_TRACK;
|
|
2380
|
+
const isTeamMember = (member) => {
|
|
2381
|
+
return typeof member.teamId === 'string';
|
|
2420
2382
|
};
|
|
2421
|
-
const
|
|
2422
|
-
return
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2383
|
+
const toEntityMembersDTO = (members) => {
|
|
2384
|
+
return {
|
|
2385
|
+
rankAdministrators: members.rankAdministrators,
|
|
2386
|
+
administrators: Object.keys(members.administrators),
|
|
2387
|
+
rankManagers: members.rankManagers,
|
|
2388
|
+
managers: Object.keys(members.managers),
|
|
2389
|
+
rankParticipants: members.rankParticipants,
|
|
2390
|
+
participants: Object.keys(members.participants),
|
|
2391
|
+
rankGuests: members.rankGuests,
|
|
2392
|
+
guests: Object.keys(members.guests),
|
|
2393
|
+
rankSpectators: members.rankSpectators,
|
|
2394
|
+
spectators: Object.keys(members.spectators),
|
|
2395
|
+
};
|
|
2428
2396
|
};
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2397
|
+
|
|
2398
|
+
function removeExtension(fileName) {
|
|
2399
|
+
const i = fileName.lastIndexOf('.');
|
|
2400
|
+
return i !== -1 ? fileName.substring(0, i) : fileName;
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2403
|
+
// https://dev.to/jsmccrumb/asynchronous-setinterval-4j69
|
|
2404
|
+
const asyncIntervals = [];
|
|
2405
|
+
const runAsyncInterval = async (cb, interval, intervalIndex) => {
|
|
2406
|
+
await cb();
|
|
2407
|
+
if (asyncIntervals[intervalIndex]) {
|
|
2408
|
+
setTimeout(() => runAsyncInterval(cb, interval, intervalIndex), interval);
|
|
2409
|
+
}
|
|
2435
2410
|
};
|
|
2436
|
-
const
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2411
|
+
const setAsyncInterval = (cb, interval) => {
|
|
2412
|
+
if (cb && typeof cb === 'function') {
|
|
2413
|
+
const intervalIndex = asyncIntervals.length;
|
|
2414
|
+
asyncIntervals.push(true);
|
|
2415
|
+
void runAsyncInterval(cb, interval, intervalIndex);
|
|
2416
|
+
return intervalIndex;
|
|
2417
|
+
}
|
|
2418
|
+
else {
|
|
2419
|
+
throw new Error('Callback must be a function');
|
|
2420
|
+
}
|
|
2440
2421
|
};
|
|
2441
|
-
const
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
&& event?.status in exports.SubmissionRunStatus;
|
|
2422
|
+
const clearAsyncInterval = (intervalIndex) => {
|
|
2423
|
+
if (asyncIntervals[intervalIndex]) {
|
|
2424
|
+
asyncIntervals[intervalIndex] = false;
|
|
2425
|
+
}
|
|
2446
2426
|
};
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2427
|
+
|
|
2428
|
+
const getDataOfTestCase = (testCase, timeLimit, memoryLimit) => {
|
|
2429
|
+
const { timeUsed, memoryUsed, exitCode } = getDataLog(testCase?.log);
|
|
2430
|
+
const timeLimitExceeded = timeUsed > timeLimit;
|
|
2431
|
+
const memoryLimitExceeded = memoryUsed > memoryLimit;
|
|
2432
|
+
const runtimeError = exitCode !== 0;
|
|
2433
|
+
const compilationError = testCase?.status === exports.SubmissionRunStatus.COMPILATION_ERROR;
|
|
2434
|
+
return {
|
|
2435
|
+
compilationError,
|
|
2436
|
+
timeUsed,
|
|
2437
|
+
timeLimitExceeded: timeLimitExceeded,
|
|
2438
|
+
memoryUsed,
|
|
2439
|
+
memoryLimitExceeded: memoryLimitExceeded,
|
|
2440
|
+
exitCode,
|
|
2441
|
+
runtimeError,
|
|
2442
|
+
failed: !!testCase?.log && (timeLimitExceeded || memoryLimitExceeded || runtimeError),
|
|
2443
|
+
};
|
|
2454
2444
|
};
|
|
2455
|
-
const
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2445
|
+
const getVerdictFromTestCase = (testCaseValue, timeLimit, memoryLimit) => {
|
|
2446
|
+
const { compilationError, timeLimitExceeded, memoryLimitExceeded, runtimeError, timeUsed, memoryUsed, exitCode, } = getDataOfTestCase(testCaseValue, timeLimit, memoryLimit);
|
|
2447
|
+
return {
|
|
2448
|
+
verdict: compilationError
|
|
2449
|
+
? exports.ProblemVerdict.CE
|
|
2450
|
+
: timeLimitExceeded
|
|
2451
|
+
? exports.ProblemVerdict.TLE
|
|
2452
|
+
: memoryLimitExceeded
|
|
2453
|
+
? exports.ProblemVerdict.MLE
|
|
2454
|
+
: runtimeError
|
|
2455
|
+
? exports.ProblemVerdict.RE
|
|
2456
|
+
: testCaseValue.out === testCaseValue.testOut
|
|
2457
|
+
? exports.ProblemVerdict.AC
|
|
2458
|
+
: testCaseValue.withPE && testCaseValue.out.split(' ').join('').split('\n').join('') === testCaseValue.testOut.split(' ').join('').split('\n').join('')
|
|
2459
|
+
? exports.ProblemVerdict.PE
|
|
2460
|
+
: !testCaseValue.withPE && testCaseValue.out.split(' ').join('').split('\n').join('') === testCaseValue.testOut.split(' ').join('').split('\n').join('')
|
|
2461
|
+
? exports.ProblemVerdict.AC
|
|
2462
|
+
: exports.ProblemVerdict.WA,
|
|
2463
|
+
timeUsed,
|
|
2464
|
+
memoryUsed,
|
|
2465
|
+
exitCode,
|
|
2466
|
+
};
|
|
2462
2467
|
};
|
|
2463
|
-
const
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
exports.
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
exports.
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
&&
|
|
2474
|
-
|
|
2468
|
+
const mergeVerdicts = (first, second) => {
|
|
2469
|
+
let verdict = first.verdict;
|
|
2470
|
+
if (second.verdict === exports.ProblemVerdict.RE) {
|
|
2471
|
+
verdict = exports.ProblemVerdict.RE;
|
|
2472
|
+
}
|
|
2473
|
+
else if (second.verdict === exports.ProblemVerdict.TLE && verdict != exports.ProblemVerdict.RE) {
|
|
2474
|
+
verdict = exports.ProblemVerdict.TLE;
|
|
2475
|
+
}
|
|
2476
|
+
else if (second.verdict === exports.ProblemVerdict.MLE
|
|
2477
|
+
&& verdict !== exports.ProblemVerdict.TLE
|
|
2478
|
+
&& verdict !== exports.ProblemVerdict.RE) {
|
|
2479
|
+
verdict = exports.ProblemVerdict.MLE;
|
|
2480
|
+
}
|
|
2481
|
+
else if (second.verdict === exports.ProblemVerdict.WA
|
|
2482
|
+
&& verdict !== exports.ProblemVerdict.MLE
|
|
2483
|
+
&& verdict !== exports.ProblemVerdict.TLE
|
|
2484
|
+
&& verdict !== exports.ProblemVerdict.RE) {
|
|
2485
|
+
verdict = exports.ProblemVerdict.WA;
|
|
2486
|
+
}
|
|
2487
|
+
else if (second.verdict === exports.ProblemVerdict.PE
|
|
2488
|
+
&& verdict !== exports.ProblemVerdict.WA
|
|
2489
|
+
&& verdict !== exports.ProblemVerdict.MLE
|
|
2490
|
+
&& verdict !== exports.ProblemVerdict.TLE
|
|
2491
|
+
&& verdict !== exports.ProblemVerdict.RE) {
|
|
2492
|
+
verdict = exports.ProblemVerdict.PE;
|
|
2493
|
+
}
|
|
2494
|
+
else if (second.verdict === exports.ProblemVerdict.PA
|
|
2495
|
+
&& verdict !== exports.ProblemVerdict.PE
|
|
2496
|
+
&& verdict !== exports.ProblemVerdict.WA
|
|
2497
|
+
&& verdict !== exports.ProblemVerdict.MLE
|
|
2498
|
+
&& verdict !== exports.ProblemVerdict.TLE
|
|
2499
|
+
&& verdict !== exports.ProblemVerdict.RE) {
|
|
2500
|
+
verdict = exports.ProblemVerdict.PA;
|
|
2501
|
+
}
|
|
2502
|
+
else if (second.verdict === exports.ProblemVerdict.AC
|
|
2503
|
+
&& verdict !== exports.ProblemVerdict.PA
|
|
2504
|
+
&& verdict !== exports.ProblemVerdict.PE
|
|
2505
|
+
&& verdict !== exports.ProblemVerdict.WA
|
|
2506
|
+
&& verdict !== exports.ProblemVerdict.MLE
|
|
2507
|
+
&& verdict !== exports.ProblemVerdict.TLE
|
|
2508
|
+
&& verdict !== exports.ProblemVerdict.RE) {
|
|
2509
|
+
verdict = exports.ProblemVerdict.AC;
|
|
2510
|
+
}
|
|
2511
|
+
return {
|
|
2512
|
+
timeUsed: Math.max(first.timeUsed, second.timeUsed),
|
|
2513
|
+
memoryUsed: Math.max(first.memoryUsed, second.memoryUsed),
|
|
2514
|
+
exitCode: first.exitCode || second.exitCode,
|
|
2515
|
+
verdict,
|
|
2516
|
+
};
|
|
2475
2517
|
};
|
|
2476
|
-
const
|
|
2477
|
-
|
|
2478
|
-
|
|
2518
|
+
const getDataLog = (log) => {
|
|
2519
|
+
const lines = log?.split?.('\n') || [];
|
|
2520
|
+
let timeUsed = 0;
|
|
2521
|
+
let memoryUsed = 0;
|
|
2522
|
+
let exitCode = -1;
|
|
2523
|
+
if (lines.length > 4) {
|
|
2524
|
+
for (const line of lines) {
|
|
2525
|
+
if (line.startsWith('time:')) {
|
|
2526
|
+
timeUsed = +line.split(':')[1];
|
|
2527
|
+
if (Number.isNaN(timeUsed)) {
|
|
2528
|
+
timeUsed = 0;
|
|
2529
|
+
}
|
|
2530
|
+
timeUsed *= 1000;
|
|
2531
|
+
}
|
|
2532
|
+
else if (line.startsWith('max-rss:')) {
|
|
2533
|
+
memoryUsed = parseInt(line.split(':')[1], 10); // en KB
|
|
2534
|
+
}
|
|
2535
|
+
else if (line.startsWith('exitcode:')) {
|
|
2536
|
+
exitCode = parseInt(line.split(':')[1], 10);
|
|
2537
|
+
}
|
|
2538
|
+
}
|
|
2539
|
+
}
|
|
2540
|
+
else if (lines.length >= 3) {
|
|
2541
|
+
timeUsed = +lines[0];
|
|
2542
|
+
memoryUsed = +lines[1];
|
|
2543
|
+
exitCode = +lines[2];
|
|
2544
|
+
}
|
|
2545
|
+
return {
|
|
2546
|
+
timeUsed: Number.isNaN(timeUsed) ? 0 : timeUsed,
|
|
2547
|
+
memoryUsed: Number.isNaN(memoryUsed) ? 0 : memoryUsed,
|
|
2548
|
+
exitCode: Number.isNaN(exitCode) ? -1 : exitCode,
|
|
2549
|
+
};
|
|
2479
2550
|
};
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2551
|
+
|
|
2552
|
+
function memorySizeOf(obj) {
|
|
2553
|
+
let bytes = 0;
|
|
2554
|
+
function sizeOf(obj) {
|
|
2555
|
+
if (obj !== null && obj !== undefined) {
|
|
2556
|
+
switch (typeof obj) {
|
|
2557
|
+
case "number":
|
|
2558
|
+
bytes += 8;
|
|
2559
|
+
break;
|
|
2560
|
+
case "string":
|
|
2561
|
+
bytes += obj.length * 2;
|
|
2562
|
+
break;
|
|
2563
|
+
case "boolean":
|
|
2564
|
+
bytes += 4;
|
|
2565
|
+
break;
|
|
2566
|
+
case "object":
|
|
2567
|
+
const objClass = Object.prototype.toString.call(obj).slice(8, -1);
|
|
2568
|
+
if (objClass === "Object" || objClass === "Array") {
|
|
2569
|
+
for (const key in obj) {
|
|
2570
|
+
if (!obj.hasOwnProperty(key))
|
|
2571
|
+
continue;
|
|
2572
|
+
bytes += key.length * 2;
|
|
2573
|
+
sizeOf(obj[key]);
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
else
|
|
2577
|
+
bytes += obj.toString().length * 2;
|
|
2578
|
+
break;
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
return bytes;
|
|
2582
|
+
}
|
|
2583
|
+
return sizeOf(obj);
|
|
2584
|
+
}
|
|
2585
|
+
|
|
2586
|
+
/* eslint-disable no-extend-native */
|
|
2587
|
+
Date.prototype.changeYear = function (year) {
|
|
2588
|
+
const newDate = new Date(this);
|
|
2589
|
+
newDate.setFullYear(year);
|
|
2590
|
+
return newDate;
|
|
2483
2591
|
};
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2592
|
+
Date.prototype.changeMonth = function (monthIndex) {
|
|
2593
|
+
const newDate = new Date(this);
|
|
2594
|
+
newDate.setMonth(monthIndex);
|
|
2595
|
+
return newDate;
|
|
2487
2596
|
};
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2597
|
+
Date.prototype.changeDay = function (date) {
|
|
2598
|
+
const newDate = new Date(this);
|
|
2599
|
+
newDate.setDate(date);
|
|
2600
|
+
return newDate;
|
|
2491
2601
|
};
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2602
|
+
Date.prototype.changeHours = function (hours) {
|
|
2603
|
+
const newDate = new Date(this);
|
|
2604
|
+
newDate.setHours(hours);
|
|
2605
|
+
return newDate;
|
|
2495
2606
|
};
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2607
|
+
Date.prototype.changeMinutes = function (minutes) {
|
|
2608
|
+
const newDate = new Date(this);
|
|
2609
|
+
newDate.setMinutes(minutes);
|
|
2610
|
+
return newDate;
|
|
2499
2611
|
};
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2612
|
+
Date.prototype.changeSeconds = function (seconds) {
|
|
2613
|
+
const newDate = new Date(this);
|
|
2614
|
+
newDate.setSeconds(seconds);
|
|
2615
|
+
return newDate;
|
|
2503
2616
|
};
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2617
|
+
Date.prototype.changeMilliseconds = function (milliseconds) {
|
|
2618
|
+
const newDate = new Date(this);
|
|
2619
|
+
newDate.setMilliseconds(milliseconds);
|
|
2620
|
+
return newDate;
|
|
2508
2621
|
};
|
|
2509
|
-
|
|
2510
|
-
return
|
|
2511
|
-
&& event?.event === exports.WebSocketResponseEvent.SUBMISSIONS_CRAWL
|
|
2512
|
-
&& !!event?.content;
|
|
2622
|
+
Date.prototype.decreaseYear = function (count = 1) {
|
|
2623
|
+
return this.changeYear(this.getFullYear() - count);
|
|
2513
2624
|
};
|
|
2514
|
-
|
|
2515
|
-
return
|
|
2516
|
-
&& event?.event === exports.WebSocketResponseEvent.CONTEST_CHANGES
|
|
2517
|
-
&& !!event?.content;
|
|
2625
|
+
Date.prototype.increaseYear = function (count = 1) {
|
|
2626
|
+
return this.changeYear(this.getFullYear() + count);
|
|
2518
2627
|
};
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2628
|
+
Date.prototype.decreaseMonth = function () {
|
|
2629
|
+
const newDate = new Date(this);
|
|
2630
|
+
newDate.setMonth(newDate.getMonth() - 1);
|
|
2631
|
+
return newDate;
|
|
2522
2632
|
};
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
].includes(event?.event)
|
|
2528
|
-
&& !!event?.content;
|
|
2633
|
+
Date.prototype.increaseMonth = function () {
|
|
2634
|
+
const newDate = new Date(this);
|
|
2635
|
+
newDate.setMonth(newDate.getMonth() + 1);
|
|
2636
|
+
return newDate;
|
|
2529
2637
|
};
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2638
|
+
Date.prototype.increaseDay = function () {
|
|
2639
|
+
const newDate = new Date(this);
|
|
2640
|
+
newDate.setDate(newDate.getDate() + 1);
|
|
2641
|
+
return newDate;
|
|
2533
2642
|
};
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2643
|
+
Date.prototype.decreaseDay = function () {
|
|
2644
|
+
const newDate = new Date(this);
|
|
2645
|
+
newDate.setDate(newDate.getDate() - 1);
|
|
2646
|
+
return newDate;
|
|
2537
2647
|
};
|
|
2538
|
-
|
|
2539
|
-
const
|
|
2540
|
-
|
|
2648
|
+
Date.prototype.startOfYear = function () {
|
|
2649
|
+
const newDate = new Date(this);
|
|
2650
|
+
newDate.setMonth(0);
|
|
2651
|
+
return newDate.startOfMonth();
|
|
2541
2652
|
};
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
// const aYearMilliseconds = 1000 * 60 * 60 * 24 * 365;
|
|
2546
|
-
// const remainingYears = Math.floor(timeRemaining / aYearMilliseconds);
|
|
2547
|
-
// remaining.push({ remaining: remainingYears, label: 'years', milliseconds: aYearMilliseconds });
|
|
2548
|
-
// const aWeekMilliseconds = 1000 * 60 * 60 * 24 * 7;
|
|
2549
|
-
// const remainingWeeks = Math.floor((timeRemaining % aYearMilliseconds) / aWeekMilliseconds);
|
|
2550
|
-
// remaining.push({ remaining: remainingWeeks, label: 'weeks', milliseconds: aWeekMilliseconds });
|
|
2551
|
-
const aSecondMilliseconds = 1000;
|
|
2552
|
-
const aMinuteMilliseconds = aSecondMilliseconds * 60;
|
|
2553
|
-
const aHourMilliseconds = aMinuteMilliseconds * 60;
|
|
2554
|
-
const aDayMilliseconds = aHourMilliseconds * 24;
|
|
2555
|
-
const aWeekMilliseconds = aDayMilliseconds * 7;
|
|
2556
|
-
const remainingWeeks = Math.floor(timeRemaining / aWeekMilliseconds);
|
|
2557
|
-
remaining.push({
|
|
2558
|
-
remaining: remainingWeeks,
|
|
2559
|
-
label: remainingWeeks === 1 ? 'week' : 'weeks',
|
|
2560
|
-
abbreviatedLabel: 'w',
|
|
2561
|
-
milliseconds: aWeekMilliseconds,
|
|
2562
|
-
digits: 2,
|
|
2563
|
-
});
|
|
2564
|
-
const remainingDays = Math.floor((timeRemaining % aWeekMilliseconds) / aDayMilliseconds);
|
|
2565
|
-
remaining.push({
|
|
2566
|
-
remaining: remainingDays,
|
|
2567
|
-
label: remainingDays === 1 ? 'day' : 'days',
|
|
2568
|
-
abbreviatedLabel: 'd',
|
|
2569
|
-
milliseconds: aDayMilliseconds,
|
|
2570
|
-
digits: 2,
|
|
2571
|
-
});
|
|
2572
|
-
const remainingHours = Math.floor((timeRemaining % aDayMilliseconds) / aHourMilliseconds);
|
|
2573
|
-
remaining.push({
|
|
2574
|
-
remaining: remainingHours,
|
|
2575
|
-
label: remainingHours === 1 ? 'hour' : 'hours',
|
|
2576
|
-
abbreviatedLabel: 'h',
|
|
2577
|
-
milliseconds: aHourMilliseconds,
|
|
2578
|
-
digits: 2,
|
|
2579
|
-
});
|
|
2580
|
-
const remainingMinutes = Math.floor((timeRemaining % aHourMilliseconds) / aMinuteMilliseconds);
|
|
2581
|
-
remaining.push({
|
|
2582
|
-
remaining: remainingMinutes,
|
|
2583
|
-
label: remainingMinutes === 1 ? 'minute' : 'minutes',
|
|
2584
|
-
abbreviatedLabel: 'm',
|
|
2585
|
-
milliseconds: aMinuteMilliseconds,
|
|
2586
|
-
digits: 2,
|
|
2587
|
-
});
|
|
2588
|
-
const remainingSeconds = Math.floor((timeRemaining % aMinuteMilliseconds) / aSecondMilliseconds);
|
|
2589
|
-
remaining.push({
|
|
2590
|
-
remaining: remainingSeconds,
|
|
2591
|
-
label: remainingSeconds === 1 ? 'second' : 'seconds',
|
|
2592
|
-
abbreviatedLabel: 's',
|
|
2593
|
-
milliseconds: aSecondMilliseconds,
|
|
2594
|
-
digits: 2,
|
|
2595
|
-
});
|
|
2596
|
-
const remainingMilliseconds = Math.floor(timeRemaining % aSecondMilliseconds);
|
|
2597
|
-
remaining.push({
|
|
2598
|
-
remaining: remainingMilliseconds,
|
|
2599
|
-
label: remainingMilliseconds === 1 ? 'millisecond' : 'milliseconds',
|
|
2600
|
-
abbreviatedLabel: 'ms',
|
|
2601
|
-
milliseconds: 1,
|
|
2602
|
-
digits: 3,
|
|
2603
|
-
});
|
|
2604
|
-
// while (remaining[0].remaining <= 0) {
|
|
2605
|
-
// remaining.shift();
|
|
2606
|
-
// if (remaining.length === 3) {
|
|
2607
|
-
// break;
|
|
2608
|
-
// }
|
|
2609
|
-
// }
|
|
2610
|
-
return remaining;
|
|
2611
|
-
}
|
|
2612
|
-
function normalizeToLocalStartOfDay(timestamp) {
|
|
2613
|
-
const date = new Date(timestamp);
|
|
2614
|
-
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
2615
|
-
}
|
|
2616
|
-
function normalizeToLocalStartOfHour(timestamp) {
|
|
2617
|
-
const date = new Date(timestamp);
|
|
2618
|
-
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours());
|
|
2619
|
-
}
|
|
2620
|
-
function normalizeToLocalStartOfMinutes(timestamp) {
|
|
2621
|
-
const date = new Date(timestamp);
|
|
2622
|
-
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes());
|
|
2623
|
-
}
|
|
2624
|
-
function normalizeToLocalStartOfSeconds(timestamp) {
|
|
2625
|
-
const date = new Date(timestamp);
|
|
2626
|
-
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes());
|
|
2627
|
-
}
|
|
2628
|
-
const getYears = (d) => d.getFullYear();
|
|
2629
|
-
const getMonths = (d) => d.getFullYear() * 12 + d.getMonth();
|
|
2630
|
-
const getDays = (d) => {
|
|
2631
|
-
return Math.floor(normalizeToLocalStartOfDay(d).getTime() / ONE_DAY);
|
|
2653
|
+
Date.prototype.endOfYear = function () {
|
|
2654
|
+
const nextMonth = this.increaseYear().startOfYear();
|
|
2655
|
+
return new Date(nextMonth.getTime() - 1);
|
|
2632
2656
|
};
|
|
2633
|
-
|
|
2634
|
-
|
|
2657
|
+
Date.prototype.startOfMonth = function () {
|
|
2658
|
+
const newDate = new Date(this);
|
|
2659
|
+
newDate.setDate(1);
|
|
2660
|
+
return newDate.startOfDay();
|
|
2635
2661
|
};
|
|
2636
|
-
|
|
2637
|
-
|
|
2662
|
+
Date.prototype.endOfMonth = function () {
|
|
2663
|
+
const nextMonth = this.increaseMonth().startOfMonth();
|
|
2664
|
+
return new Date(nextMonth.getTime() - 1);
|
|
2638
2665
|
};
|
|
2639
|
-
|
|
2640
|
-
|
|
2666
|
+
Date.prototype.startOfWeek = function () {
|
|
2667
|
+
const newDate = new Date(this);
|
|
2668
|
+
while (newDate.getDay()) {
|
|
2669
|
+
newDate.setDate(newDate.getDate() - 1);
|
|
2670
|
+
}
|
|
2671
|
+
return newDate.startOfDay();
|
|
2641
2672
|
};
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2673
|
+
Date.prototype.endOfWeek = function () {
|
|
2674
|
+
const newDate = new Date(this);
|
|
2675
|
+
while (newDate.getDay() < 6) {
|
|
2676
|
+
newDate.setDate(newDate.getDate() - 1);
|
|
2677
|
+
}
|
|
2678
|
+
return newDate.endOfDay();
|
|
2646
2679
|
};
|
|
2647
|
-
|
|
2648
|
-
const
|
|
2649
|
-
|
|
2680
|
+
Date.prototype.startOfDay = function () {
|
|
2681
|
+
const newDate = new Date(this);
|
|
2682
|
+
newDate.setHours(0, 0, 0, 0);
|
|
2683
|
+
return newDate;
|
|
2650
2684
|
};
|
|
2651
|
-
|
|
2652
|
-
|
|
2685
|
+
Date.prototype.endOfDay = function () {
|
|
2686
|
+
const newDate = new Date(this);
|
|
2687
|
+
newDate.setHours(23, 59, 59, 999);
|
|
2688
|
+
return newDate;
|
|
2653
2689
|
};
|
|
2654
|
-
|
|
2655
|
-
const
|
|
2656
|
-
|
|
2690
|
+
Date.prototype.startOfHour = function () {
|
|
2691
|
+
const newDate = new Date(this);
|
|
2692
|
+
newDate.setMinutes(0, 0, 0);
|
|
2693
|
+
return newDate;
|
|
2657
2694
|
};
|
|
2658
|
-
|
|
2659
|
-
const
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
title: '',
|
|
2663
|
-
points: 0,
|
|
2664
|
-
});
|
|
2665
|
-
const ASPECT_RATIO = {
|
|
2666
|
-
[exports.AspectRatio.RATIO_21_9]: {
|
|
2667
|
-
aspectRatio: exports.AspectRatio.RATIO_21_9,
|
|
2668
|
-
width: 2520,
|
|
2669
|
-
height: 1080,
|
|
2670
|
-
decimal: 21 / 9,
|
|
2671
|
-
label: 'ultrawide',
|
|
2672
|
-
},
|
|
2673
|
-
[exports.AspectRatio.RATIO_20_9]: {
|
|
2674
|
-
aspectRatio: exports.AspectRatio.RATIO_20_9,
|
|
2675
|
-
width: 2400,
|
|
2676
|
-
height: 1080,
|
|
2677
|
-
decimal: 20 / 9,
|
|
2678
|
-
label: 'mobile wide',
|
|
2679
|
-
},
|
|
2680
|
-
[exports.AspectRatio.RATIO_16_9]: {
|
|
2681
|
-
aspectRatio: exports.AspectRatio.RATIO_16_9,
|
|
2682
|
-
width: 1920,
|
|
2683
|
-
height: 1080,
|
|
2684
|
-
decimal: 16 / 9,
|
|
2685
|
-
label: 'widescreen',
|
|
2686
|
-
},
|
|
2687
|
-
[exports.AspectRatio.RATIO_16_10]: {
|
|
2688
|
-
aspectRatio: exports.AspectRatio.RATIO_16_10,
|
|
2689
|
-
width: 1920,
|
|
2690
|
-
height: 1200,
|
|
2691
|
-
decimal: 16 / 10,
|
|
2692
|
-
label: 'widescreen tall',
|
|
2693
|
-
},
|
|
2694
|
-
[exports.AspectRatio.RATIO_3_2]: {
|
|
2695
|
-
aspectRatio: exports.AspectRatio.RATIO_3_2,
|
|
2696
|
-
width: 1440,
|
|
2697
|
-
height: 960,
|
|
2698
|
-
decimal: 3 / 2,
|
|
2699
|
-
label: 'balanced',
|
|
2700
|
-
},
|
|
2701
|
-
[exports.AspectRatio.RATIO_4_3]: {
|
|
2702
|
-
aspectRatio: exports.AspectRatio.RATIO_4_3,
|
|
2703
|
-
width: 1024,
|
|
2704
|
-
height: 768,
|
|
2705
|
-
decimal: 4 / 3,
|
|
2706
|
-
label: 'standard',
|
|
2707
|
-
},
|
|
2708
|
-
[exports.AspectRatio.RATIO_5_4]: {
|
|
2709
|
-
aspectRatio: exports.AspectRatio.RATIO_5_4,
|
|
2710
|
-
width: 1280,
|
|
2711
|
-
height: 1024,
|
|
2712
|
-
decimal: 5 / 4,
|
|
2713
|
-
label: 'square old',
|
|
2714
|
-
},
|
|
2715
|
-
[exports.AspectRatio.RATIO_1_1]: {
|
|
2716
|
-
aspectRatio: exports.AspectRatio.RATIO_1_1,
|
|
2717
|
-
width: 1000,
|
|
2718
|
-
height: 1000,
|
|
2719
|
-
decimal: 1,
|
|
2720
|
-
label: 'square',
|
|
2721
|
-
},
|
|
2695
|
+
Date.prototype.endOfHour = function () {
|
|
2696
|
+
const newDate = new Date(this);
|
|
2697
|
+
newDate.setMinutes(59, 59, 999);
|
|
2698
|
+
return newDate;
|
|
2722
2699
|
};
|
|
2723
|
-
|
|
2724
|
-
const
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
sheets.unshift(NEW_PAGE_SHEET());
|
|
2728
|
-
}
|
|
2729
|
-
let newPage = sheets[0];
|
|
2730
|
-
let content = [];
|
|
2731
|
-
const sheetsByPages = [];
|
|
2732
|
-
for (let i = 1; i < sheets.length; i++) {
|
|
2733
|
-
const sheet = sheets[i];
|
|
2734
|
-
if (sheet.type === exports.WorksheetType.NEW_PAGE) {
|
|
2735
|
-
sheetsByPages.push({
|
|
2736
|
-
header: newPage,
|
|
2737
|
-
content: [...content],
|
|
2738
|
-
});
|
|
2739
|
-
newPage = sheet;
|
|
2740
|
-
content = [];
|
|
2741
|
-
}
|
|
2742
|
-
else {
|
|
2743
|
-
content.push(sheet);
|
|
2744
|
-
}
|
|
2745
|
-
}
|
|
2746
|
-
sheetsByPages.push({
|
|
2747
|
-
header: newPage,
|
|
2748
|
-
content: [...content],
|
|
2749
|
-
});
|
|
2750
|
-
return sheetsByPages;
|
|
2700
|
+
Date.prototype.startOfMinute = function () {
|
|
2701
|
+
const newDate = new Date(this);
|
|
2702
|
+
newDate.setSeconds(0, 0);
|
|
2703
|
+
return newDate;
|
|
2751
2704
|
};
|
|
2752
|
-
|
|
2753
|
-
const
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
}
|
|
2757
|
-
let newPage = sheets[0];
|
|
2758
|
-
let content = [];
|
|
2759
|
-
const sheetsByPages = [];
|
|
2760
|
-
for (let i = 1; i < sheets.length; i++) {
|
|
2761
|
-
const sheet = sheets[i];
|
|
2762
|
-
if (sheet.type === exports.WorksheetType.NEW_PAGE) {
|
|
2763
|
-
sheetsByPages.push({
|
|
2764
|
-
header: newPage,
|
|
2765
|
-
content: content.map(c => ({
|
|
2766
|
-
id: c.id,
|
|
2767
|
-
type: c.type,
|
|
2768
|
-
title: c.title,
|
|
2769
|
-
points: c.points,
|
|
2770
|
-
})),
|
|
2771
|
-
});
|
|
2772
|
-
newPage = sheet;
|
|
2773
|
-
content = [];
|
|
2774
|
-
}
|
|
2775
|
-
else {
|
|
2776
|
-
content.push(sheet);
|
|
2777
|
-
}
|
|
2778
|
-
}
|
|
2779
|
-
sheetsByPages.push({
|
|
2780
|
-
header: newPage,
|
|
2781
|
-
content: [...content],
|
|
2782
|
-
});
|
|
2783
|
-
return sheetsByPages;
|
|
2705
|
+
Date.prototype.endOfMinute = function () {
|
|
2706
|
+
const newDate = new Date(this);
|
|
2707
|
+
newDate.setSeconds(59, 999);
|
|
2708
|
+
return newDate;
|
|
2784
2709
|
};
|
|
2785
|
-
|
|
2786
|
-
const
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
&& typeof value?.title == 'string'
|
|
2790
|
-
&& typeof value?.points == 'number';
|
|
2710
|
+
Date.prototype.startOfSecond = function () {
|
|
2711
|
+
const newDate = new Date(this);
|
|
2712
|
+
newDate.setMilliseconds(0);
|
|
2713
|
+
return newDate;
|
|
2791
2714
|
};
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2715
|
+
Date.prototype.endOfSecond = function () {
|
|
2716
|
+
const newDate = new Date(this);
|
|
2717
|
+
newDate.setMilliseconds(999);
|
|
2718
|
+
return newDate;
|
|
2796
2719
|
};
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
&& typeof value?.sourceCode === 'object' && value?.sourceCode !== null
|
|
2801
|
-
&& value?.testCases === 'object' && value?.testCases !== null
|
|
2802
|
-
&& Array.isArray(value?.languages)
|
|
2803
|
-
&& typeof value?.height == 'number';
|
|
2720
|
+
Date.prototype.isToday = function () {
|
|
2721
|
+
const today = new Date();
|
|
2722
|
+
return this.isSameDay(today);
|
|
2804
2723
|
};
|
|
2805
|
-
|
|
2806
|
-
return
|
|
2807
|
-
&& value?.type === exports.WorksheetType.QUIZ_PROBLEM
|
|
2808
|
-
&& Object.values(exports.Judge).includes(value?.problemJudge) || typeof value?.problemJudge === 'string'
|
|
2809
|
-
&& typeof value?.problemKey == 'string'
|
|
2810
|
-
&& Array.isArray(value?.languages)
|
|
2811
|
-
&& typeof value?.height == 'number';
|
|
2724
|
+
Date.prototype.isEqual = function (date) {
|
|
2725
|
+
return this.getTime() === date.getTime();
|
|
2812
2726
|
};
|
|
2813
|
-
|
|
2814
|
-
return
|
|
2815
|
-
&& value?.type === exports.WorksheetType.QUIZ_OPTIONS
|
|
2816
|
-
&& typeof value?.description == 'string'
|
|
2817
|
-
&& Array.isArray(value?.options)
|
|
2818
|
-
&& value?.options.every((option) => typeof option?.label == 'string' && typeof option?.correct == 'boolean' && typeof option?.id == 'string')
|
|
2819
|
-
&& typeof value?.multiple == 'boolean'
|
|
2820
|
-
&& (value?.scoringMode === 'TOTAL' || value?.scoringMode === 'PARTIAL');
|
|
2727
|
+
Date.prototype.isSameYear = function (date) {
|
|
2728
|
+
return this.getFullYear() === date.getFullYear();
|
|
2821
2729
|
};
|
|
2822
|
-
|
|
2823
|
-
return
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2730
|
+
Date.prototype.isSameMonth = function (date) {
|
|
2731
|
+
return this.isSameYear(date) && this.getMonth() === date.getMonth();
|
|
2732
|
+
};
|
|
2733
|
+
Date.prototype.isSameDay = function (date) {
|
|
2734
|
+
return this.isSameMonth(date) && this.getDate() === date.getDate();
|
|
2735
|
+
};
|
|
2736
|
+
Date.prototype.isSameHour = function (date) {
|
|
2737
|
+
return this.isSameDay(date) && this.getHours() === date.getHours();
|
|
2738
|
+
};
|
|
2739
|
+
Date.prototype.isSameMinute = function (date) {
|
|
2740
|
+
return this.isSameHour(date) && this.getMinutes() === date.getMinutes();
|
|
2741
|
+
};
|
|
2742
|
+
Date.prototype.isSameSecond = function (date) {
|
|
2743
|
+
return this.isSameMinute(date) && this.getSeconds() === date.getSeconds();
|
|
2744
|
+
};
|
|
2745
|
+
Date.prototype.isSameMillisecond = function (date) {
|
|
2746
|
+
return this.isEqual(date);
|
|
2747
|
+
};
|
|
2748
|
+
Date.prototype.isValidDate = function () {
|
|
2749
|
+
return this instanceof Date && !isNaN(this.getTime());
|
|
2750
|
+
};
|
|
2751
|
+
Date.prototype.isYearAfter = function (date) {
|
|
2752
|
+
return this.getFullYear() > date.getFullYear();
|
|
2753
|
+
};
|
|
2754
|
+
Date.prototype.isMonthAfter = function (date) {
|
|
2755
|
+
return this.isYearAfter(date) || (this.isSameYear(date) && this.getMonth() > date.getMonth());
|
|
2756
|
+
};
|
|
2757
|
+
Date.prototype.isDayAfter = function (date) {
|
|
2758
|
+
return this.isMonthAfter(date) || (this.isSameMonth(date) && this.getDate() > date.getDate());
|
|
2759
|
+
};
|
|
2760
|
+
Date.prototype.isHoursAfter = function (date) {
|
|
2761
|
+
return this.isDayAfter(date) || (this.isSameDay(date) && this.getHours() > date.getHours());
|
|
2762
|
+
};
|
|
2763
|
+
Date.prototype.isMinutesAfter = function (date) {
|
|
2764
|
+
return this.isHoursAfter(date) || (this.isSameHour(date) && this.getMinutes() > date.getMinutes());
|
|
2765
|
+
};
|
|
2766
|
+
Date.prototype.isSecondsAfter = function (date) {
|
|
2767
|
+
return this.isMinutesAfter(date) || (this.isSameMinute(date) && this.getSeconds() > date.getSeconds());
|
|
2768
|
+
};
|
|
2769
|
+
Date.prototype.isMillisecondsAfter = function (date) {
|
|
2770
|
+
return this.isSecondsAfter(date) || (this.isSameSecond(date) && this.getMilliseconds() > date.getMilliseconds());
|
|
2771
|
+
};
|
|
2772
|
+
Date.prototype.isAfter = function (date) {
|
|
2773
|
+
return this.getTime() > date.getTime();
|
|
2774
|
+
};
|
|
2775
|
+
Date.prototype.isYearBefore = function (date) {
|
|
2776
|
+
return this.getFullYear() < date.getFullYear();
|
|
2777
|
+
};
|
|
2778
|
+
Date.prototype.isMonthBefore = function (date) {
|
|
2779
|
+
return this.isYearBefore(date) || (this.isSameYear(date) && this.getMonth() < date.getMonth());
|
|
2780
|
+
};
|
|
2781
|
+
Date.prototype.isDayBefore = function (date) {
|
|
2782
|
+
return this.isMonthBefore(date) || (this.isSameMonth(date) && this.getDate() < date.getDate());
|
|
2783
|
+
};
|
|
2784
|
+
Date.prototype.isHoursBefore = function (date) {
|
|
2785
|
+
return this.isDayBefore(date) || (this.isSameDay(date) && this.getHours() < date.getHours());
|
|
2786
|
+
};
|
|
2787
|
+
Date.prototype.isMinutesBefore = function (date) {
|
|
2788
|
+
return this.isHoursBefore(date) || (this.isSameHour(date) && this.getMinutes() < date.getMinutes());
|
|
2789
|
+
};
|
|
2790
|
+
Date.prototype.isSecondsBefore = function (date) {
|
|
2791
|
+
return this.isMinutesBefore(date) || (this.isSameMinute(date) && this.getSeconds() < date.getSeconds());
|
|
2792
|
+
};
|
|
2793
|
+
Date.prototype.isMillisecondsBefore = function (date) {
|
|
2794
|
+
return this.isSecondsBefore(date) || (this.isSameSecond(date) && this.getMilliseconds() < date.getMilliseconds());
|
|
2795
|
+
};
|
|
2796
|
+
Date.prototype.isBefore = function (date) {
|
|
2797
|
+
return this.getTime() < date.getTime();
|
|
2798
|
+
};
|
|
2799
|
+
Date.prototype.isWithinInterval = function ({ start, end }, cmp = '[]') {
|
|
2800
|
+
return (cmp.charAt(0) === '[' ? this.isEqual(start) || this.isAfter(start) : this.isAfter(start)) &&
|
|
2801
|
+
(cmp.charAt(1) === '[' ? this.isEqual(end) || this.isBefore(end) : this.isBefore(end));
|
|
2828
2802
|
};
|
|
2829
2803
|
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
];
|
|
2845
|
-
const DAY_NAMES = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
2846
|
-
const HOURS = range(0, 24);
|
|
2847
|
-
const MINUTES = range(0, 60);
|
|
2848
|
-
const SECONDS = range(0, 60);
|
|
2849
|
-
const MILLISECONDS = range(0, 1000);
|
|
2850
|
-
const MAX_DATE = new Date(8640000000000000);
|
|
2851
|
-
const MIN_DATE = new Date(0);
|
|
2804
|
+
class JkError extends Error {
|
|
2805
|
+
constructor(code, custom) {
|
|
2806
|
+
const message = custom?.message || ERROR[code].message;
|
|
2807
|
+
super(message);
|
|
2808
|
+
this.message = message;
|
|
2809
|
+
this.code = code;
|
|
2810
|
+
if (custom?.stack) {
|
|
2811
|
+
this.stack = custom.stack;
|
|
2812
|
+
}
|
|
2813
|
+
if (custom?.data) {
|
|
2814
|
+
this.data = custom.data;
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2852
2818
|
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
height="56px"
|
|
2861
|
-
style="padding:10px; box-sizing: border-box"
|
|
2862
|
-
/>
|
|
2863
|
-
</div>
|
|
2864
|
-
</div>
|
|
2865
|
-
<div style="padding: 24px; color: #333333; font-family: sans-serif; font-size: 16px; line-height: 24px;">
|
|
2866
|
-
<div style="max-width: 520px; margin: 0 auto; padding: 24px; background: white; border-radius: 6px;">
|
|
2867
|
-
<section style="padding: 0 0 1em 0; border-bottom: 1px solid #828282;">
|
|
2868
|
-
{{content}}
|
|
2869
|
-
</section>
|
|
2870
|
-
<div style="font-size: 14px; text-align: center; color: #828282; line-height: 16px; padding-top: 1em">
|
|
2871
|
-
<p style="margin: 0;">
|
|
2872
|
-
Si tú no realizaste la solicitud, escribenos a
|
|
2873
|
-
<a href="mailto:${SUPPORT_EMAIL}" style="color: #2468A6; text-decoration: none;">
|
|
2874
|
-
${SUPPORT_EMAIL}
|
|
2875
|
-
</a>
|
|
2876
|
-
</p>
|
|
2877
|
-
<p style="margin: 0;">
|
|
2878
|
-
Este mensaje fue enviado por el equipo de
|
|
2879
|
-
<a href="https://juki.app" style="color: #2468A6; text-decoration: none;">
|
|
2880
|
-
juki.app
|
|
2881
|
-
</a>
|
|
2882
|
-
</p>
|
|
2883
|
-
</div>
|
|
2884
|
-
</div>
|
|
2885
|
-
</div>
|
|
2886
|
-
</div>`;
|
|
2819
|
+
/* eslint-disable no-extend-native */
|
|
2820
|
+
Number.prototype.padStart = function (maxLength, fillString = '0') {
|
|
2821
|
+
return (this + '').padStart(maxLength, fillString);
|
|
2822
|
+
};
|
|
2823
|
+
Number.prototype.padEnd = function (maxLength, fillString = '0') {
|
|
2824
|
+
return (this + '').padEnd(maxLength, fillString);
|
|
2825
|
+
};
|
|
2887
2826
|
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2827
|
+
function toJkError(err) {
|
|
2828
|
+
const error = new Error();
|
|
2829
|
+
let code = err?.code;
|
|
2830
|
+
if (!(code in exports.ErrorCode)) {
|
|
2831
|
+
code = exports.ErrorCode.ERR500;
|
|
2832
|
+
}
|
|
2833
|
+
return new JkError(code, {
|
|
2834
|
+
message: err?.message || error.message,
|
|
2835
|
+
stack: err?.stack || error.stack,
|
|
2836
|
+
data: err?.data || null,
|
|
2837
|
+
});
|
|
2838
|
+
}
|
|
2839
|
+
function errorsResponse(message, ...errors) {
|
|
2840
|
+
return {
|
|
2841
|
+
success: false,
|
|
2842
|
+
message: message,
|
|
2843
|
+
errors: errors.map(error => ({
|
|
2844
|
+
code: error.code,
|
|
2845
|
+
message: error.message,
|
|
2846
|
+
detail: error.stack || new Error().stack || '',
|
|
2847
|
+
data: error.data,
|
|
2848
|
+
})),
|
|
2849
|
+
};
|
|
2850
|
+
}
|
|
2851
|
+
function contentResponse(message, content) {
|
|
2852
|
+
return {
|
|
2853
|
+
success: true,
|
|
2854
|
+
message,
|
|
2855
|
+
content,
|
|
2856
|
+
};
|
|
2857
|
+
}
|
|
2858
|
+
function contentsResponse(message, contents, meta) {
|
|
2859
|
+
return {
|
|
2860
|
+
success: true,
|
|
2861
|
+
message,
|
|
2862
|
+
contents,
|
|
2863
|
+
meta,
|
|
2864
|
+
};
|
|
2865
|
+
}
|
|
2866
|
+
const cleanRequest = (responseText) => {
|
|
2867
|
+
if (!isStringJson(responseText)) {
|
|
2868
|
+
// this occurs when the endpoint don't exits or server is down
|
|
2869
|
+
const response = {
|
|
2870
|
+
success: false,
|
|
2871
|
+
message: ERROR[exports.ErrorCode.ERR9999].message,
|
|
2872
|
+
errors: [{ code: exports.ErrorCode.ERR9999, detail: '', message: ERROR[exports.ErrorCode.ERR9999].message }],
|
|
2873
|
+
};
|
|
2874
|
+
consoleError({ message: 'response is not string json, success false on cleaning request', responseText, response });
|
|
2875
|
+
// jukiApiManager.reportError({ message: 'success false on cleaning request', responseText, response });
|
|
2876
|
+
return response;
|
|
2877
|
+
}
|
|
2878
|
+
const responseJson = JSON.parse(responseText);
|
|
2879
|
+
if (typeof responseJson.success === 'boolean') {
|
|
2880
|
+
if (responseJson.success === true && typeof responseJson.message === 'string' && responseJson.content) { // V1
|
|
2881
|
+
return {
|
|
2882
|
+
success: true,
|
|
2883
|
+
message: responseJson.message,
|
|
2884
|
+
content: responseJson.content,
|
|
2885
|
+
};
|
|
2886
|
+
}
|
|
2887
|
+
else if (responseJson.success === true && typeof responseJson.message === 'string' && Array.isArray(responseJson.contents) && responseJson.meta) { // V1
|
|
2888
|
+
return {
|
|
2889
|
+
success: true,
|
|
2890
|
+
message: responseJson.message,
|
|
2891
|
+
contents: responseJson.contents,
|
|
2892
|
+
meta: responseJson.meta,
|
|
2893
|
+
};
|
|
2894
|
+
}
|
|
2895
|
+
else if (responseJson.success === false && typeof responseJson.message === 'string' && Array.isArray(responseJson.errors)) { // V1
|
|
2896
|
+
const response = {
|
|
2897
|
+
success: false,
|
|
2898
|
+
message: responseJson.message,
|
|
2899
|
+
errors: responseJson.errors,
|
|
2900
|
+
};
|
|
2901
|
+
consoleError({ message: 'success false on cleaning request', responseText, response });
|
|
2902
|
+
// jukiApiManager.reportError({ message: 'success false on cleaning request', responseText, response });
|
|
2903
|
+
return response;
|
|
2904
|
+
}
|
|
2905
|
+
}
|
|
2906
|
+
const response = {
|
|
2907
|
+
success: false,
|
|
2908
|
+
message: ERROR[exports.ErrorCode.ERR9998].message,
|
|
2909
|
+
errors: [{ code: exports.ErrorCode.ERR9998, detail: '', message: ERROR[exports.ErrorCode.ERR9998].message }],
|
|
2910
|
+
};
|
|
2911
|
+
consoleError({ message: 'success false on cleaning request', responseText, response });
|
|
2912
|
+
// jukiApiManager.reportError({ message: 'success false on cleaning request', responseText, response });
|
|
2913
|
+
return response;
|
|
2914
|
+
};
|
|
2915
|
+
const getDefaultMeta = (contents, sort) => {
|
|
2916
|
+
return { sort: sort ?? [], page: 1, size: contents.length, totalElements: contents.length, filter: {} };
|
|
2917
|
+
};
|
|
2905
2918
|
|
|
2906
|
-
const
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
// label: '',
|
|
2910
|
-
// logo: 'https://images.juki.pub/c/juki-judge-logo-horizontal-color.svg',
|
|
2911
|
-
// logoSize: [ 883.991, 435 ],
|
|
2912
|
-
// url: '',
|
|
2913
|
-
// // getLoginUrl: () => '',
|
|
2914
|
-
// // getProfileUrl: () => '',
|
|
2915
|
-
// // getSubmitUrl: () => '',
|
|
2916
|
-
// // getSubmissionUrl: () => '',
|
|
2917
|
-
// // getProblemUrl: (key: string) => `/problem/view/${key}`,
|
|
2918
|
-
// // getUserSubmissionsUrl: () => '',
|
|
2919
|
-
// },
|
|
2920
|
-
[exports.Judge.JUKI_JUDGE]: {
|
|
2921
|
-
value: exports.Judge.JUKI_JUDGE,
|
|
2922
|
-
label: 'Juki Judge',
|
|
2923
|
-
logo: 'https://images.juki.pub/c/juki-judge-logo-horizontal-color.svg',
|
|
2924
|
-
logoSize: [883.991, 435],
|
|
2925
|
-
url: 'https://judge.juki.app',
|
|
2926
|
-
// getLoginUrl: () => '',
|
|
2927
|
-
// getProfileUrl: () => '',
|
|
2928
|
-
// getSubmitUrl: () => '',
|
|
2929
|
-
// getSubmissionUrl: () => '',
|
|
2930
|
-
// getProblemUrl: (key: string) => `https://judge.juki.app/problem/view/${key}`,
|
|
2931
|
-
// getUserSubmissionsUrl: () => '',
|
|
2932
|
-
},
|
|
2933
|
-
[exports.Judge.CODEFORCES]: {
|
|
2934
|
-
value: exports.Judge.CODEFORCES,
|
|
2935
|
-
label: 'Codeforces',
|
|
2936
|
-
logo: 'https://images.juki.pub/c/codeforces-logo-horizontal-color.svg',
|
|
2937
|
-
logoSize: [1232.75, 145.12],
|
|
2938
|
-
url: 'https://codeforces.com',
|
|
2939
|
-
// getLoginUrl: () => 'https://codeforces.com/enter',
|
|
2940
|
-
// getProfileUrl: () => '',
|
|
2941
|
-
// getSubmitUrl: () => 'https://codeforces.com/problemset/submit',
|
|
2942
|
-
// getSubmissionUrl: (problemKey: string, submissionId: string) => {
|
|
2943
|
-
// const [ contestId ] = problemKey.split('-');
|
|
2944
|
-
// return `https://codeforces.com/problemset/submission/${contestId}/${submissionId}`;
|
|
2945
|
-
// },
|
|
2946
|
-
// getProblemUrl: (problemKey: string) => {
|
|
2947
|
-
// const [ contestId, index ] = problemKey.split('-');
|
|
2948
|
-
// return `https://codeforces.com/problemset/problem/${contestId}/${index}`;
|
|
2949
|
-
// },
|
|
2950
|
-
// getUserSubmissionsUrl: () => '',
|
|
2951
|
-
},
|
|
2952
|
-
[exports.Judge.CODEFORCES_GYM]: {
|
|
2953
|
-
value: exports.Judge.CODEFORCES_GYM,
|
|
2954
|
-
label: 'Codeforces Gym',
|
|
2955
|
-
logo: 'https://images.juki.pub/c/codeforces-logo-horizontal-color.svg',
|
|
2956
|
-
logoSize: [1232.75, 145.12],
|
|
2957
|
-
url: 'https://codeforces.com',
|
|
2958
|
-
// getLoginUrl: () => 'https://codeforces.com/enter',
|
|
2959
|
-
// getProfileUrl: () => '',
|
|
2960
|
-
// getSubmitUrl: (problemKey: string) => {
|
|
2961
|
-
// const [ gymContestId, index ] = problemKey.split('-');
|
|
2962
|
-
// return `https://codeforces.com/gym/${gymContestId}/submit`;
|
|
2963
|
-
// },
|
|
2964
|
-
// getSubmissionUrl: (problemKey: string, submissionId: string) => {
|
|
2965
|
-
// const [ gymContestId ] = problemKey.split('-');
|
|
2966
|
-
// return `https://codeforces.com/gym/${gymContestId}/submission/${submissionId}`;
|
|
2967
|
-
// },
|
|
2968
|
-
// getProblemUrl: (problemKey: string) => {
|
|
2969
|
-
// const [ gymContestId, index ] = problemKey.split('-');
|
|
2970
|
-
// return `https://codeforces.com/gym/${gymContestId}/problem/${index}`;
|
|
2971
|
-
// },
|
|
2972
|
-
// getUserSubmissionsUrl: () => '',
|
|
2973
|
-
},
|
|
2974
|
-
[exports.Judge.JV_UMSA]: {
|
|
2975
|
-
value: exports.Judge.JV_UMSA,
|
|
2976
|
-
label: 'Juez Virtual UMSA',
|
|
2977
|
-
logo: 'https://images.juki.pub/c/codeforces-logo-horizontal-color.svg',
|
|
2978
|
-
logoSize: [1232.75, 145.12],
|
|
2979
|
-
url: 'https://jv.umsa.bo',
|
|
2980
|
-
// getLoginUrl: () => 'https://jv.umsa.bo/oj/login.php',
|
|
2981
|
-
// getProfileUrl: () => 'https://jv.umsa.bo/oj/userInfo.php',
|
|
2982
|
-
// getSubmitUrl: (problemKey: string) => {
|
|
2983
|
-
// // single problem: '1019'
|
|
2984
|
-
// // cib problem: '1019-A'
|
|
2985
|
-
// const isContestProblem = problemKey.includes('-');
|
|
2986
|
-
// // A -> 0, B -> 1, C -> 2, D -> 3, E -> 4, F -> 5, G -> 6, H -> 7, I -> 8, J -> 9
|
|
2987
|
-
// const params = problemKey.split('-');
|
|
2988
|
-
// return isContestProblem
|
|
2989
|
-
// ? `https://jv.umsa.bo/oj/submitpage.php?cid=${params[0]}&pid=${params[1].charCodeAt(0) - 65}`
|
|
2990
|
-
// : `https://jv.umsa.bo/oj/submitpage.php?id=${problemKey}`;
|
|
2991
|
-
// },
|
|
2992
|
-
// getSubmissionUrl: (problemKey: string, submissionId: string, username: string) => {
|
|
2993
|
-
// // return `https://jv.umsa.bo/status.php?problem_id=&user_id=${username}&language=-1&jresult=-1`;
|
|
2994
|
-
// return `https://jv.umsa.bo/oj/showsource.php?id=${submissionId}`;
|
|
2995
|
-
// },
|
|
2996
|
-
// getProblemUrl: (problemKey: string) => {
|
|
2997
|
-
// const isContestProblem = problemKey.includes('-');
|
|
2998
|
-
// const params = problemKey.split('-');
|
|
2999
|
-
// return isContestProblem
|
|
3000
|
-
// ? `https://jv.umsa.bo/oj/problem.php?cid=${params[0]}&pid=${params[1].charCodeAt(0) - 65}`
|
|
3001
|
-
// : `https://jv.umsa.bo/oj/problem.php?id=${problemKey}`;
|
|
3002
|
-
// },
|
|
3003
|
-
// getUserSubmissionsUrl: (username: string) => `https://jv.umsa.bo/oj/status.php?user_id=${username}`,
|
|
3004
|
-
},
|
|
3005
|
-
[exports.Judge.UVA_ONLINE_JUDGE]: {
|
|
3006
|
-
value: exports.Judge.UVA_ONLINE_JUDGE,
|
|
3007
|
-
label: 'Uva Online Judge',
|
|
3008
|
-
logo: 'https://images.juki.pub/c/uva-online-judge-logo-color.png',
|
|
3009
|
-
logoSize: [150, 135.994],
|
|
3010
|
-
url: 'https://onlinejudge.org',
|
|
3011
|
-
},
|
|
3012
|
-
[exports.Judge.AT_CODER]: {
|
|
3013
|
-
value: exports.Judge.AT_CODER,
|
|
3014
|
-
label: 'AtCoder',
|
|
3015
|
-
logo: 'https://images.juki.pub/c/at-coder-logo-color.png',
|
|
3016
|
-
logoSize: [762.997, 675],
|
|
3017
|
-
url: 'https://atcoder.jp',
|
|
3018
|
-
},
|
|
3019
|
-
[exports.Judge.CODECHEF]: {
|
|
3020
|
-
value: exports.Judge.CODECHEF,
|
|
3021
|
-
label: 'Codechef',
|
|
3022
|
-
logo: 'https://images.juki.pub/c/codechef-logo-color.svg',
|
|
3023
|
-
logoSize: [1207.7, 453.17],
|
|
3024
|
-
url: 'https://www.codechef.com',
|
|
3025
|
-
},
|
|
3026
|
-
[exports.Judge.TOPCODER]: {
|
|
3027
|
-
value: exports.Judge.TOPCODER,
|
|
3028
|
-
label: 'Topcoder',
|
|
3029
|
-
logo: 'https://images.juki.pub/c/topcoder-logo-color.png',
|
|
3030
|
-
logoSize: [971.99, 415.99],
|
|
3031
|
-
url: 'https://www.topcoder.com',
|
|
3032
|
-
},
|
|
3033
|
-
[exports.Judge.LEETCODE]: {
|
|
3034
|
-
value: exports.Judge.LEETCODE,
|
|
3035
|
-
label: 'LeetCode',
|
|
3036
|
-
logo: 'https://images.juki.pub/assets/leetcode-logo-color.svg',
|
|
3037
|
-
logoSize: [95, 111],
|
|
3038
|
-
url: 'https://leetcode.com',
|
|
3039
|
-
// getProblemUrl: (problemKey: string) => {
|
|
3040
|
-
// return `https://leetcode.com/problems/${problemKey.replace('PL-', '')}`;
|
|
3041
|
-
// },
|
|
3042
|
-
// getProfileUrl: (userNickname: string) => {
|
|
3043
|
-
// return `https://leetcode.com/u/${userNickname}`;
|
|
3044
|
-
// },
|
|
3045
|
-
// getSubmissionUrl: (problemKey: string, submissionId: string, username: string, submissionRunId: string) => {
|
|
3046
|
-
// return `https://leetcode.com/problems/${problemKey.replace('PL-', '')}/submissions/${submissionRunId}`;
|
|
3047
|
-
// },
|
|
3048
|
-
},
|
|
2919
|
+
const isWebsocketSubscription = (event) => {
|
|
2920
|
+
return (Object.values(exports.WebSocketSubscriptionEvent).includes(event?.event) || Object.values(exports.WebSocketMessageEvent).includes(event?.event))
|
|
2921
|
+
&& typeof event?.clientId === 'string' && !!event.clientId;
|
|
3049
2922
|
};
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
const
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
const
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
const
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
2923
|
+
// Custom CHANNEL_PUBLISH_MESSAGES
|
|
2924
|
+
const isPingWebSocketEventDTO = (event) => {
|
|
2925
|
+
return isWebsocketSubscription(event)
|
|
2926
|
+
&& event?.event === exports.WebSocketMessageEvent.PING;
|
|
2927
|
+
};
|
|
2928
|
+
const isClientTrackLocationWebSocketEventDTO = (event) => {
|
|
2929
|
+
return isWebsocketSubscription(event)
|
|
2930
|
+
&& event?.event === exports.WebSocketMessageEvent.CLIENT_TRACK_LOCATION;
|
|
2931
|
+
};
|
|
2932
|
+
const isClientTrackScreenshotWebSocketEventDTO = (event) => {
|
|
2933
|
+
return isWebsocketSubscription(event)
|
|
2934
|
+
&& event?.event === exports.WebSocketMessageEvent.CLIENT_TRACK_SCREENSHOT;
|
|
2935
|
+
};
|
|
2936
|
+
const isClientTrackDeviceWebSocketEventDTO = (event) => {
|
|
2937
|
+
return isWebsocketSubscription(event)
|
|
2938
|
+
&& event?.event === exports.WebSocketMessageEvent.CLIENT_TRACK_DEVICE;
|
|
2939
|
+
};
|
|
2940
|
+
const isChatCompletionsWebSocketEventDTO = (event) => {
|
|
2941
|
+
return isWebsocketSubscription(event)
|
|
2942
|
+
&& event?.event === exports.WebSocketMessageEvent.CHAT_COMPLETIONS;
|
|
2943
|
+
};
|
|
2944
|
+
// CHANNEL_PUBLISH_SUBSCRIPTIONS
|
|
2945
|
+
const isSubscribeCodeRunStatusWebSocketEventDTO = (event) => {
|
|
2946
|
+
return isWebsocketSubscription(event)
|
|
2947
|
+
&& event?.event === exports.WebSocketSubscriptionEvent.SUBSCRIBE_CODE_RUN_STATUS
|
|
2948
|
+
&& typeof event?.runId === 'string' && !!event.runId;
|
|
2949
|
+
};
|
|
2950
|
+
const isUnsubscribeCodeRunStatusWebSocketEventDTO = (event) => {
|
|
2951
|
+
return isWebsocketSubscription(event)
|
|
2952
|
+
&& event?.event === exports.WebSocketSubscriptionEvent.UNSUBSCRIBE_CODE_RUN_STATUS
|
|
2953
|
+
&& typeof event?.runId === 'string' && !!event.runId;
|
|
2954
|
+
};
|
|
2955
|
+
const isSubscribeSubmissionRunStatusWebSocketEventDTO = (event) => {
|
|
2956
|
+
return isWebsocketSubscription(event)
|
|
2957
|
+
&& event?.event === exports.WebSocketSubscriptionEvent.SUBSCRIBE_SUBMISSION_RUN_STATUS
|
|
2958
|
+
&& typeof event?.submitId === 'string' && !!event.submitId;
|
|
2959
|
+
};
|
|
2960
|
+
const isUnsubscribeSubmissionRunStatusWebSocketEventDTO = (event) => {
|
|
2961
|
+
return isWebsocketSubscription(event)
|
|
2962
|
+
&& event?.event === exports.WebSocketSubscriptionEvent.UNSUBSCRIBE_SUBMISSION_RUN_STATUS
|
|
2963
|
+
&& typeof event?.submitId === 'string' && !!event.submitId;
|
|
2964
|
+
};
|
|
2965
|
+
const isSubscribeGetDataWebSocketEventDTO = (event) => {
|
|
2966
|
+
return isWebsocketSubscription(event)
|
|
2967
|
+
&& event?.event === exports.WebSocketSubscriptionEvent.SUBSCRIBE_GET_DATA;
|
|
2968
|
+
};
|
|
2969
|
+
const isUnsubscribeGetDataWebSocketEventDTO = (event) => {
|
|
2970
|
+
return isWebsocketSubscription(event)
|
|
2971
|
+
&& event?.event === exports.WebSocketSubscriptionEvent.UNSUBSCRIBE_GET_DATA;
|
|
2972
|
+
};
|
|
2973
|
+
const isSubscribeProblemCrawledWebSocketEventDTO = (event) => {
|
|
2974
|
+
return isWebsocketSubscription(event)
|
|
2975
|
+
&& event?.event === exports.WebSocketSubscriptionEvent.SUBSCRIBE_PROBLEM_CRAWLED;
|
|
2976
|
+
};
|
|
2977
|
+
const isUnsubscribeProblemCrawledWebSocketEventDTO = (event) => {
|
|
2978
|
+
return isWebsocketSubscription(event)
|
|
2979
|
+
&& event?.event === exports.WebSocketSubscriptionEvent.UNSUBSCRIBE_PROBLEM_CRAWLED;
|
|
2980
|
+
};
|
|
2981
|
+
const isSubscribeSubmissionsCrawlWebSocketEventDTO = (event) => {
|
|
2982
|
+
return isWebsocketSubscription(event)
|
|
2983
|
+
&& event?.event === exports.WebSocketSubscriptionEvent.SUBSCRIBE_SUBMISSIONS_CRAWL;
|
|
2984
|
+
};
|
|
2985
|
+
const isUnsubscribeSubmissionsCrawlWebSocketEventDTO = (event) => {
|
|
2986
|
+
return isWebsocketSubscription(event)
|
|
2987
|
+
&& event?.event === exports.WebSocketSubscriptionEvent.UNSUBSCRIBE_SUBMISSIONS_CRAWL;
|
|
2988
|
+
};
|
|
2989
|
+
const isSubscribeContestChangesWebSocketEventDTO = (event) => {
|
|
2990
|
+
return isWebsocketSubscription(event)
|
|
2991
|
+
&& event?.event === exports.WebSocketSubscriptionEvent.SUBSCRIBE_CONTEST_CHANGES;
|
|
2992
|
+
};
|
|
2993
|
+
const isUnsubscribeContestChangesWebSocketEventDTO = (event) => {
|
|
2994
|
+
return isWebsocketSubscription(event)
|
|
2995
|
+
&& event?.event === exports.WebSocketSubscriptionEvent.UNSUBSCRIBE_CONTEST_CHANGES;
|
|
2996
|
+
};
|
|
2997
|
+
const isSubscribeClientTrackWebSocketEventDTO = (event) => {
|
|
2998
|
+
return isWebsocketSubscription(event)
|
|
2999
|
+
&& event?.event === exports.WebSocketSubscriptionEvent.SUBSCRIBE_CLIENT_TRACK;
|
|
3000
|
+
};
|
|
3001
|
+
const isUnsubscribeClientTrackWebSocketEventDTO = (event) => {
|
|
3002
|
+
return isWebsocketSubscription(event)
|
|
3003
|
+
&& event?.event === exports.WebSocketSubscriptionEvent.UNSUBSCRIBE_CLIENT_TRACK;
|
|
3004
|
+
};
|
|
3005
|
+
const isSubscribeUserNotificationWebSocketEventDTO = (event) => {
|
|
3006
|
+
return isWebsocketSubscription(event)
|
|
3007
|
+
&& event?.event === exports.WebSocketSubscriptionEvent.SUBSCRIBE_USER_NOTIFICATION;
|
|
3008
|
+
};
|
|
3009
|
+
const isUnsubscribeUserNotificationWebSocketEventDTO = (event) => {
|
|
3010
|
+
return isWebsocketSubscription(event)
|
|
3011
|
+
&& event?.event === exports.WebSocketSubscriptionEvent.UNSUBSCRIBE_USER_NOTIFICATION;
|
|
3012
|
+
};
|
|
3013
|
+
// is WebSocketResponseEventDTO, CHANNEL_SUBSCRIBE_CLIENT
|
|
3014
|
+
const isWebSocketResponseEventDTO = (event) => {
|
|
3015
|
+
return Object.values(exports.WebSocketResponseEvent).includes(event?.event)
|
|
3016
|
+
&& typeof event?.key === 'string'
|
|
3017
|
+
&& typeof event?.connectionId === 'string'
|
|
3018
|
+
&& typeof event?.messageTimestamp === 'number' && !!event.messageTimestamp;
|
|
3019
|
+
};
|
|
3020
|
+
const isPongWebSocketResponseEventDTO = (event) => {
|
|
3021
|
+
return isWebSocketResponseEventDTO(event)
|
|
3022
|
+
&& event?.event === exports.WebSocketResponseEvent.PONG
|
|
3023
|
+
&& !!event?.data;
|
|
3024
|
+
};
|
|
3025
|
+
const isCodeRunStatusMessageWebSocketResponseEventDTO = (event) => {
|
|
3026
|
+
return isWebSocketResponseEventDTO(event)
|
|
3027
|
+
&& event?.event === exports.WebSocketResponseEvent.CODE_RUN_STATUS
|
|
3028
|
+
&& typeof event?.runId === 'string' && !!event.runId
|
|
3029
|
+
&& event?.status in exports.SubmissionRunStatus;
|
|
3030
|
+
};
|
|
3031
|
+
const isSubmissionRunStatusMessageWebSocketResponseEventDTO = (event) => {
|
|
3032
|
+
return isWebSocketResponseEventDTO(event)
|
|
3033
|
+
&& event?.event === exports.WebSocketResponseEvent.SUBMISSION_RUN_STATUS
|
|
3034
|
+
&& typeof event?.submitId === 'string' && !!event.submitId
|
|
3035
|
+
&& event?.status in exports.SubmissionRunStatus
|
|
3036
|
+
&& event?.verdict in exports.ProblemVerdict
|
|
3037
|
+
&& typeof event?.points === 'number';
|
|
3038
|
+
};
|
|
3039
|
+
const isUserMessageWebSocketResponseEventDTO = (event) => {
|
|
3040
|
+
return isWebSocketResponseEventDTO(event)
|
|
3041
|
+
&& event?.event === exports.WebSocketResponseEvent.USER_MESSAGE
|
|
3042
|
+
&& typeof event?.user?.nickname === 'string' && !!event.user?.nickname
|
|
3043
|
+
&& typeof event?.user?.imageUrl === 'string' && !!event.user?.imageUrl
|
|
3044
|
+
&& typeof event?.user?.company?.key === 'string' && !!event.user?.company?.key
|
|
3045
|
+
&& !!event?.content;
|
|
3046
|
+
};
|
|
3047
|
+
const isSendDataWebSocketResponseEventDTO = (event) => {
|
|
3048
|
+
return [
|
|
3049
|
+
exports.WebSocketResponseEvent.SEND_DATA_ECS_TASK_DEFINITIONS_LIST,
|
|
3050
|
+
exports.WebSocketResponseEvent.SEND_DATA_EC2_INSTANCES_LIST,
|
|
3051
|
+
exports.WebSocketResponseEvent.SEND_DATA_ECS_TASKS_LIST,
|
|
3052
|
+
exports.WebSocketResponseEvent.SEND_DATA_SSM_SESSIONS_LIST,
|
|
3053
|
+
exports.WebSocketResponseEvent.SEND_DATA_RUN_COMMAND,
|
|
3054
|
+
exports.WebSocketResponseEvent.SEND_DATA_CLIENT_TRACK,
|
|
3055
|
+
exports.WebSocketResponseEvent.SEND_DATA_CHAT_COMPLETIONS,
|
|
3056
|
+
].includes(event?.event)
|
|
3057
|
+
&& typeof event?.dataId === 'string' && !!event.dataId
|
|
3058
|
+
&& !!event?.content;
|
|
3059
|
+
};
|
|
3060
|
+
const isSendDataEcsTaskDefinitionListWebSocketResponseEventDTO = (event) => {
|
|
3061
|
+
return isWebSocketResponseEventDTO(event) && isSendDataWebSocketResponseEventDTO(event)
|
|
3062
|
+
&& event?.event === exports.WebSocketResponseEvent.SEND_DATA_ECS_TASK_DEFINITIONS_LIST;
|
|
3084
3063
|
};
|
|
3085
|
-
const
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
exports.ProblemVerdict.AC,
|
|
3089
|
-
exports.ProblemVerdict.PE,
|
|
3090
|
-
exports.ProblemVerdict.PA,
|
|
3091
|
-
exports.ProblemVerdict.CE,
|
|
3092
|
-
exports.ProblemVerdict.RE,
|
|
3093
|
-
exports.ProblemVerdict.TLE,
|
|
3094
|
-
exports.ProblemVerdict.MLE,
|
|
3095
|
-
exports.ProblemVerdict.WA,
|
|
3096
|
-
];
|
|
3097
|
-
const SUBMISSION_RUN_STATUS = {
|
|
3098
|
-
[exports.SubmissionRunStatus.NONE]: { value: exports.SubmissionRunStatus.NONE, label: 'none' }, // status
|
|
3099
|
-
[exports.SubmissionRunStatus.RECEIVED]: { value: exports.SubmissionRunStatus.RECEIVED, label: 'received' }, // state
|
|
3100
|
-
[exports.SubmissionRunStatus.COMPILING]: { value: exports.SubmissionRunStatus.COMPILING, label: 'compiling' }, // state
|
|
3101
|
-
[exports.SubmissionRunStatus.COMPILED]: { value: exports.SubmissionRunStatus.COMPILED, label: 'compiled' }, // status
|
|
3102
|
-
[exports.SubmissionRunStatus.COMPILATION_ERROR]: { value: exports.SubmissionRunStatus.COMPILATION_ERROR, label: 'compilation error' }, // status
|
|
3103
|
-
[exports.SubmissionRunStatus.FETCHING_TEST_CASES]: {
|
|
3104
|
-
value: exports.SubmissionRunStatus.FETCHING_TEST_CASES,
|
|
3105
|
-
label: 'fetching test cases',
|
|
3106
|
-
}, // state
|
|
3107
|
-
[exports.SubmissionRunStatus.RUNNING_TEST_CASE]: { value: exports.SubmissionRunStatus.RUNNING_TEST_CASE, label: 'running test case' }, // state
|
|
3108
|
-
[exports.SubmissionRunStatus.RUNNING_TEST_CASES]: {
|
|
3109
|
-
value: exports.SubmissionRunStatus.RUNNING_TEST_CASES,
|
|
3110
|
-
label: 'running test cases',
|
|
3111
|
-
}, // state
|
|
3112
|
-
[exports.SubmissionRunStatus.RUNNING_SAMPLE_TEST_CASES]: {
|
|
3113
|
-
value: exports.SubmissionRunStatus.RUNNING_SAMPLE_TEST_CASES,
|
|
3114
|
-
label: 'running sample cases',
|
|
3115
|
-
}, // state
|
|
3116
|
-
[exports.SubmissionRunStatus.EXECUTED_TEST_CASE]: {
|
|
3117
|
-
value: exports.SubmissionRunStatus.EXECUTED_TEST_CASE,
|
|
3118
|
-
label: 'executed test case',
|
|
3119
|
-
}, // status
|
|
3120
|
-
[exports.SubmissionRunStatus.FAILED_TEST_CASE]: { value: exports.SubmissionRunStatus.FAILED_TEST_CASE, label: 'failed test case' }, // status
|
|
3121
|
-
[exports.SubmissionRunStatus.JUDGING_TEST_CASE]: { value: exports.SubmissionRunStatus.JUDGING_TEST_CASE, label: 'judging test case' }, // state
|
|
3122
|
-
[exports.SubmissionRunStatus.GRADING]: { value: exports.SubmissionRunStatus.GRADING, label: 'grading' }, // status
|
|
3123
|
-
[exports.SubmissionRunStatus.FAILED]: { value: exports.SubmissionRunStatus.FAILED, label: 'failed' }, // status
|
|
3124
|
-
[exports.SubmissionRunStatus.COMPLETED]: { value: exports.SubmissionRunStatus.COMPLETED, label: 'completed' }, // status
|
|
3064
|
+
const isSendDataEc2InstancesListWebSocketResponseEventDTO = (event) => {
|
|
3065
|
+
return isWebSocketResponseEventDTO(event) && isSendDataWebSocketResponseEventDTO(event)
|
|
3066
|
+
&& event?.event === exports.WebSocketResponseEvent.SEND_DATA_EC2_INSTANCES_LIST;
|
|
3125
3067
|
};
|
|
3126
|
-
const
|
|
3127
|
-
|
|
3128
|
-
|
|
3068
|
+
const isSendDataEcsTasksListWebSocketResponseEventDTO = (event) => {
|
|
3069
|
+
return isWebSocketResponseEventDTO(event) && isSendDataWebSocketResponseEventDTO(event)
|
|
3070
|
+
&& event?.event === exports.WebSocketResponseEvent.SEND_DATA_ECS_TASKS_LIST;
|
|
3129
3071
|
};
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
[exports.ProblemInput.INTERACTIVE]: { value: exports.ProblemInput.INTERACTIVE, label: 'interactive' },
|
|
3072
|
+
const isSendDataSsmSessionsListWebSocketResponseEventDTO = (event) => {
|
|
3073
|
+
return isWebSocketResponseEventDTO(event) && isSendDataWebSocketResponseEventDTO(event)
|
|
3074
|
+
&& event?.event === exports.WebSocketResponseEvent.SEND_DATA_SSM_SESSIONS_LIST;
|
|
3134
3075
|
};
|
|
3135
|
-
const
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
[exports.ProblemOutput.INTERACTIVE]: { value: exports.ProblemOutput.INTERACTIVE, label: 'interactive' },
|
|
3076
|
+
const isSendDataRunCommandWebSocketResponseEventDTO = (event) => {
|
|
3077
|
+
return isWebSocketResponseEventDTO(event) && isSendDataWebSocketResponseEventDTO(event)
|
|
3078
|
+
&& event?.event === exports.WebSocketResponseEvent.SEND_DATA_RUN_COMMAND;
|
|
3139
3079
|
};
|
|
3140
|
-
const
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
value: exports.ProblemScoringMode.TOTAL,
|
|
3144
|
-
label: 'total',
|
|
3145
|
-
description: 'if all test cases are Accepted the result is Accepted '
|
|
3146
|
-
+ 'otherwise it will be Runtime Error, Time Limited Exceeded, Memory Limited Exceeded, Wrong Answer or Presentation Error in that order.',
|
|
3147
|
-
},
|
|
3148
|
-
[exports.ProblemScoringMode.SUBTASK]: {
|
|
3149
|
-
value: exports.ProblemScoringMode.SUBTASK,
|
|
3150
|
-
label: 'subtask',
|
|
3151
|
-
description: 'the test cases are grouped and each group of test cases is assigned a score, '
|
|
3152
|
-
+ 'if all test cases in a group are Accepted then the score assigned to that group of test cases is added to total score, '
|
|
3153
|
-
+ 'if total score is equal to the sum of the assigned scores of all groups of test cases then the result is Accepted, '
|
|
3154
|
-
+ 'otherwise if the total score is greater than zero the result is Partial Accepted with the total accumulated score, '
|
|
3155
|
-
+ 'otherwise it will be Runtime Error, Time Limited Exceeded, Memory Limited Exceeded, Wrong Answer or Presentation Error in that order.',
|
|
3156
|
-
},
|
|
3157
|
-
[exports.ProblemScoringMode.PARTIAL]: {
|
|
3158
|
-
value: exports.ProblemScoringMode.PARTIAL,
|
|
3159
|
-
label: 'partial',
|
|
3160
|
-
description: 'the test cases are grouped and each group is associated with X points, '
|
|
3161
|
-
+ 'and each test case in a group scores X points ',
|
|
3162
|
-
},
|
|
3080
|
+
const isSendDataClientTrackWebSocketResponseEventDTO = (event) => {
|
|
3081
|
+
return isWebSocketResponseEventDTO(event) && isSendDataWebSocketResponseEventDTO(event)
|
|
3082
|
+
&& event?.event === exports.WebSocketResponseEvent.SEND_DATA_CLIENT_TRACK;
|
|
3163
3083
|
};
|
|
3164
|
-
const
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
value: exports.ProblemType.STANDARD,
|
|
3168
|
-
label: 'standard',
|
|
3169
|
-
description: 'The contestant submit a single source code in one of the allowed programming languages. '
|
|
3170
|
-
+ 'The source code is either standalone or to be compiled. '
|
|
3171
|
-
+ 'The resulting user\'s executable does I/O standard input and output. '
|
|
3172
|
-
+ 'The output produced by the contestant\'s program is then compared to the correct output using a simple diff algorithm.',
|
|
3173
|
-
},
|
|
3174
|
-
[exports.ProblemType.INTERACTIVE]: {
|
|
3175
|
-
value: exports.ProblemType.INTERACTIVE, label: 'interactive', description: 'developing..',
|
|
3176
|
-
},
|
|
3177
|
-
[exports.ProblemType.DYNAMIC]: {
|
|
3178
|
-
value: exports.ProblemType.DYNAMIC,
|
|
3179
|
-
label: 'dynamic',
|
|
3180
|
-
description: 'The contestant submit a single source code in one of the allowed programming languages. '
|
|
3181
|
-
+ 'The user\'s source code is either standalone or to be compiled. '
|
|
3182
|
-
+ 'The resulting user\'s executable does I/O standard input and output. '
|
|
3183
|
-
+ 'The output produced by the contestant\'s program is saved. '
|
|
3184
|
-
+ 'The problem editor save a single source code in C++ 17. '
|
|
3185
|
-
+ 'The editor\'s source code can read judge input filepath argv[1], judge output filepath argv[2], user\'s output filepath argv[3], user\'s error filepath argv[4], user\'s log filepath argv[5], user\'s source filepath argv[6] and submission information filepath argv[7] (companyId, submitId, runId, userId, contestId, problemId, language, userNickname, timestamp). '
|
|
3186
|
-
+ 'The resulting editor\'s executable should be "AC" or a number between 1 and 100 for partial accepted',
|
|
3187
|
-
},
|
|
3084
|
+
const isSenDataChatCompletionsWebSocketResponseEventDTO = (event) => {
|
|
3085
|
+
return isWebSocketResponseEventDTO(event) && isSendDataWebSocketResponseEventDTO(event)
|
|
3086
|
+
&& event?.event === exports.WebSocketResponseEvent.SEND_DATA_CHAT_COMPLETIONS;
|
|
3188
3087
|
};
|
|
3189
|
-
const
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3088
|
+
const isProblemCrawledWebSocketResponseEventDTO = (event) => {
|
|
3089
|
+
return isWebSocketResponseEventDTO(event)
|
|
3090
|
+
&& event?.event === exports.WebSocketResponseEvent.PROBLEM_CRAWLED
|
|
3091
|
+
&& !!event?.content;
|
|
3092
|
+
};
|
|
3093
|
+
const isSubmissionsCrawlWebSocketResponseEventDTO = (event) => {
|
|
3094
|
+
return isWebSocketResponseEventDTO(event)
|
|
3095
|
+
&& event?.event === exports.WebSocketResponseEvent.SUBMISSIONS_CRAWL
|
|
3096
|
+
&& !!event?.content;
|
|
3097
|
+
};
|
|
3098
|
+
const isContestChangesWebSocketResponseEventDTO = (event) => {
|
|
3099
|
+
return isWebSocketResponseEventDTO(event)
|
|
3100
|
+
&& event?.event === exports.WebSocketResponseEvent.CONTEST_CHANGES
|
|
3101
|
+
&& !!event?.content;
|
|
3102
|
+
};
|
|
3103
|
+
const isClientTrackWebSocketResponseEventDTO = (event) => {
|
|
3104
|
+
return isWebSocketResponseEventDTO(event)
|
|
3105
|
+
&& event?.event === exports.WebSocketResponseEvent.CLIENT_TRACK;
|
|
3106
|
+
};
|
|
3107
|
+
const isUserNotificationWebSocketResponseEventDTO = (event) => {
|
|
3108
|
+
return [
|
|
3109
|
+
exports.WebSocketResponseEvent.USER_NOTIFICATION_SUBMISSION,
|
|
3110
|
+
exports.WebSocketResponseEvent.USER_NOTIFICATION_CONTEST_CLARIFICATION,
|
|
3111
|
+
].includes(event?.event)
|
|
3112
|
+
&& !!event?.content;
|
|
3113
|
+
};
|
|
3114
|
+
const isUserNotificationSubmissionWebSocketResponseEventDTO = (event) => {
|
|
3115
|
+
return isWebSocketResponseEventDTO(event) && isUserNotificationWebSocketResponseEventDTO(event)
|
|
3116
|
+
&& event?.event === exports.WebSocketResponseEvent.USER_NOTIFICATION_SUBMISSION;
|
|
3117
|
+
};
|
|
3118
|
+
const isUserNotificationContestClarificationWebSocketResponseEventDTO = (event) => {
|
|
3119
|
+
return isWebSocketResponseEventDTO(event) && isUserNotificationWebSocketResponseEventDTO(event)
|
|
3120
|
+
&& event?.event === exports.WebSocketResponseEvent.USER_NOTIFICATION_CONTEST_CLARIFICATION;
|
|
3121
|
+
};
|
|
3122
|
+
// generic
|
|
3123
|
+
const getWebSocketResponseEventKey = (event, clientId, id) => {
|
|
3124
|
+
return `${event}-${clientId}-${id}`;
|
|
3125
|
+
};
|
|
3126
|
+
|
|
3127
|
+
function splitTime(timeRemaining) {
|
|
3128
|
+
const remaining = [];
|
|
3129
|
+
// const aYearMilliseconds = 1000 * 60 * 60 * 24 * 365;
|
|
3130
|
+
// const remainingYears = Math.floor(timeRemaining / aYearMilliseconds);
|
|
3131
|
+
// remaining.push({ remaining: remainingYears, label: 'years', milliseconds: aYearMilliseconds });
|
|
3132
|
+
// const aWeekMilliseconds = 1000 * 60 * 60 * 24 * 7;
|
|
3133
|
+
// const remainingWeeks = Math.floor((timeRemaining % aYearMilliseconds) / aWeekMilliseconds);
|
|
3134
|
+
// remaining.push({ remaining: remainingWeeks, label: 'weeks', milliseconds: aWeekMilliseconds });
|
|
3135
|
+
const aSecondMilliseconds = 1000;
|
|
3136
|
+
const aMinuteMilliseconds = aSecondMilliseconds * 60;
|
|
3137
|
+
const aHourMilliseconds = aMinuteMilliseconds * 60;
|
|
3138
|
+
const aDayMilliseconds = aHourMilliseconds * 24;
|
|
3139
|
+
const aWeekMilliseconds = aDayMilliseconds * 7;
|
|
3140
|
+
const remainingWeeks = Math.floor(timeRemaining / aWeekMilliseconds);
|
|
3141
|
+
remaining.push({
|
|
3142
|
+
remaining: remainingWeeks,
|
|
3143
|
+
label: remainingWeeks === 1 ? 'week' : 'weeks',
|
|
3144
|
+
abbreviatedLabel: 'w',
|
|
3145
|
+
milliseconds: aWeekMilliseconds,
|
|
3146
|
+
digits: 2,
|
|
3147
|
+
});
|
|
3148
|
+
const remainingDays = Math.floor((timeRemaining % aWeekMilliseconds) / aDayMilliseconds);
|
|
3149
|
+
remaining.push({
|
|
3150
|
+
remaining: remainingDays,
|
|
3151
|
+
label: remainingDays === 1 ? 'day' : 'days',
|
|
3152
|
+
abbreviatedLabel: 'd',
|
|
3153
|
+
milliseconds: aDayMilliseconds,
|
|
3154
|
+
digits: 2,
|
|
3155
|
+
});
|
|
3156
|
+
const remainingHours = Math.floor((timeRemaining % aDayMilliseconds) / aHourMilliseconds);
|
|
3157
|
+
remaining.push({
|
|
3158
|
+
remaining: remainingHours,
|
|
3159
|
+
label: remainingHours === 1 ? 'hour' : 'hours',
|
|
3160
|
+
abbreviatedLabel: 'h',
|
|
3161
|
+
milliseconds: aHourMilliseconds,
|
|
3162
|
+
digits: 2,
|
|
3163
|
+
});
|
|
3164
|
+
const remainingMinutes = Math.floor((timeRemaining % aHourMilliseconds) / aMinuteMilliseconds);
|
|
3165
|
+
remaining.push({
|
|
3166
|
+
remaining: remainingMinutes,
|
|
3167
|
+
label: remainingMinutes === 1 ? 'minute' : 'minutes',
|
|
3168
|
+
abbreviatedLabel: 'm',
|
|
3169
|
+
milliseconds: aMinuteMilliseconds,
|
|
3170
|
+
digits: 2,
|
|
3171
|
+
});
|
|
3172
|
+
const remainingSeconds = Math.floor((timeRemaining % aMinuteMilliseconds) / aSecondMilliseconds);
|
|
3173
|
+
remaining.push({
|
|
3174
|
+
remaining: remainingSeconds,
|
|
3175
|
+
label: remainingSeconds === 1 ? 'second' : 'seconds',
|
|
3176
|
+
abbreviatedLabel: 's',
|
|
3177
|
+
milliseconds: aSecondMilliseconds,
|
|
3178
|
+
digits: 2,
|
|
3179
|
+
});
|
|
3180
|
+
const remainingMilliseconds = Math.floor(timeRemaining % aSecondMilliseconds);
|
|
3181
|
+
remaining.push({
|
|
3182
|
+
remaining: remainingMilliseconds,
|
|
3183
|
+
label: remainingMilliseconds === 1 ? 'millisecond' : 'milliseconds',
|
|
3184
|
+
abbreviatedLabel: 'ms',
|
|
3185
|
+
milliseconds: 1,
|
|
3186
|
+
digits: 3,
|
|
3187
|
+
});
|
|
3188
|
+
// while (remaining[0].remaining <= 0) {
|
|
3189
|
+
// remaining.shift();
|
|
3190
|
+
// if (remaining.length === 3) {
|
|
3191
|
+
// break;
|
|
3192
|
+
// }
|
|
3193
|
+
// }
|
|
3194
|
+
return remaining;
|
|
3195
|
+
}
|
|
3196
|
+
function normalizeToLocalStartOfDay(timestamp) {
|
|
3197
|
+
const date = new Date(timestamp);
|
|
3198
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
3199
|
+
}
|
|
3200
|
+
function normalizeToLocalStartOfHour(timestamp) {
|
|
3201
|
+
const date = new Date(timestamp);
|
|
3202
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours());
|
|
3203
|
+
}
|
|
3204
|
+
function normalizeToLocalStartOfMinutes(timestamp) {
|
|
3205
|
+
const date = new Date(timestamp);
|
|
3206
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes());
|
|
3207
|
+
}
|
|
3208
|
+
function normalizeToLocalStartOfSeconds(timestamp) {
|
|
3209
|
+
const date = new Date(timestamp);
|
|
3210
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes());
|
|
3211
|
+
}
|
|
3212
|
+
const getYears = (d) => d.getFullYear();
|
|
3213
|
+
const getMonths = (d) => d.getFullYear() * 12 + d.getMonth();
|
|
3214
|
+
const getDays = (d) => {
|
|
3215
|
+
return Math.floor(normalizeToLocalStartOfDay(d).getTime() / ONE_DAY);
|
|
3198
3216
|
};
|
|
3217
|
+
const getHours = (d) => {
|
|
3218
|
+
return Math.floor(normalizeToLocalStartOfHour(d).getTime() / ONE_HOUR);
|
|
3219
|
+
};
|
|
3220
|
+
const getMinutes = (d) => {
|
|
3221
|
+
return Math.floor(normalizeToLocalStartOfMinutes(d).getTime() / ONE_MINUTE);
|
|
3222
|
+
};
|
|
3223
|
+
const getSeconds = (d) => {
|
|
3224
|
+
return Math.floor(normalizeToLocalStartOfSeconds(d).getTime() / 1000);
|
|
3225
|
+
};
|
|
3226
|
+
const getMilliseconds = (d) => d.getTime();
|
|
3199
3227
|
|
|
3200
|
-
const
|
|
3201
|
-
|
|
3202
|
-
const _TAB = ':tab';
|
|
3203
|
-
const _SUB_TAB = ':subTab?';
|
|
3204
|
-
const _SUB_SUB_TAB = ':subSubTab?';
|
|
3205
|
-
const PAGE = 'page';
|
|
3206
|
-
const PAGE_SIZE = 'size';
|
|
3207
|
-
|
|
3208
|
-
const FILE_TYPE = {
|
|
3209
|
-
[exports.FileType.FILE]: { value: exports.FileType.FILE, label: 'file' },
|
|
3210
|
-
[exports.FileType.FOLDER]: { value: exports.FileType.FOLDER, label: 'folder' },
|
|
3228
|
+
const getUserKey = (userNickname, userCompanyKey) => {
|
|
3229
|
+
return userNickname + '|' + userCompanyKey;
|
|
3211
3230
|
};
|
|
3212
|
-
const
|
|
3213
|
-
[
|
|
3214
|
-
|
|
3215
|
-
[exports.Role.REGULAR]: { value: exports.Role.REGULAR, label: 'regular', level: 3 },
|
|
3216
|
-
[exports.Role.MASTER]: { value: exports.Role.MASTER, label: 'master', level: 2 },
|
|
3217
|
-
[exports.Role.ADMIN]: { value: exports.Role.ADMIN, label: 'admin', level: 1 },
|
|
3218
|
-
[exports.Role.SUPER_ADMIN]: { value: exports.Role.SUPER_ADMIN, label: 'super admin', level: 0 },
|
|
3231
|
+
const getParamsOfUserKey = (userKey) => {
|
|
3232
|
+
const [userNickname, userCompanyKey] = userKey.split('|');
|
|
3233
|
+
return { userNickname, userCompanyKey };
|
|
3219
3234
|
};
|
|
3220
|
-
const
|
|
3221
|
-
|
|
3222
|
-
value: exports.EntityState.RELEASED,
|
|
3223
|
-
label: 'released',
|
|
3224
|
-
},
|
|
3225
|
-
[exports.EntityState.ARCHIVED]: {
|
|
3226
|
-
value: exports.EntityState.ARCHIVED,
|
|
3227
|
-
label: 'archived',
|
|
3228
|
-
},
|
|
3235
|
+
const getClientId = (sessionId, uiId) => {
|
|
3236
|
+
return `${sessionId}|${uiId}`;
|
|
3229
3237
|
};
|
|
3230
|
-
const
|
|
3231
|
-
[
|
|
3232
|
-
|
|
3233
|
-
label: 'private',
|
|
3234
|
-
description: 'the record will be visible and editable only to the owner',
|
|
3235
|
-
},
|
|
3236
|
-
[exports.EntityAccess.RESTRICTED]: {
|
|
3237
|
-
value: exports.EntityAccess.RESTRICTED,
|
|
3238
|
-
label: 'restricted',
|
|
3239
|
-
description: 'the record will be visible to viewers and the owner and editable to editors and the owner',
|
|
3240
|
-
},
|
|
3241
|
-
[exports.EntityAccess.PUBLIC]: {
|
|
3242
|
-
value: exports.EntityAccess.PUBLIC,
|
|
3243
|
-
label: 'public',
|
|
3244
|
-
description: 'the record will be visible to anyone and editable to editors and the owner',
|
|
3245
|
-
},
|
|
3246
|
-
[exports.EntityAccess.EXPOSED]: {
|
|
3247
|
-
value: exports.EntityAccess.EXPOSED,
|
|
3248
|
-
label: 'exposed',
|
|
3249
|
-
description: 'the record will be visible and editable to anyone',
|
|
3250
|
-
},
|
|
3238
|
+
const getParamsOfClientId = (clientId) => {
|
|
3239
|
+
const [sessionId, uiId] = clientId.split('|');
|
|
3240
|
+
return { sessionId, uiId };
|
|
3251
3241
|
};
|
|
3252
3242
|
|
|
3253
|
-
const
|
|
3254
|
-
|
|
3255
|
-
[
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3243
|
+
const getWorksheetsInPages = (initialSheets) => {
|
|
3244
|
+
const sheets = [...initialSheets];
|
|
3245
|
+
if (sheets[0]?.type !== exports.WorksheetType.NEW_PAGE) {
|
|
3246
|
+
sheets.unshift(NEW_PAGE_SHEET());
|
|
3247
|
+
}
|
|
3248
|
+
let newPage = sheets[0];
|
|
3249
|
+
let content = [];
|
|
3250
|
+
const sheetsByPages = [];
|
|
3251
|
+
for (let i = 1; i < sheets.length; i++) {
|
|
3252
|
+
const sheet = sheets[i];
|
|
3253
|
+
if (sheet.type === exports.WorksheetType.NEW_PAGE) {
|
|
3254
|
+
sheetsByPages.push({
|
|
3255
|
+
header: newPage,
|
|
3256
|
+
content: [...content],
|
|
3257
|
+
});
|
|
3258
|
+
newPage = sheet;
|
|
3259
|
+
content = [];
|
|
3260
|
+
}
|
|
3261
|
+
else {
|
|
3262
|
+
content.push(sheet);
|
|
3263
|
+
}
|
|
3264
|
+
}
|
|
3265
|
+
sheetsByPages.push({
|
|
3266
|
+
header: newPage,
|
|
3267
|
+
content: [...content],
|
|
3268
|
+
});
|
|
3269
|
+
return sheetsByPages;
|
|
3260
3270
|
};
|
|
3261
|
-
|
|
3262
|
-
const
|
|
3263
|
-
[
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3271
|
+
const getSummaryWorksheetsInPages = (initialSheets) => {
|
|
3272
|
+
const sheets = [...initialSheets];
|
|
3273
|
+
if (sheets[0]?.type !== exports.WorksheetType.NEW_PAGE) {
|
|
3274
|
+
sheets.unshift(NEW_PAGE_SHEET());
|
|
3275
|
+
}
|
|
3276
|
+
let newPage = sheets[0];
|
|
3277
|
+
let content = [];
|
|
3278
|
+
const sheetsByPages = [];
|
|
3279
|
+
for (let i = 1; i < sheets.length; i++) {
|
|
3280
|
+
const sheet = sheets[i];
|
|
3281
|
+
if (sheet.type === exports.WorksheetType.NEW_PAGE) {
|
|
3282
|
+
sheetsByPages.push({
|
|
3283
|
+
header: newPage,
|
|
3284
|
+
content: content.map(c => ({
|
|
3285
|
+
id: c.id,
|
|
3286
|
+
type: c.type,
|
|
3287
|
+
title: c.title,
|
|
3288
|
+
points: c.points,
|
|
3289
|
+
})),
|
|
3290
|
+
});
|
|
3291
|
+
newPage = sheet;
|
|
3292
|
+
content = [];
|
|
3293
|
+
}
|
|
3294
|
+
else {
|
|
3295
|
+
content.push(sheet);
|
|
3296
|
+
}
|
|
3297
|
+
}
|
|
3298
|
+
sheetsByPages.push({
|
|
3299
|
+
header: newPage,
|
|
3300
|
+
content: [...content],
|
|
3301
|
+
});
|
|
3302
|
+
return sheetsByPages;
|
|
3269
3303
|
};
|
|
3270
|
-
const
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
[TeamRole.SUPER_ADMIN]: { value: TeamRole.SUPER_ADMIN, label: 'super admin', level: 0 },
|
|
3304
|
+
const getTotalExercisesOfSummaryWorksheetsInPages = (content) => content.reduce((sum, { content }) => sum + content.reduce((sum, { type }) => sum + +(type === exports.WorksheetType.QUIZ_OPTIONS || type === exports.WorksheetType.QUIZ_PROBLEM || type === exports.WorksheetType.QUIZ_TEXT), 0), 0);
|
|
3305
|
+
const isBasicWorksheet = (value) => {
|
|
3306
|
+
return typeof value?.id == 'string' && value.id
|
|
3307
|
+
&& Object.values(exports.WorksheetType).includes(value?.type)
|
|
3308
|
+
&& typeof value?.title == 'string'
|
|
3309
|
+
&& typeof value?.points == 'number';
|
|
3277
3310
|
};
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
const SEC_90 = ONE_SECOND * 90;
|
|
3283
|
-
const SEC_120 = ONE_SECOND * 120;
|
|
3284
|
-
const ONE_MINUTE = ONE_SECOND * 60;
|
|
3285
|
-
const ONE_HOUR = ONE_MINUTE * 60;
|
|
3286
|
-
const ONE_DAY = ONE_HOUR * 24;
|
|
3287
|
-
const ONE_WEEK = ONE_DAY * 7;
|
|
3288
|
-
|
|
3289
|
-
const USER_STATUS = {
|
|
3290
|
-
[UserStatus.ACTIVE]: { value: UserStatus.ACTIVE, label: 'active' },
|
|
3291
|
-
[UserStatus.REPORTED]: { value: UserStatus.REPORTED, label: 'reported' },
|
|
3292
|
-
[UserStatus.ARCHIVED]: { value: UserStatus.ARCHIVED, label: 'archived' },
|
|
3311
|
+
const isJkmdSheet = (value) => {
|
|
3312
|
+
return isBasicWorksheet(value)
|
|
3313
|
+
&& value?.type === exports.WorksheetType.JK_MD
|
|
3314
|
+
&& typeof value?.content == 'string';
|
|
3293
3315
|
};
|
|
3294
|
-
const
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
[UserRole.SUPER_ADMIN]: { value: UserRole.SUPER_ADMIN, label: 'super admin', level: 0 },
|
|
3316
|
+
const isCodeEditorSheet = (value) => {
|
|
3317
|
+
return isBasicWorksheet(value)
|
|
3318
|
+
&& value?.type === exports.WorksheetType.CODE_EDITOR
|
|
3319
|
+
&& typeof value?.sourceCode === 'object' && value?.sourceCode !== null
|
|
3320
|
+
&& value?.testCases === 'object' && value?.testCases !== null
|
|
3321
|
+
&& Array.isArray(value?.languages)
|
|
3322
|
+
&& typeof value?.height == 'number';
|
|
3302
3323
|
};
|
|
3303
|
-
const
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
},
|
|
3324
|
+
const isQuizProblemSheet = (value) => {
|
|
3325
|
+
return isBasicWorksheet(value)
|
|
3326
|
+
&& value?.type === exports.WorksheetType.QUIZ_PROBLEM
|
|
3327
|
+
&& Object.values(exports.Judge).includes(value?.problemJudge) || typeof value?.problemJudge === 'string'
|
|
3328
|
+
&& typeof value?.problemKey == 'string'
|
|
3329
|
+
&& Array.isArray(value?.languages)
|
|
3330
|
+
&& typeof value?.height == 'number';
|
|
3331
|
+
};
|
|
3332
|
+
const isQuizOptionsSheet = (value) => {
|
|
3333
|
+
return isBasicWorksheet(value)
|
|
3334
|
+
&& value?.type === exports.WorksheetType.QUIZ_OPTIONS
|
|
3335
|
+
&& typeof value?.description == 'string'
|
|
3336
|
+
&& Array.isArray(value?.options)
|
|
3337
|
+
&& value?.options.every((option) => typeof option?.label == 'string' && typeof option?.correct == 'boolean' && typeof option?.id == 'string')
|
|
3338
|
+
&& typeof value?.multiple == 'boolean'
|
|
3339
|
+
&& (value?.scoringMode === 'TOTAL' || value?.scoringMode === 'PARTIAL');
|
|
3340
|
+
};
|
|
3341
|
+
const isQuizTextSheet = (value) => {
|
|
3342
|
+
return isBasicWorksheet(value)
|
|
3343
|
+
&& value?.type === exports.WorksheetType.QUIZ_TEXT
|
|
3344
|
+
&& typeof value?.description == 'string'
|
|
3345
|
+
&& typeof value?.answer == 'string'
|
|
3346
|
+
&& ['text', 'number', 'textarea'].includes(value?.inputType);
|
|
3327
3347
|
};
|
|
3328
|
-
|
|
3329
|
-
const CHANNEL_PUBLISH_SUBSCRIPTIONS = 'pub:subscriptions';
|
|
3330
|
-
const CHANNEL_SUBSCRIBE_NOTIFICATIONS = 'sub:notifications';
|
|
3331
|
-
const CHANNEL_SUBSCRIBE_CLIENT = (clientId) => `sub:client:${clientId}`;
|
|
3332
|
-
const CHANNEL_PUBLISH_MESSAGES = 'pub:messages';
|
|
3333
|
-
const CHANNEL_PRESENCE_CLIENT = 'pre:client';
|
|
3334
|
-
|
|
3335
|
-
exports.ContestProblemBlockedByType = void 0;
|
|
3336
|
-
(function (ContestProblemBlockedByType) {
|
|
3337
|
-
ContestProblemBlockedByType["UNMET_PREREQUISITES"] = "UNMET_PREREQUISITES";
|
|
3338
|
-
ContestProblemBlockedByType["MAX_ACCEPTED_SUBMISSIONS_ACHIEVED"] = "MAX_ACCEPTED_SUBMISSIONS_ACHIEVED";
|
|
3339
|
-
ContestProblemBlockedByType["START_TIME_IN_THE_FUTURE"] = "START_TIME_IN_THE_FUTURE";
|
|
3340
|
-
ContestProblemBlockedByType["END_TIME_IN_THE_PAST"] = "END_TIME_IN_THE_PAST";
|
|
3341
|
-
})(exports.ContestProblemBlockedByType || (exports.ContestProblemBlockedByType = {}));
|
|
3342
|
-
|
|
3343
|
-
exports.MemberType = void 0;
|
|
3344
|
-
(function (MemberType) {
|
|
3345
|
-
MemberType["USER"] = "USER";
|
|
3346
|
-
MemberType["TEAM"] = "TEAM";
|
|
3347
|
-
})(exports.MemberType || (exports.MemberType = {}));
|
|
3348
3348
|
|
|
3349
3349
|
exports.ACCEPTED_PROGRAMMING_LANGUAGES = ACCEPTED_PROGRAMMING_LANGUAGES;
|
|
3350
3350
|
exports.ASPECT_RATIO = ASPECT_RATIO;
|