@nonoun/native-ui 0.2.7 → 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 (153) hide show
  1. package/dist/components/ui-accordion/ui-accordion-element.d.ts.map +1 -1
  2. package/dist/components/ui-avatar/ui-avatar-element.d.ts +2 -0
  3. package/dist/components/ui-avatar/ui-avatar-element.d.ts.map +1 -1
  4. package/dist/components/ui-calendar/calendar-store.d.ts.map +1 -1
  5. package/dist/components/ui-calendar/ui-calendar-element.d.ts +1 -0
  6. package/dist/components/ui-calendar/ui-calendar-element.d.ts.map +1 -1
  7. package/dist/components/ui-chat/ui-chat-input-element.d.ts.map +1 -1
  8. package/dist/components/ui-checkbox/ui-checkbox-element.d.ts +1 -0
  9. package/dist/components/ui-checkbox/ui-checkbox-element.d.ts.map +1 -1
  10. package/dist/components/ui-combobox/ui-combobox-element.d.ts +1 -0
  11. package/dist/components/ui-combobox/ui-combobox-element.d.ts.map +1 -1
  12. package/dist/components/ui-command/ui-command-element.d.ts.map +1 -1
  13. package/dist/components/ui-command/ui-command-group-element.d.ts +1 -0
  14. package/dist/components/ui-command/ui-command-group-element.d.ts.map +1 -1
  15. package/dist/components/ui-controller/ui-controller-element.d.ts +1 -0
  16. package/dist/components/ui-controller/ui-controller-element.d.ts.map +1 -1
  17. package/dist/components/ui-dialog/ui-dialog-element.d.ts +0 -1
  18. package/dist/components/ui-dialog/ui-dialog-element.d.ts.map +1 -1
  19. package/dist/components/ui-drawer/ui-drawer-element.d.ts +0 -1
  20. package/dist/components/ui-drawer/ui-drawer-element.d.ts.map +1 -1
  21. package/dist/components/ui-field/ui-field-element.d.ts.map +1 -1
  22. package/dist/components/ui-input/ui-input-element.d.ts +1 -0
  23. package/dist/components/ui-input/ui-input-element.d.ts.map +1 -1
  24. package/dist/components/ui-input-otp/ui-input-otp-element.d.ts +1 -0
  25. package/dist/components/ui-input-otp/ui-input-otp-element.d.ts.map +1 -1
  26. package/dist/components/ui-listbox/ui-listbox-element.d.ts.map +1 -1
  27. package/dist/components/ui-nav/ui-nav-group-element.d.ts +1 -1
  28. package/dist/components/ui-pagination/ui-pagination-element.d.ts.map +1 -1
  29. package/dist/components/ui-radio/ui-radio-element.d.ts.map +1 -1
  30. package/dist/components/ui-radio/ui-radio-group-element.d.ts +1 -0
  31. package/dist/components/ui-radio/ui-radio-group-element.d.ts.map +1 -1
  32. package/dist/components/ui-range/ui-range-element.d.ts +4 -0
  33. package/dist/components/ui-range/ui-range-element.d.ts.map +1 -1
  34. package/dist/components/ui-segmented-control/ui-segment-element.d.ts.map +1 -1
  35. package/dist/components/ui-segmented-control/ui-segmented-control-element.d.ts +1 -0
  36. package/dist/components/ui-segmented-control/ui-segmented-control-element.d.ts.map +1 -1
  37. package/dist/components/ui-select/ui-select-element.d.ts +1 -0
  38. package/dist/components/ui-select/ui-select-element.d.ts.map +1 -1
  39. package/dist/components/ui-slideshow/ui-slideshow-element.d.ts.map +1 -1
  40. package/dist/components/ui-switch/ui-switch-element.d.ts +4 -0
  41. package/dist/components/ui-switch/ui-switch-element.d.ts.map +1 -1
  42. package/dist/components/ui-table/index.d.ts +1 -1
  43. package/dist/components/ui-table/index.d.ts.map +1 -1
  44. package/dist/components/ui-table/table-store.d.ts +0 -1
  45. package/dist/components/ui-table/table-store.d.ts.map +1 -1
  46. package/dist/components/ui-table/ui-table-element.d.ts +1 -0
  47. package/dist/components/ui-table/ui-table-element.d.ts.map +1 -1
  48. package/dist/components/ui-table/ui-table-header-element.d.ts +1 -0
  49. package/dist/components/ui-table/ui-table-header-element.d.ts.map +1 -1
  50. package/dist/components/ui-tabs/ui-tab-element.d.ts.map +1 -1
  51. package/dist/components/ui-tabs/ui-tabs-element.d.ts.map +1 -1
  52. package/dist/components/ui-textarea/ui-textarea-element.d.ts +1 -0
  53. package/dist/components/ui-textarea/ui-textarea-element.d.ts.map +1 -1
  54. package/dist/components/ui-tree/ui-tree-item-element.d.ts +4 -0
  55. package/dist/components/ui-tree/ui-tree-item-element.d.ts.map +1 -1
  56. package/dist/components-lean.css +208 -84
  57. package/dist/components.css +216 -84
  58. package/dist/containers/ui-layout-sidebar/ui-layout-sidebar-element.d.ts.map +1 -1
  59. package/dist/core/form-associable.d.ts +2 -2
  60. package/dist/core/trait-runtime.d.ts.map +1 -1
  61. package/dist/core/ui-element.d.ts +2 -0
  62. package/dist/core/ui-element.d.ts.map +1 -1
  63. package/dist/custom-elements.json +4715 -2573
  64. package/dist/dialog-controller.js +54 -349
  65. package/dist/foundation.css +1 -15
  66. package/dist/icons/ui-icon-element.d.ts +1 -0
  67. package/dist/icons/ui-icon-element.d.ts.map +1 -1
  68. package/dist/index.d.ts +1 -1
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/{nav/inspector → inspector}/build-inspector.d.ts +2 -2
  71. package/dist/inspector/build-inspector.d.ts.map +1 -0
  72. package/dist/{nav/inspector → inspector}/ds-color-swatch-element.d.ts +1 -1
  73. package/dist/inspector/ds-color-swatch-element.d.ts.map +1 -0
  74. package/dist/inspector/ds-color-swatch.d.ts.map +1 -0
  75. package/dist/{nav/inspector → inspector}/ds-colors-element.d.ts +1 -1
  76. package/dist/inspector/ds-colors-element.d.ts.map +1 -0
  77. package/dist/inspector/ds-colors.d.ts.map +1 -0
  78. package/dist/inspector/ds-inspector-element.d.ts +15 -0
  79. package/dist/inspector/ds-inspector-element.d.ts.map +1 -0
  80. package/dist/inspector/ds-inspector.d.ts +3 -0
  81. package/dist/inspector/ds-inspector.d.ts.map +1 -0
  82. package/dist/{nav/inspector → inspector}/ds-themes-element.d.ts +1 -1
  83. package/dist/inspector/ds-themes-element.d.ts.map +1 -0
  84. package/dist/inspector/ds-themes.d.ts.map +1 -0
  85. package/dist/{nav/inspector → inspector}/ds-variable-element.d.ts +1 -1
  86. package/dist/inspector/ds-variable-element.d.ts.map +1 -0
  87. package/dist/inspector/ds-variable.d.ts.map +1 -0
  88. package/dist/{nav/inspector → inspector}/index.d.ts +1 -0
  89. package/dist/inspector/index.d.ts.map +1 -0
  90. package/dist/inspector.css +1 -1
  91. package/dist/inspector.d.ts +10 -6
  92. package/dist/inspector.d.ts.map +1 -1
  93. package/dist/inspector.js +94 -75
  94. package/dist/kernel/index.d.ts +1 -0
  95. package/dist/kernel/index.d.ts.map +1 -1
  96. package/dist/kernel/overlay-manager.d.ts +5 -1
  97. package/dist/kernel/overlay-manager.d.ts.map +1 -1
  98. package/dist/kernel.js +212 -194
  99. package/dist/list-navigate-controller.js +457 -0
  100. package/dist/native-ui-lean.css +209 -99
  101. package/dist/native-ui.css +217 -99
  102. package/dist/native-ui.js +7 -7
  103. package/dist/register-all.js +4 -3
  104. package/dist/register-all2.js +151 -79
  105. package/dist/traits/adapters/collapsible-adapter.d.ts.map +1 -1
  106. package/dist/traits/adapters/copyable-adapter.d.ts.map +1 -1
  107. package/dist/traits/adapters/draggable-adapter.d.ts.map +1 -1
  108. package/dist/traits/adapters/hoverable-adapter.d.ts.map +1 -1
  109. package/dist/traits/adapters/intersectable-adapter.d.ts.map +1 -1
  110. package/dist/traits/adapters/resizable-adapter.d.ts.map +1 -1
  111. package/dist/traits/adapters/searchable-adapter.d.ts.map +1 -1
  112. package/dist/traits/adapters/sortable-adapter.d.ts.map +1 -1
  113. package/dist/traits/adapters/swipeable-adapter.d.ts.map +1 -1
  114. package/dist/traits/adapters/virtualizable-adapter.d.ts.map +1 -1
  115. package/dist/traits/collapsible-controller.d.ts.map +1 -1
  116. package/dist/traits/dialog-controller.d.ts.map +1 -1
  117. package/dist/traits/drag-controller.d.ts +3 -0
  118. package/dist/traits/drag-controller.d.ts.map +1 -1
  119. package/dist/traits/drop-zone-controller.d.ts +1 -1
  120. package/dist/traits/drop-zone-controller.d.ts.map +1 -1
  121. package/dist/traits/focus-trap-controller.d.ts.map +1 -1
  122. package/dist/traits/hover-controller.d.ts +1 -1
  123. package/dist/traits/hover-controller.d.ts.map +1 -1
  124. package/dist/traits/intersect-controller.d.ts.map +1 -1
  125. package/dist/traits/popover-controller.d.ts.map +1 -1
  126. package/dist/traits/press-controller.d.ts.map +1 -1
  127. package/dist/traits/resize-controller.d.ts.map +1 -1
  128. package/dist/traits/selection-controller.d.ts.map +1 -1
  129. package/dist/traits/sort-controller.d.ts.map +1 -1
  130. package/dist/traits/swipe-controller.d.ts.map +1 -1
  131. package/dist/traits/validate-controller.d.ts +2 -0
  132. package/dist/traits/validate-controller.d.ts.map +1 -1
  133. package/dist/traits.js +5 -6
  134. package/dist/ui-icon-element.js +407 -3949
  135. package/dist/ui-layout-inspector-element.js +3777 -0
  136. package/dist/uid.js +63 -3
  137. package/package.json +1 -1
  138. package/dist/define.js +0 -62
  139. package/dist/nav/inspector/build-inspector.d.ts.map +0 -1
  140. package/dist/nav/inspector/ds-color-swatch-element.d.ts.map +0 -1
  141. package/dist/nav/inspector/ds-color-swatch.d.ts.map +0 -1
  142. package/dist/nav/inspector/ds-colors-element.d.ts.map +0 -1
  143. package/dist/nav/inspector/ds-colors.d.ts.map +0 -1
  144. package/dist/nav/inspector/ds-themes-element.d.ts.map +0 -1
  145. package/dist/nav/inspector/ds-themes.d.ts.map +0 -1
  146. package/dist/nav/inspector/ds-variable-element.d.ts.map +0 -1
  147. package/dist/nav/inspector/ds-variable.d.ts.map +0 -1
  148. package/dist/nav/inspector/index.d.ts.map +0 -1
  149. package/dist/ui-element.js +0 -128
  150. /package/dist/{nav/inspector → inspector}/ds-color-swatch.d.ts +0 -0
  151. /package/dist/{nav/inspector → inspector}/ds-colors.d.ts +0 -0
  152. /package/dist/{nav/inspector → inspector}/ds-themes.d.ts +0 -0
  153. /package/dist/{nav/inspector → inspector}/ds-variable.d.ts +0 -0
@@ -1,8 +1,6 @@
1
- import { t as e } from "./uid.js";
2
- import { i as t, n, r } from "./define.js";
3
- import { a as i, n as a, o, r as s, t as c } from "./ui-element.js";
4
- import { a as l, c as u, n as d, o as f, r as p, s as m, t as h } from "./dialog-controller.js";
5
- function g(e, t, n, r) {
1
+ import { a as e, o as t, r as n, t as r } from "./uid.js";
2
+ import { a as i, n as a, t as o, u as s } from "./list-navigate-controller.js";
3
+ function c(e, t, n, r) {
6
4
  let i;
7
5
  return () => {
8
6
  let n = t.value;
@@ -13,7 +11,7 @@ function g(e, t, n, r) {
13
11
  })), i = n;
14
12
  };
15
13
  }
16
- function _(e, n, r) {
14
+ function l(e, n, r) {
17
15
  let i = r.attribute ?? n;
18
16
  if (r.type === "boolean") {
19
17
  let n = t(!1);
@@ -78,7 +76,7 @@ function _(e, n, r) {
78
76
  * }
79
77
  * ```
80
78
  */
81
- function v(e, t, n) {
79
+ function u(e, t, n) {
82
80
  let r = e[t];
83
81
  return r ? (r.fromAttribute(n), !0) : !1;
84
82
  }
@@ -88,20 +86,20 @@ function v(e, t, n) {
88
86
  * - `static formAssociated = true`
89
87
  * - `formDisabledCallback` → calls `onFormDisabled(disabled)`
90
88
  * - `formResetCallback` → calls `onFormReset()`
91
- *
92
- * Subclasses override `onFormDisabled` and `onFormReset` with their own logic.
89
+ * - `formStateRestoreCallback` → calls `onFormStateRestore(state)`
93
90
  *
94
91
  * Must remain a mixin (not a controller) because the Web Components spec
95
92
  * requires `static formAssociated = true` on the class constructor.
96
93
  *
97
94
  * ```ts
98
95
  * class UIInput extends FormAssociable(UIElement) {
96
+ * #internals = this.attachInternals();
99
97
  * onFormDisabled(disabled: boolean) { this.#disabled.value = disabled; }
100
98
  * onFormReset() { this.textContent = ''; }
101
99
  * }
102
100
  * ```
103
101
  */
104
- function y(e) {
102
+ function d(e) {
105
103
  return class extends e {
106
104
  static formAssociated = !0;
107
105
  /** Override to handle form-initiated disabled state changes. */
@@ -122,10 +120,10 @@ function y(e) {
122
120
  formAssociatedCallback(e) {}
123
121
  };
124
122
  }
125
- function b(e, t) {
123
+ function f(e, t) {
126
124
  return e.label.toLowerCase().includes(t.toLowerCase());
127
125
  }
128
- var x = class {
126
+ var p = class {
129
127
  data;
130
128
  query;
131
129
  #e;
@@ -139,20 +137,20 @@ var x = class {
139
137
  #n;
140
138
  selectedItem;
141
139
  empty;
142
- constructor(e = {}) {
143
- this.data = t([]), this.query = t(""), this.#e = t(e.filterFn ?? b), this.#t = t(e.sortFn ?? null), this.#n = t(e.multiple ?? !1), this.activeIndex = t(e.initialActiveIndex ?? -1), this.value = t(null), this.selected = t(/* @__PURE__ */ new Set()), this.filtered = r(() => {
140
+ constructor(n = {}) {
141
+ this.data = t([]), this.query = t(""), this.#e = t(n.filterFn ?? f), this.#t = t(n.sortFn ?? null), this.#n = t(n.multiple ?? !1), this.activeIndex = t(n.initialActiveIndex ?? -1), this.value = t(null), this.selected = t(/* @__PURE__ */ new Set()), this.filtered = e(() => {
144
142
  let e = this.data.value, t = this.query.value, n = this.#e.value;
145
143
  return t ? e.filter((e) => n(e, t)) : e;
146
- }), this.sorted = r(() => {
144
+ }), this.sorted = e(() => {
147
145
  let e = this.filtered.value, t = this.#t.value;
148
146
  return t ? [...e].sort(t) : e;
149
- }), this.activeItem = r(() => {
147
+ }), this.activeItem = e(() => {
150
148
  let e = this.view.value, t = this.activeIndex.value;
151
149
  return t >= 0 && t < e.length ? e[t] : null;
152
- }), this.selectedItem = r(() => {
150
+ }), this.selectedItem = e(() => {
153
151
  let e = this.value.value;
154
152
  return e === null ? null : this.data.value.find((t) => t.value === e) ?? null;
155
- }), this.empty = r(() => this.view.value.length === 0);
153
+ }), this.empty = e(() => this.view.value.length === 0);
156
154
  }
157
155
  get view() {
158
156
  return this.sorted;
@@ -224,14 +222,14 @@ var x = class {
224
222
  this.#t.value = e;
225
223
  }
226
224
  };
227
- function S(e) {
228
- return new x(e);
225
+ function m(e) {
226
+ return new p(e);
229
227
  }
230
228
  /**
231
229
  * Validates a JSON string → typed option array.
232
230
  * Filters out entries missing `value` or `label` strings.
233
231
  */
234
- function C(e, t) {
232
+ function h(e, t) {
235
233
  try {
236
234
  let t = JSON.parse(e);
237
235
  return Array.isArray(t) ? t.filter((e) => typeof e == "object" && !!e && typeof e.value == "string" && typeof e.label == "string") : [];
@@ -244,7 +242,7 @@ function C(e, t) {
244
242
  * Aborts any in-flight request before starting a new one.
245
243
  * Returns the new AbortController for the caller to store.
246
244
  */
247
- async function w(e, t, n, r) {
245
+ async function g(e, t, n, r) {
248
246
  t?.abort();
249
247
  let i = new AbortController();
250
248
  try {
@@ -265,14 +263,14 @@ async function w(e, t, n, r) {
265
263
  * @attr {string} type - Form button type: "button" | "submit" | "reset"
266
264
  * @fires ui-press - Fired on activation (click, Enter, Space)
267
265
  */
268
- var ee = class extends y(c) {
266
+ var _ = class extends d(s) {
269
267
  static observedAttributes = ["disabled", "type"];
270
268
  #e;
271
269
  #t;
272
270
  #n;
273
271
  #r;
274
272
  constructor() {
275
- super(), this.#e = this.attachInternals(), this.#e.role = "button", this.#t = _(this, "disabled", { type: "boolean" }), this.#n = _(this, "type", {
273
+ super(), this.#e = this.attachInternals(), this.#e.role = "button", this.#t = l(this, "disabled", { type: "boolean" }), this.#n = l(this, "type", {
276
274
  type: "string",
277
275
  initial: "button"
278
276
  });
@@ -290,13 +288,13 @@ var ee = class extends y(c) {
290
288
  this.#n.set(e);
291
289
  }
292
290
  attributeChangedCallback(e, t, n) {
293
- t !== n && (v({
291
+ t !== n && (u({
294
292
  disabled: this.#t,
295
293
  type: this.#n
296
294
  }, e, n), super.attributeChangedCallback?.(e, t, n));
297
295
  }
298
296
  setup() {
299
- super.setup(), this.#r = new f(this, { disabled: () => this.disabled }), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.addEffect(g(this, this.#t.signal, this.#e, { manageTabindex: !0 })), this.addEventListener("ui-press", this.#i);
297
+ super.setup(), this.#r = new i(this, { disabled: () => this.disabled }), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.addEffect(c(this, this.#t.signal, this.#e, { manageTabindex: !0 })), this.addEventListener("ui-press", this.#i);
300
298
  }
301
299
  teardown() {
302
300
  this.removeEventListener("ui-press", this.#i), this.#r.destroy(), super.teardown();
@@ -314,129 +312,7 @@ var ee = class extends y(c) {
314
312
  onFormReset() {
315
313
  this.#t.signal.value = this.hasAttribute("disabled");
316
314
  }
317
- }, te = class extends y(c) {
318
- static observedAttributes = [
319
- "value",
320
- "placeholder",
321
- "disabled",
322
- "readonly",
323
- "required",
324
- "name"
325
- ];
326
- #e;
327
- #t = t(!1);
328
- #n = t(!1);
329
- #r = t("");
330
- #i = [];
331
- constructor() {
332
- super(), this.#e = this.attachInternals(), this.#e.role = "textbox";
333
- }
334
- get value() {
335
- return this.#a();
336
- }
337
- set value(e) {
338
- this.#o(e), this.#r.value = e, this.#e.setFormValue(e), this.#s();
339
- }
340
- #a() {
341
- let e = "";
342
- for (let t of this.childNodes) t.nodeType === Node.TEXT_NODE && (e += t.textContent);
343
- return e;
344
- }
345
- #o(e) {
346
- for (let e of [...this.childNodes]) e.nodeType === Node.TEXT_NODE && e.remove();
347
- e && this.append(e);
348
- }
349
- get placeholder() {
350
- return this.getAttribute("placeholder") ?? "";
351
- }
352
- set placeholder(e) {
353
- this.setAttribute("placeholder", e);
354
- }
355
- get name() {
356
- return this.getAttribute("name") ?? "";
357
- }
358
- set name(e) {
359
- this.setAttribute("name", e);
360
- }
361
- get disabled() {
362
- return this.#t.value;
363
- }
364
- set disabled(e) {
365
- this.#t.value = e, this.toggleAttribute("disabled", e);
366
- }
367
- get readOnly() {
368
- return this.hasAttribute("readonly");
369
- }
370
- set readOnly(e) {
371
- this.toggleAttribute("readonly", e), this.setAttribute("contenteditable", e ? "false" : "plaintext-only");
372
- }
373
- get required() {
374
- return this.#n.value;
375
- }
376
- set required(e) {
377
- this.#n.value = e, this.toggleAttribute("required", e);
378
- }
379
- attributeChangedCallback(e, t, n) {
380
- if (t !== n) {
381
- switch (e) {
382
- case "value":
383
- this.#o(n ?? ""), this.#r.value = n ?? "", this.#e.setFormValue(n ?? ""), this.#s();
384
- break;
385
- case "disabled":
386
- this.#t.value = n !== null, this.setAttribute("contenteditable", n !== null || this.hasAttribute("readonly") ? "false" : "plaintext-only");
387
- break;
388
- case "readonly":
389
- this.setAttribute("contenteditable", n !== null || this.#t.value ? "false" : "plaintext-only");
390
- break;
391
- case "required":
392
- this.#n.value = n !== null;
393
- break;
394
- }
395
- super.attributeChangedCallback?.(e, t, n);
396
- }
397
- }
398
- setup() {
399
- super.setup(), this.hasAttribute("contenteditable") || this.setAttribute("contenteditable", "plaintext-only"), this.#i = [...this.querySelectorAll(":scope > [slot]")];
400
- for (let e of this.#i) e.setAttribute("contenteditable", "false");
401
- this.#n.value = this.hasAttribute("required"), this.#r.value = this.#a(), this.#s(), this.addEffect(g(this, this.#t, this.#e, { manageTabindex: !0 })), this.addEffect(() => {
402
- this.#n.value && this.#r.value === "" ? this.#e.setValidity({ valueMissing: !0 }, "Please fill out this field.", this) : this.#e.setValidity({});
403
- }), this.addEventListener("input", this.#c), this.addEventListener("blur", this.#l);
404
- }
405
- teardown() {
406
- this.removeEventListener("input", this.#c), this.removeEventListener("blur", this.#l), super.teardown();
407
- }
408
- select() {
409
- let e = document.createRange();
410
- e.selectNodeContents(this);
411
- let t = window.getSelection();
412
- t?.removeAllRanges(), t?.addRange(e);
413
- }
414
- onFormDisabled(e) {
415
- this.#t.value = e, this.setAttribute("contenteditable", e || this.hasAttribute("readonly") ? "false" : "plaintext-only");
416
- }
417
- onFormReset() {
418
- this.#o(""), this.#r.value = "", this.#e.setFormValue(""), this.#s(), this.#t.value = this.hasAttribute("disabled");
419
- }
420
- #s() {
421
- this.#a().trim() === "" ? this.#e.states.add("empty") : this.#e.states.delete("empty");
422
- }
423
- #c = () => {
424
- for (let e of this.#i) e.parentNode || this.appendChild(e);
425
- let e = this.#a();
426
- this.#r.value = e, this.#e.setFormValue(e), this.#s(), this.dispatchEvent(new CustomEvent("ui-input", {
427
- bubbles: !0,
428
- composed: !0,
429
- detail: { value: e }
430
- }));
431
- };
432
- #l = () => {
433
- this.dispatchEvent(new CustomEvent("ui-change", {
434
- bubbles: !0,
435
- composed: !0,
436
- detail: { value: this.#a() }
437
- }));
438
- };
439
- }, ne = class extends c {
315
+ }, v = class extends s {
440
316
  static observedAttributes = [
441
317
  "disabled",
442
318
  "multiple",
@@ -445,10 +321,10 @@ var ee = class extends y(c) {
445
321
  #e;
446
322
  #t;
447
323
  #n = t(!1);
448
- #r = new x();
324
+ #r = new p();
449
325
  #i;
450
326
  constructor() {
451
- super(), this.#e = this.attachInternals(), this.#e.role = "listbox", this.#t = _(this, "disabled", { type: "boolean" });
327
+ super(), this.#e = this.attachInternals(), this.#e.role = "listbox", this.#t = l(this, "disabled", { type: "boolean" });
452
328
  }
453
329
  get virtualFocus() {
454
330
  return this.hasAttribute("virtual-focus");
@@ -479,7 +355,7 @@ var ee = class extends y(c) {
479
355
  }
480
356
  attributeChangedCallback(e, t, n) {
481
357
  if (t !== n) {
482
- if (v({ disabled: this.#t }, e, n)) {
358
+ if (u({ disabled: this.#t }, e, n)) {
483
359
  super.attributeChangedCallback?.(e, t, n);
484
360
  return;
485
361
  }
@@ -495,7 +371,7 @@ var ee = class extends y(c) {
495
371
  }
496
372
  }
497
373
  setup() {
498
- super.setup(), this.#i = new d(this, {
374
+ super.setup(), this.#i = new o(this, {
499
375
  itemSelector: ":scope ui-option:not([disabled])",
500
376
  autoSync: !1,
501
377
  orientation: "vertical",
@@ -510,7 +386,7 @@ var ee = class extends y(c) {
510
386
  },
511
387
  addEffect: (e) => this.addEffect(e),
512
388
  deferChildren: (e) => this.deferChildren(e)
513
- }), this.addEffect(g(this, this.#t.signal, this.#e)), this.deferChildren(() => {
389
+ }), this.addEffect(c(this, this.#t.signal, this.#e)), this.deferChildren(() => {
514
390
  this.addEffect(() => {
515
391
  let e = this.#r.value.value, t = this.#r.selected.value, n = this.#n.value, r = this.querySelectorAll(":scope ui-option");
516
392
  for (let i of r) {
@@ -519,7 +395,11 @@ var ee = class extends y(c) {
519
395
  }
520
396
  }), this.addEffect(() => {
521
397
  let e = this.#r.activeIndex.value, t = this.querySelectorAll(":scope ui-option:not([disabled])");
522
- for (let n = 0; n < t.length; n++) t[n].toggleAttribute("active", n === e);
398
+ for (let n = 0; n < t.length; n++) {
399
+ let i = t[n], a = n === e;
400
+ i.toggleAttribute("active", a), a && (i.id ||= r("opt"), this.setAttribute("aria-activedescendant", i.id));
401
+ }
402
+ (e < 0 || e >= t.length) && this.removeAttribute("aria-activedescendant");
523
403
  });
524
404
  });
525
405
  }
@@ -530,7 +410,7 @@ var ee = class extends y(c) {
530
410
  let e = this.#r.activeIndex.value;
531
411
  return this.querySelectorAll(":scope ui-option:not([disabled])")[e] ?? null;
532
412
  }
533
- }, re = class extends c {
413
+ }, y = class extends s {
534
414
  static observedAttributes = [
535
415
  "value",
536
416
  "disabled",
@@ -541,7 +421,7 @@ var ee = class extends y(c) {
541
421
  #n;
542
422
  #r = t("");
543
423
  constructor() {
544
- super(), this.#e = this.attachInternals(), this.#e.role = "option", this.#n = _(this, "disabled", { type: "boolean" });
424
+ super(), this.#e = this.attachInternals(), this.#e.role = "option", this.#n = l(this, "disabled", { type: "boolean" });
545
425
  }
546
426
  get value() {
547
427
  return this.#t.value;
@@ -563,7 +443,7 @@ var ee = class extends y(c) {
563
443
  }
564
444
  attributeChangedCallback(e, t, n) {
565
445
  if (t !== n) {
566
- if (v({ disabled: this.#n }, e, n)) {
446
+ if (u({ disabled: this.#n }, e, n)) {
567
447
  super.attributeChangedCallback?.(e, t, n);
568
448
  return;
569
449
  }
@@ -579,7 +459,7 @@ var ee = class extends y(c) {
579
459
  }
580
460
  }
581
461
  setup() {
582
- super.setup(), this.addEffect(g(this, this.#n.signal, this.#e)), this.addEventListener("click", this.#i);
462
+ super.setup(), this.addEffect(c(this, this.#n.signal, this.#e)), this.addEventListener("click", this.#i);
583
463
  }
584
464
  teardown() {
585
465
  this.removeEventListener("click", this.#i), super.teardown();
@@ -594,165 +474,75 @@ var ee = class extends y(c) {
594
474
  }
595
475
  }));
596
476
  };
597
- }, ie = class extends c {
598
- constructor() {
599
- super();
600
- let e = this.attachInternals();
601
- e.role = "presentation";
602
- }
603
- setup() {
604
- super.setup(), this.id ||= e("ogh");
605
- let t = this.closest("ui-option-group");
606
- t && t.setAttribute("aria-labelledby", this.id);
607
- }
608
- }, ae = class extends c {
609
- constructor() {
610
- super();
611
- let e = this.attachInternals();
612
- e.role = "group";
613
- }
614
- }, oe = class extends c {
615
- static observedAttributes = ["disabled"];
616
- #e;
617
- #t = new x({ initialActiveIndex: 0 });
618
- #n = t(!1);
619
- constructor() {
620
- super(), this.#e = this.attachInternals();
621
- }
622
- get store() {
623
- return this.#t;
624
- }
625
- get disabled() {
626
- return this.#n.value;
477
+ }, b = class {
478
+ open = t(!1);
479
+ value = t(null);
480
+ label = t("");
481
+ toggle() {
482
+ this.open.value = !this.open.value;
627
483
  }
628
- set disabled(e) {
629
- this.#n.value = e, this.toggleAttribute("disabled", e);
484
+ show() {
485
+ this.open.value = !0;
630
486
  }
631
- attributeChangedCallback(e, t, n) {
632
- t !== n && (e === "disabled" && (this.#n.value = n !== null), super.attributeChangedCallback?.(e, t, n));
487
+ hide() {
488
+ this.open.value = !1;
633
489
  }
634
- setup() {
635
- super.setup(), this.addEffect(g(this, this.#n, this.#e)), this.addEventListener("ui-input", this.#i), this.addEventListener("ui-select", this.#a), this.addEventListener("keydown", this.#o), this.deferChildren(() => {
636
- this.addEffect(() => {
637
- let e = this.#t.query.value.toLowerCase().trim(), t = this.querySelectorAll("ui-command-item");
638
- for (let n of t) {
639
- let t = !e || n.searchText.includes(e);
640
- n.toggleAttribute("hidden", !t);
641
- }
642
- }), this.addEffect(() => {
643
- this.#t.query.value;
644
- let e = this.#t.activeIndex.value, t = this.#r();
645
- for (let n = 0; n < t.length; n++) t[n].toggleAttribute("active", n === e);
646
- let n = t[e];
647
- n && n.scrollIntoView({ block: "nearest" });
648
- }), this.addEffect(() => {
649
- this.#t.query.value;
650
- let e = this.#r(), t = this.querySelector("ui-command-empty");
651
- t && t.toggleAttribute("hidden", e.length > 0);
652
- });
490
+ select(e, t) {
491
+ n(() => {
492
+ this.value.value = e, this.label.value = t, this.open.value = !1;
653
493
  });
654
494
  }
655
- teardown() {
656
- this.removeEventListener("ui-input", this.#i), this.removeEventListener("ui-select", this.#a), this.removeEventListener("keydown", this.#o), super.teardown();
657
- }
658
- #r() {
659
- return [...this.querySelectorAll("ui-command-item:not([hidden]):not([disabled])")];
660
- }
661
- #i = (e) => {
662
- if (this.#n.value) return;
663
- let t = e.detail;
664
- this.#t.setQuery(t.value, 0);
665
- };
666
- #a = (e) => {
667
- if (this.#n.value) return;
668
- let t = e.detail;
669
- this.dispatchEvent(new CustomEvent("ui-change", {
670
- bubbles: !0,
671
- composed: !0,
672
- detail: t
673
- }));
674
- };
675
- #o = (e) => {
676
- if (this.#n.value) return;
677
- let t = this.#r();
678
- if (!(t.length === 0 && e.key !== "Escape")) switch (e.key) {
679
- case "ArrowDown":
680
- e.preventDefault(), this.#t.moveActive(1, t.length);
681
- break;
682
- case "ArrowUp":
683
- e.preventDefault(), this.#t.moveActive(-1, t.length);
684
- break;
685
- case "Home":
686
- e.preventDefault(), this.#t.activeIndex.value = 0;
687
- break;
688
- case "End":
689
- e.preventDefault(), this.#t.activeIndex.value = Math.max(0, t.length - 1);
690
- break;
691
- case "Enter": {
692
- e.preventDefault();
693
- let n = t[this.#t.activeIndex.value];
694
- n && n.click();
695
- break;
696
- }
697
- case "Escape":
698
- this.dispatchEvent(new CustomEvent("ui-dismiss", {
699
- bubbles: !0,
700
- composed: !0
701
- }));
702
- break;
703
- }
704
- };
705
- }, se = class extends c {
706
- #e = null;
707
- setup() {
708
- super.setup(), this.deferChildren(() => {
709
- this.#e = this.querySelector("input"), this.#e && this.#e.addEventListener("input", this.#t);
495
+ reset() {
496
+ n(() => {
497
+ this.open.value = !1, this.value.value = null, this.label.value = "";
710
498
  });
711
499
  }
712
- teardown() {
713
- this.#e && this.#e.removeEventListener("input", this.#t), this.#e = null, super.teardown();
714
- }
715
- get inputElement() {
716
- return this.#e;
717
- }
718
- focus(e) {
719
- this.#e?.focus(e);
720
- }
721
- clear() {
722
- this.#e && (this.#e.value = "", this.#t());
723
- }
724
- #t = () => {
725
- let e = this.#e?.value ?? "";
726
- this.dispatchEvent(new CustomEvent("ui-input", {
727
- bubbles: !0,
728
- composed: !0,
729
- detail: { value: e }
730
- }));
731
- };
732
- }, ce = class extends c {
733
- constructor() {
734
- super();
735
- let e = this.attachInternals();
736
- e.role = "listbox";
737
- }
738
- }, le = class extends c {
500
+ }, x = class extends d(s) {
739
501
  static observedAttributes = [
740
502
  "value",
741
503
  "disabled",
742
- "keywords"
504
+ "name",
505
+ "options",
506
+ "src",
507
+ "placeholder",
508
+ "required"
743
509
  ];
744
510
  #e;
745
- #t = t("");
511
+ #t = new b();
746
512
  #n = t(!1);
747
- #r = t("");
513
+ #r = t(!1);
514
+ #i;
515
+ #a = t([]);
516
+ #o = t(null);
517
+ #s = t("");
518
+ #c = !1;
519
+ #l = null;
520
+ #u = null;
521
+ #d = null;
522
+ #f = null;
523
+ #p = "";
748
524
  constructor() {
749
- super(), this.#e = this.attachInternals(), this.#e.role = "option";
525
+ super(), this.#e = this.attachInternals();
526
+ }
527
+ get controller() {
528
+ return this.#t;
750
529
  }
751
530
  get value() {
752
- return this.#t.value;
531
+ return this.#t.value.value;
753
532
  }
754
533
  set value(e) {
755
- this.#t.value = e, this.getAttribute("value") !== e && this.setAttribute("value", e);
534
+ if (e === null) {
535
+ this.#t.reset();
536
+ return;
537
+ }
538
+ let t = this.querySelector(`ui-option[value="${CSS.escape(e)}"]`), n = t?.getAttribute("label") ?? t?.textContent?.trim() ?? e;
539
+ this.#t.select(e, n);
540
+ }
541
+ get name() {
542
+ return this.getAttribute("name") ?? "";
543
+ }
544
+ set name(e) {
545
+ this.setAttribute("name", e);
756
546
  }
757
547
  get disabled() {
758
548
  return this.#n.value;
@@ -760,3482 +550,247 @@ var ee = class extends y(c) {
760
550
  set disabled(e) {
761
551
  this.#n.value = e, this.toggleAttribute("disabled", e);
762
552
  }
763
- get keywords() {
553
+ get required() {
764
554
  return this.#r.value;
765
555
  }
766
- set keywords(e) {
767
- this.#r.value = e, e ? this.getAttribute("keywords") !== e && this.setAttribute("keywords", e) : this.removeAttribute("keywords");
556
+ set required(e) {
557
+ this.#r.value = e, this.toggleAttribute("required", e);
768
558
  }
769
- get label() {
770
- return this.textContent?.trim() || "";
559
+ get options() {
560
+ return this.#a.value;
561
+ }
562
+ set options(e) {
563
+ this.#a.value = e, this.setAttribute("options", JSON.stringify(e));
564
+ }
565
+ get src() {
566
+ return this.#o.value;
567
+ }
568
+ set src(e) {
569
+ this.#o.value = e, e == null ? this.removeAttribute("src") : this.setAttribute("src", e);
570
+ }
571
+ get placeholder() {
572
+ return this.#s.value;
573
+ }
574
+ set placeholder(e) {
575
+ this.#s.value = e, e ? this.setAttribute("placeholder", e) : this.removeAttribute("placeholder");
576
+ }
577
+ #m(e) {
578
+ return h(e, "ui-select");
579
+ }
580
+ async #h(e) {
581
+ this.#l = await g(e, this.#l, this.#a, "ui-select");
771
582
  }
772
- get searchText() {
773
- return `${this.label} ${this.#t.value} ${this.#r.value}`.toLowerCase();
583
+ #g() {
584
+ let e = document.createElement("ui-button");
585
+ e.setAttribute("justify", "spread");
586
+ let t = document.createElement("span");
587
+ t.setAttribute("slot", "label"), t.textContent = this.#s.value || "\xA0", e.appendChild(t);
588
+ let n = document.createElement("ui-icon");
589
+ n.setAttribute("name", "caret-up-down"), n.setAttribute("slot", "trailing"), e.appendChild(n);
590
+ let r = document.createElement("ui-listbox");
591
+ r.setAttribute("popover", "manual"), this.appendChild(e), this.appendChild(r);
592
+ }
593
+ #_(e) {
594
+ let t = this.#u;
595
+ if (t) {
596
+ for (; t.firstChild;) t.removeChild(t.firstChild);
597
+ for (let n of e) {
598
+ let e = document.createElement("ui-option");
599
+ e.setAttribute("value", n.value), e.setAttribute("label", n.label), e.textContent = n.label, n.disabled && e.setAttribute("disabled", ""), t.appendChild(e);
600
+ }
601
+ }
774
602
  }
775
603
  attributeChangedCallback(e, t, n) {
776
604
  if (t !== n) {
777
605
  switch (e) {
778
606
  case "value":
779
- this.#t.value = n ?? "";
607
+ if (n !== null) {
608
+ let e = this.querySelector(`ui-option[value="${CSS.escape(n)}"]`), t = e?.getAttribute("label") ?? e?.textContent?.trim() ?? n;
609
+ this.#t.select(n, t);
610
+ } else this.#t.reset();
780
611
  break;
781
612
  case "disabled":
782
613
  this.#n.value = n !== null;
783
614
  break;
784
- case "keywords":
785
- this.#r.value = n ?? "";
615
+ case "required":
616
+ this.#r.value = n !== null;
617
+ break;
618
+ case "options":
619
+ n ? this.#a.value = this.#m(n) : this.#a.value = [];
620
+ break;
621
+ case "src":
622
+ this.#o.value = n;
623
+ break;
624
+ case "placeholder":
625
+ this.#s.value = n ?? "";
786
626
  break;
787
627
  }
788
628
  super.attributeChangedCallback?.(e, t, n);
789
629
  }
790
630
  }
791
631
  setup() {
792
- super.setup(), this.addEffect(g(this, this.#n, this.#e)), this.addEventListener("click", this.#i);
793
- }
794
- teardown() {
795
- this.removeEventListener("click", this.#i), super.teardown();
796
- }
797
- #i = () => {
798
- this.#n.value || this.dispatchEvent(new CustomEvent("ui-select", {
799
- bubbles: !0,
800
- composed: !0,
801
- detail: {
802
- value: this.#t.value,
803
- label: this.label
804
- }
805
- }));
806
- };
807
- }, T = class extends c {
808
- constructor() {
809
- super();
810
- let e = this.attachInternals();
811
- e.role = "group";
812
- }
813
- }, E = class extends c {}, D = class extends y(c) {
814
- static observedAttributes = [
815
- "checked",
816
- "indeterminate",
817
- "disabled",
818
- "name",
819
- "value",
820
- "required"
821
- ];
822
- #e;
823
- #t;
824
- #n;
825
- #r;
826
- #i = t(!1);
827
- #a = !1;
828
- #o;
829
- constructor() {
830
- super(), this.#e = this.attachInternals(), this.#e.role = "checkbox", this.#t = _(this, "checked", { type: "boolean" }), this.#n = _(this, "indeterminate", { type: "boolean" }), this.#r = _(this, "disabled", { type: "boolean" });
831
- }
832
- get checked() {
833
- return this.#t.value;
834
- }
835
- set checked(e) {
836
- this.#t.set(e);
837
- }
838
- get indeterminate() {
839
- return this.#n.value;
840
- }
841
- set indeterminate(e) {
842
- this.#n.set(e);
843
- }
844
- get disabled() {
845
- return this.#r.value;
846
- }
847
- set disabled(e) {
848
- this.#r.set(e);
849
- }
850
- get name() {
851
- return this.getAttribute("name") ?? "";
852
- }
853
- set name(e) {
854
- this.setAttribute("name", e);
855
- }
856
- get value() {
857
- return this.getAttribute("value") ?? "on";
858
- }
859
- set value(e) {
860
- this.setAttribute("value", e);
861
- }
862
- get required() {
863
- return this.#i.value;
864
- }
865
- set required(e) {
866
- this.#i.value = e, this.toggleAttribute("required", e);
867
- }
868
- attributeChangedCallback(e, t, n) {
869
- if (t !== n) {
870
- if (v({
871
- checked: this.#t,
872
- indeterminate: this.#n,
873
- disabled: this.#r
874
- }, e, n)) {
875
- super.attributeChangedCallback?.(e, t, n);
876
- return;
877
- }
878
- e === "required" && (this.#i.value = n !== null), super.attributeChangedCallback?.(e, t, n);
632
+ if (super.setup(), this.#i = new a(this), this.#c = this.hasAttribute("options") || this.hasAttribute("src"), this.#c) {
633
+ let e = this.getAttribute("options");
634
+ e && (this.#a.value = this.#m(e)), this.#o.value = this.getAttribute("src"), this.#s.value = this.getAttribute("placeholder") ?? "", this.#g();
879
635
  }
880
- }
881
- setup() {
882
- super.setup(), this.#o = new f(this, { disabled: () => this.disabled }), this.#a = this.hasAttribute("checked"), this.#i.value = this.hasAttribute("required"), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.addEffect(g(this, this.#r.signal, this.#e, { manageTabindex: !0 })), this.addEffect(() => {
883
- let e = this.#t.value, t = this.#n.value ? "mixed" : e ? "true" : "false";
884
- this.setAttribute("aria-checked", t), this.#e.setFormValue(e ? this.value : null);
636
+ let e = this.querySelector(":scope > ui-button");
637
+ this.#d = e;
638
+ let t = this.querySelector(":scope > ui-listbox[popover]");
639
+ this.#u = t, t?.setAttribute("popover", "manual"), e && t && this.#i.wirePopover(e, t), e?.setAttribute("aria-haspopup", "listbox"), e && t && (t.id ||= r("lb"), e.setAttribute("aria-controls", t.id)), this.#c && (this.addEffect(() => {
640
+ let e = this.#a.value;
641
+ this.#_(e);
885
642
  }), this.addEffect(() => {
886
- let e = this.#i.value;
887
- this.#e.ariaRequired = e ? "true" : null;
643
+ let e = this.#o.value;
644
+ e && this.#h(e);
888
645
  }), this.addEffect(() => {
889
- this.#i.value && !this.#t.value ? this.#e.setValidity({ valueMissing: !0 }, "Please check this box if you want to proceed.", this) : this.#e.setValidity({});
890
- }), this.addEventListener("ui-press", this.#s);
891
- }
892
- teardown() {
893
- this.removeEventListener("ui-press", this.#s), this.#o.destroy(), super.teardown();
894
- }
895
- onFormDisabled(e) {
896
- this.#r.signal.value = e;
897
- }
898
- onFormReset() {
899
- this.#t.set(this.#a), this.#n.set(!1);
900
- }
901
- #s = () => {
902
- this.#r.value || (this.#n.value ? (this.indeterminate = !1, this.checked = !0) : this.checked = !this.#t.value, this.dispatchEvent(new CustomEvent("ui-change", {
903
- bubbles: !0,
904
- composed: !0,
905
- detail: {
906
- checked: this.#t.value,
907
- value: this.value
908
- }
909
- })));
910
- };
911
- }, O = class extends y(c) {
912
- static observedAttributes = [
913
- "checked",
914
- "disabled",
915
- "name",
916
- "value"
917
- ];
918
- #e;
919
- #t;
920
- #n;
921
- #r = !1;
922
- #i;
923
- constructor() {
924
- super(), this.#e = this.attachInternals(), this.#e.role = "switch", this.#t = _(this, "checked", { type: "boolean" }), this.#n = _(this, "disabled", { type: "boolean" });
925
- }
926
- get checked() {
927
- return this.#t.value;
928
- }
929
- set checked(e) {
930
- this.#t.set(e);
931
- }
932
- get disabled() {
933
- return this.#n.value;
934
- }
935
- set disabled(e) {
936
- this.#n.set(e);
937
- }
938
- get name() {
939
- return this.getAttribute("name") ?? "";
940
- }
941
- set name(e) {
942
- this.setAttribute("name", e);
943
- }
944
- get value() {
945
- return this.getAttribute("value") ?? "on";
946
- }
947
- set value(e) {
948
- this.setAttribute("value", e);
949
- }
950
- attributeChangedCallback(e, t, n) {
951
- t !== n && (v({
952
- checked: this.#t,
953
- disabled: this.#n
954
- }, e, n), super.attributeChangedCallback?.(e, t, n));
955
- }
956
- setup() {
957
- super.setup(), this.#i = new f(this, { disabled: () => this.disabled }), this.#r = this.hasAttribute("checked"), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.addEffect(g(this, this.#n.signal, this.#e, { manageTabindex: !0 })), this.addEffect(() => {
958
- let e = this.#t.value;
959
- this.setAttribute("aria-checked", e ? "true" : "false"), this.#e.setFormValue(e ? this.value : null);
960
- }), this.addEventListener("ui-press", this.#a);
961
- }
962
- teardown() {
963
- this.removeEventListener("ui-press", this.#a), this.#i.destroy(), super.teardown();
964
- }
965
- onFormDisabled(e) {
966
- this.#n.signal.value = e;
967
- }
968
- onFormReset() {
969
- this.#t.set(this.#r);
970
- }
971
- #a = () => {
972
- this.#n.value || (this.checked = !this.#t.value, this.dispatchEvent(new CustomEvent("ui-change", {
973
- bubbles: !0,
974
- composed: !0,
975
- detail: {
976
- checked: this.#t.value,
977
- value: this.value
978
- }
979
- })));
980
- };
981
- }, k = class extends c {
982
- static observedAttributes = ["value", "disabled"];
983
- #e;
984
- #t;
985
- #n;
986
- constructor() {
987
- super(), this.#e = this.attachInternals(), this.#e.role = "radio", this.#t = _(this, "disabled", { type: "boolean" });
988
- }
989
- get value() {
990
- return this.getAttribute("value") ?? "";
991
- }
992
- set value(e) {
993
- this.setAttribute("value", e);
994
- }
995
- get disabled() {
996
- return this.#t.value;
997
- }
998
- set disabled(e) {
999
- this.#t.set(e);
1000
- }
1001
- get label() {
1002
- return this.getAttribute("label") ?? this.textContent?.trim() ?? "";
1003
- }
1004
- attributeChangedCallback(e, t, n) {
1005
- t !== n && (v({ disabled: this.#t }, e, n), super.attributeChangedCallback?.(e, t, n));
1006
- }
1007
- setup() {
1008
- super.setup(), this.setAttribute("aria-checked", "false"), this.#n = new f(this, { disabled: () => this.disabled }), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "-1"), this.addEffect(g(this, this.#t.signal, this.#e)), this.addEventListener("click", this.#r), this.addEventListener("keydown", this.#i);
1009
- }
1010
- teardown() {
1011
- this.removeEventListener("click", this.#r), this.removeEventListener("keydown", this.#i), this.#n.destroy(), super.teardown();
1012
- }
1013
- #r = () => {
1014
- this.disabled || this.dispatchEvent(new CustomEvent("ui-select", {
1015
- bubbles: !0,
1016
- composed: !0,
1017
- detail: {
1018
- value: this.value,
1019
- label: this.label
1020
- }
1021
- }));
1022
- };
1023
- #i = (e) => {
1024
- e.key !== "Enter" && e.key !== " " || this.disabled || (e.preventDefault(), this.dispatchEvent(new CustomEvent("ui-select", {
1025
- bubbles: !0,
1026
- composed: !0,
1027
- detail: {
1028
- value: this.value,
1029
- label: this.label
1030
- }
1031
- })));
1032
- };
1033
- }, A = class extends y(c) {
1034
- static observedAttributes = [
1035
- "value",
1036
- "disabled",
1037
- "name",
1038
- "required",
1039
- "orientation"
1040
- ];
1041
- #e;
1042
- #t = t(!1);
1043
- #n = t(!1);
1044
- #r = null;
1045
- #i;
1046
- constructor() {
1047
- super(), this.#e = this.attachInternals(), this.#e.role = "radiogroup";
1048
- }
1049
- get value() {
1050
- return this.#i?.listValue.value ?? null;
1051
- }
1052
- set value(e) {
1053
- this.#i && (this.#i.listValue.value = e), e === null ? this.removeAttribute("value") : this.setAttribute("value", e);
1054
- }
1055
- get disabled() {
1056
- return this.#t.value;
1057
- }
1058
- set disabled(e) {
1059
- this.#t.value = e, this.toggleAttribute("disabled", e);
1060
- }
1061
- get name() {
1062
- return this.getAttribute("name") ?? "";
1063
- }
1064
- set name(e) {
1065
- this.setAttribute("name", e);
1066
- }
1067
- get required() {
1068
- return this.#n.value;
1069
- }
1070
- set required(e) {
1071
- this.#n.value = e, this.toggleAttribute("required", e);
1072
- }
1073
- attributeChangedCallback(e, t, n) {
1074
- if (t !== n) {
1075
- switch (e) {
1076
- case "value":
1077
- this.#i && (this.#i.listValue.value = n);
1078
- break;
1079
- case "disabled":
1080
- this.#t.value = n !== null;
1081
- break;
1082
- case "required":
1083
- this.#n.value = n !== null;
1084
- break;
1085
- case "orientation":
1086
- this.#i && (this.#i.rovingFocus.orientation = n ?? "vertical");
1087
- break;
646
+ let t = this.#s.value, n = this.#t.label.value, r = e?.querySelector("[slot=\"label\"]");
647
+ r && !n && (r.textContent = t || "\xA0");
648
+ })), this.deferChildren(() => {
649
+ let n = this.getAttribute("value");
650
+ if (n) {
651
+ let e = this.querySelector(`ui-option[value="${CSS.escape(n)}"]`), t = e?.getAttribute("label") ?? e?.textContent?.trim() ?? n;
652
+ this.#t.value.value = n, this.#t.label.value = t, this.#f = n, this.#p = t;
1088
653
  }
1089
- super.attributeChangedCallback?.(e, t, n);
1090
- }
1091
- }
1092
- setup() {
1093
- super.setup(), this.#r = this.getAttribute("value"), this.#n.value = this.hasAttribute("required"), this.#i = new d(this, {
1094
- itemSelector: ":scope ui-radio:not([disabled])",
1095
- ariaAttr: "aria-checked",
1096
- orientation: "vertical",
1097
- onChildSelect: (e) => {
1098
- this.#i.listValue.value = e.value, this.setAttribute("value", e.value), this.dispatchEvent(new CustomEvent("ui-change", {
1099
- bubbles: !0,
1100
- composed: !0,
1101
- detail: e
1102
- }));
1103
- },
1104
- addEffect: (e) => this.addEffect(e),
1105
- deferChildren: (e) => this.deferChildren(e)
1106
- });
1107
- let e = this.getAttribute("value");
1108
- e !== null && (this.#i.listValue.value = e), this.addEffect(g(this, this.#t, this.#e)), this.addEffect(() => {
1109
- let e = this.#n.value;
1110
- this.#e.ariaRequired = e ? "true" : null;
1111
- }), this.addEffect(() => {
1112
- let e = this.#i.listValue.value;
1113
- this.#e.setFormValue(e);
1114
- }), this.addEffect(() => {
1115
- let e = this.#i.listValue.value;
1116
- this.#n.value && (e === null || e === "") ? this.#e.setValidity({ valueMissing: !0 }, "Please select one of these options.", this) : this.#e.setValidity({});
1117
- });
1118
- }
1119
- teardown() {
1120
- this.#i.destroy(), super.teardown();
1121
- }
1122
- onFormDisabled(e) {
1123
- this.#t.value = e;
1124
- }
1125
- onFormReset() {
1126
- this.#i && (this.#i.listValue.value = this.#r), this.#r === null ? this.removeAttribute("value") : this.setAttribute("value", this.#r);
1127
- }
1128
- }, j = class extends y(c) {
1129
- static observedAttributes = [
1130
- "value",
1131
- "disabled",
1132
- "name",
1133
- "required"
1134
- ];
1135
- #e;
1136
- #t = t(!1);
1137
- #n = t(!1);
1138
- #r = null;
1139
- #i;
1140
- constructor() {
1141
- super(), this.#e = this.attachInternals(), this.#e.role = "radiogroup";
1142
- }
1143
- get value() {
1144
- return this.#i?.listValue.value ?? null;
1145
- }
1146
- set value(e) {
1147
- this.#i && (this.#i.listValue.value = e), e === null ? this.removeAttribute("value") : this.setAttribute("value", e);
1148
- }
1149
- get disabled() {
1150
- return this.#t.value;
1151
- }
1152
- set disabled(e) {
1153
- this.#t.value = e, this.toggleAttribute("disabled", e);
1154
- }
1155
- get name() {
1156
- return this.getAttribute("name") ?? "";
1157
- }
1158
- set name(e) {
1159
- this.setAttribute("name", e);
1160
- }
1161
- get required() {
1162
- return this.#n.value;
1163
- }
1164
- set required(e) {
1165
- this.#n.value = e, this.toggleAttribute("required", e);
1166
- }
1167
- attributeChangedCallback(e, t, n) {
1168
- if (t !== n) {
1169
- switch (e) {
1170
- case "value":
1171
- this.#i && (this.#i.listValue.value = n);
1172
- break;
1173
- case "disabled":
1174
- this.#t.value = n !== null;
1175
- break;
1176
- case "required":
1177
- this.#n.value = n !== null;
1178
- break;
1179
- }
1180
- super.attributeChangedCallback?.(e, t, n);
1181
- }
1182
- }
1183
- setup() {
1184
- super.setup(), this.#r = this.getAttribute("value"), this.#i = new d(this, {
1185
- itemSelector: ":scope > ui-segment:not([disabled])",
1186
- ariaAttr: "aria-checked",
1187
- orientation: "horizontal",
1188
- onChildSelect: (e) => {
1189
- this.#i.listValue.value = e.value, this.setAttribute("value", e.value), this.dispatchEvent(new CustomEvent("ui-change", {
1190
- bubbles: !0,
1191
- composed: !0,
1192
- detail: e
1193
- }));
1194
- },
1195
- addEffect: (e) => this.addEffect(e),
1196
- deferChildren: (e) => this.deferChildren(e)
1197
- });
1198
- let e = this.getAttribute("value");
1199
- e !== null && (this.#i.listValue.value = e), this.addEffect(g(this, this.#t, this.#e)), this.#n.value = this.hasAttribute("required"), this.addEffect(() => {
1200
- let e = this.#i.listValue.value;
1201
- this.#n.value && (e === null || e === "") ? this.#e.setValidity({ valueMissing: !0 }, "Please select one of these options.", this) : this.#e.setValidity({});
1202
- }), this.addEffect(() => {
1203
- let e = this.#i.listValue.value;
1204
- this.#e.setFormValue(e);
1205
- }), this.deferChildren(() => {
1206
654
  this.addEffect(() => {
1207
- let e = this.#i.listValue.value, t = this.querySelectorAll(":scope > ui-segment"), n = -1, r = 0;
1208
- for (let i of t) (i.getAttribute("value") ?? "") === e && (n = r), r++;
1209
- this.#a(n, r);
1210
- });
1211
- });
1212
- }
1213
- teardown() {
1214
- this.#i.destroy(), super.teardown();
1215
- }
1216
- onFormDisabled(e) {
1217
- this.#t.value = e;
1218
- }
1219
- onFormReset() {
1220
- this.#i && (this.#i.listValue.value = this.#r), this.#r === null ? this.removeAttribute("value") : this.setAttribute("value", this.#r);
1221
- }
1222
- #a(e, t) {
1223
- if (e < 0) {
1224
- this.#e.states.delete("ready");
1225
- return;
1226
- }
1227
- this.style.setProperty("--_indicator-index", `${e}`), this.style.setProperty("--_segment-count", `${t}`), this.#e.states.add("ready");
1228
- }
1229
- }, M = class extends c {
1230
- static observedAttributes = ["value", "disabled"];
1231
- #e;
1232
- #t;
1233
- #n;
1234
- constructor() {
1235
- super(), this.#e = this.attachInternals(), this.#e.role = "radio", this.#t = _(this, "disabled", { type: "boolean" });
1236
- }
1237
- get value() {
1238
- return this.getAttribute("value") ?? "";
1239
- }
1240
- set value(e) {
1241
- this.setAttribute("value", e);
1242
- }
1243
- get disabled() {
1244
- return this.#t.value;
1245
- }
1246
- set disabled(e) {
1247
- this.#t.set(e);
1248
- }
1249
- get label() {
1250
- return this.getAttribute("label") ?? this.textContent?.trim() ?? "";
1251
- }
1252
- attributeChangedCallback(e, t, n) {
1253
- t !== n && (v({ disabled: this.#t }, e, n), super.attributeChangedCallback?.(e, t, n));
1254
- }
1255
- setup() {
1256
- super.setup(), this.#n = new f(this, { disabled: () => this.disabled }), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "-1"), this.addEffect(g(this, this.#t.signal, this.#e)), this.addEventListener("ui-press", this.#r);
1257
- }
1258
- teardown() {
1259
- this.removeEventListener("ui-press", this.#r), this.#n.destroy(), super.teardown();
1260
- }
1261
- #r = () => {
1262
- this.#t.value || this.dispatchEvent(new CustomEvent("ui-select", {
1263
- bubbles: !0,
1264
- composed: !0,
1265
- detail: {
1266
- value: this.value,
1267
- label: this.label
1268
- }
1269
- }));
1270
- };
1271
- }, N = class extends c {
1272
- static observedAttributes = [
1273
- "placement",
1274
- "delay",
1275
- "disabled"
1276
- ];
1277
- #e;
1278
- #t = t(!1);
1279
- #n = t(!1);
1280
- #r = null;
1281
- #i = null;
1282
- #a = "";
1283
- constructor() {
1284
- super(), this.#e = this.attachInternals();
1285
- }
1286
- get disabled() {
1287
- return this.#n.value;
1288
- }
1289
- set disabled(e) {
1290
- this.#n.value = e, this.toggleAttribute("disabled", e);
1291
- }
1292
- get placement() {
1293
- return this.getAttribute("placement") ?? "top";
1294
- }
1295
- set placement(e) {
1296
- this.setAttribute("placement", e);
1297
- }
1298
- get delay() {
1299
- return Number(this.getAttribute("delay") ?? 500);
1300
- }
1301
- set delay(e) {
1302
- this.setAttribute("delay", String(e));
1303
- }
1304
- attributeChangedCallback(e, t, n) {
1305
- t !== n && (e === "disabled" && (this.#n.value = n !== null), super.attributeChangedCallback?.(e, t, n));
1306
- }
1307
- setup() {
1308
- super.setup(), this.addEffect(g(this, this.#n, this.#e)), this.#i = this.parentElement, this.#i && (this.#a = e("tip"), this.#i.style.setProperty("anchor-name", `--${this.#a}`), this.style.setProperty("position-anchor", `--${this.#a}`), this.hasAttribute("popover") || this.setAttribute("popover", "manual"), this.id ||= e("tooltip"), this.#i.setAttribute("aria-describedby", this.id), this.#i.addEventListener("mouseenter", this.#o), this.#i.addEventListener("mouseleave", this.#s), this.#i.addEventListener("focusin", this.#o), this.#i.addEventListener("focusout", this.#s), this.#i.addEventListener("keydown", this.#c), this.addEffect(() => {
1309
- this.#n.value && this.#t.value && (this.#l(), this.#t.value = !1);
1310
- }), this.addEffect(() => {
1311
- if (this.#t.value) try {
1312
- this.showPopover();
1313
- } catch {}
1314
- else try {
1315
- this.hidePopover();
1316
- } catch {}
1317
- }));
1318
- }
1319
- teardown() {
1320
- this.#l(), this.#i &&= (this.#i.removeEventListener("mouseenter", this.#o), this.#i.removeEventListener("mouseleave", this.#s), this.#i.removeEventListener("focusin", this.#o), this.#i.removeEventListener("focusout", this.#s), this.#i.removeEventListener("keydown", this.#c), this.#i.removeAttribute("aria-describedby"), this.#i.style.removeProperty("anchor-name"), null), super.teardown();
1321
- }
1322
- #o = () => {
1323
- this.#n.value || (this.#l(), this.#r = setTimeout(() => {
1324
- this.#t.value = !0;
1325
- }, this.delay));
1326
- };
1327
- #s = () => {
1328
- this.#l(), this.#t.value = !1;
1329
- };
1330
- #c = (e) => {
1331
- e.key === "Escape" && this.#t.value && (this.#t.value = !1);
1332
- };
1333
- #l() {
1334
- this.#r !== null && (clearTimeout(this.#r), this.#r = null);
1335
- }
1336
- }, P = class extends c {
1337
- static observedAttributes = ["multiple", "disabled"];
1338
- #e = t(!1);
1339
- get multiple() {
1340
- return this.hasAttribute("multiple");
1341
- }
1342
- set multiple(e) {
1343
- this.toggleAttribute("multiple", e);
1344
- }
1345
- get disabled() {
1346
- return this.#e.value;
1347
- }
1348
- set disabled(e) {
1349
- this.#e.value = e, this.toggleAttribute("disabled", e);
1350
- }
1351
- attributeChangedCallback(e, t, n) {
1352
- t !== n && (e === "disabled" && (this.#e.value = n !== null), super.attributeChangedCallback?.(e, t, n));
1353
- }
1354
- setup() {
1355
- super.setup(), this.addEffect(g(this, this.#e)), this.addEventListener("toggle", this.#t, !0);
1356
- }
1357
- teardown() {
1358
- this.removeEventListener("toggle", this.#t, !0), super.teardown();
1359
- }
1360
- #t = (e) => {
1361
- if (this.multiple) return;
1362
- let t = e.target;
1363
- if (!t.open) return;
1364
- let n = t.closest("ui-accordion-item");
1365
- if (!n) return;
1366
- let r = this.querySelectorAll(":scope > ui-accordion-item[open]");
1367
- for (let e of r) e !== n && (e.open = !1);
1368
- };
1369
- }, F = class extends c {
1370
- static observedAttributes = ["open", "disabled"];
1371
- #e = t(!1);
1372
- #t = t(!1);
1373
- #n = null;
1374
- get open() {
1375
- return this.#e.value;
1376
- }
1377
- set open(e) {
1378
- this.#e.value = e, this.toggleAttribute("open", e);
1379
- }
1380
- get disabled() {
1381
- return this.#t.value;
1382
- }
1383
- set disabled(e) {
1384
- this.#t.value = e, this.toggleAttribute("disabled", e);
1385
- }
1386
- attributeChangedCallback(e, t, n) {
1387
- if (t !== n) {
1388
- switch (e) {
1389
- case "open":
1390
- this.#e.value = n !== null;
1391
- break;
1392
- case "disabled":
1393
- this.#t.value = n !== null;
1394
- break;
1395
- }
1396
- super.attributeChangedCallback?.(e, t, n);
1397
- }
1398
- }
1399
- setup() {
1400
- super.setup();
1401
- let e = document.createElement("details"), t = document.createElement("summary"), n = this.querySelector(":scope > [slot=\"heading\"]");
1402
- n && (n.removeAttribute("slot"), t.appendChild(n));
1403
- let r = document.createElement("div");
1404
- for (r.setAttribute("part", "content"); this.firstChild;) r.appendChild(this.firstChild);
1405
- e.appendChild(t), e.appendChild(r), this.appendChild(e), this.#n = e, this.addEffect(() => {
1406
- let e = this.#e.value;
1407
- this.#n && (this.#n.open = e);
1408
- }), this.addEffect(g(this, this.#t)), e.addEventListener("toggle", this.#r);
1409
- }
1410
- teardown() {
1411
- this.#n?.removeEventListener("toggle", this.#r), this.#n = null, super.teardown();
1412
- }
1413
- #r = () => {
1414
- if (!this.#n) return;
1415
- let e = this.#n.open;
1416
- this.#e.value = e, this.toggleAttribute("open", e);
1417
- };
1418
- }, I = class extends c {
1419
- static observedAttributes = ["no-close-on-escape", "no-close-on-backdrop"];
1420
- #e;
1421
- get open() {
1422
- return this.#e.open;
1423
- }
1424
- showModal() {
1425
- this.#e.showModal();
1426
- }
1427
- close() {
1428
- this.#e.close();
1429
- }
1430
- setup() {
1431
- super.setup(), this.#e = new h(this);
1432
- }
1433
- teardown() {
1434
- this.#e.destroy(), super.teardown();
1435
- }
1436
- }, L = class extends c {
1437
- static observedAttributes = [
1438
- "value",
1439
- "disabled",
1440
- "orientation"
1441
- ];
1442
- #e;
1443
- #t = t(!1);
1444
- #n;
1445
- constructor() {
1446
- super(), this.#e = this.attachInternals(), this.#e.role = "tablist";
1447
- }
1448
- get value() {
1449
- return this.#n?.listValue.value ?? null;
1450
- }
1451
- set value(e) {
1452
- this.#n && (this.#n.listValue.value = e), e === null ? this.removeAttribute("value") : this.setAttribute("value", e);
1453
- }
1454
- get disabled() {
1455
- return this.#t.value;
1456
- }
1457
- set disabled(e) {
1458
- this.#t.value = e, this.toggleAttribute("disabled", e);
1459
- }
1460
- attributeChangedCallback(e, t, n) {
1461
- if (t !== n) {
1462
- switch (e) {
1463
- case "value":
1464
- this.#n && (this.#n.listValue.value = n);
1465
- break;
1466
- case "disabled":
1467
- this.#t.value = n !== null;
1468
- break;
1469
- case "orientation":
1470
- this.#n && (this.#n.rovingFocus.orientation = n === "vertical" ? "vertical" : "horizontal");
1471
- break;
1472
- }
1473
- super.attributeChangedCallback?.(e, t, n);
1474
- }
1475
- }
1476
- setup() {
1477
- super.setup(), this.#n = new d(this, {
1478
- itemSelector: ":scope > ui-tab:not([disabled])",
1479
- orientation: "horizontal",
1480
- autoSync: !0,
1481
- onChildSelect: (e) => {
1482
- this.#n.listValue.value = e.value, this.setAttribute("value", e.value), this.dispatchEvent(new CustomEvent("ui-change", {
1483
- bubbles: !0,
1484
- composed: !0,
1485
- detail: e
1486
- }));
1487
- },
1488
- addEffect: (e) => this.addEffect(e),
1489
- deferChildren: (e) => this.deferChildren(e)
1490
- });
1491
- let e = this.getAttribute("value");
1492
- e !== null && (this.#n.listValue.value = e), this.addEffect(g(this, this.#t, this.#e)), this.deferChildren(() => {
1493
- this.#r(), this.addEffect(() => {
1494
- let e = this.#n.listValue.value, t = this.querySelectorAll(":scope > ui-tab"), n = this.querySelectorAll(":scope > ui-tab-panels > ui-tab-panel"), r = -1, i = 0;
1495
- for (let n of t) (n.getAttribute("value") ?? "") === e && (r = i), i++;
1496
- for (let t of n) {
1497
- let n = (t.getAttribute("value") ?? "") === e;
1498
- t.toggleAttribute("hidden", !n), t.setAttribute("tabindex", n ? "0" : "-1");
1499
- }
1500
- this.#i(r, i);
1501
- });
1502
- });
1503
- }
1504
- teardown() {
1505
- this.#n.destroy(), super.teardown();
1506
- }
1507
- #r() {
1508
- let t = this.querySelectorAll(":scope > ui-tab"), n = this.querySelectorAll(":scope > ui-tab-panels > ui-tab-panel"), r = /* @__PURE__ */ new Map();
1509
- for (let t of n) t.id ||= e("tp"), r.set(t.getAttribute("value") ?? "", t);
1510
- for (let n of t) {
1511
- n.id ||= e("tab");
1512
- let t = r.get(n.getAttribute("value") ?? "");
1513
- t && (n.setAttribute("aria-controls", t.id), t.setAttribute("aria-labelledby", n.id));
1514
- }
1515
- }
1516
- #i(e, t) {
1517
- if (e < 0) {
1518
- this.#e.states.delete("ready");
1519
- return;
1520
- }
1521
- this.style.setProperty("--_indicator-index", `${e}`), this.style.setProperty("--_tab-count", `${t}`), this.#e.states.add("ready");
1522
- }
1523
- }, R = class extends c {
1524
- static observedAttributes = ["value", "disabled"];
1525
- #e;
1526
- #t;
1527
- #n;
1528
- constructor() {
1529
- super(), this.#e = this.attachInternals(), this.#e.role = "tab", this.#t = _(this, "disabled", { type: "boolean" });
1530
- }
1531
- get value() {
1532
- return this.getAttribute("value") ?? "";
1533
- }
1534
- set value(e) {
1535
- this.setAttribute("value", e);
1536
- }
1537
- get disabled() {
1538
- return this.#t.value;
1539
- }
1540
- set disabled(e) {
1541
- this.#t.set(e);
1542
- }
1543
- get label() {
1544
- return this.getAttribute("label") ?? this.textContent?.trim() ?? "";
1545
- }
1546
- attributeChangedCallback(e, t, n) {
1547
- t !== n && (v({ disabled: this.#t }, e, n), super.attributeChangedCallback?.(e, t, n));
1548
- }
1549
- setup() {
1550
- super.setup(), this.#n = new f(this, { disabled: () => this.disabled }), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "-1"), this.addEffect(g(this, this.#t.signal, this.#e)), this.addEventListener("ui-press", this.#r);
1551
- }
1552
- teardown() {
1553
- this.removeEventListener("ui-press", this.#r), this.#n.destroy(), super.teardown();
1554
- }
1555
- #r = () => {
1556
- this.disabled || this.dispatchEvent(new CustomEvent("ui-select", {
1557
- bubbles: !0,
1558
- composed: !0,
1559
- detail: {
1560
- value: this.value,
1561
- label: this.label
1562
- }
1563
- }));
1564
- };
1565
- }, z = class extends c {
1566
- static observedAttributes = ["value"];
1567
- #e;
1568
- constructor() {
1569
- super(), this.#e = this.attachInternals(), this.#e.role = "tabpanel";
1570
- }
1571
- get value() {
1572
- return this.getAttribute("value") ?? "";
1573
- }
1574
- set value(e) {
1575
- this.setAttribute("value", e);
1576
- }
1577
- attributeChangedCallback(e, t, n) {
1578
- t !== n && super.attributeChangedCallback?.(e, t, n);
1579
- }
1580
- }, B = class extends c {
1581
- #e;
1582
- constructor() {
1583
- super(), this.#e = this.attachInternals(), this.#e.role = "presentation";
1584
- }
1585
- }, V = class {
1586
- sortColumn;
1587
- sortDirection;
1588
- selected;
1589
- columnWidths;
1590
- constructor(e = {}) {
1591
- this.sortColumn = t(e.sortColumn ?? null), this.sortDirection = t(e.sortDirection ?? "none"), this.selected = t(/* @__PURE__ */ new Set()), this.columnWidths = t([]);
1592
- }
1593
- toggleSort(e) {
1594
- if (this.sortColumn.value === e) {
1595
- let e = this.sortDirection.value;
1596
- this.sortDirection.value = e === "asc" ? "desc" : e === "desc" ? "none" : "asc", this.sortDirection.value === "none" && (this.sortColumn.value = null);
1597
- } else this.sortColumn.value = e, this.sortDirection.value = "asc";
1598
- }
1599
- select(e) {
1600
- let t = new Set(this.selected.value);
1601
- t.add(e), this.selected.value = t;
1602
- }
1603
- deselect(e) {
1604
- let t = new Set(this.selected.value);
1605
- t.delete(e), this.selected.value = t;
1606
- }
1607
- toggle(e) {
1608
- this.selected.value.has(e) ? this.deselect(e) : this.select(e);
1609
- }
1610
- selectAll(e) {
1611
- this.selected.value = new Set(e);
1612
- }
1613
- clearSelection() {
1614
- this.selected.value = /* @__PURE__ */ new Set();
1615
- }
1616
- isSelected(e) {
1617
- return this.selected.value.has(e);
1618
- }
1619
- };
1620
- function H(e = {}) {
1621
- return new V(e);
1622
- }
1623
- var U = class {
1624
- table;
1625
- #e = [];
1626
- #t = -1;
1627
- #n = 0;
1628
- #r = 0;
1629
- #i = !1;
1630
- #a;
1631
- #o;
1632
- constructor(e, t = {}) {
1633
- this.table = e, this.#a = t.minWidth ?? 48, this.#o = t.maxWidth ?? Infinity;
1634
- }
1635
- /** Call after table is in DOM and has computed layout. */
1636
- init() {
1637
- this.table.addEventListener("pointerdown", this.#l);
1638
- }
1639
- destroy() {
1640
- this.table.removeEventListener("pointerdown", this.#l), this.#m();
1641
- }
1642
- #s() {
1643
- this.#e = getComputedStyle(this.table).gridTemplateColumns.split(/\s+/).map((e) => parseFloat(e));
1644
- }
1645
- #c() {
1646
- this.table.style.gridTemplateColumns = this.#e.map((e) => `${e}px`).join(" ");
1647
- }
1648
- #l = (e) => {
1649
- if (e.button !== 0) return;
1650
- let t = e.target.closest?.(".table-resize-handle");
1651
- if (!t || !this.table.contains(t)) return;
1652
- let n = t.closest("ui-table-header");
1653
- if (!n) return;
1654
- let r = n.closest("ui-table-row");
1655
- if (!r) return;
1656
- let i = [...r.querySelectorAll("ui-table-header")];
1657
- this.#s();
1658
- let a = i.indexOf(n);
1659
- a === -1 || a >= this.#e.length || (e.preventDefault(), e.stopPropagation(), this.table.style.width || (this.table.style.width = `${this.table.offsetWidth}px`), this.#i = !0, this.#t = a, this.#n = e.clientX, this.#r = this.#e[a], t.setPointerCapture(e.pointerId), this.table.setAttribute("resizing", ""), document.addEventListener("pointermove", this.#u), document.addEventListener("pointerup", this.#d), document.addEventListener("pointercancel", this.#f), document.addEventListener("keydown", this.#p), this.table.dispatchEvent(new CustomEvent("ui-table-resize-start", {
1660
- bubbles: !0,
1661
- composed: !0,
1662
- detail: {
1663
- column: a,
1664
- width: this.#r
1665
- }
1666
- })));
1667
- };
1668
- #u = (e) => {
1669
- if (!this.#i) return;
1670
- let t = e.clientX - this.#n, n = Math.min(this.#o, Math.max(this.#a, this.#r + t));
1671
- this.#e[this.#t] = n, this.#c(), this.table.dispatchEvent(new CustomEvent("ui-table-resize", {
1672
- bubbles: !0,
1673
- composed: !0,
1674
- detail: {
1675
- column: this.#t,
1676
- width: n
1677
- }
1678
- }));
1679
- };
1680
- #d = (e) => {
1681
- this.#i && (this.table.dispatchEvent(new CustomEvent("ui-table-resize-end", {
1682
- bubbles: !0,
1683
- composed: !0,
1684
- detail: {
1685
- column: this.#t,
1686
- width: this.#e[this.#t],
1687
- allWidths: [...this.#e]
1688
- }
1689
- })), this.#m());
1690
- };
1691
- #f = () => {
1692
- this.#i && (this.#e[this.#t] = this.#r, this.#c(), this.#m());
1693
- };
1694
- #p = (e) => {
1695
- e.key === "Escape" && this.#i && (e.preventDefault(), this.#e[this.#t] = this.#r, this.#c(), this.#m());
1696
- };
1697
- #m() {
1698
- this.#i = !1, this.#t = -1, this.table.removeAttribute("resizing"), document.removeEventListener("pointermove", this.#u), document.removeEventListener("pointerup", this.#d), document.removeEventListener("pointercancel", this.#f), document.removeEventListener("keydown", this.#p);
1699
- }
1700
- }, W = class {
1701
- #e;
1702
- #t;
1703
- #n;
1704
- #r = !1;
1705
- constructor(e, t) {
1706
- this.#t = t, this.#n = e, this.#e = new u(e, {
1707
- selector: "ui-table-row:not([colspan])",
1708
- axis: "vertical",
1709
- mode: "slot"
1710
- }), e.addEventListener("ui-drag-start", this.#i), e.addEventListener("ui-drop", this.#a), e.addEventListener("click", this.#o, { capture: !0 });
1711
- }
1712
- #i = (e) => {
1713
- this.#r = !0;
1714
- let t = this.#n.querySelector(":scope > [popover][aria-hidden=\"true\"]");
1715
- t && (t.style.gridTemplateColumns = getComputedStyle(this.#t).gridTemplateColumns, t.style.display = "grid", t.style.alignItems = "center");
1716
- };
1717
- #a = (e) => {
1718
- let t = e.detail, n = new CustomEvent("ui-table-reorder", {
1719
- bubbles: !0,
1720
- composed: !0,
1721
- cancelable: !0,
1722
- detail: {
1723
- row: t.item,
1724
- fromIndex: t.fromIndex,
1725
- toIndex: t.toIndex
1726
- }
1727
- });
1728
- this.#t.dispatchEvent(n) && (t.insertBefore ? this.#n.insertBefore(t.item, t.insertBefore) : this.#n.appendChild(t.item));
1729
- };
1730
- #o = (e) => {
1731
- this.#r &&= (e.stopPropagation(), !1);
1732
- };
1733
- destroy() {
1734
- this.#n.removeEventListener("ui-drag-start", this.#i), this.#n.removeEventListener("ui-drop", this.#a), this.#n.removeEventListener("click", this.#o, { capture: !0 }), this.#e.destroy();
1735
- }
1736
- }, ue = class extends c {
1737
- static observedAttributes = [
1738
- "selectable",
1739
- "resizable",
1740
- "reorderable"
1741
- ];
1742
- #e;
1743
- #t = new V();
1744
- #n = null;
1745
- #r = null;
1746
- #i = null;
1747
- constructor() {
1748
- super(), this.#e = this.attachInternals(), this.#e.role = "table";
1749
- }
1750
- get store() {
1751
- return this.#t;
1752
- }
1753
- set store(e) {
1754
- this.#t = e;
1755
- }
1756
- get selectable() {
1757
- return this.hasAttribute("selectable");
1758
- }
1759
- set selectable(e) {
1760
- this.toggleAttribute("selectable", e);
1761
- }
1762
- setup() {
1763
- super.setup(), this.addEventListener("ui-sort", this.#c), this.addEventListener("ui-row-select", this.#l), this.deferChildren(() => {
1764
- this.addEffect(() => {
1765
- let e = this.#t.sortColumn.value, t = this.#t.sortDirection.value, n = this.querySelectorAll("ui-table-header[sortable]");
1766
- for (let r of n) r.column === e ? (r.setAttribute("sort", t), r.setAttribute("aria-sort", t === "asc" ? "ascending" : t === "desc" ? "descending" : "none")) : (r.setAttribute("sort", "none"), r.removeAttribute("aria-sort"));
1767
- }), this.addEffect(() => {
1768
- let e = this.#t.selected.value, t = this.querySelectorAll("ui-table-body ui-table-row");
1769
- for (let n of t) {
1770
- let t = e.has(n.value);
1771
- n.toggleAttribute("selected", t), n.setAttribute("aria-selected", t ? "true" : "false");
1772
- }
1773
- }), this.addEffect(() => {
1774
- let e = this.#t.sortColumn.value, t = this.querySelectorAll("ui-table-body ui-table-row[colspan]");
1775
- for (let n of t) n.toggleAttribute("hidden", e !== null);
1776
- }), this.hasAttribute("resizable") && this.#a(), this.hasAttribute("sticky-header") && this.#o(), this.hasAttribute("reorderable") && this.#s();
1777
- });
1778
- }
1779
- teardown() {
1780
- this.#n?.destroy(), this.#n = null, this.#r?.disconnect(), this.#r = null, this.#i?.destroy(), this.#i = null, this.removeEventListener("ui-sort", this.#c), this.removeEventListener("ui-row-select", this.#l), super.teardown();
1781
- }
1782
- #a() {
1783
- let e = this.querySelectorAll("ui-table-header");
1784
- for (let t of e) {
1785
- let e = document.createElement("div");
1786
- e.className = "table-resize-handle", e.setAttribute("aria-hidden", "true"), e.addEventListener("click", (e) => e.stopPropagation()), t.appendChild(e);
1787
- }
1788
- this.#n = new U(this), this.#n.init();
1789
- }
1790
- #o() {
1791
- let e = this.querySelector(":scope > ui-table-head > ui-table-row");
1792
- e && (this.#r = new ResizeObserver((e) => {
1793
- for (let t of e) {
1794
- let e = t.borderBoxSize?.[0]?.blockSize ?? t.target.getBoundingClientRect().height;
1795
- this.style.setProperty("--_header-height", `${e}px`);
1796
- }
1797
- }), this.#r.observe(e));
1798
- }
1799
- #s() {
1800
- let e = this.querySelector(":scope > ui-table-body");
1801
- e && (this.#i = new W(e, this));
1802
- }
1803
- #c = (e) => {
1804
- let t = e.detail;
1805
- this.#t.toggleSort(t.column), this.dispatchEvent(new CustomEvent("ui-table-sort", {
1806
- bubbles: !0,
1807
- composed: !0,
1808
- detail: {
1809
- column: this.#t.sortColumn.value,
1810
- direction: this.#t.sortDirection.value
1811
- }
1812
- }));
1813
- };
1814
- #l = (e) => {
1815
- if (!this.selectable) return;
1816
- let t = e.detail;
1817
- this.#t.toggle(t.value), this.dispatchEvent(new CustomEvent("ui-table-select", {
1818
- bubbles: !0,
1819
- composed: !0,
1820
- detail: {
1821
- value: t.value,
1822
- selected: this.#t.isSelected(t.value),
1823
- allSelected: [...this.#t.selected.value]
1824
- }
1825
- }));
1826
- };
1827
- }, de = class extends c {
1828
- #e;
1829
- constructor() {
1830
- super(), this.#e = this.attachInternals(), this.#e.role = "rowgroup";
1831
- }
1832
- }, fe = class extends c {
1833
- #e;
1834
- constructor() {
1835
- super(), this.#e = this.attachInternals(), this.#e.role = "rowgroup";
1836
- }
1837
- }, pe = class extends c {
1838
- static observedAttributes = ["value", "selected"];
1839
- #e;
1840
- constructor() {
1841
- super(), this.#e = this.attachInternals(), this.#e.role = "row";
1842
- }
1843
- get value() {
1844
- return this.getAttribute("value") ?? "";
1845
- }
1846
- set value(e) {
1847
- this.setAttribute("value", e);
1848
- }
1849
- get selected() {
1850
- return this.hasAttribute("selected");
1851
- }
1852
- set selected(e) {
1853
- this.toggleAttribute("selected", e);
1854
- }
1855
- setup() {
1856
- super.setup(), this.addEventListener("click", this.#t);
1857
- }
1858
- teardown() {
1859
- this.removeEventListener("click", this.#t), super.teardown();
1860
- }
1861
- #t = () => {
1862
- this.hasAttribute("colspan") || this.closest("ui-table")?.hasAttribute("selectable") && this.dispatchEvent(new CustomEvent("ui-row-select", {
1863
- bubbles: !0,
1864
- composed: !0,
1865
- detail: { value: this.value }
1866
- }));
1867
- };
1868
- }, me = class extends c {
1869
- #e;
1870
- constructor() {
1871
- super(), this.#e = this.attachInternals(), this.#e.role = "cell";
1872
- }
1873
- }, he = class extends c {
1874
- static observedAttributes = ["sort", "sortable"];
1875
- #e;
1876
- constructor() {
1877
- super(), this.#e = this.attachInternals(), this.#e.role = "columnheader";
1878
- }
1879
- get column() {
1880
- return this.getAttribute("column") ?? "";
1881
- }
1882
- get sortable() {
1883
- return this.hasAttribute("sortable");
1884
- }
1885
- get sort() {
1886
- return this.getAttribute("sort") ?? "none";
1887
- }
1888
- set sort(e) {
1889
- this.setAttribute("sort", e);
1890
- }
1891
- setup() {
1892
- super.setup(), this.sortable && (this.setAttribute("tabindex", "0"), this.addEventListener("click", this.#t), this.addEventListener("keydown", this.#n));
1893
- }
1894
- teardown() {
1895
- this.removeEventListener("click", this.#t), this.removeEventListener("keydown", this.#n), super.teardown();
1896
- }
1897
- #t = () => {
1898
- this.sortable && this.dispatchEvent(new CustomEvent("ui-sort", {
1899
- bubbles: !0,
1900
- composed: !0,
1901
- detail: { column: this.column }
1902
- }));
1903
- };
1904
- #n = (e) => {
1905
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.#t());
1906
- };
1907
- };
1908
- function G(e) {
1909
- if (!e) return null;
1910
- let t = /* @__PURE__ */ new Date(e + "T00:00:00");
1911
- return isNaN(t.getTime()) ? null : t;
1912
- }
1913
- function ge(e) {
1914
- return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
1915
- }
1916
- function K(e, t) {
1917
- return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
1918
- }
1919
- var q = class {
1920
- view;
1921
- focusedYear;
1922
- focusedMonth;
1923
- value;
1924
- rangeStart;
1925
- rangeEnd;
1926
- min;
1927
- max;
1928
- days;
1929
- months;
1930
- years;
1931
- title;
1932
- constructor(e = {}) {
1933
- let n = /* @__PURE__ */ new Date(), i = G(e.value ?? null) ?? n;
1934
- this.view = t("day"), this.focusedYear = t(i.getFullYear()), this.focusedMonth = t(i.getMonth()), this.value = t(e.value ?? null), this.rangeStart = t(e.rangeStart ?? null), this.rangeEnd = t(e.rangeEnd ?? null), this.min = t(e.min ?? null), this.max = t(e.max ?? null), this.days = r(() => this.#e()), this.months = r(() => this.#t()), this.years = r(() => this.#n()), this.title = r(() => this.#r());
1935
- }
1936
- prevMonth() {
1937
- n(() => {
1938
- this.focusedMonth.value === 0 ? (this.focusedMonth.value = 11, this.focusedYear.value--) : this.focusedMonth.value--;
1939
- });
1940
- }
1941
- nextMonth() {
1942
- n(() => {
1943
- this.focusedMonth.value === 11 ? (this.focusedMonth.value = 0, this.focusedYear.value++) : this.focusedMonth.value++;
1944
- });
1945
- }
1946
- prevYear() {
1947
- this.focusedYear.value--;
1948
- }
1949
- nextYear() {
1950
- this.focusedYear.value++;
1951
- }
1952
- prevDecade() {
1953
- this.focusedYear.value -= 10;
1954
- }
1955
- nextDecade() {
1956
- this.focusedYear.value += 10;
1957
- }
1958
- selectDate(e) {
1959
- this.value.value = e;
1960
- }
1961
- selectMonth(e) {
1962
- this.focusedMonth.value = e, this.view.value = "day";
1963
- }
1964
- selectYear(e) {
1965
- this.focusedYear.value = e, this.view.value = "month";
1966
- }
1967
- setRange(e, t) {
1968
- this.rangeStart.value = e, this.rangeEnd.value = t;
1969
- }
1970
- isDateDisabled(e) {
1971
- let t = G(this.min.value), n = G(this.max.value), r = G(e);
1972
- return !!(!r || t && r < t || n && r > n);
1973
- }
1974
- #e() {
1975
- let e = this.focusedYear.value, t = this.focusedMonth.value, n = G(this.value.value), r = /* @__PURE__ */ new Date(), i = G(this.rangeStart.value), a = G(this.rangeEnd.value), o = new Date(e, t, 1).getDay(), s = new Date(e, t, 1 - o), c = [];
1976
- for (let e = 0; e < 42; e++) {
1977
- let o = new Date(s.getFullYear(), s.getMonth(), s.getDate() + e), l = ge(o), u = o.getMonth() === t, d = K(o, r), f = n ? K(o, n) : !1, p = this.isDateDisabled(l), m = !1, h = !1, g = !1;
1978
- if (i && a) {
1979
- let e = i <= a ? i : a, t = i <= a ? a : i;
1980
- m = o >= e && o <= t, h = K(o, e), g = K(o, t);
1981
- }
1982
- c.push({
1983
- date: l,
1984
- day: o.getDate(),
1985
- inMonth: u,
1986
- isToday: d,
1987
- isSelected: f,
1988
- isDisabled: p,
1989
- inRange: m,
1990
- isRangeStart: h,
1991
- isRangeEnd: g
1992
- });
1993
- }
1994
- return c;
1995
- }
1996
- #t() {
1997
- let e = this.focusedYear.value, t = this.focusedMonth.value;
1998
- return [
1999
- "Jan",
2000
- "Feb",
2001
- "Mar",
2002
- "Apr",
2003
- "May",
2004
- "Jun",
2005
- "Jul",
2006
- "Aug",
2007
- "Sep",
2008
- "Oct",
2009
- "Nov",
2010
- "Dec"
2011
- ].map((n, r) => ({
2012
- month: r,
2013
- name: n,
2014
- isCurrent: r === t && e === (/* @__PURE__ */ new Date()).getFullYear(),
2015
- isSelected: r === t
2016
- }));
2017
- }
2018
- #n() {
2019
- let e = this.focusedYear.value, t = Math.floor(e / 10) * 10, n = (/* @__PURE__ */ new Date()).getFullYear(), r = [];
2020
- for (let i = t - 1; i <= t + 10; i++) r.push({
2021
- year: i,
2022
- inDecade: i >= t && i < t + 10,
2023
- isCurrent: i === n,
2024
- isSelected: i === e
2025
- });
2026
- return r;
2027
- }
2028
- #r() {
2029
- let e = [
2030
- "January",
2031
- "February",
2032
- "March",
2033
- "April",
2034
- "May",
2035
- "June",
2036
- "July",
2037
- "August",
2038
- "September",
2039
- "October",
2040
- "November",
2041
- "December"
2042
- ];
2043
- switch (this.view.value) {
2044
- case "day": return `${e[this.focusedMonth.value]} ${this.focusedYear.value}`;
2045
- case "month": return `${this.focusedYear.value}`;
2046
- case "year": {
2047
- let e = Math.floor(this.focusedYear.value / 10) * 10;
2048
- return `${e}–${e + 9}`;
2049
- }
2050
- }
2051
- }
2052
- };
2053
- function _e(e = {}) {
2054
- return new q(e);
2055
- }
2056
- /**
2057
- * Calendar date picker with day/month/year views and optional range selection.
2058
- * @attr {string} value - Selected date in ISO format (YYYY-MM-DD)
2059
- * @attr {string} min - Minimum selectable date in ISO format
2060
- * @attr {string} max - Maximum selectable date in ISO format
2061
- * @attr {boolean} disabled - Disables interaction
2062
- * @attr {string} name - Form field name
2063
- * @attr {boolean} range - Enables range selection mode
2064
- * @fires ui-change - Fired on single date selection with `{ value }` detail
2065
- * @fires ui-range-select - Fired on range commit with `{ start, end }` detail
2066
- */
2067
- var ve = class extends y(c) {
2068
- static observedAttributes = [
2069
- "value",
2070
- "min",
2071
- "max",
2072
- "disabled",
2073
- "name",
2074
- "range",
2075
- "required"
2076
- ];
2077
- #e;
2078
- #t = new q();
2079
- #n = t(!1);
2080
- #r = t(!1);
2081
- #i = null;
2082
- #a = t(0);
2083
- #o = "idle";
2084
- constructor() {
2085
- super(), this.#e = this.attachInternals(), this.#e.role = "group", this.setAttribute("tabindex", "0");
2086
- }
2087
- get store() {
2088
- return this.#t;
2089
- }
2090
- get value() {
2091
- return this.#t.value.value;
2092
- }
2093
- set value(e) {
2094
- this.#t.value.value = e, e ? this.setAttribute("value", e) : this.removeAttribute("value");
2095
- }
2096
- get disabled() {
2097
- return this.#n.value;
2098
- }
2099
- set disabled(e) {
2100
- this.#n.value = e, this.toggleAttribute("disabled", e);
2101
- }
2102
- get required() {
2103
- return this.#r.value;
2104
- }
2105
- set required(e) {
2106
- this.#r.value = e, this.toggleAttribute("required", e);
2107
- }
2108
- get range() {
2109
- return this.hasAttribute("range");
2110
- }
2111
- attributeChangedCallback(e, t, n) {
2112
- if (t !== n) {
2113
- switch (e) {
2114
- case "value":
2115
- this.#t.value.value = n;
2116
- break;
2117
- case "min":
2118
- this.#t.min.value = n;
2119
- break;
2120
- case "max":
2121
- this.#t.max.value = n;
2122
- break;
2123
- case "disabled":
2124
- this.#n.value = n !== null;
2125
- break;
2126
- case "required":
2127
- this.#r.value = n !== null;
2128
- break;
2129
- }
2130
- super.attributeChangedCallback?.(e, t, n);
2131
- }
2132
- }
2133
- setup() {
2134
- super.setup(), this.#i = this.getAttribute("value");
2135
- let e = this.getAttribute("value"), t = this.getAttribute("min"), r = this.getAttribute("max");
2136
- n(() => {
2137
- e && (this.#t.value.value = e), t && (this.#t.min.value = t), r && (this.#t.max.value = r);
2138
- }), this.#s(), this.addEventListener("keydown", this.#b), this.addEffect(() => this.#c()), this.addEffect(() => {
2139
- this.#e.setFormValue(this.#t.value.value);
2140
- }), this.addEffect(g(this, this.#n, this.#e, { manageTabindex: !0 })), this.#r.value = this.hasAttribute("required"), this.addEffect(() => {
2141
- let e = this.#t.value.value;
2142
- this.#r.value && (e === null || e === "") ? this.#e.setValidity({ valueMissing: !0 }, "Please select a date.", this) : this.#e.setValidity({});
2143
- });
2144
- }
2145
- teardown() {
2146
- this.querySelector(".cal-prev")?.removeEventListener("click", this.#l), this.querySelector(".cal-next")?.removeEventListener("click", this.#u), this.querySelector(".cal-title")?.removeEventListener("click", this.#d);
2147
- let e = this.querySelector(".cal-grid");
2148
- e?.removeEventListener("click", this.#f), e?.removeEventListener("pointermove", this.#p), this.removeEventListener("keydown", this.#b), super.teardown();
2149
- }
2150
- onFormDisabled(e) {
2151
- this.#n.value = e;
2152
- }
2153
- onFormReset() {
2154
- this.#t.value.value = this.#i, this.#i ? this.setAttribute("value", this.#i) : this.removeAttribute("value");
2155
- }
2156
- #s() {
2157
- this.innerHTML = "\n <div class=\"cal-header\">\n <button type=\"button\" class=\"cal-prev\" aria-label=\"Previous\" tabindex=\"-1\"></button>\n <button type=\"button\" class=\"cal-title\" tabindex=\"-1\"></button>\n <button type=\"button\" class=\"cal-next\" aria-label=\"Next\" tabindex=\"-1\"></button>\n </div>\n <div class=\"cal-weekdays\"></div>\n <div class=\"cal-grid\" role=\"grid\"></div>\n ";
2158
- let e = this.querySelector(".cal-prev"), t = this.querySelector(".cal-next"), n = this.querySelector(".cal-title");
2159
- e?.addEventListener("click", this.#l), t?.addEventListener("click", this.#u), n?.addEventListener("click", this.#d);
2160
- let r = this.querySelector(".cal-grid");
2161
- r?.addEventListener("click", this.#f), r?.addEventListener("pointermove", this.#p);
2162
- }
2163
- #c() {
2164
- let e = this.#t.view.value, t = this.querySelector(".cal-title"), n = this.querySelector(".cal-weekdays"), r = this.querySelector(".cal-grid");
2165
- !t || !n || !r || (t.textContent = this.#t.title.value, e === "day" ? (this.setAttribute("view", "day"), n.innerHTML = [
2166
- "Su",
2167
- "Mo",
2168
- "Tu",
2169
- "We",
2170
- "Th",
2171
- "Fr",
2172
- "Sa"
2173
- ].map((e) => `<span class="cal-weekday">${e}</span>`).join(""), r.innerHTML = this.#t.days.value.map((e, t) => {
2174
- let n = `class="cal-cell" data-date="${e.date}" data-index="${t}" tabindex="-1"`;
2175
- return e.inMonth || (n += " data-outside"), e.isToday && (n += " data-today"), e.isSelected && (n += " data-selected"), e.isDisabled && (n += " disabled"), e.inRange && (n += " data-in-range"), e.isRangeStart && (n += " data-range-start"), e.isRangeEnd && (n += " data-range-end"), `<button type="button" ${n}>${e.day}</button>`;
2176
- }).join("")) : e === "month" ? (this.setAttribute("view", "month"), n.innerHTML = "", r.innerHTML = this.#t.months.value.map((e) => {
2177
- let t = `class="cal-cell" data-month="${e.month}" tabindex="-1"`;
2178
- return e.isCurrent && (t += " data-today"), e.isSelected && (t += " data-selected"), `<button type="button" ${t}>${e.name}</button>`;
2179
- }).join("")) : (this.setAttribute("view", "year"), n.innerHTML = "", r.innerHTML = this.#t.years.value.map((e) => {
2180
- let t = `class="cal-cell" data-year="${e.year}" tabindex="-1"`;
2181
- return e.inDecade || (t += " data-outside"), e.isCurrent && (t += " data-today"), e.isSelected && (t += " data-selected"), `<button type="button" ${t}>${e.year}</button>`;
2182
- }).join("")));
2183
- }
2184
- #l = () => {
2185
- this.#m();
2186
- };
2187
- #u = () => {
2188
- this.#h();
2189
- };
2190
- #d = () => {
2191
- this.#g();
2192
- };
2193
- #f = (e) => {
2194
- this.#_(e);
2195
- };
2196
- #p = (e) => {
2197
- this.#y(e);
2198
- };
2199
- #m() {
2200
- let e = this.#t.view.value;
2201
- e === "day" ? this.#t.prevMonth() : e === "month" ? this.#t.prevYear() : this.#t.prevDecade();
2202
- }
2203
- #h() {
2204
- let e = this.#t.view.value;
2205
- e === "day" ? this.#t.nextMonth() : e === "month" ? this.#t.nextYear() : this.#t.nextDecade();
2206
- }
2207
- #g() {
2208
- let e = this.#t.view.value;
2209
- e === "day" ? this.#t.view.value = "month" : e === "month" && (this.#t.view.value = "year");
2210
- }
2211
- #_(e) {
2212
- if (this.#n.value) return;
2213
- let t = e.target.closest(".cal-cell");
2214
- if (!t || t.hasAttribute("disabled")) return;
2215
- let n = t.dataset.date, r = t.dataset.month, i = t.dataset.year;
2216
- n ? this.#v(n) : r === void 0 ? i !== void 0 && this.#t.selectYear(Number(i)) : this.#t.selectMonth(Number(r));
2217
- }
2218
- #v(e) {
2219
- if (this.range) if (this.#o === "idle") this.#t.selectDate(e), this.#t.setRange(e, null), this.setAttribute("value", e), this.#o = "selecting";
2220
- else if (this.#o === "selecting") {
2221
- let t = this.#t.rangeStart.value;
2222
- if (!t) return;
2223
- this.#t.setRange(t, e), this.#o = "committed", this.dispatchEvent(new CustomEvent("ui-range-select", {
2224
- bubbles: !0,
2225
- composed: !0,
2226
- detail: {
2227
- start: this.#t.rangeStart.value,
2228
- end: this.#t.rangeEnd.value
2229
- }
2230
- }));
2231
- } else this.#t.value.value = null, this.#t.setRange(null, null), this.removeAttribute("value"), this.#o = "idle";
2232
- else this.#t.selectDate(e), this.setAttribute("value", e), this.dispatchEvent(new CustomEvent("ui-change", {
2233
- bubbles: !0,
2234
- composed: !0,
2235
- detail: { value: e }
2236
- }));
2237
- }
2238
- #y(e) {
2239
- if (this.#n.value || !this.range || this.#o !== "selecting") return;
2240
- let t = e.target.closest(".cal-cell");
2241
- if (!t || t.hasAttribute("disabled")) return;
2242
- let n = t.dataset.date;
2243
- if (!n) return;
2244
- let r = this.#t.rangeStart.value;
2245
- r && this.#t.setRange(r, n);
2246
- }
2247
- #b = (e) => {
2248
- if (this.#n.value || this.#t.view.value !== "day") return;
2249
- let t = this.#t.days.value, n = this.#a.value, r = !0;
2250
- switch (e.key) {
2251
- case "ArrowRight":
2252
- n += 1;
2253
- break;
2254
- case "ArrowLeft":
2255
- --n;
2256
- break;
2257
- case "ArrowDown":
2258
- n += 7;
2259
- break;
2260
- case "ArrowUp":
2261
- n -= 7;
2262
- break;
2263
- case "Home":
2264
- n -= n % 7;
2265
- break;
2266
- case "End":
2267
- n = n - n % 7 + 6;
2268
- break;
2269
- case "PageDown":
2270
- e.shiftKey ? this.#t.nextYear() : this.#t.nextMonth();
2271
- break;
2272
- case "PageUp":
2273
- e.shiftKey ? this.#t.prevYear() : this.#t.prevMonth();
2274
- break;
2275
- case "Enter":
2276
- case " ": {
2277
- let e = t[n];
2278
- e && !e.isDisabled && this.#v(e.date);
2279
- break;
2280
- }
2281
- default: r = !1;
2282
- }
2283
- r && (e.preventDefault(), n = Math.max(0, Math.min(41, n)), this.#a.value = n, n < 0 && this.#t.prevMonth(), n > 41 && this.#t.nextMonth());
2284
- };
2285
- }, J = class {
2286
- open = t(!1);
2287
- value = t(null);
2288
- label = t("");
2289
- toggle() {
2290
- this.open.value = !this.open.value;
2291
- }
2292
- show() {
2293
- this.open.value = !0;
2294
- }
2295
- hide() {
2296
- this.open.value = !1;
2297
- }
2298
- select(e, t) {
2299
- n(() => {
2300
- this.value.value = e, this.label.value = t, this.open.value = !1;
2301
- });
2302
- }
2303
- reset() {
2304
- n(() => {
2305
- this.open.value = !1, this.value.value = null, this.label.value = "";
2306
- });
2307
- }
2308
- }, ye = class extends y(c) {
2309
- static observedAttributes = [
2310
- "value",
2311
- "disabled",
2312
- "name",
2313
- "options",
2314
- "src",
2315
- "placeholder",
2316
- "required"
2317
- ];
2318
- #e;
2319
- #t = new J();
2320
- #n = t(!1);
2321
- #r = t(!1);
2322
- #i;
2323
- #a = t([]);
2324
- #o = t(null);
2325
- #s = t("");
2326
- #c = !1;
2327
- #l = null;
2328
- #u = null;
2329
- #d = null;
2330
- constructor() {
2331
- super(), this.#e = this.attachInternals();
2332
- }
2333
- get controller() {
2334
- return this.#t;
2335
- }
2336
- get value() {
2337
- return this.#t.value.value;
2338
- }
2339
- set value(e) {
2340
- if (e === null) {
2341
- this.#t.reset();
2342
- return;
2343
- }
2344
- let t = this.querySelector(`ui-option[value="${CSS.escape(e)}"]`), n = t?.getAttribute("label") ?? t?.textContent?.trim() ?? e;
2345
- this.#t.select(e, n);
2346
- }
2347
- get name() {
2348
- return this.getAttribute("name") ?? "";
2349
- }
2350
- set name(e) {
2351
- this.setAttribute("name", e);
2352
- }
2353
- get disabled() {
2354
- return this.#n.value;
2355
- }
2356
- set disabled(e) {
2357
- this.#n.value = e, this.toggleAttribute("disabled", e);
2358
- }
2359
- get required() {
2360
- return this.#r.value;
2361
- }
2362
- set required(e) {
2363
- this.#r.value = e, this.toggleAttribute("required", e);
2364
- }
2365
- get options() {
2366
- return this.#a.value;
2367
- }
2368
- set options(e) {
2369
- this.#a.value = e, this.setAttribute("options", JSON.stringify(e));
2370
- }
2371
- get src() {
2372
- return this.#o.value;
2373
- }
2374
- set src(e) {
2375
- this.#o.value = e, e == null ? this.removeAttribute("src") : this.setAttribute("src", e);
2376
- }
2377
- get placeholder() {
2378
- return this.#s.value;
2379
- }
2380
- set placeholder(e) {
2381
- this.#s.value = e, e ? this.setAttribute("placeholder", e) : this.removeAttribute("placeholder");
2382
- }
2383
- #f(e) {
2384
- return C(e, "ui-select");
2385
- }
2386
- async #p(e) {
2387
- this.#l = await w(e, this.#l, this.#a, "ui-select");
2388
- }
2389
- #m() {
2390
- let e = document.createElement("ui-button");
2391
- e.setAttribute("justify", "spread");
2392
- let t = document.createElement("span");
2393
- t.setAttribute("slot", "label"), t.textContent = this.#s.value || "\xA0", e.appendChild(t);
2394
- let n = document.createElement("ui-icon");
2395
- n.setAttribute("name", "caret-up-down"), n.setAttribute("slot", "trailing"), e.appendChild(n);
2396
- let r = document.createElement("ui-listbox");
2397
- r.setAttribute("popover", "manual"), this.appendChild(e), this.appendChild(r);
2398
- }
2399
- #h(e) {
2400
- let t = this.#u;
2401
- if (t) {
2402
- for (; t.firstChild;) t.removeChild(t.firstChild);
2403
- for (let n of e) {
2404
- let e = document.createElement("ui-option");
2405
- e.setAttribute("value", n.value), e.setAttribute("label", n.label), e.textContent = n.label, n.disabled && e.setAttribute("disabled", ""), t.appendChild(e);
2406
- }
2407
- }
2408
- }
2409
- attributeChangedCallback(e, t, n) {
2410
- if (t !== n) {
2411
- switch (e) {
2412
- case "disabled":
2413
- this.#n.value = n !== null;
2414
- break;
2415
- case "required":
2416
- this.#r.value = n !== null;
2417
- break;
2418
- case "options":
2419
- n ? this.#a.value = this.#f(n) : this.#a.value = [];
2420
- break;
2421
- case "src":
2422
- this.#o.value = n;
2423
- break;
2424
- case "placeholder":
2425
- this.#s.value = n ?? "";
2426
- break;
2427
- }
2428
- super.attributeChangedCallback?.(e, t, n);
2429
- }
2430
- }
2431
- setup() {
2432
- if (super.setup(), this.#i = new p(this), this.#c = this.hasAttribute("options") || this.hasAttribute("src"), this.#c) {
2433
- let e = this.getAttribute("options");
2434
- e && (this.#a.value = this.#f(e)), this.#o.value = this.getAttribute("src"), this.#s.value = this.getAttribute("placeholder") ?? "", this.#m();
2435
- }
2436
- let e = this.querySelector(":scope > ui-button");
2437
- this.#d = e;
2438
- let t = this.querySelector(":scope > ui-listbox[popover]");
2439
- this.#u = t, t?.setAttribute("popover", "manual"), e && t && this.#i.wirePopover(e, t), e?.setAttribute("aria-haspopup", "listbox"), this.deferChildren(() => {
2440
- let n = this.getAttribute("value");
2441
- if (n) {
2442
- let e = this.querySelector(`ui-option[value="${CSS.escape(n)}"]`), t = e?.getAttribute("label") ?? e?.textContent?.trim() ?? n;
2443
- this.#t.value.value = n, this.#t.label.value = t;
2444
- }
2445
- this.addEffect(() => {
2446
- let t = this.#t.label.value, n = e?.querySelector("[slot=\"label\"]");
2447
- n && (n.textContent = t || (this.#c ? this.#s.value || "\xA0" : n.textContent ?? ""));
2448
- }), this.addEffect(() => {
2449
- let e = this.#t.value.value, n = t?.querySelectorAll("ui-option") ?? [];
2450
- for (let t of n) {
2451
- let n = t.getAttribute("value") === e;
2452
- t.setAttribute("aria-selected", String(n));
2453
- }
2454
- }), this.#c && (this.addEffect(() => {
2455
- let e = this.#a.value;
2456
- this.#h(e);
2457
- }), this.addEffect(() => {
2458
- let e = this.#o.value;
2459
- e && this.#p(e);
2460
- }), this.addEffect(() => {
2461
- let t = this.#s.value, n = this.#t.label.value, r = e?.querySelector("[slot=\"label\"]");
2462
- r && !n && (r.textContent = t || "\xA0");
2463
- }));
2464
- }), this.addEffect(g(this, this.#n, this.#e)), this.addEffect(() => {
2465
- let t = this.#n.value;
2466
- e && e.toggleAttribute("disabled", t), t && this.#t.open.value && this.#t.hide();
2467
- }), this.#r.value = this.hasAttribute("required"), this.addEffect(() => {
2468
- let e = this.#t.value.value;
2469
- this.#r.value && (e === null || e === "") ? this.#e.setValidity({ valueMissing: !0 }, "Please select an option.", this) : this.#e.setValidity({});
2470
- }), this.addEffect(() => {
2471
- let t = this.#t.open.value;
2472
- this.#i.syncPopover(t), e?.setAttribute("aria-expanded", String(t));
2473
- }), this.addEffect(() => {
2474
- let e = this.#t.value.value;
2475
- this.#e.setFormValue(e ?? ""), e == null ? this.removeAttribute("value") : this.setAttribute("value", e);
2476
- }), e?.addEventListener("ui-press", this.#g), this.addEventListener("ui-change", this.#_), this.addEventListener("ui-select", this.#v), this.addEventListener("ui-dismiss", this.#y), e?.addEventListener("keydown", this.#b);
2477
- }
2478
- #g = () => {
2479
- this.#n.value || this.#t.toggle();
2480
- };
2481
- #_ = (e) => {
2482
- e.target !== this && e.stopImmediatePropagation();
2483
- };
2484
- #v = (e) => {
2485
- let t = e.detail;
2486
- this.#t.select(t.value, t.label), this.dispatchEvent(new CustomEvent("ui-change", {
2487
- bubbles: !0,
2488
- composed: !0,
2489
- detail: t
2490
- }));
2491
- };
2492
- #y = () => {
2493
- this.#t.hide();
2494
- };
2495
- #b = (e) => {
2496
- if (this.#n.value) return;
2497
- let t = this.#u;
2498
- switch (e.key) {
2499
- case "ArrowDown":
2500
- case "ArrowUp": {
2501
- e.preventDefault();
2502
- let n = t?.controller;
2503
- if (this.#t.open.value || this.#t.show(), n) {
2504
- let r = t?.querySelectorAll(":scope > ui-option:not([disabled])")?.length ?? 0;
2505
- n.moveActive(e.key === "ArrowDown" ? 1 : -1, r);
2506
- }
2507
- break;
2508
- }
2509
- case "Enter":
2510
- case " ":
2511
- if (e.preventDefault(), this.#t.open.value) {
2512
- let e = t?.getActiveOption();
2513
- e && e.click();
2514
- } else this.#t.toggle();
2515
- break;
2516
- case "Escape":
2517
- this.#t.open.value && (e.preventDefault(), this.#t.hide());
2518
- break;
2519
- case "Home": {
2520
- e.preventDefault();
2521
- let n = t?.controller;
2522
- n && (n.activeIndex.value = 0);
2523
- break;
2524
- }
2525
- case "End": {
2526
- e.preventDefault();
2527
- let n = t?.controller;
2528
- if (n) {
2529
- let e = t?.querySelectorAll(":scope > ui-option:not([disabled])");
2530
- n.activeIndex.value = Math.max(0, (e?.length ?? 1) - 1);
2531
- }
2532
- break;
2533
- }
2534
- }
2535
- };
2536
- teardown() {
2537
- this.#d?.removeEventListener("ui-press", this.#g), this.#d?.removeEventListener("keydown", this.#b), this.removeEventListener("ui-change", this.#_), this.removeEventListener("ui-select", this.#v), this.removeEventListener("ui-dismiss", this.#y), this.#d = null, this.#l?.abort(), this.#l = null, this.#u = null, this.#i.destroy(), super.teardown();
2538
- }
2539
- onFormReset() {
2540
- this.#t.reset();
2541
- }
2542
- onFormDisabled(e) {
2543
- this.#n.value = e;
2544
- }
2545
- }, be = class extends y(c) {
2546
- static observedAttributes = [
2547
- "value",
2548
- "disabled",
2549
- "name",
2550
- "options",
2551
- "src",
2552
- "placeholder",
2553
- "required"
2554
- ];
2555
- #e;
2556
- #t = new x();
2557
- #n = t(!1);
2558
- #r = t(!1);
2559
- #i = t(!1);
2560
- #a;
2561
- #o = e("listbox");
2562
- #s = null;
2563
- #c = t([]);
2564
- #l = t(null);
2565
- #u = t("");
2566
- #d = !1;
2567
- #f = null;
2568
- #p = null;
2569
- constructor() {
2570
- super(), this.#e = this.attachInternals();
2571
- }
2572
- get store() {
2573
- return this.#t;
2574
- }
2575
- get value() {
2576
- return this.#t.value.value;
2577
- }
2578
- set value(e) {
2579
- if (e === null) {
2580
- n(() => {
2581
- this.#t.clearSelection(), this.#t.query.value = "", this.#t.activeIndex.value = -1, this.#n.value = !1;
2582
- });
2583
- return;
2584
- }
2585
- this.#t.select(e);
2586
- }
2587
- get name() {
2588
- return this.getAttribute("name") ?? "";
2589
- }
2590
- set name(e) {
2591
- this.setAttribute("name", e);
2592
- }
2593
- get disabled() {
2594
- return this.#r.value;
2595
- }
2596
- set disabled(e) {
2597
- this.#r.value = e, this.toggleAttribute("disabled", e);
2598
- }
2599
- get required() {
2600
- return this.#i.value;
2601
- }
2602
- set required(e) {
2603
- this.#i.value = e, this.toggleAttribute("required", e);
2604
- }
2605
- get options() {
2606
- return this.#c.value;
2607
- }
2608
- set options(e) {
2609
- this.#c.value = e, this.setAttribute("options", JSON.stringify(e));
2610
- }
2611
- get src() {
2612
- return this.#l.value;
2613
- }
2614
- set src(e) {
2615
- this.#l.value = e, e == null ? this.removeAttribute("src") : this.setAttribute("src", e);
2616
- }
2617
- get placeholder() {
2618
- return this.#u.value;
2619
- }
2620
- set placeholder(e) {
2621
- this.#u.value = e, e ? this.setAttribute("placeholder", e) : this.removeAttribute("placeholder");
2622
- }
2623
- #m(e) {
2624
- return C(e, "ui-combobox");
2625
- }
2626
- async #h(e) {
2627
- this.#f = await w(e, this.#f, this.#c, "ui-combobox");
2628
- }
2629
- #g() {
2630
- let e = document.createElement("ui-input"), t = this.#u.value;
2631
- t && e.setAttribute("placeholder", t);
2632
- let n = this.getAttribute("size");
2633
- n && e.setAttribute("size", n);
2634
- let r = document.createElement("ui-listbox");
2635
- r.setAttribute("popover", "manual"), this.appendChild(e), this.appendChild(r);
2636
- }
2637
- #_(e) {
2638
- let t = this.#p;
2639
- if (t) {
2640
- for (; t.firstChild;) t.removeChild(t.firstChild);
2641
- for (let n of e) {
2642
- let e = document.createElement("ui-option");
2643
- e.setAttribute("value", n.value), e.setAttribute("label", n.label), e.textContent = n.label, n.disabled && e.setAttribute("disabled", ""), t.appendChild(e);
2644
- }
2645
- this.#t.data.value = e;
2646
- }
2647
- }
2648
- attributeChangedCallback(e, t, n) {
2649
- if (t !== n) {
2650
- switch (e) {
2651
- case "disabled":
2652
- this.#r.value = n !== null;
2653
- break;
2654
- case "required":
2655
- this.#i.value = n !== null;
2656
- break;
2657
- case "options":
2658
- n ? this.#c.value = this.#m(n) : this.#c.value = [];
2659
- break;
2660
- case "src":
2661
- this.#l.value = n;
2662
- break;
2663
- case "placeholder":
2664
- this.#u.value = n ?? "";
2665
- break;
2666
- }
2667
- super.attributeChangedCallback?.(e, t, n);
2668
- }
2669
- }
2670
- setup() {
2671
- if (super.setup(), this.#a = new p(this), this.#d = this.hasAttribute("options") || this.hasAttribute("src"), this.#d) {
2672
- let e = this.getAttribute("options");
2673
- e && (this.#c.value = this.#m(e)), this.#l.value = this.getAttribute("src"), this.#u.value = this.getAttribute("placeholder") ?? "", this.#g();
2674
- }
2675
- let t = this.querySelector(":scope > ui-input");
2676
- this.#s = t;
2677
- let n = this.querySelector(":scope > ui-listbox[popover]");
2678
- this.#p = n, n?.setAttribute("popover", "manual"), n?.setAttribute("virtual-focus", ""), t && n && (this.#a.wirePopover(t, n), n.id ||= this.#o), t?.setAttribute("role", "combobox"), t?.setAttribute("aria-autocomplete", "list"), t?.setAttribute("aria-controls", n?.id ?? ""), t?.setAttribute("aria-expanded", "false"), this.deferChildren(() => {
2679
- if (!this.#d) {
2680
- let e = n?.querySelectorAll("ui-option") ?? [];
2681
- this.#t.data.value = [...e].map((e) => ({
2682
- value: e.getAttribute("value") ?? "",
2683
- label: e.getAttribute("label") ?? e.textContent?.trim() ?? ""
2684
- }));
2685
- }
2686
- let r = this.getAttribute("value");
2687
- if (r) {
2688
- let e = this.querySelector(`ui-option[value="${CSS.escape(r)}"]`), t = e?.getAttribute("label") ?? e?.textContent?.trim() ?? r;
2689
- this.#t.value.value = r, this.#t.query.value = t;
2690
- }
2691
- this.addEffect(() => {
2692
- let e = this.#t.view.value, t = new Set(e.map((e) => e.value)), r = n?.querySelectorAll("ui-option") ?? [];
2693
- for (let e of r) e.toggleAttribute("hidden", !t.has(e.getAttribute("value") ?? ""));
2694
- }), this.addEffect(() => {
2695
- this.#t.view.value;
2696
- let r = this.#t.activeIndex.value, i = [...n?.querySelectorAll("ui-option:not([hidden]):not([disabled])") ?? []];
2697
- for (let e = 0; e < i.length; e++) i[e].toggleAttribute("active", e === r);
2698
- let a = i[r];
2699
- a ? (a.scrollIntoView({ block: "nearest" }), a.id ||= e("opt"), t?.setAttribute("aria-activedescendant", a.id)) : t?.removeAttribute("aria-activedescendant");
2700
- }), this.addEffect(() => {
2701
- let e = this.#t.value.value, t = n?.querySelectorAll("ui-option") ?? [];
2702
- for (let n of t) {
2703
- let t = n.getAttribute("value") === e;
2704
- n.setAttribute("aria-selected", String(t));
2705
- }
2706
- }), this.#d && (this.addEffect(() => {
2707
- let e = this.#c.value;
2708
- this.#_(e);
2709
- }), this.addEffect(() => {
2710
- let e = this.#l.value;
2711
- e && this.#h(e);
2712
- }), this.addEffect(() => {
2713
- let e = this.#u.value;
2714
- t && (e ? t.setAttribute("placeholder", e) : t.removeAttribute("placeholder"));
2715
- }));
2716
- }), this.addEffect(g(this, this.#r, this.#e)), this.addEffect(() => {
2717
- let e = this.#r.value;
2718
- t && t.toggleAttribute("disabled", e), e && this.#n.value && (this.#n.value = !1);
2719
- }), this.#i.value = this.hasAttribute("required"), this.addEffect(() => {
2720
- let e = this.#t.value.value;
2721
- this.#i.value && (e === null || e === "") ? this.#e.setValidity({ valueMissing: !0 }, "Please select an option.", this) : this.#e.setValidity({});
2722
- }), this.addEffect(() => {
2723
- let e = this.#n.value;
2724
- this.#a.syncPopover(e), t?.setAttribute("aria-expanded", String(e));
2725
- }), this.addEffect(() => {
2726
- let e = this.#t.value.value;
2727
- this.#e.setFormValue(e ?? ""), e == null ? this.removeAttribute("value") : this.setAttribute("value", e);
2728
- }), t?.addEventListener("focus", this.#v), this.addEventListener("ui-input", this.#y), this.addEventListener("ui-change", this.#b), this.addEventListener("ui-select", this.#x), this.addEventListener("ui-dismiss", this.#S), t?.addEventListener("keydown", this.#C);
2729
- }
2730
- #v = () => {
2731
- !this.#r.value && !this.#n.value && (this.#n.value = !0);
2732
- };
2733
- #y = (e) => {
2734
- this.#t.setQuery(e.detail.value), this.#n.value = !0;
2735
- };
2736
- #b = (e) => {
2737
- e.target !== this && e.stopImmediatePropagation();
2738
- };
2739
- #x = (e) => {
2740
- let t = e.detail;
2741
- n(() => {
2742
- this.#t.select(t.value), this.#t.query.value = t.label, this.#t.activeIndex.value = -1, this.#n.value = !1;
2743
- });
2744
- let r = this.#s;
2745
- r && "value" in r && (r.value = t.label), this.dispatchEvent(new CustomEvent("ui-change", {
2746
- bubbles: !0,
2747
- composed: !0,
2748
- detail: t
2749
- }));
2750
- };
2751
- #S = () => {
2752
- this.#n.value = !1;
2753
- };
2754
- #C = (e) => {
2755
- if (this.#r.value) return;
2756
- let t = this.#s;
2757
- switch (e.key) {
2758
- case "ArrowDown":
2759
- e.preventDefault(), this.#n.value || (this.#n.value = !0), this.#t.moveActive(1);
2760
- break;
2761
- case "ArrowUp":
2762
- e.preventDefault(), this.#n.value || (this.#n.value = !0), this.#t.moveActive(-1);
2763
- break;
2764
- case "Enter":
2765
- if (this.#n.value) {
2766
- e.preventDefault();
2767
- let n = this.#t.activeItem.value;
2768
- this.#t.selectActive(), n && t && "value" in t && (this.#t.query.value = n.label, t.value = n.label), this.#t.activeIndex.value = -1, this.#n.value = !1;
2769
- }
2770
- break;
2771
- case "Escape":
2772
- this.#n.value && (e.preventDefault(), this.#n.value = !1);
2773
- break;
2774
- case "Home":
2775
- this.#n.value && (e.preventDefault(), this.#t.activeIndex.value = 0);
2776
- break;
2777
- case "End":
2778
- if (this.#n.value) {
2779
- e.preventDefault();
2780
- let t = this.#t.view.value.length;
2781
- this.#t.activeIndex.value = Math.max(0, t - 1);
2782
- }
2783
- break;
2784
- }
2785
- };
2786
- teardown() {
2787
- this.#s?.removeEventListener("focus", this.#v), this.#s?.removeEventListener("keydown", this.#C), this.removeEventListener("ui-input", this.#y), this.removeEventListener("ui-change", this.#b), this.removeEventListener("ui-select", this.#x), this.removeEventListener("ui-dismiss", this.#S), this.#s = null, this.#p = null, this.#f?.abort(), this.#f = null, this.#a.destroy(), super.teardown();
2788
- }
2789
- onFormReset() {
2790
- n(() => {
2791
- this.#t.clearSelection(), this.#t.query.value = "", this.#t.activeIndex.value = -1, this.#n.value = !1;
2792
- });
2793
- let e = this.querySelector(":scope > ui-input");
2794
- e && (e.value = "");
2795
- }
2796
- onFormDisabled(e) {
2797
- this.#r.value = e;
2798
- }
2799
- }, xe = class extends c {
2800
- static observedAttributes = ["disabled", "required"];
2801
- #e = e("field-label");
2802
- #t = e("field-desc");
2803
- #n = e("field-err");
2804
- #r = null;
2805
- setup() {
2806
- super.setup(), this.deferChildren(() => {
2807
- this.#i(), this.#a(), this.#o(), this.#s(), this.#c();
2808
- }), this.addEventListener("ui-invalid", this.#l), this.addEventListener("ui-valid", this.#u);
2809
- }
2810
- teardown() {
2811
- this.removeEventListener("ui-invalid", this.#l), this.removeEventListener("ui-valid", this.#u), super.teardown();
2812
- }
2813
- attributeChangedCallback(e, t, n) {
2814
- if (t !== n) {
2815
- switch (e) {
2816
- case "disabled":
2817
- this.#s();
2818
- break;
2819
- case "required":
2820
- this.#c();
2821
- break;
2822
- }
2823
- super.attributeChangedCallback(e, t, n);
2824
- }
2825
- }
2826
- #i() {
2827
- let e = this.querySelectorAll("ui-input, ui-select, ui-combobox, ui-checkbox, ui-switch, ui-radio, ui-range, ui-textarea, ui-input-otp, input, select, textarea");
2828
- for (let t of e) if (!t.hasAttribute("slot")) {
2829
- this.#r = t;
2830
- break;
2831
- }
2832
- }
2833
- #a() {
2834
- let e = this.querySelector("[slot=\"label\"]"), t = this.querySelector("[slot=\"description\"]"), n = this.querySelector("[slot=\"error\"]");
2835
- e && !e.id && (e.id = this.#e), t && !t.id && (t.id = this.#t), n && !n.id && (n.id = this.#n);
2836
- }
2837
- #o() {
2838
- if (!this.#r) return;
2839
- let e = this.querySelector("[slot=\"label\"]"), t = this.querySelector("[slot=\"description\"]"), n = this.querySelector("[slot=\"error\"]");
2840
- e && this.#r.setAttribute("aria-labelledby", e.id);
2841
- let r = [];
2842
- t && r.push(t.id), n && r.push(n.id), r.length && this.#r.setAttribute("aria-describedby", r.join(" "));
2843
- }
2844
- #s() {
2845
- this.#r && (this.hasAttribute("disabled") ? this.#r.setAttribute("disabled", "") : this.#r.removeAttribute("disabled"));
2846
- }
2847
- #c() {
2848
- this.#r && (this.hasAttribute("required") ? this.#r.setAttribute("required", "") : this.#r.removeAttribute("required"));
2849
- }
2850
- #l = (e) => {
2851
- let t = e;
2852
- this.setAttribute("invalid", "");
2853
- let n = this.querySelector("[slot=\"error\"]");
2854
- n && t.detail?.message && (n.textContent = t.detail.message);
2855
- };
2856
- #u = () => {
2857
- this.removeAttribute("invalid");
2858
- };
2859
- }, Se = class extends y(c) {
2860
- static observedAttributes = [
2861
- "value",
2862
- "placeholder",
2863
- "disabled",
2864
- "readonly",
2865
- "required",
2866
- "name",
2867
- "rows",
2868
- "maxlength",
2869
- "autogrow"
2870
- ];
2871
- #e;
2872
- #t = t(!1);
2873
- #n = t(!1);
2874
- #r = t("");
2875
- #i = 0;
2876
- constructor() {
2877
- super(), this.#e = this.attachInternals(), this.#e.role = "textbox", this.#e.ariaMultiLine = "true", this.setAttribute("aria-multiline", "true");
2878
- }
2879
- get value() {
2880
- return this.textContent ?? "";
2881
- }
2882
- set value(e) {
2883
- this.textContent = e, this.#r.value = e, this.#e.setFormValue(e), this.#a(), this.#o();
2884
- }
2885
- get placeholder() {
2886
- return this.getAttribute("placeholder") ?? "";
2887
- }
2888
- set placeholder(e) {
2889
- this.setAttribute("placeholder", e);
2890
- }
2891
- get name() {
2892
- return this.getAttribute("name") ?? "";
2893
- }
2894
- set name(e) {
2895
- this.setAttribute("name", e);
2896
- }
2897
- get disabled() {
2898
- return this.#t.value;
2899
- }
2900
- set disabled(e) {
2901
- this.#t.value = e, this.toggleAttribute("disabled", e);
2902
- }
2903
- get readOnly() {
2904
- return this.hasAttribute("readonly");
2905
- }
2906
- set readOnly(e) {
2907
- this.toggleAttribute("readonly", e), this.setAttribute("contenteditable", e ? "false" : "plaintext-only");
2908
- }
2909
- get required() {
2910
- return this.#n.value;
2911
- }
2912
- set required(e) {
2913
- this.#n.value = e, this.toggleAttribute("required", e);
2914
- }
2915
- attributeChangedCallback(e, t, n) {
2916
- if (t !== n) {
2917
- switch (e) {
2918
- case "value":
2919
- this.textContent = n ?? "", this.#r.value = n ?? "", this.#e.setFormValue(n ?? ""), this.#a(), this.#o();
2920
- break;
2921
- case "disabled":
2922
- this.#t.value = n !== null, this.setAttribute("contenteditable", n !== null || this.hasAttribute("readonly") ? "false" : "plaintext-only");
2923
- break;
2924
- case "readonly":
2925
- this.setAttribute("contenteditable", n !== null || this.#t.value ? "false" : "plaintext-only");
2926
- break;
2927
- case "required":
2928
- this.#n.value = n !== null;
2929
- break;
2930
- case "autogrow":
2931
- this.#o();
2932
- break;
2933
- }
2934
- super.attributeChangedCallback?.(e, t, n);
2935
- }
2936
- }
2937
- setup() {
2938
- super.setup(), this.hasAttribute("contenteditable") || this.setAttribute("contenteditable", "plaintext-only"), this.#n.value = this.hasAttribute("required"), this.#r.value = this.textContent ?? "", this.#a(), this.#o(), this.addEffect(g(this, this.#t, this.#e, { manageTabindex: !0 })), this.addEffect(() => {
2939
- this.#n.value && this.#r.value === "" ? this.#e.setValidity({ valueMissing: !0 }, "Please fill out this field.", this) : this.#e.setValidity({});
2940
- }), this.addEventListener("input", this.#s), this.addEventListener("blur", this.#c);
2941
- }
2942
- teardown() {
2943
- cancelAnimationFrame(this.#i), this.removeEventListener("input", this.#s), this.removeEventListener("blur", this.#c), super.teardown();
2944
- }
2945
- onFormDisabled(e) {
2946
- this.#t.value = e, this.setAttribute("contenteditable", e || this.hasAttribute("readonly") ? "false" : "plaintext-only");
2947
- }
2948
- onFormReset() {
2949
- this.textContent = "", this.#r.value = "", this.#e.setFormValue(""), this.#a(), this.#t.value = this.hasAttribute("disabled");
2950
- }
2951
- #a() {
2952
- (this.textContent ?? "").trim() === "" ? this.#e.states.add("empty") : this.#e.states.delete("empty");
2953
- }
2954
- #o() {
2955
- !this.hasAttribute("autogrow") || !this.isConnected || (this.style.setProperty("--_autogrow-height", "auto"), cancelAnimationFrame(this.#i), this.#i = requestAnimationFrame(() => {
2956
- this.style.setProperty("--_autogrow-height", `${this.scrollHeight}px`);
2957
- }));
2958
- }
2959
- #s = () => {
2960
- let e = this.textContent ?? "", t = this.getAttribute("maxlength");
2961
- if (t !== null) {
2962
- let n = parseInt(t, 10);
2963
- if (!isNaN(n) && e.length > n) {
2964
- this.textContent = e.slice(0, n);
2965
- let t = window.getSelection();
2966
- t && (t.selectAllChildren(this), t.collapseToEnd());
2967
- }
2968
- }
2969
- let n = this.textContent ?? "";
2970
- this.#r.value = n, this.#e.setFormValue(n), this.#a(), this.#o(), this.dispatchEvent(new CustomEvent("ui-input", {
2971
- bubbles: !0,
2972
- composed: !0,
2973
- detail: { value: n }
2974
- }));
2975
- };
2976
- #c = () => {
2977
- this.dispatchEvent(new CustomEvent("ui-change", {
2978
- bubbles: !0,
2979
- composed: !0,
2980
- detail: { value: this.textContent ?? "" }
2981
- }));
2982
- };
2983
- }, Ce = class extends y(c) {
2984
- static observedAttributes = [
2985
- "value",
2986
- "min",
2987
- "max",
2988
- "step",
2989
- "disabled",
2990
- "name"
2991
- ];
2992
- #e;
2993
- #t = t(!1);
2994
- #n = t(50);
2995
- #r = 50;
2996
- #i = t(0);
2997
- #a = t(100);
2998
- #o = t(1);
2999
- #s = null;
3000
- #c = !1;
3001
- constructor() {
3002
- super(), this.#e = this.attachInternals(), this.#e.role = "slider";
3003
- }
3004
- get value() {
3005
- return this.#n.value;
3006
- }
3007
- set value(e) {
3008
- this.#n.value = this.#l(e), this.#d();
3009
- }
3010
- get min() {
3011
- return this.#i.value;
3012
- }
3013
- set min(e) {
3014
- this.#i.value = e;
3015
- }
3016
- get max() {
3017
- return this.#a.value;
3018
- }
3019
- set max(e) {
3020
- this.#a.value = e;
3021
- }
3022
- get step() {
3023
- return this.#o.value;
3024
- }
3025
- set step(e) {
3026
- this.#o.value = e;
3027
- }
3028
- get disabled() {
3029
- return this.#t.value;
3030
- }
3031
- set disabled(e) {
3032
- this.#t.value = e, this.toggleAttribute("disabled", e);
3033
- }
3034
- get name() {
3035
- return this.getAttribute("name") ?? "";
3036
- }
3037
- set name(e) {
3038
- this.setAttribute("name", e);
3039
- }
3040
- attributeChangedCallback(e, t, n) {
3041
- if (t !== n) {
3042
- switch (e) {
3043
- case "value":
3044
- this.#n.value = this.#l(parseFloat(n ?? "50") || 50);
3045
- break;
3046
- case "min":
3047
- this.#i.value = parseFloat(n ?? "0") || 0;
3048
- break;
3049
- case "max":
3050
- this.#a.value = parseFloat(n ?? "100") || 100;
3051
- break;
3052
- case "step":
3053
- this.#o.value = parseFloat(n ?? "1") || 1;
3054
- break;
3055
- case "disabled":
3056
- this.#t.value = n !== null;
3057
- break;
3058
- }
3059
- super.attributeChangedCallback(e, t, n);
3060
- }
3061
- }
3062
- setup() {
3063
- super.setup(), this.#r = this.#n.value, this.#s = document.createElement("div"), this.#s.classList.add("ui-range-thumb"), this.appendChild(this.#s), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.addEffect(g(this, this.#t, this.#e, { manageTabindex: !0 })), this.addEffect(() => {
3064
- let e = this.#u();
3065
- this.style.setProperty("--_progress", String(e)), this.#e.ariaValueNow = String(this.#n.value), this.#e.ariaValueMin = String(this.#i.value), this.#e.ariaValueMax = String(this.#a.value);
3066
- }), this.#d(), this.addEventListener("pointerdown", this.#p), this.addEventListener("keydown", this.#_);
3067
- }
3068
- teardown() {
3069
- this.removeEventListener("pointerdown", this.#p), this.removeEventListener("keydown", this.#_), this.#s &&= (this.#s.remove(), null), super.teardown();
3070
- }
3071
- onFormDisabled(e) {
3072
- this.#t.value = e;
3073
- }
3074
- onFormReset() {
3075
- this.#n.value = this.#r, this.#d();
3076
- }
3077
- #l(e) {
3078
- let t = this.#i.value, n = this.#a.value, r = this.#o.value, i = Math.round((e - t) / r) * r + t;
3079
- return Math.min(n, Math.max(t, i));
3080
- }
3081
- #u() {
3082
- let e = this.#a.value - this.#i.value;
3083
- return e === 0 ? 0 : (this.#n.value - this.#i.value) / e;
3084
- }
3085
- #d() {
3086
- this.#e.setFormValue(String(this.#n.value));
3087
- }
3088
- #f(e) {
3089
- let t = this.getBoundingClientRect(), n = this.#s?.offsetWidth ?? 0, r = n / 2, i = t.width - n;
3090
- if (i <= 0) return this.#i.value;
3091
- let a = e.clientX - t.left - r, o = Math.min(1, Math.max(0, a / i));
3092
- return this.#i.value + o * (this.#a.value - this.#i.value);
3093
- }
3094
- #p = (e) => {
3095
- if (e.button !== 0 || this.#t.value) return;
3096
- this.setPointerCapture(e.pointerId), this.#c = !0, this.toggleAttribute("pressed", !0);
3097
- let t = this.#l(this.#f(e));
3098
- this.#n.value = t, this.#d(), this.#v(), this.addEventListener("pointermove", this.#m), this.addEventListener("pointerup", this.#h), this.addEventListener("pointercancel", this.#g);
3099
- };
3100
- #m = (e) => {
3101
- if (!this.#c || this.#t.value) return;
3102
- let t = this.#l(this.#f(e));
3103
- t !== this.#n.value && (this.#n.value = t, this.#d(), this.#v());
3104
- };
3105
- #h = () => {
3106
- this.#c = !1, this.removeAttribute("pressed"), this.removeEventListener("pointermove", this.#m), this.removeEventListener("pointerup", this.#h), this.removeEventListener("pointercancel", this.#g), this.#y();
3107
- };
3108
- #g = () => {
3109
- this.#c = !1, this.removeAttribute("pressed"), this.removeEventListener("pointermove", this.#m), this.removeEventListener("pointerup", this.#h), this.removeEventListener("pointercancel", this.#g);
3110
- };
3111
- #_ = (e) => {
3112
- if (this.#t.value) return;
3113
- let t = this.#o.value, n = t * 10, r = this.#n.value;
3114
- switch (e.key) {
3115
- case "ArrowRight":
3116
- case "ArrowUp":
3117
- r += t;
3118
- break;
3119
- case "ArrowLeft":
3120
- case "ArrowDown":
3121
- r -= t;
3122
- break;
3123
- case "PageUp":
3124
- r += n;
3125
- break;
3126
- case "PageDown":
3127
- r -= n;
3128
- break;
3129
- case "Home":
3130
- r = this.#i.value;
3131
- break;
3132
- case "End":
3133
- r = this.#a.value;
3134
- break;
3135
- default: return;
3136
- }
3137
- e.preventDefault(), r = this.#l(r), r !== this.#n.value && (this.#n.value = r, this.#d(), this.#v(), this.#y());
3138
- };
3139
- #v() {
3140
- this.dispatchEvent(new CustomEvent("ui-input", {
3141
- bubbles: !0,
3142
- composed: !0,
3143
- detail: { value: this.#n.value }
3144
- }));
3145
- }
3146
- #y() {
3147
- this.dispatchEvent(new CustomEvent("ui-change", {
3148
- bubbles: !0,
3149
- composed: !0,
3150
- detail: { value: this.#n.value }
3151
- }));
3152
- }
3153
- }, we = class extends y(c) {
3154
- static observedAttributes = [
3155
- "value",
3156
- "length",
3157
- "disabled",
3158
- "name",
3159
- "pattern",
3160
- "mask",
3161
- "required"
3162
- ];
3163
- #e;
3164
- #t = t(!1);
3165
- #n;
3166
- #r = [];
3167
- #i = [];
3168
- #a = 6;
3169
- #o = /[0-9]/;
3170
- constructor() {
3171
- super(), this.#e = this.attachInternals(), this.#e.role = "group", this.#n = _(this, "disabled", { type: "boolean" });
3172
- }
3173
- get value() {
3174
- return this.#i.join("");
3175
- }
3176
- set value(e) {
3177
- this.#i = e.split("").slice(0, this.#a), this.#c(), this.#l();
3178
- }
3179
- get name() {
3180
- return this.getAttribute("name") ?? "";
3181
- }
3182
- set name(e) {
3183
- this.setAttribute("name", e);
3184
- }
3185
- get disabled() {
3186
- return this.#n.value;
3187
- }
3188
- set disabled(e) {
3189
- this.#n.set(e);
3190
- }
3191
- get required() {
3192
- return this.#t.value;
3193
- }
3194
- set required(e) {
3195
- this.#t.value = e, this.toggleAttribute("required", e);
3196
- }
3197
- attributeChangedCallback(e, t, n) {
3198
- if (t !== n) {
3199
- if (v({ disabled: this.#n }, e, n)) {
3200
- super.attributeChangedCallback(e, t, n);
3201
- return;
3202
- }
3203
- switch (e) {
3204
- case "value":
3205
- this.value = n ?? "";
3206
- break;
3207
- case "length": {
3208
- let e = parseInt(n ?? "6", 10);
3209
- !isNaN(e) && e >= 1 && e <= 12 && (this.#a = e, this.isConnected && this.#s());
3210
- break;
3211
- }
3212
- case "pattern":
3213
- try {
3214
- this.#o = new RegExp(n ?? "[0-9]");
3215
- } catch {}
3216
- break;
3217
- case "required":
3218
- this.#t.value = n !== null, this.isConnected && this.#l();
3219
- break;
3220
- }
3221
- super.attributeChangedCallback(e, t, n);
3222
- }
3223
- }
3224
- setup() {
3225
- super.setup();
3226
- let e = this.getAttribute("length");
3227
- if (e) {
3228
- let t = parseInt(e, 10);
3229
- !isNaN(t) && t >= 1 && t <= 12 && (this.#a = t);
3230
- }
3231
- let t = this.getAttribute("pattern");
3232
- if (t) try {
3233
- this.#o = new RegExp(t);
3234
- } catch {}
3235
- this.#s(), this.addEffect(g(this, this.#n.signal, this.#e, { manageTabindex: !1 })), this.#t.value = this.hasAttribute("required");
3236
- let n = this.getAttribute("value");
3237
- n && (this.value = n), this.addEventListener("paste", this.#m);
3238
- }
3239
- teardown() {
3240
- for (let e of this.#r) e.removeEventListener("input", this.#d), e.removeEventListener("keydown", this.#f), e.removeEventListener("focus", this.#p);
3241
- this.removeEventListener("paste", this.#m), super.teardown();
3242
- }
3243
- #s() {
3244
- for (let e of this.#r) e.removeEventListener("input", this.#d), e.removeEventListener("keydown", this.#f), e.removeEventListener("focus", this.#p), e.remove();
3245
- this.#r = [], this.#i = [];
3246
- for (let e = 0; e < this.#a; e++) {
3247
- let e = document.createElement("div");
3248
- e.classList.add("ui-otp-cell"), e.setAttribute("data-empty", ""), e.setAttribute("contenteditable", "plaintext-only"), e.setAttribute("inputmode", "numeric"), e.addEventListener("input", this.#d), e.addEventListener("keydown", this.#f), e.addEventListener("focus", this.#p), this.appendChild(e), this.#r.push(e), this.#i.push("");
3249
- }
3250
- }
3251
- #c() {
3252
- for (let e = 0; e < this.#a; e++) {
3253
- let t = this.#r[e];
3254
- if (!t) continue;
3255
- let n = this.#i[e] ?? "";
3256
- t.textContent = n, n ? t.removeAttribute("data-empty") : t.setAttribute("data-empty", "");
3257
- }
3258
- }
3259
- #l() {
3260
- let e = this.value;
3261
- this.#e.setFormValue(e), this.#t.value && e.length < this.#a ? this.#e.setValidity({ valueMissing: !0 }, "Please fill out this field.", this) : this.#e.setValidity({});
3262
- }
3263
- #u(e) {
3264
- let t = this.#r[e];
3265
- if (t) {
3266
- t.focus();
3267
- let e = window.getSelection();
3268
- e && (e.selectAllChildren(t), e.collapseToEnd());
3269
- }
3270
- }
3271
- #d = (e) => {
3272
- if (this.disabled) return;
3273
- let t = e.target, n = this.#r.indexOf(t);
3274
- if (n === -1) return;
3275
- let r = t.textContent ?? "";
3276
- if (r.length > 0) {
3277
- let e = r[r.length - 1];
3278
- this.#o.test(e) ? (this.#i[n] = e, t.textContent = e, t.removeAttribute("data-empty"), this.#l(), this.#h(), n < this.#a - 1 && this.#u(n + 1), this.value.length === this.#a && this.#g()) : t.textContent = this.#i[n] || "";
3279
- } else this.#i[n] = "", t.setAttribute("data-empty", ""), this.#l(), this.#h();
3280
- };
3281
- #f = (e) => {
3282
- if (this.disabled) return;
3283
- let t = e.target, n = this.#r.indexOf(t);
3284
- n !== -1 && (e.key === "Backspace" ? (this.#i[n] ? (this.#i[n] = "", t.textContent = "", t.setAttribute("data-empty", ""), this.#l(), this.#h()) : n > 0 && this.#u(n - 1), e.preventDefault()) : e.key === "ArrowLeft" && n > 0 ? (this.#u(n - 1), e.preventDefault()) : e.key === "ArrowRight" && n < this.#a - 1 ? (this.#u(n + 1), e.preventDefault()) : e.key === "Delete" && (this.#i[n] = "", t.textContent = "", t.setAttribute("data-empty", ""), this.#l(), this.#h(), e.preventDefault()));
3285
- };
3286
- #p = (e) => {
3287
- let t = e.target, n = window.getSelection();
3288
- n && (n.selectAllChildren(t), n.collapseToEnd());
3289
- };
3290
- #m = (e) => {
3291
- if (this.disabled) {
3292
- e.preventDefault();
3293
- return;
3294
- }
3295
- e.preventDefault();
3296
- let t = (e.clipboardData?.getData("text") ?? "").split("").filter((e) => this.#o.test(e)).slice(0, this.#a);
3297
- for (let e = 0; e < this.#a; e++) this.#i[e] = t[e] ?? "";
3298
- this.#c(), this.#l(), this.#h();
3299
- let n = this.#i.findIndex((e) => !e);
3300
- this.#u(n >= 0 ? n : this.#a - 1), t.length === this.#a && this.#g();
3301
- };
3302
- onFormDisabled(e) {
3303
- this.#n.signal.value = e;
3304
- for (let t of this.#r) t.setAttribute("contenteditable", e ? "false" : "plaintext-only");
3305
- }
3306
- onFormReset() {
3307
- this.value = "", this.#n.signal.value = this.hasAttribute("disabled");
3308
- }
3309
- #h() {
3310
- this.dispatchEvent(new CustomEvent("ui-input", {
3311
- bubbles: !0,
3312
- composed: !0,
3313
- detail: { value: this.value }
3314
- }));
3315
- }
3316
- #g() {
3317
- this.dispatchEvent(new CustomEvent("ui-change", {
3318
- bubbles: !0,
3319
- composed: !0,
3320
- detail: { value: this.value }
3321
- }));
3322
- }
3323
- }, Te = class extends c {
3324
- static observedAttributes = [
3325
- "src",
3326
- "name",
3327
- "alt"
3328
- ];
3329
- #e;
3330
- #t = null;
3331
- constructor() {
3332
- super(), this.#e = this.attachInternals(), this.#e.role = "img";
3333
- }
3334
- get src() {
3335
- return this.getAttribute("src") ?? "";
3336
- }
3337
- set src(e) {
3338
- this.setAttribute("src", e);
3339
- }
3340
- get name() {
3341
- return this.getAttribute("name") ?? "";
3342
- }
3343
- set name(e) {
3344
- this.setAttribute("name", e);
3345
- }
3346
- attributeChangedCallback(e, t, n) {
3347
- t !== n && (this.isConnected && this.#n(), super.attributeChangedCallback(e, t, n));
3348
- }
3349
- setup() {
3350
- super.setup(), this.#n();
3351
- }
3352
- teardown() {
3353
- this.#t &&= (this.#t.removeEventListener("error", this.#i), null), super.teardown();
3354
- }
3355
- #n() {
3356
- this.textContent = "", this.#t = null;
3357
- let e = this.getAttribute("src"), t = this.getAttribute("name"), n = this.getAttribute("alt") ?? t ?? "";
3358
- this.#e.ariaLabel = n, this.setAttribute("aria-label", n), e ? (this.#t = document.createElement("img"), this.#t.src = e, this.#t.alt = n, this.#t.addEventListener("error", this.#i), this.appendChild(this.#t)) : t ? this.textContent = this.#r(t) : this.textContent = "?";
3359
- }
3360
- #r(e) {
3361
- let t = e.trim().split(/\s+/);
3362
- return t.length === 0 ? "?" : t.length === 1 ? t[0][0].toUpperCase() : (t[0][0] + t[t.length - 1][0]).toUpperCase();
3363
- }
3364
- #i = () => {
3365
- this.#t &&= (this.#t.removeEventListener("error", this.#i), this.#t.remove(), null);
3366
- let e = this.getAttribute("name");
3367
- e ? this.textContent = this.#r(e) : this.textContent = "?";
3368
- };
3369
- }, Ee = class extends c {
3370
- static observedAttributes = ["max"];
3371
- #e;
3372
- #t = "";
3373
- constructor() {
3374
- super(), this.#e = this.attachInternals(), this.#e.role = "status";
3375
- }
3376
- attributeChangedCallback(e, t, n) {
3377
- t !== n && (e === "max" && this.isConnected && this.#n(), super.attributeChangedCallback(e, t, n));
3378
- }
3379
- setup() {
3380
- super.setup(), this.#t = this.textContent?.trim() ?? "", this.#n();
3381
- }
3382
- #n() {
3383
- let e = this.getAttribute("max");
3384
- if (!e) return;
3385
- let t = parseInt(e, 10);
3386
- if (isNaN(t)) return;
3387
- let n = parseInt(this.#t, 10);
3388
- isNaN(n) || (n > t ? this.textContent = `${t}+` : this.textContent = this.#t);
3389
- }
3390
- }, De = class extends c {}, Oe = class extends c {
3391
- #e;
3392
- constructor() {
3393
- super(), this.#e = this.attachInternals(), this.#e.role = "navigation";
3394
- }
3395
- setup() {
3396
- super.setup();
3397
- let e = this.getAttribute("aria-label") ?? "Breadcrumb";
3398
- this.#e.ariaLabel = e, this.hasAttribute("aria-label") || this.setAttribute("aria-label", e);
3399
- }
3400
- }, ke = class extends c {
3401
- static observedAttributes = ["href", "current"];
3402
- #e;
3403
- constructor() {
3404
- super(), this.#e = this.attachInternals(), this.#e.role = "link";
3405
- }
3406
- setup() {
3407
- super.setup(), this.#t(), !this.hasAttribute("current") && !this.hasAttribute("tabindex") && this.setAttribute("tabindex", "0"), this.addEventListener("click", this.#n), this.addEventListener("keydown", this.#r);
3408
- }
3409
- teardown() {
3410
- this.removeEventListener("click", this.#n), this.removeEventListener("keydown", this.#r), super.teardown();
3411
- }
3412
- attributeChangedCallback(e, t, n) {
3413
- t !== n && (this.isConnected && this.#t(), super.attributeChangedCallback(e, t, n));
3414
- }
3415
- #t() {
3416
- this.hasAttribute("current") ? (this.setAttribute("aria-disabled", "true"), this.setAttribute("aria-current", "page"), this.removeAttribute("tabindex")) : (this.removeAttribute("aria-disabled"), this.removeAttribute("aria-current"), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"));
3417
- }
3418
- #n = () => {
3419
- if (this.hasAttribute("current")) return;
3420
- let e = this.getAttribute("href");
3421
- e && (window.location.href = e);
3422
- };
3423
- #r = (e) => {
3424
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.#n());
3425
- };
3426
- }, Ae = class extends c {
3427
- static observedAttributes = [
3428
- "total",
3429
- "value",
3430
- "siblings",
3431
- "boundaries",
3432
- "disabled"
3433
- ];
3434
- #e;
3435
- #t = t(1);
3436
- #n = t(1);
3437
- #r = t(1);
3438
- #i = t(1);
3439
- #a = t(!1);
3440
- constructor() {
3441
- super(), this.#e = this.attachInternals(), this.#e.role = "navigation";
3442
- }
3443
- get total() {
3444
- return this.#t.value;
3445
- }
3446
- set total(e) {
3447
- this.#t.value = Math.max(1, e);
3448
- }
3449
- get value() {
3450
- return this.#n.value;
3451
- }
3452
- set value(e) {
3453
- this.#n.value = Math.min(Math.max(1, e), this.#t.value);
3454
- }
3455
- get siblings() {
3456
- return this.#r.value;
3457
- }
3458
- set siblings(e) {
3459
- this.#r.value = Math.max(0, e);
3460
- }
3461
- get boundaries() {
3462
- return this.#i.value;
3463
- }
3464
- set boundaries(e) {
3465
- this.#i.value = Math.max(0, e);
3466
- }
3467
- get disabled() {
3468
- return this.#a.value;
3469
- }
3470
- set disabled(e) {
3471
- this.#a.value = e, this.toggleAttribute("disabled", e);
3472
- }
3473
- attributeChangedCallback(e, t, n) {
3474
- if (t === n) return;
3475
- let r = parseInt(n ?? "", 10);
3476
- switch (e) {
3477
- case "total":
3478
- this.#t.value = Math.max(1, isNaN(r) ? 1 : r);
3479
- break;
3480
- case "value":
3481
- this.#n.value = Math.min(Math.max(1, isNaN(r) ? 1 : r), this.#t.value);
3482
- break;
3483
- case "siblings":
3484
- this.#r.value = Math.max(0, isNaN(r) ? 1 : r);
3485
- break;
3486
- case "boundaries":
3487
- this.#i.value = Math.max(0, isNaN(r) ? 1 : r);
3488
- break;
3489
- case "disabled":
3490
- this.#a.value = n !== null;
3491
- return;
3492
- }
3493
- super.attributeChangedCallback(e, t, n);
3494
- }
3495
- setup() {
3496
- super.setup();
3497
- let e = this.getAttribute("aria-label") ?? "Pagination";
3498
- this.#e.ariaLabel = e, this.hasAttribute("aria-label") || this.setAttribute("aria-label", e), this.addEffect(g(this, this.#a, this.#e)), this.addEffect(() => {
3499
- this.#l();
3500
- });
3501
- }
3502
- teardown() {
3503
- this.textContent = "", super.teardown();
3504
- }
3505
- #o() {
3506
- let e = this.#t.value, t = this.#n.value, n = this.#r.value, r = this.#i.value;
3507
- if (e <= r * 2 + n * 2 + 3) return Array.from({ length: e }, (e, t) => t + 1);
3508
- let i = [];
3509
- for (let e = 1; e <= r; e++) i.push(e);
3510
- let a = Math.max(r + 1, t - n);
3511
- a > r + 1 && i.push("ellipsis");
3512
- let o = Math.min(e - r, t + n);
3513
- for (let e = a; e <= o; e++) i.includes(e) || i.push(e);
3514
- o < e - r && i.push("ellipsis");
3515
- for (let t = e - r + 1; t <= e; t++) i.includes(t) || i.push(t);
3516
- return i;
3517
- }
3518
- #s(e, t, n, r) {
3519
- let i = document.createElement("ui-button");
3520
- return i.setAttribute("variant", "ghost"), i.setAttribute("aria-label", t), n && i.setAttribute("disabled", ""), i.textContent = e, i.addEventListener("ui-press", r), i;
3521
- }
3522
- #c(e, t, n, r) {
3523
- let i = document.createElement("ui-button");
3524
- i.setAttribute("variant", "ghost"), i.setAttribute("aria-label", t), n && i.setAttribute("disabled", "");
3525
- let a = document.createElement("ui-icon");
3526
- return a.setAttribute("name", e), i.appendChild(a), i.addEventListener("ui-press", r), i;
3527
- }
3528
- #l() {
3529
- let e = this.#t.value, t = this.#n.value, n = this.#o();
3530
- this.textContent = "", this.appendChild(this.#c("caret-left", "Previous page", t <= 1, () => this.#u(t - 1)));
3531
- for (let e of n) if (e === "ellipsis") {
3532
- let e = document.createElement("span");
3533
- e.classList.add("ui-pagination-ellipsis"), e.textContent = "…", this.appendChild(e);
3534
- } else {
3535
- let n = this.#s(String(e), `Page ${e}`, !1, () => this.#u(e));
3536
- e === t && n.setAttribute("aria-current", "page"), this.appendChild(n);
3537
- }
3538
- this.appendChild(this.#c("caret-right", "Next page", t >= e, () => this.#u(t + 1)));
3539
- }
3540
- #u(e) {
3541
- if (this.#a.value) return;
3542
- let t = Math.min(Math.max(1, e), this.#t.value);
3543
- t !== this.#n.value && (this.#n.value = t, this.setAttribute("value", String(t)), this.dispatchEvent(new CustomEvent("ui-change", {
3544
- bubbles: !0,
3545
- composed: !0,
3546
- detail: { value: t }
3547
- })));
3548
- }
3549
- }, je = class extends c {
3550
- static observedAttributes = [
3551
- "side",
3552
- "no-close-on-escape",
3553
- "no-close-on-backdrop"
3554
- ];
3555
- #e;
3556
- get open() {
3557
- return this.#e.open;
3558
- }
3559
- showModal() {
3560
- this.#e.showModal();
3561
- }
3562
- close() {
3563
- this.#e.close();
3564
- }
3565
- setup() {
3566
- super.setup(), this.#e = new h(this, { contentTarget: () => document.createElement("ui-drawer-panel") });
3567
- }
3568
- teardown() {
3569
- this.#e.destroy(), super.teardown();
3570
- }
3571
- }, Me = class extends c {
3572
- static observedAttributes = ["disabled"];
3573
- #e;
3574
- #t = t(!1);
3575
- #n;
3576
- constructor() {
3577
- super(), this.#e = this.attachInternals(), this.#e.role = "tree";
3578
- }
3579
- get disabled() {
3580
- return this.#t.value;
3581
- }
3582
- set disabled(e) {
3583
- this.#t.value = e, this.toggleAttribute("disabled", e);
3584
- }
3585
- attributeChangedCallback(e, t, n) {
3586
- t !== n && (e === "disabled" && (this.#t.value = n !== null), super.attributeChangedCallback?.(e, t, n));
3587
- }
3588
- setup() {
3589
- super.setup(), this.#n = new l(this, {
3590
- selector: ":scope ui-tree-item > [slot=\"label\"]",
3591
- orientation: "vertical"
3592
- });
3593
- let e = this.getAttribute("aria-label") ?? "Tree";
3594
- this.#e.ariaLabel = e, this.hasAttribute("aria-label") || this.setAttribute("aria-label", e), this.addEffect(g(this, this.#t, this.#e));
3595
- }
3596
- teardown() {
3597
- this.#n.destroy(), super.teardown();
3598
- }
3599
- }, Ne = class extends c {
3600
- static observedAttributes = [
3601
- "expanded",
3602
- "selected",
3603
- "disabled"
3604
- ];
3605
- #e;
3606
- #t = null;
3607
- #n = null;
3608
- #r = t(!1);
3609
- constructor() {
3610
- super(), this.#e = this.attachInternals(), this.#e.role = "treeitem";
3611
- }
3612
- get disabled() {
3613
- return this.#r.value;
3614
- }
3615
- set disabled(e) {
3616
- this.#r.value = e, this.toggleAttribute("disabled", e);
3617
- }
3618
- setup() {
3619
- super.setup(), this.addEffect(g(this, this.#r, this.#e)), this.deferChildren(() => {
3620
- this.#i(), this.#a();
3621
- }), this.addEventListener("click", this.#o), this.addEventListener("keydown", this.#s);
3622
- }
3623
- teardown() {
3624
- this.removeEventListener("click", this.#o), this.removeEventListener("keydown", this.#s), super.teardown();
3625
- }
3626
- attributeChangedCallback(e, t, n) {
3627
- t !== n && (e === "disabled" && (this.#r.value = n !== null), this.isConnected && this.#a(), super.attributeChangedCallback(e, t, n));
3628
- }
3629
- #i() {
3630
- let e = this.querySelectorAll(":scope > ui-tree-item");
3631
- if (e.length > 0) {
3632
- this.setAttribute("expandable", "");
3633
- let t = this.querySelector(":scope > [slot=\"label\"]");
3634
- t && (this.#n = document.createElement("ui-icon"), this.#n.setAttribute("name", this.hasAttribute("expanded") ? "caret-down" : "caret-right"), this.#n.classList.add("ui-tree-caret"), t.prepend(this.#n)), this.#t = document.createElement("div"), this.#t.classList.add("ui-tree-children");
3635
- for (let t of e) this.#t.appendChild(t);
3636
- this.appendChild(this.#t);
3637
- }
3638
- let t = 0, n = this.parentElement;
3639
- for (; n;) {
3640
- if (n.tagName === "UI-TREE-ITEM") t++;
3641
- else if (!n.classList?.contains("ui-tree-children")) break;
3642
- n = n.parentElement;
3643
- }
3644
- if (t > 0) {
3645
- let e = this.querySelector(":scope > [slot=\"label\"]");
3646
- e instanceof HTMLElement && e.style.setProperty("--_tree-depth", String(t));
3647
- }
3648
- let r = this.querySelector(":scope > [slot=\"label\"]");
3649
- r instanceof HTMLElement && !r.hasAttribute("tabindex") && r.setAttribute("tabindex", "-1");
3650
- }
3651
- #a() {
3652
- let e = this.hasAttribute("expanded"), t = this.hasAttribute("selected");
3653
- this.hasAttribute("expandable") ? this.setAttribute("aria-expanded", String(e)) : this.removeAttribute("aria-expanded"), this.setAttribute("aria-selected", String(t)), this.#n && this.#n.setAttribute("name", e ? "caret-down" : "caret-right");
3654
- }
3655
- #o = (e) => {
3656
- let t = e.target, n = this.querySelector(":scope > [slot=\"label\"]");
3657
- t !== n && !n?.contains(t) || (e.stopPropagation(), !this.#r.value && (this.hasAttribute("expandable") && this.toggleAttribute("expanded"), this.toggleAttribute("selected", !0)));
3658
- };
3659
- #s = (e) => {
3660
- if (e.target === this.querySelector(":scope > [slot=\"label\"]") && !this.#r.value) switch (e.key) {
3661
- case "ArrowRight":
3662
- if (this.hasAttribute("expandable") && !this.hasAttribute("expanded")) this.setAttribute("expanded", ""), e.preventDefault(), e.stopPropagation();
3663
- else if (this.hasAttribute("expanded")) {
3664
- let t = this.querySelector(":scope > .ui-tree-children > ui-tree-item > [slot=\"label\"]");
3665
- t && (t.focus(), e.preventDefault(), e.stopPropagation());
3666
- }
3667
- break;
3668
- case "ArrowLeft":
3669
- if (this.hasAttribute("expanded")) this.removeAttribute("expanded"), e.preventDefault(), e.stopPropagation();
3670
- else {
3671
- let t = (this.parentElement?.closest("ui-tree-item"))?.querySelector(":scope > [slot=\"label\"]");
3672
- t && (t.focus(), e.preventDefault(), e.stopPropagation());
3673
- }
3674
- break;
3675
- case "Enter":
3676
- case " ":
3677
- e.preventDefault(), e.stopPropagation(), this.toggleAttribute("selected", !0), this.hasAttribute("expandable") && this.toggleAttribute("expanded");
3678
- break;
3679
- }
3680
- };
3681
- }, Pe = class extends c {
3682
- static observedAttributes = [
3683
- "direction",
3684
- "controls",
3685
- "indicators",
3686
- "autoplay",
3687
- "interval",
3688
- "loop",
3689
- "peek",
3690
- "per-view",
3691
- "gap",
3692
- "disabled"
3693
- ];
3694
- #e = null;
3695
- #t = null;
3696
- #n = null;
3697
- #r = null;
3698
- #i = null;
3699
- #a = t(0);
3700
- #o = t(0);
3701
- #s = t(!1);
3702
- #c = null;
3703
- #l = null;
3704
- #u = null;
3705
- #d = [];
3706
- #f = !1;
3707
- #p = 0;
3708
- #m = 0;
3709
- #h = 0;
3710
- #g = 0;
3711
- #_;
3712
- constructor() {
3713
- super(), this.#_ = this.attachInternals(), this.#_.role = "region";
3714
- }
3715
- get index() {
3716
- return this.#a.value;
3717
- }
3718
- goTo(e) {
3719
- let t = this.#d.length;
3720
- if (t === 0) return;
3721
- let n = e;
3722
- n = this.hasAttribute("loop") ? (e % t + t) % t : Math.max(0, Math.min(e, t - 1));
3723
- let r = this.#d[n];
3724
- if (!r) return;
3725
- let i = this.getAttribute("direction") === "vertical";
3726
- r.scrollIntoView({
3727
- block: i ? "start" : "nearest",
3728
- inline: i ? "nearest" : "start"
3729
- });
3730
- }
3731
- next() {
3732
- this.goTo(this.#a.value + 1);
3733
- }
3734
- prev() {
3735
- this.goTo(this.#a.value - 1);
3736
- }
3737
- attributeChangedCallback(e, t, n) {
3738
- if (t !== n) {
3739
- switch (e) {
3740
- case "disabled":
3741
- this.#s.value = n !== null;
3742
- break;
3743
- case "per-view":
3744
- this.#v(n);
3745
- break;
3746
- case "autoplay":
3747
- n === null ? this.#E() : this.#T();
3748
- break;
3749
- }
3750
- super.attributeChangedCallback?.(e, t, n);
3751
- }
3752
- }
3753
- setup() {
3754
- super.setup(), this.#l = window.matchMedia("(prefers-reduced-motion: reduce)");
3755
- let t = document.createElement("div");
3756
- t.setAttribute("part", "track"), t.id = e("ss-track"), t.setAttribute("tabindex", "0");
3757
- let n = [];
3758
- for (; this.firstChild;) {
3759
- let e = this.firstChild;
3760
- t.appendChild(e), e instanceof HTMLElement && e.tagName.toLowerCase() === "ui-slide" && n.push(e);
3761
- }
3762
- this.appendChild(t), this.#e = t, this.#d = n;
3763
- let r = document.createElement("div");
3764
- r.setAttribute("part", "controls");
3765
- let i = document.createElement("button");
3766
- i.setAttribute("part", "prev"), i.setAttribute("aria-label", "Previous slide"), i.setAttribute("type", "button"), i.innerHTML = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 256 256\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z\" fill=\"currentColor\"/></svg>";
3767
- let a = document.createElement("button");
3768
- a.setAttribute("part", "next"), a.setAttribute("aria-label", "Next slide"), a.setAttribute("type", "button"), a.innerHTML = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 256 256\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z\" fill=\"currentColor\"/></svg>", r.appendChild(i), r.appendChild(a), this.appendChild(r), this.#n = i, this.#r = a;
3769
- let o = document.createElement("div");
3770
- o.setAttribute("part", "indicators"), o.setAttribute("aria-hidden", "true"), this.appendChild(o), this.#t = o;
3771
- let s = document.createElement("div");
3772
- s.id = e("ss-live"), s.setAttribute("aria-live", "polite"), s.setAttribute("aria-atomic", "true"), s.setAttribute("data-visually-hidden", ""), this.appendChild(s), this.#i = s, this.setAttribute("aria-roledescription", "carousel"), this.hasAttribute("aria-label") || this.setAttribute("aria-label", "Slideshow"), this.#v(this.getAttribute("per-view")), this.#o.value = n.length, this.#y(n), this.#b(n.length), this.#S(n), n.length > 0 && n[0].toggleAttribute("active", !0), this.addEffect(() => {
3773
- let e = this.#a.value, t = this.#o.value;
3774
- this.#C(e), this.#w(e, t), this.#i && (this.#i.textContent = `Slide ${e + 1} of ${t}`);
3775
- }), this.addEffect(g(this, this.#s, this.#_)), i.addEventListener("click", this.#D), a.addEventListener("click", this.#O), t.addEventListener("keydown", this.#P), t.addEventListener("pointerdown", this.#j), this.addEventListener("mouseenter", this.#k), this.addEventListener("mouseleave", this.#A), this.addEventListener("focusin", this.#k), this.addEventListener("focusout", this.#A), this.hasAttribute("autoplay") && this.#T();
3776
- }
3777
- teardown() {
3778
- this.#E(), this.#u?.disconnect(), this.#u = null, this.#n?.removeEventListener("click", this.#D), this.#r?.removeEventListener("click", this.#O), this.#e?.removeEventListener("keydown", this.#P), this.#e?.removeEventListener("pointerdown", this.#j), this.removeEventListener("mouseenter", this.#k), this.removeEventListener("mouseleave", this.#A), this.removeEventListener("focusin", this.#k), this.removeEventListener("focusout", this.#A), this.#e = null, this.#t?.removeEventListener("click", this.#x), this.#t && (this.#t.innerHTML = ""), this.#t = null, this.#n = null, this.#r = null, this.#i = null, this.#d = [], super.teardown();
3779
- }
3780
- #v(e) {
3781
- let t = Math.max(1, parseInt(e ?? "1", 10) || 1);
3782
- this.style.setProperty("--_per-view", String(t));
3783
- }
3784
- #y(t) {
3785
- let n = t.length;
3786
- for (let r = 0; r < n; r++) {
3787
- let i = t[r];
3788
- i.setAttribute("role", "group"), i.setAttribute("aria-roledescription", "slide"), i.setAttribute("aria-label", `${r + 1} of ${n}`), i.id ||= e("slide");
3789
- }
3790
- }
3791
- #b(e) {
3792
- let t = this.#t;
3793
- if (t) {
3794
- t.addEventListener("click", this.#x);
3795
- for (let n = 0; n < e; n++) {
3796
- let e = document.createElement("button");
3797
- e.setAttribute("part", "dot"), e.setAttribute("type", "button"), e.setAttribute("aria-label", `Go to slide ${n + 1}`), e.setAttribute("data-index", String(n)), n === 0 && e.toggleAttribute("active", !0), t.appendChild(e);
3798
- }
3799
- }
3800
- }
3801
- #x = (e) => {
3802
- let t = e.target.closest("[data-index]");
3803
- if (!t) return;
3804
- let n = parseInt(t.dataset.index ?? "", 10);
3805
- isNaN(n) || (this.#E(), this.goTo(n));
3806
- };
3807
- #S(e) {
3808
- let t = this.#e;
3809
- if (!(!t || e.length === 0)) {
3810
- this.#u = new IntersectionObserver((e) => {
3811
- for (let t of e) if (t.isIntersecting && t.intersectionRatio >= .5) {
3812
- let e = t.target, n = this.#d.indexOf(e);
3813
- n !== -1 && n !== this.#a.value && (this.#a.value = n, this.#d.forEach((e, t) => e.toggleAttribute("active", t === n)), this.dispatchEvent(new CustomEvent("ui-slide-change", {
3814
- bubbles: !0,
3815
- composed: !0,
3816
- detail: {
3817
- index: n,
3818
- slide: e
3819
- }
3820
- })));
3821
- }
3822
- }, {
3823
- root: t,
3824
- threshold: .5
3825
- });
3826
- for (let t of e) this.#u.observe(t);
3827
- }
3828
- }
3829
- #C(e) {
3830
- let t = this.#t?.querySelectorAll("[part=\"dot\"]");
3831
- t && t.forEach((t, n) => t.toggleAttribute("active", n === e));
3832
- }
3833
- #w(e, t) {
3834
- if (!this.#n || !this.#r) return;
3835
- let n = this.hasAttribute("loop");
3836
- this.#n.disabled = !n && e === 0, this.#r.disabled = !n && e === t - 1;
3837
- }
3838
- #T() {
3839
- if (this.#l?.matches) return;
3840
- this.#E();
3841
- let e = parseInt(this.getAttribute("interval") ?? "5000", 10) || 5e3;
3842
- this.#c = setInterval(() => this.next(), e);
3843
- }
3844
- #E() {
3845
- this.#c !== null && (clearInterval(this.#c), this.#c = null);
3846
- }
3847
- #D = () => {
3848
- this.#E(), this.prev();
3849
- };
3850
- #O = () => {
3851
- this.#E(), this.next();
3852
- };
3853
- #k = () => {
3854
- this.#c !== null && (clearInterval(this.#c), this.#c = null);
3855
- };
3856
- #A = () => {
3857
- this.hasAttribute("autoplay") && !this.#l?.matches && this.#c === null && this.#T();
3858
- };
3859
- #j = (e) => {
3860
- if (e.button !== 0 || e.pointerType === "touch") return;
3861
- let t = this.#e;
3862
- t && (this.#f = !0, this.#p = e.clientX, this.#m = e.clientY, this.#h = t.scrollLeft, this.#g = t.scrollTop, t.style.scrollBehavior = "auto", t.style.scrollSnapType = "none", t.setPointerCapture(e.pointerId), t.setAttribute("data-dragging", ""), t.addEventListener("pointermove", this.#M), t.addEventListener("pointerup", this.#N), t.addEventListener("pointercancel", this.#N));
3863
- };
3864
- #M = (e) => {
3865
- if (!(!this.#f || !this.#e)) if (e.preventDefault(), this.getAttribute("direction") === "vertical") {
3866
- let t = e.clientY - this.#m;
3867
- this.#e.scrollTop = this.#g - t;
3868
- } else {
3869
- let t = e.clientX - this.#p;
3870
- this.#e.scrollLeft = this.#h - t;
3871
- }
3872
- };
3873
- #N = (e) => {
3874
- !this.#f || !this.#e || (this.#f = !1, this.#e.releasePointerCapture(e.pointerId), this.#e.removeAttribute("data-dragging"), this.#e.removeEventListener("pointermove", this.#M), this.#e.removeEventListener("pointerup", this.#N), this.#e.removeEventListener("pointercancel", this.#N), this.#e.style.scrollBehavior = "", this.#e.style.scrollSnapType = "");
3875
- };
3876
- #P = (e) => {
3877
- if (this.#s.value) return;
3878
- let t = this.getAttribute("direction") === "vertical";
3879
- switch (e.key) {
3880
- case t ? "ArrowDown" : "ArrowRight":
3881
- e.preventDefault(), this.next();
3882
- break;
3883
- case t ? "ArrowUp" : "ArrowLeft":
3884
- e.preventDefault(), this.prev();
3885
- break;
3886
- case "Home":
3887
- e.preventDefault(), this.goTo(0);
3888
- break;
3889
- case "End":
3890
- e.preventDefault(), this.goTo(this.#o.value - 1);
3891
- break;
3892
- }
3893
- };
3894
- }, Fe = class extends c {
3895
- setup() {
3896
- super.setup(), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "-1");
3897
- }
3898
- }, Ie = class extends c {
3899
- static observedAttributes = ["value", "disabled"];
3900
- #e;
3901
- #t;
3902
- #n;
3903
- constructor() {
3904
- super(), this.#e = this.attachInternals(), this.#e.role = "navigation", this.#t = _(this, "disabled", { type: "boolean" });
3905
- }
3906
- get value() {
3907
- return this.#n?.listValue.value ?? null;
3908
- }
3909
- set value(e) {
3910
- this.#n && (this.#n.listValue.value = e), e === null ? this.removeAttribute("value") : this.setAttribute("value", e);
3911
- }
3912
- get disabled() {
3913
- return this.#t.value;
3914
- }
3915
- set disabled(e) {
3916
- this.#t.set(e);
3917
- }
3918
- attributeChangedCallback(e, t, n) {
3919
- if (t !== n) {
3920
- if (v({ disabled: this.#t }, e, n)) {
3921
- super.attributeChangedCallback?.(e, t, n);
3922
- return;
3923
- }
3924
- e === "value" && this.#n && (this.#n.listValue.value = n), super.attributeChangedCallback?.(e, t, n);
3925
- }
3926
- }
3927
- setup() {
3928
- super.setup(), this.#n = new d(this, {
3929
- itemSelector: ":scope ui-nav-item:not([disabled])",
3930
- orientation: "vertical",
3931
- ariaAttr: "aria-current",
3932
- onChildSelect: (e) => {
3933
- this.#n.listValue.value = e.value, this.setAttribute("value", e.value), this.dispatchEvent(new CustomEvent("ui-change", {
3934
- bubbles: !0,
3935
- composed: !0,
3936
- cancelable: !0,
3937
- detail: e
3938
- }));
3939
- },
3940
- addEffect: (e) => this.addEffect(e),
3941
- deferChildren: (e) => this.deferChildren(e)
3942
- });
3943
- let e = this.getAttribute("value");
3944
- e !== null && (this.#n.listValue.value = e), this.addEffect(g(this, this.#t.signal, this.#e));
3945
- }
3946
- teardown() {
3947
- this.#n.destroy(), super.teardown();
3948
- }
3949
- }, Le = class extends c {
3950
- static observedAttributes = [
3951
- "value",
3952
- "disabled",
3953
- "label"
3954
- ];
3955
- #e;
3956
- #t = t("");
3957
- #n;
3958
- #r = t("");
3959
- constructor() {
3960
- super(), this.#e = this.attachInternals(), this.#e.role = "option", this.#n = _(this, "disabled", { type: "boolean" });
3961
- }
3962
- get value() {
3963
- return this.#t.value;
3964
- }
3965
- set value(e) {
3966
- this.#t.value = e, this.getAttribute("value") !== e && this.setAttribute("value", e);
3967
- }
3968
- get disabled() {
3969
- return this.#n.value;
3970
- }
3971
- set disabled(e) {
3972
- this.#n.set(e);
3973
- }
3974
- get label() {
3975
- return this.#r.value || this.textContent?.trim() || "";
3976
- }
3977
- set label(e) {
3978
- this.#r.value = e, e ? this.getAttribute("label") !== e && this.setAttribute("label", e) : this.removeAttribute("label");
3979
- }
3980
- attributeChangedCallback(e, t, n) {
3981
- if (t !== n) {
3982
- if (v({ disabled: this.#n }, e, n)) {
3983
- super.attributeChangedCallback?.(e, t, n);
3984
- return;
3985
- }
3986
- switch (e) {
3987
- case "value":
3988
- this.#t.value = n ?? "";
3989
- break;
3990
- case "label":
3991
- this.#r.value = n ?? "";
3992
- break;
3993
- }
3994
- super.attributeChangedCallback?.(e, t, n);
3995
- }
3996
- }
3997
- setup() {
3998
- super.setup(), this.addEffect(g(this, this.#n.signal, this.#e)), this.addEventListener("click", this.#i);
3999
- }
4000
- teardown() {
4001
- this.removeEventListener("click", this.#i), super.teardown();
4002
- }
4003
- #i = () => {
4004
- this.disabled || this.dispatchEvent(new CustomEvent("ui-select", {
4005
- bubbles: !0,
4006
- composed: !0,
4007
- detail: {
4008
- value: this.#t.value,
4009
- label: this.label
4010
- }
4011
- }));
4012
- };
4013
- }, Re = class extends c {
4014
- static observedAttributes = ["open"];
4015
- #e = t(!0);
4016
- #t = null;
4017
- #n;
4018
- #r = null;
4019
- #i = null;
4020
- #a = null;
4021
- #o = !1;
4022
- constructor() {
4023
- super(), this.#n = this.attachInternals(), this.#n.role = "group";
4024
- }
4025
- /** Whether the flyout popover is currently open. */
4026
- get flyoutOpen() {
4027
- return this.#o;
4028
- }
4029
- get open() {
4030
- return this.#e.value;
4031
- }
4032
- set open(e) {
4033
- this.#e.value = e, this.toggleAttribute("open", e);
4034
- }
4035
- attributeChangedCallback(e, t, n) {
4036
- t !== n && (e === "open" && (this.#e.value = n !== null), super.attributeChangedCallback?.(e, t, n));
4037
- }
4038
- setup() {
4039
- super.setup();
4040
- let e = document.createElement("details"), t = document.createElement("summary"), n = this.querySelector(":scope > ui-nav-group-header");
4041
- for (n && t.appendChild(n); this.firstChild;) e.appendChild(this.firstChild);
4042
- e.insertBefore(t, e.firstChild), this.appendChild(e), this.#t = e, this.addEffect(() => {
4043
- let e = this.#e.value;
4044
- this.#t && (this.#t.open = e);
4045
- }), e.addEventListener("toggle", this.#c), this.#r = new MutationObserver(() => this.#s()), this.#r.observe(e, {
4046
- subtree: !0,
4047
- attributes: !0,
4048
- attributeFilter: ["aria-current"]
4049
- }), this.#s();
4050
- let r = document.createElement("ui-listbox");
4051
- r.setAttribute("popover", "manual"), r.className = "nav-group-flyout", this.appendChild(r), this.#i = r, this.#a = new p(this), this.#a.wirePopover(this, r), r.addEventListener("ui-select", this.#u), r.addEventListener("ui-change", this.#d), this.addEventListener("ui-dismiss", this.#l);
4052
- }
4053
- teardown() {
4054
- this.closeFlyout(), this.#a?.destroy(), this.#a = null, this.#i?.remove(), this.#i = null, this.#r?.disconnect(), this.#r = null, this.#t?.removeEventListener("toggle", this.#c), this.#t = null, super.teardown();
4055
- }
4056
- #s() {
4057
- if (!this.#t) return;
4058
- let e = this.#t.querySelectorAll(":scope > ui-nav-item"), t = -1;
4059
- for (let n = 0; n < e.length; n++) if (e[n].hasAttribute("aria-current")) {
4060
- t = n;
4061
- break;
4062
- }
4063
- if (t < 0) {
4064
- this.#n.states.delete("has-selection");
4065
- return;
4066
- }
4067
- this.style.setProperty("--_indicator-index", `${t}`), this.#n.states.add("has-selection");
655
+ let t = this.#t.label.value, n = e?.querySelector("[slot=\"label\"]");
656
+ n && (n.textContent = t || (this.#c ? this.#s.value || "\xA0" : n.textContent ?? ""));
657
+ }), this.addEffect(() => {
658
+ let e = this.#t.value.value, n = t?.querySelectorAll("ui-option") ?? [];
659
+ for (let t of n) {
660
+ let n = t.getAttribute("value") === e;
661
+ t.setAttribute("aria-selected", String(n));
662
+ }
663
+ });
664
+ }), this.addEffect(c(this, this.#n, this.#e)), this.addEffect(() => {
665
+ let t = this.#n.value;
666
+ e && e.toggleAttribute("disabled", t), t && this.#t.open.peek() && this.#t.hide();
667
+ }), this.#r.value = this.hasAttribute("required"), this.addEffect(() => {
668
+ let e = this.#t.value.value;
669
+ this.#r.value && (e === null || e === "") ? this.#e.setValidity({ valueMissing: !0 }, "Please select an option.", this) : this.#e.setValidity({});
670
+ }), this.addEffect(() => {
671
+ let t = this.#t.open.value;
672
+ this.#i.syncPopover(t), e?.setAttribute("aria-expanded", String(t));
673
+ }), this.addEffect(() => {
674
+ let e = this.#t.value.value;
675
+ this.#e.setFormValue(e ?? ""), e == null ? this.removeAttribute("value") : this.setAttribute("value", e);
676
+ }), e?.addEventListener("ui-press", this.#v), this.addEventListener("ui-change", this.#y), this.addEventListener("ui-select", this.#b), this.addEventListener("ui-dismiss", this.#x), e?.addEventListener("keydown", this.#S);
4068
677
  }
4069
- #c = () => {
4070
- if (!this.#t) return;
4071
- let e = this.#t.open;
4072
- this.#e.value = e, this.toggleAttribute("open", e);
678
+ #v = () => {
679
+ this.#n.value || this.#t.toggle();
4073
680
  };
4074
- /** Stamp ui-option elements from child nav-items, open the flyout popover. */
4075
- openFlyout() {
4076
- if (!this.#t || !this.#i) return;
4077
- this.#i.innerHTML = "";
4078
- let e = this.#t.querySelectorAll(":scope > ui-nav-item"), t = !0;
4079
- for (let n of e) {
4080
- let e = n.getAttribute("value") ?? "", r = n.getAttribute("label") || n.textContent?.trim() || "", i = n.hasAttribute("aria-disabled"), a = document.createElement("ui-option");
4081
- a.setAttribute("value", e), a.textContent = r, n.hasAttribute("aria-current") && a.setAttribute("selected", ""), i && a.setAttribute("disabled", ""), i || (a.setAttribute("tabindex", t ? "0" : "-1"), t = !1), this.#i.appendChild(a);
4082
- }
4083
- this.#o = !0, this.#a?.syncPopover(!0), queueMicrotask(() => {
4084
- (this.#i?.querySelector("ui-option:not([disabled])"))?.focus();
4085
- });
4086
- }
4087
- /** Clear the flyout and close the popover. Returns focus to the summary. */
4088
- closeFlyout() {
4089
- this.#i && (this.#i.innerHTML = "", this.#o = !1, this.#a?.syncPopover(!1), (this.#t?.querySelector("summary"))?.focus());
4090
- }
4091
- #l = () => {
4092
- this.closeFlyout();
681
+ #y = (e) => {
682
+ e.target !== this && e.stopImmediatePropagation();
4093
683
  };
4094
- #u = () => {
4095
- queueMicrotask(() => this.closeFlyout());
684
+ #b = (e) => {
685
+ let t = e.detail;
686
+ this.#t.select(t.value, t.label), this.dispatchEvent(new CustomEvent("ui-change", {
687
+ bubbles: !0,
688
+ composed: !0,
689
+ detail: t
690
+ }));
4096
691
  };
4097
- #d = (e) => {
4098
- e.stopPropagation();
692
+ #x = () => {
693
+ this.#t.hide();
4099
694
  };
4100
- }, ze = class extends c {
4101
- constructor() {
4102
- super();
4103
- let e = this.attachInternals();
4104
- e.role = "presentation";
4105
- }
4106
- setup() {
4107
- super.setup(), this.id ||= e("ngh");
4108
- let t = this.closest("ui-nav-group");
4109
- t && t.setAttribute("aria-labelledby", this.id);
4110
- let n = this.querySelector(":scope > ui-icon");
4111
- if (n) {
4112
- let e = document.createElement("span");
4113
- e.className = "icon-well", this.insertBefore(e, n), e.appendChild(n);
4114
- }
4115
- }
4116
- }, Be = class extends c {
4117
- static observedAttributes = [
4118
- "traits",
4119
- "for",
4120
- "provides"
4121
- ];
4122
- /** Per-target controller instances: target → Map<traitName, instance> */
4123
- #e = /* @__PURE__ */ new Map();
4124
- /** Watches for child additions/removals in selector mode */
4125
- #t = null;
4126
- /** Watches for trait option attribute changes on this element */
4127
- #n = null;
4128
- /** Traits requested but not yet registered — retried on registration */
4129
- #r = /* @__PURE__ */ new Set();
4130
- #i = null;
4131
- connectedCallback() {
4132
- this.setup();
4133
- }
4134
- setup() {
4135
- super.setup(), this.#a(), this.#p();
4136
- }
4137
- teardown() {
4138
- this.#f(), this.#t?.disconnect(), this.#t = null, this.#n?.disconnect(), this.#n = null, this.#i?.(), this.#i = null, this.#r.clear(), super.teardown();
4139
- }
4140
- attributeChangedCallback(e, t, n) {
4141
- super.attributeChangedCallback(e, t, n), this.isConnected && (e === "traits" || e === "for" || e === "provides") && (this.#f(), this.#t?.disconnect(), this.#t = null, this.#a());
4142
- }
4143
- #a() {
4144
- if (this.getAttribute("provides") !== null) return;
4145
- let e = this.getAttribute("traits");
4146
- if (!e) return;
4147
- let t = this.getAttribute("for");
4148
- t === null ? this.#o(e) : this.#s(e, t), this.#r.size > 0 && !this.#i && (this.#i = o((e) => {
4149
- this.#r.has(e) && (this.#r.delete(e), this.#a(), this.#r.size === 0 && (this.#i?.(), this.#i = null));
4150
- }));
4151
- }
4152
- #o(e) {
4153
- let t = this.#u();
4154
- t && this.#l(t, e);
4155
- }
4156
- #s(e, t) {
4157
- let n = this.querySelectorAll(t);
4158
- for (let t of n) this.#l(t, e);
4159
- this.#t = new MutationObserver(() => {
4160
- this.#c(e, t);
4161
- }), this.#t.observe(this, {
4162
- childList: !0,
4163
- subtree: !0
4164
- });
4165
- }
4166
- #c(e, t) {
4167
- let n = new Set(this.querySelectorAll(t));
4168
- for (let [e, t] of this.#e) n.has(e) || (this.#d(e, t), this.#e.delete(e));
4169
- for (let t of n) this.#e.has(t) || this.#l(t, e);
4170
- }
4171
- #l(e, t) {
4172
- let n = t.split(/\s+/).filter(Boolean), r = this.#e.get(e) ?? /* @__PURE__ */ new Map();
4173
- for (let t of n) {
4174
- if (r.has(t)) continue;
4175
- let n = i(t);
4176
- if (!n) {
4177
- this.#r.add(t);
4178
- continue;
695
+ #S = (e) => {
696
+ if (this.#n.value) return;
697
+ let t = this.#u;
698
+ switch (e.key) {
699
+ case "ArrowDown":
700
+ case "ArrowUp": {
701
+ e.preventDefault();
702
+ let n = t?.controller;
703
+ if (this.#t.open.value || this.#t.show(), n) {
704
+ let r = t?.querySelectorAll(":scope ui-option:not([disabled])")?.length ?? 0;
705
+ n.moveActive(e.key === "ArrowDown" ? 1 : -1, r);
706
+ }
707
+ break;
708
+ }
709
+ case "Enter":
710
+ case " ":
711
+ if (e.preventDefault(), this.#t.open.value) {
712
+ let e = t?.getActiveOption();
713
+ e && e.click();
714
+ } else this.#t.toggle();
715
+ break;
716
+ case "Escape":
717
+ this.#t.open.value && (e.preventDefault(), this.#t.hide());
718
+ break;
719
+ case "Home": {
720
+ e.preventDefault();
721
+ let n = t?.controller;
722
+ n && (n.activeIndex.value = 0);
723
+ break;
4179
724
  }
4180
- for (let [e] of r) if (i(e)?.conflicts?.includes(t) || n.conflicts?.includes(e)) {
4181
- let n = `[native-ui] Trait conflict: "${t}" and "${e}" are incompatible.`;
4182
- console.warn(n);
725
+ case "End": {
726
+ e.preventDefault();
727
+ let n = t?.controller;
728
+ if (n) {
729
+ let e = t?.querySelectorAll(":scope ui-option:not([disabled])");
730
+ n.activeIndex.value = Math.max(0, (e?.length ?? 1) - 1);
731
+ }
732
+ break;
4183
733
  }
4184
- let o = a(this, t), s = n.create(e, o);
4185
- r.set(t, s);
4186
734
  }
4187
- this.#e.set(e, r);
4188
- }
4189
- #u() {
4190
- for (let e of this.children) if (e instanceof HTMLElement) return e;
4191
- return null;
735
+ };
736
+ teardown() {
737
+ this.#d?.removeEventListener("ui-press", this.#v), this.#d?.removeEventListener("keydown", this.#S), this.removeEventListener("ui-change", this.#y), this.removeEventListener("ui-select", this.#b), this.removeEventListener("ui-dismiss", this.#x), this.#d = null, this.#l?.abort(), this.#l = null, this.#u = null, this.#i.destroy(), super.teardown();
4192
738
  }
4193
- #d(e, t) {
4194
- for (let [e, n] of t) {
4195
- let t = i(e);
4196
- t && t.destroy(n);
4197
- }
4198
- t.clear();
739
+ onFormReset() {
740
+ this.#f === null ? this.#t.reset() : this.#t.select(this.#f, this.#p);
4199
741
  }
4200
- #f() {
4201
- for (let [e, t] of this.#e) this.#d(e, t);
4202
- this.#e.clear();
742
+ onFormStateRestore(e) {
743
+ typeof e == "string" && e && (this.value = e);
4203
744
  }
4204
- /** Watch trait option attributes (e.g. draggable-axis) on this element */
4205
- #p() {
4206
- this.#n = new MutationObserver((e) => {
4207
- for (let t of e) {
4208
- if (!t.attributeName || t.attributeName === "traits" || t.attributeName === "for" || t.attributeName === "provides") continue;
4209
- let e = s(t.attributeName);
4210
- if (!e) continue;
4211
- let n = i(e.trait);
4212
- if (!n?.update) continue;
4213
- let r = a(this, e.trait);
4214
- for (let [, t] of this.#e) {
4215
- let i = t.get(e.trait);
4216
- i && n.update(i, r);
4217
- }
4218
- }
4219
- }), this.#n.observe(this, { attributes: !0 });
745
+ onFormDisabled(e) {
746
+ this.#n.value = e;
4220
747
  }
4221
- }, Ve = class extends c {
748
+ }, S = class extends d(s) {
4222
749
  static observedAttributes = [
750
+ "value",
751
+ "min",
752
+ "max",
753
+ "step",
4223
754
  "disabled",
4224
- "no-enter-submit",
4225
- "no-auto-clear"
755
+ "name",
756
+ "required"
4226
757
  ];
4227
758
  #e;
4228
759
  #t = t(!1);
4229
- #n = null;
4230
- #r = null;
760
+ #n = t(!1);
761
+ #r = t(50);
762
+ #i = 50;
763
+ #a = t(0);
764
+ #o = t(100);
765
+ #s = t(1);
766
+ #c = null;
767
+ #l = !1;
4231
768
  constructor() {
4232
- super(), this.#e = this.attachInternals();
769
+ super(), this.#e = this.attachInternals(), this.#e.role = "slider";
4233
770
  }
4234
771
  get value() {
4235
- return this.#n?.value ?? "";
772
+ return this.#r.value;
4236
773
  }
4237
774
  set value(e) {
4238
- this.#n && (this.#n.value = e);
775
+ this.#r.value = this.#u(e);
776
+ }
777
+ get min() {
778
+ return this.#a.value;
779
+ }
780
+ set min(e) {
781
+ this.#a.value = e, this.setAttribute("min", String(e));
782
+ }
783
+ get max() {
784
+ return this.#o.value;
785
+ }
786
+ set max(e) {
787
+ this.#o.value = e, this.setAttribute("max", String(e));
788
+ }
789
+ get step() {
790
+ return this.#s.value;
791
+ }
792
+ set step(e) {
793
+ this.#s.value = e, this.setAttribute("step", String(e));
4239
794
  }
4240
795
  get disabled() {
4241
796
  return this.#t.value;
@@ -4243,269 +798,167 @@ var ve = class extends y(c) {
4243
798
  set disabled(e) {
4244
799
  this.#t.value = e, this.toggleAttribute("disabled", e);
4245
800
  }
801
+ get required() {
802
+ return this.#n.value;
803
+ }
804
+ set required(e) {
805
+ this.#n.value = e, this.toggleAttribute("required", e);
806
+ }
807
+ get name() {
808
+ return this.getAttribute("name") ?? "";
809
+ }
810
+ set name(e) {
811
+ this.setAttribute("name", e);
812
+ }
4246
813
  attributeChangedCallback(e, t, n) {
4247
814
  if (t !== n) {
4248
815
  switch (e) {
816
+ case "value":
817
+ this.#r.value = this.#u(parseFloat(n ?? "50") || 50);
818
+ break;
819
+ case "min":
820
+ this.#a.value = parseFloat(n ?? "0") || 0;
821
+ break;
822
+ case "max":
823
+ this.#o.value = parseFloat(n ?? "100") || 100;
824
+ break;
825
+ case "step":
826
+ this.#s.value = parseFloat(n ?? "1") || 1;
827
+ break;
4249
828
  case "disabled":
4250
829
  this.#t.value = n !== null;
4251
830
  break;
831
+ case "required":
832
+ this.#n.value = n !== null;
833
+ break;
4252
834
  }
4253
835
  super.attributeChangedCallback(e, t, n);
4254
836
  }
4255
837
  }
4256
838
  setup() {
4257
- super.setup(), this.addEffect(g(this, this.#t, this.#e)), this.deferChildren(() => {
4258
- this.#i(), this.addEffect(() => {
4259
- let e = this.#t.value;
4260
- this.#n && this.#n.toggleAttribute("disabled", e), this.#r && (e ? this.#r.setAttribute("disabled", "") : this.#o());
4261
- });
4262
- }), this.addEventListener("ui-input", this.#s), this.addEventListener("ui-press", this.#c), this.addEventListener("keydown", this.#l);
839
+ super.setup(), this.#i = this.#r.value, this.#c = document.createElement("div"), this.#c.classList.add("ui-range-thumb"), this.appendChild(this.#c), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.addEffect(c(this, this.#t, this.#e, { manageTabindex: !0 })), this.#n.value = this.hasAttribute("required"), this.addEffect(() => {
840
+ let e = this.#r.value, t = this.#d();
841
+ this.style.setProperty("--_progress", String(t)), this.setAttribute("aria-valuenow", String(e)), this.setAttribute("aria-valuemin", String(this.#a.value)), this.setAttribute("aria-valuemax", String(this.#o.value)), this.#e.setFormValue(String(e));
842
+ }), this.addEventListener("pointerdown", this.#p), this.addEventListener("keydown", this.#_);
4263
843
  }
4264
844
  teardown() {
4265
- this.removeEventListener("ui-input", this.#s), this.removeEventListener("ui-press", this.#c), this.removeEventListener("keydown", this.#l), this.#n = null, this.#r = null, super.teardown();
845
+ this.removeEventListener("pointerdown", this.#p), this.removeEventListener("keydown", this.#_), this.#c &&= (this.#c.remove(), null), super.teardown();
4266
846
  }
4267
- #i() {
4268
- this.#n = this.querySelector(":scope > ui-textarea"), this.#r = this.querySelector("[data-submit]") ?? this.#a();
847
+ onFormDisabled(e) {
848
+ this.#t.value = e;
4269
849
  }
4270
- #a() {
4271
- let e = this.querySelector(":scope > ui-chat-input-actions");
4272
- if (!e) return null;
4273
- let t = e.querySelectorAll("ui-button[variant=\"primary\"]");
4274
- return t.length ? t[t.length - 1] : null;
850
+ onFormReset() {
851
+ this.#r.value = this.#i;
4275
852
  }
4276
- #o() {
4277
- !this.#r || this.#t.value || (this.value.trim() ? this.#r.removeAttribute("disabled") : this.#r.setAttribute("disabled", ""));
853
+ onFormStateRestore(e) {
854
+ if (typeof e == "string") {
855
+ let t = parseFloat(e);
856
+ isNaN(t) || (this.value = t);
857
+ }
4278
858
  }
4279
- #s = (e) => {
4280
- this.#t.value || this.#o();
4281
- };
4282
- #c = (e) => {
4283
- this.#t.value || e.target === this.#r && this.#u();
4284
- };
4285
- #l = (e) => {
4286
- if (this.#t.value || this.hasAttribute("no-enter-submit")) return;
4287
- let t = e;
4288
- if (t.isComposing) return;
4289
- let n = t.target;
4290
- !this.#n?.contains(n) && n !== this.#n || t.key === "Enter" && !t.shiftKey && !t.ctrlKey && !t.metaKey && (t.preventDefault(), this.value.trim() && this.#u());
4291
- };
4292
- #u() {
4293
- let e = this.value.trim();
4294
- e && this.dispatchEvent(new CustomEvent("ui-send", {
4295
- bubbles: !0,
4296
- composed: !0,
4297
- cancelable: !0,
4298
- detail: { value: e }
4299
- })) && !this.hasAttribute("no-auto-clear") && (this.value = "", this.#r?.setAttribute("disabled", ""));
859
+ #u(e) {
860
+ let t = this.#a.value, n = this.#o.value, r = this.#s.value, i = Math.round((e - t) / r) * r + t;
861
+ return Math.min(n, Math.max(t, i));
4300
862
  }
4301
- }, He = class extends c {
4302
- static observedAttributes = ["interactive", "href"];
4303
- setup() {
4304
- super.setup(), this.hasAttribute("interactive") && (this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.addEventListener("click", this.#e), this.addEventListener("keydown", this.#t));
863
+ #d() {
864
+ let e = this.#o.value - this.#a.value;
865
+ return e === 0 ? 0 : (this.#r.value - this.#a.value) / e;
4305
866
  }
4306
- teardown() {
4307
- this.removeEventListener("click", this.#e), this.removeEventListener("keydown", this.#t), super.teardown();
867
+ #f(e) {
868
+ let t = this.getBoundingClientRect(), n = this.#c?.offsetWidth ?? 0, r = n / 2, i = t.width - n;
869
+ if (i <= 0) return this.#a.value;
870
+ let a = e.clientX - t.left - r, o = Math.min(1, Math.max(0, a / i));
871
+ return this.#a.value + o * (this.#o.value - this.#a.value);
4308
872
  }
4309
- #e = () => {
4310
- let e = this.getAttribute("href");
4311
- e && (window.location.href = e);
873
+ #p = (e) => {
874
+ if (e.button !== 0 || this.#t.value) return;
875
+ this.setPointerCapture(e.pointerId), this.#l = !0, this.toggleAttribute("pressed", !0);
876
+ let t = this.#u(this.#f(e));
877
+ this.#r.value = t, this.#v(), this.addEventListener("pointermove", this.#m), this.addEventListener("pointerup", this.#h), this.addEventListener("pointercancel", this.#g);
4312
878
  };
4313
- #t = (e) => {
4314
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.#e());
879
+ #m = (e) => {
880
+ if (!this.#l || this.#t.value) return;
881
+ let t = this.#u(this.#f(e));
882
+ t !== this.#r.value && (this.#r.value = t, this.#v());
4315
883
  };
4316
- }, Ue = class extends c {
4317
- static observedAttributes = [
4318
- "collapsible",
4319
- "collapsed",
4320
- "divider"
4321
- ];
4322
- setup() {
4323
- if (super.setup(), this.hasAttribute("collapsible")) {
4324
- let e = this.querySelector("[slot=\"heading\"]");
4325
- e && e.addEventListener("click", this.#e);
4326
- }
4327
- }
4328
- teardown() {
4329
- let e = this.querySelector("[slot=\"heading\"]");
4330
- e && e.removeEventListener("click", this.#e), super.teardown();
4331
- }
4332
- #e = () => {
4333
- this.hasAttribute("collapsible") && this.toggleAttribute("collapsed");
884
+ #h = () => {
885
+ this.#l = !1, this.removeAttribute("pressed"), this.removeEventListener("pointermove", this.#m), this.removeEventListener("pointerup", this.#h), this.removeEventListener("pointercancel", this.#g), this.#y();
4334
886
  };
4335
- }, We = class extends c {
4336
- #e;
4337
- #t;
4338
- constructor() {
4339
- super(), this.#e = this.attachInternals(), this.#e.role = "toolbar";
4340
- }
4341
- setup() {
4342
- super.setup(), this.#t = new l(this, {
4343
- selector: ":scope > ui-button:not([disabled]), :scope > button:not([disabled])",
4344
- orientation: "horizontal"
4345
- }), this.hasAttribute("aria-label") || this.setAttribute("aria-label", "Toolbar");
4346
- }
4347
- teardown() {
4348
- this.#t.destroy(), super.teardown();
4349
- }
4350
- }, Ge = class extends c {
4351
- static observedAttributes = ["collapsed"];
4352
- #e = null;
4353
- #t = null;
4354
- #n = null;
4355
- #r = [];
4356
- attributeChangedCallback(e, t, n) {
4357
- t !== n && (e === "collapsed" && this.dataset.ready !== void 0 && this.#i(), super.attributeChangedCallback?.(e, t, n));
4358
- }
4359
- setup() {
4360
- super.setup();
4361
- let e = this.querySelector(":scope > [slot=\"sidebar\"]");
4362
- e?.querySelector(".layout-resize-handle") && (this.#e = new m(e, {
4363
- handleSelector: ".layout-resize-handle",
4364
- axis: "horizontal",
4365
- min: 160,
4366
- max: 400
4367
- })), e && this.#s(e), this.#i(), this.addEventListener("ui-dismiss", this.#o), this.dataset.ready = "";
4368
- }
4369
- teardown() {
4370
- this.removeEventListener("ui-dismiss", this.#o), this.#a(), this.#n = null, this.#t?.disconnect(), this.#t = null, this.#e?.destroy(), this.#e = null, super.teardown();
4371
- }
4372
- /** Attach or detach summary click interception based on collapsed state. */
4373
- #i() {
4374
- if (this.#a(), !this.hasAttribute("collapsed")) {
4375
- this.#n?.flyoutOpen && this.#n.closeFlyout(), this.#n = null;
4376
- return;
4377
- }
4378
- let e = this.querySelectorAll("ui-nav-group");
4379
- for (let t of e) {
4380
- let e = t.querySelector(":scope > details > summary");
4381
- if (!e) continue;
4382
- let n = (e) => {
4383
- e.preventDefault(), this.#n === t && t.flyoutOpen ? (t.closeFlyout(), this.#n = null) : (this.#n?.flyoutOpen && this.#n.closeFlyout(), t.openFlyout(), this.#n = t);
4384
- };
4385
- e.addEventListener("click", n), this.#r.push({
4386
- summary: e,
4387
- handler: n
4388
- });
4389
- }
4390
- }
4391
- /** Remove all summary click listeners. */
4392
- #a() {
4393
- for (let { summary: e, handler: t } of this.#r) e.removeEventListener("click", t);
4394
- this.#r = [];
4395
- }
4396
- /** When a group closes its flyout internally (dismiss, option select),
4397
- * clear our active reference so we stay in sync. */
4398
- #o = (e) => {
4399
- let t = e.target?.closest?.("ui-nav-group");
4400
- t && t === this.#n && (this.#n = null);
887
+ #g = () => {
888
+ this.#l = !1, this.removeAttribute("pressed"), this.removeEventListener("pointermove", this.#m), this.removeEventListener("pointerup", this.#h), this.removeEventListener("pointercancel", this.#g);
4401
889
  };
4402
- /** Watch header/footer size changes and sync CSS custom properties + data
4403
- * attributes so content gets correct padding offsets and fade masks. */
4404
- #s(e) {
4405
- let t = e.querySelector("ui-layout-sidebar-header"), n = e.querySelector("ui-layout-sidebar-footer"), r = e.querySelector("ui-layout-sidebar-content");
4406
- if (!r) return;
4407
- let i = () => {
4408
- let i = t ? t.offsetHeight : 0, a = n ? n.offsetHeight : 0;
4409
- e.style.setProperty("--_sidebar-header-height", `${i}px`), e.style.setProperty("--_sidebar-footer-height", `${a}px`), t ? r.dataset.hasHeader = "" : delete r.dataset.hasHeader, n ? r.dataset.hasFooter = "" : delete r.dataset.hasFooter;
4410
- };
4411
- i();
4412
- let a = [];
4413
- if (t && a.push(t), n && a.push(n), a.length > 0) {
4414
- this.#t = new ResizeObserver(i);
4415
- for (let e of a) this.#t.observe(e);
890
+ #_ = (e) => {
891
+ if (this.#t.value) return;
892
+ let t = this.#s.value, n = t * 10, r = this.#r.value;
893
+ switch (e.key) {
894
+ case "ArrowRight":
895
+ case "ArrowUp":
896
+ r += t;
897
+ break;
898
+ case "ArrowLeft":
899
+ case "ArrowDown":
900
+ r -= t;
901
+ break;
902
+ case "PageUp":
903
+ r += n;
904
+ break;
905
+ case "PageDown":
906
+ r -= n;
907
+ break;
908
+ case "Home":
909
+ r = this.#a.value;
910
+ break;
911
+ case "End":
912
+ r = this.#o.value;
913
+ break;
914
+ default: return;
4416
915
  }
4417
- }
4418
- }, Y = class extends c {
4419
- #e = null;
4420
- #t = !1;
4421
- setup() {
4422
- super.setup();
4423
- let e = this.querySelector(":scope > ui-listbox[popover]");
4424
- e && (this.#e = new p(this), this.#e.wirePopover(this, e), this.addEventListener("click", this.#n), this.addEventListener("ui-dismiss", this.#r));
4425
- }
4426
- teardown() {
4427
- this.removeEventListener("click", this.#n), this.removeEventListener("ui-dismiss", this.#r), this.#e?.destroy(), this.#e = null, this.#t = !1, super.teardown();
4428
- }
4429
- #n = (e) => {
4430
- e.target.closest("ui-listbox") || (this.#t = !this.#t, this.#e?.syncPopover(this.#t));
4431
- };
4432
- #r = () => {
4433
- this.#t = !1, this.#e?.syncPopover(!1);
916
+ e.preventDefault(), r = this.#u(r), r !== this.#r.value && (this.#r.value = r, this.#v(), this.#y());
4434
917
  };
4435
- }, Ke = class extends c {
4436
- #e = null;
4437
- get open() {
4438
- return this.hasAttribute("open");
4439
- }
4440
- set open(e) {
4441
- this.toggleAttribute("open", e);
4442
- }
4443
- toggle() {
4444
- this.open = !this.open;
4445
- }
4446
- setup() {
4447
- super.setup(), this.querySelector(".layout-resize-handle") && (this.#e = new m(this, {
4448
- handleSelector: ".layout-resize-handle",
4449
- axis: "horizontal",
4450
- min: 280,
4451
- max: 480,
4452
- reverse: !0
918
+ #v() {
919
+ this.dispatchEvent(new CustomEvent("ui-input", {
920
+ bubbles: !0,
921
+ composed: !0,
922
+ detail: { value: this.#r.value }
4453
923
  }));
4454
924
  }
4455
- teardown() {
4456
- this.#e?.destroy(), this.#e = null, super.teardown();
4457
- }
4458
- }, qe = class extends c {
4459
- #e = null;
4460
- get open() {
4461
- return this.hasAttribute("open");
4462
- }
4463
- set open(e) {
4464
- this.toggleAttribute("open", e);
4465
- }
4466
- toggle() {
4467
- this.open = !this.open;
4468
- }
4469
- setup() {
4470
- super.setup(), this.querySelector(".layout-resize-handle") && (this.#e = new m(this, {
4471
- handleSelector: ".layout-resize-handle",
4472
- axis: "horizontal",
4473
- min: 280,
4474
- max: 480,
4475
- reverse: !0
925
+ #y() {
926
+ this.dispatchEvent(new CustomEvent("ui-change", {
927
+ bubbles: !0,
928
+ composed: !0,
929
+ detail: { value: this.#r.value }
4476
930
  }));
4477
931
  }
4478
- teardown() {
4479
- this.#e?.destroy(), this.#e = null, super.teardown();
4480
- }
4481
- }, X = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Set();
4482
- function Je(e, t) {
4483
- X.set(e, t), Z.forEach((t) => t(e));
932
+ }, C = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Set();
933
+ function T(e, t) {
934
+ C.set(e, t), w.forEach((t) => t(e));
4484
935
  }
4485
- function Q(e) {
4486
- return X.get(e);
936
+ function E(e) {
937
+ return C.get(e);
4487
938
  }
4488
- function $(e) {
4489
- return Z.add(e), () => Z.delete(e);
939
+ function D(e) {
940
+ return w.add(e), () => w.delete(e);
4490
941
  }
4491
942
  /**
4492
943
  * Icon component rendering SVG from the global icon registry.
4493
944
  * @attr {string} name - Icon name from the Phosphor icon set
945
+ * @attr {string} weight - Icon weight: "regular" (default) or "fill"
4494
946
  * @attr {string} size - Icon size override
4495
947
  * @attr {string} aria-label - Accessible label (sets role="img" when present)
4496
948
  */
4497
- var Ye = class extends c {
949
+ var O = class extends s {
4498
950
  static observedAttributes = [
4499
951
  "name",
952
+ "weight",
4500
953
  "size",
4501
954
  "aria-label"
4502
955
  ];
4503
956
  #e = null;
4504
957
  setup() {
4505
- super.setup(), this.#t(), this.#n();
958
+ super.setup(), this.#t(), this.#r();
4506
959
  }
4507
960
  attributeChangedCallback(e, t, n) {
4508
- super.attributeChangedCallback(e, t, n), e === "name" && this.#n(), e === "aria-label" && this.#t();
961
+ super.attributeChangedCallback(e, t, n), (e === "name" || e === "weight") && this.#r(), e === "aria-label" && this.#t();
4509
962
  }
4510
963
  disconnectedCallback() {
4511
964
  super.disconnectedCallback(), this.#e?.(), this.#e = null;
@@ -4513,16 +966,21 @@ var Ye = class extends c {
4513
966
  #t() {
4514
967
  this.hasAttribute("aria-label") ? (this.setAttribute("role", "img"), this.removeAttribute("aria-hidden")) : (this.setAttribute("aria-hidden", "true"), this.removeAttribute("role"));
4515
968
  }
969
+ /** Compute the effective registry key from name + weight attributes. */
4516
970
  #n() {
4517
971
  let e = this.getAttribute("name");
972
+ return e ? this.getAttribute("weight") === "fill" && !e.endsWith("-fill") ? `${e}-fill` : e : null;
973
+ }
974
+ #r() {
975
+ let e = this.#n();
4518
976
  if (!e) {
4519
977
  this.innerHTML = "", this.#e?.(), this.#e = null;
4520
978
  return;
4521
979
  }
4522
- let t = Q(e);
4523
- t ? (this.innerHTML = t, this.#e?.(), this.#e = null) : (this.innerHTML = "", this.#e ||= $((e) => {
4524
- e === this.getAttribute("name") && this.#n();
980
+ let t = E(e);
981
+ t ? (this.innerHTML = t, this.#e?.(), this.#e = null) : (this.innerHTML = "", this.#e ||= D((e) => {
982
+ e === this.#n() && this.#r();
4525
983
  }));
4526
984
  }
4527
985
  };
4528
- export { F as $, Ce as A, me as B, Ae as C, S as Ct, Ee as D, g as Dt, De as E, v as Et, J as F, U as G, fe as H, ve as I, B as J, V as K, q as L, xe as M, be as N, Te as O, ye as P, I as Q, _e as R, je as S, x as St, Oe as T, _ as Tt, de as U, pe as V, ue as W, R as X, z as Y, L as Z, Ie as _, ne as _t, qe as a, k as at, Ne as b, w as bt, Ge as c, E as ct, He as d, ce as dt, P as et, Ve as f, se as ft, Le as g, re as gt, Re as h, ie as ht, Je as i, A as it, Se as j, we as k, We as l, T as lt, ze as m, ae as mt, Q as n, M as nt, Ke as o, O as ot, Be as p, oe as pt, H as q, $ as r, j as rt, Y as s, D as st, Ye as t, N as tt, Ue as u, le as ut, Fe as v, te as vt, ke as w, y as wt, Me as x, C as xt, Pe as y, ee as yt, he as z };
986
+ export { u as _, S as a, y as c, g as d, h as f, l as g, d as h, T as i, v as l, m, E as n, x as o, p, D as r, b as s, O as t, _ as u, c as v };