pythonlib 1.0.2 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/README.md +123 -49
  2. package/dist/base64-C_am75Sv.d.ts +165 -0
  3. package/dist/base64.d.ts +1 -0
  4. package/dist/base64.js +37 -0
  5. package/dist/chunk-2QEMKE7U.js +252 -0
  6. package/dist/chunk-2YTO24B5.js +78 -0
  7. package/dist/chunk-3HQSBCEC.js +348 -0
  8. package/dist/{chunk-7BZB2TQF.js → chunk-3M3PB4RO.js} +4 -6
  9. package/dist/chunk-5OKGPZBQ.js +1106 -0
  10. package/dist/chunk-B5LQJODJ.js +37 -0
  11. package/dist/{chunk-CUP6EPDB.js → chunk-BCMGGBWG.js} +2 -5
  12. package/dist/chunk-BCVIH2BN.js +175 -0
  13. package/dist/chunk-CANUXHVB.js +349 -0
  14. package/dist/{chunk-QURVRHY2.js → chunk-D35YI363.js} +15 -12
  15. package/dist/{chunk-RSBRI27Z.js → chunk-ETBW6XNR.js} +3 -4
  16. package/dist/chunk-HSTC277I.js +255 -0
  17. package/dist/chunk-HTCQ4OO5.js +238 -0
  18. package/dist/chunk-IANXD4D4.js +250 -0
  19. package/dist/{chunk-G6PUQTVZ.js → chunk-JAUU3HMH.js} +1 -2
  20. package/dist/chunk-JVTQM7CI.js +195 -0
  21. package/dist/chunk-KKJHGY4C.js +551 -0
  22. package/dist/chunk-LHPQS75Z.js +192 -0
  23. package/dist/{chunk-OSX7QZAW.js → chunk-LK2L2TFG.js} +5 -6
  24. package/dist/{chunk-CEZSBJJV.js → chunk-LWYBTWBZ.js} +2 -3
  25. package/dist/chunk-MEEU4SH5.js +362 -0
  26. package/dist/{chunk-TAYRRHJ3.js → chunk-MFKIEN7N.js} +1 -2
  27. package/dist/{chunk-PZ5AY32C.js → chunk-MLKGABMK.js} +0 -1
  28. package/dist/chunk-OZRS5PC4.js +312 -0
  29. package/dist/chunk-PVK4F3ME.js +194 -0
  30. package/dist/{chunk-56DGFWIJ.js → chunk-QKJBQKPY.js} +1 -2
  31. package/dist/chunk-RB6BYCIQ.js +141 -0
  32. package/dist/chunk-RRSOZXZE.js +155 -0
  33. package/dist/chunk-THMJVAK6.js +282 -0
  34. package/dist/chunk-UGZ5OY5Z.js +165 -0
  35. package/dist/chunk-WTZSAITC.js +82 -0
  36. package/dist/chunk-YONWJHJU.js +265 -0
  37. package/dist/collections.js +2 -3
  38. package/dist/copy-6ZaZ__ge.d.ts +59 -0
  39. package/dist/copy.d.ts +1 -0
  40. package/dist/copy.js +9 -0
  41. package/dist/datetime.js +2 -3
  42. package/dist/functools.js +2 -3
  43. package/dist/glob.browser-B6d_YdV5.d.ts +50 -0
  44. package/dist/glob.browser.d.ts +1 -0
  45. package/dist/glob.browser.js +15 -0
  46. package/dist/glob.node-wn5ehtyM.d.ts +80 -0
  47. package/dist/glob.node.d.ts +1 -0
  48. package/dist/glob.node.js +15 -0
  49. package/dist/hashlib-vKP511NY.d.ts +205 -0
  50. package/dist/hashlib.d.ts +1 -0
  51. package/dist/hashlib.js +39 -0
  52. package/dist/index.browser.d.ts +172 -0
  53. package/dist/index.browser.js +305 -0
  54. package/dist/index.d.ts +36 -602
  55. package/dist/index.js +138 -1073
  56. package/dist/itertools.js +2 -3
  57. package/dist/json.js +2 -3
  58. package/dist/logging.browser-Dux4L5kz.d.ts +185 -0
  59. package/dist/logging.browser.d.ts +1 -0
  60. package/dist/logging.browser.js +63 -0
  61. package/dist/logging.node-CH75bVdE.d.ts +185 -0
  62. package/dist/logging.node.d.ts +1 -0
  63. package/dist/logging.node.js +61 -0
  64. package/dist/math.js +2 -3
  65. package/dist/{os-CqGKe872.d.ts → os.browser-krjSx5kF.d.ts} +32 -55
  66. package/dist/os.browser.d.ts +2 -0
  67. package/dist/{os.js → os.browser.js} +41 -16
  68. package/dist/os.node-CQjch8Ht.d.ts +124 -0
  69. package/dist/os.node.d.ts +2 -0
  70. package/dist/os.node.js +83 -0
  71. package/dist/os.shared-C3x70nhO.d.ts +59 -0
  72. package/dist/pathlib.browser-NC7kKQYe.d.ts +91 -0
  73. package/dist/pathlib.browser.d.ts +1 -0
  74. package/dist/pathlib.browser.js +17 -0
  75. package/dist/pathlib.node-CY3yUFdT.d.ts +331 -0
  76. package/dist/pathlib.node.d.ts +2 -0
  77. package/dist/pathlib.node.js +17 -0
  78. package/dist/random.js +2 -3
  79. package/dist/re.js +2 -3
  80. package/dist/set-JQbLAq8B.d.ts +592 -0
  81. package/dist/shutil.browser-Ck5oWhnP.d.ts +113 -0
  82. package/dist/shutil.browser.d.ts +1 -0
  83. package/dist/shutil.browser.js +33 -0
  84. package/dist/shutil.node-C9kwvhAf.d.ts +160 -0
  85. package/dist/shutil.node.d.ts +2 -0
  86. package/dist/shutil.node.js +33 -0
  87. package/dist/string.js +2 -3
  88. package/dist/subprocess-CZVYzQ3V.d.ts +214 -0
  89. package/dist/subprocess.d.ts +1 -0
  90. package/dist/subprocess.js +29 -0
  91. package/dist/sys-IL8LgI_W.d.ts +212 -0
  92. package/dist/sys.d.ts +1 -0
  93. package/dist/sys.js +51 -0
  94. package/dist/tempfile.browser-DciOKfNm.d.ts +78 -0
  95. package/dist/tempfile.browser.d.ts +1 -0
  96. package/dist/tempfile.browser.js +19 -0
  97. package/dist/tempfile.node-bVMY60Cu.d.ts +195 -0
  98. package/dist/tempfile.node.d.ts +2 -0
  99. package/dist/tempfile.node.js +23 -0
  100. package/dist/time-CcYhdiSu.d.ts +245 -0
  101. package/dist/time.d.ts +1 -0
  102. package/dist/time.js +49 -0
  103. package/dist/urllib-DJtkj-0f.d.ts +198 -0
  104. package/dist/urllib.d.ts +1 -0
  105. package/dist/urllib.js +37 -0
  106. package/dist/uuid-C0ypmn56.d.ts +160 -0
  107. package/dist/uuid.d.ts +1 -0
  108. package/dist/uuid.js +23 -0
  109. package/package.json +128 -5
  110. package/dist/chunk-56DGFWIJ.js.map +0 -1
  111. package/dist/chunk-5AOJFFYN.js +0 -313
  112. package/dist/chunk-5AOJFFYN.js.map +0 -1
  113. package/dist/chunk-7BZB2TQF.js.map +0 -1
  114. package/dist/chunk-CEZSBJJV.js.map +0 -1
  115. package/dist/chunk-CUP6EPDB.js.map +0 -1
  116. package/dist/chunk-G6PUQTVZ.js.map +0 -1
  117. package/dist/chunk-OSX7QZAW.js.map +0 -1
  118. package/dist/chunk-PZ5AY32C.js.map +0 -1
  119. package/dist/chunk-QURVRHY2.js.map +0 -1
  120. package/dist/chunk-RSBRI27Z.js.map +0 -1
  121. package/dist/chunk-TAYRRHJ3.js.map +0 -1
  122. package/dist/collections.js.map +0 -1
  123. package/dist/datetime.js.map +0 -1
  124. package/dist/functools.js.map +0 -1
  125. package/dist/index.js.map +0 -1
  126. package/dist/itertools.js.map +0 -1
  127. package/dist/json.js.map +0 -1
  128. package/dist/math.js.map +0 -1
  129. package/dist/os.d.ts +0 -1
  130. package/dist/os.js.map +0 -1
  131. package/dist/random.js.map +0 -1
  132. package/dist/re.js.map +0 -1
  133. package/dist/string.js.map +0 -1
@@ -0,0 +1,192 @@
1
+ // src/os.shared.ts
2
+ var environ = typeof process !== "undefined" ? process.env : {};
3
+ function getenv(key, defaultValue) {
4
+ return environ[key] ?? defaultValue;
5
+ }
6
+ var sep = typeof process !== "undefined" && process.platform === "win32" ? "\\" : "/";
7
+ var altSep = typeof process !== "undefined" && process.platform === "win32" ? "/" : null;
8
+ var pathSep = typeof process !== "undefined" && process.platform === "win32" ? ";" : ":";
9
+ var lineSep = typeof process !== "undefined" && process.platform === "win32" ? "\r\n" : "\n";
10
+ var curDir = ".";
11
+ var parDir = "..";
12
+ var extSep = ".";
13
+ var name = typeof process !== "undefined" && process.platform === "win32" ? "nt" : "posix";
14
+ function pathJoin(...paths) {
15
+ if (paths.length === 0) return "";
16
+ if (paths.length === 1) return paths[0] ?? "";
17
+ let result = paths[0] ?? "";
18
+ for (let i = 1; i < paths.length; i++) {
19
+ const p = paths[i] ?? "";
20
+ if (p.startsWith("/") || p.length > 1 && p[1] === ":") {
21
+ result = p;
22
+ } else if (result === "" || result.endsWith("/") || result.endsWith("\\")) {
23
+ result += p;
24
+ } else {
25
+ result += sep + p;
26
+ }
27
+ }
28
+ return result;
29
+ }
30
+ function pathBasename(p, suffix) {
31
+ let s = p.replace(/[/\\]+$/, "");
32
+ const idx = Math.max(s.lastIndexOf("/"), s.lastIndexOf("\\"));
33
+ s = idx >= 0 ? s.slice(idx + 1) : s;
34
+ if (suffix && s.endsWith(suffix)) {
35
+ s = s.slice(0, -suffix.length);
36
+ }
37
+ return s;
38
+ }
39
+ function pathDirname(p) {
40
+ const s = p.replace(/[/\\]+$/, "");
41
+ const idx = Math.max(s.lastIndexOf("/"), s.lastIndexOf("\\"));
42
+ if (idx < 0) return "";
43
+ if (idx === 0) return s[0] ?? "";
44
+ return s.slice(0, idx);
45
+ }
46
+ function pathSplitFn(p) {
47
+ return [pathDirname(p), pathBasename(p)];
48
+ }
49
+ function pathSplitExt(p) {
50
+ const base = pathBasename(p);
51
+ const dotIdx = base.lastIndexOf(".");
52
+ if (dotIdx <= 0) {
53
+ return [p, ""];
54
+ }
55
+ const dir = pathDirname(p);
56
+ const root = base.slice(0, dotIdx);
57
+ const ext = base.slice(dotIdx);
58
+ return [dir ? pathJoin(dir, root) : root, ext];
59
+ }
60
+ function pathExtName(p) {
61
+ return pathSplitExt(p)[1];
62
+ }
63
+ function pathIsAbs(p) {
64
+ if (p.startsWith("/")) return true;
65
+ if (p.length >= 3 && p[1] === ":" && (p[2] === "/" || p[2] === "\\")) return true;
66
+ if (p.startsWith("\\\\")) return true;
67
+ return false;
68
+ }
69
+ function pathNormPath(p) {
70
+ if (!p) return ".";
71
+ let prefix = "";
72
+ if (p.length >= 2 && p[1] === ":") {
73
+ prefix = p.slice(0, 2);
74
+ p = p.slice(2);
75
+ }
76
+ const isWin = p.includes("\\");
77
+ p = p.replace(/\\/g, "/");
78
+ const isAbsolute = p.startsWith("/");
79
+ const parts = p.split("/").filter((part) => part && part !== ".");
80
+ const result = [];
81
+ for (const part of parts) {
82
+ if (part === "..") {
83
+ if (result.length > 0 && result[result.length - 1] !== "..") {
84
+ result.pop();
85
+ } else if (!isAbsolute) {
86
+ result.push("..");
87
+ }
88
+ } else {
89
+ result.push(part);
90
+ }
91
+ }
92
+ let normalized = result.join(isWin ? "\\" : "/");
93
+ if (isAbsolute) {
94
+ normalized = (isWin ? "\\" : "/") + normalized;
95
+ }
96
+ normalized = prefix + normalized;
97
+ return normalized || ".";
98
+ }
99
+ function pathRelPath(p, start = ".") {
100
+ const pParts = pathNormPath(p).split(/[/\\]/).filter(Boolean);
101
+ const startParts = pathNormPath(start).split(/[/\\]/).filter(Boolean);
102
+ let commonLen = 0;
103
+ const minLen = Math.min(pParts.length, startParts.length);
104
+ for (let i = 0; i < minLen; i++) {
105
+ if (pParts[i] === startParts[i]) {
106
+ commonLen++;
107
+ } else {
108
+ break;
109
+ }
110
+ }
111
+ const upCount = startParts.length - commonLen;
112
+ const result = [...Array(upCount).fill(".."), ...pParts.slice(commonLen)];
113
+ return result.join(sep) || ".";
114
+ }
115
+ function pathCommonPath(paths) {
116
+ if (paths.length === 0) {
117
+ throw new Error("commonPath() arg is an empty sequence");
118
+ }
119
+ const splitPaths = paths.map((p) => pathNormPath(p).split(/[/\\]/));
120
+ const first = splitPaths[0];
121
+ if (!first) {
122
+ throw new Error("commonPath() arg is an empty sequence");
123
+ }
124
+ let commonLen = first.length;
125
+ for (const parts of splitPaths.slice(1)) {
126
+ commonLen = Math.min(commonLen, parts.length);
127
+ for (let j = 0; j < commonLen; j++) {
128
+ if (parts[j] !== first[j]) {
129
+ commonLen = j;
130
+ break;
131
+ }
132
+ }
133
+ }
134
+ return first.slice(0, commonLen).join(sep) || sep;
135
+ }
136
+ function pathExpandUser(p) {
137
+ if (!p.startsWith("~")) return p;
138
+ const home = typeof process !== "undefined" ? process.env.HOME ?? process.env.USERPROFILE : void 0;
139
+ if (!home) return p;
140
+ if (p === "~" || p.startsWith("~/") || p.startsWith("~\\")) {
141
+ return home + p.slice(1);
142
+ }
143
+ return p;
144
+ }
145
+ function pathExpandVars(p) {
146
+ return p.replace(/\$(\w+)|\$\{(\w+)\}/g, (_, v1, v2) => {
147
+ const key = v1 || v2;
148
+ return environ[key] ?? "";
149
+ });
150
+ }
151
+ function getCwd() {
152
+ if (typeof process !== "undefined") {
153
+ return process.cwd();
154
+ }
155
+ return "/";
156
+ }
157
+ function getCwdb() {
158
+ return getCwd();
159
+ }
160
+ function chdir(p) {
161
+ if (typeof process !== "undefined") {
162
+ process.chdir(p);
163
+ }
164
+ }
165
+
166
+ export {
167
+ environ,
168
+ getenv,
169
+ sep,
170
+ altSep,
171
+ pathSep,
172
+ lineSep,
173
+ curDir,
174
+ parDir,
175
+ extSep,
176
+ name,
177
+ pathJoin,
178
+ pathBasename,
179
+ pathDirname,
180
+ pathSplitFn,
181
+ pathSplitExt,
182
+ pathExtName,
183
+ pathIsAbs,
184
+ pathNormPath,
185
+ pathRelPath,
186
+ pathCommonPath,
187
+ pathExpandUser,
188
+ pathExpandVars,
189
+ getCwd,
190
+ getCwdb,
191
+ chdir
192
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __export
3
- } from "./chunk-PZ5AY32C.js";
3
+ } from "./chunk-MLKGABMK.js";
4
4
 
5
5
  // src/datetime.ts
6
6
  var datetime_exports = {};
@@ -120,7 +120,7 @@ var date = class _date {
120
120
  }
121
121
  static fromIsoFormat(dateString) {
122
122
  const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(dateString);
123
- if (!match || !match[1] || !match[2] || !match[3]) {
123
+ if (!match?.[1] || !match[2] || !match[3]) {
124
124
  throw new Error(`Invalid isoFormat string: '${dateString}'`);
125
125
  }
126
126
  return new _date(parseInt(match[1]), parseInt(match[2]), parseInt(match[3]));
@@ -231,7 +231,7 @@ var time = class _time {
231
231
  }
232
232
  static fromIsoFormat(timeString) {
233
233
  const match = /^(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?$/.exec(timeString);
234
- if (!match || !match[1] || !match[2] || !match[3]) {
234
+ if (!match?.[1] || !match[2] || !match[3]) {
235
235
  throw new Error(`Invalid isoFormat string: '${timeString}'`);
236
236
  }
237
237
  const microsecond = match[4] ? parseInt(match[4].padEnd(6, "0").slice(0, 6)) : 0;
@@ -352,9 +352,9 @@ var datetime = class _datetime extends date {
352
352
  }
353
353
  static fromIsoFormat(s) {
354
354
  const match = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?$/.exec(s);
355
- if (!match || !match[1] || !match[2] || !match[3] || !match[4] || !match[5] || !match[6]) {
355
+ if (!match?.[1] || !match[2] || !match[3] || !match[4] || !match[5] || !match[6]) {
356
356
  const dateMatch = /^(\d{4})-(\d{2})-(\d{2})$/.exec(s);
357
- if (dateMatch && dateMatch[1] && dateMatch[2] && dateMatch[3]) {
357
+ if (dateMatch?.[1] && dateMatch[2] && dateMatch[3]) {
358
358
  return new _datetime(parseInt(dateMatch[1]), parseInt(dateMatch[2]), parseInt(dateMatch[3]));
359
359
  }
360
360
  throw new Error(`Invalid isoFormat string: '${s}'`);
@@ -678,4 +678,3 @@ export {
678
678
  MAXYEAR,
679
679
  datetime_exports
680
680
  };
681
- //# sourceMappingURL=chunk-OSX7QZAW.js.map
@@ -52,7 +52,7 @@ var Template = class {
52
52
  const regex = /\$(\w+)|\$\{(\w+)\}/g;
53
53
  let match;
54
54
  while ((match = regex.exec(this.template)) !== null) {
55
- const name = match[1] || match[2];
55
+ const name = match[1] ?? match[2];
56
56
  if (name && !identifiers.includes(name)) {
57
57
  identifiers.push(name);
58
58
  }
@@ -267,7 +267,7 @@ var string = {
267
267
  */
268
268
  zFill(s, width) {
269
269
  if (s.length >= width) return s;
270
- const sign = s[0] === "-" || s[0] === "+" ? s[0] : "";
270
+ const sign = s.startsWith("-") || s.startsWith("+") ? s.charAt(0) : "";
271
271
  const digits2 = sign ? s.slice(1) : s;
272
272
  return sign + digits2.padStart(width - sign.length, "0");
273
273
  },
@@ -373,4 +373,3 @@ export {
373
373
  capWords,
374
374
  string
375
375
  };
376
- //# sourceMappingURL=chunk-CEZSBJJV.js.map
@@ -0,0 +1,362 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-MLKGABMK.js";
4
+
5
+ // src/time.ts
6
+ var time_exports = {};
7
+ __export(time_exports, {
8
+ altzone: () => altzone,
9
+ asctime: () => asctime,
10
+ ctime: () => ctime,
11
+ daylight: () => daylight,
12
+ gmtime: () => gmtime,
13
+ localtime: () => localtime,
14
+ mktime: () => mktime,
15
+ monotonic: () => monotonic,
16
+ monotonicNs: () => monotonicNs,
17
+ perfCounter: () => perfCounter,
18
+ perfCounterNs: () => perfCounterNs,
19
+ processTime: () => processTime,
20
+ processTimeNs: () => processTimeNs,
21
+ sleep: () => sleep,
22
+ strftime: () => strftime,
23
+ strptime: () => strptime,
24
+ threadTime: () => threadTime,
25
+ threadTimeNs: () => threadTimeNs,
26
+ time: () => time,
27
+ timeNs: () => timeNs,
28
+ timezone: () => timezone,
29
+ tzname: () => tzname
30
+ });
31
+ var startTime = typeof performance !== "undefined" ? performance.now() : Date.now();
32
+ function time() {
33
+ return Date.now() / 1e3;
34
+ }
35
+ function timeNs() {
36
+ return BigInt(Date.now()) * 1000000n;
37
+ }
38
+ function sleep(secs) {
39
+ const end = Date.now() + secs * 1e3;
40
+ while (Date.now() < end) {
41
+ }
42
+ }
43
+ function perfCounter() {
44
+ if (typeof performance !== "undefined") {
45
+ return performance.now() / 1e3;
46
+ }
47
+ return (Date.now() - startTime) / 1e3;
48
+ }
49
+ function perfCounterNs() {
50
+ if (typeof performance !== "undefined") {
51
+ return BigInt(Math.floor(performance.now() * 1e6));
52
+ }
53
+ return BigInt(Date.now() - startTime) * 1000000n;
54
+ }
55
+ function monotonic() {
56
+ return perfCounter();
57
+ }
58
+ function monotonicNs() {
59
+ return perfCounterNs();
60
+ }
61
+ function localtime(secs) {
62
+ const date = secs === void 0 ? /* @__PURE__ */ new Date() : new Date(secs * 1e3);
63
+ const startOfYear = new Date(date.getFullYear(), 0, 0);
64
+ const diff = date.getTime() - startOfYear.getTime();
65
+ const oneDay = 1e3 * 60 * 60 * 24;
66
+ const tm_yday = Math.floor(diff / oneDay);
67
+ const jsDay = date.getDay();
68
+ const tm_wday = jsDay === 0 ? 6 : jsDay - 1;
69
+ return {
70
+ tm_year: date.getFullYear(),
71
+ tm_mon: date.getMonth() + 1,
72
+ // JavaScript months are 0-indexed
73
+ tm_mday: date.getDate(),
74
+ tm_hour: date.getHours(),
75
+ tm_min: date.getMinutes(),
76
+ tm_sec: date.getSeconds(),
77
+ tm_wday,
78
+ tm_yday,
79
+ tm_isdst: -1
80
+ // Not determinable in JavaScript
81
+ };
82
+ }
83
+ function gmtime(secs) {
84
+ const date = secs === void 0 ? /* @__PURE__ */ new Date() : new Date(secs * 1e3);
85
+ const startOfYear = new Date(Date.UTC(date.getUTCFullYear(), 0, 0));
86
+ const diff = date.getTime() - startOfYear.getTime();
87
+ const oneDay = 1e3 * 60 * 60 * 24;
88
+ const tm_yday = Math.floor(diff / oneDay);
89
+ const jsDay = date.getUTCDay();
90
+ const tm_wday = jsDay === 0 ? 6 : jsDay - 1;
91
+ return {
92
+ tm_year: date.getUTCFullYear(),
93
+ tm_mon: date.getUTCMonth() + 1,
94
+ tm_mday: date.getUTCDate(),
95
+ tm_hour: date.getUTCHours(),
96
+ tm_min: date.getUTCMinutes(),
97
+ tm_sec: date.getUTCSeconds(),
98
+ tm_wday,
99
+ tm_yday,
100
+ tm_isdst: 0
101
+ // UTC never has DST
102
+ };
103
+ }
104
+ function mktime(t) {
105
+ const date = new Date(
106
+ t.tm_year,
107
+ t.tm_mon - 1,
108
+ // Convert to 0-indexed month
109
+ t.tm_mday,
110
+ t.tm_hour,
111
+ t.tm_min,
112
+ t.tm_sec
113
+ );
114
+ return date.getTime() / 1e3;
115
+ }
116
+ function strftime(format, t) {
117
+ const st = t ?? localtime();
118
+ const weekdays = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
119
+ const weekdaysShort = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
120
+ const months = [
121
+ "January",
122
+ "February",
123
+ "March",
124
+ "April",
125
+ "May",
126
+ "June",
127
+ "July",
128
+ "August",
129
+ "September",
130
+ "October",
131
+ "November",
132
+ "December"
133
+ ];
134
+ const monthsShort = [
135
+ "Jan",
136
+ "Feb",
137
+ "Mar",
138
+ "Apr",
139
+ "May",
140
+ "Jun",
141
+ "Jul",
142
+ "Aug",
143
+ "Sep",
144
+ "Oct",
145
+ "Nov",
146
+ "Dec"
147
+ ];
148
+ const pad = (n, width = 2) => String(n).padStart(width, "0");
149
+ const sundayWday = (st.tm_wday + 1) % 7;
150
+ const hour12 = st.tm_hour % 12 || 12;
151
+ const date = new Date(st.tm_year, st.tm_mon - 1, st.tm_mday);
152
+ const startOfYear = new Date(st.tm_year, 0, 1);
153
+ const dayOfYear = Math.floor((date.getTime() - startOfYear.getTime()) / (24 * 60 * 60 * 1e3)) + 1;
154
+ const sundayWeek = Math.floor((dayOfYear + startOfYear.getDay()) / 7);
155
+ const mondayWeek = Math.floor((dayOfYear + (startOfYear.getDay() + 6) % 7) / 7);
156
+ const replacements = {
157
+ "%Y": String(st.tm_year),
158
+ "%y": pad(st.tm_year % 100),
159
+ "%m": pad(st.tm_mon),
160
+ "%d": pad(st.tm_mday),
161
+ "%H": pad(st.tm_hour),
162
+ "%I": pad(hour12),
163
+ "%M": pad(st.tm_min),
164
+ "%S": pad(st.tm_sec),
165
+ "%p": st.tm_hour < 12 ? "AM" : "PM",
166
+ "%A": weekdays[st.tm_wday] ?? "",
167
+ "%a": weekdaysShort[st.tm_wday] ?? "",
168
+ "%B": months[st.tm_mon - 1] ?? "",
169
+ "%b": monthsShort[st.tm_mon - 1] ?? "",
170
+ "%w": String(sundayWday),
171
+ "%j": pad(st.tm_yday, 3),
172
+ "%U": pad(sundayWeek),
173
+ "%W": pad(mondayWeek),
174
+ "%c": `${weekdaysShort[st.tm_wday] ?? ""} ${monthsShort[st.tm_mon - 1] ?? ""} ${pad(st.tm_mday)} ${pad(st.tm_hour)}:${pad(st.tm_min)}:${pad(st.tm_sec)} ${String(st.tm_year)}`,
175
+ "%x": `${pad(st.tm_mon)}/${pad(st.tm_mday)}/${pad(st.tm_year % 100)}`,
176
+ "%X": `${pad(st.tm_hour)}:${pad(st.tm_min)}:${pad(st.tm_sec)}`,
177
+ "%%": "%"
178
+ };
179
+ let result = format;
180
+ for (const [code, value] of Object.entries(replacements)) {
181
+ result = result.split(code).join(value);
182
+ }
183
+ return result;
184
+ }
185
+ function strptime(timeString, format) {
186
+ const result = {
187
+ tm_year: 1900,
188
+ tm_mon: 1,
189
+ tm_mday: 1,
190
+ tm_hour: 0,
191
+ tm_min: 0,
192
+ tm_sec: 0,
193
+ tm_wday: 0,
194
+ tm_yday: 1,
195
+ tm_isdst: -1
196
+ };
197
+ const monthsShort = [
198
+ "jan",
199
+ "feb",
200
+ "mar",
201
+ "apr",
202
+ "may",
203
+ "jun",
204
+ "jul",
205
+ "aug",
206
+ "sep",
207
+ "oct",
208
+ "nov",
209
+ "dec"
210
+ ];
211
+ const months = [
212
+ "january",
213
+ "february",
214
+ "march",
215
+ "april",
216
+ "may",
217
+ "june",
218
+ "july",
219
+ "august",
220
+ "september",
221
+ "october",
222
+ "november",
223
+ "december"
224
+ ];
225
+ let pattern = format;
226
+ pattern = pattern.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
227
+ const formatMap = [
228
+ { code: "%Y", regex: "(\\d{4})", handler: (m) => result.tm_year = parseInt(m, 10) },
229
+ {
230
+ code: "%y",
231
+ regex: "(\\d{2})",
232
+ handler: (m) => {
233
+ const yr = parseInt(m, 10);
234
+ result.tm_year = yr >= 69 ? 1900 + yr : 2e3 + yr;
235
+ }
236
+ },
237
+ { code: "%m", regex: "(\\d{1,2})", handler: (m) => result.tm_mon = parseInt(m, 10) },
238
+ { code: "%d", regex: "(\\d{1,2})", handler: (m) => result.tm_mday = parseInt(m, 10) },
239
+ { code: "%H", regex: "(\\d{1,2})", handler: (m) => result.tm_hour = parseInt(m, 10) },
240
+ { code: "%I", regex: "(\\d{1,2})", handler: (m) => result.tm_hour = parseInt(m, 10) },
241
+ { code: "%M", regex: "(\\d{1,2})", handler: (m) => result.tm_min = parseInt(m, 10) },
242
+ { code: "%S", regex: "(\\d{1,2})", handler: (m) => result.tm_sec = parseInt(m, 10) },
243
+ {
244
+ code: "%p",
245
+ regex: "(AM|PM|am|pm)",
246
+ handler: (m) => {
247
+ if (m.toUpperCase() === "PM" && result.tm_hour !== void 0 && result.tm_hour < 12) {
248
+ result.tm_hour += 12;
249
+ } else if (m.toUpperCase() === "AM" && result.tm_hour === 12) {
250
+ result.tm_hour = 0;
251
+ }
252
+ }
253
+ },
254
+ {
255
+ code: "%b",
256
+ regex: "([A-Za-z]+)",
257
+ handler: (m) => {
258
+ const idx = monthsShort.indexOf(m.toLowerCase());
259
+ if (idx !== -1) result.tm_mon = idx + 1;
260
+ }
261
+ },
262
+ {
263
+ code: "%B",
264
+ regex: "([A-Za-z]+)",
265
+ handler: (m) => {
266
+ const idx = months.indexOf(m.toLowerCase());
267
+ if (idx !== -1) result.tm_mon = idx + 1;
268
+ }
269
+ },
270
+ { code: "%j", regex: "(\\d{1,3})", handler: (m) => result.tm_yday = parseInt(m, 10) },
271
+ { code: "%w", regex: "(\\d)", handler: (m) => result.tm_wday = (parseInt(m, 10) + 6) % 7 },
272
+ { code: "%%", regex: "%", handler: () => void 0 }
273
+ ];
274
+ const handlers = [];
275
+ for (const { code, regex, handler } of formatMap) {
276
+ const idx = pattern.indexOf(code.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
277
+ if (idx !== -1) {
278
+ pattern = pattern.replace(code.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), regex);
279
+ handlers.push(handler);
280
+ }
281
+ }
282
+ const match = new RegExp("^" + pattern + "$").exec(timeString);
283
+ if (!match) {
284
+ throw new Error(`time data '${timeString}' does not match format '${format}'`);
285
+ }
286
+ for (let i = 0; i < handlers.length; i++) {
287
+ if (match[i + 1] !== void 0) {
288
+ handlers[i]?.(match[i + 1] ?? "");
289
+ }
290
+ }
291
+ if (result.tm_year !== void 0 && result.tm_mon !== void 0 && result.tm_mday !== void 0) {
292
+ const date = new Date(result.tm_year, result.tm_mon - 1, result.tm_mday);
293
+ const jsDay = date.getDay();
294
+ result.tm_wday = jsDay === 0 ? 6 : jsDay - 1;
295
+ }
296
+ if (result.tm_year !== void 0 && result.tm_mon !== void 0 && result.tm_mday !== void 0) {
297
+ const date = new Date(result.tm_year, result.tm_mon - 1, result.tm_mday);
298
+ const startOfYear = new Date(result.tm_year, 0, 0);
299
+ const diff = date.getTime() - startOfYear.getTime();
300
+ const oneDay = 1e3 * 60 * 60 * 24;
301
+ result.tm_yday = Math.floor(diff / oneDay);
302
+ }
303
+ return result;
304
+ }
305
+ function asctime(t) {
306
+ return strftime("%a %b %d %H:%M:%S %Y", t);
307
+ }
308
+ function ctime(secs) {
309
+ return asctime(localtime(secs));
310
+ }
311
+ var timezone = (/* @__PURE__ */ new Date()).getTimezoneOffset() * 60;
312
+ var altzone = timezone;
313
+ var tzname = (() => {
314
+ const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
315
+ return [tz, tz];
316
+ })();
317
+ var daylight = 0;
318
+ function processTime() {
319
+ if (typeof performance !== "undefined") {
320
+ return performance.now() / 1e3;
321
+ }
322
+ return Date.now() / 1e3;
323
+ }
324
+ function processTimeNs() {
325
+ if (typeof performance !== "undefined") {
326
+ return BigInt(Math.floor(performance.now() * 1e6));
327
+ }
328
+ return BigInt(Date.now()) * 1000000n;
329
+ }
330
+ function threadTime() {
331
+ return processTime();
332
+ }
333
+ function threadTimeNs() {
334
+ return processTimeNs();
335
+ }
336
+
337
+ export {
338
+ time,
339
+ timeNs,
340
+ sleep,
341
+ perfCounter,
342
+ perfCounterNs,
343
+ monotonic,
344
+ monotonicNs,
345
+ localtime,
346
+ gmtime,
347
+ mktime,
348
+ strftime,
349
+ strptime,
350
+ asctime,
351
+ ctime,
352
+ timezone,
353
+ altzone,
354
+ tzname,
355
+ daylight,
356
+ processTime,
357
+ processTimeNs,
358
+ threadTime,
359
+ threadTimeNs,
360
+ time_exports
361
+ };
362
+ /* v8 ignore next -- browser fallback @preserve */
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __export
3
- } from "./chunk-PZ5AY32C.js";
3
+ } from "./chunk-MLKGABMK.js";
4
4
 
5
5
  // src/collections.ts
6
6
  var collections_exports = {};
@@ -214,4 +214,3 @@ export {
214
214
  collections_exports
215
215
  };
216
216
  /* v8 ignore next -- getter properties on Map fail with proxy receiver @preserve */
217
- //# sourceMappingURL=chunk-TAYRRHJ3.js.map
@@ -7,4 +7,3 @@ var __export = (target, all) => {
7
7
  export {
8
8
  __export
9
9
  };
10
- //# sourceMappingURL=chunk-PZ5AY32C.js.map