@xcpcio/core 0.76.0 → 0.76.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -200,6 +200,13 @@ function getTimeDiff(seconds) {
200
200
  return [two(h), two(m), two(s)].join(":");
201
201
  }
202
202
 
203
+ function normalizePath(path) {
204
+ while (path.endsWith("/")) {
205
+ path = path.slice(0, -1);
206
+ }
207
+ return `${path}/`;
208
+ }
209
+
203
210
  class ProblemStatistics {
204
211
  acceptedNum;
205
212
  rejectedNum;
@@ -687,6 +694,7 @@ class Team {
687
694
  photo;
688
695
  location;
689
696
  icpcID;
697
+ ip;
690
698
  se;
691
699
  constructor() {
692
700
  this.id = "";
@@ -885,6 +893,9 @@ function createTeam(teamJSON) {
885
893
  if (teamJSON.icpc_id) {
886
894
  t.icpcID = teamJSON.icpc_id;
887
895
  }
896
+ if (teamJSON.ip) {
897
+ t.ip = teamJSON.ip;
898
+ }
888
899
  return t;
889
900
  }
890
901
  function createTeams(teamsJSON) {
@@ -1741,15 +1752,18 @@ class ICPCStandingsCsvConverter {
1741
1752
  }
1742
1753
  }
1743
1754
 
1744
- function getImageSource(image, asset_host) {
1755
+ function getImageSource(image, data_host) {
1745
1756
  if (image?.url) {
1746
- if (!asset_host) {
1757
+ if (!data_host) {
1747
1758
  return image.url;
1748
1759
  }
1749
1760
  if (image.url.startsWith("http")) {
1750
1761
  return image.url;
1751
1762
  }
1752
- return new URL(image.url, asset_host === "/" ? window.location.host : asset_host).toString();
1763
+ if (image.url.startsWith("/")) {
1764
+ return image.url;
1765
+ }
1766
+ return `${normalizePath(data_host)}${image.url}`;
1753
1767
  }
1754
1768
  if (image?.base64) {
1755
1769
  return `data:image/${image.type ?? "png"};base64,${image.base64}`;
@@ -2959,4 +2973,5 @@ exports.isNotCalculatedPenaltyStatus = isNotCalculatedPenaltyStatus;
2959
2973
  exports.isPending = isPending;
2960
2974
  exports.isRejected = isRejected;
2961
2975
  exports.isValidMedalType = isValidMedalType;
2976
+ exports.normalizePath = normalizePath;
2962
2977
  exports.stringToSubmissionStatus = stringToSubmissionStatus;
package/dist/index.d.cts CHANGED
@@ -65,6 +65,8 @@ declare function createDayJS(time?: Date | string | number | undefined): dayjs.D
65
65
  declare function getTimestamp(time: number | dayjs.Dayjs): number;
66
66
  declare function getTimeDiff(seconds: number): string;
67
67
 
68
+ declare function normalizePath(path: string): string;
69
+
68
70
  declare class Contest {
69
71
  id: string;
70
72
  name: I18nText;
@@ -252,6 +254,7 @@ declare class Team {
252
254
  photo?: Image;
253
255
  location?: string;
254
256
  icpcID?: string;
257
+ ip?: string;
255
258
  se: number;
256
259
  constructor();
257
260
  reset(): void;
@@ -425,7 +428,7 @@ declare class ICPCStandingsCsvConverter {
425
428
  private getMedalCitation;
426
429
  }
427
430
 
428
- declare function getImageSource(image: Image, asset_host?: string): string;
431
+ declare function getImageSource(image: Image, data_host?: string): string;
429
432
 
430
433
  declare class RatingHistory {
431
434
  rank: number;
@@ -556,5 +559,5 @@ declare function isRejected(status: SubmissionStatus): boolean;
556
559
  declare function isPending(status: SubmissionStatus): boolean;
557
560
  declare function isNotCalculatedPenaltyStatus(status: SubmissionStatus): boolean;
558
561
 
559
- export { Award, Balloon, BattleOfGiants, CodeforcesGymGhostDATConverter, Contest, ContestIndex, ContestIndexConfig, ContestOptions, GeneralExcelConverter, Giants, GiantsType, I18nText, ICPCStandingsCsvConverter, MedalType, Organization, Person, PlaceChartPointData, Problem, ProblemStatistics, Rank, RankOptions, RankStatistics, Rating, RatingCalculator, RatingHistory, RatingLevel, RatingLevelToString, RatingUser, RatingUtility, Resolver, ResolverVue, Submission, Team, TeamProblemStatistics, calcDirt, createContest, createContestIndex, createContestIndexList, createDayJS, createOrganization, createOrganizations, createPersons, createProblem, createProblems, createProblemsByProblemIds, createSubmission, createSubmissions, createTeam, createTeams, getImageSource, getTimeDiff, getTimestamp, getWhiteOrBlackColor, getWhiteOrBlackColorV1, isAccepted, isNotCalculatedPenaltyStatus, isPending, isRejected, isValidMedalType, stringToSubmissionStatus };
562
+ export { Award, Balloon, BattleOfGiants, CodeforcesGymGhostDATConverter, Contest, ContestIndex, ContestIndexConfig, ContestOptions, GeneralExcelConverter, Giants, GiantsType, I18nText, ICPCStandingsCsvConverter, MedalType, Organization, Person, PlaceChartPointData, Problem, ProblemStatistics, Rank, RankOptions, RankStatistics, Rating, RatingCalculator, RatingHistory, RatingLevel, RatingLevelToString, RatingUser, RatingUtility, Resolver, ResolverVue, Submission, Team, TeamProblemStatistics, calcDirt, createContest, createContestIndex, createContestIndexList, createDayJS, createOrganization, createOrganizations, createPersons, createProblem, createProblems, createProblemsByProblemIds, createSubmission, createSubmissions, createTeam, createTeams, getImageSource, getTimeDiff, getTimestamp, getWhiteOrBlackColor, getWhiteOrBlackColorV1, isAccepted, isNotCalculatedPenaltyStatus, isPending, isRejected, isValidMedalType, normalizePath, stringToSubmissionStatus };
560
563
  export type { Awards, Balloons, ContestIndexList, Options, Organizations, Persons, Problems, Ranks, RatingHistories, RatingUserMap, RatingUsers, SelectOptionItem, Submissions, Teams };
package/dist/index.d.mts CHANGED
@@ -65,6 +65,8 @@ declare function createDayJS(time?: Date | string | number | undefined): dayjs.D
65
65
  declare function getTimestamp(time: number | dayjs.Dayjs): number;
66
66
  declare function getTimeDiff(seconds: number): string;
67
67
 
68
+ declare function normalizePath(path: string): string;
69
+
68
70
  declare class Contest {
69
71
  id: string;
70
72
  name: I18nText;
@@ -252,6 +254,7 @@ declare class Team {
252
254
  photo?: Image;
253
255
  location?: string;
254
256
  icpcID?: string;
257
+ ip?: string;
255
258
  se: number;
256
259
  constructor();
257
260
  reset(): void;
@@ -425,7 +428,7 @@ declare class ICPCStandingsCsvConverter {
425
428
  private getMedalCitation;
426
429
  }
427
430
 
428
- declare function getImageSource(image: Image, asset_host?: string): string;
431
+ declare function getImageSource(image: Image, data_host?: string): string;
429
432
 
430
433
  declare class RatingHistory {
431
434
  rank: number;
@@ -556,5 +559,5 @@ declare function isRejected(status: SubmissionStatus): boolean;
556
559
  declare function isPending(status: SubmissionStatus): boolean;
557
560
  declare function isNotCalculatedPenaltyStatus(status: SubmissionStatus): boolean;
558
561
 
559
- export { Award, Balloon, BattleOfGiants, CodeforcesGymGhostDATConverter, Contest, ContestIndex, ContestIndexConfig, ContestOptions, GeneralExcelConverter, Giants, GiantsType, I18nText, ICPCStandingsCsvConverter, MedalType, Organization, Person, PlaceChartPointData, Problem, ProblemStatistics, Rank, RankOptions, RankStatistics, Rating, RatingCalculator, RatingHistory, RatingLevel, RatingLevelToString, RatingUser, RatingUtility, Resolver, ResolverVue, Submission, Team, TeamProblemStatistics, calcDirt, createContest, createContestIndex, createContestIndexList, createDayJS, createOrganization, createOrganizations, createPersons, createProblem, createProblems, createProblemsByProblemIds, createSubmission, createSubmissions, createTeam, createTeams, getImageSource, getTimeDiff, getTimestamp, getWhiteOrBlackColor, getWhiteOrBlackColorV1, isAccepted, isNotCalculatedPenaltyStatus, isPending, isRejected, isValidMedalType, stringToSubmissionStatus };
562
+ export { Award, Balloon, BattleOfGiants, CodeforcesGymGhostDATConverter, Contest, ContestIndex, ContestIndexConfig, ContestOptions, GeneralExcelConverter, Giants, GiantsType, I18nText, ICPCStandingsCsvConverter, MedalType, Organization, Person, PlaceChartPointData, Problem, ProblemStatistics, Rank, RankOptions, RankStatistics, Rating, RatingCalculator, RatingHistory, RatingLevel, RatingLevelToString, RatingUser, RatingUtility, Resolver, ResolverVue, Submission, Team, TeamProblemStatistics, calcDirt, createContest, createContestIndex, createContestIndexList, createDayJS, createOrganization, createOrganizations, createPersons, createProblem, createProblems, createProblemsByProblemIds, createSubmission, createSubmissions, createTeam, createTeams, getImageSource, getTimeDiff, getTimestamp, getWhiteOrBlackColor, getWhiteOrBlackColorV1, isAccepted, isNotCalculatedPenaltyStatus, isPending, isRejected, isValidMedalType, normalizePath, stringToSubmissionStatus };
560
563
  export type { Awards, Balloons, ContestIndexList, Options, Organizations, Persons, Problems, Ranks, RatingHistories, RatingUserMap, RatingUsers, SelectOptionItem, Submissions, Teams };
package/dist/index.d.ts CHANGED
@@ -65,6 +65,8 @@ declare function createDayJS(time?: Date | string | number | undefined): dayjs.D
65
65
  declare function getTimestamp(time: number | dayjs.Dayjs): number;
66
66
  declare function getTimeDiff(seconds: number): string;
67
67
 
68
+ declare function normalizePath(path: string): string;
69
+
68
70
  declare class Contest {
69
71
  id: string;
70
72
  name: I18nText;
@@ -252,6 +254,7 @@ declare class Team {
252
254
  photo?: Image;
253
255
  location?: string;
254
256
  icpcID?: string;
257
+ ip?: string;
255
258
  se: number;
256
259
  constructor();
257
260
  reset(): void;
@@ -425,7 +428,7 @@ declare class ICPCStandingsCsvConverter {
425
428
  private getMedalCitation;
426
429
  }
427
430
 
428
- declare function getImageSource(image: Image, asset_host?: string): string;
431
+ declare function getImageSource(image: Image, data_host?: string): string;
429
432
 
430
433
  declare class RatingHistory {
431
434
  rank: number;
@@ -556,5 +559,5 @@ declare function isRejected(status: SubmissionStatus): boolean;
556
559
  declare function isPending(status: SubmissionStatus): boolean;
557
560
  declare function isNotCalculatedPenaltyStatus(status: SubmissionStatus): boolean;
558
561
 
559
- export { Award, Balloon, BattleOfGiants, CodeforcesGymGhostDATConverter, Contest, ContestIndex, ContestIndexConfig, ContestOptions, GeneralExcelConverter, Giants, GiantsType, I18nText, ICPCStandingsCsvConverter, MedalType, Organization, Person, PlaceChartPointData, Problem, ProblemStatistics, Rank, RankOptions, RankStatistics, Rating, RatingCalculator, RatingHistory, RatingLevel, RatingLevelToString, RatingUser, RatingUtility, Resolver, ResolverVue, Submission, Team, TeamProblemStatistics, calcDirt, createContest, createContestIndex, createContestIndexList, createDayJS, createOrganization, createOrganizations, createPersons, createProblem, createProblems, createProblemsByProblemIds, createSubmission, createSubmissions, createTeam, createTeams, getImageSource, getTimeDiff, getTimestamp, getWhiteOrBlackColor, getWhiteOrBlackColorV1, isAccepted, isNotCalculatedPenaltyStatus, isPending, isRejected, isValidMedalType, stringToSubmissionStatus };
562
+ export { Award, Balloon, BattleOfGiants, CodeforcesGymGhostDATConverter, Contest, ContestIndex, ContestIndexConfig, ContestOptions, GeneralExcelConverter, Giants, GiantsType, I18nText, ICPCStandingsCsvConverter, MedalType, Organization, Person, PlaceChartPointData, Problem, ProblemStatistics, Rank, RankOptions, RankStatistics, Rating, RatingCalculator, RatingHistory, RatingLevel, RatingLevelToString, RatingUser, RatingUtility, Resolver, ResolverVue, Submission, Team, TeamProblemStatistics, calcDirt, createContest, createContestIndex, createContestIndexList, createDayJS, createOrganization, createOrganizations, createPersons, createProblem, createProblems, createProblemsByProblemIds, createSubmission, createSubmissions, createTeam, createTeams, getImageSource, getTimeDiff, getTimestamp, getWhiteOrBlackColor, getWhiteOrBlackColorV1, isAccepted, isNotCalculatedPenaltyStatus, isPending, isRejected, isValidMedalType, normalizePath, stringToSubmissionStatus };
560
563
  export type { Awards, Balloons, ContestIndexList, Options, Organizations, Persons, Problems, Ranks, RatingHistories, RatingUserMap, RatingUsers, SelectOptionItem, Submissions, Teams };
package/dist/index.mjs CHANGED
@@ -169,6 +169,13 @@ function getTimeDiff(seconds) {
169
169
  return [two(h), two(m), two(s)].join(":");
170
170
  }
171
171
 
172
+ function normalizePath(path) {
173
+ while (path.endsWith("/")) {
174
+ path = path.slice(0, -1);
175
+ }
176
+ return `${path}/`;
177
+ }
178
+
172
179
  class ProblemStatistics {
173
180
  acceptedNum;
174
181
  rejectedNum;
@@ -656,6 +663,7 @@ class Team {
656
663
  photo;
657
664
  location;
658
665
  icpcID;
666
+ ip;
659
667
  se;
660
668
  constructor() {
661
669
  this.id = "";
@@ -854,6 +862,9 @@ function createTeam(teamJSON) {
854
862
  if (teamJSON.icpc_id) {
855
863
  t.icpcID = teamJSON.icpc_id;
856
864
  }
865
+ if (teamJSON.ip) {
866
+ t.ip = teamJSON.ip;
867
+ }
857
868
  return t;
858
869
  }
859
870
  function createTeams(teamsJSON) {
@@ -1710,15 +1721,18 @@ class ICPCStandingsCsvConverter {
1710
1721
  }
1711
1722
  }
1712
1723
 
1713
- function getImageSource(image, asset_host) {
1724
+ function getImageSource(image, data_host) {
1714
1725
  if (image?.url) {
1715
- if (!asset_host) {
1726
+ if (!data_host) {
1716
1727
  return image.url;
1717
1728
  }
1718
1729
  if (image.url.startsWith("http")) {
1719
1730
  return image.url;
1720
1731
  }
1721
- return new URL(image.url, asset_host === "/" ? window.location.host : asset_host).toString();
1732
+ if (image.url.startsWith("/")) {
1733
+ return image.url;
1734
+ }
1735
+ return `${normalizePath(data_host)}${image.url}`;
1722
1736
  }
1723
1737
  if (image?.base64) {
1724
1738
  return `data:image/${image.type ?? "png"};base64,${image.base64}`;
@@ -2868,4 +2882,4 @@ class ResolverVue extends Resolver {
2868
2882
  }
2869
2883
  }
2870
2884
 
2871
- export { Award, Balloon, BattleOfGiants, CodeforcesGymGhostDATConverter, Contest, ContestIndex, ContestIndexConfig, ContestOptions, GeneralExcelConverter, Giants, GiantsType, I18nText, ICPCStandingsCsvConverter, MedalType, Organization, Person, PlaceChartPointData, Problem, ProblemStatistics, Rank, RankOptions, RankStatistics, Rating, RatingCalculator, RatingHistory, RatingLevel, RatingLevelToString, RatingUser, RatingUtility, Resolver, ResolverVue, Submission, Team, TeamProblemStatistics, calcDirt, createContest, createContestIndex, createContestIndexList, createDayJS, createOrganization, createOrganizations, createPersons, createProblem, createProblems, createProblemsByProblemIds, createSubmission, createSubmissions, createTeam, createTeams, getImageSource, getTimeDiff, getTimestamp, getWhiteOrBlackColor, getWhiteOrBlackColorV1, isAccepted, isNotCalculatedPenaltyStatus, isPending, isRejected, isValidMedalType, stringToSubmissionStatus };
2885
+ export { Award, Balloon, BattleOfGiants, CodeforcesGymGhostDATConverter, Contest, ContestIndex, ContestIndexConfig, ContestOptions, GeneralExcelConverter, Giants, GiantsType, I18nText, ICPCStandingsCsvConverter, MedalType, Organization, Person, PlaceChartPointData, Problem, ProblemStatistics, Rank, RankOptions, RankStatistics, Rating, RatingCalculator, RatingHistory, RatingLevel, RatingLevelToString, RatingUser, RatingUtility, Resolver, ResolverVue, Submission, Team, TeamProblemStatistics, calcDirt, createContest, createContestIndex, createContestIndexList, createDayJS, createOrganization, createOrganizations, createPersons, createProblem, createProblems, createProblemsByProblemIds, createSubmission, createSubmissions, createTeam, createTeams, getImageSource, getTimeDiff, getTimestamp, getWhiteOrBlackColor, getWhiteOrBlackColorV1, isAccepted, isNotCalculatedPenaltyStatus, isPending, isRejected, isValidMedalType, normalizePath, stringToSubmissionStatus };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xcpcio/core",
3
3
  "type": "module",
4
- "version": "0.76.0",
4
+ "version": "0.76.1",
5
5
  "description": "The core library for XCPCIO",
6
6
  "author": "Dup4 <hi@dup4.com>",
7
7
  "license": "MIT",
@@ -33,7 +33,7 @@
33
33
  "dist"
34
34
  ],
35
35
  "dependencies": {
36
- "chroma-js": "^3.1.2",
36
+ "chroma-js": "^3.2.0",
37
37
  "color-diff": "^1.4.0",
38
38
  "dayjs": "^1.11.19",
39
39
  "js-base64": "^3.7.8",
@@ -42,7 +42,7 @@
42
42
  "papaparse": "^5.5.3",
43
43
  "string-width": "^8.1.0",
44
44
  "xlsx-js-style": "^1.2.0",
45
- "@xcpcio/types": "0.76.0"
45
+ "@xcpcio/types": "0.76.1"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@babel/types": "^7.28.5",
@@ -53,16 +53,16 @@
53
53
  "@types/papaparse": "^5.5.0",
54
54
  "@typescript-eslint/eslint-plugin": "^8.48.0",
55
55
  "@typescript-eslint/parser": "^8.48.0",
56
- "bumpp": "^10.3.1",
56
+ "bumpp": "^10.3.2",
57
57
  "eslint": "^9.39.1",
58
58
  "esmo": "^4.8.0",
59
59
  "npm-run-all": "^4.1.5",
60
- "pnpm": "^10.23.0",
61
- "taze": "^19.9.0",
60
+ "pnpm": "^10.24.0",
61
+ "taze": "^19.9.2",
62
62
  "typescript": "^5.9.3",
63
63
  "unbuild": "^3.6.1",
64
64
  "vite": "^7.2.4",
65
- "vitest": "^3.2.4"
65
+ "vitest": "^4.0.14"
66
66
  },
67
67
  "scripts": {
68
68
  "build": "unbuild",