@aidc-toolkit/utility 0.9.7-beta → 0.9.9-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/LICENSE +0 -27
- package/README.md +14 -0
- package/dist/index.cjs +163 -533
- package/dist/index.d.cts +156 -89
- package/dist/index.d.ts +156 -89
- package/dist/index.js +145 -528
- package/package.json +8 -7
- package/src/{character_set.ts → character-set.ts} +18 -37
- package/src/index.ts +20 -6
- package/src/locale/en/{locale_strings.ts → locale-strings.ts} +2 -2
- package/src/locale/fr/{locale_strings.ts → locale-strings.ts} +2 -2
- package/src/locale/i18n.ts +38 -6
- package/src/locale/i18next.d.ts +3 -3
- package/src/record.ts +3 -4
- package/src/{reg_exp.ts → reg-exp.ts} +2 -3
- package/src/sequence.ts +107 -0
- package/src/transformer.ts +156 -87
- package/test/{character_set.test.ts → character-set.test.ts} +7 -6
- package/test/record.test.ts +3 -3
- package/test/{reg_exp.test.ts → reg-exp.test.ts} +3 -3
- package/test/sequence.test.ts +61 -0
- package/test/transformer.test.ts +38 -11
- package/src/iterator_proxy.ts +0 -517
- package/src/sequencer.ts +0 -149
- package/src/types.ts +0 -46
- package/test/iterator_proxy.test.ts +0 -252
- package/test/sequencer.test.ts +0 -72
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,11 +17,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
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
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
23
33
|
ALPHABETIC_CREATOR: () => ALPHABETIC_CREATOR,
|
|
24
34
|
ALPHANUMERIC_CREATOR: () => ALPHANUMERIC_CREATOR,
|
|
25
35
|
CharacterSetCreator: () => CharacterSetCreator,
|
|
@@ -28,28 +38,32 @@ __export(src_exports, {
|
|
|
28
38
|
Exclusion: () => Exclusion,
|
|
29
39
|
HEXADECIMAL_CREATOR: () => HEXADECIMAL_CREATOR,
|
|
30
40
|
IdentityTransformer: () => IdentityTransformer,
|
|
31
|
-
IteratorProxy: () => IteratorProxy,
|
|
32
41
|
NUMERIC_CREATOR: () => NUMERIC_CREATOR,
|
|
33
42
|
RecordValidator: () => RecordValidator,
|
|
34
43
|
RegExpValidator: () => RegExpValidator,
|
|
35
|
-
|
|
44
|
+
Sequence: () => Sequence,
|
|
36
45
|
Transformer: () => Transformer,
|
|
37
|
-
|
|
46
|
+
i18nUtilityInit: () => i18nUtilityInit,
|
|
47
|
+
i18nextUtility: () => i18nextUtility,
|
|
48
|
+
transformIterable: () => transformIterable,
|
|
49
|
+
utilityNS: () => utilityNS,
|
|
50
|
+
utilityResources: () => utilityResources
|
|
38
51
|
});
|
|
39
|
-
module.exports = __toCommonJS(
|
|
52
|
+
module.exports = __toCommonJS(index_exports);
|
|
40
53
|
|
|
41
54
|
// src/locale/i18n.ts
|
|
42
55
|
var import_core = require("@aidc-toolkit/core");
|
|
56
|
+
var import_i18next = __toESM(require("i18next"), 1);
|
|
43
57
|
|
|
44
|
-
// src/locale/en/
|
|
58
|
+
// src/locale/en/locale-strings.ts
|
|
45
59
|
var localeStrings = {
|
|
46
60
|
Transformer: {
|
|
47
61
|
domainMustBeGreaterThanZero: "Domain {{domain}} must be greater than 0",
|
|
48
62
|
tweakMustBeGreaterThanOrEqualToZero: "Tweak {{tweak}} must be greater than or equal to 0",
|
|
49
63
|
valueMustBeGreaterThanOrEqualToZero: "Value {{value}} must be greater than or equal to 0",
|
|
50
64
|
valueMustBeLessThan: "Value {{value}} must be less than {{domain}}",
|
|
51
|
-
|
|
52
|
-
|
|
65
|
+
minimumValueMustBeGreaterThanOrEqualToZero: "Minimum value {{minimumValue}} must be greater than or equal to 0",
|
|
66
|
+
maximumValueMustBeLessThan: "Maximum value {{maximumValue}} must be less than {{domain}}"
|
|
53
67
|
},
|
|
54
68
|
RegExpValidator: {
|
|
55
69
|
stringDoesNotMatchPattern: "String {{s}} does not match pattern"
|
|
@@ -75,15 +89,15 @@ var localeStrings = {
|
|
|
75
89
|
}
|
|
76
90
|
};
|
|
77
91
|
|
|
78
|
-
// src/locale/fr/
|
|
92
|
+
// src/locale/fr/locale-strings.ts
|
|
79
93
|
var localeStrings2 = {
|
|
80
94
|
Transformer: {
|
|
81
95
|
domainMustBeGreaterThanZero: "Le domaine {{domain}} doit \xEAtre sup\xE9rieur \xE0 0",
|
|
82
96
|
tweakMustBeGreaterThanOrEqualToZero: "Le r\xE9glage {{tweak}} doit \xEAtre sup\xE9rieur ou \xE9gal \xE0 0",
|
|
83
97
|
valueMustBeGreaterThanOrEqualToZero: "La valeur {{value}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 0",
|
|
84
98
|
valueMustBeLessThan: "La valeur {{value}} doit \xEAtre inf\xE9rieure \xE0 {{domain}}",
|
|
85
|
-
|
|
86
|
-
|
|
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}}"
|
|
87
101
|
},
|
|
88
102
|
RegExpValidator: {
|
|
89
103
|
stringDoesNotMatchPattern: "La cha\xEEne {{s}} ne correspond pas au mod\xE8le"
|
|
@@ -112,389 +126,21 @@ var localeStrings2 = {
|
|
|
112
126
|
// src/locale/i18n.ts
|
|
113
127
|
var utilityNS = "aidct_utility";
|
|
114
128
|
(0, import_core.i18nAssertValidResources)(localeStrings, "fr", localeStrings2);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Convert an iteration source to an iterable.
|
|
123
|
-
*
|
|
124
|
-
* @param iterationSource
|
|
125
|
-
* Iteration source.
|
|
126
|
-
*
|
|
127
|
-
* @returns
|
|
128
|
-
* Iteration source if it is already an iterable, otherwise iteration source wrapped in an iterable.
|
|
129
|
-
*/
|
|
130
|
-
static toIterable(iterationSource) {
|
|
131
|
-
return Symbol.iterator in iterationSource ? iterationSource : {
|
|
132
|
-
[Symbol.iterator]() {
|
|
133
|
-
return iterationSource;
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Initial iterable.
|
|
139
|
-
*/
|
|
140
|
-
_initialIterable;
|
|
141
|
-
/**
|
|
142
|
-
* Initial iterator.
|
|
143
|
-
*/
|
|
144
|
-
_initialIterator;
|
|
145
|
-
/**
|
|
146
|
-
* Constructor.
|
|
147
|
-
*
|
|
148
|
-
* @param initialIterationSource
|
|
149
|
-
* Initial iteration source.
|
|
150
|
-
*/
|
|
151
|
-
constructor(initialIterationSource) {
|
|
152
|
-
this._initialIterable = _IteratorProxyBase.toIterable(initialIterationSource);
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Get the initial iterable.
|
|
156
|
-
*/
|
|
157
|
-
get initialIterable() {
|
|
158
|
-
return this._initialIterable;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Get the initial iterator.
|
|
162
|
-
*/
|
|
163
|
-
get initialIterator() {
|
|
164
|
-
if (this._initialIterator === void 0) {
|
|
165
|
-
this._initialIterator = this.initialIterable[Symbol.iterator]();
|
|
166
|
-
}
|
|
167
|
-
return this._initialIterator;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* @inheritDoc
|
|
171
|
-
*/
|
|
172
|
-
get [Symbol.toStringTag]() {
|
|
173
|
-
return "IteratorProxy";
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* @inheritDoc
|
|
177
|
-
*/
|
|
178
|
-
[Symbol.dispose]() {
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* @inheritDoc
|
|
182
|
-
*/
|
|
183
|
-
[Symbol.iterator]() {
|
|
184
|
-
return this;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Get the next result from the initial iterator.
|
|
188
|
-
*
|
|
189
|
-
* @param value
|
|
190
|
-
* Tuple value to be passed to Iterator.next().
|
|
191
|
-
*
|
|
192
|
-
* @returns
|
|
193
|
-
* Next result from the initial iterator.
|
|
194
|
-
*/
|
|
195
|
-
initialNext(...value) {
|
|
196
|
-
return this.initialIterator.next(...value);
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* @inheritDoc
|
|
200
|
-
*/
|
|
201
|
-
map(callback) {
|
|
202
|
-
return new IteratorMapProxy(this, callback);
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* @inheritDoc
|
|
206
|
-
*/
|
|
207
|
-
flatMap(callback) {
|
|
208
|
-
return new IteratorFlatMapProxy(this, callback);
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* @inheritDoc
|
|
212
|
-
*/
|
|
213
|
-
filter(predicate) {
|
|
214
|
-
return new IteratorFilterProxy(this, predicate, true);
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* @inheritDoc
|
|
218
|
-
*/
|
|
219
|
-
take(limit) {
|
|
220
|
-
return new IteratorTakeProxy(this, limit);
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* @inheritDoc
|
|
224
|
-
*/
|
|
225
|
-
drop(count) {
|
|
226
|
-
return new IteratorDropProxy(this, count);
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* @inheritDoc
|
|
230
|
-
*/
|
|
231
|
-
reduce(callback, initialValue) {
|
|
232
|
-
let index = 0;
|
|
233
|
-
let result = initialValue;
|
|
234
|
-
for (const value of this) {
|
|
235
|
-
if (index === 0 && arguments.length === 1) {
|
|
236
|
-
result = value;
|
|
237
|
-
} else {
|
|
238
|
-
result = callback(result, value, index);
|
|
239
|
-
}
|
|
240
|
-
index++;
|
|
241
|
-
}
|
|
242
|
-
if (index === 0 && arguments.length === 1) {
|
|
243
|
-
throw new Error("reduce() of empty iterator with no initial value");
|
|
244
|
-
}
|
|
245
|
-
return result;
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* @inheritDoc
|
|
249
|
-
*/
|
|
250
|
-
toArray() {
|
|
251
|
-
return Array.from(this);
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* @inheritDoc
|
|
255
|
-
*/
|
|
256
|
-
forEach(callback) {
|
|
257
|
-
let index = 0;
|
|
258
|
-
for (const element of this) {
|
|
259
|
-
callback(element, index++);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* @inheritDoc
|
|
264
|
-
*/
|
|
265
|
-
some(predicate) {
|
|
266
|
-
return new IteratorFilterProxy(this, predicate, true).next().done !== true;
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* @inheritDoc
|
|
270
|
-
*/
|
|
271
|
-
every(predicate) {
|
|
272
|
-
return new IteratorFilterProxy(this, predicate, false).next().done === true;
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* @inheritDoc
|
|
276
|
-
*/
|
|
277
|
-
find(predicate) {
|
|
278
|
-
return new IteratorFilterProxy(this, predicate, true).next().value;
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
var IteratorProxyObject = class extends IteratorProxyBase {
|
|
282
|
-
/**
|
|
283
|
-
* @inheritDoc
|
|
284
|
-
*/
|
|
285
|
-
next(...value) {
|
|
286
|
-
return this.initialNext(...value);
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
var IteratorMapProxyBase = class extends IteratorProxyBase {
|
|
290
|
-
/**
|
|
291
|
-
* Callback.
|
|
292
|
-
*/
|
|
293
|
-
_callback;
|
|
294
|
-
/**
|
|
295
|
-
* Index into initial iteration source.
|
|
296
|
-
*/
|
|
297
|
-
_index;
|
|
298
|
-
/**
|
|
299
|
-
* Constructor.
|
|
300
|
-
*
|
|
301
|
-
* @param initialIterationSource
|
|
302
|
-
* Initial iteration source.
|
|
303
|
-
*
|
|
304
|
-
* @param callback
|
|
305
|
-
* Callback.
|
|
306
|
-
*/
|
|
307
|
-
constructor(initialIterationSource, callback) {
|
|
308
|
-
super(initialIterationSource);
|
|
309
|
-
this._callback = callback;
|
|
310
|
-
this._index = 0;
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Get the next result from the intermediate iterator.
|
|
314
|
-
*
|
|
315
|
-
* @param value
|
|
316
|
-
* Tuple value to be passed to Iterator.next().
|
|
317
|
-
*
|
|
318
|
-
* @returns
|
|
319
|
-
* Next result from the intermediate iterator.
|
|
320
|
-
*/
|
|
321
|
-
intermediateNext(...value) {
|
|
322
|
-
const initialResult = this.initialNext(...value);
|
|
323
|
-
return initialResult.done !== true ? {
|
|
324
|
-
value: this._callback(initialResult.value, this._index++)
|
|
325
|
-
} : {
|
|
326
|
-
done: true,
|
|
327
|
-
value: void 0
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
};
|
|
331
|
-
var IteratorMapProxy = class extends IteratorMapProxyBase {
|
|
332
|
-
/**
|
|
333
|
-
* @inheritDoc
|
|
334
|
-
*/
|
|
335
|
-
next(...value) {
|
|
336
|
-
return this.intermediateNext(...value);
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
|
-
var IteratorFlatMapProxy = class extends IteratorMapProxyBase {
|
|
340
|
-
_intermediateIterator;
|
|
341
|
-
/**
|
|
342
|
-
* @inheritDoc
|
|
343
|
-
*/
|
|
344
|
-
next(...value) {
|
|
345
|
-
let finalResult = void 0;
|
|
346
|
-
do {
|
|
347
|
-
if (this._intermediateIterator === void 0) {
|
|
348
|
-
const intermediateResult = this.intermediateNext(...value);
|
|
349
|
-
if (intermediateResult.done === true) {
|
|
350
|
-
finalResult = intermediateResult;
|
|
351
|
-
} else {
|
|
352
|
-
this._intermediateIterator = IteratorProxyBase.toIterable(intermediateResult.value)[Symbol.iterator]();
|
|
353
|
-
}
|
|
354
|
-
} else {
|
|
355
|
-
const pendingFinalResult = this._intermediateIterator.next();
|
|
356
|
-
if (pendingFinalResult.done === true) {
|
|
357
|
-
this._intermediateIterator = void 0;
|
|
358
|
-
} else {
|
|
359
|
-
finalResult = pendingFinalResult;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
} while (finalResult === void 0);
|
|
363
|
-
return finalResult;
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
|
-
var IteratorFilterProxy = class extends IteratorProxyBase {
|
|
367
|
-
/**
|
|
368
|
-
* Predicate.
|
|
369
|
-
*/
|
|
370
|
-
_predicate;
|
|
371
|
-
/**
|
|
372
|
-
* Expected truthy result of the predicate.
|
|
373
|
-
*/
|
|
374
|
-
_expectedTruthy;
|
|
375
|
-
/**
|
|
376
|
-
* Index into iteration source.
|
|
377
|
-
*/
|
|
378
|
-
_index;
|
|
379
|
-
/**
|
|
380
|
-
* Constructor.
|
|
381
|
-
*
|
|
382
|
-
* @param iterationSource
|
|
383
|
-
* Iteration source.
|
|
384
|
-
*
|
|
385
|
-
* @param predicate
|
|
386
|
-
* Predicate.
|
|
387
|
-
*
|
|
388
|
-
* @param expectedTruthy
|
|
389
|
-
* Expected truthy result of the predicate.
|
|
390
|
-
*/
|
|
391
|
-
constructor(iterationSource, predicate, expectedTruthy) {
|
|
392
|
-
super(iterationSource);
|
|
393
|
-
this._predicate = predicate;
|
|
394
|
-
this._expectedTruthy = expectedTruthy;
|
|
395
|
-
this._index = 0;
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* @inheritDoc
|
|
399
|
-
*/
|
|
400
|
-
next(...value) {
|
|
401
|
-
let result;
|
|
402
|
-
const expectedTruthy = this._expectedTruthy;
|
|
403
|
-
do {
|
|
404
|
-
result = this.initialNext(...value);
|
|
405
|
-
} while (result.done !== true && Boolean(this._predicate(result.value, this._index++)) !== expectedTruthy);
|
|
406
|
-
return result;
|
|
407
|
-
}
|
|
408
|
-
};
|
|
409
|
-
var IteratorCountProxyBase = class extends IteratorProxyObject {
|
|
410
|
-
/**
|
|
411
|
-
* Count.
|
|
412
|
-
*/
|
|
413
|
-
_count;
|
|
414
|
-
/**
|
|
415
|
-
* Constructor.
|
|
416
|
-
*
|
|
417
|
-
* @param initialIterationSource
|
|
418
|
-
* Initial iteration source.
|
|
419
|
-
*
|
|
420
|
-
* @param count
|
|
421
|
-
* Count.
|
|
422
|
-
*/
|
|
423
|
-
constructor(initialIterationSource, count) {
|
|
424
|
-
super(initialIterationSource);
|
|
425
|
-
if (!Number.isInteger(count) || count < 0) {
|
|
426
|
-
throw new RangeError("Count must be a positive integer");
|
|
427
|
-
}
|
|
428
|
-
this._count = count;
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* Determine if iterator is exhausted (by count or by iterator itself).
|
|
432
|
-
*/
|
|
433
|
-
get exhausted() {
|
|
434
|
-
return this._count <= 0;
|
|
435
|
-
}
|
|
436
|
-
/**
|
|
437
|
-
* @inheritDoc
|
|
438
|
-
*/
|
|
439
|
-
next(...value) {
|
|
440
|
-
const result = super.next(...value);
|
|
441
|
-
if (result.done !== true) {
|
|
442
|
-
this._count--;
|
|
443
|
-
} else {
|
|
444
|
-
this._count = 0;
|
|
445
|
-
}
|
|
446
|
-
return result;
|
|
447
|
-
}
|
|
448
|
-
};
|
|
449
|
-
var IteratorTakeProxy = class extends IteratorCountProxyBase {
|
|
450
|
-
/**
|
|
451
|
-
* @inheritDoc
|
|
452
|
-
*/
|
|
453
|
-
next(...value) {
|
|
454
|
-
return !this.exhausted ? super.next(...value) : {
|
|
455
|
-
done: true,
|
|
456
|
-
value: void 0
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
};
|
|
460
|
-
var IteratorDropProxy = class extends IteratorCountProxyBase {
|
|
461
|
-
/**
|
|
462
|
-
* @inheritDoc
|
|
463
|
-
*/
|
|
464
|
-
next(...value) {
|
|
465
|
-
while (!this.exhausted) {
|
|
466
|
-
super.next(...value);
|
|
467
|
-
}
|
|
468
|
-
return super.next(...value);
|
|
129
|
+
var utilityResources = {
|
|
130
|
+
en: {
|
|
131
|
+
aidct_utility: localeStrings
|
|
132
|
+
},
|
|
133
|
+
fr: {
|
|
134
|
+
aidct_utility: localeStrings2
|
|
469
135
|
}
|
|
470
136
|
};
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
supported = process.env["NODE_ENV"] !== "test";
|
|
475
|
-
} catch (_e) {
|
|
476
|
-
supported = true;
|
|
477
|
-
}
|
|
478
|
-
if (supported) {
|
|
479
|
-
try {
|
|
480
|
-
Iterator.from([]);
|
|
481
|
-
} catch (_e) {
|
|
482
|
-
supported = false;
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
return supported ? Iterator : {
|
|
486
|
-
/**
|
|
487
|
-
* @inheritDoc
|
|
488
|
-
*/
|
|
489
|
-
from(value) {
|
|
490
|
-
return value instanceof IteratorProxyBase ? value : new IteratorProxyObject(value);
|
|
491
|
-
}
|
|
492
|
-
};
|
|
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);
|
|
493
140
|
}
|
|
494
|
-
var IteratorProxy = iteratorProxy();
|
|
495
141
|
|
|
496
|
-
// src/
|
|
497
|
-
var
|
|
142
|
+
// src/sequence.ts
|
|
143
|
+
var Sequence = class {
|
|
498
144
|
/**
|
|
499
145
|
* Start value (inclusive).
|
|
500
146
|
*/
|
|
@@ -514,15 +160,11 @@ var Sequencer = class {
|
|
|
514
160
|
/**
|
|
515
161
|
* Minimum value (inclusive).
|
|
516
162
|
*/
|
|
517
|
-
|
|
163
|
+
_minimumValue;
|
|
518
164
|
/**
|
|
519
165
|
* Maximum value (inclusive).
|
|
520
166
|
*/
|
|
521
|
-
|
|
522
|
-
/**
|
|
523
|
-
* Next value.
|
|
524
|
-
*/
|
|
525
|
-
_nextValue;
|
|
167
|
+
_maximumValue;
|
|
526
168
|
/**
|
|
527
169
|
* Constructor.
|
|
528
170
|
*
|
|
@@ -537,17 +179,15 @@ var Sequencer = class {
|
|
|
537
179
|
this._startValue = BigInt(startValue);
|
|
538
180
|
this._endValue = this._startValue + BigInt(count);
|
|
539
181
|
this._count = count;
|
|
540
|
-
|
|
541
|
-
if (ascending) {
|
|
182
|
+
if (count >= 0) {
|
|
542
183
|
this._nextDelta = 1n;
|
|
543
|
-
this.
|
|
544
|
-
this.
|
|
184
|
+
this._minimumValue = this._startValue;
|
|
185
|
+
this._maximumValue = this._endValue - 1n;
|
|
545
186
|
} else {
|
|
546
187
|
this._nextDelta = -1n;
|
|
547
|
-
this.
|
|
548
|
-
this.
|
|
188
|
+
this._minimumValue = this._endValue + 1n;
|
|
189
|
+
this._maximumValue = this._startValue;
|
|
549
190
|
}
|
|
550
|
-
this._nextValue = this._startValue;
|
|
551
191
|
}
|
|
552
192
|
/**
|
|
553
193
|
* Get the start value (inclusive).
|
|
@@ -570,55 +210,45 @@ var Sequencer = class {
|
|
|
570
210
|
/**
|
|
571
211
|
* Get the minimum value (inclusive).
|
|
572
212
|
*/
|
|
573
|
-
get
|
|
574
|
-
return this.
|
|
213
|
+
get minimumValue() {
|
|
214
|
+
return this._minimumValue;
|
|
575
215
|
}
|
|
576
216
|
/**
|
|
577
217
|
* Get the maximum value (inclusive).
|
|
578
218
|
*/
|
|
579
|
-
get
|
|
580
|
-
return this.
|
|
219
|
+
get maximumValue() {
|
|
220
|
+
return this._maximumValue;
|
|
581
221
|
}
|
|
582
222
|
/**
|
|
583
223
|
* Iterable implementation.
|
|
584
224
|
*
|
|
585
|
-
* @
|
|
586
|
-
*
|
|
587
|
-
*/
|
|
588
|
-
[Symbol.iterator]() {
|
|
589
|
-
return this;
|
|
590
|
-
}
|
|
591
|
-
/**
|
|
592
|
-
* Iterator implementation.
|
|
593
|
-
*
|
|
594
|
-
* @returns
|
|
595
|
-
* Iterator result. If iterator is exhausted, the value is absolute value of the count.
|
|
225
|
+
* @yields
|
|
226
|
+
* Next value in sequence.
|
|
596
227
|
*/
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
if (!done) {
|
|
601
|
-
result = {
|
|
602
|
-
value: this._nextValue
|
|
603
|
-
};
|
|
604
|
-
this._nextValue += this._nextDelta;
|
|
605
|
-
} else {
|
|
606
|
-
result = {
|
|
607
|
-
done: true,
|
|
608
|
-
value: Math.abs(this._count)
|
|
609
|
-
};
|
|
228
|
+
*[Symbol.iterator]() {
|
|
229
|
+
for (let value = this._startValue; value !== this._endValue; value += this._nextDelta) {
|
|
230
|
+
yield value;
|
|
610
231
|
}
|
|
611
|
-
return result;
|
|
612
|
-
}
|
|
613
|
-
/**
|
|
614
|
-
* Reset the iterator.
|
|
615
|
-
*/
|
|
616
|
-
reset() {
|
|
617
|
-
this._nextValue = this._startValue;
|
|
618
232
|
}
|
|
619
233
|
};
|
|
620
234
|
|
|
621
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
|
+
}
|
|
622
252
|
var Transformer = class _Transformer {
|
|
623
253
|
/**
|
|
624
254
|
* Transformers cache, mapping a domain to another map, which maps an optional tweak to a transformer.
|
|
@@ -637,8 +267,7 @@ var Transformer = class _Transformer {
|
|
|
637
267
|
constructor(domain) {
|
|
638
268
|
this._domain = BigInt(domain);
|
|
639
269
|
if (this._domain <= 0n) {
|
|
640
|
-
throw new RangeError(
|
|
641
|
-
ns: utilityNS,
|
|
270
|
+
throw new RangeError(i18nextUtility.t("Transformer.domainMustBeGreaterThanZero", {
|
|
642
271
|
domain
|
|
643
272
|
}));
|
|
644
273
|
}
|
|
@@ -687,52 +316,69 @@ var Transformer = class _Transformer {
|
|
|
687
316
|
*/
|
|
688
317
|
validate(value) {
|
|
689
318
|
if (value < 0n) {
|
|
690
|
-
throw new RangeError(
|
|
691
|
-
ns: utilityNS,
|
|
319
|
+
throw new RangeError(i18nextUtility.t("Transformer.valueMustBeGreaterThanOrEqualToZero", {
|
|
692
320
|
value
|
|
693
321
|
}));
|
|
694
322
|
}
|
|
695
323
|
if (value >= this.domain) {
|
|
696
|
-
throw new RangeError(
|
|
697
|
-
ns: utilityNS,
|
|
324
|
+
throw new RangeError(i18nextUtility.t("Transformer.valueMustBeLessThan", {
|
|
698
325
|
value,
|
|
699
326
|
domain: this.domain
|
|
700
327
|
}));
|
|
701
328
|
}
|
|
702
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
|
+
}
|
|
703
362
|
// eslint-disable-next-line jsdoc/require-jsdoc -- Implementation of overloaded signatures.
|
|
704
363
|
forward(valueOrValues, transformerCallback) {
|
|
705
364
|
let result;
|
|
706
365
|
if (typeof valueOrValues !== "object") {
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
if (valueOrValues.minValue < 0n) {
|
|
713
|
-
throw new RangeError(i18n_default.t("Transformer.minValueMustBeGreaterThanOrEqualToZero", {
|
|
714
|
-
ns: utilityNS,
|
|
715
|
-
minValue: valueOrValues.minValue
|
|
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
|
|
716
371
|
}));
|
|
717
372
|
}
|
|
718
|
-
if (valueOrValues.
|
|
719
|
-
throw new RangeError(
|
|
720
|
-
|
|
721
|
-
maxValue: valueOrValues.maxValue,
|
|
373
|
+
if (valueOrValues.maximumValue >= this.domain) {
|
|
374
|
+
throw new RangeError(i18nextUtility.t("Transformer.maximumValueMustBeLessThan", {
|
|
375
|
+
maximumValue: valueOrValues.maximumValue,
|
|
722
376
|
domain: this.domain
|
|
723
377
|
}));
|
|
724
378
|
}
|
|
725
|
-
result = transformerCallback === void 0 ?
|
|
379
|
+
result = transformerCallback === void 0 ? transformIterable(valueOrValues, (value) => this.doForward(value)) : transformIterable(valueOrValues, (value, index) => transformerCallback(this.doForward(value), index));
|
|
726
380
|
} else {
|
|
727
|
-
result = transformerCallback === void 0 ?
|
|
728
|
-
const valueN = BigInt(value);
|
|
729
|
-
this.validate(valueN);
|
|
730
|
-
return this.doForward(valueN);
|
|
731
|
-
}) : IteratorProxy.from(valueOrValues).map((value, index) => {
|
|
732
|
-
const valueN = BigInt(value);
|
|
733
|
-
this.validate(valueN);
|
|
734
|
-
return transformerCallback(this.doForward(valueN), index);
|
|
735
|
-
});
|
|
381
|
+
result = transformerCallback === void 0 ? transformIterable(valueOrValues, (value) => this.validateDoForward(value)) : transformIterable(valueOrValues, (value, index) => this.validateDoForwardCallback(transformerCallback, value, index));
|
|
736
382
|
}
|
|
737
383
|
return result;
|
|
738
384
|
}
|
|
@@ -796,10 +442,6 @@ var EncryptionTransformer = class _EncryptionTransformer extends Transformer {
|
|
|
796
442
|
* Number of bytes covered by the domain.
|
|
797
443
|
*/
|
|
798
444
|
_domainBytes;
|
|
799
|
-
/**
|
|
800
|
-
* Tweak.
|
|
801
|
-
*/
|
|
802
|
-
_tweak;
|
|
803
445
|
/**
|
|
804
446
|
* Xor bytes array generated from the domain and tweak.
|
|
805
447
|
*/
|
|
@@ -828,24 +470,21 @@ var EncryptionTransformer = class _EncryptionTransformer extends Transformer {
|
|
|
828
470
|
constructor(domain, tweak) {
|
|
829
471
|
super(domain);
|
|
830
472
|
if (tweak < 0n) {
|
|
831
|
-
throw new RangeError(
|
|
832
|
-
ns: utilityNS,
|
|
473
|
+
throw new RangeError(i18nextUtility.t("Transformer.tweakMustBeGreaterThanOrEqualToZero", {
|
|
833
474
|
tweak
|
|
834
475
|
}));
|
|
835
476
|
}
|
|
836
477
|
let domainBytes = 0;
|
|
837
|
-
for (let reducedDomainMinusOne = this.domain - 1n; reducedDomainMinusOne !== 0n; reducedDomainMinusOne
|
|
478
|
+
for (let reducedDomainMinusOne = this.domain - 1n; reducedDomainMinusOne !== 0n; reducedDomainMinusOne >>= 8n) {
|
|
838
479
|
domainBytes++;
|
|
839
480
|
}
|
|
840
481
|
this._domainBytes = domainBytes;
|
|
841
|
-
this._tweak = BigInt(tweak);
|
|
842
482
|
const xorBytes = new Array();
|
|
843
483
|
const bits = new Array();
|
|
844
484
|
const inverseBits = new Array();
|
|
845
|
-
for (let reducedKey = this.domain *
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
const bitNumber = keyByte & 7;
|
|
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));
|
|
849
488
|
bits.push(_EncryptionTransformer.BITS[bitNumber]);
|
|
850
489
|
inverseBits.push(_EncryptionTransformer.INVERSE_BITS[bitNumber]);
|
|
851
490
|
}
|
|
@@ -862,12 +501,6 @@ var EncryptionTransformer = class _EncryptionTransformer extends Transformer {
|
|
|
862
501
|
this._rounds = xorBytes.length;
|
|
863
502
|
}
|
|
864
503
|
}
|
|
865
|
-
/**
|
|
866
|
-
* Get the tweak.
|
|
867
|
-
*/
|
|
868
|
-
get tweak() {
|
|
869
|
-
return this._tweak;
|
|
870
|
-
}
|
|
871
504
|
/**
|
|
872
505
|
* Convert a value to a byte array big enough to handle the entire domain.
|
|
873
506
|
*
|
|
@@ -879,10 +512,8 @@ var EncryptionTransformer = class _EncryptionTransformer extends Transformer {
|
|
|
879
512
|
*/
|
|
880
513
|
valueToBytes(value) {
|
|
881
514
|
const bytes = new Uint8Array(this._domainBytes);
|
|
882
|
-
let reducedValue = value;
|
|
883
|
-
|
|
884
|
-
bytes[index] = Number(reducedValue & 0xFFn);
|
|
885
|
-
reducedValue = reducedValue >> 8n;
|
|
515
|
+
for (let index = this._domainBytes - 1, reducedValue = value; index >= 0 && reducedValue !== 0n; index--, reducedValue >>= 8n) {
|
|
516
|
+
bytes[index] = Number(BigInt.asUintN(8, reducedValue));
|
|
886
517
|
}
|
|
887
518
|
return bytes;
|
|
888
519
|
}
|
|
@@ -1020,7 +651,7 @@ var EncryptionTransformer = class _EncryptionTransformer extends Transformer {
|
|
|
1020
651
|
}
|
|
1021
652
|
};
|
|
1022
653
|
|
|
1023
|
-
// src/
|
|
654
|
+
// src/reg-exp.ts
|
|
1024
655
|
var RegExpValidator = class {
|
|
1025
656
|
/**
|
|
1026
657
|
* Regular expression.
|
|
@@ -1052,8 +683,7 @@ var RegExpValidator = class {
|
|
|
1052
683
|
* Error message.
|
|
1053
684
|
*/
|
|
1054
685
|
createErrorMessage(s) {
|
|
1055
|
-
return
|
|
1056
|
-
ns: utilityNS,
|
|
686
|
+
return i18nextUtility.t("RegExpValidator.stringDoesNotMatchPattern", {
|
|
1057
687
|
s
|
|
1058
688
|
});
|
|
1059
689
|
}
|
|
@@ -1109,9 +739,8 @@ var RecordValidator = class {
|
|
|
1109
739
|
* Record key.
|
|
1110
740
|
*/
|
|
1111
741
|
validate(key) {
|
|
1112
|
-
if (this.record
|
|
1113
|
-
throw new RangeError(
|
|
1114
|
-
ns: utilityNS,
|
|
742
|
+
if (!(key in this.record)) {
|
|
743
|
+
throw new RangeError(i18nextUtility.t("RecordValidator.typeNameKeyNotFound", {
|
|
1115
744
|
typeName: this.typeName,
|
|
1116
745
|
key
|
|
1117
746
|
}));
|
|
@@ -1119,7 +748,7 @@ var RecordValidator = class {
|
|
|
1119
748
|
}
|
|
1120
749
|
};
|
|
1121
750
|
|
|
1122
|
-
// src/
|
|
751
|
+
// src/character-set.ts
|
|
1123
752
|
var Exclusion = /* @__PURE__ */ ((Exclusion2) => {
|
|
1124
753
|
Exclusion2[Exclusion2["None"] = 0] = "None";
|
|
1125
754
|
Exclusion2[Exclusion2["FirstZero"] = 1] = "FirstZero";
|
|
@@ -1138,9 +767,7 @@ var CharacterSetValidator = class _CharacterSetValidator {
|
|
|
1138
767
|
* Error message.
|
|
1139
768
|
*/
|
|
1140
769
|
createErrorMessage(_s) {
|
|
1141
|
-
return
|
|
1142
|
-
ns: utilityNS
|
|
1143
|
-
});
|
|
770
|
+
return i18nextUtility.t("CharacterSetValidator.stringMustNotBeAllNumeric");
|
|
1144
771
|
}
|
|
1145
772
|
}(/\D/);
|
|
1146
773
|
/**
|
|
@@ -1250,8 +877,7 @@ var CharacterSetValidator = class _CharacterSetValidator {
|
|
|
1250
877
|
*/
|
|
1251
878
|
validateExclusion(exclusion) {
|
|
1252
879
|
if (exclusion !== 0 /* None */ && !this._exclusionSupport.includes(exclusion)) {
|
|
1253
|
-
throw new RangeError(
|
|
1254
|
-
ns: utilityNS,
|
|
880
|
+
throw new RangeError(i18nextUtility.t("CharacterSetValidator.exclusionNotSupported", {
|
|
1255
881
|
exclusion
|
|
1256
882
|
}));
|
|
1257
883
|
}
|
|
@@ -1273,15 +899,13 @@ var CharacterSetValidator = class _CharacterSetValidator {
|
|
|
1273
899
|
if (minimumLength !== void 0 && length < minimumLength) {
|
|
1274
900
|
let errorMessage;
|
|
1275
901
|
if (maximumLength !== void 0 && maximumLength === minimumLength) {
|
|
1276
|
-
errorMessage =
|
|
1277
|
-
ns: utilityNS,
|
|
902
|
+
errorMessage = i18nextUtility.t(validation?.component === void 0 ? "CharacterSetValidator.lengthMustBeEqualTo" : "CharacterSetValidator.lengthOfComponentMustBeEqualTo", {
|
|
1278
903
|
component: _CharacterSetValidator.componentToString(validation?.component),
|
|
1279
904
|
length,
|
|
1280
905
|
exactLength: minimumLength
|
|
1281
906
|
});
|
|
1282
907
|
} else {
|
|
1283
|
-
errorMessage =
|
|
1284
|
-
ns: utilityNS,
|
|
908
|
+
errorMessage = i18nextUtility.t(validation?.component === void 0 ? "CharacterSetValidator.lengthMustBeGreaterThanOrEqualTo" : "CharacterSetValidator.lengthOfComponentMustBeGreaterThanOrEqualTo", {
|
|
1285
909
|
component: _CharacterSetValidator.componentToString(validation?.component),
|
|
1286
910
|
length,
|
|
1287
911
|
minimumLength
|
|
@@ -1290,8 +914,7 @@ var CharacterSetValidator = class _CharacterSetValidator {
|
|
|
1290
914
|
throw new RangeError(errorMessage);
|
|
1291
915
|
}
|
|
1292
916
|
if (maximumLength !== void 0 && length > maximumLength) {
|
|
1293
|
-
throw new RangeError(
|
|
1294
|
-
ns: utilityNS,
|
|
917
|
+
throw new RangeError(i18nextUtility.t(validation?.component === void 0 ? "CharacterSetValidator.lengthMustBeLessThanOrEqualTo" : "CharacterSetValidator.lengthOfComponentMustBeLessThanOrEqualTo", {
|
|
1295
918
|
component: _CharacterSetValidator.componentToString(validation?.component),
|
|
1296
919
|
length,
|
|
1297
920
|
maximumLength
|
|
@@ -1299,8 +922,7 @@ var CharacterSetValidator = class _CharacterSetValidator {
|
|
|
1299
922
|
}
|
|
1300
923
|
const index = this.characterIndexes(s).findIndex((characterIndex) => characterIndex === void 0);
|
|
1301
924
|
if (index !== -1) {
|
|
1302
|
-
throw new RangeError(
|
|
1303
|
-
ns: utilityNS,
|
|
925
|
+
throw new RangeError(i18nextUtility.t(validation?.component === void 0 ? "CharacterSetValidator.invalidCharacterAtPosition" : "CharacterSetValidator.invalidCharacterAtPositionOfComponent", {
|
|
1304
926
|
component: _CharacterSetValidator.componentToString(validation?.component),
|
|
1305
927
|
c: s.charAt(index),
|
|
1306
928
|
position: index + (validation?.positionOffset ?? 0) + 1
|
|
@@ -1313,8 +935,7 @@ var CharacterSetValidator = class _CharacterSetValidator {
|
|
|
1313
935
|
break;
|
|
1314
936
|
case 1 /* FirstZero */:
|
|
1315
937
|
if (s.startsWith("0")) {
|
|
1316
|
-
throw new RangeError(
|
|
1317
|
-
ns: utilityNS,
|
|
938
|
+
throw new RangeError(i18nextUtility.t(validation.component === void 0 ? "CharacterSetValidator.invalidCharacterAtPosition" : "CharacterSetValidator.invalidCharacterAtPositionOfComponent", {
|
|
1318
939
|
component: _CharacterSetValidator.componentToString(validation.component),
|
|
1319
940
|
c: "0",
|
|
1320
941
|
position: (validation.positionOffset ?? 0) + 1
|
|
@@ -1401,9 +1022,7 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
|
|
|
1401
1022
|
exclusionDomains[0 /* None */] = exclusionNoneDomains;
|
|
1402
1023
|
if (exclusionSupport.includes(1 /* FirstZero */)) {
|
|
1403
1024
|
if (characterSet[0] !== "0") {
|
|
1404
|
-
throw new RangeError(
|
|
1405
|
-
ns: utilityNS
|
|
1406
|
-
}));
|
|
1025
|
+
throw new RangeError(i18nextUtility.t("CharacterSetValidator.firstZeroFirstCharacter"));
|
|
1407
1026
|
}
|
|
1408
1027
|
const exclusionFirstZeroDomains = new Array(_CharacterSetCreator.MAXIMUM_STRING_LENGTH + 1);
|
|
1409
1028
|
exclusionFirstZeroDomains[0] = 0n;
|
|
@@ -1417,9 +1036,7 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
|
|
|
1417
1036
|
let expectedNumberIndex = numberIndexes2[0];
|
|
1418
1037
|
for (const numberIndex of numberIndexes2) {
|
|
1419
1038
|
if (numberIndex === void 0 || numberIndex !== expectedNumberIndex) {
|
|
1420
|
-
throw new RangeError(
|
|
1421
|
-
ns: utilityNS
|
|
1422
|
-
}));
|
|
1039
|
+
throw new RangeError(i18nextUtility.t("CharacterSetValidator.allNumericAllNumericCharacters"));
|
|
1423
1040
|
}
|
|
1424
1041
|
expectedNumberIndex = numberIndex + 1;
|
|
1425
1042
|
}
|
|
@@ -1474,9 +1091,7 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
|
|
|
1474
1091
|
let shift;
|
|
1475
1092
|
if (length === 0) {
|
|
1476
1093
|
if (!shiftForward && value < 10n) {
|
|
1477
|
-
throw new RangeError(
|
|
1478
|
-
ns: utilityNS
|
|
1479
|
-
}));
|
|
1094
|
+
throw new RangeError(i18nextUtility.t("CharacterSetValidator.stringMustNotBeAllNumeric"));
|
|
1480
1095
|
}
|
|
1481
1096
|
shift = 10n;
|
|
1482
1097
|
} else {
|
|
@@ -1500,15 +1115,13 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
|
|
|
1500
1115
|
*/
|
|
1501
1116
|
validateLength(length) {
|
|
1502
1117
|
if (length < 0) {
|
|
1503
|
-
throw new RangeError(
|
|
1504
|
-
ns: utilityNS,
|
|
1118
|
+
throw new RangeError(i18nextUtility.t("CharacterSetValidator.lengthMustBeGreaterThanOrEqualTo", {
|
|
1505
1119
|
length,
|
|
1506
1120
|
minimumLength: 0
|
|
1507
1121
|
}));
|
|
1508
1122
|
}
|
|
1509
1123
|
if (length > _CharacterSetCreator.MAXIMUM_STRING_LENGTH) {
|
|
1510
|
-
throw new RangeError(
|
|
1511
|
-
ns: utilityNS,
|
|
1124
|
+
throw new RangeError(i18nextUtility.t("CharacterSetValidator.lengthMustBeLessThanOrEqualTo", {
|
|
1512
1125
|
length,
|
|
1513
1126
|
maximumLength: _CharacterSetCreator.MAXIMUM_STRING_LENGTH
|
|
1514
1127
|
}));
|
|
@@ -1556,7 +1169,7 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
|
|
|
1556
1169
|
}
|
|
1557
1170
|
s = this.character(exclusion === 1 /* FirstZero */ ? Number(convertValue % this._characterSetSizeMinusOneN) + 1 : Number(convertValue % this._characterSetSizeN)) + s;
|
|
1558
1171
|
}
|
|
1559
|
-
return creatorCallback
|
|
1172
|
+
return creatorCallback === void 0 ? s : creatorCallback(s, index);
|
|
1560
1173
|
});
|
|
1561
1174
|
}
|
|
1562
1175
|
/**
|
|
@@ -1582,8 +1195,7 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
|
|
|
1582
1195
|
const characterSetSizeN = BigInt(this.characterSetSize);
|
|
1583
1196
|
let value = this.characterIndexes(s).reduce((accumulator, characterIndex, index) => {
|
|
1584
1197
|
if (characterIndex === void 0) {
|
|
1585
|
-
throw new RangeError(
|
|
1586
|
-
ns: utilityNS,
|
|
1198
|
+
throw new RangeError(i18nextUtility.t("CharacterSetValidator.invalidCharacterAtPosition", {
|
|
1587
1199
|
c: s.charAt(index),
|
|
1588
1200
|
position: index + 1
|
|
1589
1201
|
}));
|
|
@@ -1591,8 +1203,7 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
|
|
|
1591
1203
|
let value2;
|
|
1592
1204
|
if (index === 0 && exclusion === 1 /* FirstZero */) {
|
|
1593
1205
|
if (characterIndex === 0) {
|
|
1594
|
-
throw new RangeError(
|
|
1595
|
-
ns: utilityNS,
|
|
1206
|
+
throw new RangeError(i18nextUtility.t("CharacterSetValidator.invalidCharacterAtPosition", {
|
|
1596
1207
|
c: "0",
|
|
1597
1208
|
position: 1
|
|
1598
1209
|
}));
|
|
@@ -1718,11 +1329,30 @@ var ALPHANUMERIC_CREATOR = new CharacterSetCreator([
|
|
|
1718
1329
|
Exclusion,
|
|
1719
1330
|
HEXADECIMAL_CREATOR,
|
|
1720
1331
|
IdentityTransformer,
|
|
1721
|
-
IteratorProxy,
|
|
1722
1332
|
NUMERIC_CREATOR,
|
|
1723
1333
|
RecordValidator,
|
|
1724
1334
|
RegExpValidator,
|
|
1725
|
-
|
|
1335
|
+
Sequence,
|
|
1726
1336
|
Transformer,
|
|
1727
|
-
|
|
1337
|
+
i18nUtilityInit,
|
|
1338
|
+
i18nextUtility,
|
|
1339
|
+
transformIterable,
|
|
1340
|
+
utilityNS,
|
|
1341
|
+
utilityResources
|
|
1728
1342
|
});
|
|
1343
|
+
/*!
|
|
1344
|
+
* Copyright © 2024-2025 Dolphin Data Development Ltd. and AIDC Toolkit
|
|
1345
|
+
* contributors
|
|
1346
|
+
*
|
|
1347
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1348
|
+
* you may not use this file except in compliance with the License.
|
|
1349
|
+
* You may obtain a copy of the License at
|
|
1350
|
+
*
|
|
1351
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
1352
|
+
*
|
|
1353
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1354
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1355
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1356
|
+
* See the License for the specific language governing permissions and
|
|
1357
|
+
* limitations under the License.
|
|
1358
|
+
*/
|