@stats-organization/github-readme-stats-core 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/build/api/gist.d.ts +19 -0
  4. package/build/api/gist.d.ts.map +1 -0
  5. package/build/api/gist.js +77 -0
  6. package/build/api/index.d.ts +37 -0
  7. package/build/api/index.d.ts.map +1 -0
  8. package/build/api/index.js +115 -0
  9. package/build/api/pin.d.ts +27 -0
  10. package/build/api/pin.d.ts.map +1 -0
  11. package/build/api/pin.js +104 -0
  12. package/build/api/top-langs.d.ts +31 -0
  13. package/build/api/top-langs.d.ts.map +1 -0
  14. package/build/api/top-langs.js +121 -0
  15. package/build/api/wakatime.d.ts +28 -0
  16. package/build/api/wakatime.d.ts.map +1 -0
  17. package/build/api/wakatime.js +85 -0
  18. package/build/calculateRank.d.ts +28 -0
  19. package/build/calculateRank.d.ts.map +1 -0
  20. package/build/calculateRank.js +63 -0
  21. package/build/cards/gist.d.ts +21 -0
  22. package/build/cards/gist.d.ts.map +1 -0
  23. package/build/cards/gist.js +124 -0
  24. package/build/cards/repo.d.ts +21 -0
  25. package/build/cards/repo.d.ts.map +1 -0
  26. package/build/cards/repo.js +264 -0
  27. package/build/cards/stats.d.ts +49 -0
  28. package/build/cards/stats.d.ts.map +1 -0
  29. package/build/cards/stats.js +527 -0
  30. package/build/cards/top-languages.d.ts +143 -0
  31. package/build/cards/top-languages.d.ts.map +1 -0
  32. package/build/cards/top-languages.js +795 -0
  33. package/build/cards/wakatime.d.ts +16 -0
  34. package/build/cards/wakatime.d.ts.map +1 -0
  35. package/build/cards/wakatime.js +387 -0
  36. package/build/common/Card.d.ts +109 -0
  37. package/build/common/Card.d.ts.map +1 -0
  38. package/build/common/Card.js +241 -0
  39. package/build/common/I18n.d.ts +26 -0
  40. package/build/common/I18n.d.ts.map +1 -0
  41. package/build/common/I18n.js +34 -0
  42. package/build/common/color.d.ts +53 -0
  43. package/build/common/color.d.ts.map +1 -0
  44. package/build/common/color.js +92 -0
  45. package/build/common/config.d.ts +3 -0
  46. package/build/common/config.d.ts.map +1 -0
  47. package/build/common/config.js +69 -0
  48. package/build/common/constants.d.ts +6 -0
  49. package/build/common/constants.d.ts.map +1 -0
  50. package/build/common/constants.js +7 -0
  51. package/build/common/error.d.ts +53 -0
  52. package/build/common/error.d.ts.map +1 -0
  53. package/build/common/error.js +72 -0
  54. package/build/common/fmt.d.ts +27 -0
  55. package/build/common/fmt.d.ts.map +1 -0
  56. package/build/common/fmt.js +66 -0
  57. package/build/common/html.d.ts +10 -0
  58. package/build/common/html.d.ts.map +1 -0
  59. package/build/common/html.js +18 -0
  60. package/build/common/http.d.ts +9 -0
  61. package/build/common/http.d.ts.map +1 -0
  62. package/build/common/http.js +18 -0
  63. package/build/common/icons.d.ts +26 -0
  64. package/build/common/icons.d.ts.map +1 -0
  65. package/build/common/icons.js +77 -0
  66. package/build/common/languageColors.json +667 -0
  67. package/build/common/log.d.ts +9 -0
  68. package/build/common/log.d.ts.map +1 -0
  69. package/build/common/log.js +8 -0
  70. package/build/common/ops.d.ts +65 -0
  71. package/build/common/ops.d.ts.map +1 -0
  72. package/build/common/ops.js +137 -0
  73. package/build/common/render.d.ts +155 -0
  74. package/build/common/render.d.ts.map +1 -0
  75. package/build/common/render.js +361 -0
  76. package/build/common/retryer.d.ts +22 -0
  77. package/build/common/retryer.d.ts.map +1 -0
  78. package/build/common/retryer.js +86 -0
  79. package/build/fetchers/gist.d.ts +26 -0
  80. package/build/fetchers/gist.d.ts.map +1 -0
  81. package/build/fetchers/gist.js +99 -0
  82. package/build/fetchers/repo.d.ts +16 -0
  83. package/build/fetchers/repo.d.ts.map +1 -0
  84. package/build/fetchers/repo.js +116 -0
  85. package/build/fetchers/stats.d.ts +22 -0
  86. package/build/fetchers/stats.d.ts.map +1 -0
  87. package/build/fetchers/stats.js +339 -0
  88. package/build/fetchers/top-languages.d.ts +20 -0
  89. package/build/fetchers/top-languages.d.ts.map +1 -0
  90. package/build/fetchers/top-languages.js +139 -0
  91. package/build/fetchers/wakatime.d.ts +11 -0
  92. package/build/fetchers/wakatime.d.ts.map +1 -0
  93. package/build/fetchers/wakatime.js +25 -0
  94. package/build/index.d.ts +20 -0
  95. package/build/index.d.ts.map +1 -0
  96. package/build/index.js +19 -0
  97. package/build/themes/index.d.ts +469 -0
  98. package/build/themes/index.d.ts.map +1 -0
  99. package/build/themes/index.js +468 -0
  100. package/build/translations.d.ts +533 -0
  101. package/build/translations.d.ts.map +1 -0
  102. package/build/translations.js +1140 -0
  103. package/package.json +94 -0
  104. package/src/api/gist.js +99 -0
  105. package/src/api/index.js +185 -0
  106. package/src/api/pin.js +146 -0
  107. package/src/api/top-langs.js +168 -0
  108. package/src/api/wakatime.js +113 -0
  109. package/src/calculateRank.js +86 -0
  110. package/src/cards/gist.js +187 -0
  111. package/src/cards/repo.js +365 -0
  112. package/src/cards/stats.js +673 -0
  113. package/src/cards/top-languages.js +1023 -0
  114. package/src/cards/types.d.ts +78 -0
  115. package/src/cards/wakatime.js +471 -0
  116. package/src/common/Card.js +275 -0
  117. package/src/common/I18n.js +42 -0
  118. package/src/common/color.js +145 -0
  119. package/src/common/config.js +78 -0
  120. package/src/common/constants.js +9 -0
  121. package/src/common/error.js +90 -0
  122. package/src/common/fmt.js +80 -0
  123. package/src/common/html.js +22 -0
  124. package/src/common/http.js +21 -0
  125. package/src/common/icons.js +81 -0
  126. package/src/common/languageColors.json +667 -0
  127. package/src/common/log.ts +12 -0
  128. package/src/common/ops.js +172 -0
  129. package/src/common/render.js +442 -0
  130. package/src/common/retryer.js +104 -0
  131. package/src/fetchers/gist.js +114 -0
  132. package/src/fetchers/repo.js +165 -0
  133. package/src/fetchers/stats.js +478 -0
  134. package/src/fetchers/top-languages.js +177 -0
  135. package/src/fetchers/types.d.ts +128 -0
  136. package/src/fetchers/wakatime.js +37 -0
  137. package/src/index.ts +25 -0
  138. package/src/themes/README.md +229 -0
  139. package/src/themes/index.ts +476 -0
  140. package/src/translations.js +1156 -0
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Retrieves num with suffix k(thousands) precise to given decimal places.
3
+ *
4
+ * @param {number} num The number to format.
5
+ * @param {number=} precision The number of decimal places to include.
6
+ * @returns {string|number} The formatted number.
7
+ */
8
+ export function kFormatter(num: number, precision?: number | undefined): string | number;
9
+ /**
10
+ * Convert bytes to a human-readable string representation.
11
+ *
12
+ * @param {number} bytes The number of bytes to convert.
13
+ * @returns {string} The human-readable representation of bytes.
14
+ * @throws {Error} If bytes is negative or too large.
15
+ */
16
+ export function formatBytes(bytes: number): string;
17
+ /**
18
+ * Split text over multiple lines based on the card width.
19
+ *
20
+ * @param {string} text Text to split.
21
+ * @param {number} width Available wrap width in px.
22
+ * @param {number} fontSize Font size in px.
23
+ * @param {number} maxLines Maximum number of lines.
24
+ * @returns {string[]} Array of lines.
25
+ */
26
+ export function wrapTextMultiline(text: string, width: number, fontSize: number, maxLines?: number): string[];
27
+ //# sourceMappingURL=fmt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fmt.d.ts","sourceRoot":"","sources":["../../src/common/fmt.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,gCAJW,MAAM,cACN,MAAM,YAAC,GACL,MAAM,GAAC,MAAM,CAezB;AAED;;;;;;GAMG;AACH,mCAJW,MAAM,GACJ,MAAM,CAqBlB;AAED;;;;;;;;GAQG;AACH,wCANW,MAAM,SACN,MAAM,YACN,MAAM,aACN,MAAM,GACJ,MAAM,EAAE,CAgBpB"}
@@ -0,0 +1,66 @@
1
+ // @ts-check
2
+ import { encodeHTML } from "./html.js";
3
+ import { splitWrappedText } from "./render.js";
4
+ /**
5
+ * Retrieves num with suffix k(thousands) precise to given decimal places.
6
+ *
7
+ * @param {number} num The number to format.
8
+ * @param {number=} precision The number of decimal places to include.
9
+ * @returns {string|number} The formatted number.
10
+ */
11
+ const kFormatter = (num, precision) => {
12
+ const abs = Math.abs(num);
13
+ const sign = Math.sign(num);
14
+ if (typeof precision === "number" && !isNaN(precision)) {
15
+ return (sign * (abs / 1000)).toFixed(precision) + "k";
16
+ }
17
+ if (abs < 1000) {
18
+ return sign * abs;
19
+ }
20
+ return sign * parseFloat((abs / 1000).toFixed(1)) + "k";
21
+ };
22
+ /**
23
+ * Convert bytes to a human-readable string representation.
24
+ *
25
+ * @param {number} bytes The number of bytes to convert.
26
+ * @returns {string} The human-readable representation of bytes.
27
+ * @throws {Error} If bytes is negative or too large.
28
+ */
29
+ const formatBytes = (bytes) => {
30
+ if (bytes < 0) {
31
+ throw new Error("Bytes must be a non-negative number");
32
+ }
33
+ if (bytes === 0) {
34
+ return "0 B";
35
+ }
36
+ const sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB"];
37
+ const base = 1024;
38
+ const i = Math.floor(Math.log(bytes) / Math.log(base));
39
+ if (i >= sizes.length) {
40
+ throw new Error("Bytes is too large to convert to a human-readable string");
41
+ }
42
+ return `${(bytes / Math.pow(base, i)).toFixed(1)} ${sizes[i]}`;
43
+ };
44
+ /**
45
+ * Split text over multiple lines based on the card width.
46
+ *
47
+ * @param {string} text Text to split.
48
+ * @param {number} width Available wrap width in px.
49
+ * @param {number} fontSize Font size in px.
50
+ * @param {number} maxLines Maximum number of lines.
51
+ * @returns {string[]} Array of lines.
52
+ */
53
+ const wrapTextMultiline = (text, width, fontSize, maxLines = 3) => {
54
+ const wrapped = splitWrappedText(text, fontSize, width);
55
+ const lines = wrapped
56
+ .map((line) => encodeHTML(line.trim()))
57
+ .slice(0, maxLines); // Only consider maxLines lines
58
+ // Add "..." to the last line if the text exceeds maxLines
59
+ if (wrapped.length > maxLines) {
60
+ lines[maxLines - 1] += "...";
61
+ }
62
+ // Remove empty lines if text fits in less than maxLines lines
63
+ const multiLineText = lines.filter(Boolean);
64
+ return multiLineText;
65
+ };
66
+ export { kFormatter, formatBytes, wrapTextMultiline };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Encode string as HTML.
3
+ *
4
+ * @see https://stackoverflow.com/a/48073476/10629172
5
+ *
6
+ * @param {string} str String to encode.
7
+ * @returns {string} Encoded string.
8
+ */
9
+ export function encodeHTML(str: string): string;
10
+ //# sourceMappingURL=html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/common/html.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,gCAHW,MAAM,GACJ,MAAM,CAWlB"}
@@ -0,0 +1,18 @@
1
+ // @ts-check
2
+ /**
3
+ * Encode string as HTML.
4
+ *
5
+ * @see https://stackoverflow.com/a/48073476/10629172
6
+ *
7
+ * @param {string} str String to encode.
8
+ * @returns {string} Encoded string.
9
+ */
10
+ const encodeHTML = (str) => {
11
+ return (str
12
+ .replace(/[\u00A0-\u9999<>&](?!#)/gim, (i) => {
13
+ return "&#" + i.charCodeAt(0) + ";";
14
+ })
15
+ // eslint-disable-next-line no-control-regex
16
+ .replace(/\u0008/gim, ""));
17
+ };
18
+ export { encodeHTML };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Send GraphQL request to GitHub API.
3
+ *
4
+ * @param {import('axios').AxiosRequestConfig['data']} data Request data.
5
+ * @param {import('axios').AxiosRequestConfig['headers']} headers Request headers.
6
+ * @returns {Promise<any>} Request response.
7
+ */
8
+ export function request(data: import("axios").AxiosRequestConfig["data"], headers: import("axios").AxiosRequestConfig["headers"]): Promise<any>;
9
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/common/http.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,8BAJW,OAAO,OAAO,EAAE,kBAAkB,CAAC,MAAM,CAAC,WAC1C,OAAO,OAAO,EAAE,kBAAkB,CAAC,SAAS,CAAC,GAC3C,OAAO,CAAC,GAAG,CAAC,CASxB"}
@@ -0,0 +1,18 @@
1
+ // @ts-check
2
+ import axios from "axios";
3
+ /**
4
+ * Send GraphQL request to GitHub API.
5
+ *
6
+ * @param {import('axios').AxiosRequestConfig['data']} data Request data.
7
+ * @param {import('axios').AxiosRequestConfig['headers']} headers Request headers.
8
+ * @returns {Promise<any>} Request response.
9
+ */
10
+ const request = (data, headers) => {
11
+ return axios({
12
+ url: "https://api.github.com/graphql",
13
+ method: "post",
14
+ headers,
15
+ data,
16
+ });
17
+ };
18
+ export { request };
@@ -0,0 +1,26 @@
1
+ export namespace icons {
2
+ let star: string;
3
+ let commits: string;
4
+ let prs: string;
5
+ let prs_merged: string;
6
+ let prs_merged_percentage: string;
7
+ let issues: string;
8
+ let icon: string;
9
+ let contribs: string;
10
+ let fork: string;
11
+ let reviews: string;
12
+ let discussions_started: string;
13
+ let discussions_answered: string;
14
+ let comments: string;
15
+ let gist: string;
16
+ }
17
+ /**
18
+ * Get rank icon
19
+ *
20
+ * @param {string} rankIcon - The rank icon type.
21
+ * @param {string} rankLevel - The rank level.
22
+ * @param {number} percentile - The rank percentile.
23
+ * @returns {string} - The SVG code of the rank icon
24
+ */
25
+ export function rankIcon(rankIcon: string, rankLevel: string, percentile: number): string;
26
+ //# sourceMappingURL=icons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/common/icons.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA6CA;;;;;;;GAOG;AACH,mCALW,MAAM,aACN,MAAM,cACN,MAAM,GACJ,MAAM,CA2BlB"}
@@ -0,0 +1,77 @@
1
+ // @ts-check
2
+ /*
3
+ The icons in this file are based on https://github.com/primer/octicons which is released under the MIT license:
4
+
5
+ MIT License
6
+
7
+ Copyright (c) 2026 GitHub Inc.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+ */
27
+ const icons = {
28
+ star: `<path fill-rule="evenodd" d="M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615 5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0 01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77 1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75 0 01-.564-.41L8 2.694v.001z"/>`,
29
+ commits: `<path fill-rule="evenodd" d="M1.643 3.143L.427 1.927A.25.25 0 000 2.104V5.75c0 .138.112.25.25.25h3.646a.25.25 0 00.177-.427L2.715 4.215a6.5 6.5 0 11-1.18 4.458.75.75 0 10-1.493.154 8.001 8.001 0 101.6-5.684zM7.75 4a.75.75 0 01.75.75v2.992l2.028.812a.75.75 0 01-.557 1.392l-2.5-1A.75.75 0 017 8.25v-3.5A.75.75 0 017.75 4z"/>`,
30
+ prs: `<path fill-rule="evenodd" d="M7.177 3.073L9.573.677A.25.25 0 0110 .854v4.792a.25.25 0 01-.427.177L7.177 3.427a.25.25 0 010-.354zM3.75 2.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122v5.256a2.251 2.251 0 11-1.5 0V5.372A2.25 2.25 0 011.5 3.25zM11 2.5h-1V4h1a1 1 0 011 1v5.628a2.251 2.251 0 101.5 0V5A2.5 2.5 0 0011 2.5zm1 10.25a.75.75 0 111.5 0 .75.75 0 01-1.5 0zM3.75 12a.75.75 0 100 1.5.75.75 0 000-1.5z"/>`,
31
+ prs_merged: `<path fill-rule="evenodd" d="M5.45 5.154A4.25 4.25 0 0 0 9.25 7.5h1.378a2.251 2.251 0 1 1 0 1.5H9.25A5.734 5.734 0 0 1 5 7.123v3.505a2.25 2.25 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.95-.218ZM4.25 13.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm8.5-4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM5 3.25a.75.75 0 1 0 0 .005V3.25Z" />`,
32
+ prs_merged_percentage: `<path fill-rule="evenodd" d="M13.442 2.558a.625.625 0 0 1 0 .884l-10 10a.625.625 0 1 1-.884-.884l10-10a.625.625 0 0 1 .884 0zM4.5 6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5zm7 6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5z" />`,
33
+ issues: `<path fill-rule="evenodd" d="M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm9 3a1 1 0 11-2 0 1 1 0 012 0zm-.25-6.25a.75.75 0 00-1.5 0v3.5a.75.75 0 001.5 0v-3.5z"/>`,
34
+ icon: `<path fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"/>`,
35
+ contribs: `<path fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"/>`,
36
+ fork: `<path fill-rule="evenodd" d="M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.878A2.25 2.25 0 005.75 8.5h1.5v2.128a2.251 2.251 0 101.5 0V8.5h1.5a2.25 2.25 0 002.25-2.25v-.878a2.25 2.25 0 10-1.5 0v.878a.75.75 0 01-.75.75h-4.5A.75.75 0 015 6.25v-.878zm3.75 7.378a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm3-8.75a.75.75 0 100-1.5.75.75 0 000 1.5z"></path>`,
37
+ reviews: `<path fill-rule="evenodd" d="M8 2c1.981 0 3.671.992 4.933 2.078 1.27 1.091 2.187 2.345 2.637 3.023a1.62 1.62 0 0 1 0 1.798c-.45.678-1.367 1.932-2.637 3.023C11.67 13.008 9.981 14 8 14c-1.981 0-3.671-.992-4.933-2.078C1.797 10.83.88 9.576.43 8.898a1.62 1.62 0 0 1 0-1.798c.45-.677 1.367-1.931 2.637-3.022C4.33 2.992 6.019 2 8 2ZM1.679 7.932a.12.12 0 0 0 0 .136c.411.622 1.241 1.75 2.366 2.717C5.176 11.758 6.527 12.5 8 12.5c1.473 0 2.825-.742 3.955-1.715 1.124-.967 1.954-2.096 2.366-2.717a.12.12 0 0 0 0-.136c-.412-.621-1.242-1.75-2.366-2.717C10.824 4.242 9.473 3.5 8 3.5c-1.473 0-2.825.742-3.955 1.715-1.124.967-1.954 2.096-2.366 2.717ZM8 10a2 2 0 1 1-.001-3.999A2 2 0 0 1 8 10Z"/>`,
38
+ discussions_started: `<path fill-rule="evenodd" d="M1.75 1h8.5c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 10.25 10H7.061l-2.574 2.573A1.458 1.458 0 0 1 2 11.543V10h-.25A1.75 1.75 0 0 1 0 8.25v-5.5C0 1.784.784 1 1.75 1ZM1.5 2.75v5.5c0 .138.112.25.25.25h1a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h3.5a.25.25 0 0 0 .25-.25v-5.5a.25.25 0 0 0-.25-.25h-8.5a.25.25 0 0 0-.25.25Zm13 2a.25.25 0 0 0-.25-.25h-.5a.75.75 0 0 1 0-1.5h.5c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 14.25 12H14v1.543a1.458 1.458 0 0 1-2.487 1.03L9.22 12.28a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215l2.22 2.22v-2.19a.75.75 0 0 1 .75-.75h1a.25.25 0 0 0 .25-.25Z" />`,
39
+ discussions_answered: `<path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z" />`,
40
+ comments: `<path d="M1 2.75C1 1.784 1.784 1 2.75 1h10.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 13.25 12H9.06l-2.573 2.573A1.458 1.458 0 0 1 4 13.543V12H2.75A1.75 1.75 0 0 1 1 10.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h4.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z" />`,
41
+ gist: `<path fill-rule="evenodd" d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25Zm7.47 3.97a.75.75 0 0 1 1.06 0l2 2a.75.75 0 0 1 0 1.06l-2 2a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L10.69 8 9.22 6.53a.75.75 0 0 1 0-1.06ZM6.78 6.53 5.31 8l1.47 1.47a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215l-2-2a.75.75 0 0 1 0-1.06l2-2a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z" />`,
42
+ };
43
+ /**
44
+ * Get rank icon
45
+ *
46
+ * @param {string} rankIcon - The rank icon type.
47
+ * @param {string} rankLevel - The rank level.
48
+ * @param {number} percentile - The rank percentile.
49
+ * @returns {string} - The SVG code of the rank icon
50
+ */
51
+ const rankIcon = (rankIcon, rankLevel, percentile) => {
52
+ switch (rankIcon) {
53
+ case "github":
54
+ return `
55
+ <svg x="-38" y="-30" height="66" width="66" aria-hidden="true" viewBox="0 0 16 16" version="1.1" data-view-component="true" data-testid="github-rank-icon">
56
+ <path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path>
57
+ </svg>
58
+ `;
59
+ case "percentile":
60
+ return `
61
+ <text x="-5" y="-12" alignment-baseline="central" dominant-baseline="central" text-anchor="middle" data-testid="percentile-top-header" class="rank-percentile-header">
62
+ Top
63
+ </text>
64
+ <text x="-5" y="12" alignment-baseline="central" dominant-baseline="central" text-anchor="middle" data-testid="percentile-rank-value" class="rank-percentile-text">
65
+ ${percentile.toFixed(1)}%
66
+ </text>
67
+ `;
68
+ case "default":
69
+ default:
70
+ return `
71
+ <text x="-5" y="3" alignment-baseline="central" dominant-baseline="central" text-anchor="middle" data-testid="level-rank-icon">
72
+ ${rankLevel}
73
+ </text>
74
+ `;
75
+ }
76
+ };
77
+ export { icons, rankIcon };