@tabworthy/components 0.16.0 → 1.0.0

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 (26) hide show
  1. package/dist/cjs/tabworthy-dates-calendar_2.cjs.entry.js +11 -6
  2. package/dist/cjs/tabworthy-dates.cjs.entry.js +2 -2
  3. package/dist/cjs/tabworthy-times.cjs.entry.js +5 -5
  4. package/dist/collection/components/tabworthy-dates/tabworthy-dates.js +2 -2
  5. package/dist/collection/components/tabworthy-modal/tabworthy-dates-modal.js +16 -7
  6. package/dist/collection/components/tabworthy-times/tabworthy-times.js +5 -5
  7. package/dist/components/{p-DXCumu2Y.js → p-Denq9zJN.js} +1 -1
  8. package/dist/components/tabworthy-dates-modal.js +1 -1
  9. package/dist/components/tabworthy-dates.js +1 -1
  10. package/dist/components/tabworthy-times.js +1 -1
  11. package/dist/esm/tabworthy-dates-calendar_2.entry.js +11 -6
  12. package/dist/esm/tabworthy-dates.entry.js +2 -2
  13. package/dist/esm/tabworthy-times.entry.js +5 -5
  14. package/dist/tabworthy-components/p-6749b25f.entry.js +1 -0
  15. package/dist/tabworthy-components/{p-82d70f28.entry.js → p-8c2b9340.entry.js} +1 -1
  16. package/dist/tabworthy-components/{p-66c929f1.entry.js → p-98ba1248.entry.js} +1 -1
  17. package/dist/tabworthy-components/tabworthy-components.esm.js +1 -1
  18. package/dist/types/components/tabworthy-dates/tabworthy-dates.d.ts +1 -0
  19. package/dist/types/components/tabworthy-modal/tabworthy-dates-modal.d.ts +2 -1
  20. package/dist/types/components/tabworthy-times/tabworthy-times.d.ts +1 -0
  21. package/dist/types/components.d.ts +1 -1
  22. package/package.json +3 -2
  23. package/dist/tabworthy-components/p-c57563a0.entry.js +0 -1
  24. package/dist/types/Users/damirbogdanov_1/work/tabworthy-components/.stencil/shared/utils/chrono-parser/chrono-parser.d.ts +0 -3
  25. package/dist/types/Users/damirbogdanov_1/work/tabworthy-components/.stencil/shared/utils/chrono-parser/chrono-parser.type.d.ts +0 -40
  26. package/dist/types/Users/damirbogdanov_1/work/tabworthy-components/.stencil/shared/utils/utils.d.ts +0 -34
@@ -2817,14 +2817,18 @@ const TabworthyDatesModal = class {
2817
2817
  * Close the dialog.
2818
2818
  */
2819
2819
  async close() {
2820
- var _a;
2820
+ var _a, _b;
2821
2821
  if (this.inline)
2822
2822
  return;
2823
+ const activeElement = document.activeElement;
2824
+ const focusMovedOutside = !!activeElement &&
2825
+ activeElement !== document.body &&
2826
+ !this.hostElement.contains(activeElement);
2823
2827
  this.showing = false;
2824
2828
  this.closed.emit(undefined);
2825
2829
  (_a = this.undo) === null || _a === void 0 ? void 0 : _a.call(this);
2826
- if (this.triggerElement)
2827
- this.triggerElement.focus();
2830
+ if (!focusMovedOutside)
2831
+ (_b = this.focusReturnElement) === null || _b === void 0 ? void 0 : _b.focus();
2828
2832
  }
2829
2833
  disconnectedCallback() {
2830
2834
  // Skip cleanup if we're in the middle of portal operations
@@ -2836,8 +2840,9 @@ const TabworthyDatesModal = class {
2836
2840
  async getState() {
2837
2841
  return this.showing;
2838
2842
  }
2839
- async setTriggerElement(element) {
2843
+ async setTriggerElement(element, focusElement = element) {
2840
2844
  this.triggerElement = element;
2845
+ this.focusReturnElement = focusElement;
2841
2846
  }
2842
2847
  /** Force update the popper position */
2843
2848
  async updatePosition() {
@@ -2859,7 +2864,7 @@ const TabworthyDatesModal = class {
2859
2864
  }
2860
2865
  }
2861
2866
  render() {
2862
- return (index.h(index.Host, { key: '2c9c3ade4eb4964dbb5ba86bd196240851dbb996', showing: this.showing, ref: (r) => r && (this.el = r) }, !this.inline && this.showing && (index.h("div", { key: '961c2d9e34d7ddadb512f8652f14ed4ed4ec6ce5', part: "body", ref: (r) => {
2867
+ return (index.h(index.Host, { key: '8f2128e3b9ed31547aaa4a1eb1f9fe1c2c554834', showing: this.showing, ref: (r) => r && (this.el = r) }, !this.inline && this.showing && (index.h("div", { key: 'd3c8a2b9d11bdd1147ded6256417c0bdda9274b5', part: "body", ref: (r) => {
2863
2868
  if (r) {
2864
2869
  this.bodyRef = r;
2865
2870
  // Setup portal and create popper when ref is set
@@ -2876,7 +2881,7 @@ const TabworthyDatesModal = class {
2876
2881
  });
2877
2882
  }
2878
2883
  }
2879
- }, style: { visibility: this.positioned ? "visible" : "hidden" }, onKeyDown: this.onKeyDown, role: "dialog", tabindex: -1, "aria-hidden": !this.showing, "aria-label": this.label, "aria-modal": this.showing }, index.h("focus-trap", { key: '719a3e82aab59326d1aa069b237d158d2311cd62' }, index.h("div", { key: 'b33e1aabdb7477409d97f757bf7121697979d50c', part: "content" }, index.h("slot", { key: 'c7e85552f37b930e298484c0040c138fdccb8ea7' }))))), this.inline && (index.h("div", { key: '59e0333fb0e980c17e0a1da041e6bc492d025bd8', part: "content" }, index.h("slot", { key: 'd52759f124c038fbde4b510ae1df8c3a1bdad25e' })))));
2884
+ }, style: { visibility: this.positioned ? "visible" : "hidden" }, onKeyDown: this.onKeyDown, role: "dialog", tabindex: -1, "aria-hidden": !this.showing, "aria-label": this.label, "aria-modal": this.showing }, index.h("focus-trap", { key: '3c36e0e81b87ef9364ff8288e200c4462626bfea' }, index.h("div", { key: '111ba3d8fea2f0f4afdb63506fa43d1b8467c14d', part: "content" }, index.h("slot", { key: '6ec34c827f3c4cf1a5f30d9e571826f73cc66157' }))))), this.inline && (index.h("div", { key: '49970743a4f726fd02b18ba485ba0753acc4d0ec', part: "content" }, index.h("slot", { key: '6d0e2cd6bdc51f63fbab138c93f9c99cc3b1291d' })))));
2880
2885
  }
2881
2886
  get hostElement() { return index.getElement(this); }
2882
2887
  static get watchers() { return {
@@ -10557,7 +10557,7 @@ const TabworthyDates = class {
10557
10557
  await customElements.whenDefined("tabworthy-dates-modal");
10558
10558
  // Use input container as trigger for proper dropdown alignment
10559
10559
  this.inputContainerRef &&
10560
- (await ((_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.setTriggerElement(this.inputContainerRef)));
10560
+ (await ((_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.setTriggerElement(this.inputContainerRef, this.calendarButtonRef)));
10561
10561
  if ((await ((_b = this.modalRef) === null || _b === void 0 ? void 0 : _b.getState())) === false)
10562
10562
  await ((_c = this.modalRef) === null || _c === void 0 ? void 0 : _c.open());
10563
10563
  else if ((await ((_d = this.modalRef) === null || _d === void 0 ? void 0 : _d.getState())) === true)
@@ -11001,7 +11001,7 @@ const TabworthyDates = class {
11001
11001
  return (index$1.h(index$1.Host, null, index$1.h("label", { htmlFor: this.id ? `${this.id}-input` : undefined, class: this.getClassName("label") }, this.label), index$1.h("br", null), index$1.h("div", { class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, index$1.h("input", { disabled: this.disabledState || this.disableFreeformInput, id: this.id ? `${this.id}-input` : undefined, type: "text", placeholder: this.placeholder, class: {
11002
11002
  [this.getClassName("input")]: true,
11003
11003
  [this.inputClass]: !!this.inputClass
11004
- }, ref: (r) => (this.inputRef = r), onChange: this.handleChange, onFocus: () => this.formatInput(false), onBlur: () => this.formatInput(true, false), "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (index$1.h("button", { type: "button", onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState, "aria-label": this.calendarButtonContent
11004
+ }, ref: (r) => (this.inputRef = r), onChange: this.handleChange, onFocus: () => this.formatInput(false), onBlur: () => this.formatInput(true, false), "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (index$1.h("button", { type: "button", ref: (r) => (this.calendarButtonRef = r), onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState, "aria-label": this.calendarButtonContent
11005
11005
  ? this.datesLabels.openCalendar
11006
11006
  : undefined }, this.calendarButtonContent ? (index$1.h("span", { innerHTML: this.calendarButtonContent })) : (this.datesLabels.openCalendar)))), index$1.h("tabworthy-dates-modal", { label: this.datesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
11007
11007
  if (!this.pickerRef)
@@ -145,7 +145,7 @@ const TabworthyTimes = class {
145
145
  this.handleCalendarButtonClick = async () => {
146
146
  if (this.modalRef) {
147
147
  // Use input container as trigger for proper dropdown alignment
148
- await this.modalRef.setTriggerElement(this.inputContainerRef);
148
+ await this.modalRef.setTriggerElement(this.inputContainerRef, this.calendarButtonRef);
149
149
  await this.modalRef.open();
150
150
  }
151
151
  };
@@ -491,12 +491,12 @@ const TabworthyTimes = class {
491
491
  }
492
492
  render() {
493
493
  var _a;
494
- return (index.h(index.Host, { key: '40aebf1f077c4766cbbb9bd3929f5d8d959b60a4', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState, "time-only": this.timeOnly }, index.h("label", { key: 'cbf04161329d320ebc9ae5b3a0fede08e3157afb', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), index.h("div", { key: '2e7e46172b8d46b2f88047d93f9e4d35e5c841f3', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, index.h("input", { key: '0fcf906d8bad7fe78e003bf881a6d22dcb42f4e8', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
494
+ return (index.h(index.Host, { key: 'eb40f4186e17019d6c0e7f59cd6c34ee65550fd8', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState, "time-only": this.timeOnly }, index.h("label", { key: '6d1f0deae328d66331350247da217c428910ddfb', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), index.h("div", { key: 'd7721562f0eeb5be4f6b68ff8e1c01c4ed08fe1b', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, index.h("input", { key: '1e4b4bd45f63aa5357505f58edde39739a51a124', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
495
495
  [this.getClassName("input")]: true,
496
496
  [this.inputClass]: !!this.inputClass
497
- }, placeholder: this.placeholder, disabled: this.disabledState || this.disableFreeformInput, value: (_a = this.internalValue) === null || _a === void 0 ? void 0 : _a.toString(), onBlur: this.handleInputBlur, onChange: this.handleInputChange, "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (index.h("button", { key: '7d63c31494474844633f64faf0aba4851574dce6', type: "button", onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState, "aria-label": this.calendarButtonContent
497
+ }, placeholder: this.placeholder, disabled: this.disabledState || this.disableFreeformInput, value: (_a = this.internalValue) === null || _a === void 0 ? void 0 : _a.toString(), onBlur: this.handleInputBlur, onChange: this.handleInputChange, "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (index.h("button", { key: 'c5789e7d45619291c38895ba184c6ec74d73c584', type: "button", ref: (r) => (this.calendarButtonRef = r), onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState, "aria-label": this.calendarButtonContent
498
498
  ? this.timesLabels.openCalendar
499
- : undefined }, this.calendarButtonContent ? (index.h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), index.h("tabworthy-dates-modal", { key: '802a7f839dd33d19885918819ae4a3fa9f6cb838', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
499
+ : undefined }, this.calendarButtonContent ? (index.h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), index.h("tabworthy-dates-modal", { key: 'af58b555642816b299cf50394148ed17c427db21', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
500
500
  if (this.pickerRef) {
501
501
  this.pickerRef.modalIsOpen = true;
502
502
  }
@@ -510,7 +510,7 @@ const TabworthyTimes = class {
510
510
  if (this.timePickerRef) {
511
511
  this.timePickerRef.modalIsOpen = false;
512
512
  }
513
- }, inline: this.inline, appendTo: this.appendTo }, index.h("div", { key: '2ff172c30561b5962400dc2fa052162e01013c7a', class: this.getClassName("picker-container") }, !this.timeOnly && (index.h("tabworthy-dates-calendar", { key: '6456181b374cae4d91c01b9b7873c91bb08a8778', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), onRequestClose: () => { var _a; return (_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.close(); }, labels: this.datesCalendarLabels, ref: (el) => (this.pickerRef = el), startDate: this.startDate, firstDayOfWeek: this.firstDayOfWeek, showHiddenTitle: true, disabled: this.disabledState, showMonthStepper: this.showMonthStepper, showYearStepper: this.showYearStepper, showClearButton: this.showClearButton, showCloseButton: this.showCloseButton, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline, value: this.value ? this.toDate(this.value) : undefined, nextMonthButtonContent: this.nextMonthButtonContent, nextYearButtonContent: this.nextYearButtonContent, previousMonthButtonContent: this.previousMonthButtonContent, previousYearButtonContent: this.previousYearButtonContent, todayButtonContent: this.todayButtonContent, clearButtonContent: this.clearButtonContent, closeButtonContent: this.closeButtonContent }, index.h("div", { key: '4a89d517cfcf22cffccecddca841102cb913a8fb', slot: "after-calendar", class: this.getClassName("time-section") }, index.h("hr", { key: '72d37f7058959877afa16b8336f834cc0e5aceba', class: this.getClassName("divider") }), index.h("tabworthy-times-picker", { key: 'bdba34da5c2a2a0af681e40516b0d48e8833e276', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState || this.isDateOutOfBounds(), onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels, minTime: this.getEffectiveMinTime(), maxTime: this.getEffectiveMaxTime(), ref: (el) => (this.timePickerRef = el) })))), this.timeOnly && (index.h("div", { key: '50a2866b8e7a408f72d37ee540ecba546103d4f4', class: this.getClassName("time-section") }, index.h("tabworthy-times-picker", { key: 'de317aaa6579be60679cba468e5b28be8654aa5d', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState || this.isDateOutOfBounds(), onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels, minTime: this.getEffectiveMinTime(), maxTime: this.getEffectiveMaxTime(), ref: (el) => (this.timePickerRef = el) }))))), this.errorState && (index.h("div", { key: '7617cfa25799dbbb8056abcba161284745022f44', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
513
+ }, inline: this.inline, appendTo: this.appendTo }, index.h("div", { key: '1bc48335f50777efd746a2737ac6acc60a72dec3', class: this.getClassName("picker-container") }, !this.timeOnly && (index.h("tabworthy-dates-calendar", { key: 'd0bdb6e18676f0019be5fd939a19075927b10fa4', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), onRequestClose: () => { var _a; return (_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.close(); }, labels: this.datesCalendarLabels, ref: (el) => (this.pickerRef = el), startDate: this.startDate, firstDayOfWeek: this.firstDayOfWeek, showHiddenTitle: true, disabled: this.disabledState, showMonthStepper: this.showMonthStepper, showYearStepper: this.showYearStepper, showClearButton: this.showClearButton, showCloseButton: this.showCloseButton, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline, value: this.value ? this.toDate(this.value) : undefined, nextMonthButtonContent: this.nextMonthButtonContent, nextYearButtonContent: this.nextYearButtonContent, previousMonthButtonContent: this.previousMonthButtonContent, previousYearButtonContent: this.previousYearButtonContent, todayButtonContent: this.todayButtonContent, clearButtonContent: this.clearButtonContent, closeButtonContent: this.closeButtonContent }, index.h("div", { key: '042f5fa7e60b67858ea7f92ca80792953b38d0a1', slot: "after-calendar", class: this.getClassName("time-section") }, index.h("hr", { key: '7262873201e1294e6116fea1f429c71e37bf06c2', class: this.getClassName("divider") }), index.h("tabworthy-times-picker", { key: '46a179fd9ce95d53e144d0b03a77311e4daa3c10', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState || this.isDateOutOfBounds(), onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels, minTime: this.getEffectiveMinTime(), maxTime: this.getEffectiveMaxTime(), ref: (el) => (this.timePickerRef = el) })))), this.timeOnly && (index.h("div", { key: 'eaedaf5a7157dbdc99a947b6eb3e55f696556371', class: this.getClassName("time-section") }, index.h("tabworthy-times-picker", { key: '504ea7e3069134e695d09ef48834b947de629b5e', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState || this.isDateOutOfBounds(), onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels, minTime: this.getEffectiveMinTime(), maxTime: this.getEffectiveMaxTime(), ref: (el) => (this.timePickerRef = el) }))))), this.errorState && (index.h("div", { key: '961823a7550b5439d2768f80317422b057758de3', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
514
514
  }
515
515
  get el() { return index.getElement(this); }
516
516
  static get watchers() { return {
@@ -89,7 +89,7 @@ export class TabworthyDates {
89
89
  await customElements.whenDefined("tabworthy-dates-modal");
90
90
  // Use input container as trigger for proper dropdown alignment
91
91
  this.inputContainerRef &&
92
- (await ((_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.setTriggerElement(this.inputContainerRef)));
92
+ (await ((_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.setTriggerElement(this.inputContainerRef, this.calendarButtonRef)));
93
93
  if ((await ((_b = this.modalRef) === null || _b === void 0 ? void 0 : _b.getState())) === false)
94
94
  await ((_c = this.modalRef) === null || _c === void 0 ? void 0 : _c.open());
95
95
  else if ((await ((_d = this.modalRef) === null || _d === void 0 ? void 0 : _d.getState())) === true)
@@ -533,7 +533,7 @@ export class TabworthyDates {
533
533
  return (h(Host, null, h("label", { htmlFor: this.id ? `${this.id}-input` : undefined, class: this.getClassName("label") }, this.label), h("br", null), h("div", { class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, h("input", { disabled: this.disabledState || this.disableFreeformInput, id: this.id ? `${this.id}-input` : undefined, type: "text", placeholder: this.placeholder, class: {
534
534
  [this.getClassName("input")]: true,
535
535
  [this.inputClass]: !!this.inputClass
536
- }, ref: (r) => (this.inputRef = r), onChange: this.handleChange, onFocus: () => this.formatInput(false), onBlur: () => this.formatInput(true, false), "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (h("button", { type: "button", onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState, "aria-label": this.calendarButtonContent
536
+ }, ref: (r) => (this.inputRef = r), onChange: this.handleChange, onFocus: () => this.formatInput(false), onBlur: () => this.formatInput(true, false), "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (h("button", { type: "button", ref: (r) => (this.calendarButtonRef = r), onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState, "aria-label": this.calendarButtonContent
537
537
  ? this.datesLabels.openCalendar
538
538
  : undefined }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.datesLabels.openCalendar)))), h("tabworthy-dates-modal", { label: this.datesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
539
539
  if (!this.pickerRef)
@@ -148,14 +148,18 @@ export class TabworthyDatesModal {
148
148
  * Close the dialog.
149
149
  */
150
150
  async close() {
151
- var _a;
151
+ var _a, _b;
152
152
  if (this.inline)
153
153
  return;
154
+ const activeElement = document.activeElement;
155
+ const focusMovedOutside = !!activeElement &&
156
+ activeElement !== document.body &&
157
+ !this.hostElement.contains(activeElement);
154
158
  this.showing = false;
155
159
  this.closed.emit(undefined);
156
160
  (_a = this.undo) === null || _a === void 0 ? void 0 : _a.call(this);
157
- if (this.triggerElement)
158
- this.triggerElement.focus();
161
+ if (!focusMovedOutside)
162
+ (_b = this.focusReturnElement) === null || _b === void 0 ? void 0 : _b.focus();
159
163
  }
160
164
  disconnectedCallback() {
161
165
  // Skip cleanup if we're in the middle of portal operations
@@ -167,8 +171,9 @@ export class TabworthyDatesModal {
167
171
  async getState() {
168
172
  return this.showing;
169
173
  }
170
- async setTriggerElement(element) {
174
+ async setTriggerElement(element, focusElement = element) {
171
175
  this.triggerElement = element;
176
+ this.focusReturnElement = focusElement;
172
177
  }
173
178
  /** Force update the popper position */
174
179
  async updatePosition() {
@@ -190,7 +195,7 @@ export class TabworthyDatesModal {
190
195
  }
191
196
  }
192
197
  render() {
193
- return (h(Host, { key: '2c9c3ade4eb4964dbb5ba86bd196240851dbb996', showing: this.showing, ref: (r) => r && (this.el = r) }, !this.inline && this.showing && (h("div", { key: '961c2d9e34d7ddadb512f8652f14ed4ed4ec6ce5', part: "body", ref: (r) => {
198
+ return (h(Host, { key: '8f2128e3b9ed31547aaa4a1eb1f9fe1c2c554834', showing: this.showing, ref: (r) => r && (this.el = r) }, !this.inline && this.showing && (h("div", { key: 'd3c8a2b9d11bdd1147ded6256417c0bdda9274b5', part: "body", ref: (r) => {
194
199
  if (r) {
195
200
  this.bodyRef = r;
196
201
  // Setup portal and create popper when ref is set
@@ -207,7 +212,7 @@ export class TabworthyDatesModal {
207
212
  });
208
213
  }
209
214
  }
210
- }, style: { visibility: this.positioned ? "visible" : "hidden" }, onKeyDown: this.onKeyDown, role: "dialog", tabindex: -1, "aria-hidden": !this.showing, "aria-label": this.label, "aria-modal": this.showing }, h("focus-trap", { key: '719a3e82aab59326d1aa069b237d158d2311cd62' }, h("div", { key: 'b33e1aabdb7477409d97f757bf7121697979d50c', part: "content" }, h("slot", { key: 'c7e85552f37b930e298484c0040c138fdccb8ea7' }))))), this.inline && (h("div", { key: '59e0333fb0e980c17e0a1da041e6bc492d025bd8', part: "content" }, h("slot", { key: 'd52759f124c038fbde4b510ae1df8c3a1bdad25e' })))));
215
+ }, style: { visibility: this.positioned ? "visible" : "hidden" }, onKeyDown: this.onKeyDown, role: "dialog", tabindex: -1, "aria-hidden": !this.showing, "aria-label": this.label, "aria-modal": this.showing }, h("focus-trap", { key: '3c36e0e81b87ef9364ff8288e200c4462626bfea' }, h("div", { key: '111ba3d8fea2f0f4afdb63506fa43d1b8467c14d', part: "content" }, h("slot", { key: '6ec34c827f3c4cf1a5f30d9e571826f73cc66157' }))))), this.inline && (h("div", { key: '49970743a4f726fd02b18ba485ba0753acc4d0ec', part: "content" }, h("slot", { key: '6d0e2cd6bdc51f63fbab138c93f9c99cc3b1291d' })))));
211
216
  }
212
217
  static get is() { return "tabworthy-dates-modal"; }
213
218
  static get encapsulation() { return "shadow"; }
@@ -428,11 +433,15 @@ export class TabworthyDatesModal {
428
433
  },
429
434
  "setTriggerElement": {
430
435
  "complexType": {
431
- "signature": "(element: HTMLElement) => Promise<void>",
436
+ "signature": "(element: HTMLElement, focusElement?: HTMLElement) => Promise<void>",
432
437
  "parameters": [{
433
438
  "name": "element",
434
439
  "type": "HTMLElement",
435
440
  "docs": ""
441
+ }, {
442
+ "name": "focusElement",
443
+ "type": "HTMLElement",
444
+ "docs": ""
436
445
  }],
437
446
  "references": {
438
447
  "Promise": {
@@ -122,7 +122,7 @@ export class TabworthyTimes {
122
122
  this.handleCalendarButtonClick = async () => {
123
123
  if (this.modalRef) {
124
124
  // Use input container as trigger for proper dropdown alignment
125
- await this.modalRef.setTriggerElement(this.inputContainerRef);
125
+ await this.modalRef.setTriggerElement(this.inputContainerRef, this.calendarButtonRef);
126
126
  await this.modalRef.open();
127
127
  }
128
128
  };
@@ -468,12 +468,12 @@ export class TabworthyTimes {
468
468
  }
469
469
  render() {
470
470
  var _a;
471
- return (h(Host, { key: '40aebf1f077c4766cbbb9bd3929f5d8d959b60a4', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState, "time-only": this.timeOnly }, h("label", { key: 'cbf04161329d320ebc9ae5b3a0fede08e3157afb', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), h("div", { key: '2e7e46172b8d46b2f88047d93f9e4d35e5c841f3', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, h("input", { key: '0fcf906d8bad7fe78e003bf881a6d22dcb42f4e8', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
471
+ return (h(Host, { key: 'eb40f4186e17019d6c0e7f59cd6c34ee65550fd8', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState, "time-only": this.timeOnly }, h("label", { key: '6d1f0deae328d66331350247da217c428910ddfb', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), h("div", { key: 'd7721562f0eeb5be4f6b68ff8e1c01c4ed08fe1b', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, h("input", { key: '1e4b4bd45f63aa5357505f58edde39739a51a124', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
472
472
  [this.getClassName("input")]: true,
473
473
  [this.inputClass]: !!this.inputClass
474
- }, placeholder: this.placeholder, disabled: this.disabledState || this.disableFreeformInput, value: (_a = this.internalValue) === null || _a === void 0 ? void 0 : _a.toString(), onBlur: this.handleInputBlur, onChange: this.handleInputChange, "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (h("button", { key: '7d63c31494474844633f64faf0aba4851574dce6', type: "button", onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState, "aria-label": this.calendarButtonContent
474
+ }, placeholder: this.placeholder, disabled: this.disabledState || this.disableFreeformInput, value: (_a = this.internalValue) === null || _a === void 0 ? void 0 : _a.toString(), onBlur: this.handleInputBlur, onChange: this.handleInputChange, "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (h("button", { key: 'c5789e7d45619291c38895ba184c6ec74d73c584', type: "button", ref: (r) => (this.calendarButtonRef = r), onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState, "aria-label": this.calendarButtonContent
475
475
  ? this.timesLabels.openCalendar
476
- : undefined }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: '802a7f839dd33d19885918819ae4a3fa9f6cb838', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
476
+ : undefined }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: 'af58b555642816b299cf50394148ed17c427db21', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
477
477
  if (this.pickerRef) {
478
478
  this.pickerRef.modalIsOpen = true;
479
479
  }
@@ -487,7 +487,7 @@ export class TabworthyTimes {
487
487
  if (this.timePickerRef) {
488
488
  this.timePickerRef.modalIsOpen = false;
489
489
  }
490
- }, inline: this.inline, appendTo: this.appendTo }, h("div", { key: '2ff172c30561b5962400dc2fa052162e01013c7a', class: this.getClassName("picker-container") }, !this.timeOnly && (h("tabworthy-dates-calendar", { key: '6456181b374cae4d91c01b9b7873c91bb08a8778', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), onRequestClose: () => { var _a; return (_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.close(); }, labels: this.datesCalendarLabels, ref: (el) => (this.pickerRef = el), startDate: this.startDate, firstDayOfWeek: this.firstDayOfWeek, showHiddenTitle: true, disabled: this.disabledState, showMonthStepper: this.showMonthStepper, showYearStepper: this.showYearStepper, showClearButton: this.showClearButton, showCloseButton: this.showCloseButton, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline, value: this.value ? this.toDate(this.value) : undefined, nextMonthButtonContent: this.nextMonthButtonContent, nextYearButtonContent: this.nextYearButtonContent, previousMonthButtonContent: this.previousMonthButtonContent, previousYearButtonContent: this.previousYearButtonContent, todayButtonContent: this.todayButtonContent, clearButtonContent: this.clearButtonContent, closeButtonContent: this.closeButtonContent }, h("div", { key: '4a89d517cfcf22cffccecddca841102cb913a8fb', slot: "after-calendar", class: this.getClassName("time-section") }, h("hr", { key: '72d37f7058959877afa16b8336f834cc0e5aceba', class: this.getClassName("divider") }), h("tabworthy-times-picker", { key: 'bdba34da5c2a2a0af681e40516b0d48e8833e276', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState || this.isDateOutOfBounds(), onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels, minTime: this.getEffectiveMinTime(), maxTime: this.getEffectiveMaxTime(), ref: (el) => (this.timePickerRef = el) })))), this.timeOnly && (h("div", { key: '50a2866b8e7a408f72d37ee540ecba546103d4f4', class: this.getClassName("time-section") }, h("tabworthy-times-picker", { key: 'de317aaa6579be60679cba468e5b28be8654aa5d', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState || this.isDateOutOfBounds(), onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels, minTime: this.getEffectiveMinTime(), maxTime: this.getEffectiveMaxTime(), ref: (el) => (this.timePickerRef = el) }))))), this.errorState && (h("div", { key: '7617cfa25799dbbb8056abcba161284745022f44', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
490
+ }, inline: this.inline, appendTo: this.appendTo }, h("div", { key: '1bc48335f50777efd746a2737ac6acc60a72dec3', class: this.getClassName("picker-container") }, !this.timeOnly && (h("tabworthy-dates-calendar", { key: 'd0bdb6e18676f0019be5fd939a19075927b10fa4', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), onRequestClose: () => { var _a; return (_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.close(); }, labels: this.datesCalendarLabels, ref: (el) => (this.pickerRef = el), startDate: this.startDate, firstDayOfWeek: this.firstDayOfWeek, showHiddenTitle: true, disabled: this.disabledState, showMonthStepper: this.showMonthStepper, showYearStepper: this.showYearStepper, showClearButton: this.showClearButton, showCloseButton: this.showCloseButton, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline, value: this.value ? this.toDate(this.value) : undefined, nextMonthButtonContent: this.nextMonthButtonContent, nextYearButtonContent: this.nextYearButtonContent, previousMonthButtonContent: this.previousMonthButtonContent, previousYearButtonContent: this.previousYearButtonContent, todayButtonContent: this.todayButtonContent, clearButtonContent: this.clearButtonContent, closeButtonContent: this.closeButtonContent }, h("div", { key: '042f5fa7e60b67858ea7f92ca80792953b38d0a1', slot: "after-calendar", class: this.getClassName("time-section") }, h("hr", { key: '7262873201e1294e6116fea1f429c71e37bf06c2', class: this.getClassName("divider") }), h("tabworthy-times-picker", { key: '46a179fd9ce95d53e144d0b03a77311e4daa3c10', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState || this.isDateOutOfBounds(), onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels, minTime: this.getEffectiveMinTime(), maxTime: this.getEffectiveMaxTime(), ref: (el) => (this.timePickerRef = el) })))), this.timeOnly && (h("div", { key: 'eaedaf5a7157dbdc99a947b6eb3e55f696556371', class: this.getClassName("time-section") }, h("tabworthy-times-picker", { key: '504ea7e3069134e695d09ef48834b947de629b5e', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState || this.isDateOutOfBounds(), onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels, minTime: this.getEffectiveMinTime(), maxTime: this.getEffectiveMaxTime(), ref: (el) => (this.timePickerRef = el) }))))), this.errorState && (h("div", { key: '961823a7550b5439d2768f80317422b057758de3', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
491
491
  }
492
492
  static get is() { return "tabworthy-times"; }
493
493
  static get encapsulation() { return "scoped"; }
@@ -1 +1 @@
1
- import{p as t,H as n,c as e,h as i,d as r,t as o}from"./p-BiJ0HZVY.js";function a(t,n,e,i=20,r=0){let o=[];if(r>=i)return o;const s=t=>{const o=t.assignedNodes().filter((t=>1===t.nodeType));return o.length>0?a(o[0].parentElement,n,e,i,r+1):[]},u=Array.from(t.children||[]);for(const t of u)n(t)||(e(t)&&o.push(t),null!=t.shadowRoot?o.push(...a(t.shadowRoot,n,e,i,r+1)):"SLOT"===t.tagName?o.push(...s(t)):o.push(...a(t,n,e,i,r+1)));return o}function s(t){return t.hasAttribute("hidden")||t.hasAttribute("aria-hidden")&&"false"!==t.getAttribute("aria-hidden")||"none"===t.style.display||"0"===t.style.opacity||"hidden"===t.style.visibility||"collapse"===t.style.visibility}function u(t){return"-1"!==t.getAttribute("tabindex")&&!s(t)&&!function(t){return t.hasAttribute("disabled")||t.hasAttribute("aria-disabled")&&"false"!==t.getAttribute("aria-disabled")}(t)&&(t.hasAttribute("tabindex")||(t instanceof HTMLAnchorElement||t instanceof HTMLAreaElement)&&t.hasAttribute("href")||t instanceof HTMLButtonElement||t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLIFrameElement)}const c=new Map,f=document.createElement("template");f.innerHTML='\n\t<div id="start"></div>\n\t<div id="backup"></div>\n\t<slot></slot>\n\t<div id="end"></div>\n';class d extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const t=this.attachShadow({mode:"open"});t.appendChild(f.content.cloneNode(!0)),this.$backup=t.querySelector("#backup"),this.$start=t.querySelector("#start"),this.$end=t.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(t){t?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return a(this,s,u)}trapFocus(t){if(this.inactive)return;let n=this.getFocusableElements();n.length>0?(t?n[n.length-1].focus():n[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(t){!function(t,n,e){const i=c.get(e);null!=i&&window.clearTimeout(i),c.set(e,window.setTimeout((()=>{t(),c.delete(e)}),0))}((()=>{this.focused!==t&&(this._focused=t,this.render())}),0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}window.customElements.define("focus-trap",d);var h=new WeakMap,l=new WeakMap,p={},v=0,b=function(t){return t&&(t.host||b(t.parentNode))},m=function(t,n,e){void 0===e&&(e="data-aria-hidden");var i=Array.from(Array.isArray(t)?t:[t]),r=function(t){return"undefined"==typeof document?null:(Array.isArray(t)?t[0]:t).ownerDocument.body}(t);return r?(i.push.apply(i,Array.from(r.querySelectorAll("[aria-live]"))),function(t,n,e,i){var r=function(t,n){return n.map((function(n){if(t.contains(n))return n;var e=b(n);return e&&t.contains(e)?e:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)})).filter((function(t){return Boolean(t)}))}(n,Array.isArray(t)?t:[t]);p[e]||(p[e]=new WeakMap);var o=p[e],a=[],s=new Set,u=new Set(r),c=function(t){t&&!s.has(t)&&(s.add(t),c(t.parentNode))};r.forEach(c);var f=function(t){t&&!u.has(t)&&Array.prototype.forEach.call(t.children,(function(t){if(s.has(t))f(t);else{var n=t.getAttribute(i),r=null!==n&&"false"!==n,u=(h.get(t)||0)+1,c=(o.get(t)||0)+1;h.set(t,u),o.set(t,c),a.push(t),1===u&&r&&l.set(t,!0),1===c&&t.setAttribute(e,"true"),r||t.setAttribute(i,"true")}}))};return f(n),s.clear(),v++,function(){a.forEach((function(t){var n=h.get(t)-1,r=o.get(t)-1;h.set(t,n),o.set(t,r),n||(l.has(t)||t.removeAttribute(i),l.delete(t)),r||t.removeAttribute(e)})),--v||(h=new WeakMap,h=new WeakMap,l=new WeakMap,p={})}}(i,r,e,"aria-hidden")):function(){return null}},y="top",w="bottom",g="right",x="left",O="auto",j=[y,w,g,x],k="start",M="end",E="viewport",A="popper",T=j.reduce((function(t,n){return t.concat([n+"-"+k,n+"-"+M])}),[]),S=[].concat(j,[O]).reduce((function(t,n){return t.concat([n,n+"-"+k,n+"-"+M])}),[]),L=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function P(t){return t?(t.nodeName||"").toLowerCase():null}function H(t){if(null==t)return window;if("[object Window]"!==t.toString()){var n=t.ownerDocument;return n&&n.defaultView||window}return t}function W(t){return t instanceof H(t).Element||t instanceof Element}function B(t){return t instanceof H(t).HTMLElement||t instanceof HTMLElement}function F(t){return"undefined"!=typeof ShadowRoot&&(t instanceof H(t).ShadowRoot||t instanceof ShadowRoot)}function q(t){return t.split("-")[0]}var C=Math.max,I=Math.min,R=Math.round;function z(){var t=navigator.userAgentData;return null!=t&&t.brands&&Array.isArray(t.brands)?t.brands.map((function(t){return t.brand+"/"+t.version})).join(" "):navigator.userAgent}function D(){return!/^((?!chrome|android).)*safari/i.test(z())}function V(t,n,e){void 0===n&&(n=!1),void 0===e&&(e=!1);var i=t.getBoundingClientRect(),r=1,o=1;n&&B(t)&&(r=t.offsetWidth>0&&R(i.width)/t.offsetWidth||1,o=t.offsetHeight>0&&R(i.height)/t.offsetHeight||1);var a=(W(t)?H(t):window).visualViewport,s=!D()&&e,u=(i.left+(s&&a?a.offsetLeft:0))/r,c=(i.top+(s&&a?a.offsetTop:0))/o,f=i.width/r,d=i.height/o;return{width:f,height:d,top:c,right:u+f,bottom:c+d,left:u,x:u,y:c}}function J(t){var n=V(t),e=t.offsetWidth,i=t.offsetHeight;return Math.abs(n.width-e)<=1&&(e=n.width),Math.abs(n.height-i)<=1&&(i=n.height),{x:t.offsetLeft,y:t.offsetTop,width:e,height:i}}function K(t,n){var e=n.getRootNode&&n.getRootNode();if(t.contains(n))return!0;if(e&&F(e)){var i=n;do{if(i&&t.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function U(t){return H(t).getComputedStyle(t)}function Y(t){return["table","td","th"].indexOf(P(t))>=0}function Z(t){return((W(t)?t.ownerDocument:t.document)||window.document).documentElement}function _(t){return"html"===P(t)?t:t.assignedSlot||t.parentNode||(F(t)?t.host:null)||Z(t)}function G(t){return B(t)&&"fixed"!==U(t).position?t.offsetParent:null}function N(t){for(var n=H(t),e=G(t);e&&Y(e)&&"static"===U(e).position;)e=G(e);return e&&("html"===P(e)||"body"===P(e)&&"static"===U(e).position)?n:e||function(t){var n=/firefox/i.test(z());if(/Trident/i.test(z())&&B(t)&&"fixed"===U(t).position)return null;var e=_(t);for(F(e)&&(e=e.host);B(e)&&["html","body"].indexOf(P(e))<0;){var i=U(e);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||n&&"filter"===i.willChange||n&&i.filter&&"none"!==i.filter)return e;e=e.parentNode}return null}(t)||n}function Q(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function X(t,n,e){return C(t,I(n,e))}function $(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function tt(t,n){return n.reduce((function(n,e){return n[e]=t,n}),{})}function nt(t){return t.split("-")[1]}var et={top:"auto",right:"auto",bottom:"auto",left:"auto"};function it(t){var n,e=t.popper,i=t.popperRect,r=t.placement,o=t.variation,a=t.offsets,s=t.position,u=t.gpuAcceleration,c=t.adaptive,f=t.roundOffsets,d=t.isFixed,h=a.x,l=void 0===h?0:h,p=a.y,v=void 0===p?0:p,b="function"==typeof f?f({x:l,y:v}):{x:l,y:v};l=b.x,v=b.y;var m=a.hasOwnProperty("x"),O=a.hasOwnProperty("y"),j=x,k=y,E=window;if(c){var A=N(e),T="clientHeight",S="clientWidth";A===H(e)&&"static"!==U(A=Z(e)).position&&"absolute"===s&&(T="scrollHeight",S="scrollWidth"),(r===y||(r===x||r===g)&&o===M)&&(k=w,v-=(d&&A===E&&E.visualViewport?E.visualViewport.height:A[T])-i.height,v*=u?1:-1),r!==x&&(r!==y&&r!==w||o!==M)||(j=g,l-=(d&&A===E&&E.visualViewport?E.visualViewport.width:A[S])-i.width,l*=u?1:-1)}var L,P=Object.assign({position:s},c&&et),W=!0===f?function(t,n){var e=t.y,i=n.devicePixelRatio||1;return{x:R(t.x*i)/i||0,y:R(e*i)/i||0}}({x:l,y:v},H(e)):{x:l,y:v};return l=W.x,v=W.y,Object.assign({},P,u?((L={})[k]=O?"0":"",L[j]=m?"0":"",L.transform=(E.devicePixelRatio||1)<=1?"translate("+l+"px, "+v+"px)":"translate3d("+l+"px, "+v+"px, 0)",L):((n={})[k]=O?v+"px":"",n[j]=m?l+"px":"",n.transform="",n))}var rt={passive:!0},ot={left:"right",right:"left",bottom:"top",top:"bottom"};function at(t){return t.replace(/left|right|bottom|top/g,(function(t){return ot[t]}))}var st={start:"end",end:"start"};function ut(t){return t.replace(/start|end/g,(function(t){return st[t]}))}function ct(t){var n=H(t);return{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function ft(t){return V(Z(t)).left+ct(t).scrollLeft}function dt(t){var n=U(t);return/auto|scroll|overlay|hidden/.test(n.overflow+n.overflowY+n.overflowX)}function ht(t){return["html","body","#document"].indexOf(P(t))>=0?t.ownerDocument.body:B(t)&&dt(t)?t:ht(_(t))}function lt(t,n){var e;void 0===n&&(n=[]);var i=ht(t),r=i===(null==(e=t.ownerDocument)?void 0:e.body),o=H(i),a=r?[o].concat(o.visualViewport||[],dt(i)?i:[]):i,s=n.concat(a);return r?s:s.concat(lt(_(a)))}function pt(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function vt(t,n,e){return n===E?pt(function(t,n){var e=H(t),i=Z(t),r=e.visualViewport,o=i.clientWidth,a=i.clientHeight,s=0,u=0;if(r){o=r.width,a=r.height;var c=D();(c||!c&&"fixed"===n)&&(s=r.offsetLeft,u=r.offsetTop)}return{width:o,height:a,x:s+ft(t),y:u}}(t,e)):W(n)?function(t,n){var e=V(t,!1,"fixed"===n);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}(n,e):pt(function(t){var n,e=Z(t),i=ct(t),r=null==(n=t.ownerDocument)?void 0:n.body,o=C(e.scrollWidth,e.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),a=C(e.scrollHeight,e.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),s=-i.scrollLeft+ft(t),u=-i.scrollTop;return"rtl"===U(r||e).direction&&(s+=C(e.clientWidth,r?r.clientWidth:0)-o),{width:o,height:a,x:s,y:u}}(Z(t)))}function bt(t){var n,e=t.reference,i=t.element,r=t.placement,o=r?q(r):null,a=r?nt(r):null,s=e.x+e.width/2-i.width/2,u=e.y+e.height/2-i.height/2;switch(o){case y:n={x:s,y:e.y-i.height};break;case w:n={x:s,y:e.y+e.height};break;case g:n={x:e.x+e.width,y:u};break;case x:n={x:e.x-i.width,y:u};break;default:n={x:e.x,y:e.y}}var c=o?Q(o):null;if(null!=c){var f="y"===c?"height":"width";switch(a){case k:n[c]=n[c]-(e[f]/2-i[f]/2);break;case M:n[c]=n[c]+(e[f]/2-i[f]/2)}}return n}function mt(t,n){void 0===n&&(n={});var e=n.placement,i=void 0===e?t.placement:e,r=n.strategy,o=void 0===r?t.strategy:r,a=n.boundary,s=void 0===a?"clippingParents":a,u=n.rootBoundary,c=void 0===u?E:u,f=n.elementContext,d=void 0===f?A:f,h=n.altBoundary,l=void 0!==h&&h,p=n.padding,v=void 0===p?0:p,b=$("number"!=typeof v?v:tt(v,j)),m=t.rects.popper,x=t.elements[l?d===A?"reference":A:d],O=function(t,n,e,i){var r="clippingParents"===n?function(t){var n=lt(_(t)),e=["absolute","fixed"].indexOf(U(t).position)>=0&&B(t)?N(t):t;return W(e)?n.filter((function(t){return W(t)&&K(t,e)&&"body"!==P(t)})):[]}(t):[].concat(n),o=[].concat(r,[e]),a=o.reduce((function(n,e){var r=vt(t,e,i);return n.top=C(r.top,n.top),n.right=I(r.right,n.right),n.bottom=I(r.bottom,n.bottom),n.left=C(r.left,n.left),n}),vt(t,o[0],i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}(W(x)?x:x.contextElement||Z(t.elements.popper),s,c,o),k=V(t.elements.reference),M=bt({reference:k,element:m,placement:i}),T=pt(Object.assign({},m,M)),S=d===A?T:k,L={top:O.top-S.top+b.top,bottom:S.bottom-O.bottom+b.bottom,left:O.left-S.left+b.left,right:S.right-O.right+b.right},H=t.modifiersData.offset;if(d===A&&H){var F=H[i];Object.keys(L).forEach((function(t){var n=[g,w].indexOf(t)>=0?1:-1,e=[y,w].indexOf(t)>=0?"y":"x";L[t]+=F[e]*n}))}return L}function yt(t,n){void 0===n&&(n={});var e=n.boundary,i=n.rootBoundary,r=n.padding,o=n.flipVariations,a=n.allowedAutoPlacements,s=void 0===a?S:a,u=nt(n.placement),c=u?o?T:T.filter((function(t){return nt(t)===u})):j,f=c.filter((function(t){return s.indexOf(t)>=0}));0===f.length&&(f=c);var d=f.reduce((function(n,o){return n[o]=mt(t,{placement:o,boundary:e,rootBoundary:i,padding:r})[q(o)],n}),{});return Object.keys(d).sort((function(t,n){return d[t]-d[n]}))}var wt={name:"flip",enabled:!0,phase:"main",fn:function(t){var n=t.state,e=t.options,i=t.name;if(!n.modifiersData[i]._skip){for(var r=e.mainAxis,o=void 0===r||r,a=e.altAxis,s=void 0===a||a,u=e.fallbackPlacements,c=e.padding,f=e.boundary,d=e.rootBoundary,h=e.altBoundary,l=e.flipVariations,p=void 0===l||l,v=e.allowedAutoPlacements,b=n.options.placement,m=q(b),j=u||(m!==b&&p?function(t){if(q(t)===O)return[];var n=at(t);return[ut(t),n,ut(n)]}(b):[at(b)]),M=[b].concat(j).reduce((function(t,e){return t.concat(q(e)===O?yt(n,{placement:e,boundary:f,rootBoundary:d,padding:c,flipVariations:p,allowedAutoPlacements:v}):e)}),[]),E=n.rects.reference,A=n.rects.popper,T=new Map,S=!0,L=M[0],P=0;P<M.length;P++){var H=M[P],W=q(H),B=nt(H)===k,F=[y,w].indexOf(W)>=0,C=F?"width":"height",I=mt(n,{placement:H,boundary:f,rootBoundary:d,altBoundary:h,padding:c}),R=F?B?g:x:B?w:y;E[C]>A[C]&&(R=at(R));var z=at(R),D=[];if(o&&D.push(I[W]<=0),s&&D.push(I[R]<=0,I[z]<=0),D.every((function(t){return t}))){L=H,S=!1;break}T.set(H,D)}if(S)for(var V=function(t){var n=M.find((function(n){var e=T.get(n);if(e)return e.slice(0,t).every((function(t){return t}))}));if(n)return L=n,"break"},J=p?3:1;J>0&&"break"!==V(J);J--);n.placement!==L&&(n.modifiersData[i]._skip=!0,n.placement=L,n.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function gt(t,n,e){return void 0===e&&(e={x:0,y:0}),{top:t.top-n.height-e.y,right:t.right-n.width+e.x,bottom:t.bottom-n.height+e.y,left:t.left-n.width-e.x}}function xt(t){return[y,g,w,x].some((function(n){return t[n]>=0}))}function Ot(t,n,e){void 0===e&&(e=!1);var i,r,o=B(n),a=B(n)&&function(t){var n=t.getBoundingClientRect(),e=R(n.width)/t.offsetWidth||1,i=R(n.height)/t.offsetHeight||1;return 1!==e||1!==i}(n),s=Z(n),u=V(t,a,e),c={scrollLeft:0,scrollTop:0},f={x:0,y:0};return(o||!o&&!e)&&(("body"!==P(n)||dt(s))&&(c=(i=n)!==H(i)&&B(i)?{scrollLeft:(r=i).scrollLeft,scrollTop:r.scrollTop}:ct(i)),B(n)?((f=V(n,!0)).x+=n.clientLeft,f.y+=n.clientTop):s&&(f.x=ft(s))),{x:u.left+c.scrollLeft-f.x,y:u.top+c.scrollTop-f.y,width:u.width,height:u.height}}function jt(t){var n=new Map,e=new Set,i=[];function r(t){e.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!e.has(t)){var i=n.get(t);i&&r(i)}})),i.push(t)}return t.forEach((function(t){n.set(t.name,t)})),t.forEach((function(t){e.has(t.name)||r(t)})),i}var kt={placement:"bottom",modifiers:[],strategy:"absolute"};function Mt(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];return!n.some((function(t){return!(t&&"function"==typeof t.getBoundingClientRect)}))}function Et(t){void 0===t&&(t={});var n=t.defaultModifiers,e=void 0===n?[]:n,i=t.defaultOptions,r=void 0===i?kt:i;return function(t,n,i){void 0===i&&(i=r);var o,a,s={placement:"bottom",orderedModifiers:[],options:Object.assign({},kt,r),modifiersData:{},elements:{reference:t,popper:n},attributes:{},styles:{}},u=[],c=!1,f={state:s,setOptions:function(i){var o="function"==typeof i?i(s.options):i;d(),s.options=Object.assign({},r,s.options,o),s.scrollParents={reference:W(t)?lt(t):t.contextElement?lt(t.contextElement):[],popper:lt(n)};var a,c,h=function(t){var n=jt(t);return L.reduce((function(t,e){return t.concat(n.filter((function(t){return t.phase===e})))}),[])}((a=[].concat(e,s.options.modifiers),c=a.reduce((function(t,n){var e=t[n.name];return t[n.name]=e?Object.assign({},e,n,{options:Object.assign({},e.options,n.options),data:Object.assign({},e.data,n.data)}):n,t}),{}),Object.keys(c).map((function(t){return c[t]}))));return s.orderedModifiers=h.filter((function(t){return t.enabled})),s.orderedModifiers.forEach((function(t){var n=t.options,e=t.effect;if("function"==typeof e){var i=e({state:s,name:t.name,instance:f,options:void 0===n?{}:n});u.push(i||function(){})}})),f.update()},forceUpdate:function(){if(!c){var t=s.elements,n=t.reference,e=t.popper;if(Mt(n,e)){s.rects={reference:Ot(n,N(e),"fixed"===s.options.strategy),popper:J(e)},s.reset=!1,s.placement=s.options.placement,s.orderedModifiers.forEach((function(t){return s.modifiersData[t.name]=Object.assign({},t.data)}));for(var i=0;i<s.orderedModifiers.length;i++)if(!0!==s.reset){var r=s.orderedModifiers[i],o=r.fn,a=r.options;"function"==typeof o&&(s=o({state:s,options:void 0===a?{}:a,name:r.name,instance:f})||s)}else s.reset=!1,i=-1}}},update:(o=function(){return new Promise((function(t){f.forceUpdate(),t(s)}))},function(){return a||(a=new Promise((function(t){Promise.resolve().then((function(){a=void 0,t(o())}))}))),a}),destroy:function(){d(),c=!0}};if(!Mt(t,n))return f;function d(){u.forEach((function(t){return t()})),u=[]}return f.setOptions(i).then((function(t){!c&&i.onFirstUpdate&&i.onFirstUpdate(t)})),f}}var At=Et({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var n=t.state,e=t.instance,i=t.options,r=i.scroll,o=void 0===r||r,a=i.resize,s=void 0===a||a,u=H(n.elements.popper),c=[].concat(n.scrollParents.reference,n.scrollParents.popper);return o&&c.forEach((function(t){t.addEventListener("scroll",e.update,rt)})),s&&u.addEventListener("resize",e.update,rt),function(){o&&c.forEach((function(t){t.removeEventListener("scroll",e.update,rt)})),s&&u.removeEventListener("resize",e.update,rt)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var n=t.state;n.modifiersData[t.name]=bt({reference:n.rects.reference,element:n.rects.popper,placement:n.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var n=t.state,e=t.options,i=e.gpuAcceleration,r=void 0===i||i,o=e.adaptive,a=void 0===o||o,s=e.roundOffsets,u=void 0===s||s,c={placement:q(n.placement),variation:nt(n.placement),popper:n.elements.popper,popperRect:n.rects.popper,gpuAcceleration:r,isFixed:"fixed"===n.options.strategy};null!=n.modifiersData.popperOffsets&&(n.styles.popper=Object.assign({},n.styles.popper,it(Object.assign({},c,{offsets:n.modifiersData.popperOffsets,position:n.options.strategy,adaptive:a,roundOffsets:u})))),null!=n.modifiersData.arrow&&(n.styles.arrow=Object.assign({},n.styles.arrow,it(Object.assign({},c,{offsets:n.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:u})))),n.attributes.popper=Object.assign({},n.attributes.popper,{"data-popper-placement":n.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var n=t.state;Object.keys(n.elements).forEach((function(t){var e=n.styles[t]||{},i=n.attributes[t]||{},r=n.elements[t];B(r)&&P(r)&&(Object.assign(r.style,e),Object.keys(i).forEach((function(t){var n=i[t];!1===n?r.removeAttribute(t):r.setAttribute(t,!0===n?"":n)})))}))},effect:function(t){var n=t.state,e={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(n.elements.popper.style,e.popper),n.styles=e,n.elements.arrow&&Object.assign(n.elements.arrow.style,e.arrow),function(){Object.keys(n.elements).forEach((function(t){var i=n.elements[t],r=n.attributes[t]||{},o=Object.keys(n.styles.hasOwnProperty(t)?n.styles[t]:e[t]).reduce((function(t,n){return t[n]="",t}),{});B(i)&&P(i)&&(Object.assign(i.style,o),Object.keys(r).forEach((function(t){i.removeAttribute(t)})))}))}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var n=t.state,e=t.name,i=t.options.offset,r=void 0===i?[0,0]:i,o=S.reduce((function(t,e){return t[e]=function(t,n,e){var i=q(t),r=[x,y].indexOf(i)>=0?-1:1,o="function"==typeof e?e(Object.assign({},n,{placement:t})):e,a=o[0],s=o[1];return a=a||0,s=(s||0)*r,[x,g].indexOf(i)>=0?{x:s,y:a}:{x:a,y:s}}(e,n.rects,r),t}),{}),a=o[n.placement],s=a.y;null!=n.modifiersData.popperOffsets&&(n.modifiersData.popperOffsets.x+=a.x,n.modifiersData.popperOffsets.y+=s),n.modifiersData[e]=o}},wt,{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var n=t.state,e=t.options,i=t.name,r=e.mainAxis,o=void 0===r||r,a=e.altAxis,s=void 0!==a&&a,u=e.tether,c=void 0===u||u,f=e.tetherOffset,d=void 0===f?0:f,h=mt(n,{boundary:e.boundary,rootBoundary:e.rootBoundary,padding:e.padding,altBoundary:e.altBoundary}),l=q(n.placement),p=nt(n.placement),v=!p,b=Q(l),m="x"===b?"y":"x",O=n.modifiersData.popperOffsets,j=n.rects.reference,M=n.rects.popper,E="function"==typeof d?d(Object.assign({},n.rects,{placement:n.placement})):d,A="number"==typeof E?{mainAxis:E,altAxis:E}:Object.assign({mainAxis:0,altAxis:0},E),T=n.modifiersData.offset?n.modifiersData.offset[n.placement]:null,S={x:0,y:0};if(O){if(o){var L,P="y"===b?y:x,H="y"===b?w:g,W="y"===b?"height":"width",B=O[b],F=B+h[P],R=B-h[H],z=c?-M[W]/2:0,D=p===k?j[W]:M[W],V=p===k?-M[W]:-j[W],K=n.elements.arrow,U=c&&K?J(K):{width:0,height:0},Y=n.modifiersData["arrow#persistent"]?n.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},Z=Y[P],_=Y[H],G=X(0,j[W],U[W]),$=v?j[W]/2-z-G-Z-A.mainAxis:D-G-Z-A.mainAxis,tt=v?-j[W]/2+z+G+_+A.mainAxis:V+G+_+A.mainAxis,et=n.elements.arrow&&N(n.elements.arrow),it=null!=(L=null==T?void 0:T[b])?L:0,rt=B+tt-it,ot=X(c?I(F,B+$-it-(et?"y"===b?et.clientTop||0:et.clientLeft||0:0)):F,B,c?C(R,rt):R);O[b]=ot,S[b]=ot-B}if(s){var at,st=O[m],ut="y"===m?"height":"width",ct=st+h["x"===b?y:x],ft=st-h["x"===b?w:g],dt=-1!==[y,x].indexOf(l),ht=null!=(at=null==T?void 0:T[m])?at:0,lt=dt?ct:st-j[ut]-M[ut]-ht+A.altAxis,pt=dt?st+j[ut]+M[ut]-ht-A.altAxis:ft,vt=c&&dt?function(t,n,e){var i=X(t,n,e);return i>e?e:i}(lt,st,pt):X(c?lt:ct,st,c?pt:ft);O[m]=vt,S[m]=vt-st}n.modifiersData[i]=S}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var n,e=t.state,i=t.name,r=t.options,o=e.elements.arrow,a=e.modifiersData.popperOffsets,s=q(e.placement),u=Q(s),c=[x,g].indexOf(s)>=0?"height":"width";if(o&&a){var f=function(t,n){return $("number"!=typeof(t="function"==typeof t?t(Object.assign({},n.rects,{placement:n.placement})):t)?t:tt(t,j))}(r.padding,e),d=J(o),h="y"===u?y:x,l="y"===u?w:g,p=e.rects.reference[c]+e.rects.reference[u]-a[u]-e.rects.popper[c],v=a[u]-e.rects.reference[u],b=N(o),m=b?"y"===u?b.clientHeight||0:b.clientWidth||0:0,O=m/2-d[c]/2+(p/2-v/2),k=X(f[h],O,m-d[c]-f[l]);e.modifiersData[i]=((n={})[u]=k,n.centerOffset=k-O,n)}},effect:function(t){var n=t.state,e=t.options.element,i=void 0===e?"[data-popper-arrow]":e;null!=i&&("string"!=typeof i||(i=n.elements.popper.querySelector(i)))&&K(n.elements.popper,i)&&(n.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var n=t.state,e=t.name,i=n.rects.reference,r=n.rects.popper,o=n.modifiersData.preventOverflow,a=mt(n,{elementContext:"reference"}),s=mt(n,{altBoundary:!0}),u=gt(a,i),c=gt(s,r,o),f=xt(u),d=xt(c);n.modifiersData[e]={referenceClippingOffsets:u,popperEscapeOffsets:c,isReferenceHidden:f,hasPopperEscaped:d},n.attributes.popper=Object.assign({},n.attributes.popper,{"data-popper-reference-hidden":f,"data-popper-escaped":d})}}]});const Tt=t(class extends n{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.opened=e(this,"opened",7),this.closed=e(this,"closed",7),this.inline=!1,this.placement="bottom-start",this.offset=[0,8],this.closing=!1,this.showing=this.inline||!1,this.positioned=!1,this.originalParent=null,this.originalNextSibling=null,this.isMovingPortal=!1,this.popperInstance=null,this.onKeyDown=t=>{"Escape"===t.code&&this.close()}}watchShowing(t){t||(this.destroyPopperInstance(),this.cleanupPortal()),this.positioned=!1}getAppendToElement(){return this.appendTo?"body"===this.appendTo?document.body:"string"==typeof this.appendTo?document.querySelector(this.appendTo):this.appendTo:null}setupPortal(){const t=this.getAppendToElement();t&&(this.originalParent=this.hostElement.parentElement,this.originalNextSibling=this.hostElement.nextSibling,this.isMovingPortal=!0,t.appendChild(this.hostElement),this.isMovingPortal=!1)}cleanupPortal(){this.isMovingPortal||this.originalParent&&(this.isMovingPortal=!0,this.originalNextSibling?this.originalParent.insertBefore(this.hostElement,this.originalNextSibling):this.originalParent.appendChild(this.hostElement),this.originalParent=null,this.originalNextSibling=null,this.isMovingPortal=!1)}createPopperInstance(){if(!this.triggerElement||!this.bodyRef)return;const t=!!this.appendTo,n=t?"viewport":"clippingParents";this.popperInstance=At(this.triggerElement,this.bodyRef,{placement:this.placement,strategy:t?"fixed":"absolute",modifiers:[{name:"offset",options:{offset:this.offset}},{name:"flip",options:{fallbackPlacements:["top-start","top-end","bottom-end"],boundary:n}},{name:"preventOverflow",options:{boundary:n,altAxis:!0,padding:8}},{name:"computeStyles",options:{gpuAcceleration:!0}},{name:"applyStyles",enabled:!0}]}),this.popperInstance.forceUpdate(),this.positioned=!0}destroyPopperInstance(){this.popperInstance&&(this.popperInstance.destroy(),this.popperInstance=null)}async open(){this.inline||(this.showing=!0,this.undo=m(this.el),this.opened.emit(void 0))}async close(){var t;this.inline||(this.showing=!1,this.closed.emit(void 0),null===(t=this.undo)||void 0===t||t.call(this),this.triggerElement&&this.triggerElement.focus())}disconnectedCallback(){this.isMovingPortal||(this.destroyPopperInstance(),this.cleanupPortal())}async getState(){return this.showing}async setTriggerElement(t){this.triggerElement=t}async updatePosition(){var t;await(null===(t=this.popperInstance)||void 0===t?void 0:t.update())}handleClick(t){var n;if(this.showing){const e=t.target;this.hostElement.contains(e)||(null===(n=this.triggerElement)||void 0===n?void 0:n.contains(e))||this.originalParent&&this.originalParent.contains(e)||this.close()}}render(){return i(r,{key:"2c9c3ade4eb4964dbb5ba86bd196240851dbb996",showing:this.showing,ref:t=>t&&(this.el=t)},!this.inline&&this.showing&&i("div",{key:"961c2d9e34d7ddadb512f8652f14ed4ed4ec6ce5",part:"body",ref:t=>{t&&(this.bodyRef=t,this.showing&&this.triggerElement&&!this.popperInstance&&(this.setupPortal(),requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.createPopperInstance()}))}))))},style:{visibility:this.positioned?"visible":"hidden"},onKeyDown:this.onKeyDown,role:"dialog",tabindex:-1,"aria-hidden":!this.showing,"aria-label":this.label,"aria-modal":this.showing},i("focus-trap",{key:"719a3e82aab59326d1aa069b237d158d2311cd62"},i("div",{key:"b33e1aabdb7477409d97f757bf7121697979d50c",part:"content"},i("slot",{key:"c7e85552f37b930e298484c0040c138fdccb8ea7"})))),this.inline&&i("div",{key:"59e0333fb0e980c17e0a1da041e6bc492d025bd8",part:"content"},i("slot",{key:"d52759f124c038fbde4b510ae1df8c3a1bdad25e"})))}get hostElement(){return this}static get watchers(){return{showing:[{watchShowing:0}]}}static get style(){return":host::part(body){position:absolute;top:0;left:0;width:-moz-fit-content;width:fit-content;z-index:1200}:host::part(backdrop){}:host::part(content){}"}},[257,"tabworthy-dates-modal",{label:[1],inline:[4],placement:[1],offset:[16],appendTo:[1,"append-to"],closing:[32],showing:[32],positioned:[32],open:[64],close:[64],getState:[64],setTriggerElement:[64],updatePosition:[64]},[[10,"click","handleClick"]],{showing:[{watchShowing:0}]}]);function St(){"undefined"!=typeof customElements&&["tabworthy-dates-modal"].forEach((t=>{"tabworthy-dates-modal"===t&&(customElements.get(o(t))||customElements.define(o(t),Tt))}))}export{Tt as T,St as d}
1
+ import{p as t,H as n,c as e,h as i,d as r,t as o}from"./p-BiJ0HZVY.js";function a(t,n,e,i=20,r=0){let o=[];if(r>=i)return o;const s=t=>{const o=t.assignedNodes().filter((t=>1===t.nodeType));return o.length>0?a(o[0].parentElement,n,e,i,r+1):[]},u=Array.from(t.children||[]);for(const t of u)n(t)||(e(t)&&o.push(t),null!=t.shadowRoot?o.push(...a(t.shadowRoot,n,e,i,r+1)):"SLOT"===t.tagName?o.push(...s(t)):o.push(...a(t,n,e,i,r+1)));return o}function s(t){return t.hasAttribute("hidden")||t.hasAttribute("aria-hidden")&&"false"!==t.getAttribute("aria-hidden")||"none"===t.style.display||"0"===t.style.opacity||"hidden"===t.style.visibility||"collapse"===t.style.visibility}function u(t){return"-1"!==t.getAttribute("tabindex")&&!s(t)&&!function(t){return t.hasAttribute("disabled")||t.hasAttribute("aria-disabled")&&"false"!==t.getAttribute("aria-disabled")}(t)&&(t.hasAttribute("tabindex")||(t instanceof HTMLAnchorElement||t instanceof HTMLAreaElement)&&t.hasAttribute("href")||t instanceof HTMLButtonElement||t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLIFrameElement)}const c=new Map,f=document.createElement("template");f.innerHTML='\n\t<div id="start"></div>\n\t<div id="backup"></div>\n\t<slot></slot>\n\t<div id="end"></div>\n';class d extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const t=this.attachShadow({mode:"open"});t.appendChild(f.content.cloneNode(!0)),this.$backup=t.querySelector("#backup"),this.$start=t.querySelector("#start"),this.$end=t.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(t){t?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return a(this,s,u)}trapFocus(t){if(this.inactive)return;let n=this.getFocusableElements();n.length>0?(t?n[n.length-1].focus():n[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(t){!function(t,n,e){const i=c.get(e);null!=i&&window.clearTimeout(i),c.set(e,window.setTimeout((()=>{t(),c.delete(e)}),0))}((()=>{this.focused!==t&&(this._focused=t,this.render())}),0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}window.customElements.define("focus-trap",d);var h=new WeakMap,l=new WeakMap,p={},v=0,b=function(t){return t&&(t.host||b(t.parentNode))},m=function(t,n,e){void 0===e&&(e="data-aria-hidden");var i=Array.from(Array.isArray(t)?t:[t]),r=function(t){return"undefined"==typeof document?null:(Array.isArray(t)?t[0]:t).ownerDocument.body}(t);return r?(i.push.apply(i,Array.from(r.querySelectorAll("[aria-live]"))),function(t,n,e,i){var r=function(t,n){return n.map((function(n){if(t.contains(n))return n;var e=b(n);return e&&t.contains(e)?e:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)})).filter((function(t){return Boolean(t)}))}(n,Array.isArray(t)?t:[t]);p[e]||(p[e]=new WeakMap);var o=p[e],a=[],s=new Set,u=new Set(r),c=function(t){t&&!s.has(t)&&(s.add(t),c(t.parentNode))};r.forEach(c);var f=function(t){t&&!u.has(t)&&Array.prototype.forEach.call(t.children,(function(t){if(s.has(t))f(t);else{var n=t.getAttribute(i),r=null!==n&&"false"!==n,u=(h.get(t)||0)+1,c=(o.get(t)||0)+1;h.set(t,u),o.set(t,c),a.push(t),1===u&&r&&l.set(t,!0),1===c&&t.setAttribute(e,"true"),r||t.setAttribute(i,"true")}}))};return f(n),s.clear(),v++,function(){a.forEach((function(t){var n=h.get(t)-1,r=o.get(t)-1;h.set(t,n),o.set(t,r),n||(l.has(t)||t.removeAttribute(i),l.delete(t)),r||t.removeAttribute(e)})),--v||(h=new WeakMap,h=new WeakMap,l=new WeakMap,p={})}}(i,r,e,"aria-hidden")):function(){return null}},y="top",w="bottom",g="right",x="left",O="auto",j=[y,w,g,x],k="start",M="end",E="viewport",A="popper",T=j.reduce((function(t,n){return t.concat([n+"-"+k,n+"-"+M])}),[]),S=[].concat(j,[O]).reduce((function(t,n){return t.concat([n,n+"-"+k,n+"-"+M])}),[]),L=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function P(t){return t?(t.nodeName||"").toLowerCase():null}function H(t){if(null==t)return window;if("[object Window]"!==t.toString()){var n=t.ownerDocument;return n&&n.defaultView||window}return t}function W(t){return t instanceof H(t).Element||t instanceof Element}function B(t){return t instanceof H(t).HTMLElement||t instanceof HTMLElement}function F(t){return"undefined"!=typeof ShadowRoot&&(t instanceof H(t).ShadowRoot||t instanceof ShadowRoot)}function q(t){return t.split("-")[0]}var C=Math.max,I=Math.min,R=Math.round;function z(){var t=navigator.userAgentData;return null!=t&&t.brands&&Array.isArray(t.brands)?t.brands.map((function(t){return t.brand+"/"+t.version})).join(" "):navigator.userAgent}function D(){return!/^((?!chrome|android).)*safari/i.test(z())}function V(t,n,e){void 0===n&&(n=!1),void 0===e&&(e=!1);var i=t.getBoundingClientRect(),r=1,o=1;n&&B(t)&&(r=t.offsetWidth>0&&R(i.width)/t.offsetWidth||1,o=t.offsetHeight>0&&R(i.height)/t.offsetHeight||1);var a=(W(t)?H(t):window).visualViewport,s=!D()&&e,u=(i.left+(s&&a?a.offsetLeft:0))/r,c=(i.top+(s&&a?a.offsetTop:0))/o,f=i.width/r,d=i.height/o;return{width:f,height:d,top:c,right:u+f,bottom:c+d,left:u,x:u,y:c}}function J(t){var n=V(t),e=t.offsetWidth,i=t.offsetHeight;return Math.abs(n.width-e)<=1&&(e=n.width),Math.abs(n.height-i)<=1&&(i=n.height),{x:t.offsetLeft,y:t.offsetTop,width:e,height:i}}function K(t,n){var e=n.getRootNode&&n.getRootNode();if(t.contains(n))return!0;if(e&&F(e)){var i=n;do{if(i&&t.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function U(t){return H(t).getComputedStyle(t)}function Y(t){return["table","td","th"].indexOf(P(t))>=0}function Z(t){return((W(t)?t.ownerDocument:t.document)||window.document).documentElement}function _(t){return"html"===P(t)?t:t.assignedSlot||t.parentNode||(F(t)?t.host:null)||Z(t)}function G(t){return B(t)&&"fixed"!==U(t).position?t.offsetParent:null}function N(t){for(var n=H(t),e=G(t);e&&Y(e)&&"static"===U(e).position;)e=G(e);return e&&("html"===P(e)||"body"===P(e)&&"static"===U(e).position)?n:e||function(t){var n=/firefox/i.test(z());if(/Trident/i.test(z())&&B(t)&&"fixed"===U(t).position)return null;var e=_(t);for(F(e)&&(e=e.host);B(e)&&["html","body"].indexOf(P(e))<0;){var i=U(e);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||n&&"filter"===i.willChange||n&&i.filter&&"none"!==i.filter)return e;e=e.parentNode}return null}(t)||n}function Q(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function X(t,n,e){return C(t,I(n,e))}function $(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function tt(t,n){return n.reduce((function(n,e){return n[e]=t,n}),{})}function nt(t){return t.split("-")[1]}var et={top:"auto",right:"auto",bottom:"auto",left:"auto"};function it(t){var n,e=t.popper,i=t.popperRect,r=t.placement,o=t.variation,a=t.offsets,s=t.position,u=t.gpuAcceleration,c=t.adaptive,f=t.roundOffsets,d=t.isFixed,h=a.x,l=void 0===h?0:h,p=a.y,v=void 0===p?0:p,b="function"==typeof f?f({x:l,y:v}):{x:l,y:v};l=b.x,v=b.y;var m=a.hasOwnProperty("x"),O=a.hasOwnProperty("y"),j=x,k=y,E=window;if(c){var A=N(e),T="clientHeight",S="clientWidth";A===H(e)&&"static"!==U(A=Z(e)).position&&"absolute"===s&&(T="scrollHeight",S="scrollWidth"),(r===y||(r===x||r===g)&&o===M)&&(k=w,v-=(d&&A===E&&E.visualViewport?E.visualViewport.height:A[T])-i.height,v*=u?1:-1),r!==x&&(r!==y&&r!==w||o!==M)||(j=g,l-=(d&&A===E&&E.visualViewport?E.visualViewport.width:A[S])-i.width,l*=u?1:-1)}var L,P=Object.assign({position:s},c&&et),W=!0===f?function(t,n){var e=t.y,i=n.devicePixelRatio||1;return{x:R(t.x*i)/i||0,y:R(e*i)/i||0}}({x:l,y:v},H(e)):{x:l,y:v};return l=W.x,v=W.y,Object.assign({},P,u?((L={})[k]=O?"0":"",L[j]=m?"0":"",L.transform=(E.devicePixelRatio||1)<=1?"translate("+l+"px, "+v+"px)":"translate3d("+l+"px, "+v+"px, 0)",L):((n={})[k]=O?v+"px":"",n[j]=m?l+"px":"",n.transform="",n))}var rt={passive:!0},ot={left:"right",right:"left",bottom:"top",top:"bottom"};function at(t){return t.replace(/left|right|bottom|top/g,(function(t){return ot[t]}))}var st={start:"end",end:"start"};function ut(t){return t.replace(/start|end/g,(function(t){return st[t]}))}function ct(t){var n=H(t);return{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function ft(t){return V(Z(t)).left+ct(t).scrollLeft}function dt(t){var n=U(t);return/auto|scroll|overlay|hidden/.test(n.overflow+n.overflowY+n.overflowX)}function ht(t){return["html","body","#document"].indexOf(P(t))>=0?t.ownerDocument.body:B(t)&&dt(t)?t:ht(_(t))}function lt(t,n){var e;void 0===n&&(n=[]);var i=ht(t),r=i===(null==(e=t.ownerDocument)?void 0:e.body),o=H(i),a=r?[o].concat(o.visualViewport||[],dt(i)?i:[]):i,s=n.concat(a);return r?s:s.concat(lt(_(a)))}function pt(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function vt(t,n,e){return n===E?pt(function(t,n){var e=H(t),i=Z(t),r=e.visualViewport,o=i.clientWidth,a=i.clientHeight,s=0,u=0;if(r){o=r.width,a=r.height;var c=D();(c||!c&&"fixed"===n)&&(s=r.offsetLeft,u=r.offsetTop)}return{width:o,height:a,x:s+ft(t),y:u}}(t,e)):W(n)?function(t,n){var e=V(t,!1,"fixed"===n);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}(n,e):pt(function(t){var n,e=Z(t),i=ct(t),r=null==(n=t.ownerDocument)?void 0:n.body,o=C(e.scrollWidth,e.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),a=C(e.scrollHeight,e.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),s=-i.scrollLeft+ft(t),u=-i.scrollTop;return"rtl"===U(r||e).direction&&(s+=C(e.clientWidth,r?r.clientWidth:0)-o),{width:o,height:a,x:s,y:u}}(Z(t)))}function bt(t){var n,e=t.reference,i=t.element,r=t.placement,o=r?q(r):null,a=r?nt(r):null,s=e.x+e.width/2-i.width/2,u=e.y+e.height/2-i.height/2;switch(o){case y:n={x:s,y:e.y-i.height};break;case w:n={x:s,y:e.y+e.height};break;case g:n={x:e.x+e.width,y:u};break;case x:n={x:e.x-i.width,y:u};break;default:n={x:e.x,y:e.y}}var c=o?Q(o):null;if(null!=c){var f="y"===c?"height":"width";switch(a){case k:n[c]=n[c]-(e[f]/2-i[f]/2);break;case M:n[c]=n[c]+(e[f]/2-i[f]/2)}}return n}function mt(t,n){void 0===n&&(n={});var e=n.placement,i=void 0===e?t.placement:e,r=n.strategy,o=void 0===r?t.strategy:r,a=n.boundary,s=void 0===a?"clippingParents":a,u=n.rootBoundary,c=void 0===u?E:u,f=n.elementContext,d=void 0===f?A:f,h=n.altBoundary,l=void 0!==h&&h,p=n.padding,v=void 0===p?0:p,b=$("number"!=typeof v?v:tt(v,j)),m=t.rects.popper,x=t.elements[l?d===A?"reference":A:d],O=function(t,n,e,i){var r="clippingParents"===n?function(t){var n=lt(_(t)),e=["absolute","fixed"].indexOf(U(t).position)>=0&&B(t)?N(t):t;return W(e)?n.filter((function(t){return W(t)&&K(t,e)&&"body"!==P(t)})):[]}(t):[].concat(n),o=[].concat(r,[e]),a=o.reduce((function(n,e){var r=vt(t,e,i);return n.top=C(r.top,n.top),n.right=I(r.right,n.right),n.bottom=I(r.bottom,n.bottom),n.left=C(r.left,n.left),n}),vt(t,o[0],i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}(W(x)?x:x.contextElement||Z(t.elements.popper),s,c,o),k=V(t.elements.reference),M=bt({reference:k,element:m,placement:i}),T=pt(Object.assign({},m,M)),S=d===A?T:k,L={top:O.top-S.top+b.top,bottom:S.bottom-O.bottom+b.bottom,left:O.left-S.left+b.left,right:S.right-O.right+b.right},H=t.modifiersData.offset;if(d===A&&H){var F=H[i];Object.keys(L).forEach((function(t){var n=[g,w].indexOf(t)>=0?1:-1,e=[y,w].indexOf(t)>=0?"y":"x";L[t]+=F[e]*n}))}return L}function yt(t,n){void 0===n&&(n={});var e=n.boundary,i=n.rootBoundary,r=n.padding,o=n.flipVariations,a=n.allowedAutoPlacements,s=void 0===a?S:a,u=nt(n.placement),c=u?o?T:T.filter((function(t){return nt(t)===u})):j,f=c.filter((function(t){return s.indexOf(t)>=0}));0===f.length&&(f=c);var d=f.reduce((function(n,o){return n[o]=mt(t,{placement:o,boundary:e,rootBoundary:i,padding:r})[q(o)],n}),{});return Object.keys(d).sort((function(t,n){return d[t]-d[n]}))}var wt={name:"flip",enabled:!0,phase:"main",fn:function(t){var n=t.state,e=t.options,i=t.name;if(!n.modifiersData[i]._skip){for(var r=e.mainAxis,o=void 0===r||r,a=e.altAxis,s=void 0===a||a,u=e.fallbackPlacements,c=e.padding,f=e.boundary,d=e.rootBoundary,h=e.altBoundary,l=e.flipVariations,p=void 0===l||l,v=e.allowedAutoPlacements,b=n.options.placement,m=q(b),j=u||(m!==b&&p?function(t){if(q(t)===O)return[];var n=at(t);return[ut(t),n,ut(n)]}(b):[at(b)]),M=[b].concat(j).reduce((function(t,e){return t.concat(q(e)===O?yt(n,{placement:e,boundary:f,rootBoundary:d,padding:c,flipVariations:p,allowedAutoPlacements:v}):e)}),[]),E=n.rects.reference,A=n.rects.popper,T=new Map,S=!0,L=M[0],P=0;P<M.length;P++){var H=M[P],W=q(H),B=nt(H)===k,F=[y,w].indexOf(W)>=0,C=F?"width":"height",I=mt(n,{placement:H,boundary:f,rootBoundary:d,altBoundary:h,padding:c}),R=F?B?g:x:B?w:y;E[C]>A[C]&&(R=at(R));var z=at(R),D=[];if(o&&D.push(I[W]<=0),s&&D.push(I[R]<=0,I[z]<=0),D.every((function(t){return t}))){L=H,S=!1;break}T.set(H,D)}if(S)for(var V=function(t){var n=M.find((function(n){var e=T.get(n);if(e)return e.slice(0,t).every((function(t){return t}))}));if(n)return L=n,"break"},J=p?3:1;J>0&&"break"!==V(J);J--);n.placement!==L&&(n.modifiersData[i]._skip=!0,n.placement=L,n.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function gt(t,n,e){return void 0===e&&(e={x:0,y:0}),{top:t.top-n.height-e.y,right:t.right-n.width+e.x,bottom:t.bottom-n.height+e.y,left:t.left-n.width-e.x}}function xt(t){return[y,g,w,x].some((function(n){return t[n]>=0}))}function Ot(t,n,e){void 0===e&&(e=!1);var i,r,o=B(n),a=B(n)&&function(t){var n=t.getBoundingClientRect(),e=R(n.width)/t.offsetWidth||1,i=R(n.height)/t.offsetHeight||1;return 1!==e||1!==i}(n),s=Z(n),u=V(t,a,e),c={scrollLeft:0,scrollTop:0},f={x:0,y:0};return(o||!o&&!e)&&(("body"!==P(n)||dt(s))&&(c=(i=n)!==H(i)&&B(i)?{scrollLeft:(r=i).scrollLeft,scrollTop:r.scrollTop}:ct(i)),B(n)?((f=V(n,!0)).x+=n.clientLeft,f.y+=n.clientTop):s&&(f.x=ft(s))),{x:u.left+c.scrollLeft-f.x,y:u.top+c.scrollTop-f.y,width:u.width,height:u.height}}function jt(t){var n=new Map,e=new Set,i=[];function r(t){e.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!e.has(t)){var i=n.get(t);i&&r(i)}})),i.push(t)}return t.forEach((function(t){n.set(t.name,t)})),t.forEach((function(t){e.has(t.name)||r(t)})),i}var kt={placement:"bottom",modifiers:[],strategy:"absolute"};function Mt(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];return!n.some((function(t){return!(t&&"function"==typeof t.getBoundingClientRect)}))}function Et(t){void 0===t&&(t={});var n=t.defaultModifiers,e=void 0===n?[]:n,i=t.defaultOptions,r=void 0===i?kt:i;return function(t,n,i){void 0===i&&(i=r);var o,a,s={placement:"bottom",orderedModifiers:[],options:Object.assign({},kt,r),modifiersData:{},elements:{reference:t,popper:n},attributes:{},styles:{}},u=[],c=!1,f={state:s,setOptions:function(i){var o="function"==typeof i?i(s.options):i;d(),s.options=Object.assign({},r,s.options,o),s.scrollParents={reference:W(t)?lt(t):t.contextElement?lt(t.contextElement):[],popper:lt(n)};var a,c,h=function(t){var n=jt(t);return L.reduce((function(t,e){return t.concat(n.filter((function(t){return t.phase===e})))}),[])}((a=[].concat(e,s.options.modifiers),c=a.reduce((function(t,n){var e=t[n.name];return t[n.name]=e?Object.assign({},e,n,{options:Object.assign({},e.options,n.options),data:Object.assign({},e.data,n.data)}):n,t}),{}),Object.keys(c).map((function(t){return c[t]}))));return s.orderedModifiers=h.filter((function(t){return t.enabled})),s.orderedModifiers.forEach((function(t){var n=t.options,e=t.effect;if("function"==typeof e){var i=e({state:s,name:t.name,instance:f,options:void 0===n?{}:n});u.push(i||function(){})}})),f.update()},forceUpdate:function(){if(!c){var t=s.elements,n=t.reference,e=t.popper;if(Mt(n,e)){s.rects={reference:Ot(n,N(e),"fixed"===s.options.strategy),popper:J(e)},s.reset=!1,s.placement=s.options.placement,s.orderedModifiers.forEach((function(t){return s.modifiersData[t.name]=Object.assign({},t.data)}));for(var i=0;i<s.orderedModifiers.length;i++)if(!0!==s.reset){var r=s.orderedModifiers[i],o=r.fn,a=r.options;"function"==typeof o&&(s=o({state:s,options:void 0===a?{}:a,name:r.name,instance:f})||s)}else s.reset=!1,i=-1}}},update:(o=function(){return new Promise((function(t){f.forceUpdate(),t(s)}))},function(){return a||(a=new Promise((function(t){Promise.resolve().then((function(){a=void 0,t(o())}))}))),a}),destroy:function(){d(),c=!0}};if(!Mt(t,n))return f;function d(){u.forEach((function(t){return t()})),u=[]}return f.setOptions(i).then((function(t){!c&&i.onFirstUpdate&&i.onFirstUpdate(t)})),f}}var At=Et({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var n=t.state,e=t.instance,i=t.options,r=i.scroll,o=void 0===r||r,a=i.resize,s=void 0===a||a,u=H(n.elements.popper),c=[].concat(n.scrollParents.reference,n.scrollParents.popper);return o&&c.forEach((function(t){t.addEventListener("scroll",e.update,rt)})),s&&u.addEventListener("resize",e.update,rt),function(){o&&c.forEach((function(t){t.removeEventListener("scroll",e.update,rt)})),s&&u.removeEventListener("resize",e.update,rt)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var n=t.state;n.modifiersData[t.name]=bt({reference:n.rects.reference,element:n.rects.popper,placement:n.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var n=t.state,e=t.options,i=e.gpuAcceleration,r=void 0===i||i,o=e.adaptive,a=void 0===o||o,s=e.roundOffsets,u=void 0===s||s,c={placement:q(n.placement),variation:nt(n.placement),popper:n.elements.popper,popperRect:n.rects.popper,gpuAcceleration:r,isFixed:"fixed"===n.options.strategy};null!=n.modifiersData.popperOffsets&&(n.styles.popper=Object.assign({},n.styles.popper,it(Object.assign({},c,{offsets:n.modifiersData.popperOffsets,position:n.options.strategy,adaptive:a,roundOffsets:u})))),null!=n.modifiersData.arrow&&(n.styles.arrow=Object.assign({},n.styles.arrow,it(Object.assign({},c,{offsets:n.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:u})))),n.attributes.popper=Object.assign({},n.attributes.popper,{"data-popper-placement":n.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var n=t.state;Object.keys(n.elements).forEach((function(t){var e=n.styles[t]||{},i=n.attributes[t]||{},r=n.elements[t];B(r)&&P(r)&&(Object.assign(r.style,e),Object.keys(i).forEach((function(t){var n=i[t];!1===n?r.removeAttribute(t):r.setAttribute(t,!0===n?"":n)})))}))},effect:function(t){var n=t.state,e={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(n.elements.popper.style,e.popper),n.styles=e,n.elements.arrow&&Object.assign(n.elements.arrow.style,e.arrow),function(){Object.keys(n.elements).forEach((function(t){var i=n.elements[t],r=n.attributes[t]||{},o=Object.keys(n.styles.hasOwnProperty(t)?n.styles[t]:e[t]).reduce((function(t,n){return t[n]="",t}),{});B(i)&&P(i)&&(Object.assign(i.style,o),Object.keys(r).forEach((function(t){i.removeAttribute(t)})))}))}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var n=t.state,e=t.name,i=t.options.offset,r=void 0===i?[0,0]:i,o=S.reduce((function(t,e){return t[e]=function(t,n,e){var i=q(t),r=[x,y].indexOf(i)>=0?-1:1,o="function"==typeof e?e(Object.assign({},n,{placement:t})):e,a=o[0],s=o[1];return a=a||0,s=(s||0)*r,[x,g].indexOf(i)>=0?{x:s,y:a}:{x:a,y:s}}(e,n.rects,r),t}),{}),a=o[n.placement],s=a.y;null!=n.modifiersData.popperOffsets&&(n.modifiersData.popperOffsets.x+=a.x,n.modifiersData.popperOffsets.y+=s),n.modifiersData[e]=o}},wt,{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var n=t.state,e=t.options,i=t.name,r=e.mainAxis,o=void 0===r||r,a=e.altAxis,s=void 0!==a&&a,u=e.tether,c=void 0===u||u,f=e.tetherOffset,d=void 0===f?0:f,h=mt(n,{boundary:e.boundary,rootBoundary:e.rootBoundary,padding:e.padding,altBoundary:e.altBoundary}),l=q(n.placement),p=nt(n.placement),v=!p,b=Q(l),m="x"===b?"y":"x",O=n.modifiersData.popperOffsets,j=n.rects.reference,M=n.rects.popper,E="function"==typeof d?d(Object.assign({},n.rects,{placement:n.placement})):d,A="number"==typeof E?{mainAxis:E,altAxis:E}:Object.assign({mainAxis:0,altAxis:0},E),T=n.modifiersData.offset?n.modifiersData.offset[n.placement]:null,S={x:0,y:0};if(O){if(o){var L,P="y"===b?y:x,H="y"===b?w:g,W="y"===b?"height":"width",B=O[b],F=B+h[P],R=B-h[H],z=c?-M[W]/2:0,D=p===k?j[W]:M[W],V=p===k?-M[W]:-j[W],K=n.elements.arrow,U=c&&K?J(K):{width:0,height:0},Y=n.modifiersData["arrow#persistent"]?n.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},Z=Y[P],_=Y[H],G=X(0,j[W],U[W]),$=v?j[W]/2-z-G-Z-A.mainAxis:D-G-Z-A.mainAxis,tt=v?-j[W]/2+z+G+_+A.mainAxis:V+G+_+A.mainAxis,et=n.elements.arrow&&N(n.elements.arrow),it=null!=(L=null==T?void 0:T[b])?L:0,rt=B+tt-it,ot=X(c?I(F,B+$-it-(et?"y"===b?et.clientTop||0:et.clientLeft||0:0)):F,B,c?C(R,rt):R);O[b]=ot,S[b]=ot-B}if(s){var at,st=O[m],ut="y"===m?"height":"width",ct=st+h["x"===b?y:x],ft=st-h["x"===b?w:g],dt=-1!==[y,x].indexOf(l),ht=null!=(at=null==T?void 0:T[m])?at:0,lt=dt?ct:st-j[ut]-M[ut]-ht+A.altAxis,pt=dt?st+j[ut]+M[ut]-ht-A.altAxis:ft,vt=c&&dt?function(t,n,e){var i=X(t,n,e);return i>e?e:i}(lt,st,pt):X(c?lt:ct,st,c?pt:ft);O[m]=vt,S[m]=vt-st}n.modifiersData[i]=S}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var n,e=t.state,i=t.name,r=t.options,o=e.elements.arrow,a=e.modifiersData.popperOffsets,s=q(e.placement),u=Q(s),c=[x,g].indexOf(s)>=0?"height":"width";if(o&&a){var f=function(t,n){return $("number"!=typeof(t="function"==typeof t?t(Object.assign({},n.rects,{placement:n.placement})):t)?t:tt(t,j))}(r.padding,e),d=J(o),h="y"===u?y:x,l="y"===u?w:g,p=e.rects.reference[c]+e.rects.reference[u]-a[u]-e.rects.popper[c],v=a[u]-e.rects.reference[u],b=N(o),m=b?"y"===u?b.clientHeight||0:b.clientWidth||0:0,O=m/2-d[c]/2+(p/2-v/2),k=X(f[h],O,m-d[c]-f[l]);e.modifiersData[i]=((n={})[u]=k,n.centerOffset=k-O,n)}},effect:function(t){var n=t.state,e=t.options.element,i=void 0===e?"[data-popper-arrow]":e;null!=i&&("string"!=typeof i||(i=n.elements.popper.querySelector(i)))&&K(n.elements.popper,i)&&(n.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var n=t.state,e=t.name,i=n.rects.reference,r=n.rects.popper,o=n.modifiersData.preventOverflow,a=mt(n,{elementContext:"reference"}),s=mt(n,{altBoundary:!0}),u=gt(a,i),c=gt(s,r,o),f=xt(u),d=xt(c);n.modifiersData[e]={referenceClippingOffsets:u,popperEscapeOffsets:c,isReferenceHidden:f,hasPopperEscaped:d},n.attributes.popper=Object.assign({},n.attributes.popper,{"data-popper-reference-hidden":f,"data-popper-escaped":d})}}]});const Tt=t(class extends n{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.opened=e(this,"opened",7),this.closed=e(this,"closed",7),this.inline=!1,this.placement="bottom-start",this.offset=[0,8],this.closing=!1,this.showing=this.inline||!1,this.positioned=!1,this.originalParent=null,this.originalNextSibling=null,this.isMovingPortal=!1,this.popperInstance=null,this.onKeyDown=t=>{"Escape"===t.code&&this.close()}}watchShowing(t){t||(this.destroyPopperInstance(),this.cleanupPortal()),this.positioned=!1}getAppendToElement(){return this.appendTo?"body"===this.appendTo?document.body:"string"==typeof this.appendTo?document.querySelector(this.appendTo):this.appendTo:null}setupPortal(){const t=this.getAppendToElement();t&&(this.originalParent=this.hostElement.parentElement,this.originalNextSibling=this.hostElement.nextSibling,this.isMovingPortal=!0,t.appendChild(this.hostElement),this.isMovingPortal=!1)}cleanupPortal(){this.isMovingPortal||this.originalParent&&(this.isMovingPortal=!0,this.originalNextSibling?this.originalParent.insertBefore(this.hostElement,this.originalNextSibling):this.originalParent.appendChild(this.hostElement),this.originalParent=null,this.originalNextSibling=null,this.isMovingPortal=!1)}createPopperInstance(){if(!this.triggerElement||!this.bodyRef)return;const t=!!this.appendTo,n=t?"viewport":"clippingParents";this.popperInstance=At(this.triggerElement,this.bodyRef,{placement:this.placement,strategy:t?"fixed":"absolute",modifiers:[{name:"offset",options:{offset:this.offset}},{name:"flip",options:{fallbackPlacements:["top-start","top-end","bottom-end"],boundary:n}},{name:"preventOverflow",options:{boundary:n,altAxis:!0,padding:8}},{name:"computeStyles",options:{gpuAcceleration:!0}},{name:"applyStyles",enabled:!0}]}),this.popperInstance.forceUpdate(),this.positioned=!0}destroyPopperInstance(){this.popperInstance&&(this.popperInstance.destroy(),this.popperInstance=null)}async open(){this.inline||(this.showing=!0,this.undo=m(this.el),this.opened.emit(void 0))}async close(){var t,n;if(this.inline)return;const e=document.activeElement,i=!!e&&e!==document.body&&!this.hostElement.contains(e);this.showing=!1,this.closed.emit(void 0),null===(t=this.undo)||void 0===t||t.call(this),i||null===(n=this.focusReturnElement)||void 0===n||n.focus()}disconnectedCallback(){this.isMovingPortal||(this.destroyPopperInstance(),this.cleanupPortal())}async getState(){return this.showing}async setTriggerElement(t,n=t){this.triggerElement=t,this.focusReturnElement=n}async updatePosition(){var t;await(null===(t=this.popperInstance)||void 0===t?void 0:t.update())}handleClick(t){var n;if(this.showing){const e=t.target;this.hostElement.contains(e)||(null===(n=this.triggerElement)||void 0===n?void 0:n.contains(e))||this.originalParent&&this.originalParent.contains(e)||this.close()}}render(){return i(r,{key:"8f2128e3b9ed31547aaa4a1eb1f9fe1c2c554834",showing:this.showing,ref:t=>t&&(this.el=t)},!this.inline&&this.showing&&i("div",{key:"d3c8a2b9d11bdd1147ded6256417c0bdda9274b5",part:"body",ref:t=>{t&&(this.bodyRef=t,this.showing&&this.triggerElement&&!this.popperInstance&&(this.setupPortal(),requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.createPopperInstance()}))}))))},style:{visibility:this.positioned?"visible":"hidden"},onKeyDown:this.onKeyDown,role:"dialog",tabindex:-1,"aria-hidden":!this.showing,"aria-label":this.label,"aria-modal":this.showing},i("focus-trap",{key:"3c36e0e81b87ef9364ff8288e200c4462626bfea"},i("div",{key:"111ba3d8fea2f0f4afdb63506fa43d1b8467c14d",part:"content"},i("slot",{key:"6ec34c827f3c4cf1a5f30d9e571826f73cc66157"})))),this.inline&&i("div",{key:"49970743a4f726fd02b18ba485ba0753acc4d0ec",part:"content"},i("slot",{key:"6d0e2cd6bdc51f63fbab138c93f9c99cc3b1291d"})))}get hostElement(){return this}static get watchers(){return{showing:[{watchShowing:0}]}}static get style(){return":host::part(body){position:absolute;top:0;left:0;width:-moz-fit-content;width:fit-content;z-index:1200}:host::part(backdrop){}:host::part(content){}"}},[257,"tabworthy-dates-modal",{label:[1],inline:[4],placement:[1],offset:[16],appendTo:[1,"append-to"],closing:[32],showing:[32],positioned:[32],open:[64],close:[64],getState:[64],setTriggerElement:[64],updatePosition:[64]},[[10,"click","handleClick"]],{showing:[{watchShowing:0}]}]);function St(){"undefined"!=typeof customElements&&["tabworthy-dates-modal"].forEach((t=>{"tabworthy-dates-modal"===t&&(customElements.get(o(t))||customElements.define(o(t),Tt))}))}export{Tt as T,St as d}
@@ -1 +1 @@
1
- import{T as o,d as s}from"./p-DXCumu2Y.js";const m=o,p=s;export{m as TabworthyDatesModal,p as defineCustomElement}
1
+ import{T as o,d as s}from"./p-Denq9zJN.js";const p=o,r=s;export{p as TabworthyDatesModal,r as defineCustomElement}