@aidc-toolkit/utility 1.0.24-beta → 1.0.26-beta

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 (72) hide show
  1. package/dist/character-set.d.ts +308 -0
  2. package/dist/character-set.d.ts.map +1 -0
  3. package/dist/character-set.js +564 -0
  4. package/dist/character-set.js.map +1 -0
  5. package/dist/exclusion.d.ts +26 -0
  6. package/dist/exclusion.d.ts.map +1 -0
  7. package/dist/exclusion.js +18 -0
  8. package/dist/exclusion.js.map +1 -0
  9. package/dist/index.d.ts +26 -947
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +8 -3504
  12. package/dist/index.js.map +1 -1
  13. package/dist/iterable-utility.d.ts +39 -0
  14. package/dist/iterable-utility.d.ts.map +1 -0
  15. package/dist/iterable-utility.js +35 -0
  16. package/dist/iterable-utility.js.map +1 -0
  17. package/dist/locale/en/locale-resources.d.ts +33 -0
  18. package/dist/locale/en/locale-resources.d.ts.map +1 -0
  19. package/dist/locale/en/locale-resources.js +32 -0
  20. package/dist/locale/en/locale-resources.js.map +1 -0
  21. package/dist/locale/fr/locale-resources.d.ts +33 -0
  22. package/dist/locale/fr/locale-resources.d.ts.map +1 -0
  23. package/dist/locale/fr/locale-resources.js +32 -0
  24. package/dist/locale/fr/locale-resources.js.map +1 -0
  25. package/dist/locale/i18n.d.ts +27 -0
  26. package/dist/locale/i18n.d.ts.map +1 -0
  27. package/dist/locale/i18n.js +34 -0
  28. package/dist/locale/i18n.js.map +1 -0
  29. package/dist/record.d.ts +44 -0
  30. package/dist/record.d.ts.map +1 -0
  31. package/dist/record.js +58 -0
  32. package/dist/record.js.map +1 -0
  33. package/dist/reg-exp.d.ts +43 -0
  34. package/dist/reg-exp.d.ts.map +1 -0
  35. package/dist/reg-exp.js +55 -0
  36. package/dist/reg-exp.js.map +1 -0
  37. package/dist/sequence.d.ts +68 -0
  38. package/dist/sequence.d.ts.map +1 -0
  39. package/dist/sequence.js +96 -0
  40. package/dist/sequence.js.map +1 -0
  41. package/dist/string.d.ts +25 -0
  42. package/dist/string.d.ts.map +1 -0
  43. package/dist/string.js +2 -0
  44. package/dist/string.js.map +1 -0
  45. package/dist/transformer.d.ts +347 -0
  46. package/dist/transformer.d.ts.map +1 -0
  47. package/dist/transformer.js +457 -0
  48. package/dist/transformer.js.map +1 -0
  49. package/package.json +11 -7
  50. package/src/character-set.ts +20 -19
  51. package/src/exclusion.ts +6 -1
  52. package/src/index.ts +9 -9
  53. package/src/locale/i18n.ts +3 -3
  54. package/src/locale/i18next.d.ts +1 -1
  55. package/src/record.ts +2 -2
  56. package/src/reg-exp.ts +7 -7
  57. package/src/string.ts +3 -3
  58. package/src/transformer.ts +19 -18
  59. package/test/character-set.test.ts +1 -1
  60. package/test/record.test.ts +4 -2
  61. package/test/reg-exp.test.ts +1 -1
  62. package/test/sequence.test.ts +1 -1
  63. package/test/setup.ts +1 -1
  64. package/test/transformer.test.ts +1 -1
  65. package/tsconfig-config.json +4 -0
  66. package/tsconfig-src.json +8 -0
  67. package/tsconfig-test.json +9 -0
  68. package/tsconfig.json +12 -1
  69. package/tsup.config.ts +3 -2
  70. package/dist/index.cjs +0 -3569
  71. package/dist/index.cjs.map +0 -1
  72. package/dist/index.d.cts +0 -947
@@ -0,0 +1,564 @@
1
+ import { Exclusions } from "./exclusion.js";
2
+ import { i18nextUtility } from "./locale/i18n.js";
3
+ import { RegExpValidator } from "./reg-exp.js";
4
+ import { Transformer } from "./transformer.js";
5
+ /**
6
+ * Character set validator. Validates a string against a specified character set.
7
+ */
8
+ export class CharacterSetValidator {
9
+ static NOT_ALL_NUMERIC_VALIDATOR = new class extends RegExpValidator {
10
+ /**
11
+ * Create an error message for an all-numeric string.
12
+ *
13
+ * @param _s
14
+ * String.
15
+ *
16
+ * @returns
17
+ * Error message.
18
+ */
19
+ createErrorMessage(_s) {
20
+ return i18nextUtility.t("CharacterSetValidator.stringMustNotBeAllNumeric");
21
+ }
22
+ }(/\D/);
23
+ /**
24
+ * Character set.
25
+ */
26
+ _characterSet;
27
+ /**
28
+ * Character set map, mapping each character in the character set to its index such that
29
+ * `_characterSetMap.get(_characterSet[index]) === index`.
30
+ */
31
+ _characterSetMap;
32
+ /**
33
+ * Exclusions supported by the character set.
34
+ */
35
+ _exclusionSupport;
36
+ /**
37
+ * Constructor.
38
+ *
39
+ * @param characterSet
40
+ * Character set. Each element is a single-character string, unique within the array, that defines the character
41
+ * set.
42
+ *
43
+ * @param exclusionSupport
44
+ * Exclusions supported by the character set. All character sets implicitly support {@linkcode Exclusions.None}.
45
+ */
46
+ constructor(characterSet, ...exclusionSupport) {
47
+ this._characterSet = characterSet;
48
+ const characterSetMap = new Map();
49
+ characterSet.forEach((c, index) => {
50
+ characterSetMap.set(c, index);
51
+ });
52
+ this._characterSetMap = characterSetMap;
53
+ this._exclusionSupport = exclusionSupport;
54
+ }
55
+ /**
56
+ * Get the character set.
57
+ */
58
+ get characterSet() {
59
+ return this._characterSet;
60
+ }
61
+ /**
62
+ * Get the character set size.
63
+ */
64
+ get characterSetSize() {
65
+ return this._characterSet.length;
66
+ }
67
+ /**
68
+ * Get the exclusions supported by the character set.
69
+ */
70
+ get exclusionSupport() {
71
+ return this._exclusionSupport;
72
+ }
73
+ /**
74
+ * Get the character at an index.
75
+ *
76
+ * @param index
77
+ * Index into the character set.
78
+ *
79
+ * @returns
80
+ * Character at the index.
81
+ */
82
+ character(index) {
83
+ return this._characterSet[index];
84
+ }
85
+ /**
86
+ * Get the index for a character.
87
+ *
88
+ * @param c
89
+ * Character.
90
+ *
91
+ * @returns
92
+ * Index for the character or undefined if the character is not in the character set.
93
+ */
94
+ characterIndex(c) {
95
+ return this._characterSetMap.get(c);
96
+ }
97
+ /**
98
+ * Get the indexes for all characters in a string.
99
+ *
100
+ * @param s
101
+ * String.
102
+ *
103
+ * @returns
104
+ * Array of indexes for each character or undefined if the character is not in the character set.
105
+ */
106
+ characterIndexes(s) {
107
+ return Array.from(s).map(c => this._characterSetMap.get(c));
108
+ }
109
+ /**
110
+ * Convert a component definition to a string or undefined. Checks the type of the component and makes the callback
111
+ * if required.
112
+ *
113
+ * @param component
114
+ * Component definition as a string, callback, or undefined.
115
+ *
116
+ * @returns
117
+ * Component as a string or undefined.
118
+ */
119
+ static componentToString(component) {
120
+ return typeof component === "function" ? component() : component;
121
+ }
122
+ /**
123
+ * Validate that an exclusion is supported. If not, an error is thrown.
124
+ *
125
+ * @param exclusion
126
+ * Exclusion.
127
+ */
128
+ validateExclusion(exclusion) {
129
+ if (exclusion !== Exclusions.None && !this._exclusionSupport.includes(exclusion)) {
130
+ throw new RangeError(i18nextUtility.t("CharacterSetValidator.exclusionNotSupported", {
131
+ exclusion
132
+ }));
133
+ }
134
+ }
135
+ /**
136
+ * Validate a string. If the string violates the character set or any of the character set validation parameters, an
137
+ * error is thrown.
138
+ *
139
+ * @param s
140
+ * String.
141
+ *
142
+ * @param validation
143
+ * Character set validation parameters.
144
+ */
145
+ validate(s, validation) {
146
+ const length = s.length;
147
+ const minimumLength = validation?.minimumLength;
148
+ const maximumLength = validation?.maximumLength;
149
+ if (minimumLength !== undefined && length < minimumLength) {
150
+ let errorMessage;
151
+ if (maximumLength !== undefined && maximumLength === minimumLength) {
152
+ errorMessage = i18nextUtility.t(validation?.component === undefined ? "CharacterSetValidator.lengthMustBeEqualTo" : "CharacterSetValidator.lengthOfComponentMustBeEqualTo", {
153
+ component: CharacterSetValidator.componentToString(validation?.component),
154
+ length,
155
+ exactLength: minimumLength
156
+ });
157
+ }
158
+ else {
159
+ errorMessage = i18nextUtility.t(validation?.component === undefined ? "CharacterSetValidator.lengthMustBeGreaterThanOrEqualTo" : "CharacterSetValidator.lengthOfComponentMustBeGreaterThanOrEqualTo", {
160
+ component: CharacterSetValidator.componentToString(validation?.component),
161
+ length,
162
+ minimumLength
163
+ });
164
+ }
165
+ throw new RangeError(errorMessage);
166
+ }
167
+ if (maximumLength !== undefined && length > maximumLength) {
168
+ throw new RangeError(i18nextUtility.t(validation?.component === undefined ? "CharacterSetValidator.lengthMustBeLessThanOrEqualTo" : "CharacterSetValidator.lengthOfComponentMustBeLessThanOrEqualTo", {
169
+ component: CharacterSetValidator.componentToString(validation?.component),
170
+ length,
171
+ maximumLength
172
+ }));
173
+ }
174
+ // Find the index of the first character that is not in the character set.
175
+ const index = this.characterIndexes(s).findIndex(characterIndex => characterIndex === undefined);
176
+ if (index !== -1) {
177
+ throw new RangeError(i18nextUtility.t(validation?.component === undefined ? "CharacterSetValidator.invalidCharacterAtPosition" : "CharacterSetValidator.invalidCharacterAtPositionOfComponent", {
178
+ component: CharacterSetValidator.componentToString(validation?.component),
179
+ c: s.charAt(index),
180
+ position: index + (validation?.positionOffset ?? 0) + 1
181
+ }));
182
+ }
183
+ if (validation?.exclusion !== undefined) {
184
+ this.validateExclusion(validation.exclusion);
185
+ switch (validation.exclusion) {
186
+ case Exclusions.None:
187
+ break;
188
+ case Exclusions.FirstZero:
189
+ if (s.startsWith("0")) {
190
+ throw new RangeError(i18nextUtility.t(validation.component === undefined ? "CharacterSetValidator.invalidCharacterAtPosition" : "CharacterSetValidator.invalidCharacterAtPositionOfComponent", {
191
+ component: CharacterSetValidator.componentToString(validation.component),
192
+ c: "0",
193
+ position: (validation.positionOffset ?? 0) + 1
194
+ }));
195
+ }
196
+ break;
197
+ case Exclusions.AllNumeric:
198
+ CharacterSetValidator.NOT_ALL_NUMERIC_VALIDATOR.validate(s);
199
+ break;
200
+ }
201
+ }
202
+ }
203
+ }
204
+ /**
205
+ * Character set creator. Maps numeric values to strings using the character set as digits.
206
+ */
207
+ export class CharacterSetCreator extends CharacterSetValidator {
208
+ /**
209
+ * Maximum string length supported.
210
+ */
211
+ static MAXIMUM_STRING_LENGTH = 40;
212
+ /**
213
+ * Powers of 10 from 1 (`10**0`) to `10**MAXIMUM_STRING_LENGTH`.
214
+ */
215
+ static _powersOf10 = CharacterSetCreator.createPowersOf(10);
216
+ /**
217
+ * Create powers of a given base from 1 (`base**0`) to `base**MAXIMUM_STRING_LENGTH`.
218
+ *
219
+ * @param base
220
+ * Number base.
221
+ *
222
+ * @returns
223
+ * Array of powers of base.
224
+ */
225
+ static createPowersOf(base) {
226
+ const powersOf = new Array(this.MAXIMUM_STRING_LENGTH + 1);
227
+ const baseN = BigInt(base);
228
+ for (let index = 0, powerOf = 1n; index <= this.MAXIMUM_STRING_LENGTH; index++, powerOf *= baseN) {
229
+ powersOf[index] = powerOf;
230
+ }
231
+ return powersOf;
232
+ }
233
+ /**
234
+ * Get a power of 10.
235
+ *
236
+ * @param power
237
+ * Power.
238
+ *
239
+ * @returns
240
+ * `10**power`.
241
+ */
242
+ static powerOf10(power) {
243
+ return this._powersOf10[power];
244
+ }
245
+ /**
246
+ * Character set size as big integer, cached for performance purposes.
247
+ */
248
+ _characterSetSizeN;
249
+ /**
250
+ * Character set size minus 1 as big integer, cached for performance purposes.
251
+ */
252
+ _characterSetSizeMinusOneN;
253
+ /**
254
+ * Domains for every length for every supported {@linkcode Exclusions}.
255
+ */
256
+ _exclusionDomains;
257
+ /**
258
+ * Values that would generate all zeros in the created string.
259
+ */
260
+ _allZerosValues;
261
+ /**
262
+ * Constructor.
263
+ *
264
+ * @param characterSet
265
+ * Character set. Each element is a single-character string, unique within the array, that defines the character
266
+ * set.
267
+ *
268
+ * @param exclusionSupport
269
+ * Exclusions supported by the character set. All character sets implicitly support {@linkcode Exclusions.None}.
270
+ */
271
+ constructor(characterSet, ...exclusionSupport) {
272
+ super(characterSet, ...exclusionSupport);
273
+ this._characterSetSizeN = BigInt(this.characterSetSize);
274
+ this._characterSetSizeMinusOneN = BigInt(this.characterSetSize - 1);
275
+ const exclusionDomains = [];
276
+ const exclusionNoneDomains = CharacterSetCreator.createPowersOf(this.characterSetSize);
277
+ exclusionDomains[Exclusions.None] = exclusionNoneDomains;
278
+ if (exclusionSupport.includes(Exclusions.FirstZero)) {
279
+ if (characterSet[0] !== "0") {
280
+ throw new RangeError(i18nextUtility.t("CharacterSetValidator.firstZeroFirstCharacter"));
281
+ }
282
+ const exclusionFirstZeroDomains = new Array(CharacterSetCreator.MAXIMUM_STRING_LENGTH + 1);
283
+ // Exclusion of first zero mathematically prohibits length of 0.
284
+ exclusionFirstZeroDomains[0] = 0n;
285
+ for (let index = 1; index <= CharacterSetCreator.MAXIMUM_STRING_LENGTH; index++) {
286
+ // Domain excludes zero as the first character and so works with previous exclusion none domain.
287
+ exclusionFirstZeroDomains[index] = this._characterSetSizeMinusOneN * exclusionNoneDomains[index - 1];
288
+ }
289
+ exclusionDomains[Exclusions.FirstZero] = exclusionFirstZeroDomains;
290
+ }
291
+ if (exclusionSupport.includes(Exclusions.AllNumeric)) {
292
+ const exclusionAllNumericDomains = new Array(CharacterSetCreator.MAXIMUM_STRING_LENGTH + 1);
293
+ /**
294
+ * Validate that number indexes are defined and sequential.
295
+ *
296
+ * @param numberIndexes
297
+ * Number indexes.
298
+ */
299
+ function validateNumberIndexes(numberIndexes) {
300
+ let expectedNumberIndex = numberIndexes[0];
301
+ // Make sure that all numeric characters are present and in sequence.
302
+ for (const numberIndex of numberIndexes) {
303
+ if (numberIndex === undefined || numberIndex !== expectedNumberIndex) {
304
+ throw new RangeError(i18nextUtility.t("CharacterSetValidator.allNumericAllNumericCharacters"));
305
+ }
306
+ expectedNumberIndex = numberIndex + 1;
307
+ }
308
+ }
309
+ const numberIndexes = this.characterIndexes("0123456789");
310
+ validateNumberIndexes(numberIndexes);
311
+ // Zero index is the all-zero value for a single-character string.
312
+ const zeroIndex = BigInt(numberIndexes[0]);
313
+ const allZerosValues = new Array(CharacterSetCreator.MAXIMUM_STRING_LENGTH + 1);
314
+ let allZerosValue = 0n;
315
+ // Each all-zero value is the previous all-zero value multiplied by the character set size plus the zero index.
316
+ for (let index = 0; index <= CharacterSetCreator.MAXIMUM_STRING_LENGTH; index++) {
317
+ // Domain excludes the number of permutations that would result in an all-numeric string.
318
+ exclusionAllNumericDomains[index] = exclusionNoneDomains[index] - CharacterSetCreator.powerOf10(index);
319
+ allZerosValues[index] = allZerosValue;
320
+ allZerosValue = allZerosValue * this._characterSetSizeN + zeroIndex;
321
+ }
322
+ this._allZerosValues = allZerosValues;
323
+ exclusionDomains[Exclusions.AllNumeric] = exclusionAllNumericDomains;
324
+ }
325
+ else {
326
+ // Empty array obviates need for non-null assertion while still forcing error if indexed due to a bug.
327
+ this._allZerosValues = [];
328
+ }
329
+ this._exclusionDomains = exclusionDomains;
330
+ }
331
+ /**
332
+ * Get a power of character set size.
333
+ *
334
+ * @param power
335
+ * Power.
336
+ *
337
+ * @returns
338
+ * `characterSetSize**power`.
339
+ */
340
+ powerOfSize(power) {
341
+ return this._exclusionDomains[Exclusions.None][power];
342
+ }
343
+ /**
344
+ * Determine the shift required to skip all all-numeric strings up to the value.
345
+ *
346
+ * @param shiftForward
347
+ * True to shift forward (value to string), false to shift backward (string to value).
348
+ *
349
+ * @param length
350
+ * Length of string for which to get the all-numeric shift.
351
+ *
352
+ * @param value
353
+ * Value for which to get the all-numeric shift.
354
+ *
355
+ * @returns
356
+ * Shift required to skip all all-numeric strings.
357
+ */
358
+ allNumericShift(shiftForward, length, value) {
359
+ let shift;
360
+ if (length === 0) {
361
+ if (!shiftForward && value < 10n) {
362
+ // If calculation gets this far, string is all-numeric.
363
+ throw new RangeError(i18nextUtility.t("CharacterSetValidator.stringMustNotBeAllNumeric"));
364
+ }
365
+ // Now dealing with individual characters; shift by 10 to skip numeric characters.
366
+ shift = 10n;
367
+ }
368
+ else {
369
+ const powerOfSize = this.powerOfSize(length);
370
+ const powerOf10 = CharacterSetCreator.powerOf10(length);
371
+ // Calculate the gap to the next numeric string of equal length with incremental first character.
372
+ const gap = shiftForward ? powerOfSize - powerOf10 : powerOfSize;
373
+ // Determine the number of gaps remaining in the value.
374
+ const gaps = value / gap;
375
+ if (gaps >= 10n) {
376
+ // Shift is the next power of 10.
377
+ shift = CharacterSetCreator.powerOf10(length + 1);
378
+ }
379
+ else {
380
+ // Shift is the number of gaps times the current power of 10 plus the shift for the next length down with value adjusted by the number of gaps times the gap.
381
+ shift = gaps * powerOf10 + this.allNumericShift(shiftForward, length - 1, value - gaps * gap);
382
+ }
383
+ }
384
+ return shift;
385
+ }
386
+ /**
387
+ * Validate that a length is less than or equal to {@linkcode MAXIMUM_STRING_LENGTH}. If not, an error is thrown.
388
+ *
389
+ * @param length
390
+ * Length.
391
+ */
392
+ validateLength(length) {
393
+ if (length < 0) {
394
+ throw new RangeError(i18nextUtility.t("CharacterSetValidator.lengthMustBeGreaterThanOrEqualTo", {
395
+ length,
396
+ minimumLength: 0
397
+ }));
398
+ }
399
+ if (length > CharacterSetCreator.MAXIMUM_STRING_LENGTH) {
400
+ throw new RangeError(i18nextUtility.t("CharacterSetValidator.lengthMustBeLessThanOrEqualTo", {
401
+ length,
402
+ maximumLength: CharacterSetCreator.MAXIMUM_STRING_LENGTH
403
+ }));
404
+ }
405
+ }
406
+ /**
407
+ * Create string(s) by mapping value(s) to the equivalent characters in the character set across the length of the
408
+ * string.
409
+ *
410
+ * @template TTransformerInput
411
+ * Transformer input type.
412
+ *
413
+ * @param length
414
+ * Required string length.
415
+ *
416
+ * @param valueOrValues
417
+ * Numeric value(s) of the string(s).
418
+ *
419
+ * @param exclusion
420
+ * String(s) to be excluded from the range of outputs. See {@linkcode Exclusions} for possible values and their
421
+ * meaning.
422
+ *
423
+ * @param tweak
424
+ * If provided, the numerical value of the string(s) is/are "tweaked" using an {@link EncryptionTransformer |
425
+ * encryption transformer}.
426
+ *
427
+ * @param creatorCallback
428
+ * If provided, called after each string is constructed to create the final value.
429
+ *
430
+ * @returns
431
+ * String(s) created from the value(s).
432
+ */
433
+ create(length, valueOrValues, exclusion = Exclusions.None, tweak, creatorCallback) {
434
+ this.validateLength(length);
435
+ this.validateExclusion(exclusion);
436
+ // Zero value in ternary else obviates need for non-null assertion.
437
+ const allZerosValue = exclusion === Exclusions.AllNumeric ? this._allZerosValues[length] : 0n;
438
+ const transformer = Transformer.get(this._exclusionDomains[exclusion][length], tweak);
439
+ return transformer.forward(valueOrValues, (transformedValue, index) => {
440
+ let s = "";
441
+ // Empty string is valid.
442
+ if (length !== 0) {
443
+ let convertValue = transformedValue;
444
+ if (exclusion === Exclusions.AllNumeric && convertValue >= allZerosValue) {
445
+ // Value to convert is shifted by the number of all-numeric strings that occur at or prior to it.
446
+ convertValue += this.allNumericShift(true, length, convertValue - allZerosValue);
447
+ }
448
+ // Build string from right to left excluding the first character.
449
+ for (let position = length - 1; position > 0; position--) {
450
+ const nextConvertValue = convertValue / this._characterSetSizeN;
451
+ // First step is effectively a modulus calculation.
452
+ s = this.character(Number(convertValue - nextConvertValue * this._characterSetSizeN)) + s;
453
+ convertValue = nextConvertValue;
454
+ }
455
+ // Zero is first in the character set for those that support excluding first zero.
456
+ s = this.character(exclusion === Exclusions.FirstZero ? Number(convertValue % this._characterSetSizeMinusOneN) + 1 : Number(convertValue % this._characterSetSizeN)) + s;
457
+ }
458
+ return creatorCallback === undefined ? s : creatorCallback(s, index);
459
+ });
460
+ }
461
+ /**
462
+ * Determine the value for a string.
463
+ *
464
+ * @param s
465
+ * String.
466
+ *
467
+ * @param exclusion
468
+ * Strings excluded from the range of inputs. See {@linkcode Exclusions} for possible values and their meaning.
469
+ *
470
+ * @param tweak
471
+ * If provided, the numerical value of the string was "tweaked" using an {@link EncryptionTransformer | encryption
472
+ * transformer}.
473
+ *
474
+ * @returns
475
+ * Numeric value of the string.
476
+ */
477
+ valueFor(s, exclusion = Exclusions.None, tweak) {
478
+ const length = s.length;
479
+ this.validateLength(length);
480
+ this.validateExclusion(exclusion);
481
+ const characterSetSizeN = BigInt(this.characterSetSize);
482
+ // Convert string to its value character by character.
483
+ let value = this.characterIndexes(s).reduce((accumulator, characterIndex, index) => {
484
+ if (characterIndex === undefined) {
485
+ throw new RangeError(i18nextUtility.t("CharacterSetValidator.invalidCharacterAtPosition", {
486
+ c: s.charAt(index),
487
+ position: index + 1
488
+ }));
489
+ }
490
+ let value;
491
+ if (index === 0 && exclusion === Exclusions.FirstZero) {
492
+ if (characterIndex === 0) {
493
+ throw new RangeError(i18nextUtility.t("CharacterSetValidator.invalidCharacterAtPosition", {
494
+ c: "0",
495
+ position: 1
496
+ }));
497
+ }
498
+ // Accumulator is known to be zero at this point.
499
+ value = BigInt(characterIndex - 1);
500
+ }
501
+ else {
502
+ value = accumulator * characterSetSizeN + BigInt(characterIndex);
503
+ }
504
+ return value;
505
+ }, 0n);
506
+ if (exclusion === Exclusions.AllNumeric) {
507
+ const allZerosValue = this._allZerosValues[length];
508
+ if (value >= allZerosValue) {
509
+ // Call will ensure that string is not all-numeric.
510
+ value -= this.allNumericShift(false, length, value - allZerosValue);
511
+ }
512
+ }
513
+ return Transformer.get(this._exclusionDomains[exclusion][length], tweak).reverse(value);
514
+ }
515
+ }
516
+ /**
517
+ * Numeric creator. Character set is 0-9. Supports {@linkcode Exclusions.FirstZero}.
518
+ */
519
+ export const NUMERIC_CREATOR = new CharacterSetCreator([
520
+ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
521
+ ], Exclusions.FirstZero);
522
+ /**
523
+ * Numeric validator. Character set is 0-9. Supports {@linkcode Exclusions.FirstZero}.
524
+ */
525
+ export const NUMERIC_VALIDATOR = NUMERIC_CREATOR;
526
+ /**
527
+ * Hexadecimal creator. Character set is 0-9, A-F. Supports {@linkcode Exclusions.FirstZero} and {@linkcode
528
+ * Exclusions.AllNumeric}.
529
+ */
530
+ export const HEXADECIMAL_CREATOR = new CharacterSetCreator([
531
+ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
532
+ "A", "B", "C", "D", "E", "F"
533
+ ], Exclusions.FirstZero, Exclusions.AllNumeric);
534
+ /**
535
+ * Hexadecimal validator. Character set is 0-9, A-F. Supports {@linkcode Exclusions.FirstZero} and {@linkcode
536
+ * Exclusions.AllNumeric}.
537
+ */
538
+ export const HEXADECIMAL_VALIDATOR = HEXADECIMAL_CREATOR;
539
+ /**
540
+ * Alphabetic creator. Character set is A-Z.
541
+ */
542
+ export const ALPHABETIC_CREATOR = new CharacterSetCreator([
543
+ "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
544
+ "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"
545
+ ]);
546
+ /**
547
+ * Alphabetic validator. Character set is A-Z.
548
+ */
549
+ export const ALPHABETIC_VALIDATOR = ALPHABETIC_CREATOR;
550
+ /**
551
+ * Alphanumeric creator. Character set is 0-9, A-Z. Supports {@linkcode Exclusions.FirstZero} and {@linkcode
552
+ * Exclusions.AllNumeric}.
553
+ */
554
+ export const ALPHANUMERIC_CREATOR = new CharacterSetCreator([
555
+ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
556
+ "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
557
+ "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"
558
+ ], Exclusions.FirstZero, Exclusions.AllNumeric);
559
+ /**
560
+ * Alphanumeric validator. Character set is 0-9, A-Z. Supports {@linkcode Exclusions.FirstZero} and {@linkcode
561
+ * Exclusions.AllNumeric}.
562
+ */
563
+ export const ALPHANUMERIC_VALIDATOR = ALPHANUMERIC_CREATOR;
564
+ //# sourceMappingURL=character-set.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"character-set.js","sourceRoot":"","sources":["../src/character-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAiD,MAAM,kBAAkB,CAAC;AAmC9F;;GAEG;AACH,MAAM,OAAO,qBAAqB;IACtB,MAAM,CAAU,yBAAyB,GAAG,IAAI,KAAM,SAAQ,eAAe;QACjF;;;;;;;;WAQG;QACgB,kBAAkB,CAAC,EAAU;YAC5C,OAAO,cAAc,CAAC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AAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;CAClE,EAAE,UAAU,CAAC,SAAS,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;AAEhD;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAA6C,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Exclusion options for validating and creating strings based on character sets.
3
+ */
4
+ export declare const Exclusions: {
5
+ /**
6
+ * No strings excluded.
7
+ */
8
+ readonly None: 0;
9
+ /**
10
+ * Strings that start with zero ('0') excluded.
11
+ */
12
+ readonly FirstZero: 1;
13
+ /**
14
+ * Strings that are all-numeric (e.g., "123456") excluded.
15
+ */
16
+ readonly AllNumeric: 2;
17
+ };
18
+ /**
19
+ * Exclusion key.
20
+ */
21
+ export type ExclusionKey = keyof typeof Exclusions;
22
+ /**
23
+ * Exclusion.
24
+ */
25
+ export type Exclusion = typeof Exclusions[ExclusionKey];
26
+ //# sourceMappingURL=exclusion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exclusion.d.ts","sourceRoot":"","sources":["../src/exclusion.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,UAAU;IACnB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEG,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,UAAU,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,UAAU,CAAC,YAAY,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Exclusion options for validating and creating strings based on character sets.
3
+ */
4
+ export const Exclusions = {
5
+ /**
6
+ * No strings excluded.
7
+ */
8
+ None: 0,
9
+ /**
10
+ * Strings that start with zero ('0') excluded.
11
+ */
12
+ FirstZero: 1,
13
+ /**
14
+ * Strings that are all-numeric (e.g., "123456") excluded.
15
+ */
16
+ AllNumeric: 2
17
+ };
18
+ //# sourceMappingURL=exclusion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exclusion.js","sourceRoot":"","sources":["../src/exclusion.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACtB;;OAEG;IACH,IAAI,EAAE,CAAC;IAEP;;OAEG;IACH,SAAS,EAAE,CAAC;IAEZ;;OAEG;IACH,UAAU,EAAE,CAAC;CACP,CAAC"}