stimulus_plumbers 0.2.8 → 0.2.9

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 (86) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +3 -0
  4. data/app/assets/javascripts/stimulus-plumbers/stimulus-plumbers-controllers.es.js +339 -302
  5. data/app/assets/javascripts/stimulus-plumbers/stimulus-plumbers-controllers.umd.js +1 -1
  6. data/lib/stimulus_plumbers/components/action_list/item.rb +27 -0
  7. data/lib/stimulus_plumbers/components/action_list/section.rb +21 -0
  8. data/lib/stimulus_plumbers/components/action_list.rb +23 -0
  9. data/lib/stimulus_plumbers/components/avatar.rb +72 -0
  10. data/lib/stimulus_plumbers/components/button/group.rb +17 -0
  11. data/lib/stimulus_plumbers/components/button.rb +27 -0
  12. data/lib/stimulus_plumbers/components/calendar/month/turbo/days_of_month.rb +2 -2
  13. data/lib/stimulus_plumbers/components/calendar/month/turbo/days_of_week.rb +2 -2
  14. data/lib/stimulus_plumbers/components/calendar/month/turbo.rb +55 -0
  15. data/lib/stimulus_plumbers/components/calendar.rb +33 -0
  16. data/lib/stimulus_plumbers/components/card/section.rb +25 -0
  17. data/lib/stimulus_plumbers/components/card.rb +27 -0
  18. data/lib/stimulus_plumbers/components/combobox/autocomplete.rb +30 -34
  19. data/lib/stimulus_plumbers/components/combobox/date.rb +16 -18
  20. data/lib/stimulus_plumbers/components/combobox/dropdown.rb +13 -16
  21. data/lib/stimulus_plumbers/components/combobox/options/option.rb +34 -0
  22. data/lib/stimulus_plumbers/components/combobox/options/option_group.rb +29 -0
  23. data/lib/stimulus_plumbers/components/combobox/options.rb +59 -0
  24. data/lib/stimulus_plumbers/components/combobox/popover.rb +20 -0
  25. data/lib/stimulus_plumbers/components/combobox/time/drum.rb +37 -0
  26. data/lib/stimulus_plumbers/components/combobox/time.rb +32 -15
  27. data/lib/stimulus_plumbers/components/combobox/trigger.rb +38 -0
  28. data/lib/stimulus_plumbers/components/combobox.rb +59 -0
  29. data/lib/stimulus_plumbers/components/date_picker/navigator.rb +1 -1
  30. data/lib/stimulus_plumbers/components/icon.rb +49 -0
  31. data/lib/stimulus_plumbers/components/popover/builder.rb +25 -0
  32. data/lib/stimulus_plumbers/components/popover.rb +26 -0
  33. data/lib/stimulus_plumbers/form/builder.rb +7 -5
  34. data/lib/stimulus_plumbers/form/{field_component.rb → field.rb} +1 -1
  35. data/lib/stimulus_plumbers/form/fields/combobox.rb +1 -1
  36. data/lib/stimulus_plumbers/form/fields/error.rb +14 -0
  37. data/lib/stimulus_plumbers/form/fields/group.rb +14 -0
  38. data/lib/stimulus_plumbers/form/fields/hint.rb +14 -0
  39. data/lib/stimulus_plumbers/form/fields/label.rb +21 -0
  40. data/lib/stimulus_plumbers/form/fields/renderer.rb +16 -20
  41. data/lib/stimulus_plumbers/form/fields/search.rb +23 -9
  42. data/lib/stimulus_plumbers/form/fields/submit.rb +23 -0
  43. data/lib/stimulus_plumbers/helpers/action_list_helper.rb +2 -2
  44. data/lib/stimulus_plumbers/helpers/avatar_helper.rb +2 -2
  45. data/lib/stimulus_plumbers/helpers/button_helper.rb +2 -2
  46. data/lib/stimulus_plumbers/helpers/calendar_helper.rb +1 -1
  47. data/lib/stimulus_plumbers/helpers/calendar_turbo_helper.rb +1 -1
  48. data/lib/stimulus_plumbers/helpers/card_helper.rb +2 -2
  49. data/lib/stimulus_plumbers/helpers/combobox_helper.rb +5 -5
  50. data/lib/stimulus_plumbers/helpers/popover_helper.rb +2 -2
  51. data/lib/stimulus_plumbers/plumber/base.rb +20 -0
  52. data/lib/stimulus_plumbers/plumber/dispatcher.rb +111 -0
  53. data/lib/stimulus_plumbers/plumber/html_options.rb +51 -0
  54. data/lib/stimulus_plumbers/plumber/renderer.rb +89 -0
  55. data/lib/stimulus_plumbers/themes/base.rb +9 -15
  56. data/lib/stimulus_plumbers/themes/schema/ranges.rb +5 -5
  57. data/lib/stimulus_plumbers/themes/schema.rb +97 -0
  58. data/lib/stimulus_plumbers/themes/tailwind/calendar.rb +48 -2
  59. data/lib/stimulus_plumbers/themes/tailwind/combobox.rb +75 -0
  60. data/lib/stimulus_plumbers/themes/tailwind_theme.rb +2 -0
  61. data/lib/stimulus_plumbers/version.rb +1 -1
  62. data/lib/stimulus_plumbers.rb +29 -19
  63. metadata +33 -25
  64. data/lib/stimulus_plumbers/components/action_list/renderer.rb +0 -47
  65. data/lib/stimulus_plumbers/components/avatar/renderer.rb +0 -74
  66. data/lib/stimulus_plumbers/components/button/renderer.rb +0 -33
  67. data/lib/stimulus_plumbers/components/calendar/month/turbo/renderer.rb +0 -57
  68. data/lib/stimulus_plumbers/components/calendar/renderer.rb +0 -35
  69. data/lib/stimulus_plumbers/components/card/renderer.rb +0 -41
  70. data/lib/stimulus_plumbers/components/combobox/option.rb +0 -27
  71. data/lib/stimulus_plumbers/components/combobox/option_group.rb +0 -52
  72. data/lib/stimulus_plumbers/components/combobox/renderer.rb +0 -78
  73. data/lib/stimulus_plumbers/components/icon/renderer.rb +0 -51
  74. data/lib/stimulus_plumbers/components/plumber/base.rb +0 -22
  75. data/lib/stimulus_plumbers/components/plumber/dispatcher.rb +0 -113
  76. data/lib/stimulus_plumbers/components/plumber/html_options.rb +0 -53
  77. data/lib/stimulus_plumbers/components/plumber/renderer.rb +0 -91
  78. data/lib/stimulus_plumbers/components/popover/renderer.rb +0 -46
  79. data/lib/stimulus_plumbers/components/time_picker/renderer.rb +0 -38
  80. data/lib/stimulus_plumbers/themes/base/action_list.rb +0 -14
  81. data/lib/stimulus_plumbers/themes/base/avatar.rb +0 -14
  82. data/lib/stimulus_plumbers/themes/base/button.rb +0 -18
  83. data/lib/stimulus_plumbers/themes/base/calendar.rb +0 -15
  84. data/lib/stimulus_plumbers/themes/base/card.rb +0 -12
  85. data/lib/stimulus_plumbers/themes/base/form.rb +0 -34
  86. data/lib/stimulus_plumbers/themes/base/layout.rb +0 -12
@@ -125,53 +125,53 @@ function p(e, t = {}) {
125
125
  var m = (e = "a11y") => `${e}-${Math.random().toString(36).substr(2, 9)}`, h = (e, t = "element") => e.id ||= m(t), g = (e, t, n) => {
126
126
  e.setAttribute(t, n.toString());
127
127
  }, _ = (e, t) => g(e, "aria-expanded", t), v = (e, t) => g(e, "aria-pressed", t), ee = (e, t) => g(e, "aria-checked", t);
128
- function te(e, t) {
128
+ function y(e, t) {
129
129
  g(e, "aria-disabled", t), t ? e.setAttribute("tabindex", "-1") : e.removeAttribute("tabindex");
130
130
  }
131
- var y = {
131
+ var b = {
132
132
  menu: "menu",
133
133
  listbox: "listbox",
134
134
  tree: "tree",
135
135
  grid: "grid",
136
136
  dialog: "dialog"
137
- }, b = (e, t, n) => {
137
+ }, x = (e, t, n) => {
138
138
  Object.entries(t).forEach(([t, r]) => {
139
139
  e.setAttribute(t, r), n[t] = r;
140
140
  });
141
- }, x = (e, t, n) => n || !e.hasAttribute(t);
142
- function S({ trigger: e, target: t, role: n = null, override: r = !1 }) {
141
+ }, S = (e, t, n) => n || !e.hasAttribute(t);
142
+ function C({ trigger: e, target: t, role: n = null, override: r = !1 }) {
143
143
  let i = {
144
144
  trigger: {},
145
145
  target: {}
146
146
  };
147
147
  if (!e || !t) return i;
148
148
  let a = {}, o = {};
149
- if (n && x(t, "role", r) && (o.role = n), t.id && (x(e, "aria-controls", r) && (a["aria-controls"] = t.id), n === "tooltip" && x(e, "aria-describedby", r) && (a["aria-describedby"] = t.id)), n && x(e, "aria-haspopup", r)) {
150
- let e = y[n] || "true";
149
+ if (n && S(t, "role", r) && (o.role = n), t.id && (S(e, "aria-controls", r) && (a["aria-controls"] = t.id), n === "tooltip" && S(e, "aria-describedby", r) && (a["aria-describedby"] = t.id)), n && S(e, "aria-haspopup", r)) {
150
+ let e = b[n] || "true";
151
151
  e && (a["aria-haspopup"] = e);
152
152
  }
153
- return b(t, o, i.target), b(e, a, i.trigger), i;
153
+ return x(t, o, i.target), x(e, a, i.trigger), i;
154
154
  }
155
- var C = (e, t) => {
155
+ var w = (e, t) => {
156
156
  t.forEach((t) => {
157
157
  e.hasAttribute(t) && e.removeAttribute(t);
158
158
  });
159
159
  };
160
- function ne({ trigger: e, target: t, attributes: n = null }) {
161
- !e || !t || (C(e, n || [
160
+ function te({ trigger: e, target: t, attributes: n = null }) {
161
+ !e || !t || (w(e, n || [
162
162
  "aria-controls",
163
163
  "aria-haspopup",
164
164
  "aria-describedby"
165
- ]), (!n || n.includes("role")) && C(t, ["role"]));
165
+ ]), (!n || n.includes("role")) && w(t, ["role"]));
166
166
  }
167
167
  //#endregion
168
168
  //#region src/plumbers/plumber/support.js
169
- var w = {
169
+ var T = {
170
170
  get visibleOnly() {
171
171
  return !0;
172
172
  },
173
173
  hiddenClass: null
174
- }, T = {
174
+ }, E = {
175
175
  get top() {
176
176
  return "bottom";
177
177
  },
@@ -185,7 +185,7 @@ var w = {
185
185
  return "left";
186
186
  }
187
187
  };
188
- function E({ x: e, y: t, width: n, height: r }) {
188
+ function D({ x: e, y: t, width: n, height: r }) {
189
189
  return {
190
190
  x: e,
191
191
  y: t,
@@ -197,47 +197,47 @@ function E({ x: e, y: t, width: n, height: r }) {
197
197
  bottom: t + r
198
198
  };
199
199
  }
200
- function D() {
201
- return E({
200
+ function O() {
201
+ return D({
202
202
  x: 0,
203
203
  y: 0,
204
204
  width: window.innerWidth || document.documentElement.clientWidth,
205
205
  height: window.innerHeight || document.documentElement.clientHeight
206
206
  });
207
207
  }
208
- function re(e) {
208
+ function ne(e) {
209
209
  if (!(e instanceof HTMLElement)) return !1;
210
- let t = D(), n = e.getBoundingClientRect(), r = n.top <= t.height && n.top + n.height > 0, i = n.left <= t.width && n.left + n.width > 0;
210
+ let t = O(), n = e.getBoundingClientRect(), r = n.top <= t.height && n.top + n.height > 0, i = n.left <= t.width && n.left + n.width > 0;
211
211
  return r && i;
212
212
  }
213
- function O(e) {
213
+ function k(e) {
214
214
  return e instanceof Date && !isNaN(e);
215
215
  }
216
- function k(...e) {
216
+ function A(...e) {
217
217
  if (e.length === 0) throw "Missing values to parse as date";
218
218
  if (e.length === 1) {
219
219
  let t = new Date(e[0]);
220
- if (e[0] && O(t)) return t;
220
+ if (e[0] && k(t)) return t;
221
221
  } else {
222
222
  let t = new Date(...e);
223
- if (O(t)) return t;
223
+ if (k(t)) return t;
224
224
  }
225
225
  }
226
226
  //#endregion
227
227
  //#region src/plumbers/plumber/index.js
228
- var ie = {
228
+ var j = {
229
229
  element: null,
230
230
  visible: null,
231
231
  dispatch: !0,
232
232
  prefix: ""
233
- }, A = class {
233
+ }, M = class {
234
234
  constructor(e, t = {}) {
235
235
  this.controller = e;
236
- let { element: n, visible: r, dispatch: i, prefix: a } = Object.assign({}, ie, t);
237
- this.element = n || e.element, this.visibleOnly = typeof r == "boolean" ? r : w.visibleOnly, this.visibleCallback = typeof r == "string" ? r : null, this.notify = !!i, this.prefix = typeof a == "string" && a ? a : e.identifier;
236
+ let { element: n, visible: r, dispatch: i, prefix: a } = Object.assign({}, j, t);
237
+ this.element = n || e.element, this.visibleOnly = typeof r == "boolean" ? r : T.visibleOnly, this.visibleCallback = typeof r == "string" ? r : null, this.notify = !!i, this.prefix = typeof a == "string" && a ? a : e.identifier;
238
238
  }
239
239
  get visible() {
240
- return this.element instanceof HTMLElement ? this.visibleOnly ? re(this.element) && this.isVisible(this.element) : !0 : !1;
240
+ return this.element instanceof HTMLElement ? this.visibleOnly ? ne(this.element) && this.isVisible(this.element) : !0 : !1;
241
241
  }
242
242
  isVisible(e) {
243
243
  if (this.visibleCallback) {
@@ -266,7 +266,196 @@ var ie = {
266
266
  return n instanceof Promise ? await n : n;
267
267
  }
268
268
  }
269
- }, j = 7, M = {
269
+ }, re = {
270
+ normalize(e) {
271
+ return typeof e == "string" ? e : "";
272
+ },
273
+ validate() {
274
+ return !0;
275
+ }
276
+ };
277
+ //#endregion
278
+ //#region src/plumbers/formatters/credit_card.js
279
+ function ie(e) {
280
+ let t = 0, n = !1;
281
+ for (let r = e.length - 1; r >= 0; r--) {
282
+ let i = parseInt(e[r], 10);
283
+ n && (i *= 2, i > 9 && (i -= 9)), t += i, n = !n;
284
+ }
285
+ return t % 10 == 0;
286
+ }
287
+ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
288
+ normalize(e) {
289
+ return typeof e == "string" ? e.replace(ae, "") : "";
290
+ },
291
+ validate(e) {
292
+ return typeof e != "string" || !oe.test(e) ? !1 : ie(e);
293
+ },
294
+ format(e) {
295
+ return typeof e == "string" ? e.replace(se, "$1 ") : "";
296
+ }
297
+ }, N = { 1: 10 }, P = /\D/g, le = /^\+\d{7,15}$/, ue = {
298
+ normalize(e) {
299
+ if (typeof e != "string") return "";
300
+ let t = e.trimStart().startsWith("+"), n = e.replace(P, "");
301
+ return t ? `+${n}` : n;
302
+ },
303
+ validate(e) {
304
+ if (typeof e != "string") return !1;
305
+ if (le.test(e)) return !0;
306
+ let t = e.replace(P, "");
307
+ return Object.values(N).includes(t.length);
308
+ },
309
+ format(e) {
310
+ if (typeof e != "string") return "";
311
+ let t = e.replace(P, "");
312
+ for (let [e, n] of Object.entries(N)) {
313
+ if (t.length === n) return `(${t.slice(0, 3)}) ${t.slice(3, 6)}-${t.slice(6)}`;
314
+ let r = n + e.length;
315
+ if (t.length === r && t.startsWith(e)) {
316
+ let n = t.slice(e.length);
317
+ return `+${e} (${n.slice(0, 3)}) ${n.slice(3, 6)}-${n.slice(6)}`;
318
+ }
319
+ }
320
+ return e;
321
+ }
322
+ }, de = /[^\d.,-]/g, fe = /^-?\d+(\.\d+)?$/, F = {
323
+ normalize(e) {
324
+ if (typeof e != "string") return "";
325
+ let t = e.replace(de, "");
326
+ if (!t) return "";
327
+ let n = t.lastIndexOf(","), r = t.lastIndexOf(".");
328
+ return n > -1 && r > -1 ? n > r ? t.replace(/\./g, "").replace(",", ".") : t.replace(/,/g, "") : n > -1 ? t.slice(n + 1).length <= 2 ? t.replace(",", ".") : t.replace(/,/g, "") : t;
329
+ },
330
+ validate(e) {
331
+ return typeof e == "string" ? fe.test(e) : !1;
332
+ },
333
+ format(e, t = {}) {
334
+ if (typeof e != "string") return "";
335
+ let n = parseFloat(e);
336
+ if (isNaN(n)) return e;
337
+ let r = t.locale || "en-US", i = t.currency || "USD", a = t.fractionDigits === void 0 ? {} : {
338
+ minimumFractionDigits: t.fractionDigits,
339
+ maximumFractionDigits: t.fractionDigits
340
+ };
341
+ try {
342
+ return new Intl.NumberFormat(r, {
343
+ style: "currency",
344
+ currency: i,
345
+ ...a
346
+ }).format(n);
347
+ } catch {
348
+ return e;
349
+ }
350
+ }
351
+ }, I = /^\d{4}-\d{2}-\d{2}$/, L = /^(\d{1,4})[/\-.](\d{1,2})[/\-.](\d{1,4})$/, R = /\D/g, z = {
352
+ normalize(e) {
353
+ if (typeof e != "string") return "";
354
+ let t = e.trim();
355
+ if (I.test(t)) return t;
356
+ let n = t.match(L);
357
+ if (n) {
358
+ let [, e, t, r] = n;
359
+ if (e.length === 4) return `${e}-${t.padStart(2, "0")}-${r.padStart(2, "0")}`;
360
+ if (r.length === 4) return `${r}-${e.padStart(2, "0")}-${t.padStart(2, "0")}`;
361
+ }
362
+ let r = t.replace(R, "");
363
+ if (r.length === 8) {
364
+ let e = parseInt(r.slice(0, 4), 10);
365
+ return e >= 1e3 && e <= 9999 ? `${r.slice(0, 4)}-${r.slice(4, 6)}-${r.slice(6, 8)}` : `${r.slice(4, 8)}-${r.slice(0, 2)}-${r.slice(2, 4)}`;
366
+ }
367
+ return t;
368
+ },
369
+ validate(e) {
370
+ if (typeof e != "string") return !1;
371
+ let t = z.normalize(e);
372
+ if (!I.test(t)) return !1;
373
+ let n = /* @__PURE__ */ new Date(`${t}T00:00:00Z`);
374
+ return !isNaN(n.getTime()) && n.toISOString().startsWith(t);
375
+ },
376
+ format(e, t = {}) {
377
+ if (typeof e != "string") return "";
378
+ let n = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
379
+ if (isNaN(n.getTime())) return e;
380
+ let r = t.locale || "en-US";
381
+ try {
382
+ return new Intl.DateTimeFormat(r, {
383
+ year: t.year || "numeric",
384
+ month: t.month || "2-digit",
385
+ day: t.day || "2-digit",
386
+ timeZone: t.timeZone || "UTC"
387
+ }).format(n);
388
+ } catch {
389
+ return e;
390
+ }
391
+ }
392
+ }, B = /^([01]?\d|2[0-3]):([0-5]\d)$/, V = {
393
+ normalize(e) {
394
+ if (typeof e != "string") return "";
395
+ let t = e.trim();
396
+ if (B.test(t)) {
397
+ let [e, n] = t.split(":");
398
+ return `${String(parseInt(e, 10)).padStart(2, "0")}:${n}`;
399
+ }
400
+ let n = t.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/i);
401
+ if (n) {
402
+ let e = parseInt(n[1], 10), t = n[2];
403
+ return e = n[3].toUpperCase() === "AM" ? e === 12 ? 0 : e : e === 12 ? 12 : e + 12, e > 23 || parseInt(t, 10) > 59 ? "" : `${String(e).padStart(2, "0")}:${t}`;
404
+ }
405
+ return "";
406
+ },
407
+ validate(e) {
408
+ return V.normalize(e) !== "";
409
+ },
410
+ format(e, t = {}) {
411
+ if (typeof e != "string") return "";
412
+ let n = e.match(/^(\d{2}):(\d{2})$/);
413
+ if (!n) return e;
414
+ let r = parseInt(n[1], 10), i = n[2];
415
+ if (t.format === "h24") return `${String(r).padStart(2, "0")}:${i}`;
416
+ let a = r < 12 ? "AM" : "PM";
417
+ return `${r % 12 || 12}:${i} ${a}`;
418
+ }
419
+ }, H = {
420
+ PLAIN: "plain",
421
+ CREDIT_CARD: "creditCard",
422
+ PHONE: "phone",
423
+ CURRENCY: "currency",
424
+ DATE: "date",
425
+ TIME: "time"
426
+ }, U = new Map([
427
+ [H.PLAIN, re],
428
+ [H.CREDIT_CARD, ce],
429
+ [H.PHONE, ue],
430
+ [H.CURRENCY, F],
431
+ [H.DATE, z],
432
+ [H.TIME, V]
433
+ ]), W = {
434
+ type: H.PLAIN,
435
+ options: {}
436
+ }, G = class extends M {
437
+ static register(e, t) {
438
+ U.set(e, t);
439
+ }
440
+ constructor(e, t = {}) {
441
+ super(e, t), this.type = t.type ?? W.type, this.options = t.options ?? W.options, this.enhance();
442
+ }
443
+ enhance() {
444
+ let e = this, t = U.get(e.type) ?? U.get(H.PLAIN), n = {
445
+ normalize: (n) => t.normalize?.(n, e.options) ?? (typeof n == "string" ? n : ""),
446
+ validate: (n) => t.validate?.(n, e.options) ?? !0,
447
+ format: (n) => t.format?.(n, e.options) ?? (typeof n == "string" ? n : ""),
448
+ mask: (n) => t.mask?.(n, e.options) ?? null,
449
+ maskable: () => typeof t.mask == "function"
450
+ };
451
+ Object.defineProperty(this.controller, "formatter", {
452
+ get() {
453
+ return n;
454
+ },
455
+ configurable: !0
456
+ });
457
+ }
458
+ }, K = (e, t) => new G(e, t), q = 7, J = {
270
459
  locales: ["default"],
271
460
  today: "",
272
461
  day: null,
@@ -281,15 +470,15 @@ var ie = {
281
470
  disabledYears: [],
282
471
  firstDayOfWeek: 0,
283
472
  onNavigated: "navigated"
284
- }, ae = class extends A {
473
+ }, pe = class extends M {
285
474
  constructor(e, t = {}) {
286
475
  super(e, t);
287
- let n = Object.assign({}, M, t), { onNavigated: r, since: i, till: a, firstDayOfWeek: o } = n;
288
- this.onNavigated = r, this.since = k(i), this.till = k(a), this.firstDayOfWeek = 0 <= o && o < 7 ? o : M.firstDayOfWeek;
476
+ let n = Object.assign({}, J, t), { onNavigated: r, since: i, till: a, firstDayOfWeek: o } = n;
477
+ this.onNavigated = r, this.since = A(i), this.till = A(a), this.firstDayOfWeek = 0 <= o && o < 7 ? o : J.firstDayOfWeek;
289
478
  let { disabledDates: s, disabledWeekdays: c, disabledDays: l, disabledMonths: u, disabledYears: d } = n;
290
479
  this.disabledDates = Array.isArray(s) ? s : [], this.disabledWeekdays = Array.isArray(c) ? c : [], this.disabledDays = Array.isArray(l) ? l : [], this.disabledMonths = Array.isArray(u) ? u : [], this.disabledYears = Array.isArray(d) ? d : [];
291
480
  let { today: f, day: p, month: m, year: h } = n;
292
- this.now = k(f) || /* @__PURE__ */ new Date(), typeof h == "number" && typeof m == "number" && typeof p == "number" ? this.current = k(h, m, p) : this.current = this.now, this.build(), this.enhance();
481
+ this.now = A(f) || /* @__PURE__ */ new Date(), typeof h == "number" && typeof m == "number" && typeof p == "number" ? this.current = A(h, m, p) : this.current = this.now, this.build(), this.enhance();
293
482
  }
294
483
  build() {
295
484
  this.daysOfWeek = this.buildDaysOfWeek(), this.daysOfMonth = this.buildDaysOfMonth(), this.monthsOfYear = this.buildMonthsOfYear();
@@ -325,7 +514,7 @@ var ie = {
325
514
  let a = new Date(t, e, i);
326
515
  n.push(r(a));
327
516
  }
328
- let s = n.length % j, c = s === 0 ? 0 : j - s;
517
+ let s = n.length % q, c = s === 0 ? 0 : q - s;
329
518
  for (let i = 1; i <= c; i++) {
330
519
  let a = new Date(t, e + 1, i);
331
520
  n.push(r(a));
@@ -350,18 +539,18 @@ var ie = {
350
539
  return this.now;
351
540
  }
352
541
  set today(e) {
353
- if (!O(e)) return;
542
+ if (!k(e)) return;
354
543
  let t = this.month ? this.month : e.getMonth(), n = this.year ? this.year : e.getFullYear(), r = t == e.getMonth() && n == e.getFullYear(), i = this.hasDayValue ? this.day : r ? e.getDate() : 1;
355
544
  this.now = new Date(n, t, i).toISOString();
356
545
  }
357
546
  get current() {
358
- return typeof this.year == "number" && typeof this.month == "number" && typeof this.day == "number" ? k(this.year, this.month, this.day) : null;
547
+ return typeof this.year == "number" && typeof this.month == "number" && typeof this.day == "number" ? A(this.year, this.month, this.day) : null;
359
548
  }
360
549
  set current(e) {
361
- O(e) && (this.day = e.getDate(), this.month = e.getMonth(), this.year = e.getFullYear());
550
+ k(e) && (this.day = e.getDate(), this.month = e.getMonth(), this.year = e.getFullYear());
362
551
  }
363
552
  navigate = async (e) => {
364
- if (!O(e)) return;
553
+ if (!k(e)) return;
365
554
  let t = this.current, n = e.toISOString(), r = t.toISOString();
366
555
  this.dispatch("navigate", { detail: {
367
556
  from: r,
@@ -392,7 +581,7 @@ var ie = {
392
581
  await this.navigate(n);
393
582
  };
394
583
  isDisabled = (e) => {
395
- if (!O(e)) return !1;
584
+ if (!k(e)) return !1;
396
585
  if (this.disabledDates.length) {
397
586
  let t = e.getTime();
398
587
  for (let e of this.disabledDates) if (t === new Date(e).getTime()) return !0;
@@ -422,7 +611,7 @@ var ie = {
422
611
  return !1;
423
612
  };
424
613
  isWithinRange = (e) => {
425
- if (!O(e)) return !1;
614
+ if (!k(e)) return !1;
426
615
  let t = !0;
427
616
  return this.since && (t &&= e >= this.since), this.till && (t &&= e <= this.till), t;
428
617
  };
@@ -485,7 +674,7 @@ var ie = {
485
674
  };
486
675
  } });
487
676
  }
488
- }, oe = (e, t) => new ae(e, t), se = class extends A {
677
+ }, me = (e, t) => new pe(e, t), he = class extends M {
489
678
  constructor(e, t = {}) {
490
679
  super(e, t), this.debounceTimer = null, this.abortController = null;
491
680
  }
@@ -527,7 +716,7 @@ var ie = {
527
716
  cancel() {
528
717
  clearTimeout(this.debounceTimer), this.abortController?.abort();
529
718
  }
530
- }, ce = (e, t) => new se(e, t), N = {
719
+ }, ge = (e, t) => new he(e, t), Y = {
531
720
  content: null,
532
721
  url: "",
533
722
  reload: "never",
@@ -535,11 +724,11 @@ var ie = {
535
724
  onLoad: "canLoad",
536
725
  onLoading: "contentLoading",
537
726
  onLoaded: "contentLoaded"
538
- }, le = class extends A {
727
+ }, _e = class extends M {
539
728
  constructor(e, t = {}) {
540
729
  super(e, t);
541
- let n = Object.assign({}, N, t), { content: r, url: i, reload: a, stale: o } = n;
542
- this.content = r, this.url = i, this.reload = typeof a == "string" ? a : N.reload, this.stale = typeof o == "number" ? o : N.stale;
730
+ let n = Object.assign({}, Y, t), { content: r, url: i, reload: a, stale: o } = n;
731
+ this.content = r, this.url = i, this.reload = typeof a == "string" ? a : Y.reload, this.stale = typeof o == "number" ? o : Y.stale;
543
732
  let { onLoad: s, onLoading: c, onLoaded: l } = n;
544
733
  this.onLoad = s, this.onLoading = c, this.onLoaded = l, this.enhance();
545
734
  }
@@ -548,7 +737,7 @@ var ie = {
548
737
  case "never": return !1;
549
738
  case "always": return !0;
550
739
  default: {
551
- let e = k(this.loadedAt);
740
+ let e = A(this.loadedAt);
552
741
  return e && /* @__PURE__ */ new Date() - e > this.stale * 1e3;
553
742
  }
554
743
  }
@@ -574,14 +763,14 @@ var ie = {
574
763
  let e = this;
575
764
  Object.assign(this.controller, { load: e.load.bind(e) });
576
765
  }
577
- }, ue = (e, t) => new le(e, t), de = {
766
+ }, ve = (e, t) => new _e(e, t), ye = {
578
767
  trigger: null,
579
768
  events: ["click"],
580
769
  onDismissed: "dismissed"
581
- }, fe = class extends A {
770
+ }, be = class extends M {
582
771
  constructor(e, t = {}) {
583
772
  super(e, t);
584
- let { trigger: n, events: r, onDismissed: i } = Object.assign({}, de, t);
773
+ let { trigger: n, events: r, onDismissed: i } = Object.assign({}, ye, t);
585
774
  this.onDismissed = i, this.trigger = n || this.element, this.events = r, this.enhance(), this.observe();
586
775
  }
587
776
  dismiss = async (e) => {
@@ -604,7 +793,7 @@ var ie = {
604
793
  e.unobserve(), t();
605
794
  } });
606
795
  }
607
- }, P = (e, t) => new fe(e, t), F = {
796
+ }, X = (e, t) => new be(e, t), xe = {
608
797
  anchor: null,
609
798
  events: ["click"],
610
799
  placement: "bottom",
@@ -612,11 +801,11 @@ var ie = {
612
801
  onFlipped: "flipped",
613
802
  ariaRole: null,
614
803
  respectMotion: !0
615
- }, I = class extends A {
804
+ }, Se = class extends M {
616
805
  constructor(e, t = {}) {
617
806
  super(e, t);
618
- let { anchor: n, events: r, placement: i, alignment: a, onFlipped: o, ariaRole: s, respectMotion: c } = Object.assign({}, F, t);
619
- this.anchor = n, this.events = r, this.placement = i, this.alignment = a, this.onFlipped = o, this.ariaRole = s, this.respectMotion = c, this.prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches, this.anchor && this.element && S({
807
+ let { anchor: n, events: r, placement: i, alignment: a, onFlipped: o, ariaRole: s, respectMotion: c } = Object.assign({}, xe, t);
808
+ this.anchor = n, this.events = r, this.placement = i, this.alignment = a, this.onFlipped = o, this.ariaRole = s, this.respectMotion = c, this.prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches, this.anchor && this.element && C({
620
809
  trigger: this.anchor,
621
810
  target: this.element,
622
811
  role: this.ariaRole
@@ -634,7 +823,7 @@ var ie = {
634
823
  }), this.dispatch("flipped", { detail: { placement: e } });
635
824
  };
636
825
  flippedRect(e, t) {
637
- let n = this.quadrumRect(e, D()), r = [this.placement, T[this.placement]], i = {};
826
+ let n = this.quadrumRect(e, O()), r = [this.placement, E[this.placement]], i = {};
638
827
  for (; !Object.keys(i).length && r.length > 0;) {
639
828
  let a = r.shift();
640
829
  if (!this.biggerRectThan(n[a], t)) continue;
@@ -645,25 +834,25 @@ var ie = {
645
834
  }
646
835
  quadrumRect(e, t) {
647
836
  return {
648
- left: E({
837
+ left: D({
649
838
  x: t.x,
650
839
  y: t.y,
651
840
  width: e.x - t.x,
652
841
  height: t.height
653
842
  }),
654
- right: E({
843
+ right: D({
655
844
  x: e.x + e.width,
656
845
  y: t.y,
657
846
  width: t.width - (e.x + e.width),
658
847
  height: t.height
659
848
  }),
660
- top: E({
849
+ top: D({
661
850
  x: t.x,
662
851
  y: t.y,
663
852
  width: t.width,
664
853
  height: e.y - t.y
665
854
  }),
666
- bottom: E({
855
+ bottom: D({
667
856
  x: t.x,
668
857
  y: e.y + e.height,
669
858
  width: t.width,
@@ -673,25 +862,25 @@ var ie = {
673
862
  }
674
863
  quadrumPlacement(e, t, n) {
675
864
  switch (t) {
676
- case "top": return E({
865
+ case "top": return D({
677
866
  x: n.x,
678
867
  y: e.y - n.height,
679
868
  width: n.width,
680
869
  height: n.height
681
870
  });
682
- case "bottom": return E({
871
+ case "bottom": return D({
683
872
  x: n.x,
684
873
  y: e.y + e.height,
685
874
  width: n.width,
686
875
  height: n.height
687
876
  });
688
- case "left": return E({
877
+ case "left": return D({
689
878
  x: e.x - n.width,
690
879
  y: n.y,
691
880
  width: n.width,
692
881
  height: n.height
693
882
  });
694
- case "right": return E({
883
+ case "right": return D({
695
884
  x: e.x + e.width,
696
885
  y: n.y,
697
886
  width: n.width,
@@ -705,7 +894,7 @@ var ie = {
705
894
  case "top":
706
895
  case "bottom": {
707
896
  let t = e.x;
708
- return this.alignment === "center" ? t = e.x + e.width / 2 - n.width / 2 : this.alignment === "end" && (t = e.x + e.width - n.width), E({
897
+ return this.alignment === "center" ? t = e.x + e.width / 2 - n.width / 2 : this.alignment === "end" && (t = e.x + e.width - n.width), D({
709
898
  x: t,
710
899
  y: n.y,
711
900
  width: n.width,
@@ -715,7 +904,7 @@ var ie = {
715
904
  case "left":
716
905
  case "right": {
717
906
  let t = e.y;
718
- return this.alignment === "center" ? t = e.y + e.height / 2 - n.height / 2 : this.alignment === "end" && (t = e.y + e.height - n.height), E({
907
+ return this.alignment === "center" ? t = e.y + e.height / 2 - n.height / 2 : this.alignment === "end" && (t = e.y + e.height - n.height), D({
719
908
  x: n.x,
720
909
  y: t,
721
910
  width: n.width,
@@ -747,196 +936,7 @@ var ie = {
747
936
  flip: e.flip.bind(e)
748
937
  });
749
938
  }
750
- }, L = (e, t) => new I(e, t), R = {
751
- normalize(e) {
752
- return typeof e == "string" ? e : "";
753
- },
754
- validate() {
755
- return !0;
756
- }
757
- };
758
- //#endregion
759
- //#region src/plumbers/input_format/formatters/credit_card.js
760
- function z(e) {
761
- let t = 0, n = !1;
762
- for (let r = e.length - 1; r >= 0; r--) {
763
- let i = parseInt(e[r], 10);
764
- n && (i *= 2, i > 9 && (i -= 9)), t += i, n = !n;
765
- }
766
- return t % 10 == 0;
767
- }
768
- var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
769
- normalize(e) {
770
- return typeof e == "string" ? e.replace(B, "") : "";
771
- },
772
- validate(e) {
773
- return typeof e != "string" || !V.test(e) ? !1 : z(e);
774
- },
775
- format(e) {
776
- return typeof e == "string" ? e.replace(pe, "$1 ") : "";
777
- }
778
- }, H = { 1: 10 }, U = /\D/g, he = /^\+\d{7,15}$/, ge = {
779
- normalize(e) {
780
- if (typeof e != "string") return "";
781
- let t = e.trimStart().startsWith("+"), n = e.replace(U, "");
782
- return t ? `+${n}` : n;
783
- },
784
- validate(e) {
785
- if (typeof e != "string") return !1;
786
- if (he.test(e)) return !0;
787
- let t = e.replace(U, "");
788
- return Object.values(H).includes(t.length);
789
- },
790
- format(e) {
791
- if (typeof e != "string") return "";
792
- let t = e.replace(U, "");
793
- for (let [e, n] of Object.entries(H)) {
794
- if (t.length === n) return `(${t.slice(0, 3)}) ${t.slice(3, 6)}-${t.slice(6)}`;
795
- let r = n + e.length;
796
- if (t.length === r && t.startsWith(e)) {
797
- let n = t.slice(e.length);
798
- return `+${e} (${n.slice(0, 3)}) ${n.slice(3, 6)}-${n.slice(6)}`;
799
- }
800
- }
801
- return e;
802
- }
803
- }, _e = /[^\d.,-]/g, ve = /^-?\d+(\.\d+)?$/, ye = {
804
- normalize(e) {
805
- if (typeof e != "string") return "";
806
- let t = e.replace(_e, "");
807
- if (!t) return "";
808
- let n = t.lastIndexOf(","), r = t.lastIndexOf(".");
809
- return n > -1 && r > -1 ? n > r ? t.replace(/\./g, "").replace(",", ".") : t.replace(/,/g, "") : n > -1 ? t.slice(n + 1).length <= 2 ? t.replace(",", ".") : t.replace(/,/g, "") : t;
810
- },
811
- validate(e) {
812
- return typeof e == "string" ? ve.test(e) : !1;
813
- },
814
- format(e, t = {}) {
815
- if (typeof e != "string") return "";
816
- let n = parseFloat(e);
817
- if (isNaN(n)) return e;
818
- let r = t.locale || "en-US", i = t.currency || "USD", a = t.fractionDigits === void 0 ? {} : {
819
- minimumFractionDigits: t.fractionDigits,
820
- maximumFractionDigits: t.fractionDigits
821
- };
822
- try {
823
- return new Intl.NumberFormat(r, {
824
- style: "currency",
825
- currency: i,
826
- ...a
827
- }).format(n);
828
- } catch {
829
- return e;
830
- }
831
- }
832
- }, W = /^\d{4}-\d{2}-\d{2}$/, be = /^(\d{1,4})[/\-.](\d{1,2})[/\-.](\d{1,4})$/, xe = /\D/g, G = {
833
- normalize(e) {
834
- if (typeof e != "string") return "";
835
- let t = e.trim();
836
- if (W.test(t)) return t;
837
- let n = t.match(be);
838
- if (n) {
839
- let [, e, t, r] = n;
840
- if (e.length === 4) return `${e}-${t.padStart(2, "0")}-${r.padStart(2, "0")}`;
841
- if (r.length === 4) return `${r}-${e.padStart(2, "0")}-${t.padStart(2, "0")}`;
842
- }
843
- let r = t.replace(xe, "");
844
- if (r.length === 8) {
845
- let e = parseInt(r.slice(0, 4), 10);
846
- return e >= 1e3 && e <= 9999 ? `${r.slice(0, 4)}-${r.slice(4, 6)}-${r.slice(6, 8)}` : `${r.slice(4, 8)}-${r.slice(0, 2)}-${r.slice(2, 4)}`;
847
- }
848
- return t;
849
- },
850
- validate(e) {
851
- if (typeof e != "string") return !1;
852
- let t = G.normalize(e);
853
- if (!W.test(t)) return !1;
854
- let n = /* @__PURE__ */ new Date(`${t}T00:00:00Z`);
855
- return !isNaN(n.getTime()) && n.toISOString().startsWith(t);
856
- },
857
- format(e, t = {}) {
858
- if (typeof e != "string") return "";
859
- let n = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
860
- if (isNaN(n.getTime())) return e;
861
- let r = t.locale || "en-US";
862
- try {
863
- return new Intl.DateTimeFormat(r, {
864
- year: t.year || "numeric",
865
- month: t.month || "2-digit",
866
- day: t.day || "2-digit",
867
- timeZone: t.timeZone || "UTC"
868
- }).format(n);
869
- } catch {
870
- return e;
871
- }
872
- }
873
- }, Se = /^([01]?\d|2[0-3]):([0-5]\d)$/, K = {
874
- normalize(e) {
875
- if (typeof e != "string") return "";
876
- let t = e.trim();
877
- if (Se.test(t)) {
878
- let [e, n] = t.split(":");
879
- return `${String(parseInt(e, 10)).padStart(2, "0")}:${n}`;
880
- }
881
- let n = t.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/i);
882
- if (n) {
883
- let e = parseInt(n[1], 10), t = n[2];
884
- return e = n[3].toUpperCase() === "AM" ? e === 12 ? 0 : e : e === 12 ? 12 : e + 12, e > 23 || parseInt(t, 10) > 59 ? "" : `${String(e).padStart(2, "0")}:${t}`;
885
- }
886
- return "";
887
- },
888
- validate(e) {
889
- return K.normalize(e) !== "";
890
- },
891
- format(e, t = {}) {
892
- if (typeof e != "string") return "";
893
- let n = e.match(/^(\d{2}):(\d{2})$/);
894
- if (!n) return e;
895
- let r = parseInt(n[1], 10), i = n[2];
896
- if (t.format === "h24") return `${String(r).padStart(2, "0")}:${i}`;
897
- let a = r < 12 ? "AM" : "PM";
898
- return `${r % 12 || 12}:${i} ${a}`;
899
- }
900
- }, q = {
901
- PLAIN: "plain",
902
- CREDIT_CARD: "creditCard",
903
- PHONE: "phone",
904
- CURRENCY: "currency",
905
- DATE: "date",
906
- TIME: "time"
907
- }, J = new Map([
908
- [q.PLAIN, R],
909
- [q.CREDIT_CARD, me],
910
- [q.PHONE, ge],
911
- [q.CURRENCY, ye],
912
- [q.DATE, G],
913
- [q.TIME, K]
914
- ]), Y = {
915
- type: q.PLAIN,
916
- options: {}
917
- }, Ce = class extends A {
918
- static register(e, t) {
919
- J.set(e, t);
920
- }
921
- constructor(e, t = {}) {
922
- super(e, t), this.type = t.type ?? Y.type, this.options = t.options ?? Y.options, this.enhance();
923
- }
924
- enhance() {
925
- let e = this, t = J.get(e.type) ?? J.get(q.PLAIN), n = {
926
- normalize: (n) => t.normalize?.(n, e.options) ?? (typeof n == "string" ? n : ""),
927
- validate: (n) => t.validate?.(n, e.options) ?? !0,
928
- format: (n) => t.format?.(n, e.options) ?? (typeof n == "string" ? n : ""),
929
- mask: (n) => t.mask?.(n, e.options) ?? null,
930
- maskable: () => typeof t.mask == "function"
931
- };
932
- Object.defineProperty(this.controller, "inputFormat", {
933
- get() {
934
- return n;
935
- },
936
- configurable: !0
937
- });
938
- }
939
- }, X = (e, t) => new Ce(e, t), we = {
939
+ }, Ce = (e, t) => new Se(e, t), we = {
940
940
  events: ["resize"],
941
941
  boundaries: [
942
942
  "top",
@@ -945,7 +945,7 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
945
945
  ],
946
946
  onShifted: "shifted",
947
947
  respectMotion: !0
948
- }, Te = class extends A {
948
+ }, Te = class extends M {
949
949
  constructor(e, t = {}) {
950
950
  super(e, t);
951
951
  let { onShifted: n, events: r, boundaries: i, respectMotion: a } = Object.assign({}, we, t);
@@ -958,14 +958,14 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
958
958
  this.element.style.transition = this.respectMotion && this.prefersReducedMotion ? "none" : "", this.element.style.transform = `translate(${t}px, ${n}px)`, await this.awaitCallback(this.onShifted, e), this.dispatch("shifted", { detail: e });
959
959
  };
960
960
  overflowRect(e, t) {
961
- let n = {}, r = D(), i = E({
961
+ let n = {}, r = O(), i = D({
962
962
  x: e.x - t.x,
963
963
  y: e.y - t.y,
964
964
  width: e.width,
965
965
  height: e.height
966
966
  });
967
967
  for (let e of this.boundaries) {
968
- let t = this.directionDistance(i, e, r), a = T[e];
968
+ let t = this.directionDistance(i, e, r), a = E[e];
969
969
  t < 0 ? i[a] + t >= r[a] && !n[a] && (n[e] = t) : n[e] = "";
970
970
  }
971
971
  return n;
@@ -1017,19 +1017,19 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1017
1017
  visibility: "visibility",
1018
1018
  onShown: "shown",
1019
1019
  onHidden: "hidden"
1020
- }, De = class extends A {
1020
+ }, De = class extends M {
1021
1021
  constructor(e, t = {}) {
1022
1022
  let { visibility: n, onShown: r, onHidden: i, activator: a } = Object.assign({}, Z, t), o = typeof n == "string" ? n : Z.namespace, s = typeof t.visible == "string" ? t.visible : "isVisible";
1023
1023
  (typeof t.visible != "boolean" || t.visible) && (t.visible = `${o}.${s}`), super(e, t), this.visibility = o, this.visibilityResolver = s, this.onShown = r, this.onHidden = i, this.activator = a instanceof HTMLElement ? a : null, this.enhance(), this.element instanceof HTMLElement && this.activate(this.isVisible(this.element));
1024
1024
  }
1025
1025
  isVisible(e) {
1026
1026
  if (!(e instanceof HTMLElement)) return !1;
1027
- let t = w.hiddenClass;
1027
+ let t = T.hiddenClass;
1028
1028
  return t ? !e.classList.contains(t) : !e.hasAttribute("hidden");
1029
1029
  }
1030
1030
  toggle(e, t) {
1031
1031
  if (!(e instanceof HTMLElement)) return;
1032
- let n = w.hiddenClass;
1032
+ let n = T.hiddenClass;
1033
1033
  n ? t ? e.classList.remove(n) : e.classList.add(n) : t ? e.removeAttribute("hidden") : e.setAttribute("hidden", !0);
1034
1034
  }
1035
1035
  activate(e) {
@@ -1074,7 +1074,7 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1074
1074
  }
1075
1075
  };
1076
1076
  initialize() {
1077
- oe(this);
1077
+ me(this);
1078
1078
  }
1079
1079
  connect() {
1080
1080
  this.draw();
@@ -1129,12 +1129,12 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1129
1129
  this.dispatch("selecting", { target: t });
1130
1130
  let n = e.target instanceof HTMLTimeElement ? e.target : e.target.querySelector("time");
1131
1131
  if (!n) return console.error(`unable to locate time element within ${t}`);
1132
- let r = k(n.dateTime);
1132
+ let r = A(n.dateTime);
1133
1133
  if (!r) return console.error(`unable to parse ${n.dateTime} found within the time element`);
1134
1134
  this.select(r.toISOString());
1135
1135
  }
1136
1136
  select(e) {
1137
- let t = k(e);
1137
+ let t = A(e);
1138
1138
  t && this.dispatch("selected", { detail: {
1139
1139
  epoch: t.getTime(),
1140
1140
  iso: e
@@ -1203,7 +1203,7 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1203
1203
  }
1204
1204
  async calendarMonthOutletConnected() {
1205
1205
  if (this.dateValue) {
1206
- let e = k(this.dateValue);
1206
+ let e = A(this.dateValue);
1207
1207
  e && await this.calendarMonthOutlet.calendar.navigate(e);
1208
1208
  }
1209
1209
  this.draw();
@@ -1271,7 +1271,7 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1271
1271
  }
1272
1272
  };
1273
1273
  initialize() {
1274
- this.comboboxDropdown = ce(this);
1274
+ this.comboboxDropdown = ge(this);
1275
1275
  }
1276
1276
  onSelect(e) {
1277
1277
  let t = e.target.closest("[role=\"option\"]");
@@ -1372,7 +1372,7 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1372
1372
  }, Ne = class extends e {
1373
1373
  static targets = ["trigger"];
1374
1374
  connect() {
1375
- P(this, { trigger: this.hasTriggerTarget ? this.triggerTarget : null });
1375
+ X(this, { trigger: this.hasTriggerTarget ? this.triggerTarget : null });
1376
1376
  }
1377
1377
  }, Pe = class extends e {
1378
1378
  static targets = ["anchor", "reference"];
@@ -1399,7 +1399,7 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1399
1399
  console.error("FlipperController requires an anchor target. Add data-flipper-target=\"anchor\" to your element.");
1400
1400
  return;
1401
1401
  }
1402
- L(this, {
1402
+ Ce(this, {
1403
1403
  element: this.referenceTarget,
1404
1404
  anchor: this.anchorTarget,
1405
1405
  placement: this.placementValue,
@@ -1421,17 +1421,32 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1421
1421
  }
1422
1422
  };
1423
1423
  static outlets = ["combobox-dropdown"];
1424
- open() {
1425
- this.hasPopoverTarget && (this.popoverTarget.hidden = !1, this.hasTriggerTarget && _(this.triggerTarget, !0), this.focusFirstInPopover());
1424
+ connect() {
1425
+ X(this), this.hasPopoverTarget && Q(this, {
1426
+ element: this.popoverTarget,
1427
+ activator: this.hasTriggerTarget ? this.triggerTarget : null
1428
+ });
1426
1429
  }
1427
- close() {
1428
- this.hasPopoverTarget && (this.popoverTarget.hidden = !0, this.hasTriggerTarget && (_(this.triggerTarget, !1), this.triggerTarget.focus()));
1430
+ async dismissed() {
1431
+ await this.close();
1429
1432
  }
1430
- toggle() {
1431
- this.hasPopoverTarget && this.popoverTarget.hidden ? this.open() : this.close();
1433
+ async open() {
1434
+ this.hasPopoverTarget && await this.visibility.show();
1432
1435
  }
1433
- onSelect(e) {
1434
- e.detail?.value !== void 0 && (this.valueValue = e.detail.value), this.close();
1436
+ async close() {
1437
+ this.hasPopoverTarget && await this.visibility.hide();
1438
+ }
1439
+ async toggle() {
1440
+ this.visibility?.visible ? await this.close() : await this.open();
1441
+ }
1442
+ async shown() {
1443
+ this.hasPopoverTarget && i(this.popoverTarget);
1444
+ }
1445
+ async hidden() {
1446
+ this.hasTriggerTarget && this.triggerTarget.focus();
1447
+ }
1448
+ async onSelect(e) {
1449
+ e.detail?.value !== void 0 && (this.valueValue = e.detail.value), await this.close();
1435
1450
  }
1436
1451
  onInput(e) {
1437
1452
  if (e.target !== this.triggerTarget) return;
@@ -1445,9 +1460,6 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1445
1460
  valueValueChanged(e) {
1446
1461
  this.hasValueTarget && (this.valueTarget.value = e), this.dispatch("changed", { detail: { value: e } });
1447
1462
  }
1448
- focusFirstInPopover() {
1449
- this.hasPopoverTarget && this.popoverTarget.querySelector("button:not([disabled]), [href], input:not([type=\"hidden\"]):not([disabled]), [tabindex]:not([tabindex=\"-1\"])")?.focus();
1450
- }
1451
1463
  }, Ie = class extends e {
1452
1464
  static targets = ["input", "toggle"];
1453
1465
  static values = {
@@ -1465,73 +1477,98 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1465
1477
  }
1466
1478
  };
1467
1479
  connect() {
1468
- X(this, {
1480
+ K(this, {
1469
1481
  type: this.typeValue,
1470
1482
  options: this.optionsValue
1471
1483
  }), this.format(this.readValue()), this.drawToggle();
1472
1484
  }
1473
1485
  typeValueChanged() {
1474
- this.inputFormat && (X(this, {
1486
+ this.formatter && (K(this, {
1475
1487
  type: this.typeValue,
1476
1488
  options: this.optionsValue
1477
1489
  }), this.format(this.readValue()), this.drawToggle());
1478
1490
  }
1479
1491
  optionsValueChanged() {
1480
- this.inputFormat && (X(this, {
1492
+ this.formatter && (K(this, {
1481
1493
  type: this.typeValue,
1482
1494
  options: this.optionsValue
1483
1495
  }), this.format(this.readValue()));
1484
1496
  }
1485
1497
  revealedValueChanged() {
1486
- this.inputFormat && (this.format(this.readValue()), this.drawToggle());
1498
+ this.formatter && (this.format(this.readValue()), this.drawToggle());
1487
1499
  }
1488
1500
  onChange(e) {
1489
1501
  this.format(e?.detail?.value ?? "");
1490
1502
  }
1491
1503
  format(e) {
1492
- this.inputFormat && this.onFormatting(e);
1504
+ this.formatter && this.onFormatting(e);
1493
1505
  }
1494
1506
  toggle() {
1495
- !this.inputFormat.maskable() && this.typeValue !== "password" || (this.revealedValue = !this.revealedValue);
1507
+ !this.formatter.maskable() && this.typeValue !== "password" || (this.revealedValue = !this.revealedValue);
1496
1508
  }
1497
1509
  onPaste(e) {
1498
1510
  let t = e.detail?.text ?? "";
1499
- if (!this.inputFormat || !t) return;
1500
- let n = this.inputFormat.normalize(t);
1501
- this.inputFormat.validate(n) && this.format(n);
1511
+ if (!this.formatter || !t) return;
1512
+ let n = this.formatter.normalize(t);
1513
+ this.formatter.validate(n) && this.format(n);
1502
1514
  }
1503
1515
  drawToggle() {
1504
1516
  if (!this.hasToggleTarget) return;
1505
- let e = this.inputFormat?.maskable() || this.typeValue === "password";
1517
+ let e = this.formatter?.maskable() || this.typeValue === "password";
1506
1518
  this.toggleTarget.hidden = !e, e && v(this.toggleTarget, this.revealedValue);
1507
1519
  }
1508
1520
  readValue() {
1509
1521
  return this.hasInputTarget ? this.inputTarget instanceof HTMLInputElement ? this.inputTarget.value : this.inputTarget.textContent : "";
1510
1522
  }
1511
1523
  onFormatting(e) {
1512
- if (!this.inputFormat) return;
1524
+ if (!this.formatter) return;
1513
1525
  if (this.typeValue === "password") {
1514
1526
  this.hasInputTarget && (this.inputTarget.type = this.revealedValue ? "text" : "password");
1515
1527
  return;
1516
1528
  }
1517
- let t = this.inputFormat.normalize(e), n = this.revealedValue || !this.inputFormat.maskable() ? this.inputFormat.format(t) : this.inputFormat.mask(t);
1529
+ let t = this.formatter.normalize(e), n = this.revealedValue || !this.formatter.maskable() ? this.formatter.format(t) : this.formatter.mask(t);
1518
1530
  this.hasInputTarget && (this.inputTarget instanceof HTMLInputElement ? this.inputTarget.value = n : this.inputTarget.textContent = n), this.dispatch("formatted", { detail: { value: n } });
1519
1531
  }
1520
1532
  }, Le = class extends e {
1533
+ static targets = ["input", "clear"];
1534
+ initialize() {
1535
+ this.onInput = this.draw.bind(this), this.onEscape = this.handleEscape.bind(this);
1536
+ }
1537
+ connect() {
1538
+ this.draw();
1539
+ }
1540
+ inputTargetConnected(e) {
1541
+ e.addEventListener("input", this.onInput), e.addEventListener("keydown", this.onEscape);
1542
+ }
1543
+ inputTargetDisconnected(e) {
1544
+ e.removeEventListener("input", this.onInput), e.removeEventListener("keydown", this.onEscape);
1545
+ }
1546
+ clear() {
1547
+ this.hasInputTarget && (this.inputTarget.value = "", this.draw(), this.inputTarget.focus(), this.inputTarget.dispatchEvent(new Event("input", { bubbles: !0 })));
1548
+ }
1549
+ draw() {
1550
+ !this.hasInputTarget || !this.hasClearTarget || (this.clearTarget.hidden = this.inputTarget.value.length === 0);
1551
+ }
1552
+ handleEscape(e) {
1553
+ e.key === "Escape" && this.inputTarget.value !== "" && (e.preventDefault(), this.clear());
1554
+ }
1555
+ }, Re = class extends e {
1521
1556
  static targets = ["modal", "overlay"];
1557
+ initialize() {
1558
+ this.onCancel = this.close.bind(this);
1559
+ }
1522
1560
  connect() {
1523
- if (!this.hasModalTarget) {
1524
- console.error("ModalController requires a modal target. Add data-modal-target=\"modal\" to your element.");
1525
- return;
1526
- }
1527
- this.isNativeDialog = this.modalTarget instanceof HTMLDialogElement, this.isNativeDialog ? (this.modalTarget.addEventListener("cancel", this.close), this.modalTarget.addEventListener("click", this.onBackdropClick)) : (this.focusTrap = new a(this.modalTarget, { escapeDeactivates: !0 }), P(this, { element: this.modalTarget }));
1561
+ this.hasModalTarget || console.error("ModalController requires a modal target. Add data-modal-target=\"modal\" to your element.");
1562
+ }
1563
+ modalTargetConnected(e) {
1564
+ this.isNativeDialog = e instanceof HTMLDialogElement, this.isNativeDialog ? (e.addEventListener("cancel", this.onCancel), e.addEventListener("click", this.onBackdropClick)) : (this.focusTrap = new a(e, { escapeDeactivates: !0 }), X(this, { element: e }));
1565
+ }
1566
+ modalTargetDisconnected(e) {
1567
+ this.isNativeDialog && (e.removeEventListener("cancel", this.onCancel), e.removeEventListener("click", this.onBackdropClick));
1528
1568
  }
1529
1569
  dismissed = () => {
1530
1570
  this.close();
1531
1571
  };
1532
- disconnect() {
1533
- this.isNativeDialog && (this.modalTarget.removeEventListener("cancel", this.close), this.modalTarget.removeEventListener("click", this.onBackdropClick));
1534
- }
1535
1572
  open(e) {
1536
1573
  if (e && e.preventDefault(), this.hasModalTarget) {
1537
1574
  if (this.isNativeDialog) this.previouslyFocused = document.activeElement, this.modalTarget.showModal();
@@ -1558,12 +1595,12 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1558
1595
  let t = this.modalTarget.getBoundingClientRect();
1559
1596
  (e.clientY < t.top || e.clientY > t.bottom || e.clientX < t.left || e.clientX > t.right) && this.close();
1560
1597
  };
1561
- }, Re = class extends e {
1598
+ }, ze = class extends e {
1562
1599
  static targets = ["content"];
1563
1600
  connect() {
1564
1601
  Ee(this, { element: this.hasContentTarget ? this.contentTarget : null });
1565
1602
  }
1566
- }, ze = class extends e {
1603
+ }, Be = class extends e {
1567
1604
  static targets = [
1568
1605
  "content",
1569
1606
  "template",
@@ -1584,7 +1621,7 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1584
1621
  }
1585
1622
  };
1586
1623
  connect() {
1587
- ue(this, {
1624
+ ve(this, {
1588
1625
  element: this.hasContentTarget ? this.contentTarget : null,
1589
1626
  url: this.hasUrlValue ? this.urlValue : null
1590
1627
  }), this.hasContentTarget && Q(this, {
@@ -1625,4 +1662,4 @@ var B = /\D/g, V = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
1625
1662
  }
1626
1663
  };
1627
1664
  //#endregion
1628
- export { y as ARIA_HASPOPUP_VALUES, $ as CalendarMonthController, Oe as CalendarMonthObserverController, ke as ClipboardController, Ae as ComboboxDateController, je as ComboboxDropdownController, Me as ComboboxTimeController, Ne as DismisserController, t as FOCUSABLE_SELECTOR, Pe as FlipperController, o as FocusRestoration, a as FocusTrap, Fe as InputComboboxController, Ie as InputFormatController, Le as ModalController, Re as PannerController, ze as PopoverController, d as RovingTabIndex, p as announce, S as connectTriggerToTarget, ne as disconnectTriggerFromTarget, h as ensureId, i as focusFirst, m as generateId, n as getFocusableElements, c as isActivationKey, l as isArrowKey, s as isKey, r as isVisible, u as preventDefault, g as setAriaState, ee as setChecked, te as setDisabled, _ as setExpanded, v as setPressed };
1665
+ export { b as ARIA_HASPOPUP_VALUES, $ as CalendarMonthController, Oe as CalendarMonthObserverController, ke as ClipboardController, Ae as ComboboxDateController, je as ComboboxDropdownController, Me as ComboboxTimeController, Ne as DismisserController, t as FOCUSABLE_SELECTOR, H as FORMATTER_TYPES, Pe as FlipperController, o as FocusRestoration, a as FocusTrap, G as Formatter, Fe as InputComboboxController, Ie as InputFormatController, Le as InputSearchController, Re as ModalController, ze as PannerController, Be as PopoverController, d as RovingTabIndex, p as announce, C as connectTriggerToTarget, te as disconnectTriggerFromTarget, h as ensureId, i as focusFirst, m as generateId, n as getFocusableElements, c as isActivationKey, l as isArrowKey, s as isKey, r as isVisible, u as preventDefault, g as setAriaState, ee as setChecked, y as setDisabled, _ as setExpanded, v as setPressed };