smoothly 0.1.86 → 0.1.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/cjs/{generate-a6821b82.js → generate-f9a36f25.js} +1 -1
  2. package/dist/cjs/index-328edd81.js +1599 -0
  3. package/dist/cjs/{index-fc82954f.js → index-ac32385c.js} +230 -184
  4. package/dist/cjs/smoothly-accordion_47.cjs.entry.js +1025 -19098
  5. package/dist/cjs/smoothly-calendar.cjs.entry.js +2 -2
  6. package/dist/cjs/smoothly-display-amount.cjs.entry.js +1 -1
  7. package/dist/cjs/smoothly-display.cjs.entry.js +2 -1
  8. package/dist/cjs/smoothly-input-date-range.cjs.entry.js +1 -1
  9. package/dist/cjs/smoothly-input-date.cjs.entry.js +1 -1
  10. package/dist/cjs/smoothly-input-month.cjs.entry.js +2 -2
  11. package/dist/cjs/smoothly-input.cjs.entry.js +17 -10
  12. package/dist/cjs/smoothly-select-demo.cjs.entry.js +2 -2
  13. package/dist/collection/components/display/index.js +1 -1
  14. package/dist/collection/components/input/index.js +17 -10
  15. package/dist/collection/components/select-demo/index.js +2 -2
  16. package/dist/custom-elements/index.js +1174 -19455
  17. package/dist/{smoothly/generate-776b3b0f.js → esm/generate-50b98474.js} +1 -1
  18. package/dist/esm/index-1be6d668.js +1597 -0
  19. package/dist/{smoothly/index-a28d88cf.js → esm/index-a5a08f46.js} +230 -184
  20. package/dist/esm/smoothly-accordion_47.entry.js +1025 -19098
  21. package/dist/esm/smoothly-calendar.entry.js +2 -2
  22. package/dist/esm/smoothly-display-amount.entry.js +1 -1
  23. package/dist/esm/smoothly-display.entry.js +2 -1
  24. package/dist/esm/smoothly-input-date-range.entry.js +1 -1
  25. package/dist/esm/smoothly-input-date.entry.js +1 -1
  26. package/dist/esm/smoothly-input-month.entry.js +2 -2
  27. package/dist/esm/smoothly-input.entry.js +17 -10
  28. package/dist/esm/smoothly-select-demo.entry.js +2 -2
  29. package/dist/{esm/generate-776b3b0f.js → smoothly/generate-50b98474.js} +1 -1
  30. package/dist/smoothly/index-1be6d668.js +1597 -0
  31. package/dist/{esm/index-a28d88cf.js → smoothly/index-a5a08f46.js} +230 -184
  32. package/dist/smoothly/p-7b43df84.entry.js +1 -0
  33. package/dist/smoothly/smoothly-calendar.entry.js +2 -2
  34. package/dist/smoothly/smoothly-display-amount.entry.js +1 -1
  35. package/dist/smoothly/smoothly-display.entry.js +2 -1
  36. package/dist/smoothly/smoothly-input-date-range.entry.js +1 -1
  37. package/dist/smoothly/smoothly-input-date.entry.js +1 -1
  38. package/dist/smoothly/smoothly-input-month.entry.js +2 -2
  39. package/dist/smoothly/smoothly-input.entry.js +17 -10
  40. package/dist/smoothly/smoothly-select-demo.entry.js +2 -2
  41. package/dist/types/components/input/index.d.ts +1 -0
  42. package/package.json +3 -3
  43. package/dist/cjs/index-42db74b3.js +0 -19931
  44. package/dist/esm/index-36a04e8c.js +0 -19929
  45. package/dist/smoothly/index-36a04e8c.js +0 -19929
  46. package/dist/smoothly/p-375a8d94.entry.js +0 -1
@@ -0,0 +1,1597 @@
1
+ import { c as createCommonjsModule, g as getDefaultExportFromCjs } from './_commonjsHelpers-8fe71198.js';
2
+ import { d as dist$1 } from './index-a5a08f46.js';
3
+
4
+ var getAdjecentWordBreakIndex_1 = createCommonjsModule(function (module, exports) {
5
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.getAdjecentWordBreakIndex = void 0;
8
+ function getForwardWordBreakIndex(str, index, wordRegex) {
9
+ let result = 0;
10
+ while (wordRegex.exec(str) != null) {
11
+ result = wordRegex.lastIndex;
12
+ if (wordRegex.lastIndex > index)
13
+ break;
14
+ }
15
+ wordRegex.lastIndex <= index && (result = str.length);
16
+ return result;
17
+ }
18
+ function getBackwardWordBreakIndex(str, index, wordRegex) {
19
+ let result = 0;
20
+ let execArray;
21
+ while ((execArray = wordRegex.exec(str)) != null) {
22
+ if (wordRegex.lastIndex - execArray[0].length < index)
23
+ result = wordRegex.lastIndex - execArray[0].length;
24
+ else
25
+ break;
26
+ }
27
+ return result;
28
+ }
29
+ function getAdjecentWordBreakIndex(str, index, direction) {
30
+ const wordRegex = /([\wåäöüéáúíóßðœøæñµçþ_]+|[@-]+)/gi;
31
+ return direction == "backward"
32
+ ? getBackwardWordBreakIndex(str, index, wordRegex)
33
+ : getForwardWordBreakIndex(str, index, wordRegex);
34
+ }
35
+ exports.getAdjecentWordBreakIndex = getAdjecentWordBreakIndex;
36
+ //# sourceMappingURL=getAdjecentWordBreakIndex.js.map
37
+ });
38
+
39
+ const getAdjecentWordBreakIndex = /*@__PURE__*/getDefaultExportFromCjs(getAdjecentWordBreakIndex_1);
40
+
41
+ var Selection_1 = createCommonjsModule(function (module, exports) {
42
+ "use strict";
43
+ Object.defineProperty(exports, "__esModule", { value: true });
44
+ exports.Selection = void 0;
45
+ var Selection;
46
+ (function (Selection) {
47
+ function getCursor(selection) {
48
+ return selection.direction == "backward" ? selection.start : selection.end;
49
+ }
50
+ Selection.getCursor = getCursor;
51
+ function getStalker(selection) {
52
+ return selection.direction != "backward" ? selection.start : selection.end;
53
+ }
54
+ Selection.getStalker = getStalker;
55
+ })(Selection = exports.Selection || (exports.Selection = {}));
56
+ //# sourceMappingURL=Selection.js.map
57
+ });
58
+
59
+ const Selection = /*@__PURE__*/getDefaultExportFromCjs(Selection_1);
60
+
61
+ var State_1 = createCommonjsModule(function (module, exports) {
62
+ "use strict";
63
+ Object.defineProperty(exports, "__esModule", { value: true });
64
+ exports.State = void 0;
65
+ var State;
66
+ (function (State) {
67
+ function copy(state) {
68
+ return {
69
+ value: state.value,
70
+ selection: { start: state.selection.start, end: state.selection.end, direction: state.selection.direction },
71
+ };
72
+ }
73
+ State.copy = copy;
74
+ })(State = exports.State || (exports.State = {}));
75
+ //# sourceMappingURL=State.js.map
76
+ });
77
+
78
+ const State = /*@__PURE__*/getDefaultExportFromCjs(State_1);
79
+
80
+ var StateEditor_1 = createCommonjsModule(function (module, exports) {
81
+ "use strict";
82
+ Object.defineProperty(exports, "__esModule", { value: true });
83
+ exports.StateEditor = void 0;
84
+ class StateEditor {
85
+ constructor(state) {
86
+ this.value = state.value;
87
+ this.selection = { start: state.selection.start, end: state.selection.end, direction: state.selection.direction };
88
+ }
89
+ get(index, length = 1) {
90
+ return this.value.substr(index, length);
91
+ }
92
+ is(index, ...character) {
93
+ const c = this.get(index);
94
+ return character.some(d => c == d);
95
+ }
96
+ isDigit(index) {
97
+ const character = this.get(index);
98
+ return character >= "0" && character <= "9";
99
+ }
100
+ match(matcher) {
101
+ return this.value.match(matcher);
102
+ }
103
+ replace(start, end, value) {
104
+ let result;
105
+ if (typeof start == "string" && typeof end == "string") {
106
+ let s;
107
+ result = this;
108
+ while ((s = result.value.search(start)) > -1)
109
+ result = result.replace(s, s + start.length, end);
110
+ }
111
+ else if (typeof start == "number" && typeof end == "number") {
112
+ const state = {
113
+ value: this.value,
114
+ selection: { start: this.selection.start, end: this.selection.end, direction: this.selection.direction },
115
+ };
116
+ if (!value)
117
+ value = "";
118
+ state.value = this.value.slice(0, start) + value + this.value.slice(end, this.value.length);
119
+ if (this.selection.start >= end)
120
+ state.selection.start = this.selection.start + value.length - end + start;
121
+ else if (this.selection.start > start && this.selection.start < end)
122
+ state.selection.start = Math.min(this.selection.start, start + value.length);
123
+ if (this.selection.end >= end)
124
+ state.selection.end = this.selection.end + value.length - end + start;
125
+ else if (this.selection.end > start && this.selection.end < end)
126
+ state.selection.end = Math.min(this.selection.end, start + value.length);
127
+ result = new StateEditor(state);
128
+ }
129
+ return result || this;
130
+ }
131
+ insert(index, value) {
132
+ return this.replace(index, index, value);
133
+ }
134
+ append(value) {
135
+ return this.insert(this.value.length, value);
136
+ }
137
+ prepend(value) {
138
+ return this.insert(0, value);
139
+ }
140
+ suffix(value) {
141
+ return new StateEditor({ value: this.value + value, selection: this.selection });
142
+ }
143
+ delete(start, end) {
144
+ let result;
145
+ if (!this.value)
146
+ result = this;
147
+ else if (typeof start == "string") {
148
+ let s;
149
+ result = this;
150
+ while ((s = result.value.search(start)) > -1)
151
+ result = result.delete(s, s + start.length);
152
+ }
153
+ else
154
+ result = this.replace(start, end || start + 1, "");
155
+ return result;
156
+ }
157
+ truncate(end) {
158
+ return this.value.length >= end ? this.delete(end, this.value.length) : this;
159
+ }
160
+ pad(length, padding, index) {
161
+ let result = this;
162
+ while (length > result.value.length + padding.length)
163
+ result = result.insert(index, padding);
164
+ if (length > result.value.length)
165
+ result = result.insert(index, padding.substring(0, length - result.value.length));
166
+ return result;
167
+ }
168
+ padEnd(length, padding) {
169
+ return this.pad(length, padding, this.value.length);
170
+ }
171
+ padStart(length, padding) {
172
+ return this.pad(length, padding, 0);
173
+ }
174
+ map(mapping) {
175
+ let result = this;
176
+ let j = 0;
177
+ for (let i = 0; i < this.value.length; i++) {
178
+ const replacement = mapping(this.get(i), i);
179
+ result = result.replace(j, j + 1, replacement);
180
+ j += replacement.length;
181
+ }
182
+ return result;
183
+ }
184
+ static copy(state) {
185
+ return new StateEditor(Object.assign({}, state));
186
+ }
187
+ static create() {
188
+ return new StateEditor({ value: "", selection: { start: 0, end: 0 } });
189
+ }
190
+ static modify(state) {
191
+ return new StateEditor(typeof state == "string" ? { value: state, selection: { start: state.length, end: state.length } } : state);
192
+ }
193
+ }
194
+ exports.StateEditor = StateEditor;
195
+ //# sourceMappingURL=StateEditor.js.map
196
+ });
197
+
198
+ const StateEditor = /*@__PURE__*/getDefaultExportFromCjs(StateEditor_1);
199
+
200
+ var Action_1 = createCommonjsModule(function (module, exports) {
201
+ "use strict";
202
+ Object.defineProperty(exports, "__esModule", { value: true });
203
+ exports.Action = void 0;
204
+
205
+
206
+
207
+
208
+ var Action;
209
+ (function (Action) {
210
+ function apply(formatter, state, action) {
211
+ var _a, _b;
212
+ let result = State_1.State.copy(formatter.unformat(StateEditor_1.StateEditor.copy(state)));
213
+ if (action) {
214
+ if (action.ctrlKey || action.metaKey) {
215
+ if (action.key == "a")
216
+ select(result, 0, result.value.length, "forward");
217
+ else if (["ArrowLeft", "ArrowRight"].includes(action.key) && ((_a = state) === null || _a === void 0 ? void 0 : _a.type) != "password")
218
+ result = ctrlArrow(formatter, state, action);
219
+ else if (["Delete", "Backspace"].includes(action.key) && ((_b = state) === null || _b === void 0 ? void 0 : _b.type) != "password")
220
+ result = ctrlBackspaceDelete(formatter, state, action);
221
+ }
222
+ else if (["ArrowLeft", "ArrowRight", "Home", "End"].includes(action.key))
223
+ arrowHomeEnd(result, action);
224
+ else if (["Delete", "Backspace"].includes(action.key)) {
225
+ result.selection.start == result.selection.end &&
226
+ select(result, result.selection.start + (action.key == "Backspace" ? -1 : 0), result.selection.end + (action.key == "Delete" ? 1 : 0));
227
+ erase(result);
228
+ }
229
+ else if (action.key != "Unidentified") {
230
+ erase(result);
231
+ formatter.allowed(action.key, result) && replace(result, action.key);
232
+ }
233
+ }
234
+ return formatter.format(StateEditor_1.StateEditor.copy(result));
235
+ }
236
+ Action.apply = apply;
237
+ function ctrlArrow(formatter, state, action) {
238
+ let cursorPosition = Selection_1.Selection.getCursor(state.selection);
239
+ let stalkPosition = Selection_1.Selection.getStalker(state.selection);
240
+ cursorPosition = getAdjecentWordBreakIndex_1.getAdjecentWordBreakIndex(state.value, cursorPosition, action.key == "ArrowLeft" ? "backward" : "forward");
241
+ stalkPosition = action.shiftKey ? stalkPosition : cursorPosition;
242
+ return State_1.State.copy(formatter.unformat(StateEditor_1.StateEditor.copy(Object.assign(Object.assign({}, state), { selection: {
243
+ start: Math.min(stalkPosition, cursorPosition),
244
+ end: Math.max(stalkPosition, cursorPosition),
245
+ direction: stalkPosition < cursorPosition ? "forward" : stalkPosition > cursorPosition ? "backward" : "none",
246
+ } }))));
247
+ }
248
+ function ctrlBackspaceDelete(formatter, state, action) {
249
+ const cursorPosition = Selection_1.Selection.getCursor(state.selection);
250
+ const adjecentIndex = getAdjecentWordBreakIndex_1.getAdjecentWordBreakIndex(state.value, cursorPosition, action.key == "Backspace" ? "backward" : "forward");
251
+ const result = State_1.State.copy(formatter.unformat(StateEditor_1.StateEditor.copy(Object.assign(Object.assign({}, state), { selection: {
252
+ start: Math.min(cursorPosition, adjecentIndex),
253
+ end: Math.max(cursorPosition, adjecentIndex),
254
+ direction: "none",
255
+ } }))));
256
+ result.value = result.value.substring(0, result.selection.start) + result.value.substring(result.selection.end);
257
+ result.selection.end = result.selection.start;
258
+ return result;
259
+ }
260
+ function arrowHomeEnd(state, action) {
261
+ let cursorPosition = Selection_1.Selection.getCursor(state.selection);
262
+ let stalkPosition = Selection_1.Selection.getStalker(state.selection);
263
+ cursorPosition =
264
+ action.key == "Home"
265
+ ? 0
266
+ : action.key == "End"
267
+ ? state.value.length
268
+ : state.selection.start == state.selection.end || action.shiftKey
269
+ ? Math.min(Math.max(cursorPosition + (action.key == "ArrowLeft" ? -1 : 1), 0), state.value.length)
270
+ : action.key == "ArrowLeft"
271
+ ? state.selection.start
272
+ : state.selection.end;
273
+ stalkPosition = action.shiftKey ? stalkPosition : cursorPosition;
274
+ state.selection.direction =
275
+ stalkPosition < cursorPosition ? "forward" : stalkPosition > cursorPosition ? "backward" : "none";
276
+ state.selection.start = Math.min(stalkPosition, cursorPosition);
277
+ state.selection.end = Math.max(stalkPosition, cursorPosition);
278
+ }
279
+ function select(state, from, to, direction) {
280
+ state.selection.start = from;
281
+ state.selection.end = to;
282
+ direction && (state.selection.direction = direction);
283
+ }
284
+ function erase(state) {
285
+ replace(state, "");
286
+ }
287
+ function replace(state, insertString) {
288
+ state.value =
289
+ state.value.substring(0, state.selection.start) + insertString + state.value.substring(state.selection.end);
290
+ state.selection.start = state.selection.start + insertString.length;
291
+ state.selection.end = state.selection.start;
292
+ }
293
+ })(Action = exports.Action || (exports.Action = {}));
294
+ //# sourceMappingURL=Action.js.map
295
+ });
296
+
297
+ const Action = /*@__PURE__*/getDefaultExportFromCjs(Action_1);
298
+
299
+ var base = createCommonjsModule(function (module, exports) {
300
+ "use strict";
301
+ Object.defineProperty(exports, "__esModule", { value: true });
302
+ exports.parse = exports.format = exports.get = exports.add = void 0;
303
+
304
+ const handlers = {};
305
+ function add(type, create) {
306
+ handlers[type] = create;
307
+ }
308
+ exports.add = add;
309
+ function get(type, ...argument) {
310
+ const create = handlers[type];
311
+ return create && create(argument);
312
+ }
313
+ exports.get = get;
314
+ function format(data, type, ...argument) {
315
+ const handler = get(type, argument);
316
+ return handler
317
+ ? handler.format(StateEditor_1.StateEditor.modify(handler.toString(typeof data == "string" ? parse(data, type, argument) : data)))
318
+ .value
319
+ : "";
320
+ }
321
+ exports.format = format;
322
+ function parse(value, type, ...argument) {
323
+ const handler = get(type, argument);
324
+ return handler ? handler.fromString(handler.unformat(StateEditor_1.StateEditor.modify(value)).value) : undefined;
325
+ }
326
+ exports.parse = parse;
327
+ //# sourceMappingURL=base.js.map
328
+ });
329
+
330
+ const base$1 = /*@__PURE__*/getDefaultExportFromCjs(base);
331
+
332
+ var cardCsc = createCommonjsModule(function (module, exports) {
333
+ "use strict";
334
+ Object.defineProperty(exports, "__esModule", { value: true });
335
+
336
+ class Handler {
337
+ toString(data) {
338
+ return typeof data == "string" ? data : "";
339
+ }
340
+ fromString(value) {
341
+ return typeof value == "string" ? value : undefined;
342
+ }
343
+ format(unformated) {
344
+ return Object.assign(Object.assign({}, unformated), { type: "text", autocomplete: "cc-csc", length: [3, 3], pattern: /^\d{3}$/ });
345
+ }
346
+ unformat(formated) {
347
+ return formated;
348
+ }
349
+ allowed(symbol, state) {
350
+ return state.value.length < 3 && symbol >= "0" && symbol <= "9";
351
+ }
352
+ }
353
+ base.add("card-csc", () => new Handler());
354
+ //# sourceMappingURL=card-csc.js.map
355
+ });
356
+
357
+ const cardCsc$1 = /*@__PURE__*/getDefaultExportFromCjs(cardCsc);
358
+
359
+ var cardExpires = createCommonjsModule(function (module, exports) {
360
+ "use strict";
361
+ Object.defineProperty(exports, "__esModule", { value: true });
362
+
363
+ class Handler {
364
+ toString(data) {
365
+ return Array.isArray(data) && data.length == 2 && typeof data[0] == "number" && typeof data[1] == "number"
366
+ ? data[0].toString().padStart(2, "0") + data[1].toString().padStart(2, "0")
367
+ : "";
368
+ }
369
+ fromString(value) {
370
+ return typeof value == "string" && value.length == 4
371
+ ? [Number.parseInt(value.slice(0, 2)), Number.parseInt(value.slice(2))]
372
+ : undefined;
373
+ }
374
+ format(unformated) {
375
+ let result = unformated;
376
+ if (unformated.value.length > 0 && !unformated.is(0, "0", "1"))
377
+ result = result.prepend("0");
378
+ if (result.value.length > 1)
379
+ result = result.insert(2, " / ");
380
+ return Object.assign(Object.assign({}, result), { type: "text", autocomplete: "cc-exp", length: [7, 7], pattern: /^(0[1-9]|1[012]) \/ \d\d$/ });
381
+ }
382
+ unformat(formated) {
383
+ return formated.delete(" / ");
384
+ }
385
+ allowed(symbol, state) {
386
+ return state.value.length < 4 && symbol >= "0" && symbol <= "9";
387
+ }
388
+ }
389
+ base.add("card-expires", () => new Handler());
390
+ //# sourceMappingURL=card-expires.js.map
391
+ });
392
+
393
+ const cardExpires$1 = /*@__PURE__*/getDefaultExportFromCjs(cardExpires);
394
+
395
+ var cardNumber = createCommonjsModule(function (module, exports) {
396
+ "use strict";
397
+ Object.defineProperty(exports, "__esModule", { value: true });
398
+
399
+ class Handler {
400
+ toString(data) {
401
+ return typeof data == "string" ? data : "";
402
+ }
403
+ fromString(value) {
404
+ return typeof value == "string" ? value : undefined;
405
+ }
406
+ format(unformated) {
407
+ const issuer = getIssuer(unformated.value);
408
+ const result = unformated.map((symbol, index) => symbol + (index % 4 == 3 && index + 1 < issuer.length[0] ? " " : ""));
409
+ return Object.assign(Object.assign({}, result), { type: "text", autocomplete: "cc-number", length: issuer.length.slice(1), pattern: issuer.verification, classes: ["issuer-" + issuer.icon] });
410
+ }
411
+ unformat(formated) {
412
+ return formated.delete(" ");
413
+ }
414
+ allowed(symbol, state) {
415
+ const issuer = getIssuer(state.value);
416
+ return symbol >= "0" && symbol <= "9" && state.value.length < issuer.length[0];
417
+ }
418
+ }
419
+ base.add("card-number", () => new Handler());
420
+ function getIssuer(value) {
421
+ let result = defaultIssuer;
422
+ for (const key in issuers)
423
+ if (Object.prototype.hasOwnProperty.call(issuers, key) && issuers[key].identification.test(value)) {
424
+ result = Object.assign(Object.assign(Object.assign({}, defaultIssuer), { name: key }), issuers[key]);
425
+ break;
426
+ }
427
+ return result;
428
+ }
429
+ const defaultIssuer = {
430
+ name: "unknown",
431
+ verification: /^\d{19}$/,
432
+ identification: /^\d/,
433
+ length: [16, 16, 19],
434
+ icon: "generic",
435
+ };
436
+ const issuers = {
437
+ amex: {
438
+ verification: /^3[47][0-9]{2}\s[0-9]{4}\s[0-9]{4}\s[0-9]{3}$/,
439
+ identification: /^3[47]/,
440
+ length: [15, 18, 18],
441
+ icon: "amex",
442
+ },
443
+ dankort: {
444
+ verification: /^(5019)\s[0-9]{4}\s[0-9]{4}\s[0-9]{4}$/,
445
+ identification: /^(5019)\d+/,
446
+ length: [16, 19, 19],
447
+ icon: "generic",
448
+ },
449
+ diners: {
450
+ verification: /^3(?:0[0-5]|[68][0-9])[0-9]\s[0-9]{4}\s[0-9]{4}\s[0-9]{2}$/,
451
+ identification: /^3(?:0[0-5]|[68][0-9])/,
452
+ length: [14, 17, 17],
453
+ icon: "diners",
454
+ },
455
+ discover: {
456
+ verification: /^6(?:011|5[0-9]{2})\s[0-9]{4}\s[0-9]{4}\s[0-9]{4}$/,
457
+ identification: /^6(?:011|5[0-9]{2})/,
458
+ length: [16, 19, 19],
459
+ icon: "generic",
460
+ },
461
+ electron: {
462
+ verification: /^((4026|4405|4508|4844|4913|4917)\s[0-9]{4}\s[0-9]{4}\s[0-9]{4})|((4175)\s(00)[0-9]{2}\s[0-9]{4}\s[0-9]{4})$/,
463
+ identification: /^(4026|417500|4405|4508|4844|4913|4917)/,
464
+ length: [16, 19, 19],
465
+ icon: "generic",
466
+ },
467
+ interpayment: {
468
+ verification: /^(636)[0-9]\s[0-9]{4}\s[0-9]{4}\s[0-9]{4}$/,
469
+ identification: /^(636)/,
470
+ length: [16, 19, 19],
471
+ icon: "generic",
472
+ },
473
+ jcb: {
474
+ verification: /^((?:2131|1800)\s[0-9]{4}\s[0-9]{4}\s[0-9]{4})|(35[0-9]{2}\s[0-9]{4}\s[0-9]{4}\s[0-9]{4})$/,
475
+ identification: /^(?:2131|1800|35\d{3})/,
476
+ length: [16, 19, 19],
477
+ icon: "generic",
478
+ },
479
+ unionpay: {
480
+ verification: /^(62|88)[0-9]{2}\s[0-9]{4}\s[0-9]{4}\s[0-9]{4}$/,
481
+ identification: /^(62|88)/,
482
+ length: [16, 19, 19],
483
+ icon: "generic",
484
+ },
485
+ maestro: {
486
+ verification: /^(5018|5020|5038|5612|5893|6304|6759|6761|6762|6763|0604|6390)\s[0-9]{4}\s[0-9]{4}\s[0-9]{4}$/,
487
+ identification: /^(5018|5020|5038|5612|5893|6304|6759|6761|6762|6763|0604|6390)/,
488
+ length: [16, 19, 19],
489
+ icon: "maestro",
490
+ },
491
+ mastercard: {
492
+ verification: /^5[1-5][0-9]{2}\s[0-9]{4}\s[0-9]{4}\s[0-9]{4}$/,
493
+ identification: /^5[1-5][0-9]/,
494
+ length: [16, 19, 19],
495
+ icon: "mastercard",
496
+ },
497
+ visa: {
498
+ verification: /^4[0-9]{3}\s[0-9]{4}\s[0-9]{4}\s[0-9](?:[0-9]{3})?$/,
499
+ identification: /^4[0-9]/,
500
+ length: [16, 16, 19],
501
+ icon: "visa",
502
+ },
503
+ };
504
+ //# sourceMappingURL=card-number.js.map
505
+ });
506
+
507
+ const cardNumber$1 = /*@__PURE__*/getDefaultExportFromCjs(cardNumber);
508
+
509
+ var DateFormat_1 = createCommonjsModule(function (module, exports) {
510
+ "use strict";
511
+ Object.defineProperty(exports, "__esModule", { value: true });
512
+ exports.DateFormat = void 0;
513
+ var DateFormat;
514
+ (function (DateFormat) {
515
+ function fromLocale(locale) {
516
+ let result;
517
+ switch (locale) {
518
+ case "en-GB":
519
+ result = "dd/mm/YYYY";
520
+ break;
521
+ case "en-US":
522
+ result = "mm/dd/YYYY";
523
+ break;
524
+ case "de-DE":
525
+ case "pl-PL":
526
+ case "ru-RU":
527
+ result = "dd.mm.YYYY";
528
+ break;
529
+ default:
530
+ result = "YYYY-mm-dd";
531
+ break;
532
+ }
533
+ return result;
534
+ }
535
+ DateFormat.fromLocale = fromLocale;
536
+ function toLocale(format) {
537
+ let result;
538
+ switch (format) {
539
+ case "dd/mm/YYYY":
540
+ result = "en-GB";
541
+ break;
542
+ case "mm/dd/YYYY":
543
+ result = "en-US";
544
+ break;
545
+ case "dd.mm.YYYY":
546
+ result = "de-DE";
547
+ break;
548
+ default:
549
+ result = "sv-SE";
550
+ break;
551
+ }
552
+ return result;
553
+ }
554
+ DateFormat.toLocale = toLocale;
555
+ function is(value) {
556
+ return (typeof value == "string" &&
557
+ (value == "YYYY-mm-dd" || value == "dd/mm/YYYY" || value == "dd.mm.YYYY" || value == "mm/dd/YYYY"));
558
+ }
559
+ DateFormat.is = is;
560
+ })(DateFormat = exports.DateFormat || (exports.DateFormat = {}));
561
+ //# sourceMappingURL=DateFormat.js.map
562
+ });
563
+
564
+ const DateFormat = /*@__PURE__*/getDefaultExportFromCjs(DateFormat_1);
565
+
566
+ var helper = createCommonjsModule(function (module, exports) {
567
+ "use strict";
568
+ Object.defineProperty(exports, "__esModule", { value: true });
569
+ exports.validFormat = exports.validSymbol = exports.validYear = exports.validMonth = exports.validDay = void 0;
570
+ function validDay(symbol, state, startIndex, endIndex) {
571
+ let result = false;
572
+ if (state.value.length == startIndex)
573
+ result = symbol <= "3" && symbol >= "0";
574
+ else if (state.value.length == endIndex) {
575
+ if (state.value.substring(startIndex, startIndex + 1) == "2" ||
576
+ state.value.substring(startIndex, startIndex + 1) == "1")
577
+ result = symbol <= "9" && symbol >= "0";
578
+ else if (state.value.substring(startIndex, startIndex + 1) == "0")
579
+ result = symbol <= "9" && symbol >= "1";
580
+ else
581
+ result = symbol == "1" || symbol == "0";
582
+ }
583
+ return result;
584
+ }
585
+ exports.validDay = validDay;
586
+ function validMonth(symbol, state, startIndex, endIndex) {
587
+ let result = false;
588
+ if (state.value.length == startIndex)
589
+ result = symbol == "1" || symbol == "0";
590
+ else if (state.value.length == endIndex) {
591
+ if (state.value.substring(startIndex, startIndex + 1) != "1")
592
+ result = symbol <= "9" && symbol >= "1";
593
+ else
594
+ result = symbol < "3" && symbol >= "0";
595
+ }
596
+ return result;
597
+ }
598
+ exports.validMonth = validMonth;
599
+ function validYear(symbol, state, startIndex, endIndex) {
600
+ return state.value.length < endIndex && state.value.length >= startIndex && symbol >= "0" && symbol <= "9";
601
+ }
602
+ exports.validYear = validYear;
603
+ function validSymbol(symbol, state, firstSplitter, lastSplitter, character) {
604
+ return (state.value.length == firstSplitter || state.value.length == lastSplitter) && symbol == character;
605
+ }
606
+ exports.validSymbol = validSymbol;
607
+ function validFormat(symbol, state, format) {
608
+ let result;
609
+ switch (format) {
610
+ case "dd/mm/YYYY":
611
+ result =
612
+ validDay(symbol, state, 0, 1) ||
613
+ validSymbol(symbol, state, 2, 5, "/") ||
614
+ validMonth(symbol, state, 3, 4) ||
615
+ validYear(symbol, state, 6, 10);
616
+ break;
617
+ case "dd.mm.YYYY":
618
+ result =
619
+ validDay(symbol, state, 0, 1) ||
620
+ validSymbol(symbol, state, 2, 5, ".") ||
621
+ validMonth(symbol, state, 3, 4) ||
622
+ validYear(symbol, state, 6, 10);
623
+ break;
624
+ case "mm/dd/YYYY":
625
+ result =
626
+ validDay(symbol, state, 3, 4) ||
627
+ validSymbol(symbol, state, 2, 5, "/") ||
628
+ validMonth(symbol, state, 0, 1) ||
629
+ validYear(symbol, state, 6, 10);
630
+ break;
631
+ default:
632
+ result =
633
+ validDay(symbol, state, 8, 9) ||
634
+ validSymbol(symbol, state, 4, 7, "-") ||
635
+ validMonth(symbol, state, 5, 6) ||
636
+ validYear(symbol, state, 0, 4);
637
+ break;
638
+ }
639
+ return result;
640
+ }
641
+ exports.validFormat = validFormat;
642
+ //# sourceMappingURL=helper.js.map
643
+ });
644
+
645
+ const helper$1 = /*@__PURE__*/getDefaultExportFromCjs(helper);
646
+
647
+ var date = createCommonjsModule(function (module, exports) {
648
+ "use strict";
649
+ Object.defineProperty(exports, "__esModule", { value: true });
650
+ exports.formatDate = void 0;
651
+
652
+
653
+
654
+
655
+ class Handler {
656
+ constructor(formatting) {
657
+ this.formatting = DateFormat_1.DateFormat.is(formatting) ? formatting : DateFormat_1.DateFormat.fromLocale(formatting);
658
+ this.locale = dist$1.Locale.is(formatting)
659
+ ? formatting
660
+ : DateFormat_1.DateFormat.is(formatting)
661
+ ? DateFormat_1.DateFormat.toLocale(formatting)
662
+ : undefined;
663
+ }
664
+ toString(data) {
665
+ return typeof data != "string" ? "" : dist$1.Date.is(data) ? dist$1.Date.localize(data, this.locale) : data;
666
+ }
667
+ fromString(value) {
668
+ let result;
669
+ switch (this.formatting) {
670
+ case "dd/mm/YYYY":
671
+ case "dd.mm.YYYY":
672
+ result = `${value.substring(6, 10)}-${value.substring(3, 5)}-${value.substring(0, 2)}`;
673
+ break;
674
+ case "mm/dd/YYYY":
675
+ result = `${value.substring(6, 10)}-${value.substring(0, 2)}-${value.substring(3, 5)}`;
676
+ break;
677
+ default:
678
+ result = value;
679
+ break;
680
+ }
681
+ return dist$1.Date.is(result) ? result : undefined;
682
+ }
683
+ format(unformated) {
684
+ let result;
685
+ switch (this.formatting) {
686
+ case "dd/mm/YYYY":
687
+ result = Object.assign(Object.assign({}, formatDate(unformated, "dd/mm/YYYY")), { type: "text", length: [0, 10], pattern: /^([0-2][0-9]|(3)[0-1])(\/)(((0)[0-9])|((1)[0-2]))(\/)\d{4}$/ });
688
+ break;
689
+ case "dd.mm.YYYY":
690
+ result = Object.assign(Object.assign({}, formatDate(unformated, "dd.mm.YYYY")), { type: "text", length: [0, 10], pattern: /^([0-2][0-9]|(3)[0-1])(\.)(((0)[0-9])|((1)[0-2]))(\.)\d{4}$/ });
691
+ break;
692
+ case "mm/dd/YYYY":
693
+ result = Object.assign(Object.assign({}, formatDate(unformated, "mm/dd/YYYY")), { type: "text", length: [0, 10], pattern: /^(((0)[0-9])|((1)[0-2]))(\/)([0-2][0-9]|(3)[0-1])(\/)\d{4}$/ });
694
+ break;
695
+ default:
696
+ result = Object.assign(Object.assign({}, formatDate(unformated)), { type: "text", length: [0, 10], pattern: /^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$/ });
697
+ break;
698
+ }
699
+ return result;
700
+ }
701
+ unformat(formated) {
702
+ return formated;
703
+ }
704
+ allowed(symbol, state) {
705
+ var _a;
706
+ return helper.validFormat(symbol, state, (_a = this.formatting) !== null && _a !== void 0 ? _a : "YYYY-mm-dd");
707
+ }
708
+ }
709
+ base.add("date", (argument) => new Handler(argument && argument.length > 0 ? argument[0] : undefined));
710
+ function formatDate(unformated, format) {
711
+ let result = unformated;
712
+ switch (format) {
713
+ case "dd/mm/YYYY":
714
+ case "dd.mm.YYYY":
715
+ if (!validDate(result.value, format))
716
+ result = result.replace(0, 10, validDate("31" + result.value.substring(2, 10), format)
717
+ ? "31" + result.value.substring(2, 10)
718
+ : validDate("30" + result.value.substring(2, 10), format)
719
+ ? "30" + result.value.substring(2, 10)
720
+ : validDate("29" + result.value.substring(2, 10), format)
721
+ ? "29" + result.value.substring(2, 10)
722
+ : validDate("28" + result.value.substring(2, 10), format)
723
+ ? "28" + result.value.substring(2, 10)
724
+ : result.value);
725
+ break;
726
+ case "mm/dd/YYYY":
727
+ if (!validDate(result.value, format))
728
+ result = result.replace(0, 10, validDate(result.value.substring(0, 3) + "31" + result.value.substring(5, 10), format)
729
+ ? result.value.substring(0, 3) + "31" + result.value.substring(5, 10)
730
+ : validDate(result.value.substring(0, 3) + "30" + result.value.substring(5, 10), format)
731
+ ? result.value.substring(0, 3) + "30" + result.value.substring(5, 10)
732
+ : validDate(result.value.substring(0, 3) + "29" + result.value.substring(5, 10), format)
733
+ ? result.value.substring(0, 3) + "29" + result.value.substring(5, 10)
734
+ : validDate(result.value.substring(0, 3) + "28" + result.value.substring(5, 10), format)
735
+ ? result.value.substring(0, 3) + "28" + result.value.substring(5, 10)
736
+ : result.value);
737
+ break;
738
+ default:
739
+ if (unformated.value.length == 10) {
740
+ if (!validDate(result.value))
741
+ result = result.replace(0, 10, validDate(result.value.substring(0, 8) + "31")
742
+ ? result.value.substring(0, 8) + "31"
743
+ : validDate(result.value.substring(0, 8) + "30")
744
+ ? result.value.substring(0, 8) + "30"
745
+ : validDate(result.value.substring(0, 8) + "29")
746
+ ? result.value.substring(0, 8) + "29"
747
+ : validDate(result.value.substring(0, 8) + "28")
748
+ ? result.value.substring(0, 8) + "28"
749
+ : result.value);
750
+ break;
751
+ }
752
+ }
753
+ return result;
754
+ }
755
+ exports.formatDate = formatDate;
756
+ function validDate(date, format) {
757
+ let year;
758
+ let month;
759
+ let day;
760
+ let result;
761
+ switch (format) {
762
+ case "dd/mm/YYYY":
763
+ case "dd.mm.YYYY":
764
+ year = parseInt(date.substring(6, 10));
765
+ month = parseInt(date.substring(3, 5));
766
+ day = parseInt(date.substring(0, 2));
767
+ result = year && month && day ? day > 0 && daysPerMonth(year, month) >= day : false;
768
+ break;
769
+ case "mm/dd/YYYY":
770
+ year = parseInt(date.substring(6, 10));
771
+ month = parseInt(date.substring(0, 2));
772
+ day = parseInt(date.substring(3, 5));
773
+ result = year && month && day ? day > 0 && daysPerMonth(year, month) >= day : false;
774
+ break;
775
+ default:
776
+ year = parseInt(date.substring(0, 4));
777
+ month = parseInt(date.substring(5, 7));
778
+ day = parseInt(date.substring(8, 10));
779
+ result = year && month && day ? day > 0 && daysPerMonth(year, month) >= day : false;
780
+ break;
781
+ }
782
+ return result;
783
+ }
784
+ function daysPerMonth(year, month) {
785
+ let result;
786
+ switch (month) {
787
+ case 1:
788
+ case 3:
789
+ case 5:
790
+ case 7:
791
+ case 8:
792
+ case 10:
793
+ case 12:
794
+ default:
795
+ result = 31;
796
+ break;
797
+ case 4:
798
+ case 6:
799
+ case 9:
800
+ case 11:
801
+ result = 30;
802
+ break;
803
+ case 2:
804
+ result = 28;
805
+ break;
806
+ }
807
+ return result;
808
+ }
809
+ //# sourceMappingURL=index.js.map
810
+ });
811
+
812
+ const index$2 = /*@__PURE__*/getDefaultExportFromCjs(date);
813
+
814
+ var dateTime = createCommonjsModule(function (module, exports) {
815
+ "use strict";
816
+ Object.defineProperty(exports, "__esModule", { value: true });
817
+
818
+
819
+
820
+ class Handler {
821
+ toString(data) {
822
+ return typeof data == "string" ? data : "";
823
+ }
824
+ fromString(value) {
825
+ let result = value.replace(" ", "T");
826
+ const fillerDate = "0000-01-01T00:00:00.000Z";
827
+ if (result === null || result === void 0 ? void 0 : result.match(/-\d$/))
828
+ result = result.substring(0, result.length - 1) + "0" + result.substring(result.length - 1, result.length);
829
+ result = !result.match(/^\d{4}-(0[1-9]|1[012])/)
830
+ ? undefined
831
+ : result + fillerDate.substring(result.length, fillerDate.length);
832
+ return dist$1.DateTime.is(result) ? result : undefined;
833
+ }
834
+ format(unformated) {
835
+ let result = date.formatDate(unformated);
836
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[\d:.-]$/))
837
+ result = result.insert(10, " ");
838
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 3$/))
839
+ result = result.replace(11, 12, "23:");
840
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) [45]$/))
841
+ result = result.insert(11, "23:");
842
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) [6-9]$/))
843
+ result = result.insert(11, "23:5");
844
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 24$/))
845
+ result = result.replace(10, 13, "00:");
846
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 25$/))
847
+ result = result.insert(12, "3:");
848
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 2[6-9]$/))
849
+ result = result.insert(12, "3:5").append(":");
850
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3])\d[\s\S]$/))
851
+ result = result.insert(13, ":");
852
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3]):[6-9]$/))
853
+ result = result.insert(14, "5");
854
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3]):[0-5]\d\d$/))
855
+ result = result.insert(16, ":");
856
+ if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3]):[0-5]\d:[6-9]$/))
857
+ result = result.insert(17, "5");
858
+ return Object.assign(Object.assign({}, result), { type: "text", length: [0, 19], pattern: /^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3])(:[0-5]\d){2}$/ });
859
+ }
860
+ unformat(formated) {
861
+ return formated;
862
+ }
863
+ allowed(symbol, state) {
864
+ return (state.value.length < 19 &&
865
+ ((symbol >= "0" && symbol <= "9") || symbol == "-" || symbol == ":" || symbol == "." || symbol == " "));
866
+ }
867
+ }
868
+ base.add("date-time", () => new Handler());
869
+ //# sourceMappingURL=date-time.js.map
870
+ });
871
+
872
+ const dateTime$1 = /*@__PURE__*/getDefaultExportFromCjs(dateTime);
873
+
874
+ var divisor = createCommonjsModule(function (module, exports) {
875
+ "use strict";
876
+ Object.defineProperty(exports, "__esModule", { value: true });
877
+
878
+ class Handler {
879
+ toString(data) {
880
+ return Array.isArray(data) && data.length == 2 && typeof data[0] == "number" && typeof data[1] == "number"
881
+ ? data[0].toString() + " / " + data[1].toString()
882
+ : typeof data == "number"
883
+ ? data.toString()
884
+ : "";
885
+ }
886
+ fromString(value) {
887
+ return typeof value == "string" && value.match(/^\d{1,2}\s+\/\s+\d{1,2}$/)
888
+ ? [Number.parseInt(value.slice(0, 2)), Number.parseInt(value.slice(value.length - 2))]
889
+ : typeof value == "string" && value.match(/\d{1,2}/)
890
+ ? Number.parseInt(value)
891
+ : undefined;
892
+ }
893
+ format(unformated) {
894
+ let result = unformated;
895
+ if (unformated.match(/^\d\/$/))
896
+ result = unformated.replace(1, 2, " / ");
897
+ else if (unformated.match(/^\d{1,2}\s$/))
898
+ result = unformated.replace(unformated.value.length - 1, unformated.value.length, " / ");
899
+ else if (unformated.match(/^[\D.]+\/[\D.]+$/))
900
+ result = unformated.delete(0, unformated.value.length);
901
+ else if (unformated.match(/^[\D.]+\/[\D.]+\d$/))
902
+ result = unformated.delete(0, unformated.value.length - 1);
903
+ else if (unformated.match(/^[\D.]+\/[\D.]+\d\d$/))
904
+ result = unformated.delete(0, unformated.value.length - 2);
905
+ else if (unformated.match(/^[\D.]+\//))
906
+ result = unformated.delete(0, unformated.value.search("/") + 1);
907
+ else if (unformated.match(/^\d\d\/$/))
908
+ result = unformated.replace(2, 3, " / ");
909
+ else if (unformated.match(/^\d\d\s+\/$/))
910
+ result = unformated.delete(2, unformated.value.length);
911
+ else if (unformated.match(/^\d\s+\/$/))
912
+ result = unformated.delete(1, unformated.value.length);
913
+ else if (unformated.match(/^\d\d\s\s+\/\s*$/))
914
+ result = unformated.replace(2, unformated.value.length, " / ");
915
+ else if (unformated.match(/^\d\s\s+(\/\s*)?$/))
916
+ result = unformated.replace(1, unformated.value.length, " / ");
917
+ else if (unformated.match(/^\d\s\/\s\d\d.+$/))
918
+ result = unformated.delete(6, unformated.value.length);
919
+ else if (unformated.value.length > 1 && unformated.value.indexOf("/") < 1)
920
+ result = unformated.insert(2, " / ");
921
+ else if (unformated.value.length > 1 && unformated.value.split("/").length > 2)
922
+ result = unformated.delete(unformated.value.lastIndexOf("/"));
923
+ else if (unformated.value.length == 1 && !unformated.isDigit(0))
924
+ result = unformated.delete(0);
925
+ return Object.assign(Object.assign({}, result), { type: "text", length: [1, 7], pattern: /^(\d{1,2}|\d{1,2} \/ \d{1,2})$/ });
926
+ }
927
+ unformat(formated) {
928
+ return formated;
929
+ }
930
+ allowed(symbol, state) {
931
+ return state.value.length < 7 && ((symbol >= "0" && symbol <= "9") || symbol == "/" || symbol == " ");
932
+ }
933
+ }
934
+ base.add("divisor", () => new Handler());
935
+ //# sourceMappingURL=divisor.js.map
936
+ });
937
+
938
+ const divisor$1 = /*@__PURE__*/getDefaultExportFromCjs(divisor);
939
+
940
+ var identityNumber = createCommonjsModule(function (module, exports) {
941
+ "use strict";
942
+ Object.defineProperty(exports, "__esModule", { value: true });
943
+
944
+ class Handler {
945
+ constructor(country) {
946
+ this.country = country;
947
+ }
948
+ toString(data) {
949
+ return typeof data == "string" ? data : "";
950
+ }
951
+ fromString(value) {
952
+ return typeof value == "string" ? value : undefined;
953
+ }
954
+ format(unformated) {
955
+ let result = unformated;
956
+ const year = new Date().getFullYear().toString();
957
+ if (unformated.value.length > 1 && unformated.get(0, 2) != "19" && unformated.get(0, 2) != "20")
958
+ result = result.prepend(unformated.get(0, 2) > year.substr(2, 2) ? "19" : "20");
959
+ if (result.value.length >= 8)
960
+ result = result.insert(8, "-");
961
+ return Object.assign(Object.assign({}, result.truncate(13)), { type: "text", length: [11, 13], pattern: /^\d{6,8}-\d{4}$/ });
962
+ }
963
+ unformat(formated) {
964
+ return formated.delete("-");
965
+ }
966
+ allowed(symbol, state) {
967
+ return state.value.length < 13 && symbol >= "0" && symbol <= "9";
968
+ }
969
+ }
970
+ base.add("identity-number", (argument) => new Handler(argument && argument.length > 0 ? argument[0] : undefined));
971
+ //# sourceMappingURL=identity-number.js.map
972
+ });
973
+
974
+ const identityNumber$1 = /*@__PURE__*/getDefaultExportFromCjs(identityNumber);
975
+
976
+ var password = createCommonjsModule(function (module, exports) {
977
+ "use strict";
978
+ Object.defineProperty(exports, "__esModule", { value: true });
979
+
980
+ class Handler {
981
+ toString(data) {
982
+ return typeof data == "string" ? data : "";
983
+ }
984
+ fromString(value) {
985
+ return typeof value == "string" ? value : undefined;
986
+ }
987
+ format(unformated) {
988
+ return Object.assign(Object.assign({}, unformated), { type: "password", autocomplete: "current-password" });
989
+ }
990
+ unformat(formated) {
991
+ return formated;
992
+ }
993
+ allowed(symbol, state) {
994
+ return true;
995
+ }
996
+ }
997
+ base.add("password", () => new Handler());
998
+ //# sourceMappingURL=password.js.map
999
+ });
1000
+
1001
+ const password$1 = /*@__PURE__*/getDefaultExportFromCjs(password);
1002
+
1003
+ var percent = createCommonjsModule(function (module, exports) {
1004
+ "use strict";
1005
+ Object.defineProperty(exports, "__esModule", { value: true });
1006
+
1007
+ class Handler {
1008
+ toString(data) {
1009
+ return data && typeof data == "number" ? (data * 100).toString() : "";
1010
+ }
1011
+ fromString(value) {
1012
+ return typeof value != "string" || !Number.parseFloat(value) ? undefined : Number.parseFloat(value) / 100;
1013
+ }
1014
+ format(unformated) {
1015
+ return Object.assign(Object.assign({}, (unformated.value ? unformated.suffix(" %") : unformated)), { type: "text", length: [3, undefined], pattern: /^\d+(.\d)? %+$/ });
1016
+ }
1017
+ unformat(formated) {
1018
+ return formated.delete(" %");
1019
+ }
1020
+ allowed(symbol, state) {
1021
+ return (symbol >= "0" && symbol <= "9") || (symbol == "." && !state.value.includes("."));
1022
+ }
1023
+ }
1024
+ base.add("percent", () => new Handler());
1025
+ //# sourceMappingURL=percent.js.map
1026
+ });
1027
+
1028
+ const percent$1 = /*@__PURE__*/getDefaultExportFromCjs(percent);
1029
+
1030
+ var phonePrefix = createCommonjsModule(function (module, exports) {
1031
+ "use strict";
1032
+ Object.defineProperty(exports, "__esModule", { value: true });
1033
+ exports.phonePrefix = void 0;
1034
+ exports.phonePrefix = [
1035
+ {
1036
+ countryCode: "+46",
1037
+ areaCodes: [
1038
+ "011",
1039
+ "0120",
1040
+ "0121",
1041
+ "0122",
1042
+ "0123",
1043
+ "0125",
1044
+ "013",
1045
+ "0140",
1046
+ "0141",
1047
+ "0142",
1048
+ "0143",
1049
+ "0144",
1050
+ "0150",
1051
+ "0151",
1052
+ "0152",
1053
+ "0155",
1054
+ "0156",
1055
+ "0157",
1056
+ "0158",
1057
+ "0159",
1058
+ "016",
1059
+ "0171",
1060
+ "0173",
1061
+ "0174",
1062
+ "0175",
1063
+ "0176",
1064
+ "018",
1065
+ "019",
1066
+ "021",
1067
+ "0220",
1068
+ "0221",
1069
+ "0222",
1070
+ "0223",
1071
+ "0224",
1072
+ "0225",
1073
+ "0226",
1074
+ "0227",
1075
+ "023",
1076
+ "0240",
1077
+ "0241",
1078
+ "0243",
1079
+ "0246",
1080
+ "0247",
1081
+ "0248",
1082
+ "0250",
1083
+ "0251",
1084
+ "0253",
1085
+ "0258",
1086
+ "026",
1087
+ "0270",
1088
+ "0271",
1089
+ "0278",
1090
+ "0280",
1091
+ "0281",
1092
+ "0290",
1093
+ "0291",
1094
+ "0292",
1095
+ "0293",
1096
+ "0294",
1097
+ "0295",
1098
+ "0297",
1099
+ "0300",
1100
+ "0301",
1101
+ "0302",
1102
+ "0303",
1103
+ "0304",
1104
+ "031",
1105
+ "0320",
1106
+ "0321",
1107
+ "0322",
1108
+ "0325",
1109
+ "033",
1110
+ "0340",
1111
+ "0345",
1112
+ "0346",
1113
+ "035",
1114
+ "036",
1115
+ "0370",
1116
+ "0371",
1117
+ "0372",
1118
+ "0380",
1119
+ "0381",
1120
+ "0382",
1121
+ "0383",
1122
+ "0390",
1123
+ "0392",
1124
+ "0393",
1125
+ "040",
1126
+ "0410",
1127
+ "0411",
1128
+ "0413",
1129
+ "0414",
1130
+ "0415",
1131
+ "0416",
1132
+ "0417",
1133
+ "0418",
1134
+ "042",
1135
+ "0430",
1136
+ "0431",
1137
+ "0433",
1138
+ "0435",
1139
+ "044",
1140
+ "0451",
1141
+ "0454",
1142
+ "0455",
1143
+ "0456",
1144
+ "0457",
1145
+ "0459",
1146
+ "046",
1147
+ "0470",
1148
+ "0471",
1149
+ "0472",
1150
+ "0474",
1151
+ "0476",
1152
+ "0477",
1153
+ "0478",
1154
+ "0479",
1155
+ "0480",
1156
+ "0481",
1157
+ "0485",
1158
+ "0486",
1159
+ "0490",
1160
+ "0491",
1161
+ "0492",
1162
+ "0493",
1163
+ "0494",
1164
+ "0495",
1165
+ "0496",
1166
+ "0498",
1167
+ "0499",
1168
+ "0500",
1169
+ "0501",
1170
+ "0502",
1171
+ "0503",
1172
+ "0504",
1173
+ "0505",
1174
+ "0506",
1175
+ "0510",
1176
+ "0511",
1177
+ "0512",
1178
+ "0513",
1179
+ "0514",
1180
+ "0515",
1181
+ "0520",
1182
+ "0521",
1183
+ "0522",
1184
+ "0523",
1185
+ "0524",
1186
+ "0525",
1187
+ "0526",
1188
+ "0528",
1189
+ "0530",
1190
+ "0531",
1191
+ "0532",
1192
+ "0533",
1193
+ "0534",
1194
+ "054",
1195
+ "0550",
1196
+ "0551",
1197
+ "0552",
1198
+ "0553",
1199
+ "0554",
1200
+ "0555",
1201
+ "0560",
1202
+ "0563",
1203
+ "0564",
1204
+ "0565",
1205
+ "0570",
1206
+ "0571",
1207
+ "0573",
1208
+ "0580",
1209
+ "0581",
1210
+ "0582",
1211
+ "0583",
1212
+ "0584",
1213
+ "0585",
1214
+ "0586",
1215
+ "0587",
1216
+ "0589",
1217
+ "0590",
1218
+ "0591",
1219
+ "060",
1220
+ "0611",
1221
+ "0612",
1222
+ "0613",
1223
+ "0620",
1224
+ "0621",
1225
+ "0622",
1226
+ "0623",
1227
+ "0624",
1228
+ "063",
1229
+ "0640",
1230
+ "0642",
1231
+ "0643",
1232
+ "0644",
1233
+ "0645",
1234
+ "0647",
1235
+ "0650",
1236
+ "0651",
1237
+ "0652",
1238
+ "0653",
1239
+ "0657",
1240
+ "0660",
1241
+ "0661",
1242
+ "0662",
1243
+ "0663",
1244
+ "0670",
1245
+ "0671",
1246
+ "0672",
1247
+ "0680",
1248
+ "0682",
1249
+ "0684",
1250
+ "0687",
1251
+ "0690",
1252
+ "0691",
1253
+ "0692",
1254
+ "0693",
1255
+ "0695",
1256
+ "0696",
1257
+ "08",
1258
+ "090",
1259
+ "0910",
1260
+ "0911",
1261
+ "0912",
1262
+ "0913",
1263
+ "0914",
1264
+ "0915",
1265
+ "0916",
1266
+ "0918",
1267
+ "0920",
1268
+ "0921",
1269
+ "0922",
1270
+ "0923",
1271
+ "0924",
1272
+ "0925",
1273
+ "0926",
1274
+ "0927",
1275
+ "0928",
1276
+ "0929",
1277
+ "0930",
1278
+ "0932",
1279
+ "0933",
1280
+ "0934",
1281
+ "0935",
1282
+ "0940",
1283
+ "0941",
1284
+ "0942",
1285
+ "0943",
1286
+ "0950",
1287
+ "0951",
1288
+ "0952",
1289
+ "0953",
1290
+ "0954",
1291
+ "0960",
1292
+ "0961",
1293
+ "0970",
1294
+ "0971",
1295
+ "0973",
1296
+ "0975",
1297
+ "0976",
1298
+ "0977",
1299
+ "0978",
1300
+ "0980",
1301
+ "0981",
1302
+ "010",
1303
+ "020",
1304
+ "0378",
1305
+ "070",
1306
+ "072",
1307
+ "073",
1308
+ "076",
1309
+ "079",
1310
+ "0710",
1311
+ "0740",
1312
+ "0746",
1313
+ "0749",
1314
+ "0741",
1315
+ "0742",
1316
+ "0743",
1317
+ "0744",
1318
+ "0745",
1319
+ "0747",
1320
+ "075",
1321
+ "077",
1322
+ "078",
1323
+ "0900",
1324
+ "0939",
1325
+ "0944",
1326
+ "0969",
1327
+ "099",
1328
+ ],
1329
+ },
1330
+ ];
1331
+ //# sourceMappingURL=phonePrefix.js.map
1332
+ });
1333
+
1334
+ const phonePrefix$1 = /*@__PURE__*/getDefaultExportFromCjs(phonePrefix);
1335
+
1336
+ var phone = createCommonjsModule(function (module, exports) {
1337
+ "use strict";
1338
+ Object.defineProperty(exports, "__esModule", { value: true });
1339
+
1340
+
1341
+ class Handler {
1342
+ toString(data) {
1343
+ return typeof data == "string" ? data : "";
1344
+ }
1345
+ fromString(value) {
1346
+ return typeof value == "string" ? value : undefined;
1347
+ }
1348
+ format(unformated) {
1349
+ let result = unformated;
1350
+ if (result.value.startsWith("+")) {
1351
+ for (const country of phonePrefix.phonePrefix)
1352
+ if (result.value.startsWith(country.countryCode))
1353
+ for (let prefix of country.areaCodes) {
1354
+ prefix = prefix.substring(1);
1355
+ if (result.value.startsWith(country.countryCode + prefix) && !result.value.includes("-"))
1356
+ result = result
1357
+ .insert(country.countryCode.length, "-")
1358
+ .insert(country.countryCode.length + 1 + prefix.length, "-");
1359
+ }
1360
+ }
1361
+ else {
1362
+ const first = phonePrefix.phonePrefix[0];
1363
+ for (const prefix of first.areaCodes)
1364
+ if (result.value.startsWith(prefix) && !result.value.includes("-")) {
1365
+ result = result.insert(prefix.length, "-");
1366
+ result = result.delete(0);
1367
+ result = result.insert(0, "-").insert(0, first.countryCode);
1368
+ }
1369
+ }
1370
+ if (result.value.includes("-")) {
1371
+ const digitIndex = result.value.indexOf("-", result.value.indexOf("-") + 1) + 1;
1372
+ const digitCount = result.value.substring(digitIndex, result.value.length + 1).length;
1373
+ switch (digitCount) {
1374
+ case 4:
1375
+ result = result.insert(digitIndex + 2, " ");
1376
+ break;
1377
+ case 5:
1378
+ result = result.insert(digitIndex + 3, " ");
1379
+ break;
1380
+ case 6:
1381
+ result = result.insert(digitIndex + 2, " ");
1382
+ result = result.insert(digitIndex + 5, " ");
1383
+ break;
1384
+ case 7:
1385
+ result = result.insert(digitIndex + 3, " ");
1386
+ result = result.insert(digitIndex + 6, " ");
1387
+ break;
1388
+ case 8:
1389
+ case 9:
1390
+ result = result.insert(digitIndex + 3, " ");
1391
+ result = result.insert(digitIndex + 7, " ");
1392
+ break;
1393
+ default:
1394
+ break;
1395
+ }
1396
+ if (digitCount > 9) {
1397
+ const spaces = Math.ceil(digitCount / 3) - 1;
1398
+ if (spaces > 0) {
1399
+ for (let i = 0; i < spaces; i++) {
1400
+ const position = i * 3 + 3 + i;
1401
+ result = result.insert(position + digitIndex, " ");
1402
+ }
1403
+ }
1404
+ }
1405
+ }
1406
+ return Object.assign(Object.assign({}, result), { type: "text", autocomplete: "tel" });
1407
+ }
1408
+ unformat(formated) {
1409
+ return formated.delete(" ").delete("-");
1410
+ }
1411
+ allowed(symbol, state) {
1412
+ return ((symbol >= "0" && symbol <= "9") || (state.selection.start == 0 && symbol == "+" && !state.value.includes("+")));
1413
+ }
1414
+ }
1415
+ base.add("phone", () => new Handler());
1416
+ //# sourceMappingURL=phone.js.map
1417
+ });
1418
+
1419
+ const phone$1 = /*@__PURE__*/getDefaultExportFromCjs(phone);
1420
+
1421
+ var postalCode = createCommonjsModule(function (module, exports) {
1422
+ "use strict";
1423
+ Object.defineProperty(exports, "__esModule", { value: true });
1424
+
1425
+ class Handler {
1426
+ constructor(country) {
1427
+ this.country = country;
1428
+ }
1429
+ toString(data) {
1430
+ return typeof data == "string" ? data : "";
1431
+ }
1432
+ fromString(value) {
1433
+ return typeof value == "string" ? value : undefined;
1434
+ }
1435
+ format(unformated) {
1436
+ const result = !unformated.value.includes(" ") && unformated.value.length >= 4 ? unformated.insert(3, " ") : unformated;
1437
+ return Object.assign(Object.assign({}, result.truncate(6)), { type: "text", autocomplete: "postal-code", length: [6, 6], pattern: /^\d{3} \d{2}$/ });
1438
+ }
1439
+ unformat(formated) {
1440
+ return formated.delete(" ");
1441
+ }
1442
+ allowed(symbol, state) {
1443
+ return state.value.length <= 5 && symbol >= "0" && symbol <= "9";
1444
+ }
1445
+ }
1446
+ base.add("postal-code", (argument) => new Handler(argument && argument.length > 0 ? argument[0] : undefined));
1447
+ //# sourceMappingURL=postal-code.js.map
1448
+ });
1449
+
1450
+ const postalCode$1 = /*@__PURE__*/getDefaultExportFromCjs(postalCode);
1451
+
1452
+ var price = createCommonjsModule(function (module, exports) {
1453
+ "use strict";
1454
+ Object.defineProperty(exports, "__esModule", { value: true });
1455
+
1456
+
1457
+
1458
+ class Handler {
1459
+ constructor(currency) {
1460
+ this.currency = currency;
1461
+ }
1462
+ toString(data) {
1463
+ return typeof data == "number" ? (isNaN(data) ? "" : data.toString()) : "";
1464
+ }
1465
+ fromString(value) {
1466
+ const result = typeof value == "string" ? Number.parseFloat(value) : undefined;
1467
+ return result && !isNaN(result) ? result : undefined;
1468
+ }
1469
+ format(unformated) {
1470
+ var _a;
1471
+ let separator = unformated.value && unformated.value.includes(".") ? unformated.value.indexOf(".") : undefined;
1472
+ let result = unformated.value == "NaN" ? unformated.replace(0, unformated.value.length, "") : StateEditor_1.StateEditor.copy(unformated);
1473
+ if (separator == 0) {
1474
+ result = result.prepend("0");
1475
+ separator++;
1476
+ }
1477
+ if (separator != undefined) {
1478
+ const adjust = separator +
1479
+ 1 +
1480
+ (!this.currency || dist$1.Currency.decimalDigits(this.currency) == undefined
1481
+ ? 2
1482
+ : (_a = dist$1.Currency.decimalDigits(this.currency)) !== null && _a !== void 0 ? _a : 2) -
1483
+ result.value.length;
1484
+ result = adjust < 0 ? result.truncate(result.value.length + adjust) : result.suffix("0".repeat(adjust));
1485
+ }
1486
+ else
1487
+ separator = result.value.length;
1488
+ const spaces = separator <= 0 ? 0 : Math.ceil(separator / 3) - 1;
1489
+ for (let i = 0; i < spaces; i++) {
1490
+ const position = separator - (spaces - i) * 3;
1491
+ result = result.insert(position, " ");
1492
+ separator++;
1493
+ }
1494
+ if (result.match(/^[0\s]{2,}$/))
1495
+ result = result.replace(0, result.value.length, "0");
1496
+ else if (result.match(/^[0\s]{2,}(\s\w{3}){1}$/))
1497
+ result = result.replace(0, result.value.length - 4, "0");
1498
+ result =
1499
+ this.currency && (result.value.length > 1 || (result.value.length == 1 && result.value.charAt(0) != "."))
1500
+ ? result.suffix(" " + this.currency)
1501
+ : result;
1502
+ return Object.assign(Object.assign({}, result), { type: "text", length: [3, undefined], pattern: new RegExp("^(\\d{0,3})( \\d{3})*(\\.\\d+)?" + (this.currency ? " " + this.currency : "") + "$") });
1503
+ }
1504
+ unformat(formated) {
1505
+ return this.currency ? formated.delete(" ").delete("" + this.currency) : formated.delete(" ");
1506
+ }
1507
+ allowed(symbol, state) {
1508
+ return (symbol >= "0" && symbol <= "9") || (symbol == "." && !state.value.includes("."));
1509
+ }
1510
+ }
1511
+ base.add("price", (argument) => new Handler(argument && argument.length > 0 ? argument[0] : undefined));
1512
+ //# sourceMappingURL=price.js.map
1513
+ });
1514
+
1515
+ const price$1 = /*@__PURE__*/getDefaultExportFromCjs(price);
1516
+
1517
+ var text = createCommonjsModule(function (module, exports) {
1518
+ "use strict";
1519
+ Object.defineProperty(exports, "__esModule", { value: true });
1520
+
1521
+ class Handler {
1522
+ constructor(settings) {
1523
+ this.settings = settings;
1524
+ }
1525
+ toString(data) {
1526
+ return typeof data == "string" ? data : "";
1527
+ }
1528
+ fromString(value) {
1529
+ return typeof value == "string" ? value : undefined;
1530
+ }
1531
+ format(unformated) {
1532
+ return Object.assign(Object.assign(Object.assign({}, unformated), { type: "text" }), this.settings);
1533
+ }
1534
+ unformat(formated) {
1535
+ return formated;
1536
+ }
1537
+ allowed(symbol, state) {
1538
+ return (this.settings.length == undefined ||
1539
+ this.settings.length[1] == undefined ||
1540
+ state.value.length < this.settings.length[1]);
1541
+ }
1542
+ }
1543
+ base.add("text", (settings) => new Handler(settings || {}));
1544
+ base.add("email", (settings) => new Handler(settings || {}));
1545
+ //# sourceMappingURL=text.js.map
1546
+ });
1547
+
1548
+ const text$1 = /*@__PURE__*/getDefaultExportFromCjs(text);
1549
+
1550
+ var Handler = createCommonjsModule(function (module, exports) {
1551
+ "use strict";
1552
+ Object.defineProperty(exports, "__esModule", { value: true });
1553
+ exports.parse = exports.format = exports.get = void 0;
1554
+
1555
+
1556
+
1557
+
1558
+
1559
+
1560
+
1561
+
1562
+
1563
+
1564
+
1565
+
1566
+
1567
+
1568
+ Object.defineProperty(exports, "format", { enumerable: true, get: function () { return base.format; } });
1569
+ Object.defineProperty(exports, "get", { enumerable: true, get: function () { return base.get; } });
1570
+ Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return base.parse; } });
1571
+ //# sourceMappingURL=index.js.map
1572
+ });
1573
+
1574
+ const index$1 = /*@__PURE__*/getDefaultExportFromCjs(Handler);
1575
+
1576
+ var dist = createCommonjsModule(function (module, exports) {
1577
+ "use strict";
1578
+ Object.defineProperty(exports, "__esModule", { value: true });
1579
+ exports.parse = exports.format = exports.get = exports.StateEditor = exports.State = exports.Selection = exports.Action = void 0;
1580
+
1581
+ Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return Action_1.Action; } });
1582
+
1583
+ Object.defineProperty(exports, "format", { enumerable: true, get: function () { return Handler.format; } });
1584
+ Object.defineProperty(exports, "get", { enumerable: true, get: function () { return Handler.get; } });
1585
+ Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return Handler.parse; } });
1586
+
1587
+ Object.defineProperty(exports, "Selection", { enumerable: true, get: function () { return Selection_1.Selection; } });
1588
+
1589
+ Object.defineProperty(exports, "State", { enumerable: true, get: function () { return State_1.State; } });
1590
+
1591
+ Object.defineProperty(exports, "StateEditor", { enumerable: true, get: function () { return StateEditor_1.StateEditor; } });
1592
+ //# sourceMappingURL=index.js.map
1593
+ });
1594
+
1595
+ const index = /*@__PURE__*/getDefaultExportFromCjs(dist);
1596
+
1597
+ export { dist as d };