@kvell-group/ui 1.12.4 → 1.12.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3163 +1,15 @@
1
- import { jsx as ee } from "react/jsx-runtime";
2
- import X, { forwardRef as se } from "react";
3
- import { Input as ie } from "../Input.js";
4
- function G(a) {
5
- return typeof a == "string" || a instanceof String;
6
- }
7
- function Bt(a) {
8
- var t;
9
- return typeof a == "object" && a != null && (a == null || (t = a.constructor) == null ? void 0 : t.name) === "Object";
10
- }
11
- function zt(a, t) {
12
- return Array.isArray(t) ? zt(a, (e, s) => t.includes(s)) : Object.entries(a).reduce((e, s) => {
13
- let [i, r] = s;
14
- return t(r, i) && (e[i] = r), e;
15
- }, {});
16
- }
17
- const m = {
18
- NONE: "NONE",
19
- LEFT: "LEFT",
20
- FORCE_LEFT: "FORCE_LEFT",
21
- RIGHT: "RIGHT",
22
- FORCE_RIGHT: "FORCE_RIGHT"
23
- };
24
- function re(a) {
25
- switch (a) {
26
- case m.LEFT:
27
- return m.FORCE_LEFT;
28
- case m.RIGHT:
29
- return m.FORCE_RIGHT;
30
- default:
31
- return a;
32
- }
33
- }
34
- function Ct(a) {
35
- return a.replace(/([.*+?^=!:${}()|[\]/\\])/g, "\\$1");
36
- }
37
- function ot(a, t) {
38
- if (t === a) return !0;
39
- const e = Array.isArray(t), s = Array.isArray(a);
40
- let i;
41
- if (e && s) {
42
- if (t.length != a.length) return !1;
43
- for (i = 0; i < t.length; i++) if (!ot(t[i], a[i])) return !1;
44
- return !0;
45
- }
46
- if (e != s) return !1;
47
- if (t && a && typeof t == "object" && typeof a == "object") {
48
- const r = t instanceof Date, n = a instanceof Date;
49
- if (r && n) return t.getTime() == a.getTime();
50
- if (r != n) return !1;
51
- const u = t instanceof RegExp, l = a instanceof RegExp;
52
- if (u && l) return t.toString() == a.toString();
53
- if (u != l) return !1;
54
- const h = Object.keys(t);
55
- for (i = 0; i < h.length; i++) if (!Object.prototype.hasOwnProperty.call(a, h[i])) return !1;
56
- for (i = 0; i < h.length; i++) if (!ot(a[h[i]], t[h[i]])) return !1;
57
- return !0;
58
- } else if (t && a && typeof t == "function" && typeof a == "function")
59
- return t.toString() === a.toString();
60
- return !1;
61
- }
62
- class ne {
63
- /** Current input value */
64
- /** Current cursor position */
65
- /** Old input value */
66
- /** Old selection */
67
- constructor(t) {
68
- for (Object.assign(this, t); this.value.slice(0, this.startChangePos) !== this.oldValue.slice(0, this.startChangePos); )
69
- --this.oldSelection.start;
70
- if (this.insertedCount)
71
- for (; this.value.slice(this.cursorPos) !== this.oldValue.slice(this.oldSelection.end); )
72
- this.value.length - this.cursorPos < this.oldValue.length - this.oldSelection.end ? ++this.oldSelection.end : ++this.cursorPos;
73
- }
74
- /** Start changing position */
75
- get startChangePos() {
76
- return Math.min(this.cursorPos, this.oldSelection.start);
77
- }
78
- /** Inserted symbols count */
79
- get insertedCount() {
80
- return this.cursorPos - this.startChangePos;
81
- }
82
- /** Inserted symbols */
83
- get inserted() {
84
- return this.value.substr(this.startChangePos, this.insertedCount);
85
- }
86
- /** Removed symbols count */
87
- get removedCount() {
88
- return Math.max(this.oldSelection.end - this.startChangePos || // for Delete
89
- this.oldValue.length - this.value.length, 0);
90
- }
91
- /** Removed symbols */
92
- get removed() {
93
- return this.oldValue.substr(this.startChangePos, this.removedCount);
94
- }
95
- /** Unchanged head symbols */
96
- get head() {
97
- return this.value.substring(0, this.startChangePos);
98
- }
99
- /** Unchanged tail symbols */
100
- get tail() {
101
- return this.value.substring(this.startChangePos + this.insertedCount);
102
- }
103
- /** Remove direction */
104
- get removeDirection() {
105
- return !this.removedCount || this.insertedCount ? m.NONE : (this.oldSelection.end === this.cursorPos || this.oldSelection.start === this.cursorPos) && // if not range removed (event with backspace)
106
- this.oldSelection.end === this.oldSelection.start ? m.RIGHT : m.LEFT;
107
- }
108
- }
109
- function g(a, t) {
110
- return new g.InputMask(a, t);
111
- }
112
- function Ht(a) {
113
- if (a == null) throw new Error("mask property should be defined");
114
- return a instanceof RegExp ? g.MaskedRegExp : G(a) ? g.MaskedPattern : a === Date ? g.MaskedDate : a === Number ? g.MaskedNumber : Array.isArray(a) || a === Array ? g.MaskedDynamic : g.Masked && a.prototype instanceof g.Masked ? a : g.Masked && a instanceof g.Masked ? a.constructor : a instanceof Function ? g.MaskedFunction : (console.warn("Mask not found for mask", a), g.Masked);
115
- }
116
- function et(a) {
117
- if (!a) throw new Error("Options in not defined");
118
- if (g.Masked) {
119
- if (a.prototype instanceof g.Masked) return {
120
- mask: a
121
- };
122
- const {
123
- mask: t = void 0,
124
- ...e
125
- } = a instanceof g.Masked ? {
126
- mask: a
127
- } : Bt(a) && a.mask instanceof g.Masked ? a : {};
128
- if (t) {
129
- const s = t.mask;
130
- return {
131
- ...zt(t, (i, r) => !r.startsWith("_")),
132
- mask: t.constructor,
133
- _mask: s,
134
- ...e
135
- };
136
- }
137
- }
138
- return Bt(a) ? {
139
- ...a
140
- } : {
141
- mask: a
142
- };
143
- }
144
- function K(a) {
145
- if (g.Masked && a instanceof g.Masked) return a;
146
- const t = et(a), e = Ht(t.mask);
147
- if (!e) throw new Error("Masked class is not found for provided mask " + t.mask + ", appropriate module needs to be imported manually before creating mask.");
148
- return t.mask === e && delete t.mask, t._mask && (t.mask = t._mask, delete t._mask), new e(t);
149
- }
150
- g.createMask = K;
151
- class Rt {
152
- /** */
153
- /** */
154
- /** */
155
- /** Safely returns selection start */
156
- get selectionStart() {
157
- let t;
158
- try {
159
- t = this._unsafeSelectionStart;
160
- } catch {
161
- }
162
- return t ?? this.value.length;
163
- }
164
- /** Safely returns selection end */
165
- get selectionEnd() {
166
- let t;
167
- try {
168
- t = this._unsafeSelectionEnd;
169
- } catch {
170
- }
171
- return t ?? this.value.length;
172
- }
173
- /** Safely sets element selection */
174
- select(t, e) {
175
- if (!(t == null || e == null || t === this.selectionStart && e === this.selectionEnd))
176
- try {
177
- this._unsafeSelect(t, e);
178
- } catch {
179
- }
180
- }
181
- /** */
182
- get isActive() {
183
- return !1;
184
- }
185
- /** */
186
- /** */
187
- /** */
188
- }
189
- g.MaskElement = Rt;
190
- const Ot = 90, ae = 89;
191
- class ht extends Rt {
192
- /** HTMLElement to use mask on */
193
- constructor(t) {
194
- super(), this.input = t, this._onKeydown = this._onKeydown.bind(this), this._onInput = this._onInput.bind(this), this._onBeforeinput = this._onBeforeinput.bind(this), this._onCompositionEnd = this._onCompositionEnd.bind(this);
195
- }
196
- get rootElement() {
197
- var t, e, s;
198
- return (t = (e = (s = this.input).getRootNode) == null ? void 0 : e.call(s)) != null ? t : document;
199
- }
200
- /** Is element in focus */
201
- get isActive() {
202
- return this.input === this.rootElement.activeElement;
203
- }
204
- /** Binds HTMLElement events to mask internal events */
205
- bindEvents(t) {
206
- this.input.addEventListener("keydown", this._onKeydown), this.input.addEventListener("input", this._onInput), this.input.addEventListener("beforeinput", this._onBeforeinput), this.input.addEventListener("compositionend", this._onCompositionEnd), this.input.addEventListener("drop", t.drop), this.input.addEventListener("click", t.click), this.input.addEventListener("focus", t.focus), this.input.addEventListener("blur", t.commit), this._handlers = t;
207
- }
208
- _onKeydown(t) {
209
- if (this._handlers.redo && (t.keyCode === Ot && t.shiftKey && (t.metaKey || t.ctrlKey) || t.keyCode === ae && t.ctrlKey))
210
- return t.preventDefault(), this._handlers.redo(t);
211
- if (this._handlers.undo && t.keyCode === Ot && (t.metaKey || t.ctrlKey))
212
- return t.preventDefault(), this._handlers.undo(t);
213
- t.isComposing || this._handlers.selectionChange(t);
214
- }
215
- _onBeforeinput(t) {
216
- if (t.inputType === "historyUndo" && this._handlers.undo)
217
- return t.preventDefault(), this._handlers.undo(t);
218
- if (t.inputType === "historyRedo" && this._handlers.redo)
219
- return t.preventDefault(), this._handlers.redo(t);
220
- }
221
- _onCompositionEnd(t) {
222
- this._handlers.input(t);
223
- }
224
- _onInput(t) {
225
- t.isComposing || this._handlers.input(t);
226
- }
227
- /** Unbinds HTMLElement events to mask internal events */
228
- unbindEvents() {
229
- this.input.removeEventListener("keydown", this._onKeydown), this.input.removeEventListener("input", this._onInput), this.input.removeEventListener("beforeinput", this._onBeforeinput), this.input.removeEventListener("compositionend", this._onCompositionEnd), this.input.removeEventListener("drop", this._handlers.drop), this.input.removeEventListener("click", this._handlers.click), this.input.removeEventListener("focus", this._handlers.focus), this.input.removeEventListener("blur", this._handlers.commit), this._handlers = {};
230
- }
231
- }
232
- g.HTMLMaskElement = ht;
233
- class ue extends ht {
234
- /** InputElement to use mask on */
235
- constructor(t) {
236
- super(t), this.input = t;
237
- }
238
- /** Returns InputElement selection start */
239
- get _unsafeSelectionStart() {
240
- return this.input.selectionStart != null ? this.input.selectionStart : this.value.length;
241
- }
242
- /** Returns InputElement selection end */
243
- get _unsafeSelectionEnd() {
244
- return this.input.selectionEnd;
245
- }
246
- /** Sets InputElement selection */
247
- _unsafeSelect(t, e) {
248
- this.input.setSelectionRange(t, e);
249
- }
250
- get value() {
251
- return this.input.value;
252
- }
253
- set value(t) {
254
- this.input.value = t;
255
- }
256
- }
257
- g.HTMLMaskElement = ht;
258
- class Kt extends ht {
259
- /** Returns HTMLElement selection start */
260
- get _unsafeSelectionStart() {
261
- const t = this.rootElement, e = t.getSelection && t.getSelection(), s = e && e.anchorOffset, i = e && e.focusOffset;
262
- return i == null || s == null || s < i ? s : i;
263
- }
264
- /** Returns HTMLElement selection end */
265
- get _unsafeSelectionEnd() {
266
- const t = this.rootElement, e = t.getSelection && t.getSelection(), s = e && e.anchorOffset, i = e && e.focusOffset;
267
- return i == null || s == null || s > i ? s : i;
268
- }
269
- /** Sets HTMLElement selection */
270
- _unsafeSelect(t, e) {
271
- if (!this.rootElement.createRange) return;
272
- const s = this.rootElement.createRange();
273
- s.setStart(this.input.firstChild || this.input, t), s.setEnd(this.input.lastChild || this.input, e);
274
- const i = this.rootElement, r = i.getSelection && i.getSelection();
275
- r && (r.removeAllRanges(), r.addRange(s));
276
- }
277
- /** HTMLElement value */
278
- get value() {
279
- return this.input.textContent || "";
280
- }
281
- set value(t) {
282
- this.input.textContent = t;
283
- }
284
- }
285
- g.HTMLContenteditableMaskElement = Kt;
286
- class pt {
287
- constructor() {
288
- this.states = [], this.currentIndex = 0;
289
- }
290
- get currentState() {
291
- return this.states[this.currentIndex];
292
- }
293
- get isEmpty() {
294
- return this.states.length === 0;
295
- }
296
- push(t) {
297
- this.currentIndex < this.states.length - 1 && (this.states.length = this.currentIndex + 1), this.states.push(t), this.states.length > pt.MAX_LENGTH && this.states.shift(), this.currentIndex = this.states.length - 1;
298
- }
299
- go(t) {
300
- return this.currentIndex = Math.min(Math.max(this.currentIndex + t, 0), this.states.length - 1), this.currentState;
301
- }
302
- undo() {
303
- return this.go(-1);
304
- }
305
- redo() {
306
- return this.go(1);
307
- }
308
- clear() {
309
- this.states.length = 0, this.currentIndex = 0;
310
- }
311
- }
312
- pt.MAX_LENGTH = 100;
313
- class oe {
314
- /**
315
- View element
316
- */
317
- /** Internal {@link Masked} model */
318
- constructor(t, e) {
319
- this.el = t instanceof Rt ? t : t.isContentEditable && t.tagName !== "INPUT" && t.tagName !== "TEXTAREA" ? new Kt(t) : new ue(t), this.masked = K(e), this._listeners = {}, this._value = "", this._unmaskedValue = "", this._rawInputValue = "", this.history = new pt(), this._saveSelection = this._saveSelection.bind(this), this._onInput = this._onInput.bind(this), this._onChange = this._onChange.bind(this), this._onDrop = this._onDrop.bind(this), this._onFocus = this._onFocus.bind(this), this._onClick = this._onClick.bind(this), this._onUndo = this._onUndo.bind(this), this._onRedo = this._onRedo.bind(this), this.alignCursor = this.alignCursor.bind(this), this.alignCursorFriendly = this.alignCursorFriendly.bind(this), this._bindEvents(), this.updateValue(), this._onChange();
320
- }
321
- maskEquals(t) {
322
- var e;
323
- return t == null || ((e = this.masked) == null ? void 0 : e.maskEquals(t));
324
- }
325
- /** Masked */
326
- get mask() {
327
- return this.masked.mask;
328
- }
329
- set mask(t) {
330
- if (this.maskEquals(t)) return;
331
- if (!(t instanceof g.Masked) && this.masked.constructor === Ht(t)) {
332
- this.masked.updateOptions({
333
- mask: t
334
- });
335
- return;
336
- }
337
- const e = t instanceof g.Masked ? t : K({
338
- mask: t
339
- });
340
- e.unmaskedValue = this.masked.unmaskedValue, this.masked = e;
341
- }
342
- /** Raw value */
343
- get value() {
344
- return this._value;
345
- }
346
- set value(t) {
347
- this.value !== t && (this.masked.value = t, this.updateControl("auto"));
348
- }
349
- /** Unmasked value */
350
- get unmaskedValue() {
351
- return this._unmaskedValue;
352
- }
353
- set unmaskedValue(t) {
354
- this.unmaskedValue !== t && (this.masked.unmaskedValue = t, this.updateControl("auto"));
355
- }
356
- /** Raw input value */
357
- get rawInputValue() {
358
- return this._rawInputValue;
359
- }
360
- set rawInputValue(t) {
361
- this.rawInputValue !== t && (this.masked.rawInputValue = t, this.updateControl(), this.alignCursor());
362
- }
363
- /** Typed unmasked value */
364
- get typedValue() {
365
- return this.masked.typedValue;
366
- }
367
- set typedValue(t) {
368
- this.masked.typedValueEquals(t) || (this.masked.typedValue = t, this.updateControl("auto"));
369
- }
370
- /** Display value */
371
- get displayValue() {
372
- return this.masked.displayValue;
373
- }
374
- /** Starts listening to element events */
375
- _bindEvents() {
376
- this.el.bindEvents({
377
- selectionChange: this._saveSelection,
378
- input: this._onInput,
379
- drop: this._onDrop,
380
- click: this._onClick,
381
- focus: this._onFocus,
382
- commit: this._onChange,
383
- undo: this._onUndo,
384
- redo: this._onRedo
385
- });
386
- }
387
- /** Stops listening to element events */
388
- _unbindEvents() {
389
- this.el && this.el.unbindEvents();
390
- }
391
- /** Fires custom event */
392
- _fireEvent(t, e) {
393
- const s = this._listeners[t];
394
- s && s.forEach((i) => i(e));
395
- }
396
- /** Current selection start */
397
- get selectionStart() {
398
- return this._cursorChanging ? this._changingCursorPos : this.el.selectionStart;
399
- }
400
- /** Current cursor position */
401
- get cursorPos() {
402
- return this._cursorChanging ? this._changingCursorPos : this.el.selectionEnd;
403
- }
404
- set cursorPos(t) {
405
- !this.el || !this.el.isActive || (this.el.select(t, t), this._saveSelection());
406
- }
407
- /** Stores current selection */
408
- _saveSelection() {
409
- this.displayValue !== this.el.value && console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."), this._selection = {
410
- start: this.selectionStart,
411
- end: this.cursorPos
412
- };
413
- }
414
- /** Syncronizes model value from view */
415
- updateValue() {
416
- this.masked.value = this.el.value, this._value = this.masked.value, this._unmaskedValue = this.masked.unmaskedValue, this._rawInputValue = this.masked.rawInputValue;
417
- }
418
- /** Syncronizes view from model value, fires change events */
419
- updateControl(t) {
420
- const e = this.masked.unmaskedValue, s = this.masked.value, i = this.masked.rawInputValue, r = this.displayValue, n = this.unmaskedValue !== e || this.value !== s || this._rawInputValue !== i;
421
- this._unmaskedValue = e, this._value = s, this._rawInputValue = i, this.el.value !== r && (this.el.value = r), t === "auto" ? this.alignCursor() : t != null && (this.cursorPos = t), n && this._fireChangeEvents(), !this._historyChanging && (n || this.history.isEmpty) && this.history.push({
422
- unmaskedValue: e,
423
- selection: {
424
- start: this.selectionStart,
425
- end: this.cursorPos
426
- }
427
- });
428
- }
429
- /** Updates options with deep equal check, recreates {@link Masked} model if mask type changes */
430
- updateOptions(t) {
431
- const {
432
- mask: e,
433
- ...s
434
- } = t, i = !this.maskEquals(e), r = this.masked.optionsIsChanged(s);
435
- i && (this.mask = e), r && this.masked.updateOptions(s), (i || r) && this.updateControl();
436
- }
437
- /** Updates cursor */
438
- updateCursor(t) {
439
- t != null && (this.cursorPos = t, this._delayUpdateCursor(t));
440
- }
441
- /** Delays cursor update to support mobile browsers */
442
- _delayUpdateCursor(t) {
443
- this._abortUpdateCursor(), this._changingCursorPos = t, this._cursorChanging = setTimeout(() => {
444
- this.el && (this.cursorPos = this._changingCursorPos, this._abortUpdateCursor());
445
- }, 10);
446
- }
447
- /** Fires custom events */
448
- _fireChangeEvents() {
449
- this._fireEvent("accept", this._inputEvent), this.masked.isComplete && this._fireEvent("complete", this._inputEvent);
450
- }
451
- /** Aborts delayed cursor update */
452
- _abortUpdateCursor() {
453
- this._cursorChanging && (clearTimeout(this._cursorChanging), delete this._cursorChanging);
454
- }
455
- /** Aligns cursor to nearest available position */
456
- alignCursor() {
457
- this.cursorPos = this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos, m.LEFT));
458
- }
459
- /** Aligns cursor only if selection is empty */
460
- alignCursorFriendly() {
461
- this.selectionStart === this.cursorPos && this.alignCursor();
462
- }
463
- /** Adds listener on custom event */
464
- on(t, e) {
465
- return this._listeners[t] || (this._listeners[t] = []), this._listeners[t].push(e), this;
466
- }
467
- /** Removes custom event listener */
468
- off(t, e) {
469
- if (!this._listeners[t]) return this;
470
- if (!e)
471
- return delete this._listeners[t], this;
472
- const s = this._listeners[t].indexOf(e);
473
- return s >= 0 && this._listeners[t].splice(s, 1), this;
474
- }
475
- /** Handles view input event */
476
- _onInput(t) {
477
- this._inputEvent = t, this._abortUpdateCursor();
478
- const e = new ne({
479
- // new state
480
- value: this.el.value,
481
- cursorPos: this.cursorPos,
482
- // old state
483
- oldValue: this.displayValue,
484
- oldSelection: this._selection
485
- }), s = this.masked.rawInputValue, i = this.masked.splice(e.startChangePos, e.removed.length, e.inserted, e.removeDirection, {
486
- input: !0,
487
- raw: !0
488
- }).offset, r = s === this.masked.rawInputValue ? e.removeDirection : m.NONE;
489
- let n = this.masked.nearestInputPos(e.startChangePos + i, r);
490
- r !== m.NONE && (n = this.masked.nearestInputPos(n, m.NONE)), this.updateControl(n), delete this._inputEvent;
491
- }
492
- /** Handles view change event and commits model value */
493
- _onChange() {
494
- this.displayValue !== this.el.value && this.updateValue(), this.masked.doCommit(), this.updateControl(), this._saveSelection();
495
- }
496
- /** Handles view drop event, prevents by default */
497
- _onDrop(t) {
498
- t.preventDefault(), t.stopPropagation();
499
- }
500
- /** Restore last selection on focus */
501
- _onFocus(t) {
502
- this.alignCursorFriendly();
503
- }
504
- /** Restore last selection on focus */
505
- _onClick(t) {
506
- this.alignCursorFriendly();
507
- }
508
- _onUndo() {
509
- this._applyHistoryState(this.history.undo());
510
- }
511
- _onRedo() {
512
- this._applyHistoryState(this.history.redo());
513
- }
514
- _applyHistoryState(t) {
515
- t && (this._historyChanging = !0, this.unmaskedValue = t.unmaskedValue, this.el.select(t.selection.start, t.selection.end), this._saveSelection(), this._historyChanging = !1);
516
- }
517
- /** Unbind view events and removes element reference */
518
- destroy() {
519
- this._unbindEvents(), this._listeners.length = 0, delete this.el;
520
- }
521
- }
522
- g.InputMask = oe;
523
- class E {
524
- /** Inserted symbols */
525
- /** Additional offset if any changes occurred before tail */
526
- /** Raw inserted is used by dynamic mask */
527
- /** Can skip chars */
528
- static normalize(t) {
529
- return Array.isArray(t) ? t : [t, new E()];
530
- }
531
- constructor(t) {
532
- Object.assign(this, {
533
- inserted: "",
534
- rawInserted: "",
535
- tailShift: 0,
536
- skip: !1
537
- }, t);
538
- }
539
- /** Aggregate changes */
540
- aggregate(t) {
541
- return this.inserted += t.inserted, this.rawInserted += t.rawInserted, this.tailShift += t.tailShift, this.skip = this.skip || t.skip, this;
542
- }
543
- /** Total offset considering all changes */
544
- get offset() {
545
- return this.tailShift + this.inserted.length;
546
- }
547
- get consumed() {
548
- return !!this.rawInserted || this.skip;
549
- }
550
- equals(t) {
551
- return this.inserted === t.inserted && this.tailShift === t.tailShift && this.rawInserted === t.rawInserted && this.skip === t.skip;
552
- }
553
- }
554
- g.ChangeDetails = E;
555
- class z {
556
- /** Tail value as string */
557
- /** Tail start position */
558
- /** Start position */
559
- constructor(t, e, s) {
560
- t === void 0 && (t = ""), e === void 0 && (e = 0), this.value = t, this.from = e, this.stop = s;
561
- }
562
- toString() {
563
- return this.value;
564
- }
565
- extend(t) {
566
- this.value += String(t);
567
- }
568
- appendTo(t) {
569
- return t.append(this.toString(), {
570
- tail: !0
571
- }).aggregate(t._appendPlaceholder());
572
- }
573
- get state() {
574
- return {
575
- value: this.value,
576
- from: this.from,
577
- stop: this.stop
578
- };
579
- }
580
- set state(t) {
581
- Object.assign(this, t);
582
- }
583
- unshift(t) {
584
- if (!this.value.length || t != null && this.from >= t) return "";
585
- const e = this.value[0];
586
- return this.value = this.value.slice(1), e;
587
- }
588
- shift() {
589
- if (!this.value.length) return "";
590
- const t = this.value[this.value.length - 1];
591
- return this.value = this.value.slice(0, -1), t;
592
- }
593
- }
594
- class P {
595
- /** */
596
- /** */
597
- /** Transforms value before mask processing */
598
- /** Transforms each char before mask processing */
599
- /** Validates if value is acceptable */
600
- /** Does additional processing at the end of editing */
601
- /** Format typed value to string */
602
- /** Parse string to get typed value */
603
- /** Enable characters overwriting */
604
- /** */
605
- /** */
606
- /** */
607
- /** */
608
- constructor(t) {
609
- this._value = "", this._update({
610
- ...P.DEFAULTS,
611
- ...t
612
- }), this._initialized = !0;
613
- }
614
- /** Sets and applies new options */
615
- updateOptions(t) {
616
- this.optionsIsChanged(t) && this.withValueRefresh(this._update.bind(this, t));
617
- }
618
- /** Sets new options */
619
- _update(t) {
620
- Object.assign(this, t);
621
- }
622
- /** Mask state */
623
- get state() {
624
- return {
625
- _value: this.value,
626
- _rawInputValue: this.rawInputValue
627
- };
628
- }
629
- set state(t) {
630
- this._value = t._value;
631
- }
632
- /** Resets value */
633
- reset() {
634
- this._value = "";
635
- }
636
- get value() {
637
- return this._value;
638
- }
639
- set value(t) {
640
- this.resolve(t, {
641
- input: !0
642
- });
643
- }
644
- /** Resolve new value */
645
- resolve(t, e) {
646
- e === void 0 && (e = {
647
- input: !0
648
- }), this.reset(), this.append(t, e, ""), this.doCommit();
649
- }
650
- get unmaskedValue() {
651
- return this.value;
652
- }
653
- set unmaskedValue(t) {
654
- this.resolve(t, {});
655
- }
656
- get typedValue() {
657
- return this.parse ? this.parse(this.value, this) : this.unmaskedValue;
658
- }
659
- set typedValue(t) {
660
- this.format ? this.value = this.format(t, this) : this.unmaskedValue = String(t);
661
- }
662
- /** Value that includes raw user input */
663
- get rawInputValue() {
664
- return this.extractInput(0, this.displayValue.length, {
665
- raw: !0
666
- });
667
- }
668
- set rawInputValue(t) {
669
- this.resolve(t, {
670
- raw: !0
671
- });
672
- }
673
- get displayValue() {
674
- return this.value;
675
- }
676
- get isComplete() {
677
- return !0;
678
- }
679
- get isFilled() {
680
- return this.isComplete;
681
- }
682
- /** Finds nearest input position in direction */
683
- nearestInputPos(t, e) {
684
- return t;
685
- }
686
- totalInputPositions(t, e) {
687
- return t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), Math.min(this.displayValue.length, e - t);
688
- }
689
- /** Extracts value in range considering flags */
690
- extractInput(t, e, s) {
691
- return t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), this.displayValue.slice(t, e);
692
- }
693
- /** Extracts tail in range */
694
- extractTail(t, e) {
695
- return t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), new z(this.extractInput(t, e), t);
696
- }
697
- /** Appends tail */
698
- appendTail(t) {
699
- return G(t) && (t = new z(String(t))), t.appendTo(this);
700
- }
701
- /** Appends char */
702
- _appendCharRaw(t, e) {
703
- return t ? (this._value += t, new E({
704
- inserted: t,
705
- rawInserted: t
706
- })) : new E();
707
- }
708
- /** Appends char */
709
- _appendChar(t, e, s) {
710
- e === void 0 && (e = {});
711
- const i = this.state;
712
- let r;
713
- if ([t, r] = this.doPrepareChar(t, e), t && (r = r.aggregate(this._appendCharRaw(t, e)), !r.rawInserted && this.autofix === "pad")) {
714
- const n = this.state;
715
- this.state = i;
716
- let u = this.pad(e);
717
- const l = this._appendCharRaw(t, e);
718
- u = u.aggregate(l), l.rawInserted || u.equals(r) ? r = u : this.state = n;
719
- }
720
- if (r.inserted) {
721
- let n, u = this.doValidate(e) !== !1;
722
- if (u && s != null) {
723
- const l = this.state;
724
- if (this.overwrite === !0) {
725
- n = s.state;
726
- for (let v = 0; v < r.rawInserted.length; ++v)
727
- s.unshift(this.displayValue.length - r.tailShift);
728
- }
729
- let h = this.appendTail(s);
730
- if (u = h.rawInserted.length === s.toString().length, !(u && h.inserted) && this.overwrite === "shift") {
731
- this.state = l, n = s.state;
732
- for (let v = 0; v < r.rawInserted.length; ++v)
733
- s.shift();
734
- h = this.appendTail(s), u = h.rawInserted.length === s.toString().length;
735
- }
736
- u && h.inserted && (this.state = l);
737
- }
738
- u || (r = new E(), this.state = i, s && n && (s.state = n));
739
- }
740
- return r;
741
- }
742
- /** Appends optional placeholder at the end */
743
- _appendPlaceholder() {
744
- return new E();
745
- }
746
- /** Appends optional eager placeholder at the end */
747
- _appendEager() {
748
- return new E();
749
- }
750
- /** Appends symbols considering flags */
751
- append(t, e, s) {
752
- if (!G(t)) throw new Error("value should be string");
753
- const i = G(s) ? new z(String(s)) : s;
754
- e != null && e.tail && (e._beforeTailState = this.state);
755
- let r;
756
- [t, r] = this.doPrepare(t, e);
757
- for (let n = 0; n < t.length; ++n) {
758
- const u = this._appendChar(t[n], e, i);
759
- if (!u.rawInserted && !this.doSkipInvalid(t[n], e, i)) break;
760
- r.aggregate(u);
761
- }
762
- return (this.eager === !0 || this.eager === "append") && e != null && e.input && t && r.aggregate(this._appendEager()), i != null && (r.tailShift += this.appendTail(i).tailShift), r;
763
- }
764
- remove(t, e) {
765
- return t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), this._value = this.displayValue.slice(0, t) + this.displayValue.slice(e), new E();
766
- }
767
- /** Calls function and reapplies current value */
768
- withValueRefresh(t) {
769
- if (this._refreshing || !this._initialized) return t();
770
- this._refreshing = !0;
771
- const e = this.rawInputValue, s = this.value, i = t();
772
- return this.rawInputValue = e, this.value && this.value !== s && s.indexOf(this.value) === 0 && (this.append(s.slice(this.displayValue.length), {}, ""), this.doCommit()), delete this._refreshing, i;
773
- }
774
- runIsolated(t) {
775
- if (this._isolated || !this._initialized) return t(this);
776
- this._isolated = !0;
777
- const e = this.state, s = t(this);
778
- return this.state = e, delete this._isolated, s;
779
- }
780
- doSkipInvalid(t, e, s) {
781
- return !!this.skipInvalid;
782
- }
783
- /** Prepares string before mask processing */
784
- doPrepare(t, e) {
785
- return e === void 0 && (e = {}), E.normalize(this.prepare ? this.prepare(t, this, e) : t);
786
- }
787
- /** Prepares each char before mask processing */
788
- doPrepareChar(t, e) {
789
- return e === void 0 && (e = {}), E.normalize(this.prepareChar ? this.prepareChar(t, this, e) : t);
790
- }
791
- /** Validates if value is acceptable */
792
- doValidate(t) {
793
- return (!this.validate || this.validate(this.value, this, t)) && (!this.parent || this.parent.doValidate(t));
794
- }
795
- /** Does additional processing at the end of editing */
796
- doCommit() {
797
- this.commit && this.commit(this.value, this);
798
- }
799
- splice(t, e, s, i, r) {
800
- s === void 0 && (s = ""), i === void 0 && (i = m.NONE), r === void 0 && (r = {
801
- input: !0
802
- });
803
- const n = t + e, u = this.extractTail(n), l = this.eager === !0 || this.eager === "remove";
804
- let h;
805
- l && (i = re(i), h = this.extractInput(0, n, {
806
- raw: !0
807
- }));
808
- let v = t;
809
- const k = new E();
810
- if (i !== m.NONE && (v = this.nearestInputPos(t, e > 1 && t !== 0 && !l ? m.NONE : i), k.tailShift = v - t), k.aggregate(this.remove(v)), l && i !== m.NONE && h === this.rawInputValue)
811
- if (i === m.FORCE_LEFT) {
812
- let F;
813
- for (; h === this.rawInputValue && (F = this.displayValue.length); )
814
- k.aggregate(new E({
815
- tailShift: -1
816
- })).aggregate(this.remove(F - 1));
817
- } else i === m.FORCE_RIGHT && u.unshift();
818
- return k.aggregate(this.append(s, r, u));
819
- }
820
- maskEquals(t) {
821
- return this.mask === t;
822
- }
823
- optionsIsChanged(t) {
824
- return !ot(this, t);
825
- }
826
- typedValueEquals(t) {
827
- const e = this.typedValue;
828
- return t === e || P.EMPTY_VALUES.includes(t) && P.EMPTY_VALUES.includes(e) || (this.format ? this.format(t, this) === this.format(this.typedValue, this) : !1);
829
- }
830
- pad(t) {
831
- return new E();
832
- }
833
- }
834
- P.DEFAULTS = {
835
- skipInvalid: !0
836
- };
837
- P.EMPTY_VALUES = [void 0, null, ""];
838
- g.Masked = P;
839
- class J {
840
- /** */
841
- constructor(t, e) {
842
- t === void 0 && (t = []), e === void 0 && (e = 0), this.chunks = t, this.from = e;
843
- }
844
- toString() {
845
- return this.chunks.map(String).join("");
846
- }
847
- extend(t) {
848
- if (!String(t)) return;
849
- t = G(t) ? new z(String(t)) : t;
850
- const e = this.chunks[this.chunks.length - 1], s = e && // if stops are same or tail has no stop
851
- (e.stop === t.stop || t.stop == null) && // if tail chunk goes just after last chunk
852
- t.from === e.from + e.toString().length;
853
- if (t instanceof z)
854
- s ? e.extend(t.toString()) : this.chunks.push(t);
855
- else if (t instanceof J) {
856
- if (t.stop == null) {
857
- let i;
858
- for (; t.chunks.length && t.chunks[0].stop == null; )
859
- i = t.chunks.shift(), i.from += t.from, this.extend(i);
860
- }
861
- t.toString() && (t.stop = t.blockIndex, this.chunks.push(t));
862
- }
863
- }
864
- appendTo(t) {
865
- if (!(t instanceof g.MaskedPattern))
866
- return new z(this.toString()).appendTo(t);
867
- const e = new E();
868
- for (let s = 0; s < this.chunks.length; ++s) {
869
- const i = this.chunks[s], r = t._mapPosToBlock(t.displayValue.length), n = i.stop;
870
- let u;
871
- if (n != null && // if block not found or stop is behind lastBlock
872
- (!r || r.index <= n) && ((i instanceof J || // for continuous block also check if stop is exist
873
- t._stops.indexOf(n) >= 0) && e.aggregate(t._appendPlaceholder(n)), u = i instanceof J && t._blocks[n]), u) {
874
- const l = u.appendTail(i);
875
- e.aggregate(l);
876
- const h = i.toString().slice(l.rawInserted.length);
877
- h && e.aggregate(t.append(h, {
878
- tail: !0
879
- }));
880
- } else
881
- e.aggregate(t.append(i.toString(), {
882
- tail: !0
883
- }));
884
- }
885
- return e;
886
- }
887
- get state() {
888
- return {
889
- chunks: this.chunks.map((t) => t.state),
890
- from: this.from,
891
- stop: this.stop,
892
- blockIndex: this.blockIndex
893
- };
894
- }
895
- set state(t) {
896
- const {
897
- chunks: e,
898
- ...s
899
- } = t;
900
- Object.assign(this, s), this.chunks = e.map((i) => {
901
- const r = "chunks" in i ? new J() : new z();
902
- return r.state = i, r;
903
- });
904
- }
905
- unshift(t) {
906
- if (!this.chunks.length || t != null && this.from >= t) return "";
907
- const e = t != null ? t - this.from : t;
908
- let s = 0;
909
- for (; s < this.chunks.length; ) {
910
- const i = this.chunks[s], r = i.unshift(e);
911
- if (i.toString()) {
912
- if (!r) break;
913
- ++s;
914
- } else
915
- this.chunks.splice(s, 1);
916
- if (r) return r;
917
- }
918
- return "";
919
- }
920
- shift() {
921
- if (!this.chunks.length) return "";
922
- let t = this.chunks.length - 1;
923
- for (; 0 <= t; ) {
924
- const e = this.chunks[t], s = e.shift();
925
- if (e.toString()) {
926
- if (!s) break;
927
- --t;
928
- } else
929
- this.chunks.splice(t, 1);
930
- if (s) return s;
931
- }
932
- return "";
933
- }
934
- }
935
- class le {
936
- constructor(t, e) {
937
- this.masked = t, this._log = [];
938
- const {
939
- offset: s,
940
- index: i
941
- } = t._mapPosToBlock(e) || (e < 0 ? (
942
- // first
943
- {
944
- index: 0,
945
- offset: 0
946
- }
947
- ) : (
948
- // last
949
- {
950
- index: this.masked._blocks.length,
951
- offset: 0
952
- }
953
- ));
954
- this.offset = s, this.index = i, this.ok = !1;
955
- }
956
- get block() {
957
- return this.masked._blocks[this.index];
958
- }
959
- get pos() {
960
- return this.masked._blockStartPos(this.index) + this.offset;
961
- }
962
- get state() {
963
- return {
964
- index: this.index,
965
- offset: this.offset,
966
- ok: this.ok
967
- };
968
- }
969
- set state(t) {
970
- Object.assign(this, t);
971
- }
972
- pushState() {
973
- this._log.push(this.state);
974
- }
975
- popState() {
976
- const t = this._log.pop();
977
- return t && (this.state = t), t;
978
- }
979
- bindBlock() {
980
- this.block || (this.index < 0 && (this.index = 0, this.offset = 0), this.index >= this.masked._blocks.length && (this.index = this.masked._blocks.length - 1, this.offset = this.block.displayValue.length));
981
- }
982
- _pushLeft(t) {
983
- for (this.pushState(), this.bindBlock(); 0 <= this.index; --this.index, this.offset = ((e = this.block) == null ? void 0 : e.displayValue.length) || 0) {
984
- var e;
985
- if (t()) return this.ok = !0;
986
- }
987
- return this.ok = !1;
988
- }
989
- _pushRight(t) {
990
- for (this.pushState(), this.bindBlock(); this.index < this.masked._blocks.length; ++this.index, this.offset = 0)
991
- if (t()) return this.ok = !0;
992
- return this.ok = !1;
993
- }
994
- pushLeftBeforeFilled() {
995
- return this._pushLeft(() => {
996
- if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, m.FORCE_LEFT), this.offset !== 0))
997
- return !0;
998
- });
999
- }
1000
- pushLeftBeforeInput() {
1001
- return this._pushLeft(() => {
1002
- if (!this.block.isFixed)
1003
- return this.offset = this.block.nearestInputPos(this.offset, m.LEFT), !0;
1004
- });
1005
- }
1006
- pushLeftBeforeRequired() {
1007
- return this._pushLeft(() => {
1008
- if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
1009
- return this.offset = this.block.nearestInputPos(this.offset, m.LEFT), !0;
1010
- });
1011
- }
1012
- pushRightBeforeFilled() {
1013
- return this._pushRight(() => {
1014
- if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, m.FORCE_RIGHT), this.offset !== this.block.value.length))
1015
- return !0;
1016
- });
1017
- }
1018
- pushRightBeforeInput() {
1019
- return this._pushRight(() => {
1020
- if (!this.block.isFixed)
1021
- return this.offset = this.block.nearestInputPos(this.offset, m.NONE), !0;
1022
- });
1023
- }
1024
- pushRightBeforeRequired() {
1025
- return this._pushRight(() => {
1026
- if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
1027
- return this.offset = this.block.nearestInputPos(this.offset, m.NONE), !0;
1028
- });
1029
- }
1030
- }
1031
- class Gt {
1032
- /** */
1033
- /** */
1034
- /** */
1035
- /** */
1036
- /** */
1037
- /** */
1038
- constructor(t) {
1039
- Object.assign(this, t), this._value = "", this.isFixed = !0;
1040
- }
1041
- get value() {
1042
- return this._value;
1043
- }
1044
- get unmaskedValue() {
1045
- return this.isUnmasking ? this.value : "";
1046
- }
1047
- get rawInputValue() {
1048
- return this._isRawInput ? this.value : "";
1049
- }
1050
- get displayValue() {
1051
- return this.value;
1052
- }
1053
- reset() {
1054
- this._isRawInput = !1, this._value = "";
1055
- }
1056
- remove(t, e) {
1057
- return t === void 0 && (t = 0), e === void 0 && (e = this._value.length), this._value = this._value.slice(0, t) + this._value.slice(e), this._value || (this._isRawInput = !1), new E();
1058
- }
1059
- nearestInputPos(t, e) {
1060
- e === void 0 && (e = m.NONE);
1061
- const s = 0, i = this._value.length;
1062
- switch (e) {
1063
- case m.LEFT:
1064
- case m.FORCE_LEFT:
1065
- return s;
1066
- case m.NONE:
1067
- case m.RIGHT:
1068
- case m.FORCE_RIGHT:
1069
- default:
1070
- return i;
1071
- }
1072
- }
1073
- totalInputPositions(t, e) {
1074
- return t === void 0 && (t = 0), e === void 0 && (e = this._value.length), this._isRawInput ? e - t : 0;
1075
- }
1076
- extractInput(t, e, s) {
1077
- return t === void 0 && (t = 0), e === void 0 && (e = this._value.length), s === void 0 && (s = {}), s.raw && this._isRawInput && this._value.slice(t, e) || "";
1078
- }
1079
- get isComplete() {
1080
- return !0;
1081
- }
1082
- get isFilled() {
1083
- return !!this._value;
1084
- }
1085
- _appendChar(t, e) {
1086
- if (e === void 0 && (e = {}), this.isFilled) return new E();
1087
- const s = this.eager === !0 || this.eager === "append", r = this.char === t && (this.isUnmasking || e.input || e.raw) && (!e.raw || !s) && !e.tail, n = new E({
1088
- inserted: this.char,
1089
- rawInserted: r ? this.char : ""
1090
- });
1091
- return this._value = this.char, this._isRawInput = r && (e.raw || e.input), n;
1092
- }
1093
- _appendEager() {
1094
- return this._appendChar(this.char, {
1095
- tail: !0
1096
- });
1097
- }
1098
- _appendPlaceholder() {
1099
- const t = new E();
1100
- return this.isFilled || (this._value = t.inserted = this.char), t;
1101
- }
1102
- extractTail() {
1103
- return new z("");
1104
- }
1105
- appendTail(t) {
1106
- return G(t) && (t = new z(String(t))), t.appendTo(this);
1107
- }
1108
- append(t, e, s) {
1109
- const i = this._appendChar(t[0], e);
1110
- return s != null && (i.tailShift += this.appendTail(s).tailShift), i;
1111
- }
1112
- doCommit() {
1113
- }
1114
- get state() {
1115
- return {
1116
- _value: this._value,
1117
- _rawInputValue: this.rawInputValue
1118
- };
1119
- }
1120
- set state(t) {
1121
- this._value = t._value, this._isRawInput = !!t._rawInputValue;
1122
- }
1123
- pad(t) {
1124
- return this._appendPlaceholder();
1125
- }
1126
- }
1127
- class lt {
1128
- /** */
1129
- /** */
1130
- /** */
1131
- /** */
1132
- /** */
1133
- /** */
1134
- /** */
1135
- /** */
1136
- constructor(t) {
1137
- const {
1138
- parent: e,
1139
- isOptional: s,
1140
- placeholderChar: i,
1141
- displayChar: r,
1142
- lazy: n,
1143
- eager: u,
1144
- ...l
1145
- } = t;
1146
- this.masked = K(l), Object.assign(this, {
1147
- parent: e,
1148
- isOptional: s,
1149
- placeholderChar: i,
1150
- displayChar: r,
1151
- lazy: n,
1152
- eager: u
1153
- });
1154
- }
1155
- reset() {
1156
- this.isFilled = !1, this.masked.reset();
1157
- }
1158
- remove(t, e) {
1159
- return t === void 0 && (t = 0), e === void 0 && (e = this.value.length), t === 0 && e >= 1 ? (this.isFilled = !1, this.masked.remove(t, e)) : new E();
1160
- }
1161
- get value() {
1162
- return this.masked.value || (this.isFilled && !this.isOptional ? this.placeholderChar : "");
1163
- }
1164
- get unmaskedValue() {
1165
- return this.masked.unmaskedValue;
1166
- }
1167
- get rawInputValue() {
1168
- return this.masked.rawInputValue;
1169
- }
1170
- get displayValue() {
1171
- return this.masked.value && this.displayChar || this.value;
1172
- }
1173
- get isComplete() {
1174
- return !!this.masked.value || this.isOptional;
1175
- }
1176
- _appendChar(t, e) {
1177
- if (e === void 0 && (e = {}), this.isFilled) return new E();
1178
- const s = this.masked.state;
1179
- let i = this.masked._appendChar(t, this.currentMaskFlags(e));
1180
- return i.inserted && this.doValidate(e) === !1 && (i = new E(), this.masked.state = s), !i.inserted && !this.isOptional && !this.lazy && !e.input && (i.inserted = this.placeholderChar), i.skip = !i.inserted && !this.isOptional, this.isFilled = !!i.inserted, i;
1181
- }
1182
- append(t, e, s) {
1183
- return this.masked.append(t, this.currentMaskFlags(e), s);
1184
- }
1185
- _appendPlaceholder() {
1186
- return this.isFilled || this.isOptional ? new E() : (this.isFilled = !0, new E({
1187
- inserted: this.placeholderChar
1188
- }));
1189
- }
1190
- _appendEager() {
1191
- return new E();
1192
- }
1193
- extractTail(t, e) {
1194
- return this.masked.extractTail(t, e);
1195
- }
1196
- appendTail(t) {
1197
- return this.masked.appendTail(t);
1198
- }
1199
- extractInput(t, e, s) {
1200
- return t === void 0 && (t = 0), e === void 0 && (e = this.value.length), this.masked.extractInput(t, e, s);
1201
- }
1202
- nearestInputPos(t, e) {
1203
- e === void 0 && (e = m.NONE);
1204
- const s = 0, i = this.value.length, r = Math.min(Math.max(t, s), i);
1205
- switch (e) {
1206
- case m.LEFT:
1207
- case m.FORCE_LEFT:
1208
- return this.isComplete ? r : s;
1209
- case m.RIGHT:
1210
- case m.FORCE_RIGHT:
1211
- return this.isComplete ? r : i;
1212
- case m.NONE:
1213
- default:
1214
- return r;
1215
- }
1216
- }
1217
- totalInputPositions(t, e) {
1218
- return t === void 0 && (t = 0), e === void 0 && (e = this.value.length), this.value.slice(t, e).length;
1219
- }
1220
- doValidate(t) {
1221
- return this.masked.doValidate(this.currentMaskFlags(t)) && (!this.parent || this.parent.doValidate(this.currentMaskFlags(t)));
1222
- }
1223
- doCommit() {
1224
- this.masked.doCommit();
1225
- }
1226
- get state() {
1227
- return {
1228
- _value: this.value,
1229
- _rawInputValue: this.rawInputValue,
1230
- masked: this.masked.state,
1231
- isFilled: this.isFilled
1232
- };
1233
- }
1234
- set state(t) {
1235
- this.masked.state = t.masked, this.isFilled = t.isFilled;
1236
- }
1237
- currentMaskFlags(t) {
1238
- var e;
1239
- return {
1240
- ...t,
1241
- _beforeTailState: (t == null || (e = t._beforeTailState) == null ? void 0 : e.masked) || (t == null ? void 0 : t._beforeTailState)
1242
- };
1243
- }
1244
- pad(t) {
1245
- return new E();
1246
- }
1247
- }
1248
- lt.DEFAULT_DEFINITIONS = {
1249
- 0: /\d/,
1250
- a: /[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
1251
- // http://stackoverflow.com/a/22075070
1252
- "*": /./
1253
- };
1254
- class he extends P {
1255
- /** */
1256
- /** Enable characters overwriting */
1257
- /** */
1258
- /** */
1259
- /** */
1260
- updateOptions(t) {
1261
- super.updateOptions(t);
1262
- }
1263
- _update(t) {
1264
- const e = t.mask;
1265
- e && (t.validate = (s) => s.search(e) >= 0), super._update(t);
1266
- }
1267
- }
1268
- g.MaskedRegExp = he;
1269
- class L extends P {
1270
- /** */
1271
- /** */
1272
- /** Single char for empty input */
1273
- /** Single char for filled input */
1274
- /** Show placeholder only when needed */
1275
- /** Enable characters overwriting */
1276
- /** */
1277
- /** */
1278
- /** */
1279
- constructor(t) {
1280
- super({
1281
- ...L.DEFAULTS,
1282
- ...t,
1283
- definitions: Object.assign({}, lt.DEFAULT_DEFINITIONS, t == null ? void 0 : t.definitions)
1284
- });
1285
- }
1286
- updateOptions(t) {
1287
- super.updateOptions(t);
1288
- }
1289
- _update(t) {
1290
- t.definitions = Object.assign({}, this.definitions, t.definitions), super._update(t), this._rebuildMask();
1291
- }
1292
- _rebuildMask() {
1293
- const t = this.definitions;
1294
- this._blocks = [], this.exposeBlock = void 0, this._stops = [], this._maskedBlocks = {};
1295
- const e = this.mask;
1296
- if (!e || !t) return;
1297
- let s = !1, i = !1;
1298
- for (let r = 0; r < e.length; ++r) {
1299
- if (this.blocks) {
1300
- const h = e.slice(r), v = Object.keys(this.blocks).filter((F) => h.indexOf(F) === 0);
1301
- v.sort((F, B) => B.length - F.length);
1302
- const k = v[0];
1303
- if (k) {
1304
- const {
1305
- expose: F,
1306
- repeat: B,
1307
- ...N
1308
- } = et(this.blocks[k]), M = {
1309
- lazy: this.lazy,
1310
- eager: this.eager,
1311
- placeholderChar: this.placeholderChar,
1312
- displayChar: this.displayChar,
1313
- overwrite: this.overwrite,
1314
- autofix: this.autofix,
1315
- ...N,
1316
- repeat: B,
1317
- parent: this
1318
- }, O = B != null ? new g.RepeatBlock(
1319
- M
1320
- /* TODO */
1321
- ) : K(M);
1322
- O && (this._blocks.push(O), F && (this.exposeBlock = O), this._maskedBlocks[k] || (this._maskedBlocks[k] = []), this._maskedBlocks[k].push(this._blocks.length - 1)), r += k.length - 1;
1323
- continue;
1324
- }
1325
- }
1326
- let n = e[r], u = n in t;
1327
- if (n === L.STOP_CHAR) {
1328
- this._stops.push(this._blocks.length);
1329
- continue;
1330
- }
1331
- if (n === "{" || n === "}") {
1332
- s = !s;
1333
- continue;
1334
- }
1335
- if (n === "[" || n === "]") {
1336
- i = !i;
1337
- continue;
1338
- }
1339
- if (n === L.ESCAPE_CHAR) {
1340
- if (++r, n = e[r], !n) break;
1341
- u = !1;
1342
- }
1343
- const l = u ? new lt({
1344
- isOptional: i,
1345
- lazy: this.lazy,
1346
- eager: this.eager,
1347
- placeholderChar: this.placeholderChar,
1348
- displayChar: this.displayChar,
1349
- ...et(t[n]),
1350
- parent: this
1351
- }) : new Gt({
1352
- char: n,
1353
- eager: this.eager,
1354
- isUnmasking: s
1355
- });
1356
- this._blocks.push(l);
1357
- }
1358
- }
1359
- get state() {
1360
- return {
1361
- ...super.state,
1362
- _blocks: this._blocks.map((t) => t.state)
1363
- };
1364
- }
1365
- set state(t) {
1366
- if (!t) {
1367
- this.reset();
1368
- return;
1369
- }
1370
- const {
1371
- _blocks: e,
1372
- ...s
1373
- } = t;
1374
- this._blocks.forEach((i, r) => i.state = e[r]), super.state = s;
1375
- }
1376
- reset() {
1377
- super.reset(), this._blocks.forEach((t) => t.reset());
1378
- }
1379
- get isComplete() {
1380
- return this.exposeBlock ? this.exposeBlock.isComplete : this._blocks.every((t) => t.isComplete);
1381
- }
1382
- get isFilled() {
1383
- return this._blocks.every((t) => t.isFilled);
1384
- }
1385
- get isFixed() {
1386
- return this._blocks.every((t) => t.isFixed);
1387
- }
1388
- get isOptional() {
1389
- return this._blocks.every((t) => t.isOptional);
1390
- }
1391
- doCommit() {
1392
- this._blocks.forEach((t) => t.doCommit()), super.doCommit();
1393
- }
1394
- get unmaskedValue() {
1395
- return this.exposeBlock ? this.exposeBlock.unmaskedValue : this._blocks.reduce((t, e) => t += e.unmaskedValue, "");
1396
- }
1397
- set unmaskedValue(t) {
1398
- if (this.exposeBlock) {
1399
- const e = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
1400
- this.exposeBlock.unmaskedValue = t, this.appendTail(e), this.doCommit();
1401
- } else super.unmaskedValue = t;
1402
- }
1403
- get value() {
1404
- return this.exposeBlock ? this.exposeBlock.value : (
1405
- // TODO return _value when not in change?
1406
- this._blocks.reduce((t, e) => t += e.value, "")
1407
- );
1408
- }
1409
- set value(t) {
1410
- if (this.exposeBlock) {
1411
- const e = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
1412
- this.exposeBlock.value = t, this.appendTail(e), this.doCommit();
1413
- } else super.value = t;
1414
- }
1415
- get typedValue() {
1416
- return this.exposeBlock ? this.exposeBlock.typedValue : super.typedValue;
1417
- }
1418
- set typedValue(t) {
1419
- if (this.exposeBlock) {
1420
- const e = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
1421
- this.exposeBlock.typedValue = t, this.appendTail(e), this.doCommit();
1422
- } else super.typedValue = t;
1423
- }
1424
- get displayValue() {
1425
- return this._blocks.reduce((t, e) => t += e.displayValue, "");
1426
- }
1427
- appendTail(t) {
1428
- return super.appendTail(t).aggregate(this._appendPlaceholder());
1429
- }
1430
- _appendEager() {
1431
- var t;
1432
- const e = new E();
1433
- let s = (t = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : t.index;
1434
- if (s == null) return e;
1435
- this._blocks[s].isFilled && ++s;
1436
- for (let i = s; i < this._blocks.length; ++i) {
1437
- const r = this._blocks[i]._appendEager();
1438
- if (!r.inserted) break;
1439
- e.aggregate(r);
1440
- }
1441
- return e;
1442
- }
1443
- _appendCharRaw(t, e) {
1444
- e === void 0 && (e = {});
1445
- const s = this._mapPosToBlock(this.displayValue.length), i = new E();
1446
- if (!s) return i;
1447
- for (let n = s.index, u; u = this._blocks[n]; ++n) {
1448
- var r;
1449
- const l = u._appendChar(t, {
1450
- ...e,
1451
- _beforeTailState: (r = e._beforeTailState) == null || (r = r._blocks) == null ? void 0 : r[n]
1452
- });
1453
- if (i.aggregate(l), l.consumed) break;
1454
- }
1455
- return i;
1456
- }
1457
- extractTail(t, e) {
1458
- t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length);
1459
- const s = new J();
1460
- return t === e || this._forEachBlocksInRange(t, e, (i, r, n, u) => {
1461
- const l = i.extractTail(n, u);
1462
- l.stop = this._findStopBefore(r), l.from = this._blockStartPos(r), l instanceof J && (l.blockIndex = r), s.extend(l);
1463
- }), s;
1464
- }
1465
- extractInput(t, e, s) {
1466
- if (t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), s === void 0 && (s = {}), t === e) return "";
1467
- let i = "";
1468
- return this._forEachBlocksInRange(t, e, (r, n, u, l) => {
1469
- i += r.extractInput(u, l, s);
1470
- }), i;
1471
- }
1472
- _findStopBefore(t) {
1473
- let e;
1474
- for (let s = 0; s < this._stops.length; ++s) {
1475
- const i = this._stops[s];
1476
- if (i <= t) e = i;
1477
- else break;
1478
- }
1479
- return e;
1480
- }
1481
- /** Appends placeholder depending on laziness */
1482
- _appendPlaceholder(t) {
1483
- const e = new E();
1484
- if (this.lazy && t == null) return e;
1485
- const s = this._mapPosToBlock(this.displayValue.length);
1486
- if (!s) return e;
1487
- const i = s.index, r = t ?? this._blocks.length;
1488
- return this._blocks.slice(i, r).forEach((n) => {
1489
- if (!n.lazy || t != null) {
1490
- var u;
1491
- e.aggregate(n._appendPlaceholder((u = n._blocks) == null ? void 0 : u.length));
1492
- }
1493
- }), e;
1494
- }
1495
- /** Finds block in pos */
1496
- _mapPosToBlock(t) {
1497
- let e = "";
1498
- for (let s = 0; s < this._blocks.length; ++s) {
1499
- const i = this._blocks[s], r = e.length;
1500
- if (e += i.displayValue, t <= e.length)
1501
- return {
1502
- index: s,
1503
- offset: t - r
1504
- };
1505
- }
1506
- }
1507
- _blockStartPos(t) {
1508
- return this._blocks.slice(0, t).reduce((e, s) => e += s.displayValue.length, 0);
1509
- }
1510
- _forEachBlocksInRange(t, e, s) {
1511
- e === void 0 && (e = this.displayValue.length);
1512
- const i = this._mapPosToBlock(t);
1513
- if (i) {
1514
- const r = this._mapPosToBlock(e), n = r && i.index === r.index, u = i.offset, l = r && n ? r.offset : this._blocks[i.index].displayValue.length;
1515
- if (s(this._blocks[i.index], i.index, u, l), r && !n) {
1516
- for (let h = i.index + 1; h < r.index; ++h)
1517
- s(this._blocks[h], h, 0, this._blocks[h].displayValue.length);
1518
- s(this._blocks[r.index], r.index, 0, r.offset);
1519
- }
1520
- }
1521
- }
1522
- remove(t, e) {
1523
- t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length);
1524
- const s = super.remove(t, e);
1525
- return this._forEachBlocksInRange(t, e, (i, r, n, u) => {
1526
- s.aggregate(i.remove(n, u));
1527
- }), s;
1528
- }
1529
- nearestInputPos(t, e) {
1530
- if (e === void 0 && (e = m.NONE), !this._blocks.length) return 0;
1531
- const s = new le(this, t);
1532
- if (e === m.NONE)
1533
- return s.pushRightBeforeInput() || (s.popState(), s.pushLeftBeforeInput()) ? s.pos : this.displayValue.length;
1534
- if (e === m.LEFT || e === m.FORCE_LEFT) {
1535
- if (e === m.LEFT) {
1536
- if (s.pushRightBeforeFilled(), s.ok && s.pos === t) return t;
1537
- s.popState();
1538
- }
1539
- if (s.pushLeftBeforeInput(), s.pushLeftBeforeRequired(), s.pushLeftBeforeFilled(), e === m.LEFT) {
1540
- if (s.pushRightBeforeInput(), s.pushRightBeforeRequired(), s.ok && s.pos <= t || (s.popState(), s.ok && s.pos <= t)) return s.pos;
1541
- s.popState();
1542
- }
1543
- return s.ok ? s.pos : e === m.FORCE_LEFT ? 0 : (s.popState(), s.ok || (s.popState(), s.ok) ? s.pos : 0);
1544
- }
1545
- return e === m.RIGHT || e === m.FORCE_RIGHT ? (s.pushRightBeforeInput(), s.pushRightBeforeRequired(), s.pushRightBeforeFilled() ? s.pos : e === m.FORCE_RIGHT ? this.displayValue.length : (s.popState(), s.ok || (s.popState(), s.ok) ? s.pos : this.nearestInputPos(t, m.LEFT))) : t;
1546
- }
1547
- totalInputPositions(t, e) {
1548
- t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length);
1549
- let s = 0;
1550
- return this._forEachBlocksInRange(t, e, (i, r, n, u) => {
1551
- s += i.totalInputPositions(n, u);
1552
- }), s;
1553
- }
1554
- /** Get block by name */
1555
- maskedBlock(t) {
1556
- return this.maskedBlocks(t)[0];
1557
- }
1558
- /** Get all blocks by name */
1559
- maskedBlocks(t) {
1560
- const e = this._maskedBlocks[t];
1561
- return e ? e.map((s) => this._blocks[s]) : [];
1562
- }
1563
- pad(t) {
1564
- const e = new E();
1565
- return this._forEachBlocksInRange(0, this.displayValue.length, (s) => e.aggregate(s.pad(t))), e;
1566
- }
1567
- }
1568
- L.DEFAULTS = {
1569
- ...P.DEFAULTS,
1570
- lazy: !0,
1571
- placeholderChar: "_"
1572
- };
1573
- L.STOP_CHAR = "`";
1574
- L.ESCAPE_CHAR = "\\";
1575
- L.InputDefinition = lt;
1576
- L.FixedDefinition = Gt;
1577
- g.MaskedPattern = L;
1578
- class ut extends L {
1579
- /**
1580
- Optionally sets max length of pattern.
1581
- Used when pattern length is longer then `to` param length. Pads zeros at start in this case.
1582
- */
1583
- /** Min bound */
1584
- /** Max bound */
1585
- get _matchFrom() {
1586
- return this.maxLength - String(this.from).length;
1587
- }
1588
- constructor(t) {
1589
- super(t);
1590
- }
1591
- updateOptions(t) {
1592
- super.updateOptions(t);
1593
- }
1594
- _update(t) {
1595
- const {
1596
- to: e = this.to || 0,
1597
- from: s = this.from || 0,
1598
- maxLength: i = this.maxLength || 0,
1599
- autofix: r = this.autofix,
1600
- ...n
1601
- } = t;
1602
- this.to = e, this.from = s, this.maxLength = Math.max(String(e).length, i), this.autofix = r;
1603
- const u = String(this.from).padStart(this.maxLength, "0"), l = String(this.to).padStart(this.maxLength, "0");
1604
- let h = 0;
1605
- for (; h < l.length && l[h] === u[h]; ) ++h;
1606
- n.mask = l.slice(0, h).replace(/0/g, "\\0") + "0".repeat(this.maxLength - h), super._update(n);
1607
- }
1608
- get isComplete() {
1609
- return super.isComplete && !!this.value;
1610
- }
1611
- boundaries(t) {
1612
- let e = "", s = "";
1613
- const [, i, r] = t.match(/^(\D*)(\d*)(\D*)/) || [];
1614
- return r && (e = "0".repeat(i.length) + r, s = "9".repeat(i.length) + r), e = e.padEnd(this.maxLength, "0"), s = s.padEnd(this.maxLength, "9"), [e, s];
1615
- }
1616
- doPrepareChar(t, e) {
1617
- e === void 0 && (e = {});
1618
- let s;
1619
- return [t, s] = super.doPrepareChar(t.replace(/\D/g, ""), e), t || (s.skip = !this.isComplete), [t, s];
1620
- }
1621
- _appendCharRaw(t, e) {
1622
- if (e === void 0 && (e = {}), !this.autofix || this.value.length + 1 > this.maxLength) return super._appendCharRaw(t, e);
1623
- const s = String(this.from).padStart(this.maxLength, "0"), i = String(this.to).padStart(this.maxLength, "0"), [r, n] = this.boundaries(this.value + t);
1624
- return Number(n) < this.from ? super._appendCharRaw(s[this.value.length], e) : Number(r) > this.to ? !e.tail && this.autofix === "pad" && this.value.length + 1 < this.maxLength ? super._appendCharRaw(s[this.value.length], e).aggregate(this._appendCharRaw(t, e)) : super._appendCharRaw(i[this.value.length], e) : super._appendCharRaw(t, e);
1625
- }
1626
- doValidate(t) {
1627
- const e = this.value;
1628
- if (e.search(/[^0]/) === -1 && e.length <= this._matchFrom) return !0;
1629
- const [i, r] = this.boundaries(e);
1630
- return this.from <= Number(r) && Number(i) <= this.to && super.doValidate(t);
1631
- }
1632
- pad(t) {
1633
- const e = new E();
1634
- if (this.value.length === this.maxLength) return e;
1635
- const s = this.value, i = this.maxLength - this.value.length;
1636
- if (i) {
1637
- this.reset();
1638
- for (let r = 0; r < i; ++r)
1639
- e.aggregate(super._appendCharRaw("0", t));
1640
- s.split("").forEach((r) => this._appendCharRaw(r));
1641
- }
1642
- return e;
1643
- }
1644
- }
1645
- g.MaskedRange = ut;
1646
- const pe = "d{.}`m{.}`Y";
1647
- class H extends L {
1648
- static extractPatternOptions(t) {
1649
- const {
1650
- mask: e,
1651
- pattern: s,
1652
- ...i
1653
- } = t;
1654
- return {
1655
- ...i,
1656
- mask: G(e) ? e : s
1657
- };
1658
- }
1659
- /** Pattern mask for date according to {@link MaskedDate#format} */
1660
- /** Start date */
1661
- /** End date */
1662
- /** Format typed value to string */
1663
- /** Parse string to get typed value */
1664
- constructor(t) {
1665
- super(H.extractPatternOptions({
1666
- ...H.DEFAULTS,
1667
- ...t
1668
- }));
1669
- }
1670
- updateOptions(t) {
1671
- super.updateOptions(t);
1672
- }
1673
- _update(t) {
1674
- const {
1675
- mask: e,
1676
- pattern: s,
1677
- blocks: i,
1678
- ...r
1679
- } = {
1680
- ...H.DEFAULTS,
1681
- ...t
1682
- }, n = Object.assign({}, H.GET_DEFAULT_BLOCKS());
1683
- t.min && (n.Y.from = t.min.getFullYear()), t.max && (n.Y.to = t.max.getFullYear()), t.min && t.max && n.Y.from === n.Y.to && (n.m.from = t.min.getMonth() + 1, n.m.to = t.max.getMonth() + 1, n.m.from === n.m.to && (n.d.from = t.min.getDate(), n.d.to = t.max.getDate())), Object.assign(n, this.blocks, i), super._update({
1684
- ...r,
1685
- mask: G(e) ? e : s,
1686
- blocks: n
1687
- });
1688
- }
1689
- doValidate(t) {
1690
- const e = this.date;
1691
- return super.doValidate(t) && (!this.isComplete || this.isDateExist(this.value) && e != null && (this.min == null || this.min <= e) && (this.max == null || e <= this.max));
1692
- }
1693
- /** Checks if date is exists */
1694
- isDateExist(t) {
1695
- return this.format(this.parse(t, this), this).indexOf(t) >= 0;
1696
- }
1697
- /** Parsed Date */
1698
- get date() {
1699
- return this.typedValue;
1700
- }
1701
- set date(t) {
1702
- this.typedValue = t;
1703
- }
1704
- get typedValue() {
1705
- return this.isComplete ? super.typedValue : null;
1706
- }
1707
- set typedValue(t) {
1708
- super.typedValue = t;
1709
- }
1710
- maskEquals(t) {
1711
- return t === Date || super.maskEquals(t);
1712
- }
1713
- optionsIsChanged(t) {
1714
- return super.optionsIsChanged(H.extractPatternOptions(t));
1715
- }
1716
- }
1717
- H.GET_DEFAULT_BLOCKS = () => ({
1718
- d: {
1719
- mask: ut,
1720
- from: 1,
1721
- to: 31,
1722
- maxLength: 2
1723
- },
1724
- m: {
1725
- mask: ut,
1726
- from: 1,
1727
- to: 12,
1728
- maxLength: 2
1729
- },
1730
- Y: {
1731
- mask: ut,
1732
- from: 1900,
1733
- to: 9999
1734
- }
1735
- });
1736
- H.DEFAULTS = {
1737
- ...L.DEFAULTS,
1738
- mask: Date,
1739
- pattern: pe,
1740
- format: (a, t) => {
1741
- if (!a) return "";
1742
- const e = String(a.getDate()).padStart(2, "0"), s = String(a.getMonth() + 1).padStart(2, "0"), i = a.getFullYear();
1743
- return [e, s, i].join(".");
1744
- },
1745
- parse: (a, t) => {
1746
- const [e, s, i] = a.split(".").map(Number);
1747
- return new Date(i, s - 1, e);
1748
- }
1749
- };
1750
- g.MaskedDate = H;
1751
- class ct extends P {
1752
- constructor(t) {
1753
- super({
1754
- ...ct.DEFAULTS,
1755
- ...t
1756
- }), this.currentMask = void 0;
1757
- }
1758
- updateOptions(t) {
1759
- super.updateOptions(t);
1760
- }
1761
- _update(t) {
1762
- super._update(t), "mask" in t && (this.exposeMask = void 0, this.compiledMasks = Array.isArray(t.mask) ? t.mask.map((e) => {
1763
- const {
1764
- expose: s,
1765
- ...i
1766
- } = et(e), r = K({
1767
- overwrite: this._overwrite,
1768
- eager: this._eager,
1769
- skipInvalid: this._skipInvalid,
1770
- ...i
1771
- });
1772
- return s && (this.exposeMask = r), r;
1773
- }) : []);
1774
- }
1775
- _appendCharRaw(t, e) {
1776
- e === void 0 && (e = {});
1777
- const s = this._applyDispatch(t, e);
1778
- return this.currentMask && s.aggregate(this.currentMask._appendChar(t, this.currentMaskFlags(e))), s;
1779
- }
1780
- _applyDispatch(t, e, s) {
1781
- t === void 0 && (t = ""), e === void 0 && (e = {}), s === void 0 && (s = "");
1782
- const i = e.tail && e._beforeTailState != null ? e._beforeTailState._value : this.value, r = this.rawInputValue, n = e.tail && e._beforeTailState != null ? e._beforeTailState._rawInputValue : r, u = r.slice(n.length), l = this.currentMask, h = new E(), v = l == null ? void 0 : l.state;
1783
- return this.currentMask = this.doDispatch(t, {
1784
- ...e
1785
- }, s), this.currentMask && (this.currentMask !== l ? (this.currentMask.reset(), n && (this.currentMask.append(n, {
1786
- raw: !0
1787
- }), h.tailShift = this.currentMask.value.length - i.length), u && (h.tailShift += this.currentMask.append(u, {
1788
- raw: !0,
1789
- tail: !0
1790
- }).tailShift)) : v && (this.currentMask.state = v)), h;
1791
- }
1792
- _appendPlaceholder() {
1793
- const t = this._applyDispatch();
1794
- return this.currentMask && t.aggregate(this.currentMask._appendPlaceholder()), t;
1795
- }
1796
- _appendEager() {
1797
- const t = this._applyDispatch();
1798
- return this.currentMask && t.aggregate(this.currentMask._appendEager()), t;
1799
- }
1800
- appendTail(t) {
1801
- const e = new E();
1802
- return t && e.aggregate(this._applyDispatch("", {}, t)), e.aggregate(this.currentMask ? this.currentMask.appendTail(t) : super.appendTail(t));
1803
- }
1804
- currentMaskFlags(t) {
1805
- var e, s;
1806
- return {
1807
- ...t,
1808
- _beforeTailState: ((e = t._beforeTailState) == null ? void 0 : e.currentMaskRef) === this.currentMask && ((s = t._beforeTailState) == null ? void 0 : s.currentMask) || t._beforeTailState
1809
- };
1810
- }
1811
- doDispatch(t, e, s) {
1812
- return e === void 0 && (e = {}), s === void 0 && (s = ""), this.dispatch(t, this, e, s);
1813
- }
1814
- doValidate(t) {
1815
- return super.doValidate(t) && (!this.currentMask || this.currentMask.doValidate(this.currentMaskFlags(t)));
1816
- }
1817
- doPrepare(t, e) {
1818
- e === void 0 && (e = {});
1819
- let [s, i] = super.doPrepare(t, e);
1820
- if (this.currentMask) {
1821
- let r;
1822
- [s, r] = super.doPrepare(s, this.currentMaskFlags(e)), i = i.aggregate(r);
1823
- }
1824
- return [s, i];
1825
- }
1826
- doPrepareChar(t, e) {
1827
- e === void 0 && (e = {});
1828
- let [s, i] = super.doPrepareChar(t, e);
1829
- if (this.currentMask) {
1830
- let r;
1831
- [s, r] = super.doPrepareChar(s, this.currentMaskFlags(e)), i = i.aggregate(r);
1832
- }
1833
- return [s, i];
1834
- }
1835
- reset() {
1836
- var t;
1837
- (t = this.currentMask) == null || t.reset(), this.compiledMasks.forEach((e) => e.reset());
1838
- }
1839
- get value() {
1840
- return this.exposeMask ? this.exposeMask.value : this.currentMask ? this.currentMask.value : "";
1841
- }
1842
- set value(t) {
1843
- this.exposeMask ? (this.exposeMask.value = t, this.currentMask = this.exposeMask, this._applyDispatch()) : super.value = t;
1844
- }
1845
- get unmaskedValue() {
1846
- return this.exposeMask ? this.exposeMask.unmaskedValue : this.currentMask ? this.currentMask.unmaskedValue : "";
1847
- }
1848
- set unmaskedValue(t) {
1849
- this.exposeMask ? (this.exposeMask.unmaskedValue = t, this.currentMask = this.exposeMask, this._applyDispatch()) : super.unmaskedValue = t;
1850
- }
1851
- get typedValue() {
1852
- return this.exposeMask ? this.exposeMask.typedValue : this.currentMask ? this.currentMask.typedValue : "";
1853
- }
1854
- set typedValue(t) {
1855
- if (this.exposeMask) {
1856
- this.exposeMask.typedValue = t, this.currentMask = this.exposeMask, this._applyDispatch();
1857
- return;
1858
- }
1859
- let e = String(t);
1860
- this.currentMask && (this.currentMask.typedValue = t, e = this.currentMask.unmaskedValue), this.unmaskedValue = e;
1861
- }
1862
- get displayValue() {
1863
- return this.currentMask ? this.currentMask.displayValue : "";
1864
- }
1865
- get isComplete() {
1866
- var t;
1867
- return !!((t = this.currentMask) != null && t.isComplete);
1868
- }
1869
- get isFilled() {
1870
- var t;
1871
- return !!((t = this.currentMask) != null && t.isFilled);
1872
- }
1873
- remove(t, e) {
1874
- const s = new E();
1875
- return this.currentMask && s.aggregate(this.currentMask.remove(t, e)).aggregate(this._applyDispatch()), s;
1876
- }
1877
- get state() {
1878
- var t;
1879
- return {
1880
- ...super.state,
1881
- _rawInputValue: this.rawInputValue,
1882
- compiledMasks: this.compiledMasks.map((e) => e.state),
1883
- currentMaskRef: this.currentMask,
1884
- currentMask: (t = this.currentMask) == null ? void 0 : t.state
1885
- };
1886
- }
1887
- set state(t) {
1888
- const {
1889
- compiledMasks: e,
1890
- currentMaskRef: s,
1891
- currentMask: i,
1892
- ...r
1893
- } = t;
1894
- e && this.compiledMasks.forEach((n, u) => n.state = e[u]), s != null && (this.currentMask = s, this.currentMask.state = i), super.state = r;
1895
- }
1896
- extractInput(t, e, s) {
1897
- return this.currentMask ? this.currentMask.extractInput(t, e, s) : "";
1898
- }
1899
- extractTail(t, e) {
1900
- return this.currentMask ? this.currentMask.extractTail(t, e) : super.extractTail(t, e);
1901
- }
1902
- doCommit() {
1903
- this.currentMask && this.currentMask.doCommit(), super.doCommit();
1904
- }
1905
- nearestInputPos(t, e) {
1906
- return this.currentMask ? this.currentMask.nearestInputPos(t, e) : super.nearestInputPos(t, e);
1907
- }
1908
- get overwrite() {
1909
- return this.currentMask ? this.currentMask.overwrite : this._overwrite;
1910
- }
1911
- set overwrite(t) {
1912
- this._overwrite = t;
1913
- }
1914
- get eager() {
1915
- return this.currentMask ? this.currentMask.eager : this._eager;
1916
- }
1917
- set eager(t) {
1918
- this._eager = t;
1919
- }
1920
- get skipInvalid() {
1921
- return this.currentMask ? this.currentMask.skipInvalid : this._skipInvalid;
1922
- }
1923
- set skipInvalid(t) {
1924
- this._skipInvalid = t;
1925
- }
1926
- get autofix() {
1927
- return this.currentMask ? this.currentMask.autofix : this._autofix;
1928
- }
1929
- set autofix(t) {
1930
- this._autofix = t;
1931
- }
1932
- maskEquals(t) {
1933
- return Array.isArray(t) ? this.compiledMasks.every((e, s) => {
1934
- if (!t[s]) return;
1935
- const {
1936
- mask: i,
1937
- ...r
1938
- } = t[s];
1939
- return ot(e, r) && e.maskEquals(i);
1940
- }) : super.maskEquals(t);
1941
- }
1942
- typedValueEquals(t) {
1943
- var e;
1944
- return !!((e = this.currentMask) != null && e.typedValueEquals(t));
1945
- }
1946
- }
1947
- ct.DEFAULTS = {
1948
- ...P.DEFAULTS,
1949
- dispatch: (a, t, e, s) => {
1950
- if (!t.compiledMasks.length) return;
1951
- const i = t.rawInputValue, r = t.compiledMasks.map((n, u) => {
1952
- const l = t.currentMask === n, h = l ? n.displayValue.length : n.nearestInputPos(n.displayValue.length, m.FORCE_LEFT);
1953
- return n.rawInputValue !== i ? (n.reset(), n.append(i, {
1954
- raw: !0
1955
- })) : l || n.remove(h), n.append(a, t.currentMaskFlags(e)), n.appendTail(s), {
1956
- index: u,
1957
- weight: n.rawInputValue.length,
1958
- totalInputPositions: n.totalInputPositions(0, Math.max(h, n.nearestInputPos(n.displayValue.length, m.FORCE_LEFT)))
1959
- };
1960
- });
1961
- return r.sort((n, u) => u.weight - n.weight || u.totalInputPositions - n.totalInputPositions), t.compiledMasks[r[0].index];
1962
- }
1963
- };
1964
- g.MaskedDynamic = ct;
1965
- class dt extends L {
1966
- constructor(t) {
1967
- super({
1968
- ...dt.DEFAULTS,
1969
- ...t
1970
- });
1971
- }
1972
- updateOptions(t) {
1973
- super.updateOptions(t);
1974
- }
1975
- _update(t) {
1976
- const {
1977
- enum: e,
1978
- ...s
1979
- } = t;
1980
- if (e) {
1981
- const i = e.map((u) => u.length), r = Math.min(...i), n = Math.max(...i) - r;
1982
- s.mask = "*".repeat(r), n && (s.mask += "[" + "*".repeat(n) + "]"), this.enum = e;
1983
- }
1984
- super._update(s);
1985
- }
1986
- _appendCharRaw(t, e) {
1987
- e === void 0 && (e = {});
1988
- const s = Math.min(this.nearestInputPos(0, m.FORCE_RIGHT), this.value.length), i = this.enum.filter((r) => this.matchValue(r, this.unmaskedValue + t, s));
1989
- if (i.length) {
1990
- i.length === 1 && this._forEachBlocksInRange(0, this.value.length, (n, u) => {
1991
- const l = i[0][u];
1992
- u >= this.value.length || l === n.value || (n.reset(), n._appendChar(l, e));
1993
- });
1994
- const r = super._appendCharRaw(i[0][this.value.length], e);
1995
- return i.length === 1 && i[0].slice(this.unmaskedValue.length).split("").forEach((n) => r.aggregate(super._appendCharRaw(n))), r;
1996
- }
1997
- return new E({
1998
- skip: !this.isComplete
1999
- });
2000
- }
2001
- extractTail(t, e) {
2002
- return t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), new z("", t);
2003
- }
2004
- remove(t, e) {
2005
- if (t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), t === e) return new E();
2006
- const s = Math.min(super.nearestInputPos(0, m.FORCE_RIGHT), this.value.length);
2007
- let i;
2008
- for (i = t; i >= 0 && !(this.enum.filter((u) => this.matchValue(u, this.value.slice(s, i), s)).length > 1); --i)
2009
- ;
2010
- const r = super.remove(i, e);
2011
- return r.tailShift += i - t, r;
2012
- }
2013
- get isComplete() {
2014
- return this.enum.indexOf(this.value) >= 0;
2015
- }
2016
- }
2017
- dt.DEFAULTS = {
2018
- ...L.DEFAULTS,
2019
- matchValue: (a, t, e) => a.indexOf(t, e) === e
2020
- };
2021
- g.MaskedEnum = dt;
2022
- class ce extends P {
2023
- /** */
2024
- /** Enable characters overwriting */
2025
- /** */
2026
- /** */
2027
- /** */
2028
- updateOptions(t) {
2029
- super.updateOptions(t);
2030
- }
2031
- _update(t) {
2032
- super._update({
2033
- ...t,
2034
- validate: t.mask
2035
- });
2036
- }
2037
- }
2038
- g.MaskedFunction = ce;
2039
- var Wt;
2040
- class U extends P {
2041
- /** Single char */
2042
- /** Single char */
2043
- /** Array of single chars */
2044
- /** */
2045
- /** */
2046
- /** Digits after point */
2047
- /** Flag to remove leading and trailing zeros in the end of editing */
2048
- /** Flag to pad trailing zeros after point in the end of editing */
2049
- /** Enable characters overwriting */
2050
- /** */
2051
- /** */
2052
- /** */
2053
- /** Format typed value to string */
2054
- /** Parse string to get typed value */
2055
- constructor(t) {
2056
- super({
2057
- ...U.DEFAULTS,
2058
- ...t
2059
- });
2060
- }
2061
- updateOptions(t) {
2062
- super.updateOptions(t);
2063
- }
2064
- _update(t) {
2065
- super._update(t), this._updateRegExps();
2066
- }
2067
- _updateRegExps() {
2068
- const t = "^" + (this.allowNegative ? "[+|\\-]?" : ""), e = "\\d*", s = (this.scale ? "(" + Ct(this.radix) + "\\d{0," + this.scale + "})?" : "") + "$";
2069
- this._numberRegExp = new RegExp(t + e + s), this._mapToRadixRegExp = new RegExp("[" + this.mapToRadix.map(Ct).join("") + "]", "g"), this._thousandsSeparatorRegExp = new RegExp(Ct(this.thousandsSeparator), "g");
2070
- }
2071
- _removeThousandsSeparators(t) {
2072
- return t.replace(this._thousandsSeparatorRegExp, "");
2073
- }
2074
- _insertThousandsSeparators(t) {
2075
- const e = t.split(this.radix);
2076
- return e[0] = e[0].replace(/\B(?=(\d{3})+(?!\d))/g, this.thousandsSeparator), e.join(this.radix);
2077
- }
2078
- doPrepareChar(t, e) {
2079
- e === void 0 && (e = {});
2080
- const [s, i] = super.doPrepareChar(this._removeThousandsSeparators(this.scale && this.mapToRadix.length && /*
2081
- radix should be mapped when
2082
- 1) input is done from keyboard = flags.input && flags.raw
2083
- 2) unmasked value is set = !flags.input && !flags.raw
2084
- and should not be mapped when
2085
- 1) value is set = flags.input && !flags.raw
2086
- 2) raw value is set = !flags.input && flags.raw
2087
- */
2088
- (e.input && e.raw || !e.input && !e.raw) ? t.replace(this._mapToRadixRegExp, this.radix) : t), e);
2089
- return t && !s && (i.skip = !0), s && !this.allowPositive && !this.value && s !== "-" && i.aggregate(this._appendChar("-")), [s, i];
2090
- }
2091
- _separatorsCount(t, e) {
2092
- e === void 0 && (e = !1);
2093
- let s = 0;
2094
- for (let i = 0; i < t; ++i)
2095
- this._value.indexOf(this.thousandsSeparator, i) === i && (++s, e && (t += this.thousandsSeparator.length));
2096
- return s;
2097
- }
2098
- _separatorsCountFromSlice(t) {
2099
- return t === void 0 && (t = this._value), this._separatorsCount(this._removeThousandsSeparators(t).length, !0);
2100
- }
2101
- extractInput(t, e, s) {
2102
- return t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), [t, e] = this._adjustRangeWithSeparators(t, e), this._removeThousandsSeparators(super.extractInput(t, e, s));
2103
- }
2104
- _appendCharRaw(t, e) {
2105
- e === void 0 && (e = {});
2106
- const s = e.tail && e._beforeTailState ? e._beforeTailState._value : this._value, i = this._separatorsCountFromSlice(s);
2107
- this._value = this._removeThousandsSeparators(this.value);
2108
- const r = this._value;
2109
- this._value += t;
2110
- const n = this.number;
2111
- let u = !isNaN(n), l = !1;
2112
- if (u) {
2113
- let F;
2114
- this.min != null && this.min < 0 && this.number < this.min && (F = this.min), this.max != null && this.max > 0 && this.number > this.max && (F = this.max), F != null && (this.autofix ? (this._value = this.format(F, this).replace(U.UNMASKED_RADIX, this.radix), l || (l = r === this._value && !e.tail)) : u = !1), u && (u = !!this._value.match(this._numberRegExp));
2115
- }
2116
- let h;
2117
- u ? h = new E({
2118
- inserted: this._value.slice(r.length),
2119
- rawInserted: l ? "" : t,
2120
- skip: l
2121
- }) : (this._value = r, h = new E()), this._value = this._insertThousandsSeparators(this._value);
2122
- const v = e.tail && e._beforeTailState ? e._beforeTailState._value : this._value, k = this._separatorsCountFromSlice(v);
2123
- return h.tailShift += (k - i) * this.thousandsSeparator.length, h;
2124
- }
2125
- _findSeparatorAround(t) {
2126
- if (this.thousandsSeparator) {
2127
- const e = t - this.thousandsSeparator.length + 1, s = this.value.indexOf(this.thousandsSeparator, e);
2128
- if (s <= t) return s;
2129
- }
2130
- return -1;
2131
- }
2132
- _adjustRangeWithSeparators(t, e) {
2133
- const s = this._findSeparatorAround(t);
2134
- s >= 0 && (t = s);
2135
- const i = this._findSeparatorAround(e);
2136
- return i >= 0 && (e = i + this.thousandsSeparator.length), [t, e];
2137
- }
2138
- remove(t, e) {
2139
- t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), [t, e] = this._adjustRangeWithSeparators(t, e);
2140
- const s = this.value.slice(0, t), i = this.value.slice(e), r = this._separatorsCount(s.length);
2141
- this._value = this._insertThousandsSeparators(this._removeThousandsSeparators(s + i));
2142
- const n = this._separatorsCountFromSlice(s);
2143
- return new E({
2144
- tailShift: (n - r) * this.thousandsSeparator.length
2145
- });
2146
- }
2147
- nearestInputPos(t, e) {
2148
- if (!this.thousandsSeparator) return t;
2149
- switch (e) {
2150
- case m.NONE:
2151
- case m.LEFT:
2152
- case m.FORCE_LEFT: {
2153
- const s = this._findSeparatorAround(t - 1);
2154
- if (s >= 0) {
2155
- const i = s + this.thousandsSeparator.length;
2156
- if (t < i || this.value.length <= i || e === m.FORCE_LEFT)
2157
- return s;
2158
- }
2159
- break;
2160
- }
2161
- case m.RIGHT:
2162
- case m.FORCE_RIGHT: {
2163
- const s = this._findSeparatorAround(t);
2164
- if (s >= 0)
2165
- return s + this.thousandsSeparator.length;
2166
- }
2167
- }
2168
- return t;
2169
- }
2170
- doCommit() {
2171
- if (this.value) {
2172
- const t = this.number;
2173
- let e = t;
2174
- this.min != null && (e = Math.max(e, this.min)), this.max != null && (e = Math.min(e, this.max)), e !== t && (this.unmaskedValue = this.format(e, this));
2175
- let s = this.value;
2176
- this.normalizeZeros && (s = this._normalizeZeros(s)), this.padFractionalZeros && this.scale > 0 && (s = this._padFractionalZeros(s)), this._value = s;
2177
- }
2178
- super.doCommit();
2179
- }
2180
- _normalizeZeros(t) {
2181
- const e = this._removeThousandsSeparators(t).split(this.radix);
2182
- return e[0] = e[0].replace(/^(\D*)(0*)(\d*)/, (s, i, r, n) => i + n), t.length && !/\d$/.test(e[0]) && (e[0] = e[0] + "0"), e.length > 1 && (e[1] = e[1].replace(/0*$/, ""), e[1].length || (e.length = 1)), this._insertThousandsSeparators(e.join(this.radix));
2183
- }
2184
- _padFractionalZeros(t) {
2185
- if (!t) return t;
2186
- const e = t.split(this.radix);
2187
- return e.length < 2 && e.push(""), e[1] = e[1].padEnd(this.scale, "0"), e.join(this.radix);
2188
- }
2189
- doSkipInvalid(t, e, s) {
2190
- e === void 0 && (e = {});
2191
- const i = this.scale === 0 && t !== this.thousandsSeparator && (t === this.radix || t === U.UNMASKED_RADIX || this.mapToRadix.includes(t));
2192
- return super.doSkipInvalid(t, e, s) && !i;
2193
- }
2194
- get unmaskedValue() {
2195
- return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix, U.UNMASKED_RADIX);
2196
- }
2197
- set unmaskedValue(t) {
2198
- super.unmaskedValue = t;
2199
- }
2200
- get typedValue() {
2201
- return this.parse(this.unmaskedValue, this);
2202
- }
2203
- set typedValue(t) {
2204
- this.rawInputValue = this.format(t, this).replace(U.UNMASKED_RADIX, this.radix);
2205
- }
2206
- /** Parsed Number */
2207
- get number() {
2208
- return this.typedValue;
2209
- }
2210
- set number(t) {
2211
- this.typedValue = t;
2212
- }
2213
- get allowNegative() {
2214
- return this.min != null && this.min < 0 || this.max != null && this.max < 0;
2215
- }
2216
- get allowPositive() {
2217
- return this.min != null && this.min > 0 || this.max != null && this.max > 0;
2218
- }
2219
- typedValueEquals(t) {
2220
- return (super.typedValueEquals(t) || U.EMPTY_VALUES.includes(t) && U.EMPTY_VALUES.includes(this.typedValue)) && !(t === 0 && this.value === "");
2221
- }
2222
- }
2223
- Wt = U;
2224
- U.UNMASKED_RADIX = ".";
2225
- U.EMPTY_VALUES = [...P.EMPTY_VALUES, 0];
2226
- U.DEFAULTS = {
2227
- ...P.DEFAULTS,
2228
- mask: Number,
2229
- radix: ",",
2230
- thousandsSeparator: "",
2231
- mapToRadix: [Wt.UNMASKED_RADIX],
2232
- min: Number.MIN_SAFE_INTEGER,
2233
- max: Number.MAX_SAFE_INTEGER,
2234
- scale: 2,
2235
- normalizeZeros: !0,
2236
- padFractionalZeros: !1,
2237
- parse: Number,
2238
- format: (a) => a.toLocaleString("en-US", {
2239
- useGrouping: !1,
2240
- maximumFractionDigits: 20
2241
- })
2242
- };
2243
- g.MaskedNumber = U;
2244
- const It = {
2245
- MASKED: "value",
2246
- UNMASKED: "unmaskedValue",
2247
- TYPED: "typedValue"
2248
- };
2249
- function Zt(a, t, e) {
2250
- t === void 0 && (t = It.MASKED), e === void 0 && (e = It.MASKED);
2251
- const s = K(a);
2252
- return (i) => s.runIsolated((r) => (r[t] = i, r[e]));
2253
- }
2254
- function de(a, t, e, s) {
2255
- return Zt(t, e, s)(a);
2256
- }
2257
- g.PIPE_TYPE = It;
2258
- g.createPipe = Zt;
2259
- g.pipe = de;
2260
- class fe extends L {
2261
- get repeatFrom() {
2262
- var t;
2263
- return (t = Array.isArray(this.repeat) ? this.repeat[0] : this.repeat === 1 / 0 ? 0 : this.repeat) != null ? t : 0;
2264
- }
2265
- get repeatTo() {
2266
- var t;
2267
- return (t = Array.isArray(this.repeat) ? this.repeat[1] : this.repeat) != null ? t : 1 / 0;
2268
- }
2269
- constructor(t) {
2270
- super(t);
2271
- }
2272
- updateOptions(t) {
2273
- super.updateOptions(t);
2274
- }
2275
- _update(t) {
2276
- var e, s, i;
2277
- const {
2278
- repeat: r,
2279
- ...n
2280
- } = et(t);
2281
- this._blockOpts = Object.assign({}, this._blockOpts, n);
2282
- const u = K(this._blockOpts);
2283
- this.repeat = (e = (s = r ?? u.repeat) != null ? s : this.repeat) != null ? e : 1 / 0, super._update({
2284
- mask: "m".repeat(Math.max(this.repeatTo === 1 / 0 && ((i = this._blocks) == null ? void 0 : i.length) || 0, this.repeatFrom)),
2285
- blocks: {
2286
- m: u
2287
- },
2288
- eager: u.eager,
2289
- overwrite: u.overwrite,
2290
- skipInvalid: u.skipInvalid,
2291
- lazy: u.lazy,
2292
- placeholderChar: u.placeholderChar,
2293
- displayChar: u.displayChar
2294
- });
2295
- }
2296
- _allocateBlock(t) {
2297
- if (t < this._blocks.length) return this._blocks[t];
2298
- if (this.repeatTo === 1 / 0 || this._blocks.length < this.repeatTo)
2299
- return this._blocks.push(K(this._blockOpts)), this.mask += "m", this._blocks[this._blocks.length - 1];
2300
- }
2301
- _appendCharRaw(t, e) {
2302
- e === void 0 && (e = {});
2303
- const s = new E();
2304
- for (
2305
- let l = (i = (r = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : r.index) != null ? i : Math.max(this._blocks.length - 1, 0), h, v;
2306
- // try to get a block or
2307
- // try to allocate a new block if not allocated already
2308
- h = (n = this._blocks[l]) != null ? n : v = !v && this._allocateBlock(l);
2309
- ++l
2310
- ) {
2311
- var i, r, n, u;
2312
- const k = h._appendChar(t, {
2313
- ...e,
2314
- _beforeTailState: (u = e._beforeTailState) == null || (u = u._blocks) == null ? void 0 : u[l]
2315
- });
2316
- if (k.skip && v) {
2317
- this._blocks.pop(), this.mask = this.mask.slice(1);
2318
- break;
2319
- }
2320
- if (s.aggregate(k), k.consumed) break;
2321
- }
2322
- return s;
2323
- }
2324
- _trimEmptyTail(t, e) {
2325
- var s, i;
2326
- t === void 0 && (t = 0);
2327
- const r = Math.max(((s = this._mapPosToBlock(t)) == null ? void 0 : s.index) || 0, this.repeatFrom, 0);
2328
- let n;
2329
- e != null && (n = (i = this._mapPosToBlock(e)) == null ? void 0 : i.index), n == null && (n = this._blocks.length - 1);
2330
- let u = 0;
2331
- for (let l = n; r <= l && !this._blocks[l].unmaskedValue; --l, ++u)
2332
- ;
2333
- u && (this._blocks.splice(n - u + 1, u), this.mask = this.mask.slice(u));
2334
- }
2335
- reset() {
2336
- super.reset(), this._trimEmptyTail();
2337
- }
2338
- remove(t, e) {
2339
- t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length);
2340
- const s = super.remove(t, e);
2341
- return this._trimEmptyTail(t, e), s;
2342
- }
2343
- totalInputPositions(t, e) {
2344
- return t === void 0 && (t = 0), e == null && this.repeatTo === 1 / 0 ? 1 / 0 : super.totalInputPositions(t, e);
2345
- }
2346
- get state() {
2347
- return super.state;
2348
- }
2349
- set state(t) {
2350
- this._blocks.length = t._blocks.length, this.mask = this.mask.slice(0, this._blocks.length), super.state = t;
2351
- }
2352
- }
2353
- g.RepeatBlock = fe;
2354
- try {
2355
- globalThis.IMask = g;
2356
- } catch {
2357
- }
2358
- function me(a) {
2359
- return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
2360
- }
2361
- var nt = { exports: {} }, at = { exports: {} }, I = {};
2362
- /** @license React v16.13.1
2363
- * react-is.production.min.js
2364
- *
2365
- * Copyright (c) Facebook, Inc. and its affiliates.
2366
- *
2367
- * This source code is licensed under the MIT license found in the
2368
- * LICENSE file in the root directory of this source tree.
2369
- */
2370
- var Dt;
2371
- function ve() {
2372
- if (Dt) return I;
2373
- Dt = 1;
2374
- var a = typeof Symbol == "function" && Symbol.for, t = a ? Symbol.for("react.element") : 60103, e = a ? Symbol.for("react.portal") : 60106, s = a ? Symbol.for("react.fragment") : 60107, i = a ? Symbol.for("react.strict_mode") : 60108, r = a ? Symbol.for("react.profiler") : 60114, n = a ? Symbol.for("react.provider") : 60109, u = a ? Symbol.for("react.context") : 60110, l = a ? Symbol.for("react.async_mode") : 60111, h = a ? Symbol.for("react.concurrent_mode") : 60111, v = a ? Symbol.for("react.forward_ref") : 60112, k = a ? Symbol.for("react.suspense") : 60113, F = a ? Symbol.for("react.suspense_list") : 60120, B = a ? Symbol.for("react.memo") : 60115, N = a ? Symbol.for("react.lazy") : 60116, M = a ? Symbol.for("react.block") : 60121, O = a ? Symbol.for("react.fundamental") : 60117, $ = a ? Symbol.for("react.responder") : 60118, tt = a ? Symbol.for("react.scope") : 60119;
2375
- function V(c) {
2376
- if (typeof c == "object" && c !== null) {
2377
- var W = c.$$typeof;
2378
- switch (W) {
2379
- case t:
2380
- switch (c = c.type, c) {
2381
- case l:
2382
- case h:
2383
- case s:
2384
- case r:
2385
- case i:
2386
- case k:
2387
- return c;
2388
- default:
2389
- switch (c = c && c.$$typeof, c) {
2390
- case u:
2391
- case v:
2392
- case N:
2393
- case B:
2394
- case n:
2395
- return c;
2396
- default:
2397
- return W;
2398
- }
2399
- }
2400
- case e:
2401
- return W;
2402
- }
2403
- }
2404
- }
2405
- function D(c) {
2406
- return V(c) === h;
2407
- }
2408
- return I.AsyncMode = l, I.ConcurrentMode = h, I.ContextConsumer = u, I.ContextProvider = n, I.Element = t, I.ForwardRef = v, I.Fragment = s, I.Lazy = N, I.Memo = B, I.Portal = e, I.Profiler = r, I.StrictMode = i, I.Suspense = k, I.isAsyncMode = function(c) {
2409
- return D(c) || V(c) === l;
2410
- }, I.isConcurrentMode = D, I.isContextConsumer = function(c) {
2411
- return V(c) === u;
2412
- }, I.isContextProvider = function(c) {
2413
- return V(c) === n;
2414
- }, I.isElement = function(c) {
2415
- return typeof c == "object" && c !== null && c.$$typeof === t;
2416
- }, I.isForwardRef = function(c) {
2417
- return V(c) === v;
2418
- }, I.isFragment = function(c) {
2419
- return V(c) === s;
2420
- }, I.isLazy = function(c) {
2421
- return V(c) === N;
2422
- }, I.isMemo = function(c) {
2423
- return V(c) === B;
2424
- }, I.isPortal = function(c) {
2425
- return V(c) === e;
2426
- }, I.isProfiler = function(c) {
2427
- return V(c) === r;
2428
- }, I.isStrictMode = function(c) {
2429
- return V(c) === i;
2430
- }, I.isSuspense = function(c) {
2431
- return V(c) === k;
2432
- }, I.isValidElementType = function(c) {
2433
- return typeof c == "string" || typeof c == "function" || c === s || c === h || c === r || c === i || c === k || c === F || typeof c == "object" && c !== null && (c.$$typeof === N || c.$$typeof === B || c.$$typeof === n || c.$$typeof === u || c.$$typeof === v || c.$$typeof === O || c.$$typeof === $ || c.$$typeof === tt || c.$$typeof === M);
2434
- }, I.typeOf = V, I;
2435
- }
2436
- var R = {};
2437
- /** @license React v16.13.1
2438
- * react-is.development.js
2439
- *
2440
- * Copyright (c) Facebook, Inc. and its affiliates.
2441
- *
2442
- * This source code is licensed under the MIT license found in the
2443
- * LICENSE file in the root directory of this source tree.
2444
- */
2445
- var Vt;
2446
- function ge() {
2447
- return Vt || (Vt = 1, process.env.NODE_ENV !== "production" && function() {
2448
- var a = typeof Symbol == "function" && Symbol.for, t = a ? Symbol.for("react.element") : 60103, e = a ? Symbol.for("react.portal") : 60106, s = a ? Symbol.for("react.fragment") : 60107, i = a ? Symbol.for("react.strict_mode") : 60108, r = a ? Symbol.for("react.profiler") : 60114, n = a ? Symbol.for("react.provider") : 60109, u = a ? Symbol.for("react.context") : 60110, l = a ? Symbol.for("react.async_mode") : 60111, h = a ? Symbol.for("react.concurrent_mode") : 60111, v = a ? Symbol.for("react.forward_ref") : 60112, k = a ? Symbol.for("react.suspense") : 60113, F = a ? Symbol.for("react.suspense_list") : 60120, B = a ? Symbol.for("react.memo") : 60115, N = a ? Symbol.for("react.lazy") : 60116, M = a ? Symbol.for("react.block") : 60121, O = a ? Symbol.for("react.fundamental") : 60117, $ = a ? Symbol.for("react.responder") : 60118, tt = a ? Symbol.for("react.scope") : 60119;
2449
- function V(p) {
2450
- return typeof p == "string" || typeof p == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
2451
- p === s || p === h || p === r || p === i || p === k || p === F || typeof p == "object" && p !== null && (p.$$typeof === N || p.$$typeof === B || p.$$typeof === n || p.$$typeof === u || p.$$typeof === v || p.$$typeof === O || p.$$typeof === $ || p.$$typeof === tt || p.$$typeof === M);
2452
- }
2453
- function D(p) {
2454
- if (typeof p == "object" && p !== null) {
2455
- var Y = p.$$typeof;
2456
- switch (Y) {
2457
- case t:
2458
- var rt = p.type;
2459
- switch (rt) {
2460
- case l:
2461
- case h:
2462
- case s:
2463
- case r:
2464
- case i:
2465
- case k:
2466
- return rt;
2467
- default:
2468
- var Mt = rt && rt.$$typeof;
2469
- switch (Mt) {
2470
- case u:
2471
- case v:
2472
- case N:
2473
- case B:
2474
- case n:
2475
- return Mt;
2476
- default:
2477
- return Y;
2478
- }
2479
- }
2480
- case e:
2481
- return Y;
2482
- }
2483
- }
2484
- }
2485
- var c = l, W = h, ft = u, mt = n, vt = t, gt = v, st = s, kt = N, _t = B, Q = e, Et = r, q = i, Z = k, it = !1;
2486
- function yt(p) {
2487
- return it || (it = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), o(p) || D(p) === l;
2488
- }
2489
- function o(p) {
2490
- return D(p) === h;
2491
- }
2492
- function d(p) {
2493
- return D(p) === u;
2494
- }
2495
- function b(p) {
2496
- return D(p) === n;
2497
- }
2498
- function C(p) {
2499
- return typeof p == "object" && p !== null && p.$$typeof === t;
2500
- }
2501
- function _(p) {
2502
- return D(p) === v;
2503
- }
2504
- function S(p) {
2505
- return D(p) === s;
2506
- }
2507
- function y(p) {
2508
- return D(p) === N;
2509
- }
2510
- function A(p) {
2511
- return D(p) === B;
2512
- }
2513
- function x(p) {
2514
- return D(p) === e;
2515
- }
2516
- function w(p) {
2517
- return D(p) === r;
2518
- }
2519
- function T(p) {
2520
- return D(p) === i;
2521
- }
2522
- function j(p) {
2523
- return D(p) === k;
2524
- }
2525
- R.AsyncMode = c, R.ConcurrentMode = W, R.ContextConsumer = ft, R.ContextProvider = mt, R.Element = vt, R.ForwardRef = gt, R.Fragment = st, R.Lazy = kt, R.Memo = _t, R.Portal = Q, R.Profiler = Et, R.StrictMode = q, R.Suspense = Z, R.isAsyncMode = yt, R.isConcurrentMode = o, R.isContextConsumer = d, R.isContextProvider = b, R.isElement = C, R.isForwardRef = _, R.isFragment = S, R.isLazy = y, R.isMemo = A, R.isPortal = x, R.isProfiler = w, R.isStrictMode = T, R.isSuspense = j, R.isValidElementType = V, R.typeOf = D;
2526
- }()), R;
2527
- }
2528
- var Pt;
2529
- function Xt() {
2530
- return Pt || (Pt = 1, process.env.NODE_ENV === "production" ? at.exports = ve() : at.exports = ge()), at.exports;
2531
- }
2532
- /*
2533
- object-assign
2534
- (c) Sindre Sorhus
2535
- @license MIT
2536
- */
2537
- var At, Lt;
2538
- function ke() {
2539
- if (Lt) return At;
2540
- Lt = 1;
2541
- var a = Object.getOwnPropertySymbols, t = Object.prototype.hasOwnProperty, e = Object.prototype.propertyIsEnumerable;
2542
- function s(r) {
2543
- if (r == null)
2544
- throw new TypeError("Object.assign cannot be called with null or undefined");
2545
- return Object(r);
2546
- }
2547
- function i() {
2548
- try {
2549
- if (!Object.assign)
2550
- return !1;
2551
- var r = new String("abc");
2552
- if (r[5] = "de", Object.getOwnPropertyNames(r)[0] === "5")
2553
- return !1;
2554
- for (var n = {}, u = 0; u < 10; u++)
2555
- n["_" + String.fromCharCode(u)] = u;
2556
- var l = Object.getOwnPropertyNames(n).map(function(v) {
2557
- return n[v];
2558
- });
2559
- if (l.join("") !== "0123456789")
2560
- return !1;
2561
- var h = {};
2562
- return "abcdefghijklmnopqrst".split("").forEach(function(v) {
2563
- h[v] = v;
2564
- }), Object.keys(Object.assign({}, h)).join("") === "abcdefghijklmnopqrst";
2565
- } catch {
2566
- return !1;
2567
- }
2568
- }
2569
- return At = i() ? Object.assign : function(r, n) {
2570
- for (var u, l = s(r), h, v = 1; v < arguments.length; v++) {
2571
- u = Object(arguments[v]);
2572
- for (var k in u)
2573
- t.call(u, k) && (l[k] = u[k]);
2574
- if (a) {
2575
- h = a(u);
2576
- for (var F = 0; F < h.length; F++)
2577
- e.call(u, h[F]) && (l[h[F]] = u[h[F]]);
2578
- }
2579
- }
2580
- return l;
2581
- }, At;
2582
- }
2583
- var bt, Nt;
2584
- function wt() {
2585
- if (Nt) return bt;
2586
- Nt = 1;
2587
- var a = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
2588
- return bt = a, bt;
2589
- }
2590
- var Ft, jt;
2591
- function Jt() {
2592
- return jt || (jt = 1, Ft = Function.call.bind(Object.prototype.hasOwnProperty)), Ft;
2593
- }
2594
- var St, Ut;
2595
- function _e() {
2596
- if (Ut) return St;
2597
- Ut = 1;
2598
- var a = function() {
2599
- };
2600
- if (process.env.NODE_ENV !== "production") {
2601
- var t = /* @__PURE__ */ wt(), e = {}, s = /* @__PURE__ */ Jt();
2602
- a = function(r) {
2603
- var n = "Warning: " + r;
2604
- typeof console < "u" && console.error(n);
2605
- try {
2606
- throw new Error(n);
2607
- } catch {
2608
- }
2609
- };
2610
- }
2611
- function i(r, n, u, l, h) {
2612
- if (process.env.NODE_ENV !== "production") {
2613
- for (var v in r)
2614
- if (s(r, v)) {
2615
- var k;
2616
- try {
2617
- if (typeof r[v] != "function") {
2618
- var F = Error(
2619
- (l || "React class") + ": " + u + " type `" + v + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof r[v] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
2620
- );
2621
- throw F.name = "Invariant Violation", F;
2622
- }
2623
- k = r[v](n, v, l, u, null, t);
2624
- } catch (N) {
2625
- k = N;
2626
- }
2627
- if (k && !(k instanceof Error) && a(
2628
- (l || "React class") + ": type specification of " + u + " `" + v + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof k + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
2629
- ), k instanceof Error && !(k.message in e)) {
2630
- e[k.message] = !0;
2631
- var B = h ? h() : "";
2632
- a(
2633
- "Failed " + u + " type: " + k.message + (B ?? "")
2634
- );
2635
- }
2636
- }
2637
- }
2638
- }
2639
- return i.resetWarningCache = function() {
2640
- process.env.NODE_ENV !== "production" && (e = {});
2641
- }, St = i, St;
2642
- }
2643
- var xt, $t;
2644
- function Ee() {
2645
- if ($t) return xt;
2646
- $t = 1;
2647
- var a = Xt(), t = ke(), e = /* @__PURE__ */ wt(), s = /* @__PURE__ */ Jt(), i = /* @__PURE__ */ _e(), r = function() {
2648
- };
2649
- process.env.NODE_ENV !== "production" && (r = function(u) {
2650
- var l = "Warning: " + u;
2651
- typeof console < "u" && console.error(l);
2652
- try {
2653
- throw new Error(l);
2654
- } catch {
2655
- }
2656
- });
2657
- function n() {
2658
- return null;
2659
- }
2660
- return xt = function(u, l) {
2661
- var h = typeof Symbol == "function" && Symbol.iterator, v = "@@iterator";
2662
- function k(o) {
2663
- var d = o && (h && o[h] || o[v]);
2664
- if (typeof d == "function")
2665
- return d;
2666
- }
2667
- var F = "<<anonymous>>", B = {
2668
- array: $("array"),
2669
- bigint: $("bigint"),
2670
- bool: $("boolean"),
2671
- func: $("function"),
2672
- number: $("number"),
2673
- object: $("object"),
2674
- string: $("string"),
2675
- symbol: $("symbol"),
2676
- any: tt(),
2677
- arrayOf: V,
2678
- element: D(),
2679
- elementType: c(),
2680
- instanceOf: W,
2681
- node: gt(),
2682
- objectOf: mt,
2683
- oneOf: ft,
2684
- oneOfType: vt,
2685
- shape: kt,
2686
- exact: _t
2687
- };
2688
- function N(o, d) {
2689
- return o === d ? o !== 0 || 1 / o === 1 / d : o !== o && d !== d;
2690
- }
2691
- function M(o, d) {
2692
- this.message = o, this.data = d && typeof d == "object" ? d : {}, this.stack = "";
2693
- }
2694
- M.prototype = Error.prototype;
2695
- function O(o) {
2696
- if (process.env.NODE_ENV !== "production")
2697
- var d = {}, b = 0;
2698
- function C(S, y, A, x, w, T, j) {
2699
- if (x = x || F, T = T || A, j !== e) {
2700
- if (l) {
2701
- var p = new Error(
2702
- "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
2703
- );
2704
- throw p.name = "Invariant Violation", p;
2705
- } else if (process.env.NODE_ENV !== "production" && typeof console < "u") {
2706
- var Y = x + ":" + A;
2707
- !d[Y] && // Avoid spamming the console because they are often not actionable except for lib authors
2708
- b < 3 && (r(
2709
- "You are manually calling a React.PropTypes validation function for the `" + T + "` prop on `" + x + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
2710
- ), d[Y] = !0, b++);
2711
- }
2712
- }
2713
- return y[A] == null ? S ? y[A] === null ? new M("The " + w + " `" + T + "` is marked as required " + ("in `" + x + "`, but its value is `null`.")) : new M("The " + w + " `" + T + "` is marked as required in " + ("`" + x + "`, but its value is `undefined`.")) : null : o(y, A, x, w, T);
2714
- }
2715
- var _ = C.bind(null, !1);
2716
- return _.isRequired = C.bind(null, !0), _;
2717
- }
2718
- function $(o) {
2719
- function d(b, C, _, S, y, A) {
2720
- var x = b[C], w = q(x);
2721
- if (w !== o) {
2722
- var T = Z(x);
2723
- return new M(
2724
- "Invalid " + S + " `" + y + "` of type " + ("`" + T + "` supplied to `" + _ + "`, expected ") + ("`" + o + "`."),
2725
- { expectedType: o }
2726
- );
2727
- }
2728
- return null;
2729
- }
2730
- return O(d);
2731
- }
2732
- function tt() {
2733
- return O(n);
2734
- }
2735
- function V(o) {
2736
- function d(b, C, _, S, y) {
2737
- if (typeof o != "function")
2738
- return new M("Property `" + y + "` of component `" + _ + "` has invalid PropType notation inside arrayOf.");
2739
- var A = b[C];
2740
- if (!Array.isArray(A)) {
2741
- var x = q(A);
2742
- return new M("Invalid " + S + " `" + y + "` of type " + ("`" + x + "` supplied to `" + _ + "`, expected an array."));
2743
- }
2744
- for (var w = 0; w < A.length; w++) {
2745
- var T = o(A, w, _, S, y + "[" + w + "]", e);
2746
- if (T instanceof Error)
2747
- return T;
2748
- }
2749
- return null;
2750
- }
2751
- return O(d);
2752
- }
2753
- function D() {
2754
- function o(d, b, C, _, S) {
2755
- var y = d[b];
2756
- if (!u(y)) {
2757
- var A = q(y);
2758
- return new M("Invalid " + _ + " `" + S + "` of type " + ("`" + A + "` supplied to `" + C + "`, expected a single ReactElement."));
2759
- }
2760
- return null;
2761
- }
2762
- return O(o);
2763
- }
2764
- function c() {
2765
- function o(d, b, C, _, S) {
2766
- var y = d[b];
2767
- if (!a.isValidElementType(y)) {
2768
- var A = q(y);
2769
- return new M("Invalid " + _ + " `" + S + "` of type " + ("`" + A + "` supplied to `" + C + "`, expected a single ReactElement type."));
2770
- }
2771
- return null;
2772
- }
2773
- return O(o);
2774
- }
2775
- function W(o) {
2776
- function d(b, C, _, S, y) {
2777
- if (!(b[C] instanceof o)) {
2778
- var A = o.name || F, x = yt(b[C]);
2779
- return new M("Invalid " + S + " `" + y + "` of type " + ("`" + x + "` supplied to `" + _ + "`, expected ") + ("instance of `" + A + "`."));
2780
- }
2781
- return null;
2782
- }
2783
- return O(d);
2784
- }
2785
- function ft(o) {
2786
- if (!Array.isArray(o))
2787
- return process.env.NODE_ENV !== "production" && (arguments.length > 1 ? r(
2788
- "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
2789
- ) : r("Invalid argument supplied to oneOf, expected an array.")), n;
2790
- function d(b, C, _, S, y) {
2791
- for (var A = b[C], x = 0; x < o.length; x++)
2792
- if (N(A, o[x]))
2793
- return null;
2794
- var w = JSON.stringify(o, function(j, p) {
2795
- var Y = Z(p);
2796
- return Y === "symbol" ? String(p) : p;
2797
- });
2798
- return new M("Invalid " + S + " `" + y + "` of value `" + String(A) + "` " + ("supplied to `" + _ + "`, expected one of " + w + "."));
2799
- }
2800
- return O(d);
2801
- }
2802
- function mt(o) {
2803
- function d(b, C, _, S, y) {
2804
- if (typeof o != "function")
2805
- return new M("Property `" + y + "` of component `" + _ + "` has invalid PropType notation inside objectOf.");
2806
- var A = b[C], x = q(A);
2807
- if (x !== "object")
2808
- return new M("Invalid " + S + " `" + y + "` of type " + ("`" + x + "` supplied to `" + _ + "`, expected an object."));
2809
- for (var w in A)
2810
- if (s(A, w)) {
2811
- var T = o(A, w, _, S, y + "." + w, e);
2812
- if (T instanceof Error)
2813
- return T;
2814
- }
2815
- return null;
2816
- }
2817
- return O(d);
2818
- }
2819
- function vt(o) {
2820
- if (!Array.isArray(o))
2821
- return process.env.NODE_ENV !== "production" && r("Invalid argument supplied to oneOfType, expected an instance of array."), n;
2822
- for (var d = 0; d < o.length; d++) {
2823
- var b = o[d];
2824
- if (typeof b != "function")
2825
- return r(
2826
- "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + it(b) + " at index " + d + "."
2827
- ), n;
2828
- }
2829
- function C(_, S, y, A, x) {
2830
- for (var w = [], T = 0; T < o.length; T++) {
2831
- var j = o[T], p = j(_, S, y, A, x, e);
2832
- if (p == null)
2833
- return null;
2834
- p.data && s(p.data, "expectedType") && w.push(p.data.expectedType);
2835
- }
2836
- var Y = w.length > 0 ? ", expected one of type [" + w.join(", ") + "]" : "";
2837
- return new M("Invalid " + A + " `" + x + "` supplied to " + ("`" + y + "`" + Y + "."));
2838
- }
2839
- return O(C);
2840
- }
2841
- function gt() {
2842
- function o(d, b, C, _, S) {
2843
- return Q(d[b]) ? null : new M("Invalid " + _ + " `" + S + "` supplied to " + ("`" + C + "`, expected a ReactNode."));
2844
- }
2845
- return O(o);
2846
- }
2847
- function st(o, d, b, C, _) {
2848
- return new M(
2849
- (o || "React class") + ": " + d + " type `" + b + "." + C + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + _ + "`."
2850
- );
2851
- }
2852
- function kt(o) {
2853
- function d(b, C, _, S, y) {
2854
- var A = b[C], x = q(A);
2855
- if (x !== "object")
2856
- return new M("Invalid " + S + " `" + y + "` of type `" + x + "` " + ("supplied to `" + _ + "`, expected `object`."));
2857
- for (var w in o) {
2858
- var T = o[w];
2859
- if (typeof T != "function")
2860
- return st(_, S, y, w, Z(T));
2861
- var j = T(A, w, _, S, y + "." + w, e);
2862
- if (j)
2863
- return j;
2864
- }
2865
- return null;
2866
- }
2867
- return O(d);
2868
- }
2869
- function _t(o) {
2870
- function d(b, C, _, S, y) {
2871
- var A = b[C], x = q(A);
2872
- if (x !== "object")
2873
- return new M("Invalid " + S + " `" + y + "` of type `" + x + "` " + ("supplied to `" + _ + "`, expected `object`."));
2874
- var w = t({}, b[C], o);
2875
- for (var T in w) {
2876
- var j = o[T];
2877
- if (s(o, T) && typeof j != "function")
2878
- return st(_, S, y, T, Z(j));
2879
- if (!j)
2880
- return new M(
2881
- "Invalid " + S + " `" + y + "` key `" + T + "` supplied to `" + _ + "`.\nBad object: " + JSON.stringify(b[C], null, " ") + `
2882
- Valid keys: ` + JSON.stringify(Object.keys(o), null, " ")
2883
- );
2884
- var p = j(A, T, _, S, y + "." + T, e);
2885
- if (p)
2886
- return p;
2887
- }
2888
- return null;
2889
- }
2890
- return O(d);
2891
- }
2892
- function Q(o) {
2893
- switch (typeof o) {
2894
- case "number":
2895
- case "string":
2896
- case "undefined":
2897
- return !0;
2898
- case "boolean":
2899
- return !o;
2900
- case "object":
2901
- if (Array.isArray(o))
2902
- return o.every(Q);
2903
- if (o === null || u(o))
2904
- return !0;
2905
- var d = k(o);
2906
- if (d) {
2907
- var b = d.call(o), C;
2908
- if (d !== o.entries) {
2909
- for (; !(C = b.next()).done; )
2910
- if (!Q(C.value))
2911
- return !1;
2912
- } else
2913
- for (; !(C = b.next()).done; ) {
2914
- var _ = C.value;
2915
- if (_ && !Q(_[1]))
2916
- return !1;
2917
- }
2918
- } else
2919
- return !1;
2920
- return !0;
2921
- default:
2922
- return !1;
2923
- }
2924
- }
2925
- function Et(o, d) {
2926
- return o === "symbol" ? !0 : d ? d["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && d instanceof Symbol : !1;
2927
- }
2928
- function q(o) {
2929
- var d = typeof o;
2930
- return Array.isArray(o) ? "array" : o instanceof RegExp ? "object" : Et(d, o) ? "symbol" : d;
2931
- }
2932
- function Z(o) {
2933
- if (typeof o > "u" || o === null)
2934
- return "" + o;
2935
- var d = q(o);
2936
- if (d === "object") {
2937
- if (o instanceof Date)
2938
- return "date";
2939
- if (o instanceof RegExp)
2940
- return "regexp";
2941
- }
2942
- return d;
2943
- }
2944
- function it(o) {
2945
- var d = Z(o);
2946
- switch (d) {
2947
- case "array":
2948
- case "object":
2949
- return "an " + d;
2950
- case "boolean":
2951
- case "date":
2952
- case "regexp":
2953
- return "a " + d;
2954
- default:
2955
- return d;
2956
- }
2957
- }
2958
- function yt(o) {
2959
- return !o.constructor || !o.constructor.name ? F : o.constructor.name;
2960
- }
2961
- return B.checkPropTypes = i, B.resetWarningCache = i.resetWarningCache, B.PropTypes = B, B;
2962
- }, xt;
2963
- }
2964
- var Tt, qt;
2965
- function ye() {
2966
- if (qt) return Tt;
2967
- qt = 1;
2968
- var a = /* @__PURE__ */ wt();
2969
- function t() {
2970
- }
2971
- function e() {
2972
- }
2973
- return e.resetWarningCache = t, Tt = function() {
2974
- function s(n, u, l, h, v, k) {
2975
- if (k !== a) {
2976
- var F = new Error(
2977
- "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
2978
- );
2979
- throw F.name = "Invariant Violation", F;
2980
- }
2981
- }
2982
- s.isRequired = s;
2983
- function i() {
2984
- return s;
2985
- }
2986
- var r = {
2987
- array: s,
2988
- bigint: s,
2989
- bool: s,
2990
- func: s,
2991
- number: s,
2992
- object: s,
2993
- string: s,
2994
- symbol: s,
2995
- any: s,
2996
- arrayOf: i,
2997
- element: s,
2998
- elementType: s,
2999
- instanceOf: i,
3000
- node: s,
3001
- objectOf: i,
3002
- oneOf: i,
3003
- oneOfType: i,
3004
- shape: i,
3005
- exact: i,
3006
- checkPropTypes: e,
3007
- resetWarningCache: t
3008
- };
3009
- return r.PropTypes = r, r;
3010
- }, Tt;
3011
- }
3012
- var Yt;
3013
- function Ce() {
3014
- if (Yt) return nt.exports;
3015
- if (Yt = 1, process.env.NODE_ENV !== "production") {
3016
- var a = Xt(), t = !0;
3017
- nt.exports = /* @__PURE__ */ Ee()(a.isElement, t);
3018
- } else
3019
- nt.exports = /* @__PURE__ */ ye()();
3020
- return nt.exports;
3021
- }
3022
- var Ae = /* @__PURE__ */ Ce();
3023
- const f = /* @__PURE__ */ me(Ae), Qt = {
3024
- // common
3025
- mask: f.oneOfType([f.array, f.func, f.string, f.instanceOf(RegExp), f.oneOf([Date, Number, g.Masked]), f.instanceOf(g.Masked)]),
3026
- value: f.any,
3027
- unmask: f.oneOfType([f.bool, f.oneOf(["typed"])]),
3028
- prepare: f.func,
3029
- prepareChar: f.func,
3030
- validate: f.func,
3031
- commit: f.func,
3032
- overwrite: f.oneOfType([f.bool, f.oneOf(["shift"])]),
3033
- eager: f.oneOfType([f.bool, f.oneOf(["append", "remove"])]),
3034
- skipInvalid: f.bool,
3035
- // events
3036
- onAccept: f.func,
3037
- onComplete: f.func,
3038
- // pattern
3039
- placeholderChar: f.string,
3040
- displayChar: f.string,
3041
- lazy: f.bool,
3042
- definitions: f.object,
3043
- blocks: f.object,
3044
- // enum
3045
- enum: f.arrayOf(f.string),
3046
- // range
3047
- maxLength: f.number,
3048
- from: f.number,
3049
- to: f.number,
3050
- // date
3051
- pattern: f.string,
3052
- format: f.func,
3053
- parse: f.func,
3054
- autofix: f.oneOfType([f.bool, f.oneOf(["pad"])]),
3055
- // number
3056
- radix: f.string,
3057
- thousandsSeparator: f.string,
3058
- mapToRadix: f.arrayOf(f.string),
3059
- scale: f.number,
3060
- normalizeZeros: f.bool,
3061
- padFractionalZeros: f.bool,
3062
- min: f.oneOfType([f.number, f.instanceOf(Date)]),
3063
- max: f.oneOfType([f.number, f.instanceOf(Date)]),
3064
- // dynamic
3065
- dispatch: f.func,
3066
- // ref
3067
- inputRef: f.oneOfType([f.func, f.shape({
3068
- current: f.object
3069
- })])
3070
- }, te = Object.keys(Qt).filter((a) => a !== "value"), be = ["value", "unmask", "onAccept", "onComplete", "inputRef"], Fe = te.filter((a) => be.indexOf(a) < 0);
3071
- function Se(a) {
3072
- var t;
3073
- const e = (t = class extends X.Component {
3074
- constructor(r) {
3075
- super(r), this._inputRef = this._inputRef.bind(this);
3076
- }
3077
- componentDidMount() {
3078
- this.props.mask && this.initMask();
3079
- }
3080
- componentDidUpdate() {
3081
- const r = this.props, n = this._extractMaskOptionsFromProps(r);
3082
- if (n.mask)
3083
- this.maskRef ? (this.maskRef.updateOptions(n), "value" in r && r.value !== void 0 && (this.maskValue = r.value)) : this.initMask(n);
3084
- else if (this.destroyMask(), "value" in r && r.value !== void 0) {
3085
- var u;
3086
- (u = this.element) != null && u.isContentEditable && this.element.tagName !== "INPUT" && this.element.tagName !== "TEXTAREA" ? this.element.textContent = r.value : this.element.value = r.value;
3087
- }
3088
- }
3089
- componentWillUnmount() {
3090
- this.destroyMask();
3091
- }
3092
- _inputRef(r) {
3093
- this.element = r, this.props.inputRef && (Object.prototype.hasOwnProperty.call(this.props.inputRef, "current") ? this.props.inputRef.current = r : this.props.inputRef(r));
3094
- }
3095
- initMask(r) {
3096
- r === void 0 && (r = this._extractMaskOptionsFromProps(this.props)), this.maskRef = g(this.element, r).on("accept", this._onAccept.bind(this)).on("complete", this._onComplete.bind(this)), "value" in this.props && this.props.value !== void 0 && (this.maskValue = this.props.value);
3097
- }
3098
- destroyMask() {
3099
- this.maskRef && (this.maskRef.destroy(), delete this.maskRef);
3100
- }
3101
- _extractMaskOptionsFromProps(r) {
3102
- const {
3103
- ...n
3104
- } = r;
3105
- return Object.keys(n).filter((u) => Fe.indexOf(u) < 0).forEach((u) => {
3106
- delete n[u];
3107
- }), n;
3108
- }
3109
- _extractNonMaskProps(r) {
3110
- const {
3111
- ...n
3112
- } = r;
3113
- return te.forEach((u) => {
3114
- u !== "maxLength" && delete n[u];
3115
- }), "defaultValue" in n || (n.defaultValue = r.mask ? "" : n.value), delete n.value, n;
3116
- }
3117
- get maskValue() {
3118
- return this.maskRef ? this.props.unmask === "typed" ? this.maskRef.typedValue : this.props.unmask ? this.maskRef.unmaskedValue : this.maskRef.value : "";
3119
- }
3120
- set maskValue(r) {
3121
- this.maskRef && (r = r == null && this.props.unmask !== "typed" ? "" : r, this.props.unmask === "typed" ? this.maskRef.typedValue = r : this.props.unmask ? this.maskRef.unmaskedValue = r : this.maskRef.value = r);
3122
- }
3123
- _onAccept(r) {
3124
- this.props.onAccept && this.maskRef && this.props.onAccept(this.maskValue, this.maskRef, r);
3125
- }
3126
- _onComplete(r) {
3127
- this.props.onComplete && this.maskRef && this.props.onComplete(this.maskValue, this.maskRef, r);
3128
- }
3129
- render() {
3130
- return X.createElement(a, {
3131
- ...this._extractNonMaskProps(this.props),
3132
- inputRef: this._inputRef
3133
- });
3134
- }
3135
- }, t.displayName = void 0, t.propTypes = void 0, t), s = a.displayName || a.name || "Component";
3136
- return e.displayName = "IMask(" + s + ")", e.propTypes = Qt, X.forwardRef((i, r) => X.createElement(e, {
3137
- ...i,
3138
- ref: r
3139
- }));
3140
- }
3141
- const xe = Se((a) => {
3142
- let {
3143
- inputRef: t,
3144
- ...e
3145
- } = a;
3146
- return X.createElement("input", {
3147
- ...e,
3148
- ref: t
3149
- });
3150
- }), Te = (a, t) => X.createElement(xe, {
3151
- ...a,
3152
- ref: t
3153
- }), Ie = X.forwardRef(Te), Oe = se((a, t) => /* @__PURE__ */ ee(
3154
- ie,
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { IMaskInput as m } from "react-imask";
3
+ import { Input as p } from "../Input.js";
4
+ import { forwardRef as n } from "react";
5
+ const u = n((o, r) => /* @__PURE__ */ t(
6
+ p,
3155
7
  {
3156
- ref: t,
3157
- component: Ie,
3158
- ...a
8
+ ref: r,
9
+ component: m,
10
+ ...o
3159
11
  }
3160
12
  ));
3161
13
  export {
3162
- Oe as MaskedInput
14
+ u as MaskedInput
3163
15
  };