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,255 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-MLKGABMK.js";
4
+
5
+ // src/pathlib.browser.ts
6
+ var pathlib_browser_exports = {};
7
+ __export(pathlib_browser_exports, {
8
+ Path: () => Path,
9
+ PosixPath: () => PosixPath,
10
+ PurePath: () => PurePath,
11
+ PurePosixPath: () => PurePosixPath,
12
+ PureWindowsPath: () => PureWindowsPath,
13
+ WindowsPath: () => WindowsPath
14
+ });
15
+ var SEP = "/";
16
+ function basename(p) {
17
+ const normalized = p.replace(/\/+$/, "");
18
+ const idx = normalized.lastIndexOf(SEP);
19
+ return idx === -1 ? normalized : normalized.slice(idx + 1);
20
+ }
21
+ function dirname(p) {
22
+ const normalized = p.replace(/\/+$/, "");
23
+ const idx = normalized.lastIndexOf(SEP);
24
+ if (idx === -1) return "";
25
+ if (idx === 0) return SEP;
26
+ return normalized.slice(0, idx);
27
+ }
28
+ function extname(p) {
29
+ const base = basename(p);
30
+ const dotIdx = base.lastIndexOf(".");
31
+ if (dotIdx <= 0) return "";
32
+ return base.slice(dotIdx);
33
+ }
34
+ function join(...parts) {
35
+ return parts.filter(Boolean).join(SEP).replace(/\/+/g, "/");
36
+ }
37
+ function isAbsolute(p) {
38
+ return p.startsWith(SEP);
39
+ }
40
+ function normalize(p) {
41
+ if (!p) return ".";
42
+ const isAbs = isAbsolute(p);
43
+ const parts = p.split(SEP).filter(Boolean);
44
+ const result = [];
45
+ for (const part of parts) {
46
+ if (part === "..") {
47
+ if (result.length > 0 && result[result.length - 1] !== "..") {
48
+ result.pop();
49
+ } else if (!isAbs) {
50
+ result.push("..");
51
+ }
52
+ } else if (part !== ".") {
53
+ result.push(part);
54
+ }
55
+ }
56
+ const normalized = result.join(SEP);
57
+ if (isAbs) return SEP + normalized;
58
+ return normalized || ".";
59
+ }
60
+ var Path = class _Path {
61
+ _path;
62
+ constructor(...pathSegments) {
63
+ if (pathSegments.length === 0) {
64
+ this._path = ".";
65
+ } else {
66
+ this._path = join(...pathSegments);
67
+ }
68
+ }
69
+ static of(...pathSegments) {
70
+ return new _Path(...pathSegments);
71
+ }
72
+ get name() {
73
+ return basename(this._path);
74
+ }
75
+ get stem() {
76
+ const base = basename(this._path);
77
+ const ext = extname(base);
78
+ return ext ? base.slice(0, -ext.length) : base;
79
+ }
80
+ get suffix() {
81
+ return extname(this._path);
82
+ }
83
+ get suffixes() {
84
+ const name = this.name;
85
+ const suffixes = [];
86
+ let remaining = name;
87
+ let ext = extname(remaining);
88
+ while (ext) {
89
+ suffixes.unshift(ext);
90
+ remaining = remaining.slice(0, -ext.length);
91
+ ext = extname(remaining);
92
+ }
93
+ return suffixes;
94
+ }
95
+ get parent() {
96
+ const parentPath = dirname(this._path);
97
+ return new _Path(parentPath || ".");
98
+ }
99
+ get parents() {
100
+ const parents = [];
101
+ let current = this.parent;
102
+ while (current._path !== "." && current._path !== SEP) {
103
+ parents.push(current);
104
+ current = current.parent;
105
+ }
106
+ if (current._path === SEP) {
107
+ parents.push(current);
108
+ }
109
+ return parents;
110
+ }
111
+ get parts() {
112
+ const parts = [];
113
+ if (this._path.startsWith(SEP)) {
114
+ parts.push(SEP);
115
+ }
116
+ parts.push(...this._path.split(SEP).filter(Boolean));
117
+ return parts;
118
+ }
119
+ get anchor() {
120
+ return this._path.startsWith(SEP) ? SEP : "";
121
+ }
122
+ get root() {
123
+ return this.anchor;
124
+ }
125
+ isAbsolute() {
126
+ return isAbsolute(this._path);
127
+ }
128
+ isRelativeTo(other) {
129
+ const otherPath = other instanceof _Path ? other._path : other;
130
+ const normalizedThis = normalize(this._path);
131
+ const normalizedOther = normalize(otherPath);
132
+ return normalizedThis.startsWith(normalizedOther + SEP) || normalizedThis === normalizedOther;
133
+ }
134
+ joinpath(...pathSegments) {
135
+ const segments = pathSegments.map((p) => p instanceof _Path ? p._path : p);
136
+ return new _Path(this._path, ...segments);
137
+ }
138
+ div(other) {
139
+ return this.joinpath(other);
140
+ }
141
+ withName(name) {
142
+ return new _Path(dirname(this._path), name);
143
+ }
144
+ withStem(stem) {
145
+ return new _Path(dirname(this._path), stem + this.suffix);
146
+ }
147
+ withSuffix(suffix) {
148
+ return new _Path(dirname(this._path), this.stem + suffix);
149
+ }
150
+ toString() {
151
+ return this._path;
152
+ }
153
+ valueOf() {
154
+ return this._path;
155
+ }
156
+ [Symbol.toPrimitive](_hint) {
157
+ return this._path;
158
+ }
159
+ /* v8 ignore start -- browser stubs for filesystem operations @preserve */
160
+ /* eslint-disable @typescript-eslint/require-await */
161
+ async exists() {
162
+ return false;
163
+ }
164
+ async isFile() {
165
+ return false;
166
+ }
167
+ async isDir() {
168
+ return false;
169
+ }
170
+ async isSymlink() {
171
+ return false;
172
+ }
173
+ async stat() {
174
+ throw new Error("Path.stat is not supported in browser environment");
175
+ }
176
+ async lstat() {
177
+ throw new Error("Path.lstat is not supported in browser environment");
178
+ }
179
+ async readText(_encoding) {
180
+ throw new Error("Path.readText is not supported in browser environment");
181
+ }
182
+ async writeText(_content, _encoding) {
183
+ throw new Error("Path.writeText is not supported in browser environment");
184
+ }
185
+ async readBytes() {
186
+ throw new Error("Path.readBytes is not supported in browser environment");
187
+ }
188
+ async writeBytes(_content) {
189
+ throw new Error("Path.writeBytes is not supported in browser environment");
190
+ }
191
+ async mkdir(_options) {
192
+ throw new Error("Path.mkdir is not supported in browser environment");
193
+ }
194
+ async rmdir() {
195
+ throw new Error("Path.rmdir is not supported in browser environment");
196
+ }
197
+ async unlink() {
198
+ throw new Error("Path.unlink is not supported in browser environment");
199
+ }
200
+ async rename(_target) {
201
+ throw new Error("Path.rename is not supported in browser environment");
202
+ }
203
+ async replace(_target) {
204
+ throw new Error("Path.replace is not supported in browser environment");
205
+ }
206
+ resolve() {
207
+ return new _Path(normalize(this._path));
208
+ }
209
+ absolute() {
210
+ if (this.isAbsolute()) {
211
+ return this.resolve();
212
+ }
213
+ return new _Path(SEP + this._path).resolve();
214
+ }
215
+ async readlink() {
216
+ throw new Error("Path.readlink is not supported in browser environment");
217
+ }
218
+ async symlinkTo(_target) {
219
+ throw new Error("Path.symlinkTo is not supported in browser environment");
220
+ }
221
+ async linkTo(_target) {
222
+ throw new Error("Path.linkTo is not supported in browser environment");
223
+ }
224
+ async chmod(_mode) {
225
+ throw new Error("Path.chmod is not supported in browser environment");
226
+ }
227
+ async touch(_options) {
228
+ throw new Error("Path.touch is not supported in browser environment");
229
+ }
230
+ async iterdir() {
231
+ throw new Error("Path.iterdir is not supported in browser environment");
232
+ }
233
+ async glob(_pattern) {
234
+ return [];
235
+ }
236
+ async rglob(_pattern) {
237
+ return [];
238
+ }
239
+ /* v8 ignore stop */
240
+ };
241
+ var PurePath = Path;
242
+ var PurePosixPath = Path;
243
+ var PureWindowsPath = Path;
244
+ var PosixPath = Path;
245
+ var WindowsPath = Path;
246
+
247
+ export {
248
+ Path,
249
+ PurePath,
250
+ PurePosixPath,
251
+ PureWindowsPath,
252
+ PosixPath,
253
+ WindowsPath,
254
+ pathlib_browser_exports
255
+ };
@@ -0,0 +1,238 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-MLKGABMK.js";
4
+
5
+ // src/base64.ts
6
+ var base64_exports = {};
7
+ __export(base64_exports, {
8
+ a85decode: () => a85decode,
9
+ a85encode: () => a85encode,
10
+ b16decode: () => b16decode,
11
+ b16encode: () => b16encode,
12
+ b32decode: () => b32decode,
13
+ b32encode: () => b32encode,
14
+ b64decode: () => b64decode,
15
+ b64encode: () => b64encode,
16
+ b85decode: () => b85decode,
17
+ b85encode: () => b85encode,
18
+ decodeString: () => decodeString,
19
+ encodeString: () => encodeString,
20
+ standardB64decode: () => standardB64decode,
21
+ standardB64encode: () => standardB64encode,
22
+ urlsafeB64decode: () => urlsafeB64decode,
23
+ urlsafeB64encode: () => urlsafeB64encode
24
+ });
25
+ function uint8ArrayToBase64(bytes) {
26
+ if (typeof Buffer !== "undefined") {
27
+ return Buffer.from(bytes).toString("base64");
28
+ }
29
+ let binary = "";
30
+ for (const byte of bytes) {
31
+ binary += String.fromCharCode(byte);
32
+ }
33
+ return btoa(binary);
34
+ }
35
+ function base64ToUint8Array(base64) {
36
+ if (typeof Buffer !== "undefined") {
37
+ return new Uint8Array(Buffer.from(base64, "base64"));
38
+ }
39
+ const binary = atob(base64);
40
+ const bytes = new Uint8Array(binary.length);
41
+ for (let i = 0; i < binary.length; i++) {
42
+ bytes[i] = binary.charCodeAt(i);
43
+ }
44
+ return bytes;
45
+ }
46
+ function b64encode(s) {
47
+ const bytes = typeof s === "string" ? new TextEncoder().encode(s) : s;
48
+ const base64String = uint8ArrayToBase64(bytes);
49
+ return new TextEncoder().encode(base64String);
50
+ }
51
+ function b64decode(s) {
52
+ const base64String = typeof s === "string" ? s : new TextDecoder().decode(s);
53
+ const cleaned = base64String.replace(/\s/g, "");
54
+ return base64ToUint8Array(cleaned);
55
+ }
56
+ function standardB64encode(s) {
57
+ return b64encode(s);
58
+ }
59
+ function standardB64decode(s) {
60
+ return b64decode(s);
61
+ }
62
+ function urlsafeB64encode(s) {
63
+ const bytes = typeof s === "string" ? new TextEncoder().encode(s) : s;
64
+ const base64String = uint8ArrayToBase64(bytes);
65
+ const urlSafe = base64String.replace(/\+/g, "-").replace(/\//g, "_");
66
+ return new TextEncoder().encode(urlSafe);
67
+ }
68
+ function urlsafeB64decode(s) {
69
+ const base64String = typeof s === "string" ? s : new TextDecoder().decode(s);
70
+ const cleaned = base64String.replace(/\s/g, "").replace(/-/g, "+").replace(/_/g, "/");
71
+ const padding = (4 - cleaned.length % 4) % 4;
72
+ const padded = cleaned + "=".repeat(padding);
73
+ return base64ToUint8Array(padded);
74
+ }
75
+ function b16encode(s) {
76
+ const bytes = typeof s === "string" ? new TextEncoder().encode(s) : s;
77
+ let hex = "";
78
+ for (const byte of bytes) {
79
+ hex += byte.toString(16).padStart(2, "0").toUpperCase();
80
+ }
81
+ return new TextEncoder().encode(hex);
82
+ }
83
+ function b16decode(s) {
84
+ const hexString = typeof s === "string" ? s : new TextDecoder().decode(s);
85
+ const cleaned = hexString.replace(/\s/g, "");
86
+ if (cleaned.length % 2 !== 0) {
87
+ throw new Error("Non-hexadecimal digit found");
88
+ }
89
+ const bytes = new Uint8Array(cleaned.length / 2);
90
+ for (let i = 0; i < cleaned.length; i += 2) {
91
+ const byte = parseInt(cleaned.substring(i, i + 2), 16);
92
+ if (isNaN(byte)) {
93
+ throw new Error("Non-hexadecimal digit found");
94
+ }
95
+ bytes[i / 2] = byte;
96
+ }
97
+ return bytes;
98
+ }
99
+ function b32encode(s) {
100
+ const bytes = typeof s === "string" ? new TextEncoder().encode(s) : s;
101
+ const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
102
+ let result = "";
103
+ let bits = 0;
104
+ let value = 0;
105
+ for (const byte of bytes) {
106
+ value = value << 8 | byte;
107
+ bits += 8;
108
+ while (bits >= 5) {
109
+ bits -= 5;
110
+ const idx = value >> bits & 31;
111
+ result += alphabet[idx] ?? "";
112
+ }
113
+ }
114
+ if (bits > 0) {
115
+ const idx = value << 5 - bits & 31;
116
+ result += alphabet[idx] ?? "";
117
+ }
118
+ while (result.length % 8 !== 0) {
119
+ result += "=";
120
+ }
121
+ return new TextEncoder().encode(result);
122
+ }
123
+ function b32decode(s) {
124
+ const base32String = typeof s === "string" ? s : new TextDecoder().decode(s);
125
+ const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
126
+ const cleaned = base32String.replace(/=+$/, "").replace(/\s/g, "").toUpperCase();
127
+ let bits = 0;
128
+ let value = 0;
129
+ const result = [];
130
+ for (const char of cleaned) {
131
+ const idx = alphabet.indexOf(char);
132
+ if (idx === -1) {
133
+ throw new Error("Invalid Base32 character");
134
+ }
135
+ value = value << 5 | idx;
136
+ bits += 5;
137
+ if (bits >= 8) {
138
+ bits -= 8;
139
+ result.push(value >> bits & 255);
140
+ }
141
+ }
142
+ return new Uint8Array(result);
143
+ }
144
+ function a85encode(s) {
145
+ const bytes = typeof s === "string" ? new TextEncoder().encode(s) : s;
146
+ let result = "";
147
+ for (let i = 0; i < bytes.length; i += 4) {
148
+ const chunk = bytes.slice(i, i + 4);
149
+ let value = 0;
150
+ for (const byte of chunk) {
151
+ value = value * 256 + byte;
152
+ }
153
+ for (let j = chunk.length; j < 4; j++) {
154
+ value = value * 256;
155
+ }
156
+ if (value === 0 && chunk.length === 4) {
157
+ result += "z";
158
+ } else {
159
+ const chars = [];
160
+ for (let j = 0; j < 5; j++) {
161
+ chars.unshift(String.fromCharCode(value % 85 + 33));
162
+ value = Math.floor(value / 85);
163
+ }
164
+ const outputLen = chunk.length + 1;
165
+ result += chars.slice(0, outputLen).join("");
166
+ }
167
+ }
168
+ return new TextEncoder().encode(result);
169
+ }
170
+ function a85decode(s) {
171
+ const ascii85String = typeof s === "string" ? s : new TextDecoder().decode(s);
172
+ const cleaned = ascii85String.replace(/\s/g, "");
173
+ const result = [];
174
+ let i = 0;
175
+ while (i < cleaned.length) {
176
+ if (cleaned[i] === "z") {
177
+ result.push(0, 0, 0, 0);
178
+ i++;
179
+ } else {
180
+ let chunk = cleaned.slice(i, i + 5);
181
+ const chunkLen = chunk.length;
182
+ while (chunk.length < 5) {
183
+ chunk += "u";
184
+ }
185
+ let value = 0;
186
+ for (let j = 0; j < 5; j++) {
187
+ const charCode = chunk.charCodeAt(j) - 33;
188
+ if (charCode < 0 || charCode > 84) {
189
+ throw new Error("Invalid Ascii85 character");
190
+ }
191
+ value = value * 85 + charCode;
192
+ }
193
+ const bytes = [];
194
+ for (let j = 0; j < 4; j++) {
195
+ bytes.unshift(value & 255);
196
+ value = Math.floor(value / 256);
197
+ }
198
+ const outputLen = chunkLen - 1;
199
+ result.push(...bytes.slice(0, outputLen));
200
+ i += chunkLen;
201
+ }
202
+ }
203
+ return new Uint8Array(result);
204
+ }
205
+ function b85encode(s) {
206
+ return a85encode(s);
207
+ }
208
+ function b85decode(s) {
209
+ return a85decode(s);
210
+ }
211
+ function encodeString(s) {
212
+ const bytes = typeof s === "string" ? new TextEncoder().encode(s) : s;
213
+ return uint8ArrayToBase64(bytes);
214
+ }
215
+ function decodeString(s) {
216
+ return base64ToUint8Array(s);
217
+ }
218
+
219
+ export {
220
+ b64encode,
221
+ b64decode,
222
+ standardB64encode,
223
+ standardB64decode,
224
+ urlsafeB64encode,
225
+ urlsafeB64decode,
226
+ b16encode,
227
+ b16decode,
228
+ b32encode,
229
+ b32decode,
230
+ a85encode,
231
+ a85decode,
232
+ b85encode,
233
+ b85decode,
234
+ encodeString,
235
+ decodeString,
236
+ base64_exports
237
+ };
238
+ /* v8 ignore start -- browser fallback @preserve */