basecoat-css 0.2.0-beta.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/basecoat.css CHANGED
@@ -504,7 +504,9 @@
504
504
  /* Dropdown Menu */
505
505
  @layer components {
506
506
  .dropdown-menu {
507
- [popover].popover {
507
+ @apply relative inline-flex p-1;
508
+
509
+ [data-popover] {
508
510
  @apply p-1;
509
511
  min-width: anchor-size(width);
510
512
 
@@ -517,7 +519,7 @@
517
519
  @apply bg-accent text-accent-foreground;
518
520
  }
519
521
  }
520
- [role='menu'] [role='heading'] {
522
+ [role='menu'] [role="presentation"] {
521
523
  @apply flex px-2 py-1.5 text-sm font-medium;
522
524
  }
523
525
  [role='separator'] {
@@ -576,85 +578,74 @@
576
578
 
577
579
  /* Popover */
578
580
  @layer components {
579
- [popover].popover {
580
- @apply absolute inset-auto bg-popover text-popover-foreground overflow-x-hidden overflow-y-auto p-4 rounded-md border shadow-md z-50 visible opacity-0 scale-95 w-max transition-all transition-discrete;
581
+ [data-popover] {
582
+ @apply absolute bg-popover text-popover-foreground overflow-x-hidden overflow-y-auto rounded-md border shadow-md z-50 visible opacity-100 scale-100 min-w-full w-max transition-all;
581
583
 
582
- &:not([data-side]),
583
- &[data-side='bottom'] {
584
- @apply -translate-y-2;
585
- }
586
- &[data-side='top'] {
587
- @apply translate-y-2;
588
- }
589
- &[data-side='left'] {
590
- @apply translate-x-2;
591
- }
592
- &[data-side='right'] {
593
- @apply -translate-x-2;
584
+ &[aria-hidden='true'] {
585
+ @apply invisible opacity-0 scale-95;
586
+
587
+ &:not([data-side]),
588
+ &[data-side='bottom'] {
589
+ @apply -translate-y-2;
590
+ }
591
+ &[data-side='top'] {
592
+ @apply translate-y-2;
593
+ }
594
+ &[data-side='left'] {
595
+ @apply translate-x-2;
596
+ }
597
+ &[data-side='right'] {
598
+ @apply -translate-x-2;
599
+ }
594
600
  }
595
601
  &:not([data-side]),
596
602
  &[data-side='bottom'] {
597
- @apply mt-1 top-[anchor(bottom)];
603
+ @apply mt-1 top-full;
598
604
  }
599
605
  &[data-side='top'] {
600
- @apply mb-1 bottom-[anchor(top)];
606
+ @apply mb-1 bottom-full;
601
607
  }
602
608
  &[data-side='left'] {
603
- @apply mr-1 right-[anchor(left)];
609
+ @apply mr-1 right-full;
604
610
  }
605
611
  &[data-side='right'] {
606
- @apply ml-1 left-[anchor(right)];
612
+ @apply ml-1 left-full;
607
613
  }
608
614
  &:not([data-side]),
609
615
  &[data-side='bottom'],
610
616
  &[data-side='top'] {
611
617
  &:not([data-align]),
612
618
  &[data-align='start'] {
613
- @apply left-[anchor(left)];
619
+ @apply left-0;
614
620
  }
615
621
  &[data-align='end'] {
616
- @apply right-[anchor(right)];
622
+ @apply right-0;
617
623
  }
618
624
  &[data-align='center'] {
619
- @apply left-[anchor(center)] -translate-x-1/2;
625
+ @apply left-1/2 -translate-x-1/2;
620
626
  }
621
627
  }
622
628
  &[data-side='left'],
623
629
  &[data-side='right'] {
624
630
  &:not([data-align]),
625
631
  &[data-align='start'] {
626
- @apply top-[anchor(top)];
632
+ @apply top-0;
627
633
  }
628
634
  &[data-align='end'] {
629
- @apply bottom-[anchor(bottom)];
635
+ @apply bottom-0;
630
636
  }
631
637
  &[data-align='center'] {
632
- @apply top-[anchor(center)] -translate-y-1/2;
638
+ @apply top-1/2 -translate-y-1/2;
633
639
  }
634
640
  }
635
- &:is(:popover-open) {
636
- @apply opacity-100 scale-100 translate-x-0 translate-y-0;
637
-
638
- @starting-style {
639
- @apply opacity-0 scale-95;
641
+ }
642
+ .popover {
643
+ @apply relative inline-flex;
640
644
 
641
- &:not([data-side]),
642
- &[data-side='bottom'] {
643
- @apply -translate-y-2;
644
- }
645
- &[data-side='top'] {
646
- @apply translate-y-2;
647
- }
648
- &[data-side='left'] {
649
- @apply translate-x-2;
650
- }
651
- &[data-side='right'] {
652
- @apply -translate-x-2;
653
- }
654
- }
645
+ [data-popover] {
646
+ @apply p-4;
655
647
  }
656
-
657
- }
648
+ }
658
649
  }
659
650
 
660
651
  /* Radio */
@@ -731,8 +722,10 @@
731
722
  }
732
723
  }
733
724
  *:not(select).select {
734
- [popover].popover {
735
- @apply p-1 min-w-[anchor-size(width)];
725
+ @apply relative inline-flex;
726
+
727
+ [data-popover] {
728
+ @apply p-1;
736
729
 
737
730
  [role='option'] {
738
731
  @apply aria-hidden:hidden [&_svg]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm pl-2 py-1.5 pr-7.5 text-sm outline-hidden select-none [&_svg]:shrink-0 [&_svg]:size-4 aria-disabled:opacity-50 aria-disabled:pointer-events-none disabled:opacity-50 disabled:pointer-events-none w-full truncate;
@@ -741,7 +734,7 @@
741
734
  @apply bg-[image:var(--check-icon)] bg-no-repeat bg-position-[center_right_0.5rem] bg-size-[0.875rem];
742
735
  }
743
736
  }
744
- [role='listbox'] [role='heading'] {
737
+ [role='listbox'] [role="presentation"] {
745
738
  @apply flex text-muted-foreground px-2 py-1.5 text-xs;
746
739
  }
747
740
  [role='listbox'] [role='group']:not(:has([role='option']:not([aria-hidden='true']))) {
package/dist/js/all.js CHANGED
@@ -1,13 +1,35 @@
1
1
  (() => {
2
2
  const initDropdownMenu = (dropdownMenuComponent) => {
3
- const trigger = dropdownMenuComponent.querySelector('[popovertarget]');
4
- const popover = dropdownMenuComponent.querySelector('[popover]');
5
- const menu = popover?.querySelector('[role="menu"]');
6
- if (!trigger || !popover || !menu) return;
3
+ const trigger = dropdownMenuComponent.querySelector(':scope > button');
4
+ const popover = dropdownMenuComponent.querySelector(':scope > [data-popover]');
5
+ const menu = popover.querySelector('[role="menu"]');
6
+
7
+ if (!trigger || !menu || !popover) {
8
+ console.error('Dropdown menu component is missing a trigger, a menu, or a popover content element.', dropdownMenuComponent);
9
+ return;
10
+ }
7
11
 
8
12
  let menuItems = [];
9
13
  let activeIndex = -1;
10
14
 
15
+ const closeMenu = () => {
16
+ if (trigger.getAttribute('aria-expanded') === 'false') return;
17
+ trigger.setAttribute('aria-expanded', 'false');
18
+ trigger.removeAttribute('aria-activedescendant');
19
+ popover.setAttribute('aria-hidden', 'true');
20
+ trigger.focus();
21
+ activeIndex = -1;
22
+ };
23
+
24
+ const openMenu = () => {
25
+ trigger.setAttribute('aria-expanded', 'true');
26
+ popover.setAttribute('aria-hidden', 'false');
27
+ menuItems = Array.from(menu.querySelectorAll('[role^="menuitem"]:not([disabled])'));
28
+ if (menuItems.length > 0) {
29
+ setActiveItem(0);
30
+ }
31
+ };
32
+
11
33
  const setActiveItem = (index) => {
12
34
  if (activeIndex > -1 && menuItems[activeIndex]) {
13
35
  menuItems[activeIndex].classList.remove('active');
@@ -17,36 +39,48 @@
17
39
  const activeItem = menuItems[activeIndex];
18
40
  activeItem.classList.add('active');
19
41
  trigger.setAttribute('aria-activedescendant', activeItem.id);
20
- activeItem.scrollIntoView({ block: 'nearest' });
21
42
  } else {
22
43
  trigger.removeAttribute('aria-activedescendant');
23
44
  }
24
45
  };
25
46
 
26
- const handleKeyDown = (e) => {
27
- if (!popover.matches(':popover-open')) {
47
+ trigger.addEventListener('click', () => {
48
+ const isExpanded = trigger.getAttribute('aria-expanded') === 'true';
49
+ if (isExpanded) {
50
+ closeMenu();
51
+ } else {
52
+ openMenu();
53
+ }
54
+ });
55
+
56
+ dropdownMenuComponent.addEventListener('keydown', (e) => {
57
+ const isExpanded = trigger.getAttribute('aria-expanded') === 'true';
58
+
59
+ if (e.key === 'Escape') {
60
+ if (isExpanded) closeMenu();
61
+ return;
62
+ }
63
+
64
+ if (!isExpanded) {
28
65
  if (['ArrowDown', 'ArrowUp', 'Enter', ' '].includes(e.key)) {
29
66
  e.preventDefault();
30
- trigger.click();
67
+ openMenu();
31
68
  }
32
69
  return;
33
70
  }
34
71
 
35
- let nextIndex = activeIndex;
36
72
  if (menuItems.length === 0) return;
37
73
 
74
+ let nextIndex = activeIndex;
75
+
38
76
  switch (e.key) {
39
77
  case 'ArrowDown':
40
78
  e.preventDefault();
41
- if (activeIndex < menuItems.length - 1) {
42
- nextIndex = activeIndex + 1;
43
- }
79
+ nextIndex = activeIndex < menuItems.length - 1 ? activeIndex + 1 : 0;
44
80
  break;
45
81
  case 'ArrowUp':
46
82
  e.preventDefault();
47
- if (activeIndex > 0) {
48
- nextIndex = activeIndex - 1;
49
- }
83
+ nextIndex = activeIndex > 0 ? activeIndex - 1 : menuItems.length - 1;
50
84
  break;
51
85
  case 'Home':
52
86
  e.preventDefault();
@@ -60,42 +94,24 @@
60
94
  case ' ':
61
95
  e.preventDefault();
62
96
  menuItems[activeIndex]?.click();
63
- break;
97
+ closeMenu();
98
+ return;
64
99
  }
65
100
 
66
101
  if (nextIndex !== activeIndex) {
67
102
  setActiveItem(nextIndex);
68
103
  }
69
- };
70
-
71
- trigger.addEventListener('keydown', handleKeyDown);
72
-
73
- popover.addEventListener('toggle', (e) => {
74
- trigger.setAttribute('aria-expanded', e.newState === 'open');
75
- if (e.newState === 'open') {
76
- menuItems = Array.from(menu.querySelectorAll('[role^="menuitem"]:not([disabled])'));
77
- menuItems.forEach((item, index) => {
78
- if (!item.id) item.id = `${menu.id}-item-${index}`;
79
- });
80
- setActiveItem(0);
81
- } else {
82
- setActiveItem(-1);
83
- }
84
104
  });
85
105
 
86
106
  menu.addEventListener('click', (e) => {
87
107
  if (e.target.closest('[role^="menuitem"]')) {
88
- popover.hidePopover();
108
+ closeMenu();
89
109
  }
90
110
  });
91
111
 
92
- menu.addEventListener('mouseover', (e) => {
93
- const item = e.target.closest('[role^="menuitem"]:not([disabled])');
94
- if (item) {
95
- const index = menuItems.indexOf(item);
96
- if (index > -1 && index !== activeIndex) {
97
- setActiveItem(index);
98
- }
112
+ document.addEventListener('click', (e) => {
113
+ if (!dropdownMenuComponent.contains(e.target)) {
114
+ closeMenu();
99
115
  }
100
116
  });
101
117
 
@@ -107,23 +123,92 @@
107
123
  const observer = new MutationObserver((mutations) => {
108
124
  mutations.forEach((mutation) => {
109
125
  mutation.addedNodes.forEach((node) => {
110
- if (node.nodeType === Node.ELEMENT_NODE) {
111
- if (node.matches('.dropdown-menu:not([data-dropdown-menu-initialized])')) {
112
- initDropdownMenu(node);
113
- }
114
- node.querySelectorAll('.dropdown-menu:not([data-dropdown-menu-initialized])').forEach(initDropdownMenu);
126
+ if (node.nodeType !== Node.ELEMENT_NODE) return;
127
+ if (node.matches('.dropdown-menu:not([data-dropdown-menu-initialized])')) {
128
+ initDropdownMenu(node);
115
129
  }
130
+ node.querySelectorAll('.dropdown-menu:not([data-dropdown-menu-initialized])').forEach(initDropdownMenu);
116
131
  });
117
132
  });
118
133
  });
134
+
135
+ observer.observe(document.body, { childList: true, subtree: true });
136
+ })();
137
+ (() => {
138
+ const initPopover = (popoverComponent) => {
139
+ const trigger = popoverComponent.querySelector(':scope > button');
140
+ const content = popoverComponent.querySelector(':scope > [data-popover]');
141
+
142
+ if (!trigger || !content) {
143
+ console.error('Popover component is missing a trigger button or a content element.', popoverComponent);
144
+ return;
145
+ }
146
+
147
+ const closePopover = () => {
148
+ if (trigger.getAttribute('aria-expanded') === 'false') return;
149
+ trigger.setAttribute('aria-expanded', 'false');
150
+ content.setAttribute('aria-hidden', 'true');
151
+ trigger.focus();
152
+ };
153
+
154
+ const openPopover = () => {
155
+ const elementToFocus = content.querySelector('[autofocus]');
156
+ if (elementToFocus) {
157
+ content.addEventListener('transitionend', () => {
158
+ elementToFocus.focus();
159
+ }, { once: true });
160
+ }
161
+
162
+ trigger.setAttribute('aria-expanded', 'true');
163
+ content.setAttribute('aria-hidden', 'false');
164
+ };
119
165
 
166
+ trigger.addEventListener('click', () => {
167
+ const isExpanded = trigger.getAttribute('aria-expanded') === 'true';
168
+ if (isExpanded) {
169
+ closePopover();
170
+ } else {
171
+ openPopover();
172
+ }
173
+ });
174
+
175
+ popoverComponent.addEventListener('keydown', (e) => {
176
+ if (e.key === 'Escape') {
177
+ closePopover();
178
+ }
179
+ });
180
+
181
+ document.addEventListener('click', (e) => {
182
+ if (!popoverComponent.contains(e.target)) {
183
+ closePopover();
184
+ }
185
+ });
186
+
187
+ popoverComponent.dataset.popoverInitialized = true;
188
+ };
189
+
190
+ document.querySelectorAll('.popover:not([data-popover-initialized])').forEach(initPopover);
191
+
192
+ const observer = new MutationObserver((mutations) => {
193
+ mutations.forEach((mutation) => {
194
+ mutation.addedNodes.forEach((node) => {
195
+ if (node.nodeType !== Node.ELEMENT_NODE) return;
196
+ if (node.matches('.popover:not([data-popover-initialized])')) {
197
+ initPopover(node);
198
+ }
199
+ node.querySelectorAll('.popover:not([data-popover-initialized])').forEach(initPopover);
200
+ });
201
+ });
202
+ });
203
+
120
204
  observer.observe(document.body, { childList: true, subtree: true });
121
205
  })();
206
+
122
207
  (() => {
123
208
  const initSelect = (selectComponent) => {
124
- const trigger = selectComponent.querySelector(':scope > [popovertarget]');
209
+ const trigger = selectComponent.querySelector(':scope > button');
125
210
  const selectedValue = trigger.querySelector(':scope > span');
126
- const popover = selectComponent.querySelector(':scope > [popover]');
211
+ const popover = selectComponent.querySelector(':scope > [data-popover]');
127
212
  const listbox = popover.querySelector('[role="listbox"]');
128
213
  const input = selectComponent.querySelector(':scope > input[type="hidden"]');
129
214
  const filter = selectComponent.querySelector('header input[type="text"]');
@@ -142,15 +227,26 @@
142
227
  }
143
228
  };
144
229
 
230
+ const closePopover = () => {
231
+ popover.setAttribute('aria-hidden', 'true');
232
+ trigger.setAttribute('aria-expanded', 'false');
233
+ if (filter) {
234
+ filter.value = '';
235
+ visibleOptions = [...options];
236
+ options.forEach(opt => opt.setAttribute('aria-hidden', 'false'));
237
+ }
238
+ trigger.removeAttribute('aria-activedescendant');
239
+ if (activeIndex > -1) options[activeIndex]?.classList.remove('active');
240
+ activeIndex = -1;
241
+ }
242
+
145
243
  const selectOption = (option) => {
146
244
  if (!option) return;
147
245
 
148
- updateValue(option);
149
-
150
- trigger.removeAttribute('aria-activedescendant');
151
- options.forEach(opt => opt.classList.remove('active'));
152
- activeIndex = -1;
153
- popover.hidePopover();
246
+ if (option.dataset.value) {
247
+ updateValue(option);
248
+ }
249
+ closePopover();
154
250
  };
155
251
 
156
252
  if (filter) {
@@ -183,12 +279,14 @@
183
279
  updateValue(initialOption);
184
280
 
185
281
  const handleKeyNavigation = (e) => {
186
- if (!['ArrowDown', 'ArrowUp', 'Enter', 'Home', 'End'].includes(e.key)) {
282
+ const isPopoverOpen = popover.getAttribute('aria-hidden') === 'false';
283
+
284
+ if (!['ArrowDown', 'ArrowUp', 'Enter', 'Home', 'End', 'Escape'].includes(e.key)) {
187
285
  return;
188
286
  }
189
287
 
190
- if (!popover.matches(':popover-open')) {
191
- if (e.currentTarget === trigger && e.key !== 'Enter') {
288
+ if (!isPopoverOpen) {
289
+ if (e.key !== 'Enter' && e.key !== 'Escape') {
192
290
  e.preventDefault();
193
291
  trigger.click();
194
292
  }
@@ -197,9 +295,14 @@
197
295
 
198
296
  e.preventDefault();
199
297
 
298
+ if (e.key === 'Escape') {
299
+ closePopover();
300
+ return;
301
+ }
302
+
200
303
  if (e.key === 'Enter') {
201
304
  if (activeIndex > -1) {
202
- selectOption(options[activeIndex]);
305
+ selectOption(visibleOptions[activeIndex]);
203
306
  }
204
307
  return;
205
308
  }
@@ -251,6 +354,31 @@
251
354
  filter.addEventListener('keydown', handleKeyNavigation);
252
355
  }
253
356
 
357
+ trigger.addEventListener('click', () => {
358
+ const isExpanded = trigger.getAttribute('aria-expanded') === 'true';
359
+
360
+ if (isExpanded) {
361
+ closePopover();
362
+ } else {
363
+ popover.setAttribute('aria-hidden', 'false');
364
+ trigger.setAttribute('aria-expanded', 'true');
365
+ if (filter) filter.focus();
366
+
367
+ const selectedOption = listbox.querySelector('[role="option"][aria-selected="true"]');
368
+ if (selectedOption) {
369
+ if (activeIndex > -1) {
370
+ options[activeIndex]?.classList.remove('active');
371
+ }
372
+ activeIndex = options.indexOf(selectedOption);
373
+ selectedOption.classList.add('active');
374
+ if (selectedOption.id) {
375
+ trigger.setAttribute('aria-activedescendant', selectedOption.id);
376
+ }
377
+ selectedOption.scrollIntoView({ block: 'nearest' });
378
+ }
379
+ }
380
+ });
381
+
254
382
  listbox.addEventListener('click', (e) => {
255
383
  const clickedOption = e.target.closest('[role="option"]');
256
384
  if (clickedOption) {
@@ -258,46 +386,13 @@
258
386
  }
259
387
  });
260
388
 
261
- popover.addEventListener('toggle', (e) => {
262
- trigger.setAttribute('aria-expanded', e.newState === 'open');
263
-
264
- if (e.newState === 'open') {
265
- if (filter) filter.focus();
266
-
267
- const selectedOption = listbox.querySelector('[role="option"][aria-selected="true"]');
268
- let startingOption = null;
269
-
270
- if (selectedOption && visibleOptions.includes(selectedOption)) {
271
- startingOption = selectedOption;
272
- } else if (visibleOptions.length > 0) {
273
- startingOption = visibleOptions[0];
274
- }
275
-
276
- if (activeIndex > -1) options[activeIndex]?.classList.remove('active');
277
-
278
- if (startingOption) {
279
- activeIndex = options.indexOf(startingOption);
280
- startingOption.classList.add('active');
281
- if (startingOption.id) {
282
- trigger.setAttribute('aria-activedescendant', startingOption.id);
283
- }
284
- startingOption.scrollIntoView({ block: 'nearest' });
285
- } else {
286
- activeIndex = -1;
287
- }
288
- } else if (e.newState === 'closed') {
289
- if (filter) {
290
- filter.value = '';
291
- visibleOptions = [...options];
292
- options.forEach(opt => opt.setAttribute('aria-hidden', 'false'));
293
- }
294
-
295
- trigger.removeAttribute('aria-activedescendant');
296
- if (activeIndex > -1) options[activeIndex]?.classList.remove('active');
297
- activeIndex = -1;
389
+ document.addEventListener('click', (e) => {
390
+ if (!selectComponent.contains(e.target)) {
391
+ closePopover();
298
392
  }
299
393
  });
300
394
 
395
+ popover.setAttribute('aria-hidden', 'true');
301
396
  selectComponent.dataset.selectInitialized = true;
302
397
  };
303
398
 
@@ -1 +1 @@
1
- (()=>{const e=e=>{const t=e.querySelector("[popovertarget]"),n=e.querySelector("[popover]"),a=n?.querySelector('[role="menu"]');if(!t||!n||!a)return;let o=[],r=-1;const i=e=>{if(r>-1&&o[r]&&o[r].classList.remove("active"),r=e,r>-1&&o[r]){const e=o[r];e.classList.add("active"),t.setAttribute("aria-activedescendant",e.id),e.scrollIntoView({block:"nearest"})}else t.removeAttribute("aria-activedescendant")};t.addEventListener("keydown",(e=>{if(!n.matches(":popover-open"))return void(["ArrowDown","ArrowUp","Enter"," "].includes(e.key)&&(e.preventDefault(),t.click()));let a=r;if(0!==o.length){switch(e.key){case"ArrowDown":e.preventDefault(),r<o.length-1&&(a=r+1);break;case"ArrowUp":e.preventDefault(),r>0&&(a=r-1);break;case"Home":e.preventDefault(),a=0;break;case"End":e.preventDefault(),a=o.length-1;break;case"Enter":case" ":e.preventDefault(),o[r]?.click()}a!==r&&i(a)}})),n.addEventListener("toggle",(e=>{t.setAttribute("aria-expanded","open"===e.newState),"open"===e.newState?(o=Array.from(a.querySelectorAll('[role^="menuitem"]:not([disabled])')),o.forEach(((e,t)=>{e.id||(e.id=`${a.id}-item-${t}`)})),i(0)):i(-1)})),a.addEventListener("click",(e=>{e.target.closest('[role^="menuitem"]')&&n.hidePopover()})),a.addEventListener("mouseover",(e=>{const t=e.target.closest('[role^="menuitem"]:not([disabled])');if(t){const e=o.indexOf(t);e>-1&&e!==r&&i(e)}})),e.dataset.dropdownMenuInitialized=!0};document.querySelectorAll(".dropdown-menu:not([data-dropdown-menu-initialized])").forEach(e);new MutationObserver((t=>{t.forEach((t=>{t.addedNodes.forEach((t=>{t.nodeType===Node.ELEMENT_NODE&&(t.matches(".dropdown-menu:not([data-dropdown-menu-initialized])")&&e(t),t.querySelectorAll(".dropdown-menu:not([data-dropdown-menu-initialized])").forEach(e))}))}))})).observe(document.body,{childList:!0,subtree:!0})})(),(()=>{const e=e=>{const t=e.querySelector(":scope > [popovertarget]"),n=t.querySelector(":scope > span"),a=e.querySelector(":scope > [popover]"),o=a.querySelector('[role="listbox"]'),r=e.querySelector(':scope > input[type="hidden"]'),i=e.querySelector('header input[type="text"]');if(!(t&&a&&o&&r))return;const d=Array.from(o.querySelectorAll('[role="option"]'));let s=[...d],c=-1;const l=e=>{e&&(n.innerHTML=e.dataset.label||e.innerHTML,r.value=e.dataset.value,o.querySelector('[role="option"][aria-selected="true"]')?.removeAttribute("aria-selected"),e.setAttribute("aria-selected","true"))},u=e=>{e&&(l(e),t.removeAttribute("aria-activedescendant"),d.forEach((e=>e.classList.remove("active"))),c=-1,a.hidePopover())};if(i){const e=()=>{const e=i.value.trim().toLowerCase();c>-1&&(d[c].classList.remove("active"),t.removeAttribute("aria-activedescendant"),c=-1),s=[],d.forEach((t=>{const n=(t.dataset.label||t.textContent).trim().toLowerCase().includes(e);t.setAttribute("aria-hidden",String(!n)),n&&s.push(t)}))};i.addEventListener("input",e)}let h=d.find((e=>r.value&&e.dataset.value===r.value));!h&&d.length>0&&(h=d[0]),l(h);const v=e=>{if(!["ArrowDown","ArrowUp","Enter","Home","End"].includes(e.key))return;if(!a.matches(":popover-open"))return void(e.currentTarget===t&&"Enter"!==e.key&&(e.preventDefault(),t.click()));if(e.preventDefault(),"Enter"===e.key)return void(c>-1&&u(d[c]));if(0===s.length)return;const n=c>-1?s.indexOf(d[c]):-1;let o=n;switch(e.key){case"ArrowDown":n<s.length-1&&(o=n+1);break;case"ArrowUp":n>0?o=n-1:-1===n&&(o=0);break;case"Home":o=0;break;case"End":o=s.length-1}if(o!==n){n>-1&&s[n].classList.remove("active");const e=s[o];e.classList.add("active"),c=d.indexOf(e),e.id&&t.setAttribute("aria-activedescendant",e.id),e.scrollIntoView({block:"nearest",behavior:"smooth"})}};t.addEventListener("keydown",v),i&&i.addEventListener("keydown",v),o.addEventListener("click",(e=>{const t=e.target.closest('[role="option"]');t&&u(t)})),a.addEventListener("toggle",(e=>{if(t.setAttribute("aria-expanded","open"===e.newState),"open"===e.newState){i&&i.focus();const e=o.querySelector('[role="option"][aria-selected="true"]');let n=null;e&&s.includes(e)?n=e:s.length>0&&(n=s[0]),c>-1&&d[c]?.classList.remove("active"),n?(c=d.indexOf(n),n.classList.add("active"),n.id&&t.setAttribute("aria-activedescendant",n.id),n.scrollIntoView({block:"nearest"})):c=-1}else"closed"===e.newState&&(i&&(i.value="",s=[...d],d.forEach((e=>e.setAttribute("aria-hidden","false")))),t.removeAttribute("aria-activedescendant"),c>-1&&d[c]?.classList.remove("active"),c=-1)})),e.dataset.selectInitialized=!0};document.querySelectorAll("div.select:not([data-select-initialized])").forEach(e);new MutationObserver((t=>{t.forEach((t=>{t.addedNodes.forEach((t=>{t.nodeType===Node.ELEMENT_NODE&&(t.matches("div.select:not([data-select-initialized])")&&e(t),t.querySelectorAll("div.select:not([data-select-initialized])").forEach(e))}))}))})).observe(document.body,{childList:!0,subtree:!0})})(),(()=>{if(!window.history.__basecoatPatched){const e=window.history.pushState;window.history.pushState=function(...t){e.apply(this,t),window.dispatchEvent(new Event("basecoat:locationchange"))};const t=window.history.replaceState;window.history.replaceState=function(...e){t.apply(this,e),window.dispatchEvent(new Event("basecoat:locationchange"))},window.history.__basecoatPatched=!0}const e=e=>{const t="false"!==e.dataset.initialOpen,n="true"===e.dataset.initialMobileOpen,a=parseInt(e.dataset.breakpoint)||768;let o=a>0?window.innerWidth>=a?t:n:t;const r=()=>{const t=window.location.pathname.replace(/\/$/,"");e.querySelectorAll("a").forEach((e=>{if(e.hasAttribute("data-ignore-current"))return;new URL(e.href).pathname.replace(/\/$/,"")===t?e.setAttribute("aria-current","page"):e.removeAttribute("aria-current")}))},i=()=>{e.setAttribute("aria-hidden",!o),o?e.removeAttribute("inert"):e.setAttribute("inert","")},d=e=>{o=e,i()},s=e.id;window.addEventListener("sidebar:open",(e=>{e.detail?.id&&e.detail.id!==s||d(!0)})),window.addEventListener("sidebar:close",(e=>{e.detail?.id&&e.detail.id!==s||d(!1)})),window.addEventListener("sidebar:toggle",(e=>{e.detail?.id&&e.detail.id!==s||d(!o)})),e.addEventListener("click",(t=>{const n=t.target,o=e.querySelector("nav");if(window.innerWidth<a&&n.closest("a, button")&&!n.closest("[data-keep-mobile-sidebar-open]"))return document.activeElement&&document.activeElement.blur(),void d(!1);(n===e||o&&!o.contains(n))&&(document.activeElement&&document.activeElement.blur(),d(!1))})),window.addEventListener("popstate",r),window.addEventListener("basecoat:locationchange",r),i(),r(),e.dataset.sidebarInitialized=!0};document.querySelectorAll(".sidebar:not([data-sidebar-initialized])").forEach(e);new MutationObserver((t=>{t.forEach((t=>{t.addedNodes.forEach((t=>{t.nodeType===Node.ELEMENT_NODE&&(t.matches(".sidebar:not([data-sidebar-initialized])")&&e(t),t.querySelectorAll(".sidebar:not([data-sidebar-initialized])").forEach(e))}))}))})).observe(document.body,{childList:!0,subtree:!0})})(),(()=>{const e=e=>{const t=e.querySelector('[role="tablist"]');if(!t)return;const n=Array.from(t.querySelectorAll('[role="tab"]')),a=n.map((e=>document.getElementById(e.getAttribute("aria-controls")))).filter(Boolean),o=e=>{n.forEach(((e,t)=>{e.setAttribute("aria-selected","false"),e.setAttribute("tabindex","-1"),a[t]&&(a[t].hidden=!0)})),e.setAttribute("aria-selected","true"),e.setAttribute("tabindex","0");const t=document.getElementById(e.getAttribute("aria-controls"));t&&(t.hidden=!1)};t.addEventListener("click",(e=>{const t=e.target.closest('[role="tab"]');t&&o(t)})),t.addEventListener("keydown",(e=>{const t=e.target;if(!n.includes(t))return;let a;const r=n.indexOf(t);switch(e.key){case"ArrowRight":a=n[(r+1)%n.length];break;case"ArrowLeft":a=n[(r-1+n.length)%n.length];break;case"Home":a=n[0];break;case"End":a=n[n.length-1];break;default:return}e.preventDefault(),o(a),a.focus()})),e.dataset.tabsInitialized=!0};document.querySelectorAll(".tabs:not([data-tabs-initialized])").forEach(e);new MutationObserver((t=>{t.forEach((t=>{t.addedNodes.forEach((t=>{t.nodeType===Node.ELEMENT_NODE&&(t.matches(".tabs:not([data-tabs-initialized])")&&e(t),t.querySelectorAll(".tabs:not([data-tabs-initialized])").forEach(e))}))}))})).observe(document.body,{childList:!0,subtree:!0})})(),(()=>{let e;const t=new WeakMap;let n=!1;const a={success:'<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>',error:'<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>',info:'<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>',warning:'<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>'};function o(t){t.dataset.toasterInitialized||(e=t,e.addEventListener("mouseenter",i),e.addEventListener("mouseleave",d),e.addEventListener("click",(e=>{const t=e.target.closest(".toast footer a"),n=e.target.closest(".toast footer button");(t||n)&&s(e.target.closest(".toast"))})),e.querySelectorAll(".toast:not([data-toast-initialized])").forEach(r),e.dataset.toasterInitialized="true")}function r(e){if(e.dataset.toastInitialized)return;const a=parseInt(e.dataset.duration),o=-1!==a?a||("error"===e.dataset.category?5e3:3e3):-1,r={remainingTime:o,timeoutId:null,startTime:null};-1!==o&&(n?r.timeoutId=null:(r.startTime=Date.now(),r.timeoutId=setTimeout((()=>s(e)),o))),t.set(e,r),e.dataset.toastInitialized="true"}function i(){n||(n=!0,e.querySelectorAll('.toast:not([aria-hidden="true"])').forEach((e=>{if(!t.has(e))return;const n=t.get(e);n.timeoutId&&(clearTimeout(n.timeoutId),n.timeoutId=null,n.remainingTime-=Date.now()-n.startTime)})))}function d(){n&&(n=!1,e.querySelectorAll('.toast:not([aria-hidden="true"])').forEach((e=>{if(!t.has(e))return;const n=t.get(e);-1===n.remainingTime||n.timeoutId||(n.remainingTime>0?(n.startTime=Date.now(),n.timeoutId=setTimeout((()=>s(e)),n.remainingTime)):s(e))})))}function s(e){if(!t.has(e))return;const n=t.get(e);clearTimeout(n.timeoutId),t.delete(e),document.activeElement&&document.activeElement.blur(),e.setAttribute("aria-hidden","true"),e.addEventListener("transitionend",(()=>e.remove()),{once:!0})}const c=document.getElementById("toaster");c&&o(c),window.addEventListener("basecoat:toast",(t=>{if(!e)return void console.error("Cannot create toast: toaster container not found on page.");const n=function(e){const{category:t="info",title:n,description:o,action:r,cancel:i,duration:d,icon:s}=e,c=s||t&&a[t]||"",l=n?`<h2>${n}</h2>`:"",u=o?`<p>${o}</p>`:"",h=r?.href?`<a href="${r.href}" class="btn" data-toast-action>${r.label}</a>`:r?.onclick?`<button type="button" class="btn" data-toast-action onclick="${r.onclick}">${r.label}</button>`:"",v=i?`<button type="button" class="btn-outline h-6 text-xs px-2.5 rounded-sm" data-toast-cancel onclick="${i?.onclick}">${i.label}</button>`:"",m=`\n <div\n class="toast"\n role="${"error"===t?"alert":"status"}"\n aria-atomic="true"\n ${t?`data-category="${t}"`:""}\n ${void 0!==d?`data-duration="${d}"`:""}\n >\n <div class="toast-content">\n ${c}\n <section>\n ${l}\n ${u}\n </section>\n ${h||v?`<footer>${h}${v}</footer>`:""}\n </div>\n </div>\n </div>\n `,b=document.createElement("template");return b.innerHTML=m.trim(),b.content.firstChild}(t.detail?.config||{});e.appendChild(n)}));new MutationObserver((t=>{t.forEach((t=>{t.addedNodes.forEach((t=>{t.nodeType===Node.ELEMENT_NODE&&(t.matches("#toaster")&&o(t),e&&t.matches(".toast:not([data-toast-initialized])")&&r(t))}))}))})).observe(document.body,{childList:!0,subtree:!0})})();
1
+ (()=>{const e=e=>{const t=e.querySelector(":scope > button"),a=e.querySelector(":scope > [data-popover]"),n=a.querySelector('[role="menu"]');if(!t||!n||!a)return void console.error("Dropdown menu component is missing a trigger, a menu, or a popover content element.",e);let r=[],i=-1;const o=()=>{"false"!==t.getAttribute("aria-expanded")&&(t.setAttribute("aria-expanded","false"),t.removeAttribute("aria-activedescendant"),a.setAttribute("aria-hidden","true"),t.focus(),i=-1)},d=()=>{t.setAttribute("aria-expanded","true"),a.setAttribute("aria-hidden","false"),r=Array.from(n.querySelectorAll('[role^="menuitem"]:not([disabled])')),r.length>0&&s(0)},s=e=>{if(i>-1&&r[i]&&r[i].classList.remove("active"),i=e,i>-1&&r[i]){const e=r[i];e.classList.add("active"),t.setAttribute("aria-activedescendant",e.id)}else t.removeAttribute("aria-activedescendant")};t.addEventListener("click",(()=>{"true"===t.getAttribute("aria-expanded")?o():d()})),e.addEventListener("keydown",(e=>{const a="true"===t.getAttribute("aria-expanded");if("Escape"===e.key)return void(a&&o());if(!a)return void(["ArrowDown","ArrowUp","Enter"," "].includes(e.key)&&(e.preventDefault(),d()));if(0===r.length)return;let n=i;switch(e.key){case"ArrowDown":e.preventDefault(),n=i<r.length-1?i+1:0;break;case"ArrowUp":e.preventDefault(),n=i>0?i-1:r.length-1;break;case"Home":e.preventDefault(),n=0;break;case"End":e.preventDefault(),n=r.length-1;break;case"Enter":case" ":return e.preventDefault(),r[i]?.click(),void o()}n!==i&&s(n)})),n.addEventListener("click",(e=>{e.target.closest('[role^="menuitem"]')&&o()})),document.addEventListener("click",(t=>{e.contains(t.target)||o()})),e.dataset.dropdownMenuInitialized=!0};document.querySelectorAll(".dropdown-menu:not([data-dropdown-menu-initialized])").forEach(e);new MutationObserver((t=>{t.forEach((t=>{t.addedNodes.forEach((t=>{t.nodeType===Node.ELEMENT_NODE&&(t.matches(".dropdown-menu:not([data-dropdown-menu-initialized])")&&e(t),t.querySelectorAll(".dropdown-menu:not([data-dropdown-menu-initialized])").forEach(e))}))}))})).observe(document.body,{childList:!0,subtree:!0})})(),(()=>{const e=e=>{const t=e.querySelector(":scope > button"),a=e.querySelector(":scope > [data-popover]");if(!t||!a)return void console.error("Popover component is missing a trigger button or a content element.",e);const n=()=>{"false"!==t.getAttribute("aria-expanded")&&(t.setAttribute("aria-expanded","false"),a.setAttribute("aria-hidden","true"),t.focus())};t.addEventListener("click",(()=>{"true"===t.getAttribute("aria-expanded")?n():(()=>{const e=a.querySelector("[autofocus]");e&&a.addEventListener("transitionend",(()=>{e.focus()}),{once:!0}),t.setAttribute("aria-expanded","true"),a.setAttribute("aria-hidden","false")})()})),e.addEventListener("keydown",(e=>{"Escape"===e.key&&n()})),document.addEventListener("click",(t=>{e.contains(t.target)||n()})),e.dataset.popoverInitialized=!0};document.querySelectorAll(".popover:not([data-popover-initialized])").forEach(e);new MutationObserver((t=>{t.forEach((t=>{t.addedNodes.forEach((t=>{t.nodeType===Node.ELEMENT_NODE&&(t.matches(".popover:not([data-popover-initialized])")&&e(t),t.querySelectorAll(".popover:not([data-popover-initialized])").forEach(e))}))}))})).observe(document.body,{childList:!0,subtree:!0})})(),(()=>{const e=e=>{const t=e.querySelector(":scope > button"),a=t.querySelector(":scope > span"),n=e.querySelector(":scope > [data-popover]"),r=n.querySelector('[role="listbox"]'),i=e.querySelector(':scope > input[type="hidden"]'),o=e.querySelector('header input[type="text"]');if(!(t&&n&&r&&i))return;const d=Array.from(r.querySelectorAll('[role="option"]'));let s=[...d],c=-1;const l=e=>{e&&(a.innerHTML=e.dataset.label||e.innerHTML,i.value=e.dataset.value,r.querySelector('[role="option"][aria-selected="true"]')?.removeAttribute("aria-selected"),e.setAttribute("aria-selected","true"))},u=()=>{n.setAttribute("aria-hidden","true"),t.setAttribute("aria-expanded","false"),o&&(o.value="",s=[...d],d.forEach((e=>e.setAttribute("aria-hidden","false")))),t.removeAttribute("aria-activedescendant"),c>-1&&d[c]?.classList.remove("active"),c=-1},h=e=>{e&&(e.dataset.value&&l(e),u())};if(o){const e=()=>{const e=o.value.trim().toLowerCase();c>-1&&(d[c].classList.remove("active"),t.removeAttribute("aria-activedescendant"),c=-1),s=[],d.forEach((t=>{const a=(t.dataset.label||t.textContent).trim().toLowerCase().includes(e);t.setAttribute("aria-hidden",String(!a)),a&&s.push(t)}))};o.addEventListener("input",e)}let v=d.find((e=>i.value&&e.dataset.value===i.value));!v&&d.length>0&&(v=d[0]),l(v);const p=e=>{const a="false"===n.getAttribute("aria-hidden");if(!["ArrowDown","ArrowUp","Enter","Home","End","Escape"].includes(e.key))return;if(!a)return void("Enter"!==e.key&&"Escape"!==e.key&&(e.preventDefault(),t.click()));if(e.preventDefault(),"Escape"===e.key)return void u();if("Enter"===e.key)return void(c>-1&&h(s[c]));if(0===s.length)return;const r=c>-1?s.indexOf(d[c]):-1;let i=r;switch(e.key){case"ArrowDown":r<s.length-1&&(i=r+1);break;case"ArrowUp":r>0?i=r-1:-1===r&&(i=0);break;case"Home":i=0;break;case"End":i=s.length-1}if(i!==r){r>-1&&s[r].classList.remove("active");const e=s[i];e.classList.add("active"),c=d.indexOf(e),e.id&&t.setAttribute("aria-activedescendant",e.id),e.scrollIntoView({block:"nearest",behavior:"smooth"})}};t.addEventListener("keydown",p),o&&o.addEventListener("keydown",p),t.addEventListener("click",(()=>{if("true"===t.getAttribute("aria-expanded"))u();else{n.setAttribute("aria-hidden","false"),t.setAttribute("aria-expanded","true"),o&&o.focus();const e=r.querySelector('[role="option"][aria-selected="true"]');e&&(c>-1&&d[c]?.classList.remove("active"),c=d.indexOf(e),e.classList.add("active"),e.id&&t.setAttribute("aria-activedescendant",e.id),e.scrollIntoView({block:"nearest"}))}})),r.addEventListener("click",(e=>{const t=e.target.closest('[role="option"]');t&&h(t)})),document.addEventListener("click",(t=>{e.contains(t.target)||u()})),n.setAttribute("aria-hidden","true"),e.dataset.selectInitialized=!0};document.querySelectorAll("div.select:not([data-select-initialized])").forEach(e);new MutationObserver((t=>{t.forEach((t=>{t.addedNodes.forEach((t=>{t.nodeType===Node.ELEMENT_NODE&&(t.matches("div.select:not([data-select-initialized])")&&e(t),t.querySelectorAll("div.select:not([data-select-initialized])").forEach(e))}))}))})).observe(document.body,{childList:!0,subtree:!0})})(),(()=>{if(!window.history.__basecoatPatched){const e=window.history.pushState;window.history.pushState=function(...t){e.apply(this,t),window.dispatchEvent(new Event("basecoat:locationchange"))};const t=window.history.replaceState;window.history.replaceState=function(...e){t.apply(this,e),window.dispatchEvent(new Event("basecoat:locationchange"))},window.history.__basecoatPatched=!0}const e=e=>{const t="false"!==e.dataset.initialOpen,a="true"===e.dataset.initialMobileOpen,n=parseInt(e.dataset.breakpoint)||768;let r=n>0?window.innerWidth>=n?t:a:t;const i=()=>{const t=window.location.pathname.replace(/\/$/,"");e.querySelectorAll("a").forEach((e=>{if(e.hasAttribute("data-ignore-current"))return;new URL(e.href).pathname.replace(/\/$/,"")===t?e.setAttribute("aria-current","page"):e.removeAttribute("aria-current")}))},o=()=>{e.setAttribute("aria-hidden",!r),r?e.removeAttribute("inert"):e.setAttribute("inert","")},d=e=>{r=e,o()},s=e.id;window.addEventListener("sidebar:open",(e=>{e.detail?.id&&e.detail.id!==s||d(!0)})),window.addEventListener("sidebar:close",(e=>{e.detail?.id&&e.detail.id!==s||d(!1)})),window.addEventListener("sidebar:toggle",(e=>{e.detail?.id&&e.detail.id!==s||d(!r)})),e.addEventListener("click",(t=>{const a=t.target,r=e.querySelector("nav");if(window.innerWidth<n&&a.closest("a, button")&&!a.closest("[data-keep-mobile-sidebar-open]"))return document.activeElement&&document.activeElement.blur(),void d(!1);(a===e||r&&!r.contains(a))&&(document.activeElement&&document.activeElement.blur(),d(!1))})),window.addEventListener("popstate",i),window.addEventListener("basecoat:locationchange",i),o(),i(),e.dataset.sidebarInitialized=!0};document.querySelectorAll(".sidebar:not([data-sidebar-initialized])").forEach(e);new MutationObserver((t=>{t.forEach((t=>{t.addedNodes.forEach((t=>{t.nodeType===Node.ELEMENT_NODE&&(t.matches(".sidebar:not([data-sidebar-initialized])")&&e(t),t.querySelectorAll(".sidebar:not([data-sidebar-initialized])").forEach(e))}))}))})).observe(document.body,{childList:!0,subtree:!0})})(),(()=>{const e=e=>{const t=e.querySelector('[role="tablist"]');if(!t)return;const a=Array.from(t.querySelectorAll('[role="tab"]')),n=a.map((e=>document.getElementById(e.getAttribute("aria-controls")))).filter(Boolean),r=e=>{a.forEach(((e,t)=>{e.setAttribute("aria-selected","false"),e.setAttribute("tabindex","-1"),n[t]&&(n[t].hidden=!0)})),e.setAttribute("aria-selected","true"),e.setAttribute("tabindex","0");const t=document.getElementById(e.getAttribute("aria-controls"));t&&(t.hidden=!1)};t.addEventListener("click",(e=>{const t=e.target.closest('[role="tab"]');t&&r(t)})),t.addEventListener("keydown",(e=>{const t=e.target;if(!a.includes(t))return;let n;const i=a.indexOf(t);switch(e.key){case"ArrowRight":n=a[(i+1)%a.length];break;case"ArrowLeft":n=a[(i-1+a.length)%a.length];break;case"Home":n=a[0];break;case"End":n=a[a.length-1];break;default:return}e.preventDefault(),r(n),n.focus()})),e.dataset.tabsInitialized=!0};document.querySelectorAll(".tabs:not([data-tabs-initialized])").forEach(e);new MutationObserver((t=>{t.forEach((t=>{t.addedNodes.forEach((t=>{t.nodeType===Node.ELEMENT_NODE&&(t.matches(".tabs:not([data-tabs-initialized])")&&e(t),t.querySelectorAll(".tabs:not([data-tabs-initialized])").forEach(e))}))}))})).observe(document.body,{childList:!0,subtree:!0})})(),(()=>{let e;const t=new WeakMap;let a=!1;const n={success:'<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>',error:'<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>',info:'<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>',warning:'<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>'};function r(t){t.dataset.toasterInitialized||(e=t,e.addEventListener("mouseenter",o),e.addEventListener("mouseleave",d),e.addEventListener("click",(e=>{const t=e.target.closest(".toast footer a"),a=e.target.closest(".toast footer button");(t||a)&&s(e.target.closest(".toast"))})),e.querySelectorAll(".toast:not([data-toast-initialized])").forEach(i),e.dataset.toasterInitialized="true")}function i(e){if(e.dataset.toastInitialized)return;const n=parseInt(e.dataset.duration),r=-1!==n?n||("error"===e.dataset.category?5e3:3e3):-1,i={remainingTime:r,timeoutId:null,startTime:null};-1!==r&&(a?i.timeoutId=null:(i.startTime=Date.now(),i.timeoutId=setTimeout((()=>s(e)),r))),t.set(e,i),e.dataset.toastInitialized="true"}function o(){a||(a=!0,e.querySelectorAll('.toast:not([aria-hidden="true"])').forEach((e=>{if(!t.has(e))return;const a=t.get(e);a.timeoutId&&(clearTimeout(a.timeoutId),a.timeoutId=null,a.remainingTime-=Date.now()-a.startTime)})))}function d(){a&&(a=!1,e.querySelectorAll('.toast:not([aria-hidden="true"])').forEach((e=>{if(!t.has(e))return;const a=t.get(e);-1===a.remainingTime||a.timeoutId||(a.remainingTime>0?(a.startTime=Date.now(),a.timeoutId=setTimeout((()=>s(e)),a.remainingTime)):s(e))})))}function s(e){if(!t.has(e))return;const a=t.get(e);clearTimeout(a.timeoutId),t.delete(e),document.activeElement&&document.activeElement.blur(),e.setAttribute("aria-hidden","true"),e.addEventListener("transitionend",(()=>e.remove()),{once:!0})}const c=document.getElementById("toaster");c&&r(c),window.addEventListener("basecoat:toast",(t=>{if(!e)return void console.error("Cannot create toast: toaster container not found on page.");const a=function(e){const{category:t="info",title:a,description:r,action:i,cancel:o,duration:d,icon:s}=e,c=s||t&&n[t]||"",l=a?`<h2>${a}</h2>`:"",u=r?`<p>${r}</p>`:"",h=i?.href?`<a href="${i.href}" class="btn" data-toast-action>${i.label}</a>`:i?.onclick?`<button type="button" class="btn" data-toast-action onclick="${i.onclick}">${i.label}</button>`:"",v=o?`<button type="button" class="btn-outline h-6 text-xs px-2.5 rounded-sm" data-toast-cancel onclick="${o?.onclick}">${o.label}</button>`:"",p=`\n <div\n class="toast"\n role="${"error"===t?"alert":"status"}"\n aria-atomic="true"\n ${t?`data-category="${t}"`:""}\n ${void 0!==d?`data-duration="${d}"`:""}\n >\n <div class="toast-content">\n ${c}\n <section>\n ${l}\n ${u}\n </section>\n ${h||v?`<footer>${h}${v}</footer>`:""}\n </div>\n </div>\n </div>\n `,b=document.createElement("template");return b.innerHTML=p.trim(),b.content.firstChild}(t.detail?.config||{});e.appendChild(a)}));new MutationObserver((t=>{t.forEach((t=>{t.addedNodes.forEach((t=>{t.nodeType===Node.ELEMENT_NODE&&(t.matches("#toaster")&&r(t),e&&t.matches(".toast:not([data-toast-initialized])")&&i(t))}))}))})).observe(document.body,{childList:!0,subtree:!0})})();