@7pmlabs/design-system 0.5.7 → 0.5.8

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 (202) hide show
  1. package/dist/design-system102.js +1 -1
  2. package/dist/design-system102.mjs +3 -3
  3. package/dist/design-system103.js +1 -1
  4. package/dist/design-system103.js.map +1 -1
  5. package/dist/design-system103.mjs +1069 -2138
  6. package/dist/design-system103.mjs.map +1 -1
  7. package/dist/design-system104.js +1 -1
  8. package/dist/design-system104.js.map +1 -1
  9. package/dist/design-system104.mjs +25 -1103
  10. package/dist/design-system104.mjs.map +1 -1
  11. package/dist/design-system105.js +1 -1
  12. package/dist/design-system105.js.map +1 -1
  13. package/dist/design-system105.mjs +2171 -24
  14. package/dist/design-system105.mjs.map +1 -1
  15. package/dist/design-system107.js +1 -1
  16. package/dist/design-system107.mjs +1 -1
  17. package/dist/design-system111.js +1 -1
  18. package/dist/design-system111.mjs +1 -1
  19. package/dist/design-system118.js +1 -1
  20. package/dist/design-system118.js.map +1 -1
  21. package/dist/design-system118.mjs +63 -4
  22. package/dist/design-system118.mjs.map +1 -1
  23. package/dist/design-system119.js +1 -1
  24. package/dist/design-system119.js.map +1 -1
  25. package/dist/design-system119.mjs +3 -7
  26. package/dist/design-system119.mjs.map +1 -1
  27. package/dist/design-system120.js +1 -1
  28. package/dist/design-system120.js.map +1 -1
  29. package/dist/design-system120.mjs +9 -7
  30. package/dist/design-system120.mjs.map +1 -1
  31. package/dist/design-system121.js +1 -1
  32. package/dist/design-system121.js.map +1 -1
  33. package/dist/design-system121.mjs +6 -62
  34. package/dist/design-system121.mjs.map +1 -1
  35. package/dist/design-system122.js +1 -1
  36. package/dist/design-system122.js.map +1 -1
  37. package/dist/design-system122.mjs +3 -3
  38. package/dist/design-system122.mjs.map +1 -1
  39. package/dist/design-system123.js +1 -1
  40. package/dist/design-system123.js.map +1 -1
  41. package/dist/design-system123.mjs +3 -9
  42. package/dist/design-system123.mjs.map +1 -1
  43. package/dist/design-system124.js +1 -1
  44. package/dist/design-system124.js.map +1 -1
  45. package/dist/design-system124.mjs +5 -6
  46. package/dist/design-system124.mjs.map +1 -1
  47. package/dist/design-system125.js +1 -1
  48. package/dist/design-system125.js.map +1 -1
  49. package/dist/design-system125.mjs +9 -3
  50. package/dist/design-system125.mjs.map +1 -1
  51. package/dist/design-system126.js +1 -1
  52. package/dist/design-system126.js.map +1 -1
  53. package/dist/design-system126.mjs +5 -3
  54. package/dist/design-system126.mjs.map +1 -1
  55. package/dist/design-system127.js +1 -1
  56. package/dist/design-system127.js.map +1 -1
  57. package/dist/design-system127.mjs +5 -6
  58. package/dist/design-system127.mjs.map +1 -1
  59. package/dist/design-system128.js +1 -1
  60. package/dist/design-system128.js.map +1 -1
  61. package/dist/design-system128.mjs +4 -10
  62. package/dist/design-system128.mjs.map +1 -1
  63. package/dist/design-system129.js +1 -1
  64. package/dist/design-system129.js.map +1 -1
  65. package/dist/design-system129.mjs +3 -4
  66. package/dist/design-system129.mjs.map +1 -1
  67. package/dist/design-system13.js +1 -1
  68. package/dist/design-system13.mjs +2 -2
  69. package/dist/design-system130.js +1 -1
  70. package/dist/design-system130.js.map +1 -1
  71. package/dist/design-system130.mjs +12 -5
  72. package/dist/design-system130.mjs.map +1 -1
  73. package/dist/design-system131.js +1 -1
  74. package/dist/design-system131.js.map +1 -1
  75. package/dist/design-system131.mjs +27 -4
  76. package/dist/design-system131.mjs.map +1 -1
  77. package/dist/design-system132.js +1 -1
  78. package/dist/design-system132.js.map +1 -1
  79. package/dist/design-system132.mjs +4 -2
  80. package/dist/design-system132.mjs.map +1 -1
  81. package/dist/design-system133.js +1 -1
  82. package/dist/design-system133.js.map +1 -1
  83. package/dist/design-system133.mjs +6 -12
  84. package/dist/design-system133.mjs.map +1 -1
  85. package/dist/design-system134.js +1 -1
  86. package/dist/design-system134.js.map +1 -1
  87. package/dist/design-system134.mjs +8 -27
  88. package/dist/design-system134.mjs.map +1 -1
  89. package/dist/design-system135.js +1 -1
  90. package/dist/design-system135.js.map +1 -1
  91. package/dist/design-system135.mjs +4 -5
  92. package/dist/design-system135.mjs.map +1 -1
  93. package/dist/design-system136.js +1 -1
  94. package/dist/design-system136.js.map +1 -1
  95. package/dist/design-system136.mjs +6 -6
  96. package/dist/design-system136.mjs.map +1 -1
  97. package/dist/design-system137.js +1 -1
  98. package/dist/design-system137.js.map +1 -1
  99. package/dist/design-system137.mjs +6 -7
  100. package/dist/design-system137.mjs.map +1 -1
  101. package/dist/design-system138.js +1 -1
  102. package/dist/design-system138.js.map +1 -1
  103. package/dist/design-system138.mjs +5 -4
  104. package/dist/design-system138.mjs.map +1 -1
  105. package/dist/design-system139.js +1 -1
  106. package/dist/design-system139.js.map +1 -1
  107. package/dist/design-system139.mjs +10 -6
  108. package/dist/design-system139.mjs.map +1 -1
  109. package/dist/design-system140.js +1 -1
  110. package/dist/design-system140.js.map +1 -1
  111. package/dist/design-system140.mjs +6 -7
  112. package/dist/design-system140.mjs.map +1 -1
  113. package/dist/design-system141.js +1 -1
  114. package/dist/design-system141.js.map +1 -1
  115. package/dist/design-system141.mjs +6 -5
  116. package/dist/design-system141.mjs.map +1 -1
  117. package/dist/design-system142.js +1 -1
  118. package/dist/design-system142.js.map +1 -1
  119. package/dist/design-system142.mjs +10 -10
  120. package/dist/design-system142.mjs.map +1 -1
  121. package/dist/design-system143.js +1 -1
  122. package/dist/design-system143.js.map +1 -1
  123. package/dist/design-system143.mjs +7 -6
  124. package/dist/design-system143.mjs.map +1 -1
  125. package/dist/design-system144.js +1 -1
  126. package/dist/design-system144.js.map +1 -1
  127. package/dist/design-system144.mjs +17 -6
  128. package/dist/design-system144.mjs.map +1 -1
  129. package/dist/design-system145.js +1 -1
  130. package/dist/design-system145.js.map +1 -1
  131. package/dist/design-system145.mjs +6 -9
  132. package/dist/design-system145.mjs.map +1 -1
  133. package/dist/design-system146.js +1 -1
  134. package/dist/design-system146.js.map +1 -1
  135. package/dist/design-system146.mjs +12 -6
  136. package/dist/design-system146.mjs.map +1 -1
  137. package/dist/design-system147.js +1 -1
  138. package/dist/design-system147.js.map +1 -1
  139. package/dist/design-system147.mjs +3 -17
  140. package/dist/design-system147.mjs.map +1 -1
  141. package/dist/design-system148.js +1 -1
  142. package/dist/design-system148.js.map +1 -1
  143. package/dist/design-system148.mjs +3 -6
  144. package/dist/design-system148.mjs.map +1 -1
  145. package/dist/design-system149.js +1 -1
  146. package/dist/design-system149.js.map +1 -1
  147. package/dist/design-system149.mjs +7 -12
  148. package/dist/design-system149.mjs.map +1 -1
  149. package/dist/design-system15.js +1 -1
  150. package/dist/design-system15.mjs +2 -2
  151. package/dist/design-system150.js +1 -1
  152. package/dist/design-system150.js.map +1 -1
  153. package/dist/design-system150.mjs +6 -3
  154. package/dist/design-system150.mjs.map +1 -1
  155. package/dist/design-system151.js +1 -1
  156. package/dist/design-system151.mjs +1 -1
  157. package/dist/design-system157.js +1 -1
  158. package/dist/design-system157.mjs +1 -1
  159. package/dist/design-system158.js +1 -1
  160. package/dist/design-system158.mjs +1 -1
  161. package/dist/design-system159.js +1 -1
  162. package/dist/design-system159.mjs +1 -1
  163. package/dist/design-system163.js +1 -1
  164. package/dist/design-system163.mjs +1 -1
  165. package/dist/design-system164.js +1 -1
  166. package/dist/design-system164.mjs +1 -1
  167. package/dist/design-system167.js +1 -1
  168. package/dist/design-system167.mjs +1 -1
  169. package/dist/design-system169.js +1 -1
  170. package/dist/design-system169.mjs +1 -1
  171. package/dist/design-system172.js +1 -1
  172. package/dist/design-system172.mjs +1 -1
  173. package/dist/design-system176.js +1 -1
  174. package/dist/design-system176.mjs +1 -1
  175. package/dist/design-system177.js +1 -1
  176. package/dist/design-system177.mjs +1 -1
  177. package/dist/design-system178.js +1 -1
  178. package/dist/design-system178.mjs +1 -1
  179. package/dist/design-system179.js +1 -1
  180. package/dist/design-system179.mjs +1 -1
  181. package/dist/design-system180.js +1 -1
  182. package/dist/design-system180.mjs +1 -1
  183. package/dist/design-system182.js +1 -1
  184. package/dist/design-system182.mjs +2 -2
  185. package/dist/design-system195.js +1 -1
  186. package/dist/design-system195.mjs +1 -1
  187. package/dist/design-system196.js +1 -1
  188. package/dist/design-system196.mjs +1 -1
  189. package/dist/design-system204.js +1 -1
  190. package/dist/design-system204.mjs +1 -1
  191. package/dist/design-system210.js +1 -1
  192. package/dist/design-system210.mjs +1 -1
  193. package/dist/design-system219.js +1 -1
  194. package/dist/design-system219.mjs +1 -1
  195. package/dist/design-system226.js +1 -1
  196. package/dist/design-system226.mjs +1 -1
  197. package/dist/design-system89.js +1 -1
  198. package/dist/design-system89.mjs +1 -1
  199. package/dist/design-system92.js +1 -1
  200. package/dist/design-system92.mjs +1 -1
  201. package/dist/style.css +1 -1
  202. package/package.json +2 -2
@@ -1,2175 +1,1106 @@
1
- (function(p, m) {
2
- typeof exports == "object" && typeof module < "u" ? m(exports) : typeof define == "function" && define.amd ? define(["exports"], m) : (p = typeof globalThis < "u" ? globalThis : p || self, m(p.IMask = {}));
3
- })(globalThis, function(p) {
4
- function m(n) {
5
- return typeof n == "string" || n instanceof String;
6
- }
7
- function P(n) {
8
- var t;
9
- return typeof n == "object" && n != null && (n == null || (t = n.constructor) == null ? void 0 : t.name) === "Object";
10
- }
11
- function U(n, t) {
12
- return Array.isArray(t) ? U(n, (e, s) => t.includes(s)) : Object.entries(n).reduce((e, s) => {
13
- let [i, u] = s;
14
- return t(u, i) && (e[i] = u), e;
15
- }, {});
16
- }
17
- const h = {
18
- NONE: "NONE",
19
- LEFT: "LEFT",
20
- FORCE_LEFT: "FORCE_LEFT",
21
- RIGHT: "RIGHT",
22
- FORCE_RIGHT: "FORCE_RIGHT"
23
- };
24
- function j(n) {
25
- switch (n) {
26
- case h.LEFT:
27
- return h.FORCE_LEFT;
28
- case h.RIGHT:
29
- return h.FORCE_RIGHT;
30
- default:
31
- return n;
32
- }
33
- }
34
- function y(n) {
35
- return n.replace(/([.*+?^=!:${}()|[\]/\\])/g, "\\$1");
36
- }
37
- function b(n, t) {
38
- if (t === n)
39
- return !0;
40
- const e = Array.isArray(t), s = Array.isArray(n);
41
- let i;
42
- if (e && s) {
43
- if (t.length != n.length)
44
- return !1;
45
- for (i = 0; i < t.length; i++)
46
- if (!b(t[i], n[i]))
47
- return !1;
48
- return !0;
49
- }
50
- if (e != s)
51
- return !1;
52
- if (t && n && typeof t == "object" && typeof n == "object") {
53
- const u = t instanceof Date, a = n instanceof Date;
54
- if (u && a)
55
- return t.getTime() == n.getTime();
56
- if (u != a)
57
- return !1;
58
- const r = t instanceof RegExp, l = n instanceof RegExp;
59
- if (r && l)
60
- return t.toString() == n.toString();
61
- if (r != l)
62
- return !1;
63
- const d = Object.keys(t);
64
- for (i = 0; i < d.length; i++)
65
- if (!Object.prototype.hasOwnProperty.call(n, d[i]))
66
- return !1;
67
- for (i = 0; i < d.length; i++)
68
- if (!b(n[d[i]], t[d[i]]))
69
- return !1;
70
- return !0;
71
- } else if (t && n && typeof t == "function" && typeof n == "function")
72
- return t.toString() === n.toString();
73
- return !1;
74
- }
75
- class Z {
76
- /** Current input value */
77
- /** Current cursor position */
78
- /** Old input value */
79
- /** Old selection */
80
- constructor(t) {
81
- for (Object.assign(this, t); this.value.slice(0, this.startChangePos) !== this.oldValue.slice(0, this.startChangePos); )
82
- --this.oldSelection.start;
83
- }
84
- /** Start changing position */
85
- get startChangePos() {
86
- return Math.min(this.cursorPos, this.oldSelection.start);
87
- }
88
- /** Inserted symbols count */
89
- get insertedCount() {
90
- return this.cursorPos - this.startChangePos;
91
- }
92
- /** Inserted symbols */
93
- get inserted() {
94
- return this.value.substr(this.startChangePos, this.insertedCount);
95
- }
96
- /** Removed symbols count */
97
- get removedCount() {
98
- return Math.max(this.oldSelection.end - this.startChangePos || // for Delete
99
- this.oldValue.length - this.value.length, 0);
100
- }
101
- /** Removed symbols */
102
- get removed() {
103
- return this.oldValue.substr(this.startChangePos, this.removedCount);
104
- }
105
- /** Unchanged head symbols */
106
- get head() {
107
- return this.value.substring(0, this.startChangePos);
108
- }
109
- /** Unchanged tail symbols */
110
- get tail() {
111
- return this.value.substring(this.startChangePos + this.insertedCount);
112
- }
113
- /** Remove direction */
114
- get removeDirection() {
115
- return !this.removedCount || this.insertedCount ? h.NONE : (this.oldSelection.end === this.cursorPos || this.oldSelection.start === this.cursorPos) && // if not range removed (event with backspace)
116
- this.oldSelection.end === this.oldSelection.start ? h.RIGHT : h.LEFT;
117
- }
118
- }
119
- function o(n, t) {
120
- return new o.InputMask(n, t);
121
- }
122
- function H(n) {
123
- if (n == null)
124
- throw new Error("mask property should be defined");
125
- return n instanceof RegExp ? o.MaskedRegExp : m(n) ? o.MaskedPattern : n === Date ? o.MaskedDate : n === Number ? o.MaskedNumber : Array.isArray(n) || n === Array ? o.MaskedDynamic : o.Masked && n.prototype instanceof o.Masked ? n : o.Masked && n instanceof o.Masked ? n.constructor : n instanceof Function ? o.MaskedFunction : (console.warn("Mask not found for mask", n), o.Masked);
126
- }
127
- function x(n) {
128
- if (!n)
129
- throw new Error("Options in not defined");
130
- if (o.Masked) {
131
- if (n.prototype instanceof o.Masked)
132
- return {
133
- mask: n
134
- };
135
- const {
136
- mask: t = void 0,
137
- ...e
138
- } = n instanceof o.Masked ? {
139
- mask: n
140
- } : P(n) && n.mask instanceof o.Masked ? n : {};
141
- if (t) {
142
- const s = t.mask;
143
- return {
144
- ...U(t, (i, u) => !u.startsWith("_")),
145
- mask: t.constructor,
146
- _mask: s,
147
- ...e
148
- };
1
+ import { getDefaultExportFromCjs as De, commonjsGlobal as ve } from "./design-system112.mjs";
2
+ import { __module as ne } from "./design-system117.mjs";
3
+ (function(re, fe) {
4
+ (function(U, j) {
5
+ re.exports = j();
6
+ })(ve, function() {
7
+ return function() {
8
+ var U = { d: function(r, e) {
9
+ for (var t in e)
10
+ U.o(e, t) && !U.o(r, t) && Object.defineProperty(r, t, { enumerable: !0, get: e[t] });
11
+ }, o: function(r, e) {
12
+ return Object.prototype.hasOwnProperty.call(r, e);
13
+ } }, j = {};
14
+ U.d(j, { default: function() {
15
+ return T;
16
+ } });
17
+ var l = { days: "days", months: "months", years: "years", day: "day", month: "month", year: "year", eventChangeViewDate: "changeViewDate", eventChangeCurrentView: "changeCurrentView", eventChangeFocusDate: "changeFocusDate", eventChangeSelectedDate: "changeSelectedDate", eventChangeTime: "changeTime", eventChangeLastSelectedDate: "changeLastSelectedDate", actionSelectDate: "selectDate", actionUnselectDate: "unselectDate", cssClassWeekend: "-weekend-" }, Q = { classes: "", inline: !1, locale: { days: ["Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"], daysShort: ["Вос", "Пон", "Вто", "Сре", "Чет", "Пят", "Суб"], daysMin: ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"], months: ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"], monthsShort: ["Янв", "Фев", "Мар", "Апр", "Май", "Июн", "Июл", "Авг", "Сен", "Окт", "Ноя", "Дек"], today: "Сегодня", clear: "Очистить", dateFormat: "dd.MM.yyyy", timeFormat: "HH:mm", firstDay: 1 }, startDate: /* @__PURE__ */ new Date(), firstDay: "", weekends: [6, 0], dateFormat: "", altField: "", altFieldDateFormat: "T", toggleSelected: !0, keyboardNav: !0, selectedDates: !1, container: "", isMobile: !1, visible: !1, position: "bottom left", offset: 12, view: l.days, minView: l.days, showOtherMonths: !0, selectOtherMonths: !0, moveToOtherMonthsOnSelect: !0, showOtherYears: !0, selectOtherYears: !0, moveToOtherYearsOnSelect: !0, minDate: "", maxDate: "", disableNavWhenOutOfRange: !0, multipleDates: !1, multipleDatesSeparator: ", ", range: !1, dynamicRange: !0, buttons: !1, monthsField: "monthsShort", showEvent: "focus", autoClose: !1, prevHtml: '<svg><path d="M 17,12 l -5,5 l 5,5"></path></svg>', nextHtml: '<svg><path d="M 14,12 l 5,5 l -5,5"></path></svg>', navTitles: { days: "MMMM, <i>yyyy</i>", months: "yyyy", years: "yyyy1 - yyyy2" }, timepicker: !1, onlyTimepicker: !1, dateTimeSeparator: " ", timeFormat: "", minHours: 0, maxHours: 24, minMinutes: 0, maxMinutes: 59, hoursStep: 1, minutesStep: 1, onSelect: !1, onChangeViewDate: !1, onChangeView: !1, onRenderCell: !1, onShow: !1, onHide: !1, onClickDayName: !1 };
18
+ function y(r) {
19
+ let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : document;
20
+ return typeof r == "string" ? e.querySelector(r) : r;
149
21
  }
150
- }
151
- return P(n) ? {
152
- ...n
153
- } : {
154
- mask: n
155
- };
156
- }
157
- function A(n) {
158
- if (o.Masked && n instanceof o.Masked)
159
- return n;
160
- const t = x(n), e = H(t.mask);
161
- if (!e)
162
- throw new Error("Masked class is not found for provided mask, appropriate module needs to be imported manually before creating mask.");
163
- return t.mask === e && delete t.mask, t._mask && (t.mask = t._mask, delete t._mask), new e(t);
164
- }
165
- o.createMask = A;
166
- class I {
167
- /** */
168
- /** */
169
- /** */
170
- /** Safely returns selection start */
171
- get selectionStart() {
172
- let t;
173
- try {
174
- t = this._unsafeSelectionStart;
175
- } catch {
22
+ function b() {
23
+ let { tagName: r = "div", className: e = "", innerHtml: t = "", id: s = "", attrs: a = {} } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = document.createElement(r);
24
+ return e && n.classList.add(...e.split(" ")), s && (n.id = s), t && (n.innerHTML = t), a && q(n, a), n;
176
25
  }
177
- return t ?? this.value.length;
178
- }
179
- /** Safely returns selection end */
180
- get selectionEnd() {
181
- let t;
182
- try {
183
- t = this._unsafeSelectionEnd;
184
- } catch {
26
+ function q(r, e) {
27
+ for (let [t, s] of Object.entries(e))
28
+ s !== void 0 && r.setAttribute(t, s);
29
+ return r;
185
30
  }
186
- return t ?? this.value.length;
187
- }
188
- /** Safely sets element selection */
189
- select(t, e) {
190
- if (!(t == null || e == null || t === this.selectionStart && e === this.selectionEnd))
191
- try {
192
- this._unsafeSelect(t, e);
193
- } catch {
194
- }
195
- }
196
- /** */
197
- get isActive() {
198
- return !1;
199
- }
200
- /** */
201
- /** */
202
- /** */
203
- }
204
- o.MaskElement = I;
205
- class F extends I {
206
- /** HTMLElement to use mask on */
207
- constructor(t) {
208
- super(), this.input = t, this._handlers = {};
209
- }
210
- get rootElement() {
211
- var t, e, s;
212
- return (t = (e = (s = this.input).getRootNode) == null ? void 0 : e.call(s)) != null ? t : document;
213
- }
214
- /**
215
- Is element in focus
216
- */
217
- get isActive() {
218
- return this.input === this.rootElement.activeElement;
219
- }
220
- /**
221
- Binds HTMLElement events to mask internal events
222
- */
223
- bindEvents(t) {
224
- Object.keys(t).forEach((e) => this._toggleEventHandler(F.EVENTS_MAP[e], t[e]));
225
- }
226
- /**
227
- Unbinds HTMLElement events to mask internal events
228
- */
229
- unbindEvents() {
230
- Object.keys(this._handlers).forEach((t) => this._toggleEventHandler(t));
231
- }
232
- _toggleEventHandler(t, e) {
233
- this._handlers[t] && (this.input.removeEventListener(t, this._handlers[t]), delete this._handlers[t]), e && (this.input.addEventListener(t, e), this._handlers[t] = e);
234
- }
235
- }
236
- F.EVENTS_MAP = {
237
- selectionChange: "keydown",
238
- input: "input",
239
- drop: "drop",
240
- click: "click",
241
- focus: "focus",
242
- commit: "blur"
243
- }, o.HTMLMaskElement = F;
244
- class z extends F {
245
- /** InputElement to use mask on */
246
- constructor(t) {
247
- super(t), this.input = t, this._handlers = {};
248
- }
249
- /** Returns InputElement selection start */
250
- get _unsafeSelectionStart() {
251
- return this.input.selectionStart != null ? this.input.selectionStart : this.value.length;
252
- }
253
- /** Returns InputElement selection end */
254
- get _unsafeSelectionEnd() {
255
- return this.input.selectionEnd;
256
- }
257
- /** Sets InputElement selection */
258
- _unsafeSelect(t, e) {
259
- this.input.setSelectionRange(t, e);
260
- }
261
- get value() {
262
- return this.input.value;
263
- }
264
- set value(t) {
265
- this.input.value = t;
266
- }
267
- }
268
- o.HTMLMaskElement = F;
269
- class w extends F {
270
- /** Returns HTMLElement selection start */
271
- get _unsafeSelectionStart() {
272
- const t = this.rootElement, e = t.getSelection && t.getSelection(), s = e && e.anchorOffset, i = e && e.focusOffset;
273
- return i == null || s == null || s < i ? s : i;
274
- }
275
- /** Returns HTMLElement selection end */
276
- get _unsafeSelectionEnd() {
277
- const t = this.rootElement, e = t.getSelection && t.getSelection(), s = e && e.anchorOffset, i = e && e.focusOffset;
278
- return i == null || s == null || s > i ? s : i;
279
- }
280
- /** Sets HTMLElement selection */
281
- _unsafeSelect(t, e) {
282
- if (!this.rootElement.createRange)
283
- return;
284
- const s = this.rootElement.createRange();
285
- s.setStart(this.input.firstChild || this.input, t), s.setEnd(this.input.lastChild || this.input, e);
286
- const i = this.rootElement, u = i.getSelection && i.getSelection();
287
- u && (u.removeAllRanges(), u.addRange(s));
288
- }
289
- /** HTMLElement value */
290
- get value() {
291
- return this.input.textContent || "";
292
- }
293
- set value(t) {
294
- this.input.textContent = t;
295
- }
296
- }
297
- o.HTMLContenteditableMaskElement = w;
298
- class G {
299
- /**
300
- View element
301
- */
302
- /** Internal {@link Masked} model */
303
- constructor(t, e) {
304
- this.el = t instanceof I ? t : t.isContentEditable && t.tagName !== "INPUT" && t.tagName !== "TEXTAREA" ? new w(t) : new z(t), this.masked = A(e), this._listeners = {}, this._value = "", this._unmaskedValue = "", 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.alignCursor = this.alignCursor.bind(this), this.alignCursorFriendly = this.alignCursorFriendly.bind(this), this._bindEvents(), this.updateValue(), this._onChange();
305
- }
306
- maskEquals(t) {
307
- var e;
308
- return t == null || ((e = this.masked) == null ? void 0 : e.maskEquals(t));
309
- }
310
- /** Masked */
311
- get mask() {
312
- return this.masked.mask;
313
- }
314
- set mask(t) {
315
- if (this.maskEquals(t))
316
- return;
317
- if (!(t instanceof o.Masked) && this.masked.constructor === H(t)) {
318
- this.masked.updateOptions({
319
- mask: t
320
- });
321
- return;
31
+ function Z(r) {
32
+ return new Date(r.getFullYear(), r.getMonth() + 1, 0).getDate();
322
33
  }
323
- const e = t instanceof o.Masked ? t : A({
324
- mask: t
325
- });
326
- e.unmaskedValue = this.masked.unmaskedValue, this.masked = e;
327
- }
328
- /** Raw value */
329
- get value() {
330
- return this._value;
331
- }
332
- set value(t) {
333
- this.value !== t && (this.masked.value = t, this.updateControl(), this.alignCursor());
334
- }
335
- /** Unmasked value */
336
- get unmaskedValue() {
337
- return this._unmaskedValue;
338
- }
339
- set unmaskedValue(t) {
340
- this.unmaskedValue !== t && (this.masked.unmaskedValue = t, this.updateControl(), this.alignCursor());
341
- }
342
- /** Typed unmasked value */
343
- get typedValue() {
344
- return this.masked.typedValue;
345
- }
346
- set typedValue(t) {
347
- this.masked.typedValueEquals(t) || (this.masked.typedValue = t, this.updateControl(), this.alignCursor());
348
- }
349
- /** Display value */
350
- get displayValue() {
351
- return this.masked.displayValue;
352
- }
353
- /** Starts listening to element events */
354
- _bindEvents() {
355
- this.el.bindEvents({
356
- selectionChange: this._saveSelection,
357
- input: this._onInput,
358
- drop: this._onDrop,
359
- click: this._onClick,
360
- focus: this._onFocus,
361
- commit: this._onChange
362
- });
363
- }
364
- /** Stops listening to element events */
365
- _unbindEvents() {
366
- this.el && this.el.unbindEvents();
367
- }
368
- /** Fires custom event */
369
- _fireEvent(t, e) {
370
- const s = this._listeners[t];
371
- s && s.forEach((i) => i(e));
372
- }
373
- /** Current selection start */
374
- get selectionStart() {
375
- return this._cursorChanging ? this._changingCursorPos : this.el.selectionStart;
376
- }
377
- /** Current cursor position */
378
- get cursorPos() {
379
- return this._cursorChanging ? this._changingCursorPos : this.el.selectionEnd;
380
- }
381
- set cursorPos(t) {
382
- !this.el || !this.el.isActive || (this.el.select(t, t), this._saveSelection());
383
- }
384
- /** Stores current selection */
385
- _saveSelection() {
386
- this.displayValue !== this.el.value && console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."), this._selection = {
387
- start: this.selectionStart,
388
- end: this.cursorPos
389
- };
390
- }
391
- /** Syncronizes model value from view */
392
- updateValue() {
393
- this.masked.value = this.el.value, this._value = this.masked.value;
394
- }
395
- /** Syncronizes view from model value, fires change events */
396
- updateControl() {
397
- const t = this.masked.unmaskedValue, e = this.masked.value, s = this.displayValue, i = this.unmaskedValue !== t || this.value !== e;
398
- this._unmaskedValue = t, this._value = e, this.el.value !== s && (this.el.value = s), i && this._fireChangeEvents();
399
- }
400
- /** Updates options with deep equal check, recreates {@link Masked} model if mask type changes */
401
- updateOptions(t) {
402
- const {
403
- mask: e,
404
- ...s
405
- } = t, i = !this.maskEquals(e), u = !b(this.masked, s);
406
- i && (this.mask = e), u && this.masked.updateOptions(s), (i || u) && this.updateControl();
407
- }
408
- /** Updates cursor */
409
- updateCursor(t) {
410
- t != null && (this.cursorPos = t, this._delayUpdateCursor(t));
411
- }
412
- /** Delays cursor update to support mobile browsers */
413
- _delayUpdateCursor(t) {
414
- this._abortUpdateCursor(), this._changingCursorPos = t, this._cursorChanging = setTimeout(() => {
415
- this.el && (this.cursorPos = this._changingCursorPos, this._abortUpdateCursor());
416
- }, 10);
417
- }
418
- /** Fires custom events */
419
- _fireChangeEvents() {
420
- this._fireEvent("accept", this._inputEvent), this.masked.isComplete && this._fireEvent("complete", this._inputEvent);
421
- }
422
- /** Aborts delayed cursor update */
423
- _abortUpdateCursor() {
424
- this._cursorChanging && (clearTimeout(this._cursorChanging), delete this._cursorChanging);
425
- }
426
- /** Aligns cursor to nearest available position */
427
- alignCursor() {
428
- this.cursorPos = this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos, h.LEFT));
429
- }
430
- /** Aligns cursor only if selection is empty */
431
- alignCursorFriendly() {
432
- this.selectionStart === this.cursorPos && this.alignCursor();
433
- }
434
- /** Adds listener on custom event */
435
- on(t, e) {
436
- return this._listeners[t] || (this._listeners[t] = []), this._listeners[t].push(e), this;
437
- }
438
- /** Removes custom event listener */
439
- off(t, e) {
440
- if (!this._listeners[t])
441
- return this;
442
- if (!e)
443
- return delete this._listeners[t], this;
444
- const s = this._listeners[t].indexOf(e);
445
- return s >= 0 && this._listeners[t].splice(s, 1), this;
446
- }
447
- /** Handles view input event */
448
- _onInput(t) {
449
- if (this._inputEvent = t, this._abortUpdateCursor(), !this._selection)
450
- return this.updateValue();
451
- const e = new Z({
452
- // new state
453
- value: this.el.value,
454
- cursorPos: this.cursorPos,
455
- // old state
456
- oldValue: this.displayValue,
457
- oldSelection: this._selection
458
- }), s = this.masked.rawInputValue, i = this.masked.splice(e.startChangePos, e.removed.length, e.inserted, e.removeDirection, {
459
- input: !0,
460
- raw: !0
461
- }).offset, u = s === this.masked.rawInputValue ? e.removeDirection : h.NONE;
462
- let a = this.masked.nearestInputPos(e.startChangePos + i, u);
463
- u !== h.NONE && (a = this.masked.nearestInputPos(a, h.NONE)), this.updateControl(), this.updateCursor(a), delete this._inputEvent;
464
- }
465
- /** Handles view change event and commits model value */
466
- _onChange() {
467
- this.displayValue !== this.el.value && this.updateValue(), this.masked.doCommit(), this.updateControl(), this._saveSelection();
468
- }
469
- /** Handles view drop event, prevents by default */
470
- _onDrop(t) {
471
- t.preventDefault(), t.stopPropagation();
472
- }
473
- /** Restore last selection on focus */
474
- _onFocus(t) {
475
- this.alignCursorFriendly();
476
- }
477
- /** Restore last selection on focus */
478
- _onClick(t) {
479
- this.alignCursorFriendly();
480
- }
481
- /** Unbind view events and removes element reference */
482
- destroy() {
483
- this._unbindEvents(), this._listeners.length = 0, delete this.el;
484
- }
485
- }
486
- o.InputMask = G;
487
- class c {
488
- /** Inserted symbols */
489
- /** Can skip chars */
490
- /** Additional offset if any changes occurred before tail */
491
- /** Raw inserted is used by dynamic mask */
492
- static normalize(t) {
493
- return Array.isArray(t) ? t : [t, new c()];
494
- }
495
- constructor(t) {
496
- Object.assign(this, {
497
- inserted: "",
498
- rawInserted: "",
499
- skip: !1,
500
- tailShift: 0
501
- }, t);
502
- }
503
- /** Aggregate changes */
504
- aggregate(t) {
505
- return this.rawInserted += t.rawInserted, this.skip = this.skip || t.skip, this.inserted += t.inserted, this.tailShift += t.tailShift, this;
506
- }
507
- /** Total offset considering all changes */
508
- get offset() {
509
- return this.tailShift + this.inserted.length;
510
- }
511
- }
512
- o.ChangeDetails = c;
513
- class E {
514
- /** Tail value as string */
515
- /** Tail start position */
516
- /** Start position */
517
- constructor(t, e, s) {
518
- t === void 0 && (t = ""), e === void 0 && (e = 0), this.value = t, this.from = e, this.stop = s;
519
- }
520
- toString() {
521
- return this.value;
522
- }
523
- extend(t) {
524
- this.value += String(t);
525
- }
526
- appendTo(t) {
527
- return t.append(this.toString(), {
528
- tail: !0
529
- }).aggregate(t._appendPlaceholder());
530
- }
531
- get state() {
532
- return {
533
- value: this.value,
534
- from: this.from,
535
- stop: this.stop
536
- };
537
- }
538
- set state(t) {
539
- Object.assign(this, t);
540
- }
541
- unshift(t) {
542
- if (!this.value.length || t != null && this.from >= t)
543
- return "";
544
- const e = this.value[0];
545
- return this.value = this.value.slice(1), e;
546
- }
547
- shift() {
548
- if (!this.value.length)
549
- return "";
550
- const t = this.value[this.value.length - 1];
551
- return this.value = this.value.slice(0, -1), t;
552
- }
553
- }
554
- class f {
555
- /** */
556
- /** */
557
- /** Transforms value before mask processing */
558
- /** Transforms each char before mask processing */
559
- /** Validates if value is acceptable */
560
- /** Does additional processing at the end of editing */
561
- /** Format typed value to string */
562
- /** Parse string to get typed value */
563
- /** Enable characters overwriting */
564
- /** */
565
- /** */
566
- /** */
567
- constructor(t) {
568
- this._value = "", this._update({
569
- ...f.DEFAULTS,
570
- ...t
571
- }), this._initialized = !0;
572
- }
573
- /** Sets and applies new options */
574
- updateOptions(t) {
575
- Object.keys(t).length && this.withValueRefresh(this._update.bind(this, t));
576
- }
577
- /** Sets new options */
578
- _update(t) {
579
- Object.assign(this, t);
580
- }
581
- /** Mask state */
582
- get state() {
583
- return {
584
- _value: this.value,
585
- _rawInputValue: this.rawInputValue
586
- };
587
- }
588
- set state(t) {
589
- this._value = t._value;
590
- }
591
- /** Resets value */
592
- reset() {
593
- this._value = "";
594
- }
595
- get value() {
596
- return this._value;
597
- }
598
- set value(t) {
599
- this.resolve(t, {
600
- input: !0
601
- });
602
- }
603
- /** Resolve new value */
604
- resolve(t, e) {
605
- e === void 0 && (e = {
606
- input: !0
607
- }), this.reset(), this.append(t, e, ""), this.doCommit();
608
- }
609
- get unmaskedValue() {
610
- return this.value;
611
- }
612
- set unmaskedValue(t) {
613
- this.resolve(t, {});
614
- }
615
- get typedValue() {
616
- return this.parse ? this.parse(this.value, this) : this.unmaskedValue;
617
- }
618
- set typedValue(t) {
619
- this.format ? this.value = this.format(t, this) : this.unmaskedValue = String(t);
620
- }
621
- /** Value that includes raw user input */
622
- get rawInputValue() {
623
- return this.extractInput(0, this.displayValue.length, {
624
- raw: !0
625
- });
626
- }
627
- set rawInputValue(t) {
628
- this.resolve(t, {
629
- raw: !0
630
- });
631
- }
632
- get displayValue() {
633
- return this.value;
634
- }
635
- get isComplete() {
636
- return !0;
637
- }
638
- get isFilled() {
639
- return this.isComplete;
640
- }
641
- /** Finds nearest input position in direction */
642
- nearestInputPos(t, e) {
643
- return t;
644
- }
645
- totalInputPositions(t, e) {
646
- return t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), Math.min(this.displayValue.length, e - t);
647
- }
648
- /** Extracts value in range considering flags */
649
- extractInput(t, e, s) {
650
- return t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), this.displayValue.slice(t, e);
651
- }
652
- /** Extracts tail in range */
653
- extractTail(t, e) {
654
- return t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), new E(this.extractInput(t, e), t);
655
- }
656
- /** Appends tail */
657
- appendTail(t) {
658
- return m(t) && (t = new E(String(t))), t.appendTo(this);
659
- }
660
- /** Appends char */
661
- _appendCharRaw(t, e) {
662
- return t ? (this._value += t, new c({
663
- inserted: t,
664
- rawInserted: t
665
- })) : new c();
666
- }
667
- /** Appends char */
668
- _appendChar(t, e, s) {
669
- e === void 0 && (e = {});
670
- const i = this.state;
671
- let u;
672
- if ([t, u] = this.doPrepareChar(t, e), u = u.aggregate(this._appendCharRaw(t, e)), u.inserted) {
673
- let a, r = this.doValidate(e) !== !1;
674
- if (r && s != null) {
675
- const l = this.state;
676
- this.overwrite === !0 && (a = s.state, s.unshift(this.displayValue.length - u.tailShift));
677
- let d = this.appendTail(s);
678
- r = d.rawInserted === s.toString(), !(r && d.inserted) && this.overwrite === "shift" && (this.state = l, a = s.state, s.shift(), d = this.appendTail(s), r = d.rawInserted === s.toString()), r && d.inserted && (this.state = l);
679
- }
680
- r || (u = new c(), this.state = i, s && a && (s.state = a));
34
+ function D(r) {
35
+ let e = r.getHours(), t = e % 12 == 0 ? 12 : e % 12;
36
+ return { year: r.getFullYear(), month: r.getMonth(), fullMonth: r.getMonth() + 1 < 10 ? "0" + (r.getMonth() + 1) : r.getMonth() + 1, date: r.getDate(), fullDate: r.getDate() < 10 ? "0" + r.getDate() : r.getDate(), day: r.getDay(), hours: e, fullHours: O(e), hours12: t, fullHours12: O(t), minutes: r.getMinutes(), fullMinutes: r.getMinutes() < 10 ? "0" + r.getMinutes() : r.getMinutes() };
681
37
  }
682
- return u;
683
- }
684
- /** Appends optional placeholder at the end */
685
- _appendPlaceholder() {
686
- return new c();
687
- }
688
- /** Appends optional eager placeholder at the end */
689
- _appendEager() {
690
- return new c();
691
- }
692
- /** Appends symbols considering flags */
693
- append(t, e, s) {
694
- if (!m(t))
695
- throw new Error("value should be string");
696
- const i = m(s) ? new E(String(s)) : s;
697
- e != null && e.tail && (e._beforeTailState = this.state);
698
- let u;
699
- [t, u] = this.doPrepare(t, e);
700
- for (let a = 0; a < t.length; ++a) {
701
- const r = this._appendChar(t[a], e, i);
702
- if (!r.rawInserted && !this.doSkipInvalid(t[a], e, i))
703
- break;
704
- u.aggregate(r);
38
+ function O(r) {
39
+ return r < 10 ? "0" + r : r;
705
40
  }
706
- return (this.eager === !0 || this.eager === "append") && e != null && e.input && t && u.aggregate(this._appendEager()), i != null && (u.tailShift += this.appendTail(i).tailShift), u;
707
- }
708
- remove(t, e) {
709
- 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();
710
- }
711
- /** Calls function and reapplies current value */
712
- withValueRefresh(t) {
713
- if (this._refreshing || !this._initialized)
714
- return t();
715
- this._refreshing = !0;
716
- const e = this.rawInputValue, s = this.value, i = t();
717
- return this.rawInputValue = e, this.value && this.value !== s && s.indexOf(this.value) === 0 && this.append(s.slice(this.displayValue.length), {}, ""), delete this._refreshing, i;
718
- }
719
- runIsolated(t) {
720
- if (this._isolated || !this._initialized)
721
- return t(this);
722
- this._isolated = !0;
723
- const e = this.state, s = t(this);
724
- return this.state = e, delete this._isolated, s;
725
- }
726
- doSkipInvalid(t, e, s) {
727
- return !!this.skipInvalid;
728
- }
729
- /** Prepares string before mask processing */
730
- doPrepare(t, e) {
731
- return e === void 0 && (e = {}), c.normalize(this.prepare ? this.prepare(t, this, e) : t);
732
- }
733
- /** Prepares each char before mask processing */
734
- doPrepareChar(t, e) {
735
- return e === void 0 && (e = {}), c.normalize(this.prepareChar ? this.prepareChar(t, this, e) : t);
736
- }
737
- /** Validates if value is acceptable */
738
- doValidate(t) {
739
- return (!this.validate || this.validate(this.value, this, t)) && (!this.parent || this.parent.doValidate(t));
740
- }
741
- /** Does additional processing at the end of editing */
742
- doCommit() {
743
- this.commit && this.commit(this.value, this);
744
- }
745
- splice(t, e, s, i, u) {
746
- i === void 0 && (i = h.NONE), u === void 0 && (u = {
747
- input: !0
748
- });
749
- const a = t + e, r = this.extractTail(a), l = this.eager === !0 || this.eager === "remove";
750
- let d;
751
- l && (i = j(i), d = this.extractInput(0, a, {
752
- raw: !0
753
- }));
754
- let v = t;
755
- const _ = new c();
756
- if (i !== h.NONE && (v = this.nearestInputPos(t, e > 1 && t !== 0 && !l ? h.NONE : i), _.tailShift = v - t), _.aggregate(this.remove(v)), l && i !== h.NONE && d === this.rawInputValue)
757
- if (i === h.FORCE_LEFT) {
758
- let S;
759
- for (; d === this.rawInputValue && (S = this.displayValue.length); )
760
- _.aggregate(new c({
761
- tailShift: -1
762
- })).aggregate(this.remove(S - 1));
763
- } else
764
- i === h.FORCE_RIGHT && r.unshift();
765
- return _.aggregate(this.append(s, u, r));
766
- }
767
- maskEquals(t) {
768
- return this.mask === t;
769
- }
770
- typedValueEquals(t) {
771
- const e = this.typedValue;
772
- return t === e || f.EMPTY_VALUES.includes(t) && f.EMPTY_VALUES.includes(e) || (this.format ? this.format(t, this) === this.format(this.typedValue, this) : !1);
773
- }
774
- }
775
- f.DEFAULTS = {
776
- skipInvalid: !0
777
- }, f.EMPTY_VALUES = [void 0, null, ""], o.Masked = f;
778
- class C {
779
- /** */
780
- constructor(t, e) {
781
- t === void 0 && (t = []), e === void 0 && (e = 0), this.chunks = t, this.from = e;
782
- }
783
- toString() {
784
- return this.chunks.map(String).join("");
785
- }
786
- extend(t) {
787
- if (!String(t))
788
- return;
789
- t = m(t) ? new E(String(t)) : t;
790
- const e = this.chunks[this.chunks.length - 1], s = e && // if stops are same or tail has no stop
791
- (e.stop === t.stop || t.stop == null) && // if tail chunk goes just after last chunk
792
- t.from === e.from + e.toString().length;
793
- if (t instanceof E)
794
- s ? e.extend(t.toString()) : this.chunks.push(t);
795
- else if (t instanceof C) {
796
- if (t.stop == null) {
797
- let i;
798
- for (; t.chunks.length && t.chunks[0].stop == null; )
799
- i = t.chunks.shift(), i.from += t.from, this.extend(i);
800
- }
801
- t.toString() && (t.stop = t.blockIndex, this.chunks.push(t));
41
+ function F(r) {
42
+ let e = 10 * Math.floor(r.getFullYear() / 10);
43
+ return [e, e + 9];
802
44
  }
803
- }
804
- appendTo(t) {
805
- if (!(t instanceof o.MaskedPattern))
806
- return new E(this.toString()).appendTo(t);
807
- const e = new c();
808
- for (let s = 0; s < this.chunks.length && !e.skip; ++s) {
809
- const i = this.chunks[s], u = t._mapPosToBlock(t.displayValue.length), a = i.stop;
810
- let r;
811
- if (a != null && // if block not found or stop is behind lastBlock
812
- (!u || u.index <= a)) {
813
- if (i instanceof C || // for continuous block also check if stop is exist
814
- t._stops.indexOf(a) >= 0) {
815
- const l = t._appendPlaceholder(a);
816
- e.aggregate(l);
817
- }
818
- r = i instanceof C && t._blocks[a];
819
- }
820
- if (r) {
821
- const l = r.appendTail(i);
822
- l.skip = !1, e.aggregate(l), t._value += l.inserted;
823
- const d = i.toString().slice(l.rawInserted.length);
824
- d && e.aggregate(t.append(d, {
825
- tail: !0
826
- }));
827
- } else
828
- e.aggregate(t.append(i.toString(), {
829
- tail: !0
830
- }));
45
+ function M() {
46
+ let r = [];
47
+ for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
48
+ t[s] = arguments[s];
49
+ return t.forEach((a) => {
50
+ if (typeof a == "object")
51
+ for (let n in a)
52
+ a[n] && r.push(n);
53
+ else
54
+ a && r.push(a);
55
+ }), r.join(" ");
831
56
  }
832
- return e;
833
- }
834
- get state() {
835
- return {
836
- chunks: this.chunks.map((t) => t.state),
837
- from: this.from,
838
- stop: this.stop,
839
- blockIndex: this.blockIndex
840
- };
841
- }
842
- set state(t) {
843
- const {
844
- chunks: e,
845
- ...s
846
- } = t;
847
- Object.assign(this, s), this.chunks = e.map((i) => {
848
- const u = "chunks" in i ? new C() : new E();
849
- return u.state = i, u;
850
- });
851
- }
852
- unshift(t) {
853
- if (!this.chunks.length || t != null && this.from >= t)
854
- return "";
855
- const e = t != null ? t - this.from : t;
856
- let s = 0;
857
- for (; s < this.chunks.length; ) {
858
- const i = this.chunks[s], u = i.unshift(e);
859
- if (i.toString()) {
860
- if (!u)
861
- break;
862
- ++s;
863
- } else
864
- this.chunks.splice(s, 1);
865
- if (u)
866
- return u;
57
+ function v(r, e) {
58
+ let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : l.days;
59
+ if (!r || !e)
60
+ return !1;
61
+ let s = D(r), a = D(e);
62
+ return { [l.days]: s.date === a.date && s.month === a.month && s.year === a.year, [l.months]: s.month === a.month && s.year === a.year, [l.years]: s.year === a.year }[t];
867
63
  }
868
- return "";
869
- }
870
- shift() {
871
- if (!this.chunks.length)
872
- return "";
873
- let t = this.chunks.length - 1;
874
- for (; 0 <= t; ) {
875
- const e = this.chunks[t], s = e.shift();
876
- if (e.toString()) {
877
- if (!s)
878
- break;
879
- --t;
880
- } else
881
- this.chunks.splice(t, 1);
882
- if (s)
883
- return s;
64
+ function $(r, e, t) {
65
+ let s = J(r, !1).getTime(), a = J(e, !1).getTime();
66
+ return t ? s >= a : s > a;
884
67
  }
885
- return "";
886
- }
887
- }
888
- class X {
889
- constructor(t, e) {
890
- this.masked = t, this._log = [];
891
- const {
892
- offset: s,
893
- index: i
894
- } = t._mapPosToBlock(e) || (e < 0 ? (
895
- // first
896
- {
897
- index: 0,
898
- offset: 0
899
- }
900
- ) : (
901
- // last
902
- {
903
- index: this.masked._blocks.length,
904
- offset: 0
905
- }
906
- ));
907
- this.offset = s, this.index = i, this.ok = !1;
908
- }
909
- get block() {
910
- return this.masked._blocks[this.index];
911
- }
912
- get pos() {
913
- return this.masked._blockStartPos(this.index) + this.offset;
914
- }
915
- get state() {
916
- return {
917
- index: this.index,
918
- offset: this.offset,
919
- ok: this.ok
920
- };
921
- }
922
- set state(t) {
923
- Object.assign(this, t);
924
- }
925
- pushState() {
926
- this._log.push(this.state);
927
- }
928
- popState() {
929
- const t = this._log.pop();
930
- return t && (this.state = t), t;
931
- }
932
- bindBlock() {
933
- 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));
934
- }
935
- _pushLeft(t) {
936
- for (this.pushState(), this.bindBlock(); 0 <= this.index; --this.index, this.offset = ((e = this.block) == null ? void 0 : e.displayValue.length) || 0) {
937
- var e;
938
- if (t())
939
- return this.ok = !0;
68
+ function E(r, e) {
69
+ return !$(r, e, !0);
940
70
  }
941
- return this.ok = !1;
942
- }
943
- _pushRight(t) {
944
- for (this.pushState(), this.bindBlock(); this.index < this.masked._blocks.length; ++this.index, this.offset = 0)
945
- if (t())
946
- return this.ok = !0;
947
- return this.ok = !1;
948
- }
949
- pushLeftBeforeFilled() {
950
- return this._pushLeft(() => {
951
- if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, h.FORCE_LEFT), this.offset !== 0))
952
- return !0;
953
- });
954
- }
955
- pushLeftBeforeInput() {
956
- return this._pushLeft(() => {
957
- if (!this.block.isFixed)
958
- return this.offset = this.block.nearestInputPos(this.offset, h.LEFT), !0;
959
- });
960
- }
961
- pushLeftBeforeRequired() {
962
- return this._pushLeft(() => {
963
- if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
964
- return this.offset = this.block.nearestInputPos(this.offset, h.LEFT), !0;
965
- });
966
- }
967
- pushRightBeforeFilled() {
968
- return this._pushRight(() => {
969
- if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, h.FORCE_RIGHT), this.offset !== this.block.value.length))
970
- return !0;
971
- });
972
- }
973
- pushRightBeforeInput() {
974
- return this._pushRight(() => {
975
- if (!this.block.isFixed)
976
- return this.offset = this.block.nearestInputPos(this.offset, h.NONE), !0;
977
- });
978
- }
979
- pushRightBeforeRequired() {
980
- return this._pushRight(() => {
981
- if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
982
- return this.offset = this.block.nearestInputPos(this.offset, h.NONE), !0;
983
- });
984
- }
985
- }
986
- class R {
987
- /** */
988
- /** */
989
- /** */
990
- /** */
991
- /** */
992
- /** */
993
- constructor(t) {
994
- Object.assign(this, t), this._value = "", this.isFixed = !0;
995
- }
996
- get value() {
997
- return this._value;
998
- }
999
- get unmaskedValue() {
1000
- return this.isUnmasking ? this.value : "";
1001
- }
1002
- get rawInputValue() {
1003
- return this._isRawInput ? this.value : "";
1004
- }
1005
- get displayValue() {
1006
- return this.value;
1007
- }
1008
- reset() {
1009
- this._isRawInput = !1, this._value = "";
1010
- }
1011
- remove(t, e) {
1012
- 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();
1013
- }
1014
- nearestInputPos(t, e) {
1015
- e === void 0 && (e = h.NONE);
1016
- const s = 0, i = this._value.length;
1017
- switch (e) {
1018
- case h.LEFT:
1019
- case h.FORCE_LEFT:
1020
- return s;
1021
- case h.NONE:
1022
- case h.RIGHT:
1023
- case h.FORCE_RIGHT:
1024
- default:
1025
- return i;
71
+ function J(r) {
72
+ let e = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1], t = new Date(r.getTime());
73
+ return typeof e != "boolean" || e || he(t), t;
1026
74
  }
1027
- }
1028
- totalInputPositions(t, e) {
1029
- return t === void 0 && (t = 0), e === void 0 && (e = this._value.length), this._isRawInput ? e - t : 0;
1030
- }
1031
- extractInput(t, e, s) {
1032
- 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) || "";
1033
- }
1034
- get isComplete() {
1035
- return !0;
1036
- }
1037
- get isFilled() {
1038
- return !!this._value;
1039
- }
1040
- _appendChar(t, e) {
1041
- e === void 0 && (e = {});
1042
- const s = new c();
1043
- if (this.isFilled)
1044
- return s;
1045
- const i = this.eager === !0 || this.eager === "append", a = this.char === t && (this.isUnmasking || e.input || e.raw) && (!e.raw || !i) && !e.tail;
1046
- return a && (s.rawInserted = this.char), this._value = s.inserted = this.char, this._isRawInput = a && (e.raw || e.input), s;
1047
- }
1048
- _appendEager() {
1049
- return this._appendChar(this.char, {
1050
- tail: !0
1051
- });
1052
- }
1053
- _appendPlaceholder() {
1054
- const t = new c();
1055
- return this.isFilled || (this._value = t.inserted = this.char), t;
1056
- }
1057
- extractTail() {
1058
- return new E("");
1059
- }
1060
- appendTail(t) {
1061
- return m(t) && (t = new E(String(t))), t.appendTo(this);
1062
- }
1063
- append(t, e, s) {
1064
- const i = this._appendChar(t[0], e);
1065
- return s != null && (i.tailShift += this.appendTail(s).tailShift), i;
1066
- }
1067
- doCommit() {
1068
- }
1069
- get state() {
1070
- return {
1071
- _value: this._value,
1072
- _rawInputValue: this.rawInputValue
1073
- };
1074
- }
1075
- set state(t) {
1076
- this._value = t._value, this._isRawInput = !!t._rawInputValue;
1077
- }
1078
- }
1079
- class M {
1080
- /** */
1081
- /** */
1082
- /** */
1083
- /** */
1084
- /** */
1085
- /** */
1086
- /** */
1087
- /** */
1088
- constructor(t) {
1089
- const {
1090
- parent: e,
1091
- isOptional: s,
1092
- placeholderChar: i,
1093
- displayChar: u,
1094
- lazy: a,
1095
- eager: r,
1096
- ...l
1097
- } = t;
1098
- this.masked = A(l), Object.assign(this, {
1099
- parent: e,
1100
- isOptional: s,
1101
- placeholderChar: i,
1102
- displayChar: u,
1103
- lazy: a,
1104
- eager: r
1105
- });
1106
- }
1107
- reset() {
1108
- this.isFilled = !1, this.masked.reset();
1109
- }
1110
- remove(t, e) {
1111
- 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();
1112
- }
1113
- get value() {
1114
- return this.masked.value || (this.isFilled && !this.isOptional ? this.placeholderChar : "");
1115
- }
1116
- get unmaskedValue() {
1117
- return this.masked.unmaskedValue;
1118
- }
1119
- get rawInputValue() {
1120
- return this.masked.rawInputValue;
1121
- }
1122
- get displayValue() {
1123
- return this.masked.value && this.displayChar || this.value;
1124
- }
1125
- get isComplete() {
1126
- return !!this.masked.value || this.isOptional;
1127
- }
1128
- _appendChar(t, e) {
1129
- if (e === void 0 && (e = {}), this.isFilled)
1130
- return new c();
1131
- const s = this.masked.state, i = this.masked._appendChar(t, this.currentMaskFlags(e));
1132
- return i.inserted && this.doValidate(e) === !1 && (i.inserted = i.rawInserted = "", 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;
1133
- }
1134
- append(t, e, s) {
1135
- return this.masked.append(t, this.currentMaskFlags(e), s);
1136
- }
1137
- _appendPlaceholder() {
1138
- const t = new c();
1139
- return this.isFilled || this.isOptional || (this.isFilled = !0, t.inserted = this.placeholderChar), t;
1140
- }
1141
- _appendEager() {
1142
- return new c();
1143
- }
1144
- extractTail(t, e) {
1145
- return this.masked.extractTail(t, e);
1146
- }
1147
- appendTail(t) {
1148
- return this.masked.appendTail(t);
1149
- }
1150
- extractInput(t, e, s) {
1151
- return t === void 0 && (t = 0), e === void 0 && (e = this.value.length), this.masked.extractInput(t, e, s);
1152
- }
1153
- nearestInputPos(t, e) {
1154
- e === void 0 && (e = h.NONE);
1155
- const s = 0, i = this.value.length, u = Math.min(Math.max(t, s), i);
1156
- switch (e) {
1157
- case h.LEFT:
1158
- case h.FORCE_LEFT:
1159
- return this.isComplete ? u : s;
1160
- case h.RIGHT:
1161
- case h.FORCE_RIGHT:
1162
- return this.isComplete ? u : i;
1163
- case h.NONE:
1164
- default:
1165
- return u;
75
+ function he(r) {
76
+ return r.setHours(0, 0, 0, 0), r;
1166
77
  }
1167
- }
1168
- totalInputPositions(t, e) {
1169
- return t === void 0 && (t = 0), e === void 0 && (e = this.value.length), this.value.slice(t, e).length;
1170
- }
1171
- doValidate(t) {
1172
- return this.masked.doValidate(this.currentMaskFlags(t)) && (!this.parent || this.parent.doValidate(this.currentMaskFlags(t)));
1173
- }
1174
- doCommit() {
1175
- this.masked.doCommit();
1176
- }
1177
- get state() {
1178
- return {
1179
- _value: this.value,
1180
- _rawInputValue: this.rawInputValue,
1181
- masked: this.masked.state,
1182
- isFilled: this.isFilled
1183
- };
1184
- }
1185
- set state(t) {
1186
- this.masked.state = t.masked, this.isFilled = t.isFilled;
1187
- }
1188
- currentMaskFlags(t) {
1189
- var e;
1190
- return {
1191
- ...t,
1192
- _beforeTailState: (t == null || (e = t._beforeTailState) == null ? void 0 : e.masked) || (t == null ? void 0 : t._beforeTailState)
1193
- };
1194
- }
1195
- }
1196
- M.DEFAULT_DEFINITIONS = {
1197
- 0: /\d/,
1198
- 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]/,
1199
- // http://stackoverflow.com/a/22075070
1200
- "*": /./
1201
- };
1202
- class q extends f {
1203
- /** */
1204
- /** Enable characters overwriting */
1205
- /** */
1206
- /** */
1207
- updateOptions(t) {
1208
- super.updateOptions(t);
1209
- }
1210
- _update(t) {
1211
- const e = t.mask;
1212
- e && (t.validate = (s) => s.search(e) >= 0), super._update(t);
1213
- }
1214
- }
1215
- o.MaskedRegExp = q;
1216
- class k extends f {
1217
- /** */
1218
- /** */
1219
- /** Single char for empty input */
1220
- /** Single char for filled input */
1221
- /** Show placeholder only when needed */
1222
- /** Enable characters overwriting */
1223
- /** */
1224
- /** */
1225
- constructor(t) {
1226
- super({
1227
- ...k.DEFAULTS,
1228
- ...t,
1229
- definitions: Object.assign({}, M.DEFAULT_DEFINITIONS, t == null ? void 0 : t.definitions)
1230
- });
1231
- }
1232
- updateOptions(t) {
1233
- super.updateOptions(t);
1234
- }
1235
- _update(t) {
1236
- t.definitions = Object.assign({}, this.definitions, t.definitions), super._update(t), this._rebuildMask();
1237
- }
1238
- _rebuildMask() {
1239
- const t = this.definitions;
1240
- this._blocks = [], this.exposeBlock = void 0, this._stops = [], this._maskedBlocks = {};
1241
- const e = this.mask;
1242
- if (!e || !t)
1243
- return;
1244
- let s = !1, i = !1;
1245
- for (let u = 0; u < e.length; ++u) {
1246
- if (this.blocks) {
1247
- const d = e.slice(u), v = Object.keys(this.blocks).filter((S) => d.indexOf(S) === 0);
1248
- v.sort((S, L) => L.length - S.length);
1249
- const _ = v[0];
1250
- if (_) {
1251
- const {
1252
- expose: S,
1253
- ...L
1254
- } = x(this.blocks[_]), N = A({
1255
- lazy: this.lazy,
1256
- eager: this.eager,
1257
- placeholderChar: this.placeholderChar,
1258
- displayChar: this.displayChar,
1259
- overwrite: this.overwrite,
1260
- ...L,
1261
- parent: this
1262
- });
1263
- N && (this._blocks.push(N), S && (this.exposeBlock = N), this._maskedBlocks[_] || (this._maskedBlocks[_] = []), this._maskedBlocks[_].push(this._blocks.length - 1)), u += _.length - 1;
1264
- continue;
1265
- }
1266
- }
1267
- let a = e[u], r = a in t;
1268
- if (a === k.STOP_CHAR) {
1269
- this._stops.push(this._blocks.length);
1270
- continue;
1271
- }
1272
- if (a === "{" || a === "}") {
1273
- s = !s;
1274
- continue;
1275
- }
1276
- if (a === "[" || a === "]") {
1277
- i = !i;
1278
- continue;
1279
- }
1280
- if (a === k.ESCAPE_CHAR) {
1281
- if (++u, a = e[u], !a)
1282
- break;
1283
- r = !1;
1284
- }
1285
- const l = r ? new M({
1286
- isOptional: i,
1287
- lazy: this.lazy,
1288
- eager: this.eager,
1289
- placeholderChar: this.placeholderChar,
1290
- displayChar: this.displayChar,
1291
- ...x(t[a]),
1292
- parent: this
1293
- }) : new R({
1294
- char: a,
1295
- eager: this.eager,
1296
- isUnmasking: s
1297
- });
1298
- this._blocks.push(l);
78
+ function w(r, e, t) {
79
+ r.length ? r.forEach((s) => {
80
+ s.addEventListener(e, t);
81
+ }) : r.addEventListener(e, t);
82
+ }
83
+ function R(r, e) {
84
+ return !(!r || r === document || r instanceof DocumentFragment) && (r.matches(e) ? r : R(r.parentNode, e));
85
+ }
86
+ function A(r, e, t) {
87
+ return r > t ? t : r < e ? e : r;
1299
88
  }
1300
- }
1301
- get state() {
1302
- return {
1303
- ...super.state,
1304
- _blocks: this._blocks.map((t) => t.state)
1305
- };
1306
- }
1307
- set state(t) {
1308
- const {
1309
- _blocks: e,
1310
- ...s
1311
- } = t;
1312
- this._blocks.forEach((i, u) => i.state = e[u]), super.state = s;
1313
- }
1314
- reset() {
1315
- super.reset(), this._blocks.forEach((t) => t.reset());
1316
- }
1317
- get isComplete() {
1318
- return this.exposeBlock ? this.exposeBlock.isComplete : this._blocks.every((t) => t.isComplete);
1319
- }
1320
- get isFilled() {
1321
- return this._blocks.every((t) => t.isFilled);
1322
- }
1323
- get isFixed() {
1324
- return this._blocks.every((t) => t.isFixed);
1325
- }
1326
- get isOptional() {
1327
- return this._blocks.every((t) => t.isOptional);
1328
- }
1329
- doCommit() {
1330
- this._blocks.forEach((t) => t.doCommit()), super.doCommit();
1331
- }
1332
- get unmaskedValue() {
1333
- return this.exposeBlock ? this.exposeBlock.unmaskedValue : this._blocks.reduce((t, e) => t += e.unmaskedValue, "");
1334
- }
1335
- set unmaskedValue(t) {
1336
- if (this.exposeBlock) {
1337
- const e = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
1338
- this.exposeBlock.unmaskedValue = t, this.appendTail(e), this.doCommit();
1339
- } else
1340
- super.unmaskedValue = t;
1341
- }
1342
- get value() {
1343
- return this.exposeBlock ? this.exposeBlock.value : (
1344
- // TODO return _value when not in change?
1345
- this._blocks.reduce((t, e) => t += e.value, "")
1346
- );
1347
- }
1348
- set value(t) {
1349
- if (this.exposeBlock) {
1350
- const e = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
1351
- this.exposeBlock.value = t, this.appendTail(e), this.doCommit();
1352
- } else
1353
- super.value = t;
1354
- }
1355
- get typedValue() {
1356
- return this.exposeBlock ? this.exposeBlock.typedValue : super.typedValue;
1357
- }
1358
- set typedValue(t) {
1359
- if (this.exposeBlock) {
1360
- const e = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
1361
- this.exposeBlock.typedValue = t, this.appendTail(e), this.doCommit();
1362
- } else
1363
- super.typedValue = t;
1364
- }
1365
- get displayValue() {
1366
- return this._blocks.reduce((t, e) => t += e.displayValue, "");
1367
- }
1368
- appendTail(t) {
1369
- return super.appendTail(t).aggregate(this._appendPlaceholder());
1370
- }
1371
- _appendEager() {
1372
- var t;
1373
- const e = new c();
1374
- let s = (t = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : t.index;
1375
- if (s == null)
1376
- return e;
1377
- this._blocks[s].isFilled && ++s;
1378
- for (let i = s; i < this._blocks.length; ++i) {
1379
- const u = this._blocks[i]._appendEager();
1380
- if (!u.inserted)
1381
- break;
1382
- e.aggregate(u);
89
+ function Y(r) {
90
+ for (var e = arguments.length, t = new Array(e > 1 ? e - 1 : 0), s = 1; s < e; s++)
91
+ t[s - 1] = arguments[s];
92
+ return t.filter((a) => a).forEach((a) => {
93
+ for (let [n, i] of Object.entries(a))
94
+ if (i !== void 0 && i.toString() === "[object Object]") {
95
+ let h = r[n] !== void 0 ? r[n].toString() : void 0, o = i.toString(), d = Array.isArray(i) ? [] : {};
96
+ r[n] = r[n] ? h !== o ? d : r[n] : d, Y(r[n], i);
97
+ } else
98
+ r[n] = i;
99
+ }), r;
1383
100
  }
1384
- return e;
1385
- }
1386
- _appendCharRaw(t, e) {
1387
- e === void 0 && (e = {});
1388
- const s = this._mapPosToBlock(this.displayValue.length), i = new c();
1389
- if (!s)
1390
- return i;
1391
- for (let a = s.index; ; ++a) {
1392
- var u;
1393
- const r = this._blocks[a];
1394
- if (!r)
1395
- break;
1396
- const l = r._appendChar(t, {
1397
- ...e,
1398
- _beforeTailState: (u = e._beforeTailState) == null || (u = u._blocks) == null ? void 0 : u[a]
1399
- }), d = l.skip;
1400
- if (i.aggregate(l), d || l.rawInserted)
1401
- break;
101
+ function C(r) {
102
+ let e = r;
103
+ return r instanceof Date || (e = new Date(r)), isNaN(e.getTime()) && (console.log('Unable to convert value "'.concat(r, '" to Date object')), e = !1), e;
1402
104
  }
1403
- return i;
1404
- }
1405
- extractTail(t, e) {
1406
- t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length);
1407
- const s = new C();
1408
- return t === e || this._forEachBlocksInRange(t, e, (i, u, a, r) => {
1409
- const l = i.extractTail(a, r);
1410
- l.stop = this._findStopBefore(u), l.from = this._blockStartPos(u), l instanceof C && (l.blockIndex = u), s.extend(l);
1411
- }), s;
1412
- }
1413
- extractInput(t, e, s) {
1414
- if (t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), s === void 0 && (s = {}), t === e)
1415
- return "";
1416
- let i = "";
1417
- return this._forEachBlocksInRange(t, e, (u, a, r, l) => {
1418
- i += u.extractInput(r, l, s);
1419
- }), i;
1420
- }
1421
- _findStopBefore(t) {
1422
- let e;
1423
- for (let s = 0; s < this._stops.length; ++s) {
1424
- const i = this._stops[s];
1425
- if (i <= t)
1426
- e = i;
1427
- else
1428
- break;
105
+ function G(r) {
106
+ let e = "\\s|\\.|-|/|\\\\|,|\\$|\\!|\\?|:|;";
107
+ return new RegExp("(^|>|" + e + ")(" + r + ")($|<|" + e + ")", "g");
1429
108
  }
1430
- return e;
1431
- }
1432
- /** Appends placeholder depending on laziness */
1433
- _appendPlaceholder(t) {
1434
- const e = new c();
1435
- if (this.lazy && t == null)
1436
- return e;
1437
- const s = this._mapPosToBlock(this.displayValue.length);
1438
- if (!s)
1439
- return e;
1440
- const i = s.index, u = t ?? this._blocks.length;
1441
- return this._blocks.slice(i, u).forEach((a) => {
1442
- if (!a.lazy || t != null) {
1443
- var r;
1444
- const l = a._appendPlaceholder((r = a._blocks) == null ? void 0 : r.length);
1445
- this._value += l.inserted, e.aggregate(l);
1446
- }
1447
- }), e;
1448
- }
1449
- /** Finds block in pos */
1450
- _mapPosToBlock(t) {
1451
- let e = "";
1452
- for (let s = 0; s < this._blocks.length; ++s) {
1453
- const i = this._blocks[s], u = e.length;
1454
- if (e += i.displayValue, t <= e.length)
1455
- return {
1456
- index: s,
1457
- offset: t - u
1458
- };
109
+ function V(r, e, t) {
110
+ return e in r ? Object.defineProperty(r, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : r[e] = t, r;
1459
111
  }
1460
- }
1461
- _blockStartPos(t) {
1462
- return this._blocks.slice(0, t).reduce((e, s) => e += s.displayValue.length, 0);
1463
- }
1464
- _forEachBlocksInRange(t, e, s) {
1465
- e === void 0 && (e = this.displayValue.length);
1466
- const i = this._mapPosToBlock(t);
1467
- if (i) {
1468
- const u = this._mapPosToBlock(e), a = u && i.index === u.index, r = i.offset, l = u && a ? u.offset : this._blocks[i.index].displayValue.length;
1469
- if (s(this._blocks[i.index], i.index, r, l), u && !a) {
1470
- for (let d = i.index + 1; d < u.index; ++d)
1471
- s(this._blocks[d], d, 0, this._blocks[d].displayValue.length);
1472
- s(this._blocks[u.index], u.index, 0, u.offset);
112
+ class oe {
113
+ constructor() {
114
+ let { type: e, date: t, dp: s, opts: a, body: n } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
115
+ V(this, "focus", () => {
116
+ this.$cell.classList.add("-focus-"), this.focused = !0;
117
+ }), V(this, "removeFocus", () => {
118
+ this.$cell.classList.remove("-focus-"), this.focused = !1;
119
+ }), V(this, "select", () => {
120
+ this.$cell.classList.add("-selected-"), this.selected = !0;
121
+ }), V(this, "removeSelect", () => {
122
+ this.$cell.classList.remove("-selected-", "-range-from-", "-range-to-"), this.selected = !1;
123
+ }), V(this, "onChangeSelectedDate", () => {
124
+ this.isDisabled || (this._handleSelectedStatus(), this.opts.range && this._handleRangeStatus());
125
+ }), V(this, "onChangeFocusDate", (i) => {
126
+ if (!i)
127
+ return void (this.focused && this.removeFocus());
128
+ let h = v(i, this.date, this.type);
129
+ h ? this.focus() : !h && this.focused && this.removeFocus(), this.opts.range && this._handleRangeStatus();
130
+ }), V(this, "render", () => (this.$cell.innerHTML = this._getHtml(), this.$cell.adpCell = this, this.$cell)), this.type = e, this.singleType = this.type.slice(0, -1), this.date = t, this.dp = s, this.opts = a, this.body = n, this.customData = !1, this.init();
131
+ }
132
+ init() {
133
+ let { range: e, onRenderCell: t } = this.opts;
134
+ t && (this.customData = t({ date: this.date, cellType: this.singleType, datepicker: this.dp })), this._createElement(), this._bindDatepickerEvents(), this._handleInitialFocusStatus(), this.dp.hasSelectedDates && (this._handleSelectedStatus(), e && this._handleRangeStatus());
135
+ }
136
+ _bindDatepickerEvents() {
137
+ this.dp.on(l.eventChangeSelectedDate, this.onChangeSelectedDate), this.dp.on(l.eventChangeFocusDate, this.onChangeFocusDate);
138
+ }
139
+ unbindDatepickerEvents() {
140
+ this.dp.off(l.eventChangeSelectedDate, this.onChangeSelectedDate), this.dp.off(l.eventChangeFocusDate, this.onChangeFocusDate);
141
+ }
142
+ _createElement() {
143
+ var e;
144
+ let { year: t, month: s, date: a } = D(this.date), n = ((e = this.customData) === null || e === void 0 ? void 0 : e.attrs) || {};
145
+ this.$cell = b({ className: this._getClassName(), attrs: { "data-year": t, "data-month": s, "data-date": a, ...n } });
146
+ }
147
+ _getClassName() {
148
+ var e, t;
149
+ let s = /* @__PURE__ */ new Date(), { selectOtherMonths: a, selectOtherYears: n } = this.opts, { minDate: i, maxDate: h } = this.dp, { day: o } = D(this.date), d = this._isOutOfMinMaxRange(), c = (e = this.customData) === null || e === void 0 ? void 0 : e.disabled, u = M("air-datepicker-cell", "-".concat(this.singleType, "-"), { "-current-": v(s, this.date, this.type), "-min-date-": i && v(i, this.date, this.type), "-max-date-": h && v(h, this.date, this.type) }), p = "";
150
+ switch (this.type) {
151
+ case l.days:
152
+ p = M({ "-weekend-": this.dp.isWeekend(o), "-other-month-": this.isOtherMonth, "-disabled-": this.isOtherMonth && !a || d || c });
153
+ break;
154
+ case l.months:
155
+ p = M({ "-disabled-": d || c });
156
+ break;
157
+ case l.years:
158
+ p = M({ "-other-decade-": this.isOtherDecade, "-disabled-": d || this.isOtherDecade && !n || c });
159
+ }
160
+ return M(u, p, (t = this.customData) === null || t === void 0 ? void 0 : t.classes);
161
+ }
162
+ _getHtml() {
163
+ var e;
164
+ let { year: t, month: s, date: a } = D(this.date), { showOtherMonths: n, showOtherYears: i } = this.opts;
165
+ if ((e = this.customData) !== null && e !== void 0 && e.html)
166
+ return this.customData.html;
167
+ switch (this.type) {
168
+ case l.days:
169
+ return !n && this.isOtherMonth ? "" : a;
170
+ case l.months:
171
+ return this.dp.locale[this.opts.monthsField][s];
172
+ case l.years:
173
+ return !i && this.isOtherDecade ? "" : t;
174
+ }
175
+ }
176
+ _isOutOfMinMaxRange() {
177
+ let { minDate: e, maxDate: t } = this.dp, { type: s, date: a } = this, { month: n, year: i, date: h } = D(a), o = s === l.days, d = s === l.years, c = !!e && new Date(i, d ? e.getMonth() : n, o ? h : e.getDate()), u = !!t && new Date(i, d ? t.getMonth() : n, o ? h : t.getDate());
178
+ return e && t ? E(c, e) || $(u, t) : e ? E(c, e) : t ? $(u, t) : void 0;
179
+ }
180
+ destroy() {
181
+ this.unbindDatepickerEvents();
182
+ }
183
+ _handleRangeStatus() {
184
+ let { rangeDateFrom: e, rangeDateTo: t } = this.dp, s = M({ "-in-range-": e && t && (a = this.date, n = e, i = t, $(a, n) && E(a, i)), "-range-from-": e && v(this.date, e, this.type), "-range-to-": t && v(this.date, t, this.type) });
185
+ var a, n, i;
186
+ this.$cell.classList.remove("-range-from-", "-range-to-", "-in-range-"), s && this.$cell.classList.add(...s.split(" "));
187
+ }
188
+ _handleSelectedStatus() {
189
+ let e = this.dp._checkIfDateIsSelected(this.date, this.type);
190
+ e ? this.select() : !e && this.selected && this.removeSelect();
191
+ }
192
+ _handleInitialFocusStatus() {
193
+ v(this.dp.focusDate, this.date, this.type) && this.focus();
194
+ }
195
+ get isDisabled() {
196
+ return this.$cell.matches(".-disabled-");
197
+ }
198
+ get isOtherMonth() {
199
+ return this.dp.isOtherMonth(this.date);
200
+ }
201
+ get isOtherDecade() {
202
+ return this.dp.isOtherDecade(this.date);
1473
203
  }
1474
204
  }
1475
- }
1476
- remove(t, e) {
1477
- t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length);
1478
- const s = super.remove(t, e);
1479
- return this._forEachBlocksInRange(t, e, (i, u, a, r) => {
1480
- s.aggregate(i.remove(a, r));
1481
- }), s;
1482
- }
1483
- nearestInputPos(t, e) {
1484
- if (e === void 0 && (e = h.NONE), !this._blocks.length)
1485
- return 0;
1486
- const s = new X(this, t);
1487
- if (e === h.NONE)
1488
- return s.pushRightBeforeInput() || (s.popState(), s.pushLeftBeforeInput()) ? s.pos : this.displayValue.length;
1489
- if (e === h.LEFT || e === h.FORCE_LEFT) {
1490
- if (e === h.LEFT) {
1491
- if (s.pushRightBeforeFilled(), s.ok && s.pos === t)
1492
- return t;
1493
- s.popState();
1494
- }
1495
- if (s.pushLeftBeforeInput(), s.pushLeftBeforeRequired(), s.pushLeftBeforeFilled(), e === h.LEFT) {
1496
- if (s.pushRightBeforeInput(), s.pushRightBeforeRequired(), s.ok && s.pos <= t || (s.popState(), s.ok && s.pos <= t))
1497
- return s.pos;
1498
- s.popState();
1499
- }
1500
- return s.ok ? s.pos : e === h.FORCE_LEFT ? 0 : (s.popState(), s.ok || (s.popState(), s.ok) ? s.pos : 0);
205
+ function k(r, e, t) {
206
+ return e in r ? Object.defineProperty(r, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : r[e] = t, r;
1501
207
  }
1502
- 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;
1503
- }
1504
- totalInputPositions(t, e) {
1505
- t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length);
1506
- let s = 0;
1507
- return this._forEachBlocksInRange(t, e, (i, u, a, r) => {
1508
- s += i.totalInputPositions(a, r);
1509
- }), s;
1510
- }
1511
- /** Get block by name */
1512
- maskedBlock(t) {
1513
- return this.maskedBlocks(t)[0];
1514
- }
1515
- /** Get all blocks by name */
1516
- maskedBlocks(t) {
1517
- const e = this._maskedBlocks[t];
1518
- return e ? e.map((s) => this._blocks[s]) : [];
1519
- }
1520
- }
1521
- k.DEFAULTS = {
1522
- lazy: !0,
1523
- placeholderChar: "_"
1524
- }, k.STOP_CHAR = "`", k.ESCAPE_CHAR = "\\", k.InputDefinition = M, k.FixedDefinition = R, o.MaskedPattern = k;
1525
- class V extends k {
1526
- /**
1527
- Optionally sets max length of pattern.
1528
- Used when pattern length is longer then `to` param length. Pads zeros at start in this case.
1529
- */
1530
- /** Min bound */
1531
- /** Max bound */
1532
- /** */
1533
- get _matchFrom() {
1534
- return this.maxLength - String(this.from).length;
1535
- }
1536
- constructor(t) {
1537
- super(t);
1538
- }
1539
- updateOptions(t) {
1540
- super.updateOptions(t);
1541
- }
1542
- _update(t) {
1543
- const {
1544
- to: e = this.to || 0,
1545
- from: s = this.from || 0,
1546
- maxLength: i = this.maxLength || 0,
1547
- autofix: u = this.autofix,
1548
- ...a
1549
- } = t;
1550
- this.to = e, this.from = s, this.maxLength = Math.max(String(e).length, i), this.autofix = u;
1551
- const r = String(this.from).padStart(this.maxLength, "0"), l = String(this.to).padStart(this.maxLength, "0");
1552
- let d = 0;
1553
- for (; d < l.length && l[d] === r[d]; )
1554
- ++d;
1555
- a.mask = l.slice(0, d).replace(/0/g, "\\0") + "0".repeat(this.maxLength - d), super._update(a);
1556
- }
1557
- get isComplete() {
1558
- return super.isComplete && !!this.value;
1559
- }
1560
- boundaries(t) {
1561
- let e = "", s = "";
1562
- const [, i, u] = t.match(/^(\D*)(\d*)(\D*)/) || [];
1563
- return u && (e = "0".repeat(i.length) + u, s = "9".repeat(i.length) + u), e = e.padEnd(this.maxLength, "0"), s = s.padEnd(this.maxLength, "9"), [e, s];
1564
- }
1565
- doPrepareChar(t, e) {
1566
- e === void 0 && (e = {});
1567
- let s;
1568
- if ([t, s] = super.doPrepareChar(t.replace(/\D/g, ""), e), !this.autofix || !t)
1569
- return [t, s];
1570
- const i = String(this.from).padStart(this.maxLength, "0"), u = String(this.to).padStart(this.maxLength, "0"), a = this.value + t;
1571
- if (a.length > this.maxLength)
1572
- return ["", s];
1573
- const [r, l] = this.boundaries(a);
1574
- return Number(l) < this.from ? [i[a.length - 1], s] : Number(r) > this.to ? this.autofix === "pad" && a.length < this.maxLength ? ["", s.aggregate(this.append(i[a.length - 1] + t, e))] : [u[a.length - 1], s] : [t, s];
1575
- }
1576
- doValidate(t) {
1577
- const e = this.value;
1578
- if (e.search(/[^0]/) === -1 && e.length <= this._matchFrom)
1579
- return !0;
1580
- const [i, u] = this.boundaries(e);
1581
- return this.from <= Number(u) && Number(i) <= this.to && super.doValidate(t);
1582
- }
1583
- }
1584
- o.MaskedRange = V;
1585
- class B extends k {
1586
- /** Pattern mask for date according to {@link MaskedDate#format} */
1587
- /** Start date */
1588
- /** End date */
1589
- /** */
1590
- /** Format typed value to string */
1591
- /** Parse string to get typed value */
1592
- constructor(t) {
1593
- const {
1594
- mask: e,
1595
- pattern: s,
1596
- ...i
1597
- } = {
1598
- ...B.DEFAULTS,
1599
- ...t
1600
- };
1601
- super({
1602
- ...i,
1603
- mask: m(e) ? e : s
1604
- });
1605
- }
1606
- updateOptions(t) {
1607
- super.updateOptions(t);
1608
- }
1609
- _update(t) {
1610
- const {
1611
- mask: e,
1612
- pattern: s,
1613
- blocks: i,
1614
- ...u
1615
- } = {
1616
- ...B.DEFAULTS,
1617
- ...t
1618
- }, a = Object.assign({}, B.GET_DEFAULT_BLOCKS());
1619
- t.min && (a.Y.from = t.min.getFullYear()), t.max && (a.Y.to = t.max.getFullYear()), t.min && t.max && a.Y.from === a.Y.to && (a.m.from = t.min.getMonth() + 1, a.m.to = t.max.getMonth() + 1, a.m.from === a.m.to && (a.d.from = t.min.getDate(), a.d.to = t.max.getDate())), Object.assign(a, this.blocks, i), Object.keys(a).forEach((r) => {
1620
- const l = a[r];
1621
- !("autofix" in l) && "autofix" in t && (l.autofix = t.autofix);
1622
- }), super._update({
1623
- ...u,
1624
- mask: m(e) ? e : s,
1625
- blocks: a
1626
- });
1627
- }
1628
- doValidate(t) {
1629
- const e = this.date;
1630
- return super.doValidate(t) && (!this.isComplete || this.isDateExist(this.value) && e != null && (this.min == null || this.min <= e) && (this.max == null || e <= this.max));
1631
- }
1632
- /** Checks if date is exists */
1633
- isDateExist(t) {
1634
- return this.format(this.parse(t, this), this).indexOf(t) >= 0;
1635
- }
1636
- /** Parsed Date */
1637
- get date() {
1638
- return this.typedValue;
1639
- }
1640
- set date(t) {
1641
- this.typedValue = t;
1642
- }
1643
- get typedValue() {
1644
- return this.isComplete ? super.typedValue : null;
1645
- }
1646
- set typedValue(t) {
1647
- super.typedValue = t;
1648
- }
1649
- maskEquals(t) {
1650
- return t === Date || super.maskEquals(t);
1651
- }
1652
- }
1653
- B.GET_DEFAULT_BLOCKS = () => ({
1654
- d: {
1655
- mask: V,
1656
- from: 1,
1657
- to: 31,
1658
- maxLength: 2
1659
- },
1660
- m: {
1661
- mask: V,
1662
- from: 1,
1663
- to: 12,
1664
- maxLength: 2
1665
- },
1666
- Y: {
1667
- mask: V,
1668
- from: 1900,
1669
- to: 9999
1670
- }
1671
- }), B.DEFAULTS = {
1672
- mask: Date,
1673
- pattern: "d{.}`m{.}`Y",
1674
- format: (n, t) => {
1675
- if (!n)
1676
- return "";
1677
- const e = String(n.getDate()).padStart(2, "0"), s = String(n.getMonth() + 1).padStart(2, "0"), i = n.getFullYear();
1678
- return [e, s, i].join(".");
1679
- },
1680
- parse: (n, t) => {
1681
- const [e, s, i] = n.split(".").map(Number);
1682
- return new Date(i, s - 1, e);
1683
- }
1684
- }, o.MaskedDate = B;
1685
- class D extends f {
1686
- /** Currently chosen mask */
1687
- /** Currently chosen mask */
1688
- /** Compliled {@link Masked} options */
1689
- /** Chooses {@link Masked} depending on input value */
1690
- constructor(t) {
1691
- super({
1692
- ...D.DEFAULTS,
1693
- ...t
1694
- }), this.currentMask = void 0;
1695
- }
1696
- updateOptions(t) {
1697
- super.updateOptions(t);
1698
- }
1699
- _update(t) {
1700
- super._update(t), "mask" in t && (this.exposeMask = void 0, this.compiledMasks = Array.isArray(t.mask) ? t.mask.map((e) => {
1701
- const {
1702
- expose: s,
1703
- ...i
1704
- } = x(e), u = A({
1705
- overwrite: this._overwrite,
1706
- eager: this._eager,
1707
- skipInvalid: this._skipInvalid,
1708
- ...i
1709
- });
1710
- return s && (this.exposeMask = u), u;
1711
- }) : []);
1712
- }
1713
- _appendCharRaw(t, e) {
1714
- e === void 0 && (e = {});
1715
- const s = this._applyDispatch(t, e);
1716
- return this.currentMask && s.aggregate(this.currentMask._appendChar(t, this.currentMaskFlags(e))), s;
1717
- }
1718
- _applyDispatch(t, e, s) {
1719
- t === void 0 && (t = ""), e === void 0 && (e = {}), s === void 0 && (s = "");
1720
- const i = e.tail && e._beforeTailState != null ? e._beforeTailState._value : this.value, u = this.rawInputValue, a = e.tail && e._beforeTailState != null ? e._beforeTailState._rawInputValue : u, r = u.slice(a.length), l = this.currentMask, d = new c(), v = l == null ? void 0 : l.state;
1721
- if (this.currentMask = this.doDispatch(t, {
1722
- ...e
1723
- }, s), this.currentMask)
1724
- if (this.currentMask !== l) {
1725
- if (this.currentMask.reset(), a) {
1726
- const _ = this.currentMask.append(a, {
1727
- raw: !0
208
+ let le = { [l.days]: '<div class="air-datepicker-body--day-names"></div>' + '<div class="air-datepicker-body--cells -'.concat(l.days, '-"></div>'), [l.months]: '<div class="air-datepicker-body--cells -'.concat(l.months, '-"></div>'), [l.years]: '<div class="air-datepicker-body--cells -'.concat(l.years, '-"></div>') };
209
+ const P = ".air-datepicker-cell";
210
+ class ee {
211
+ constructor(e) {
212
+ let { dp: t, type: s, opts: a } = e;
213
+ k(this, "handleClick", (n) => {
214
+ let i = n.target.closest(P).adpCell;
215
+ if (i.isDisabled)
216
+ return;
217
+ if (!this.dp.isMinViewReached)
218
+ return void this.dp.down();
219
+ let h = this.dp._checkIfDateIsSelected(i.date, i.type);
220
+ h ? this.dp._handleAlreadySelectedDates(h, i.date) : this.dp.selectDate(i.date);
221
+ }), k(this, "handleDayNameClick", (n) => {
222
+ let i = n.target.getAttribute("data-day-index");
223
+ this.opts.onClickDayName({ dayIndex: Number(i), datepicker: this.dp });
224
+ }), k(this, "onChangeCurrentView", (n) => {
225
+ n !== this.type ? this.hide() : (this.show(), this.render());
226
+ }), k(this, "onMouseOverCell", (n) => {
227
+ let i = R(n.target, P);
228
+ this.dp.setFocusDate(!!i && i.adpCell.date);
229
+ }), k(this, "onMouseOutCell", () => {
230
+ this.dp.setFocusDate(!1);
231
+ }), k(this, "onClickBody", (n) => {
232
+ let { onClickDayName: i } = this.opts, h = n.target;
233
+ h.closest(P) && this.handleClick(n), i && h.closest(".air-datepicker-body--day-name") && this.handleDayNameClick(n);
234
+ }), k(this, "onMouseDown", (n) => {
235
+ this.pressed = !0;
236
+ let i = R(n.target, P), h = i && i.adpCell;
237
+ v(h.date, this.dp.rangeDateFrom) && (this.rangeFromFocused = !0), v(h.date, this.dp.rangeDateTo) && (this.rangeToFocused = !0);
238
+ }), k(this, "onMouseMove", (n) => {
239
+ if (!this.pressed || !this.dp.isMinViewReached)
240
+ return;
241
+ n.preventDefault();
242
+ let i = R(n.target, P), h = i && i.adpCell, { selectedDates: o, rangeDateTo: d, rangeDateFrom: c } = this.dp;
243
+ if (!h || h.isDisabled)
244
+ return;
245
+ let { date: u } = h;
246
+ if (o.length === 2) {
247
+ if (this.rangeFromFocused && !$(u, d)) {
248
+ let { hours: p, minutes: g } = D(c);
249
+ u.setHours(p), u.setMinutes(g), this.dp.rangeDateFrom = u, this.dp.replaceDate(c, u);
250
+ }
251
+ if (this.rangeToFocused && !E(u, c)) {
252
+ let { hours: p, minutes: g } = D(d);
253
+ u.setHours(p), u.setMinutes(g), this.dp.rangeDateTo = u, this.dp.replaceDate(d, u);
254
+ }
255
+ }
256
+ }), k(this, "onMouseUp", () => {
257
+ this.pressed = !1, this.rangeFromFocused = !1, this.rangeToFocused = !1;
258
+ }), k(this, "onChangeViewDate", (n, i) => {
259
+ if (!this.isVisible)
260
+ return;
261
+ let h = F(n), o = F(i);
262
+ switch (this.dp.currentView) {
263
+ case l.days:
264
+ if (v(n, i, l.months))
265
+ return;
266
+ break;
267
+ case l.months:
268
+ if (v(n, i, l.years))
269
+ return;
270
+ break;
271
+ case l.years:
272
+ if (h[0] === o[0] && h[1] === o[1])
273
+ return;
274
+ }
275
+ this.render();
276
+ }), k(this, "render", () => {
277
+ this.destroyCells(), this._generateCells(), this.cells.forEach((n) => {
278
+ this.$cells.appendChild(n.render());
1728
279
  });
1729
- d.tailShift = _.inserted.length - i.length;
280
+ }), this.dp = t, this.type = s, this.opts = a, this.cells = [], this.$el = "", this.pressed = !1, this.isVisible = !0, this.init();
281
+ }
282
+ init() {
283
+ this._buildBaseHtml(), this.type === l.days && this.renderDayNames(), this.render(), this._bindEvents(), this._bindDatepickerEvents();
284
+ }
285
+ _bindEvents() {
286
+ let { range: e, dynamicRange: t } = this.opts;
287
+ w(this.$el, "mouseover", this.onMouseOverCell), w(this.$el, "mouseout", this.onMouseOutCell), w(this.$el, "click", this.onClickBody), e && t && (w(this.$el, "mousedown", this.onMouseDown), w(this.$el, "mousemove", this.onMouseMove), w(window.document, "mouseup", this.onMouseUp));
288
+ }
289
+ _bindDatepickerEvents() {
290
+ this.dp.on(l.eventChangeViewDate, this.onChangeViewDate), this.dp.on(l.eventChangeCurrentView, this.onChangeCurrentView);
291
+ }
292
+ _buildBaseHtml() {
293
+ this.$el = b({ className: "air-datepicker-body -".concat(this.type, "-"), innerHtml: le[this.type] }), this.$names = y(".air-datepicker-body--day-names", this.$el), this.$cells = y(".air-datepicker-body--cells", this.$el);
294
+ }
295
+ _getDayNamesHtml() {
296
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dp.locale.firstDay, t = "", s = this.dp.isWeekend, { onClickDayName: a } = this.opts, n = e, i = 0;
297
+ for (; i < 7; ) {
298
+ let h = n % 7, o = M("air-datepicker-body--day-name", { [l.cssClassWeekend]: s(h), "-clickable-": !!a }), d = this.dp.locale.daysMin[h];
299
+ t += '<div class="'.concat(o, `" data-day-index='`).concat(h, "'>").concat(d, "</div>"), i++, n++;
1730
300
  }
1731
- r && (d.tailShift += this.currentMask.append(r, {
1732
- raw: !0,
1733
- tail: !0
1734
- }).tailShift);
1735
- } else
1736
- v && (this.currentMask.state = v);
1737
- return d;
1738
- }
1739
- _appendPlaceholder() {
1740
- const t = this._applyDispatch();
1741
- return this.currentMask && t.aggregate(this.currentMask._appendPlaceholder()), t;
1742
- }
1743
- _appendEager() {
1744
- const t = this._applyDispatch();
1745
- return this.currentMask && t.aggregate(this.currentMask._appendEager()), t;
1746
- }
1747
- appendTail(t) {
1748
- const e = new c();
1749
- return t && e.aggregate(this._applyDispatch("", {}, t)), e.aggregate(this.currentMask ? this.currentMask.appendTail(t) : super.appendTail(t));
1750
- }
1751
- currentMaskFlags(t) {
1752
- var e, s;
1753
- return {
1754
- ...t,
1755
- _beforeTailState: ((e = t._beforeTailState) == null ? void 0 : e.currentMaskRef) === this.currentMask && ((s = t._beforeTailState) == null ? void 0 : s.currentMask) || t._beforeTailState
1756
- };
1757
- }
1758
- doDispatch(t, e, s) {
1759
- return e === void 0 && (e = {}), s === void 0 && (s = ""), this.dispatch(t, this, e, s);
1760
- }
1761
- doValidate(t) {
1762
- return super.doValidate(t) && (!this.currentMask || this.currentMask.doValidate(this.currentMaskFlags(t)));
1763
- }
1764
- doPrepare(t, e) {
1765
- e === void 0 && (e = {});
1766
- let [s, i] = super.doPrepare(t, e);
1767
- if (this.currentMask) {
1768
- let u;
1769
- [s, u] = super.doPrepare(s, this.currentMaskFlags(e)), i = i.aggregate(u);
301
+ return t;
302
+ }
303
+ _getDaysCells() {
304
+ let { viewDate: e, locale: { firstDay: t } } = this.dp, s = Z(e), { year: a, month: n } = D(e), i = new Date(a, n, 1), h = new Date(a, n, s), o = i.getDay() - t, d = 6 - h.getDay() + t;
305
+ o = o < 0 ? o + 7 : o, d = d > 6 ? d - 7 : d;
306
+ let c = function(N, B) {
307
+ let { year: K, month: I, date: z } = D(N);
308
+ return new Date(K, I, z - B);
309
+ }(i, o), u = s + o + d, p = c.getDate(), { year: g, month: f } = D(c), _ = 0;
310
+ for (; _ < u; ) {
311
+ let N = new Date(g, f, p + _);
312
+ this._generateCell(N), _++;
313
+ }
314
+ }
315
+ _generateCell(e) {
316
+ let { type: t, dp: s, opts: a } = this, n = new oe({ type: t, dp: s, opts: a, date: e, body: this });
317
+ return this.cells.push(n), n;
318
+ }
319
+ _generateDayCells() {
320
+ this._getDaysCells();
321
+ }
322
+ _generateMonthCells() {
323
+ let { year: e } = this.dp.parsedViewDate, t = 0;
324
+ for (; t < 12; )
325
+ this.cells.push(this._generateCell(new Date(e, t))), t++;
326
+ }
327
+ _generateYearCells() {
328
+ let e = F(this.dp.viewDate), t = e[0] - 1, s = e[1] + 1, a = t;
329
+ for (; a <= s; )
330
+ this.cells.push(this._generateCell(new Date(a, 0))), a++;
331
+ }
332
+ renderDayNames() {
333
+ this.$names.innerHTML = this._getDayNamesHtml();
334
+ }
335
+ _generateCells() {
336
+ switch (this.type) {
337
+ case l.days:
338
+ this._generateDayCells();
339
+ break;
340
+ case l.months:
341
+ this._generateMonthCells();
342
+ break;
343
+ case l.years:
344
+ this._generateYearCells();
345
+ }
346
+ }
347
+ show() {
348
+ this.isVisible = !0, this.$el.classList.remove("-hidden-");
349
+ }
350
+ hide() {
351
+ this.isVisible = !1, this.$el.classList.add("-hidden-");
352
+ }
353
+ destroyCells() {
354
+ this.cells.forEach((e) => e.destroy()), this.cells = [], this.$cells.innerHTML = "";
355
+ }
356
+ destroy() {
357
+ this.destroyCells(), this.dp.off(l.eventChangeViewDate, this.onChangeViewDate), this.dp.off(l.eventChangeCurrentView, this.onChangeCurrentView);
358
+ }
1770
359
  }
1771
- return [s, i];
1772
- }
1773
- doPrepareChar(t, e) {
1774
- e === void 0 && (e = {});
1775
- let [s, i] = super.doPrepareChar(t, e);
1776
- if (this.currentMask) {
1777
- let u;
1778
- [s, u] = super.doPrepareChar(s, this.currentMaskFlags(e)), i = i.aggregate(u);
360
+ function x(r, e, t) {
361
+ return e in r ? Object.defineProperty(r, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : r[e] = t, r;
1779
362
  }
1780
- return [s, i];
1781
- }
1782
- reset() {
1783
- var t;
1784
- (t = this.currentMask) == null || t.reset(), this.compiledMasks.forEach((e) => e.reset());
1785
- }
1786
- get value() {
1787
- return this.exposeMask ? this.exposeMask.value : this.currentMask ? this.currentMask.value : "";
1788
- }
1789
- set value(t) {
1790
- this.exposeMask ? (this.exposeMask.value = t, this.currentMask = this.exposeMask, this._applyDispatch()) : super.value = t;
1791
- }
1792
- get unmaskedValue() {
1793
- return this.exposeMask ? this.exposeMask.unmaskedValue : this.currentMask ? this.currentMask.unmaskedValue : "";
1794
- }
1795
- set unmaskedValue(t) {
1796
- this.exposeMask ? (this.exposeMask.unmaskedValue = t, this.currentMask = this.exposeMask, this._applyDispatch()) : super.unmaskedValue = t;
1797
- }
1798
- get typedValue() {
1799
- return this.exposeMask ? this.exposeMask.typedValue : this.currentMask ? this.currentMask.typedValue : "";
1800
- }
1801
- set typedValue(t) {
1802
- if (this.exposeMask) {
1803
- this.exposeMask.typedValue = t, this.currentMask = this.exposeMask, this._applyDispatch();
1804
- return;
363
+ class de {
364
+ constructor(e) {
365
+ let { dp: t, opts: s } = e;
366
+ x(this, "onClickNav", (a) => {
367
+ let n = R(a.target, ".air-datepicker-nav--action");
368
+ if (!n)
369
+ return;
370
+ let i = n.dataset.action;
371
+ this.dp[i]();
372
+ }), x(this, "onChangeViewDate", () => {
373
+ this.render(), this._resetNavStatus(), this.handleNavStatus();
374
+ }), x(this, "onChangeCurrentView", () => {
375
+ this.render(), this._resetNavStatus(), this.handleNavStatus();
376
+ }), x(this, "onClickNavTitle", () => {
377
+ this.dp.isFinalView || this.dp.up();
378
+ }), x(this, "update", () => {
379
+ let { prevHtml: a, nextHtml: n } = this.opts;
380
+ this.$prev.innerHTML = a, this.$next.innerHTML = n, this._resetNavStatus(), this.render(), this.handleNavStatus();
381
+ }), x(this, "renderDelay", () => {
382
+ setTimeout(this.render);
383
+ }), x(this, "render", () => {
384
+ this.$title.innerHTML = this._getTitle(), function(a, n) {
385
+ for (let i in n)
386
+ n[i] ? a.classList.add(i) : a.classList.remove(i);
387
+ }(this.$title, { "-disabled-": this.dp.isFinalView });
388
+ }), this.dp = t, this.opts = s, this.init();
389
+ }
390
+ init() {
391
+ this._createElement(), this._buildBaseHtml(), this._defineDOM(), this.render(), this.handleNavStatus(), this._bindEvents(), this._bindDatepickerEvents();
392
+ }
393
+ _defineDOM() {
394
+ this.$title = y(".air-datepicker-nav--title", this.$el), this.$prev = y('[data-action="prev"]', this.$el), this.$next = y('[data-action="next"]', this.$el);
395
+ }
396
+ _bindEvents() {
397
+ this.$el.addEventListener("click", this.onClickNav), this.$title.addEventListener("click", this.onClickNavTitle);
398
+ }
399
+ _bindDatepickerEvents() {
400
+ this.dp.on(l.eventChangeViewDate, this.onChangeViewDate), this.dp.on(l.eventChangeCurrentView, this.onChangeCurrentView), this.isNavIsFunction && (this.dp.on(l.eventChangeSelectedDate, this.renderDelay), this.dp.opts.timepicker && this.dp.on(l.eventChangeTime, this.render));
401
+ }
402
+ destroy() {
403
+ this.dp.off(l.eventChangeViewDate, this.onChangeViewDate), this.dp.off(l.eventChangeCurrentView, this.onChangeCurrentView), this.isNavIsFunction && (this.dp.off(l.eventChangeSelectedDate, this.renderDelay), this.dp.opts.timepicker && this.dp.off(l.eventChangeTime, this.render));
404
+ }
405
+ _createElement() {
406
+ this.$el = b({ tagName: "nav", className: "air-datepicker-nav" });
407
+ }
408
+ _getTitle() {
409
+ let { dp: e, opts: t } = this, s = t.navTitles[e.currentView];
410
+ return typeof s == "function" ? s(e) : e.formatDate(e.viewDate, s);
411
+ }
412
+ handleNavStatus() {
413
+ let { disableNavWhenOutOfRange: e } = this.opts, { minDate: t, maxDate: s } = this.dp;
414
+ if (!t && !s || !e)
415
+ return;
416
+ let { year: a, month: n } = this.dp.parsedViewDate, i = !!t && D(t), h = !!s && D(s);
417
+ switch (this.dp.currentView) {
418
+ case l.days:
419
+ t && i.month >= n && i.year >= a && this._disableNav("prev"), s && h.month <= n && h.year <= a && this._disableNav("next");
420
+ break;
421
+ case l.months:
422
+ t && i.year >= a && this._disableNav("prev"), s && h.year <= a && this._disableNav("next");
423
+ break;
424
+ case l.years: {
425
+ let o = F(this.dp.viewDate);
426
+ t && i.year >= o[0] && this._disableNav("prev"), s && h.year <= o[1] && this._disableNav("next");
427
+ break;
428
+ }
429
+ }
430
+ }
431
+ _disableNav(e) {
432
+ y('[data-action="' + e + '"]', this.$el).classList.add("-disabled-");
433
+ }
434
+ _resetNavStatus() {
435
+ (function(e) {
436
+ for (var t = arguments.length, s = new Array(t > 1 ? t - 1 : 0), a = 1; a < t; a++)
437
+ s[a - 1] = arguments[a];
438
+ e.length ? e.forEach((n) => {
439
+ n.classList.remove(...s);
440
+ }) : e.classList.remove(...s);
441
+ })(this.$el.querySelectorAll(".air-datepicker-nav--action"), "-disabled-");
442
+ }
443
+ _buildBaseHtml() {
444
+ let { prevHtml: e, nextHtml: t } = this.opts;
445
+ this.$el.innerHTML = '<div class="air-datepicker-nav--action" data-action="prev">'.concat(e, "</div>") + '<div class="air-datepicker-nav--title"></div>' + '<div class="air-datepicker-nav--action" data-action="next">'.concat(t, "</div>");
446
+ }
447
+ get isNavIsFunction() {
448
+ let { navTitles: e } = this.opts;
449
+ return Object.keys(e).find((t) => typeof e[t] == "function");
450
+ }
1805
451
  }
1806
- let e = String(t);
1807
- this.currentMask && (this.currentMask.typedValue = t, e = this.currentMask.unmaskedValue), this.unmaskedValue = e;
1808
- }
1809
- get displayValue() {
1810
- return this.currentMask ? this.currentMask.displayValue : "";
1811
- }
1812
- get isComplete() {
1813
- var t;
1814
- return !!((t = this.currentMask) != null && t.isComplete);
1815
- }
1816
- get isFilled() {
1817
- var t;
1818
- return !!((t = this.currentMask) != null && t.isFilled);
1819
- }
1820
- remove(t, e) {
1821
- const s = new c();
1822
- return this.currentMask && s.aggregate(this.currentMask.remove(t, e)).aggregate(this._applyDispatch()), s;
1823
- }
1824
- get state() {
1825
- var t;
1826
- return {
1827
- ...super.state,
1828
- _rawInputValue: this.rawInputValue,
1829
- compiledMasks: this.compiledMasks.map((e) => e.state),
1830
- currentMaskRef: this.currentMask,
1831
- currentMask: (t = this.currentMask) == null ? void 0 : t.state
1832
- };
1833
- }
1834
- set state(t) {
1835
- const {
1836
- compiledMasks: e,
1837
- currentMaskRef: s,
1838
- currentMask: i,
1839
- ...u
1840
- } = t;
1841
- e && this.compiledMasks.forEach((a, r) => a.state = e[r]), s != null && (this.currentMask = s, this.currentMask.state = i), super.state = u;
1842
- }
1843
- extractInput(t, e, s) {
1844
- return this.currentMask ? this.currentMask.extractInput(t, e, s) : "";
1845
- }
1846
- extractTail(t, e) {
1847
- return this.currentMask ? this.currentMask.extractTail(t, e) : super.extractTail(t, e);
1848
- }
1849
- doCommit() {
1850
- this.currentMask && this.currentMask.doCommit(), super.doCommit();
1851
- }
1852
- nearestInputPos(t, e) {
1853
- return this.currentMask ? this.currentMask.nearestInputPos(t, e) : super.nearestInputPos(t, e);
1854
- }
1855
- get overwrite() {
1856
- return this.currentMask ? this.currentMask.overwrite : this._overwrite;
1857
- }
1858
- set overwrite(t) {
1859
- this._overwrite = t;
1860
- }
1861
- get eager() {
1862
- return this.currentMask ? this.currentMask.eager : this._eager;
1863
- }
1864
- set eager(t) {
1865
- this._eager = t;
1866
- }
1867
- get skipInvalid() {
1868
- return this.currentMask ? this.currentMask.skipInvalid : this._skipInvalid;
1869
- }
1870
- set skipInvalid(t) {
1871
- this._skipInvalid = t;
1872
- }
1873
- maskEquals(t) {
1874
- return Array.isArray(t) ? this.compiledMasks.every((e, s) => {
1875
- if (!t[s])
1876
- return;
1877
- const {
1878
- mask: i,
1879
- ...u
1880
- } = t[s];
1881
- return b(e, u) && e.maskEquals(i);
1882
- }) : super.maskEquals(t);
1883
- }
1884
- typedValueEquals(t) {
1885
- var e;
1886
- return !!((e = this.currentMask) != null && e.typedValueEquals(t));
1887
- }
1888
- }
1889
- D.DEFAULTS = void 0, D.DEFAULTS = {
1890
- dispatch: (n, t, e, s) => {
1891
- if (!t.compiledMasks.length)
1892
- return;
1893
- const i = t.rawInputValue, u = t.compiledMasks.map((a, r) => {
1894
- const l = t.currentMask === a, d = l ? a.displayValue.length : a.nearestInputPos(a.displayValue.length, h.FORCE_LEFT);
1895
- return a.rawInputValue !== i ? (a.reset(), a.append(i, {
1896
- raw: !0
1897
- })) : l || a.remove(d), a.append(n, t.currentMaskFlags(e)), a.appendTail(s), {
1898
- index: r,
1899
- weight: a.rawInputValue.length,
1900
- totalInputPositions: a.totalInputPositions(0, Math.max(d, a.nearestInputPos(a.displayValue.length, h.FORCE_LEFT)))
1901
- };
1902
- });
1903
- return u.sort((a, r) => r.weight - a.weight || r.totalInputPositions - a.totalInputPositions), t.compiledMasks[u[0].index];
1904
- }
1905
- }, o.MaskedDynamic = D;
1906
- class Y extends k {
1907
- constructor(t) {
1908
- super(t);
1909
- }
1910
- updateOptions(t) {
1911
- super.updateOptions(t);
1912
- }
1913
- _update(t) {
1914
- const {
1915
- enum: e,
1916
- ...s
1917
- } = t;
1918
- if (e) {
1919
- const i = e.map((r) => r.length), u = Math.min(...i), a = Math.max(...i) - u;
1920
- s.mask = "*".repeat(u), a && (s.mask += "[" + "*".repeat(a) + "]"), this.enum = e;
452
+ var te = { today: { content: (r) => r.locale.today, onClick: (r) => r.setViewDate(/* @__PURE__ */ new Date()) }, clear: { content: (r) => r.locale.clear, onClick: (r) => r.clear() } };
453
+ class ce {
454
+ constructor(e) {
455
+ let { dp: t, opts: s } = e;
456
+ this.dp = t, this.opts = s, this.init();
457
+ }
458
+ init() {
459
+ this.createElement(), this.render();
460
+ }
461
+ createElement() {
462
+ this.$el = b({ className: "air-datepicker-buttons" });
463
+ }
464
+ destroy() {
465
+ this.$el.parentNode.removeChild(this.$el);
466
+ }
467
+ clearHtml() {
468
+ return this.$el.innerHTML = "", this;
469
+ }
470
+ generateButtons() {
471
+ let { buttons: e } = this.opts;
472
+ Array.isArray(e) || (e = [e]), e.forEach((t) => {
473
+ let s = t;
474
+ typeof t == "string" && te[t] && (s = te[t]);
475
+ let a = this.createButton(s);
476
+ s.onClick && this.attachEventToButton(a, s.onClick), this.$el.appendChild(a);
477
+ });
478
+ }
479
+ attachEventToButton(e, t) {
480
+ e.addEventListener("click", () => {
481
+ t(this.dp);
482
+ });
483
+ }
484
+ createButton(e) {
485
+ let { content: t, className: s, tagName: a = "button", attrs: n = {} } = e, i = typeof t == "function" ? t(this.dp) : t;
486
+ return b({ tagName: a, innerHtml: "<span tabindex='-1'>".concat(i, "</span>"), className: M("air-datepicker-button", s), attrs: n });
487
+ }
488
+ render() {
489
+ this.generateButtons();
490
+ }
1921
491
  }
1922
- super._update(s);
1923
- }
1924
- doValidate(t) {
1925
- return this.enum.some((e) => e.indexOf(this.unmaskedValue) === 0) && super.doValidate(t);
1926
- }
1927
- }
1928
- o.MaskedEnum = Y;
1929
- class $ extends f {
1930
- /** */
1931
- /** Enable characters overwriting */
1932
- /** */
1933
- /** */
1934
- updateOptions(t) {
1935
- super.updateOptions(t);
1936
- }
1937
- _update(t) {
1938
- super._update({
1939
- ...t,
1940
- validate: t.mask
1941
- });
1942
- }
1943
- }
1944
- o.MaskedFunction = $;
1945
- class g extends f {
1946
- /** Single char */
1947
- /** Single char */
1948
- /** Array of single chars */
1949
- /** */
1950
- /** */
1951
- /** Digits after point */
1952
- /** Flag to remove leading and trailing zeros in the end of editing */
1953
- /** Flag to pad trailing zeros after point in the end of editing */
1954
- /** Enable characters overwriting */
1955
- /** */
1956
- /** */
1957
- /** Format typed value to string */
1958
- /** Parse string to get typed value */
1959
- constructor(t) {
1960
- super({
1961
- ...g.DEFAULTS,
1962
- ...t
1963
- });
1964
- }
1965
- updateOptions(t) {
1966
- super.updateOptions(t);
1967
- }
1968
- _update(t) {
1969
- super._update(t), this._updateRegExps();
1970
- }
1971
- _updateRegExps() {
1972
- const t = "^" + (this.allowNegative ? "[+|\\-]?" : ""), e = "\\d*", s = (this.scale ? "(" + y(this.radix) + "\\d{0," + this.scale + "})?" : "") + "$";
1973
- this._numberRegExp = new RegExp(t + e + s), this._mapToRadixRegExp = new RegExp("[" + this.mapToRadix.map(y).join("") + "]", "g"), this._thousandsSeparatorRegExp = new RegExp(y(this.thousandsSeparator), "g");
1974
- }
1975
- _removeThousandsSeparators(t) {
1976
- return t.replace(this._thousandsSeparatorRegExp, "");
1977
- }
1978
- _insertThousandsSeparators(t) {
1979
- const e = t.split(this.radix);
1980
- return e[0] = e[0].replace(/\B(?=(\d{3})+(?!\d))/g, this.thousandsSeparator), e.join(this.radix);
1981
- }
1982
- doPrepareChar(t, e) {
1983
- e === void 0 && (e = {});
1984
- const [s, i] = super.doPrepareChar(this._removeThousandsSeparators(this.scale && this.mapToRadix.length && /*
1985
- radix should be mapped when
1986
- 1) input is done from keyboard = flags.input && flags.raw
1987
- 2) unmasked value is set = !flags.input && !flags.raw
1988
- and should not be mapped when
1989
- 1) value is set = flags.input && !flags.raw
1990
- 2) raw value is set = !flags.input && flags.raw
1991
- */
1992
- (e.input && e.raw || !e.input && !e.raw) ? t.replace(this._mapToRadixRegExp, this.radix) : t), e);
1993
- return t && !s && (i.skip = !0), s && !this.allowPositive && !this.value && s !== "-" && i.aggregate(this._appendChar("-")), [s, i];
1994
- }
1995
- _separatorsCount(t, e) {
1996
- e === void 0 && (e = !1);
1997
- let s = 0;
1998
- for (let i = 0; i < t; ++i)
1999
- this._value.indexOf(this.thousandsSeparator, i) === i && (++s, e && (t += this.thousandsSeparator.length));
2000
- return s;
2001
- }
2002
- _separatorsCountFromSlice(t) {
2003
- return t === void 0 && (t = this._value), this._separatorsCount(this._removeThousandsSeparators(t).length, !0);
2004
- }
2005
- extractInput(t, e, s) {
2006
- 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));
2007
- }
2008
- _appendCharRaw(t, e) {
2009
- if (e === void 0 && (e = {}), !this.thousandsSeparator)
2010
- return super._appendCharRaw(t, e);
2011
- const s = e.tail && e._beforeTailState ? e._beforeTailState._value : this._value, i = this._separatorsCountFromSlice(s);
2012
- this._value = this._removeThousandsSeparators(this.value);
2013
- const u = super._appendCharRaw(t, e);
2014
- this._value = this._insertThousandsSeparators(this._value);
2015
- const a = e.tail && e._beforeTailState ? e._beforeTailState._value : this._value, r = this._separatorsCountFromSlice(a);
2016
- return u.tailShift += (r - i) * this.thousandsSeparator.length, u.skip = !u.rawInserted && t === this.thousandsSeparator, u;
2017
- }
2018
- _findSeparatorAround(t) {
2019
- if (this.thousandsSeparator) {
2020
- const e = t - this.thousandsSeparator.length + 1, s = this.value.indexOf(this.thousandsSeparator, e);
2021
- if (s <= t)
2022
- return s;
492
+ function H(r, e, t) {
493
+ return e in r ? Object.defineProperty(r, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : r[e] = t, r;
2023
494
  }
2024
- return -1;
2025
- }
2026
- _adjustRangeWithSeparators(t, e) {
2027
- const s = this._findSeparatorAround(t);
2028
- s >= 0 && (t = s);
2029
- const i = this._findSeparatorAround(e);
2030
- return i >= 0 && (e = i + this.thousandsSeparator.length), [t, e];
2031
- }
2032
- remove(t, e) {
2033
- t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), [t, e] = this._adjustRangeWithSeparators(t, e);
2034
- const s = this.value.slice(0, t), i = this.value.slice(e), u = this._separatorsCount(s.length);
2035
- this._value = this._insertThousandsSeparators(this._removeThousandsSeparators(s + i));
2036
- const a = this._separatorsCountFromSlice(s);
2037
- return new c({
2038
- tailShift: (a - u) * this.thousandsSeparator.length
2039
- });
2040
- }
2041
- nearestInputPos(t, e) {
2042
- if (!this.thousandsSeparator)
2043
- return t;
2044
- switch (e) {
2045
- case h.NONE:
2046
- case h.LEFT:
2047
- case h.FORCE_LEFT: {
2048
- const s = this._findSeparatorAround(t - 1);
2049
- if (s >= 0) {
2050
- const i = s + this.thousandsSeparator.length;
2051
- if (t < i || this.value.length <= i || e === h.FORCE_LEFT)
2052
- return s;
495
+ class ue {
496
+ constructor() {
497
+ let { opts: e, dp: t } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
498
+ H(this, "toggleTimepickerIsActive", (a) => {
499
+ this.dp.timepickerIsActive = a;
500
+ }), H(this, "onChangeSelectedDate", (a) => {
501
+ let { date: n, updateTime: i = !1 } = a;
502
+ n && (this.setMinMaxTime(n), this.setCurrentTime(!!i && n), this.addTimeToDate(n));
503
+ }), H(this, "onChangeLastSelectedDate", (a) => {
504
+ a && (this.setTime(a), this.render());
505
+ }), H(this, "onChangeInputRange", (a) => {
506
+ let n = a.target;
507
+ this[n.getAttribute("name")] = n.value, this.updateText(), this.dp.trigger(l.eventChangeTime, { hours: this.hours, minutes: this.minutes });
508
+ }), H(this, "onMouseEnterLeave", (a) => {
509
+ let n = a.target.getAttribute("name"), i = this.$minutesText;
510
+ n === "hours" && (i = this.$hoursText), i.classList.toggle("-focus-");
511
+ }), H(this, "onFocus", () => {
512
+ this.toggleTimepickerIsActive(!0);
513
+ }), H(this, "onBlur", () => {
514
+ this.toggleTimepickerIsActive(!1);
515
+ }), this.opts = e, this.dp = t;
516
+ let { timeFormat: s } = this.dp.locale;
517
+ s && (s.match(G("h")) || s.match(G("hh"))) && (this.ampm = !0), this.init();
518
+ }
519
+ init() {
520
+ this.setTime(this.dp.lastSelectedDate || this.dp.viewDate), this.createElement(), this.buildHtml(), this.defineDOM(), this.render(), this.bindDatepickerEvents(), this.bindDOMEvents();
521
+ }
522
+ bindDatepickerEvents() {
523
+ this.dp.on(l.eventChangeSelectedDate, this.onChangeSelectedDate), this.dp.on(l.eventChangeLastSelectedDate, this.onChangeLastSelectedDate);
524
+ }
525
+ bindDOMEvents() {
526
+ let e = "input";
527
+ navigator.userAgent.match(/trident/gi) && (e = "change"), w(this.$ranges, e, this.onChangeInputRange), w(this.$ranges, "mouseenter", this.onMouseEnterLeave), w(this.$ranges, "mouseleave", this.onMouseEnterLeave), w(this.$ranges, "focus", this.onFocus), w(this.$ranges, "mousedown", this.onFocus), w(this.$ranges, "blur", this.onBlur);
528
+ }
529
+ createElement() {
530
+ this.$el = b({ className: M("air-datepicker-time", { "-am-pm-": this.dp.ampm }) });
531
+ }
532
+ destroy() {
533
+ this.dp.off(l.eventChangeSelectedDate, this.onChangeSelectedDate), this.dp.off(l.eventChangeLastSelectedDate, this.onChangeLastSelectedDate), this.$el.parentNode.removeChild(this.$el);
534
+ }
535
+ buildHtml() {
536
+ let { ampm: e, hours: t, displayHours: s, minutes: a, minHours: n, minMinutes: i, maxHours: h, maxMinutes: o, dayPeriod: d, opts: { hoursStep: c, minutesStep: u } } = this;
537
+ this.$el.innerHTML = '<div class="air-datepicker-time--current">' + ' <span class="air-datepicker-time--current-hours">'.concat(O(s), "</span>") + ' <span class="air-datepicker-time--current-colon">:</span>' + ' <span class="air-datepicker-time--current-minutes">'.concat(O(a), "</span>") + " ".concat(e ? "<span class='air-datepicker-time--current-ampm'>".concat(d, "</span>") : "") + '</div><div class="air-datepicker-time--sliders"> <div class="air-datepicker-time--row">' + ' <input type="range" name="hours" value="'.concat(t, '" min="').concat(n, '" max="').concat(h, '" step="').concat(c, '"/>') + ' </div> <div class="air-datepicker-time--row">' + ' <input type="range" name="minutes" value="'.concat(a, '" min="').concat(i, '" max="').concat(o, '" step="').concat(u, '"/>') + " </div></div>";
538
+ }
539
+ defineDOM() {
540
+ let e = (t) => y(t, this.$el);
541
+ this.$ranges = this.$el.querySelectorAll('[type="range"]'), this.$hours = e('[name="hours"]'), this.$minutes = e('[name="minutes"]'), this.$hoursText = e(".air-datepicker-time--current-hours"), this.$minutesText = e(".air-datepicker-time--current-minutes"), this.$ampm = e(".air-datepicker-time--current-ampm");
542
+ }
543
+ setTime(e) {
544
+ this.setMinMaxTime(e), this.setCurrentTime(e);
545
+ }
546
+ addTimeToDate(e) {
547
+ e && (e.setHours(this.hours), e.setMinutes(this.minutes));
548
+ }
549
+ setMinMaxTime(e) {
550
+ if (this.setMinMaxTimeFromOptions(), e) {
551
+ let { minDate: t, maxDate: s } = this.dp;
552
+ t && v(e, t) && this.setMinTimeFromMinDate(t), s && v(e, s) && this.setMaxTimeFromMaxDate(s);
553
+ }
554
+ }
555
+ setCurrentTime(e) {
556
+ let { hours: t, minutes: s } = e ? D(e) : this;
557
+ this.hours = A(t, this.minHours, this.maxHours), this.minutes = A(s, this.minMinutes, this.maxMinutes);
558
+ }
559
+ setMinMaxTimeFromOptions() {
560
+ let { minHours: e, minMinutes: t, maxHours: s, maxMinutes: a } = this.opts;
561
+ this.minHours = A(e, 0, 23), this.minMinutes = A(t, 0, 59), this.maxHours = A(s, 0, 23), this.maxMinutes = A(a, 0, 59);
562
+ }
563
+ setMinTimeFromMinDate(e) {
564
+ let { lastSelectedDate: t } = this.dp;
565
+ this.minHours = e.getHours(), t && t.getHours() > e.getHours() ? this.minMinutes = this.opts.minMinutes : this.minMinutes = e.getMinutes();
566
+ }
567
+ setMaxTimeFromMaxDate(e) {
568
+ let { lastSelectedDate: t } = this.dp;
569
+ this.maxHours = e.getHours(), t && t.getHours() < e.getHours() ? this.maxMinutes = this.opts.maxMinutes : this.maxMinutes = e.getMinutes();
570
+ }
571
+ getDayPeriod(e, t) {
572
+ let s = e, a = Number(e);
573
+ e instanceof Date && (s = D(e), a = Number(s.hours));
574
+ let n = "am";
575
+ if (t || this.ampm) {
576
+ switch (!0) {
577
+ case a === 12:
578
+ case a > 11:
579
+ n = "pm";
580
+ }
581
+ a = a % 12 == 0 ? 12 : a % 12;
2053
582
  }
2054
- break;
583
+ return { hours: a, dayPeriod: n };
584
+ }
585
+ updateSliders() {
586
+ q(this.$hours, { min: this.minHours, max: this.maxHours }).value = this.hours, q(this.$minutes, { min: this.minMinutes, max: this.maxMinutes }).value = this.minutes;
587
+ }
588
+ updateText() {
589
+ this.$hoursText.innerHTML = O(this.displayHours), this.$minutesText.innerHTML = O(this.minutes), this.ampm && (this.$ampm.innerHTML = this.dayPeriod);
590
+ }
591
+ set hours(e) {
592
+ this._hours = e;
593
+ let { hours: t, dayPeriod: s } = this.getDayPeriod(e);
594
+ this.displayHours = t, this.dayPeriod = s;
2055
595
  }
2056
- case h.RIGHT:
2057
- case h.FORCE_RIGHT: {
2058
- const s = this._findSeparatorAround(t);
2059
- if (s >= 0)
2060
- return s + this.thousandsSeparator.length;
596
+ get hours() {
597
+ return this._hours;
598
+ }
599
+ render() {
600
+ this.updateSliders(), this.updateText();
2061
601
  }
2062
602
  }
2063
- return t;
2064
- }
2065
- doValidate(t) {
2066
- let e = !!this._removeThousandsSeparators(this.value).match(this._numberRegExp);
2067
- if (e) {
2068
- const s = this.number;
2069
- e = e && !isNaN(s) && // check min bound for negative values
2070
- (this.min == null || this.min >= 0 || this.min <= this.number) && // check max bound for positive values
2071
- (this.max == null || this.max <= 0 || this.number <= this.max);
603
+ function L(r, e, t) {
604
+ return e in r ? Object.defineProperty(r, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : r[e] = t, r;
2072
605
  }
2073
- return e && super.doValidate(t);
2074
- }
2075
- doCommit() {
2076
- if (this.value) {
2077
- const t = this.number;
2078
- let e = t;
2079
- 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));
2080
- let s = this.value;
2081
- this.normalizeZeros && (s = this._normalizeZeros(s)), this.padFractionalZeros && this.scale > 0 && (s = this._padFractionalZeros(s)), this._value = s;
606
+ class pe {
607
+ constructor(e) {
608
+ let { dp: t, opts: s } = e;
609
+ L(this, "pressedKeys", /* @__PURE__ */ new Set()), L(this, "hotKeys", /* @__PURE__ */ new Map([[[["Control", "ArrowRight"], ["Control", "ArrowUp"]], (a) => a.month++], [[["Control", "ArrowLeft"], ["Control", "ArrowDown"]], (a) => a.month--], [[["Shift", "ArrowRight"], ["Shift", "ArrowUp"]], (a) => a.year++], [[["Shift", "ArrowLeft"], ["Shift", "ArrowDown"]], (a) => a.year--], [[["Alt", "ArrowRight"], ["Alt", "ArrowUp"]], (a) => a.year += 10], [[["Alt", "ArrowLeft"], ["Alt", "ArrowDown"]], (a) => a.year -= 10], [["Control", "Shift", "ArrowUp"], (a, n) => n.up()]])), L(this, "handleHotKey", (a) => {
610
+ let n = this.hotKeys.get(a), i = D(this.getInitialFocusDate());
611
+ n(i, this.dp);
612
+ let { year: h, month: o, date: d } = i, c = Z(new Date(h, o));
613
+ c < d && (d = c);
614
+ let u = this.dp.getClampedDate(new Date(h, o, d));
615
+ this.dp.setFocusDate(u, { viewDateTransition: !0 });
616
+ }), L(this, "isHotKeyPressed", () => {
617
+ let a = !1, n = this.pressedKeys.size, i = (h) => this.pressedKeys.has(h);
618
+ for (let [h] of this.hotKeys) {
619
+ if (a)
620
+ break;
621
+ if (Array.isArray(h[0]))
622
+ h.forEach((o) => {
623
+ a || n !== o.length || (a = o.every(i) && h);
624
+ });
625
+ else {
626
+ if (n !== h.length)
627
+ continue;
628
+ a = h.every(i) && h;
629
+ }
630
+ }
631
+ return a;
632
+ }), L(this, "isArrow", (a) => a >= 37 && a <= 40), L(this, "onKeyDown", (a) => {
633
+ let { key: n, which: i } = a, { dp: h, dp: { focusDate: o }, opts: d } = this;
634
+ this.registerKey(n);
635
+ let c = this.isHotKeyPressed();
636
+ if (c)
637
+ return a.preventDefault(), void this.handleHotKey(c);
638
+ if (this.isArrow(i))
639
+ return a.preventDefault(), void this.focusNextCell(n);
640
+ if (n === "Enter") {
641
+ if (h.currentView !== d.minView)
642
+ return void h.down();
643
+ if (o) {
644
+ let u = h._checkIfDateIsSelected(o);
645
+ return void (u ? h._handleAlreadySelectedDates(u, o) : h.selectDate(o));
646
+ }
647
+ }
648
+ n === "Escape" && this.dp.hide();
649
+ }), L(this, "onKeyUp", (a) => {
650
+ this.removeKey(a.key);
651
+ }), this.dp = t, this.opts = s, this.init();
652
+ }
653
+ init() {
654
+ this.bindKeyboardEvents();
655
+ }
656
+ bindKeyboardEvents() {
657
+ let { $el: e } = this.dp;
658
+ e.addEventListener("keydown", this.onKeyDown), e.addEventListener("keyup", this.onKeyUp);
659
+ }
660
+ destroy() {
661
+ let { $el: e } = this.dp;
662
+ e.removeEventListener("keydown", this.onKeyDown), e.removeEventListener("keyup", this.onKeyUp), this.hotKeys = null, this.pressedKeys = null;
663
+ }
664
+ getInitialFocusDate() {
665
+ let { focusDate: e, currentView: t, selectedDates: s, parsedViewDate: { year: a, month: n } } = this.dp, i = e || s[s.length - 1];
666
+ if (!i)
667
+ switch (t) {
668
+ case l.days:
669
+ i = new Date(a, n, (/* @__PURE__ */ new Date()).getDate());
670
+ break;
671
+ case l.months:
672
+ i = new Date(a, n, 1);
673
+ break;
674
+ case l.years:
675
+ i = new Date(a, 0, 1);
676
+ }
677
+ return i;
678
+ }
679
+ focusNextCell(e) {
680
+ let t = this.getInitialFocusDate(), { currentView: s } = this.dp, { days: a, months: n, years: i } = l, h = D(t), o = h.year, d = h.month, c = h.date;
681
+ switch (e) {
682
+ case "ArrowLeft":
683
+ s === a && (c -= 1), s === n && (d -= 1), s === i && (o -= 1);
684
+ break;
685
+ case "ArrowUp":
686
+ s === a && (c -= 7), s === n && (d -= 3), s === i && (o -= 4);
687
+ break;
688
+ case "ArrowRight":
689
+ s === a && (c += 1), s === n && (d += 1), s === i && (o += 1);
690
+ break;
691
+ case "ArrowDown":
692
+ s === a && (c += 7), s === n && (d += 3), s === i && (o += 4);
693
+ }
694
+ let u = this.dp.getClampedDate(new Date(o, d, c));
695
+ this.dp.setFocusDate(u, { viewDateTransition: !0 });
696
+ }
697
+ registerKey(e) {
698
+ this.pressedKeys.add(e);
699
+ }
700
+ removeKey(e) {
701
+ this.pressedKeys.delete(e);
702
+ }
703
+ }
704
+ let me = { on(r, e) {
705
+ this.__events || (this.__events = {}), this.__events[r] ? this.__events[r].push(e) : this.__events[r] = [e];
706
+ }, off(r, e) {
707
+ this.__events && this.__events[r] && (this.__events[r] = this.__events[r].filter((t) => t !== e));
708
+ }, removeAllEvents() {
709
+ this.__events = {};
710
+ }, trigger(r) {
711
+ for (var e = arguments.length, t = new Array(e > 1 ? e - 1 : 0), s = 1; s < e; s++)
712
+ t[s - 1] = arguments[s];
713
+ this.__events && this.__events[r] && this.__events[r].forEach((a) => {
714
+ a(...t);
715
+ });
716
+ } };
717
+ function m(r, e, t) {
718
+ return e in r ? Object.defineProperty(r, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : r[e] = t, r;
719
+ }
720
+ let X = "", W = "", S = "", se = !1;
721
+ class T {
722
+ constructor(e, t) {
723
+ var s = this;
724
+ if (m(this, "viewIndexes", [l.days, l.months, l.years]), m(this, "next", () => {
725
+ let { year: i, month: h } = this.parsedViewDate;
726
+ switch (this.currentView) {
727
+ case l.days:
728
+ this.setViewDate(new Date(i, h + 1, 1));
729
+ break;
730
+ case l.months:
731
+ this.setViewDate(new Date(i + 1, h, 1));
732
+ break;
733
+ case l.years:
734
+ this.setViewDate(new Date(i + 10, 0, 1));
735
+ }
736
+ }), m(this, "prev", () => {
737
+ let { year: i, month: h } = this.parsedViewDate;
738
+ switch (this.currentView) {
739
+ case l.days:
740
+ this.setViewDate(new Date(i, h - 1, 1));
741
+ break;
742
+ case l.months:
743
+ this.setViewDate(new Date(i - 1, h, 1));
744
+ break;
745
+ case l.years:
746
+ this.setViewDate(new Date(i - 10, 0, 1));
747
+ }
748
+ }), m(this, "_finishHide", () => {
749
+ this.hideAnimation = !1, this._destroyComponents(), this.$container.removeChild(this.$datepicker);
750
+ }), m(this, "setPosition", function(i) {
751
+ let h = arguments.length > 1 && arguments[1] !== void 0 && arguments[1];
752
+ if (typeof (i = i || s.opts.position) == "function")
753
+ return void (s.customHide = i({ $datepicker: s.$datepicker, $target: s.$el, $pointer: s.$pointer, isViewChange: h, done: s._finishHide }));
754
+ let o, d, { isMobile: c } = s.opts, u = s.$el.getBoundingClientRect(), p = s.$el.getBoundingClientRect(), g = s.$datepicker.offsetParent, f = s.$el.offsetParent, _ = s.$datepicker.getBoundingClientRect(), N = i.split(" "), B = window.scrollY, K = window.scrollX, I = s.opts.offset, z = N[0], ge = N[1];
755
+ if (c)
756
+ s.$datepicker.style.cssText = "left: 50%; top: 50%";
757
+ else {
758
+ if (g === f && g !== document.body && (p = { top: s.$el.offsetTop, left: s.$el.offsetLeft, width: u.width, height: s.$el.offsetHeight }, B = 0, K = 0), g !== f && g !== document.body) {
759
+ let ae = g.getBoundingClientRect();
760
+ p = { top: u.top - ae.top, left: u.left - ae.left, width: u.width, height: u.height }, B = 0, K = 0;
761
+ }
762
+ switch (z) {
763
+ case "top":
764
+ o = p.top - _.height - I;
765
+ break;
766
+ case "right":
767
+ d = p.left + p.width + I;
768
+ break;
769
+ case "bottom":
770
+ o = p.top + p.height + I;
771
+ break;
772
+ case "left":
773
+ d = p.left - _.width - I;
774
+ }
775
+ switch (ge) {
776
+ case "top":
777
+ o = p.top;
778
+ break;
779
+ case "right":
780
+ d = p.left + p.width - _.width;
781
+ break;
782
+ case "bottom":
783
+ o = p.top + p.height - _.height;
784
+ break;
785
+ case "left":
786
+ d = p.left;
787
+ break;
788
+ case "center":
789
+ /left|right/.test(z) ? o = p.top + p.height / 2 - _.height / 2 : d = p.left + p.width / 2 - _.width / 2;
790
+ }
791
+ s.$datepicker.style.cssText = "left: ".concat(d + K, "px; top: ").concat(o + B, "px");
792
+ }
793
+ }), m(this, "_setInputValue", () => {
794
+ let { opts: i, $altField: h, locale: { dateFormat: o } } = this, { altFieldDateFormat: d, altField: c } = i;
795
+ c && h && (h.value = this._getInputValue(d)), this.$el.value = this._getInputValue(o);
796
+ }), m(this, "_getInputValue", (i) => {
797
+ let { selectedDates: h, opts: o } = this, { multipleDates: d, multipleDatesSeparator: c } = o;
798
+ if (!h.length)
799
+ return "";
800
+ let u = typeof i == "function", p = u ? i(d ? h : h[0]) : h.map((g) => this.formatDate(g, i));
801
+ return p = u ? p : p.join(c), p;
802
+ }), m(this, "_checkIfDateIsSelected", function(i) {
803
+ let h = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : l.days, o = !1;
804
+ return s.selectedDates.some((d) => {
805
+ let c = v(i, d, h);
806
+ return o = c && d, c;
807
+ }), o;
808
+ }), m(this, "_scheduleCallAfterTransition", (i) => {
809
+ this._cancelScheduledCall(), i && i(!1), this._onTransitionEnd = () => {
810
+ i && i(!0);
811
+ }, this.$datepicker.addEventListener("transitionend", this._onTransitionEnd, { once: !0 });
812
+ }), m(this, "_cancelScheduledCall", () => {
813
+ this.$datepicker.removeEventListener("transitionend", this._onTransitionEnd);
814
+ }), m(this, "setViewDate", (i) => {
815
+ if (!((i = C(i)) instanceof Date) || v(i, this.viewDate))
816
+ return;
817
+ let h = this.viewDate;
818
+ this.viewDate = i;
819
+ let { onChangeViewDate: o } = this.opts;
820
+ if (o) {
821
+ let { month: d, year: c } = this.parsedViewDate;
822
+ o({ month: d, year: c, decade: this.curDecade });
823
+ }
824
+ this.trigger(l.eventChangeViewDate, i, h);
825
+ }), m(this, "setFocusDate", function(i) {
826
+ let h = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
827
+ (!i || (i = C(i)) instanceof Date) && (s.focusDate = i, s.opts.range && i && s._handleRangeOnFocus(), s.trigger(l.eventChangeFocusDate, i, h));
828
+ }), m(this, "setCurrentView", (i) => {
829
+ if (this.viewIndexes.includes(i)) {
830
+ if (this.currentView = i, this.elIsInput && this.visible && this.setPosition(void 0, !0), this.trigger(l.eventChangeCurrentView, i), !this.views[i]) {
831
+ let h = this.views[i] = new ee({ dp: this, opts: this.opts, type: i });
832
+ this.shouldUpdateDOM && this.$content.appendChild(h.$el);
833
+ }
834
+ this.opts.onChangeView && this.opts.onChangeView(i);
835
+ }
836
+ }), m(this, "_updateLastSelectedDate", (i) => {
837
+ this.lastSelectedDate = i, this.trigger(l.eventChangeLastSelectedDate, i);
838
+ }), m(this, "destroy", () => {
839
+ let { showEvent: i, isMobile: h } = this.opts, o = this.$datepicker.parentNode;
840
+ o && o.removeChild(this.$datepicker), this.$el.removeEventListener(i, this._onFocus), this.$el.removeEventListener("blur", this._onBlur), window.removeEventListener("resize", this._onResize), h && this._removeMobileAttributes(), this.keyboardNav && this.keyboardNav.destroy(), this.views = null, this.nav = null, this.$datepicker = null, this.opts = null, this.$customContainer = null, this.viewDate = null, this.focusDate = null, this.selectedDates = null, this.rangeDateFrom = null, this.rangeDateTo = null;
841
+ }), m(this, "update", (i) => {
842
+ let h = Y({}, this.opts);
843
+ Y(this.opts, i);
844
+ let { timepicker: o, buttons: d, range: c, selectedDates: u, isMobile: p } = this.opts, g = this.visible || this.treatAsInline;
845
+ this._createMinMaxDates(), this._limitViewDateByMaxMinDates(), this._handleLocale(), !h.selectedDates && u && this.selectDate(u), i.view && this.setCurrentView(i.view), this._setInputValue(), h.range && !c ? (this.rangeDateTo = !1, this.rangeDateFrom = !1) : !h.range && c && this.selectedDates.length && (this.rangeDateFrom = this.selectedDates[0], this.rangeDateTo = this.selectedDates[1]), h.timepicker && !o ? (g && this.timepicker.destroy(), this.timepicker = !1, this.$timepicker.parentNode.removeChild(this.$timepicker)) : !h.timepicker && o && this._addTimepicker(), !h.buttons && d ? this._addButtons() : h.buttons && !d ? (this.buttons.destroy(), this.$buttons.parentNode.removeChild(this.$buttons)) : g && h.buttons && d && this.buttons.clearHtml().render(), !h.isMobile && p ? (this.treatAsInline || S || this._createMobileOverlay(), this._addMobileAttributes(), this.visible && this._showMobileOverlay()) : h.isMobile && !p && (this._removeMobileAttributes(), this.visible && (S.classList.remove("-active-"), typeof this.opts.position != "function" && this.setPosition())), g && (this.nav.update(), this.views[this.currentView].render(), this.currentView === l.days && this.views[this.currentView].renderDayNames());
846
+ }), m(this, "isOtherMonth", (i) => {
847
+ let { month: h } = D(i);
848
+ return h !== this.parsedViewDate.month;
849
+ }), m(this, "isOtherYear", (i) => {
850
+ let { year: h } = D(i);
851
+ return h !== this.parsedViewDate.year;
852
+ }), m(this, "isOtherDecade", (i) => {
853
+ let { year: h } = D(i), [o, d] = F(this.viewDate);
854
+ return h < o || h > d;
855
+ }), m(this, "_onChangeSelectedDate", (i) => {
856
+ let { silent: h } = i;
857
+ setTimeout(() => {
858
+ this._setInputValue(), this.opts.onSelect && !h && this._triggerOnSelect();
859
+ });
860
+ }), m(this, "_onChangeFocusedDate", function(i) {
861
+ let { viewDateTransition: h } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
862
+ if (!i)
863
+ return;
864
+ let o = !1;
865
+ h && (o = s.isOtherMonth(i) || s.isOtherYear(i) || s.isOtherDecade(i)), o && s.setViewDate(i);
866
+ }), m(this, "_onChangeTime", (i) => {
867
+ let { hours: h, minutes: o } = i, d = /* @__PURE__ */ new Date(), { lastSelectedDate: c, opts: { onSelect: u } } = this, p = c;
868
+ c || (p = d);
869
+ let g = this.getCell(p, this.currentViewSingular), f = g && g.adpCell;
870
+ f && f.isDisabled || (p.setHours(h), p.setMinutes(o), c ? (this._setInputValue(), u && this._triggerOnSelect()) : this.selectDate(p));
871
+ }), m(this, "_onFocus", (i) => {
872
+ this.visible || this.show();
873
+ }), m(this, "_onBlur", (i) => {
874
+ this.inFocus || !this.visible || this.opts.isMobile || this.hide();
875
+ }), m(this, "_onMouseDown", (i) => {
876
+ this.inFocus = !0;
877
+ }), m(this, "_onMouseUp", (i) => {
878
+ this.inFocus = !1, this.$el.focus();
879
+ }), m(this, "_onResize", () => {
880
+ this.visible && typeof this.opts.position != "function" && this.setPosition();
881
+ }), m(this, "_onClickOverlay", () => {
882
+ this.visible && this.hide();
883
+ }), m(this, "isWeekend", (i) => this.opts.weekends.includes(i)), m(this, "getClampedDate", (i) => {
884
+ let { minDate: h, maxDate: o } = this, d = i;
885
+ return o && $(i, o) ? d = o : h && E(i, h) && (d = h), d;
886
+ }), this.$el = y(e), !this.$el)
887
+ return;
888
+ this.$datepicker = b({ className: "air-datepicker" }), this.opts = Y({}, Q, t), this.$customContainer = !!this.opts.container && y(this.opts.container), this.$altField = y(this.opts.altField || !1), X || (X = y("body"));
889
+ let { view: a, startDate: n } = this.opts;
890
+ n || (this.opts.startDate = /* @__PURE__ */ new Date()), this.$el.nodeName === "INPUT" && (this.elIsInput = !0), this.inited = !1, this.visible = !1, this.viewDate = C(this.opts.startDate), this.focusDate = !1, this.initialReadonly = this.$el.getAttribute("readonly"), this.customHide = !1, this.currentView = a, this.selectedDates = [], this.views = {}, this.keys = [], this.rangeDateFrom = "", this.rangeDateTo = "", this.timepickerIsActive = !1, this.treatAsInline = this.opts.inline || !this.elIsInput, this.init();
891
+ }
892
+ init() {
893
+ let { opts: e, treatAsInline: t, opts: { inline: s, isMobile: a, selectedDates: n, keyboardNav: i, onlyTimepicker: h } } = this;
894
+ var o;
895
+ se || s || !this.elIsInput || (se = !0, W = b({ className: o = T.defaultContainerId, id: o }), X.appendChild(W)), !a || S || t || this._createMobileOverlay(), this._handleLocale(), this._bindSubEvents(), this._createMinMaxDates(), this._limitViewDateByMaxMinDates(), this.elIsInput && (s || this._bindEvents(), i && !h && (this.keyboardNav = new pe({ dp: this, opts: e }))), n && this.selectDate(n, { silent: !0 }), this.opts.visible && !t && this.show(), a && !t && this.$el.setAttribute("readonly", !0), t && this._createComponents();
896
+ }
897
+ _createMobileOverlay() {
898
+ S = b({ className: "air-datepicker-overlay" }), W.appendChild(S);
899
+ }
900
+ _createComponents() {
901
+ let { opts: e, treatAsInline: t, opts: { inline: s, buttons: a, timepicker: n, position: i, classes: h, onlyTimepicker: o, isMobile: d } } = this;
902
+ this._buildBaseHtml(), this.elIsInput && (s || this._setPositionClasses(i)), !s && this.elIsInput || this.$datepicker.classList.add("-inline-"), h && this.$datepicker.classList.add(...h.split(" ")), o && this.$datepicker.classList.add("-only-timepicker-"), d && !t && this._addMobileAttributes(), this.views[this.currentView] = new ee({ dp: this, type: this.currentView, opts: e }), this.nav = new de({ dp: this, opts: e }), n && this._addTimepicker(), a && this._addButtons(), this.$content.appendChild(this.views[this.currentView].$el), this.$nav.appendChild(this.nav.$el);
903
+ }
904
+ _destroyComponents() {
905
+ for (let e in this.views)
906
+ this.views[e].destroy();
907
+ this.views = {}, this.nav.destroy(), this.timepicker && this.timepicker.destroy();
908
+ }
909
+ _addMobileAttributes() {
910
+ S.addEventListener("click", this._onClickOverlay), this.$datepicker.classList.add("-is-mobile-"), this.$el.setAttribute("readonly", !0);
911
+ }
912
+ _removeMobileAttributes() {
913
+ S.removeEventListener("click", this._onClickOverlay), this.$datepicker.classList.remove("-is-mobile-"), this.initialReadonly || this.initialReadonly === "" || this.$el.removeAttribute("readonly");
914
+ }
915
+ _createMinMaxDates() {
916
+ let { minDate: e, maxDate: t } = this.opts;
917
+ this.minDate = !!e && C(e), this.maxDate = !!t && C(t);
918
+ }
919
+ _addTimepicker() {
920
+ this.$timepicker = b({ className: "air-datepicker--time" }), this.$datepicker.appendChild(this.$timepicker), this.timepicker = new ue({ dp: this, opts: this.opts }), this.$timepicker.appendChild(this.timepicker.$el);
921
+ }
922
+ _addButtons() {
923
+ this.$buttons = b({ className: "air-datepicker--buttons" }), this.$datepicker.appendChild(this.$buttons), this.buttons = new ce({ dp: this, opts: this.opts }), this.$buttons.appendChild(this.buttons.$el);
924
+ }
925
+ _bindSubEvents() {
926
+ this.on(l.eventChangeSelectedDate, this._onChangeSelectedDate), this.on(l.eventChangeFocusDate, this._onChangeFocusedDate), this.on(l.eventChangeTime, this._onChangeTime);
927
+ }
928
+ _buildBaseHtml() {
929
+ let { inline: e } = this.opts;
930
+ var t, s;
931
+ this.elIsInput ? e ? (t = this.$datepicker, (s = this.$el).parentNode.insertBefore(t, s.nextSibling)) : this.$container.appendChild(this.$datepicker) : this.$el.appendChild(this.$datepicker), this.$datepicker.innerHTML = '<i class="air-datepicker--pointer"></i><div class="air-datepicker--navigation"></div><div class="air-datepicker--content"></div>', this.$content = y(".air-datepicker--content", this.$datepicker), this.$pointer = y(".air-datepicker--pointer", this.$datepicker), this.$nav = y(".air-datepicker--navigation", this.$datepicker);
932
+ }
933
+ _handleLocale() {
934
+ let { locale: e, dateFormat: t, firstDay: s, timepicker: a, onlyTimepicker: n, timeFormat: i, dateTimeSeparator: h } = this.opts;
935
+ var o;
936
+ this.locale = (o = e, JSON.parse(JSON.stringify(o))), t && (this.locale.dateFormat = t), i !== void 0 && i !== "" && (this.locale.timeFormat = i);
937
+ let { timeFormat: d } = this.locale;
938
+ if (s !== "" && (this.locale.firstDay = s), a && typeof t != "function") {
939
+ let c = d ? h : "";
940
+ this.locale.dateFormat = [this.locale.dateFormat, d || ""].join(c);
941
+ }
942
+ n && typeof t != "function" && (this.locale.dateFormat = this.locale.timeFormat);
943
+ }
944
+ _setPositionClasses(e) {
945
+ if (typeof e == "function")
946
+ return void this.$datepicker.classList.add("-custom-position-");
947
+ let t = (e = e.split(" "))[0], s = e[1], a = "air-datepicker -".concat(t, "-").concat(s, "- -from-").concat(t, "-");
948
+ this.$datepicker.classList.add(...a.split(" "));
949
+ }
950
+ _bindEvents() {
951
+ this.$el.addEventListener(this.opts.showEvent, this._onFocus), this.$el.addEventListener("blur", this._onBlur), this.$datepicker.addEventListener("mousedown", this._onMouseDown), this.$datepicker.addEventListener("mouseup", this._onMouseUp), window.addEventListener("resize", this._onResize);
952
+ }
953
+ _limitViewDateByMaxMinDates() {
954
+ let { viewDate: e, minDate: t, maxDate: s } = this;
955
+ s && $(e, s) && this.setViewDate(s), t && E(e, t) && this.setViewDate(t);
956
+ }
957
+ formatDate() {
958
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.viewDate, t = arguments.length > 1 ? arguments[1] : void 0;
959
+ if (e = C(e), !(e instanceof Date))
960
+ return;
961
+ let s = t, a = this.locale, n = D(e), i = F(e), h = T.replacer, o = "am";
962
+ this.opts.timepicker && this.timepicker && (o = this.timepicker.getDayPeriod(e).dayPeriod);
963
+ let d = { T: e.getTime(), m: n.minutes, mm: n.fullMinutes, h: n.hours12, hh: n.fullHours12, H: n.hours, HH: n.fullHours, aa: o, AA: o.toUpperCase(), E: a.daysShort[n.day], EEEE: a.days[n.day], d: n.date, dd: n.fullDate, M: n.month + 1, MM: n.fullMonth, MMM: a.monthsShort[n.month], MMMM: a.months[n.month], yy: n.year.toString().slice(-2), yyyy: n.year, yyyy1: i[0], yyyy2: i[1] };
964
+ for (let [c, u] of Object.entries(d))
965
+ s = h(s, G(c), u);
966
+ return s;
967
+ }
968
+ down(e) {
969
+ this._handleUpDownActions(e, "down");
970
+ }
971
+ up(e) {
972
+ this._handleUpDownActions(e, "up");
973
+ }
974
+ selectDate(e) {
975
+ let t, s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, { currentView: a, parsedViewDate: n, selectedDates: i } = this, { updateTime: h } = s, { moveToOtherMonthsOnSelect: o, moveToOtherYearsOnSelect: d, multipleDates: c, range: u, autoClose: p } = this.opts, g = i.length;
976
+ if (Array.isArray(e))
977
+ return e.forEach((f) => {
978
+ this.selectDate(f, s);
979
+ }), new Promise((f) => {
980
+ setTimeout(f);
981
+ });
982
+ if ((e = C(e)) instanceof Date) {
983
+ if (a === l.days && e.getMonth() !== n.month && o && (t = new Date(e.getFullYear(), e.getMonth(), 1)), a === l.years && e.getFullYear() !== n.year && d && (t = new Date(e.getFullYear(), 0, 1)), t && this.setViewDate(t), c && !u) {
984
+ if (g === c)
985
+ return;
986
+ this._checkIfDateIsSelected(e) || i.push(e);
987
+ } else if (u)
988
+ switch (g) {
989
+ case 1:
990
+ i.push(e), this.rangeDateTo || (this.rangeDateTo = e), $(this.rangeDateFrom, this.rangeDateTo) && (this.rangeDateTo = this.rangeDateFrom, this.rangeDateFrom = e), this.selectedDates = [this.rangeDateFrom, this.rangeDateTo];
991
+ break;
992
+ case 2:
993
+ this.selectedDates = [e], this.rangeDateFrom = e, this.rangeDateTo = "";
994
+ break;
995
+ default:
996
+ this.selectedDates = [e], this.rangeDateFrom = e;
997
+ }
998
+ else
999
+ this.selectedDates = [e];
1000
+ return this.trigger(l.eventChangeSelectedDate, { action: l.actionSelectDate, silent: s == null ? void 0 : s.silent, date: e, updateTime: h }), this._updateLastSelectedDate(e), p && !this.timepickerIsActive && this.visible && (c || u ? u && g === 1 && this.hide() : this.hide()), new Promise((f) => {
1001
+ setTimeout(f);
1002
+ });
1003
+ }
1004
+ }
1005
+ unselectDate(e) {
1006
+ let t = this.selectedDates, s = this;
1007
+ if ((e = C(e)) instanceof Date)
1008
+ return t.some((a, n) => {
1009
+ if (v(a, e))
1010
+ return t.splice(n, 1), s.selectedDates.length ? s._updateLastSelectedDate(s.selectedDates[s.selectedDates.length - 1]) : (s.rangeDateFrom = "", s.rangeDateTo = "", s._updateLastSelectedDate(!1)), this.trigger(l.eventChangeSelectedDate, { action: l.actionUnselectDate, date: e }), !0;
1011
+ });
1012
+ }
1013
+ replaceDate(e, t) {
1014
+ let s = this.selectedDates.find((n) => v(n, e, this.currentView)), a = this.selectedDates.indexOf(s);
1015
+ a < 0 || v(this.selectedDates[a], t, this.currentView) || (this.selectedDates[a] = t, this.trigger(l.eventChangeSelectedDate, { action: l.actionSelectDate, date: t, updateTime: !0 }), this._updateLastSelectedDate(t));
1016
+ }
1017
+ clear() {
1018
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1019
+ return this.selectedDates = [], this.rangeDateFrom = !1, this.rangeDateTo = !1, this.trigger(l.eventChangeSelectedDate, { action: l.actionUnselectDate, silent: e.silent }), new Promise((t) => {
1020
+ setTimeout(t);
1021
+ });
1022
+ }
1023
+ show() {
1024
+ let { onShow: e, isMobile: t } = this.opts;
1025
+ this._cancelScheduledCall(), this.visible || this.hideAnimation || this._createComponents(), this.setPosition(this.opts.position), this.$datepicker.classList.add("-active-"), this.visible = !0, e && this._scheduleCallAfterTransition(e), t && this._showMobileOverlay();
1026
+ }
1027
+ hide() {
1028
+ let { onHide: e, isMobile: t } = this.opts, s = this._hasTransition();
1029
+ this.visible = !1, this.hideAnimation = !0, this.$datepicker.classList.remove("-active-"), this.customHide && this.customHide(), this.elIsInput && this.$el.blur(), this._scheduleCallAfterTransition((a) => {
1030
+ !this.customHide && (a && s || !a && !s) && this._finishHide(), e && e(a);
1031
+ }), t && S.classList.remove("-active-");
1032
+ }
1033
+ _triggerOnSelect() {
1034
+ let e = [], t = [], { selectedDates: s, locale: a, opts: { onSelect: n, multipleDates: i, range: h } } = this, o = i || h, d = typeof a.dateFormat == "function";
1035
+ s.length && (e = s.map(J), t = d ? i ? a.dateFormat(e) : e.map((c) => a.dateFormat(c)) : e.map((c) => this.formatDate(c, a.dateFormat))), n({ date: o ? e : e[0], formattedDate: o ? t : t[0], datepicker: this });
1036
+ }
1037
+ _handleAlreadySelectedDates(e, t) {
1038
+ let { range: s, toggleSelected: a } = this.opts;
1039
+ s ? a ? this.unselectDate(t) : this.selectedDates.length !== 2 && this.selectDate(t) : a && this.unselectDate(t), a || this._updateLastSelectedDate(e);
1040
+ }
1041
+ _handleUpDownActions(e, t) {
1042
+ if (!((e = C(e || this.focusDate || this.viewDate)) instanceof Date))
1043
+ return;
1044
+ let s = t === "up" ? this.viewIndex + 1 : this.viewIndex - 1;
1045
+ s > 2 && (s = 2), s < 0 && (s = 0), this.setViewDate(new Date(e.getFullYear(), e.getMonth(), 1)), this.setCurrentView(this.viewIndexes[s]);
1046
+ }
1047
+ _handleRangeOnFocus() {
1048
+ this.selectedDates.length === 1 && ($(this.selectedDates[0], this.focusDate) ? (this.rangeDateTo = this.selectedDates[0], this.rangeDateFrom = this.focusDate) : (this.rangeDateTo = this.focusDate, this.rangeDateFrom = this.selectedDates[0]));
1049
+ }
1050
+ getCell(e) {
1051
+ let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : l.day;
1052
+ if (!((e = C(e)) instanceof Date))
1053
+ return;
1054
+ let { year: s, month: a, date: n } = D(e), i = '[data-year="'.concat(s, '"]'), h = '[data-month="'.concat(a, '"]'), o = '[data-date="'.concat(n, '"]'), d = { [l.day]: "".concat(i).concat(h).concat(o), [l.month]: "".concat(i).concat(h), [l.year]: "".concat(i) };
1055
+ return this.views[this.currentView].$el.querySelector(d[t]);
1056
+ }
1057
+ _showMobileOverlay() {
1058
+ S.classList.add("-active-");
1059
+ }
1060
+ _hasTransition() {
1061
+ return window.getComputedStyle(this.$datepicker).getPropertyValue("transition-duration").split(", ").reduce((e, t) => parseFloat(t) + e, 0) > 0;
1062
+ }
1063
+ get shouldUpdateDOM() {
1064
+ return this.visible || this.treatAsInline;
1065
+ }
1066
+ get parsedViewDate() {
1067
+ return D(this.viewDate);
1068
+ }
1069
+ get currentViewSingular() {
1070
+ return this.currentView.slice(0, -1);
1071
+ }
1072
+ get curDecade() {
1073
+ return F(this.viewDate);
1074
+ }
1075
+ get viewIndex() {
1076
+ return this.viewIndexes.indexOf(this.currentView);
1077
+ }
1078
+ get isFinalView() {
1079
+ return this.currentView === l.years;
1080
+ }
1081
+ get hasSelectedDates() {
1082
+ return this.selectedDates.length > 0;
1083
+ }
1084
+ get isMinViewReached() {
1085
+ return this.currentView === this.opts.minView || this.currentView === l.days;
1086
+ }
1087
+ get $container() {
1088
+ return this.$customContainer || W;
1089
+ }
1090
+ static replacer(e, t, s) {
1091
+ return e.replace(t, function(a, n, i, h) {
1092
+ return n + s + h;
1093
+ });
1094
+ }
2082
1095
  }
2083
- super.doCommit();
2084
- }
2085
- _normalizeZeros(t) {
2086
- const e = this._removeThousandsSeparators(t).split(this.radix);
2087
- return e[0] = e[0].replace(/^(\D*)(0*)(\d*)/, (s, i, u, a) => i + a), 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));
2088
- }
2089
- _padFractionalZeros(t) {
2090
- if (!t)
2091
- return t;
2092
- const e = t.split(this.radix);
2093
- return e.length < 2 && e.push(""), e[1] = e[1].padEnd(this.scale, "0"), e.join(this.radix);
2094
- }
2095
- doSkipInvalid(t, e, s) {
2096
- e === void 0 && (e = {});
2097
- const i = this.scale === 0 && t !== this.thousandsSeparator && (t === this.radix || t === g.UNMASKED_RADIX || this.mapToRadix.includes(t));
2098
- return super.doSkipInvalid(t, e, s) && !i;
2099
- }
2100
- get unmaskedValue() {
2101
- return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix, g.UNMASKED_RADIX);
2102
- }
2103
- set unmaskedValue(t) {
2104
- super.unmaskedValue = t;
2105
- }
2106
- get typedValue() {
2107
- return this.parse(this.unmaskedValue, this);
2108
- }
2109
- set typedValue(t) {
2110
- this.rawInputValue = this.format(t, this).replace(g.UNMASKED_RADIX, this.radix);
2111
- }
2112
- /** Parsed Number */
2113
- get number() {
2114
- return this.typedValue;
2115
- }
2116
- set number(t) {
2117
- this.typedValue = t;
2118
- }
2119
- /**
2120
- Is negative allowed
2121
- */
2122
- get allowNegative() {
2123
- return this.min != null && this.min < 0 || this.max != null && this.max < 0;
2124
- }
2125
- /**
2126
- Is positive allowed
2127
- */
2128
- get allowPositive() {
2129
- return this.min != null && this.min > 0 || this.max != null && this.max > 0;
2130
- }
2131
- typedValueEquals(t) {
2132
- return (super.typedValueEquals(t) || g.EMPTY_VALUES.includes(t) && g.EMPTY_VALUES.includes(this.typedValue)) && !(t === 0 && this.value === "");
2133
- }
2134
- }
2135
- g.UNMASKED_RADIX = ".", g.EMPTY_VALUES = [...f.EMPTY_VALUES, 0], g.DEFAULTS = {
2136
- mask: Number,
2137
- radix: ",",
2138
- thousandsSeparator: "",
2139
- mapToRadix: [g.UNMASKED_RADIX],
2140
- min: Number.MIN_SAFE_INTEGER,
2141
- max: Number.MAX_SAFE_INTEGER,
2142
- scale: 2,
2143
- normalizeZeros: !0,
2144
- padFractionalZeros: !1,
2145
- parse: Number,
2146
- format: (n) => n.toLocaleString("en-US", {
2147
- useGrouping: !1,
2148
- maximumFractionDigits: 20
2149
- })
2150
- }, o.MaskedNumber = g;
2151
- const T = {
2152
- MASKED: "value",
2153
- UNMASKED: "unmaskedValue",
2154
- TYPED: "typedValue"
2155
- };
2156
- function O(n, t, e) {
2157
- t === void 0 && (t = T.MASKED), e === void 0 && (e = T.MASKED);
2158
- const s = A(n);
2159
- return (i) => s.runIsolated((u) => (u[t] = i, u[e]));
2160
- }
2161
- function K(n, t, e, s) {
2162
- return O(t, e, s)(n);
2163
- }
2164
- o.PIPE_TYPE = T, o.createPipe = O, o.pipe = K;
2165
- try {
2166
- globalThis.IMask = o;
2167
- } catch {
2168
- }
2169
- p.ChangeDetails = c, p.ChunksTailDetails = C, p.DIRECTION = h, p.HTMLContenteditableMaskElement = w, p.HTMLInputMaskElement = z, p.HTMLMaskElement = F, p.InputMask = G, p.MaskElement = I, p.Masked = f, p.MaskedDate = B, p.MaskedDynamic = D, p.MaskedEnum = Y, p.MaskedFunction = $, p.MaskedNumber = g, p.MaskedPattern = k, p.MaskedRange = V, p.MaskedRegExp = q, p.PIPE_TYPE = T, p.PatternFixedDefinition = R, p.PatternInputDefinition = M, p.createMask = A, p.createPipe = O, p.default = o, p.forceDirection = j, p.normalizeOpts = x, p.pipe = K, Object.defineProperty(p, "__esModule", { value: !0 });
2170
- });
2171
- const W = IMask;
1096
+ var ie;
1097
+ return m(T, "defaults", Q), m(T, "version", "3.3.0"), m(T, "defaultContainerId", "air-datepicker-global-container"), ie = T.prototype, Object.assign(ie, me), j.default;
1098
+ }();
1099
+ });
1100
+ })(ne);
1101
+ var ye = ne.exports;
1102
+ const ke = /* @__PURE__ */ De(ye);
2172
1103
  export {
2173
- W as default
1104
+ ke as default
2174
1105
  };
2175
1106
  //# sourceMappingURL=design-system103.mjs.map