wcz-test 6.24.3 → 6.24.5

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 (43) hide show
  1. package/dist/chunks/{DialogsHooks-DOT0O_b4.js → DialogsHooks-DVnj8xmz.js} +178 -3
  2. package/dist/chunks/DialogsHooks-DVnj8xmz.js.map +1 -0
  3. package/dist/chunks/FileHooks-GprjzNKW.js +3554 -0
  4. package/dist/chunks/FileHooks-GprjzNKW.js.map +1 -0
  5. package/dist/chunks/RouterListItemButton-BvsZysDL.js +959 -0
  6. package/dist/chunks/RouterListItemButton-BvsZysDL.js.map +1 -0
  7. package/dist/chunks/_commonjsHelpers-BGn2FbsY.js +35 -0
  8. package/dist/chunks/_commonjsHelpers-BGn2FbsY.js.map +1 -0
  9. package/dist/chunks/env-Di2sjb5X.js +104 -0
  10. package/dist/chunks/env-Di2sjb5X.js.map +1 -0
  11. package/dist/chunks/i18next-Dx0Bahhj.js +2203 -0
  12. package/dist/chunks/i18next-Dx0Bahhj.js.map +1 -0
  13. package/dist/chunks/index-BrFiyyyk.js +327 -0
  14. package/dist/chunks/index-BrFiyyyk.js.map +1 -0
  15. package/dist/chunks/session-CPSUX_HJ.js +12970 -0
  16. package/dist/chunks/session-CPSUX_HJ.js.map +1 -0
  17. package/dist/chunks/useTranslation-D7I_DXWv.js +406 -0
  18. package/dist/chunks/useTranslation-D7I_DXWv.js.map +1 -0
  19. package/dist/chunks/utils-DtlCJSvY.js +2582 -0
  20. package/dist/chunks/utils-DtlCJSvY.js.map +1 -0
  21. package/dist/client.js +4 -4
  22. package/dist/components.js +2418 -7
  23. package/dist/components.js.map +1 -1
  24. package/dist/hooks.js +1011 -5
  25. package/dist/hooks.js.map +1 -1
  26. package/dist/index.js +448 -951
  27. package/dist/index.js.map +1 -1
  28. package/dist/queries.js +3 -3
  29. package/dist/server.js +5213 -4
  30. package/dist/server.js.map +1 -1
  31. package/dist/utils.js +5 -5
  32. package/package.json +1 -1
  33. package/dist/chunks/DialogsHooks-DOT0O_b4.js.map +0 -1
  34. package/dist/chunks/FileHooks-CF1bPDoe.js +0 -493
  35. package/dist/chunks/FileHooks-CF1bPDoe.js.map +0 -1
  36. package/dist/chunks/RouterListItemButton-DTYXk1kh.js +0 -35
  37. package/dist/chunks/RouterListItemButton-DTYXk1kh.js.map +0 -1
  38. package/dist/chunks/env-gsqZ6zZD.js +0 -30
  39. package/dist/chunks/env-gsqZ6zZD.js.map +0 -1
  40. package/dist/chunks/session-vW7WZadj.js +0 -91
  41. package/dist/chunks/session-vW7WZadj.js.map +0 -1
  42. package/dist/chunks/utils-MD9YwOtu.js +0 -91
  43. package/dist/chunks/utils-MD9YwOtu.js.map +0 -1
@@ -0,0 +1,327 @@
1
+ const DIGITS = "0123456789abcdef";
2
+ class UUID {
3
+ /** @param bytes - The 16-byte byte array representation. */
4
+ constructor(bytes) {
5
+ this.bytes = bytes;
6
+ }
7
+ /**
8
+ * Creates an object from the internal representation, a 16-byte byte array
9
+ * containing the binary UUID representation in the big-endian byte order.
10
+ *
11
+ * This method does NOT shallow-copy the argument, and thus the created object
12
+ * holds the reference to the underlying buffer.
13
+ *
14
+ * @throws TypeError if the length of the argument is not 16.
15
+ */
16
+ static ofInner(bytes) {
17
+ if (bytes.length !== 16) {
18
+ throw new TypeError("not 128-bit length");
19
+ } else {
20
+ return new UUID(bytes);
21
+ }
22
+ }
23
+ /**
24
+ * Builds a byte array from UUIDv7 field values.
25
+ *
26
+ * @param unixTsMs - A 48-bit `unix_ts_ms` field value.
27
+ * @param randA - A 12-bit `rand_a` field value.
28
+ * @param randBHi - The higher 30 bits of 62-bit `rand_b` field value.
29
+ * @param randBLo - The lower 32 bits of 62-bit `rand_b` field value.
30
+ * @throws RangeError if any field value is out of the specified range.
31
+ */
32
+ static fromFieldsV7(unixTsMs, randA, randBHi, randBLo) {
33
+ if (!Number.isInteger(unixTsMs) || !Number.isInteger(randA) || !Number.isInteger(randBHi) || !Number.isInteger(randBLo) || unixTsMs < 0 || randA < 0 || randBHi < 0 || randBLo < 0 || unixTsMs > 281474976710655 || randA > 4095 || randBHi > 1073741823 || randBLo > 4294967295) {
34
+ throw new RangeError("invalid field value");
35
+ }
36
+ const bytes = new Uint8Array(16);
37
+ bytes[0] = unixTsMs / 2 ** 40;
38
+ bytes[1] = unixTsMs / 2 ** 32;
39
+ bytes[2] = unixTsMs / 2 ** 24;
40
+ bytes[3] = unixTsMs / 2 ** 16;
41
+ bytes[4] = unixTsMs / 2 ** 8;
42
+ bytes[5] = unixTsMs;
43
+ bytes[6] = 112 | randA >>> 8;
44
+ bytes[7] = randA;
45
+ bytes[8] = 128 | randBHi >>> 24;
46
+ bytes[9] = randBHi >>> 16;
47
+ bytes[10] = randBHi >>> 8;
48
+ bytes[11] = randBHi;
49
+ bytes[12] = randBLo >>> 24;
50
+ bytes[13] = randBLo >>> 16;
51
+ bytes[14] = randBLo >>> 8;
52
+ bytes[15] = randBLo;
53
+ return new UUID(bytes);
54
+ }
55
+ /**
56
+ * Builds a byte array from a string representation.
57
+ *
58
+ * This method accepts the following formats:
59
+ *
60
+ * - 32-digit hexadecimal format without hyphens: `0189dcd553117d408db09496a2eef37b`
61
+ * - 8-4-4-4-12 hyphenated format: `0189dcd5-5311-7d40-8db0-9496a2eef37b`
62
+ * - Hyphenated format with surrounding braces: `{0189dcd5-5311-7d40-8db0-9496a2eef37b}`
63
+ * - RFC 9562 URN format: `urn:uuid:0189dcd5-5311-7d40-8db0-9496a2eef37b`
64
+ *
65
+ * Leading and trailing whitespaces represents an error.
66
+ *
67
+ * @throws SyntaxError if the argument could not parse as a valid UUID string.
68
+ */
69
+ static parse(uuid) {
70
+ var _a, _b, _c, _d;
71
+ let hex = void 0;
72
+ switch (uuid.length) {
73
+ case 32:
74
+ hex = (_a = /^[0-9a-f]{32}$/i.exec(uuid)) === null || _a === void 0 ? void 0 : _a[0];
75
+ break;
76
+ case 36:
77
+ hex = (_b = /^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(uuid)) === null || _b === void 0 ? void 0 : _b.slice(1, 6).join("");
78
+ break;
79
+ case 38:
80
+ hex = (_c = /^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(uuid)) === null || _c === void 0 ? void 0 : _c.slice(1, 6).join("");
81
+ break;
82
+ case 45:
83
+ hex = (_d = /^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(uuid)) === null || _d === void 0 ? void 0 : _d.slice(1, 6).join("");
84
+ break;
85
+ }
86
+ if (hex) {
87
+ const inner = new Uint8Array(16);
88
+ for (let i = 0; i < 16; i += 4) {
89
+ const n = parseInt(hex.substring(2 * i, 2 * i + 8), 16);
90
+ inner[i + 0] = n >>> 24;
91
+ inner[i + 1] = n >>> 16;
92
+ inner[i + 2] = n >>> 8;
93
+ inner[i + 3] = n;
94
+ }
95
+ return new UUID(inner);
96
+ } else {
97
+ throw new SyntaxError("could not parse UUID string");
98
+ }
99
+ }
100
+ /**
101
+ * @returns The 8-4-4-4-12 canonical hexadecimal string representation
102
+ * (`0189dcd5-5311-7d40-8db0-9496a2eef37b`).
103
+ */
104
+ toString() {
105
+ let text = "";
106
+ for (let i = 0; i < this.bytes.length; i++) {
107
+ text += DIGITS.charAt(this.bytes[i] >>> 4);
108
+ text += DIGITS.charAt(this.bytes[i] & 15);
109
+ if (i === 3 || i === 5 || i === 7 || i === 9) {
110
+ text += "-";
111
+ }
112
+ }
113
+ return text;
114
+ }
115
+ /**
116
+ * @returns The 32-digit hexadecimal representation without hyphens
117
+ * (`0189dcd553117d408db09496a2eef37b`).
118
+ */
119
+ toHex() {
120
+ let text = "";
121
+ for (let i = 0; i < this.bytes.length; i++) {
122
+ text += DIGITS.charAt(this.bytes[i] >>> 4);
123
+ text += DIGITS.charAt(this.bytes[i] & 15);
124
+ }
125
+ return text;
126
+ }
127
+ /** @returns The 8-4-4-4-12 canonical hexadecimal string representation. */
128
+ toJSON() {
129
+ return this.toString();
130
+ }
131
+ /**
132
+ * Reports the variant field value of the UUID or, if appropriate, "NIL" or
133
+ * "MAX".
134
+ *
135
+ * For convenience, this method reports "NIL" or "MAX" if `this` represents
136
+ * the Nil or Max UUID, although the Nil and Max UUIDs are technically
137
+ * subsumed under the variants `0b0` and `0b111`, respectively.
138
+ */
139
+ getVariant() {
140
+ const n = this.bytes[8] >>> 4;
141
+ if (n < 0) {
142
+ throw new Error("unreachable");
143
+ } else if (n <= 7) {
144
+ return this.bytes.every((e) => e === 0) ? "NIL" : "VAR_0";
145
+ } else if (n <= 11) {
146
+ return "VAR_10";
147
+ } else if (n <= 13) {
148
+ return "VAR_110";
149
+ } else if (n <= 15) {
150
+ return this.bytes.every((e) => e === 255) ? "MAX" : "VAR_RESERVED";
151
+ } else {
152
+ throw new Error("unreachable");
153
+ }
154
+ }
155
+ /**
156
+ * Returns the version field value of the UUID or `undefined` if the UUID does
157
+ * not have the variant field value of `0b10`.
158
+ */
159
+ getVersion() {
160
+ return this.getVariant() === "VAR_10" ? this.bytes[6] >>> 4 : void 0;
161
+ }
162
+ /** Creates an object from `this`. */
163
+ clone() {
164
+ return new UUID(this.bytes.slice(0));
165
+ }
166
+ /** Returns true if `this` is equivalent to `other`. */
167
+ equals(other) {
168
+ return this.compareTo(other) === 0;
169
+ }
170
+ /**
171
+ * Returns a negative integer, zero, or positive integer if `this` is less
172
+ * than, equal to, or greater than `other`, respectively.
173
+ */
174
+ compareTo(other) {
175
+ for (let i = 0; i < 16; i++) {
176
+ const diff = this.bytes[i] - other.bytes[i];
177
+ if (diff !== 0) {
178
+ return Math.sign(diff);
179
+ }
180
+ }
181
+ return 0;
182
+ }
183
+ }
184
+ class V7Generator {
185
+ /**
186
+ * Creates a generator object with the default random number generator, or
187
+ * with the specified one if passed as an argument. The specified random
188
+ * number generator should be cryptographically strong and securely seeded.
189
+ */
190
+ constructor(randomNumberGenerator) {
191
+ this.timestamp_biased = 0;
192
+ this.counter = 0;
193
+ this.random = randomNumberGenerator !== null && randomNumberGenerator !== void 0 ? randomNumberGenerator : getDefaultRandom();
194
+ }
195
+ /**
196
+ * Generates a new UUIDv7 object from the current timestamp, or resets the
197
+ * generator upon significant timestamp rollback.
198
+ *
199
+ * This method returns a monotonically increasing UUID by reusing the previous
200
+ * timestamp even if the up-to-date timestamp is smaller than the immediately
201
+ * preceding UUID's. However, when such a clock rollback is considered
202
+ * significant (i.e., by more than ten seconds), this method resets the
203
+ * generator and returns a new UUID based on the given timestamp, breaking the
204
+ * increasing order of UUIDs.
205
+ *
206
+ * See {@link generateOrAbort} for the other mode of generation and
207
+ * {@link generateOrResetCore} for the low-level primitive.
208
+ */
209
+ generate() {
210
+ return this.generateOrResetCore(Date.now(), 1e4);
211
+ }
212
+ /**
213
+ * Generates a new UUIDv7 object from the current timestamp, or returns
214
+ * `undefined` upon significant timestamp rollback.
215
+ *
216
+ * This method returns a monotonically increasing UUID by reusing the previous
217
+ * timestamp even if the up-to-date timestamp is smaller than the immediately
218
+ * preceding UUID's. However, when such a clock rollback is considered
219
+ * significant (i.e., by more than ten seconds), this method aborts and
220
+ * returns `undefined` immediately.
221
+ *
222
+ * See {@link generate} for the other mode of generation and
223
+ * {@link generateOrAbortCore} for the low-level primitive.
224
+ */
225
+ generateOrAbort() {
226
+ return this.generateOrAbortCore(Date.now(), 1e4);
227
+ }
228
+ /**
229
+ * Generates a new UUIDv7 object from the `unixTsMs` passed, or resets the
230
+ * generator upon significant timestamp rollback.
231
+ *
232
+ * This method is equivalent to {@link generate} except that it takes a custom
233
+ * timestamp and clock rollback allowance.
234
+ *
235
+ * @param rollbackAllowance - The amount of `unixTsMs` rollback that is
236
+ * considered significant. A suggested value is `10_000` (milliseconds).
237
+ * @throws RangeError if `unixTsMs` is not a 48-bit unsigned integer.
238
+ */
239
+ generateOrResetCore(unixTsMs, rollbackAllowance) {
240
+ let value = this.generateOrAbortCore(unixTsMs, rollbackAllowance);
241
+ if (value === void 0) {
242
+ this.timestamp_biased = 0;
243
+ value = this.generateOrAbortCore(unixTsMs, rollbackAllowance);
244
+ }
245
+ return value;
246
+ }
247
+ /**
248
+ * Generates a new UUIDv7 object from the `unixTsMs` passed, or returns
249
+ * `undefined` upon significant timestamp rollback.
250
+ *
251
+ * This method is equivalent to {@link generateOrAbort} except that it takes a
252
+ * custom timestamp and clock rollback allowance.
253
+ *
254
+ * @param rollbackAllowance - The amount of `unixTsMs` rollback that is
255
+ * considered significant. A suggested value is `10_000` (milliseconds).
256
+ * @throws RangeError if `unixTsMs` is not a 48-bit unsigned integer.
257
+ */
258
+ generateOrAbortCore(unixTsMs, rollbackAllowance) {
259
+ const MAX_COUNTER = 4398046511103;
260
+ if (!Number.isInteger(unixTsMs) || unixTsMs < 0 || unixTsMs > 281474976710655) {
261
+ throw new RangeError("`unixTsMs` must be a 48-bit unsigned integer");
262
+ } else if (rollbackAllowance < 0 || rollbackAllowance > 281474976710655) {
263
+ throw new RangeError("`rollbackAllowance` out of reasonable range");
264
+ }
265
+ unixTsMs++;
266
+ if (unixTsMs > this.timestamp_biased) {
267
+ this.timestamp_biased = unixTsMs;
268
+ this.resetCounter();
269
+ } else if (unixTsMs + rollbackAllowance >= this.timestamp_biased) {
270
+ this.counter++;
271
+ if (this.counter > MAX_COUNTER) {
272
+ this.timestamp_biased++;
273
+ this.resetCounter();
274
+ }
275
+ } else {
276
+ return void 0;
277
+ }
278
+ return UUID.fromFieldsV7(this.timestamp_biased - 1, Math.trunc(this.counter / 2 ** 30), this.counter & 2 ** 30 - 1, this.random.nextUint32());
279
+ }
280
+ /** Initializes the counter at a 42-bit random integer. */
281
+ resetCounter() {
282
+ this.counter = this.random.nextUint32() * 1024 + (this.random.nextUint32() & 1023);
283
+ }
284
+ /**
285
+ * Generates a new UUIDv4 object utilizing the random number generator inside.
286
+ *
287
+ * @internal
288
+ */
289
+ generateV4() {
290
+ const bytes = new Uint8Array(Uint32Array.of(this.random.nextUint32(), this.random.nextUint32(), this.random.nextUint32(), this.random.nextUint32()).buffer);
291
+ bytes[6] = 64 | bytes[6] >>> 4;
292
+ bytes[8] = 128 | bytes[8] >>> 2;
293
+ return UUID.ofInner(bytes);
294
+ }
295
+ }
296
+ const getDefaultRandom = () => {
297
+ if (typeof crypto !== "undefined" && typeof crypto.getRandomValues !== "undefined") {
298
+ return new BufferedCryptoRandom();
299
+ } else {
300
+ if (typeof UUIDV7_DENY_WEAK_RNG !== "undefined" && UUIDV7_DENY_WEAK_RNG) {
301
+ throw new Error("no cryptographically strong RNG available");
302
+ }
303
+ return {
304
+ nextUint32: () => Math.trunc(Math.random() * 65536) * 65536 + Math.trunc(Math.random() * 65536)
305
+ };
306
+ }
307
+ };
308
+ class BufferedCryptoRandom {
309
+ constructor() {
310
+ this.buffer = new Uint32Array(8);
311
+ this.cursor = 65535;
312
+ }
313
+ nextUint32() {
314
+ if (this.cursor >= this.buffer.length) {
315
+ crypto.getRandomValues(this.buffer);
316
+ this.cursor = 0;
317
+ }
318
+ return this.buffer[this.cursor++];
319
+ }
320
+ }
321
+ let defaultGenerator;
322
+ const uuidv7 = () => uuidv7obj().toString();
323
+ const uuidv7obj = () => (defaultGenerator || (defaultGenerator = new V7Generator())).generate();
324
+ export {
325
+ uuidv7 as u
326
+ };
327
+ //# sourceMappingURL=index-BrFiyyyk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BrFiyyyk.js","sources":["../../node_modules/uuidv7/dist/index.js"],"sourcesContent":["/**\n * uuidv7: A JavaScript implementation of UUID version 7\n *\n * Copyright 2021-2025 LiosK\n *\n * @license Apache-2.0\n * @packageDocumentation\n */\nconst DIGITS = \"0123456789abcdef\";\n/** Represents a UUID as a 16-byte byte array. */\nexport class UUID {\n /** @param bytes - The 16-byte byte array representation. */\n constructor(bytes) {\n this.bytes = bytes;\n }\n /**\n * Creates an object from the internal representation, a 16-byte byte array\n * containing the binary UUID representation in the big-endian byte order.\n *\n * This method does NOT shallow-copy the argument, and thus the created object\n * holds the reference to the underlying buffer.\n *\n * @throws TypeError if the length of the argument is not 16.\n */\n static ofInner(bytes) {\n if (bytes.length !== 16) {\n throw new TypeError(\"not 128-bit length\");\n }\n else {\n return new UUID(bytes);\n }\n }\n /**\n * Builds a byte array from UUIDv7 field values.\n *\n * @param unixTsMs - A 48-bit `unix_ts_ms` field value.\n * @param randA - A 12-bit `rand_a` field value.\n * @param randBHi - The higher 30 bits of 62-bit `rand_b` field value.\n * @param randBLo - The lower 32 bits of 62-bit `rand_b` field value.\n * @throws RangeError if any field value is out of the specified range.\n */\n static fromFieldsV7(unixTsMs, randA, randBHi, randBLo) {\n if (!Number.isInteger(unixTsMs) ||\n !Number.isInteger(randA) ||\n !Number.isInteger(randBHi) ||\n !Number.isInteger(randBLo) ||\n unixTsMs < 0 ||\n randA < 0 ||\n randBHi < 0 ||\n randBLo < 0 ||\n unixTsMs > 281474976710655 ||\n randA > 0xfff ||\n randBHi > 1073741823 ||\n randBLo > 4294967295) {\n throw new RangeError(\"invalid field value\");\n }\n const bytes = new Uint8Array(16);\n bytes[0] = unixTsMs / 2 ** 40;\n bytes[1] = unixTsMs / 2 ** 32;\n bytes[2] = unixTsMs / 2 ** 24;\n bytes[3] = unixTsMs / 2 ** 16;\n bytes[4] = unixTsMs / 2 ** 8;\n bytes[5] = unixTsMs;\n bytes[6] = 0x70 | (randA >>> 8);\n bytes[7] = randA;\n bytes[8] = 0x80 | (randBHi >>> 24);\n bytes[9] = randBHi >>> 16;\n bytes[10] = randBHi >>> 8;\n bytes[11] = randBHi;\n bytes[12] = randBLo >>> 24;\n bytes[13] = randBLo >>> 16;\n bytes[14] = randBLo >>> 8;\n bytes[15] = randBLo;\n return new UUID(bytes);\n }\n /**\n * Builds a byte array from a string representation.\n *\n * This method accepts the following formats:\n *\n * - 32-digit hexadecimal format without hyphens: `0189dcd553117d408db09496a2eef37b`\n * - 8-4-4-4-12 hyphenated format: `0189dcd5-5311-7d40-8db0-9496a2eef37b`\n * - Hyphenated format with surrounding braces: `{0189dcd5-5311-7d40-8db0-9496a2eef37b}`\n * - RFC 9562 URN format: `urn:uuid:0189dcd5-5311-7d40-8db0-9496a2eef37b`\n *\n * Leading and trailing whitespaces represents an error.\n *\n * @throws SyntaxError if the argument could not parse as a valid UUID string.\n */\n static parse(uuid) {\n var _a, _b, _c, _d;\n let hex = undefined;\n switch (uuid.length) {\n case 32:\n hex = (_a = /^[0-9a-f]{32}$/i.exec(uuid)) === null || _a === void 0 ? void 0 : _a[0];\n break;\n case 36:\n hex =\n (_b = /^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i\n .exec(uuid)) === null || _b === void 0 ? void 0 : _b.slice(1, 6).join(\"\");\n break;\n case 38:\n hex =\n (_c = /^\\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\\}$/i\n .exec(uuid)) === null || _c === void 0 ? void 0 : _c.slice(1, 6).join(\"\");\n break;\n case 45:\n hex =\n (_d = /^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i\n .exec(uuid)) === null || _d === void 0 ? void 0 : _d.slice(1, 6).join(\"\");\n break;\n default:\n break;\n }\n if (hex) {\n const inner = new Uint8Array(16);\n for (let i = 0; i < 16; i += 4) {\n const n = parseInt(hex.substring(2 * i, 2 * i + 8), 16);\n inner[i + 0] = n >>> 24;\n inner[i + 1] = n >>> 16;\n inner[i + 2] = n >>> 8;\n inner[i + 3] = n;\n }\n return new UUID(inner);\n }\n else {\n throw new SyntaxError(\"could not parse UUID string\");\n }\n }\n /**\n * @returns The 8-4-4-4-12 canonical hexadecimal string representation\n * (`0189dcd5-5311-7d40-8db0-9496a2eef37b`).\n */\n toString() {\n let text = \"\";\n for (let i = 0; i < this.bytes.length; i++) {\n text += DIGITS.charAt(this.bytes[i] >>> 4);\n text += DIGITS.charAt(this.bytes[i] & 0xf);\n if (i === 3 || i === 5 || i === 7 || i === 9) {\n text += \"-\";\n }\n }\n return text;\n }\n /**\n * @returns The 32-digit hexadecimal representation without hyphens\n * (`0189dcd553117d408db09496a2eef37b`).\n */\n toHex() {\n let text = \"\";\n for (let i = 0; i < this.bytes.length; i++) {\n text += DIGITS.charAt(this.bytes[i] >>> 4);\n text += DIGITS.charAt(this.bytes[i] & 0xf);\n }\n return text;\n }\n /** @returns The 8-4-4-4-12 canonical hexadecimal string representation. */\n toJSON() {\n return this.toString();\n }\n /**\n * Reports the variant field value of the UUID or, if appropriate, \"NIL\" or\n * \"MAX\".\n *\n * For convenience, this method reports \"NIL\" or \"MAX\" if `this` represents\n * the Nil or Max UUID, although the Nil and Max UUIDs are technically\n * subsumed under the variants `0b0` and `0b111`, respectively.\n */\n getVariant() {\n const n = this.bytes[8] >>> 4;\n if (n < 0) {\n throw new Error(\"unreachable\");\n }\n else if (n <= 0b0111) {\n return this.bytes.every((e) => e === 0) ? \"NIL\" : \"VAR_0\";\n }\n else if (n <= 0b1011) {\n return \"VAR_10\";\n }\n else if (n <= 0b1101) {\n return \"VAR_110\";\n }\n else if (n <= 0b1111) {\n return this.bytes.every((e) => e === 0xff) ? \"MAX\" : \"VAR_RESERVED\";\n }\n else {\n throw new Error(\"unreachable\");\n }\n }\n /**\n * Returns the version field value of the UUID or `undefined` if the UUID does\n * not have the variant field value of `0b10`.\n */\n getVersion() {\n return this.getVariant() === \"VAR_10\" ? this.bytes[6] >>> 4 : undefined;\n }\n /** Creates an object from `this`. */\n clone() {\n return new UUID(this.bytes.slice(0));\n }\n /** Returns true if `this` is equivalent to `other`. */\n equals(other) {\n return this.compareTo(other) === 0;\n }\n /**\n * Returns a negative integer, zero, or positive integer if `this` is less\n * than, equal to, or greater than `other`, respectively.\n */\n compareTo(other) {\n for (let i = 0; i < 16; i++) {\n const diff = this.bytes[i] - other.bytes[i];\n if (diff !== 0) {\n return Math.sign(diff);\n }\n }\n return 0;\n }\n}\n/**\n * Encapsulates the monotonic counter state.\n *\n * This class provides APIs to utilize a separate counter state from that of the\n * global generator used by {@link uuidv7} and {@link uuidv7obj}. In addition to\n * the default {@link generate} method, this class has {@link generateOrAbort}\n * that is useful to absolutely guarantee the monotonically increasing order of\n * generated UUIDs. See their respective documentation for details.\n */\nexport class V7Generator {\n /**\n * Creates a generator object with the default random number generator, or\n * with the specified one if passed as an argument. The specified random\n * number generator should be cryptographically strong and securely seeded.\n */\n constructor(randomNumberGenerator) {\n /**\n * Biased by one to distinguish zero (uninitialized) and zero (UNIX epoch).\n */\n this.timestamp_biased = 0;\n this.counter = 0;\n this.random = randomNumberGenerator !== null && randomNumberGenerator !== void 0 ? randomNumberGenerator : getDefaultRandom();\n }\n /**\n * Generates a new UUIDv7 object from the current timestamp, or resets the\n * generator upon significant timestamp rollback.\n *\n * This method returns a monotonically increasing UUID by reusing the previous\n * timestamp even if the up-to-date timestamp is smaller than the immediately\n * preceding UUID's. However, when such a clock rollback is considered\n * significant (i.e., by more than ten seconds), this method resets the\n * generator and returns a new UUID based on the given timestamp, breaking the\n * increasing order of UUIDs.\n *\n * See {@link generateOrAbort} for the other mode of generation and\n * {@link generateOrResetCore} for the low-level primitive.\n */\n generate() {\n return this.generateOrResetCore(Date.now(), 10000);\n }\n /**\n * Generates a new UUIDv7 object from the current timestamp, or returns\n * `undefined` upon significant timestamp rollback.\n *\n * This method returns a monotonically increasing UUID by reusing the previous\n * timestamp even if the up-to-date timestamp is smaller than the immediately\n * preceding UUID's. However, when such a clock rollback is considered\n * significant (i.e., by more than ten seconds), this method aborts and\n * returns `undefined` immediately.\n *\n * See {@link generate} for the other mode of generation and\n * {@link generateOrAbortCore} for the low-level primitive.\n */\n generateOrAbort() {\n return this.generateOrAbortCore(Date.now(), 10000);\n }\n /**\n * Generates a new UUIDv7 object from the `unixTsMs` passed, or resets the\n * generator upon significant timestamp rollback.\n *\n * This method is equivalent to {@link generate} except that it takes a custom\n * timestamp and clock rollback allowance.\n *\n * @param rollbackAllowance - The amount of `unixTsMs` rollback that is\n * considered significant. A suggested value is `10_000` (milliseconds).\n * @throws RangeError if `unixTsMs` is not a 48-bit unsigned integer.\n */\n generateOrResetCore(unixTsMs, rollbackAllowance) {\n let value = this.generateOrAbortCore(unixTsMs, rollbackAllowance);\n if (value === undefined) {\n // reset state and resume\n this.timestamp_biased = 0;\n value = this.generateOrAbortCore(unixTsMs, rollbackAllowance);\n }\n return value;\n }\n /**\n * Generates a new UUIDv7 object from the `unixTsMs` passed, or returns\n * `undefined` upon significant timestamp rollback.\n *\n * This method is equivalent to {@link generateOrAbort} except that it takes a\n * custom timestamp and clock rollback allowance.\n *\n * @param rollbackAllowance - The amount of `unixTsMs` rollback that is\n * considered significant. A suggested value is `10_000` (milliseconds).\n * @throws RangeError if `unixTsMs` is not a 48-bit unsigned integer.\n */\n generateOrAbortCore(unixTsMs, rollbackAllowance) {\n const MAX_COUNTER = 4398046511103;\n if (!Number.isInteger(unixTsMs) ||\n unixTsMs < 0 ||\n unixTsMs > 281474976710655) {\n throw new RangeError(\"`unixTsMs` must be a 48-bit unsigned integer\");\n }\n else if (rollbackAllowance < 0 || rollbackAllowance > 281474976710655) {\n throw new RangeError(\"`rollbackAllowance` out of reasonable range\");\n }\n unixTsMs++;\n if (unixTsMs > this.timestamp_biased) {\n this.timestamp_biased = unixTsMs;\n this.resetCounter();\n }\n else if (unixTsMs + rollbackAllowance >= this.timestamp_biased) {\n // go on with previous timestamp if new one is not much smaller\n this.counter++;\n if (this.counter > MAX_COUNTER) {\n // increment timestamp at counter overflow\n this.timestamp_biased++;\n this.resetCounter();\n }\n }\n else {\n // abort if clock went backwards to unbearable extent\n return undefined;\n }\n return UUID.fromFieldsV7(this.timestamp_biased - 1, Math.trunc(this.counter / 2 ** 30), this.counter & (2 ** 30 - 1), this.random.nextUint32());\n }\n /** Initializes the counter at a 42-bit random integer. */\n resetCounter() {\n this.counter =\n this.random.nextUint32() * 0x400 + (this.random.nextUint32() & 0x3ff);\n }\n /**\n * Generates a new UUIDv4 object utilizing the random number generator inside.\n *\n * @internal\n */\n generateV4() {\n const bytes = new Uint8Array(Uint32Array.of(this.random.nextUint32(), this.random.nextUint32(), this.random.nextUint32(), this.random.nextUint32()).buffer);\n bytes[6] = 0x40 | (bytes[6] >>> 4);\n bytes[8] = 0x80 | (bytes[8] >>> 2);\n return UUID.ofInner(bytes);\n }\n}\n/** Returns the default random number generator available in the environment. */\nconst getDefaultRandom = () => {\n // detect Web Crypto API\n if (typeof crypto !== \"undefined\" &&\n typeof crypto.getRandomValues !== \"undefined\") {\n return new BufferedCryptoRandom();\n }\n else {\n // fall back on Math.random() unless the flag is set to true\n if (typeof UUIDV7_DENY_WEAK_RNG !== \"undefined\" && UUIDV7_DENY_WEAK_RNG) {\n throw new Error(\"no cryptographically strong RNG available\");\n }\n return {\n nextUint32: () => Math.trunc(Math.random() * 65536) * 65536 +\n Math.trunc(Math.random() * 65536),\n };\n }\n};\n/**\n * Wraps `crypto.getRandomValues()` to enable buffering; this uses a small\n * buffer by default to avoid both unbearable throughput decline in some\n * environments and the waste of time and space for unused values.\n */\nclass BufferedCryptoRandom {\n constructor() {\n this.buffer = new Uint32Array(8);\n this.cursor = 0xffff;\n }\n nextUint32() {\n if (this.cursor >= this.buffer.length) {\n crypto.getRandomValues(this.buffer);\n this.cursor = 0;\n }\n return this.buffer[this.cursor++];\n }\n}\nlet defaultGenerator;\n/**\n * Generates a UUIDv7 string.\n *\n * @returns The 8-4-4-4-12 canonical hexadecimal string representation\n * (\"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\").\n */\nexport const uuidv7 = () => uuidv7obj().toString();\n/** Generates a UUIDv7 object. */\nexport const uuidv7obj = () => (defaultGenerator || (defaultGenerator = new V7Generator())).generate();\n/**\n * Generates a UUIDv4 string.\n *\n * @returns The 8-4-4-4-12 canonical hexadecimal string representation\n * (\"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\").\n */\nexport const uuidv4 = () => uuidv4obj().toString();\n/** Generates a UUIDv4 object. */\nexport const uuidv4obj = () => (defaultGenerator || (defaultGenerator = new V7Generator())).generateV4();\n"],"names":[],"mappings":"AAQA,MAAM,SAAS;AAER,MAAM,KAAK;AAAA;AAAA,EAEd,YAAY,OAAO;AACf,SAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,OAAO,QAAQ,OAAO;AAClB,QAAI,MAAM,WAAW,IAAI;AACrB,YAAM,IAAI,UAAU,oBAAoB;AAAA,IAC5C,OACK;AACD,aAAO,IAAI,KAAK,KAAK;AAAA,IACzB;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,OAAO,aAAa,UAAU,OAAO,SAAS,SAAS;AACnD,QAAI,CAAC,OAAO,UAAU,QAAQ,KAC1B,CAAC,OAAO,UAAU,KAAK,KACvB,CAAC,OAAO,UAAU,OAAO,KACzB,CAAC,OAAO,UAAU,OAAO,KACzB,WAAW,KACX,QAAQ,KACR,UAAU,KACV,UAAU,KACV,WAAW,mBACX,QAAQ,QACR,UAAU,cACV,UAAU,YAAY;AACtB,YAAM,IAAI,WAAW,qBAAqB;AAAA,IAC9C;AACA,UAAM,QAAQ,IAAI,WAAW,EAAE;AAC/B,UAAM,CAAC,IAAI,WAAW,KAAK;AAC3B,UAAM,CAAC,IAAI,WAAW,KAAK;AAC3B,UAAM,CAAC,IAAI,WAAW,KAAK;AAC3B,UAAM,CAAC,IAAI,WAAW,KAAK;AAC3B,UAAM,CAAC,IAAI,WAAW,KAAK;AAC3B,UAAM,CAAC,IAAI;AACX,UAAM,CAAC,IAAI,MAAQ,UAAU;AAC7B,UAAM,CAAC,IAAI;AACX,UAAM,CAAC,IAAI,MAAQ,YAAY;AAC/B,UAAM,CAAC,IAAI,YAAY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