brd-ui-kit 0.1.67 → 0.1.68

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