@opengis/cms 0.0.24 → 0.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/index-W-qQIppj-DRzFSjU1.js +2452 -0
  2. package/dist/index.html +28 -34
  3. package/dist/index.js +13915 -0
  4. package/dist/index.umd.cjs +153 -0
  5. package/package.json +4 -3
  6. package/dist/assets/AddUser-CX-McfRW.js +0 -1
  7. package/dist/assets/ApiKeys-DSv1exYv.js +0 -16
  8. package/dist/assets/Appearance-DDtOUvCV.js +0 -6
  9. package/dist/assets/ArticlesPage-D6B3cZsl.js +0 -6
  10. package/dist/assets/BuilderPage-CCeSMVWe.js +0 -1
  11. package/dist/assets/CollectionsBreadcrumb.vue_vue_type_script_setup_true_lang-DVYVfYF4.js +0 -1
  12. package/dist/assets/CollectionsPage-CHk8Cn5k.js +0 -1
  13. package/dist/assets/Dashboard-Bs7sXO6h.js +0 -11
  14. package/dist/assets/EditCollectionPage-gPuLJrN8.js +0 -41
  15. package/dist/assets/EmailPage-DhlWsPxk.js +0 -1
  16. package/dist/assets/EmptyData-Ct-xQv_N.js +0 -1
  17. package/dist/assets/FeedbackPage-DtaOncVv.js +0 -1
  18. package/dist/assets/Logs-CZ5klHNK.js +0 -1
  19. package/dist/assets/MediaBreadcrumb-BpOxt5PK.js +0 -11
  20. package/dist/assets/MediaPage-DqRcZFlO.js +0 -16
  21. package/dist/assets/MenuAddPage-BLcoVgrS.js +0 -1
  22. package/dist/assets/MenuItemPage-B2otXqkz.js +0 -20
  23. package/dist/assets/MenuPage-C00m4Fc_.js +0 -1
  24. package/dist/assets/MonacoEditor.vue_vue_type_script_setup_true_lang-CjoEsC67.js +0 -3
  25. package/dist/assets/PermissionsPage-LtqcCJ14.js +0 -1
  26. package/dist/assets/Settings-BHH6RoBP.js +0 -1
  27. package/dist/assets/SettingsTable-CY5pZx1z.js +0 -1
  28. package/dist/assets/SettingsTitle-t4WJBFxZ.js +0 -1
  29. package/dist/assets/SingletonsPage-Bn2Ypjhs.js +0 -6
  30. package/dist/assets/TagsPage-DAiakEth.js +0 -1
  31. package/dist/assets/UniversalTable.vue_vue_type_script_setup_true_lang-BQ5m4aZd.js +0 -11
  32. package/dist/assets/UniversalTablePagination.vue_vue_type_script_setup_true_lang-DppVBws0.js +0 -1
  33. package/dist/assets/Users-CMH5j0db.js +0 -1
  34. package/dist/assets/UsersPage-CDGreEib.js +0 -1
  35. package/dist/assets/arrow-up-DCe0WsrM.js +0 -16
  36. package/dist/assets/calendar-o9t4MkD2.js +0 -6
  37. package/dist/assets/chevron-left-WFftVS9c.js +0 -6
  38. package/dist/assets/chevron-right-BiiSb3Be.js +0 -6
  39. package/dist/assets/contentForm-unZQhjCu.js +0 -6
  40. package/dist/assets/en-BDx3Svx8.js +0 -1
  41. package/dist/assets/eye-Dijywc6g.js +0 -6
  42. package/dist/assets/file-B_duymIT.js +0 -6
  43. package/dist/assets/general-CkN_0qIV.js +0 -1
  44. package/dist/assets/index-BIp7eSXk.js +0 -1
  45. package/dist/assets/index-DCW2e4Az.js +0 -9
  46. package/dist/assets/index-DGweaj24.js +0 -1
  47. package/dist/assets/index-W-qQIppj-BDlsxaGB.js +0 -1
  48. package/dist/assets/index-W-qQIppj-BsopI3Hz-BIZR-dhy.js +0 -1
  49. package/dist/assets/index-oQz9FOqL.css +0 -1
  50. package/dist/assets/index-yMJAVBXk.js +0 -290
  51. package/dist/assets/list-CXRbSNky.js +0 -6
  52. package/dist/assets/logo-Cct5WB26.png +0 -0
  53. package/dist/assets/pencil-CwnPP4IJ.js +0 -6
  54. package/dist/assets/plus-DLR44m6p.js +0 -6
  55. package/dist/assets/save-FeDrOUOd.js +0 -6
  56. package/dist/assets/search-C4-fHihx.js +0 -6
  57. package/dist/assets/square-pen-xVs4e8Yb.js +0 -6
  58. package/dist/assets/trash-2-BGXMNU3d.js +0 -6
  59. package/dist/assets/uk-BA7DIKEL.js +0 -1
  60. package/dist/assets/useDebounce-DFq3rxAW.js +0 -1
  61. package/dist/assets/vs-form-reletion-link-C-xrdHDl.js +0 -20
  62. package/dist/assets/vs-form-reletion-link-bk-9ZkDH.css +0 -1
  63. package/dist/assets/vue.-sixQ7xP-CUPNuJcq.js +0 -1
  64. package/dist/assets/vuedraggable.umd-W_2WTF6i.js +0 -14
  65. package/dist/assets/x-D2t-wfBe.js +0 -6
  66. package/src/index.js +0 -23
@@ -0,0 +1,2452 @@
1
+ function F(u) {
2
+ return typeof u == "string" || u instanceof String;
3
+ }
4
+ function L(u) {
5
+ var e;
6
+ return typeof u == "object" && u != null && (u == null || (e = u.constructor) == null ? void 0 : e.name) === "Object";
7
+ }
8
+ function U(u, e) {
9
+ return Array.isArray(e) ? U(u, (t, s) => e.includes(s)) : Object.entries(u).reduce((t, s) => {
10
+ let [i, a] = s;
11
+ return e(a, i) && (t[i] = a), t;
12
+ }, {});
13
+ }
14
+ const l = {
15
+ NONE: "NONE",
16
+ LEFT: "LEFT",
17
+ FORCE_LEFT: "FORCE_LEFT",
18
+ RIGHT: "RIGHT",
19
+ FORCE_RIGHT: "FORCE_RIGHT"
20
+ };
21
+ function Y(u) {
22
+ switch (u) {
23
+ case l.LEFT:
24
+ return l.FORCE_LEFT;
25
+ case l.RIGHT:
26
+ return l.FORCE_RIGHT;
27
+ default:
28
+ return u;
29
+ }
30
+ }
31
+ function w(u) {
32
+ return u.replace(/([.*+?^=!:${}()|[\]/\\])/g, "\\$1");
33
+ }
34
+ function D(u, e) {
35
+ if (e === u)
36
+ return !0;
37
+ const t = Array.isArray(e), s = Array.isArray(u);
38
+ let i;
39
+ if (t && s) {
40
+ if (e.length != u.length)
41
+ return !1;
42
+ for (i = 0; i < e.length; i++)
43
+ if (!D(e[i], u[i]))
44
+ return !1;
45
+ return !0;
46
+ }
47
+ if (t != s)
48
+ return !1;
49
+ if (e && u && typeof e == "object" && typeof u == "object") {
50
+ const a = e instanceof Date, n = u instanceof Date;
51
+ if (a && n)
52
+ return e.getTime() == u.getTime();
53
+ if (a != n)
54
+ return !1;
55
+ const r = e instanceof RegExp, h = u instanceof RegExp;
56
+ if (r && h)
57
+ return e.toString() == u.toString();
58
+ if (r != h)
59
+ return !1;
60
+ const o = Object.keys(e);
61
+ for (i = 0; i < o.length; i++)
62
+ if (!Object.prototype.hasOwnProperty.call(u, o[i]))
63
+ return !1;
64
+ for (i = 0; i < o.length; i++)
65
+ if (!D(u[o[i]], e[o[i]]))
66
+ return !1;
67
+ return !0;
68
+ } else if (e && u && typeof e == "function" && typeof u == "function")
69
+ return e.toString() === u.toString();
70
+ return !1;
71
+ }
72
+ class X {
73
+ /** Current input value */
74
+ /** Current cursor position */
75
+ /** Old input value */
76
+ /** Old selection */
77
+ constructor(e) {
78
+ for (Object.assign(this, e); this.value.slice(0, this.startChangePos) !== this.oldValue.slice(0, this.startChangePos); )
79
+ --this.oldSelection.start;
80
+ if (this.insertedCount)
81
+ for (; this.value.slice(this.cursorPos) !== this.oldValue.slice(this.oldSelection.end); )
82
+ this.value.length - this.cursorPos < this.oldValue.length - this.oldSelection.end ? ++this.oldSelection.end : ++this.cursorPos;
83
+ }
84
+ /** Start changing position */
85
+ get startChangePos() {
86
+ return Math.min(this.cursorPos, this.oldSelection.start);
87
+ }
88
+ /** Inserted symbols count */
89
+ get insertedCount() {
90
+ return this.cursorPos - this.startChangePos;
91
+ }
92
+ /** Inserted symbols */
93
+ get inserted() {
94
+ return this.value.substr(this.startChangePos, this.insertedCount);
95
+ }
96
+ /** Removed symbols count */
97
+ get removedCount() {
98
+ return Math.max(this.oldSelection.end - this.startChangePos || // for Delete
99
+ this.oldValue.length - this.value.length, 0);
100
+ }
101
+ /** Removed symbols */
102
+ get removed() {
103
+ return this.oldValue.substr(this.startChangePos, this.removedCount);
104
+ }
105
+ /** Unchanged head symbols */
106
+ get head() {
107
+ return this.value.substring(0, this.startChangePos);
108
+ }
109
+ /** Unchanged tail symbols */
110
+ get tail() {
111
+ return this.value.substring(this.startChangePos + this.insertedCount);
112
+ }
113
+ /** Remove direction */
114
+ get removeDirection() {
115
+ return !this.removedCount || this.insertedCount ? l.NONE : (this.oldSelection.end === this.cursorPos || this.oldSelection.start === this.cursorPos) && // if not range removed (event with backspace)
116
+ this.oldSelection.end === this.oldSelection.start ? l.RIGHT : l.LEFT;
117
+ }
118
+ }
119
+ function d(u, e) {
120
+ return new d.InputMask(u, e);
121
+ }
122
+ function H(u) {
123
+ if (u == null)
124
+ throw new Error("mask property should be defined");
125
+ return u instanceof RegExp ? d.MaskedRegExp : F(u) ? d.MaskedPattern : u === Date ? d.MaskedDate : u === Number ? d.MaskedNumber : Array.isArray(u) || u === Array ? d.MaskedDynamic : d.Masked && u.prototype instanceof d.Masked ? u : d.Masked && u instanceof d.Masked ? u.constructor : u instanceof Function ? d.MaskedFunction : (console.warn("Mask not found for mask", u), d.Masked);
126
+ }
127
+ function x(u) {
128
+ if (!u)
129
+ throw new Error("Options in not defined");
130
+ if (d.Masked) {
131
+ if (u.prototype instanceof d.Masked)
132
+ return {
133
+ mask: u
134
+ };
135
+ const {
136
+ mask: e = void 0,
137
+ ...t
138
+ } = u instanceof d.Masked ? {
139
+ mask: u
140
+ } : L(u) && u.mask instanceof d.Masked ? u : {};
141
+ if (e) {
142
+ const s = e.mask;
143
+ return {
144
+ ...U(e, (i, a) => !a.startsWith("_")),
145
+ mask: e.constructor,
146
+ _mask: s,
147
+ ...t
148
+ };
149
+ }
150
+ }
151
+ return L(u) ? {
152
+ ...u
153
+ } : {
154
+ mask: u
155
+ };
156
+ }
157
+ function A(u) {
158
+ if (d.Masked && u instanceof d.Masked)
159
+ return u;
160
+ const e = x(u), t = H(e.mask);
161
+ if (!t)
162
+ throw new Error("Masked class is not found for provided mask " + e.mask + ", appropriate module needs to be imported manually before creating mask.");
163
+ return e.mask === t && delete e.mask, e._mask && (e.mask = e._mask, delete e._mask), new t(e);
164
+ }
165
+ d.createMask = A;
166
+ class P {
167
+ /** */
168
+ /** */
169
+ /** */
170
+ /** Safely returns selection start */
171
+ get selectionStart() {
172
+ let e;
173
+ try {
174
+ e = this._unsafeSelectionStart;
175
+ } catch {
176
+ }
177
+ return e ?? this.value.length;
178
+ }
179
+ /** Safely returns selection end */
180
+ get selectionEnd() {
181
+ let e;
182
+ try {
183
+ e = this._unsafeSelectionEnd;
184
+ } catch {
185
+ }
186
+ return e ?? this.value.length;
187
+ }
188
+ /** Safely sets element selection */
189
+ select(e, t) {
190
+ if (!(e == null || t == null || e === this.selectionStart && t === this.selectionEnd))
191
+ try {
192
+ this._unsafeSelect(e, t);
193
+ } catch {
194
+ }
195
+ }
196
+ /** */
197
+ get isActive() {
198
+ return !1;
199
+ }
200
+ /** */
201
+ /** */
202
+ /** */
203
+ }
204
+ d.MaskElement = P;
205
+ const N = 90, Z = 89;
206
+ class y extends P {
207
+ /** HTMLElement to use mask on */
208
+ constructor(e) {
209
+ super(), this.input = e, this._onKeydown = this._onKeydown.bind(this), this._onInput = this._onInput.bind(this), this._onBeforeinput = this._onBeforeinput.bind(this), this._onCompositionEnd = this._onCompositionEnd.bind(this);
210
+ }
211
+ get rootElement() {
212
+ var e, t, s;
213
+ return (e = (t = (s = this.input).getRootNode) == null ? void 0 : t.call(s)) != null ? e : document;
214
+ }
215
+ /** Is element in focus */
216
+ get isActive() {
217
+ return this.input === this.rootElement.activeElement;
218
+ }
219
+ /** Binds HTMLElement events to mask internal events */
220
+ bindEvents(e) {
221
+ 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", e.drop), this.input.addEventListener("click", e.click), this.input.addEventListener("focus", e.focus), this.input.addEventListener("blur", e.commit), this._handlers = e;
222
+ }
223
+ _onKeydown(e) {
224
+ if (this._handlers.redo && (e.keyCode === N && e.shiftKey && (e.metaKey || e.ctrlKey) || e.keyCode === Z && e.ctrlKey))
225
+ return e.preventDefault(), this._handlers.redo(e);
226
+ if (this._handlers.undo && e.keyCode === N && (e.metaKey || e.ctrlKey))
227
+ return e.preventDefault(), this._handlers.undo(e);
228
+ e.isComposing || this._handlers.selectionChange(e);
229
+ }
230
+ _onBeforeinput(e) {
231
+ if (e.inputType === "historyUndo" && this._handlers.undo)
232
+ return e.preventDefault(), this._handlers.undo(e);
233
+ if (e.inputType === "historyRedo" && this._handlers.redo)
234
+ return e.preventDefault(), this._handlers.redo(e);
235
+ }
236
+ _onCompositionEnd(e) {
237
+ this._handlers.input(e);
238
+ }
239
+ _onInput(e) {
240
+ e.isComposing || this._handlers.input(e);
241
+ }
242
+ /** Unbinds HTMLElement events to mask internal events */
243
+ unbindEvents() {
244
+ 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 = {};
245
+ }
246
+ }
247
+ d.HTMLMaskElement = y;
248
+ class $ extends y {
249
+ /** InputElement to use mask on */
250
+ constructor(e) {
251
+ super(e), this.input = e;
252
+ }
253
+ /** Returns InputElement selection start */
254
+ get _unsafeSelectionStart() {
255
+ return this.input.selectionStart != null ? this.input.selectionStart : this.value.length;
256
+ }
257
+ /** Returns InputElement selection end */
258
+ get _unsafeSelectionEnd() {
259
+ return this.input.selectionEnd;
260
+ }
261
+ /** Sets InputElement selection */
262
+ _unsafeSelect(e, t) {
263
+ this.input.setSelectionRange(e, t);
264
+ }
265
+ get value() {
266
+ return this.input.value;
267
+ }
268
+ set value(e) {
269
+ this.input.value = e;
270
+ }
271
+ }
272
+ d.HTMLMaskElement = y;
273
+ class j extends y {
274
+ /** Returns HTMLElement selection start */
275
+ get _unsafeSelectionStart() {
276
+ const e = this.rootElement, t = e.getSelection && e.getSelection(), s = t && t.anchorOffset, i = t && t.focusOffset;
277
+ return i == null || s == null || s < i ? s : i;
278
+ }
279
+ /** Returns HTMLElement selection end */
280
+ get _unsafeSelectionEnd() {
281
+ const e = this.rootElement, t = e.getSelection && e.getSelection(), s = t && t.anchorOffset, i = t && t.focusOffset;
282
+ return i == null || s == null || s > i ? s : i;
283
+ }
284
+ /** Sets HTMLElement selection */
285
+ _unsafeSelect(e, t) {
286
+ if (!this.rootElement.createRange)
287
+ return;
288
+ const s = this.rootElement.createRange();
289
+ s.setStart(this.input.firstChild || this.input, e), s.setEnd(this.input.lastChild || this.input, t);
290
+ const i = this.rootElement, a = i.getSelection && i.getSelection();
291
+ a && (a.removeAllRanges(), a.addRange(s));
292
+ }
293
+ /** HTMLElement value */
294
+ get value() {
295
+ return this.input.textContent || "";
296
+ }
297
+ set value(e) {
298
+ this.input.textContent = e;
299
+ }
300
+ }
301
+ d.HTMLContenteditableMaskElement = j;
302
+ class I {
303
+ constructor() {
304
+ this.states = [], this.currentIndex = 0;
305
+ }
306
+ get currentState() {
307
+ return this.states[this.currentIndex];
308
+ }
309
+ get isEmpty() {
310
+ return this.states.length === 0;
311
+ }
312
+ push(e) {
313
+ this.currentIndex < this.states.length - 1 && (this.states.length = this.currentIndex + 1), this.states.push(e), this.states.length > I.MAX_LENGTH && this.states.shift(), this.currentIndex = this.states.length - 1;
314
+ }
315
+ go(e) {
316
+ return this.currentIndex = Math.min(Math.max(this.currentIndex + e, 0), this.states.length - 1), this.currentState;
317
+ }
318
+ undo() {
319
+ return this.go(-1);
320
+ }
321
+ redo() {
322
+ return this.go(1);
323
+ }
324
+ clear() {
325
+ this.states.length = 0, this.currentIndex = 0;
326
+ }
327
+ }
328
+ I.MAX_LENGTH = 100;
329
+ class W {
330
+ /**
331
+ View element
332
+ */
333
+ /** Internal {@link Masked} model */
334
+ constructor(e, t) {
335
+ this.el = e instanceof P ? e : e.isContentEditable && e.tagName !== "INPUT" && e.tagName !== "TEXTAREA" ? new j(e) : new $(e), this.masked = A(t), this._listeners = {}, this._value = "", this._unmaskedValue = "", this._rawInputValue = "", this.history = new I(), 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();
336
+ }
337
+ maskEquals(e) {
338
+ var t;
339
+ return e == null || ((t = this.masked) == null ? void 0 : t.maskEquals(e));
340
+ }
341
+ /** Masked */
342
+ get mask() {
343
+ return this.masked.mask;
344
+ }
345
+ set mask(e) {
346
+ if (this.maskEquals(e))
347
+ return;
348
+ if (!(e instanceof d.Masked) && this.masked.constructor === H(e)) {
349
+ this.masked.updateOptions({
350
+ mask: e
351
+ });
352
+ return;
353
+ }
354
+ const t = e instanceof d.Masked ? e : A({
355
+ mask: e
356
+ });
357
+ t.unmaskedValue = this.masked.unmaskedValue, this.masked = t;
358
+ }
359
+ /** Raw value */
360
+ get value() {
361
+ return this._value;
362
+ }
363
+ set value(e) {
364
+ this.value !== e && (this.masked.value = e, this.updateControl("auto"));
365
+ }
366
+ /** Unmasked value */
367
+ get unmaskedValue() {
368
+ return this._unmaskedValue;
369
+ }
370
+ set unmaskedValue(e) {
371
+ this.unmaskedValue !== e && (this.masked.unmaskedValue = e, this.updateControl("auto"));
372
+ }
373
+ /** Raw input value */
374
+ get rawInputValue() {
375
+ return this._rawInputValue;
376
+ }
377
+ set rawInputValue(e) {
378
+ this.rawInputValue !== e && (this.masked.rawInputValue = e, this.updateControl(), this.alignCursor());
379
+ }
380
+ /** Typed unmasked value */
381
+ get typedValue() {
382
+ return this.masked.typedValue;
383
+ }
384
+ set typedValue(e) {
385
+ this.masked.typedValueEquals(e) || (this.masked.typedValue = e, this.updateControl("auto"));
386
+ }
387
+ /** Display value */
388
+ get displayValue() {
389
+ return this.masked.displayValue;
390
+ }
391
+ /** Starts listening to element events */
392
+ _bindEvents() {
393
+ this.el.bindEvents({
394
+ selectionChange: this._saveSelection,
395
+ input: this._onInput,
396
+ drop: this._onDrop,
397
+ click: this._onClick,
398
+ focus: this._onFocus,
399
+ commit: this._onChange,
400
+ undo: this._onUndo,
401
+ redo: this._onRedo
402
+ });
403
+ }
404
+ /** Stops listening to element events */
405
+ _unbindEvents() {
406
+ this.el && this.el.unbindEvents();
407
+ }
408
+ /** Fires custom event */
409
+ _fireEvent(e, t) {
410
+ const s = this._listeners[e];
411
+ s && s.forEach((i) => i(t));
412
+ }
413
+ /** Current selection start */
414
+ get selectionStart() {
415
+ return this._cursorChanging ? this._changingCursorPos : this.el.selectionStart;
416
+ }
417
+ /** Current cursor position */
418
+ get cursorPos() {
419
+ return this._cursorChanging ? this._changingCursorPos : this.el.selectionEnd;
420
+ }
421
+ set cursorPos(e) {
422
+ !this.el || !this.el.isActive || (this.el.select(e, e), this._saveSelection());
423
+ }
424
+ /** Stores current selection */
425
+ _saveSelection() {
426
+ this.displayValue !== this.el.value && console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."), this._selection = {
427
+ start: this.selectionStart,
428
+ end: this.cursorPos
429
+ };
430
+ }
431
+ /** Syncronizes model value from view */
432
+ updateValue() {
433
+ this.masked.value = this.el.value, this._value = this.masked.value, this._unmaskedValue = this.masked.unmaskedValue, this._rawInputValue = this.masked.rawInputValue;
434
+ }
435
+ /** Syncronizes view from model value, fires change events */
436
+ updateControl(e) {
437
+ const t = this.masked.unmaskedValue, s = this.masked.value, i = this.masked.rawInputValue, a = this.displayValue, n = this.unmaskedValue !== t || this.value !== s || this._rawInputValue !== i;
438
+ this._unmaskedValue = t, this._value = s, this._rawInputValue = i, this.el.value !== a && (this.el.value = a), e === "auto" ? this.alignCursor() : e != null && (this.cursorPos = e), n && this._fireChangeEvents(), !this._historyChanging && (n || this.history.isEmpty) && this.history.push({
439
+ unmaskedValue: t,
440
+ selection: {
441
+ start: this.selectionStart,
442
+ end: this.cursorPos
443
+ }
444
+ });
445
+ }
446
+ /** Updates options with deep equal check, recreates {@link Masked} model if mask type changes */
447
+ updateOptions(e) {
448
+ const {
449
+ mask: t,
450
+ ...s
451
+ } = e, i = !this.maskEquals(t), a = this.masked.optionsIsChanged(s);
452
+ i && (this.mask = t), a && this.masked.updateOptions(s), (i || a) && this.updateControl();
453
+ }
454
+ /** Updates cursor */
455
+ updateCursor(e) {
456
+ e != null && (this.cursorPos = e, this._delayUpdateCursor(e));
457
+ }
458
+ /** Delays cursor update to support mobile browsers */
459
+ _delayUpdateCursor(e) {
460
+ this._abortUpdateCursor(), this._changingCursorPos = e, this._cursorChanging = setTimeout(() => {
461
+ this.el && (this.cursorPos = this._changingCursorPos, this._abortUpdateCursor());
462
+ }, 10);
463
+ }
464
+ /** Fires custom events */
465
+ _fireChangeEvents() {
466
+ this._fireEvent("accept", this._inputEvent), this.masked.isComplete && this._fireEvent("complete", this._inputEvent);
467
+ }
468
+ /** Aborts delayed cursor update */
469
+ _abortUpdateCursor() {
470
+ this._cursorChanging && (clearTimeout(this._cursorChanging), delete this._cursorChanging);
471
+ }
472
+ /** Aligns cursor to nearest available position */
473
+ alignCursor() {
474
+ this.cursorPos = this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos, l.LEFT));
475
+ }
476
+ /** Aligns cursor only if selection is empty */
477
+ alignCursorFriendly() {
478
+ this.selectionStart === this.cursorPos && this.alignCursor();
479
+ }
480
+ /** Adds listener on custom event */
481
+ on(e, t) {
482
+ return this._listeners[e] || (this._listeners[e] = []), this._listeners[e].push(t), this;
483
+ }
484
+ /** Removes custom event listener */
485
+ off(e, t) {
486
+ if (!this._listeners[e])
487
+ return this;
488
+ if (!t)
489
+ return delete this._listeners[e], this;
490
+ const s = this._listeners[e].indexOf(t);
491
+ return s >= 0 && this._listeners[e].splice(s, 1), this;
492
+ }
493
+ /** Handles view input event */
494
+ _onInput(e) {
495
+ this._inputEvent = e, this._abortUpdateCursor();
496
+ const t = new X({
497
+ // new state
498
+ value: this.el.value,
499
+ cursorPos: this.cursorPos,
500
+ // old state
501
+ oldValue: this.displayValue,
502
+ oldSelection: this._selection
503
+ }), s = this.masked.rawInputValue, i = this.masked.splice(t.startChangePos, t.removed.length, t.inserted, t.removeDirection, {
504
+ input: !0,
505
+ raw: !0
506
+ }).offset, a = s === this.masked.rawInputValue ? t.removeDirection : l.NONE;
507
+ let n = this.masked.nearestInputPos(t.startChangePos + i, a);
508
+ a !== l.NONE && (n = this.masked.nearestInputPos(n, l.NONE)), this.updateControl(n), delete this._inputEvent;
509
+ }
510
+ /** Handles view change event and commits model value */
511
+ _onChange() {
512
+ this.displayValue !== this.el.value && this.updateValue(), this.masked.doCommit(), this.updateControl(), this._saveSelection();
513
+ }
514
+ /** Handles view drop event, prevents by default */
515
+ _onDrop(e) {
516
+ e.preventDefault(), e.stopPropagation();
517
+ }
518
+ /** Restore last selection on focus */
519
+ _onFocus(e) {
520
+ this.alignCursorFriendly();
521
+ }
522
+ /** Restore last selection on focus */
523
+ _onClick(e) {
524
+ this.alignCursorFriendly();
525
+ }
526
+ _onUndo() {
527
+ this._applyHistoryState(this.history.undo());
528
+ }
529
+ _onRedo() {
530
+ this._applyHistoryState(this.history.redo());
531
+ }
532
+ _applyHistoryState(e) {
533
+ e && (this._historyChanging = !0, this.unmaskedValue = e.unmaskedValue, this.el.select(e.selection.start, e.selection.end), this._saveSelection(), this._historyChanging = !1);
534
+ }
535
+ /** Unbind view events and removes element reference */
536
+ destroy() {
537
+ this._unbindEvents(), this._listeners.length = 0, delete this.el;
538
+ }
539
+ }
540
+ d.InputMask = W;
541
+ class p {
542
+ /** Inserted symbols */
543
+ /** Additional offset if any changes occurred before tail */
544
+ /** Raw inserted is used by dynamic mask */
545
+ /** Can skip chars */
546
+ static normalize(e) {
547
+ return Array.isArray(e) ? e : [e, new p()];
548
+ }
549
+ constructor(e) {
550
+ Object.assign(this, {
551
+ inserted: "",
552
+ rawInserted: "",
553
+ tailShift: 0,
554
+ skip: !1
555
+ }, e);
556
+ }
557
+ /** Aggregate changes */
558
+ aggregate(e) {
559
+ return this.inserted += e.inserted, this.rawInserted += e.rawInserted, this.tailShift += e.tailShift, this.skip = this.skip || e.skip, this;
560
+ }
561
+ /** Total offset considering all changes */
562
+ get offset() {
563
+ return this.tailShift + this.inserted.length;
564
+ }
565
+ get consumed() {
566
+ return !!this.rawInserted || this.skip;
567
+ }
568
+ equals(e) {
569
+ return this.inserted === e.inserted && this.tailShift === e.tailShift && this.rawInserted === e.rawInserted && this.skip === e.skip;
570
+ }
571
+ }
572
+ d.ChangeDetails = p;
573
+ class E {
574
+ /** Tail value as string */
575
+ /** Tail start position */
576
+ /** Start position */
577
+ constructor(e, t, s) {
578
+ e === void 0 && (e = ""), t === void 0 && (t = 0), this.value = e, this.from = t, this.stop = s;
579
+ }
580
+ toString() {
581
+ return this.value;
582
+ }
583
+ extend(e) {
584
+ this.value += String(e);
585
+ }
586
+ appendTo(e) {
587
+ return e.append(this.toString(), {
588
+ tail: !0
589
+ }).aggregate(e._appendPlaceholder());
590
+ }
591
+ get state() {
592
+ return {
593
+ value: this.value,
594
+ from: this.from,
595
+ stop: this.stop
596
+ };
597
+ }
598
+ set state(e) {
599
+ Object.assign(this, e);
600
+ }
601
+ unshift(e) {
602
+ if (!this.value.length || e != null && this.from >= e)
603
+ return "";
604
+ const t = this.value[0];
605
+ return this.value = this.value.slice(1), t;
606
+ }
607
+ shift() {
608
+ if (!this.value.length)
609
+ return "";
610
+ const e = this.value[this.value.length - 1];
611
+ return this.value = this.value.slice(0, -1), e;
612
+ }
613
+ }
614
+ class g {
615
+ /** */
616
+ /** */
617
+ /** Transforms value before mask processing */
618
+ /** Transforms each char before mask processing */
619
+ /** Validates if value is acceptable */
620
+ /** Does additional processing at the end of editing */
621
+ /** Format typed value to string */
622
+ /** Parse string to get typed value */
623
+ /** Enable characters overwriting */
624
+ /** */
625
+ /** */
626
+ /** */
627
+ /** */
628
+ constructor(e) {
629
+ this._value = "", this._update({
630
+ ...g.DEFAULTS,
631
+ ...e
632
+ }), this._initialized = !0;
633
+ }
634
+ /** Sets and applies new options */
635
+ updateOptions(e) {
636
+ this.optionsIsChanged(e) && this.withValueRefresh(this._update.bind(this, e));
637
+ }
638
+ /** Sets new options */
639
+ _update(e) {
640
+ Object.assign(this, e);
641
+ }
642
+ /** Mask state */
643
+ get state() {
644
+ return {
645
+ _value: this.value,
646
+ _rawInputValue: this.rawInputValue
647
+ };
648
+ }
649
+ set state(e) {
650
+ this._value = e._value;
651
+ }
652
+ /** Resets value */
653
+ reset() {
654
+ this._value = "";
655
+ }
656
+ get value() {
657
+ return this._value;
658
+ }
659
+ set value(e) {
660
+ this.resolve(e, {
661
+ input: !0
662
+ });
663
+ }
664
+ /** Resolve new value */
665
+ resolve(e, t) {
666
+ t === void 0 && (t = {
667
+ input: !0
668
+ }), this.reset(), this.append(e, t, ""), this.doCommit();
669
+ }
670
+ get unmaskedValue() {
671
+ return this.value;
672
+ }
673
+ set unmaskedValue(e) {
674
+ this.resolve(e, {});
675
+ }
676
+ get typedValue() {
677
+ return this.parse ? this.parse(this.value, this) : this.unmaskedValue;
678
+ }
679
+ set typedValue(e) {
680
+ this.format ? this.value = this.format(e, this) : this.unmaskedValue = String(e);
681
+ }
682
+ /** Value that includes raw user input */
683
+ get rawInputValue() {
684
+ return this.extractInput(0, this.displayValue.length, {
685
+ raw: !0
686
+ });
687
+ }
688
+ set rawInputValue(e) {
689
+ this.resolve(e, {
690
+ raw: !0
691
+ });
692
+ }
693
+ get displayValue() {
694
+ return this.value;
695
+ }
696
+ get isComplete() {
697
+ return !0;
698
+ }
699
+ get isFilled() {
700
+ return this.isComplete;
701
+ }
702
+ /** Finds nearest input position in direction */
703
+ nearestInputPos(e, t) {
704
+ return e;
705
+ }
706
+ totalInputPositions(e, t) {
707
+ return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), Math.min(this.displayValue.length, t - e);
708
+ }
709
+ /** Extracts value in range considering flags */
710
+ extractInput(e, t, s) {
711
+ return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), this.displayValue.slice(e, t);
712
+ }
713
+ /** Extracts tail in range */
714
+ extractTail(e, t) {
715
+ return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), new E(this.extractInput(e, t), e);
716
+ }
717
+ /** Appends tail */
718
+ appendTail(e) {
719
+ return F(e) && (e = new E(String(e))), e.appendTo(this);
720
+ }
721
+ /** Appends char */
722
+ _appendCharRaw(e, t) {
723
+ return e ? (this._value += e, new p({
724
+ inserted: e,
725
+ rawInserted: e
726
+ })) : new p();
727
+ }
728
+ /** Appends char */
729
+ _appendChar(e, t, s) {
730
+ t === void 0 && (t = {});
731
+ const i = this.state;
732
+ let a;
733
+ if ([e, a] = this.doPrepareChar(e, t), e && (a = a.aggregate(this._appendCharRaw(e, t)), !a.rawInserted && this.autofix === "pad")) {
734
+ const n = this.state;
735
+ this.state = i;
736
+ let r = this.pad(t);
737
+ const h = this._appendCharRaw(e, t);
738
+ r = r.aggregate(h), h.rawInserted || r.equals(a) ? a = r : this.state = n;
739
+ }
740
+ if (a.inserted) {
741
+ let n, r = this.doValidate(t) !== !1;
742
+ if (r && s != null) {
743
+ const h = this.state;
744
+ if (this.overwrite === !0) {
745
+ n = s.state;
746
+ for (let c = 0; c < a.rawInserted.length; ++c)
747
+ s.unshift(this.displayValue.length - a.tailShift);
748
+ }
749
+ let o = this.appendTail(s);
750
+ if (r = o.rawInserted.length === s.toString().length, !(r && o.inserted) && this.overwrite === "shift") {
751
+ this.state = h, n = s.state;
752
+ for (let c = 0; c < a.rawInserted.length; ++c)
753
+ s.shift();
754
+ o = this.appendTail(s), r = o.rawInserted.length === s.toString().length;
755
+ }
756
+ r && o.inserted && (this.state = h);
757
+ }
758
+ r || (a = new p(), this.state = i, s && n && (s.state = n));
759
+ }
760
+ return a;
761
+ }
762
+ /** Appends optional placeholder at the end */
763
+ _appendPlaceholder() {
764
+ return new p();
765
+ }
766
+ /** Appends optional eager placeholder at the end */
767
+ _appendEager() {
768
+ return new p();
769
+ }
770
+ /** Appends symbols considering flags */
771
+ append(e, t, s) {
772
+ if (!F(e))
773
+ throw new Error("value should be string");
774
+ const i = F(s) ? new E(String(s)) : s;
775
+ t != null && t.tail && (t._beforeTailState = this.state);
776
+ let a;
777
+ [e, a] = this.doPrepare(e, t);
778
+ for (let n = 0; n < e.length; ++n) {
779
+ const r = this._appendChar(e[n], t, i);
780
+ if (!r.rawInserted && !this.doSkipInvalid(e[n], t, i))
781
+ break;
782
+ a.aggregate(r);
783
+ }
784
+ return (this.eager === !0 || this.eager === "append") && t != null && t.input && e && a.aggregate(this._appendEager()), i != null && (a.tailShift += this.appendTail(i).tailShift), a;
785
+ }
786
+ remove(e, t) {
787
+ return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), this._value = this.displayValue.slice(0, e) + this.displayValue.slice(t), new p();
788
+ }
789
+ /** Calls function and reapplies current value */
790
+ withValueRefresh(e) {
791
+ if (this._refreshing || !this._initialized)
792
+ return e();
793
+ this._refreshing = !0;
794
+ const t = this.rawInputValue, s = this.value, i = e();
795
+ return this.rawInputValue = t, this.value && this.value !== s && s.indexOf(this.value) === 0 && (this.append(s.slice(this.displayValue.length), {}, ""), this.doCommit()), delete this._refreshing, i;
796
+ }
797
+ runIsolated(e) {
798
+ if (this._isolated || !this._initialized)
799
+ return e(this);
800
+ this._isolated = !0;
801
+ const t = this.state, s = e(this);
802
+ return this.state = t, delete this._isolated, s;
803
+ }
804
+ doSkipInvalid(e, t, s) {
805
+ return !!this.skipInvalid;
806
+ }
807
+ /** Prepares string before mask processing */
808
+ doPrepare(e, t) {
809
+ return t === void 0 && (t = {}), p.normalize(this.prepare ? this.prepare(e, this, t) : e);
810
+ }
811
+ /** Prepares each char before mask processing */
812
+ doPrepareChar(e, t) {
813
+ return t === void 0 && (t = {}), p.normalize(this.prepareChar ? this.prepareChar(e, this, t) : e);
814
+ }
815
+ /** Validates if value is acceptable */
816
+ doValidate(e) {
817
+ return (!this.validate || this.validate(this.value, this, e)) && (!this.parent || this.parent.doValidate(e));
818
+ }
819
+ /** Does additional processing at the end of editing */
820
+ doCommit() {
821
+ this.commit && this.commit(this.value, this);
822
+ }
823
+ splice(e, t, s, i, a) {
824
+ s === void 0 && (s = ""), i === void 0 && (i = l.NONE), a === void 0 && (a = {
825
+ input: !0
826
+ });
827
+ const n = e + t, r = this.extractTail(n), h = this.eager === !0 || this.eager === "remove";
828
+ let o;
829
+ h && (i = Y(i), o = this.extractInput(0, n, {
830
+ raw: !0
831
+ }));
832
+ let c = e;
833
+ const f = new p();
834
+ if (i !== l.NONE && (c = this.nearestInputPos(e, t > 1 && e !== 0 && !h ? l.NONE : i), f.tailShift = c - e), f.aggregate(this.remove(c)), h && i !== l.NONE && o === this.rawInputValue)
835
+ if (i === l.FORCE_LEFT) {
836
+ let m;
837
+ for (; o === this.rawInputValue && (m = this.displayValue.length); )
838
+ f.aggregate(new p({
839
+ tailShift: -1
840
+ })).aggregate(this.remove(m - 1));
841
+ } else
842
+ i === l.FORCE_RIGHT && r.unshift();
843
+ return f.aggregate(this.append(s, a, r));
844
+ }
845
+ maskEquals(e) {
846
+ return this.mask === e;
847
+ }
848
+ optionsIsChanged(e) {
849
+ return !D(this, e);
850
+ }
851
+ typedValueEquals(e) {
852
+ const t = this.typedValue;
853
+ return e === t || g.EMPTY_VALUES.includes(e) && g.EMPTY_VALUES.includes(t) || (this.format ? this.format(e, this) === this.format(this.typedValue, this) : !1);
854
+ }
855
+ pad(e) {
856
+ return new p();
857
+ }
858
+ }
859
+ g.DEFAULTS = {
860
+ skipInvalid: !0
861
+ };
862
+ g.EMPTY_VALUES = [void 0, null, ""];
863
+ d.Masked = g;
864
+ class v {
865
+ /** */
866
+ constructor(e, t) {
867
+ e === void 0 && (e = []), t === void 0 && (t = 0), this.chunks = e, this.from = t;
868
+ }
869
+ toString() {
870
+ return this.chunks.map(String).join("");
871
+ }
872
+ extend(e) {
873
+ if (!String(e))
874
+ return;
875
+ e = F(e) ? new E(String(e)) : e;
876
+ const t = this.chunks[this.chunks.length - 1], s = t && // if stops are same or tail has no stop
877
+ (t.stop === e.stop || e.stop == null) && // if tail chunk goes just after last chunk
878
+ e.from === t.from + t.toString().length;
879
+ if (e instanceof E)
880
+ s ? t.extend(e.toString()) : this.chunks.push(e);
881
+ else if (e instanceof v) {
882
+ if (e.stop == null) {
883
+ let i;
884
+ for (; e.chunks.length && e.chunks[0].stop == null; )
885
+ i = e.chunks.shift(), i.from += e.from, this.extend(i);
886
+ }
887
+ e.toString() && (e.stop = e.blockIndex, this.chunks.push(e));
888
+ }
889
+ }
890
+ appendTo(e) {
891
+ if (!(e instanceof d.MaskedPattern))
892
+ return new E(this.toString()).appendTo(e);
893
+ const t = new p();
894
+ for (let s = 0; s < this.chunks.length; ++s) {
895
+ const i = this.chunks[s], a = e._mapPosToBlock(e.displayValue.length), n = i.stop;
896
+ let r;
897
+ if (n != null && // if block not found or stop is behind lastBlock
898
+ (!a || a.index <= n) && ((i instanceof v || // for continuous block also check if stop is exist
899
+ e._stops.indexOf(n) >= 0) && t.aggregate(e._appendPlaceholder(n)), r = i instanceof v && e._blocks[n]), r) {
900
+ const h = r.appendTail(i);
901
+ t.aggregate(h);
902
+ const o = i.toString().slice(h.rawInserted.length);
903
+ o && t.aggregate(e.append(o, {
904
+ tail: !0
905
+ }));
906
+ } else
907
+ t.aggregate(e.append(i.toString(), {
908
+ tail: !0
909
+ }));
910
+ }
911
+ return t;
912
+ }
913
+ get state() {
914
+ return {
915
+ chunks: this.chunks.map((e) => e.state),
916
+ from: this.from,
917
+ stop: this.stop,
918
+ blockIndex: this.blockIndex
919
+ };
920
+ }
921
+ set state(e) {
922
+ const {
923
+ chunks: t,
924
+ ...s
925
+ } = e;
926
+ Object.assign(this, s), this.chunks = t.map((i) => {
927
+ const a = "chunks" in i ? new v() : new E();
928
+ return a.state = i, a;
929
+ });
930
+ }
931
+ unshift(e) {
932
+ if (!this.chunks.length || e != null && this.from >= e)
933
+ return "";
934
+ const t = e != null ? e - this.from : e;
935
+ let s = 0;
936
+ for (; s < this.chunks.length; ) {
937
+ const i = this.chunks[s], a = i.unshift(t);
938
+ if (i.toString()) {
939
+ if (!a)
940
+ break;
941
+ ++s;
942
+ } else
943
+ this.chunks.splice(s, 1);
944
+ if (a)
945
+ return a;
946
+ }
947
+ return "";
948
+ }
949
+ shift() {
950
+ if (!this.chunks.length)
951
+ return "";
952
+ let e = this.chunks.length - 1;
953
+ for (; 0 <= e; ) {
954
+ const t = this.chunks[e], s = t.shift();
955
+ if (t.toString()) {
956
+ if (!s)
957
+ break;
958
+ --e;
959
+ } else
960
+ this.chunks.splice(e, 1);
961
+ if (s)
962
+ return s;
963
+ }
964
+ return "";
965
+ }
966
+ }
967
+ class J {
968
+ constructor(e, t) {
969
+ this.masked = e, this._log = [];
970
+ const {
971
+ offset: s,
972
+ index: i
973
+ } = e._mapPosToBlock(t) || (t < 0 ? (
974
+ // first
975
+ {
976
+ index: 0,
977
+ offset: 0
978
+ }
979
+ ) : (
980
+ // last
981
+ {
982
+ index: this.masked._blocks.length,
983
+ offset: 0
984
+ }
985
+ ));
986
+ this.offset = s, this.index = i, this.ok = !1;
987
+ }
988
+ get block() {
989
+ return this.masked._blocks[this.index];
990
+ }
991
+ get pos() {
992
+ return this.masked._blockStartPos(this.index) + this.offset;
993
+ }
994
+ get state() {
995
+ return {
996
+ index: this.index,
997
+ offset: this.offset,
998
+ ok: this.ok
999
+ };
1000
+ }
1001
+ set state(e) {
1002
+ Object.assign(this, e);
1003
+ }
1004
+ pushState() {
1005
+ this._log.push(this.state);
1006
+ }
1007
+ popState() {
1008
+ const e = this._log.pop();
1009
+ return e && (this.state = e), e;
1010
+ }
1011
+ bindBlock() {
1012
+ 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));
1013
+ }
1014
+ _pushLeft(e) {
1015
+ for (this.pushState(), this.bindBlock(); 0 <= this.index; --this.index, this.offset = ((t = this.block) == null ? void 0 : t.displayValue.length) || 0) {
1016
+ var t;
1017
+ if (e())
1018
+ return this.ok = !0;
1019
+ }
1020
+ return this.ok = !1;
1021
+ }
1022
+ _pushRight(e) {
1023
+ for (this.pushState(), this.bindBlock(); this.index < this.masked._blocks.length; ++this.index, this.offset = 0)
1024
+ if (e())
1025
+ return this.ok = !0;
1026
+ return this.ok = !1;
1027
+ }
1028
+ pushLeftBeforeFilled() {
1029
+ return this._pushLeft(() => {
1030
+ if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, l.FORCE_LEFT), this.offset !== 0))
1031
+ return !0;
1032
+ });
1033
+ }
1034
+ pushLeftBeforeInput() {
1035
+ return this._pushLeft(() => {
1036
+ if (!this.block.isFixed)
1037
+ return this.offset = this.block.nearestInputPos(this.offset, l.LEFT), !0;
1038
+ });
1039
+ }
1040
+ pushLeftBeforeRequired() {
1041
+ return this._pushLeft(() => {
1042
+ if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
1043
+ return this.offset = this.block.nearestInputPos(this.offset, l.LEFT), !0;
1044
+ });
1045
+ }
1046
+ pushRightBeforeFilled() {
1047
+ return this._pushRight(() => {
1048
+ if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, l.FORCE_RIGHT), this.offset !== this.block.value.length))
1049
+ return !0;
1050
+ });
1051
+ }
1052
+ pushRightBeforeInput() {
1053
+ return this._pushRight(() => {
1054
+ if (!this.block.isFixed)
1055
+ return this.offset = this.block.nearestInputPos(this.offset, l.NONE), !0;
1056
+ });
1057
+ }
1058
+ pushRightBeforeRequired() {
1059
+ return this._pushRight(() => {
1060
+ if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
1061
+ return this.offset = this.block.nearestInputPos(this.offset, l.NONE), !0;
1062
+ });
1063
+ }
1064
+ }
1065
+ class G {
1066
+ /** */
1067
+ /** */
1068
+ /** */
1069
+ /** */
1070
+ /** */
1071
+ /** */
1072
+ constructor(e) {
1073
+ Object.assign(this, e), this._value = "", this.isFixed = !0;
1074
+ }
1075
+ get value() {
1076
+ return this._value;
1077
+ }
1078
+ get unmaskedValue() {
1079
+ return this.isUnmasking ? this.value : "";
1080
+ }
1081
+ get rawInputValue() {
1082
+ return this._isRawInput ? this.value : "";
1083
+ }
1084
+ get displayValue() {
1085
+ return this.value;
1086
+ }
1087
+ reset() {
1088
+ this._isRawInput = !1, this._value = "";
1089
+ }
1090
+ remove(e, t) {
1091
+ return e === void 0 && (e = 0), t === void 0 && (t = this._value.length), this._value = this._value.slice(0, e) + this._value.slice(t), this._value || (this._isRawInput = !1), new p();
1092
+ }
1093
+ nearestInputPos(e, t) {
1094
+ t === void 0 && (t = l.NONE);
1095
+ const s = 0, i = this._value.length;
1096
+ switch (t) {
1097
+ case l.LEFT:
1098
+ case l.FORCE_LEFT:
1099
+ return s;
1100
+ case l.NONE:
1101
+ case l.RIGHT:
1102
+ case l.FORCE_RIGHT:
1103
+ default:
1104
+ return i;
1105
+ }
1106
+ }
1107
+ totalInputPositions(e, t) {
1108
+ return e === void 0 && (e = 0), t === void 0 && (t = this._value.length), this._isRawInput ? t - e : 0;
1109
+ }
1110
+ extractInput(e, t, s) {
1111
+ return e === void 0 && (e = 0), t === void 0 && (t = this._value.length), s === void 0 && (s = {}), s.raw && this._isRawInput && this._value.slice(e, t) || "";
1112
+ }
1113
+ get isComplete() {
1114
+ return !0;
1115
+ }
1116
+ get isFilled() {
1117
+ return !!this._value;
1118
+ }
1119
+ _appendChar(e, t) {
1120
+ if (t === void 0 && (t = {}), this.isFilled)
1121
+ return new p();
1122
+ const s = this.eager === !0 || this.eager === "append", i = this.char === e && (this.isUnmasking || t.input || t.raw) && (!t.raw || !s) && !t.tail, a = new p({
1123
+ inserted: this.char,
1124
+ rawInserted: i ? this.char : ""
1125
+ });
1126
+ return this._value = this.char, this._isRawInput = i && (t.raw || t.input), a;
1127
+ }
1128
+ _appendEager() {
1129
+ return this._appendChar(this.char, {
1130
+ tail: !0
1131
+ });
1132
+ }
1133
+ _appendPlaceholder() {
1134
+ const e = new p();
1135
+ return this.isFilled || (this._value = e.inserted = this.char), e;
1136
+ }
1137
+ extractTail() {
1138
+ return new E("");
1139
+ }
1140
+ appendTail(e) {
1141
+ return F(e) && (e = new E(String(e))), e.appendTo(this);
1142
+ }
1143
+ append(e, t, s) {
1144
+ const i = this._appendChar(e[0], t);
1145
+ return s != null && (i.tailShift += this.appendTail(s).tailShift), i;
1146
+ }
1147
+ doCommit() {
1148
+ }
1149
+ get state() {
1150
+ return {
1151
+ _value: this._value,
1152
+ _rawInputValue: this.rawInputValue
1153
+ };
1154
+ }
1155
+ set state(e) {
1156
+ this._value = e._value, this._isRawInput = !!e._rawInputValue;
1157
+ }
1158
+ pad(e) {
1159
+ return this._appendPlaceholder();
1160
+ }
1161
+ }
1162
+ class b {
1163
+ /** */
1164
+ /** */
1165
+ /** */
1166
+ /** */
1167
+ /** */
1168
+ /** */
1169
+ /** */
1170
+ /** */
1171
+ constructor(e) {
1172
+ const {
1173
+ parent: t,
1174
+ isOptional: s,
1175
+ placeholderChar: i,
1176
+ displayChar: a,
1177
+ lazy: n,
1178
+ eager: r,
1179
+ ...h
1180
+ } = e;
1181
+ this.masked = A(h), Object.assign(this, {
1182
+ parent: t,
1183
+ isOptional: s,
1184
+ placeholderChar: i,
1185
+ displayChar: a,
1186
+ lazy: n,
1187
+ eager: r
1188
+ });
1189
+ }
1190
+ reset() {
1191
+ this.isFilled = !1, this.masked.reset();
1192
+ }
1193
+ remove(e, t) {
1194
+ return e === void 0 && (e = 0), t === void 0 && (t = this.value.length), e === 0 && t >= 1 ? (this.isFilled = !1, this.masked.remove(e, t)) : new p();
1195
+ }
1196
+ get value() {
1197
+ return this.masked.value || (this.isFilled && !this.isOptional ? this.placeholderChar : "");
1198
+ }
1199
+ get unmaskedValue() {
1200
+ return this.masked.unmaskedValue;
1201
+ }
1202
+ get rawInputValue() {
1203
+ return this.masked.rawInputValue;
1204
+ }
1205
+ get displayValue() {
1206
+ return this.masked.value && this.displayChar || this.value;
1207
+ }
1208
+ get isComplete() {
1209
+ return !!this.masked.value || this.isOptional;
1210
+ }
1211
+ _appendChar(e, t) {
1212
+ if (t === void 0 && (t = {}), this.isFilled)
1213
+ return new p();
1214
+ const s = this.masked.state;
1215
+ let i = this.masked._appendChar(e, this.currentMaskFlags(t));
1216
+ return i.inserted && this.doValidate(t) === !1 && (i = new p(), this.masked.state = s), !i.inserted && !this.isOptional && !this.lazy && !t.input && (i.inserted = this.placeholderChar), i.skip = !i.inserted && !this.isOptional, this.isFilled = !!i.inserted, i;
1217
+ }
1218
+ append(e, t, s) {
1219
+ return this.masked.append(e, this.currentMaskFlags(t), s);
1220
+ }
1221
+ _appendPlaceholder() {
1222
+ return this.isFilled || this.isOptional ? new p() : (this.isFilled = !0, new p({
1223
+ inserted: this.placeholderChar
1224
+ }));
1225
+ }
1226
+ _appendEager() {
1227
+ return new p();
1228
+ }
1229
+ extractTail(e, t) {
1230
+ return this.masked.extractTail(e, t);
1231
+ }
1232
+ appendTail(e) {
1233
+ return this.masked.appendTail(e);
1234
+ }
1235
+ extractInput(e, t, s) {
1236
+ return e === void 0 && (e = 0), t === void 0 && (t = this.value.length), this.masked.extractInput(e, t, s);
1237
+ }
1238
+ nearestInputPos(e, t) {
1239
+ t === void 0 && (t = l.NONE);
1240
+ const s = 0, i = this.value.length, a = Math.min(Math.max(e, s), i);
1241
+ switch (t) {
1242
+ case l.LEFT:
1243
+ case l.FORCE_LEFT:
1244
+ return this.isComplete ? a : s;
1245
+ case l.RIGHT:
1246
+ case l.FORCE_RIGHT:
1247
+ return this.isComplete ? a : i;
1248
+ case l.NONE:
1249
+ default:
1250
+ return a;
1251
+ }
1252
+ }
1253
+ totalInputPositions(e, t) {
1254
+ return e === void 0 && (e = 0), t === void 0 && (t = this.value.length), this.value.slice(e, t).length;
1255
+ }
1256
+ doValidate(e) {
1257
+ return this.masked.doValidate(this.currentMaskFlags(e)) && (!this.parent || this.parent.doValidate(this.currentMaskFlags(e)));
1258
+ }
1259
+ doCommit() {
1260
+ this.masked.doCommit();
1261
+ }
1262
+ get state() {
1263
+ return {
1264
+ _value: this.value,
1265
+ _rawInputValue: this.rawInputValue,
1266
+ masked: this.masked.state,
1267
+ isFilled: this.isFilled
1268
+ };
1269
+ }
1270
+ set state(e) {
1271
+ this.masked.state = e.masked, this.isFilled = e.isFilled;
1272
+ }
1273
+ currentMaskFlags(e) {
1274
+ var t;
1275
+ return {
1276
+ ...e,
1277
+ _beforeTailState: (e == null || (t = e._beforeTailState) == null ? void 0 : t.masked) || (e == null ? void 0 : e._beforeTailState)
1278
+ };
1279
+ }
1280
+ pad(e) {
1281
+ return new p();
1282
+ }
1283
+ }
1284
+ b.DEFAULT_DEFINITIONS = {
1285
+ 0: /\d/,
1286
+ 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]/,
1287
+ // http://stackoverflow.com/a/22075070
1288
+ "*": /./
1289
+ };
1290
+ class Q extends g {
1291
+ /** */
1292
+ /** Enable characters overwriting */
1293
+ /** */
1294
+ /** */
1295
+ /** */
1296
+ updateOptions(e) {
1297
+ super.updateOptions(e);
1298
+ }
1299
+ _update(e) {
1300
+ const t = e.mask;
1301
+ t && (e.validate = (s) => s.search(t) >= 0), super._update(e);
1302
+ }
1303
+ }
1304
+ d.MaskedRegExp = Q;
1305
+ class k extends g {
1306
+ /** */
1307
+ /** */
1308
+ /** Single char for empty input */
1309
+ /** Single char for filled input */
1310
+ /** Show placeholder only when needed */
1311
+ /** Enable characters overwriting */
1312
+ /** */
1313
+ /** */
1314
+ /** */
1315
+ constructor(e) {
1316
+ super({
1317
+ ...k.DEFAULTS,
1318
+ ...e,
1319
+ definitions: Object.assign({}, b.DEFAULT_DEFINITIONS, e == null ? void 0 : e.definitions)
1320
+ });
1321
+ }
1322
+ updateOptions(e) {
1323
+ super.updateOptions(e);
1324
+ }
1325
+ _update(e) {
1326
+ e.definitions = Object.assign({}, this.definitions, e.definitions), super._update(e), this._rebuildMask();
1327
+ }
1328
+ _rebuildMask() {
1329
+ const e = this.definitions;
1330
+ this._blocks = [], this.exposeBlock = void 0, this._stops = [], this._maskedBlocks = {};
1331
+ const t = this.mask;
1332
+ if (!t || !e)
1333
+ return;
1334
+ let s = !1, i = !1;
1335
+ for (let a = 0; a < t.length; ++a) {
1336
+ if (this.blocks) {
1337
+ const o = t.slice(a), c = Object.keys(this.blocks).filter((m) => o.indexOf(m) === 0);
1338
+ c.sort((m, S) => S.length - m.length);
1339
+ const f = c[0];
1340
+ if (f) {
1341
+ const {
1342
+ expose: m,
1343
+ repeat: S,
1344
+ ...K
1345
+ } = x(this.blocks[f]), O = {
1346
+ lazy: this.lazy,
1347
+ eager: this.eager,
1348
+ placeholderChar: this.placeholderChar,
1349
+ displayChar: this.displayChar,
1350
+ overwrite: this.overwrite,
1351
+ autofix: this.autofix,
1352
+ ...K,
1353
+ repeat: S,
1354
+ parent: this
1355
+ }, T = S != null ? new d.RepeatBlock(
1356
+ O
1357
+ /* TODO */
1358
+ ) : A(O);
1359
+ T && (this._blocks.push(T), m && (this.exposeBlock = T), this._maskedBlocks[f] || (this._maskedBlocks[f] = []), this._maskedBlocks[f].push(this._blocks.length - 1)), a += f.length - 1;
1360
+ continue;
1361
+ }
1362
+ }
1363
+ let n = t[a], r = n in e;
1364
+ if (n === k.STOP_CHAR) {
1365
+ this._stops.push(this._blocks.length);
1366
+ continue;
1367
+ }
1368
+ if (n === "{" || n === "}") {
1369
+ s = !s;
1370
+ continue;
1371
+ }
1372
+ if (n === "[" || n === "]") {
1373
+ i = !i;
1374
+ continue;
1375
+ }
1376
+ if (n === k.ESCAPE_CHAR) {
1377
+ if (++a, n = t[a], !n)
1378
+ break;
1379
+ r = !1;
1380
+ }
1381
+ const h = r ? new b({
1382
+ isOptional: i,
1383
+ lazy: this.lazy,
1384
+ eager: this.eager,
1385
+ placeholderChar: this.placeholderChar,
1386
+ displayChar: this.displayChar,
1387
+ ...x(e[n]),
1388
+ parent: this
1389
+ }) : new G({
1390
+ char: n,
1391
+ eager: this.eager,
1392
+ isUnmasking: s
1393
+ });
1394
+ this._blocks.push(h);
1395
+ }
1396
+ }
1397
+ get state() {
1398
+ return {
1399
+ ...super.state,
1400
+ _blocks: this._blocks.map((e) => e.state)
1401
+ };
1402
+ }
1403
+ set state(e) {
1404
+ if (!e) {
1405
+ this.reset();
1406
+ return;
1407
+ }
1408
+ const {
1409
+ _blocks: t,
1410
+ ...s
1411
+ } = e;
1412
+ this._blocks.forEach((i, a) => i.state = t[a]), super.state = s;
1413
+ }
1414
+ reset() {
1415
+ super.reset(), this._blocks.forEach((e) => e.reset());
1416
+ }
1417
+ get isComplete() {
1418
+ return this.exposeBlock ? this.exposeBlock.isComplete : this._blocks.every((e) => e.isComplete);
1419
+ }
1420
+ get isFilled() {
1421
+ return this._blocks.every((e) => e.isFilled);
1422
+ }
1423
+ get isFixed() {
1424
+ return this._blocks.every((e) => e.isFixed);
1425
+ }
1426
+ get isOptional() {
1427
+ return this._blocks.every((e) => e.isOptional);
1428
+ }
1429
+ doCommit() {
1430
+ this._blocks.forEach((e) => e.doCommit()), super.doCommit();
1431
+ }
1432
+ get unmaskedValue() {
1433
+ return this.exposeBlock ? this.exposeBlock.unmaskedValue : this._blocks.reduce((e, t) => e += t.unmaskedValue, "");
1434
+ }
1435
+ set unmaskedValue(e) {
1436
+ if (this.exposeBlock) {
1437
+ const t = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
1438
+ this.exposeBlock.unmaskedValue = e, this.appendTail(t), this.doCommit();
1439
+ } else
1440
+ super.unmaskedValue = e;
1441
+ }
1442
+ get value() {
1443
+ return this.exposeBlock ? this.exposeBlock.value : (
1444
+ // TODO return _value when not in change?
1445
+ this._blocks.reduce((e, t) => e += t.value, "")
1446
+ );
1447
+ }
1448
+ set value(e) {
1449
+ if (this.exposeBlock) {
1450
+ const t = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
1451
+ this.exposeBlock.value = e, this.appendTail(t), this.doCommit();
1452
+ } else
1453
+ super.value = e;
1454
+ }
1455
+ get typedValue() {
1456
+ return this.exposeBlock ? this.exposeBlock.typedValue : super.typedValue;
1457
+ }
1458
+ set typedValue(e) {
1459
+ if (this.exposeBlock) {
1460
+ const t = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
1461
+ this.exposeBlock.typedValue = e, this.appendTail(t), this.doCommit();
1462
+ } else
1463
+ super.typedValue = e;
1464
+ }
1465
+ get displayValue() {
1466
+ return this._blocks.reduce((e, t) => e += t.displayValue, "");
1467
+ }
1468
+ appendTail(e) {
1469
+ return super.appendTail(e).aggregate(this._appendPlaceholder());
1470
+ }
1471
+ _appendEager() {
1472
+ var e;
1473
+ const t = new p();
1474
+ let s = (e = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : e.index;
1475
+ if (s == null)
1476
+ return t;
1477
+ this._blocks[s].isFilled && ++s;
1478
+ for (let i = s; i < this._blocks.length; ++i) {
1479
+ const a = this._blocks[i]._appendEager();
1480
+ if (!a.inserted)
1481
+ break;
1482
+ t.aggregate(a);
1483
+ }
1484
+ return t;
1485
+ }
1486
+ _appendCharRaw(e, t) {
1487
+ t === void 0 && (t = {});
1488
+ const s = this._mapPosToBlock(this.displayValue.length), i = new p();
1489
+ if (!s)
1490
+ return i;
1491
+ for (let n = s.index, r; r = this._blocks[n]; ++n) {
1492
+ var a;
1493
+ const h = r._appendChar(e, {
1494
+ ...t,
1495
+ _beforeTailState: (a = t._beforeTailState) == null || (a = a._blocks) == null ? void 0 : a[n]
1496
+ });
1497
+ if (i.aggregate(h), h.consumed)
1498
+ break;
1499
+ }
1500
+ return i;
1501
+ }
1502
+ extractTail(e, t) {
1503
+ e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length);
1504
+ const s = new v();
1505
+ return e === t || this._forEachBlocksInRange(e, t, (i, a, n, r) => {
1506
+ const h = i.extractTail(n, r);
1507
+ h.stop = this._findStopBefore(a), h.from = this._blockStartPos(a), h instanceof v && (h.blockIndex = a), s.extend(h);
1508
+ }), s;
1509
+ }
1510
+ extractInput(e, t, s) {
1511
+ if (e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), s === void 0 && (s = {}), e === t)
1512
+ return "";
1513
+ let i = "";
1514
+ return this._forEachBlocksInRange(e, t, (a, n, r, h) => {
1515
+ i += a.extractInput(r, h, s);
1516
+ }), i;
1517
+ }
1518
+ _findStopBefore(e) {
1519
+ let t;
1520
+ for (let s = 0; s < this._stops.length; ++s) {
1521
+ const i = this._stops[s];
1522
+ if (i <= e)
1523
+ t = i;
1524
+ else
1525
+ break;
1526
+ }
1527
+ return t;
1528
+ }
1529
+ /** Appends placeholder depending on laziness */
1530
+ _appendPlaceholder(e) {
1531
+ const t = new p();
1532
+ if (this.lazy && e == null)
1533
+ return t;
1534
+ const s = this._mapPosToBlock(this.displayValue.length);
1535
+ if (!s)
1536
+ return t;
1537
+ const i = s.index, a = e ?? this._blocks.length;
1538
+ return this._blocks.slice(i, a).forEach((n) => {
1539
+ if (!n.lazy || e != null) {
1540
+ var r;
1541
+ t.aggregate(n._appendPlaceholder((r = n._blocks) == null ? void 0 : r.length));
1542
+ }
1543
+ }), t;
1544
+ }
1545
+ /** Finds block in pos */
1546
+ _mapPosToBlock(e) {
1547
+ let t = "";
1548
+ for (let s = 0; s < this._blocks.length; ++s) {
1549
+ const i = this._blocks[s], a = t.length;
1550
+ if (t += i.displayValue, e <= t.length)
1551
+ return {
1552
+ index: s,
1553
+ offset: e - a
1554
+ };
1555
+ }
1556
+ }
1557
+ _blockStartPos(e) {
1558
+ return this._blocks.slice(0, e).reduce((t, s) => t += s.displayValue.length, 0);
1559
+ }
1560
+ _forEachBlocksInRange(e, t, s) {
1561
+ t === void 0 && (t = this.displayValue.length);
1562
+ const i = this._mapPosToBlock(e);
1563
+ if (i) {
1564
+ const a = this._mapPosToBlock(t), n = a && i.index === a.index, r = i.offset, h = a && n ? a.offset : this._blocks[i.index].displayValue.length;
1565
+ if (s(this._blocks[i.index], i.index, r, h), a && !n) {
1566
+ for (let o = i.index + 1; o < a.index; ++o)
1567
+ s(this._blocks[o], o, 0, this._blocks[o].displayValue.length);
1568
+ s(this._blocks[a.index], a.index, 0, a.offset);
1569
+ }
1570
+ }
1571
+ }
1572
+ remove(e, t) {
1573
+ e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length);
1574
+ const s = super.remove(e, t);
1575
+ return this._forEachBlocksInRange(e, t, (i, a, n, r) => {
1576
+ s.aggregate(i.remove(n, r));
1577
+ }), s;
1578
+ }
1579
+ nearestInputPos(e, t) {
1580
+ if (t === void 0 && (t = l.NONE), !this._blocks.length)
1581
+ return 0;
1582
+ const s = new J(this, e);
1583
+ if (t === l.NONE)
1584
+ return s.pushRightBeforeInput() || (s.popState(), s.pushLeftBeforeInput()) ? s.pos : this.displayValue.length;
1585
+ if (t === l.LEFT || t === l.FORCE_LEFT) {
1586
+ if (t === l.LEFT) {
1587
+ if (s.pushRightBeforeFilled(), s.ok && s.pos === e)
1588
+ return e;
1589
+ s.popState();
1590
+ }
1591
+ if (s.pushLeftBeforeInput(), s.pushLeftBeforeRequired(), s.pushLeftBeforeFilled(), t === l.LEFT) {
1592
+ if (s.pushRightBeforeInput(), s.pushRightBeforeRequired(), s.ok && s.pos <= e || (s.popState(), s.ok && s.pos <= e))
1593
+ return s.pos;
1594
+ s.popState();
1595
+ }
1596
+ return s.ok ? s.pos : t === l.FORCE_LEFT ? 0 : (s.popState(), s.ok || (s.popState(), s.ok) ? s.pos : 0);
1597
+ }
1598
+ return t === l.RIGHT || t === l.FORCE_RIGHT ? (s.pushRightBeforeInput(), s.pushRightBeforeRequired(), s.pushRightBeforeFilled() ? s.pos : t === l.FORCE_RIGHT ? this.displayValue.length : (s.popState(), s.ok || (s.popState(), s.ok) ? s.pos : this.nearestInputPos(e, l.LEFT))) : e;
1599
+ }
1600
+ totalInputPositions(e, t) {
1601
+ e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length);
1602
+ let s = 0;
1603
+ return this._forEachBlocksInRange(e, t, (i, a, n, r) => {
1604
+ s += i.totalInputPositions(n, r);
1605
+ }), s;
1606
+ }
1607
+ /** Get block by name */
1608
+ maskedBlock(e) {
1609
+ return this.maskedBlocks(e)[0];
1610
+ }
1611
+ /** Get all blocks by name */
1612
+ maskedBlocks(e) {
1613
+ const t = this._maskedBlocks[e];
1614
+ return t ? t.map((s) => this._blocks[s]) : [];
1615
+ }
1616
+ pad(e) {
1617
+ const t = new p();
1618
+ return this._forEachBlocksInRange(0, this.displayValue.length, (s) => t.aggregate(s.pad(e))), t;
1619
+ }
1620
+ }
1621
+ k.DEFAULTS = {
1622
+ ...g.DEFAULTS,
1623
+ lazy: !0,
1624
+ placeholderChar: "_"
1625
+ };
1626
+ k.STOP_CHAR = "`";
1627
+ k.ESCAPE_CHAR = "\\";
1628
+ k.InputDefinition = b;
1629
+ k.FixedDefinition = G;
1630
+ d.MaskedPattern = k;
1631
+ class B extends k {
1632
+ /**
1633
+ Optionally sets max length of pattern.
1634
+ Used when pattern length is longer then `to` param length. Pads zeros at start in this case.
1635
+ */
1636
+ /** Min bound */
1637
+ /** Max bound */
1638
+ get _matchFrom() {
1639
+ return this.maxLength - String(this.from).length;
1640
+ }
1641
+ constructor(e) {
1642
+ super(e);
1643
+ }
1644
+ updateOptions(e) {
1645
+ super.updateOptions(e);
1646
+ }
1647
+ _update(e) {
1648
+ const {
1649
+ to: t = this.to || 0,
1650
+ from: s = this.from || 0,
1651
+ maxLength: i = this.maxLength || 0,
1652
+ autofix: a = this.autofix,
1653
+ ...n
1654
+ } = e;
1655
+ this.to = t, this.from = s, this.maxLength = Math.max(String(t).length, i), this.autofix = a;
1656
+ const r = String(this.from).padStart(this.maxLength, "0"), h = String(this.to).padStart(this.maxLength, "0");
1657
+ let o = 0;
1658
+ for (; o < h.length && h[o] === r[o]; )
1659
+ ++o;
1660
+ n.mask = h.slice(0, o).replace(/0/g, "\\0") + "0".repeat(this.maxLength - o), super._update(n);
1661
+ }
1662
+ get isComplete() {
1663
+ return super.isComplete && !!this.value;
1664
+ }
1665
+ boundaries(e) {
1666
+ let t = "", s = "";
1667
+ const [, i, a] = e.match(/^(\D*)(\d*)(\D*)/) || [];
1668
+ return a && (t = "0".repeat(i.length) + a, s = "9".repeat(i.length) + a), t = t.padEnd(this.maxLength, "0"), s = s.padEnd(this.maxLength, "9"), [t, s];
1669
+ }
1670
+ doPrepareChar(e, t) {
1671
+ t === void 0 && (t = {});
1672
+ let s;
1673
+ return [e, s] = super.doPrepareChar(e.replace(/\D/g, ""), t), e || (s.skip = !this.isComplete), [e, s];
1674
+ }
1675
+ _appendCharRaw(e, t) {
1676
+ if (t === void 0 && (t = {}), !this.autofix || this.value.length + 1 > this.maxLength)
1677
+ return super._appendCharRaw(e, t);
1678
+ const s = String(this.from).padStart(this.maxLength, "0"), i = String(this.to).padStart(this.maxLength, "0"), [a, n] = this.boundaries(this.value + e);
1679
+ return Number(n) < this.from ? super._appendCharRaw(s[this.value.length], t) : Number(a) > this.to ? !t.tail && this.autofix === "pad" && this.value.length + 1 < this.maxLength ? super._appendCharRaw(s[this.value.length], t).aggregate(this._appendCharRaw(e, t)) : super._appendCharRaw(i[this.value.length], t) : super._appendCharRaw(e, t);
1680
+ }
1681
+ doValidate(e) {
1682
+ const t = this.value;
1683
+ if (t.search(/[^0]/) === -1 && t.length <= this._matchFrom)
1684
+ return !0;
1685
+ const [s, i] = this.boundaries(t);
1686
+ return this.from <= Number(i) && Number(s) <= this.to && super.doValidate(e);
1687
+ }
1688
+ pad(e) {
1689
+ const t = new p();
1690
+ if (this.value.length === this.maxLength)
1691
+ return t;
1692
+ const s = this.value, i = this.maxLength - this.value.length;
1693
+ if (i) {
1694
+ this.reset();
1695
+ for (let a = 0; a < i; ++a)
1696
+ t.aggregate(super._appendCharRaw("0", e));
1697
+ s.split("").forEach((a) => this._appendCharRaw(a));
1698
+ }
1699
+ return t;
1700
+ }
1701
+ }
1702
+ d.MaskedRange = B;
1703
+ const ee = "d{.}`m{.}`Y";
1704
+ class C extends k {
1705
+ static extractPatternOptions(e) {
1706
+ const {
1707
+ mask: t,
1708
+ pattern: s,
1709
+ ...i
1710
+ } = e;
1711
+ return {
1712
+ ...i,
1713
+ mask: F(t) ? t : s
1714
+ };
1715
+ }
1716
+ /** Pattern mask for date according to {@link MaskedDate#format} */
1717
+ /** Start date */
1718
+ /** End date */
1719
+ /** Format typed value to string */
1720
+ /** Parse string to get typed value */
1721
+ constructor(e) {
1722
+ super(C.extractPatternOptions({
1723
+ ...C.DEFAULTS,
1724
+ ...e
1725
+ }));
1726
+ }
1727
+ updateOptions(e) {
1728
+ super.updateOptions(e);
1729
+ }
1730
+ _update(e) {
1731
+ const {
1732
+ mask: t,
1733
+ pattern: s,
1734
+ blocks: i,
1735
+ ...a
1736
+ } = {
1737
+ ...C.DEFAULTS,
1738
+ ...e
1739
+ }, n = Object.assign({}, C.GET_DEFAULT_BLOCKS());
1740
+ e.min && (n.Y.from = e.min.getFullYear()), e.max && (n.Y.to = e.max.getFullYear()), e.min && e.max && n.Y.from === n.Y.to && (n.m.from = e.min.getMonth() + 1, n.m.to = e.max.getMonth() + 1, n.m.from === n.m.to && (n.d.from = e.min.getDate(), n.d.to = e.max.getDate())), Object.assign(n, this.blocks, i), super._update({
1741
+ ...a,
1742
+ mask: F(t) ? t : s,
1743
+ blocks: n
1744
+ });
1745
+ }
1746
+ doValidate(e) {
1747
+ const t = this.date;
1748
+ return super.doValidate(e) && (!this.isComplete || this.isDateExist(this.value) && t != null && (this.min == null || this.min <= t) && (this.max == null || t <= this.max));
1749
+ }
1750
+ /** Checks if date is exists */
1751
+ isDateExist(e) {
1752
+ return this.format(this.parse(e, this), this).indexOf(e) >= 0;
1753
+ }
1754
+ /** Parsed Date */
1755
+ get date() {
1756
+ return this.typedValue;
1757
+ }
1758
+ set date(e) {
1759
+ this.typedValue = e;
1760
+ }
1761
+ get typedValue() {
1762
+ return this.isComplete ? super.typedValue : null;
1763
+ }
1764
+ set typedValue(e) {
1765
+ super.typedValue = e;
1766
+ }
1767
+ maskEquals(e) {
1768
+ return e === Date || super.maskEquals(e);
1769
+ }
1770
+ optionsIsChanged(e) {
1771
+ return super.optionsIsChanged(C.extractPatternOptions(e));
1772
+ }
1773
+ }
1774
+ C.GET_DEFAULT_BLOCKS = () => ({
1775
+ d: {
1776
+ mask: B,
1777
+ from: 1,
1778
+ to: 31,
1779
+ maxLength: 2
1780
+ },
1781
+ m: {
1782
+ mask: B,
1783
+ from: 1,
1784
+ to: 12,
1785
+ maxLength: 2
1786
+ },
1787
+ Y: {
1788
+ mask: B,
1789
+ from: 1900,
1790
+ to: 9999
1791
+ }
1792
+ });
1793
+ C.DEFAULTS = {
1794
+ ...k.DEFAULTS,
1795
+ mask: Date,
1796
+ pattern: ee,
1797
+ format: (u, e) => {
1798
+ if (!u)
1799
+ return "";
1800
+ const t = String(u.getDate()).padStart(2, "0"), s = String(u.getMonth() + 1).padStart(2, "0"), i = u.getFullYear();
1801
+ return [t, s, i].join(".");
1802
+ },
1803
+ parse: (u, e) => {
1804
+ const [t, s, i] = u.split(".").map(Number);
1805
+ return new Date(i, s - 1, t);
1806
+ }
1807
+ };
1808
+ d.MaskedDate = C;
1809
+ class M extends g {
1810
+ constructor(e) {
1811
+ super({
1812
+ ...M.DEFAULTS,
1813
+ ...e
1814
+ }), this.currentMask = void 0;
1815
+ }
1816
+ updateOptions(e) {
1817
+ super.updateOptions(e);
1818
+ }
1819
+ _update(e) {
1820
+ super._update(e), "mask" in e && (this.exposeMask = void 0, this.compiledMasks = Array.isArray(e.mask) ? e.mask.map((t) => {
1821
+ const {
1822
+ expose: s,
1823
+ ...i
1824
+ } = x(t), a = A({
1825
+ overwrite: this._overwrite,
1826
+ eager: this._eager,
1827
+ skipInvalid: this._skipInvalid,
1828
+ ...i
1829
+ });
1830
+ return s && (this.exposeMask = a), a;
1831
+ }) : []);
1832
+ }
1833
+ _appendCharRaw(e, t) {
1834
+ t === void 0 && (t = {});
1835
+ const s = this._applyDispatch(e, t);
1836
+ return this.currentMask && s.aggregate(this.currentMask._appendChar(e, this.currentMaskFlags(t))), s;
1837
+ }
1838
+ _applyDispatch(e, t, s) {
1839
+ e === void 0 && (e = ""), t === void 0 && (t = {}), s === void 0 && (s = "");
1840
+ const i = t.tail && t._beforeTailState != null ? t._beforeTailState._value : this.value, a = this.rawInputValue, n = t.tail && t._beforeTailState != null ? t._beforeTailState._rawInputValue : a, r = a.slice(n.length), h = this.currentMask, o = new p(), c = h == null ? void 0 : h.state;
1841
+ return this.currentMask = this.doDispatch(e, {
1842
+ ...t
1843
+ }, s), this.currentMask && (this.currentMask !== h ? (this.currentMask.reset(), n && (this.currentMask.append(n, {
1844
+ raw: !0
1845
+ }), o.tailShift = this.currentMask.value.length - i.length), r && (o.tailShift += this.currentMask.append(r, {
1846
+ raw: !0,
1847
+ tail: !0
1848
+ }).tailShift)) : c && (this.currentMask.state = c)), o;
1849
+ }
1850
+ _appendPlaceholder() {
1851
+ const e = this._applyDispatch();
1852
+ return this.currentMask && e.aggregate(this.currentMask._appendPlaceholder()), e;
1853
+ }
1854
+ _appendEager() {
1855
+ const e = this._applyDispatch();
1856
+ return this.currentMask && e.aggregate(this.currentMask._appendEager()), e;
1857
+ }
1858
+ appendTail(e) {
1859
+ const t = new p();
1860
+ return e && t.aggregate(this._applyDispatch("", {}, e)), t.aggregate(this.currentMask ? this.currentMask.appendTail(e) : super.appendTail(e));
1861
+ }
1862
+ currentMaskFlags(e) {
1863
+ var t, s;
1864
+ return {
1865
+ ...e,
1866
+ _beforeTailState: ((t = e._beforeTailState) == null ? void 0 : t.currentMaskRef) === this.currentMask && ((s = e._beforeTailState) == null ? void 0 : s.currentMask) || e._beforeTailState
1867
+ };
1868
+ }
1869
+ doDispatch(e, t, s) {
1870
+ return t === void 0 && (t = {}), s === void 0 && (s = ""), this.dispatch(e, this, t, s);
1871
+ }
1872
+ doValidate(e) {
1873
+ return super.doValidate(e) && (!this.currentMask || this.currentMask.doValidate(this.currentMaskFlags(e)));
1874
+ }
1875
+ doPrepare(e, t) {
1876
+ t === void 0 && (t = {});
1877
+ let [s, i] = super.doPrepare(e, t);
1878
+ if (this.currentMask) {
1879
+ let a;
1880
+ [s, a] = super.doPrepare(s, this.currentMaskFlags(t)), i = i.aggregate(a);
1881
+ }
1882
+ return [s, i];
1883
+ }
1884
+ doPrepareChar(e, t) {
1885
+ t === void 0 && (t = {});
1886
+ let [s, i] = super.doPrepareChar(e, t);
1887
+ if (this.currentMask) {
1888
+ let a;
1889
+ [s, a] = super.doPrepareChar(s, this.currentMaskFlags(t)), i = i.aggregate(a);
1890
+ }
1891
+ return [s, i];
1892
+ }
1893
+ reset() {
1894
+ var e;
1895
+ (e = this.currentMask) == null || e.reset(), this.compiledMasks.forEach((t) => t.reset());
1896
+ }
1897
+ get value() {
1898
+ return this.exposeMask ? this.exposeMask.value : this.currentMask ? this.currentMask.value : "";
1899
+ }
1900
+ set value(e) {
1901
+ this.exposeMask ? (this.exposeMask.value = e, this.currentMask = this.exposeMask, this._applyDispatch()) : super.value = e;
1902
+ }
1903
+ get unmaskedValue() {
1904
+ return this.exposeMask ? this.exposeMask.unmaskedValue : this.currentMask ? this.currentMask.unmaskedValue : "";
1905
+ }
1906
+ set unmaskedValue(e) {
1907
+ this.exposeMask ? (this.exposeMask.unmaskedValue = e, this.currentMask = this.exposeMask, this._applyDispatch()) : super.unmaskedValue = e;
1908
+ }
1909
+ get typedValue() {
1910
+ return this.exposeMask ? this.exposeMask.typedValue : this.currentMask ? this.currentMask.typedValue : "";
1911
+ }
1912
+ set typedValue(e) {
1913
+ if (this.exposeMask) {
1914
+ this.exposeMask.typedValue = e, this.currentMask = this.exposeMask, this._applyDispatch();
1915
+ return;
1916
+ }
1917
+ let t = String(e);
1918
+ this.currentMask && (this.currentMask.typedValue = e, t = this.currentMask.unmaskedValue), this.unmaskedValue = t;
1919
+ }
1920
+ get displayValue() {
1921
+ return this.currentMask ? this.currentMask.displayValue : "";
1922
+ }
1923
+ get isComplete() {
1924
+ var e;
1925
+ return !!((e = this.currentMask) != null && e.isComplete);
1926
+ }
1927
+ get isFilled() {
1928
+ var e;
1929
+ return !!((e = this.currentMask) != null && e.isFilled);
1930
+ }
1931
+ remove(e, t) {
1932
+ const s = new p();
1933
+ return this.currentMask && s.aggregate(this.currentMask.remove(e, t)).aggregate(this._applyDispatch()), s;
1934
+ }
1935
+ get state() {
1936
+ var e;
1937
+ return {
1938
+ ...super.state,
1939
+ _rawInputValue: this.rawInputValue,
1940
+ compiledMasks: this.compiledMasks.map((t) => t.state),
1941
+ currentMaskRef: this.currentMask,
1942
+ currentMask: (e = this.currentMask) == null ? void 0 : e.state
1943
+ };
1944
+ }
1945
+ set state(e) {
1946
+ const {
1947
+ compiledMasks: t,
1948
+ currentMaskRef: s,
1949
+ currentMask: i,
1950
+ ...a
1951
+ } = e;
1952
+ t && this.compiledMasks.forEach((n, r) => n.state = t[r]), s != null && (this.currentMask = s, this.currentMask.state = i), super.state = a;
1953
+ }
1954
+ extractInput(e, t, s) {
1955
+ return this.currentMask ? this.currentMask.extractInput(e, t, s) : "";
1956
+ }
1957
+ extractTail(e, t) {
1958
+ return this.currentMask ? this.currentMask.extractTail(e, t) : super.extractTail(e, t);
1959
+ }
1960
+ doCommit() {
1961
+ this.currentMask && this.currentMask.doCommit(), super.doCommit();
1962
+ }
1963
+ nearestInputPos(e, t) {
1964
+ return this.currentMask ? this.currentMask.nearestInputPos(e, t) : super.nearestInputPos(e, t);
1965
+ }
1966
+ get overwrite() {
1967
+ return this.currentMask ? this.currentMask.overwrite : this._overwrite;
1968
+ }
1969
+ set overwrite(e) {
1970
+ this._overwrite = e;
1971
+ }
1972
+ get eager() {
1973
+ return this.currentMask ? this.currentMask.eager : this._eager;
1974
+ }
1975
+ set eager(e) {
1976
+ this._eager = e;
1977
+ }
1978
+ get skipInvalid() {
1979
+ return this.currentMask ? this.currentMask.skipInvalid : this._skipInvalid;
1980
+ }
1981
+ set skipInvalid(e) {
1982
+ this._skipInvalid = e;
1983
+ }
1984
+ get autofix() {
1985
+ return this.currentMask ? this.currentMask.autofix : this._autofix;
1986
+ }
1987
+ set autofix(e) {
1988
+ this._autofix = e;
1989
+ }
1990
+ maskEquals(e) {
1991
+ return Array.isArray(e) ? this.compiledMasks.every((t, s) => {
1992
+ if (!e[s])
1993
+ return;
1994
+ const {
1995
+ mask: i,
1996
+ ...a
1997
+ } = e[s];
1998
+ return D(t, a) && t.maskEquals(i);
1999
+ }) : super.maskEquals(e);
2000
+ }
2001
+ typedValueEquals(e) {
2002
+ var t;
2003
+ return !!((t = this.currentMask) != null && t.typedValueEquals(e));
2004
+ }
2005
+ }
2006
+ M.DEFAULTS = {
2007
+ ...g.DEFAULTS,
2008
+ dispatch: (u, e, t, s) => {
2009
+ if (!e.compiledMasks.length)
2010
+ return;
2011
+ const i = e.rawInputValue, a = e.compiledMasks.map((n, r) => {
2012
+ const h = e.currentMask === n, o = h ? n.displayValue.length : n.nearestInputPos(n.displayValue.length, l.FORCE_LEFT);
2013
+ return n.rawInputValue !== i ? (n.reset(), n.append(i, {
2014
+ raw: !0
2015
+ })) : h || n.remove(o), n.append(u, e.currentMaskFlags(t)), n.appendTail(s), {
2016
+ index: r,
2017
+ weight: n.rawInputValue.length,
2018
+ totalInputPositions: n.totalInputPositions(0, Math.max(o, n.nearestInputPos(n.displayValue.length, l.FORCE_LEFT)))
2019
+ };
2020
+ });
2021
+ return a.sort((n, r) => r.weight - n.weight || r.totalInputPositions - n.totalInputPositions), e.compiledMasks[a[0].index];
2022
+ }
2023
+ };
2024
+ d.MaskedDynamic = M;
2025
+ class V extends k {
2026
+ constructor(e) {
2027
+ super({
2028
+ ...V.DEFAULTS,
2029
+ ...e
2030
+ });
2031
+ }
2032
+ updateOptions(e) {
2033
+ super.updateOptions(e);
2034
+ }
2035
+ _update(e) {
2036
+ const {
2037
+ enum: t,
2038
+ ...s
2039
+ } = e;
2040
+ if (t) {
2041
+ const i = t.map((r) => r.length), a = Math.min(...i), n = Math.max(...i) - a;
2042
+ s.mask = "*".repeat(a), n && (s.mask += "[" + "*".repeat(n) + "]"), this.enum = t;
2043
+ }
2044
+ super._update(s);
2045
+ }
2046
+ _appendCharRaw(e, t) {
2047
+ t === void 0 && (t = {});
2048
+ const s = Math.min(this.nearestInputPos(0, l.FORCE_RIGHT), this.value.length), i = this.enum.filter((a) => this.matchValue(a, this.unmaskedValue + e, s));
2049
+ if (i.length) {
2050
+ i.length === 1 && this._forEachBlocksInRange(0, this.value.length, (n, r) => {
2051
+ const h = i[0][r];
2052
+ r >= this.value.length || h === n.value || (n.reset(), n._appendChar(h, t));
2053
+ });
2054
+ const a = super._appendCharRaw(i[0][this.value.length], t);
2055
+ return i.length === 1 && i[0].slice(this.unmaskedValue.length).split("").forEach((n) => a.aggregate(super._appendCharRaw(n))), a;
2056
+ }
2057
+ return new p({
2058
+ skip: !this.isComplete
2059
+ });
2060
+ }
2061
+ extractTail(e, t) {
2062
+ return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), new E("", e);
2063
+ }
2064
+ remove(e, t) {
2065
+ if (e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), e === t)
2066
+ return new p();
2067
+ const s = Math.min(super.nearestInputPos(0, l.FORCE_RIGHT), this.value.length);
2068
+ let i;
2069
+ for (i = e; i >= 0 && !(this.enum.filter((n) => this.matchValue(n, this.value.slice(s, i), s)).length > 1); --i)
2070
+ ;
2071
+ const a = super.remove(i, t);
2072
+ return a.tailShift += i - e, a;
2073
+ }
2074
+ get isComplete() {
2075
+ return this.enum.indexOf(this.value) >= 0;
2076
+ }
2077
+ }
2078
+ V.DEFAULTS = {
2079
+ ...k.DEFAULTS,
2080
+ matchValue: (u, e, t) => u.indexOf(e, t) === t
2081
+ };
2082
+ d.MaskedEnum = V;
2083
+ class te extends g {
2084
+ /** */
2085
+ /** Enable characters overwriting */
2086
+ /** */
2087
+ /** */
2088
+ /** */
2089
+ updateOptions(e) {
2090
+ super.updateOptions(e);
2091
+ }
2092
+ _update(e) {
2093
+ super._update({
2094
+ ...e,
2095
+ validate: e.mask
2096
+ });
2097
+ }
2098
+ }
2099
+ d.MaskedFunction = te;
2100
+ var z;
2101
+ class _ extends g {
2102
+ /** Single char */
2103
+ /** Single char */
2104
+ /** Array of single chars */
2105
+ /** */
2106
+ /** */
2107
+ /** Digits after point */
2108
+ /** Flag to remove leading and trailing zeros in the end of editing */
2109
+ /** Flag to pad trailing zeros after point in the end of editing */
2110
+ /** Enable characters overwriting */
2111
+ /** */
2112
+ /** */
2113
+ /** */
2114
+ /** Format typed value to string */
2115
+ /** Parse string to get typed value */
2116
+ constructor(e) {
2117
+ super({
2118
+ ..._.DEFAULTS,
2119
+ ...e
2120
+ });
2121
+ }
2122
+ updateOptions(e) {
2123
+ super.updateOptions(e);
2124
+ }
2125
+ _update(e) {
2126
+ super._update(e), this._updateRegExps();
2127
+ }
2128
+ _updateRegExps() {
2129
+ const e = "^" + (this.allowNegative ? "[+|\\-]?" : ""), t = "\\d*", s = (this.scale ? "(" + w(this.radix) + "\\d{0," + this.scale + "})?" : "") + "$";
2130
+ this._numberRegExp = new RegExp(e + t + s), this._mapToRadixRegExp = new RegExp("[" + this.mapToRadix.map(w).join("") + "]", "g"), this._thousandsSeparatorRegExp = new RegExp(w(this.thousandsSeparator), "g");
2131
+ }
2132
+ _removeThousandsSeparators(e) {
2133
+ return e.replace(this._thousandsSeparatorRegExp, "");
2134
+ }
2135
+ _insertThousandsSeparators(e) {
2136
+ const t = e.split(this.radix);
2137
+ return t[0] = t[0].replace(/\B(?=(\d{3})+(?!\d))/g, this.thousandsSeparator), t.join(this.radix);
2138
+ }
2139
+ doPrepareChar(e, t) {
2140
+ t === void 0 && (t = {});
2141
+ const [s, i] = super.doPrepareChar(this._removeThousandsSeparators(this.scale && this.mapToRadix.length && /*
2142
+ radix should be mapped when
2143
+ 1) input is done from keyboard = flags.input && flags.raw
2144
+ 2) unmasked value is set = !flags.input && !flags.raw
2145
+ and should not be mapped when
2146
+ 1) value is set = flags.input && !flags.raw
2147
+ 2) raw value is set = !flags.input && flags.raw
2148
+ */
2149
+ (t.input && t.raw || !t.input && !t.raw) ? e.replace(this._mapToRadixRegExp, this.radix) : e), t);
2150
+ return e && !s && (i.skip = !0), s && !this.allowPositive && !this.value && s !== "-" && i.aggregate(this._appendChar("-")), [s, i];
2151
+ }
2152
+ _separatorsCount(e, t) {
2153
+ t === void 0 && (t = !1);
2154
+ let s = 0;
2155
+ for (let i = 0; i < e; ++i)
2156
+ this._value.indexOf(this.thousandsSeparator, i) === i && (++s, t && (e += this.thousandsSeparator.length));
2157
+ return s;
2158
+ }
2159
+ _separatorsCountFromSlice(e) {
2160
+ return e === void 0 && (e = this._value), this._separatorsCount(this._removeThousandsSeparators(e).length, !0);
2161
+ }
2162
+ extractInput(e, t, s) {
2163
+ return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), [e, t] = this._adjustRangeWithSeparators(e, t), this._removeThousandsSeparators(super.extractInput(e, t, s));
2164
+ }
2165
+ _appendCharRaw(e, t) {
2166
+ t === void 0 && (t = {});
2167
+ const s = t.tail && t._beforeTailState ? t._beforeTailState._value : this._value, i = this._separatorsCountFromSlice(s);
2168
+ this._value = this._removeThousandsSeparators(this.value);
2169
+ const a = this._value;
2170
+ this._value += e;
2171
+ const n = this.number;
2172
+ let r = !isNaN(n), h = !1;
2173
+ if (r) {
2174
+ let m;
2175
+ this.min != null && this.min < 0 && this.number < this.min && (m = this.min), this.max != null && this.max > 0 && this.number > this.max && (m = this.max), m != null && (this.autofix ? (this._value = this.format(m, this).replace(_.UNMASKED_RADIX, this.radix), h || (h = a === this._value && !t.tail)) : r = !1), r && (r = !!this._value.match(this._numberRegExp));
2176
+ }
2177
+ let o;
2178
+ r ? o = new p({
2179
+ inserted: this._value.slice(a.length),
2180
+ rawInserted: h ? "" : e,
2181
+ skip: h
2182
+ }) : (this._value = a, o = new p()), this._value = this._insertThousandsSeparators(this._value);
2183
+ const c = t.tail && t._beforeTailState ? t._beforeTailState._value : this._value, f = this._separatorsCountFromSlice(c);
2184
+ return o.tailShift += (f - i) * this.thousandsSeparator.length, o;
2185
+ }
2186
+ _findSeparatorAround(e) {
2187
+ if (this.thousandsSeparator) {
2188
+ const t = e - this.thousandsSeparator.length + 1, s = this.value.indexOf(this.thousandsSeparator, t);
2189
+ if (s <= e)
2190
+ return s;
2191
+ }
2192
+ return -1;
2193
+ }
2194
+ _adjustRangeWithSeparators(e, t) {
2195
+ const s = this._findSeparatorAround(e);
2196
+ s >= 0 && (e = s);
2197
+ const i = this._findSeparatorAround(t);
2198
+ return i >= 0 && (t = i + this.thousandsSeparator.length), [e, t];
2199
+ }
2200
+ remove(e, t) {
2201
+ e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), [e, t] = this._adjustRangeWithSeparators(e, t);
2202
+ const s = this.value.slice(0, e), i = this.value.slice(t), a = this._separatorsCount(s.length);
2203
+ this._value = this._insertThousandsSeparators(this._removeThousandsSeparators(s + i));
2204
+ const n = this._separatorsCountFromSlice(s);
2205
+ return new p({
2206
+ tailShift: (n - a) * this.thousandsSeparator.length
2207
+ });
2208
+ }
2209
+ nearestInputPos(e, t) {
2210
+ if (!this.thousandsSeparator)
2211
+ return e;
2212
+ switch (t) {
2213
+ case l.NONE:
2214
+ case l.LEFT:
2215
+ case l.FORCE_LEFT: {
2216
+ const s = this._findSeparatorAround(e - 1);
2217
+ if (s >= 0) {
2218
+ const i = s + this.thousandsSeparator.length;
2219
+ if (e < i || this.value.length <= i || t === l.FORCE_LEFT)
2220
+ return s;
2221
+ }
2222
+ break;
2223
+ }
2224
+ case l.RIGHT:
2225
+ case l.FORCE_RIGHT: {
2226
+ const s = this._findSeparatorAround(e);
2227
+ if (s >= 0)
2228
+ return s + this.thousandsSeparator.length;
2229
+ }
2230
+ }
2231
+ return e;
2232
+ }
2233
+ doCommit() {
2234
+ if (this.value) {
2235
+ const e = this.number;
2236
+ let t = e;
2237
+ this.min != null && (t = Math.max(t, this.min)), this.max != null && (t = Math.min(t, this.max)), t !== e && (this.unmaskedValue = this.format(t, this));
2238
+ let s = this.value;
2239
+ this.normalizeZeros && (s = this._normalizeZeros(s)), this.padFractionalZeros && this.scale > 0 && (s = this._padFractionalZeros(s)), this._value = s;
2240
+ }
2241
+ super.doCommit();
2242
+ }
2243
+ _normalizeZeros(e) {
2244
+ const t = this._removeThousandsSeparators(e).split(this.radix);
2245
+ return t[0] = t[0].replace(/^(\D*)(0*)(\d*)/, (s, i, a, n) => i + n), e.length && !/\d$/.test(t[0]) && (t[0] = t[0] + "0"), t.length > 1 && (t[1] = t[1].replace(/0*$/, ""), t[1].length || (t.length = 1)), this._insertThousandsSeparators(t.join(this.radix));
2246
+ }
2247
+ _padFractionalZeros(e) {
2248
+ if (!e)
2249
+ return e;
2250
+ const t = e.split(this.radix);
2251
+ return t.length < 2 && t.push(""), t[1] = t[1].padEnd(this.scale, "0"), t.join(this.radix);
2252
+ }
2253
+ doSkipInvalid(e, t, s) {
2254
+ t === void 0 && (t = {});
2255
+ const i = this.scale === 0 && e !== this.thousandsSeparator && (e === this.radix || e === _.UNMASKED_RADIX || this.mapToRadix.includes(e));
2256
+ return super.doSkipInvalid(e, t, s) && !i;
2257
+ }
2258
+ get unmaskedValue() {
2259
+ return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix, _.UNMASKED_RADIX);
2260
+ }
2261
+ set unmaskedValue(e) {
2262
+ super.unmaskedValue = e;
2263
+ }
2264
+ get typedValue() {
2265
+ return this.parse(this.unmaskedValue, this);
2266
+ }
2267
+ set typedValue(e) {
2268
+ this.rawInputValue = this.format(e, this).replace(_.UNMASKED_RADIX, this.radix);
2269
+ }
2270
+ /** Parsed Number */
2271
+ get number() {
2272
+ return this.typedValue;
2273
+ }
2274
+ set number(e) {
2275
+ this.typedValue = e;
2276
+ }
2277
+ get allowNegative() {
2278
+ return this.min != null && this.min < 0 || this.max != null && this.max < 0;
2279
+ }
2280
+ get allowPositive() {
2281
+ return this.min != null && this.min > 0 || this.max != null && this.max > 0;
2282
+ }
2283
+ typedValueEquals(e) {
2284
+ return (super.typedValueEquals(e) || _.EMPTY_VALUES.includes(e) && _.EMPTY_VALUES.includes(this.typedValue)) && !(e === 0 && this.value === "");
2285
+ }
2286
+ }
2287
+ z = _;
2288
+ _.UNMASKED_RADIX = ".";
2289
+ _.EMPTY_VALUES = [...g.EMPTY_VALUES, 0];
2290
+ _.DEFAULTS = {
2291
+ ...g.DEFAULTS,
2292
+ mask: Number,
2293
+ radix: ",",
2294
+ thousandsSeparator: "",
2295
+ mapToRadix: [z.UNMASKED_RADIX],
2296
+ min: Number.MIN_SAFE_INTEGER,
2297
+ max: Number.MAX_SAFE_INTEGER,
2298
+ scale: 2,
2299
+ normalizeZeros: !0,
2300
+ padFractionalZeros: !1,
2301
+ parse: Number,
2302
+ format: (u) => u.toLocaleString("en-US", {
2303
+ useGrouping: !1,
2304
+ maximumFractionDigits: 20
2305
+ })
2306
+ };
2307
+ d.MaskedNumber = _;
2308
+ const R = {
2309
+ MASKED: "value",
2310
+ UNMASKED: "unmaskedValue",
2311
+ TYPED: "typedValue"
2312
+ };
2313
+ function q(u, e, t) {
2314
+ e === void 0 && (e = R.MASKED), t === void 0 && (t = R.MASKED);
2315
+ const s = A(u);
2316
+ return (i) => s.runIsolated((a) => (a[e] = i, a[t]));
2317
+ }
2318
+ function se(u, e, t, s) {
2319
+ return q(e, t, s)(u);
2320
+ }
2321
+ d.PIPE_TYPE = R;
2322
+ d.createPipe = q;
2323
+ d.pipe = se;
2324
+ class ie extends k {
2325
+ get repeatFrom() {
2326
+ var e;
2327
+ return (e = Array.isArray(this.repeat) ? this.repeat[0] : this.repeat === 1 / 0 ? 0 : this.repeat) != null ? e : 0;
2328
+ }
2329
+ get repeatTo() {
2330
+ var e;
2331
+ return (e = Array.isArray(this.repeat) ? this.repeat[1] : this.repeat) != null ? e : 1 / 0;
2332
+ }
2333
+ constructor(e) {
2334
+ super(e);
2335
+ }
2336
+ updateOptions(e) {
2337
+ super.updateOptions(e);
2338
+ }
2339
+ _update(e) {
2340
+ var t, s, i;
2341
+ const {
2342
+ repeat: a,
2343
+ ...n
2344
+ } = x(e);
2345
+ this._blockOpts = Object.assign({}, this._blockOpts, n);
2346
+ const r = A(this._blockOpts);
2347
+ this.repeat = (t = (s = a ?? r.repeat) != null ? s : this.repeat) != null ? t : 1 / 0, super._update({
2348
+ mask: "m".repeat(Math.max(this.repeatTo === 1 / 0 && ((i = this._blocks) == null ? void 0 : i.length) || 0, this.repeatFrom)),
2349
+ blocks: {
2350
+ m: r
2351
+ },
2352
+ eager: r.eager,
2353
+ overwrite: r.overwrite,
2354
+ skipInvalid: r.skipInvalid,
2355
+ lazy: r.lazy,
2356
+ placeholderChar: r.placeholderChar,
2357
+ displayChar: r.displayChar
2358
+ });
2359
+ }
2360
+ _allocateBlock(e) {
2361
+ if (e < this._blocks.length)
2362
+ return this._blocks[e];
2363
+ if (this.repeatTo === 1 / 0 || this._blocks.length < this.repeatTo)
2364
+ return this._blocks.push(A(this._blockOpts)), this.mask += "m", this._blocks[this._blocks.length - 1];
2365
+ }
2366
+ _appendCharRaw(e, t) {
2367
+ t === void 0 && (t = {});
2368
+ const s = new p();
2369
+ for (
2370
+ let h = (i = (a = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : a.index) != null ? i : Math.max(this._blocks.length - 1, 0), o, c;
2371
+ // try to get a block or
2372
+ // try to allocate a new block if not allocated already
2373
+ o = (n = this._blocks[h]) != null ? n : c = !c && this._allocateBlock(h);
2374
+ ++h
2375
+ ) {
2376
+ var i, a, n, r;
2377
+ const f = o._appendChar(e, {
2378
+ ...t,
2379
+ _beforeTailState: (r = t._beforeTailState) == null || (r = r._blocks) == null ? void 0 : r[h]
2380
+ });
2381
+ if (f.skip && c) {
2382
+ this._blocks.pop(), this.mask = this.mask.slice(1);
2383
+ break;
2384
+ }
2385
+ if (s.aggregate(f), f.consumed)
2386
+ break;
2387
+ }
2388
+ return s;
2389
+ }
2390
+ _trimEmptyTail(e, t) {
2391
+ var s, i;
2392
+ e === void 0 && (e = 0);
2393
+ const a = Math.max(((s = this._mapPosToBlock(e)) == null ? void 0 : s.index) || 0, this.repeatFrom, 0);
2394
+ let n;
2395
+ t != null && (n = (i = this._mapPosToBlock(t)) == null ? void 0 : i.index), n == null && (n = this._blocks.length - 1);
2396
+ let r = 0;
2397
+ for (let h = n; a <= h && !this._blocks[h].unmaskedValue; --h, ++r)
2398
+ ;
2399
+ r && (this._blocks.splice(n - r + 1, r), this.mask = this.mask.slice(r));
2400
+ }
2401
+ reset() {
2402
+ super.reset(), this._trimEmptyTail();
2403
+ }
2404
+ remove(e, t) {
2405
+ e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length);
2406
+ const s = super.remove(e, t);
2407
+ return this._trimEmptyTail(e, t), s;
2408
+ }
2409
+ totalInputPositions(e, t) {
2410
+ return e === void 0 && (e = 0), t == null && this.repeatTo === 1 / 0 ? 1 / 0 : super.totalInputPositions(e, t);
2411
+ }
2412
+ get state() {
2413
+ return super.state;
2414
+ }
2415
+ set state(e) {
2416
+ this._blocks.length = e._blocks.length, this.mask = this.mask.slice(0, this._blocks.length), super.state = e;
2417
+ }
2418
+ }
2419
+ d.RepeatBlock = ie;
2420
+ try {
2421
+ globalThis.IMask = d;
2422
+ } catch {
2423
+ }
2424
+ export {
2425
+ p as ChangeDetails,
2426
+ v as ChunksTailDetails,
2427
+ l as DIRECTION,
2428
+ j as HTMLContenteditableMaskElement,
2429
+ $ as HTMLInputMaskElement,
2430
+ y as HTMLMaskElement,
2431
+ W as InputMask,
2432
+ P as MaskElement,
2433
+ g as Masked,
2434
+ C as MaskedDate,
2435
+ M as MaskedDynamic,
2436
+ V as MaskedEnum,
2437
+ te as MaskedFunction,
2438
+ _ as MaskedNumber,
2439
+ k as MaskedPattern,
2440
+ B as MaskedRange,
2441
+ Q as MaskedRegExp,
2442
+ R as PIPE_TYPE,
2443
+ G as PatternFixedDefinition,
2444
+ b as PatternInputDefinition,
2445
+ ie as RepeatBlock,
2446
+ A as createMask,
2447
+ q as createPipe,
2448
+ d as default,
2449
+ Y as forceDirection,
2450
+ x as normalizeOpts,
2451
+ se as pipe
2452
+ };