@phila/phila-ui-date-field 0.0.6 → 0.0.7-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,22 +1,3400 @@
1
- import { defineComponent as a, computed as n, createElementBlock as r, openBlock as l, normalizeClass as m } from "vue";
2
- import { cn as p } from "@phila/phila-ui-core";
3
- import './index.css';const _ = /* @__PURE__ */ a({
4
- __name: "DateField",
1
+ import { defineComponent as ve, toRef as Ae, watch as ue, h as ut, useAttrs as Je, computed as Y, ref as G, createElementBlock as U, openBlock as V, normalizeClass as ze, createCommentVNode as pe, createElementVNode as H, toDisplayString as Z, withModifiers as re, createBlock as se, renderSlot as me, unref as D, withDirectives as lt, mergeProps as Q, vModelDynamic as ot, createVNode as ge, createTextVNode as Fe, isRef as ht, readonly as dt, onMounted as ct, onUnmounted as pt, withCtx as le, normalizeProps as _e, guardReactiveProps as Ce, Fragment as Me, renderList as Be, nextTick as Ke, useTemplateRef as ft, withKeys as mt } from "vue";
2
+ import { cn as be, Icon as Ue, BaseLink as Qe, ActionContent as Te, useCollapse as gt, generateRandomId as vt } from "@phila/phila-ui-core";
3
+ import './index.css';const kt = ["disabled"], _t = /* @__PURE__ */ ve({
4
+ inheritAttrs: !1,
5
+ __name: "PhlButton",
5
6
  props: {
6
- className: {}
7
- },
8
- setup(e, { emit: s }) {
9
- const t = e, o = n(() => p("default-class", t.className));
10
- return (c, d) => (l(), r("span", {
11
- class: m(o.value)
12
- }, " Hello world! I am DateField ", 2));
13
- }
14
- }), i = (e, s) => {
15
- const t = e.__vccOpts || e;
16
- for (const [o, c] of s)
17
- t[o] = c;
7
+ href: {},
8
+ to: {},
9
+ target: {},
10
+ rel: {},
11
+ disabled: { type: Boolean, default: !1 },
12
+ clickTarget: {},
13
+ variant: { default: "primary" },
14
+ size: { default: "medium" },
15
+ iconOnly: { type: Boolean, default: !1 },
16
+ iconRight: { type: Boolean },
17
+ text: {},
18
+ className: {},
19
+ iconDefinition: {},
20
+ iconClass: {},
21
+ src: {},
22
+ svgRaw: {}
23
+ },
24
+ setup(r) {
25
+ const e = r, t = (n) => "href" in n && n.href !== void 0 || "to" in n && n.to !== void 0, s = Y(() => be(
26
+ "phila-button",
27
+ `phila-button--${e.variant}`,
28
+ e.size && `is-${e.size}`,
29
+ e.iconOnly && "icon-button",
30
+ e.iconOnly && e.variant === "standard" && "icon-button--standard",
31
+ e.className
32
+ )), a = Y(() => t(e) ? "to" in e && e.to !== void 0 ? {
33
+ to: e.to,
34
+ disabled: e.disabled,
35
+ className: s.value
36
+ } : {
37
+ href: e.href,
38
+ target: e.target,
39
+ rel: e.rel,
40
+ disabled: e.disabled,
41
+ className: s.value
42
+ } : {}), i = Y(
43
+ () => ({
44
+ iconDefinition: e.iconDefinition,
45
+ iconClass: e.iconClass,
46
+ src: e.src,
47
+ iconRight: e.iconRight,
48
+ iconOnly: e.iconOnly,
49
+ text: e.text,
50
+ size: e.size
51
+ })
52
+ );
53
+ return (n, u) => t(e) ? (V(), se(D(Qe), Q({ key: 0 }, { ...a.value, ...n.$attrs }, { role: "button" }), {
54
+ default: le(() => [
55
+ ge(D(Te), _e(Ce(i.value)), {
56
+ default: le(() => [
57
+ me(n.$slots, "default", {}, () => [
58
+ Fe(Z(e.text), 1)
59
+ ])
60
+ ]),
61
+ _: 3
62
+ }, 16)
63
+ ]),
64
+ _: 3
65
+ }, 16)) : (V(), U("button", Q({
66
+ key: 1,
67
+ type: "button",
68
+ disabled: e.disabled,
69
+ class: s.value
70
+ }, n.$attrs), [
71
+ ge(D(Te), _e(Ce(i.value)), {
72
+ default: le(() => [
73
+ me(n.$slots, "default", {}, () => [
74
+ Fe(Z(e.text), 1)
75
+ ])
76
+ ]),
77
+ _: 3
78
+ }, 16)
79
+ ], 16, kt));
80
+ }
81
+ });
82
+ var Ct = {
83
+ prefix: "fas",
84
+ iconName: "circle-exclamation",
85
+ icon: [512, 512, ["exclamation-circle"], "f06a", "M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512zm0-192a32 32 0 1 0 0 64 32 32 0 1 0 0-64zm0-192c-18.2 0-32.7 15.5-31.4 33.7l7.4 104c.9 12.6 11.4 22.3 23.9 22.3 12.6 0 23-9.7 23.9-22.3l7.4-104c1.3-18.2-13.1-33.7-31.4-33.7z"]
86
+ }, yt = Ct, Et = {
87
+ prefix: "fas",
88
+ iconName: "xmark",
89
+ icon: [384, 512, [128473, 10005, 10006, 10060, 215, "close", "multiply", "remove", "times"], "f00d", "M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z"]
90
+ }, At = Et;
91
+ function oe(r) {
92
+ return typeof r == "string" || r instanceof String;
93
+ }
94
+ function Ge(r) {
95
+ var e;
96
+ return typeof r == "object" && r != null && (r == null || (e = r.constructor) == null ? void 0 : e.name) === "Object";
97
+ }
98
+ function et(r, e) {
99
+ return Array.isArray(e) ? et(r, (t, s) => e.includes(s)) : Object.entries(r).reduce((t, s) => {
100
+ let [a, i] = s;
101
+ return e(i, a) && (t[a] = i), t;
102
+ }, {});
103
+ }
104
+ const m = {
105
+ NONE: "NONE",
106
+ LEFT: "LEFT",
107
+ FORCE_LEFT: "FORCE_LEFT",
108
+ RIGHT: "RIGHT",
109
+ FORCE_RIGHT: "FORCE_RIGHT"
110
+ };
111
+ function Ft(r) {
112
+ switch (r) {
113
+ case m.LEFT:
114
+ return m.FORCE_LEFT;
115
+ case m.RIGHT:
116
+ return m.FORCE_RIGHT;
117
+ default:
118
+ return r;
119
+ }
120
+ }
121
+ function Ye(r) {
122
+ return r.replace(/([.*+?^=!:${}()|[\]/\\])/g, "\\$1");
123
+ }
124
+ function Oe(r, e) {
125
+ if (e === r) return !0;
126
+ const t = Array.isArray(e), s = Array.isArray(r);
127
+ let a;
128
+ if (t && s) {
129
+ if (e.length != r.length) return !1;
130
+ for (a = 0; a < e.length; a++) if (!Oe(e[a], r[a])) return !1;
131
+ return !0;
132
+ }
133
+ if (t != s) return !1;
134
+ if (e && r && typeof e == "object" && typeof r == "object") {
135
+ const i = e instanceof Date, n = r instanceof Date;
136
+ if (i && n) return e.getTime() == r.getTime();
137
+ if (i != n) return !1;
138
+ const u = e instanceof RegExp, l = r instanceof RegExp;
139
+ if (u && l) return e.toString() == r.toString();
140
+ if (u != l) return !1;
141
+ const o = Object.keys(e);
142
+ for (a = 0; a < o.length; a++) if (!Object.prototype.hasOwnProperty.call(r, o[a])) return !1;
143
+ for (a = 0; a < o.length; a++) if (!Oe(r[o[a]], e[o[a]])) return !1;
144
+ return !0;
145
+ } else if (e && r && typeof e == "function" && typeof r == "function")
146
+ return e.toString() === r.toString();
147
+ return !1;
148
+ }
149
+ class bt {
150
+ /** Current input value */
151
+ /** Current cursor position */
152
+ /** Old input value */
153
+ /** Old selection */
154
+ constructor(e) {
155
+ for (Object.assign(this, e); this.value.slice(0, this.startChangePos) !== this.oldValue.slice(0, this.startChangePos); )
156
+ --this.oldSelection.start;
157
+ if (this.insertedCount)
158
+ for (; this.value.slice(this.cursorPos) !== this.oldValue.slice(this.oldSelection.end); )
159
+ this.value.length - this.cursorPos < this.oldValue.length - this.oldSelection.end ? ++this.oldSelection.end : ++this.cursorPos;
160
+ }
161
+ /** Start changing position */
162
+ get startChangePos() {
163
+ return Math.min(this.cursorPos, this.oldSelection.start);
164
+ }
165
+ /** Inserted symbols count */
166
+ get insertedCount() {
167
+ return this.cursorPos - this.startChangePos;
168
+ }
169
+ /** Inserted symbols */
170
+ get inserted() {
171
+ return this.value.substr(this.startChangePos, this.insertedCount);
172
+ }
173
+ /** Removed symbols count */
174
+ get removedCount() {
175
+ return Math.max(this.oldSelection.end - this.startChangePos || // for Delete
176
+ this.oldValue.length - this.value.length, 0);
177
+ }
178
+ /** Removed symbols */
179
+ get removed() {
180
+ return this.oldValue.substr(this.startChangePos, this.removedCount);
181
+ }
182
+ /** Unchanged head symbols */
183
+ get head() {
184
+ return this.value.substring(0, this.startChangePos);
185
+ }
186
+ /** Unchanged tail symbols */
187
+ get tail() {
188
+ return this.value.substring(this.startChangePos + this.insertedCount);
189
+ }
190
+ /** Remove direction */
191
+ get removeDirection() {
192
+ return !this.removedCount || this.insertedCount ? m.NONE : (this.oldSelection.end === this.cursorPos || this.oldSelection.start === this.cursorPos) && // if not range removed (event with backspace)
193
+ this.oldSelection.end === this.oldSelection.start ? m.RIGHT : m.LEFT;
194
+ }
195
+ }
196
+ function C(r, e) {
197
+ return new C.InputMask(r, e);
198
+ }
199
+ function tt(r) {
200
+ if (r == null) throw new Error("mask property should be defined");
201
+ return r instanceof RegExp ? C.MaskedRegExp : oe(r) ? C.MaskedPattern : r === Date ? C.MaskedDate : r === Number ? C.MaskedNumber : Array.isArray(r) || r === Array ? C.MaskedDynamic : C.Masked && r.prototype instanceof C.Masked ? r : C.Masked && r instanceof C.Masked ? r.constructor : r instanceof Function ? C.MaskedFunction : C.Masked;
202
+ }
203
+ function xe(r) {
204
+ if (!r) throw new Error("Options in not defined");
205
+ if (C.Masked) {
206
+ if (r.prototype instanceof C.Masked) return {
207
+ mask: r
208
+ };
209
+ const {
210
+ mask: e = void 0,
211
+ ...t
212
+ } = r instanceof C.Masked ? {
213
+ mask: r
214
+ } : Ge(r) && r.mask instanceof C.Masked ? r : {};
215
+ if (e) {
216
+ const s = e.mask;
217
+ return {
218
+ ...et(e, (a, i) => !i.startsWith("_")),
219
+ mask: e.constructor,
220
+ _mask: s,
221
+ ...t
222
+ };
223
+ }
224
+ }
225
+ return Ge(r) ? {
226
+ ...r
227
+ } : {
228
+ mask: r
229
+ };
230
+ }
231
+ function ae(r) {
232
+ if (C.Masked && r instanceof C.Masked) return r;
233
+ const e = xe(r), t = tt(e.mask);
234
+ if (!t) throw new Error("Masked class is not found for provided mask " + e.mask + ", appropriate module needs to be imported manually before creating mask.");
235
+ return e.mask === t && delete e.mask, e._mask && (e.mask = e._mask, delete e._mask), new t(e);
236
+ }
237
+ C.createMask = ae;
238
+ class je {
239
+ /** */
240
+ /** */
241
+ /** */
242
+ /** Safely returns selection start */
243
+ get selectionStart() {
244
+ let e;
245
+ try {
246
+ e = this._unsafeSelectionStart;
247
+ } catch {
248
+ }
249
+ return e ?? this.value.length;
250
+ }
251
+ /** Safely returns selection end */
252
+ get selectionEnd() {
253
+ let e;
254
+ try {
255
+ e = this._unsafeSelectionEnd;
256
+ } catch {
257
+ }
258
+ return e ?? this.value.length;
259
+ }
260
+ /** Safely sets element selection */
261
+ select(e, t) {
262
+ if (!(e == null || t == null || e === this.selectionStart && t === this.selectionEnd))
263
+ try {
264
+ this._unsafeSelect(e, t);
265
+ } catch {
266
+ }
267
+ }
268
+ /** */
269
+ get isActive() {
270
+ return !1;
271
+ }
272
+ /** */
273
+ /** */
274
+ /** */
275
+ }
276
+ C.MaskElement = je;
277
+ const Ze = 90, xt = 89;
278
+ class Pe extends je {
279
+ /** HTMLElement to use mask on */
280
+ constructor(e) {
281
+ 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);
282
+ }
283
+ get rootElement() {
284
+ var e, t, s;
285
+ return (e = (t = (s = this.input).getRootNode) == null ? void 0 : t.call(s)) != null ? e : document;
286
+ }
287
+ /** Is element in focus */
288
+ get isActive() {
289
+ return this.input === this.rootElement.activeElement;
290
+ }
291
+ /** Binds HTMLElement events to mask internal events */
292
+ bindEvents(e) {
293
+ 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;
294
+ }
295
+ _onKeydown(e) {
296
+ if (this._handlers.redo && (e.keyCode === Ze && e.shiftKey && (e.metaKey || e.ctrlKey) || e.keyCode === xt && e.ctrlKey))
297
+ return e.preventDefault(), this._handlers.redo(e);
298
+ if (this._handlers.undo && e.keyCode === Ze && (e.metaKey || e.ctrlKey))
299
+ return e.preventDefault(), this._handlers.undo(e);
300
+ e.isComposing || this._handlers.selectionChange(e);
301
+ }
302
+ _onBeforeinput(e) {
303
+ if (e.inputType === "historyUndo" && this._handlers.undo)
304
+ return e.preventDefault(), this._handlers.undo(e);
305
+ if (e.inputType === "historyRedo" && this._handlers.redo)
306
+ return e.preventDefault(), this._handlers.redo(e);
307
+ }
308
+ _onCompositionEnd(e) {
309
+ this._handlers.input(e);
310
+ }
311
+ _onInput(e) {
312
+ e.isComposing || this._handlers.input(e);
313
+ }
314
+ /** Unbinds HTMLElement events to mask internal events */
315
+ unbindEvents() {
316
+ 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 = {};
317
+ }
318
+ }
319
+ C.HTMLMaskElement = Pe;
320
+ class Dt extends Pe {
321
+ /** InputElement to use mask on */
322
+ constructor(e) {
323
+ super(e), this.input = e;
324
+ }
325
+ /** Returns InputElement selection start */
326
+ get _unsafeSelectionStart() {
327
+ return this.input.selectionStart != null ? this.input.selectionStart : this.value.length;
328
+ }
329
+ /** Returns InputElement selection end */
330
+ get _unsafeSelectionEnd() {
331
+ return this.input.selectionEnd;
332
+ }
333
+ /** Sets InputElement selection */
334
+ _unsafeSelect(e, t) {
335
+ this.input.setSelectionRange(e, t);
336
+ }
337
+ get value() {
338
+ return this.input.value;
339
+ }
340
+ set value(e) {
341
+ this.input.value = e;
342
+ }
343
+ }
344
+ C.HTMLMaskElement = Pe;
345
+ class st extends Pe {
346
+ /** Returns HTMLElement selection start */
347
+ get _unsafeSelectionStart() {
348
+ const e = this.rootElement, t = e.getSelection && e.getSelection(), s = t && t.anchorOffset, a = t && t.focusOffset;
349
+ return a == null || s == null || s < a ? s : a;
350
+ }
351
+ /** Returns HTMLElement selection end */
352
+ get _unsafeSelectionEnd() {
353
+ const e = this.rootElement, t = e.getSelection && e.getSelection(), s = t && t.anchorOffset, a = t && t.focusOffset;
354
+ return a == null || s == null || s > a ? s : a;
355
+ }
356
+ /** Sets HTMLElement selection */
357
+ _unsafeSelect(e, t) {
358
+ if (!this.rootElement.createRange) return;
359
+ const s = this.rootElement.createRange();
360
+ s.setStart(this.input.firstChild || this.input, e), s.setEnd(this.input.lastChild || this.input, t);
361
+ const a = this.rootElement, i = a.getSelection && a.getSelection();
362
+ i && (i.removeAllRanges(), i.addRange(s));
363
+ }
364
+ /** HTMLElement value */
365
+ get value() {
366
+ return this.input.textContent || "";
367
+ }
368
+ set value(e) {
369
+ this.input.textContent = e;
370
+ }
371
+ }
372
+ C.HTMLContenteditableMaskElement = st;
373
+ class Le {
374
+ constructor() {
375
+ this.states = [], this.currentIndex = 0;
376
+ }
377
+ get currentState() {
378
+ return this.states[this.currentIndex];
379
+ }
380
+ get isEmpty() {
381
+ return this.states.length === 0;
382
+ }
383
+ push(e) {
384
+ this.currentIndex < this.states.length - 1 && (this.states.length = this.currentIndex + 1), this.states.push(e), this.states.length > Le.MAX_LENGTH && this.states.shift(), this.currentIndex = this.states.length - 1;
385
+ }
386
+ go(e) {
387
+ return this.currentIndex = Math.min(Math.max(this.currentIndex + e, 0), this.states.length - 1), this.currentState;
388
+ }
389
+ undo() {
390
+ return this.go(-1);
391
+ }
392
+ redo() {
393
+ return this.go(1);
394
+ }
395
+ clear() {
396
+ this.states.length = 0, this.currentIndex = 0;
397
+ }
398
+ }
399
+ Le.MAX_LENGTH = 100;
400
+ class St {
401
+ /**
402
+ View element
403
+ */
404
+ /** Internal {@link Masked} model */
405
+ constructor(e, t) {
406
+ this.el = e instanceof je ? e : e.isContentEditable && e.tagName !== "INPUT" && e.tagName !== "TEXTAREA" ? new st(e) : new Dt(e), this.masked = ae(t), this._listeners = {}, this._value = "", this._unmaskedValue = "", this._rawInputValue = "", this.history = new Le(), 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();
407
+ }
408
+ maskEquals(e) {
409
+ var t;
410
+ return e == null || ((t = this.masked) == null ? void 0 : t.maskEquals(e));
411
+ }
412
+ /** Masked */
413
+ get mask() {
414
+ return this.masked.mask;
415
+ }
416
+ set mask(e) {
417
+ if (this.maskEquals(e)) return;
418
+ if (!(e instanceof C.Masked) && this.masked.constructor === tt(e)) {
419
+ this.masked.updateOptions({
420
+ mask: e
421
+ });
422
+ return;
423
+ }
424
+ const t = e instanceof C.Masked ? e : ae({
425
+ mask: e
426
+ });
427
+ t.unmaskedValue = this.masked.unmaskedValue, this.masked = t;
428
+ }
429
+ /** Raw value */
430
+ get value() {
431
+ return this._value;
432
+ }
433
+ set value(e) {
434
+ this.value !== e && (this.masked.value = e, this.updateControl("auto"));
435
+ }
436
+ /** Unmasked value */
437
+ get unmaskedValue() {
438
+ return this._unmaskedValue;
439
+ }
440
+ set unmaskedValue(e) {
441
+ this.unmaskedValue !== e && (this.masked.unmaskedValue = e, this.updateControl("auto"));
442
+ }
443
+ /** Raw input value */
444
+ get rawInputValue() {
445
+ return this._rawInputValue;
446
+ }
447
+ set rawInputValue(e) {
448
+ this.rawInputValue !== e && (this.masked.rawInputValue = e, this.updateControl(), this.alignCursor());
449
+ }
450
+ /** Typed unmasked value */
451
+ get typedValue() {
452
+ return this.masked.typedValue;
453
+ }
454
+ set typedValue(e) {
455
+ this.masked.typedValueEquals(e) || (this.masked.typedValue = e, this.updateControl("auto"));
456
+ }
457
+ /** Display value */
458
+ get displayValue() {
459
+ return this.masked.displayValue;
460
+ }
461
+ /** Starts listening to element events */
462
+ _bindEvents() {
463
+ this.el.bindEvents({
464
+ selectionChange: this._saveSelection,
465
+ input: this._onInput,
466
+ drop: this._onDrop,
467
+ click: this._onClick,
468
+ focus: this._onFocus,
469
+ commit: this._onChange,
470
+ undo: this._onUndo,
471
+ redo: this._onRedo
472
+ });
473
+ }
474
+ /** Stops listening to element events */
475
+ _unbindEvents() {
476
+ this.el && this.el.unbindEvents();
477
+ }
478
+ /** Fires custom event */
479
+ _fireEvent(e, t) {
480
+ const s = this._listeners[e];
481
+ s && s.forEach((a) => a(t));
482
+ }
483
+ /** Current selection start */
484
+ get selectionStart() {
485
+ return this._cursorChanging ? this._changingCursorPos : this.el.selectionStart;
486
+ }
487
+ /** Current cursor position */
488
+ get cursorPos() {
489
+ return this._cursorChanging ? this._changingCursorPos : this.el.selectionEnd;
490
+ }
491
+ set cursorPos(e) {
492
+ !this.el || !this.el.isActive || (this.el.select(e, e), this._saveSelection());
493
+ }
494
+ /** Stores current selection */
495
+ _saveSelection() {
496
+ this.displayValue, this.el.value, this._selection = {
497
+ start: this.selectionStart,
498
+ end: this.cursorPos
499
+ };
500
+ }
501
+ /** Syncronizes model value from view */
502
+ updateValue() {
503
+ this.masked.value = this.el.value, this._value = this.masked.value, this._unmaskedValue = this.masked.unmaskedValue, this._rawInputValue = this.masked.rawInputValue;
504
+ }
505
+ /** Syncronizes view from model value, fires change events */
506
+ updateControl(e) {
507
+ const t = this.masked.unmaskedValue, s = this.masked.value, a = this.masked.rawInputValue, i = this.displayValue, n = this.unmaskedValue !== t || this.value !== s || this._rawInputValue !== a;
508
+ this._unmaskedValue = t, this._value = s, this._rawInputValue = a, this.el.value !== i && (this.el.value = i), e === "auto" ? this.alignCursor() : e != null && (this.cursorPos = e), n && this._fireChangeEvents(), !this._historyChanging && (n || this.history.isEmpty) && this.history.push({
509
+ unmaskedValue: t,
510
+ selection: {
511
+ start: this.selectionStart,
512
+ end: this.cursorPos
513
+ }
514
+ });
515
+ }
516
+ /** Updates options with deep equal check, recreates {@link Masked} model if mask type changes */
517
+ updateOptions(e) {
518
+ const {
519
+ mask: t,
520
+ ...s
521
+ } = e, a = !this.maskEquals(t), i = this.masked.optionsIsChanged(s);
522
+ a && (this.mask = t), i && this.masked.updateOptions(s), (a || i) && this.updateControl();
523
+ }
524
+ /** Updates cursor */
525
+ updateCursor(e) {
526
+ e != null && (this.cursorPos = e, this._delayUpdateCursor(e));
527
+ }
528
+ /** Delays cursor update to support mobile browsers */
529
+ _delayUpdateCursor(e) {
530
+ this._abortUpdateCursor(), this._changingCursorPos = e, this._cursorChanging = setTimeout(() => {
531
+ this.el && (this.cursorPos = this._changingCursorPos, this._abortUpdateCursor());
532
+ }, 10);
533
+ }
534
+ /** Fires custom events */
535
+ _fireChangeEvents() {
536
+ this._fireEvent("accept", this._inputEvent), this.masked.isComplete && this._fireEvent("complete", this._inputEvent);
537
+ }
538
+ /** Aborts delayed cursor update */
539
+ _abortUpdateCursor() {
540
+ this._cursorChanging && (clearTimeout(this._cursorChanging), delete this._cursorChanging);
541
+ }
542
+ /** Aligns cursor to nearest available position */
543
+ alignCursor() {
544
+ this.cursorPos = this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos, m.LEFT));
545
+ }
546
+ /** Aligns cursor only if selection is empty */
547
+ alignCursorFriendly() {
548
+ this.selectionStart === this.cursorPos && this.alignCursor();
549
+ }
550
+ /** Adds listener on custom event */
551
+ on(e, t) {
552
+ return this._listeners[e] || (this._listeners[e] = []), this._listeners[e].push(t), this;
553
+ }
554
+ /** Removes custom event listener */
555
+ off(e, t) {
556
+ if (!this._listeners[e]) return this;
557
+ if (!t)
558
+ return delete this._listeners[e], this;
559
+ const s = this._listeners[e].indexOf(t);
560
+ return s >= 0 && this._listeners[e].splice(s, 1), this;
561
+ }
562
+ /** Handles view input event */
563
+ _onInput(e) {
564
+ this._inputEvent = e, this._abortUpdateCursor();
565
+ const t = new bt({
566
+ // new state
567
+ value: this.el.value,
568
+ cursorPos: this.cursorPos,
569
+ // old state
570
+ oldValue: this.displayValue,
571
+ oldSelection: this._selection
572
+ }), s = this.masked.rawInputValue, a = this.masked.splice(t.startChangePos, t.removed.length, t.inserted, t.removeDirection, {
573
+ input: !0,
574
+ raw: !0
575
+ }).offset, i = s === this.masked.rawInputValue ? t.removeDirection : m.NONE;
576
+ let n = this.masked.nearestInputPos(t.startChangePos + a, i);
577
+ i !== m.NONE && (n = this.masked.nearestInputPos(n, m.NONE)), this.updateControl(n), delete this._inputEvent;
578
+ }
579
+ /** Handles view change event and commits model value */
580
+ _onChange() {
581
+ this.displayValue !== this.el.value && this.updateValue(), this.masked.doCommit(), this.updateControl(), this._saveSelection();
582
+ }
583
+ /** Handles view drop event, prevents by default */
584
+ _onDrop(e) {
585
+ e.preventDefault(), e.stopPropagation();
586
+ }
587
+ /** Restore last selection on focus */
588
+ _onFocus(e) {
589
+ this.alignCursorFriendly();
590
+ }
591
+ /** Restore last selection on focus */
592
+ _onClick(e) {
593
+ this.alignCursorFriendly();
594
+ }
595
+ _onUndo() {
596
+ this._applyHistoryState(this.history.undo());
597
+ }
598
+ _onRedo() {
599
+ this._applyHistoryState(this.history.redo());
600
+ }
601
+ _applyHistoryState(e) {
602
+ e && (this._historyChanging = !0, this.unmaskedValue = e.unmaskedValue, this.el.select(e.selection.start, e.selection.end), this._saveSelection(), this._historyChanging = !1);
603
+ }
604
+ /** Unbind view events and removes element reference */
605
+ destroy() {
606
+ this._unbindEvents(), this._listeners.length = 0, delete this.el;
607
+ }
608
+ }
609
+ C.InputMask = St;
610
+ class x {
611
+ /** Inserted symbols */
612
+ /** Additional offset if any changes occurred before tail */
613
+ /** Raw inserted is used by dynamic mask */
614
+ /** Can skip chars */
615
+ static normalize(e) {
616
+ return Array.isArray(e) ? e : [e, new x()];
617
+ }
618
+ constructor(e) {
619
+ Object.assign(this, {
620
+ inserted: "",
621
+ rawInserted: "",
622
+ tailShift: 0,
623
+ skip: !1
624
+ }, e);
625
+ }
626
+ /** Aggregate changes */
627
+ aggregate(e) {
628
+ return this.inserted += e.inserted, this.rawInserted += e.rawInserted, this.tailShift += e.tailShift, this.skip = this.skip || e.skip, this;
629
+ }
630
+ /** Total offset considering all changes */
631
+ get offset() {
632
+ return this.tailShift + this.inserted.length;
633
+ }
634
+ get consumed() {
635
+ return !!this.rawInserted || this.skip;
636
+ }
637
+ equals(e) {
638
+ return this.inserted === e.inserted && this.tailShift === e.tailShift && this.rawInserted === e.rawInserted && this.skip === e.skip;
639
+ }
640
+ }
641
+ C.ChangeDetails = x;
642
+ class J {
643
+ /** Tail value as string */
644
+ /** Tail start position */
645
+ /** Start position */
646
+ constructor(e, t, s) {
647
+ e === void 0 && (e = ""), t === void 0 && (t = 0), this.value = e, this.from = t, this.stop = s;
648
+ }
649
+ toString() {
650
+ return this.value;
651
+ }
652
+ extend(e) {
653
+ this.value += String(e);
654
+ }
655
+ appendTo(e) {
656
+ return e.append(this.toString(), {
657
+ tail: !0
658
+ }).aggregate(e._appendPlaceholder());
659
+ }
660
+ get state() {
661
+ return {
662
+ value: this.value,
663
+ from: this.from,
664
+ stop: this.stop
665
+ };
666
+ }
667
+ set state(e) {
668
+ Object.assign(this, e);
669
+ }
670
+ unshift(e) {
671
+ if (!this.value.length || e != null && this.from >= e) return "";
672
+ const t = this.value[0];
673
+ return this.value = this.value.slice(1), t;
674
+ }
675
+ shift() {
676
+ if (!this.value.length) return "";
677
+ const e = this.value[this.value.length - 1];
678
+ return this.value = this.value.slice(0, -1), e;
679
+ }
680
+ }
681
+ let W = class Ve {
682
+ /** */
683
+ /** */
684
+ /** Transforms value before mask processing */
685
+ /** Transforms each char before mask processing */
686
+ /** Validates if value is acceptable */
687
+ /** Does additional processing at the end of editing */
688
+ /** Format typed value to string */
689
+ /** Parse string to get typed value */
690
+ /** Enable characters overwriting */
691
+ /** */
692
+ /** */
693
+ /** */
694
+ /** */
695
+ constructor(e) {
696
+ this._value = "", this._update({
697
+ ...Ve.DEFAULTS,
698
+ ...e
699
+ }), this._initialized = !0;
700
+ }
701
+ /** Sets and applies new options */
702
+ updateOptions(e) {
703
+ this.optionsIsChanged(e) && this.withValueRefresh(this._update.bind(this, e));
704
+ }
705
+ /** Sets new options */
706
+ _update(e) {
707
+ Object.assign(this, e);
708
+ }
709
+ /** Mask state */
710
+ get state() {
711
+ return {
712
+ _value: this.value,
713
+ _rawInputValue: this.rawInputValue
714
+ };
715
+ }
716
+ set state(e) {
717
+ this._value = e._value;
718
+ }
719
+ /** Resets value */
720
+ reset() {
721
+ this._value = "";
722
+ }
723
+ get value() {
724
+ return this._value;
725
+ }
726
+ set value(e) {
727
+ this.resolve(e, {
728
+ input: !0
729
+ });
730
+ }
731
+ /** Resolve new value */
732
+ resolve(e, t) {
733
+ t === void 0 && (t = {
734
+ input: !0
735
+ }), this.reset(), this.append(e, t, ""), this.doCommit();
736
+ }
737
+ get unmaskedValue() {
738
+ return this.value;
739
+ }
740
+ set unmaskedValue(e) {
741
+ this.resolve(e, {});
742
+ }
743
+ get typedValue() {
744
+ return this.parse ? this.parse(this.value, this) : this.unmaskedValue;
745
+ }
746
+ set typedValue(e) {
747
+ this.format ? this.value = this.format(e, this) : this.unmaskedValue = String(e);
748
+ }
749
+ /** Value that includes raw user input */
750
+ get rawInputValue() {
751
+ return this.extractInput(0, this.displayValue.length, {
752
+ raw: !0
753
+ });
754
+ }
755
+ set rawInputValue(e) {
756
+ this.resolve(e, {
757
+ raw: !0
758
+ });
759
+ }
760
+ get displayValue() {
761
+ return this.value;
762
+ }
763
+ get isComplete() {
764
+ return !0;
765
+ }
766
+ get isFilled() {
767
+ return this.isComplete;
768
+ }
769
+ /** Finds nearest input position in direction */
770
+ nearestInputPos(e, t) {
771
+ return e;
772
+ }
773
+ totalInputPositions(e, t) {
774
+ return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), Math.min(this.displayValue.length, t - e);
775
+ }
776
+ /** Extracts value in range considering flags */
777
+ extractInput(e, t, s) {
778
+ return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), this.displayValue.slice(e, t);
779
+ }
780
+ /** Extracts tail in range */
781
+ extractTail(e, t) {
782
+ return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), new J(this.extractInput(e, t), e);
783
+ }
784
+ /** Appends tail */
785
+ appendTail(e) {
786
+ return oe(e) && (e = new J(String(e))), e.appendTo(this);
787
+ }
788
+ /** Appends char */
789
+ _appendCharRaw(e, t) {
790
+ return e ? (this._value += e, new x({
791
+ inserted: e,
792
+ rawInserted: e
793
+ })) : new x();
794
+ }
795
+ /** Appends char */
796
+ _appendChar(e, t, s) {
797
+ t === void 0 && (t = {});
798
+ const a = this.state;
799
+ let i;
800
+ if ([e, i] = this.doPrepareChar(e, t), e && (i = i.aggregate(this._appendCharRaw(e, t)), !i.rawInserted && this.autofix === "pad")) {
801
+ const n = this.state;
802
+ this.state = a;
803
+ let u = this.pad(t);
804
+ const l = this._appendCharRaw(e, t);
805
+ u = u.aggregate(l), l.rawInserted || u.equals(i) ? i = u : this.state = n;
806
+ }
807
+ if (i.inserted) {
808
+ let n, u = this.doValidate(t) !== !1;
809
+ if (u && s != null) {
810
+ const l = this.state;
811
+ if (this.overwrite === !0) {
812
+ n = s.state;
813
+ for (let h = 0; h < i.rawInserted.length; ++h)
814
+ s.unshift(this.displayValue.length - i.tailShift);
815
+ }
816
+ let o = this.appendTail(s);
817
+ if (u = o.rawInserted.length === s.toString().length, !(u && o.inserted) && this.overwrite === "shift") {
818
+ this.state = l, n = s.state;
819
+ for (let h = 0; h < i.rawInserted.length; ++h)
820
+ s.shift();
821
+ o = this.appendTail(s), u = o.rawInserted.length === s.toString().length;
822
+ }
823
+ u && o.inserted && (this.state = l);
824
+ }
825
+ u || (i = new x(), this.state = a, s && n && (s.state = n));
826
+ }
827
+ return i;
828
+ }
829
+ /** Appends optional placeholder at the end */
830
+ _appendPlaceholder() {
831
+ return new x();
832
+ }
833
+ /** Appends optional eager placeholder at the end */
834
+ _appendEager() {
835
+ return new x();
836
+ }
837
+ /** Appends symbols considering flags */
838
+ append(e, t, s) {
839
+ if (!oe(e)) throw new Error("value should be string");
840
+ const a = oe(s) ? new J(String(s)) : s;
841
+ t != null && t.tail && (t._beforeTailState = this.state);
842
+ let i;
843
+ [e, i] = this.doPrepare(e, t);
844
+ for (let n = 0; n < e.length; ++n) {
845
+ const u = this._appendChar(e[n], t, a);
846
+ if (!u.rawInserted && !this.doSkipInvalid(e[n], t, a)) break;
847
+ i.aggregate(u);
848
+ }
849
+ return (this.eager === !0 || this.eager === "append") && t != null && t.input && e && i.aggregate(this._appendEager()), a != null && (i.tailShift += this.appendTail(a).tailShift), i;
850
+ }
851
+ remove(e, t) {
852
+ 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 x();
853
+ }
854
+ /** Calls function and reapplies current value */
855
+ withValueRefresh(e) {
856
+ if (this._refreshing || !this._initialized) return e();
857
+ this._refreshing = !0;
858
+ const t = this.rawInputValue, s = this.value, a = e();
859
+ 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, a;
860
+ }
861
+ runIsolated(e) {
862
+ if (this._isolated || !this._initialized) return e(this);
863
+ this._isolated = !0;
864
+ const t = this.state, s = e(this);
865
+ return this.state = t, delete this._isolated, s;
866
+ }
867
+ doSkipInvalid(e, t, s) {
868
+ return !!this.skipInvalid;
869
+ }
870
+ /** Prepares string before mask processing */
871
+ doPrepare(e, t) {
872
+ return t === void 0 && (t = {}), x.normalize(this.prepare ? this.prepare(e, this, t) : e);
873
+ }
874
+ /** Prepares each char before mask processing */
875
+ doPrepareChar(e, t) {
876
+ return t === void 0 && (t = {}), x.normalize(this.prepareChar ? this.prepareChar(e, this, t) : e);
877
+ }
878
+ /** Validates if value is acceptable */
879
+ doValidate(e) {
880
+ return (!this.validate || this.validate(this.value, this, e)) && (!this.parent || this.parent.doValidate(e));
881
+ }
882
+ /** Does additional processing at the end of editing */
883
+ doCommit() {
884
+ this.commit && this.commit(this.value, this);
885
+ }
886
+ splice(e, t, s, a, i) {
887
+ s === void 0 && (s = ""), a === void 0 && (a = m.NONE), i === void 0 && (i = {
888
+ input: !0
889
+ });
890
+ const n = e + t, u = this.extractTail(n), l = this.eager === !0 || this.eager === "remove";
891
+ let o;
892
+ l && (a = Ft(a), o = this.extractInput(0, n, {
893
+ raw: !0
894
+ }));
895
+ let h = e;
896
+ const c = new x();
897
+ if (a !== m.NONE && (h = this.nearestInputPos(e, t > 1 && e !== 0 && !l ? m.NONE : a), c.tailShift = h - e), c.aggregate(this.remove(h)), l && a !== m.NONE && o === this.rawInputValue)
898
+ if (a === m.FORCE_LEFT) {
899
+ let k;
900
+ for (; o === this.rawInputValue && (k = this.displayValue.length); )
901
+ c.aggregate(new x({
902
+ tailShift: -1
903
+ })).aggregate(this.remove(k - 1));
904
+ } else a === m.FORCE_RIGHT && u.unshift();
905
+ return c.aggregate(this.append(s, i, u));
906
+ }
907
+ maskEquals(e) {
908
+ return this.mask === e;
909
+ }
910
+ optionsIsChanged(e) {
911
+ return !Oe(this, e);
912
+ }
913
+ typedValueEquals(e) {
914
+ const t = this.typedValue;
915
+ return e === t || Ve.EMPTY_VALUES.includes(e) && Ve.EMPTY_VALUES.includes(t) || (this.format ? this.format(e, this) === this.format(this.typedValue, this) : !1);
916
+ }
917
+ pad(e) {
918
+ return new x();
919
+ }
920
+ };
921
+ W.DEFAULTS = {
922
+ skipInvalid: !0
923
+ };
924
+ W.EMPTY_VALUES = [void 0, null, ""];
925
+ C.Masked = W;
926
+ class fe {
927
+ /** */
928
+ constructor(e, t) {
929
+ e === void 0 && (e = []), t === void 0 && (t = 0), this.chunks = e, this.from = t;
930
+ }
931
+ toString() {
932
+ return this.chunks.map(String).join("");
933
+ }
934
+ extend(e) {
935
+ if (!String(e)) return;
936
+ e = oe(e) ? new J(String(e)) : e;
937
+ const t = this.chunks[this.chunks.length - 1], s = t && // if stops are same or tail has no stop
938
+ (t.stop === e.stop || e.stop == null) && // if tail chunk goes just after last chunk
939
+ e.from === t.from + t.toString().length;
940
+ if (e instanceof J)
941
+ s ? t.extend(e.toString()) : this.chunks.push(e);
942
+ else if (e instanceof fe) {
943
+ if (e.stop == null) {
944
+ let a;
945
+ for (; e.chunks.length && e.chunks[0].stop == null; )
946
+ a = e.chunks.shift(), a.from += e.from, this.extend(a);
947
+ }
948
+ e.toString() && (e.stop = e.blockIndex, this.chunks.push(e));
949
+ }
950
+ }
951
+ appendTo(e) {
952
+ if (!(e instanceof C.MaskedPattern))
953
+ return new J(this.toString()).appendTo(e);
954
+ const t = new x();
955
+ for (let s = 0; s < this.chunks.length; ++s) {
956
+ const a = this.chunks[s], i = e._mapPosToBlock(e.displayValue.length), n = a.stop;
957
+ let u;
958
+ if (n != null && // if block not found or stop is behind lastBlock
959
+ (!i || i.index <= n) && ((a instanceof fe || // for continuous block also check if stop is exist
960
+ e._stops.indexOf(n) >= 0) && t.aggregate(e._appendPlaceholder(n)), u = a instanceof fe && e._blocks[n]), u) {
961
+ const l = u.appendTail(a);
962
+ t.aggregate(l);
963
+ const o = a.toString().slice(l.rawInserted.length);
964
+ o && t.aggregate(e.append(o, {
965
+ tail: !0
966
+ }));
967
+ } else
968
+ t.aggregate(e.append(a.toString(), {
969
+ tail: !0
970
+ }));
971
+ }
972
+ return t;
973
+ }
974
+ get state() {
975
+ return {
976
+ chunks: this.chunks.map((e) => e.state),
977
+ from: this.from,
978
+ stop: this.stop,
979
+ blockIndex: this.blockIndex
980
+ };
981
+ }
982
+ set state(e) {
983
+ const {
984
+ chunks: t,
985
+ ...s
986
+ } = e;
987
+ Object.assign(this, s), this.chunks = t.map((a) => {
988
+ const i = "chunks" in a ? new fe() : new J();
989
+ return i.state = a, i;
990
+ });
991
+ }
992
+ unshift(e) {
993
+ if (!this.chunks.length || e != null && this.from >= e) return "";
994
+ const t = e != null ? e - this.from : e;
995
+ let s = 0;
996
+ for (; s < this.chunks.length; ) {
997
+ const a = this.chunks[s], i = a.unshift(t);
998
+ if (a.toString()) {
999
+ if (!i) break;
1000
+ ++s;
1001
+ } else
1002
+ this.chunks.splice(s, 1);
1003
+ if (i) return i;
1004
+ }
1005
+ return "";
1006
+ }
1007
+ shift() {
1008
+ if (!this.chunks.length) return "";
1009
+ let e = this.chunks.length - 1;
1010
+ for (; 0 <= e; ) {
1011
+ const t = this.chunks[e], s = t.shift();
1012
+ if (t.toString()) {
1013
+ if (!s) break;
1014
+ --e;
1015
+ } else
1016
+ this.chunks.splice(e, 1);
1017
+ if (s) return s;
1018
+ }
1019
+ return "";
1020
+ }
1021
+ }
1022
+ class Mt {
1023
+ constructor(e, t) {
1024
+ this.masked = e, this._log = [];
1025
+ const {
1026
+ offset: s,
1027
+ index: a
1028
+ } = e._mapPosToBlock(t) || (t < 0 ? (
1029
+ // first
1030
+ {
1031
+ index: 0,
1032
+ offset: 0
1033
+ }
1034
+ ) : (
1035
+ // last
1036
+ {
1037
+ index: this.masked._blocks.length,
1038
+ offset: 0
1039
+ }
1040
+ ));
1041
+ this.offset = s, this.index = a, this.ok = !1;
1042
+ }
1043
+ get block() {
1044
+ return this.masked._blocks[this.index];
1045
+ }
1046
+ get pos() {
1047
+ return this.masked._blockStartPos(this.index) + this.offset;
1048
+ }
1049
+ get state() {
1050
+ return {
1051
+ index: this.index,
1052
+ offset: this.offset,
1053
+ ok: this.ok
1054
+ };
1055
+ }
1056
+ set state(e) {
1057
+ Object.assign(this, e);
1058
+ }
1059
+ pushState() {
1060
+ this._log.push(this.state);
1061
+ }
1062
+ popState() {
1063
+ const e = this._log.pop();
1064
+ return e && (this.state = e), e;
1065
+ }
1066
+ bindBlock() {
1067
+ 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));
1068
+ }
1069
+ _pushLeft(e) {
1070
+ for (this.pushState(), this.bindBlock(); 0 <= this.index; --this.index, this.offset = ((t = this.block) == null ? void 0 : t.displayValue.length) || 0) {
1071
+ var t;
1072
+ if (e()) return this.ok = !0;
1073
+ }
1074
+ return this.ok = !1;
1075
+ }
1076
+ _pushRight(e) {
1077
+ for (this.pushState(), this.bindBlock(); this.index < this.masked._blocks.length; ++this.index, this.offset = 0)
1078
+ if (e()) return this.ok = !0;
1079
+ return this.ok = !1;
1080
+ }
1081
+ pushLeftBeforeFilled() {
1082
+ return this._pushLeft(() => {
1083
+ if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, m.FORCE_LEFT), this.offset !== 0))
1084
+ return !0;
1085
+ });
1086
+ }
1087
+ pushLeftBeforeInput() {
1088
+ return this._pushLeft(() => {
1089
+ if (!this.block.isFixed)
1090
+ return this.offset = this.block.nearestInputPos(this.offset, m.LEFT), !0;
1091
+ });
1092
+ }
1093
+ pushLeftBeforeRequired() {
1094
+ return this._pushLeft(() => {
1095
+ if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
1096
+ return this.offset = this.block.nearestInputPos(this.offset, m.LEFT), !0;
1097
+ });
1098
+ }
1099
+ pushRightBeforeFilled() {
1100
+ return this._pushRight(() => {
1101
+ if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, m.FORCE_RIGHT), this.offset !== this.block.value.length))
1102
+ return !0;
1103
+ });
1104
+ }
1105
+ pushRightBeforeInput() {
1106
+ return this._pushRight(() => {
1107
+ if (!this.block.isFixed)
1108
+ return this.offset = this.block.nearestInputPos(this.offset, m.NONE), !0;
1109
+ });
1110
+ }
1111
+ pushRightBeforeRequired() {
1112
+ return this._pushRight(() => {
1113
+ if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
1114
+ return this.offset = this.block.nearestInputPos(this.offset, m.NONE), !0;
1115
+ });
1116
+ }
1117
+ }
1118
+ class at {
1119
+ /** */
1120
+ /** */
1121
+ /** */
1122
+ /** */
1123
+ /** */
1124
+ /** */
1125
+ constructor(e) {
1126
+ Object.assign(this, e), this._value = "", this.isFixed = !0;
1127
+ }
1128
+ get value() {
1129
+ return this._value;
1130
+ }
1131
+ get unmaskedValue() {
1132
+ return this.isUnmasking ? this.value : "";
1133
+ }
1134
+ get rawInputValue() {
1135
+ return this._isRawInput ? this.value : "";
1136
+ }
1137
+ get displayValue() {
1138
+ return this.value;
1139
+ }
1140
+ reset() {
1141
+ this._isRawInput = !1, this._value = "";
1142
+ }
1143
+ remove(e, t) {
1144
+ 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 x();
1145
+ }
1146
+ nearestInputPos(e, t) {
1147
+ t === void 0 && (t = m.NONE);
1148
+ const s = 0, a = this._value.length;
1149
+ switch (t) {
1150
+ case m.LEFT:
1151
+ case m.FORCE_LEFT:
1152
+ return s;
1153
+ case m.NONE:
1154
+ case m.RIGHT:
1155
+ case m.FORCE_RIGHT:
1156
+ default:
1157
+ return a;
1158
+ }
1159
+ }
1160
+ totalInputPositions(e, t) {
1161
+ return e === void 0 && (e = 0), t === void 0 && (t = this._value.length), this._isRawInput ? t - e : 0;
1162
+ }
1163
+ extractInput(e, t, s) {
1164
+ 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) || "";
1165
+ }
1166
+ get isComplete() {
1167
+ return !0;
1168
+ }
1169
+ get isFilled() {
1170
+ return !!this._value;
1171
+ }
1172
+ _appendChar(e, t) {
1173
+ if (t === void 0 && (t = {}), this.isFilled) return new x();
1174
+ const s = this.eager === !0 || this.eager === "append", a = this.char === e && (this.isUnmasking || t.input || t.raw) && (!t.raw || !s) && !t.tail, i = new x({
1175
+ inserted: this.char,
1176
+ rawInserted: a ? this.char : ""
1177
+ });
1178
+ return this._value = this.char, this._isRawInput = a && (t.raw || t.input), i;
1179
+ }
1180
+ _appendEager() {
1181
+ return this._appendChar(this.char, {
1182
+ tail: !0
1183
+ });
1184
+ }
1185
+ _appendPlaceholder() {
1186
+ const e = new x();
1187
+ return this.isFilled || (this._value = e.inserted = this.char), e;
1188
+ }
1189
+ extractTail() {
1190
+ return new J("");
1191
+ }
1192
+ appendTail(e) {
1193
+ return oe(e) && (e = new J(String(e))), e.appendTo(this);
1194
+ }
1195
+ append(e, t, s) {
1196
+ const a = this._appendChar(e[0], t);
1197
+ return s != null && (a.tailShift += this.appendTail(s).tailShift), a;
1198
+ }
1199
+ doCommit() {
1200
+ }
1201
+ get state() {
1202
+ return {
1203
+ _value: this._value,
1204
+ _rawInputValue: this.rawInputValue
1205
+ };
1206
+ }
1207
+ set state(e) {
1208
+ this._value = e._value, this._isRawInput = !!e._rawInputValue;
1209
+ }
1210
+ pad(e) {
1211
+ return this._appendPlaceholder();
1212
+ }
1213
+ }
1214
+ class Re {
1215
+ /** */
1216
+ /** */
1217
+ /** */
1218
+ /** */
1219
+ /** */
1220
+ /** */
1221
+ /** */
1222
+ /** */
1223
+ constructor(e) {
1224
+ const {
1225
+ parent: t,
1226
+ isOptional: s,
1227
+ placeholderChar: a,
1228
+ displayChar: i,
1229
+ lazy: n,
1230
+ eager: u,
1231
+ ...l
1232
+ } = e;
1233
+ this.masked = ae(l), Object.assign(this, {
1234
+ parent: t,
1235
+ isOptional: s,
1236
+ placeholderChar: a,
1237
+ displayChar: i,
1238
+ lazy: n,
1239
+ eager: u
1240
+ });
1241
+ }
1242
+ reset() {
1243
+ this.isFilled = !1, this.masked.reset();
1244
+ }
1245
+ remove(e, t) {
1246
+ 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 x();
1247
+ }
1248
+ get value() {
1249
+ return this.masked.value || (this.isFilled && !this.isOptional ? this.placeholderChar : "");
1250
+ }
1251
+ get unmaskedValue() {
1252
+ return this.masked.unmaskedValue;
1253
+ }
1254
+ get rawInputValue() {
1255
+ return this.masked.rawInputValue;
1256
+ }
1257
+ get displayValue() {
1258
+ return this.masked.value && this.displayChar || this.value;
1259
+ }
1260
+ get isComplete() {
1261
+ return !!this.masked.value || this.isOptional;
1262
+ }
1263
+ _appendChar(e, t) {
1264
+ if (t === void 0 && (t = {}), this.isFilled) return new x();
1265
+ const s = this.masked.state;
1266
+ let a = this.masked._appendChar(e, this.currentMaskFlags(t));
1267
+ return a.inserted && this.doValidate(t) === !1 && (a = new x(), this.masked.state = s), !a.inserted && !this.isOptional && !this.lazy && !t.input && (a.inserted = this.placeholderChar), a.skip = !a.inserted && !this.isOptional, this.isFilled = !!a.inserted, a;
1268
+ }
1269
+ append(e, t, s) {
1270
+ return this.masked.append(e, this.currentMaskFlags(t), s);
1271
+ }
1272
+ _appendPlaceholder() {
1273
+ return this.isFilled || this.isOptional ? new x() : (this.isFilled = !0, new x({
1274
+ inserted: this.placeholderChar
1275
+ }));
1276
+ }
1277
+ _appendEager() {
1278
+ return new x();
1279
+ }
1280
+ extractTail(e, t) {
1281
+ return this.masked.extractTail(e, t);
1282
+ }
1283
+ appendTail(e) {
1284
+ return this.masked.appendTail(e);
1285
+ }
1286
+ extractInput(e, t, s) {
1287
+ return e === void 0 && (e = 0), t === void 0 && (t = this.value.length), this.masked.extractInput(e, t, s);
1288
+ }
1289
+ nearestInputPos(e, t) {
1290
+ t === void 0 && (t = m.NONE);
1291
+ const s = 0, a = this.value.length, i = Math.min(Math.max(e, s), a);
1292
+ switch (t) {
1293
+ case m.LEFT:
1294
+ case m.FORCE_LEFT:
1295
+ return this.isComplete ? i : s;
1296
+ case m.RIGHT:
1297
+ case m.FORCE_RIGHT:
1298
+ return this.isComplete ? i : a;
1299
+ case m.NONE:
1300
+ default:
1301
+ return i;
1302
+ }
1303
+ }
1304
+ totalInputPositions(e, t) {
1305
+ return e === void 0 && (e = 0), t === void 0 && (t = this.value.length), this.value.slice(e, t).length;
1306
+ }
1307
+ doValidate(e) {
1308
+ return this.masked.doValidate(this.currentMaskFlags(e)) && (!this.parent || this.parent.doValidate(this.currentMaskFlags(e)));
1309
+ }
1310
+ doCommit() {
1311
+ this.masked.doCommit();
1312
+ }
1313
+ get state() {
1314
+ return {
1315
+ _value: this.value,
1316
+ _rawInputValue: this.rawInputValue,
1317
+ masked: this.masked.state,
1318
+ isFilled: this.isFilled
1319
+ };
1320
+ }
1321
+ set state(e) {
1322
+ this.masked.state = e.masked, this.isFilled = e.isFilled;
1323
+ }
1324
+ currentMaskFlags(e) {
1325
+ var t;
1326
+ return {
1327
+ ...e,
1328
+ _beforeTailState: (e == null || (t = e._beforeTailState) == null ? void 0 : t.masked) || e?._beforeTailState
1329
+ };
1330
+ }
1331
+ pad(e) {
1332
+ return new x();
1333
+ }
1334
+ }
1335
+ Re.DEFAULT_DEFINITIONS = {
1336
+ 0: /\d/,
1337
+ 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]/,
1338
+ // http://stackoverflow.com/a/22075070
1339
+ "*": /./
1340
+ };
1341
+ class Bt extends W {
1342
+ /** */
1343
+ /** Enable characters overwriting */
1344
+ /** */
1345
+ /** */
1346
+ /** */
1347
+ updateOptions(e) {
1348
+ super.updateOptions(e);
1349
+ }
1350
+ _update(e) {
1351
+ const t = e.mask;
1352
+ t && (e.validate = (s) => s.search(t) >= 0), super._update(e);
1353
+ }
1354
+ }
1355
+ C.MaskedRegExp = Bt;
1356
+ class z extends W {
1357
+ /** */
1358
+ /** */
1359
+ /** Single char for empty input */
1360
+ /** Single char for filled input */
1361
+ /** Show placeholder only when needed */
1362
+ /** Enable characters overwriting */
1363
+ /** */
1364
+ /** */
1365
+ /** */
1366
+ constructor(e) {
1367
+ super({
1368
+ ...z.DEFAULTS,
1369
+ ...e,
1370
+ definitions: Object.assign({}, Re.DEFAULT_DEFINITIONS, e?.definitions)
1371
+ });
1372
+ }
1373
+ updateOptions(e) {
1374
+ super.updateOptions(e);
1375
+ }
1376
+ _update(e) {
1377
+ e.definitions = Object.assign({}, this.definitions, e.definitions), super._update(e), this._rebuildMask();
1378
+ }
1379
+ _rebuildMask() {
1380
+ const e = this.definitions;
1381
+ this._blocks = [], this.exposeBlock = void 0, this._stops = [], this._maskedBlocks = {};
1382
+ const t = this.mask;
1383
+ if (!t || !e) return;
1384
+ let s = !1, a = !1;
1385
+ for (let i = 0; i < t.length; ++i) {
1386
+ if (this.blocks) {
1387
+ const o = t.slice(i), h = Object.keys(this.blocks).filter((k) => o.indexOf(k) === 0);
1388
+ h.sort((k, v) => v.length - k.length);
1389
+ const c = h[0];
1390
+ if (c) {
1391
+ const {
1392
+ expose: k,
1393
+ repeat: v,
1394
+ ...F
1395
+ } = xe(this.blocks[c]), I = {
1396
+ lazy: this.lazy,
1397
+ eager: this.eager,
1398
+ placeholderChar: this.placeholderChar,
1399
+ displayChar: this.displayChar,
1400
+ overwrite: this.overwrite,
1401
+ autofix: this.autofix,
1402
+ ...F,
1403
+ repeat: v,
1404
+ parent: this
1405
+ }, L = v != null ? new C.RepeatBlock(
1406
+ I
1407
+ /* TODO */
1408
+ ) : ae(I);
1409
+ L && (this._blocks.push(L), k && (this.exposeBlock = L), this._maskedBlocks[c] || (this._maskedBlocks[c] = []), this._maskedBlocks[c].push(this._blocks.length - 1)), i += c.length - 1;
1410
+ continue;
1411
+ }
1412
+ }
1413
+ let n = t[i], u = n in e;
1414
+ if (n === z.STOP_CHAR) {
1415
+ this._stops.push(this._blocks.length);
1416
+ continue;
1417
+ }
1418
+ if (n === "{" || n === "}") {
1419
+ s = !s;
1420
+ continue;
1421
+ }
1422
+ if (n === "[" || n === "]") {
1423
+ a = !a;
1424
+ continue;
1425
+ }
1426
+ if (n === z.ESCAPE_CHAR) {
1427
+ if (++i, n = t[i], !n) break;
1428
+ u = !1;
1429
+ }
1430
+ const l = u ? new Re({
1431
+ isOptional: a,
1432
+ lazy: this.lazy,
1433
+ eager: this.eager,
1434
+ placeholderChar: this.placeholderChar,
1435
+ displayChar: this.displayChar,
1436
+ ...xe(e[n]),
1437
+ parent: this
1438
+ }) : new at({
1439
+ char: n,
1440
+ eager: this.eager,
1441
+ isUnmasking: s
1442
+ });
1443
+ this._blocks.push(l);
1444
+ }
1445
+ }
1446
+ get state() {
1447
+ return {
1448
+ ...super.state,
1449
+ _blocks: this._blocks.map((e) => e.state)
1450
+ };
1451
+ }
1452
+ set state(e) {
1453
+ if (!e) {
1454
+ this.reset();
1455
+ return;
1456
+ }
1457
+ const {
1458
+ _blocks: t,
1459
+ ...s
1460
+ } = e;
1461
+ this._blocks.forEach((a, i) => a.state = t[i]), super.state = s;
1462
+ }
1463
+ reset() {
1464
+ super.reset(), this._blocks.forEach((e) => e.reset());
1465
+ }
1466
+ get isComplete() {
1467
+ return this.exposeBlock ? this.exposeBlock.isComplete : this._blocks.every((e) => e.isComplete);
1468
+ }
1469
+ get isFilled() {
1470
+ return this._blocks.every((e) => e.isFilled);
1471
+ }
1472
+ get isFixed() {
1473
+ return this._blocks.every((e) => e.isFixed);
1474
+ }
1475
+ get isOptional() {
1476
+ return this._blocks.every((e) => e.isOptional);
1477
+ }
1478
+ doCommit() {
1479
+ this._blocks.forEach((e) => e.doCommit()), super.doCommit();
1480
+ }
1481
+ get unmaskedValue() {
1482
+ return this.exposeBlock ? this.exposeBlock.unmaskedValue : this._blocks.reduce((e, t) => e += t.unmaskedValue, "");
1483
+ }
1484
+ set unmaskedValue(e) {
1485
+ if (this.exposeBlock) {
1486
+ const t = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
1487
+ this.exposeBlock.unmaskedValue = e, this.appendTail(t), this.doCommit();
1488
+ } else super.unmaskedValue = e;
1489
+ }
1490
+ get value() {
1491
+ return this.exposeBlock ? this.exposeBlock.value : (
1492
+ // TODO return _value when not in change?
1493
+ this._blocks.reduce((e, t) => e += t.value, "")
1494
+ );
1495
+ }
1496
+ set value(e) {
1497
+ if (this.exposeBlock) {
1498
+ const t = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
1499
+ this.exposeBlock.value = e, this.appendTail(t), this.doCommit();
1500
+ } else super.value = e;
1501
+ }
1502
+ get typedValue() {
1503
+ return this.exposeBlock ? this.exposeBlock.typedValue : super.typedValue;
1504
+ }
1505
+ set typedValue(e) {
1506
+ if (this.exposeBlock) {
1507
+ const t = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
1508
+ this.exposeBlock.typedValue = e, this.appendTail(t), this.doCommit();
1509
+ } else super.typedValue = e;
1510
+ }
1511
+ get displayValue() {
1512
+ return this._blocks.reduce((e, t) => e += t.displayValue, "");
1513
+ }
1514
+ appendTail(e) {
1515
+ return super.appendTail(e).aggregate(this._appendPlaceholder());
1516
+ }
1517
+ _appendEager() {
1518
+ var e;
1519
+ const t = new x();
1520
+ let s = (e = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : e.index;
1521
+ if (s == null) return t;
1522
+ this._blocks[s].isFilled && ++s;
1523
+ for (let a = s; a < this._blocks.length; ++a) {
1524
+ const i = this._blocks[a]._appendEager();
1525
+ if (!i.inserted) break;
1526
+ t.aggregate(i);
1527
+ }
1528
+ return t;
1529
+ }
1530
+ _appendCharRaw(e, t) {
1531
+ t === void 0 && (t = {});
1532
+ const s = this._mapPosToBlock(this.displayValue.length), a = new x();
1533
+ if (!s) return a;
1534
+ for (let n = s.index, u; u = this._blocks[n]; ++n) {
1535
+ var i;
1536
+ const l = u._appendChar(e, {
1537
+ ...t,
1538
+ _beforeTailState: (i = t._beforeTailState) == null || (i = i._blocks) == null ? void 0 : i[n]
1539
+ });
1540
+ if (a.aggregate(l), l.consumed) break;
1541
+ }
1542
+ return a;
1543
+ }
1544
+ extractTail(e, t) {
1545
+ e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length);
1546
+ const s = new fe();
1547
+ return e === t || this._forEachBlocksInRange(e, t, (a, i, n, u) => {
1548
+ const l = a.extractTail(n, u);
1549
+ l.stop = this._findStopBefore(i), l.from = this._blockStartPos(i), l instanceof fe && (l.blockIndex = i), s.extend(l);
1550
+ }), s;
1551
+ }
1552
+ extractInput(e, t, s) {
1553
+ if (e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), s === void 0 && (s = {}), e === t) return "";
1554
+ let a = "";
1555
+ return this._forEachBlocksInRange(e, t, (i, n, u, l) => {
1556
+ a += i.extractInput(u, l, s);
1557
+ }), a;
1558
+ }
1559
+ _findStopBefore(e) {
1560
+ let t;
1561
+ for (let s = 0; s < this._stops.length; ++s) {
1562
+ const a = this._stops[s];
1563
+ if (a <= e) t = a;
1564
+ else break;
1565
+ }
1566
+ return t;
1567
+ }
1568
+ /** Appends placeholder depending on laziness */
1569
+ _appendPlaceholder(e) {
1570
+ const t = new x();
1571
+ if (this.lazy && e == null) return t;
1572
+ const s = this._mapPosToBlock(this.displayValue.length);
1573
+ if (!s) return t;
1574
+ const a = s.index, i = e ?? this._blocks.length;
1575
+ return this._blocks.slice(a, i).forEach((n) => {
1576
+ if (!n.lazy || e != null) {
1577
+ var u;
1578
+ t.aggregate(n._appendPlaceholder((u = n._blocks) == null ? void 0 : u.length));
1579
+ }
1580
+ }), t;
1581
+ }
1582
+ /** Finds block in pos */
1583
+ _mapPosToBlock(e) {
1584
+ let t = "";
1585
+ for (let s = 0; s < this._blocks.length; ++s) {
1586
+ const a = this._blocks[s], i = t.length;
1587
+ if (t += a.displayValue, e <= t.length)
1588
+ return {
1589
+ index: s,
1590
+ offset: e - i
1591
+ };
1592
+ }
1593
+ }
1594
+ _blockStartPos(e) {
1595
+ return this._blocks.slice(0, e).reduce((t, s) => t += s.displayValue.length, 0);
1596
+ }
1597
+ _forEachBlocksInRange(e, t, s) {
1598
+ t === void 0 && (t = this.displayValue.length);
1599
+ const a = this._mapPosToBlock(e);
1600
+ if (a) {
1601
+ const i = this._mapPosToBlock(t), n = i && a.index === i.index, u = a.offset, l = i && n ? i.offset : this._blocks[a.index].displayValue.length;
1602
+ if (s(this._blocks[a.index], a.index, u, l), i && !n) {
1603
+ for (let o = a.index + 1; o < i.index; ++o)
1604
+ s(this._blocks[o], o, 0, this._blocks[o].displayValue.length);
1605
+ s(this._blocks[i.index], i.index, 0, i.offset);
1606
+ }
1607
+ }
1608
+ }
1609
+ remove(e, t) {
1610
+ e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length);
1611
+ const s = super.remove(e, t);
1612
+ return this._forEachBlocksInRange(e, t, (a, i, n, u) => {
1613
+ s.aggregate(a.remove(n, u));
1614
+ }), s;
1615
+ }
1616
+ nearestInputPos(e, t) {
1617
+ if (t === void 0 && (t = m.NONE), !this._blocks.length) return 0;
1618
+ const s = new Mt(this, e);
1619
+ if (t === m.NONE)
1620
+ return s.pushRightBeforeInput() || (s.popState(), s.pushLeftBeforeInput()) ? s.pos : this.displayValue.length;
1621
+ if (t === m.LEFT || t === m.FORCE_LEFT) {
1622
+ if (t === m.LEFT) {
1623
+ if (s.pushRightBeforeFilled(), s.ok && s.pos === e) return e;
1624
+ s.popState();
1625
+ }
1626
+ if (s.pushLeftBeforeInput(), s.pushLeftBeforeRequired(), s.pushLeftBeforeFilled(), t === m.LEFT) {
1627
+ if (s.pushRightBeforeInput(), s.pushRightBeforeRequired(), s.ok && s.pos <= e || (s.popState(), s.ok && s.pos <= e)) return s.pos;
1628
+ s.popState();
1629
+ }
1630
+ return s.ok ? s.pos : t === m.FORCE_LEFT ? 0 : (s.popState(), s.ok || (s.popState(), s.ok) ? s.pos : 0);
1631
+ }
1632
+ return t === m.RIGHT || t === m.FORCE_RIGHT ? (s.pushRightBeforeInput(), s.pushRightBeforeRequired(), s.pushRightBeforeFilled() ? s.pos : t === m.FORCE_RIGHT ? this.displayValue.length : (s.popState(), s.ok || (s.popState(), s.ok) ? s.pos : this.nearestInputPos(e, m.LEFT))) : e;
1633
+ }
1634
+ totalInputPositions(e, t) {
1635
+ e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length);
1636
+ let s = 0;
1637
+ return this._forEachBlocksInRange(e, t, (a, i, n, u) => {
1638
+ s += a.totalInputPositions(n, u);
1639
+ }), s;
1640
+ }
1641
+ /** Get block by name */
1642
+ maskedBlock(e) {
1643
+ return this.maskedBlocks(e)[0];
1644
+ }
1645
+ /** Get all blocks by name */
1646
+ maskedBlocks(e) {
1647
+ const t = this._maskedBlocks[e];
1648
+ return t ? t.map((s) => this._blocks[s]) : [];
1649
+ }
1650
+ pad(e) {
1651
+ const t = new x();
1652
+ return this._forEachBlocksInRange(0, this.displayValue.length, (s) => t.aggregate(s.pad(e))), t;
1653
+ }
1654
+ }
1655
+ z.DEFAULTS = {
1656
+ ...W.DEFAULTS,
1657
+ lazy: !0,
1658
+ placeholderChar: "_"
1659
+ };
1660
+ z.STOP_CHAR = "`";
1661
+ z.ESCAPE_CHAR = "\\";
1662
+ z.InputDefinition = Re;
1663
+ z.FixedDefinition = at;
1664
+ C.MaskedPattern = z;
1665
+ class we extends z {
1666
+ /**
1667
+ Optionally sets max length of pattern.
1668
+ Used when pattern length is longer then `to` param length. Pads zeros at start in this case.
1669
+ */
1670
+ /** Min bound */
1671
+ /** Max bound */
1672
+ get _matchFrom() {
1673
+ return this.maxLength - String(this.from).length;
1674
+ }
1675
+ constructor(e) {
1676
+ super(e);
1677
+ }
1678
+ updateOptions(e) {
1679
+ super.updateOptions(e);
1680
+ }
1681
+ _update(e) {
1682
+ const {
1683
+ to: t = this.to || 0,
1684
+ from: s = this.from || 0,
1685
+ maxLength: a = this.maxLength || 0,
1686
+ autofix: i = this.autofix,
1687
+ ...n
1688
+ } = e;
1689
+ this.to = t, this.from = s, this.maxLength = Math.max(String(t).length, a), this.autofix = i;
1690
+ const u = String(this.from).padStart(this.maxLength, "0"), l = String(this.to).padStart(this.maxLength, "0");
1691
+ let o = 0;
1692
+ for (; o < l.length && l[o] === u[o]; ) ++o;
1693
+ n.mask = l.slice(0, o).replace(/0/g, "\\0") + "0".repeat(this.maxLength - o), super._update(n);
1694
+ }
1695
+ get isComplete() {
1696
+ return super.isComplete && !!this.value;
1697
+ }
1698
+ boundaries(e) {
1699
+ let t = "", s = "";
1700
+ const [, a, i] = e.match(/^(\D*)(\d*)(\D*)/) || [];
1701
+ return i && (t = "0".repeat(a.length) + i, s = "9".repeat(a.length) + i), t = t.padEnd(this.maxLength, "0"), s = s.padEnd(this.maxLength, "9"), [t, s];
1702
+ }
1703
+ doPrepareChar(e, t) {
1704
+ t === void 0 && (t = {});
1705
+ let s;
1706
+ return [e, s] = super.doPrepareChar(e.replace(/\D/g, ""), t), e || (s.skip = !this.isComplete), [e, s];
1707
+ }
1708
+ _appendCharRaw(e, t) {
1709
+ if (t === void 0 && (t = {}), !this.autofix || this.value.length + 1 > this.maxLength) return super._appendCharRaw(e, t);
1710
+ const s = String(this.from).padStart(this.maxLength, "0"), a = String(this.to).padStart(this.maxLength, "0"), [i, n] = this.boundaries(this.value + e);
1711
+ return Number(n) < this.from ? super._appendCharRaw(s[this.value.length], t) : Number(i) > 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(a[this.value.length], t) : super._appendCharRaw(e, t);
1712
+ }
1713
+ doValidate(e) {
1714
+ const t = this.value;
1715
+ if (t.search(/[^0]/) === -1 && t.length <= this._matchFrom) return !0;
1716
+ const [s, a] = this.boundaries(t);
1717
+ return this.from <= Number(a) && Number(s) <= this.to && super.doValidate(e);
1718
+ }
1719
+ pad(e) {
1720
+ const t = new x();
1721
+ if (this.value.length === this.maxLength) return t;
1722
+ const s = this.value, a = this.maxLength - this.value.length;
1723
+ if (a) {
1724
+ this.reset();
1725
+ for (let i = 0; i < a; ++i)
1726
+ t.aggregate(super._appendCharRaw("0", e));
1727
+ s.split("").forEach((i) => this._appendCharRaw(i));
1728
+ }
1729
+ return t;
1730
+ }
1731
+ }
1732
+ C.MaskedRange = we;
1733
+ const Vt = "d{.}`m{.}`Y";
1734
+ class te extends z {
1735
+ static extractPatternOptions(e) {
1736
+ const {
1737
+ mask: t,
1738
+ pattern: s,
1739
+ ...a
1740
+ } = e;
1741
+ return {
1742
+ ...a,
1743
+ mask: oe(t) ? t : s
1744
+ };
1745
+ }
1746
+ /** Pattern mask for date according to {@link MaskedDate#format} */
1747
+ /** Start date */
1748
+ /** End date */
1749
+ /** Format typed value to string */
1750
+ /** Parse string to get typed value */
1751
+ constructor(e) {
1752
+ super(te.extractPatternOptions({
1753
+ ...te.DEFAULTS,
1754
+ ...e
1755
+ }));
1756
+ }
1757
+ updateOptions(e) {
1758
+ super.updateOptions(e);
1759
+ }
1760
+ _update(e) {
1761
+ const {
1762
+ mask: t,
1763
+ pattern: s,
1764
+ blocks: a,
1765
+ ...i
1766
+ } = {
1767
+ ...te.DEFAULTS,
1768
+ ...e
1769
+ }, n = Object.assign({}, te.GET_DEFAULT_BLOCKS());
1770
+ 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, a), super._update({
1771
+ ...i,
1772
+ mask: oe(t) ? t : s,
1773
+ blocks: n
1774
+ });
1775
+ }
1776
+ doValidate(e) {
1777
+ const t = this.date;
1778
+ return super.doValidate(e) && (!this.isComplete || this.isDateExist(this.value) && t != null && (this.min == null || this.min <= t) && (this.max == null || t <= this.max));
1779
+ }
1780
+ /** Checks if date is exists */
1781
+ isDateExist(e) {
1782
+ return this.format(this.parse(e, this), this).indexOf(e) >= 0;
1783
+ }
1784
+ /** Parsed Date */
1785
+ get date() {
1786
+ return this.typedValue;
1787
+ }
1788
+ set date(e) {
1789
+ this.typedValue = e;
1790
+ }
1791
+ get typedValue() {
1792
+ return this.isComplete ? super.typedValue : null;
1793
+ }
1794
+ set typedValue(e) {
1795
+ super.typedValue = e;
1796
+ }
1797
+ maskEquals(e) {
1798
+ return e === Date || super.maskEquals(e);
1799
+ }
1800
+ optionsIsChanged(e) {
1801
+ return super.optionsIsChanged(te.extractPatternOptions(e));
1802
+ }
1803
+ }
1804
+ te.GET_DEFAULT_BLOCKS = () => ({
1805
+ d: {
1806
+ mask: we,
1807
+ from: 1,
1808
+ to: 31,
1809
+ maxLength: 2
1810
+ },
1811
+ m: {
1812
+ mask: we,
1813
+ from: 1,
1814
+ to: 12,
1815
+ maxLength: 2
1816
+ },
1817
+ Y: {
1818
+ mask: we,
1819
+ from: 1900,
1820
+ to: 9999
1821
+ }
1822
+ });
1823
+ te.DEFAULTS = {
1824
+ ...z.DEFAULTS,
1825
+ mask: Date,
1826
+ pattern: Vt,
1827
+ format: (r, e) => {
1828
+ if (!r) return "";
1829
+ const t = String(r.getDate()).padStart(2, "0"), s = String(r.getMonth() + 1).padStart(2, "0"), a = r.getFullYear();
1830
+ return [t, s, a].join(".");
1831
+ },
1832
+ parse: (r, e) => {
1833
+ const [t, s, a] = r.split(".").map(Number);
1834
+ return new Date(a, s - 1, t);
1835
+ }
1836
+ };
1837
+ C.MaskedDate = te;
1838
+ class $e extends W {
1839
+ constructor(e) {
1840
+ super({
1841
+ ...$e.DEFAULTS,
1842
+ ...e
1843
+ }), this.currentMask = void 0;
1844
+ }
1845
+ updateOptions(e) {
1846
+ super.updateOptions(e);
1847
+ }
1848
+ _update(e) {
1849
+ super._update(e), "mask" in e && (this.exposeMask = void 0, this.compiledMasks = Array.isArray(e.mask) ? e.mask.map((t) => {
1850
+ const {
1851
+ expose: s,
1852
+ ...a
1853
+ } = xe(t), i = ae({
1854
+ overwrite: this._overwrite,
1855
+ eager: this._eager,
1856
+ skipInvalid: this._skipInvalid,
1857
+ ...a
1858
+ });
1859
+ return s && (this.exposeMask = i), i;
1860
+ }) : []);
1861
+ }
1862
+ _appendCharRaw(e, t) {
1863
+ t === void 0 && (t = {});
1864
+ const s = this._applyDispatch(e, t);
1865
+ return this.currentMask && s.aggregate(this.currentMask._appendChar(e, this.currentMaskFlags(t))), s;
1866
+ }
1867
+ _applyDispatch(e, t, s) {
1868
+ e === void 0 && (e = ""), t === void 0 && (t = {}), s === void 0 && (s = "");
1869
+ const a = t.tail && t._beforeTailState != null ? t._beforeTailState._value : this.value, i = this.rawInputValue, n = t.tail && t._beforeTailState != null ? t._beforeTailState._rawInputValue : i, u = i.slice(n.length), l = this.currentMask, o = new x(), h = l?.state;
1870
+ return this.currentMask = this.doDispatch(e, {
1871
+ ...t
1872
+ }, s), this.currentMask && (this.currentMask !== l ? (this.currentMask.reset(), n && (this.currentMask.append(n, {
1873
+ raw: !0
1874
+ }), o.tailShift = this.currentMask.value.length - a.length), u && (o.tailShift += this.currentMask.append(u, {
1875
+ raw: !0,
1876
+ tail: !0
1877
+ }).tailShift)) : h && (this.currentMask.state = h)), o;
1878
+ }
1879
+ _appendPlaceholder() {
1880
+ const e = this._applyDispatch();
1881
+ return this.currentMask && e.aggregate(this.currentMask._appendPlaceholder()), e;
1882
+ }
1883
+ _appendEager() {
1884
+ const e = this._applyDispatch();
1885
+ return this.currentMask && e.aggregate(this.currentMask._appendEager()), e;
1886
+ }
1887
+ appendTail(e) {
1888
+ const t = new x();
1889
+ return e && t.aggregate(this._applyDispatch("", {}, e)), t.aggregate(this.currentMask ? this.currentMask.appendTail(e) : super.appendTail(e));
1890
+ }
1891
+ currentMaskFlags(e) {
1892
+ var t, s;
1893
+ return {
1894
+ ...e,
1895
+ _beforeTailState: ((t = e._beforeTailState) == null ? void 0 : t.currentMaskRef) === this.currentMask && ((s = e._beforeTailState) == null ? void 0 : s.currentMask) || e._beforeTailState
1896
+ };
1897
+ }
1898
+ doDispatch(e, t, s) {
1899
+ return t === void 0 && (t = {}), s === void 0 && (s = ""), this.dispatch(e, this, t, s);
1900
+ }
1901
+ doValidate(e) {
1902
+ return super.doValidate(e) && (!this.currentMask || this.currentMask.doValidate(this.currentMaskFlags(e)));
1903
+ }
1904
+ doPrepare(e, t) {
1905
+ t === void 0 && (t = {});
1906
+ let [s, a] = super.doPrepare(e, t);
1907
+ if (this.currentMask) {
1908
+ let i;
1909
+ [s, i] = super.doPrepare(s, this.currentMaskFlags(t)), a = a.aggregate(i);
1910
+ }
1911
+ return [s, a];
1912
+ }
1913
+ doPrepareChar(e, t) {
1914
+ t === void 0 && (t = {});
1915
+ let [s, a] = super.doPrepareChar(e, t);
1916
+ if (this.currentMask) {
1917
+ let i;
1918
+ [s, i] = super.doPrepareChar(s, this.currentMaskFlags(t)), a = a.aggregate(i);
1919
+ }
1920
+ return [s, a];
1921
+ }
1922
+ reset() {
1923
+ var e;
1924
+ (e = this.currentMask) == null || e.reset(), this.compiledMasks.forEach((t) => t.reset());
1925
+ }
1926
+ get value() {
1927
+ return this.exposeMask ? this.exposeMask.value : this.currentMask ? this.currentMask.value : "";
1928
+ }
1929
+ set value(e) {
1930
+ this.exposeMask ? (this.exposeMask.value = e, this.currentMask = this.exposeMask, this._applyDispatch()) : super.value = e;
1931
+ }
1932
+ get unmaskedValue() {
1933
+ return this.exposeMask ? this.exposeMask.unmaskedValue : this.currentMask ? this.currentMask.unmaskedValue : "";
1934
+ }
1935
+ set unmaskedValue(e) {
1936
+ this.exposeMask ? (this.exposeMask.unmaskedValue = e, this.currentMask = this.exposeMask, this._applyDispatch()) : super.unmaskedValue = e;
1937
+ }
1938
+ get typedValue() {
1939
+ return this.exposeMask ? this.exposeMask.typedValue : this.currentMask ? this.currentMask.typedValue : "";
1940
+ }
1941
+ set typedValue(e) {
1942
+ if (this.exposeMask) {
1943
+ this.exposeMask.typedValue = e, this.currentMask = this.exposeMask, this._applyDispatch();
1944
+ return;
1945
+ }
1946
+ let t = String(e);
1947
+ this.currentMask && (this.currentMask.typedValue = e, t = this.currentMask.unmaskedValue), this.unmaskedValue = t;
1948
+ }
1949
+ get displayValue() {
1950
+ return this.currentMask ? this.currentMask.displayValue : "";
1951
+ }
1952
+ get isComplete() {
1953
+ var e;
1954
+ return !!((e = this.currentMask) != null && e.isComplete);
1955
+ }
1956
+ get isFilled() {
1957
+ var e;
1958
+ return !!((e = this.currentMask) != null && e.isFilled);
1959
+ }
1960
+ remove(e, t) {
1961
+ const s = new x();
1962
+ return this.currentMask && s.aggregate(this.currentMask.remove(e, t)).aggregate(this._applyDispatch()), s;
1963
+ }
1964
+ get state() {
1965
+ var e;
1966
+ return {
1967
+ ...super.state,
1968
+ _rawInputValue: this.rawInputValue,
1969
+ compiledMasks: this.compiledMasks.map((t) => t.state),
1970
+ currentMaskRef: this.currentMask,
1971
+ currentMask: (e = this.currentMask) == null ? void 0 : e.state
1972
+ };
1973
+ }
1974
+ set state(e) {
1975
+ const {
1976
+ compiledMasks: t,
1977
+ currentMaskRef: s,
1978
+ currentMask: a,
1979
+ ...i
1980
+ } = e;
1981
+ t && this.compiledMasks.forEach((n, u) => n.state = t[u]), s != null && (this.currentMask = s, this.currentMask.state = a), super.state = i;
1982
+ }
1983
+ extractInput(e, t, s) {
1984
+ return this.currentMask ? this.currentMask.extractInput(e, t, s) : "";
1985
+ }
1986
+ extractTail(e, t) {
1987
+ return this.currentMask ? this.currentMask.extractTail(e, t) : super.extractTail(e, t);
1988
+ }
1989
+ doCommit() {
1990
+ this.currentMask && this.currentMask.doCommit(), super.doCommit();
1991
+ }
1992
+ nearestInputPos(e, t) {
1993
+ return this.currentMask ? this.currentMask.nearestInputPos(e, t) : super.nearestInputPos(e, t);
1994
+ }
1995
+ get overwrite() {
1996
+ return this.currentMask ? this.currentMask.overwrite : this._overwrite;
1997
+ }
1998
+ set overwrite(e) {
1999
+ this._overwrite = e;
2000
+ }
2001
+ get eager() {
2002
+ return this.currentMask ? this.currentMask.eager : this._eager;
2003
+ }
2004
+ set eager(e) {
2005
+ this._eager = e;
2006
+ }
2007
+ get skipInvalid() {
2008
+ return this.currentMask ? this.currentMask.skipInvalid : this._skipInvalid;
2009
+ }
2010
+ set skipInvalid(e) {
2011
+ this._skipInvalid = e;
2012
+ }
2013
+ get autofix() {
2014
+ return this.currentMask ? this.currentMask.autofix : this._autofix;
2015
+ }
2016
+ set autofix(e) {
2017
+ this._autofix = e;
2018
+ }
2019
+ maskEquals(e) {
2020
+ return Array.isArray(e) ? this.compiledMasks.every((t, s) => {
2021
+ if (!e[s]) return;
2022
+ const {
2023
+ mask: a,
2024
+ ...i
2025
+ } = e[s];
2026
+ return Oe(t, i) && t.maskEquals(a);
2027
+ }) : super.maskEquals(e);
2028
+ }
2029
+ typedValueEquals(e) {
2030
+ var t;
2031
+ return !!((t = this.currentMask) != null && t.typedValueEquals(e));
2032
+ }
2033
+ }
2034
+ $e.DEFAULTS = {
2035
+ ...W.DEFAULTS,
2036
+ dispatch: (r, e, t, s) => {
2037
+ if (!e.compiledMasks.length) return;
2038
+ const a = e.rawInputValue, i = e.compiledMasks.map((n, u) => {
2039
+ const l = e.currentMask === n, o = l ? n.displayValue.length : n.nearestInputPos(n.displayValue.length, m.FORCE_LEFT);
2040
+ return n.rawInputValue !== a ? (n.reset(), n.append(a, {
2041
+ raw: !0
2042
+ })) : l || n.remove(o), n.append(r, e.currentMaskFlags(t)), n.appendTail(s), {
2043
+ index: u,
2044
+ weight: n.rawInputValue.length,
2045
+ totalInputPositions: n.totalInputPositions(0, Math.max(o, n.nearestInputPos(n.displayValue.length, m.FORCE_LEFT)))
2046
+ };
2047
+ });
2048
+ return i.sort((n, u) => u.weight - n.weight || u.totalInputPositions - n.totalInputPositions), e.compiledMasks[i[0].index];
2049
+ }
2050
+ };
2051
+ C.MaskedDynamic = $e;
2052
+ class Ne extends z {
2053
+ constructor(e) {
2054
+ super({
2055
+ ...Ne.DEFAULTS,
2056
+ ...e
2057
+ });
2058
+ }
2059
+ updateOptions(e) {
2060
+ super.updateOptions(e);
2061
+ }
2062
+ _update(e) {
2063
+ const {
2064
+ enum: t,
2065
+ ...s
2066
+ } = e;
2067
+ if (t) {
2068
+ const a = t.map((u) => u.length), i = Math.min(...a), n = Math.max(...a) - i;
2069
+ s.mask = "*".repeat(i), n && (s.mask += "[" + "*".repeat(n) + "]"), this.enum = t;
2070
+ }
2071
+ super._update(s);
2072
+ }
2073
+ _appendCharRaw(e, t) {
2074
+ t === void 0 && (t = {});
2075
+ const s = Math.min(this.nearestInputPos(0, m.FORCE_RIGHT), this.value.length), a = this.enum.filter((i) => this.matchValue(i, this.unmaskedValue + e, s));
2076
+ if (a.length) {
2077
+ a.length === 1 && this._forEachBlocksInRange(0, this.value.length, (n, u) => {
2078
+ const l = a[0][u];
2079
+ u >= this.value.length || l === n.value || (n.reset(), n._appendChar(l, t));
2080
+ });
2081
+ const i = super._appendCharRaw(a[0][this.value.length], t);
2082
+ return a.length === 1 && a[0].slice(this.unmaskedValue.length).split("").forEach((n) => i.aggregate(super._appendCharRaw(n))), i;
2083
+ }
2084
+ return new x({
2085
+ skip: !this.isComplete
2086
+ });
2087
+ }
2088
+ extractTail(e, t) {
2089
+ return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), new J("", e);
2090
+ }
2091
+ remove(e, t) {
2092
+ if (e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), e === t) return new x();
2093
+ const s = Math.min(super.nearestInputPos(0, m.FORCE_RIGHT), this.value.length);
2094
+ let a;
2095
+ for (a = e; a >= 0 && !(this.enum.filter((n) => this.matchValue(n, this.value.slice(s, a), s)).length > 1); --a)
2096
+ ;
2097
+ const i = super.remove(a, t);
2098
+ return i.tailShift += a - e, i;
2099
+ }
2100
+ get isComplete() {
2101
+ return this.enum.indexOf(this.value) >= 0;
2102
+ }
2103
+ }
2104
+ Ne.DEFAULTS = {
2105
+ ...z.DEFAULTS,
2106
+ matchValue: (r, e, t) => r.indexOf(e, t) === t
2107
+ };
2108
+ C.MaskedEnum = Ne;
2109
+ class wt extends W {
2110
+ /** */
2111
+ /** Enable characters overwriting */
2112
+ /** */
2113
+ /** */
2114
+ /** */
2115
+ updateOptions(e) {
2116
+ super.updateOptions(e);
2117
+ }
2118
+ _update(e) {
2119
+ super._update({
2120
+ ...e,
2121
+ validate: e.mask
2122
+ });
2123
+ }
2124
+ }
2125
+ C.MaskedFunction = wt;
2126
+ var it;
2127
+ class q extends W {
2128
+ /** Single char */
2129
+ /** Single char */
2130
+ /** Array of single chars */
2131
+ /** */
2132
+ /** */
2133
+ /** Digits after point */
2134
+ /** Flag to remove leading and trailing zeros in the end of editing */
2135
+ /** Flag to pad trailing zeros after point in the end of editing */
2136
+ /** Enable characters overwriting */
2137
+ /** */
2138
+ /** */
2139
+ /** */
2140
+ /** Format typed value to string */
2141
+ /** Parse string to get typed value */
2142
+ constructor(e) {
2143
+ super({
2144
+ ...q.DEFAULTS,
2145
+ ...e
2146
+ });
2147
+ }
2148
+ updateOptions(e) {
2149
+ super.updateOptions(e);
2150
+ }
2151
+ _update(e) {
2152
+ super._update(e), this._updateRegExps();
2153
+ }
2154
+ _updateRegExps() {
2155
+ const e = "^" + (this.allowNegative ? "[+|\\-]?" : ""), t = "\\d*", s = (this.scale ? "(" + Ye(this.radix) + "\\d{0," + this.scale + "})?" : "") + "$";
2156
+ this._numberRegExp = new RegExp(e + t + s), this._mapToRadixRegExp = new RegExp("[" + this.mapToRadix.map(Ye).join("") + "]", "g"), this._thousandsSeparatorRegExp = new RegExp(Ye(this.thousandsSeparator), "g");
2157
+ }
2158
+ _removeThousandsSeparators(e) {
2159
+ return e.replace(this._thousandsSeparatorRegExp, "");
2160
+ }
2161
+ _insertThousandsSeparators(e) {
2162
+ const t = e.split(this.radix);
2163
+ return t[0] = t[0].replace(/\B(?=(\d{3})+(?!\d))/g, this.thousandsSeparator), t.join(this.radix);
2164
+ }
2165
+ doPrepareChar(e, t) {
2166
+ t === void 0 && (t = {});
2167
+ const [s, a] = super.doPrepareChar(this._removeThousandsSeparators(this.scale && this.mapToRadix.length && /*
2168
+ radix should be mapped when
2169
+ 1) input is done from keyboard = flags.input && flags.raw
2170
+ 2) unmasked value is set = !flags.input && !flags.raw
2171
+ and should not be mapped when
2172
+ 1) value is set = flags.input && !flags.raw
2173
+ 2) raw value is set = !flags.input && flags.raw
2174
+ */
2175
+ (t.input && t.raw || !t.input && !t.raw) ? e.replace(this._mapToRadixRegExp, this.radix) : e), t);
2176
+ return e && !s && (a.skip = !0), s && !this.allowPositive && !this.value && s !== "-" && a.aggregate(this._appendChar("-")), [s, a];
2177
+ }
2178
+ _separatorsCount(e, t) {
2179
+ t === void 0 && (t = !1);
2180
+ let s = 0;
2181
+ for (let a = 0; a < e; ++a)
2182
+ this._value.indexOf(this.thousandsSeparator, a) === a && (++s, t && (e += this.thousandsSeparator.length));
2183
+ return s;
2184
+ }
2185
+ _separatorsCountFromSlice(e) {
2186
+ return e === void 0 && (e = this._value), this._separatorsCount(this._removeThousandsSeparators(e).length, !0);
2187
+ }
2188
+ extractInput(e, t, s) {
2189
+ 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));
2190
+ }
2191
+ _appendCharRaw(e, t) {
2192
+ t === void 0 && (t = {});
2193
+ const s = t.tail && t._beforeTailState ? t._beforeTailState._value : this._value, a = this._separatorsCountFromSlice(s);
2194
+ this._value = this._removeThousandsSeparators(this.value);
2195
+ const i = this._value;
2196
+ this._value += e;
2197
+ const n = this.number;
2198
+ let u = !isNaN(n), l = !1;
2199
+ if (u) {
2200
+ let k;
2201
+ this.min != null && this.min < 0 && this.number < this.min && (k = this.min), this.max != null && this.max > 0 && this.number > this.max && (k = this.max), k != null && (this.autofix ? (this._value = this.format(k, this).replace(q.UNMASKED_RADIX, this.radix), l || (l = i === this._value && !t.tail)) : u = !1), u && (u = !!this._value.match(this._numberRegExp));
2202
+ }
2203
+ let o;
2204
+ u ? o = new x({
2205
+ inserted: this._value.slice(i.length),
2206
+ rawInserted: l ? "" : e,
2207
+ skip: l
2208
+ }) : (this._value = i, o = new x()), this._value = this._insertThousandsSeparators(this._value);
2209
+ const h = t.tail && t._beforeTailState ? t._beforeTailState._value : this._value, c = this._separatorsCountFromSlice(h);
2210
+ return o.tailShift += (c - a) * this.thousandsSeparator.length, o;
2211
+ }
2212
+ _findSeparatorAround(e) {
2213
+ if (this.thousandsSeparator) {
2214
+ const t = e - this.thousandsSeparator.length + 1, s = this.value.indexOf(this.thousandsSeparator, t);
2215
+ if (s <= e) return s;
2216
+ }
2217
+ return -1;
2218
+ }
2219
+ _adjustRangeWithSeparators(e, t) {
2220
+ const s = this._findSeparatorAround(e);
2221
+ s >= 0 && (e = s);
2222
+ const a = this._findSeparatorAround(t);
2223
+ return a >= 0 && (t = a + this.thousandsSeparator.length), [e, t];
2224
+ }
2225
+ remove(e, t) {
2226
+ e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), [e, t] = this._adjustRangeWithSeparators(e, t);
2227
+ const s = this.value.slice(0, e), a = this.value.slice(t), i = this._separatorsCount(s.length);
2228
+ this._value = this._insertThousandsSeparators(this._removeThousandsSeparators(s + a));
2229
+ const n = this._separatorsCountFromSlice(s);
2230
+ return new x({
2231
+ tailShift: (n - i) * this.thousandsSeparator.length
2232
+ });
2233
+ }
2234
+ nearestInputPos(e, t) {
2235
+ if (!this.thousandsSeparator) return e;
2236
+ switch (t) {
2237
+ case m.NONE:
2238
+ case m.LEFT:
2239
+ case m.FORCE_LEFT: {
2240
+ const s = this._findSeparatorAround(e - 1);
2241
+ if (s >= 0) {
2242
+ const a = s + this.thousandsSeparator.length;
2243
+ if (e < a || this.value.length <= a || t === m.FORCE_LEFT)
2244
+ return s;
2245
+ }
2246
+ break;
2247
+ }
2248
+ case m.RIGHT:
2249
+ case m.FORCE_RIGHT: {
2250
+ const s = this._findSeparatorAround(e);
2251
+ if (s >= 0)
2252
+ return s + this.thousandsSeparator.length;
2253
+ }
2254
+ }
2255
+ return e;
2256
+ }
2257
+ doCommit() {
2258
+ if (this.value) {
2259
+ const e = this.number;
2260
+ let t = e;
2261
+ 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));
2262
+ let s = this.value;
2263
+ this.normalizeZeros && (s = this._normalizeZeros(s)), this.padFractionalZeros && this.scale > 0 && (s = this._padFractionalZeros(s)), this._value = s;
2264
+ }
2265
+ super.doCommit();
2266
+ }
2267
+ _normalizeZeros(e) {
2268
+ const t = this._removeThousandsSeparators(e).split(this.radix);
2269
+ return t[0] = t[0].replace(/^(\D*)(0*)(\d*)/, (s, a, i, n) => a + 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));
2270
+ }
2271
+ _padFractionalZeros(e) {
2272
+ if (!e) return e;
2273
+ const t = e.split(this.radix);
2274
+ return t.length < 2 && t.push(""), t[1] = t[1].padEnd(this.scale, "0"), t.join(this.radix);
2275
+ }
2276
+ doSkipInvalid(e, t, s) {
2277
+ t === void 0 && (t = {});
2278
+ const a = this.scale === 0 && e !== this.thousandsSeparator && (e === this.radix || e === q.UNMASKED_RADIX || this.mapToRadix.includes(e));
2279
+ return super.doSkipInvalid(e, t, s) && !a;
2280
+ }
2281
+ get unmaskedValue() {
2282
+ return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix, q.UNMASKED_RADIX);
2283
+ }
2284
+ set unmaskedValue(e) {
2285
+ super.unmaskedValue = e;
2286
+ }
2287
+ get typedValue() {
2288
+ return this.parse(this.unmaskedValue, this);
2289
+ }
2290
+ set typedValue(e) {
2291
+ this.rawInputValue = this.format(e, this).replace(q.UNMASKED_RADIX, this.radix);
2292
+ }
2293
+ /** Parsed Number */
2294
+ get number() {
2295
+ return this.typedValue;
2296
+ }
2297
+ set number(e) {
2298
+ this.typedValue = e;
2299
+ }
2300
+ get allowNegative() {
2301
+ return this.min != null && this.min < 0 || this.max != null && this.max < 0;
2302
+ }
2303
+ get allowPositive() {
2304
+ return this.min != null && this.min > 0 || this.max != null && this.max > 0;
2305
+ }
2306
+ typedValueEquals(e) {
2307
+ return (super.typedValueEquals(e) || q.EMPTY_VALUES.includes(e) && q.EMPTY_VALUES.includes(this.typedValue)) && !(e === 0 && this.value === "");
2308
+ }
2309
+ }
2310
+ it = q;
2311
+ q.UNMASKED_RADIX = ".";
2312
+ q.EMPTY_VALUES = [...W.EMPTY_VALUES, 0];
2313
+ q.DEFAULTS = {
2314
+ ...W.DEFAULTS,
2315
+ mask: Number,
2316
+ radix: ",",
2317
+ thousandsSeparator: "",
2318
+ mapToRadix: [it.UNMASKED_RADIX],
2319
+ min: Number.MIN_SAFE_INTEGER,
2320
+ max: Number.MAX_SAFE_INTEGER,
2321
+ scale: 2,
2322
+ normalizeZeros: !0,
2323
+ padFractionalZeros: !1,
2324
+ parse: Number,
2325
+ format: (r) => r.toLocaleString("en-US", {
2326
+ useGrouping: !1,
2327
+ maximumFractionDigits: 20
2328
+ })
2329
+ };
2330
+ C.MaskedNumber = q;
2331
+ const He = {
2332
+ MASKED: "value",
2333
+ UNMASKED: "unmaskedValue",
2334
+ TYPED: "typedValue"
2335
+ };
2336
+ function nt(r, e, t) {
2337
+ e === void 0 && (e = He.MASKED), t === void 0 && (t = He.MASKED);
2338
+ const s = ae(r);
2339
+ return (a) => s.runIsolated((i) => (i[e] = a, i[t]));
2340
+ }
2341
+ function It(r, e, t, s) {
2342
+ return nt(e, t, s)(r);
2343
+ }
2344
+ C.PIPE_TYPE = He;
2345
+ C.createPipe = nt;
2346
+ C.pipe = It;
2347
+ class Tt extends z {
2348
+ get repeatFrom() {
2349
+ var e;
2350
+ return (e = Array.isArray(this.repeat) ? this.repeat[0] : this.repeat === 1 / 0 ? 0 : this.repeat) != null ? e : 0;
2351
+ }
2352
+ get repeatTo() {
2353
+ var e;
2354
+ return (e = Array.isArray(this.repeat) ? this.repeat[1] : this.repeat) != null ? e : 1 / 0;
2355
+ }
2356
+ constructor(e) {
2357
+ super(e);
2358
+ }
2359
+ updateOptions(e) {
2360
+ super.updateOptions(e);
2361
+ }
2362
+ _update(e) {
2363
+ var t, s, a;
2364
+ const {
2365
+ repeat: i,
2366
+ ...n
2367
+ } = xe(e);
2368
+ this._blockOpts = Object.assign({}, this._blockOpts, n);
2369
+ const u = ae(this._blockOpts);
2370
+ this.repeat = (t = (s = i ?? u.repeat) != null ? s : this.repeat) != null ? t : 1 / 0, super._update({
2371
+ mask: "m".repeat(Math.max(this.repeatTo === 1 / 0 && ((a = this._blocks) == null ? void 0 : a.length) || 0, this.repeatFrom)),
2372
+ blocks: {
2373
+ m: u
2374
+ },
2375
+ eager: u.eager,
2376
+ overwrite: u.overwrite,
2377
+ skipInvalid: u.skipInvalid,
2378
+ lazy: u.lazy,
2379
+ placeholderChar: u.placeholderChar,
2380
+ displayChar: u.displayChar
2381
+ });
2382
+ }
2383
+ _allocateBlock(e) {
2384
+ if (e < this._blocks.length) return this._blocks[e];
2385
+ if (this.repeatTo === 1 / 0 || this._blocks.length < this.repeatTo)
2386
+ return this._blocks.push(ae(this._blockOpts)), this.mask += "m", this._blocks[this._blocks.length - 1];
2387
+ }
2388
+ _appendCharRaw(e, t) {
2389
+ t === void 0 && (t = {});
2390
+ const s = new x();
2391
+ for (
2392
+ let l = (a = (i = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : i.index) != null ? a : Math.max(this._blocks.length - 1, 0), o, h;
2393
+ // try to get a block or
2394
+ // try to allocate a new block if not allocated already
2395
+ o = (n = this._blocks[l]) != null ? n : h = !h && this._allocateBlock(l);
2396
+ ++l
2397
+ ) {
2398
+ var a, i, n, u;
2399
+ const c = o._appendChar(e, {
2400
+ ...t,
2401
+ _beforeTailState: (u = t._beforeTailState) == null || (u = u._blocks) == null ? void 0 : u[l]
2402
+ });
2403
+ if (c.skip && h) {
2404
+ this._blocks.pop(), this.mask = this.mask.slice(1);
2405
+ break;
2406
+ }
2407
+ if (s.aggregate(c), c.consumed) break;
2408
+ }
2409
+ return s;
2410
+ }
2411
+ _trimEmptyTail(e, t) {
2412
+ var s, a;
2413
+ e === void 0 && (e = 0);
2414
+ const i = Math.max(((s = this._mapPosToBlock(e)) == null ? void 0 : s.index) || 0, this.repeatFrom, 0);
2415
+ let n;
2416
+ t != null && (n = (a = this._mapPosToBlock(t)) == null ? void 0 : a.index), n == null && (n = this._blocks.length - 1);
2417
+ let u = 0;
2418
+ for (let l = n; i <= l && !this._blocks[l].unmaskedValue; --l, ++u)
2419
+ ;
2420
+ u && (this._blocks.splice(n - u + 1, u), this.mask = this.mask.slice(u));
2421
+ }
2422
+ reset() {
2423
+ super.reset(), this._trimEmptyTail();
2424
+ }
2425
+ remove(e, t) {
2426
+ e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length);
2427
+ const s = super.remove(e, t);
2428
+ return this._trimEmptyTail(e, t), s;
2429
+ }
2430
+ totalInputPositions(e, t) {
2431
+ return e === void 0 && (e = 0), t == null && this.repeatTo === 1 / 0 ? 1 / 0 : super.totalInputPositions(e, t);
2432
+ }
2433
+ get state() {
2434
+ return super.state;
2435
+ }
2436
+ set state(e) {
2437
+ this._blocks.length = e._blocks.length, this.mask = this.mask.slice(0, this._blocks.length), super.state = e;
2438
+ }
2439
+ }
2440
+ C.RepeatBlock = Tt;
2441
+ try {
2442
+ globalThis.IMask = C;
2443
+ } catch {
2444
+ }
2445
+ var Ot = {
2446
+ // common
2447
+ mask: void 0,
2448
+ prepare: Function,
2449
+ prepareChar: Function,
2450
+ validate: Function,
2451
+ commit: Function,
2452
+ overwrite: {
2453
+ type: Boolean,
2454
+ required: !1,
2455
+ default: void 0
2456
+ },
2457
+ eager: {
2458
+ required: !1,
2459
+ default: void 0,
2460
+ validator: (r) => ["append", "remove"].includes(r) || typeof r == "boolean"
2461
+ },
2462
+ skipInvalid: {
2463
+ type: Boolean,
2464
+ required: !1,
2465
+ default: void 0
2466
+ },
2467
+ // pattern
2468
+ placeholderChar: String,
2469
+ displayChar: String,
2470
+ lazy: {
2471
+ type: Boolean,
2472
+ required: !1,
2473
+ default: void 0
2474
+ },
2475
+ definitions: Object,
2476
+ blocks: Object,
2477
+ // enum
2478
+ enum: Array,
2479
+ // range
2480
+ maxLength: Number,
2481
+ from: Number,
2482
+ to: Number,
2483
+ // date
2484
+ pattern: String,
2485
+ format: Function,
2486
+ parse: Function,
2487
+ autofix: {
2488
+ required: !1,
2489
+ default: void 0,
2490
+ validator: (r) => r === "pad" || typeof r == "boolean"
2491
+ },
2492
+ // number
2493
+ radix: String,
2494
+ thousandsSeparator: String,
2495
+ mapToRadix: Array,
2496
+ scale: Number,
2497
+ normalizeZeros: {
2498
+ type: Boolean,
2499
+ required: !1,
2500
+ default: void 0
2501
+ },
2502
+ padFractionalZeros: {
2503
+ type: Boolean,
2504
+ required: !1,
2505
+ default: void 0
2506
+ },
2507
+ min: [Number, Date],
2508
+ max: [Number, Date],
2509
+ // dynamic
2510
+ dispatch: Function
2511
+ };
2512
+ function Rt(r, e) {
2513
+ let {
2514
+ emit: t,
2515
+ onAccept: s,
2516
+ onComplete: a,
2517
+ defaultValue: i,
2518
+ defaultUnmaskedValue: n,
2519
+ defaultTypedValue: u
2520
+ } = e === void 0 ? {} : e;
2521
+ const l = ht(r) ? r : G(r), o = G(), h = G(), c = G(""), k = G(""), v = G();
2522
+ let F, I = c.value, L = k.value, he = v.value;
2523
+ function ie() {
2524
+ he = v.value = h.value.typedValue, L = k.value = h.value.unmaskedValue, I = c.value = h.value.value;
2525
+ }
2526
+ function S(b) {
2527
+ ie(), t && (t("accept", c.value, b), t("accept:masked", c.value, b), t("accept:typed", v.value, b), t("accept:unmasked", k.value, b)), s?.(b);
2528
+ }
2529
+ function O(b) {
2530
+ t && (t("complete", h.value.value, b), t("complete:masked", h.value.value, b), t("complete:typed", h.value.typedValue, b), t("complete:unmasked", h.value.unmaskedValue, b)), a?.(b);
2531
+ }
2532
+ const y = () => {
2533
+ !h.value || k.value === void 0 || (L !== k.value && (h.value.unmaskedValue = k.value, h.value.unmaskedValue !== k.value && S()), L = void 0);
2534
+ };
2535
+ ue(k, y);
2536
+ const w = () => {
2537
+ !h.value || c.value === void 0 || (I !== c.value && (h.value.value = c.value, h.value.value !== c.value && S()), I = void 0);
2538
+ };
2539
+ ue(c, w);
2540
+ const $ = () => {
2541
+ !h.value || v.value === void 0 || (he !== v.value && (h.value.typedValue = v.value, h.value.masked.typedValueEquals(v.value) || S()), he = void 0);
2542
+ };
2543
+ ue(v, $);
2544
+ function R() {
2545
+ F = o.value;
2546
+ const b = l.value;
2547
+ !F || !(b != null && b.mask) || (h.value = C(F, b), i !== void 0 && (c.value = i), n !== void 0 && (k.value = n), u !== void 0 && (v.value = u), y(), w(), $(), ie(), h.value.on("accept", S).on("complete", O));
2548
+ }
2549
+ function ee() {
2550
+ var b;
2551
+ (b = h.value) == null || b.destroy(), h.value = void 0;
2552
+ }
2553
+ return ct(R), pt(ee), ue([o, l], () => {
2554
+ const b = o.value, M = l.value;
2555
+ (!(M != null && M.mask) || b !== F) && ee(), b && (h.value ? h.value.updateOptions(M) : R());
2556
+ }), {
2557
+ el: o,
2558
+ mask: dt(h),
2559
+ masked: c,
2560
+ unmasked: k,
2561
+ typed: v
2562
+ };
2563
+ }
2564
+ function Pt(r, e) {
2565
+ return r = {
2566
+ ...r
2567
+ }, Object.keys(r).forEach((t) => {
2568
+ (r[t] === void 0 || e.includes(t)) && delete r[t];
2569
+ }), r;
2570
+ }
2571
+ const Lt = ["typed", "unmasked", "value", "modelValue"];
2572
+ var $t = ve({
2573
+ name: "imask-input",
2574
+ inheritAttrs: !1,
2575
+ props: {
2576
+ // plugin
2577
+ modelValue: String,
2578
+ value: String,
2579
+ unmasked: String,
2580
+ typed: {
2581
+ validator: () => !0
2582
+ },
2583
+ ...Ot
2584
+ },
2585
+ emits: ["update:modelValue", "update:masked", "update:value", "update:unmasked", "update:typed", "accept", "accept:value", "accept:masked", "accept:unmasked", "accept:typed", "complete", "complete:value", "complete:masked", "complete:unmasked", "complete:typed"],
2586
+ setup(r, e) {
2587
+ let {
2588
+ attrs: t,
2589
+ emit: s
2590
+ } = e;
2591
+ const {
2592
+ el: a,
2593
+ mask: i,
2594
+ masked: n,
2595
+ unmasked: u,
2596
+ typed: l
2597
+ } = Rt(Pt(r, Lt), {
2598
+ emit: s,
2599
+ onAccept: (v) => {
2600
+ const F = n.value;
2601
+ s("accept:value", F, v), s("update:value", F, v), s("update:masked", F, v), s("update:modelValue", F, v), s("update:unmasked", u.value, v), s("update:typed", l.value, v);
2602
+ },
2603
+ onComplete: (v) => {
2604
+ s("complete:value", n.value, v);
2605
+ }
2606
+ }), o = Ae(r, "value"), h = Ae(r, "modelValue"), c = Ae(r, "unmasked"), k = Ae(r, "typed");
2607
+ return n.value = h.value || o.value || "", u.value = c.value || "", l.value = k.value, ue(o, (v) => n.value = v), ue(h, (v) => n.value = v), ue(c, (v) => u.value = v), ue(k, (v) => l.value = v), () => {
2608
+ const v = {
2609
+ ...t,
2610
+ value: r.value != null ? r.value : r.modelValue != null ? r.modelValue : i.value ? i.value.displayValue : "",
2611
+ ref: a
2612
+ };
2613
+ return r.mask || (v.onInput = (F) => {
2614
+ s("update:modelValue", F.target.value), s("update:value", F.target.value);
2615
+ }), ut("input", v);
2616
+ };
2617
+ }
2618
+ }), Nt = $t;
2619
+ const Ut = ["for"], Yt = { class: "state-layer" }, zt = { class: "content" }, Ht = { class: "input-text-container" }, jt = ["id", "placeholder", "aria-label"], qt = {
2620
+ key: 1,
2621
+ class: "has-text-body-small phila-supporting-text"
2622
+ }, Kt = {
2623
+ key: 2,
2624
+ class: "has-text-body-small phila-error-text"
2625
+ }, We = /* @__PURE__ */ ve({
2626
+ inheritAttrs: !1,
2627
+ __name: "TextField",
2628
+ props: {
2629
+ modelValue: { default: void 0 },
2630
+ className: { default: "" },
2631
+ label: { default: "" },
2632
+ id: { default: `phila-text-field-${Math.random().toString(36).substring(2, 9)}` },
2633
+ imaskProps: { default: void 0 },
2634
+ supportingText: { default: "" },
2635
+ placeholder: { default: "" },
2636
+ leadingIcon: { default: "" },
2637
+ trailingIcon: { default: "" },
2638
+ error: { default() {
2639
+ return [];
2640
+ } }
2641
+ },
2642
+ emits: ["update:modelValue", "complete"],
2643
+ setup(r, { emit: e }) {
2644
+ const t = Je(), s = r, a = Y(() => typeof s.error == "string" ? s.error : s.error[0]), i = Ae(s, "id"), n = e, u = G(""), l = Y({
2645
+ get: () => s.modelValue !== void 0 ? s.modelValue : u.value,
2646
+ set: (F) => {
2647
+ n("update:modelValue", F), u.value = F;
2648
+ }
2649
+ }), o = Y(() => {
2650
+ const F = ["default-class"];
2651
+ return t.disabled != null && F.push("phila-input--disabled"), a.value && F.push("phila-input--error"), t.required != null && F.push("phila-input--required"), be(...F);
2652
+ }), h = Y(() => {
2653
+ const F = [];
2654
+ return l.value !== "" && F.push("phila-text-field--filled"), s.className && F.push(s.className), be(...F);
2655
+ }), c = Y(() => {
2656
+ if (!(s.label || t["aria-label"]))
2657
+ return s.placeholder || void 0;
2658
+ }), k = G(null), v = (F) => {
2659
+ F.target.closest("button") || k.value?.focus();
2660
+ };
2661
+ return (F, I) => (V(), U("div", {
2662
+ class: ze(["phila-input", o.value])
2663
+ }, [
2664
+ s.label ? (V(), U("label", {
2665
+ key: 0,
2666
+ for: i.value,
2667
+ class: "has-text-label-small phila-label"
2668
+ }, Z(s.label), 9, Ut)) : pe("", !0),
2669
+ H("div", {
2670
+ class: ze(["phila-text-field", h.value]),
2671
+ onClick: re(v, ["prevent"])
2672
+ }, [
2673
+ H("div", Yt, [
2674
+ s.leadingIcon ? (V(), se(D(Ue), {
2675
+ key: 0,
2676
+ "icon-class": s.leadingIcon,
2677
+ inline: "",
2678
+ decorative: ""
2679
+ }, null, 8, ["icon-class"])) : pe("", !0),
2680
+ H("div", zt, [
2681
+ H("div", Ht, [
2682
+ s.imaskProps?.mask ? (V(), se(D(Nt), Q({ key: 0 }, { ...D(t), ...s.imaskProps }, {
2683
+ id: i.value,
2684
+ modelValue: l.value,
2685
+ "onUpdate:modelValue": I[0] || (I[0] = (L) => l.value = L),
2686
+ class: "phila-text-field-input has-text-body-default",
2687
+ placeholder: s.placeholder,
2688
+ onComplete: I[1] || (I[1] = () => n("complete", u.value))
2689
+ }), null, 16, ["id", "modelValue", "placeholder"])) : lt((V(), U("input", Q({ key: 1 }, D(t), {
2690
+ id: i.value,
2691
+ "onUpdate:modelValue": I[2] || (I[2] = (L) => l.value = L),
2692
+ class: "phila-text-field-input has-text-body-default",
2693
+ placeholder: s.placeholder,
2694
+ "aria-label": c.value
2695
+ }), null, 16, jt)), [
2696
+ [ot, l.value]
2697
+ ])
2698
+ ])
2699
+ ]),
2700
+ l.value != "" ? (V(), se(D(_t), {
2701
+ key: 1,
2702
+ variant: "standard",
2703
+ size: "small",
2704
+ "icon-only": "",
2705
+ "icon-definition": D(At),
2706
+ onClick: I[3] || (I[3] = (L) => l.value = "")
2707
+ }, null, 8, ["icon-definition"])) : pe("", !0),
2708
+ s.trailingIcon ? (V(), se(D(Ue), {
2709
+ key: 2,
2710
+ size: "small",
2711
+ "icon-class": s.trailingIcon,
2712
+ inline: "",
2713
+ decorative: ""
2714
+ }, null, 8, ["icon-class"])) : pe("", !0),
2715
+ me(F.$slots, "trailing-action")
2716
+ ])
2717
+ ], 2),
2718
+ s.supportingText ? (V(), U("div", qt, Z(s.supportingText), 1)) : pe("", !0),
2719
+ a.value ? (V(), U("div", Kt, [
2720
+ ge(D(Ue), {
2721
+ "icon-definition": D(yt),
2722
+ size: "small",
2723
+ inline: "",
2724
+ decorative: ""
2725
+ }, null, 8, ["icon-definition"]),
2726
+ Fe(" " + Z(a.value), 1)
2727
+ ])) : pe("", !0)
2728
+ ], 2));
2729
+ }
2730
+ }), Gt = ["data-toggle", "aria-label", "aria-expanded", "aria-controls"], Zt = /* @__PURE__ */ ve({
2731
+ __name: "CollapsePanel",
2732
+ props: {
2733
+ className: {},
2734
+ id: {},
2735
+ group: { default: void 0 },
2736
+ blurClose: { type: Boolean, default: !1 },
2737
+ openSingle: { type: Boolean, default: !1 },
2738
+ mouseOverToggle: { type: Boolean, default: !1 },
2739
+ outsideClickClose: { type: Boolean, default: !1 },
2740
+ escapeKeyClose: { type: Boolean, default: !1 },
2741
+ toggleAttrs: { default: void 0 }
2742
+ },
2743
+ setup(r) {
2744
+ const e = r, { isCollapsed: t, onMouseEnter: s, onMouseLeave: a, onClickToggle: i, onClickOpen: n, focusChange: u } = gt(e), l = Y(() => t(e.id));
2745
+ return (o, h) => (V(), U("div", {
2746
+ onMouseenter: h[1] || (h[1] = //@ts-ignore
2747
+ (...c) => D(s) && D(s)(...c)),
2748
+ onMouseleave: h[2] || (h[2] = //@ts-ignore
2749
+ (...c) => D(a) && D(a)(...c)),
2750
+ onFocusout: h[3] || (h[3] = //@ts-ignore
2751
+ (...c) => D(u) && D(u)(...c))
2752
+ }, [
2753
+ me(o.$slots, "toggle", _e(Ce({
2754
+ open: l.value,
2755
+ ariaLabel: l.value ? "Close panel" : "Open panel",
2756
+ ariaExpanded: l.value,
2757
+ ariaControls: r.id,
2758
+ onClickToggle: D(i),
2759
+ onClickOpen: D(n),
2760
+ focusChange: D(u),
2761
+ onClick: D(i)
2762
+ })), () => [
2763
+ H("button", Q({
2764
+ "data-toggle": r.id,
2765
+ "aria-label": l.value ? "Close panel" : "Open panel",
2766
+ "aria-expanded": l.value,
2767
+ "aria-controls": r.id
2768
+ }, r.toggleAttrs, {
2769
+ onClick: h[0] || (h[0] = re(
2770
+ //@ts-ignore
2771
+ (...c) => D(i) && D(i)(...c),
2772
+ ["prevent"]
2773
+ ))
2774
+ }), null, 16, Gt)
2775
+ ]),
2776
+ me(o.$slots, "default", _e(Ce({ id: r.id, open: l.value, onClickToggle: D(i), focusChange: D(u), hidden: !l.value })))
2777
+ ], 32));
2778
+ }
2779
+ }), Wt = ["disabled"], Xt = /* @__PURE__ */ ve({
2780
+ inheritAttrs: !1,
2781
+ __name: "PhlButton",
2782
+ props: {
2783
+ href: {},
2784
+ to: {},
2785
+ target: {},
2786
+ rel: {},
2787
+ disabled: { type: Boolean, default: !1 },
2788
+ clickTarget: {},
2789
+ variant: { default: "primary" },
2790
+ size: { default: "medium" },
2791
+ iconOnly: { type: Boolean, default: !1 },
2792
+ iconRight: { type: Boolean },
2793
+ text: {},
2794
+ className: {},
2795
+ iconDefinition: {},
2796
+ iconClass: {},
2797
+ src: {},
2798
+ svgRaw: {}
2799
+ },
2800
+ setup(r) {
2801
+ const e = r, t = (n) => "href" in n && n.href !== void 0 || "to" in n && n.to !== void 0, s = Y(() => be(
2802
+ "phila-button",
2803
+ `phila-button--${e.variant}`,
2804
+ e.size && `is-${e.size}`,
2805
+ e.iconOnly && "icon-button",
2806
+ e.iconOnly && e.variant === "standard" && "icon-button--standard",
2807
+ e.className
2808
+ )), a = Y(() => t(e) ? "to" in e && e.to !== void 0 ? {
2809
+ to: e.to,
2810
+ disabled: e.disabled,
2811
+ className: s.value
2812
+ } : {
2813
+ href: e.href,
2814
+ target: e.target,
2815
+ rel: e.rel,
2816
+ disabled: e.disabled,
2817
+ className: s.value
2818
+ } : {}), i = Y(
2819
+ () => ({
2820
+ iconDefinition: e.iconDefinition,
2821
+ iconClass: e.iconClass,
2822
+ src: e.src,
2823
+ iconRight: e.iconRight,
2824
+ iconOnly: e.iconOnly,
2825
+ text: e.text,
2826
+ size: e.size
2827
+ })
2828
+ );
2829
+ return (n, u) => t(e) ? (V(), se(D(Qe), Q({ key: 0 }, { ...a.value, ...n.$attrs }, { role: "button" }), {
2830
+ default: le(() => [
2831
+ ge(D(Te), _e(Ce(i.value)), {
2832
+ default: le(() => [
2833
+ me(n.$slots, "default", {}, () => [
2834
+ Fe(Z(e.text), 1)
2835
+ ])
2836
+ ]),
2837
+ _: 3
2838
+ }, 16)
2839
+ ]),
2840
+ _: 3
2841
+ }, 16)) : (V(), U("button", Q({
2842
+ key: 1,
2843
+ type: "button",
2844
+ disabled: e.disabled,
2845
+ class: s.value
2846
+ }, n.$attrs), [
2847
+ ge(D(Te), _e(Ce(i.value)), {
2848
+ default: le(() => [
2849
+ me(n.$slots, "default", {}, () => [
2850
+ Fe(Z(e.text), 1)
2851
+ ])
2852
+ ]),
2853
+ _: 3
2854
+ }, 16)
2855
+ ], 16, Wt));
2856
+ }
2857
+ });
2858
+ var Jt = {
2859
+ prefix: "fas",
2860
+ iconName: "xmark",
2861
+ icon: [384, 512, [128473, 10005, 10006, 10060, 215, "close", "multiply", "remove", "times"], "f00d", "M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z"]
2862
+ }, Qt = Jt;
2863
+ function es(r) {
2864
+ return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
2865
+ }
2866
+ var Ie = { exports: {} }, ts = Ie.exports, Xe;
2867
+ function ss() {
2868
+ return Xe || (Xe = 1, (function(r, e) {
2869
+ (function(t, s) {
2870
+ r.exports = s();
2871
+ })(ts, (function() {
2872
+ var t = 1e3, s = 6e4, a = 36e5, i = "millisecond", n = "second", u = "minute", l = "hour", o = "day", h = "week", c = "month", k = "quarter", v = "year", F = "date", I = "Invalid Date", L = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, he = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, ie = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(_) {
2873
+ var f = ["th", "st", "nd", "rd"], d = _ % 100;
2874
+ return "[" + _ + (f[(d - 20) % 10] || f[d] || f[0]) + "]";
2875
+ } }, S = function(_, f, d) {
2876
+ var g = String(_);
2877
+ return !g || g.length >= f ? _ : "" + Array(f + 1 - g.length).join(d) + _;
2878
+ }, O = { s: S, z: function(_) {
2879
+ var f = -_.utcOffset(), d = Math.abs(f), g = Math.floor(d / 60), p = d % 60;
2880
+ return (f <= 0 ? "+" : "-") + S(g, 2, "0") + ":" + S(p, 2, "0");
2881
+ }, m: function _(f, d) {
2882
+ if (f.date() < d.date()) return -_(d, f);
2883
+ var g = 12 * (d.year() - f.year()) + (d.month() - f.month()), p = f.clone().add(g, c), E = d - p < 0, A = f.clone().add(g + (E ? -1 : 1), c);
2884
+ return +(-(g + (d - p) / (E ? p - A : A - p)) || 0);
2885
+ }, a: function(_) {
2886
+ return _ < 0 ? Math.ceil(_) || 0 : Math.floor(_);
2887
+ }, p: function(_) {
2888
+ return { M: c, y: v, w: h, d: o, D: F, h: l, m: u, s: n, ms: i, Q: k }[_] || String(_ || "").toLowerCase().replace(/s$/, "");
2889
+ }, u: function(_) {
2890
+ return _ === void 0;
2891
+ } }, y = "en", w = {};
2892
+ w[y] = ie;
2893
+ var $ = "$isDayjsObject", R = function(_) {
2894
+ return _ instanceof De || !(!_ || !_[$]);
2895
+ }, ee = function _(f, d, g) {
2896
+ var p;
2897
+ if (!f) return y;
2898
+ if (typeof f == "string") {
2899
+ var E = f.toLowerCase();
2900
+ w[E] && (p = E), d && (w[E] = d, p = E);
2901
+ var A = f.split("-");
2902
+ if (!p && A.length > 1) return _(A[0]);
2903
+ } else {
2904
+ var B = f.name;
2905
+ w[B] = f, p = B;
2906
+ }
2907
+ return !g && p && (y = p), p || !g && y;
2908
+ }, b = function(_, f) {
2909
+ if (R(_)) return _.clone();
2910
+ var d = typeof f == "object" ? f : {};
2911
+ return d.date = _, d.args = arguments, new De(d);
2912
+ }, M = O;
2913
+ M.l = ee, M.i = R, M.w = function(_, f) {
2914
+ return b(_, { locale: f.$L, utc: f.$u, x: f.$x, $offset: f.$offset });
2915
+ };
2916
+ var De = (function() {
2917
+ function _(d) {
2918
+ this.$L = ee(d.locale, null, !0), this.parse(d), this.$x = this.$x || d.x || {}, this[$] = !0;
2919
+ }
2920
+ var f = _.prototype;
2921
+ return f.parse = function(d) {
2922
+ this.$d = (function(g) {
2923
+ var p = g.date, E = g.utc;
2924
+ if (p === null) return /* @__PURE__ */ new Date(NaN);
2925
+ if (M.u(p)) return /* @__PURE__ */ new Date();
2926
+ if (p instanceof Date) return new Date(p);
2927
+ if (typeof p == "string" && !/Z$/i.test(p)) {
2928
+ var A = p.match(L);
2929
+ if (A) {
2930
+ var B = A[2] - 1 || 0, T = (A[7] || "0").substring(0, 3);
2931
+ return E ? new Date(Date.UTC(A[1], B, A[3] || 1, A[4] || 0, A[5] || 0, A[6] || 0, T)) : new Date(A[1], B, A[3] || 1, A[4] || 0, A[5] || 0, A[6] || 0, T);
2932
+ }
2933
+ }
2934
+ return new Date(p);
2935
+ })(d), this.init();
2936
+ }, f.init = function() {
2937
+ var d = this.$d;
2938
+ this.$y = d.getFullYear(), this.$M = d.getMonth(), this.$D = d.getDate(), this.$W = d.getDay(), this.$H = d.getHours(), this.$m = d.getMinutes(), this.$s = d.getSeconds(), this.$ms = d.getMilliseconds();
2939
+ }, f.$utils = function() {
2940
+ return M;
2941
+ }, f.isValid = function() {
2942
+ return this.$d.toString() !== I;
2943
+ }, f.isSame = function(d, g) {
2944
+ var p = b(d);
2945
+ return this.startOf(g) <= p && p <= this.endOf(g);
2946
+ }, f.isAfter = function(d, g) {
2947
+ return b(d) < this.startOf(g);
2948
+ }, f.isBefore = function(d, g) {
2949
+ return this.endOf(g) < b(d);
2950
+ }, f.$g = function(d, g, p) {
2951
+ return M.u(d) ? this[g] : this.set(p, d);
2952
+ }, f.unix = function() {
2953
+ return Math.floor(this.valueOf() / 1e3);
2954
+ }, f.valueOf = function() {
2955
+ return this.$d.getTime();
2956
+ }, f.startOf = function(d, g) {
2957
+ var p = this, E = !!M.u(g) || g, A = M.p(d), B = function(ce, j) {
2958
+ var ne = M.w(p.$u ? Date.UTC(p.$y, j, ce) : new Date(p.$y, j, ce), p);
2959
+ return E ? ne : ne.endOf(o);
2960
+ }, T = function(ce, j) {
2961
+ return M.w(p.toDate()[ce].apply(p.toDate("s"), (E ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(j)), p);
2962
+ }, P = this.$W, N = this.$M, K = this.$D, ke = "set" + (this.$u ? "UTC" : "");
2963
+ switch (A) {
2964
+ case v:
2965
+ return E ? B(1, 0) : B(31, 11);
2966
+ case c:
2967
+ return E ? B(1, N) : B(0, N + 1);
2968
+ case h:
2969
+ var de = this.$locale().weekStart || 0, ye = (P < de ? P + 7 : P) - de;
2970
+ return B(E ? K - ye : K + (6 - ye), N);
2971
+ case o:
2972
+ case F:
2973
+ return T(ke + "Hours", 0);
2974
+ case l:
2975
+ return T(ke + "Minutes", 1);
2976
+ case u:
2977
+ return T(ke + "Seconds", 2);
2978
+ case n:
2979
+ return T(ke + "Milliseconds", 3);
2980
+ default:
2981
+ return this.clone();
2982
+ }
2983
+ }, f.endOf = function(d) {
2984
+ return this.startOf(d, !1);
2985
+ }, f.$set = function(d, g) {
2986
+ var p, E = M.p(d), A = "set" + (this.$u ? "UTC" : ""), B = (p = {}, p[o] = A + "Date", p[F] = A + "Date", p[c] = A + "Month", p[v] = A + "FullYear", p[l] = A + "Hours", p[u] = A + "Minutes", p[n] = A + "Seconds", p[i] = A + "Milliseconds", p)[E], T = E === o ? this.$D + (g - this.$W) : g;
2987
+ if (E === c || E === v) {
2988
+ var P = this.clone().set(F, 1);
2989
+ P.$d[B](T), P.init(), this.$d = P.set(F, Math.min(this.$D, P.daysInMonth())).$d;
2990
+ } else B && this.$d[B](T);
2991
+ return this.init(), this;
2992
+ }, f.set = function(d, g) {
2993
+ return this.clone().$set(d, g);
2994
+ }, f.get = function(d) {
2995
+ return this[M.p(d)]();
2996
+ }, f.add = function(d, g) {
2997
+ var p, E = this;
2998
+ d = Number(d);
2999
+ var A = M.p(g), B = function(N) {
3000
+ var K = b(E);
3001
+ return M.w(K.date(K.date() + Math.round(N * d)), E);
3002
+ };
3003
+ if (A === c) return this.set(c, this.$M + d);
3004
+ if (A === v) return this.set(v, this.$y + d);
3005
+ if (A === o) return B(1);
3006
+ if (A === h) return B(7);
3007
+ var T = (p = {}, p[u] = s, p[l] = a, p[n] = t, p)[A] || 1, P = this.$d.getTime() + d * T;
3008
+ return M.w(P, this);
3009
+ }, f.subtract = function(d, g) {
3010
+ return this.add(-1 * d, g);
3011
+ }, f.format = function(d) {
3012
+ var g = this, p = this.$locale();
3013
+ if (!this.isValid()) return p.invalidDate || I;
3014
+ var E = d || "YYYY-MM-DDTHH:mm:ssZ", A = M.z(this), B = this.$H, T = this.$m, P = this.$M, N = p.weekdays, K = p.months, ke = p.meridiem, de = function(j, ne, Ee, Se) {
3015
+ return j && (j[ne] || j(g, E)) || Ee[ne].slice(0, Se);
3016
+ }, ye = function(j) {
3017
+ return M.s(B % 12 || 12, j, "0");
3018
+ }, ce = ke || function(j, ne, Ee) {
3019
+ var Se = j < 12 ? "AM" : "PM";
3020
+ return Ee ? Se.toLowerCase() : Se;
3021
+ };
3022
+ return E.replace(he, (function(j, ne) {
3023
+ return ne || (function(Ee) {
3024
+ switch (Ee) {
3025
+ case "YY":
3026
+ return String(g.$y).slice(-2);
3027
+ case "YYYY":
3028
+ return M.s(g.$y, 4, "0");
3029
+ case "M":
3030
+ return P + 1;
3031
+ case "MM":
3032
+ return M.s(P + 1, 2, "0");
3033
+ case "MMM":
3034
+ return de(p.monthsShort, P, K, 3);
3035
+ case "MMMM":
3036
+ return de(K, P);
3037
+ case "D":
3038
+ return g.$D;
3039
+ case "DD":
3040
+ return M.s(g.$D, 2, "0");
3041
+ case "d":
3042
+ return String(g.$W);
3043
+ case "dd":
3044
+ return de(p.weekdaysMin, g.$W, N, 2);
3045
+ case "ddd":
3046
+ return de(p.weekdaysShort, g.$W, N, 3);
3047
+ case "dddd":
3048
+ return N[g.$W];
3049
+ case "H":
3050
+ return String(B);
3051
+ case "HH":
3052
+ return M.s(B, 2, "0");
3053
+ case "h":
3054
+ return ye(1);
3055
+ case "hh":
3056
+ return ye(2);
3057
+ case "a":
3058
+ return ce(B, T, !0);
3059
+ case "A":
3060
+ return ce(B, T, !1);
3061
+ case "m":
3062
+ return String(T);
3063
+ case "mm":
3064
+ return M.s(T, 2, "0");
3065
+ case "s":
3066
+ return String(g.$s);
3067
+ case "ss":
3068
+ return M.s(g.$s, 2, "0");
3069
+ case "SSS":
3070
+ return M.s(g.$ms, 3, "0");
3071
+ case "Z":
3072
+ return A;
3073
+ }
3074
+ return null;
3075
+ })(j) || A.replace(":", "");
3076
+ }));
3077
+ }, f.utcOffset = function() {
3078
+ return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
3079
+ }, f.diff = function(d, g, p) {
3080
+ var E, A = this, B = M.p(g), T = b(d), P = (T.utcOffset() - this.utcOffset()) * s, N = this - T, K = function() {
3081
+ return M.m(A, T);
3082
+ };
3083
+ switch (B) {
3084
+ case v:
3085
+ E = K() / 12;
3086
+ break;
3087
+ case c:
3088
+ E = K();
3089
+ break;
3090
+ case k:
3091
+ E = K() / 3;
3092
+ break;
3093
+ case h:
3094
+ E = (N - P) / 6048e5;
3095
+ break;
3096
+ case o:
3097
+ E = (N - P) / 864e5;
3098
+ break;
3099
+ case l:
3100
+ E = N / a;
3101
+ break;
3102
+ case u:
3103
+ E = N / s;
3104
+ break;
3105
+ case n:
3106
+ E = N / t;
3107
+ break;
3108
+ default:
3109
+ E = N;
3110
+ }
3111
+ return p ? E : M.a(E);
3112
+ }, f.daysInMonth = function() {
3113
+ return this.endOf(c).$D;
3114
+ }, f.$locale = function() {
3115
+ return w[this.$L];
3116
+ }, f.locale = function(d, g) {
3117
+ if (!d) return this.$L;
3118
+ var p = this.clone(), E = ee(d, g, !0);
3119
+ return E && (p.$L = E), p;
3120
+ }, f.clone = function() {
3121
+ return M.w(this.$d, this);
3122
+ }, f.toDate = function() {
3123
+ return new Date(this.valueOf());
3124
+ }, f.toJSON = function() {
3125
+ return this.isValid() ? this.toISOString() : null;
3126
+ }, f.toISOString = function() {
3127
+ return this.$d.toISOString();
3128
+ }, f.toString = function() {
3129
+ return this.$d.toUTCString();
3130
+ }, _;
3131
+ })(), qe = De.prototype;
3132
+ return b.prototype = qe, [["$ms", i], ["$s", n], ["$m", u], ["$H", l], ["$W", o], ["$M", c], ["$y", v], ["$D", F]].forEach((function(_) {
3133
+ qe[_[1]] = function(f) {
3134
+ return this.$g(f, _[0], _[1]);
3135
+ };
3136
+ })), b.extend = function(_, f) {
3137
+ return _.$i || (_(f, De, b), _.$i = !0), b;
3138
+ }, b.locale = ee, b.isDayjs = R, b.unix = function(_) {
3139
+ return b(1e3 * _);
3140
+ }, b.en = w[y], b.Ls = w, b.p = {}, b;
3141
+ }));
3142
+ })(Ie)), Ie.exports;
3143
+ }
3144
+ var as = ss();
3145
+ const X = /* @__PURE__ */ es(as), is = ["id"], ns = { class: "date-picker-close is-flex is-justify-flex-end" }, rs = { class: "date-picker-header is-flex is-justify-space-between is-align-center mb-2 content" }, us = { class: "calendar is-flex is-flex-wrap content" }, ls = ["title", "tabindex", "disabled", "onClick"], os = ["id", "title", "tabindex", "disabled", "onClick"], hs = ["title", "disabled", "onClick"], ds = /* @__PURE__ */ ve({
3146
+ __name: "DatePicker",
3147
+ props: {
3148
+ id: {},
3149
+ close: { type: Function },
3150
+ initialValue: {},
3151
+ min: {},
3152
+ max: {},
3153
+ format: {}
3154
+ },
3155
+ emits: ["update:modelValue"],
3156
+ setup(r, { expose: e, emit: t }) {
3157
+ const s = r, a = t, i = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], n = G(X(s.initialValue === "" ? void 0 : s.initialValue)), u = G(n.value), l = Y(() => {
3158
+ const S = u.value.daysInMonth();
3159
+ return Array.from({ length: S }, (O, y) => u.value.date(y + 1));
3160
+ }), o = Y(() => Array.from(
3161
+ {
3162
+ length: u.value.date(1).day()
3163
+ },
3164
+ (O, y) => u.value.date(-y)
3165
+ ).reverse()), h = Y(() => Array.from(
3166
+ {
3167
+ length: 6 - u.value.endOf("month").day()
3168
+ },
3169
+ (O, y) => u.value.endOf("month").add(y + 1, "day")
3170
+ )), c = (S) => !rt(S, s.min, s.max), k = (S) => {
3171
+ n.value = S, a("update:modelValue", n.value.format(s.format)), s.close();
3172
+ }, v = (S) => {
3173
+ a("update:modelValue", S), S ? (n.value = X(S, s.format), u.value = n.value) : (n.value = X(), u.value = X());
3174
+ }, F = () => {
3175
+ u.value = u.value.add(1, "month");
3176
+ }, I = () => {
3177
+ u.value = u.value.subtract(1, "month");
3178
+ }, L = (S) => {
3179
+ const O = document.querySelector("#selected-day");
3180
+ O instanceof HTMLButtonElement && (S.preventDefault(), O.focus());
3181
+ }, he = (S) => {
3182
+ const O = document.querySelector(`#${s.id} button`);
3183
+ O instanceof HTMLButtonElement && (S.preventDefault(), O.focus());
3184
+ }, ie = (S) => {
3185
+ if (S.key === "Tab" && !S.shiftKey && he(S), ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Home", "End"].includes(S.key)) {
3186
+ S.preventDefault();
3187
+ const y = document.activeElement;
3188
+ if (y instanceof HTMLButtonElement) {
3189
+ const w = Array.from(document.querySelectorAll(".calendar button")).filter(
3190
+ (ee) => !ee.disabled
3191
+ ), $ = w.indexOf(y);
3192
+ let R = $;
3193
+ switch (S.key) {
3194
+ case "ArrowUp":
3195
+ R = $ - 7;
3196
+ break;
3197
+ case "ArrowDown":
3198
+ R = $ + 7;
3199
+ break;
3200
+ case "ArrowLeft":
3201
+ R = $ - 1;
3202
+ break;
3203
+ case "ArrowRight":
3204
+ R = $ + 1;
3205
+ break;
3206
+ case "Home":
3207
+ R = 0;
3208
+ break;
3209
+ case "End":
3210
+ R = w.length - 1;
3211
+ break;
3212
+ }
3213
+ R >= 0 && R < w.length ? w[R].focus() : R < 0 ? (I(), Ke(() => {
3214
+ document.querySelector(".calendar > span:last-of-type button:last-of-type")?.focus();
3215
+ })) : R >= w.length && (F(), Ke(() => {
3216
+ document.querySelector(".calendar button")?.focus();
3217
+ }));
3218
+ }
3219
+ }
3220
+ };
3221
+ return e({
3222
+ update: v,
3223
+ focusDatePicker: L
3224
+ }), (S, O) => (V(), U("div", {
3225
+ id: r.id,
3226
+ class: "date-picker"
3227
+ }, [
3228
+ H("div", ns, [
3229
+ ge(D(Xt), {
3230
+ id: `${r.id}-date-picker-toggle`,
3231
+ variant: "standard",
3232
+ size: "extra-small",
3233
+ "icon-only": "",
3234
+ "icon-definition": D(Qt),
3235
+ "aria-label": "close date picker",
3236
+ onClick: re(r.close, ["prevent"])
3237
+ }, null, 8, ["id", "icon-definition", "onClick"])
3238
+ ]),
3239
+ H("div", rs, [
3240
+ H("button", {
3241
+ class: "phila-button icon-button--secondary is-extra-small",
3242
+ onClick: re(I, ["prevent"])
3243
+ }, " Prev "),
3244
+ H("span", null, Z(u.value.format("MMMM YYYY")), 1),
3245
+ H("button", {
3246
+ class: "phila-button is-extra-small",
3247
+ onClick: re(F, ["prevent"])
3248
+ }, "Next")
3249
+ ]),
3250
+ H("div", us, [
3251
+ (V(), U(Me, null, Be(i, (y) => H("span", {
3252
+ key: y,
3253
+ class: "calendar-day is-5 has-text-weight-bold"
3254
+ }, Z(y), 1)), 64)),
3255
+ (V(!0), U(Me, null, Be(o.value, (y, w) => (V(), U("span", {
3256
+ key: "day-in-previous-month-" + y.date(),
3257
+ class: "calendar-day outside-month is-5"
3258
+ }, [
3259
+ H("button", {
3260
+ class: "phila-button is-extra-small p-2",
3261
+ title: `${y.format("MMMM D, YYYY")}`,
3262
+ tabindex: w === 0 ? 0 : -1,
3263
+ disabled: c(y),
3264
+ onKeydown: O[0] || (O[0] = ($) => ie($)),
3265
+ onClick: re(($) => k(y), ["prevent"])
3266
+ }, Z(y.date()), 41, ls)
3267
+ ]))), 128)),
3268
+ (V(!0), U(Me, null, Be(l.value, (y, w) => (V(), U("span", {
3269
+ key: `day-in-current-month-${y.date()}`,
3270
+ class: "calendar-day is-5"
3271
+ }, [
3272
+ H("button", {
3273
+ id: y.isSame(n.value, "day") ? "selected-day" : void 0,
3274
+ class: ze(["phila-button is-extra-small p-2", {
3275
+ active: y.isSame(n.value, "day")
3276
+ }]),
3277
+ title: y.format("MMMM D, YYYY"),
3278
+ tabindex: y.isSame(n.value, "day") || y.month() !== n.value.month() && w === 0 ? 0 : -1,
3279
+ disabled: c(y),
3280
+ onKeydown: O[1] || (O[1] = ($) => ie($)),
3281
+ onClick: re(() => k(y), ["prevent"])
3282
+ }, Z(y.date()), 43, os)
3283
+ ]))), 128)),
3284
+ (V(!0), U(Me, null, Be(h.value, (y) => (V(), U("span", {
3285
+ key: "day-in-next-month-" + y.date(),
3286
+ class: "calendar-day outside-month is-5"
3287
+ }, [
3288
+ H("button", {
3289
+ class: "phila-button is-extra-small p-2",
3290
+ title: `${y.format("MMMM D, YYYY")}`,
3291
+ tabindex: "-1",
3292
+ disabled: c(y),
3293
+ onKeydown: O[2] || (O[2] = (w) => ie(w)),
3294
+ onClick: re((w) => k(y), ["prevent"])
3295
+ }, Z(y.date()), 41, hs)
3296
+ ]))), 128))
3297
+ ])
3298
+ ], 8, is));
3299
+ }
3300
+ }), cs = (r, e) => {
3301
+ const t = r.__vccOpts || r;
3302
+ for (const [s, a] of e)
3303
+ t[s] = a;
18
3304
  return t;
19
- }, v = /* @__PURE__ */ i(_, [["__scopeId", "data-v-75c4084b"]]);
3305
+ }, ps = /* @__PURE__ */ cs(ds, [["__scopeId", "data-v-8fd98834"]]), gs = /* @__PURE__ */ ve({
3306
+ inheritAttrs: !1,
3307
+ __name: "DateField",
3308
+ props: {
3309
+ format: { default: "MM/DD/YYYY" },
3310
+ datePicker: { type: Boolean },
3311
+ imaskProps: { default: () => ({
3312
+ mask: Date,
3313
+ pattern: "m/d/Y",
3314
+ format: (r) => X(r).format("MM/DD/YYYY"),
3315
+ parse: (r) => X(r, "MM/DD/YYYY").toDate()
3316
+ }) },
3317
+ datePickerOptions: {},
3318
+ min: {},
3319
+ max: {},
3320
+ className: {},
3321
+ modelValue: {},
3322
+ label: {},
3323
+ id: { default: () => vt("phila-date-field-") },
3324
+ supportingText: {},
3325
+ placeholder: {},
3326
+ leadingIcon: {},
3327
+ trailingIcon: {},
3328
+ error: {}
3329
+ },
3330
+ setup(r) {
3331
+ const e = r, t = Je(), s = ft("datePicker"), a = G(e.modelValue), i = G(""), n = Y(() => be("default-class", e.className)), u = (o) => {
3332
+ a.value = o;
3333
+ }, l = (o) => {
3334
+ (e.min || e.max) && (rt(o, e.min, e.max) ? i.value = "" : i.value = "Selected date should be between " + X(e.min).format(e.format) + " and " + X(e.max).format(e.format)), s.value?.update(o);
3335
+ };
3336
+ return (o, h) => r.datePicker ? (V(), se(D(Zt), {
3337
+ key: 0,
3338
+ id: `${e.id}-date-picker`,
3339
+ group: "date-picker",
3340
+ "outside-click-close": "",
3341
+ "escape-key-close": "",
3342
+ "open-single": ""
3343
+ }, {
3344
+ toggle: le((c) => [
3345
+ ge(D(We), Q({ ...D(t), ...e }, {
3346
+ modelValue: a.value,
3347
+ "onUpdate:modelValue": [
3348
+ h[0] || (h[0] = (k) => a.value = k),
3349
+ u
3350
+ ],
3351
+ class: n.value,
3352
+ "aria-controls": c.ariaControls,
3353
+ "trailing-icon": "fa-solid fa-calendar",
3354
+ min: void 0,
3355
+ max: void 0,
3356
+ error: i.value || e.error,
3357
+ onFocus: (k) => c.open ? null : c?.onClickToggle(k),
3358
+ onClick: (k) => c.open ? null : c?.onClickOpen(k),
3359
+ onKeydown: h[1] || (h[1] = mt((k) => s.value?.focusDatePicker(k), ["tab"])),
3360
+ onComplete: l
3361
+ }), null, 16, ["modelValue", "class", "aria-controls", "error", "onFocus", "onClick"])
3362
+ ]),
3363
+ default: le(({ open: c, id: k, onClickToggle: v }) => [
3364
+ c ? (V(), se(ps, Q({
3365
+ key: 0,
3366
+ id: k,
3367
+ ref: "datePicker"
3368
+ }, e.datePickerOptions, {
3369
+ "initial-value": a.value,
3370
+ min: e.min,
3371
+ max: e.max,
3372
+ format: e.format,
3373
+ close: v,
3374
+ "onUpdate:modelValue": u
3375
+ }), null, 16, ["id", "initial-value", "min", "max", "format", "close"])) : pe("", !0)
3376
+ ]),
3377
+ _: 1
3378
+ }, 8, ["id"])) : (V(), se(D(We), Q({ key: 1 }, { ...D(t), ...e }, {
3379
+ modelValue: a.value,
3380
+ "onUpdate:modelValue": [
3381
+ h[2] || (h[2] = (c) => a.value = c),
3382
+ u
3383
+ ],
3384
+ class: n.value,
3385
+ label: "Date field",
3386
+ "trailing-icon": "fa-solid fa-calendar",
3387
+ errors: i.value || e.error,
3388
+ min: void 0,
3389
+ max: void 0
3390
+ }), null, 16, ["modelValue", "class", "errors"]));
3391
+ }
3392
+ }), rt = (r, e, t) => {
3393
+ typeof r == "string" && (r = X(r));
3394
+ const s = e ? X(e) : null, a = t ? X(t) : null;
3395
+ return !(s && r.isBefore(s, "day") || a && r.isAfter(a, "day"));
3396
+ };
20
3397
  export {
21
- v as DateField
3398
+ gs as DateField,
3399
+ rt as isInDateRange
22
3400
  };