@aidc-toolkit/utility 0.9.11-beta → 0.9.13-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.
package/dist/index.cjs CHANGED
@@ -1,1345 +1,4 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var index_exports = {};
32
- __export(index_exports, {
33
- ALPHABETIC_CREATOR: () => ALPHABETIC_CREATOR,
34
- ALPHANUMERIC_CREATOR: () => ALPHANUMERIC_CREATOR,
35
- CharacterSetCreator: () => CharacterSetCreator,
36
- CharacterSetValidator: () => CharacterSetValidator,
37
- EncryptionTransformer: () => EncryptionTransformer,
38
- Exclusion: () => Exclusion,
39
- HEXADECIMAL_CREATOR: () => HEXADECIMAL_CREATOR,
40
- IdentityTransformer: () => IdentityTransformer,
41
- NUMERIC_CREATOR: () => NUMERIC_CREATOR,
42
- RecordValidator: () => RecordValidator,
43
- RegExpValidator: () => RegExpValidator,
44
- Sequence: () => Sequence,
45
- Transformer: () => Transformer,
46
- i18nUtilityInit: () => i18nUtilityInit,
47
- i18nextUtility: () => i18nextUtility,
48
- transformIterable: () => transformIterable,
49
- utilityNS: () => utilityNS,
50
- utilityResources: () => utilityResources
51
- });
52
- module.exports = __toCommonJS(index_exports);
53
-
54
- // src/locale/i18n.ts
55
- var import_core = require("@aidc-toolkit/core");
56
- var import_i18next = __toESM(require("i18next"), 1);
57
-
58
- // src/locale/en/locale-strings.ts
59
- var localeStrings = {
60
- Transformer: {
61
- domainMustBeGreaterThanZero: "Domain {{domain}} must be greater than 0",
62
- tweakMustBeGreaterThanOrEqualToZero: "Tweak {{tweak}} must be greater than or equal to 0",
63
- valueMustBeGreaterThanOrEqualToZero: "Value {{value}} must be greater than or equal to 0",
64
- valueMustBeLessThan: "Value {{value}} must be less than {{domain}}",
65
- minimumValueMustBeGreaterThanOrEqualToZero: "Minimum value {{minimumValue}} must be greater than or equal to 0",
66
- maximumValueMustBeLessThan: "Maximum value {{maximumValue}} must be less than {{domain}}"
67
- },
68
- RegExpValidator: {
69
- stringDoesNotMatchPattern: "String {{s}} does not match pattern"
70
- },
71
- CharacterSetValidator: {
72
- firstZeroFirstCharacter: "Character set must support zero as first character",
73
- allNumericAllNumericCharacters: "Character set must support all numeric characters in sequence",
74
- stringMustNotBeAllNumeric: "String must not be all numeric",
75
- lengthMustBeGreaterThanOrEqualTo: "Length {{length}} must be greater than or equal to {{minimumLength}}",
76
- lengthMustBeLessThanOrEqualTo: "Length {{length}} must be less than or equal to {{maximumLength}}",
77
- lengthMustBeEqualTo: "Length {{length}} must be equal to {{exactLength}}",
78
- lengthOfComponentMustBeGreaterThanOrEqualTo: "Length {{length}} of {{component}} must be greater than or equal to {{minimumLength}}",
79
- lengthOfComponentMustBeLessThanOrEqualTo: "Length {{length}} of {{component}} must be less than or equal to {{maximumLength}}",
80
- lengthOfComponentMustBeEqualTo: "Length {{length}} of {{component}} must be equal to {{exactLength}}",
81
- invalidCharacterAtPosition: "Invalid character '{{c}}' at position {{position}}",
82
- invalidCharacterAtPositionOfComponent: "Invalid character '{{c}}' at position {{position}} of {{component}}",
83
- exclusionNotSupported: "Exclusion value of {{exclusion}} is not supported",
84
- invalidTweakWithAllNumericExclusion: "Tweak must not be used with all-numeric exclusion",
85
- endSequenceValueMustBeLessThanOrEqualTo: "End sequence value (start sequence value + count - 1) must be less than {{domain}}"
86
- },
87
- RecordValidator: {
88
- typeNameKeyNotFound: '{{typeName}} "{{key}}" not found'
89
- }
90
- };
91
-
92
- // src/locale/fr/locale-strings.ts
93
- var localeStrings2 = {
94
- Transformer: {
95
- domainMustBeGreaterThanZero: "Le domaine {{domain}} doit \xEAtre sup\xE9rieur \xE0 0",
96
- tweakMustBeGreaterThanOrEqualToZero: "Le r\xE9glage {{tweak}} doit \xEAtre sup\xE9rieur ou \xE9gal \xE0 0",
97
- valueMustBeGreaterThanOrEqualToZero: "La valeur {{value}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 0",
98
- valueMustBeLessThan: "La valeur {{value}} doit \xEAtre inf\xE9rieure \xE0 {{domain}}",
99
- minimumValueMustBeGreaterThanOrEqualToZero: "La valeur minimale {{minimumValue}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 0",
100
- maximumValueMustBeLessThan: "La valeur maximale {{maximumValue}} doit \xEAtre inf\xE9rieure \xE0 {{domain}}"
101
- },
102
- RegExpValidator: {
103
- stringDoesNotMatchPattern: "La cha\xEEne {{s}} ne correspond pas au mod\xE8le"
104
- },
105
- CharacterSetValidator: {
106
- firstZeroFirstCharacter: "Le jeu de caract\xE8res doit prendre en charge z\xE9ro comme premier caract\xE8re",
107
- allNumericAllNumericCharacters: "Le jeu de caract\xE8res doit prendre en charge tous les caract\xE8res num\xE9riques en s\xE9quence",
108
- stringMustNotBeAllNumeric: "La cha\xEEne ne doit pas \xEAtre enti\xE8rement num\xE9rique",
109
- lengthMustBeGreaterThanOrEqualTo: "La longueur {{length}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 {{minimumLength}}",
110
- lengthMustBeLessThanOrEqualTo: "La longueur {{length}} doit \xEAtre inf\xE9rieure ou \xE9gale \xE0 {{maximumLength}}",
111
- lengthMustBeEqualTo: "La longueur {{length}} doit \xEAtre \xE9gale \xE0 {{exactLength}}",
112
- lengthOfComponentMustBeGreaterThanOrEqualTo: "La longueur {{length}} de {{component}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 {{minimumLength}}",
113
- lengthOfComponentMustBeLessThanOrEqualTo: "La longueur {{length}} de {{component}} doit \xEAtre inf\xE9rieure ou \xE9gale \xE0 {{maximumLength}}",
114
- lengthOfComponentMustBeEqualTo: "La longueur {{length}} de {{component}} doit \xEAtre \xE9gale \xE0 {{exactLength}}",
115
- invalidCharacterAtPosition: "Caract\xE8re non valide '{{c}}' \xE0 la position {{position}}",
116
- invalidCharacterAtPositionOfComponent: "Caract\xE8re non valide '{{c}}' \xE0 la position {{position}} de {{component}}",
117
- exclusionNotSupported: "La valeur d'exclusion de {{exclusion}} n'est pas prise en charge",
118
- invalidTweakWithAllNumericExclusion: "Le r\xE9glage ne doit pas \xEAtre utilis\xE9 avec une exclusion enti\xE8rement num\xE9rique",
119
- endSequenceValueMustBeLessThanOrEqualTo: "La valeur de la s\xE9quence de fin (valeur de la s\xE9quence de d\xE9but + nombre - 1) doit \xEAtre inf\xE9rieure \xE0 {{domaine}}"
120
- },
121
- RecordValidator: {
122
- typeNameKeyNotFound: '{{typeName}} "{{key}}" introuvable'
123
- }
124
- };
125
-
126
- // src/locale/i18n.ts
127
- var utilityNS = "aidct_utility";
128
- (0, import_core.i18nAssertValidResources)(localeStrings, "fr", localeStrings2);
129
- var utilityResources = {
130
- en: {
131
- aidct_utility: localeStrings
132
- },
133
- fr: {
134
- aidct_utility: localeStrings2
135
- }
136
- };
137
- var i18nextUtility = import_i18next.default.createInstance();
138
- async function i18nUtilityInit(environment, debug = false) {
139
- await (0, import_core.i18nCoreInit)(i18nextUtility, environment, debug, utilityNS, utilityResources);
140
- }
141
-
142
- // src/sequence.ts
143
- var Sequence = class {
144
- /**
145
- * Start value (inclusive).
146
- */
147
- _startValue;
148
- /**
149
- * End value (exclusive).
150
- */
151
- _endValue;
152
- /**
153
- * Count of values.
154
- */
155
- _count;
156
- /**
157
- * Delta to the next value; equal to the sign of the count.
158
- */
159
- _nextDelta;
160
- /**
161
- * Minimum value (inclusive).
162
- */
163
- _minimumValue;
164
- /**
165
- * Maximum value (inclusive).
166
- */
167
- _maximumValue;
168
- /**
169
- * Constructor.
170
- *
171
- * @param startValue
172
- * Start value.
173
- *
174
- * @param count
175
- * Count of values. If count is zero or positive, iteration ascends from start value, otherwise it descends from
176
- * start value.
177
- */
178
- constructor(startValue, count) {
179
- this._startValue = BigInt(startValue);
180
- this._endValue = this._startValue + BigInt(count);
181
- this._count = count;
182
- if (count >= 0) {
183
- this._nextDelta = 1n;
184
- this._minimumValue = this._startValue;
185
- this._maximumValue = this._endValue - 1n;
186
- } else {
187
- this._nextDelta = -1n;
188
- this._minimumValue = this._endValue + 1n;
189
- this._maximumValue = this._startValue;
190
- }
191
- }
192
- /**
193
- * Get the start value (inclusive).
194
- */
195
- get startValue() {
196
- return this._startValue;
197
- }
198
- /**
199
- * Get the end value (exclusive).
200
- */
201
- get endValue() {
202
- return this._endValue;
203
- }
204
- /**
205
- * Get the count of values.
206
- */
207
- get count() {
208
- return this._count;
209
- }
210
- /**
211
- * Get the minimum value (inclusive).
212
- */
213
- get minimumValue() {
214
- return this._minimumValue;
215
- }
216
- /**
217
- * Get the maximum value (inclusive).
218
- */
219
- get maximumValue() {
220
- return this._maximumValue;
221
- }
222
- /**
223
- * Iterable implementation.
224
- *
225
- * @yields
226
- * Next value in sequence.
227
- */
228
- *[Symbol.iterator]() {
229
- for (let value = this._startValue; value !== this._endValue; value += this._nextDelta) {
230
- yield value;
231
- }
232
- }
233
- };
234
-
235
- // src/transformer.ts
236
- function transformIterable(values, transformerCallback) {
237
- return {
238
- /**
239
- * Iterable implementation.
240
- *
241
- * @yields
242
- * Next output value.
243
- */
244
- *[Symbol.iterator]() {
245
- let index = 0;
246
- for (const value of values) {
247
- yield transformerCallback(value, index++);
248
- }
249
- }
250
- };
251
- }
252
- var Transformer = class _Transformer {
253
- /**
254
- * Transformers cache, mapping a domain to another map, which maps an optional tweak to a transformer.
255
- */
256
- static TRANSFORMER_MAPS_MAP = /* @__PURE__ */ new Map();
257
- /**
258
- * Domain.
259
- */
260
- _domain;
261
- /**
262
- * Constructor.
263
- *
264
- * @param domain
265
- * Domain.
266
- */
267
- constructor(domain) {
268
- this._domain = BigInt(domain);
269
- if (this._domain <= 0n) {
270
- throw new RangeError(i18nextUtility.t("Transformer.domainMustBeGreaterThanZero", {
271
- domain
272
- }));
273
- }
274
- }
275
- /**
276
- * Get a transformer, constructing it if necessary. The type returned is {@link IdentityTransformer} if tweak is
277
- * undefined, {@link EncryptionTransformer} if tweak is defined. Note that although an {@link EncryptionTransformer}
278
- * with a zero tweak operates as an {@link IdentityTransformer}, {@link EncryptionTransformer} is still the type
279
- * returned if a zero tweak is explicitly specified.
280
- *
281
- * @param domain
282
- * Domain.
283
- *
284
- * @param tweak
285
- * Tweak.
286
- *
287
- * @returns
288
- * {@link IdentityTransformer} if tweak is undefined, {@link EncryptionTransformer} if tweak is defined.
289
- */
290
- static get(domain, tweak) {
291
- const domainN = BigInt(domain);
292
- let transformersMap = _Transformer.TRANSFORMER_MAPS_MAP.get(domainN);
293
- if (transformersMap === void 0) {
294
- transformersMap = /* @__PURE__ */ new Map();
295
- _Transformer.TRANSFORMER_MAPS_MAP.set(domainN, transformersMap);
296
- }
297
- const tweakN = tweak === void 0 ? void 0 : BigInt(tweak);
298
- let transformer = transformersMap.get(tweakN);
299
- if (transformer === void 0) {
300
- transformer = tweakN === void 0 ? new IdentityTransformer(domainN) : new EncryptionTransformer(domainN, tweakN);
301
- transformersMap.set(tweakN, transformer);
302
- }
303
- return transformer;
304
- }
305
- /**
306
- * Get the domain.
307
- */
308
- get domain() {
309
- return this._domain;
310
- }
311
- /**
312
- * Validate that a value is within the domain.
313
- *
314
- * @param value
315
- * Value.
316
- */
317
- validate(value) {
318
- if (value < 0n) {
319
- throw new RangeError(i18nextUtility.t("Transformer.valueMustBeGreaterThanOrEqualToZero", {
320
- value
321
- }));
322
- }
323
- if (value >= this.domain) {
324
- throw new RangeError(i18nextUtility.t("Transformer.valueMustBeLessThan", {
325
- value,
326
- domain: this.domain
327
- }));
328
- }
329
- }
330
- /**
331
- * Validate that a value is within the domain and do the work of transforming it forward.
332
- *
333
- * @param value
334
- * Value.
335
- *
336
- * @returns
337
- * Transformed value.
338
- */
339
- validateDoForward(value) {
340
- const valueN = BigInt(value);
341
- this.validate(valueN);
342
- return this.doForward(valueN);
343
- }
344
- /**
345
- * Validate that a value is within the domain, do the work of transforming it forward, and apply a callback.
346
- *
347
- * @param transformerCallback
348
- * Called after each value is transformed to convert it to its final value.
349
- *
350
- * @param value
351
- * Value.
352
- *
353
- * @param index
354
- * Index in sequence (0 for single transformation).
355
- *
356
- * @returns
357
- * Transformed value.
358
- */
359
- validateDoForwardCallback(transformerCallback, value, index) {
360
- return transformerCallback(this.validateDoForward(value), index);
361
- }
362
- // eslint-disable-next-line jsdoc/require-jsdoc -- Implementation of overloaded signatures.
363
- forward(valueOrValues, transformerCallback) {
364
- let result;
365
- if (typeof valueOrValues !== "object") {
366
- result = transformerCallback === void 0 ? this.validateDoForward(valueOrValues) : this.validateDoForwardCallback(transformerCallback, valueOrValues, 0);
367
- } else if (valueOrValues instanceof Sequence) {
368
- if (valueOrValues.minimumValue < 0n) {
369
- throw new RangeError(i18nextUtility.t("Transformer.minimumValueMustBeGreaterThanOrEqualToZero", {
370
- minimumValue: valueOrValues.minimumValue
371
- }));
372
- }
373
- if (valueOrValues.maximumValue >= this.domain) {
374
- throw new RangeError(i18nextUtility.t("Transformer.maximumValueMustBeLessThan", {
375
- maximumValue: valueOrValues.maximumValue,
376
- domain: this.domain
377
- }));
378
- }
379
- result = transformerCallback === void 0 ? transformIterable(valueOrValues, (value) => this.doForward(value)) : transformIterable(valueOrValues, (value, index) => transformerCallback(this.doForward(value), index));
380
- } else {
381
- result = transformerCallback === void 0 ? transformIterable(valueOrValues, (value) => this.validateDoForward(value)) : transformIterable(valueOrValues, (value, index) => this.validateDoForwardCallback(transformerCallback, value, index));
382
- }
383
- return result;
384
- }
385
- /**
386
- * Transform a value in reverse.
387
- *
388
- * @param transformedValue
389
- * Transformed value.
390
- *
391
- * @returns
392
- * Value.
393
- */
394
- reverse(transformedValue) {
395
- const transformedValueN = BigInt(transformedValue);
396
- this.validate(transformedValueN);
397
- return this.doReverse(transformedValueN);
398
- }
399
- };
400
- var IdentityTransformer = class extends Transformer {
401
- /**
402
- * @inheritDoc
403
- */
404
- doForward(value) {
405
- return value;
406
- }
407
- /**
408
- * @inheritDoc
409
- */
410
- doReverse(transformedValue) {
411
- return transformedValue;
412
- }
413
- };
414
- var EncryptionTransformer = class _EncryptionTransformer extends Transformer {
415
- /**
416
- * Individual bits, pre-calculated for performance.
417
- */
418
- static BITS = new Uint8Array([
419
- 1,
420
- 2,
421
- 4,
422
- 8,
423
- 16,
424
- 32,
425
- 64,
426
- 128
427
- ]);
428
- /**
429
- * Inverse individual bits, pre-calculated for performance.
430
- */
431
- static INVERSE_BITS = new Uint8Array([
432
- 254,
433
- 253,
434
- 251,
435
- 247,
436
- 239,
437
- 223,
438
- 191,
439
- 127
440
- ]);
441
- /**
442
- * Number of bytes covered by the domain.
443
- */
444
- _domainBytes;
445
- /**
446
- * Xor bytes array generated from the domain and tweak.
447
- */
448
- _xorBytes;
449
- /**
450
- * Bits array generated from the domain and tweak.
451
- */
452
- _bits;
453
- /**
454
- * Inverse bits array generated from the domain and tweak.
455
- */
456
- _inverseBits;
457
- /**
458
- * Number of rounds (length of arrays) generated from the domain and tweak.
459
- */
460
- _rounds;
461
- /**
462
- * Constructor.
463
- *
464
- * @param domain
465
- * Domain.
466
- *
467
- * @param tweak
468
- * Tweak.
469
- */
470
- constructor(domain, tweak) {
471
- super(domain);
472
- if (tweak < 0n) {
473
- throw new RangeError(i18nextUtility.t("Transformer.tweakMustBeGreaterThanOrEqualToZero", {
474
- tweak
475
- }));
476
- }
477
- let domainBytes = 0;
478
- for (let reducedDomainMinusOne = this.domain - 1n; reducedDomainMinusOne !== 0n; reducedDomainMinusOne >>= 8n) {
479
- domainBytes++;
480
- }
481
- this._domainBytes = domainBytes;
482
- const xorBytes = new Array();
483
- const bits = new Array();
484
- const inverseBits = new Array();
485
- for (let reducedKey = this.domain * BigInt(tweak) * 603868999n; reducedKey !== 0n; reducedKey >>= 8n) {
486
- xorBytes.unshift(Number(BigInt.asUintN(8, reducedKey)));
487
- const bitNumber = Number(BigInt.asUintN(3, reducedKey));
488
- bits.push(_EncryptionTransformer.BITS[bitNumber]);
489
- inverseBits.push(_EncryptionTransformer.INVERSE_BITS[bitNumber]);
490
- }
491
- if (domainBytes === 1) {
492
- const domainMask = _EncryptionTransformer.BITS.filter((bit) => bit < domain).reduce((accumulator, bit) => accumulator | bit, 0);
493
- this._xorBytes = new Uint8Array([xorBytes.reduce((accumulator, xorByte) => accumulator ^ xorByte, 0) & domainMask]);
494
- this._bits = new Uint8Array([_EncryptionTransformer.BITS[0]]);
495
- this._inverseBits = new Uint8Array([_EncryptionTransformer.INVERSE_BITS[0]]);
496
- this._rounds = 1;
497
- } else {
498
- this._xorBytes = new Uint8Array(xorBytes);
499
- this._bits = new Uint8Array(bits);
500
- this._inverseBits = new Uint8Array(inverseBits);
501
- this._rounds = xorBytes.length;
502
- }
503
- }
504
- /**
505
- * Convert a value to a byte array big enough to handle the entire domain.
506
- *
507
- * @param value
508
- * Value.
509
- *
510
- * @returns
511
- * Big-endian byte array equivalent to the value.
512
- */
513
- valueToBytes(value) {
514
- const bytes = new Uint8Array(this._domainBytes);
515
- for (let index = this._domainBytes - 1, reducedValue = value; index >= 0 && reducedValue !== 0n; index--, reducedValue >>= 8n) {
516
- bytes[index] = Number(BigInt.asUintN(8, reducedValue));
517
- }
518
- return bytes;
519
- }
520
- /**
521
- * Convert a byte array to a value.
522
- *
523
- * @param bytes
524
- * Big-endian byte array equivalent to the value.
525
- *
526
- * @returns
527
- * Value.
528
- */
529
- static bytesToValue(bytes) {
530
- return bytes.reduce((accumulator, byte) => accumulator << 8n | BigInt(byte), 0n);
531
- }
532
- /**
533
- * Shuffle a byte array.
534
- *
535
- * The input array to the forward operation (output from the reverse operation) is `bytes` and the output array from
536
- * the forward operation (input to the reverse operation) is `bytes'`.
537
- *
538
- * The shuffle operation starts by testing the bit at `bits[round]` for each `byte` in `bytes`. The indexes for all
539
- * bytes with that bit set are put into one array (`shuffleIndexes1`) and the rest are put into another
540
- * (`shuffleIndexes0`). The two arrays are concatenated and used to shuffle the input array, using their values
541
- * (`shuffleIndex`) and the indexes of those values (`index`) in the concatenated array.
542
- *
543
- * Forward shuffling moves the entry at `shuffleIndex` to the `index` position.
544
- *
545
- * Reverse shuffling moves the entry at `index` to the `shuffleIndex` position.
546
- *
547
- * As each byte is moved, the bit at `bits[round]` is preserved in its original position. This ensures that the
548
- * process is reversible.
549
- *
550
- * @param bytes
551
- * Byte array.
552
- *
553
- * @param round
554
- * Round number.
555
- *
556
- * @param forward
557
- * True if operating forward (encrypting), false if operating in reverse (decrypting).
558
- *
559
- * @returns
560
- * Shuffled byte array.
561
- */
562
- shuffle(bytes, round, forward) {
563
- const bytesLength = bytes.length;
564
- const determinants = new Uint8Array(bytesLength);
565
- const shuffleIndexes1 = new Array();
566
- const shuffleIndexes0 = new Array();
567
- const bit = this._bits[round];
568
- bytes.forEach((byte, index) => {
569
- const determinant = byte & bit;
570
- determinants[index] = determinant;
571
- (determinant !== 0 ? shuffleIndexes1 : shuffleIndexes0).push(index);
572
- });
573
- const inverseBit = this._inverseBits[round];
574
- const shuffleBytes = new Uint8Array(bytesLength);
575
- [...shuffleIndexes1, ...shuffleIndexes0].forEach((shuffleIndex, index) => {
576
- if (forward) {
577
- shuffleBytes[index] = bytes[shuffleIndex] & inverseBit | determinants[index];
578
- } else {
579
- shuffleBytes[shuffleIndex] = bytes[index] & inverseBit | determinants[shuffleIndex];
580
- }
581
- });
582
- return shuffleBytes;
583
- }
584
- /**
585
- * Xor a byte array.
586
- *
587
- * The input array to the forward operation (output from the reverse operation) is `bytes` and the output array from
588
- * the forward operation (input to the reverse operation) is `bytes'`.
589
- *
590
- * Forward:
591
- * - `bytes'[0] = bytes[0] ^ xorBytes[round]`
592
- * - `bytes'[1] = bytes[1] ^ bytes'[0]`
593
- * - `bytes'[2] = bytes[2] ^ bytes'[1]`
594
- * - `...`
595
- * - `bytes'[domainBytes - 1] = bytes[domainBytes - 1] ^ bytes'[domainBytes - 2]`
596
- *
597
- * Reverse:
598
- * - `bytes[0] = bytes'[0] ^ xorBytes[round]`
599
- * - `bytes[1] = bytes'[1] ^ bytes'[0]`
600
- * - `bytes[2] = bytes'[2] ^ bytes'[1]`
601
- * - `...`
602
- * - `bytes[domainBytes - 1] = bytes'[domainBytes - 1] ^ bytes'[domainBytes - 2]`
603
- *
604
- * @param bytes
605
- * Byte array.
606
- *
607
- * @param round
608
- * Round number.
609
- *
610
- * @param forward
611
- * True if operating forward (encrypting), false if operating in reverse (decrypting).
612
- *
613
- * @returns
614
- * Xored byte array.
615
- */
616
- xor(bytes, round, forward) {
617
- let cumulativeXorByte = this._xorBytes[round];
618
- return bytes.map((byte) => {
619
- const xorByte = byte ^ cumulativeXorByte;
620
- cumulativeXorByte = forward ? xorByte : byte;
621
- return xorByte;
622
- });
623
- }
624
- /**
625
- * @inheritDoc
626
- */
627
- doForward(value) {
628
- let bytes = this.valueToBytes(value);
629
- let transformedValue;
630
- do {
631
- for (let round = 0; round < this._rounds; round++) {
632
- bytes = this.xor(this.shuffle(bytes, round, true), round, true);
633
- }
634
- transformedValue = _EncryptionTransformer.bytesToValue(bytes);
635
- } while (transformedValue >= this.domain);
636
- return transformedValue;
637
- }
638
- /**
639
- * @inheritDoc
640
- */
641
- doReverse(transformedValue) {
642
- let bytes = this.valueToBytes(transformedValue);
643
- let value;
644
- do {
645
- for (let round = this._rounds - 1; round >= 0; round--) {
646
- bytes = this.shuffle(this.xor(bytes, round, false), round, false);
647
- }
648
- value = _EncryptionTransformer.bytesToValue(bytes);
649
- } while (value >= this.domain);
650
- return value;
651
- }
652
- };
653
-
654
- // src/reg-exp.ts
655
- var RegExpValidator = class {
656
- /**
657
- * Regular expression.
658
- */
659
- _regExp;
660
- /**
661
- * Constructor.
662
- *
663
- * @param regExp
664
- * Regular expression. See {@link RegExpValidator | class documentation} for notes.
665
- */
666
- constructor(regExp) {
667
- this._regExp = regExp;
668
- }
669
- /**
670
- * Get the regular expression.
671
- */
672
- get regExp() {
673
- return this._regExp;
674
- }
675
- /**
676
- * Create an error message for a string. The generic error message is sufficient for many use cases but a more
677
- * domain-specific error message, possibly including the pattern itself, is often required.
678
- *
679
- * @param s
680
- * String.
681
- *
682
- * @returns
683
- * Error message.
684
- */
685
- createErrorMessage(s) {
686
- return i18nextUtility.t("RegExpValidator.stringDoesNotMatchPattern", {
687
- s
688
- });
689
- }
690
- /**
691
- * @inheritDoc
692
- */
693
- validate(s) {
694
- if (!this._regExp.test(s)) {
695
- throw new RangeError(this.createErrorMessage(s));
696
- }
697
- }
698
- };
699
-
700
- // src/record.ts
701
- var RecordValidator = class {
702
- /**
703
- * Type name for error message.
704
- */
705
- _typeName;
706
- /**
707
- * Record in which to look up keys.
708
- */
709
- _record;
710
- /**
711
- * Constructor.
712
- *
713
- * @param typeName
714
- * Type name for error message.
715
- *
716
- * @param record
717
- * Record in which to look up keys.
718
- */
719
- constructor(typeName, record) {
720
- this._typeName = typeName;
721
- this._record = record;
722
- }
723
- /**
724
- * Get the type name.
725
- */
726
- get typeName() {
727
- return this._typeName;
728
- }
729
- /**
730
- * Get the record.
731
- */
732
- get record() {
733
- return this._record;
734
- }
735
- /**
736
- * Validate a key by looking it up in the record.
737
- *
738
- * @param key
739
- * Record key.
740
- */
741
- validate(key) {
742
- if (!(key in this.record)) {
743
- throw new RangeError(i18nextUtility.t("RecordValidator.typeNameKeyNotFound", {
744
- typeName: this.typeName,
745
- key
746
- }));
747
- }
748
- }
749
- };
750
-
751
- // src/character-set.ts
752
- var Exclusion = /* @__PURE__ */ ((Exclusion2) => {
753
- Exclusion2[Exclusion2["None"] = 0] = "None";
754
- Exclusion2[Exclusion2["FirstZero"] = 1] = "FirstZero";
755
- Exclusion2[Exclusion2["AllNumeric"] = 2] = "AllNumeric";
756
- return Exclusion2;
757
- })(Exclusion || {});
758
- var CharacterSetValidator = class _CharacterSetValidator {
759
- static NOT_ALL_NUMERIC_VALIDATOR = new class extends RegExpValidator {
760
- /**
761
- * Create an error message for an all-numeric string.
762
- *
763
- * @param _s
764
- * String.
765
- *
766
- * @returns
767
- * Error message.
768
- */
769
- createErrorMessage(_s) {
770
- return i18nextUtility.t("CharacterSetValidator.stringMustNotBeAllNumeric");
771
- }
772
- }(/\D/);
773
- /**
774
- * Character set.
775
- */
776
- _characterSet;
777
- /**
778
- * Character set map, mapping each character in the character set to its index such that
779
- * `_characterSetMap.get(_characterSet[index]) === index`.
780
- */
781
- _characterSetMap;
782
- /**
783
- * Exclusions supported by the character set.
784
- */
785
- _exclusionSupport;
786
- /**
787
- * Constructor.
788
- *
789
- * @param characterSet
790
- * Character set. Each element is a single-character string, unique within the array, that defines the character
791
- * set.
792
- *
793
- * @param exclusionSupport
794
- * Exclusions supported by the character set. All character sets implicitly support {@link Exclusion.None}.
795
- */
796
- constructor(characterSet, ...exclusionSupport) {
797
- this._characterSet = characterSet;
798
- const characterSetMap = /* @__PURE__ */ new Map();
799
- characterSet.forEach((c, index) => {
800
- characterSetMap.set(c, index);
801
- });
802
- this._characterSetMap = characterSetMap;
803
- this._exclusionSupport = exclusionSupport;
804
- }
805
- /**
806
- * Get the character set.
807
- */
808
- get characterSet() {
809
- return this._characterSet;
810
- }
811
- /**
812
- * Get the character set size.
813
- */
814
- get characterSetSize() {
815
- return this._characterSet.length;
816
- }
817
- /**
818
- * Get the exclusions supported by the character set.
819
- */
820
- get exclusionSupport() {
821
- return this._exclusionSupport;
822
- }
823
- /**
824
- * Get the character at an index.
825
- *
826
- * @param index
827
- * Index into the character set.
828
- *
829
- * @returns
830
- * Character at the index.
831
- */
832
- character(index) {
833
- return this._characterSet[index];
834
- }
835
- /**
836
- * Get the index for a character.
837
- *
838
- * @param c
839
- * Character.
840
- *
841
- * @returns
842
- * Index for the character or undefined if the character is not in the character set.
843
- */
844
- characterIndex(c) {
845
- return this._characterSetMap.get(c);
846
- }
847
- /**
848
- * Get the indexes for all characters in a string.
849
- *
850
- * @param s
851
- * String.
852
- *
853
- * @returns
854
- * Array of indexes for each character or undefined if the character is not in the character set.
855
- */
856
- characterIndexes(s) {
857
- return s.split("").map((c) => this._characterSetMap.get(c));
858
- }
859
- /**
860
- * Convert a component definition to a string or undefined. Checks the type of the component and makes the callback
861
- * if required.
862
- *
863
- * @param component
864
- * Component definition as a string, callback, or undefined.
865
- *
866
- * @returns
867
- * Component as a string or undefined.
868
- */
869
- static componentToString(component) {
870
- return typeof component === "function" ? component() : component;
871
- }
872
- /**
873
- * Validate that an exclusion is supported. If not, an error is thrown.
874
- *
875
- * @param exclusion
876
- * Exclusion.
877
- */
878
- validateExclusion(exclusion) {
879
- if (exclusion !== 0 /* None */ && !this._exclusionSupport.includes(exclusion)) {
880
- throw new RangeError(i18nextUtility.t("CharacterSetValidator.exclusionNotSupported", {
881
- exclusion
882
- }));
883
- }
884
- }
885
- /**
886
- * Validate a string. If the string violates the character set or any of the character set validation parameters, an
887
- * error is thrown.
888
- *
889
- * @param s
890
- * String.
891
- *
892
- * @param validation
893
- * Character set validation parameters.
894
- */
895
- validate(s, validation) {
896
- const length = s.length;
897
- const minimumLength = validation?.minimumLength;
898
- const maximumLength = validation?.maximumLength;
899
- if (minimumLength !== void 0 && length < minimumLength) {
900
- let errorMessage;
901
- if (maximumLength !== void 0 && maximumLength === minimumLength) {
902
- errorMessage = i18nextUtility.t(validation?.component === void 0 ? "CharacterSetValidator.lengthMustBeEqualTo" : "CharacterSetValidator.lengthOfComponentMustBeEqualTo", {
903
- component: _CharacterSetValidator.componentToString(validation?.component),
904
- length,
905
- exactLength: minimumLength
906
- });
907
- } else {
908
- errorMessage = i18nextUtility.t(validation?.component === void 0 ? "CharacterSetValidator.lengthMustBeGreaterThanOrEqualTo" : "CharacterSetValidator.lengthOfComponentMustBeGreaterThanOrEqualTo", {
909
- component: _CharacterSetValidator.componentToString(validation?.component),
910
- length,
911
- minimumLength
912
- });
913
- }
914
- throw new RangeError(errorMessage);
915
- }
916
- if (maximumLength !== void 0 && length > maximumLength) {
917
- throw new RangeError(i18nextUtility.t(validation?.component === void 0 ? "CharacterSetValidator.lengthMustBeLessThanOrEqualTo" : "CharacterSetValidator.lengthOfComponentMustBeLessThanOrEqualTo", {
918
- component: _CharacterSetValidator.componentToString(validation?.component),
919
- length,
920
- maximumLength
921
- }));
922
- }
923
- const index = this.characterIndexes(s).findIndex((characterIndex) => characterIndex === void 0);
924
- if (index !== -1) {
925
- throw new RangeError(i18nextUtility.t(validation?.component === void 0 ? "CharacterSetValidator.invalidCharacterAtPosition" : "CharacterSetValidator.invalidCharacterAtPositionOfComponent", {
926
- component: _CharacterSetValidator.componentToString(validation?.component),
927
- c: s.charAt(index),
928
- position: index + (validation?.positionOffset ?? 0) + 1
929
- }));
930
- }
931
- if (validation?.exclusion !== void 0) {
932
- this.validateExclusion(validation.exclusion);
933
- switch (validation.exclusion) {
934
- case 0 /* None */:
935
- break;
936
- case 1 /* FirstZero */:
937
- if (s.startsWith("0")) {
938
- throw new RangeError(i18nextUtility.t(validation.component === void 0 ? "CharacterSetValidator.invalidCharacterAtPosition" : "CharacterSetValidator.invalidCharacterAtPositionOfComponent", {
939
- component: _CharacterSetValidator.componentToString(validation.component),
940
- c: "0",
941
- position: (validation.positionOffset ?? 0) + 1
942
- }));
943
- }
944
- break;
945
- case 2 /* AllNumeric */:
946
- _CharacterSetValidator.NOT_ALL_NUMERIC_VALIDATOR.validate(s);
947
- break;
948
- }
949
- }
950
- }
951
- };
952
- var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidator {
953
- /**
954
- * Maximum string length supported.
955
- */
956
- static MAXIMUM_STRING_LENGTH = 40;
957
- /**
958
- * Powers of 10 from 1 (`10**0`) to `10**MAXIMUM_STRING_LENGTH`.
959
- */
960
- static _powersOf10 = _CharacterSetCreator.createPowersOf(10);
961
- /**
962
- * Create powers of a given base from 1 (`base**0`) to `base**MAXIMUM_STRING_LENGTH`.
963
- *
964
- * @param base
965
- * Number base.
966
- *
967
- * @returns
968
- * Array of powers of base.
969
- */
970
- static createPowersOf(base) {
971
- const powersOf = new Array(this.MAXIMUM_STRING_LENGTH + 1);
972
- const baseN = BigInt(base);
973
- for (let index = 0, powerOf = 1n; index <= this.MAXIMUM_STRING_LENGTH; index++, powerOf *= baseN) {
974
- powersOf[index] = powerOf;
975
- }
976
- return powersOf;
977
- }
978
- /**
979
- * Get a power of 10.
980
- *
981
- * @param power
982
- * Power.
983
- *
984
- * @returns
985
- * `10**power`.
986
- */
987
- static powerOf10(power) {
988
- return this._powersOf10[power];
989
- }
990
- /**
991
- * Character set size as big integer, cached for performance purposes.
992
- */
993
- _characterSetSizeN;
994
- /**
995
- * Character set size minus 1 as big integer, cached for performance purposes.
996
- */
997
- _characterSetSizeMinusOneN;
998
- /**
999
- * Domains for every length for every supported {@link Exclusion}.
1000
- */
1001
- _exclusionDomains;
1002
- /**
1003
- * Values that would generate all zeros in the created string.
1004
- */
1005
- _allZerosValues;
1006
- /**
1007
- * Constructor.
1008
- *
1009
- * @param characterSet
1010
- * Character set. Each element is a single-character string, unique within the array, that defines the character
1011
- * set.
1012
- *
1013
- * @param exclusionSupport
1014
- * Exclusions supported by the character set. All character sets implicitly support {@link Exclusion.None}.
1015
- */
1016
- constructor(characterSet, ...exclusionSupport) {
1017
- super(characterSet, ...exclusionSupport);
1018
- this._characterSetSizeN = BigInt(this.characterSetSize);
1019
- this._characterSetSizeMinusOneN = BigInt(this.characterSetSize - 1);
1020
- const exclusionDomains = [];
1021
- const exclusionNoneDomains = _CharacterSetCreator.createPowersOf(this.characterSetSize);
1022
- exclusionDomains[0 /* None */] = exclusionNoneDomains;
1023
- if (exclusionSupport.includes(1 /* FirstZero */)) {
1024
- if (characterSet[0] !== "0") {
1025
- throw new RangeError(i18nextUtility.t("CharacterSetValidator.firstZeroFirstCharacter"));
1026
- }
1027
- const exclusionFirstZeroDomains = new Array(_CharacterSetCreator.MAXIMUM_STRING_LENGTH + 1);
1028
- exclusionFirstZeroDomains[0] = 0n;
1029
- for (let index = 1; index <= _CharacterSetCreator.MAXIMUM_STRING_LENGTH; index++) {
1030
- exclusionFirstZeroDomains[index] = this._characterSetSizeMinusOneN * exclusionNoneDomains[index - 1];
1031
- }
1032
- exclusionDomains[1 /* FirstZero */] = exclusionFirstZeroDomains;
1033
- }
1034
- if (exclusionSupport.includes(2 /* AllNumeric */)) {
1035
- let validateNumberIndexes2 = function(numberIndexes2) {
1036
- let expectedNumberIndex = numberIndexes2[0];
1037
- for (const numberIndex of numberIndexes2) {
1038
- if (numberIndex === void 0 || numberIndex !== expectedNumberIndex) {
1039
- throw new RangeError(i18nextUtility.t("CharacterSetValidator.allNumericAllNumericCharacters"));
1040
- }
1041
- expectedNumberIndex = numberIndex + 1;
1042
- }
1043
- };
1044
- var validateNumberIndexes = validateNumberIndexes2;
1045
- const exclusionAllNumericDomains = new Array(_CharacterSetCreator.MAXIMUM_STRING_LENGTH + 1);
1046
- const numberIndexes = this.characterIndexes("0123456789");
1047
- validateNumberIndexes2(numberIndexes);
1048
- const zeroIndex = BigInt(numberIndexes[0]);
1049
- const allZerosValues = new Array(_CharacterSetCreator.MAXIMUM_STRING_LENGTH + 1);
1050
- let allZerosValue = 0n;
1051
- for (let index = 0; index <= _CharacterSetCreator.MAXIMUM_STRING_LENGTH; index++) {
1052
- exclusionAllNumericDomains[index] = exclusionNoneDomains[index] - _CharacterSetCreator.powerOf10(index);
1053
- allZerosValues[index] = allZerosValue;
1054
- allZerosValue = allZerosValue * this._characterSetSizeN + zeroIndex;
1055
- }
1056
- this._allZerosValues = allZerosValues;
1057
- exclusionDomains[2 /* AllNumeric */] = exclusionAllNumericDomains;
1058
- } else {
1059
- this._allZerosValues = [];
1060
- }
1061
- this._exclusionDomains = exclusionDomains;
1062
- }
1063
- /**
1064
- * Get a power of character set size.
1065
- *
1066
- * @param power
1067
- * Power.
1068
- *
1069
- * @returns
1070
- * `characterSetSize**power`.
1071
- */
1072
- powerOfSize(power) {
1073
- return this._exclusionDomains[0 /* None */][power];
1074
- }
1075
- /**
1076
- * Determine the shift required to skip all all-numeric strings up to the value.
1077
- *
1078
- * @param shiftForward
1079
- * True to shift forward (value to string), false to shift backward (string to value).
1080
- *
1081
- * @param length
1082
- * Length of string for which to get the all-numeric shift.
1083
- *
1084
- * @param value
1085
- * Value for which to get the all-numeric shift.
1086
- *
1087
- * @returns
1088
- * Shift required to skip all all-numeric strings.
1089
- */
1090
- allNumericShift(shiftForward, length, value) {
1091
- let shift;
1092
- if (length === 0) {
1093
- if (!shiftForward && value < 10n) {
1094
- throw new RangeError(i18nextUtility.t("CharacterSetValidator.stringMustNotBeAllNumeric"));
1095
- }
1096
- shift = 10n;
1097
- } else {
1098
- const powerOfSize = this.powerOfSize(length);
1099
- const powerOf10 = _CharacterSetCreator.powerOf10(length);
1100
- const gap = shiftForward ? powerOfSize - powerOf10 : powerOfSize;
1101
- const gaps = value / gap;
1102
- if (gaps >= 10n) {
1103
- shift = _CharacterSetCreator.powerOf10(length + 1);
1104
- } else {
1105
- shift = gaps * powerOf10 + this.allNumericShift(shiftForward, length - 1, value - gaps * gap);
1106
- }
1107
- }
1108
- return shift;
1109
- }
1110
- /**
1111
- * Validate that a length is less than or equal to {@link MAXIMUM_STRING_LENGTH}. If not, an error is thrown.
1112
- *
1113
- * @param length
1114
- * Length.
1115
- */
1116
- validateLength(length) {
1117
- if (length < 0) {
1118
- throw new RangeError(i18nextUtility.t("CharacterSetValidator.lengthMustBeGreaterThanOrEqualTo", {
1119
- length,
1120
- minimumLength: 0
1121
- }));
1122
- }
1123
- if (length > _CharacterSetCreator.MAXIMUM_STRING_LENGTH) {
1124
- throw new RangeError(i18nextUtility.t("CharacterSetValidator.lengthMustBeLessThanOrEqualTo", {
1125
- length,
1126
- maximumLength: _CharacterSetCreator.MAXIMUM_STRING_LENGTH
1127
- }));
1128
- }
1129
- }
1130
- /**
1131
- * Create string(s) by mapping value(s) to the equivalent characters in the character set across the length of the
1132
- * string.
1133
- *
1134
- * @param length
1135
- * Required string length.
1136
- *
1137
- * @param valueOrValues
1138
- * Numeric value(s) of the string(s).
1139
- *
1140
- * @param exclusion
1141
- * String(s) to be excluded from the range of outputs. See {@link Exclusion} for possible values and their meaning.
1142
- *
1143
- * @param tweak
1144
- * If provided, the numerical value of the string(s) is/are "tweaked" using an {@link EncryptionTransformer |
1145
- * encryption transformer}.
1146
- *
1147
- * @param creatorCallback
1148
- * If provided, called after each string is constructed to create the final value.
1149
- *
1150
- * @returns
1151
- * String(s) created from the value(s).
1152
- */
1153
- create(length, valueOrValues, exclusion = 0 /* None */, tweak, creatorCallback) {
1154
- this.validateLength(length);
1155
- this.validateExclusion(exclusion);
1156
- const allZerosValue = exclusion === 2 /* AllNumeric */ ? this._allZerosValues[length] : 0n;
1157
- const transformer = Transformer.get(this._exclusionDomains[exclusion][length], tweak);
1158
- return transformer.forward(valueOrValues, (transformedValue, index) => {
1159
- let s = "";
1160
- if (length !== 0) {
1161
- let convertValue = transformedValue;
1162
- if (exclusion === 2 /* AllNumeric */ && convertValue >= allZerosValue) {
1163
- convertValue = convertValue + this.allNumericShift(true, length, convertValue - allZerosValue);
1164
- }
1165
- for (let position = length - 1; position > 0; position--) {
1166
- const nextConvertValue = convertValue / this._characterSetSizeN;
1167
- s = this.character(Number(convertValue - nextConvertValue * this._characterSetSizeN)) + s;
1168
- convertValue = nextConvertValue;
1169
- }
1170
- s = this.character(exclusion === 1 /* FirstZero */ ? Number(convertValue % this._characterSetSizeMinusOneN) + 1 : Number(convertValue % this._characterSetSizeN)) + s;
1171
- }
1172
- return creatorCallback === void 0 ? s : creatorCallback(s, index);
1173
- });
1174
- }
1175
- /**
1176
- * Determine the value for a string.
1177
- *
1178
- * @param s
1179
- * String.
1180
- *
1181
- * @param exclusion
1182
- * Strings excluded from the range of inputs. See {@link Exclusion} for possible values and their meaning.
1183
- *
1184
- * @param tweak
1185
- * If provided, the numerical value of the string was "tweaked" using an {@link EncryptionTransformer | encryption
1186
- * transformer}.
1187
- *
1188
- * @returns
1189
- * Numeric value of the string.
1190
- */
1191
- valueFor(s, exclusion = 0 /* None */, tweak) {
1192
- const length = s.length;
1193
- this.validateLength(length);
1194
- this.validateExclusion(exclusion);
1195
- const characterSetSizeN = BigInt(this.characterSetSize);
1196
- let value = this.characterIndexes(s).reduce((accumulator, characterIndex, index) => {
1197
- if (characterIndex === void 0) {
1198
- throw new RangeError(i18nextUtility.t("CharacterSetValidator.invalidCharacterAtPosition", {
1199
- c: s.charAt(index),
1200
- position: index + 1
1201
- }));
1202
- }
1203
- let value2;
1204
- if (index === 0 && exclusion === 1 /* FirstZero */) {
1205
- if (characterIndex === 0) {
1206
- throw new RangeError(i18nextUtility.t("CharacterSetValidator.invalidCharacterAtPosition", {
1207
- c: "0",
1208
- position: 1
1209
- }));
1210
- }
1211
- value2 = BigInt(characterIndex - 1);
1212
- } else {
1213
- value2 = accumulator * characterSetSizeN + BigInt(characterIndex);
1214
- }
1215
- return value2;
1216
- }, 0n);
1217
- if (exclusion === 2 /* AllNumeric */) {
1218
- const allZerosValue = this._allZerosValues[length];
1219
- if (value >= allZerosValue) {
1220
- value -= this.allNumericShift(false, length, value - allZerosValue);
1221
- }
1222
- }
1223
- return Transformer.get(this._exclusionDomains[exclusion][length], tweak).reverse(value);
1224
- }
1225
- };
1226
- var NUMERIC_CREATOR = new CharacterSetCreator([
1227
- "0",
1228
- "1",
1229
- "2",
1230
- "3",
1231
- "4",
1232
- "5",
1233
- "6",
1234
- "7",
1235
- "8",
1236
- "9"
1237
- ], 1 /* FirstZero */);
1238
- var HEXADECIMAL_CREATOR = new CharacterSetCreator([
1239
- "0",
1240
- "1",
1241
- "2",
1242
- "3",
1243
- "4",
1244
- "5",
1245
- "6",
1246
- "7",
1247
- "8",
1248
- "9",
1249
- "A",
1250
- "B",
1251
- "C",
1252
- "D",
1253
- "E",
1254
- "F"
1255
- ], 1 /* FirstZero */, 2 /* AllNumeric */);
1256
- var ALPHABETIC_CREATOR = new CharacterSetCreator([
1257
- "A",
1258
- "B",
1259
- "C",
1260
- "D",
1261
- "E",
1262
- "F",
1263
- "G",
1264
- "H",
1265
- "I",
1266
- "J",
1267
- "K",
1268
- "L",
1269
- "M",
1270
- "N",
1271
- "O",
1272
- "P",
1273
- "Q",
1274
- "R",
1275
- "S",
1276
- "T",
1277
- "U",
1278
- "V",
1279
- "W",
1280
- "X",
1281
- "Y",
1282
- "Z"
1283
- ]);
1284
- var ALPHANUMERIC_CREATOR = new CharacterSetCreator([
1285
- "0",
1286
- "1",
1287
- "2",
1288
- "3",
1289
- "4",
1290
- "5",
1291
- "6",
1292
- "7",
1293
- "8",
1294
- "9",
1295
- "A",
1296
- "B",
1297
- "C",
1298
- "D",
1299
- "E",
1300
- "F",
1301
- "G",
1302
- "H",
1303
- "I",
1304
- "J",
1305
- "K",
1306
- "L",
1307
- "M",
1308
- "N",
1309
- "O",
1310
- "P",
1311
- "Q",
1312
- "R",
1313
- "S",
1314
- "T",
1315
- "U",
1316
- "V",
1317
- "W",
1318
- "X",
1319
- "Y",
1320
- "Z"
1321
- ], 1 /* FirstZero */, 2 /* AllNumeric */);
1322
- // Annotate the CommonJS export names for ESM import in node:
1323
- 0 && (module.exports = {
1324
- ALPHABETIC_CREATOR,
1325
- ALPHANUMERIC_CREATOR,
1326
- CharacterSetCreator,
1327
- CharacterSetValidator,
1328
- EncryptionTransformer,
1329
- Exclusion,
1330
- HEXADECIMAL_CREATOR,
1331
- IdentityTransformer,
1332
- NUMERIC_CREATOR,
1333
- RecordValidator,
1334
- RegExpValidator,
1335
- Sequence,
1336
- Transformer,
1337
- i18nUtilityInit,
1338
- i18nextUtility,
1339
- transformIterable,
1340
- utilityNS,
1341
- utilityResources
1342
- });
1
+ "use strict";var R=Object.create;var y=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var U=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var F=(i,e)=>{for(var t in e)y(i,t,{get:e[t],enumerable:!0})},A=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of q(e))!G.call(i,n)&&n!==t&&y(i,n,{get:()=>e[n],enumerable:!(r=C(e,n))||r.enumerable});return i};var Z=(i,e,t)=>(t=i!=null?R(U(i)):{},A(e||!i||!i.__esModule?y(t,"default",{value:i,enumerable:!0}):t,i)),D=i=>A(y({},"__esModule",{value:!0}),i);var j={};F(j,{ALPHABETIC_CREATOR:()=>H,ALPHANUMERIC_CREATOR:()=>X,CharacterSetCreator:()=>f,CharacterSetValidator:()=>M,EncryptionTransformer:()=>N,Exclusion:()=>L,HEXADECIMAL_CREATOR:()=>k,IdentityTransformer:()=>S,NUMERIC_CREATOR:()=>z,RecordValidator:()=>w,RegExpValidator:()=>x,Sequence:()=>T,Transformer:()=>g,i18nUtilityInit:()=>P,i18nextUtility:()=>u,transformIterable:()=>b,utilityNS:()=>V,utilityResources:()=>O});module.exports=D(j);var E=require("@aidc-toolkit/core"),B=Z(require("i18next"),1);var _={Transformer:{domainMustBeGreaterThanZero:"Domain {{domain}} must be greater than 0",tweakMustBeGreaterThanOrEqualToZero:"Tweak {{tweak}} must be greater than or equal to 0",valueMustBeGreaterThanOrEqualToZero:"Value {{value}} must be greater than or equal to 0",valueMustBeLessThan:"Value {{value}} must be less than {{domain}}",minimumValueMustBeGreaterThanOrEqualToZero:"Minimum value {{minimumValue}} must be greater than or equal to 0",maximumValueMustBeLessThan:"Maximum value {{maximumValue}} must be less than {{domain}}"},RegExpValidator:{stringDoesNotMatchPattern:"String {{s}} does not match pattern"},CharacterSetValidator:{firstZeroFirstCharacter:"Character set must support zero as first character",allNumericAllNumericCharacters:"Character set must support all numeric characters in sequence",stringMustNotBeAllNumeric:"String must not be all numeric",lengthMustBeGreaterThanOrEqualTo:"Length {{length}} must be greater than or equal to {{minimumLength}}",lengthMustBeLessThanOrEqualTo:"Length {{length}} must be less than or equal to {{maximumLength}}",lengthMustBeEqualTo:"Length {{length}} must be equal to {{exactLength}}",lengthOfComponentMustBeGreaterThanOrEqualTo:"Length {{length}} of {{component}} must be greater than or equal to {{minimumLength}}",lengthOfComponentMustBeLessThanOrEqualTo:"Length {{length}} of {{component}} must be less than or equal to {{maximumLength}}",lengthOfComponentMustBeEqualTo:"Length {{length}} of {{component}} must be equal to {{exactLength}}",invalidCharacterAtPosition:"Invalid character '{{c}}' at position {{position}}",invalidCharacterAtPositionOfComponent:"Invalid character '{{c}}' at position {{position}} of {{component}}",exclusionNotSupported:"Exclusion value of {{exclusion}} is not supported",invalidTweakWithAllNumericExclusion:"Tweak must not be used with all-numeric exclusion",endSequenceValueMustBeLessThanOrEqualTo:"End sequence value (start sequence value + count - 1) must be less than {{domain}}"},RecordValidator:{typeNameKeyNotFound:'{{typeName}} "{{key}}" not found'}};var v={Transformer:{domainMustBeGreaterThanZero:"Le domaine {{domain}} doit \xEAtre sup\xE9rieur \xE0 0",tweakMustBeGreaterThanOrEqualToZero:"Le r\xE9glage {{tweak}} doit \xEAtre sup\xE9rieur ou \xE9gal \xE0 0",valueMustBeGreaterThanOrEqualToZero:"La valeur {{value}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 0",valueMustBeLessThan:"La valeur {{value}} doit \xEAtre inf\xE9rieure \xE0 {{domain}}",minimumValueMustBeGreaterThanOrEqualToZero:"La valeur minimale {{minimumValue}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 0",maximumValueMustBeLessThan:"La valeur maximale {{maximumValue}} doit \xEAtre inf\xE9rieure \xE0 {{domain}}"},RegExpValidator:{stringDoesNotMatchPattern:"La cha\xEEne {{s}} ne correspond pas au mod\xE8le"},CharacterSetValidator:{firstZeroFirstCharacter:"Le jeu de caract\xE8res doit prendre en charge z\xE9ro comme premier caract\xE8re",allNumericAllNumericCharacters:"Le jeu de caract\xE8res doit prendre en charge tous les caract\xE8res num\xE9riques en s\xE9quence",stringMustNotBeAllNumeric:"La cha\xEEne ne doit pas \xEAtre enti\xE8rement num\xE9rique",lengthMustBeGreaterThanOrEqualTo:"La longueur {{length}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 {{minimumLength}}",lengthMustBeLessThanOrEqualTo:"La longueur {{length}} doit \xEAtre inf\xE9rieure ou \xE9gale \xE0 {{maximumLength}}",lengthMustBeEqualTo:"La longueur {{length}} doit \xEAtre \xE9gale \xE0 {{exactLength}}",lengthOfComponentMustBeGreaterThanOrEqualTo:"La longueur {{length}} de {{component}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 {{minimumLength}}",lengthOfComponentMustBeLessThanOrEqualTo:"La longueur {{length}} de {{component}} doit \xEAtre inf\xE9rieure ou \xE9gale \xE0 {{maximumLength}}",lengthOfComponentMustBeEqualTo:"La longueur {{length}} de {{component}} doit \xEAtre \xE9gale \xE0 {{exactLength}}",invalidCharacterAtPosition:"Caract\xE8re non valide '{{c}}' \xE0 la position {{position}}",invalidCharacterAtPositionOfComponent:"Caract\xE8re non valide '{{c}}' \xE0 la position {{position}} de {{component}}",exclusionNotSupported:"La valeur d'exclusion de {{exclusion}} n'est pas prise en charge",invalidTweakWithAllNumericExclusion:"Le r\xE9glage ne doit pas \xEAtre utilis\xE9 avec une exclusion enti\xE8rement num\xE9rique",endSequenceValueMustBeLessThanOrEqualTo:"La valeur de la s\xE9quence de fin (valeur de la s\xE9quence de d\xE9but + nombre - 1) doit \xEAtre inf\xE9rieure \xE0 {{domaine}}"},RecordValidator:{typeNameKeyNotFound:'{{typeName}} "{{key}}" introuvable'}};var V="aidct_utility";(0,E.i18nAssertValidResources)(_,"fr",v);var O={en:{aidct_utility:_},fr:{aidct_utility:v}},u=B.default.createInstance();async function P(i,e=!1){await(0,E.i18nCoreInit)(u,i,e,V,O)}var T=class{_startValue;_endValue;_count;_nextDelta;_minimumValue;_maximumValue;constructor(e,t){this._startValue=BigInt(e),this._endValue=this._startValue+BigInt(t),this._count=t,t>=0?(this._nextDelta=1n,this._minimumValue=this._startValue,this._maximumValue=this._endValue-1n):(this._nextDelta=-1n,this._minimumValue=this._endValue+1n,this._maximumValue=this._startValue)}get startValue(){return this._startValue}get endValue(){return this._endValue}get count(){return this._count}get minimumValue(){return this._minimumValue}get maximumValue(){return this._maximumValue}*[Symbol.iterator](){for(let e=this._startValue;e!==this._endValue;e+=this._nextDelta)yield e}};function b(i,e){return{*[Symbol.iterator](){let t=0;for(let r of i)yield e(r,t++)}}}var g=class i{static TRANSFORMER_MAPS_MAP=new Map;_domain;constructor(e){if(this._domain=BigInt(e),this._domain<=0n)throw new RangeError(u.t("Transformer.domainMustBeGreaterThanZero",{domain:e}))}static get(e,t){let r=BigInt(e),n=i.TRANSFORMER_MAPS_MAP.get(r);n===void 0&&(n=new Map,i.TRANSFORMER_MAPS_MAP.set(r,n));let a=t===void 0?void 0:BigInt(t),o=n.get(a);return o===void 0&&(o=a===void 0?new S(r):new N(r,a),n.set(a,o)),o}get domain(){return this._domain}validate(e){if(e<0n)throw new RangeError(u.t("Transformer.valueMustBeGreaterThanOrEqualToZero",{value:e}));if(e>=this.domain)throw new RangeError(u.t("Transformer.valueMustBeLessThan",{value:e,domain:this.domain}))}validateDoForward(e){let t=BigInt(e);return this.validate(t),this.doForward(t)}validateDoForwardCallback(e,t,r){return e(this.validateDoForward(t),r)}forward(e,t){let r;if(typeof e!="object")r=t===void 0?this.validateDoForward(e):this.validateDoForwardCallback(t,e,0);else if(e instanceof T){if(e.minimumValue<0n)throw new RangeError(u.t("Transformer.minimumValueMustBeGreaterThanOrEqualToZero",{minimumValue:e.minimumValue}));if(e.maximumValue>=this.domain)throw new RangeError(u.t("Transformer.maximumValueMustBeLessThan",{maximumValue:e.maximumValue,domain:this.domain}));r=t===void 0?b(e,n=>this.doForward(n)):b(e,(n,a)=>t(this.doForward(n),a))}else r=t===void 0?b(e,n=>this.validateDoForward(n)):b(e,(n,a)=>this.validateDoForwardCallback(t,n,a));return r}reverse(e){let t=BigInt(e);return this.validate(t),this.doReverse(t)}},S=class extends g{doForward(e){return e}doReverse(e){return e}},N=class i extends g{static BITS=new Uint8Array([1,2,4,8,16,32,64,128]);static INVERSE_BITS=new Uint8Array([254,253,251,247,239,223,191,127]);_domainBytes;_xorBytes;_bits;_inverseBits;_rounds;constructor(e,t){if(super(e),t<0n)throw new RangeError(u.t("Transformer.tweakMustBeGreaterThanOrEqualToZero",{tweak:t}));let r=0;for(let s=this.domain-1n;s!==0n;s>>=8n)r++;this._domainBytes=r;let n=new Array,a=new Array,o=new Array;for(let s=this.domain*BigInt(t)*603868999n;s!==0n;s>>=8n){n.unshift(Number(BigInt.asUintN(8,s)));let l=Number(BigInt.asUintN(3,s));a.push(i.BITS[l]),o.push(i.INVERSE_BITS[l])}if(r===1){let s=i.BITS.filter(l=>l<e).reduce((l,h)=>l|h,0);this._xorBytes=new Uint8Array([n.reduce((l,h)=>l^h,0)&s]),this._bits=new Uint8Array([i.BITS[0]]),this._inverseBits=new Uint8Array([i.INVERSE_BITS[0]]),this._rounds=1}else this._xorBytes=new Uint8Array(n),this._bits=new Uint8Array(a),this._inverseBits=new Uint8Array(o),this._rounds=n.length}valueToBytes(e){let t=new Uint8Array(this._domainBytes);for(let r=this._domainBytes-1,n=e;r>=0&&n!==0n;r--,n>>=8n)t[r]=Number(BigInt.asUintN(8,n));return t}static bytesToValue(e){return e.reduce((t,r)=>t<<8n|BigInt(r),0n)}shuffle(e,t,r){let n=e.length,a=new Uint8Array(n),o=new Array,s=new Array,l=this._bits[t];e.forEach((m,c)=>{let p=m&l;a[c]=p,(p!==0?o:s).push(c)});let h=this._inverseBits[t],d=new Uint8Array(n);return[...o,...s].forEach((m,c)=>{r?d[c]=e[m]&h|a[c]:d[m]=e[c]&h|a[m]}),d}xor(e,t,r){let n=this._xorBytes[t];return e.map(a=>{let o=a^n;return n=r?o:a,o})}doForward(e){let t=this.valueToBytes(e),r;do{for(let n=0;n<this._rounds;n++)t=this.xor(this.shuffle(t,n,!0),n,!0);r=i.bytesToValue(t)}while(r>=this.domain);return r}doReverse(e){let t=this.valueToBytes(e),r;do{for(let n=this._rounds-1;n>=0;n--)t=this.shuffle(this.xor(t,n,!1),n,!1);r=i.bytesToValue(t)}while(r>=this.domain);return r}};var x=class{_regExp;constructor(e){this._regExp=e}get regExp(){return this._regExp}createErrorMessage(e){return u.t("RegExpValidator.stringDoesNotMatchPattern",{s:e})}validate(e){if(!this._regExp.test(e))throw new RangeError(this.createErrorMessage(e))}};var w=class{_typeName;_record;constructor(e,t){this._typeName=e,this._record=t}get typeName(){return this._typeName}get record(){return this._record}validate(e){if(!(e in this.record))throw new RangeError(u.t("RecordValidator.typeNameKeyNotFound",{typeName:this.typeName,key:e}))}};var L=(r=>(r[r.None=0]="None",r[r.FirstZero=1]="FirstZero",r[r.AllNumeric=2]="AllNumeric",r))(L||{}),M=class i{static NOT_ALL_NUMERIC_VALIDATOR=new class extends x{createErrorMessage(e){return u.t("CharacterSetValidator.stringMustNotBeAllNumeric")}}(/\D/);_characterSet;_characterSetMap;_exclusionSupport;constructor(e,...t){this._characterSet=e;let r=new Map;e.forEach((n,a)=>{r.set(n,a)}),this._characterSetMap=r,this._exclusionSupport=t}get characterSet(){return this._characterSet}get characterSetSize(){return this._characterSet.length}get exclusionSupport(){return this._exclusionSupport}character(e){return this._characterSet[e]}characterIndex(e){return this._characterSetMap.get(e)}characterIndexes(e){return Array.from(e).map(t=>this._characterSetMap.get(t))}static componentToString(e){return typeof e=="function"?e():e}validateExclusion(e){if(e!==0&&!this._exclusionSupport.includes(e))throw new RangeError(u.t("CharacterSetValidator.exclusionNotSupported",{exclusion:e}))}validate(e,t){let r=e.length,n=t?.minimumLength,a=t?.maximumLength;if(n!==void 0&&r<n){let s;throw a!==void 0&&a===n?s=u.t(t?.component===void 0?"CharacterSetValidator.lengthMustBeEqualTo":"CharacterSetValidator.lengthOfComponentMustBeEqualTo",{component:i.componentToString(t?.component),length:r,exactLength:n}):s=u.t(t?.component===void 0?"CharacterSetValidator.lengthMustBeGreaterThanOrEqualTo":"CharacterSetValidator.lengthOfComponentMustBeGreaterThanOrEqualTo",{component:i.componentToString(t?.component),length:r,minimumLength:n}),new RangeError(s)}if(a!==void 0&&r>a)throw new RangeError(u.t(t?.component===void 0?"CharacterSetValidator.lengthMustBeLessThanOrEqualTo":"CharacterSetValidator.lengthOfComponentMustBeLessThanOrEqualTo",{component:i.componentToString(t?.component),length:r,maximumLength:a}));let o=this.characterIndexes(e).findIndex(s=>s===void 0);if(o!==-1)throw new RangeError(u.t(t?.component===void 0?"CharacterSetValidator.invalidCharacterAtPosition":"CharacterSetValidator.invalidCharacterAtPositionOfComponent",{component:i.componentToString(t?.component),c:e.charAt(o),position:o+(t?.positionOffset??0)+1}));if(t?.exclusion!==void 0)switch(this.validateExclusion(t.exclusion),t.exclusion){case 0:break;case 1:if(e.startsWith("0"))throw new RangeError(u.t(t.component===void 0?"CharacterSetValidator.invalidCharacterAtPosition":"CharacterSetValidator.invalidCharacterAtPositionOfComponent",{component:i.componentToString(t.component),c:"0",position:(t.positionOffset??0)+1}));break;case 2:i.NOT_ALL_NUMERIC_VALIDATOR.validate(e);break}}},f=class i extends M{static MAXIMUM_STRING_LENGTH=40;static _powersOf10=i.createPowersOf(10);static createPowersOf(e){let t=new Array(this.MAXIMUM_STRING_LENGTH+1),r=BigInt(e);for(let n=0,a=1n;n<=this.MAXIMUM_STRING_LENGTH;n++,a*=r)t[n]=a;return t}static powerOf10(e){return this._powersOf10[e]}_characterSetSizeN;_characterSetSizeMinusOneN;_exclusionDomains;_allZerosValues;constructor(e,...t){super(e,...t),this._characterSetSizeN=BigInt(this.characterSetSize),this._characterSetSizeMinusOneN=BigInt(this.characterSetSize-1);let r=[],n=i.createPowersOf(this.characterSetSize);if(r[0]=n,t.includes(1)){if(e[0]!=="0")throw new RangeError(u.t("CharacterSetValidator.firstZeroFirstCharacter"));let o=new Array(i.MAXIMUM_STRING_LENGTH+1);o[0]=0n;for(let s=1;s<=i.MAXIMUM_STRING_LENGTH;s++)o[s]=this._characterSetSizeMinusOneN*n[s-1];r[1]=o}if(t.includes(2)){let s=function(c){let p=c[0];for(let I of c){if(I===void 0||I!==p)throw new RangeError(u.t("CharacterSetValidator.allNumericAllNumericCharacters"));p=I+1}};var a=s;let o=new Array(i.MAXIMUM_STRING_LENGTH+1),l=this.characterIndexes("0123456789");s(l);let h=BigInt(l[0]),d=new Array(i.MAXIMUM_STRING_LENGTH+1),m=0n;for(let c=0;c<=i.MAXIMUM_STRING_LENGTH;c++)o[c]=n[c]-i.powerOf10(c),d[c]=m,m=m*this._characterSetSizeN+h;this._allZerosValues=d,r[2]=o}else this._allZerosValues=[];this._exclusionDomains=r}powerOfSize(e){return this._exclusionDomains[0][e]}allNumericShift(e,t,r){let n;if(t===0){if(!e&&r<10n)throw new RangeError(u.t("CharacterSetValidator.stringMustNotBeAllNumeric"));n=10n}else{let a=this.powerOfSize(t),o=i.powerOf10(t),s=e?a-o:a,l=r/s;l>=10n?n=i.powerOf10(t+1):n=l*o+this.allNumericShift(e,t-1,r-l*s)}return n}validateLength(e){if(e<0)throw new RangeError(u.t("CharacterSetValidator.lengthMustBeGreaterThanOrEqualTo",{length:e,minimumLength:0}));if(e>i.MAXIMUM_STRING_LENGTH)throw new RangeError(u.t("CharacterSetValidator.lengthMustBeLessThanOrEqualTo",{length:e,maximumLength:i.MAXIMUM_STRING_LENGTH}))}create(e,t,r=0,n,a){this.validateLength(e),this.validateExclusion(r);let o=r===2?this._allZerosValues[e]:0n;return g.get(this._exclusionDomains[r][e],n).forward(t,(l,h)=>{let d="";if(e!==0){let m=l;r===2&&m>=o&&(m=m+this.allNumericShift(!0,e,m-o));for(let c=e-1;c>0;c--){let p=m/this._characterSetSizeN;d=this.character(Number(m-p*this._characterSetSizeN))+d,m=p}d=this.character(r===1?Number(m%this._characterSetSizeMinusOneN)+1:Number(m%this._characterSetSizeN))+d}return a===void 0?d:a(d,h)})}valueFor(e,t=0,r){let n=e.length;this.validateLength(n),this.validateExclusion(t);let a=BigInt(this.characterSetSize),o=this.characterIndexes(e).reduce((s,l,h)=>{if(l===void 0)throw new RangeError(u.t("CharacterSetValidator.invalidCharacterAtPosition",{c:e.charAt(h),position:h+1}));let d;if(h===0&&t===1){if(l===0)throw new RangeError(u.t("CharacterSetValidator.invalidCharacterAtPosition",{c:"0",position:1}));d=BigInt(l-1)}else d=s*a+BigInt(l);return d},0n);if(t===2){let s=this._allZerosValues[n];o>=s&&(o-=this.allNumericShift(!1,n,o-s))}return g.get(this._exclusionDomains[t][n],r).reverse(o)}},z=new f(["0","1","2","3","4","5","6","7","8","9"],1),k=new f(["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"],1,2),H=new f(["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]),X=new f(["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],1,2);0&&(module.exports={ALPHABETIC_CREATOR,ALPHANUMERIC_CREATOR,CharacterSetCreator,CharacterSetValidator,EncryptionTransformer,Exclusion,HEXADECIMAL_CREATOR,IdentityTransformer,NUMERIC_CREATOR,RecordValidator,RegExpValidator,Sequence,Transformer,i18nUtilityInit,i18nextUtility,transformIterable,utilityNS,utilityResources});
1343
2
  /*!
1344
3
  * Copyright © 2024-2025 Dolphin Data Development Ltd. and AIDC Toolkit
1345
4
  * contributors