diff --git a/assets/components/combobox.ts b/assets/components/combobox.ts index b55561d3..3e8596f1 100644 --- a/assets/components/combobox.ts +++ b/assets/components/combobox.ts @@ -135,94 +135,234 @@ export class Combobox extends Component { return blocks; } - renderItems(): void { - const listEl = this.el.querySelector('[data-scope="combobox"][data-part="list"]'); - if (!listEl) return; + private isOwnedByList(listEl: HTMLElement, el: Element): boolean { + return el.closest('[data-scope="combobox"][data-part="list"]') === listEl; + } - const isOwnedByList = (el: Element) => - el.closest('[data-scope="combobox"][data-part="list"]') === listEl; + private listPartElements(listEl: HTMLElement, part: string): HTMLElement[] { + return Array.from( + listEl.querySelectorAll( + `[data-scope="combobox"][data-part="${part}"]:not([data-template])` + ) + ).filter((el) => this.isOwnedByList(listEl, el)); + } - const templatesRoot = templatesContentRoot(this.el, "combobox"); - if (!templatesRoot) return; + private directListPartElements(listEl: HTMLElement, part: string): HTMLElement[] { + return Array.from(listEl.children).filter( + (el): el is HTMLElement => + el instanceof HTMLElement && + el.getAttribute("data-scope") === "combobox" && + el.getAttribute("data-part") === part && + !el.hasAttribute("data-template") + ); + } - (["empty", "item-group", "item"] as const).forEach((part) => { - Array.from( - listEl.querySelectorAll( - `[data-scope="combobox"][data-part="${part}"]:not([data-template])` - ) - ) - .filter(isOwnedByList) - .forEach((el) => el.remove()); + private removeListParts(listEl: HTMLElement, parts: readonly string[]): void { + for (const part of parts) { + this.listPartElements(listEl, part).forEach((el) => el.remove()); + } + } + + private cloneItemFromTemplate( + templatesRoot: DocumentFragment | HTMLElement, + value: string + ): HTMLElement | null { + const template = templatesRoot.querySelector( + `:scope > [data-scope="combobox"][data-part="item"][data-value="${CSS.escape(value)}"][data-template]` + ); + if (!template) return null; + const itemEl = template.cloneNode(true) as HTMLElement; + itemEl.removeAttribute("data-template"); + return itemEl; + } + + private cloneGroupFromTemplate( + templatesRoot: DocumentFragment | HTMLElement, + groupId: string + ): HTMLElement | null { + const groupTemplate = templatesRoot.querySelector( + `[data-scope="combobox"][data-part="item-group"][data-id="${CSS.escape(groupId)}"][data-template]` + ); + if (!groupTemplate) return null; + const groupEl = groupTemplate.cloneNode(true) as HTMLElement; + groupEl.removeAttribute("data-template"); + groupEl + .querySelectorAll("[data-template]") + .forEach((e) => e.removeAttribute("data-template")); + return groupEl; + } + + private syncFlatItems( + listEl: HTMLElement, + templatesRoot: DocumentFragment | HTMLElement, + items: ComboboxItem[] + ): void { + const desiredValues = items.map((item) => this.getItemValue(item)); + const desiredSet = new Set(desiredValues); + + this.listPartElements(listEl, "item").forEach((itemEl) => { + const value = itemEl.dataset.value ?? ""; + if (!desiredSet.has(value)) itemEl.remove(); }); - const items = this.activeItems(); + const byValue = new Map(); + this.listPartElements(listEl, "item").forEach((itemEl) => { + byValue.set(itemEl.dataset.value ?? "", itemEl); + }); - if (items.length === 0) { - const emptyTemplate = templatesRoot.querySelector( - '[data-scope="combobox"][data-part="empty"][data-template]' - ); - if (emptyTemplate) { - const emptyEl = emptyTemplate.cloneNode(true) as HTMLElement; - emptyEl.removeAttribute("data-template"); - listEl.appendChild(emptyEl); + for (let index = 0; index < desiredValues.length; index += 1) { + const value = desiredValues[index]!; + let itemEl = byValue.get(value); + if (!itemEl) { + itemEl = this.cloneItemFromTemplate(templatesRoot, value) ?? undefined; + if (!itemEl) continue; + listEl.appendChild(itemEl); + byValue.set(value, itemEl); + } + const ref = listEl.children[index] ?? null; + if (listEl.children[index] !== itemEl) { + listEl.insertBefore(itemEl, ref); } - return; } - if (this.hasGroups) { - this.renderGroupedItems(listEl, templatesRoot, items); - } else { - this.renderFlatItems(listEl, templatesRoot, items); + while (listEl.children.length > desiredValues.length) { + listEl.lastElementChild?.remove(); } } - private renderGroupedItems( - listEl: HTMLElement, - templatesRoot: DocumentFragment | HTMLElement, - items: ComboboxItem[] + private syncGroupItems( + groupEl: HTMLElement, + blockItems: ComboboxItem[], + templatesRoot: DocumentFragment | HTMLElement ): void { - const blocks = this.buildOrderedBlocks(items); - - for (const block of blocks) { - if (block.type !== "group") continue; - - const groupTemplate = templatesRoot.querySelector( - `[data-scope="combobox"][data-part="item-group"][data-id="${CSS.escape(block.groupId)}"][data-template]` - ); - if (!groupTemplate) continue; - - const groupEl = groupTemplate.cloneNode(true) as HTMLElement; - groupEl.removeAttribute("data-template"); - groupEl - .querySelectorAll("[data-template]") - .forEach((e) => e.removeAttribute("data-template")); - - const keepValues = new Set(block.items.map((i) => this.getItemValue(i))); - groupEl - .querySelectorAll('[data-scope="combobox"][data-part="item"]') - .forEach((itemEl) => { - const v = itemEl.dataset.value ?? ""; - if (!keepValues.has(v)) itemEl.remove(); - }); - - listEl.appendChild(groupEl); + const ul = groupEl.querySelector("ul"); + if (!ul) return; + + const desiredValues = blockItems.map((item) => this.getItemValue(item)); + const desiredSet = new Set(desiredValues); + const groupId = groupEl.dataset.id ?? ""; + + Array.from( + ul.querySelectorAll( + '[data-scope="combobox"][data-part="item"]:not([data-template])' + ) + ).forEach((itemEl) => { + const value = itemEl.dataset.value ?? ""; + if (!desiredSet.has(value)) itemEl.remove(); + }); + + const byValue = new Map(); + Array.from(ul.children).forEach((child) => { + if (!(child instanceof HTMLElement)) return; + if (child.getAttribute("data-part") !== "item") return; + byValue.set(child.dataset.value ?? "", child); + }); + + for (let index = 0; index < desiredValues.length; index += 1) { + const value = desiredValues[index]!; + let itemEl = byValue.get(value); + if (!itemEl) { + const groupTemplate = templatesRoot.querySelector( + `[data-scope="combobox"][data-part="item-group"][data-id="${CSS.escape(groupId)}"][data-template]` + ); + const itemTemplate = groupTemplate?.querySelector( + `[data-scope="combobox"][data-part="item"][data-value="${CSS.escape(value)}"]` + ); + if (!itemTemplate) continue; + itemEl = itemTemplate.cloneNode(true) as HTMLElement; + itemEl.removeAttribute("data-template"); + ul.appendChild(itemEl); + byValue.set(value, itemEl); + } + const ref = ul.children[index] ?? null; + if (ul.children[index] !== itemEl) { + ul.insertBefore(itemEl, ref); + } + } + + while (ul.children.length > desiredValues.length) { + ul.lastElementChild?.remove(); } } - private renderFlatItems( + private syncGroupedItems( listEl: HTMLElement, templatesRoot: DocumentFragment | HTMLElement, items: ComboboxItem[] ): void { - for (const item of items) { - const value = this.getItemValue(item); - const template = templatesRoot.querySelector( - `:scope > [data-scope="combobox"][data-part="item"][data-value="${CSS.escape(value)}"][data-template]` - ); - if (!template) continue; - const itemEl = template.cloneNode(true) as HTMLElement; - itemEl.removeAttribute("data-template"); - listEl.appendChild(itemEl); + const blocks = this.buildOrderedBlocks(items).filter( + (block): block is { type: "group"; groupId: string; items: ComboboxItem[] } => + block.type === "group" + ); + const desiredGroupIds = new Set(blocks.map((block) => block.groupId)); + + this.listPartElements(listEl, "item-group").forEach((groupEl) => { + const groupId = groupEl.dataset.id ?? ""; + if (!desiredGroupIds.has(groupId)) groupEl.remove(); + }); + + const groupsById = new Map(); + this.listPartElements(listEl, "item-group").forEach((groupEl) => { + groupsById.set(groupEl.dataset.id ?? "", groupEl); + }); + + for (let index = 0; index < blocks.length; index += 1) { + const block = blocks[index]!; + let groupEl = groupsById.get(block.groupId); + if (!groupEl) { + groupEl = this.cloneGroupFromTemplate(templatesRoot, block.groupId) ?? undefined; + if (!groupEl) continue; + listEl.appendChild(groupEl); + groupsById.set(block.groupId, groupEl); + } + const ref = listEl.children[index] ?? null; + if (listEl.children[index] !== groupEl) { + listEl.insertBefore(groupEl, ref); + } + this.syncGroupItems(groupEl, block.items, templatesRoot); + } + + while (listEl.children.length > blocks.length) { + listEl.lastElementChild?.remove(); + } + } + + private syncEmptyState(listEl: HTMLElement, templatesRoot: DocumentFragment | HTMLElement): void { + this.removeListParts(listEl, ["item", "item-group"]); + if (this.listPartElements(listEl, "empty").length > 0) return; + + const emptyTemplate = templatesRoot.querySelector( + '[data-scope="combobox"][data-part="empty"][data-template]' + ); + if (!emptyTemplate) return; + + const emptyEl = emptyTemplate.cloneNode(true) as HTMLElement; + emptyEl.removeAttribute("data-template"); + listEl.appendChild(emptyEl); + } + + renderItems(): void { + const listEl = this.el.querySelector('[data-scope="combobox"][data-part="list"]'); + if (!listEl) return; + + const templatesRoot = templatesContentRoot(this.el, "combobox"); + if (!templatesRoot) return; + + const items = this.activeItems(); + + if (items.length === 0) { + this.syncEmptyState(listEl, templatesRoot); + return; + } + + this.removeListParts(listEl, ["empty"]); + + if (this.hasGroups) { + this.directListPartElements(listEl, "item").forEach((el) => el.remove()); + this.syncGroupedItems(listEl, templatesRoot, items); + } else { + this.removeListParts(listEl, ["item-group"]); + this.syncFlatItems(listEl, templatesRoot, items); } } diff --git a/assets/components/date-picker.ts b/assets/components/date-picker.ts index 4e437e72..3e36e85f 100644 --- a/assets/components/date-picker.ts +++ b/assets/components/date-picker.ts @@ -136,21 +136,74 @@ export class DatePicker extends Component { private getMonthView = () => this.el.querySelector('[data-part="month-view"]'); private getYearView = () => this.el.querySelector('[data-part="year-view"]'); + private ensureTableRow(tbody: HTMLElement, rowIndex: number): HTMLElement { + let tr = tbody.children[rowIndex] as HTMLElement | undefined; + if (!tr || tr.tagName !== "TR") { + tr = this.doc.createElement("tr"); + const ref = tbody.children[rowIndex] ?? null; + tbody.insertBefore(tr, ref); + } + return tr; + } + + private ensureTableCell( + tr: HTMLElement, + cellIndex: number, + cellKey: string + ): { td: HTMLElement; trigger: HTMLElement } { + let td = tr.children[cellIndex] as HTMLElement | undefined; + if (td && (td.tagName !== "TD" || td.dataset.dateCell !== cellKey)) { + td.remove(); + td = undefined; + } + if (!td) { + td = this.doc.createElement("td"); + td.dataset.dateCell = cellKey; + const trigger = this.doc.createElement("div"); + td.appendChild(trigger); + const ref = tr.children[cellIndex] ?? null; + tr.insertBefore(td, ref); + } + const trigger = td.querySelector("div") as HTMLElement; + return { td, trigger }; + } + + private trimTableRows(tbody: HTMLElement, rowCount: number): void { + while (tbody.children.length > rowCount) { + tbody.lastElementChild?.remove(); + } + } + + private trimTableCells(tr: HTMLElement, cellCount: number): void { + while (tr.children.length > cellCount) { + tr.lastElementChild?.remove(); + } + } + private renderDayTableHeader = () => { const dayView = this.getDayView(); const thead = dayView?.querySelector("thead"); if (!thead || !this.api.weekDays) return; - const tr = this.doc.createElement("tr"); + + let tr = thead.querySelector("tr"); + if (!tr || tr.children.length !== this.api.weekDays.length) { + tr = this.doc.createElement("tr"); + thead.replaceChildren(tr); + this.api.weekDays.forEach(() => { + const th = this.doc.createElement("th"); + th.scope = "col"; + tr!.appendChild(th); + }); + } + this.spreadProps(tr, this.api.getTableRowProps({ view: "day" })); - this.api.weekDays.forEach((day) => { - const th = this.doc.createElement("th"); - th.scope = "col"; + this.api.weekDays.forEach((day, index) => { + const th = tr!.children[index] as HTMLElement; th.setAttribute("aria-label", day.long); - th.textContent = day.narrow; - tr.appendChild(th); + if (th.textContent !== day.narrow) { + th.textContent = day.narrow; + } }); - thead.innerHTML = ""; - thead.appendChild(tr); }; private renderDayTableBody = () => { @@ -158,21 +211,29 @@ export class DatePicker extends Component { const tbody = dayView?.querySelector("tbody"); if (!tbody) return; this.spreadProps(tbody, this.api.getTableBodyProps({ view: "day" })); - if (!this.api.weeks) return; - tbody.innerHTML = ""; - this.api.weeks.forEach((week) => { - const tr = this.doc.createElement("tr"); + if (!this.api.weeks) { + tbody.replaceChildren(); + return; + } + + const weeks = this.api.weeks; + this.trimTableRows(tbody, weeks.length); + + weeks.forEach((week, weekIndex) => { + const tr = this.ensureTableRow(tbody, weekIndex); this.spreadProps(tr, this.api.getTableRowProps({ view: "day" })); - week.forEach((value) => { - const td = this.doc.createElement("td"); + this.trimTableCells(tr, week.length); + + week.forEach((value, cellIndex) => { + const cellKey = `${value.year}-${value.month}-${value.day}`; + const { td, trigger } = this.ensureTableCell(tr, cellIndex, cellKey); this.spreadProps(td, this.api.getDayTableCellProps({ value })); - const trigger = this.doc.createElement("div"); this.spreadProps(trigger, this.api.getDayTableCellTriggerProps({ value })); - trigger.textContent = String(value.day); - td.appendChild(trigger); - tr.appendChild(td); + const label = String(value.day); + if (trigger.textContent !== label) { + trigger.textContent = label; + } }); - tbody.appendChild(tr); }); }; @@ -182,20 +243,22 @@ export class DatePicker extends Component { if (!tbody) return; this.spreadProps(tbody, this.api.getTableBodyProps({ view: "month" })); const monthsGrid = this.api.getMonthsGrid({ columns: 4, format: "short" }); - tbody.innerHTML = ""; - monthsGrid.forEach((months) => { - const tr = this.doc.createElement("tr"); + this.trimTableRows(tbody, monthsGrid.length); + + monthsGrid.forEach((months, rowIndex) => { + const tr = this.ensureTableRow(tbody, rowIndex); this.spreadProps(tr, this.api.getTableRowProps()); - months.forEach((month) => { - const td = this.doc.createElement("td"); + this.trimTableCells(tr, months.length); + + months.forEach((month, cellIndex) => { + const cellKey = `${this.api.visibleRange.start.year}-${month.value}`; + const { td, trigger } = this.ensureTableCell(tr, cellIndex, cellKey); this.spreadProps(td, this.api.getMonthTableCellProps({ ...month, columns: 4 })); - const trigger = this.doc.createElement("div"); this.spreadProps(trigger, this.api.getMonthTableCellTriggerProps({ ...month, columns: 4 })); - trigger.textContent = month.label; - td.appendChild(trigger); - tr.appendChild(td); + if (trigger.textContent !== month.label) { + trigger.textContent = month.label; + } }); - tbody.appendChild(tr); }); }; @@ -205,20 +268,22 @@ export class DatePicker extends Component { if (!tbody) return; this.spreadProps(tbody, this.api.getTableBodyProps()); const yearsGrid = this.api.getYearsGrid({ columns: 4 }); - tbody.innerHTML = ""; - yearsGrid.forEach((years) => { - const tr = this.doc.createElement("tr"); + this.trimTableRows(tbody, yearsGrid.length); + + yearsGrid.forEach((years, rowIndex) => { + const tr = this.ensureTableRow(tbody, rowIndex); this.spreadProps(tr, this.api.getTableRowProps({ view: "year" })); - years.forEach((year) => { - const td = this.doc.createElement("td"); + this.trimTableCells(tr, years.length); + + years.forEach((year, cellIndex) => { + const cellKey = String(year.value); + const { td, trigger } = this.ensureTableCell(tr, cellIndex, cellKey); this.spreadProps(td, this.api.getYearTableCellProps({ ...year, columns: 4 })); - const trigger = this.doc.createElement("div"); this.spreadProps(trigger, this.api.getYearTableCellTriggerProps({ ...year, columns: 4 })); - trigger.textContent = year.label; - td.appendChild(trigger); - tr.appendChild(td); + if (trigger.textContent !== year.label) { + trigger.textContent = year.label; + } }); - tbody.appendChild(tr); }); }; diff --git a/assets/test/component/combobox.test.ts b/assets/test/component/combobox.test.ts index f2a0fa6e..f4e1a066 100644 --- a/assets/test/component/combobox.test.ts +++ b/assets/test/component/combobox.test.ts @@ -1,7 +1,54 @@ import { describe, expect, it } from "vitest"; -import { Combobox } from "../../components/combobox"; +import { Combobox, type ComboboxItem } from "../../components/combobox"; import { comboboxTree } from "../helpers/component-smoke"; +function comboboxTreeWithTemplates(items: ComboboxItem[]): HTMLElement { + const root = comboboxTree(); + const templates = document.createElement("div"); + templates.dataset.templates = "combobox"; + templates.style.display = "none"; + + for (const item of items) { + const template = document.createElement("div"); + template.dataset.scope = "combobox"; + template.dataset.part = "item"; + template.dataset.value = item.value ?? item.label; + template.dataset.template = "true"; + templates.appendChild(template); + } + + root.appendChild(templates); + return root; +} + +function comboboxGroupedTreeWithTemplates(items: ComboboxItem[]): HTMLElement { + const root = comboboxTreeWithTemplates(items); + const templates = root.querySelector('[data-templates="combobox"]')!; + + for (const groupId of [...new Set(items.map((item) => item.group).filter(Boolean))]) { + const groupTemplate = document.createElement("div"); + groupTemplate.dataset.scope = "combobox"; + groupTemplate.dataset.part = "item-group"; + groupTemplate.dataset.id = groupId!; + groupTemplate.dataset.template = "true"; + + const ul = document.createElement("ul"); + for (const item of items.filter((entry) => entry.group === groupId)) { + const itemTemplate = document.createElement("div"); + itemTemplate.dataset.scope = "combobox"; + itemTemplate.dataset.part = "item"; + itemTemplate.dataset.value = item.value ?? item.label; + itemTemplate.dataset.template = "true"; + ul.appendChild(itemTemplate); + } + + groupTemplate.appendChild(ul); + templates.appendChild(groupTemplate); + } + + return root; +} + describe("Combobox", () => { const items = [ { label: "Alpha", value: "a" }, @@ -61,4 +108,62 @@ describe("Combobox", () => { expect(c.getCollection().size).toBe(2); c.destroy(); }); + + it("reuses existing flat list items on repeated render", () => { + const root = comboboxTreeWithTemplates(items); + const c = new Combobox(root, { id: "cb" }, items, false); + c.init(); + c.render(); + + const list = root.querySelector('[data-part="list"]'); + const firstItem = list?.querySelector('[data-part="item"]:not([data-template])'); + expect(firstItem).toBeTruthy(); + + c.render(); + expect(list?.querySelector('[data-part="item"]:not([data-template])')).toBe(firstItem); + + c.destroy(); + }); + + it("removes filtered-out flat list items without rebuilding survivors", () => { + const root = comboboxTreeWithTemplates(items); + const c = new Combobox(root, { id: "cb" }, items, false); + c.init(); + c.render(); + + const list = root.querySelector('[data-part="list"]')!; + const alpha = list.querySelector('[data-value="a"]'); + expect(alpha).toBeTruthy(); + + c.options = [{ label: "Beta", value: "b" }]; + c.render(); + + expect(list.querySelector('[data-value="a"]')).toBeNull(); + expect(list.querySelector('[data-value="b"]')).toBeTruthy(); + + c.destroy(); + }); + + it("reuses grouped list items on repeated render", () => { + const grouped = [ + { label: "A", value: "a", group: "g1" }, + { label: "B", value: "b", group: "g1" }, + ]; + const root = comboboxGroupedTreeWithTemplates(grouped); + const c = new Combobox(root, { id: "cb" }, grouped, true); + c.init(); + c.render(); + + const list = root.querySelector('[data-part="list"]'); + const firstGroup = list?.querySelector('[data-part="item-group"]:not([data-template])'); + const firstItem = list?.querySelector('[data-part="item"]:not([data-template])'); + expect(firstGroup).toBeTruthy(); + expect(firstItem).toBeTruthy(); + + c.render(); + expect(list?.querySelector('[data-part="item-group"]:not([data-template])')).toBe(firstGroup); + expect(list?.querySelector('[data-part="item"]:not([data-template])')).toBe(firstItem); + + c.destroy(); + }); }); diff --git a/assets/test/component/date-picker.test.ts b/assets/test/component/date-picker.test.ts index d23ec0e1..23e42995 100644 --- a/assets/test/component/date-picker.test.ts +++ b/assets/test/component/date-picker.test.ts @@ -1,9 +1,36 @@ import { describe, expect, it } from "vitest"; +import * as datePicker from "@zag-js/date-picker"; import { applyInputAriaIfNeeded, buildZagDatePickerTranslations, + DatePicker, } from "../../components/date-picker"; +function datePickerDayViewTree(): HTMLElement { + const host = document.createElement("div"); + host.id = "dp-perf"; + host.innerHTML = ` +
+
+ +
+
+
+
+
+
+
+
+
+
+ + +
+
+ `; + return host; +} + describe("buildZagDatePickerTranslations", () => { it("maps open/close calendar labels to trigger", () => { const t = buildZagDatePickerTranslations({ @@ -69,3 +96,47 @@ describe("applyInputAriaIfNeeded", () => { expect(input.getAttribute("aria-label")).toBeNull(); }); }); + +describe("DatePicker render", () => { + it("reuses day table cells on repeated render", () => { + const host = datePickerDayViewTree(); + const instance = new DatePicker(host, { + id: host.id, + selectionMode: "single", + defaultOpen: true, + defaultValue: [datePicker.parse("2024-06-15")], + }); + instance.init(); + instance.render(); + + const tbody = host.querySelector("tbody"); + const firstCell = tbody?.querySelector("td"); + expect(firstCell).toBeTruthy(); + + instance.render(); + expect(tbody?.querySelector("td")).toBe(firstCell); + + instance.destroy(); + }); + + it("reuses day table header row on repeated render", () => { + const host = datePickerDayViewTree(); + const instance = new DatePicker(host, { + id: host.id, + selectionMode: "single", + defaultOpen: true, + defaultValue: [datePicker.parse("2024-06-15")], + }); + instance.init(); + instance.render(); + + const thead = host.querySelector("thead"); + const firstRow = thead?.querySelector("tr"); + expect(firstRow).toBeTruthy(); + + instance.render(); + expect(thead?.querySelector("tr")).toBe(firstRow); + + instance.destroy(); + }); +}); diff --git a/priv/static/combobox.mjs b/priv/static/combobox.mjs index 935910eb..b13ccb52 100644 --- a/priv/static/combobox.mjs +++ b/priv/static/combobox.mjs @@ -1645,66 +1645,179 @@ var Combobox = class extends Component { } return blocks; } + isOwnedByList(listEl, el) { + return el.closest('[data-scope="combobox"][data-part="list"]') === listEl; + } + listPartElements(listEl, part) { + return Array.from( + listEl.querySelectorAll( + `[data-scope="combobox"][data-part="${part}"]:not([data-template])` + ) + ).filter((el) => this.isOwnedByList(listEl, el)); + } + directListPartElements(listEl, part) { + return Array.from(listEl.children).filter( + (el) => el instanceof HTMLElement && el.getAttribute("data-scope") === "combobox" && el.getAttribute("data-part") === part && !el.hasAttribute("data-template") + ); + } + removeListParts(listEl, parts2) { + for (const part of parts2) { + this.listPartElements(listEl, part).forEach((el) => el.remove()); + } + } + cloneItemFromTemplate(templatesRoot, value) { + const template = templatesRoot.querySelector( + `:scope > [data-scope="combobox"][data-part="item"][data-value="${CSS.escape(value)}"][data-template]` + ); + if (!template) return null; + const itemEl = template.cloneNode(true); + itemEl.removeAttribute("data-template"); + return itemEl; + } + cloneGroupFromTemplate(templatesRoot, groupId) { + const groupTemplate = templatesRoot.querySelector( + `[data-scope="combobox"][data-part="item-group"][data-id="${CSS.escape(groupId)}"][data-template]` + ); + if (!groupTemplate) return null; + const groupEl = groupTemplate.cloneNode(true); + groupEl.removeAttribute("data-template"); + groupEl.querySelectorAll("[data-template]").forEach((e) => e.removeAttribute("data-template")); + return groupEl; + } + syncFlatItems(listEl, templatesRoot, items) { + const desiredValues = items.map((item) => this.getItemValue(item)); + const desiredSet = new Set(desiredValues); + this.listPartElements(listEl, "item").forEach((itemEl) => { + const value = itemEl.dataset.value ?? ""; + if (!desiredSet.has(value)) itemEl.remove(); + }); + const byValue = /* @__PURE__ */ new Map(); + this.listPartElements(listEl, "item").forEach((itemEl) => { + byValue.set(itemEl.dataset.value ?? "", itemEl); + }); + for (let index = 0; index < desiredValues.length; index += 1) { + const value = desiredValues[index]; + let itemEl = byValue.get(value); + if (!itemEl) { + itemEl = this.cloneItemFromTemplate(templatesRoot, value) ?? void 0; + if (!itemEl) continue; + listEl.appendChild(itemEl); + byValue.set(value, itemEl); + } + const ref = listEl.children[index] ?? null; + if (listEl.children[index] !== itemEl) { + listEl.insertBefore(itemEl, ref); + } + } + while (listEl.children.length > desiredValues.length) { + listEl.lastElementChild?.remove(); + } + } + syncGroupItems(groupEl, blockItems, templatesRoot) { + const ul = groupEl.querySelector("ul"); + if (!ul) return; + const desiredValues = blockItems.map((item) => this.getItemValue(item)); + const desiredSet = new Set(desiredValues); + const groupId = groupEl.dataset.id ?? ""; + Array.from( + ul.querySelectorAll( + '[data-scope="combobox"][data-part="item"]:not([data-template])' + ) + ).forEach((itemEl) => { + const value = itemEl.dataset.value ?? ""; + if (!desiredSet.has(value)) itemEl.remove(); + }); + const byValue = /* @__PURE__ */ new Map(); + Array.from(ul.children).forEach((child) => { + if (!(child instanceof HTMLElement)) return; + if (child.getAttribute("data-part") !== "item") return; + byValue.set(child.dataset.value ?? "", child); + }); + for (let index = 0; index < desiredValues.length; index += 1) { + const value = desiredValues[index]; + let itemEl = byValue.get(value); + if (!itemEl) { + const groupTemplate = templatesRoot.querySelector( + `[data-scope="combobox"][data-part="item-group"][data-id="${CSS.escape(groupId)}"][data-template]` + ); + const itemTemplate = groupTemplate?.querySelector( + `[data-scope="combobox"][data-part="item"][data-value="${CSS.escape(value)}"]` + ); + if (!itemTemplate) continue; + itemEl = itemTemplate.cloneNode(true); + itemEl.removeAttribute("data-template"); + ul.appendChild(itemEl); + byValue.set(value, itemEl); + } + const ref = ul.children[index] ?? null; + if (ul.children[index] !== itemEl) { + ul.insertBefore(itemEl, ref); + } + } + while (ul.children.length > desiredValues.length) { + ul.lastElementChild?.remove(); + } + } + syncGroupedItems(listEl, templatesRoot, items) { + const blocks = this.buildOrderedBlocks(items).filter( + (block) => block.type === "group" + ); + const desiredGroupIds = new Set(blocks.map((block) => block.groupId)); + this.listPartElements(listEl, "item-group").forEach((groupEl) => { + const groupId = groupEl.dataset.id ?? ""; + if (!desiredGroupIds.has(groupId)) groupEl.remove(); + }); + const groupsById = /* @__PURE__ */ new Map(); + this.listPartElements(listEl, "item-group").forEach((groupEl) => { + groupsById.set(groupEl.dataset.id ?? "", groupEl); + }); + for (let index = 0; index < blocks.length; index += 1) { + const block = blocks[index]; + let groupEl = groupsById.get(block.groupId); + if (!groupEl) { + groupEl = this.cloneGroupFromTemplate(templatesRoot, block.groupId) ?? void 0; + if (!groupEl) continue; + listEl.appendChild(groupEl); + groupsById.set(block.groupId, groupEl); + } + const ref = listEl.children[index] ?? null; + if (listEl.children[index] !== groupEl) { + listEl.insertBefore(groupEl, ref); + } + this.syncGroupItems(groupEl, block.items, templatesRoot); + } + while (listEl.children.length > blocks.length) { + listEl.lastElementChild?.remove(); + } + } + syncEmptyState(listEl, templatesRoot) { + this.removeListParts(listEl, ["item", "item-group"]); + if (this.listPartElements(listEl, "empty").length > 0) return; + const emptyTemplate = templatesRoot.querySelector( + '[data-scope="combobox"][data-part="empty"][data-template]' + ); + if (!emptyTemplate) return; + const emptyEl = emptyTemplate.cloneNode(true); + emptyEl.removeAttribute("data-template"); + listEl.appendChild(emptyEl); + } renderItems() { const listEl = this.el.querySelector('[data-scope="combobox"][data-part="list"]'); if (!listEl) return; - const isOwnedByList = (el) => el.closest('[data-scope="combobox"][data-part="list"]') === listEl; const templatesRoot = templatesContentRoot(this.el, "combobox"); if (!templatesRoot) return; - ["empty", "item-group", "item"].forEach((part) => { - Array.from( - listEl.querySelectorAll( - `[data-scope="combobox"][data-part="${part}"]:not([data-template])` - ) - ).filter(isOwnedByList).forEach((el) => el.remove()); - }); const items = this.activeItems(); if (items.length === 0) { - const emptyTemplate = templatesRoot.querySelector( - '[data-scope="combobox"][data-part="empty"][data-template]' - ); - if (emptyTemplate) { - const emptyEl = emptyTemplate.cloneNode(true); - emptyEl.removeAttribute("data-template"); - listEl.appendChild(emptyEl); - } + this.syncEmptyState(listEl, templatesRoot); return; } + this.removeListParts(listEl, ["empty"]); if (this.hasGroups) { - this.renderGroupedItems(listEl, templatesRoot, items); + this.directListPartElements(listEl, "item").forEach((el) => el.remove()); + this.syncGroupedItems(listEl, templatesRoot, items); } else { - this.renderFlatItems(listEl, templatesRoot, items); - } - } - renderGroupedItems(listEl, templatesRoot, items) { - const blocks = this.buildOrderedBlocks(items); - for (const block of blocks) { - if (block.type !== "group") continue; - const groupTemplate = templatesRoot.querySelector( - `[data-scope="combobox"][data-part="item-group"][data-id="${CSS.escape(block.groupId)}"][data-template]` - ); - if (!groupTemplate) continue; - const groupEl = groupTemplate.cloneNode(true); - groupEl.removeAttribute("data-template"); - groupEl.querySelectorAll("[data-template]").forEach((e) => e.removeAttribute("data-template")); - const keepValues = new Set(block.items.map((i) => this.getItemValue(i))); - groupEl.querySelectorAll('[data-scope="combobox"][data-part="item"]').forEach((itemEl) => { - const v = itemEl.dataset.value ?? ""; - if (!keepValues.has(v)) itemEl.remove(); - }); - listEl.appendChild(groupEl); - } - } - renderFlatItems(listEl, templatesRoot, items) { - for (const item of items) { - const value = this.getItemValue(item); - const template = templatesRoot.querySelector( - `:scope > [data-scope="combobox"][data-part="item"][data-value="${CSS.escape(value)}"][data-template]` - ); - if (!template) continue; - const itemEl = template.cloneNode(true); - itemEl.removeAttribute("data-template"); - listEl.appendChild(itemEl); + this.removeListParts(listEl, ["item-group"]); + this.syncFlatItems(listEl, templatesRoot, items); } } applyItemProps() { diff --git a/priv/static/corex.js b/priv/static/corex.js index 4e99bf19..2b934897 100644 --- a/priv/static/corex.js +++ b/priv/static/corex.js @@ -14785,67 +14785,188 @@ var Corex = (() => { } return blocks; } + isOwnedByList(listEl, el) { + return el.closest('[data-scope="combobox"][data-part="list"]') === listEl; + } + listPartElements(listEl, part) { + return Array.from( + listEl.querySelectorAll( + `[data-scope="combobox"][data-part="${part}"]:not([data-template])` + ) + ).filter((el) => this.isOwnedByList(listEl, el)); + } + directListPartElements(listEl, part) { + return Array.from(listEl.children).filter( + (el) => el instanceof HTMLElement && el.getAttribute("data-scope") === "combobox" && el.getAttribute("data-part") === part && !el.hasAttribute("data-template") + ); + } + removeListParts(listEl, parts210) { + for (const part of parts210) { + this.listPartElements(listEl, part).forEach((el) => el.remove()); + } + } + cloneItemFromTemplate(templatesRoot, value) { + const template = templatesRoot.querySelector( + `:scope > [data-scope="combobox"][data-part="item"][data-value="${CSS.escape(value)}"][data-template]` + ); + if (!template) return null; + const itemEl = template.cloneNode(true); + itemEl.removeAttribute("data-template"); + return itemEl; + } + cloneGroupFromTemplate(templatesRoot, groupId) { + const groupTemplate = templatesRoot.querySelector( + `[data-scope="combobox"][data-part="item-group"][data-id="${CSS.escape(groupId)}"][data-template]` + ); + if (!groupTemplate) return null; + const groupEl = groupTemplate.cloneNode(true); + groupEl.removeAttribute("data-template"); + groupEl.querySelectorAll("[data-template]").forEach((e2) => e2.removeAttribute("data-template")); + return groupEl; + } + syncFlatItems(listEl, templatesRoot, items) { + var _a4, _b, _c; + const desiredValues = items.map((item) => this.getItemValue(item)); + const desiredSet = new Set(desiredValues); + this.listPartElements(listEl, "item").forEach((itemEl) => { + var _a5; + const value = (_a5 = itemEl.dataset.value) != null ? _a5 : ""; + if (!desiredSet.has(value)) itemEl.remove(); + }); + const byValue = /* @__PURE__ */ new Map(); + this.listPartElements(listEl, "item").forEach((itemEl) => { + var _a5; + byValue.set((_a5 = itemEl.dataset.value) != null ? _a5 : "", itemEl); + }); + for (let index = 0; index < desiredValues.length; index += 1) { + const value = desiredValues[index]; + let itemEl = byValue.get(value); + if (!itemEl) { + itemEl = (_a4 = this.cloneItemFromTemplate(templatesRoot, value)) != null ? _a4 : void 0; + if (!itemEl) continue; + listEl.appendChild(itemEl); + byValue.set(value, itemEl); + } + const ref = (_b = listEl.children[index]) != null ? _b : null; + if (listEl.children[index] !== itemEl) { + listEl.insertBefore(itemEl, ref); + } + } + while (listEl.children.length > desiredValues.length) { + (_c = listEl.lastElementChild) == null ? void 0 : _c.remove(); + } + } + syncGroupItems(groupEl, blockItems, templatesRoot) { + var _a4, _b, _c; + const ul = groupEl.querySelector("ul"); + if (!ul) return; + const desiredValues = blockItems.map((item) => this.getItemValue(item)); + const desiredSet = new Set(desiredValues); + const groupId = (_a4 = groupEl.dataset.id) != null ? _a4 : ""; + Array.from( + ul.querySelectorAll( + '[data-scope="combobox"][data-part="item"]:not([data-template])' + ) + ).forEach((itemEl) => { + var _a5; + const value = (_a5 = itemEl.dataset.value) != null ? _a5 : ""; + if (!desiredSet.has(value)) itemEl.remove(); + }); + const byValue = /* @__PURE__ */ new Map(); + Array.from(ul.children).forEach((child) => { + var _a5; + if (!(child instanceof HTMLElement)) return; + if (child.getAttribute("data-part") !== "item") return; + byValue.set((_a5 = child.dataset.value) != null ? _a5 : "", child); + }); + for (let index = 0; index < desiredValues.length; index += 1) { + const value = desiredValues[index]; + let itemEl = byValue.get(value); + if (!itemEl) { + const groupTemplate = templatesRoot.querySelector( + `[data-scope="combobox"][data-part="item-group"][data-id="${CSS.escape(groupId)}"][data-template]` + ); + const itemTemplate = groupTemplate == null ? void 0 : groupTemplate.querySelector( + `[data-scope="combobox"][data-part="item"][data-value="${CSS.escape(value)}"]` + ); + if (!itemTemplate) continue; + itemEl = itemTemplate.cloneNode(true); + itemEl.removeAttribute("data-template"); + ul.appendChild(itemEl); + byValue.set(value, itemEl); + } + const ref = (_b = ul.children[index]) != null ? _b : null; + if (ul.children[index] !== itemEl) { + ul.insertBefore(itemEl, ref); + } + } + while (ul.children.length > desiredValues.length) { + (_c = ul.lastElementChild) == null ? void 0 : _c.remove(); + } + } + syncGroupedItems(listEl, templatesRoot, items) { + var _a4, _b, _c; + const blocks = this.buildOrderedBlocks(items).filter( + (block) => block.type === "group" + ); + const desiredGroupIds = new Set(blocks.map((block) => block.groupId)); + this.listPartElements(listEl, "item-group").forEach((groupEl) => { + var _a5; + const groupId = (_a5 = groupEl.dataset.id) != null ? _a5 : ""; + if (!desiredGroupIds.has(groupId)) groupEl.remove(); + }); + const groupsById = /* @__PURE__ */ new Map(); + this.listPartElements(listEl, "item-group").forEach((groupEl) => { + var _a5; + groupsById.set((_a5 = groupEl.dataset.id) != null ? _a5 : "", groupEl); + }); + for (let index = 0; index < blocks.length; index += 1) { + const block = blocks[index]; + let groupEl = groupsById.get(block.groupId); + if (!groupEl) { + groupEl = (_a4 = this.cloneGroupFromTemplate(templatesRoot, block.groupId)) != null ? _a4 : void 0; + if (!groupEl) continue; + listEl.appendChild(groupEl); + groupsById.set(block.groupId, groupEl); + } + const ref = (_b = listEl.children[index]) != null ? _b : null; + if (listEl.children[index] !== groupEl) { + listEl.insertBefore(groupEl, ref); + } + this.syncGroupItems(groupEl, block.items, templatesRoot); + } + while (listEl.children.length > blocks.length) { + (_c = listEl.lastElementChild) == null ? void 0 : _c.remove(); + } + } + syncEmptyState(listEl, templatesRoot) { + this.removeListParts(listEl, ["item", "item-group"]); + if (this.listPartElements(listEl, "empty").length > 0) return; + const emptyTemplate = templatesRoot.querySelector( + '[data-scope="combobox"][data-part="empty"][data-template]' + ); + if (!emptyTemplate) return; + const emptyEl = emptyTemplate.cloneNode(true); + emptyEl.removeAttribute("data-template"); + listEl.appendChild(emptyEl); + } renderItems() { const listEl = this.el.querySelector('[data-scope="combobox"][data-part="list"]'); if (!listEl) return; - const isOwnedByList = (el) => el.closest('[data-scope="combobox"][data-part="list"]') === listEl; const templatesRoot = templatesContentRoot(this.el, "combobox"); if (!templatesRoot) return; - ["empty", "item-group", "item"].forEach((part) => { - Array.from( - listEl.querySelectorAll( - `[data-scope="combobox"][data-part="${part}"]:not([data-template])` - ) - ).filter(isOwnedByList).forEach((el) => el.remove()); - }); const items = this.activeItems(); if (items.length === 0) { - const emptyTemplate = templatesRoot.querySelector( - '[data-scope="combobox"][data-part="empty"][data-template]' - ); - if (emptyTemplate) { - const emptyEl = emptyTemplate.cloneNode(true); - emptyEl.removeAttribute("data-template"); - listEl.appendChild(emptyEl); - } + this.syncEmptyState(listEl, templatesRoot); return; } + this.removeListParts(listEl, ["empty"]); if (this.hasGroups) { - this.renderGroupedItems(listEl, templatesRoot, items); + this.directListPartElements(listEl, "item").forEach((el) => el.remove()); + this.syncGroupedItems(listEl, templatesRoot, items); } else { - this.renderFlatItems(listEl, templatesRoot, items); - } - } - renderGroupedItems(listEl, templatesRoot, items) { - const blocks = this.buildOrderedBlocks(items); - for (const block of blocks) { - if (block.type !== "group") continue; - const groupTemplate = templatesRoot.querySelector( - `[data-scope="combobox"][data-part="item-group"][data-id="${CSS.escape(block.groupId)}"][data-template]` - ); - if (!groupTemplate) continue; - const groupEl = groupTemplate.cloneNode(true); - groupEl.removeAttribute("data-template"); - groupEl.querySelectorAll("[data-template]").forEach((e2) => e2.removeAttribute("data-template")); - const keepValues = new Set(block.items.map((i2) => this.getItemValue(i2))); - groupEl.querySelectorAll('[data-scope="combobox"][data-part="item"]').forEach((itemEl) => { - var _a4; - const v2 = (_a4 = itemEl.dataset.value) != null ? _a4 : ""; - if (!keepValues.has(v2)) itemEl.remove(); - }); - listEl.appendChild(groupEl); - } - } - renderFlatItems(listEl, templatesRoot, items) { - for (const item of items) { - const value = this.getItemValue(item); - const template = templatesRoot.querySelector( - `:scope > [data-scope="combobox"][data-part="item"][data-value="${CSS.escape(value)}"][data-template]` - ); - if (!template) continue; - const itemEl = template.cloneNode(true); - itemEl.removeAttribute("data-template"); - listEl.appendChild(itemEl); + this.removeListParts(listEl, ["item-group"]); + this.syncFlatItems(listEl, templatesRoot, items); } } applyItemProps() { @@ -21731,38 +21852,50 @@ var Corex = (() => { const dayView = this.getDayView(); const thead = dayView == null ? void 0 : dayView.querySelector("thead"); if (!thead || !this.api.weekDays) return; - const tr = this.doc.createElement("tr"); + let tr = thead.querySelector("tr"); + if (!tr || tr.children.length !== this.api.weekDays.length) { + tr = this.doc.createElement("tr"); + thead.replaceChildren(tr); + this.api.weekDays.forEach(() => { + const th = this.doc.createElement("th"); + th.scope = "col"; + tr.appendChild(th); + }); + } this.spreadProps(tr, this.api.getTableRowProps({ view: "day" })); - this.api.weekDays.forEach((day) => { - const th = this.doc.createElement("th"); - th.scope = "col"; + this.api.weekDays.forEach((day, index) => { + const th = tr.children[index]; th.setAttribute("aria-label", day.long); - th.textContent = day.narrow; - tr.appendChild(th); + if (th.textContent !== day.narrow) { + th.textContent = day.narrow; + } }); - thead.innerHTML = ""; - thead.appendChild(tr); }); __publicField(this, "renderDayTableBody", () => { const dayView = this.getDayView(); const tbody = dayView == null ? void 0 : dayView.querySelector("tbody"); if (!tbody) return; this.spreadProps(tbody, this.api.getTableBodyProps({ view: "day" })); - if (!this.api.weeks) return; - tbody.innerHTML = ""; - this.api.weeks.forEach((week) => { - const tr = this.doc.createElement("tr"); + if (!this.api.weeks) { + tbody.replaceChildren(); + return; + } + const weeks = this.api.weeks; + this.trimTableRows(tbody, weeks.length); + weeks.forEach((week, weekIndex) => { + const tr = this.ensureTableRow(tbody, weekIndex); this.spreadProps(tr, this.api.getTableRowProps({ view: "day" })); - week.forEach((value) => { - const td = this.doc.createElement("td"); + this.trimTableCells(tr, week.length); + week.forEach((value, cellIndex) => { + const cellKey = `${value.year}-${value.month}-${value.day}`; + const { td, trigger } = this.ensureTableCell(tr, cellIndex, cellKey); this.spreadProps(td, this.api.getDayTableCellProps({ value })); - const trigger = this.doc.createElement("div"); this.spreadProps(trigger, this.api.getDayTableCellTriggerProps({ value })); - trigger.textContent = String(value.day); - td.appendChild(trigger); - tr.appendChild(td); + const label = String(value.day); + if (trigger.textContent !== label) { + trigger.textContent = label; + } }); - tbody.appendChild(tr); }); }); __publicField(this, "renderMonthTableBody", () => { @@ -21771,20 +21904,20 @@ var Corex = (() => { if (!tbody) return; this.spreadProps(tbody, this.api.getTableBodyProps({ view: "month" })); const monthsGrid = this.api.getMonthsGrid({ columns: 4, format: "short" }); - tbody.innerHTML = ""; - monthsGrid.forEach((months) => { - const tr = this.doc.createElement("tr"); + this.trimTableRows(tbody, monthsGrid.length); + monthsGrid.forEach((months, rowIndex) => { + const tr = this.ensureTableRow(tbody, rowIndex); this.spreadProps(tr, this.api.getTableRowProps()); - months.forEach((month) => { - const td = this.doc.createElement("td"); + this.trimTableCells(tr, months.length); + months.forEach((month, cellIndex) => { + const cellKey = `${this.api.visibleRange.start.year}-${month.value}`; + const { td, trigger } = this.ensureTableCell(tr, cellIndex, cellKey); this.spreadProps(td, this.api.getMonthTableCellProps(__spreadProps(__spreadValues({}, month), { columns: 4 }))); - const trigger = this.doc.createElement("div"); this.spreadProps(trigger, this.api.getMonthTableCellTriggerProps(__spreadProps(__spreadValues({}, month), { columns: 4 }))); - trigger.textContent = month.label; - td.appendChild(trigger); - tr.appendChild(td); + if (trigger.textContent !== month.label) { + trigger.textContent = month.label; + } }); - tbody.appendChild(tr); }); }); __publicField(this, "renderYearTableBody", () => { @@ -21793,20 +21926,20 @@ var Corex = (() => { if (!tbody) return; this.spreadProps(tbody, this.api.getTableBodyProps()); const yearsGrid = this.api.getYearsGrid({ columns: 4 }); - tbody.innerHTML = ""; - yearsGrid.forEach((years) => { - const tr = this.doc.createElement("tr"); + this.trimTableRows(tbody, yearsGrid.length); + yearsGrid.forEach((years, rowIndex) => { + const tr = this.ensureTableRow(tbody, rowIndex); this.spreadProps(tr, this.api.getTableRowProps({ view: "year" })); - years.forEach((year) => { - const td = this.doc.createElement("td"); + this.trimTableCells(tr, years.length); + years.forEach((year, cellIndex) => { + const cellKey = String(year.value); + const { td, trigger } = this.ensureTableCell(tr, cellIndex, cellKey); this.spreadProps(td, this.api.getYearTableCellProps(__spreadProps(__spreadValues({}, year), { columns: 4 }))); - const trigger = this.doc.createElement("div"); this.spreadProps(trigger, this.api.getYearTableCellTriggerProps(__spreadProps(__spreadValues({}, year), { columns: 4 }))); - trigger.textContent = year.label; - td.appendChild(trigger); - tr.appendChild(td); + if (trigger.textContent !== year.label) { + trigger.textContent = year.label; + } }); - tbody.appendChild(tr); }); }); } @@ -21817,6 +21950,46 @@ var Corex = (() => { initApi() { return this.zagConnect(connect11); } + ensureTableRow(tbody, rowIndex) { + var _a4; + let tr = tbody.children[rowIndex]; + if (!tr || tr.tagName !== "TR") { + tr = this.doc.createElement("tr"); + const ref = (_a4 = tbody.children[rowIndex]) != null ? _a4 : null; + tbody.insertBefore(tr, ref); + } + return tr; + } + ensureTableCell(tr, cellIndex, cellKey) { + var _a4; + let td = tr.children[cellIndex]; + if (td && (td.tagName !== "TD" || td.dataset.dateCell !== cellKey)) { + td.remove(); + td = void 0; + } + if (!td) { + td = this.doc.createElement("td"); + td.dataset.dateCell = cellKey; + const trigger2 = this.doc.createElement("div"); + td.appendChild(trigger2); + const ref = (_a4 = tr.children[cellIndex]) != null ? _a4 : null; + tr.insertBefore(td, ref); + } + const trigger = td.querySelector("div"); + return { td, trigger }; + } + trimTableRows(tbody, rowCount) { + var _a4; + while (tbody.children.length > rowCount) { + (_a4 = tbody.lastElementChild) == null ? void 0 : _a4.remove(); + } + } + trimTableCells(tr, cellCount) { + var _a4; + while (tr.children.length > cellCount) { + (_a4 = tr.lastElementChild) == null ? void 0 : _a4.remove(); + } + } render() { const root = this.el.querySelector('[data-scope="date-picker"][data-part="root"]'); if (root) this.spreadProps(root, this.api.getRootProps()); diff --git a/priv/static/corex.min.js b/priv/static/corex.min.js index b6167104..1a7bbe94 100644 --- a/priv/static/corex.min.js +++ b/priv/static/corex.min.js @@ -1,17 +1,17 @@ -"use strict";var Corex=(()=>{var os=Object.defineProperty,GS=Object.defineProperties,qS=Object.getOwnPropertyDescriptor,WS=Object.getOwnPropertyDescriptors,KS=Object.getOwnPropertyNames,as=Object.getOwnPropertySymbols;var Fc=Object.prototype.hasOwnProperty,Ep=Object.prototype.propertyIsEnumerable;var Lc=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Pp=e=>{throw TypeError(e)};var Dc=(e,t,n)=>t in e?os(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,h=(e,t)=>{for(var n in t||(t={}))Fc.call(t,n)&&Dc(e,n,t[n]);if(as)for(var n of as(t))Ep.call(t,n)&&Dc(e,n,t[n]);return e},y=(e,t)=>GS(e,WS(t));var St=(e,t)=>{var n={};for(var r in e)Fc.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&as)for(var r of as(e))t.indexOf(r)<0&&Ep.call(e,r)&&(n[r]=e[r]);return n};var ee=(e,t)=>()=>(e&&(t=e(e=0)),t);var pe=(e,t)=>{for(var n in t)os(e,n,{get:t[n],enumerable:!0})},zS=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of KS(t))!Fc.call(e,i)&&i!==n&&os(e,i,{get:()=>t[i],enumerable:!(r=qS(t,i))||r.enumerable});return e};var jS=e=>zS(os({},"__esModule",{value:!0}),e);var Q=(e,t,n)=>Dc(e,typeof t!="symbol"?t+"":t,n);var ss=(e,t,n)=>t.has(e)?Pp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);var Ke=(e,t,n)=>new Promise((r,i)=>{var a=l=>{try{s(n.next(l))}catch(c){i(c)}},o=l=>{try{s(n.throw(l))}catch(c){i(c)}},s=l=>l.done?r(l.value):Promise.resolve(l.value).then(a,o);s((n=n.apply(e,t)).next())}),YS=function(e,t){this[0]=e,this[1]=t};var Sp=e=>{var t=e[Lc("asyncIterator")],n=!1,r,i={};return t==null?(t=e[Lc("iterator")](),r=a=>i[a]=o=>t[a](o)):(t=t.call(e),r=a=>i[a]=o=>{if(n){if(n=!1,a==="throw")throw o;return o}return n=!0,{done:!1,value:new YS(new Promise(s=>{var l=t[a](o);l instanceof Object||Pp("Object expected"),s(l)}),1)}}),i[Lc("iterator")]=()=>i,r("next"),"throw"in t?r("throw"):i.throw=a=>{throw a},"return"in t&&r("return"),i};function Na(e,t){let n=e.filter(i=>!t.includes(i)),r=t.filter(i=>!e.includes(i));return{added:n,removed:r}}var Mc=ee(()=>{"use strict"});function q(e){let t=e.dataset.dir;if(t!==void 0&&XS.includes(t))return t;let n=document.documentElement.getAttribute("dir");return n==="ltr"||n==="rtl"?n:"ltr"}function Ma(e,t){let n=e.dataset[t];return n==="indeterminate"?"indeterminate":n==="true"}function Is(e,t){let n=e.querySelector(`[data-templates="${t}"]`);return n?n instanceof HTMLTemplateElement?n.content:n:null}function j(e){return!e.main.isDead&&e.main.isConnected()}function zc(e,t){let n=V(t,"form");n&&t.closest("form")===null&&e.setAttribute("form",n)}function it(e,t){e&&(t.closest("form")!==null?e.removeAttribute("form"):zc(e,t))}function $a(e){return e==null?[]:Array.isArray(e)?e:[e]}function Mi(e,t,n={}){let{step:r=1,loop:i=!0}=n,a=t+r,o=e.length,s=o-1;return t===-1?r>0?0:s:a<0?i?s:0:a>=o?i?0:t>o?o:t:a}function Wp(e,t,n={}){return e[Mi(e,t,n)]}function Ha(e,t,n={}){let{step:r=1,loop:i=!0}=n;return Mi(e,t,{step:-r,loop:i})}function Kp(e,t,n={}){return e[Ha(e,t,n)]}function Ba(e,t){return e.reduce((n,r,i)=>{var a;return i%t===0?n.push([r]):(a=en(n))==null||a.push(r),n},[])}function Xc(e){return e.reduce((t,n)=>Array.isArray(n)?t.concat(Xc(n)):t.concat(n),[])}function Zc(e,t){return e.reduce(([n,r],i)=>(t(i)?n.push(i):r.push(i),[n,r]),[[],[]])}function He(e,t,...n){var i;if(e in t){let a=t[e];return Qe(a)?a(...n):a}let r=new Error(`No matching key: ${JSON.stringify(e)} in ${JSON.stringify(Object.keys(t))}`);throw(i=Error.captureStackTrace)==null||i.call(Error,r,He),r}function Zp(e,t=0){let n=0,r=null;return(...i)=>{let a=Date.now(),o=a-n;o>=t?(r&&(clearTimeout(r),r=null),e(...i),n=a):r||(r=setTimeout(()=>{e(...i),n=Date.now(),r=null},t-o))}}function dI(e){let t="",n;for(n=Math.abs(e);n>52;n=n/52|0)t=kp(n%52)+t;return kp(n%52)+t}function uI(e,t){let n=t.length;for(;n;)e=e*33^t.charCodeAt(--n);return e}function _n(e){if(!Da(e)||e===void 0)return e;let t=Reflect.ownKeys(e).filter(r=>typeof r=="string"),n={};for(let r of t){let i=e[r];i!==void 0&&(n[r]=_n(i))}return n}function dr(e,t){let n={};for(let r of t){let i=e[r];i!==void 0&&(n[r]=i)}return n}function It(...e){let t=e.length===1?e[0]:e[1];(e.length===2?e[0]:!0)&&console.warn(t)}function Fi(...e){let t=e.length===1?e[0]:e[1];if(e.length===2?e[0]:!0)throw new Error(t)}function nn(e,t){if(e==null)throw new Error(t())}function gn(e,t,n){let r=[];for(let i of t)e[i]==null&&r.push(i);if(r.length>0)throw new Error(`[zag-js${n?` > ${n}`:""}] missing required props: ${r.join(", ")}`)}function Uc(e){return e.join(ur)}function gI(e){return e.includes(ur)}function th(e){return e.startsWith(Qp)}function pI(e){return e.startsWith(ur)}function hI(e){return th(e)?e.slice(Qp.length):e}function Gc(e,t){return e?`${e}${ur}${t}`:t}function fI(e){let t=new Map,n=new Map,r=(i,a)=>{t.set(i,a);let o=a.id;o&&(n.has(o)&&Fi(`[zag-js] Duplicate state id: "${o}"`),n.set(o,i));let s=a.states;if(s){nn(a.initial,()=>`[zag-js] Compound state "${i}" has child states but no "initial" property`),a.initial in s||Fi(`[zag-js] Compound state "${i}" has initial "${String(a.initial)}" which is not a child state`);for(let[l,c]of Object.entries(s)){if(!c)continue;let d=Gc(i,l);r(d,c)}}};for(let[i,a]of Object.entries(e.states))a&&r(i,a);return{index:t,idIndex:n}}function qa(e){let t=Np.get(e);if(t)return t;let{index:n,idIndex:r}=fI(e);return Np.set(e,n),eh.set(e,r),n}function mI(e,t){var n;return qa(e),(n=eh.get(e))==null?void 0:n.get(t)}function td(e){return e?String(e).split(ur).filter(Boolean):[]}function ys(e,t){if(!t)return[];let n=qa(e),r=td(t),i=[],a=[];for(let o of r){a.push(o);let s=Uc(a),l=n.get(s);if(!l)break;i.push({path:s,state:l})}return i}function La(e,t){let n=qa(e),r=td(t);if(!r.length)return t;let i=[];for(let s of r){i.push(s);let l=Uc(i);if(!n.has(l))return t}let a=Uc(i),o=n.get(a);for(;o!=null&&o.initial;){let s=`${a}${ur}${o.initial}`,l=n.get(s);if(!l)break;a=s,o=l}return a}function Lp(e,t){return qa(e).has(t)}function Dp(e,t,n){let r=String(t);if(th(r)){let i=hI(r),a=mI(e,i);return nn(a,()=>`[zag-js] Unknown state id: "${i}"`),La(e,a)}if(pI(r)&&n){let i=Gc(n,r.slice(1));return La(e,i)}if(!gI(r)&&n){let i=td(n);for(let a=i.length-1;a>=1;a--){let o=i.slice(0,a).join(ur),s=Gc(o,r);if(Lp(e,s))return La(e,s)}if(Lp(e,r))return La(e,r)}return La(e,r)}function vI(e,t,n){var a,o;let r=ys(e,t);for(let s=r.length-1;s>=0;s--){let l=(a=r[s])==null?void 0:a.state.on,c=l==null?void 0:l[n];if(c)return{transitions:c,source:(o=r[s])==null?void 0:o.path}}let i=e.on;return{transitions:i==null?void 0:i[n],source:void 0}}function yI(e,t,n,r){var d,g,p,u;let i=t?ys(e,t):[],a=ys(e,n),o=0;for(;o{var i;return(i=r.state.tags)==null?void 0:i.includes(n)})}function we(){return{and:(...e)=>function(n){return e.every(r=>n.guard(r))},or:(...e)=>function(n){return e.some(r=>n.guard(r))},not:e=>function(n){return!n.guard(e)}}}function te(e){return qa(e),e}function Mt(){return{guards:we(),createMachine:e=>te(e),choose:e=>function({choose:n}){var r;return(r=n(e))==null?void 0:r.actions}}}function nh(e){if(!e)return!1;try{return e.selectionStart===0&&e.selectionEnd===0}catch(t){return e.value===""}}function _i(e){if(e)try{if(e.ownerDocument.activeElement!==e)return;let t=e.value.length;e.setSelectionRange(t,t)}catch(t){}}function VI(e){return["html","body","#document"].includes(rh(e))}function bs(e){if(!e)return!1;let t=e.getRootNode();return gr(t)===e}function $t(e){if(e==null||!Pe(e))return!1;try{return ah(e)&&e.selectionStart!=null||xI.test(e.localName)||e.isContentEditable||e.getAttribute("contenteditable")==="true"||e.getAttribute("contenteditable")===""}catch(t){return!1}}function ge(e,t){var r;if(!e||!t||!Pe(e)||!ih(t))return!1;if(Pe(t)&&e===t||e.contains(t))return!0;let n=(r=t.getRootNode)==null?void 0:r.call(t);if(n&&zr(n)){let i=t;for(;i;){if(e===i)return!0;i=i.parentNode||i.host}}return!1}function Ge(e){var t;return Wa(e)?e:OI(e)?e.document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function RI(e){return Ge(e).documentElement}function ye(e){var t,n,r;return zr(e)?ye(e.host):Wa(e)?(t=e.defaultView)!=null?t:window:Pe(e)&&(r=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?r:window}function gr(e){let t=e.activeElement;for(;t!=null&&t.shadowRoot;){let n=t.shadowRoot.activeElement;if(!n||n===t)break;t=n}return t}function kI(e){if(rh(e)==="html")return e;let t=e.assignedSlot||e.parentNode||zr(e)&&e.host||RI(e);return zr(t)?t.host:t}function nd(e){var n;let t;try{if(t=e.getRootNode({composed:!0}),Wa(t)||zr(t))return t}catch(r){}return(n=e.ownerDocument)!=null?n:document}function pt(e){return Bc.has(e)||Bc.set(e,ye(e).getComputedStyle(e)),Bc.get(e)}function Vs(e,t){let n=new Set,r=nd(e),i=a=>{let o=a.querySelectorAll("[aria-controls]");for(let s of o){if(s.getAttribute("aria-expanded")!=="true")continue;let l=oh(s);for(let c of l){if(!c||n.has(c))continue;n.add(c);let d=r.getElementById(c);if(d){let g=d.getAttribute("role"),p=d.getAttribute("aria-modal")==="true";if(g&&NI(g)&&!p&&(d===t||d.contains(t)||i(d)))return!0}}}return!1};return i(e)}function id(e,t){let n=nd(e),r=new Set,i=a=>{let o=a.querySelectorAll("[aria-controls]");for(let s of o){if(s.getAttribute("aria-expanded")!=="true")continue;let l=oh(s);for(let c of l){if(!c||r.has(c))continue;r.add(c);let d=n.getElementById(c);if(d){let g=d.getAttribute("role"),p=d.getAttribute("aria-modal")==="true";g&&rd.has(g)&&!p&&(t(d),i(d))}}}};i(e)}function sh(e){let t=new Set;return id(e,n=>{e.contains(n)||t.add(n)}),Array.from(t)}function LI(e){let t=e.getAttribute("role");return!!(t&&rd.has(t))}function DI(e){return e.hasAttribute("aria-controls")&&e.getAttribute("aria-expanded")==="true"}function lh(e){var t;return DI(e)?!0:!!((t=e.querySelector)!=null&&t.call(e,'[aria-controls][aria-expanded="true"]'))}function ch(e){if(!e.id)return!1;let t=nd(e),n=CSS.escape(e.id),r=`[aria-controls~="${n}"][aria-expanded="true"], [aria-controls="${n}"][aria-expanded="true"]`;return!!(t.querySelector(r)&&LI(e))}function dh(e,t){let{type:n,quality:r=.92,background:i}=t;if(!e)throw new Error("[zag-js > getDataUrl]: Could not find the svg element");let a=ye(e),o=a.document,s=e.getBoundingClientRect(),l=e.cloneNode(!0);l.hasAttribute("viewBox")||l.setAttribute("viewBox",`0 0 ${s.width} ${s.height}`);let d=`\r -`+new a.XMLSerializer().serializeToString(l),g="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(d);if(n==="image/svg+xml")return Promise.resolve(g).then(S=>(l.remove(),S));let p=a.devicePixelRatio||1,u=o.createElement("canvas"),f=new a.Image;f.src=g,u.width=s.width*p,u.height=s.height*p;let m=u.getContext("2d");return(n==="image/jpeg"||i)&&(m.fillStyle=i||"white",m.fillRect(0,0,u.width,u.height)),new Promise(S=>{f.onload=()=>{m==null||m.drawImage(f,0,0,u.width,u.height),S(u.toDataURL(n,r)),l.remove()}})}function FI(){var t;let e=navigator.userAgentData;return(t=e==null?void 0:e.platform)!=null?t:navigator.platform}function MI(){let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function gh(e){let{selectionStart:t,selectionEnd:n,value:r}=e.currentTarget,i=e.data;return r.slice(0,t)+(i!=null?i:"")+r.slice(n)}function GI(e){var t,n,r,i;return(i=(t=e.composedPath)==null?void 0:t.call(e))!=null?i:(r=(n=e.nativeEvent)==null?void 0:n.composedPath)==null?void 0:r.call(n)}function ne(e){var n;let t=GI(e);return(n=t==null?void 0:t[0])!=null?n:e.target}function $n(e){let t=e.currentTarget;if(!t||!t.matches("a[href], button[type='submit'], input[type='submit']"))return!1;let r=e.button===1,i=xs(e);return r||i}function jr(e){let t=e.currentTarget;if(!t)return!1;let n=t.localName;return e.altKey?n==="a"||n==="button"&&t.type==="submit"||n==="input"&&t.type==="submit":!1}function Me(e){return Ot(e).isComposing||e.keyCode===229}function xs(e){return $i()?e.metaKey:e.ctrlKey}function ph(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}function hh(e){return e.pointerType===""&&e.isTrusted?!0:UI()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function me(e,t={}){var o;let{dir:n="ltr",orientation:r="horizontal"}=t,i=e.key;return i=(o=WI[i])!=null?o:i,n==="rtl"&&r==="horizontal"&&i in Mp&&(i=Mp[i]),i}function Ot(e){var t;return(t=e.nativeEvent)!=null?t:e}function Hn(e){return e.ctrlKey||e.metaKey?.1:KI.has(e.key)||e.shiftKey&&zI.has(e.key)?10:1}function et(e,t="client"){let n=qI(e)?e.touches[0]||e.changedTouches[0]:e;return{x:n[`${t}X`],y:n[`${t}Y`]}}function fh(e,t){var a;let{type:n="HTMLInputElement",property:r="value"}=t,i=ye(e)[n].prototype;return(a=Object.getOwnPropertyDescriptor(i,r))!=null?a:{}}function jI(e){if(e.localName==="input")return"HTMLInputElement";if(e.localName==="textarea")return"HTMLTextAreaElement";if(e.localName==="select")return"HTMLSelectElement"}function _e(e,t,n="value"){var i;if(!e)return;let r=jI(e);r&&((i=fh(e,{type:r,property:n}).set)==null||i.call(e,t)),e.setAttribute(n,t)}function ja(e,t){var r;if(!e)return;(r=fh(e,{type:"HTMLInputElement",property:"checked"}).set)==null||r.call(e,t),t?e.setAttribute("checked",""):e.removeAttribute("checked")}function Hi(e,t){let{value:n,bubbles:r=!0}=t;if(!e)return;let i=ye(e);if(!(e instanceof i.HTMLInputElement))return;_e(e,`${n}`);let a=new i.Event("input",{bubbles:r});e.dispatchEvent(Rs(a))}function Bi(e,t){let{checked:n,bubbles:r=!0}=t;if(!e)return;let i=ye(e);if(!(e instanceof i.HTMLInputElement))return;ja(e,n);let a=new i.Event("click",{bubbles:r});e.dispatchEvent(Rs(a))}function YI(e){return e.matches("textarea, input, select, button")}function XI(e,t){if(!e)return;let n=YI(e)?e.form:e.closest("form"),r=i=>{i.defaultPrevented||t()};return n==null||n.addEventListener("reset",r,{passive:!0}),()=>n==null?void 0:n.removeEventListener("reset",r)}function ZI(e,t){let n=e==null?void 0:e.closest("fieldset");if(!n)return;t(n.disabled);let r=ye(n),i=new r.MutationObserver(()=>t(n.disabled));return i.observe(n,{attributes:!0,attributeFilter:["disabled"]}),()=>i.disconnect()}function ht(e,t){if(!e)return;let{onFieldsetDisabledChange:n,onFormReset:r}=t,i=[XI(e,r),ZI(e,n)];return()=>i.forEach(a=>a==null?void 0:a())}function sd(e){return Object.prototype.hasOwnProperty.call(e,mh)}function Rs(e){return sd(e)||Object.defineProperty(e,mh,{value:!0}),e}function yh(e){let t=e.getAttribute("tabindex");return t?parseInt(t,10):NaN}function tT(e){return ah(e)&&e.type==="radio"}function nT(e){var a;if(!tT(e)||!e.name||e.checked)return!0;let t=`input[type="radio"][name="${CSS.escape(e.name)}"]`,n=(a=e.form)!=null?a:e.ownerDocument,r=Array.from(n.querySelectorAll(t)).filter(o=>o.form===e.form&&ut(o)),i=r.find(o=>o.checked);return i?i===e:r[0]===e}function rT(e,t){if(!t)return null;if(t===!0)return e.shadowRoot||null;let n=t(e);return(n===!0?e.shadowRoot:n)||null}function bh(e,t,n){let r=[...e],i=[...e],a=new Set,o=new Map;e.forEach((l,c)=>o.set(l,c));let s=0;for(;s{o.set(u,p+f)});for(let u=p+d.length;u{o.set(u,p+f)})}i.push(...d)}}return r}function ut(e){return!Pe(e)||e.closest("[inert]")?!1:e.matches(ks)&&AI(e)}function Bn(e,t={}){if(!e)return[];let{includeContainer:n,getShadowRoot:r}=t,i=Array.from(e.querySelectorAll(ks));n&&lr(e)&&i.unshift(e);let a=[];for(let o of i)if(lr(o)){if(vh(o)&&o.contentDocument){let s=o.contentDocument.body;a.push(...Bn(s,{getShadowRoot:r}));continue}a.push(o)}if(r){let o=bh(a,r,lr);return!o.length&&n?i:o}return!a.length&&n?i:a}function lr(e){return Pe(e)&&e.tabIndex>0?!0:!ut(e)||eT(e)?!1:nT(e)}function iT(e,t={}){let n=Bn(e,t),r=n[0]||null,i=n[n.length-1]||null;return[r,i]}function Ui(e){return e.tabIndex<0&&(JI.test(e.localName)||$t(e))&&!QI(e)?0:e.tabIndex}function hr(e){let{root:t,getInitialEl:n,filter:r,enabled:i=!0}=e;if(!i)return;let a=null;if(a||(a=typeof n=="function"?n():n),a||(a=t==null?void 0:t.querySelector("[data-autofocus],[autofocus]")),!a){let o=Bn(t);a=r?o.filter(r)[0]:o[0]}return a||t||void 0}function Ns(e){let t=e.currentTarget;if(!t)return!1;let[n,r]=iT(t);return!(bs(n)&&e.shiftKey||bs(r)&&!e.shiftKey||!n&&!r)}function B(e){let t=ld.create();return t.request(e),t.cleanup}function Yr(e){let t=new Set;function n(r){let i=globalThis.requestAnimationFrame(r);t.add(()=>globalThis.cancelAnimationFrame(i))}return n(()=>n(e)),function(){t.forEach(i=>i())}}function aT(e,t,n){let r=B(()=>{e.removeEventListener(t,i,!0),n()}),i=()=>{r(),n()};return e.addEventListener(t,i,{once:!0,capture:!0}),r}function oT(e,t){if(!e)return;let{attributes:n,callback:r}=t,i=e.ownerDocument.defaultView||window,a=new i.MutationObserver(o=>{for(let s of o)s.type==="attributes"&&s.attributeName&&n.includes(s.attributeName)&&r(s)});return a.observe(e,{attributes:!0,attributeFilter:n}),()=>a.disconnect()}function Ht(e,t){let{defer:n}=t,r=n?B:a=>a(),i=[];return i.push(r(()=>{let a=typeof e=="function"?e():e;i.push(oT(a,t))})),()=>{i.forEach(a=>a==null?void 0:a())}}function sT(e,t){let{callback:n}=t;if(!e)return;let r=e.ownerDocument.defaultView||window,i=new r.MutationObserver(n);return i.observe(e,{childList:!0,subtree:!0}),()=>i.disconnect()}function Ls(e,t){let{defer:n}=t,r=n?B:a=>a(),i=[];return i.push(r(()=>{let a=typeof e=="function"?e():e;i.push(sT(a,t))})),()=>{i.forEach(a=>a==null?void 0:a())}}function Gi(e){let t=()=>{let n=ye(e);e.dispatchEvent(new n.MouseEvent("click"))};BI()?aT(e,"keyup",t):queueMicrotask(t)}function Xa(e){let t=kI(e);return VI(t)?Ge(t).body:Pe(t)&&dd(t)?t:Xa(t)}function cd(e,t=[]){let n=Xa(e),r=n===e.ownerDocument.body,i=ye(n);return r?t.concat(i,i.visualViewport||[],dd(n)?n:[]):t.concat(n,cd(n,[]))}function dd(e){let t=ye(e),{overflow:n,overflowX:r,overflowY:i,display:a}=t.getComputedStyle(e);return lT.test(n+i+r)&&!cT.has(a)}function dT(e){return e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth}function Un(e,t){let i=t||{},{rootEl:n}=i,r=St(i,["rootEl"]);!e||!n||!dd(n)||!dT(n)||e.scrollIntoView(r)}function qi(e,t){let{left:n,top:r,width:i,height:a}=t.getBoundingClientRect(),o={x:e.x-n,y:e.y-r},s={x:Fp(o.x/i),y:Fp(o.y/a)};function l(c={}){let{dir:d="ltr",orientation:g="horizontal",inverted:p}=c,u=typeof p=="object"?p.x:p,f=typeof p=="object"?p.y:p;return g==="horizontal"?d==="rtl"||u?1-s.x:s.x:f?1-s.y:s.y}return{offset:o,percent:s,getPercentValue:l}}function Ph(e,t){let n=e.body,r="pointerLockElement"in e||"mozPointerLockElement"in e,i=()=>!!e.pointerLockElement;function a(){t==null||t(i())}function o(l){i()&&(t==null||t(!1)),console.error("PointerLock error occurred:",l),e.exitPointerLock()}if(!r)return;try{n.requestPointerLock()}catch(l){}let s=[ae(e,"pointerlockchange",a,!1),ae(e,"pointerlockerror",o,!1)];return()=>{s.forEach(l=>l()),e.exitPointerLock()}}function uT(e={}){let{target:t,doc:n}=e,r=n!=null?n:document,i=r.documentElement;return Ka()?(Di==="default"&&(qc=i.style.webkitUserSelect,i.style.webkitUserSelect="none"),Di="disabled"):t&&(ms.set(t,t.style.userSelect),t.style.userSelect="none"),()=>ud({target:t,doc:r})}function ud(e={}){let{target:t,doc:n}=e,i=(n!=null?n:document).documentElement;if(Ka()){if(Di!=="disabled")return;Di="restoring",setTimeout(()=>{Yr(()=>{Di==="restoring"&&(i.style.webkitUserSelect==="none"&&(i.style.webkitUserSelect=qc||""),qc="",Di="default")})},300)}else if(t&&ms.has(t)){let a=ms.get(t);t.style.userSelect==="none"&&(t.style.userSelect=a!=null?a:""),t.getAttribute("style")===""&&t.removeAttribute("style"),ms.delete(t)}}function Za(e={}){let o=e,{defer:t,target:n}=o,r=St(o,["defer","target"]),i=t?B:s=>s(),a=[];return a.push(i(()=>{let s=typeof n=="function"?n():n;a.push(uT(y(h({},r),{target:s})))})),()=>{a.forEach(s=>s==null?void 0:s())}}function pn(e,t){let{onPointerMove:n,onPointerUp:r}=t,i=s=>{let l=et(s),c=Math.sqrt(l.x**2+l.y**2),d=s.pointerType==="touch"?10:5;if(!(c{let l=et(s);r({point:l,event:s})},o=[ae(e,"pointermove",i,!1),ae(e,"pointerup",a,!1),ae(e,"pointercancel",a,!1),ae(e,"contextmenu",a,!1),Za({doc:e})];return()=>{o.forEach(s=>s())}}function Ds(e){let{pointerNode:t,keyboardNode:n=t,onPress:r,onPressStart:i,onPressEnd:a,isValidKey:o=w=>w.key==="Enter"}=e;if(!t)return Mn;let s=ye(t),l=Mn,c=Mn,d=Mn,g=w=>({point:et(w),event:w});function p(w){i==null||i(g(w))}function u(w){a==null||a(g(w))}let m=ae(t,"pointerdown",w=>{c();let P=ae(s,"pointerup",E=>{let R=ne(E);ge(t,R)?r==null||r(g(E)):a==null||a(g(E))},{passive:!r,once:!0}),v=ae(s,"pointercancel",u,{passive:!a,once:!0});c=Hc(P,v),bs(n)&&w.pointerType==="mouse"&&w.preventDefault(),p(w)},{passive:!i}),S=ae(n,"focus",T);l=Hc(m,S);function T(){let w=E=>{if(!o(E))return;let R=C=>{if(!o(C))return;let A=new s.PointerEvent("pointerup"),N=g(A);r==null||r(N),a==null||a(N)};c(),c=ae(n,"keyup",R);let x=new s.PointerEvent("pointerdown");p(x)},I=()=>{let E=new s.PointerEvent("pointercancel");u(E)},P=ae(n,"keydown",w),v=ae(n,"blur",I);d=Hc(P,v)}return()=>{l(),c(),d()}}function Oe(e,t){var n;return Array.from((n=e==null?void 0:e.querySelectorAll(t))!=null?n:[])}function fr(e,t){var n;return(n=e==null?void 0:e.querySelector(t))!=null?n:null}function pd(e,t,n=gd){return e.find(r=>n(r)===t)}function Ja(e,t,n=gd){let r=pd(e,t,n);return r?e.indexOf(r):-1}function mr(e,t,n=!0){let r=Ja(e,t);return r=n?(r+1)%e.length:Math.min(r+1,e.length-1),e[r]}function vr(e,t,n=!0){let r=Ja(e,t);return r===-1?n?e[e.length-1]:null:(r=n?(r-1+e.length)%e.length:Math.max(0,r-1),e[r])}function gT(e){let t=new WeakMap,n,r=new WeakMap,i=s=>n||(n=new s.ResizeObserver(l=>{for(let c of l){r.set(c.target,c);let d=t.get(c.target);if(d)for(let g of d)g(c)}}),n);return{observe:(s,l)=>{let c=t.get(s)||new Set;c.add(l),t.set(s,c);let d=ye(s);return i(d).observe(s,e),()=>{let g=t.get(s);g&&(g.delete(l),g.size===0&&(t.delete(s),i(d).unobserve(s)))}},unobserve:s=>{t.delete(s),n==null||n.unobserve(s)}}}function Sh(e){let t=e.getBoundingClientRect(),n=e.offsetWidth,r=e.offsetHeight,i=Math.round(t.width)!==n||Math.round(t.height)!==r,a=i?Math.round(t.width)/n:1,o=i?Math.round(t.height)/r:1;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}function mT(e,t,n,r=gd){let i=n?Ja(e,n,r):-1,a=n?II(e,i):e;return t.length===1&&(a=a.filter(s=>r(s)!==n)),a.find(s=>fT(hT(s),t))}function Ih(e,t,n){let r=e.getAttribute(t),i=r!=null;return r===n?Mn:(e.setAttribute(t,n),()=>{i?e.setAttribute(t,r):e.removeAttribute(t)})}function Xr(e,t){if(!e)return Mn;let n=Object.keys(t).reduce((r,i)=>(r[i]=e.style.getPropertyValue(i),r),{});return vT(n,t)?Mn:(Object.assign(e.style,t),()=>{Object.assign(e.style,n),e.style.length===0&&e.removeAttribute("style")})}function Th(e,t,n){if(!e)return Mn;let r=e.style.getPropertyValue(t);return r===n?Mn:(e.style.setProperty(t,n),()=>{e.style.setProperty(t,r),e.style.length===0&&e.removeAttribute("style")})}function vT(e,t){return Object.keys(e).every(n=>e[n]===t[n])}function yT(e,t){let{state:n,activeId:r,key:i,timeout:a=350,itemToId:o}=t,s=n.keysSoFar+i,c=s.length>1&&Array.from(s).every(f=>f===s[0])?s[0]:s,d=e.slice(),g=mT(d,c,r,o);function p(){clearTimeout(n.timer),n.timer=-1}function u(f){n.keysSoFar=f,p(),f!==""&&(n.timer=+setTimeout(()=>{u(""),p()},a))}return u(s),g}function bT(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}function ET(e,t,n){let{signal:r}=t;return[new Promise((o,s)=>{let l=setTimeout(()=>{s(new Error(`Timeout of ${n}ms exceeded`))},n);r.addEventListener("abort",()=>{clearTimeout(l),s(new DOMException("Promise aborted","AbortError"))}),e.then(c=>{r.aborted||(clearTimeout(l),o(c))}).catch(c=>{r.aborted||(clearTimeout(l),s(c))})}),()=>t.abort()]}function Ch(e,t){let{timeout:n,rootNode:r}=t,i=ye(r),a=Ge(r),o=new i.AbortController;return ET(new Promise(s=>{let l=e();if(l){s(l);return}let c=new i.MutationObserver(()=>{let d=e();d&&d.isConnected&&(c.disconnect(),s(d))});c.observe(a.body,{childList:!0,subtree:!0})}),o,n)}function PT(e){let t=()=>{var o,s;return(s=(o=e.getRootNode)==null?void 0:o.call(e))!=null?s:document},n=()=>Ge(t()),r=()=>{var o;return(o=n().defaultView)!=null?o:window},i=()=>gr(t()),a=o=>t().getElementById(o);return y(h({},e),{getRootNode:t,getDoc:n,getWin:r,getActiveElement:i,isActiveElement:bs,getById:a})}function ST(){if(typeof globalThis!="undefined")return globalThis;if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof global!="undefined")return global}function wh(e,t){let n=ST();return n?(n[e]||(n[e]=t()),n[e]):t()}function Fs(e={}){return RT(e)}function Ps(e,t,n){let r=Kr.get(e);Es()&&!r&&console.warn("Please use proxy object");let i,a=[],o=r[3],s=!1,c=o(d=>{if(a.push(d),n){t(a.splice(0));return}i||(i=Promise.resolve().then(()=>{i=void 0,s&&t(a.splice(0))}))});return s=!0,()=>{s=!1,c()}}function kT(e){let t=Kr.get(e);Es()&&!t&&console.warn("Please use proxy object");let[n,r,i]=t;return i(n,r())}function Ss(e){var a,o;let t=(a=e().value)!=null?a:e().defaultValue;e().debug&&console.log(`[bindable > ${e().debug}] initial`,t);let n=(o=e().isEqual)!=null?o:Object.is,r=Fs({value:t}),i=()=>e().value!==void 0;return{initial:t,ref:r,get(){return i()?e().value:r.value},set(s){var d,g;let l=i()?e().value:r.value,c=Qe(s)?s(l):s;e().debug&&console.log(`[bindable > ${e().debug}] setValue`,{next:c,prev:l}),i()||(r.value=c),n(c,l)||(g=(d=e()).onChange)==null||g.call(d,c,l)},invoke(s,l){var c,d;(d=(c=e()).onChange)==null||d.call(c,s,l)},hash(s){var l,c,d;return(d=(c=(l=e()).hash)==null?void 0:c.call(l,s))!=null?d:String(s)}}}function NT(e){let t={current:e};return{get(n){return t.current[n]},set(n,r){t.current[n]=r}}}function Oh(e,t){if(!Da(e)||!Da(t))return t===void 0?e:t;let n=h({},e);for(let r of Object.keys(t)){let i=t[r],a=e[r];i!==void 0&&(Da(a)&&Da(i)?n[r]=Oh(a,i):n[r]=i)}return n}function LT(e){return new Proxy({},{get(t,n){return n==="style"?r=>e({style:r}).style:e}})}function HT(e,t,n){let r=n||"default",i=hs.get(e);i||(i=new Map,hs.set(e,i));let a=i.get(r)||{},o=Object.keys(t),s=(m,S)=>{e.addEventListener(m.toLowerCase(),S)},l=(m,S)=>{e.removeEventListener(m.toLowerCase(),S)},c=m=>m.startsWith("on"),d=m=>!m.startsWith("on"),g=m=>s(m.substring(2),t[m]),p=m=>l(m.substring(2),t[m]),u=m=>{let S=t[m],T=a[m];if(S!==T){if(m==="class"){e.className=S!=null?S:"";return}if(Up.has(m)){e[m]=S!=null?S:"";return}if(typeof S=="boolean"&&!m.includes("aria-")){e.toggleAttribute(fs(e,m),S);return}if(m==="children"){e.innerHTML=S;return}if(S!=null){e.setAttribute(fs(e,m),S);return}e.removeAttribute(fs(e,m))}};for(let m in a)t[m]==null&&(m==="class"?e.className="":Up.has(m)?e[m]="":e.removeAttribute(fs(e,m)));return Object.keys(a).filter(c).forEach(m=>{l(m.substring(2),a[m])}),o.filter(c).forEach(g),o.filter(d).forEach(u),i.set(r,t),function(){o.filter(c).forEach(p);let S=hs.get(e);S&&(S.delete(r),S.size===0&&hs.delete(e))}}var XS,V,Ie,G,O,Ye,_a,ZS,JS,Se,QS,Gp,eI,dn,tI,jc,qp,Dt,en,nI,Tt,Ft,Yc,gt,Ts,tn,Rp,rI,Ce,cr,zp,jp,un,Cs,Ua,Qe,Yp,at,iI,Xp,aI,Da,oI,sI,lI,Fn,Jc,cI,Qc,Ct,Ga,ed,kp,Jp,ur,Qp,Np,eh,Fa,_c,PI,SI,$c,Fp,II,Hc,Mn,ws,Os,b,se,TI,CI,wI,Pe,Wa,OI,rh,ih,zr,ah,_t,AI,xI,Bc,rd,NI,oh,As,ad,uh,_I,od,$I,HI,Ka,za,$i,wt,BI,UI,fe,pr,Be,qI,WI,Mp,KI,zI,ae,mh,vh,JI,QI,eT,ks,Ya,ld,lT,cT,Di,qc,ms,gd,Gn,pT,hT,fT,ft,mt,vs,IT,TT,CT,wT,Wc,_p,Es,v1,OT,$p,Kc,VT,AT,Hp,Kr,xT,RT,Y,Bp,DT,FT,MT,hs,Up,_T,$T,fs,X,z,Li,BT,oe=ee(()=>{"use strict";XS=["ltr","rtl"];V=(e,t,n)=>{let r=e.dataset[t];if(r!==void 0&&(!n||n.includes(r)))return r},Ie=(e,t)=>{let n=e.dataset[t];if(typeof n=="string")return n.split(",").map(r=>r.trim()).filter(r=>r.length>0)},G=(e,t,n)=>{let r=e.dataset[t];if(r===void 0)return;let i=Number(r);if(!Number.isNaN(i))return n&&!n.includes(i)?0:i},O=(e,t)=>{let r=`data-${t.replace(/([A-Z])/g,"-$1").toLowerCase()}`;if(!e.hasAttribute(r))return!1;let i=e.getAttribute(r);return!(i==="false"||i==="0")},Ye=(e,t)=>{let n=e.dataset[t];return n==="true"?!0:n==="false"?!1:void 0};_a=(e,t="element")=>e!=null&&e.id?e.id:`${t}-${Math.random().toString(36).substring(2,9)}`;ZS=Object.defineProperty,JS=(e,t,n)=>t in e?ZS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Se=(e,t,n)=>JS(e,typeof t!="symbol"?t+"":t,n),QS=Object.defineProperty,Gp=e=>{throw TypeError(e)},eI=(e,t,n)=>t in e?QS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dn=(e,t,n)=>eI(e,typeof t!="symbol"?t+"":t,n),tI=(e,t,n)=>t.has(e)||Gp("Cannot "+n),jc=(e,t,n)=>(tI(e,t,"read from private field"),n?n.call(e):t.get(e)),qp=(e,t,n)=>t.has(e)?Gp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);Dt=e=>e[0],en=e=>e[e.length-1],nI=(e,t)=>e.indexOf(t)!==-1,Tt=(e,...t)=>e.concat(t),Ft=(e,...t)=>e.filter(n=>!t.includes(n)),Yc=(e,t)=>e.filter((n,r)=>r!==t),gt=e=>Array.from(new Set(e)),Ts=(e,t)=>{let n=new Set(t);return e.filter(r=>!n.has(r))},tn=(e,t)=>nI(e,t)?Ft(e,t):Tt(e,t);Rp=e=>(e==null?void 0:e.constructor.name)==="Array",rI=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n{if(Object.is(e,t))return!0;if(e==null&&t!=null||e!=null&&t==null)return!1;if(typeof(e==null?void 0:e.isEqual)=="function"&&typeof(t==null?void 0:t.isEqual)=="function")return e.isEqual(t);if(typeof e=="function"&&typeof t=="function")return e.toString()===t.toString();if(Rp(e)&&Rp(t))return rI(Array.from(e),Array.from(t));if(typeof e!="object"||typeof t!="object")return!1;let n=Object.keys(t!=null?t:Object.create(null)),r=n.length;for(let i=0;iArray.isArray(e),zp=e=>e===!0||e===!1,jp=e=>e!=null&&typeof e=="object",un=e=>jp(e)&&!cr(e),Cs=e=>typeof e=="number"&&!Number.isNaN(e),Ua=e=>typeof e=="string",Qe=e=>typeof e=="function",Yp=e=>e==null,at=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),iI=e=>Object.prototype.toString.call(e),Xp=Function.prototype.toString,aI=Xp.call(Object),Da=e=>{if(!jp(e)||iI(e)!="[object Object]"||lI(e))return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let n=at(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Xp.call(n)==aI},oI=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,sI=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,lI=e=>oI(e)||sI(e),Fn=(e,...t)=>{let n=typeof e=="function"?e(...t):e;return n!=null?n:void 0},Jc=e=>e,cI=e=>e(),Qc=()=>{},Ct=(...e)=>(...t)=>{e.forEach(function(n){n==null||n(...t)})},Ga=(()=>{let e=0;return()=>(e++,e.toString(36))})();ed=(e,t)=>{var n;try{return e()}catch(r){return r instanceof Error&&((n=Error.captureStackTrace)==null||n.call(Error,r,ed)),t==null?void 0:t()}};kp=e=>String.fromCharCode(e+(e>25?39:97));Jp=e=>dI(uI(5381,e)>>>0);ur=".",Qp="#",Np=new WeakMap,eh=new WeakMap;Fa=(e=>(e.NotStarted="Not Started",e.Started="Started",e.Stopped="Stopped",e))(Fa||{}),_c="__init__",PI=Object.defineProperty,SI=(e,t,n)=>t in e?PI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$c=(e,t,n)=>SI(e,typeof t!="symbol"?t+"":t,n);Fp=e=>Math.max(0,Math.min(1,e)),II=(e,t)=>e.map((n,r)=>e[(Math.max(t,0)+r)%e.length]),Hc=(...e)=>t=>e.reduce((n,r)=>r(n),t),Mn=()=>{},ws=e=>typeof e=="object"&&e!==null,Os=2147483647,b=e=>e?"":void 0,se=e=>e?"true":void 0,TI=1,CI=9,wI=11,Pe=e=>ws(e)&&e.nodeType===TI&&typeof e.nodeName=="string",Wa=e=>ws(e)&&e.nodeType===CI,OI=e=>ws(e)&&e===e.window,rh=e=>Pe(e)?e.localName||"":"#document";ih=e=>ws(e)&&e.nodeType!==void 0,zr=e=>ih(e)&&e.nodeType===wI&&"host"in e,ah=e=>Pe(e)&&e.localName==="input",_t=e=>!!(e!=null&&e.matches("a[href]")),AI=e=>Pe(e)?e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0:!1;xI=/(textarea|select)/;Bc=new WeakMap;rd=new Set(["menu","listbox","dialog","grid","tree","region"]),NI=e=>rd.has(e),oh=e=>{var t;return((t=e.getAttribute("aria-controls"))==null?void 0:t.split(" "))||[]};As=()=>typeof document!="undefined";ad=e=>As()&&e.test(FI()),uh=e=>As()&&e.test(MI()),_I=e=>As()&&e.test(navigator.vendor),od=()=>As()&&!!navigator.maxTouchPoints,$I=()=>ad(/^iPhone/i),HI=()=>ad(/^iPad/i)||$i()&&navigator.maxTouchPoints>1,Ka=()=>$I()||HI(),za=()=>$i()||Ka(),$i=()=>ad(/^Mac/i),wt=()=>za()&&_I(/apple/i),BI=()=>uh(/Firefox/i),UI=()=>uh(/Android/i);fe=e=>e.button===0,pr=e=>e.button===2||$i()&&e.ctrlKey&&e.button===0,Be=e=>e.ctrlKey||e.altKey||e.metaKey,qI=e=>"touches"in e&&e.touches.length>0,WI={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},Mp={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};KI=new Set(["PageUp","PageDown"]),zI=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);ae=(e,t,n,r)=>{let i=typeof e=="function"?e():e;return i==null||i.addEventListener(t,n,r),()=>{i==null||i.removeEventListener(t,n,r)}};mh=Symbol.for("zag.changeEvent");vh=e=>Pe(e)&&e.tagName==="IFRAME",JI=/^(audio|video|details)$/;QI=e=>!Number.isNaN(yh(e)),eT=e=>yh(e)<0;ks="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type",Ya=(e,t={})=>{if(!e)return[];let{includeContainer:n=!1,getShadowRoot:r}=t,i=Array.from(e.querySelectorAll(ks));(n==!0||n=="if-empty"&&i.length===0)&&Pe(e)&&ut(e)&&i.unshift(e);let o=[];for(let s of i)if(ut(s)){if(vh(s)&&s.contentDocument){let l=s.contentDocument.body;o.push(...Ya(l,{getShadowRoot:r}));continue}o.push(s)}return r?bh(o,r,ut):o};ld=class Eh{constructor(){$c(this,"id",null),$c(this,"fn_cleanup"),$c(this,"cleanup",()=>{this.cancel()})}static create(){return new Eh}request(t){this.cancel(),this.id=globalThis.requestAnimationFrame(()=>{this.id=null,this.fn_cleanup=t==null?void 0:t()})}cancel(){var t;this.id!==null&&(globalThis.cancelAnimationFrame(this.id),this.id=null),(t=this.fn_cleanup)==null||t.call(this),this.fn_cleanup=void 0}isActive(){return this.id!==null}};lT=/auto|scroll|overlay|hidden|clip/,cT=new Set(["inline","contents"]);Di="default",qc="",ms=new WeakMap;gd=e=>e.id;Gn=gT({box:"border-box"});pT=e=>e.split("").map(t=>{let n=t.charCodeAt(0);return n>0&&n<128?t:n>=128&&n<=255?`/x${n.toString(16)}`.replace("/","\\"):""}).join("").trim(),hT=e=>{var t,n,r;return pT((r=(n=(t=e.dataset)==null?void 0:t.valuetext)!=null?n:e.textContent)!=null?r:"")},fT=(e,t)=>e.trim().toLowerCase().startsWith(t.toLowerCase());ft=Object.assign(yT,{defaultOptions:{keysSoFar:"",timer:-1},isValidEvent:bT});mt={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"};vs=wh("__zag__refSet",()=>new WeakSet),IT=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,TT=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,CT=e=>typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeName=="string",wT=e=>IT(e)||TT(e)||CT(e),Wc=e=>e!==null&&typeof e=="object",_p=e=>Wc(e)&&!vs.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!wT(e)&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer)&&!(e instanceof Promise)&&!(e instanceof File)&&!(e instanceof Blob)&&!(e instanceof AbortController),Es=()=>!0,v1=Symbol(),OT=Symbol(),$p=Object.getPrototypeOf,Kc=new WeakMap,VT=e=>e&&(Kc.has(e)?Kc.get(e):$p(e)===Object.prototype||$p(e)===Array.prototype),AT=e=>VT(e)&&e[OT]||null,Hp=(e,t=!0)=>{Kc.set(e,t)},Kr=wh("__zag__proxyStateMap",()=>new WeakMap),xT=(e=Object.is,t=(s,l)=>new Proxy(s,l),n=new WeakMap,r=(s,l)=>{let c=n.get(s);if((c==null?void 0:c[0])===l)return c[1];let d=Array.isArray(s)?[]:Object.create(Object.getPrototypeOf(s));return Hp(d,!0),n.set(s,[l,d]),Reflect.ownKeys(s).forEach(g=>{let p=Reflect.get(s,g);vs.has(p)?(Hp(p,!1),d[g]=p):Kr.has(p)?d[g]=kT(p):d[g]=p}),Object.freeze(d)},i=new WeakMap,a=[1,1],o=s=>{if(!Wc(s))throw new Error("object required");let l=i.get(s);if(l)return l;let c=a[0],d=new Set,g=(R,x=++a[0])=>{c!==x&&(c=x,d.forEach(C=>C(R,x)))},p=a[1],u=(R=++a[1])=>(p!==R&&!d.size&&(p=R,m.forEach(([x])=>{let C=x[1](R);C>c&&(c=C)})),c),f=R=>(x,C)=>{let A=[...x];A[1]=[R,...A[1]],g(A,C)},m=new Map,S=(R,x)=>{if(Es()&&m.has(R))throw new Error("prop listener already exists");if(d.size){let C=x[3](f(R));m.set(R,[x,C])}else m.set(R,[x])},T=R=>{var C;let x=m.get(R);x&&(m.delete(R),(C=x[1])==null||C.call(x))},w=R=>(d.add(R),d.size===1&&m.forEach(([C,A],N)=>{if(Es()&&A)throw new Error("remove already exists");let k=C[3](f(N));m.set(N,[C,k])}),()=>{d.delete(R),d.size===0&&m.forEach(([C,A],N)=>{A&&(A(),m.set(N,[C]))})}),I=Array.isArray(s)?[]:Object.create(Object.getPrototypeOf(s)),v=t(I,{deleteProperty(R,x){let C=Reflect.get(R,x);T(x);let A=Reflect.deleteProperty(R,x);return A&&g(["delete",[x],C]),A},set(R,x,C,A){var K;let N=Reflect.has(R,x),k=Reflect.get(R,x,A);if(N&&(e(k,C)||i.has(C)&&e(k,i.get(C))))return!0;T(x),Wc(C)&&(C=AT(C)||C);let L=C;if(!((K=Object.getOwnPropertyDescriptor(R,x))!=null&&K.set)){!Kr.has(C)&&_p(C)&&(L=Fs(C));let J=!vs.has(L)&&Kr.get(L);J&&S(x,J)}return Reflect.set(R,x,L,A),g(["set",[x],C,k]),!0}});i.set(s,v);let E=[I,u,r,w];return Kr.set(v,E),Reflect.ownKeys(s).forEach(R=>{let x=Object.getOwnPropertyDescriptor(s,R);x.get||x.set?Object.defineProperty(I,R,x):v[R]=s[R]}),v})=>[o,Kr,vs,e,t,_p,n,r,i,a],[RT]=xT();Ss.cleanup=e=>{};Ss.ref=e=>{let t=e;return{get:()=>t,set:n=>{t=n}}};Y=class{constructor(e,t={}){var g,p,u;Se(this,"machine",e),Se(this,"scope"),Se(this,"context"),Se(this,"prop"),Se(this,"state"),Se(this,"refs"),Se(this,"computed"),Se(this,"event",{type:""}),Se(this,"previousEvent",{type:""}),Se(this,"effects",new Map),Se(this,"transition",null),Se(this,"cleanups",[]),Se(this,"subscriptions",[]),Se(this,"userPropsRef"),Se(this,"getEvent",()=>y(h({},this.event),{current:()=>this.event,previous:()=>this.previousEvent})),Se(this,"getState",()=>y(h({},this.state),{matches:(...f)=>f.some(m=>bI(this.state.get(),m)),hasTag:f=>EI(this.machine,this.state.get(),f)})),Se(this,"debug",(...f)=>{this.machine.debug&&console.log(...f)}),Se(this,"notify",()=>{this.publish()}),Se(this,"send",f=>{this.status===Fa.Started&&queueMicrotask(()=>{var E;if(!f)return;this.previousEvent=this.event,this.event=f,this.debug("send",f);let m=this.state.get(),S=f.type,{transitions:T,source:w}=vI(this.machine,m,S),I=this.choose(T);if(!I)return;this.transition=I;let P=Dp(this.machine,(E=I.target)!=null?E:m,w);this.debug("transition",I),P!==m?this.state.set(P):I.reenter?this.state.invoke(m,m):this.action(I.actions)})}),Se(this,"action",f=>{let m=Qe(f)?f(this.getParams()):f;if(!m)return;let S=m.map(T=>{var I,P;let w=(P=(I=this.machine.implementations)==null?void 0:I.actions)==null?void 0:P[T];return w||It(`[zag-js] No implementation found for action "${JSON.stringify(T)}"`),w});for(let T of S)T==null||T(this.getParams())}),Se(this,"guard",f=>{var m,S;return Qe(f)?f(this.getParams()):(S=(m=this.machine.implementations)==null?void 0:m.guards)==null?void 0:S[f](this.getParams())}),Se(this,"effect",f=>{let m=Qe(f)?f(this.getParams()):f;if(!m)return;let S=m.map(w=>{var P,v;let I=(v=(P=this.machine.implementations)==null?void 0:P.effects)==null?void 0:v[w];return I||It(`[zag-js] No implementation found for effect "${JSON.stringify(w)}"`),I}),T=[];for(let w of S){let I=w==null?void 0:w(this.getParams());I&&T.push(I)}return()=>T.forEach(w=>w==null?void 0:w())}),Se(this,"choose",f=>$a(f).find(m=>{let S=!m.guard;return Ua(m.guard)?S=!!this.guard(m.guard):Qe(m.guard)&&(S=m.guard(this.getParams())),S})),Se(this,"subscribe",f=>(this.subscriptions.push(f),()=>{let m=this.subscriptions.indexOf(f);m>-1&&this.subscriptions.splice(m,1)})),Se(this,"status",Fa.NotStarted),Se(this,"publish",()=>{this.callTrackers(),this.subscriptions.forEach(f=>f(this.service))}),Se(this,"trackers",[]),Se(this,"setupTrackers",()=>{var f,m;(m=(f=this.machine).watch)==null||m.call(f,this.getParams())}),Se(this,"callTrackers",()=>{this.trackers.forEach(({deps:f,fn:m})=>{let S=f.map(T=>T());Ce(m.prev,S)||(m(),m.prev=S)})}),Se(this,"getParams",()=>({state:this.getState(),context:this.context,event:this.getEvent(),prop:this.prop,send:this.send,action:this.action,guard:this.guard,track:(f,m)=>{m.prev=f.map(S=>S()),this.trackers.push({deps:f,fn:m})},refs:this.refs,computed:this.computed,flush:cI,scope:this.scope,choose:this.choose})),this.userPropsRef={current:t};let{id:n,ids:r,getRootNode:i}=Fn(t);this.scope=PT({id:n,ids:r,getRootNode:i});let a=f=>{var T,w;let m=Fn(this.userPropsRef.current);return((w=(T=e.props)==null?void 0:T.call(e,{props:_n(m),scope:this.scope}))!=null?w:m)[f]};this.prop=a;let o=(g=e.context)==null?void 0:g.call(e,{prop:a,bindable:Ss,scope:this.scope,flush(f){queueMicrotask(f)},getContext(){return s},getComputed(){return l},getRefs(){return c},getEvent:this.getEvent.bind(this)});o&&Object.values(o).forEach(f=>{let m=Ps(f.ref,()=>this.notify());this.cleanups.push(m)});let s={get(f){return o==null?void 0:o[f].get()},set(f,m){o==null||o[f].set(m)},initial(f){return o==null?void 0:o[f].initial},hash(f){let m=o==null?void 0:o[f].get();return o==null?void 0:o[f].hash(m)}};this.context=s;let l=f=>(nn(e.computed,()=>"[zag-js] No computed object found on machine"),e.computed[f]({context:s,event:this.getEvent(),prop:a,refs:this.refs,scope:this.scope,computed:l}));this.computed=l;let c=NT((u=(p=e.refs)==null?void 0:p.call(e,{prop:a,context:s}))!=null?u:{});this.refs=c;let d=Ss(()=>({defaultValue:Dp(e,e.initialState({prop:a})),onChange:(f,m)=>{var w,I;let{exiting:S,entering:T}=yI(this.machine,m,f,(w=this.transition)==null?void 0:w.reenter);if(S.forEach(P=>{let v=this.effects.get(P.path);v==null||v(),this.effects.delete(P.path)}),S.forEach(P=>{var v;this.action((v=P.state)==null?void 0:v.exit)}),this.action((I=this.transition)==null?void 0:I.actions),T.forEach(P=>{var E;let v=this.effect((E=P.state)==null?void 0:E.effects);v&&this.effects.set(P.path,v)}),m===_c){this.action(e.entry);let P=this.effect(e.effects);P&&this.effects.set(_c,P)}T.forEach(P=>{var v;this.action((v=P.state)==null?void 0:v.entry)})}}));this.state=d,this.cleanups.push(Ps(this.state.ref,()=>this.notify()))}updateProps(e){let t=this.userPropsRef.current;this.userPropsRef.current=()=>{let n=Fn(t),r=Fn(e);return Oh(n,r)},this.notify()}start(){this.status=Fa.Started,this.debug("initializing..."),this.state.invoke(this.state.initial,_c),this.setupTrackers()}stop(){this.effects.forEach(e=>e==null?void 0:e()),this.effects.clear(),this.transition=null,this.action(this.machine.exit),this.cleanups.forEach(e=>e()),this.cleanups=[],this.subscriptions=[],this.status=Fa.Stopped,this.debug("unmounting...")}get service(){return{state:this.getState(),send:this.send,context:this.context,prop:this.prop,scope:this.scope,refs:this.refs,computed:this.computed,event:this.getEvent(),getStatus:()=>this.status}}};Bp={onFocus:"onFocusin",onBlur:"onFocusout",onChange:"onInput",onDoubleClick:"onDblclick",htmlFor:"for",className:"class",defaultValue:"value",defaultChecked:"checked"},DT=new Set(["viewBox","preserveAspectRatio"]),FT=e=>{let t="";for(let n in e){let r=e[n];r!=null&&(n.startsWith("--")||(n=n.replace(/[A-Z]/g,i=>`-${i.toLowerCase()}`)),t+=`${n}:${r};`)}return t},MT=LT(e=>Object.entries(e).reduce((t,[n,r])=>{if(r===void 0)return t;if(n in Bp&&(n=Bp[n]),n==="style"&&typeof r=="object")return t.style=FT(r),t;let i=DT.has(n)?n:n.toLowerCase();return t[i]=r,t},{})),hs=new WeakMap,Up=new Set(["value","checked","selected"]),_T=new Set(["viewBox","preserveAspectRatio","clipPath","clipRule","fillRule","strokeWidth","strokeLinecap","strokeLinejoin","strokeDasharray","strokeDashoffset","strokeMiterlimit"]),$T=e=>e.tagName==="svg"||e.namespaceURI==="http://www.w3.org/2000/svg",fs=(e,t)=>$T(e)&&_T.has(t)?t:t.toLowerCase();X=class{constructor(e,t,n){Q(this,"el");Q(this,"doc");Q(this,"machine");Q(this,"api");Q(this,"init",()=>{try{this.machine.start(),this.render()}finally{this.el.removeAttribute("data-loading")}this.machine.subscribe(()=>{this.api=this.initApi(),this.render()})});Q(this,"destroy",()=>{this.el.removeAttribute("data-loading"),this.machine.stop()});Q(this,"spreadProps",(e,t)=>{HT(e,t,this.machine.scope.id)});if(!e)throw new Error("Root element not found");this.el=e,this.doc=document,n==null||n(this),this.machine=this.initMachine(t),this.api=this.initApi()}updateProps(e){this.machine.updateProps(e)}zagConnect(e){return e(this.machine.service,MT)}},z=(e,t=[])=>({parts:(...n)=>{if(BT(t))return z(e,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>z(e,[...t,...n]),omit:(...n)=>z(e,t.filter(r=>!n.includes(r))),rename:n=>z(n,t),keys:()=>t,build:()=>[...new Set(t)].reduce((n,r)=>Object.assign(n,{[r]:{selector:[`&[data-scope="${Li(e)}"][data-part="${Li(r)}"]`,`& [data-scope="${Li(e)}"][data-part="${Li(r)}"]`].join(", "),attrs:{"data-scope":Li(e),"data-part":Li(r)}}}),{})}),Li=e=>e.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),BT=e=>e.length===0});function fd(e,t,n){let r=e.getAttribute(t);if(r===null)throw new Error(`[corex] missing ${n} on #${e.id}`);return r}function yr(e,t,n){let r=fd(e,t,n),i=parseFloat(r);if(Number.isNaN(i))throw new Error(`[corex] invalid ${n} on #${e.id}`);return i}function md(e){return{duration:yr(e,"data-anim-height-duration","data-anim-height-duration"),easing:fd(e,"data-anim-height-easing","data-anim-height-easing"),opacityStart:yr(e,"data-anim-height-opacity-start","data-anim-height-opacity-start"),opacityEnd:yr(e,"data-anim-height-opacity-end","data-anim-height-opacity-end"),blockInteraction:Ye(e,"animHeightBlockInteraction")!==!1}}function vd(e){return{duration:yr(e,"data-anim-scale-duration","data-anim-scale-duration"),easing:fd(e,"data-anim-scale-easing","data-anim-scale-easing"),opacityStart:yr(e,"data-anim-scale-opacity-start","data-anim-scale-opacity-start"),opacityEnd:yr(e,"data-anim-scale-opacity-end","data-anim-scale-opacity-end"),scaleStart:yr(e,"data-anim-transform-scale-start","data-anim-transform-scale-start"),scaleEnd:yr(e,"data-anim-transform-scale-end","data-anim-transform-scale-end"),blockInteraction:Ye(e,"animScaleBlockInteraction")!==!1}}function Vh(e){var n;let t=((n=Qa.get(e))!=null?n:0)+1;Qa.set(e,t),t===1&&(e.style.pointerEvents="none")}function Ah(e){var n;let t=((n=Qa.get(e))!=null?n:0)-1;t<=0?(Qa.delete(e),e.style.removeProperty("pointer-events")):Qa.set(e,t)}function UT(e,t,n){let r=e.dataset.part==="backdrop",i=(n==null?void 0:n.scale)!==!1&&!r&&(t.scaleStart!==t.scaleEnd||t.scaleStart!==1||t.scaleEnd!==1);e.style.opacity=String(t.opacityStart),i?e.style.transform=`scale(${t.scaleStart})`:e.style.removeProperty("transform")}function GT(e,t){e.style.opacity=String(t.opacityStart),e.style.height="0px",e.style.overflow="hidden",e.style.removeProperty("transform")}function Zr(e){let t=h({},e);return delete t.hidden,t}function xh(e){e.style.opacity="",e.style.height="",e.style.overflow="",e.style.removeProperty("transform")}function qT(e,t,n){e.querySelectorAll(t).forEach(r=>{r.dataset.state==="open"?xh(r):GT(r,n)})}function WT(e,t,n,r){e.querySelectorAll(t).forEach(i=>{i.dataset.state==="open"?xh(i):UT(i,n,r==null?void 0:r(i))})}function Rh(e){let{rootEl:t,selector:n,opts:r,isOpen:i,wasOpen:a}=e,o=r.blockInteraction?t:void 0;t.querySelectorAll(n).forEach(s=>{let l=a?a(s):s.dataset.state==="open",c=i(s);l!==c&&KT(s,c,r,o)})}function Vt(e){return e.dataset.animation==="js"}function hd(e,t){return!!e&&t.includes(e)}function yd(e){return e.dataset.value}function kh(e){return t=>{var n;return(n=t.closest(e))==null?void 0:n.dataset.value}}function eo(e){let{el:t,selector:n,prevOpen:r,nextOpen:i,resolveValue:a}=e;Vt(t)&&Rh({rootEl:t,selector:n,opts:md(t),wasOpen:o=>hd(a(o),r),isOpen:o=>hd(a(o),i)})}function Nh(e){let{el:t,selector:n,openValues:r,resolveValue:i}=e;Vt(t)&&Rh({rootEl:t,selector:n,opts:md(t),isOpen:a=>hd(i(a),r)})}function Ms(e,t){Vt(e)&&qT(e,t,md(e))}function Lh(e,t,n){Vt(e)&&WT(e,t,vd(e),n)}function KT(e,t,n,r){e.getAnimations().forEach(p=>p.cancel());let i=t?n.opacityStart:n.opacityEnd,a=t?n.opacityEnd:n.opacityStart;e.style.overflow="hidden",e.style.height="auto";let o=`${e.scrollHeight}px`;e.style.height=t?"0px":o;let s={opacity:i,height:t?"0px":o},l={opacity:a,height:t?o:"0px"};r&&n.blockInteraction&&Vh(r);let c=e.animate([s,l],{duration:n.duration*1e3,easing:n.easing,fill:"forwards"}),d=!1,g=()=>{d||(d=!0,c.cancel(),r&&n.blockInteraction&&Ah(r),t?(e.style.height="auto",e.style.opacity="",e.style.overflow=""):(e.style.height="0px",e.style.opacity=String(n.opacityStart),e.style.overflow="hidden"))};return c.onfinish=()=>{g()},c.oncancel=()=>{g()},c}function bd(e,t,n,r){e.getAnimations().forEach(m=>m.cancel());let i=e.dataset.part==="backdrop",a=!i&&(n.scaleStart!==n.scaleEnd||n.scaleStart!==1||n.scaleEnd!==1),o=t?n.opacityStart:n.opacityEnd,s=t?n.opacityEnd:n.opacityStart,l=t?n.scaleStart:n.scaleEnd,c=t?n.scaleEnd:n.scaleStart,d={opacity:o},g={opacity:s};a&&(d.transform=`scale(${l})`,g.transform=`scale(${c})`),r&&n.blockInteraction&&Vh(r);let p=e.animate([d,g],{duration:n.duration*1e3,easing:n.easing,fill:"forwards"}),u=!1,f=()=>{u||(u=!0,p.cancel(),r&&n.blockInteraction&&Ah(r),t?(e.style.opacity="",e.style.removeProperty("transform")):(e.style.opacity=String(n.opacityStart),i?e.style.removeProperty("transform"):a?e.style.transform=`scale(${n.scaleStart})`:e.style.removeProperty("transform")))};return p.onfinish=()=>{f()},p.oncancel=()=>{f()},p}var Qa,_s=ee(()=>{"use strict";oe();Qa=new WeakMap});function jT(e){var n;if(!Number.isFinite(e)||e===Math.trunc(e))return null;let t=(n=e.toString().split(".")[1])==null?void 0:n.replace(/0+$/,"");return t?Math.min(t.length,zT):null}function Dh(e){let t=jT(e);return t===null?{useGrouping:!0}:{maximumFractionDigits:t,minimumFractionDigits:0,useGrouping:!0}}function $s(e){return Dh(e)}function YT(e){return y(h({},Dh(e)),{useGrouping:!1})}function no(e,t){if(e==null)return"";let n=String(e).trim();if(n==="")return"";let r=typeof e=="number"?e:Number(n.replace(/,/g,""));return Number.isNaN(r)?n.replace(/,/g,""):new Intl.NumberFormat("en-US",YT(t)).format(r)}function Jr(e,t){if(e==null)return"";let n=String(e).trim();if(n==="")return"";let r=typeof e=="number"?e:Number(n.replace(/,/g,""));return Number.isNaN(r)?n:new Intl.NumberFormat("en-US",$s(t)).format(r)}function Hs(e,t,n){return io(e,t,n)}function Fh(e,t,n){return ro(e)?{value:to(V(e,t))}:{}}function Ki(e,t){let n=e.dataset[t];if(n===void 0)return;if(!n||n.trim()==="")return[];let r=n.trim();if(r.startsWith("["))try{let i=JSON.parse(r);return Array.isArray(i)&&i.every(a=>typeof a=="string")?i:[]}catch(i){return[]}}function Mh(e,t="defaultPaths"){if(!O(e,"formField"))return;let n=Ki(e,t);if(n!==void 0)return n;let r=e.dataset[t];return r?r.split(` -`).map(i=>i.trim()).filter(Boolean):[]}function Bs(e,t,n){return O(e,"controlled")?{open:O(e,t)}:{}}function ro(e){return O(e,"controlled")||O(e,"formField")}function Wi(e,t){var n,r;return(r=(n=Ki(e,t))!=null?n:Ie(e,t))!=null?r:[]}function qn(e){return ro(e)?{value:Wi(e,"value")}:{}}function hn(e){return O(e,"formField")?{defaultValue:Wi(e,"value")}:O(e,"controlled")?{value:Wi(e,"value")}:{defaultValue:Wi(e,"defaultValue")}}function br(e,t){if(!ro(e))return{};let n=V(e,"value");return O(e,"formField")&&n===t?{}:{value:to(n)}}function io(e,t,n){return O(e,"formField")?{defaultValue:to(V(e,t))}:O(e,"controlled")?{value:to(V(e,t))}:{defaultValue:to(V(e,n))}}function XT(e){return O(e,"controlled")||O(e,"formField")}function Us(e){return XT(e)?{checked:Ma(e,"checked")}:{}}function Gs(e){return O(e,"formField")?{defaultChecked:Ma(e,"checked")}:O(e,"controlled")?{checked:Ma(e,"checked")}:{defaultChecked:Ma(e,"defaultChecked")}}function Ed(e,t){let n=t==="tags"?e.dataset.tags:e.dataset.defaultTags;if(!n||n.trim()==="")return[];try{let r=JSON.parse(n);return Array.isArray(r)&&r.every(i=>typeof i=="string")?r:[]}catch(r){return[]}}function _h(e){return ro(e)?{value:Ed(e,"tags")}:{}}function $h(e){return ro(e)?{value:Ed(e,"tags")}:{defaultValue:Ed(e,"defaultTags")}}function Hh(e){var t;return(t=G(e,"step"))!=null?t:1}function qs(e,t){let n=Hh(e),r={step:n};if(O(e,"controlled")){let i=V(e,"value");return i===void 0||i===""?r:y(h({},r),{value:Jr(i,n),nextServerValue:i})}if(O(e,"formField")){let i=V(e,"value");return i===void 0||i===""||i===t?r:y(h({},r),{value:Jr(i,n),nextServerValue:i})}return r}function Ws(e){let t=Hh(e);if(O(e,"controlled")){let i=V(e,"value");return{value:i!==void 0&&i!==""?Jr(i,t):void 0,step:t}}if(O(e,"formField")){let i=V(e,"value");return{defaultValue:i!==void 0&&i!==""?Jr(i,t):void 0,step:t}}let n=V(e,"defaultValue");return{defaultValue:n!==void 0&&n!==""?Jr(n,t):void 0,step:t}}function Ks(e,t,n){return qn(e)}function Bh(e){return O(e,"controlled")?{pressed:O(e,"pressed")}:{}}function Uh(e){return O(e,"controlled")?{edit:O(e,"edit")}:{}}function zs(e,t,n){return O(e,"controlled")?{open:O(e,t)}:{defaultOpen:O(e,n)}}function Pd(e,t,n){return O(e,"controlled")?O(e,t):O(e,n)}function js(e,t,n){return hn(e)}function Gh(e,t,n){var r;return(r=O(e,"controlled")?Ie(e,t):Ie(e,n))!=null?r:[]}var zT,to,$e=ee(()=>{"use strict";oe();zT=10;to=e=>e===void 0?null:e});function re(e){let t=[];return{add(n,r){t.push(e.handleEvent(n,r))},teardown(){for(let n of t)e.removeHandleEvent(n);t.length=0}}}function ie(e){let t=[];return{add(n,r){let i=r;e.addEventListener(n,i),t.push({eventName:n,listener:i})},teardown(){for(let{eventName:n,listener:r}of t)e.removeEventListener(n,r);t.length=0}}}var Ve=ee(()=>{"use strict"});function zi(e,t){return{id:e.id,checked:t.checked}}function de(e){var t,n,r;if(e&&typeof e=="object"){let i=e,a=(r=(n=(t=i.respond_to)!=null?t:i.respondTo)!=null?n:typeof i.respond_to=="string"?i.respond_to:void 0)!=null?r:typeof i.respondTo=="string"?i.respondTo:void 0;if(a==="server"||a==="client"||a==="both")return a}return"server"}function $(e,t){return t==null||t===""?!0:e===t}function Ys(e){var r;if(!e||typeof e!="object")return;let t=e,n=(r=t.checked)!=null?r:t.checked;if(n===!0||n==="true"||n===1)return!0;if(n===!1||n==="false"||n===0)return!1}function qh(e){var r;if(!e||typeof e!="object")return;let t=e,n=(r=t.pressed)!=null?r:t.pressed;if(n===!0||n==="true"||n===1)return!0;if(n===!1||n==="false"||n===0)return!1}function Wh(e){var r;if(!e||typeof e!="object")return;let t=e,n=(r=t.value)!=null?r:t.value;if(Array.isArray(n)&&n.every(i=>typeof i=="string"))return n}function Kh(e){var r;if(!e||typeof e!="object")return;let t=e,n=(r=t.visible)!=null?r:t.visible;if(n===!0||n==="true"||n===1)return!0;if(n===!1||n==="false"||n===0)return!1}function H(e){if(!e||typeof e!="object")return;let t=e,n;for(let r of Object.keys(t)){let i=t[r];if(!(typeof i!="string"||i==="")){if(r==="id"||r==="Id")n=i;else if(r.includes("_id")||r.length>2&&r.endsWith("Id"))return i}}return n}function ao(e){var r;if(!e||typeof e!="object")return"";let t=e,n=(r=t.value)!=null?r:t.value;return n==null?"":String(n)}function W(e){let{el:t,canPushServer:n,pushEvent:r,payload:i,serverEventName:a,clientEventName:o}=e;a&&n&&r(a,h({},i)),o&&t.dispatchEvent(new CustomEvent(o,{bubbles:!0,detail:i}))}function ji(e,t){return n=>{let r=t.getValue(),i={id:e.el.id,value:r};Ue({respondTo:n,canPushServer:e.canPushServer(),pushEvent:e.pushEvent,serverEventName:t.serverEventName,serverPayload:i,el:e.el,domEventName:t.domEventName,domDetail:i})}}function Ue(e){let{respondTo:t,canPushServer:n,pushEvent:r,serverEventName:i,serverPayload:a,el:o,domEventName:s,domDetail:l}=e;t!=="client"&&n&&r(i,a),t!=="server"&&o.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:l}))}var be=ee(()=>{"use strict"});var Yh={};pe(Yh,{Accordion:()=>dC,readAccordionLayoutProps:()=>jh});function iC(e,t){let{send:n,context:r,prop:i,scope:a,computed:o}=e,s=r.get("focusedValue"),l=r.get("value"),c=i("multiple");function d(p){let u=p;!c&&u.length>1&&(u=[u[0]]),n({type:"VALUE.SET",value:u})}function g(p){var u;return{expanded:l.includes(p.value),focused:s===p.value,disabled:!!((u=p.disabled)!=null?u:i("disabled"))}}return{focusedValue:s,value:l,setValue:d,getItemState:g,getRootProps(){return t.element(y(h({},oo.root.attrs),{dir:i("dir"),id:Xs(a),"data-orientation":i("orientation")}))},getItemProps(p){let u=g(p);return t.element(y(h({},oo.item.attrs),{dir:i("dir"),id:JT(a,p.value),"data-state":u.expanded?"open":"closed","data-focus":b(u.focused),"data-disabled":b(u.disabled),"data-orientation":i("orientation")}))},getItemContentProps(p){let u=g(p);return t.element(y(h({},oo.itemContent.attrs),{dir:i("dir"),role:"region",id:Sd(a,p.value),"aria-labelledby":Zs(a,p.value),hidden:!u.expanded,"data-state":u.expanded?"open":"closed","data-disabled":b(u.disabled),"data-focus":b(u.focused),"data-orientation":i("orientation")}))},getItemIndicatorProps(p){let u=g(p);return t.element(y(h({},oo.itemIndicator.attrs),{dir:i("dir"),"aria-hidden":!0,"data-state":u.expanded?"open":"closed","data-disabled":b(u.disabled),"data-focus":b(u.focused),"data-orientation":i("orientation")}))},getItemTriggerProps(p){let{value:u}=p,f=g(p);return t.button(y(h({},oo.itemTrigger.attrs),{type:"button",dir:i("dir"),id:Zs(a,u),"aria-controls":Sd(a,u),"data-controls":Sd(a,u),"aria-expanded":f.expanded,disabled:f.disabled,"data-orientation":i("orientation"),"aria-disabled":f.disabled,"data-state":f.expanded?"open":"closed","data-focus":b(f.focused),"data-ownedby":Xs(a),onFocus(){f.disabled||n({type:"TRIGGER.FOCUS",value:u})},onBlur(){f.disabled||n({type:"TRIGGER.BLUR"})},onClick(m){f.disabled||(wt()&&m.currentTarget.focus(),n({type:"TRIGGER.CLICK",value:u}))},onKeyDown(m){if(m.defaultPrevented||f.disabled)return;let S={ArrowDown(){o("isHorizontal")||n({type:"GOTO.NEXT",value:u})},ArrowUp(){o("isHorizontal")||n({type:"GOTO.PREV",value:u})},ArrowRight(){o("isHorizontal")&&n({type:"GOTO.NEXT",value:u})},ArrowLeft(){o("isHorizontal")&&n({type:"GOTO.PREV",value:u})},Home(){n({type:"GOTO.FIRST",value:u})},End(){n({type:"GOTO.LAST",value:u})}},T=me(m,{dir:i("dir"),orientation:i("orientation")}),w=S[T];w&&(w(m),m.preventDefault())}}))}}}function jh(e){return{id:e.id,collapsible:O(e,"collapsible"),multiple:O(e,"multiple"),orientation:V(e,"orientation"),dir:q(e)}}var ZT,oo,Xs,JT,Sd,Zs,QT,Js,eC,tC,nC,rC,aC,oC,sC,lC,Id,cC,zh,dC,Xh=ee(()=>{"use strict";Mc();_s();$e();Ve();be();oe();ZT=z("accordion").parts("root","item","itemTrigger","itemContent","itemIndicator"),oo=ZT.build(),Xs=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`accordion:${e.id}`},JT=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.item)==null?void 0:r.call(n,t))!=null?i:`accordion:${e.id}:item:${t}`},Sd=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemContent)==null?void 0:r.call(n,t))!=null?i:`accordion:${e.id}:content:${t}`},Zs=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemTrigger)==null?void 0:r.call(n,t))!=null?i:`accordion:${e.id}:trigger:${t}`},QT=e=>e.getById(Xs(e)),Js=e=>{let n=`[data-controls][data-ownedby='${CSS.escape(Xs(e))}']:not([disabled])`;return Oe(QT(e),n)},eC=e=>Dt(Js(e)),tC=e=>en(Js(e)),nC=(e,t)=>mr(Js(e),Zs(e,t)),rC=(e,t)=>vr(Js(e),Zs(e,t));({and:aC,not:oC}=we()),sC=te({props({props:e}){return h({collapsible:!1,multiple:!1,orientation:"vertical",defaultValue:[]},e)},initialState(){return"idle"},context({prop:e,bindable:t}){return{focusedValue:t(()=>({defaultValue:null,sync:!0,onChange(n){var r;(r=e("onFocusChange"))==null||r({value:n})}})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var r;(r=e("onValueChange"))==null||r({value:n})}}))}},computed:{isHorizontal:({prop:e})=>e("orientation")==="horizontal"},on:{"VALUE.SET":{actions:["setValue"]}},states:{idle:{on:{"TRIGGER.FOCUS":{target:"focused",actions:["setFocusedValue"]}}},focused:{on:{"GOTO.NEXT":{actions:["focusNextTrigger"]},"GOTO.PREV":{actions:["focusPrevTrigger"]},"TRIGGER.CLICK":[{guard:aC("isExpanded","canToggle"),actions:["collapse"]},{guard:oC("isExpanded"),actions:["expand"]}],"GOTO.FIRST":{actions:["focusFirstTrigger"]},"GOTO.LAST":{actions:["focusLastTrigger"]},"TRIGGER.BLUR":{target:"idle",actions:["clearFocusedValue"]}}}},implementations:{guards:{canToggle:({prop:e})=>!!e("collapsible")||!!e("multiple"),isExpanded:({context:e,event:t})=>e.get("value").includes(t.value)},actions:{collapse({context:e,prop:t,event:n}){let r=t("multiple")?Ft(e.get("value"),n.value):[];e.set("value",r)},expand({context:e,prop:t,event:n}){let r=t("multiple")?Tt(e.get("value"),n.value):[n.value];e.set("value",r)},focusFirstTrigger({scope:e}){var t;(t=eC(e))==null||t.focus()},focusLastTrigger({scope:e}){var t;(t=tC(e))==null||t.focus()},focusNextTrigger({context:e,scope:t}){let n=e.get("focusedValue");if(!n)return;let r=nC(t,n);r==null||r.focus()},focusPrevTrigger({context:e,scope:t}){let n=e.get("focusedValue");if(!n)return;let r=rC(t,n);r==null||r.focus()},setFocusedValue({context:e,event:t}){e.set("focusedValue",t.value)},clearFocusedValue({context:e}){e.set("focusedValue",null)},setValue({context:e,event:t}){e.set("value",t.value)},coarseValue({context:e,prop:t}){!t("multiple")&&e.get("value").length>1&&(It("The value of accordion should be a single value when multiple is false."),e.set("value",[e.get("value")[0]]))}}}}),lC=class extends X{initMachine(e){return new Y(sC,e)}initApi(){return this.zagConnect(iC)}render(){var a,o;let e=(a=this.el.querySelector('[data-scope="accordion"][data-part="root"]'))!=null?a:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.id,n=t?`accordion:${t}:item:`:"",r=e.querySelectorAll('[data-scope="accordion"][data-part="item"]'),i=(o=this.el.dataset.animation)!=null?o:"instant";for(let s of r){if(n&&!s.id.startsWith(n))continue;let l=s.dataset.value;if(!l)continue;let c=s.dataset.disabled==="";this.spreadProps(s,this.api.getItemProps({value:l,disabled:c}));let d=s.querySelector('[data-scope="accordion"][data-part="item-trigger"]');d&&this.spreadProps(d,this.api.getItemTriggerProps({value:l,disabled:c}));let g=s.querySelector('[data-scope="accordion"][data-part="item-indicator"]');g&&this.spreadProps(g,this.api.getItemIndicatorProps({value:l,disabled:c}));let p=s.querySelector('[data-scope="accordion"][data-part="item-content"]');p&&(i==="instant"?this.spreadProps(p,this.api.getItemContentProps({value:l,disabled:c})):(i==="js"||i==="custom")&&(this.spreadProps(p,Zr(this.api.getItemContentProps({value:l,disabled:c}))),p.removeAttribute("hidden")))}}},Id='[data-scope="accordion"][data-part="item-content"]',cC='[data-scope="accordion"][data-part="item"]',zh=kh(cC);dC={mounted(){let e=this.el,t=this,n=this.pushEvent.bind(this),r=()=>j(this.liveSocket);t.lastValue=Gh(e,"value","defaultValue");let i=new lC(e,y(h({id:e.id},js(e,"value","defaultValue")),{collapsible:O(e,"collapsible"),multiple:O(e,"multiple"),orientation:V(e,"orientation"),dir:q(e),onValueChange:g=>{var T,w;let p=(T=g.value)!=null?T:[],u=(w=t.lastValue)!=null?w:[],{added:f,removed:m}=Na(p,u);t.lastValue=p;let S={id:e.id,value:p,previousValue:u,added:f,removed:m};W({el:e,canPushServer:r(),pushEvent:n,payload:S,serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")}),Vt(e)&&!O(e,"controlled")&&Nh({el:e,selector:Id,openValues:p,resolveValue:zh})},onFocusChange:g=>{var p;W({el:e,canPushServer:r(),pushEvent:n,payload:{id:e.id,value:(p=g.value)!=null?p:null},serverEventName:V(e,"onFocusChange"),clientEventName:V(e,"onFocusChangeClient")})}}));i.init(),this.accordion=i,Ms(e,Id);let a={el:e,pushEvent:n,canPushServer:r},o=ji(a,{getValue:()=>i.api.value,serverEventName:"accordion_value_response",domEventName:"accordion-value"}),s=ji(a,{getValue:()=>i.api.focusedValue,serverEventName:"accordion_focused_response",domEventName:"accordion-focused"}),l=(g,p,u)=>{let f={value:g,disabled:p},m=i.api.getItemState(f);Ue({respondTo:u,canPushServer:r(),pushEvent:n,serverEventName:"accordion_item_state_response",serverPayload:{id:e.id,value:g,state:{expanded:m.expanded,focused:m.focused,disabled:m.disabled}},el:e,domEventName:"accordion-item-state",domDetail:{id:e.id,value:g,state:m}})},c=ie(e);this.domRegistry=c,c.add("corex:accordion:set-value",g=>{i.api.setValue(g.detail.value)}),c.add("corex:accordion:value",g=>{o(de(g.detail))}),c.add("corex:accordion:focused",g=>{s(de(g.detail))}),c.add("corex:accordion:item-state",g=>{let p=g.detail,u=p==null?void 0:p.value;typeof u!="string"||u===""||l(u,(p==null?void 0:p.disabled)===!0,de(p))});let d=re(this);this.handleRegistry=d,d.add("accordion_set_value",g=>{$(e.id,H(g))&&i.api.setValue(g.value)}),d.add("accordion_value",g=>{$(e.id,H(g))&&o(de(g))}),d.add("accordion_focused",g=>{$(e.id,H(g))&&s(de(g))}),d.add("accordion_item_state",g=>{$(e.id,H(g))&&(typeof(g==null?void 0:g.value)!="string"||g.value===""||l(g.value,g.disabled===!0,de(g)))})},beforeUpdate(){var t;let{el:e}=this;O(e,"controlled")&&Vt(e)&&(this.previousValue=(t=Ie(e,"value"))!=null?t:[])},updated(){var i,a,o,s,l;let{el:e}=this,t=jh(e);if(!O(e,"controlled")){(i=this.accordion)==null||i.updateProps(t);return}let n=(a=Ie(e,"value"))!=null?a:[],r=(s=(o=this.previousValue)!=null?o:this.lastValue)!=null?s:[];this.previousValue=void 0,this.lastValue=n,eo({el:e,selector:Id,prevOpen:r,nextOpen:n,resolveValue:zh}),(l=this.accordion)==null||l.updateProps(y(h({},t),{value:n}))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.accordion)==null||n.destroy()}}});function uC(e){let t=h({},e);return delete t.defaultValue,delete t.value,t}function Er(e,t,n,r,i){Object.keys(i).length>0&&r(e,uC(i)),e.value=n,it(e,t)}var so=ee(()=>{"use strict";oe()});function Wn(e){let{x:t,y:n,width:r,height:i}=e,a=t+r/2,o=n+i/2;return{x:t,y:n,width:r,height:i,minX:t,minY:n,maxX:t+r,maxY:n+i,midX:a,midY:o,center:Qr(a,o)}}function Jh(e){let t=Qr(e.minX,e.minY),n=Qr(e.maxX,e.minY),r=Qr(e.maxX,e.maxY),i=Qr(e.minX,e.maxY);return{top:t,right:n,bottom:r,left:i}}var gC,pC,fn,Qr,Td,Zh,Qs=ee(()=>{"use strict";gC=Object.defineProperty,pC=(e,t,n)=>t in e?gC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fn=(e,t,n)=>pC(e,typeof t!="symbol"?t+"":t,n),Qr=(e,t)=>({x:e,y:t}),Td=(e,t)=>t?Qr(e.x-t.x,e.y-t.y):e,Zh=(e,t)=>Qr(e.x+t.x,e.y+t.y)});var nf,Qh,el,hC,fC,mC,vC,Cd,Pr,wd,rf,af,of,Yi,yC,Ae,sf,lf,ef,Xi,lo,Od,xe,tf,cf,df,uf,ke,Bt=ee(()=>{"use strict";({floor:nf,abs:Qh,round:el,min:hC,max:fC,pow:mC,sign:vC}=Math),Cd=e=>Number.isNaN(e),Pr=e=>Cd(e)?0:e,wd=(e,t)=>(e%t+t)%t,rf=(e,t)=>(e%t+t)%t,af=(e,t)=>Pr(e)>=t,of=(e,t)=>Pr(e)<=t,Yi=(e,t,n)=>{let r=Pr(e),i=t==null||r>=t,a=n==null||r<=n;return i&&a},yC=(e,t,n)=>el((Pr(e)-t)/n)*n+t,Ae=(e,t,n)=>hC(fC(Pr(e),t),n),sf=(e,t,n)=>(Pr(e)-t)/(n-t),lf=(e,t,n,r)=>Ae(yC(e*(n-t)+t,t,r),t,n),ef=(e,t)=>{let n=e,r=t.toString(),i=r.indexOf("."),a=i>=0?r.length-i:0;if(a>0){let o=mC(10,a);n=el(n*o)/o}return n},Xi=(e,t)=>typeof t=="number"?nf(e*t+.5)/t:el(e),lo=(e,t,n,r)=>{let i=t!=null?Number(t):0,a=Number(n),o=(e-i)%r,s=Qh(o)*2>=r?e+vC(o)*(r-Qh(o)):e-o;if(s=ef(s,r),!Cd(i)&&sa){let l=nf((a-i)/r),c=i+l*r;s=l<=0||ce[t]===n?e:[...e.slice(0,t),n,...e.slice(t+1)],xe=(e,t=0,n=10)=>{let r=Math.pow(n,t);return el(e*r)/r},tf=e=>{if(!Number.isFinite(e))return 0;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n+=1;return n},cf=(e,t,n)=>{let r=t==="+"?e+n:e-n;if(e%1!==0||n%1!==0){let i=10**Math.max(tf(e),tf(n));e=Math.round(e*i),n=Math.round(n*i),r=t==="+"?e+n:e-n,r/=i}return r},df=(e,t)=>cf(Pr(e),"+",t),uf=(e,t)=>cf(Pr(e),"-",t),ke=e=>typeof e=="number"?`${e}px`:e});var bf={};pe(bf,{AngleSlider:()=>xC,valueChangePayload:()=>kd});function TC(e,t,n=e.center){let r=t.x-n.x,i=t.y-n.y;return 360-(Math.atan2(r,i)*(180/Math.PI)+180)}function vf(e){return(360-e)%360}function Rd(e,t,n,r){let i=Wn(e.getBoundingClientRect()),a=TC(i,t);return n!=null?a-n:(r==="rtl"&&(a=vf(a)),a)}function CC(e,t,n,r,i){if(n==null)return Rd(e,t,null,i);let a=Rd(e,t),o=r+n;return i==="rtl"?r+o-a:a-n}function pf(e,t){return t==="rtl"?vf(e):e}function yf(e){return Math.min(Math.max(e,tl),nl)}function wC(e,t){let n=yf(e),r=Math.ceil(n/t),i=Math.round(n/t);return r>=n/t?r*t===nl?tl:r*t:i*t}function hf(e,t){return lo(e,tl,nl,t)}function OC(e,t){let{state:n,send:r,context:i,prop:a,computed:o,scope:s}=e,l=n.matches("dragging"),c=i.get("value"),d=o("valueAsDegree"),g=a("dir"),p=pf(c,g),u=a("disabled"),f=a("invalid"),m=a("readOnly"),S=o("interactive"),T=a("aria-label"),w=a("aria-labelledby");return{value:c,valueAsDegree:d,dragging:l,setValue(I){r({type:"VALUE.SET",value:I})},getRootProps(){return t.element(y(h({},ei.root.attrs),{id:EC(s),dir:a("dir"),"data-disabled":b(u),"data-invalid":b(f),"data-readonly":b(m),style:{"--value":c,"--angle":`${p}deg`}}))},getLabelProps(){return t.label(y(h({},ei.label.attrs),{id:gf(s),htmlFor:Ad(s),dir:a("dir"),"data-disabled":b(u),"data-invalid":b(f),"data-readonly":b(m),onClick(I){var P;S&&(I.preventDefault(),(P=xd(s))==null||P.focus())}}))},getHiddenInputProps(){return t.element({type:"hidden",value:c,name:a("name"),id:Ad(s),dir:a("dir")})},getControlProps(){return t.element(y(h({},ei.control.attrs),{role:"presentation",id:mf(s),dir:a("dir"),"data-disabled":b(u),"data-invalid":b(f),"data-readonly":b(m),onPointerDown(I){if(!S||!fe(I))return;let P=et(I),v=I.currentTarget,E=xd(s),R=Ot(I).composedPath(),x=E&&R.includes(E),C=null;x&&(C=Rd(v,P)-c),r({type:"CONTROL.POINTER_DOWN",point:P,angularOffset:C}),I.stopPropagation()},style:{touchAction:"none",userSelect:"none",WebkitUserSelect:"none"}}))},getThumbProps(){return t.element(y(h({},ei.thumb.attrs),{id:ff(s),role:"slider",dir:a("dir"),"aria-label":T,"aria-labelledby":w!=null?w:gf(s),"aria-valuemax":360,"aria-valuemin":0,"aria-valuenow":c,tabIndex:m||S?0:void 0,"data-disabled":b(u),"data-invalid":b(f),"data-readonly":b(m),onFocus(){r({type:"THUMB.FOCUS"})},onBlur(){r({type:"THUMB.BLUR"})},onKeyDown(I){if(!S)return;let P=Hn(I)*a("step"),v={ArrowLeft(){r({type:"THUMB.ARROW_DEC",step:P})},ArrowUp(){r({type:"THUMB.ARROW_DEC",step:P})},ArrowRight(){r({type:"THUMB.ARROW_INC",step:P})},ArrowDown(){r({type:"THUMB.ARROW_INC",step:P})},Home(){r({type:"THUMB.HOME"})},End(){r({type:"THUMB.END"})}},E=me(I,{dir:a("dir"),orientation:"horizontal"}),R=v[E];R&&(R(I),I.preventDefault())},style:{rotate:"var(--angle)"}}))},getValueTextProps(){return t.element(y(h({},ei.valueText.attrs),{id:PC(s),dir:a("dir")}))},getMarkerGroupProps(){return t.element(y(h({},ei.markerGroup.attrs),{dir:a("dir")}))},getMarkerProps(I){let P;I.valuec?P="over-value":P="at-value";let v=pf(I.value,g);return t.element(y(h({},ei.marker.attrs),{dir:a("dir"),"data-value":I.value,"data-state":P,"data-disabled":b(u),style:{"--marker-value":I.value,"--marker-display-value":v,rotate:"calc(var(--marker-display-value) * 1deg)"}}))}}}function kd(e,t){return{id:e.id,value:t.value,valueAsDegree:t.valueAsDegree}}function Vd(e,t){queueMicrotask(()=>{let n=t(),r=e.querySelector('[data-scope="angle-slider"][data-part="hidden-input"]');if(!r)return;let i=n.api.value;String(r.value)!==String(i)&&(r.value=String(i)),r.dispatchEvent(new Event("input",{bubbles:!0})),r.dispatchEvent(new Event("change",{bubbles:!0}))})}var bC,ei,EC,ff,Ad,mf,PC,gf,SC,IC,xd,tl,nl,VC,AC,xC,Ef=ee(()=>{"use strict";so();Qs();Bt();$e();Ve();be();oe();bC=z("angle-slider").parts("root","label","thumb","valueText","control","track","markerGroup","marker"),ei=bC.build(),EC=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`angle-slider:${e.id}`},ff=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.thumb)!=null?n:`angle-slider:${e.id}:thumb`},Ad=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`angle-slider:${e.id}:input`},mf=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`angle-slider:${e.id}:control`},PC=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.valueText)!=null?n:`angle-slider:${e.id}:value-text`},gf=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`angle-slider:${e.id}:label`},SC=e=>e.getById(Ad(e)),IC=e=>e.getById(mf(e)),xd=e=>e.getById(ff(e));tl=0,nl=359;VC=te({props({props:e}){return h({step:1,defaultValue:0},e)},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var r;(r=e("onValueChange"))==null||r({value:n,valueAsDegree:`${n}deg`})}}))}},refs(){return{thumbDragOffset:null}},computed:{interactive:({prop:e})=>!(e("disabled")||e("readOnly")),valueAsDegree:({context:e})=>`${e.get("value")}deg`},watch({track:e,context:t,action:n}){e([()=>t.get("value")],()=>{n(["syncInputElement"])})},initialState(){return"idle"},on:{"VALUE.SET":{actions:["setValue"]}},states:{idle:{on:{"CONTROL.POINTER_DOWN":{target:"dragging",actions:["setThumbDragOffset","setPointerValue","focusThumb"]},"THUMB.FOCUS":{target:"focused"}}},focused:{on:{"CONTROL.POINTER_DOWN":{target:"dragging",actions:["setThumbDragOffset","setPointerValue","focusThumb"]},"THUMB.ARROW_DEC":{actions:["decrementValue","invokeOnChangeEnd"]},"THUMB.ARROW_INC":{actions:["incrementValue","invokeOnChangeEnd"]},"THUMB.HOME":{actions:["setValueToMin","invokeOnChangeEnd"]},"THUMB.END":{actions:["setValueToMax","invokeOnChangeEnd"]},"THUMB.BLUR":{target:"idle"}}},dragging:{entry:["focusThumb"],effects:["trackPointerMove"],on:{"DOC.POINTER_UP":{target:"focused",actions:["invokeOnChangeEnd","clearThumbDragOffset"]},"DOC.POINTER_MOVE":{actions:["setPointerValue"]}}}},implementations:{effects:{trackPointerMove({scope:e,send:t}){return pn(e.getDoc(),{onPointerMove(n){t({type:"DOC.POINTER_MOVE",point:n.point})},onPointerUp(){t({type:"DOC.POINTER_UP"})}})}},actions:{syncInputElement({scope:e,context:t}){let n=SC(e);_e(n,t.get("value").toString())},invokeOnChangeEnd({context:e,prop:t,computed:n}){var r;(r=t("onValueChangeEnd"))==null||r({value:e.get("value"),valueAsDegree:n("valueAsDegree")})},setPointerValue({scope:e,event:t,context:n,prop:r,refs:i}){let a=IC(e);if(!a)return;let o=i.get("thumbDragOffset"),s=n.get("value"),l=CC(a,t.point,o,s,r("dir"));n.set("value",wC(l,r("step")))},setValueToMin({context:e}){e.set("value",tl)},setValueToMax({context:e}){e.set("value",nl)},setValue({context:e,event:t}){e.set("value",yf(t.value))},decrementValue({context:e,event:t,prop:n}){var i;let r=hf(e.get("value")-t.step,(i=t.step)!=null?i:n("step"));e.set("value",r)},incrementValue({context:e,event:t,prop:n}){var i;let r=hf(e.get("value")+t.step,(i=t.step)!=null?i:n("step"));e.set("value",r)},focusThumb({scope:e}){B(()=>{var t;(t=xd(e))==null||t.focus({preventScroll:!0})})},setThumbDragOffset({refs:e,event:t}){var n;e.set("thumbDragOffset",(n=t.angularOffset)!=null?n:null)},clearThumbDragOffset({refs:e}){e.set("thumbDragOffset",null)}}}}),AC=class extends X{initMachine(e){return new Y(VC,e)}initApi(){return this.zagConnect(OC)}render(){var s,l;let e=(s=this.el.querySelector('[data-scope="angle-slider"][data-part="root"]'))!=null?s:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="angle-slider"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-scope="angle-slider"][data-part="hidden-input"]');n instanceof HTMLInputElement&&Er(n,this.el,String(this.api.value),(c,d)=>this.spreadProps(c,d),this.api.getHiddenInputProps());let r=this.el.querySelector('[data-scope="angle-slider"][data-part="control"]');r&&this.spreadProps(r,this.api.getControlProps());let i=this.el.querySelector('[data-scope="angle-slider"][data-part="thumb"]');i&&this.spreadProps(i,this.api.getThumbProps());let a=this.el.querySelector('[data-scope="angle-slider"][data-part="value-text"]');if(a){this.spreadProps(a,this.api.getValueTextProps());let c=a.querySelector('[data-scope="angle-slider"][data-part="value"]'),d=this.el.dataset.valueTextAs,g=String(d==="raw"?this.api.value:(l=this.api.valueAsDegree)!=null?l:this.api.value);c&&c.textContent!==g&&(c.textContent=g)}let o=this.el.querySelector('[data-scope="angle-slider"][data-part="marker-group"]');o&&this.spreadProps(o,this.api.getMarkerGroupProps()),this.el.querySelectorAll('[data-scope="angle-slider"][data-part="marker"]').forEach(c=>{let d=c.dataset.value;if(d==null)return;let g=Number(d);Number.isNaN(g)||this.spreadProps(c,this.api.getMarkerProps({value:g}))})}};xC={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=new AC(e,y(h({id:e.id},Ws(e)),{disabled:O(e,"disabled"),readOnly:O(e,"readonly"),invalid:O(e,"invalid"),name:V(e,"name"),dir:q(e),"aria-label":V(e,"aria-label"),"aria-labelledby":V(e,"aria-labelledby"),onValueChange:s=>{W({el:e,canPushServer:n(),pushEvent:t,payload:kd(e,s),serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})},onValueChangeEnd:s=>{W({el:e,canPushServer:n(),pushEvent:t,payload:kd(e,s),serverEventName:V(e,"onValueChangeEnd"),clientEventName:V(e,"onValueChangeEndClient")}),Vd(e,()=>r)}}));r.init(),this.angleSlider=r;let i=s=>{Ue({respondTo:s,canPushServer:n(),pushEvent:t,serverEventName:"angle_slider_value_response",serverPayload:{id:e.id,value:r.api.value,valueAsDegree:r.api.valueAsDegree,dragging:r.api.dragging},el:e,domEventName:"angle-slider-value",domDetail:{id:e.id,value:r.api.value,valueAsDegree:r.api.valueAsDegree,dragging:r.api.dragging}})},a=ie(e);this.domRegistry=a,a.add("corex:angle-slider:set-value",s=>{r.api.setValue(s.detail.value),Vd(e,()=>r)}),a.add("corex:angle-slider:value",s=>{i(de(s.detail))});let o=re(this);this.handleRegistry=o,o.add("angle_slider_set_value",s=>{$(e.id,H(s))&&(r.api.setValue(s.value),Vd(e,()=>r))}),o.add("angle_slider_value",s=>{$(e.id,H(s))&&i(de(s))})},updated(){let e=this.el,t=this.angleSlider,n=qs(e);t==null||t.updateProps(y(h({id:e.id},n),{disabled:O(e,"disabled"),readOnly:O(e,"readonly"),invalid:O(e,"invalid"),name:V(e,"name"),dir:q(e)}))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.angleSlider)==null||n.destroy()}}});var Tf={};pe(Tf,{Avatar:()=>_C,statusPayload:()=>If});function LC(e,t){let{state:n,send:r,prop:i,scope:a}=e,o=n.matches("loaded");return{loaded:o,setSrc(s){let l=Ld(a);l==null||l.setAttribute("src",s)},setLoaded(){r({type:"img.loaded",src:"api"})},setError(){r({type:"img.error",src:"api"})},getRootProps(){return t.element(y(h({},Nd.root.attrs),{dir:i("dir"),id:Pf(a)}))},getImageProps(){return t.img(y(h({},Nd.image.attrs),{hidden:!o,dir:i("dir"),id:Sf(a),"data-state":o?"visible":"hidden",onLoad(){r({type:"img.loaded",src:"element"})},onError(){r({type:"img.error",src:"element"})}}))},getFallbackProps(){return t.element(y(h({},Nd.fallback.attrs),{dir:i("dir"),id:kC(a),hidden:o,"data-state":o?"hidden":"visible"}))}}}function FC(e){return e.complete&&e.naturalWidth!==0&&e.naturalHeight!==0}function If(e,t){return{id:e.id,status:t.status}}var RC,Nd,Pf,Sf,kC,NC,Ld,DC,MC,_C,Cf=ee(()=>{"use strict";Ve();be();oe();RC=z("avatar").parts("root","image","fallback"),Nd=RC.build(),Pf=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`avatar:${e.id}`},Sf=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.image)!=null?n:`avatar:${e.id}:image`},kC=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.fallback)!=null?n:`avatar:${e.id}:fallback`},NC=e=>e.getById(Pf(e)),Ld=e=>e.getById(Sf(e));DC=te({initialState(){return"loading"},effects:["trackImageRemoval","trackSrcChange"],on:{"src.change":{target:"loading"},"img.unmount":{target:"error"}},states:{loading:{entry:["checkImageStatus"],on:{"img.loaded":{target:"loaded",actions:["invokeOnLoad"]},"img.error":{target:"error",actions:["invokeOnError"]}}},error:{on:{"img.loaded":{target:"loaded",actions:["invokeOnLoad"]}}},loaded:{on:{"img.error":{target:"error",actions:["invokeOnError"]}}}},implementations:{actions:{invokeOnLoad({prop:e}){var t;(t=e("onStatusChange"))==null||t({status:"loaded"})},invokeOnError({prop:e}){var t;(t=e("onStatusChange"))==null||t({status:"error"})},checkImageStatus({send:e,scope:t}){let n=Ld(t);if(!(n!=null&&n.complete))return;let r=FC(n)?"img.loaded":"img.error";e({type:r,src:"ssr"})}},effects:{trackImageRemoval({send:e,scope:t}){let n=NC(t);return Ls(n,{callback(r){Array.from(r[0].removedNodes).find(o=>o.nodeType===Node.ELEMENT_NODE&&o.matches("[data-scope=avatar][data-part=image]"))&&e({type:"img.unmount"})}})},trackSrcChange({send:e,scope:t}){let n=Ld(t);return Ht(n,{attributes:["src","srcset"],callback(){e({type:"src.change"})}})}}}});MC=class extends X{initMachine(e){return new Y(DC,e)}initApi(){return this.zagConnect(LC)}render(){var i;let e=(i=this.el.querySelector('[data-scope="avatar"][data-part="root"]'))!=null?i:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="avatar"][data-part="image"]');t&&this.spreadProps(t,this.api.getImageProps());let n=this.el.querySelector('[data-scope="avatar"][data-part="fallback"]');n&&this.spreadProps(n,this.api.getFallbackProps());let r=this.el.querySelector('[data-scope="avatar"][data-part="skeleton"]');if(r){let a=this.machine.service.state,o=a.matches("loaded"),s=a.matches("error");r.hidden=o||s,r.setAttribute("data-state",o||s?"hidden":"visible")}}};_C={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=V(e,"src"),i=new MC(e,{id:e.id,dir:V(e,"dir"),onStatusChange:l=>{let c=If(e,l);W({el:e,canPushServer:n(),pushEvent:t,payload:c,serverEventName:V(e,"onStatusChange"),clientEventName:V(e,"onStatusChangeClient")})}});i.init(),this.avatar=i,this.lastSrc=r;let a=l=>{let c=i.api.loaded;Ue({respondTo:l,canPushServer:n(),pushEvent:t,serverEventName:"avatar_loaded_response",serverPayload:{id:e.id,loaded:c},el:e,domEventName:"avatar-loaded",domDetail:{id:e.id,loaded:c}})},o=ie(e);this.domRegistry=o,o.add("corex:avatar:set-src",l=>{var d;let c=(d=l.detail)==null?void 0:d.src;typeof c=="string"&&(i.api.setSrc(c),this.lastSrc=c,e.dataset.src=c)}),o.add("corex:avatar:loaded",l=>{a(de(l.detail))});let s=re(this);this.handleRegistry=s,s.add("avatar_set_src",l=>{$(e.id,H(l))&&(i.api.setSrc(l.src),this.lastSrc=l.src,e.dataset.src=l.src)}),s.add("avatar_loaded",l=>{$(e.id,H(l))&&a(de(l))})},updated(){let e=V(this.el,"src"),t=V(this.el,"dir");this.avatar&&this.avatar.updateProps(h({},t!==void 0?{dir:t}:{})),this.avatar&&e!==void 0&&e!==this.lastSrc&&(this.avatar.api.setSrc(e),this.lastSrc=e),this.avatar&&e===void 0&&this.lastSrc!==void 0&&(this.avatar.api.setSrc(""),this.lastSrc=void 0)},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.avatar)==null||n.destroy()}}});var Lf={};pe(Lf,{Carousel:()=>e0,fromZagPage:()=>Nf,readCorexPage:()=>al,readInstant:()=>co,toZagPage:()=>kf});function KC(e,t){let{state:n,context:r,computed:i,send:a,scope:o,prop:s}=e,l=n.matches("autoplay"),c=n.matches("dragging"),d=i("canScrollNext"),g=i("canScrollPrev"),p=i("isHorizontal"),u=s("autoSize"),f=Array.from(r.get("pageSnapPoints")),m=r.get("page"),S=f.length?Ae(m,0,f.length-1):0,T=s("slidesPerPage"),w=s("padding"),I=s("translations");return{isPlaying:l,isDragging:c,page:S,pageSnapPoints:f,canScrollNext:d,canScrollPrev:g,getProgress(){return S/f.length},getProgressText(){var v,E;let P={page:S+1,totalPages:f.length};return(E=(v=I.progressText)==null?void 0:v.call(I,P))!=null?E:""},scrollToIndex(P,v){a({type:"INDEX.SET",index:P,instant:v})},scrollTo(P,v){a({type:"PAGE.SET",index:P,instant:v})},scrollNext(P){a({type:"PAGE.NEXT",instant:P})},scrollPrev(P){a({type:"PAGE.PREV",instant:P})},play(){a({type:"AUTOPLAY.START"})},pause(){a({type:"AUTOPLAY.PAUSE"})},isInView(P){return Array.from(r.get("slidesInView")).includes(P)},refresh(){a({type:"SNAP.REFRESH"})},getRootProps(){return t.element(y(h({},mn.root.attrs),{id:HC(o),role:"region","aria-roledescription":"carousel","data-orientation":s("orientation"),dir:s("dir"),style:{"--slides-per-page":T,"--slide-spacing":s("spacing"),"--slide-item-size":u?"auto":"calc(100% / var(--slides-per-page) - var(--slide-spacing) * (var(--slides-per-page) - 1) / var(--slides-per-page))"}}))},getItemGroupProps(){return t.element(y(h({},mn.itemGroup.attrs),{id:il(o),"data-orientation":s("orientation"),"data-dragging":b(c),dir:s("dir"),"aria-live":l?"off":"polite",onFocus(P){ge(P.currentTarget,ne(P))&&a({type:"VIEWPORT.FOCUS"})},onBlur(P){ge(P.currentTarget,P.relatedTarget)||a({type:"VIEWPORT.BLUR"})},onMouseDown(P){if(P.defaultPrevented||!s("allowMouseDrag")||!fe(P))return;let v=ne(P);ut(v)&&v!==P.currentTarget||(P.preventDefault(),a({type:"DRAGGING.START"}))},onWheel:Zp(P=>{let v=s("orientation")==="horizontal"?"deltaX":"deltaY";P[v]<0&&!i("canScrollPrev")||P[v]>0&&!i("canScrollNext")||a({type:"USER.SCROLL"})},150),onTouchStart(){a({type:"USER.SCROLL"})},style:{display:u?"flex":"grid",gap:"var(--slide-spacing)",scrollSnapType:[p?"x":"y",s("snapType")].join(" "),gridAutoFlow:p?"column":"row",scrollbarWidth:"none",overscrollBehaviorX:"contain",[p?"gridAutoColumns":"gridAutoRows"]:u?void 0:"var(--slide-item-size)",[p?"scrollPaddingInline":"scrollPaddingBlock"]:w,[p?"paddingInline":"paddingBlock"]:w,[p?"overflowX":"overflowY"]:"auto"}}))},getItemProps(P){let v=r.get("slidesInView").includes(P.index);return t.element(y(h({},mn.item.attrs),{id:BC(o,P.index),dir:s("dir"),role:"group","data-index":P.index,"data-inview":b(v),"aria-roledescription":"slide","data-orientation":s("orientation"),"aria-label":I.item(P.index,s("slideCount")),"aria-hidden":se(!v),style:{flex:"0 0 auto",[p?"maxWidth":"maxHeight"]:"100%",scrollSnapAlign:(()=>{var A;let E=(A=P.snapAlign)!=null?A:"start",R=s("slidesPerMove"),x=R==="auto"?Math.floor(s("slidesPerPage")):R;return(P.index+x)%x===0?E:void 0})()}}))},getControlProps(){return t.element(y(h({},mn.control.attrs),{"data-orientation":s("orientation")}))},getPrevTriggerProps(){return t.button(y(h({},mn.prevTrigger.attrs),{id:GC(o),type:"button",disabled:!g,dir:s("dir"),"aria-label":I.prevTrigger,"data-orientation":s("orientation"),"aria-controls":il(o),onClick(P){P.defaultPrevented||a({type:"PAGE.PREV",src:"trigger"})}}))},getNextTriggerProps(){return t.button(y(h({},mn.nextTrigger.attrs),{dir:s("dir"),id:UC(o),type:"button","aria-label":I.nextTrigger,"data-orientation":s("orientation"),"aria-controls":il(o),disabled:!d,onClick(P){P.defaultPrevented||a({type:"PAGE.NEXT",src:"trigger"})}}))},getIndicatorGroupProps(){return t.element(y(h({},mn.indicatorGroup.attrs),{dir:s("dir"),id:qC(o),"data-orientation":s("orientation"),onKeyDown(P){if(P.defaultPrevented)return;let v="indicator",E={ArrowDown(C){p||(a({type:"PAGE.NEXT",src:v}),C.preventDefault())},ArrowUp(C){p||(a({type:"PAGE.PREV",src:v}),C.preventDefault())},ArrowRight(C){p&&(a({type:"PAGE.NEXT",src:v}),C.preventDefault())},ArrowLeft(C){p&&(a({type:"PAGE.PREV",src:v}),C.preventDefault())},Home(C){a({type:"PAGE.SET",index:0,src:v}),C.preventDefault()},End(C){a({type:"PAGE.SET",index:f.length-1,src:v}),C.preventDefault()}},R=me(P,{dir:s("dir"),orientation:s("orientation")}),x=E[R];x==null||x(P)}}))},getIndicatorProps(P){return t.button(y(h({},mn.indicator.attrs),{dir:s("dir"),id:Vf(o,P.index),type:"button","data-orientation":s("orientation"),"data-index":P.index,"data-readonly":b(P.readOnly),"data-current":b(P.index===S),"aria-label":I.indicator(P.index),onClick(v){v.defaultPrevented||P.readOnly||a({type:"PAGE.SET",index:P.index,src:"indicator"})}}))},getAutoplayTriggerProps(){return t.button(y(h({},mn.autoplayTrigger.attrs),{type:"button","data-orientation":s("orientation"),"data-pressed":b(l),"aria-label":l?I.autoplayStop:I.autoplayStart,onClick(P){P.defaultPrevented||a({type:l?"AUTOPLAY.PAUSE":"AUTOPLAY.START"})}}))},getProgressTextProps(){return t.element(h({},mn.progressText.attrs))}}}function Af(e){let t=pt(e),n=e.offsetWidth,r=e.offsetHeight,i=t.getPropertyValue("scroll-padding-left").replace("auto","0px"),a=t.getPropertyValue("scroll-padding-top").replace("auto","0px"),o=t.getPropertyValue("scroll-padding-right").replace("auto","0px"),s=t.getPropertyValue("scroll-padding-bottom").replace("auto","0px"),l=rl(i,n),c=rl(a,r),d=rl(o,n),g=rl(s,r);return{x:{before:l,after:d},y:{before:c,after:g}}}function zC(e,t,n="both"){return n==="x"&&e.right>=t.left&&e.left<=t.right||n==="y"&&e.bottom>=t.top&&e.top<=t.bottom||n==="both"&&e.right>=t.left&&e.left<=t.right&&e.bottom>=t.top&&e.top<=t.bottom}function xf(e){let t=[];for(let n of e.children)t=t.concat(n,xf(n));return t}function Rf(e,t=!1){let n=e.getBoundingClientRect(),i=Md(e)==="rtl",a=Sh(e),o={x:{start:[],center:[],end:[]},y:{start:[],center:[],end:[]}},s=t?xf(e):e.children;for(let l of["x","y"]){let c=l==="x"?"y":"x",d=l==="x"?"left":"top",g=l==="x"?"right":"bottom",p=l==="x"?"width":"height",u=l==="x"?"scrollLeft":"scrollTop",f=l==="x"?a.x:a.y,m=i&&l==="x";for(let S of s){let T=S.getBoundingClientRect();if(!zC(n,T,c))continue;let w=pt(S),[I,P]=w.getPropertyValue("scroll-snap-align").split(" ");typeof P=="undefined"&&(P=I);let v=l==="x"?P:I,E,R,x;if(m){let C=Math.abs(e[u]),A=(n[g]-T[g])/f+C;E=A,R=A+T[p]/f,x=A+T[p]/(2*f)}else E=(T[d]-n[d])/f+e[u],R=E+T[p]/f,x=E+T[p]/(2*f);switch(v){case"none":break;case"start":o[l].start.push({node:S,position:E});break;case"center":o[l].center.push({node:S,position:x});break;case"end":o[l].end.push({node:S,position:R});break}}}return o}function jC(e){let t=Md(e),n=Af(e),r=Rf(e),i=e.offsetWidth,a=e.offsetHeight,o={x:e.scrollWidth-e.offsetWidth,y:e.scrollHeight-e.offsetHeight},s=t==="rtl",l=s&&e.scrollLeft<=0,c;return s?(c=Dd([...r.x.start.map(d=>d.position-n.x.after),...r.x.center.map(d=>d.position-i/2),...r.x.end.map(d=>d.position-i+n.x.before)].map(Fd(0,o.x))),l&&(c=c.map(d=>-d))):c=Dd([...r.x.start.map(d=>d.position-n.x.before),...r.x.center.map(d=>d.position-i/2),...r.x.end.map(d=>d.position-i+n.x.after)].map(Fd(0,o.x))),{x:c,y:Dd([...r.y.start.map(d=>d.position-n.y.before),...r.y.center.map(d=>d.position-a/2),...r.y.end.map(d=>d.position-a+n.y.after)].map(Fd(0,o.y)))}}function YC(e,t,n){let r=Md(e),i=Af(e),a=Rf(e),o=[...a[t].start,...a[t].center,...a[t].end],s=r==="rtl",l=s&&t==="x"&&e.scrollLeft<=0;for(let c of o)if(n(c.node)){let d;return t==="x"&&s?(d=c.position-i.x.after,l&&(d=-d)):d=c.position-(t==="x"?i.x.before:i.y.before),d}}function JC(e,t,n){if(e==null||n<=0)return[];let r=[],i=t==="auto"?Math.floor(n):t;if(i<=0)return[];for(let a=0;ae);a+=i)r.push(a);return r}function kf(e){if(e!=null)return Math.max(0,e-1)}function Nf(e){return e+1}function al(e,t){return kf(G(e,t==="page"?"page":"defaultPage"))}function co(e){if(e&&typeof e=="object"&&"instant"in e){let t=e.instant;return t===!0||t==="true"}return!1}var $C,mn,HC,BC,il,UC,GC,qC,Vf,tt,wf,WC,Of,Md,rl,Dd,Fd,XC,ZC,QC,e0,Df=ee(()=>{"use strict";Bt();Ve();be();oe();$C=z("carousel").parts("root","itemGroup","item","control","nextTrigger","prevTrigger","indicatorGroup","indicator","autoplayTrigger","progressText"),mn=$C.build(),HC=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`carousel:${e.id}`},BC=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.item)==null?void 0:r.call(n,t))!=null?i:`carousel:${e.id}:item:${t}`},il=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.itemGroup)!=null?n:`carousel:${e.id}:item-group`},UC=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.nextTrigger)!=null?n:`carousel:${e.id}:next-trigger`},GC=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.prevTrigger)!=null?n:`carousel:${e.id}:prev-trigger`},qC=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.indicatorGroup)!=null?n:`carousel:${e.id}:indicator-group`},Vf=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.indicator)==null?void 0:r.call(n,t))!=null?i:`carousel:${e.id}:indicator:${t}`},tt=e=>e.getById(il(e)),wf=e=>Oe(tt(e),"[data-part=item]"),WC=(e,t)=>e.getById(Vf(e,t)),Of=e=>{let t=tt(e);if(!t)return;let n=Bn(t);t.setAttribute("tabindex",n.length>0?"-1":"0")};Md=e=>pt(e).direction,rl=(e,t)=>{let n=parseFloat(e);return/%/.test(e)&&(n/=100,n*=t),Number.isNaN(n)?0:n};Dd=e=>[...new Set(e)],Fd=(e,t)=>n=>Math.max(e,Math.min(t,n)),XC=1,ZC=te({props({props:e}){return gn(e,["slideCount"],"carousel"),y(h({dir:"ltr",defaultPage:0,orientation:"horizontal",snapType:"mandatory",loop:!!e.autoplay,slidesPerPage:1,slidesPerMove:"auto",spacing:"0px",autoplay:!1,allowMouseDrag:!1,inViewThreshold:.6,autoSize:!1},e),{translations:h({nextTrigger:"Next slide",prevTrigger:"Previous slide",indicator:t=>`Go to slide ${t+1}`,item:(t,n)=>`${t+1} of ${n}`,autoplayStart:"Start slide rotation",autoplayStop:"Stop slide rotation",progressText:({page:t,totalPages:n})=>`${t} / ${n}`},e.translations)})},refs(){return{timeoutRef:void 0}},initialState({prop:e}){return e("autoplay")?"autoplay":"idle"},context({prop:e,bindable:t,getContext:n}){return{page:t(()=>({defaultValue:e("defaultPage"),value:e("page"),onChange(r){var o;let a=n().get("pageSnapPoints");(o=e("onPageChange"))==null||o({page:r,pageSnapPoint:a[r]})}})),pageSnapPoints:t(()=>({defaultValue:e("autoSize")?Array.from({length:e("slideCount")},(r,i)=>i):JC(e("slideCount"),e("slidesPerMove"),e("slidesPerPage"))})),slidesInView:t(()=>({defaultValue:[]}))}},computed:{isRtl:({prop:e})=>e("dir")==="rtl",isHorizontal:({prop:e})=>e("orientation")==="horizontal",canScrollNext:({prop:e,context:t})=>e("loop")||t.get("page")e("loop")||t.get("page")>0,autoplayInterval:({prop:e})=>{let t=e("autoplay");return un(t)?t.delay:4e3}},watch({track:e,action:t,context:n,prop:r,send:i}){e([()=>r("slidesPerPage"),()=>r("slidesPerMove")],()=>{t(["setSnapPoints"])}),e([()=>n.get("page")],()=>{t(["scrollToPage","focusIndicatorEl"])}),e([()=>r("orientation"),()=>r("autoSize"),()=>r("dir")],()=>{t(["setSnapPoints","scrollToPage"])}),e([()=>r("slideCount")],()=>{i({type:"SNAP.REFRESH",src:"slide.count"})}),e([()=>!!r("autoplay")],()=>{i({type:r("autoplay")?"AUTOPLAY.START":"AUTOPLAY.PAUSE",src:"autoplay.prop.change"})})},on:{"PAGE.NEXT":{target:"idle",actions:["clearScrollEndTimer","setNextPage"]},"PAGE.PREV":{target:"idle",actions:["clearScrollEndTimer","setPrevPage"]},"PAGE.SET":{target:"idle",actions:["clearScrollEndTimer","setPage"]},"INDEX.SET":{target:"idle",actions:["clearScrollEndTimer","setMatchingPage"]},"SNAP.REFRESH":{actions:["setSnapPoints","scrollToPageIfDrifted"]},"PAGE.SCROLL":{actions:["scrollToPage"]}},effects:["trackSlideMutation","trackSlideIntersections","trackSlideResize"],entry:["setSnapPoints","setPage"],exit:["clearScrollEndTimer"],states:{idle:{on:{"DRAGGING.START":{target:"dragging",actions:["invokeDragStart"]},"AUTOPLAY.START":{target:"autoplay",actions:["invokeAutoplayStart"]},"USER.SCROLL":{target:"userScroll"},"VIEWPORT.FOCUS":{target:"focus"}}},focus:{effects:["trackKeyboardScroll"],on:{"VIEWPORT.BLUR":{target:"idle"},"PAGE.NEXT":{actions:["clearScrollEndTimer","setNextPage"]},"PAGE.PREV":{actions:["clearScrollEndTimer","setPrevPage"]},"PAGE.SET":{actions:["clearScrollEndTimer","setPage"]},"INDEX.SET":{actions:["clearScrollEndTimer","setMatchingPage"]},"USER.SCROLL":{target:"userScroll"}}},dragging:{effects:["trackPointerMove"],entry:["disableScrollSnap"],on:{DRAGGING:{actions:["scrollSlides","invokeDragging"]},"DRAGGING.END":{target:"settling",actions:["endDragging"]}}},settling:{effects:["trackSettlingScroll"],on:{"DRAGGING.START":{target:"dragging",actions:["clearScrollEndTimer","invokeDragStart"]},"SCROLL.END":[{guard:"isFocused",target:"focus",actions:["clearScrollEndTimer","setClosestPage","invokeDraggingEnd"]},{target:"idle",actions:["clearScrollEndTimer","setClosestPage","invokeDraggingEnd"]}]}},userScroll:{effects:["trackScroll"],on:{"DRAGGING.START":{target:"dragging",actions:["invokeDragStart"]},"SCROLL.END":[{guard:"isFocused",target:"focus",actions:["setClosestPage"]},{target:"idle",actions:["setClosestPage"]}]}},autoplay:{effects:["trackDocumentVisibility","trackScroll","autoUpdateSlide"],exit:["invokeAutoplayEnd"],on:{"AUTOPLAY.TICK":{actions:["setNextPage","invokeAutoplay"]},"DRAGGING.START":{target:"dragging",actions:["invokeDragStart"]},"AUTOPLAY.PAUSE":{target:"idle"}}}},implementations:{guards:{isFocused:({scope:e})=>e.isActiveElement(tt(e))},effects:{autoUpdateSlide({computed:e,send:t}){let n=setInterval(()=>{t({type:e("canScrollNext")?"AUTOPLAY.TICK":"AUTOPLAY.PAUSE",src:"autoplay.interval"})},e("autoplayInterval"));return()=>clearInterval(n)},trackSlideMutation({scope:e,send:t}){let n=tt(e);if(!n)return;let r=e.getWin(),i=new r.MutationObserver(()=>{t({type:"SNAP.REFRESH",src:"slide.mutation"}),Of(e)});return Of(e),i.observe(n,{childList:!0,subtree:!0}),()=>i.disconnect()},trackSlideResize({scope:e,send:t}){let n=tt(e);if(!n)return;let r=()=>{t({type:"SNAP.REFRESH",src:"slide.resize"})};B(()=>{r(),B(()=>{t({type:"PAGE.SCROLL",instant:!0})})});let i=wf(e);i.forEach(r);let a=[Gn.observe(n,r),...i.map(o=>Gn.observe(o,r))];return Ct(...a)},trackSlideIntersections({scope:e,prop:t,context:n}){let r=tt(e),i=e.getWin(),a=new i.IntersectionObserver(o=>{let s=o.reduce((l,c)=>{var p;let d=c.target,g=Number((p=d.dataset.index)!=null?p:"-1");return g==null||Number.isNaN(g)||g===-1?l:c.isIntersecting?Tt(l,g):Ft(l,g)},n.get("slidesInView"));n.set("slidesInView",gt(s))},{root:r,threshold:t("inViewThreshold")});return wf(e).forEach(o=>a.observe(o)),()=>a.disconnect()},trackScroll({send:e,refs:t,scope:n}){let r=tt(n);return r?ae(r,"scroll",()=>{clearTimeout(t.get("timeoutRef")),t.set("timeoutRef",void 0),t.set("timeoutRef",setTimeout(()=>{e({type:"SCROLL.END"})},150))},{passive:!0}):void 0},trackSettlingScroll({send:e,refs:t,scope:n}){let r=tt(n);if(!r)return;let i=()=>{clearTimeout(t.get("timeoutRef")),t.set("timeoutRef",void 0),t.set("timeoutRef",setTimeout(()=>{e({type:"SCROLL.END"})},200))};i();let o=ae(r,"scroll",()=>{i()},{passive:!0});return()=>{o(),clearTimeout(t.get("timeoutRef")),t.set("timeoutRef",void 0)}},trackDocumentVisibility({scope:e,send:t}){let n=e.getDoc();return ae(n,"visibilitychange",()=>{n.visibilityState!=="visible"&&t({type:"AUTOPLAY.PAUSE",src:"doc.hidden"})})},trackPointerMove({scope:e,send:t}){let n=e.getDoc();return pn(n,{onPointerMove({event:r}){t({type:"DRAGGING",left:-r.movementX,top:-r.movementY})},onPointerUp(){t({type:"DRAGGING.END"})}})},trackKeyboardScroll({scope:e,send:t,context:n}){let r=e.getWin();return ae(r,"keydown",a=>{switch(a.key){case"ArrowRight":a.preventDefault(),t({type:"PAGE.NEXT"});break;case"ArrowLeft":a.preventDefault(),t({type:"PAGE.PREV"});break;case"Home":a.preventDefault(),t({type:"PAGE.SET",index:0});break;case"End":a.preventDefault(),t({type:"PAGE.SET",index:n.get("pageSnapPoints").length-1})}},{capture:!0})}},actions:{clearScrollEndTimer({refs:e}){e.get("timeoutRef")!=null&&(clearTimeout(e.get("timeoutRef")),e.set("timeoutRef",void 0))},scrollToPage({context:e,event:t,scope:n,computed:r,flush:i}){var c;let a=t.instant?"instant":"smooth",o=Ae((c=t.index)!=null?c:e.get("page"),0,e.get("pageSnapPoints").length-1),s=tt(n);if(!s)return;let l=r("isHorizontal")?"left":"top";i(()=>{s.scrollTo({[l]:e.get("pageSnapPoints")[o],behavior:a})})},scrollToPageIfDrifted({context:e,scope:t,computed:n}){let r=tt(t);if(!r)return;let i=e.get("pageSnapPoints")[e.get("page")];if(i==null)return;let a=n("isHorizontal")?r.scrollLeft:r.scrollTop;if(Math.abs(a-i)<=XC)return;let o=n("isHorizontal")?"left":"top";r.scrollTo({[o]:i,behavior:"instant"})},setClosestPage({context:e,scope:t,computed:n}){let r=tt(t);if(!r)return;let i=n("isHorizontal")?r.scrollLeft:r.scrollTop,a=e.get("pageSnapPoints");if(!a.length)return;let o=a.reduce((s,l,c)=>{let d=Math.abs(l-i),g=Math.abs(a[s]-i);return ds.dataset.index===t.index.toString());if(a==null)return;let o=e.get("pageSnapPoints").findIndex(s=>Math.abs(s-a)<1);e.set("page",o)},setPage({context:e,event:t}){var r;let n=(r=t.index)!=null?r:e.get("page");e.set("page",n)},setSnapPoints({context:e,computed:t,scope:n}){let r=tt(n);if(!r)return;let i=jC(r),a=t("isHorizontal")?i.x:i.y;if(e.set("pageSnapPoints",a),!a.length)return;let o=Ae(e.get("page"),0,a.length-1);e.set("page",o)},disableScrollSnap({scope:e}){let t=tt(e);if(!t)return;let n=getComputedStyle(t);t.dataset.scrollSnapType=n.getPropertyValue("scroll-snap-type"),t.style.setProperty("scroll-snap-type","none")},scrollSlides({scope:e,event:t}){let n=tt(e);n==null||n.scrollBy({left:t.left,top:t.top,behavior:"instant"})},endDragging({scope:e,context:t,computed:n}){let r=tt(e);if(!r)return;let i=n("isHorizontal"),a=i?r.scrollLeft:r.scrollTop,o=t.get("pageSnapPoints");if(!o.length)return;let s=o.reduce((l,c)=>Math.abs(c-a){r.scrollTo({left:i?s:r.scrollLeft,top:i?r.scrollTop:s,behavior:"smooth"});let l=r.dataset.scrollSnapType;l&&(r.style.setProperty("scroll-snap-type",l),delete r.dataset.scrollSnapType)})},focusIndicatorEl({context:e,event:t,scope:n}){if(t.src!=="indicator")return;let r=WC(n,e.get("page"));r&&B(()=>r.focus({preventScroll:!0}))},invokeDragStart({context:e,prop:t}){var n;(n=t("onDragStatusChange"))==null||n({type:"dragging.start",isDragging:!0,page:e.get("page")})},invokeDragging({context:e,prop:t}){var n;(n=t("onDragStatusChange"))==null||n({type:"dragging",isDragging:!0,page:e.get("page")})},invokeDraggingEnd({context:e,prop:t}){var n;(n=t("onDragStatusChange"))==null||n({type:"dragging.end",isDragging:!1,page:e.get("page")})},invokeAutoplay({context:e,prop:t}){var n;(n=t("onAutoplayStatusChange"))==null||n({type:"autoplay",isPlaying:!0,page:e.get("page")})},invokeAutoplayStart({context:e,prop:t}){var n;(n=t("onAutoplayStatusChange"))==null||n({type:"autoplay.start",isPlaying:!0,page:e.get("page")})},invokeAutoplayEnd({context:e,prop:t}){var n;(n=t("onAutoplayStatusChange"))==null||n({type:"autoplay.stop",isPlaying:!1,page:e.get("page")})}}}});QC=class extends X{initMachine(e){return new Y(ZC,e)}initApi(){return this.zagConnect(KC)}updateProps(e){super.updateProps(e),this.machine.service.send({type:"SNAP.REFRESH"})}render(){var d;let e=(d=this.el.querySelector('[data-scope="carousel"][data-part="root"]'))!=null?d:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="carousel"][data-part="control"]');t&&this.spreadProps(t,this.api.getControlProps());let n=this.el.querySelector('[data-scope="carousel"][data-part="item-group"]');n&&this.spreadProps(n,this.api.getItemGroupProps());let r=Number(this.el.dataset.slideCount)||0;for(let g=0;gj(this.liveSocket),r=O(e,"controlled"),i=G(e,"slideCount");if(i==null||i<1)return;let a=new QC(e,y(h({id:e.id,slideCount:i},r?{page:al(e,"page")}:{defaultPage:al(e,"defaultPage")}),{dir:q(e),orientation:V(e,"orientation"),slidesPerPage:G(e,"slidesPerPage"),slidesPerMove:V(e,"slidesPerMove")==="auto"?"auto":G(e,"slidesPerMove"),loop:O(e,"loop"),autoplay:O(e,"autoplay")?{delay:G(e,"autoplayDelay")}:!1,allowMouseDrag:O(e,"allowMouseDrag"),spacing:V(e,"spacing"),padding:V(e,"padding"),inViewThreshold:G(e,"inViewThreshold"),snapType:V(e,"snapType"),autoSize:O(e,"autoSize"),onPageChange:l=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,page:Nf(l.page),pageSnapPoint:l.pageSnapPoint},serverEventName:V(e,"onPageChange"),clientEventName:V(e,"onPageChangeClient")})}}));a.init(),this.carousel=a;let o=ie(e);this.domRegistry=o,o.add("corex:carousel:play",()=>{a.api.play()}),o.add("corex:carousel:pause",()=>{a.api.pause()}),o.add("corex:carousel:scroll-next",l=>{a.api.scrollNext(co(l.detail))}),o.add("corex:carousel:scroll-prev",l=>{a.api.scrollPrev(co(l.detail))});let s=re(this);this.handleRegistry=s,s.add("carousel_play",l=>{$(e.id,H(l))&&a.api.play()}),s.add("carousel_pause",l=>{$(e.id,H(l))&&a.api.pause()}),s.add("carousel_scroll_next",l=>{$(e.id,H(l))&&a.api.scrollNext(co(l))}),s.add("carousel_scroll_prev",l=>{$(e.id,H(l))&&a.api.scrollPrev(co(l))})},updated(){var n;let e=G(this.el,"slideCount");if(e==null||e<1)return;let t=O(this.el,"controlled");(n=this.carousel)==null||n.updateProps(y(h({id:this.el.id,slideCount:e},t?{page:al(this.el,"page")}:{}),{dir:q(this.el),orientation:V(this.el,"orientation"),slidesPerPage:G(this.el,"slidesPerPage"),slidesPerMove:V(this.el,"slidesPerMove")==="auto"?"auto":G(this.el,"slidesPerMove"),loop:O(this.el,"loop"),autoplay:O(this.el,"autoplay")?{delay:G(this.el,"autoplayDelay")}:!1,allowMouseDrag:O(this.el,"allowMouseDrag"),spacing:V(this.el,"spacing"),padding:V(this.el,"padding"),inViewThreshold:G(this.el,"inViewThreshold"),snapType:V(this.el,"snapType"),autoSize:O(this.el,"autoSize")}))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.carousel)==null||n.destroy()}}});function _d(e){let t=h({},e);return delete t.defaultChecked,delete t.checked,t}function ol(e,t,n,r,i){r(e,_d(i)),e.checked=n,it(e,t)}var sl=ee(()=>{"use strict";oe()});function t0(e){return!(e.metaKey||!$i()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function r0(e,t,n){let r=n?ne(n):null,i=Ge(r),a=ye(r),o=gr(i);return e=e||o instanceof a.HTMLInputElement&&!n0.has(o==null?void 0:o.type)||o instanceof a.HTMLTextAreaElement||o instanceof a.HTMLElement&&o.isContentEditable,!(e&&t==="keyboard"&&n instanceof a.KeyboardEvent&&!Reflect.has(i0,n.key))}function dl(e,t){for(let n of $d)n(e,t)}function cl(e){ti=!0,t0(e)&&(Kn="keyboard",dl("keyboard",e))}function Ut(e){Kn="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(ti=!0,dl("pointer",e))}function Mf(e){hh(e)&&(ti=!0,Kn="virtual")}function _f(e){let t=ne(e);t===ye(t)||t===Ge(t)||Ff||!e.isTrusted||(!ti&&!Hd&&(Kn="virtual",dl("virtual",e)),ti=!1,Hd=!1)}function $f(){Ff||(ti=!1,Hd=!0)}function a0(e){if(typeof window=="undefined"||ll.get(ye(e)))return;let t=ye(e),n=Ge(e),r=t.HTMLElement.prototype.focus;function i(){ti=!0,r.apply(this,arguments)}try{Object.defineProperty(t.HTMLElement.prototype,"focus",{configurable:!0,value:i})}catch(a){}n.addEventListener("keydown",cl,!0),n.addEventListener("keyup",cl,!0),n.addEventListener("click",Mf,!0),t.addEventListener("focus",_f,!0),t.addEventListener("blur",$f,!1),typeof t.PointerEvent!="undefined"?(n.addEventListener("pointerdown",Ut,!0),n.addEventListener("pointermove",Ut,!0),n.addEventListener("pointerup",Ut,!0)):(n.addEventListener("mousedown",Ut,!0),n.addEventListener("mousemove",Ut,!0),n.addEventListener("mouseup",Ut,!0)),t.addEventListener("beforeunload",()=>{o0(e)},{once:!0}),ll.set(t,{focus:r})}function Sr(){return Kn}function Ir(e){Kn=e,dl(e,null)}function vn(){return Kn==="keyboard"||Kn==="virtual"}function nt(e={}){let{isTextInput:t,autoFocus:n,onChange:r,root:i}=e;a0(i),r==null||r({isFocusVisible:n||vn(),modality:Kn});let a=(o,s)=>{r0(!!t,o,s)&&(r==null||r({isFocusVisible:vn(),modality:o}))};return $d.add(a),()=>{$d.delete(a)}}var n0,Kn,$d,ll,ti,Hd,Ff,i0,o0,yn=ee(()=>{"use strict";oe();n0=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);Kn=null,$d=new Set,ll=new Map,ti=!1,Hd=!1,Ff=!1,i0={Tab:!0,Escape:!0};o0=(e,t)=>{let n=ye(e),r=Ge(e);t&&r.removeEventListener("DOMContentLoaded",t);let i=ll.get(n);if(i){try{Object.defineProperty(n.HTMLElement.prototype,"focus",{configurable:!0,value:i.focus})}catch(a){}r.removeEventListener("keydown",cl,!0),r.removeEventListener("keyup",cl,!0),r.removeEventListener("click",Mf,!0),n.removeEventListener("focus",_f,!0),n.removeEventListener("blur",$f,!1),typeof n.PointerEvent!="undefined"?(r.removeEventListener("pointerdown",Ut,!0),r.removeEventListener("pointermove",Ut,!0),r.removeEventListener("pointerup",Ut,!0)):(r.removeEventListener("mousedown",Ut,!0),r.removeEventListener("mousemove",Ut,!0),r.removeEventListener("mouseup",Ut,!0)),ll.delete(n)}}});var Gf={};pe(Gf,{Checkbox:()=>h0,checkedChangePayload:()=>zi});function d0(e,t){let{send:n,context:r,prop:i,computed:a,scope:o}=e,s=!!i("disabled"),l=!!i("readOnly"),c=!!i("required"),d=!!i("invalid"),g=!s&&r.get("focused"),p=!s&&r.get("focusVisible"),u=a("checked"),f=a("indeterminate"),m=r.get("checked"),S={"data-active":b(r.get("active")),"data-focus":b(g),"data-focus-visible":b(p),"data-readonly":b(l),"data-hover":b(r.get("hovered")),"data-disabled":b(s),"data-state":f?"indeterminate":u?"checked":"unchecked","data-invalid":b(d),"data-required":b(c)};return{checked:u,disabled:s,indeterminate:f,focused:g,checkedState:m,setChecked(T){n({type:"CHECKED.SET",checked:T,isTrusted:!1})},toggleChecked(){n({type:"CHECKED.TOGGLE",checked:u,isTrusted:!1})},getRootProps(){return t.label(y(h(h({},ul.root.attrs),S),{dir:i("dir"),id:Uf(o),htmlFor:Bd(o),onPointerMove(){s||n({type:"CONTEXT.SET",context:{hovered:!0}})},onPointerLeave(){s||n({type:"CONTEXT.SET",context:{hovered:!1}})},onClick(T){ne(T)===uo(o)&&T.stopPropagation()}}))},getLabelProps(){return t.element(y(h(h({},ul.label.attrs),S),{dir:i("dir"),id:Hf(o)}))},getControlProps(){return t.element(y(h(h({},ul.control.attrs),S),{dir:i("dir"),id:l0(o),"aria-hidden":!0}))},getIndicatorProps(){return t.element(y(h(h({},ul.indicator.attrs),S),{dir:i("dir"),hidden:!f&&!u}))},getHiddenInputProps(){return t.input({id:Bd(o),type:"checkbox",required:i("required"),defaultChecked:u,disabled:s,"aria-labelledby":Hf(o),"aria-invalid":d,name:i("name"),form:i("form"),value:i("value"),style:mt,onFocus(){let T=vn();n({type:"CONTEXT.SET",context:{focused:!0,focusVisible:T}})},onBlur(){n({type:"CONTEXT.SET",context:{focused:!1,focusVisible:!1}})},onClick(T){if(l){T.preventDefault();return}let w=T.currentTarget.checked;n({type:"CHECKED.SET",checked:w,isTrusted:!0})}})}}}function gl(e){return e==="indeterminate"}function g0(e){return gl(e)?!1:!!e}var s0,ul,Uf,Hf,l0,Bd,c0,uo,Bf,u0,p0,h0,qf=ee(()=>{"use strict";sl();yn();$e();Ve();be();oe();s0=z("checkbox").parts("root","label","control","indicator"),ul=s0.build(),Uf=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`checkbox:${e.id}`},Hf=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`checkbox:${e.id}:label`},l0=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`checkbox:${e.id}:control`},Bd=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`checkbox:${e.id}:input`},c0=e=>e.getById(Uf(e)),uo=e=>e.getById(Bd(e));({not:Bf}=we()),u0=te({props({props:e}){var t;return y(h({value:"on"},e),{defaultChecked:(t=e.defaultChecked)!=null?t:!1})},initialState(){return"ready"},context({prop:e,bindable:t}){return{checked:t(()=>({defaultValue:e("defaultChecked"),value:e("checked"),onChange(n){var r;(r=e("onCheckedChange"))==null||r({checked:n})}})),fieldsetDisabled:t(()=>({defaultValue:!1})),focusVisible:t(()=>({defaultValue:!1})),active:t(()=>({defaultValue:!1})),focused:t(()=>({defaultValue:!1})),hovered:t(()=>({defaultValue:!1}))}},watch({track:e,context:t,prop:n,action:r}){e([()=>n("disabled")],()=>{r(["removeFocusIfNeeded"])}),e([()=>t.get("checked")],()=>{r(["syncInputElement"])})},effects:["trackFormControlState","trackPressEvent","trackFocusVisible"],on:{"CHECKED.TOGGLE":[{guard:Bf("isTrusted"),actions:["toggleChecked","dispatchChangeEvent"]},{actions:["toggleChecked"]}],"CHECKED.SET":[{guard:Bf("isTrusted"),actions:["setChecked","dispatchChangeEvent"]},{actions:["setChecked"]}],"CONTEXT.SET":{actions:["setContext"]}},computed:{indeterminate:({context:e})=>gl(e.get("checked")),checked:({context:e})=>g0(e.get("checked")),disabled:({context:e,prop:t})=>!!t("disabled")||e.get("fieldsetDisabled")},states:{ready:{}},implementations:{guards:{isTrusted:({event:e})=>!!e.isTrusted},effects:{trackPressEvent({context:e,computed:t,scope:n}){if(!t("disabled"))return Ds({pointerNode:c0(n),keyboardNode:uo(n),isValidKey:r=>r.key===" ",onPress:()=>e.set("active",!1),onPressStart:()=>e.set("active",!0),onPressEnd:()=>e.set("active",!1)})},trackFocusVisible({computed:e,scope:t}){var n;if(!e("disabled"))return nt({root:(n=t.getRootNode)==null?void 0:n.call(t)})},trackFormControlState({context:e,scope:t}){return ht(uo(t),{onFieldsetDisabledChange(n){e.set("fieldsetDisabled",n)},onFormReset(){e.set("checked",e.initial("checked"))}})}},actions:{setContext({context:e,event:t}){for(let n in t.context)e.set(n,t.context[n])},syncInputElement({context:e,computed:t,scope:n}){let r=uo(n);r&&(ja(r,t("checked")),r.indeterminate=gl(e.get("checked")))},removeFocusIfNeeded({context:e,prop:t}){t("disabled")&&e.get("focused")&&(e.set("focused",!1),e.set("focusVisible",!1))},setChecked({context:e,event:t}){e.set("checked",t.checked)},toggleChecked({context:e,computed:t}){let n=gl(t("checked"))?!0:!t("checked");e.set("checked",n)},dispatchChangeEvent({computed:e,scope:t}){queueMicrotask(()=>{let n=uo(t);Bi(n,{checked:e("checked")})})}}}});p0=class extends X{initMachine(e){return new Y(u0,e)}initApi(){return this.zagConnect(d0)}render(){let e=this.el.querySelector('[data-scope="checkbox"][data-part="root"]');if(!e)return;this.spreadProps(e,this.api.getRootProps());let t=e.querySelector(':scope > [data-scope="checkbox"][data-part="hidden-input"]');t instanceof HTMLInputElement&&ol(t,this.el,this.api.checked===!0,(i,a)=>this.spreadProps(i,a),this.api.getHiddenInputProps());let n=e.querySelector(':scope > [data-scope="checkbox"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps());let r=e.querySelector(':scope > [data-scope="checkbox"][data-part="control"]');if(r){this.spreadProps(r,this.api.getControlProps());let i=r.querySelector(':scope > [data-scope="checkbox"][data-part="indicator"]');i&&this.spreadProps(i,this.api.getIndicatorProps())}}},h0={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=new p0(e,y(h({id:e.id},Gs(e)),{disabled:O(e,"disabled"),name:V(e,"name"),form:V(e,"form"),value:V(e,"value"),dir:q(e),invalid:O(e,"invalid"),required:O(e,"required"),readOnly:O(e,"readonly"),onCheckedChange:s=>{W({el:e,canPushServer:n(),pushEvent:t,payload:zi(e,s),serverEventName:V(e,"onCheckedChange"),clientEventName:V(e,"onCheckedChangeClient")});let l=e.querySelector('[data-scope="checkbox"][data-part="hidden-input"]');l&&queueMicrotask(()=>{l.checked=s.checked===!0,l.dispatchEvent(new Event("input",{bubbles:!0})),l.dispatchEvent(new Event("change",{bubbles:!0}))})}}));r.init(),this.checkbox=r;let i=ie(e);this.domRegistry=i,i.add("corex:checkbox:set-checked",s=>{let{checked:l}=s.detail;r.api.setChecked(l)}),i.add("corex:checkbox:toggle-checked",()=>{r.api.toggleChecked()});let a=re(this);this.handleRegistry=a,a.add("checkbox_set_checked",s=>{if(!$(e.id,H(s)))return;let l=Ys(s);typeof l=="boolean"&&r.api.setChecked(l)}),a.add("checkbox_toggle_checked",s=>{$(e.id,H(s))&&r.api.toggleChecked()});let o=(s,l,c,d)=>{let g={id:e.id,value:d};Ue({respondTo:s,canPushServer:n(),pushEvent:t,serverEventName:l,serverPayload:g,el:e,domEventName:c,domDetail:g})};a.add("checkbox_checked",s=>{$(e.id,H(s))&&o(de(s),"checkbox_checked_response","corex:checkbox:checked",r.api.checked)}),a.add("checkbox_focused",s=>{$(e.id,H(s))&&o(de(s),"checkbox_focused_response","corex:checkbox:focused",r.api.focused)}),a.add("checkbox_disabled",s=>{$(e.id,H(s))&&o(de(s),"checkbox_disabled_response","corex:checkbox:disabled",r.api.disabled)})},updated(){let e=this.checkbox;e&&e.updateProps(y(h({id:this.el.id},Us(this.el)),{disabled:O(this.el,"disabled"),name:V(this.el,"name"),form:V(this.el,"form"),value:V(this.el,"value"),dir:q(this.el),invalid:O(this.el,"invalid"),required:O(this.el,"required"),readOnly:O(this.el,"readonly")}))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.checkbox)==null||n.destroy()}}});function Kf(e,t){let n=new Wf(({now:r,deltaMs:i})=>{if(i>=t){let a=t>0?r-i%t:r;n.setStartMs(a),e({startMs:a,deltaMs:i})}});return n.start(),()=>n.stop()}function Tr(e,t){let n=new Wf(({deltaMs:r})=>{if(r>=t)return e(),!1});return n.start(),()=>n.stop()}var pl,hl,Wf,fl=ee(()=>{"use strict";oe();pl=()=>performance.now(),Wf=class{constructor(e){dn(this,"onTick",e),dn(this,"frameId",null),dn(this,"pausedAtMs",null),dn(this,"context"),dn(this,"cancelFrame",()=>{this.frameId!==null&&(cancelAnimationFrame(this.frameId),this.frameId=null)}),dn(this,"setStartMs",t=>{this.context.startMs=t}),dn(this,"start",()=>{if(this.frameId!==null)return;let t=pl();this.pausedAtMs!==null?(this.context.startMs+=t-this.pausedAtMs,this.pausedAtMs=null):this.context.startMs=t,this.frameId=requestAnimationFrame(jc(this,hl))}),dn(this,"pause",()=>{this.frameId!==null&&(this.cancelFrame(),this.pausedAtMs=pl())}),dn(this,"stop",()=>{this.frameId!==null&&(this.cancelFrame(),this.pausedAtMs=null)}),qp(this,hl,t=>{if(this.context.now=t,this.context.deltaMs=t-this.context.startMs,this.onTick(this.context)===!1){this.stop();return}this.frameId=requestAnimationFrame(jc(this,hl))}),this.context={now:0,startMs:pl(),deltaMs:0}}get elapsedMs(){return this.pausedAtMs!==null?this.pausedAtMs-this.context.startMs:pl()-this.context.startMs}};hl=new WeakMap});var jf={};pe(jf,{Clipboard:()=>w0,copyPayload:()=>zf});function E0(e,t){let n=e.createElement("pre");return Object.assign(n.style,{width:"1px",height:"1px",position:"fixed",top:"5px"}),n.textContent=t,n}function P0(e){let n=ye(e).getSelection();if(n==null)return Promise.reject(new Error);n.removeAllRanges();let r=e.ownerDocument,i=r.createRange();return i.selectNodeContents(e),n.addRange(i),r.execCommand("copy"),n.removeAllRanges(),Promise.resolve()}function S0(e,t){var i;let n=e.defaultView||window;if(((i=n.navigator.clipboard)==null?void 0:i.writeText)!==void 0)return n.navigator.clipboard.writeText(t);if(!e.body)return Promise.reject(new Error);let r=E0(e,t);return e.body.appendChild(r),P0(r),e.body.removeChild(r),Promise.resolve()}function I0(e,t){let{state:n,send:r,context:i,scope:a,prop:o}=e,s=n.matches("copied"),l=o("translations");return{copied:s,value:i.get("value"),setValue(c){r({type:"VALUE.SET",value:c})},copy(){r({type:"COPY"})},getRootProps(){return t.element(y(h({},Zi.root.attrs),{"data-copied":b(s),id:m0(a)}))},getLabelProps(){return t.label(y(h({},Zi.label.attrs),{htmlFor:Ud(a),"data-copied":b(s),id:v0(a)}))},getControlProps(){return t.element(y(h({},Zi.control.attrs),{"data-copied":b(s)}))},getInputProps(){return t.input(y(h({},Zi.input.attrs),{defaultValue:i.get("value"),"data-copied":b(s),readOnly:!0,"data-readonly":"true",id:Ud(a),onFocus(c){c.currentTarget.select()},onCopy(){r({type:"INPUT.COPY"})}}))},getTriggerProps(){var c;return t.button(y(h({},Zi.trigger.attrs),{type:"button","aria-label":(c=l.triggerLabel)==null?void 0:c.call(l,s),"data-copied":b(s),onClick(){r({type:"COPY"})}}))},getIndicatorProps(c){return t.element(y(h({},Zi.indicator.attrs),{hidden:c.copied!==s}))}}}function zf(e,t){return{id:e.id,value:t}}var f0,Zi,m0,Ud,v0,y0,b0,T0,C0,w0,Yf=ee(()=>{"use strict";fl();Ve();be();oe();f0=z("clipboard").parts("root","control","trigger","indicator","input","label"),Zi=f0.build(),m0=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`clip:${e.id}`},Ud=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`clip:${e.id}:input`},v0=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`clip:${e.id}:label`},y0=e=>e.getById(Ud(e)),b0=(e,t)=>S0(e.getDoc(),t);T0=te({props({props:e}){return y(h({timeout:3e3,defaultValue:""},e),{translations:h({triggerLabel:t=>t?"Copied to clipboard":"Copy to clipboard"},e.translations)})},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var r;(r=e("onValueChange"))==null||r({value:n})}}))}},watch({track:e,context:t,action:n}){e([()=>t.get("value")],()=>{n(["syncInputElement"])})},on:{"VALUE.SET":{actions:["setValue"]},COPY:{target:"copied",actions:["copyToClipboard","invokeOnCopy"]}},states:{idle:{on:{"INPUT.COPY":{target:"copied",actions:["invokeOnCopy"]}}},copied:{effects:["waitForTimeout"],on:{"COPY.DONE":{target:"idle"},COPY:{target:"copied",actions:["copyToClipboard","invokeOnCopy"]},"INPUT.COPY":{actions:["invokeOnCopy"]}}}},implementations:{effects:{waitForTimeout({prop:e,send:t}){return Tr(()=>{t({type:"COPY.DONE"})},e("timeout"))}},actions:{setValue({context:e,event:t}){e.set("value",t.value)},copyToClipboard({context:e,scope:t}){b0(t,e.get("value"))},invokeOnCopy({prop:e}){var t;(t=e("onStatusChange"))==null||t({copied:!0})},syncInputElement({context:e,scope:t}){let n=y0(t);n&&_e(n,e.get("value"))}}}}),C0=class extends X{initMachine(e){return new Y(T0,e)}initApi(){return this.zagConnect(I0)}render(){let e=this.el.querySelector('[data-scope="clipboard"][data-part="root"]');if(e){this.spreadProps(e,this.api.getRootProps());let t=e.querySelector('[data-scope="clipboard"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=e.querySelector('[data-scope="clipboard"][data-part="control"]');if(n){this.spreadProps(n,this.api.getControlProps());let r=n.querySelector('[data-scope="clipboard"][data-part="input"]');if(r){let a=h({},this.api.getInputProps()),o=this.el.dataset.inputAriaLabel;o&&(a["aria-label"]=o),this.spreadProps(r,a)}let i=n.querySelector('[data-scope="clipboard"][data-part="trigger"]');if(i){let a=h({},this.api.getTriggerProps()),o=this.el.dataset.triggerAriaLabel;o&&(a["aria-label"]=o),this.spreadProps(i,a)}}}}};w0={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=new C0(e,{id:e.id,timeout:G(e,"timeout"),defaultValue:V(e,"defaultValue"),onStatusChange:o=>{var l;if((o==null?void 0:o.copied)!==!0)return;let s=(l=r.api.value)!=null?l:V(e,"defaultValue");W({el:e,canPushServer:n(),pushEvent:t,payload:zf(e,s),serverEventName:V(e,"onCopy"),clientEventName:V(e,"onCopyClient")})}});r.init(),this.clipboard=r;let i=ie(e);this.domRegistry=i,i.add("corex:clipboard:copy",()=>{r.api.copy()}),i.add("corex:clipboard:set-value",o=>{var l;let s=(l=o.detail)==null?void 0:l.value;typeof s=="string"&&r.api.setValue(s)});let a=re(this);this.handleRegistry=a,a.add("clipboard_copy",o=>{$(e.id,H(o))&&r.api.copy()}),a.add("clipboard_set_value",o=>{var c;if(!$(e.id,H(o))||!o||typeof o!="object")return;let s=o,l=(c=s.value)!=null?c:s.value;typeof l=="string"&&r.api.setValue(l)})},updated(){var e;(e=this.clipboard)==null||e.updateProps({id:this.el.id,timeout:G(this.el,"timeout")})},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.clipboard)==null||n.destroy()}}});var Zf={};pe(Zf,{Collapsible:()=>N0,openChangePayload:()=>Xf});function x0(e,t){let{state:n,send:r,context:i,scope:a,prop:o}=e,s=n.matches("open")||n.matches("closing"),l=n.matches("open"),c=n.matches("closed"),{width:d,height:g}=i.get("size"),p=!!o("disabled"),u=o("collapsedHeight"),f=o("collapsedWidth"),m=u!=null,S=f!=null,T=m||S,w=!i.get("initial")&&l;return{disabled:p,visible:s,open:l,measureSize(){r({type:"size.measure"})},setOpen(I){n.matches("open")!==I&&r({type:I?"open":"close"})},getRootProps(){return t.element(y(h({},ml.root.attrs),{"data-state":l?"open":"closed",dir:o("dir"),id:V0(a)}))},getContentProps(){return t.element(y(h({},ml.content.attrs),{id:Gd(a),"data-collapsible":"","data-state":w?void 0:l?"open":"closed","data-disabled":b(p),"data-has-collapsed-size":b(T),hidden:!s&&!T,dir:o("dir"),style:h(h({"--height":ke(g),"--width":ke(d),"--collapsed-height":ke(u),"--collapsed-width":ke(f)},c&&m&&{overflow:"hidden",minHeight:ke(u),maxHeight:ke(u)}),c&&S&&{overflow:"hidden",minWidth:ke(f),maxWidth:ke(f)})}))},getTriggerProps(){return t.element(y(h({},ml.trigger.attrs),{id:A0(a),dir:o("dir"),type:"button","data-state":l?"open":"closed","data-disabled":b(p),"aria-controls":Gd(a),"aria-expanded":s||!1,onClick(I){I.defaultPrevented||p||r({type:l?"close":"open"})}}))},getIndicatorProps(){return t.element(y(h({},ml.indicator.attrs),{dir:o("dir"),"data-state":l?"open":"closed","data-disabled":b(p)}))}}}function Xf(e,t){return{id:e.id,open:t.open}}var O0,ml,V0,Gd,A0,go,R0,k0,N0,Jf=ee(()=>{"use strict";Bt();$e();Ve();be();oe();O0=z("collapsible").parts("root","trigger","content","indicator"),ml=O0.build(),V0=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`collapsible:${e.id}`},Gd=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`collapsible:${e.id}:content`},A0=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`collapsible:${e.id}:trigger`},go=e=>e.getById(Gd(e));R0=te({initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"closed"},context({bindable:e}){return{size:e(()=>({defaultValue:{height:0,width:0},sync:!0})),initial:e(()=>({defaultValue:!1}))}},refs(){return{cleanup:void 0,stylesRef:void 0}},watch({track:e,prop:t,action:n}){e([()=>t("open")],()=>{n(["setInitial","computeSize","toggleVisibility"])})},exit:["cleanupNode"],states:{closed:{effects:["trackTabbableElements"],on:{"controlled.open":{target:"open"},open:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitial","computeSize","invokeOnOpen"]}]}},closing:{effects:["trackExitAnimation"],on:{"controlled.close":{target:"closed"},"controlled.open":{target:"open"},open:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitial","invokeOnOpen"]}],close:[{guard:"isOpenControlled",actions:["invokeOnExitComplete"]},{target:"closed",actions:["setInitial","computeSize","invokeOnExitComplete"]}],"animation.end":{target:"closed",actions:["invokeOnExitComplete","clearInitial"]}}},open:{effects:["trackEnterAnimation"],on:{"controlled.close":{target:"closing"},close:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closing",actions:["setInitial","computeSize","invokeOnClose"]}],"size.measure":{actions:["measureSize"]},"animation.end":{actions:["clearInitial"]}}}},implementations:{guards:{isOpenControlled:({prop:e})=>e("open")!=null},effects:{trackEnterAnimation:({send:e,scope:t})=>{let n,r=B(()=>{let i=go(t);if(!i)return;let a=pt(i).animationName;if(!a||a==="none"){e({type:"animation.end"});return}let s=l=>{ne(l)===i&&e({type:"animation.end"})};i.addEventListener("animationend",s),n=()=>{i.removeEventListener("animationend",s)}});return()=>{r(),n==null||n()}},trackExitAnimation:({send:e,scope:t})=>{let n,r=B(()=>{let i=go(t);if(!i)return;let a=pt(i).animationName;if(!a||a==="none"){e({type:"animation.end"});return}let s=c=>{ne(c)===i&&e({type:"animation.end"})};i.addEventListener("animationend",s);let l=Xr(i,{animationFillMode:"forwards"});n=()=>{i.removeEventListener("animationend",s),Yr(()=>l())}});return()=>{r(),n==null||n()}},trackTabbableElements:({scope:e,prop:t})=>{if(!t("collapsedHeight")&&!t("collapsedWidth"))return;let n=go(e);if(!n)return;let r=()=>{let s=Bn(n).map(l=>Ih(l,"inert",""));return()=>{s.forEach(l=>l())}},i=r(),a=Ls(n,{callback(){i(),i=r()}});return()=>{i(),a()}}},actions:{setInitial:({context:e,flush:t})=>{t(()=>{e.set("initial",!0)})},clearInitial:({context:e})=>{e.set("initial",!1)},cleanupNode:({refs:e})=>{e.set("stylesRef",null)},measureSize:({context:e,scope:t})=>{let n=go(t);if(!n)return;let{height:r,width:i}=n.getBoundingClientRect();e.set("size",{height:r,width:i})},computeSize:({refs:e,scope:t,context:n})=>{var i;(i=e.get("cleanup"))==null||i();let r=B(()=>{let a=go(t);if(!a)return;let o=a.hidden;a.style.animationName="none",a.style.animationDuration="0s",a.hidden=!1;let s=a.getBoundingClientRect();n.set("size",{height:s.height,width:s.width}),n.get("initial")&&(a.style.animationName="",a.style.animationDuration=""),a.hidden=o});e.set("cleanup",r)},invokeOnOpen:({prop:e})=>{var t;(t=e("onOpenChange"))==null||t({open:!0})},invokeOnClose:({prop:e})=>{var t;(t=e("onOpenChange"))==null||t({open:!1})},invokeOnExitComplete:({prop:e})=>{var t;(t=e("onExitComplete"))==null||t()},toggleVisibility:({prop:e,send:t})=>{t({type:e("open")?"controlled.open":"controlled.close"})}}}}),k0=class extends X{initMachine(e){return new Y(R0,e)}initApi(){return this.zagConnect(x0)}render(){let e=this.el.dataset.orientation,t=this.el.querySelector('[data-scope="collapsible"][data-part="root"]');if(t){this.spreadProps(t,this.api.getRootProps()),e&&(t.dataset.orientation=e);let n=t.querySelector('[data-scope="collapsible"][data-part="trigger"]');n&&(this.spreadProps(n,this.api.getTriggerProps()),e&&(n.dataset.orientation=e));let r=t.querySelector('[data-scope="collapsible"][data-part="content"]');r&&(this.spreadProps(r,this.api.getContentProps()),e&&(r.dataset.orientation=e))}}};N0={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=new k0(e,y(h({id:e.id},zs(e,"open","defaultOpen")),{disabled:O(e,"disabled"),dir:q(e),onOpenChange:s=>{W({el:e,canPushServer:n(),pushEvent:t,payload:Xf(e,s),serverEventName:V(e,"onOpenChange"),clientEventName:V(e,"onOpenChangeClient")})}}));r.init(),this.collapsible=r;let i=s=>{Ue({respondTo:s,canPushServer:n(),pushEvent:t,serverEventName:"collapsible_open_response",serverPayload:{id:e.id,open:r.api.open,disabled:r.api.disabled},el:e,domEventName:"collapsible-open",domDetail:{id:e.id,open:r.api.open,disabled:r.api.disabled}})},a=ie(e);this.domRegistry=a,a.add("corex:collapsible:set-open",s=>{let{open:l}=s.detail;r.api.setOpen(l)}),a.add("corex:collapsible:open",s=>{i(de(s.detail))});let o=re(this);this.handleRegistry=o,o.add("collapsible_set_open",s=>{$(e.id,H(s))&&r.api.setOpen(s.open)}),o.add("collapsible_open",s=>{$(e.id,H(s))&&i(de(s))})},updated(){var e;(e=this.collapsible)==null||e.updateProps(y(h({id:this.el.id},Bs(this.el,"open","defaultOpen")),{disabled:O(this.el,"disabled"),dir:q(this.el)}))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.collapsible)==null||n.destroy()}}});function L0(e){return V(e,"submitName")!==void 0}function Ji(e,t,n=["hidden-input"]){if(L0(e))for(let r of n){let i=e.querySelector(`[data-scope="${t}"][data-part="${r}"]`);i&&(i.removeAttribute("name"),i.removeAttribute("form"))}}var vl=ee(()=>{"use strict";oe()});function Qi(e={}){var c;let{level:t="polite",document:n=document,root:r,delay:i=0}=e,a=(c=n.defaultView)!=null?c:window,o=r!=null?r:n.body;function s(d,g){let p=n.getElementById(yl);p==null||p.remove(),g=g!=null?g:i;let u=n.createElement("span");u.id=yl,u.dataset.liveAnnouncer="true";let f=t!=="assertive"?"status":"alert";u.setAttribute("aria-live",t),u.setAttribute("role",f),Object.assign(u.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}),o.appendChild(u),a.setTimeout(()=>{u.textContent=d},g)}function l(){let d=n.getElementById(yl);d==null||d.remove()}return{announce:s,destroy:l,toJSON(){return yl}}}var yl,bl=ee(()=>{"use strict";yl="__live-region__"});function D0(e){let[t,n]=e.split("-");return{side:t,align:n,hasAlign:n!=null}}function gm(e){return e.split("-")[0]}function Kd(e,t,n){return At(e,Cr(t,n))}function jn(e,t){return typeof e=="function"?e(t):e}function Yn(e){return e.split("-")[0]}function ra(e){return e.split("-")[1]}function Yd(e){return e==="x"?"y":"x"}function Xd(e){return e==="y"?"height":"width"}function bn(e){let t=e[0];return t==="t"||t==="b"?"y":"x"}function Zd(e){return Yd(bn(e))}function _0(e,t,n){n===void 0&&(n=!1);let r=ra(e),i=Zd(e),a=Xd(i),o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(o=Sl(o)),[o,Sl(o)]}function $0(e){let t=Sl(e);return[zd(e),t,zd(t)]}function zd(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}function U0(e,t,n){switch(e){case"top":case"bottom":return n?t?em:Qf:t?Qf:em;case"left":case"right":return t?H0:B0;default:return[]}}function G0(e,t,n,r){let i=ra(e),a=U0(Yn(e),n==="start",r);return i&&(a=a.map(o=>o+"-"+i),t&&(a=a.concat(a.map(zd)))),a}function Sl(e){let t=Yn(e);return M0[t]+e.slice(t.length)}function q0(e){return h({top:0,right:0,bottom:0,left:0},e)}function pm(e){return typeof e!="number"?q0(e):{top:e,right:e,bottom:e,left:e}}function Il(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function tm(e,t,n){let{reference:r,floating:i}=e,a=bn(t),o=Zd(t),s=Xd(o),l=Yn(t),c=a==="y",d=r.x+r.width/2-i.width/2,g=r.y+r.height/2-i.height/2,p=r[s]/2-i[s]/2,u;switch(l){case"top":u={x:d,y:r.y-i.height};break;case"bottom":u={x:d,y:r.y+r.height};break;case"right":u={x:r.x+r.width,y:g};break;case"left":u={x:r.x-i.width,y:g};break;default:u={x:r.x,y:r.y}}switch(ra(t)){case"start":u[o]-=p*(n&&c?-1:1);break;case"end":u[o]+=p*(n&&c?-1:1);break}return u}function W0(e,t){return Ke(this,null,function*(){var n;t===void 0&&(t={});let{x:r,y:i,platform:a,rects:o,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:g="floating",altBoundary:p=!1,padding:u=0}=jn(t,e),f=pm(u),S=s[p?g==="floating"?"reference":"floating":g],T=Il(yield a.getClippingRect({element:(n=yield a.isElement==null?void 0:a.isElement(S))==null||n?S:S.contextElement||(yield a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:c,rootBoundary:d,strategy:l})),w=g==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,I=yield a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating),P=(yield a.isElement==null?void 0:a.isElement(I))?(yield a.getScale==null?void 0:a.getScale(I))||{x:1,y:1}:{x:1,y:1},v=Il(a.convertOffsetParentRelativeRectToViewportRelativeRect?yield a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:w,offsetParent:I,strategy:l}):w);return{top:(T.top-v.top+f.top)/P.y,bottom:(v.bottom-T.bottom+f.bottom)/P.y,left:(T.left-v.left+f.left)/P.x,right:(v.right-T.right+f.right)/P.x}})}function nm(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function rm(e){return F0.some(t=>e[t]>=0)}function Z0(e,t){return Ke(this,null,function*(){let{placement:n,platform:r,elements:i}=e,a=yield r.isRTL==null?void 0:r.isRTL(i.floating),o=Yn(n),s=ra(n),l=bn(n)==="y",c=hm.has(o)?-1:1,d=a&&l?-1:1,g=jn(t,e),{mainAxis:p,crossAxis:u,alignmentAxis:f}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return s&&typeof f=="number"&&(u=s==="end"?f*-1:f),l?{x:u*d,y:p*c}:{x:p*c,y:u*d}})}function Tl(){return typeof window!="undefined"}function ia(e){return fm(e)?(e.nodeName||"").toLowerCase():"#document"}function xt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Pn(e){var t;return(t=(fm(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function fm(e){return Tl()?e instanceof Node||e instanceof xt(e).Node:!1}function rn(e){return Tl()?e instanceof Element||e instanceof xt(e).Element:!1}function Xn(e){return Tl()?e instanceof HTMLElement||e instanceof xt(e).HTMLElement:!1}function im(e){return!Tl()||typeof ShadowRoot=="undefined"?!1:e instanceof ShadowRoot||e instanceof xt(e).ShadowRoot}function fo(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=an(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function nw(e){return/^(table|td|th)$/.test(ia(e))}function Cl(e){try{if(e.matches(":popover-open"))return!0}catch(t){}try{return e.matches(":modal")}catch(t){return!1}}function Jd(e){let t=rn(e)?an(e):e;return ni(t.transform)||ni(t.translate)||ni(t.scale)||ni(t.rotate)||ni(t.perspective)||!Qd()&&(ni(t.backdropFilter)||ni(t.filter))||rw.test(t.willChange||"")||iw.test(t.contain||"")}function aw(e){let t=wr(e);for(;Xn(t)&&!na(t);){if(Jd(t))return t;if(Cl(t))return null;t=wr(t)}return null}function Qd(){return qd==null&&(qd=typeof CSS!="undefined"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),qd}function na(e){return/^(html|body|#document)$/.test(ia(e))}function an(e){return xt(e).getComputedStyle(e)}function wl(e){return rn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function wr(e){if(ia(e)==="html")return e;let t=e.assignedSlot||e.parentNode||im(e)&&e.host||Pn(e);return im(t)?t.host:t}function mm(e){let t=wr(e);return na(t)?e.ownerDocument?e.ownerDocument.body:e.body:Xn(t)&&fo(t)?t:mm(t)}function ho(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);let i=mm(e),a=i===((r=e.ownerDocument)==null?void 0:r.body),o=xt(i);if(a){let s=jd(o);return t.concat(o,o.visualViewport||[],fo(i)?i:[],s&&n?ho(s):[])}else return t.concat(i,ho(i,[],n))}function jd(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function vm(e){let t=an(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Xn(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Pl(n)!==a||Pl(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function eu(e){return rn(e)?e:e.contextElement}function ta(e){let t=eu(e);if(!Xn(t))return En(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=vm(t),o=(a?Pl(n.width):n.width)/r,s=(a?Pl(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}function ym(e){let t=xt(e);return!Qd()||!t.visualViewport?ow:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function sw(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==xt(e)?!1:t}function ri(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=eu(e),o=En(1);t&&(r?rn(r)&&(o=ta(r)):o=ta(e));let s=sw(a,n,r)?ym(a):En(0),l=(i.left+s.x)/o.x,c=(i.top+s.y)/o.y,d=i.width/o.x,g=i.height/o.y;if(a){let p=xt(a),u=r&&rn(r)?xt(r):r,f=p,m=jd(f);for(;m&&r&&u!==f;){let S=ta(m),T=m.getBoundingClientRect(),w=an(m),I=T.left+(m.clientLeft+parseFloat(w.paddingLeft))*S.x,P=T.top+(m.clientTop+parseFloat(w.paddingTop))*S.y;l*=S.x,c*=S.y,d*=S.x,g*=S.y,l+=I,c+=P,f=xt(m),m=jd(f)}}return Il({width:d,height:g,x:l,y:c})}function Ol(e,t){let n=wl(e).scrollLeft;return t?t.left+n:ri(Pn(e)).left+n}function bm(e,t){let n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ol(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function lw(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i==="fixed",o=Pn(r),s=t?Cl(t.floating):!1;if(r===o||s&&a)return n;let l={scrollLeft:0,scrollTop:0},c=En(1),d=En(0),g=Xn(r);if((g||!g&&!a)&&((ia(r)!=="body"||fo(o))&&(l=wl(r)),g)){let u=ri(r);c=ta(r),d.x=u.x+r.clientLeft,d.y=u.y+r.clientTop}let p=o&&!g&&!a?bm(o,l):En(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+p.x,y:n.y*c.y-l.scrollTop*c.y+d.y+p.y}}function cw(e){return Array.from(e.getClientRects())}function dw(e){let t=Pn(e),n=wl(e),r=e.ownerDocument.body,i=At(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=At(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Ol(e),s=-n.scrollTop;return an(r).direction==="rtl"&&(o+=At(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function uw(e,t){let n=xt(e),r=Pn(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,l=0;if(i){a=i.width,o=i.height;let d=Qd();(!d||d&&t==="fixed")&&(s=i.offsetLeft,l=i.offsetTop)}let c=Ol(r);if(c<=0){let d=r.ownerDocument,g=d.body,p=getComputedStyle(g),u=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,f=Math.abs(r.clientWidth-g.clientWidth-u);f<=am&&(a-=f)}else c<=am&&(a+=c);return{width:a,height:o,x:s,y:l}}function gw(e,t){let n=ri(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Xn(e)?ta(e):En(1),o=e.clientWidth*a.x,s=e.clientHeight*a.y,l=i*a.x,c=r*a.y;return{width:o,height:s,x:l,y:c}}function om(e,t,n){let r;if(t==="viewport")r=uw(e,n);else if(t==="document")r=dw(Pn(e));else if(rn(t))r=gw(t,n);else{let i=ym(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Il(r)}function Em(e,t){let n=wr(e);return n===t||!rn(n)||na(n)?!1:an(n).position==="fixed"||Em(n,t)}function pw(e,t){let n=t.get(e);if(n)return n;let r=ho(e,[],!1).filter(s=>rn(s)&&ia(s)!=="body"),i=null,a=an(e).position==="fixed",o=a?wr(e):e;for(;rn(o)&&!na(o);){let s=an(o),l=Jd(o);!l&&s.position==="fixed"&&(i=null),(a?!l&&!i:!l&&s.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||fo(o)&&!l&&Em(e,o))?r=r.filter(d=>d!==o):i=s,o=wr(o)}return t.set(e,r),r}function hw(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,o=[...n==="clippingAncestors"?Cl(t)?[]:pw(t,this._c):[].concat(n),r],s=om(t,o[0],i),l=s.top,c=s.right,d=s.bottom,g=s.left;for(let p=1;p{o(!1,1e-7)},1e3)}R===1&&!Sm(c,e.getBoundingClientRect())&&o(),P=!1}try{n=new IntersectionObserver(v,y(h({},I),{root:i.ownerDocument}))}catch(E){n=new IntersectionObserver(v,I)}n.observe(e)}return o(!0),a}function Pw(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=eu(e),d=i||a?[...c?ho(c):[],...t?ho(t):[]]:[];d.forEach(T=>{i&&T.addEventListener("scroll",n,{passive:!0}),a&&T.addEventListener("resize",n)});let g=c&&s?Ew(c,n):null,p=-1,u=null;o&&(u=new ResizeObserver(T=>{let[w]=T;w&&w.target===c&&u&&t&&(u.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var I;(I=u)==null||I.observe(t)})),n()}),c&&!l&&u.observe(c),t&&u.observe(t));let f,m=l?ri(e):null;l&&S();function S(){let T=ri(e);m&&!Sm(m,T)&&n(),m=T,f=requestAnimationFrame(S)}return n(),()=>{var T;d.forEach(w=>{i&&w.removeEventListener("scroll",n),a&&w.removeEventListener("resize",n)}),g==null||g(),(T=u)==null||T.disconnect(),u=null,l&&cancelAnimationFrame(f)}}function lm(e=0,t=0,n=0,r=0){if(typeof DOMRect=="function")return new DOMRect(e,t,n,r);let i={x:e,y:t,width:n,height:r,top:t,right:e+n,bottom:t+r,left:e};return y(h({},i),{toJSON:()=>i})}function xw(e){if(!e)return lm();let{x:t,y:n,width:r,height:i}=e;return lm(t,n,r,i)}function Rw(e,t){return{contextElement:Pe(e)?e:e==null?void 0:e.contextElement,getBoundingClientRect:()=>{let n=e,r=t==null?void 0:t(n);return r||!n?xw(r):n.getBoundingClientRect()}}}function Nw(e,t){return{name:"transformOrigin",fn(n){var C,A,N,k,L;let{elements:r,middlewareData:i,placement:a,rects:o,y:s}=n,l=a.split("-")[0],c=kw(l),d=((C=i.arrow)==null?void 0:C.x)||0,g=((A=i.arrow)==null?void 0:A.y)||0,p=(t==null?void 0:t.clientWidth)||0,u=(t==null?void 0:t.clientHeight)||0,f=d+p/2,m=g+u/2,S=Math.abs(((N=i.shift)==null?void 0:N.y)||0),T=o.reference.height/2,w=u/2,I=(L=(k=e.offset)==null?void 0:k.mainAxis)!=null?L:e.gutter,P=typeof I=="number"?I+w:I!=null?I:w,v=S>P,E={top:`${f}px calc(100% + ${P}px)`,bottom:`${f}px ${-P}px`,left:`calc(100% + ${P}px) ${m}px`,right:`${-P}px ${m}px`}[l],R=`${f}px ${o.reference.y+T-s}px`,x=!!e.overlap&&c==="y"&&v;return r.floating.style.setProperty(zn.transformOrigin.variable,x?R:E),{data:{transformOrigin:x?R:E}}}}}function cm(e,t){let n=e.devicePixelRatio||1;return Math.round(t*n)/n}function ea(e,t){return e!=null&&Math.abs(e-t)<.5}function tu(e){return typeof e=="function"?e():e==="clipping-ancestors"?"clippingAncestors":e}function Mw(e,t,n){let r=e||t.createElement("div");return Ow({element:r,padding:n.arrowPadding})}function _w(e,t){var n;if(!Yp((n=t.offset)!=null?n:t.gutter))return Sw(({placement:r})=>{var d,g,p,u;let i=((e==null?void 0:e.clientHeight)||0)/2,a=(g=(d=t.offset)==null?void 0:d.mainAxis)!=null?g:t.gutter,o=typeof a=="number"?a+i:a!=null?a:i,{hasAlign:s}=D0(r),l=s?void 0:t.shift,c=(u=(p=t.offset)==null?void 0:p.crossAxis)!=null?u:l;return _n({crossAxis:c,mainAxis:o,alignmentAxis:t.shift})})}function $w(e){if(!e.flip)return;let t=tu(e.boundary);return Tw(y(h({},t?{boundary:t}:void 0),{padding:e.overflowPadding,fallbackPlacements:e.flip===!0?void 0:e.flip}))}function Hw(e){if(!e.slide&&!e.overlap)return;let t=tu(e.boundary);return Iw(y(h({},t?{boundary:t}:void 0),{mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:Vw()}))}function Bw(e){if(e.sizeMiddleware===!1&&!e.sameWidth&&!e.fitViewport)return;let t,n,r,i;return Cw({padding:e.overflowPadding,apply({elements:a,rects:o,availableHeight:s,availableWidth:l}){let c=a.floating,d=Math.round(o.reference.width),g=Math.round(o.reference.height);l=Math.floor(l),s=Math.floor(s),ea(t,d)||(c.style.setProperty("--reference-width",`${d}px`),t=d),ea(n,g)||(c.style.setProperty("--reference-height",`${g}px`),n=g),ea(r,l)||(c.style.setProperty("--available-width",`${l}px`),r=l),ea(i,s)||(c.style.setProperty("--available-height",`${s}px`),i=s)}})}function Uw(e){var t;if(e.hideWhenDetached)return ww({strategy:"referenceHidden",boundary:(t=tu(e.boundary))!=null?t:"clippingAncestors"})}function Gw(e){return e?e===!0?{ancestorResize:!0,ancestorScroll:!0,elementResize:!0,layoutShift:!0}:e:{}}function dm(e,t){if(!e)return Qc;let n=new Map(t.map(r=>[r,e.style.getPropertyValue(r)]));return()=>{n.forEach((r,i)=>{r?e.style.setProperty(i,r):e.style.removeProperty(i)}),e.style.length===0&&e.removeAttribute("style")}}function um(e){return e==null?null:Pe(e)?e:typeof e=="object"&&e&&"contextElement"in e&&e.contextElement?e.contextElement:e}function Kw(e,t,n={}){let r=()=>{let A=typeof t=="function"?t():t;return A!=null?A:null},i=()=>{var N,k;let A=typeof e=="function"?e():e;return(k=(N=n.getAnchorElement)==null?void 0:N.call(n))!=null?k:A},a=()=>{let A=i();return!A&&!n.getAnchorRect?null:Rw(A,n.getAnchorRect)},o=Object.assign({},Fw,n),s=[],l=null,c,d;function g(A){c==null||c(),d==null||d(),l=A,c=o.restoreStyles?dm(A,qw):void 0;let N=A.querySelector("[data-part=arrow]");d=o.restoreStyles?dm(N,Ww):void 0,s=[_w(N,o),$w(o),Hw(o),Mw(N,A.ownerDocument,o),Dw(N),Nw({gutter:o.gutter,offset:o.offset,overlap:o.overlap},N),Bw(o),Uw(o),Lw]}let{placement:p,strategy:u,onComplete:f,onPositioned:m}=o,S,T,w=!1,I,P,v=Qc,E=Gw(o.listeners);function R(){if(!o.listeners)return;let A=i(),N=a(),k=r();if(!N||!k)return;(um(A)!==um(I)||k!==P)&&(v(),I=A,P=k,v=Pw(N,k,C,E))}function x(){return Ke(this,null,function*(){var ue;R();let A=r();if(!A)return;A!==l&&(g(A),w=!1);let N=a();if(!N)return;let k=yield Aw(N,A,{placement:p,middleware:s,strategy:u});f==null||f(k);let L=ye(A),K=cm(L,k.x),J=cm(L,k.y);if(ea(S,K)||(A.style.setProperty("--x",`${K}px`),S=K),ea(T,J)||(A.style.setProperty("--y",`${J}px`),T=J),o.hideWhenDetached&&(((ue=k.middlewareData.hide)==null?void 0:ue.referenceHidden)?(A.style.setProperty("visibility","hidden"),A.style.setProperty("pointer-events","none")):(A.style.removeProperty("visibility"),A.style.removeProperty("pointer-events"))),!w){let Z=A.firstElementChild;Z&&(A.style.setProperty("--z-index",pt(Z).zIndex),w=!0)}})}function C(){return Ke(this,null,function*(){n.updatePosition?(yield n.updatePosition({updatePosition:x,floatingElement:r()}),m==null||m({placed:!0})):yield x()})}return C(),()=>{v(),d==null||d(),c==null||c(),m==null||m({placed:!1})}}function Xe(e,t,n={}){let s=n,{defer:r}=s,i=St(s,["defer"]),a=r?B:l=>l(),o=[];return o.push(a(()=>{o.push(Kw(e,t,i))})),()=>{o.forEach(l=>l==null?void 0:l())}}function Gt(e={}){let{placement:t,sameWidth:n,fitViewport:r,strategy:i="absolute"}=e;return{arrow:{position:"absolute",width:zn.arrowSize.reference,height:zn.arrowSize.reference,[zn.arrowSizeHalf.variable]:`calc(${zn.arrowSize.reference} / 2)`,[zn.arrowOffset.variable]:`calc(${zn.arrowSizeHalf.reference} * -1)`},arrowTip:{transform:t?zw[t.split("-")[0]]:void 0,background:zn.arrowBg.reference,top:"0",left:"0",width:"100%",height:"100%",position:"absolute",zIndex:"inherit"},floating:{position:i,isolation:"isolate",minWidth:n?void 0:"max-content",width:n?"var(--reference-width)":void 0,maxWidth:r?"var(--available-width)":void 0,maxHeight:r?"var(--available-height)":void 0,pointerEvents:t?void 0:"none",top:"0px",left:"0px",transform:t?"translate3d(var(--x), var(--y), 0)":"translate3d(0, -100vh, 0)",zIndex:"var(--z-index)"}}}var F0,Cr,At,Pl,El,En,M0,Qf,em,H0,B0,K0,z0,j0,Y0,X0,hm,J0,Q0,ew,tw,rw,iw,ni,qd,ow,am,vw,bw,Sw,Iw,Tw,Cw,ww,Ow,Vw,Aw,po,zn,kw,Lw,Dw,Fw,qw,Ww,zw,ii=ee(()=>{"use strict";oe();F0=["top","right","bottom","left"],Cr=Math.min,At=Math.max,Pl=Math.round,El=Math.floor,En=e=>({x:e,y:e}),M0={left:"right",right:"left",bottom:"top",top:"bottom"};Qf=["left","right"],em=["right","left"],H0=["top","bottom"],B0=["bottom","top"];K0=50,z0=(e,t,n)=>Ke(null,null,function*(){let{placement:r="bottom",strategy:i="absolute",middleware:a=[],platform:o}=n,s=o.detectOverflow?o:y(h({},o),{detectOverflow:W0}),l=yield o.isRTL==null?void 0:o.isRTL(t),c=yield o.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:g}=tm(c,r,l),p=r,u=0,f={};for(let m=0;m({name:"arrow",options:e,fn(n){return Ke(this,null,function*(){let{x:r,y:i,placement:a,rects:o,platform:s,elements:l,middlewareData:c}=n,{element:d,padding:g=0}=jn(e,n)||{};if(d==null)return{};let p=pm(g),u={x:r,y:i},f=Zd(a),m=Xd(f),S=yield s.getDimensions(d),T=f==="y",w=T?"top":"left",I=T?"bottom":"right",P=T?"clientHeight":"clientWidth",v=o.reference[m]+o.reference[f]-u[f]-o.floating[m],E=u[f]-o.reference[f],R=yield s.getOffsetParent==null?void 0:s.getOffsetParent(d),x=R?R[P]:0;(!x||!(yield s.isElement==null?void 0:s.isElement(R)))&&(x=l.floating[P]||o.floating[m]);let C=v/2-E/2,A=x/2-S[m]/2-1,N=Cr(p[w],A),k=Cr(p[I],A),L=N,K=x-S[m]-k,J=x/2-S[m]/2+C,ue=Kd(L,J,K),Z=!c.arrow&&ra(a)!=null&&J!==ue&&o.reference[m]/2-(Jue<=0)){var k,L;let ue=(((k=o.flip)==null?void 0:k.index)||0)+1,Z=x[ue];if(Z&&(!(p==="alignment"?I!==bn(Z):!1)||N.every(le=>bn(le.placement)===I?le.overflows[0]>0:!0)))return{data:{index:ue,overflows:N},reset:{placement:Z}};let ce=(L=N.filter(ve=>ve.overflows[0]<=0).sort((ve,le)=>ve.overflows[1]-le.overflows[1])[0])==null?void 0:L.placement;if(!ce)switch(f){case"bestFit":{var K;let ve=(K=N.filter(le=>{if(R){let De=bn(le.placement);return De===I||De==="y"}return!0}).map(le=>[le.placement,le.overflows.filter(De=>De>0).reduce((De,Fe)=>De+Fe,0)]).sort((le,De)=>le[1]-De[1])[0])==null?void 0:K[0];ve&&(ce=ve);break}case"initialPlacement":ce=l;break}if(a!==ce)return{reset:{placement:ce}}}return{}})}}};X0=function(e){return e===void 0&&(e={}),{name:"hide",options:e,fn(n){return Ke(this,null,function*(){let{rects:r,platform:i}=n,s=jn(e,n),{strategy:a="referenceHidden"}=s,o=St(s,["strategy"]);switch(a){case"referenceHidden":{let l=yield i.detectOverflow(n,y(h({},o),{elementContext:"reference"})),c=nm(l,r.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:rm(c)}}}case"escaped":{let l=yield i.detectOverflow(n,y(h({},o),{altBoundary:!0})),c=nm(l,r.floating);return{data:{escapedOffsets:c,escaped:rm(c)}}}default:return{}}})}}},hm=new Set(["left","top"]);J0=function(e){return e===void 0&&(e=0),{name:"offset",options:e,fn(n){return Ke(this,null,function*(){var r,i;let{x:a,y:o,placement:s,middlewareData:l}=n,c=yield Z0(n,e);return s===((r=l.offset)==null?void 0:r.placement)&&(i=l.arrow)!=null&&i.alignmentOffset?{}:{x:a+c.x,y:o+c.y,data:y(h({},c),{placement:s})}})}}},Q0=function(e){return e===void 0&&(e={}),{name:"shift",options:e,fn(n){return Ke(this,null,function*(){let{x:r,y:i,placement:a,platform:o}=n,w=jn(e,n),{mainAxis:s=!0,crossAxis:l=!1,limiter:c={fn:I=>{let{x:P,y:v}=I;return{x:P,y:v}}}}=w,d=St(w,["mainAxis","crossAxis","limiter"]),g={x:r,y:i},p=yield o.detectOverflow(n,d),u=bn(Yn(a)),f=Yd(u),m=g[f],S=g[u];if(s){let I=f==="y"?"top":"left",P=f==="y"?"bottom":"right",v=m+p[I],E=m-p[P];m=Kd(v,m,E)}if(l){let I=u==="y"?"top":"left",P=u==="y"?"bottom":"right",v=S+p[I],E=S-p[P];S=Kd(v,S,E)}let T=c.fn(y(h({},n),{[f]:m,[u]:S}));return y(h({},T),{data:{x:T.x-r,y:T.y-i,enabled:{[f]:s,[u]:l}}})})}}},ew=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=jn(e,t),d={x:n,y:r},g=bn(i),p=Yd(g),u=d[p],f=d[g],m=jn(s,t),S=typeof m=="number"?{mainAxis:m,crossAxis:0}:h({mainAxis:0,crossAxis:0},m);if(l){let I=p==="y"?"height":"width",P=a.reference[p]-a.floating[I]+S.mainAxis,v=a.reference[p]+a.reference[I]-S.mainAxis;uv&&(u=v)}if(c){var T,w;let I=p==="y"?"width":"height",P=hm.has(Yn(i)),v=a.reference[g]-a.floating[I]+(P&&((T=o.offset)==null?void 0:T[g])||0)+(P?0:S.crossAxis),E=a.reference[g]+a.reference[I]+(P?0:((w=o.offset)==null?void 0:w[g])||0)-(P?S.crossAxis:0);fE&&(f=E)}return{[p]:u,[g]:f}}}},tw=function(e){return e===void 0&&(e={}),{name:"size",options:e,fn(n){return Ke(this,null,function*(){var r,i;let{placement:a,rects:o,platform:s,elements:l}=n,N=jn(e,n),{apply:c=()=>{}}=N,d=St(N,["apply"]),g=yield s.detectOverflow(n,d),p=Yn(a),u=ra(a),f=bn(a)==="y",{width:m,height:S}=o.floating,T,w;p==="top"||p==="bottom"?(T=p,w=u===((yield s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(w=p,T=u==="end"?"top":"bottom");let I=S-g.top-g.bottom,P=m-g.left-g.right,v=Cr(S-g[T],I),E=Cr(m-g[w],P),R=!n.middlewareData.shift,x=v,C=E;if((r=n.middlewareData.shift)!=null&&r.enabled.x&&(C=P),(i=n.middlewareData.shift)!=null&&i.enabled.y&&(x=I),R&&!u){let k=At(g.left,0),L=At(g.right,0),K=At(g.top,0),J=At(g.bottom,0);f?C=m-2*(k!==0||L!==0?k+L:At(g.left,g.right)):x=S-2*(K!==0||J!==0?K+J:At(g.top,g.bottom))}yield c(y(h({},n),{availableWidth:C,availableHeight:x}));let A=yield s.getDimensions(l.floating);return m!==A.width||S!==A.height?{reset:{rects:!0}}:{}})}}};rw=/transform|translate|scale|rotate|perspective|filter/,iw=/paint|layout|strict|content/,ni=e=>!!e&&e!=="none";ow=En(0);am=25;vw=function(e){return Ke(this,null,function*(){let t=this.getOffsetParent||Pm,n=this.getDimensions,r=yield n(e.floating);return{reference:mw(e.reference,yield t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}})};bw={convertOffsetParentRelativeRectToViewportRelativeRect:lw,getDocumentElement:Pn,getClippingRect:hw,getOffsetParent:Pm,getElementRects:vw,getClientRects:cw,getDimensions:fw,getScale:ta,isElement:rn,isRTL:yw};Sw=J0,Iw=Q0,Tw=Y0,Cw=tw,ww=X0,Ow=j0,Vw=ew,Aw=(e,t,n)=>{let r=new Map,i=h({platform:bw},n),a=y(h({},i.platform),{_c:r});return z0(e,t,y(h({},i),{platform:a}))};po=e=>({variable:e,reference:`var(${e})`}),zn={arrowSize:po("--arrow-size"),arrowSizeHalf:po("--arrow-size-half"),arrowBg:po("--arrow-background"),transformOrigin:po("--transform-origin"),arrowOffset:po("--arrow-offset")},kw=e=>e==="top"||e==="bottom"?"y":"x";Lw={name:"rects",fn({rects:e}){return{data:e}}},Dw=e=>{if(e)return{name:"shiftArrow",fn({placement:t,middlewareData:n}){if(!n.arrow)return{};let{x:r,y:i}=n.arrow,a=t.split("-")[0];return Object.assign(e.style,{left:r!=null?`${r}px`:"",top:i!=null?`${i}px`:"",[a]:`calc(100% + ${zn.arrowOffset.reference})`}),{}}}},Fw={strategy:"absolute",placement:"bottom",listeners:!0,restoreStyles:!1,gutter:8,flip:!0,slide:!0,overlap:!1,sameWidth:!1,fitViewport:!1,overflowPadding:8,arrowPadding:4};qw=["transform","visibility","pointer-events","--x","--y","--z-index","--reference-width","--reference-height","--available-width","--available-height","--transform-origin"],Ww=["top","right","bottom","left"];zw={bottom:"rotate(45deg)",left:"rotate(135deg)",top:"rotate(225deg)",right:"rotate(315deg)"}});function jw(e){let t={each(n){var r;for(let i=0;i<((r=e.frames)==null?void 0:r.length);i+=1){let a=e.frames[i];a&&n(a)}},addEventListener(n,r,i){return t.each(a=>{try{a.document.addEventListener(n,r,i)}catch(o){}}),()=>{try{t.removeEventListener(n,r,i)}catch(a){}}},removeEventListener(n,r,i){t.each(a=>{try{a.document.removeEventListener(n,r,i)}catch(o){}})}};return t}function Yw(e){let t=e.frameElement!=null?e.parent:null;return{addEventListener:(n,r,i)=>{try{t==null||t.addEventListener(n,r,i)}catch(a){}return()=>{try{t==null||t.removeEventListener(n,r,i)}catch(a){}}},removeEventListener:(n,r,i)=>{try{t==null||t.removeEventListener(n,r,i)}catch(a){}}}}function Xw(e){for(let t of e)if(Pe(t)&&ut(t))return!0;return!1}function Zw(e,t){if(!Om(t)||!e)return!1;let n=e.getBoundingClientRect();return n.width===0||n.height===0?!1:n.top<=t.clientY&&t.clientY<=n.top+n.height&&n.left<=t.clientX&&t.clientX<=n.left+n.width}function Jw(e,t){return e.y<=t.y&&t.y<=e.y+e.height&&e.x<=t.x&&t.x<=e.x+e.width}function Cm(e,t){if(!t||!Om(e))return!1;let n=t.scrollHeight>t.clientHeight,r=n&&e.clientX>t.offsetLeft+t.clientWidth,i=t.scrollWidth>t.clientWidth,a=i&&e.clientY>t.offsetTop+t.clientHeight,o={x:t.offsetLeft,y:t.offsetTop,width:t.clientWidth+(n?16:0),height:t.clientHeight+(i?16:0)},s={x:e.clientX,y:e.clientY};return Jw(o,s)?r||a:!1}function Qw(e,t){let{exclude:n,onFocusOutside:r,onPointerDownOutside:i,onInteractOutside:a,defer:o,followControlledElements:s=!0}=t;if(!e)return;let l=Ge(e),c=ye(e),d=jw(c),g=Yw(c);function p(P,v){if(!Pe(v)||!v.isConnected||ge(e,v)||Zw(e,P)||s&&Vs(e,v))return!1;let E=l.querySelector(`[aria-controls="${e.id}"]`);if(E){let x=Xa(E);if(Cm(P,x))return!1}let R=Xa(e);return Cm(P,R)?!1:!(n!=null&&n(v))}let u=new Set,f=zr(e==null?void 0:e.getRootNode()),m=!1;function S(P){m=!0;let v=()=>{m=!1};l.addEventListener("pointerup",v,{once:!0}),c.addEventListener("pointerup",v,{once:!0});function E(R){var N,k;let x=o&&!od()?B:L=>L(),C=R!=null?R:P,A=(k=(N=C==null?void 0:C.composedPath)==null?void 0:N.call(C))!=null?k:[C==null?void 0:C.target];x(()=>{let L=f?A[0]:ne(P);if(!(!e||!p(P,L))){if(i||a){let K=Ct(i,a);e.addEventListener(Im,K,{once:!0})}wm(e,Im,{bubbles:!1,cancelable:!0,detail:{originalEvent:C,contextmenu:pr(C),focusable:Xw(A),target:L}})}})}P.pointerType==="touch"?(u.forEach(R=>R()),u.add(ae(l,"click",E,{once:!0})),u.add(g.addEventListener("click",E,{once:!0})),u.add(d.addEventListener("click",E,{once:!0}))):E()}let T=new Set,w=setTimeout(()=>{T.add(ae(l,"pointerdown",S,!0)),T.add(g.addEventListener("pointerdown",S,!0)),T.add(d.addEventListener("pointerdown",S,!0))},0);function I(P){if(m)return;(o?B:E=>E())(()=>{var x,C;let E=(C=(x=P==null?void 0:P.composedPath)==null?void 0:x.call(P))!=null?C:[P==null?void 0:P.target],R=f?E[0]:ne(P);if(!(!e||!p(P,R))){if(r||a){let A=Ct(r,a);e.addEventListener(Tm,A,{once:!0})}wm(e,Tm,{bubbles:!1,cancelable:!0,detail:{originalEvent:P,contextmenu:!1,focusable:ut(R),target:R}})}})}return od()||(T.add(ae(l,"focusin",I,!0)),T.add(g.addEventListener("focusin",I,!0)),T.add(d.addEventListener("focusin",I,!0))),()=>{clearTimeout(w),u.forEach(P=>P()),T.forEach(P=>P())}}function aa(e,t){let{defer:n}=t,r=n?B:a=>a(),i=[];return i.push(r(()=>{let a=typeof e=="function"?e():e;i.push(Qw(a,t))})),()=>{i.forEach(a=>a==null?void 0:a())}}function wm(e,t,n){let r=e.ownerDocument.defaultView||window,i=new r.CustomEvent(t,n);return e.dispatchEvent(i)}var Im,Tm,Om,on=ee(()=>{"use strict";oe();Im="pointerdown.outside",Tm="focus.outside";Om=e=>"clientY"in e});function eO(e,t){let n=r=>{r.key==="Escape"&&(r.isComposing||t==null||t(r))};return ae(Ge(e),"keydown",n,{capture:!0})}function tO(e,t,n){let r=e.ownerDocument.defaultView||window,i=new r.CustomEvent(t,{cancelable:!0,bubbles:!0,detail:n});return e.dispatchEvent(i)}function nO(e,t,n){e.addEventListener(t,n,{once:!0})}function xm(){vt.layers.forEach(({node:e})=>{e.style.pointerEvents=vt.isBelowPointerBlockingLayer(e)?"none":"auto"})}function rO(e){e.style.pointerEvents=""}function iO(e,t){let n=Ge(e),r=[];return vt.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(Am=document.body.style.pointerEvents,queueMicrotask(()=>{n.body.style.pointerEvents="none",n.body.setAttribute("data-inert","")})),t==null||t.forEach(i=>{let[a,o]=Ch(()=>{let s=i();return Pe(s)?s:null},{timeout:1e3});a.then(s=>r.push(Xr(s,{pointerEvents:"auto"}))),r.push(o)}),()=>{vt.hasPointerBlockingLayer()||(queueMicrotask(()=>{n.body.style.pointerEvents=Am,n.body.removeAttribute("data-inert"),n.body.style.length===0&&n.body.removeAttribute("style")}),r.forEach(i=>i()))}}function aO(e,t){let{warnOnMissingNode:n=!0}=t;if(n&&!e){It("[@zag-js/dismissable] node is `null` or `undefined`");return}if(!e)return;let{onDismiss:r,onRequestDismiss:i,pointerBlocking:a,exclude:o,debug:s,type:l="dialog"}=t,c={dismiss:r,node:e,type:l,pointerBlocking:a,requestDismiss:i};vt.add(c),xm();function d(m){var T,w;let S=ne(m.detail.originalEvent);vt.isBelowPointerBlockingLayer(e)||vt.isInBranch(S)||((T=t.onPointerDownOutside)==null||T.call(t,m),(w=t.onInteractOutside)==null||w.call(t,m),!m.defaultPrevented&&(s&&console.log("onPointerDownOutside:",m.detail.originalEvent),r==null||r()))}function g(m){var T,w;let S=ne(m.detail.originalEvent);vt.isInBranch(S)||((T=t.onFocusOutside)==null||T.call(t,m),(w=t.onInteractOutside)==null||w.call(t,m),!m.defaultPrevented&&(s&&console.log("onFocusOutside:",m.detail.originalEvent),r==null||r()))}function p(m){var S;vt.isTopMost(e)&&((S=t.onEscapeKeyDown)==null||S.call(t,m),!m.defaultPrevented&&r&&(m.preventDefault(),r()))}function u(m){var I;if(!e)return!1;let S=typeof o=="function"?o():o,T=Array.isArray(S)?S:[S],w=(I=t.persistentElements)==null?void 0:I.map(P=>P()).filter(Pe);return w&&T.push(...w),T.some(P=>ge(P,m))||vt.isInNestedLayer(e,m)}let f=[a?iO(e,t.persistentElements):void 0,eO(e,p),aa(e,{exclude:u,onFocusOutside:g,onPointerDownOutside:d,defer:t.defer})];return()=>{vt.remove(e),xm(),rO(e),f.forEach(m=>m==null?void 0:m())}}function qt(e,t){let{defer:n}=t,r=n?B:a=>a(),i=[];return i.push(r(()=>{let a=Qe(e)?e():e;i.push(aO(a,t))})),()=>{i.forEach(a=>a==null?void 0:a())}}function Rm(e,t={}){let{defer:n}=t,r=n?B:a=>a(),i=[];return i.push(r(()=>{let a=Qe(e)?e():e;if(!a){It("[@zag-js/dismissable] branch node is `null` or `undefined`");return}vt.addBranch(a),i.push(()=>{vt.removeBranch(a)})})),()=>{i.forEach(a=>a==null?void 0:a())}}var Vm,vt,Am,Or=ee(()=>{"use strict";on();oe();Vm="layer:request-dismiss",vt={layers:[],branches:[],recentlyRemoved:new Set,count(){return this.layers.length},pointerBlockingLayers(){return this.layers.filter(e=>e.pointerBlocking)},topMostPointerBlockingLayer(){return[...this.pointerBlockingLayers()].slice(-1)[0]},hasPointerBlockingLayer(){return this.pointerBlockingLayers().length>0},isBelowPointerBlockingLayer(e){var r;let t=this.indexOf(e),n=this.topMostPointerBlockingLayer()?this.indexOf((r=this.topMostPointerBlockingLayer())==null?void 0:r.node):-1;return tt.type===e)},getNestedLayersByType(e,t){let n=this.indexOf(e);return n===-1?[]:this.layers.slice(n+1).filter(r=>r.type===t)},getParentLayerOfType(e,t){let n=this.indexOf(e);if(!(n<=0))return this.layers.slice(0,n).reverse().find(r=>r.type===t)},countNestedLayersOfType(e,t){return this.getNestedLayersByType(e,t).length},isInNestedLayer(e,t){return!!(this.getNestedLayers(e).some(r=>ge(r.node,t))||this.recentlyRemoved.size>0)},isInBranch(e){return Array.from(this.branches).some(t=>ge(t,e))},add(e){this.layers.push(e),this.syncLayers()},addBranch(e){this.branches.push(e)},remove(e){let t=this.indexOf(e);t<0||(this.recentlyRemoved.add(e),Yr(()=>this.recentlyRemoved.delete(e)),tvt.dismiss(r.node,e)),this.layers.splice(t,1),this.syncLayers())},removeBranch(e){let t=this.branches.indexOf(e);t>=0&&this.branches.splice(t,1)},syncLayers(){this.layers.forEach((e,t)=>{e.node.style.setProperty("--layer-index",`${t}`),e.node.removeAttribute("data-nested"),e.node.removeAttribute("data-has-nested"),this.getParentLayerOfType(e.node,e.type)&&e.node.setAttribute("data-nested",e.type);let r=this.countNestedLayersOfType(e.node,e.type);r>0&&e.node.setAttribute("data-has-nested",e.type),e.node.style.setProperty("--nested-layer-count",`${r}`)})},indexOf(e){return this.layers.findIndex(t=>t.node===e)},dismiss(e,t){let n=this.indexOf(e);if(n===-1)return;let r=this.layers[n];nO(e,Vm,i=>{var a;(a=r.requestDismiss)==null||a.call(r,i),i.defaultPrevented||r==null||r.dismiss()}),tO(e,Vm,{originalLayer:e,targetLayer:t,originalIndex:n,targetIndex:t?this.indexOf(t):-1}),this.syncLayers()},clear(){this.remove(this.layers[0].node)}}});function Wt(e){let t=e;t.phxPrivate||(t.phxPrivate={}),t.phxPrivate[oO]=!0}function yt(e,t,n={}){var r;String(e.value)!==String(t)&&(e.value=t),(r=n.onTouched)==null||r.call(n),n.markUsed!==!1&&(Wt(e),e.dispatchEvent(new Event("input",{bubbles:!0})),n.change!==!1&&e.dispatchEvent(new Event("change",{bubbles:!0})))}function Vr(e,t,n){queueMicrotask(()=>{yt(e,t(),{onTouched:n})})}var oO,Kt=ee(()=>{"use strict";oO="phx-has-focused"});function Ar(e,t=!1){return t||O(e,"fieldUsed")===!0}function sO(e,t){let n=e.map(r=>String(r));for(;n.lengthg.remove());let d=km(t,a?n:void 0,r,"",!0);return e.appendChild(d),d}o.filter(d=>d.hasAttribute("data-empty")).forEach(d=>d.remove());let l=o.filter(d=>!d.hasAttribute("data-empty"));for(;l.lengthi.length;){let d=l[l.length-1];d==null||d.remove(),l=l.slice(0,-1)}return l.forEach((d,g)=>{var p;d.value=(p=i[g])!=null?p:""}),(c=l[l.length-1])!=null?c:null}function sn(e,t,n={}){var g,p,u,f;let r=(g=n.scope)!=null?g:"tags-input",i=(p=n.submitName)!=null?p:V(e,"submitName");if(!i)return;let a=n.fixedLength,o=a!==void 0?sO(t,a):t.map(m=>String(m)),s=Ar(e,n.fieldTouched===!0),l=e.querySelector(`[data-scope="${r}"][data-part="array-inputs"]`);if(!l){let m=(u=e.querySelector(`[data-scope="${r}"][data-part="root"]`))!=null?u:e;l=document.createElement("div"),l.setAttribute("data-scope",r),l.setAttribute("data-part","array-inputs"),l.setAttribute("phx-update","ignore"),l.id=`${r}:${e.id}:array-inputs`,m.prepend(l)}let c=lO(l,r,i,e,o,s);s&&l.querySelectorAll(`[data-scope="${r}"][data-part="array-input"][name="${CSS.escape(i)}"]`).forEach(m=>Wt(m)),!(!((f=n.notifyLiveView)!=null&&f)||!c)&&queueMicrotask(()=>{var m;(m=n.onTouched)==null||m.call(n),yt(c,c.value,{onTouched:void 0})})}function oa(e,t){let n=e.closest("form");if(!n)return()=>{};let r=()=>{t()};return n.addEventListener("submit",r,{capture:!0}),()=>n.removeEventListener("submit",r,{capture:!0})}var ai=ee(()=>{"use strict";Kt();oe()});function cO(e){let t=e.dataset.positionFlip;if(t==null)return;if(t==="true")return!0;if(t==="false")return!1;let n=t.split(",").map(r=>r.trim()).filter(Boolean);return n.length>0?n:void 0}function qe(e){let t={},n=V(e,"positionStrategy");n&&(t.strategy=n);let r=V(e,"positionPlacement");r&&(t.placement=r);let i=G(e,"positionGutter");i!==void 0&&(t.gutter=i);let a=G(e,"positionShift");a!==void 0&&(t.shift=a);let o=G(e,"positionOverflowPadding");o!==void 0&&(t.overflowPadding=o);let s=G(e,"positionArrowPadding");s!==void 0&&(t.arrowPadding=s);let l=G(e,"positionOffsetMainAxis"),c=G(e,"positionOffsetCrossAxis");if(l!==void 0||c!==void 0){let S={};l!==void 0&&(S.mainAxis=l),c!==void 0&&(S.crossAxis=c),t.offset=S}let d=cO(e);d!==void 0&&(t.flip=d);let g=Ye(e,"positionSlide");g!==void 0&&(t.slide=g);let p=Ye(e,"positionOverlap");p!==void 0&&(t.overlap=p);let u=Ye(e,"positionSameWidth");u!==void 0&&(t.sameWidth=u);let f=Ye(e,"positionFitViewport");f!==void 0&&(t.fitViewport=f);let m=Ye(e,"positionHideWhenDetached");return m!==void 0&&(t.hideWhenDetached=m),Object.keys(t).length>0?t:void 0}var xr=ee(()=>{"use strict";oe()});function mo(e,t,...n){return[...e.slice(0,t),...n,...e.slice(t)]}function Vl(e,t,n){t=[...t].sort((i,a)=>i-a);let r=t.map(i=>e[i]);for(let i=t.length-1;i>=0;i--)e=[...e.slice(0,t[i]),...e.slice(t[i]+1)];return n=Math.max(0,n-t.filter(i=>it.getItemValue(n)).filter(Boolean),selectedItems:e,collection:t})}function _m(e,t,n){for(let r=0;rt[n])return 1}return e.length-t.length}function hO(e){return e.sort($m)}function fO(e,t){let n;return Rt(e,y(h({},t),{onEnter:(r,i)=>{if(t.predicate(r,i))return n=r,"stop"}})),n}function mO(e,t){let n=[];return Rt(e,{onEnter:(r,i)=>{t.predicate(r,i)&&n.push(r)},getChildren:t.getChildren}),n}function Nm(e,t){let n;return Rt(e,{onEnter:(r,i)=>{if(t.predicate(r,i))return n=[...i],"stop"},getChildren:t.getChildren}),n}function vO(e,t){let n=t.initialResult;return Rt(e,y(h({},t),{onEnter:(r,i)=>{n=t.nextResult(n,r,i)}})),n}function yO(e,t){return vO(e,y(h({},t),{initialResult:[],nextResult:(n,r,i)=>(n.push(...t.transform(r,i)),n)}))}function bO(e,t){let{predicate:n,create:r,getChildren:i}=t,a=(o,s)=>{let l=i(o,s),c=[];l.forEach((u,f)=>{let m=[...s,f],S=a(u,m);S&&c.push(S)});let d=s.length===0,g=n(o,s),p=c.length>0;return d||g||p?r(o,c,s):null};return a(e,[])||r(e,[],[])}function EO(e,t){let n=[],r=0,i=new Map,a=new Map;return Rt(e,{getChildren:t.getChildren,onEnter:(o,s)=>{i.has(o)||i.set(o,r++);let l=t.getChildren(o,s);l.forEach(u=>{a.has(u)||a.set(u,o),i.has(u)||i.set(u,r++)});let c=l.length>0?l.map(u=>i.get(u)):void 0,d=a.get(o),g=d?i.get(d):void 0,p=i.get(o);n.push(y(h({},o),{_children:c,_parent:g,_index:p}))}}),n}function PO(e,t){return{type:"insert",index:e,nodes:t}}function SO(e){return{type:"remove",indexes:e}}function ru(){return{type:"replace"}}function Hm(e){return[e.slice(0,-1),e[e.length-1]]}function Bm(e,t,n=new Map){var o;let[r,i]=Hm(e);for(let s=r.length-1;s>=0;s--){let l=r.slice(0,s).join();switch((o=n.get(l))==null?void 0:o.type){case"remove":continue}n.set(l,ru())}let a=n.get(r.join());switch(a==null?void 0:a.type){case"remove":n.set(r.join(),{type:"removeThenInsert",removeIndexes:a.indexes,insertIndex:i,insertNodes:t});break;default:n.set(r.join(),PO(i,t))}return n}function Um(e){var r;let t=new Map,n=new Map;for(let i of e){let a=i.slice(0,-1).join(),o=(r=n.get(a))!=null?r:[];o.push(i[i.length-1]),n.set(a,o.sort((s,l)=>s-l))}for(let i of e)for(let a=i.length-2;a>=0;a--){let o=i.slice(0,a).join();t.has(o)||t.set(o,ru())}for(let[i,a]of n)t.set(i,SO(a));return t}function IO(e,t){let n=new Map,[r,i]=Hm(e);for(let a=r.length-1;a>=0;a--){let o=r.slice(0,a).join();n.set(o,ru())}return n.set(r.join(),{type:"removeThenInsert",removeIndexes:[i],insertIndex:i,insertNodes:[t]}),n}function Rl(e,t,n){return TO(e,y(h({},n),{getChildren:(r,i)=>{let a=i.join(),o=t.get(a);switch(o==null?void 0:o.type){case"replace":case"remove":case"removeThenInsert":case"insert":return n.getChildren(r,i);default:return[]}},transform:(r,i,a)=>{let o=a.join(),s=t.get(o);switch(s==null?void 0:s.type){case"remove":return n.create(r,i.filter((d,g)=>!s.indexes.includes(g)),a);case"removeThenInsert":let l=i.filter((d,g)=>!s.removeIndexes.includes(g)),c=s.removeIndexes.reduce((d,g)=>g{var d,g;let a=[0,...i],o=a.join(),s=t.transform(r,(d=n[o])!=null?d:[],i),l=a.slice(0,-1).join(),c=(g=n[l])!=null?g:[];c.push(s),n[l]=c}})),n[""][0]}function CO(e,t){let{nodes:n,at:r}=t;if(r.length===0)throw new Error("Can't insert nodes at the root");let i=Bm(r,n);return Rl(e,i,t)}function wO(e,t){if(t.at.length===0)return t.node;let n=IO(t.at,t.node);return Rl(e,n,t)}function OO(e,t){if(t.indexPaths.length===0)return e;for(let r of t.indexPaths)if(r.length===0)throw new Error("Can't remove the root node");let n=Um(t.indexPaths);return Rl(e,n,t)}function VO(e,t){if(t.indexPaths.length===0)return e;for(let a of t.indexPaths)if(a.length===0)throw new Error("Can't move the root node");if(t.to.length===0)throw new Error("Can't move nodes to the root");let n=pO(t.indexPaths),r=n.map(a=>_m(e,a,t)),i=Bm(t.to,r,Um(n));return Rl(e,i,t)}function Rt(e,t){let{onEnter:n,onLeave:r,getChildren:i}=t,a=[],o=[{node:e}],s=t.reuseIndexPath?()=>a:()=>a.slice();for(;o.length>0;){let l=o[o.length-1];if(l.state===void 0){let d=n==null?void 0:n(l.node,s());if(d==="stop")return;l.state=d==="skip"?-1:0}let c=l.children||i(l.node,s());if(l.children||(l.children=c),l.state!==-1){if(l.state{"use strict";oe();dO=Object.defineProperty,uO=(e,t,n)=>t in e?dO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,M=(e,t,n)=>uO(e,typeof t!="symbol"?t+"":t,n),Al={itemToValue(e){return typeof e=="string"?e:un(e)&&at(e,"value")?e.value:""},itemToString(e){return typeof e=="string"?e:un(e)&&at(e,"label")?e.label:Al.itemToValue(e)},isItemDisabled(e){return un(e)&&at(e,"disabled")?!!e.disabled:!1}},Sn=class Dm{constructor(t){M(this,"options",t),M(this,"items"),M(this,"indexMap",null),M(this,"copy",n=>new Dm(y(h({},this.options),{items:n!=null?n:[...this.items]}))),M(this,"isEqual",n=>Ce(this.items,n.items)),M(this,"setItems",n=>this.copy(n)),M(this,"getValues",(n=this.items)=>{let r=[];for(let i of n){let a=this.getItemValue(i);a!=null&&r.push(a)}return r}),M(this,"find",n=>{if(n==null)return null;let r=this.indexOf(n);return r!==-1?this.at(r):null}),M(this,"findMany",n=>{let r=[];for(let i of n){let a=this.find(i);a!=null&&r.push(a)}return r}),M(this,"at",n=>{var a;if(!this.options.groupBy&&!this.options.groupSort)return(a=this.items[n])!=null?a:null;let r=0,i=this.group();for(let[,o]of i)for(let s of o){if(r===n)return s;r++}return null}),M(this,"sortFn",(n,r)=>{let i=this.indexOf(n),a=this.indexOf(r);return(i!=null?i:0)-(a!=null?a:0)}),M(this,"sort",n=>[...n].sort(this.sortFn.bind(this))),M(this,"getItemValue",n=>{var r,i,a;return n==null?null:(a=(i=(r=this.options).itemToValue)==null?void 0:i.call(r,n))!=null?a:Al.itemToValue(n)}),M(this,"getItemDisabled",n=>{var r,i,a;return n==null?!1:(a=(i=(r=this.options).isItemDisabled)==null?void 0:i.call(r,n))!=null?a:Al.isItemDisabled(n)}),M(this,"stringifyItem",n=>{var r,i,a;return n==null?null:(a=(i=(r=this.options).itemToString)==null?void 0:i.call(r,n))!=null?a:Al.itemToString(n)}),M(this,"stringify",n=>n==null?null:this.stringifyItem(this.find(n))),M(this,"stringifyItems",(n,r=", ")=>{let i=[];for(let a of n){let o=this.stringifyItem(a);o!=null&&i.push(o)}return i.join(r)}),M(this,"stringifyMany",(n,r)=>this.stringifyItems(this.findMany(n),r)),M(this,"has",n=>this.indexOf(n)!==-1),M(this,"hasItem",n=>n==null?!1:this.has(this.getItemValue(n))),M(this,"group",()=>{let{groupBy:n,groupSort:r}=this.options;if(!n)return[["",[...this.items]]];let i=new Map;this.items.forEach((o,s)=>{let l=n(o,s);i.has(l)||i.set(l,[]),i.get(l).push(o)});let a=Array.from(i.entries());return r&&a.sort(([o],[s])=>{if(typeof r=="function")return r(o,s);if(Array.isArray(r)){let l=r.indexOf(o),c=r.indexOf(s);return l===-1?1:c===-1?-1:l-c}return r==="asc"?o.localeCompare(s):r==="desc"?s.localeCompare(o):0}),a}),M(this,"getNextValue",(n,r=1,i=!1)=>{let a=this.indexOf(n);if(a===-1)return null;for(a=i?Math.min(a+r,this.size-1):a+r;a<=this.size&&this.getItemDisabled(this.at(a));)a++;return this.getItemValue(this.at(a))}),M(this,"getPreviousValue",(n,r=1,i=!1)=>{let a=this.indexOf(n);if(a===-1)return null;for(a=i?Math.max(a-r,0):a-r;a>=0&&this.getItemDisabled(this.at(a));)a--;return this.getItemValue(this.at(a))}),M(this,"indexOf",n=>{var r;if(n==null)return-1;if(!this.options.groupBy&&!this.options.groupSort)return this.items.findIndex(i=>this.getItemValue(i)===n);if(!this.indexMap){this.indexMap=new Map;let i=0,a=this.group();for(let[,o]of a)for(let s of o){let l=this.getItemValue(s);l!=null&&this.indexMap.set(l,i),i++}}return(r=this.indexMap.get(n))!=null?r:-1}),M(this,"getByText",(n,r)=>{let i=r!=null?this.indexOf(r):-1,a=n.length===1;for(let o=0;o{let{state:i,currentValue:a,timeout:o=350}=r,s=i.keysSoFar+n,c=s.length>1&&Array.from(s).every(f=>f===s[0])?s[0]:s,d=this.getByText(c,a),g=this.getItemValue(d);function p(){clearTimeout(i.timer),i.timer=-1}function u(f){i.keysSoFar=f,p(),f!==""&&(i.timer=+setTimeout(()=>{u(""),p()},o))}return u(s),g}),M(this,"update",(n,r)=>{let i=this.indexOf(n);return i===-1?this:this.copy([...this.items.slice(0,i),r,...this.items.slice(i+1)])}),M(this,"upsert",(n,r,i="append")=>{let a=this.indexOf(n);return a===-1?(i==="append"?this.append:this.prepend)(r):this.copy([...this.items.slice(0,a),r,...this.items.slice(a+1)])}),M(this,"insert",(n,...r)=>this.copy(mo(this.items,n,...r))),M(this,"insertBefore",(n,...r)=>{let i=this.indexOf(n);if(i===-1)if(this.items.length===0)i=0;else return this;return this.copy(mo(this.items,i,...r))}),M(this,"insertAfter",(n,...r)=>{let i=this.indexOf(n);if(i===-1)if(this.items.length===0)i=0;else return this;return this.copy(mo(this.items,i+1,...r))}),M(this,"prepend",(...n)=>this.copy(mo(this.items,0,...n))),M(this,"append",(...n)=>this.copy(mo(this.items,this.items.length,...n))),M(this,"filter",n=>{let r=this.items.filter((i,a)=>n(this.stringifyItem(i),a,i));return this.copy(r)}),M(this,"remove",(...n)=>{let r=n.map(i=>typeof i=="string"?i:this.getItemValue(i));return this.copy(this.items.filter(i=>{let a=this.getItemValue(i);return a==null?!1:!r.includes(a)}))}),M(this,"move",(n,r)=>{let i=this.indexOf(n);return i===-1?this:this.copy(Vl(this.items,[i],r))}),M(this,"moveBefore",(n,...r)=>{let i=this.items.findIndex(o=>this.getItemValue(o)===n);if(i===-1)return this;let a=r.map(o=>this.items.findIndex(s=>this.getItemValue(s)===o)).sort((o,s)=>o-s);return this.copy(Vl(this.items,a,i))}),M(this,"moveAfter",(n,...r)=>{let i=this.items.findIndex(o=>this.getItemValue(o)===n);if(i===-1)return this;let a=r.map(o=>this.items.findIndex(s=>this.getItemValue(s)===o)).sort((o,s)=>o-s);return this.copy(Vl(this.items,a,i+1))}),M(this,"reorder",(n,r)=>this.copy(Vl(this.items,[n],r))),M(this,"compareValue",(n,r)=>{let i=this.indexOf(n),a=this.indexOf(r);return ia?1:0}),M(this,"range",(n,r)=>{let i=[],a=n;for(;a!=null;){if(this.find(a)&&i.push(a),a===r)return i;a=this.getNextValue(a)}return[]}),M(this,"getValueRange",(n,r)=>n&&r?this.compareValue(n,r)<=0?this.range(n,r):this.range(r,n):[]),M(this,"toString",()=>{let n="";for(let r of this.items){let i=this.getItemValue(r),a=this.stringifyItem(r),o=this.getItemDisabled(r),s=[i,a,o].filter(Boolean).join(":");n+=s+","}return n}),M(this,"toJSON",()=>({size:this.size,first:this.firstValue,last:this.lastValue})),this.items=[...t.items]}get size(){return this.items.length}get firstValue(){let t=0;for(;this.getItemDisabled(this.at(t));)t++;return this.getItemValue(this.at(t))}get lastValue(){let t=this.size-1;for(;this.getItemDisabled(this.at(t));)t--;return this.getItemValue(this.at(t))}*[Symbol.iterator](){yield*Sp(this.items)}},gO=(e,t)=>!!(e!=null&&e.toLowerCase().startsWith(t.toLowerCase()));nu=class extends Sn{constructor(e){let{columnCount:t}=e;super(e),M(this,"columnCount"),M(this,"rows",null),M(this,"getRows",()=>(this.rows||(this.rows=Ba([...this.items],this.columnCount)),this.rows)),M(this,"getRowCount",()=>Math.ceil(this.items.length/this.columnCount)),M(this,"getCellIndex",(n,r)=>n*this.columnCount+r),M(this,"getCell",(n,r)=>this.at(this.getCellIndex(n,r))),M(this,"getValueCell",n=>{let r=this.indexOf(n);if(r===-1)return null;let i=Math.floor(r/this.columnCount),a=r%this.columnCount;return{row:i,column:a}}),M(this,"getLastEnabledColumnIndex",n=>{for(let r=this.columnCount-1;r>=0;r--){let i=this.getCell(n,r);if(i&&!this.getItemDisabled(i))return r}return null}),M(this,"getFirstEnabledColumnIndex",n=>{for(let r=0;r{let i=this.getValueCell(n);if(i===null)return null;let a=this.getRows(),o=a.length,s=i.row,l=i.column;for(let c=1;c<=o;c++){s=Ha(a,s,{loop:r});let d=a[s];if(!d)continue;if(!d[l]){let u=this.getLastEnabledColumnIndex(s);u!=null&&(l=u)}let p=this.getCell(s,l);if(!this.getItemDisabled(p))return this.getItemValue(p)}return this.firstValue}),M(this,"getNextRowValue",(n,r=!1)=>{let i=this.getValueCell(n);if(i===null)return null;let a=this.getRows(),o=a.length,s=i.row,l=i.column;for(let c=1;c<=o;c++){s=Mi(a,s,{loop:r});let d=a[s];if(!d)continue;if(!d[l]){let u=this.getLastEnabledColumnIndex(s);u!=null&&(l=u)}let p=this.getCell(s,l);if(!this.getItemDisabled(p))return this.getItemValue(p)}return this.lastValue}),this.columnCount=t}};Mm=class xl extends Set{constructor(t=[]){super(t),M(this,"selectionMode","single"),M(this,"deselectable",!0),M(this,"copy",()=>{let n=new xl([...this]);return this.sync(n)}),M(this,"sync",n=>(n.selectionMode=this.selectionMode,n.deselectable=this.deselectable,n)),M(this,"isEmpty",()=>this.size===0),M(this,"isSelected",n=>this.selectionMode==="none"||n==null?!1:this.has(n)),M(this,"canSelect",(n,r)=>this.selectionMode!=="none"||!n.getItemDisabled(n.find(r))),M(this,"firstSelectedValue",n=>{let r=null;for(let i of this)(!r||n.compareValue(i,r)<0)&&(r=i);return r}),M(this,"lastSelectedValue",n=>{let r=null;for(let i of this)(!r||n.compareValue(i,r)>0)&&(r=i);return r}),M(this,"extendSelection",(n,r,i)=>{if(this.selectionMode==="none")return this;if(this.selectionMode==="single")return this.replaceSelection(n,i);let a=this.copy(),o=Array.from(this).pop();for(let s of n.getValueRange(r,o!=null?o:i))a.delete(s);for(let s of n.getValueRange(i,r))this.canSelect(n,s)&&a.add(s);return a}),M(this,"toggleSelection",(n,r)=>{if(this.selectionMode==="none")return this;if(this.selectionMode==="single"&&!this.isSelected(r))return this.replaceSelection(n,r);let i=this.copy();return i.has(r)?i.delete(r):i.canSelect(n,r)&&i.add(r),i}),M(this,"replaceSelection",(n,r)=>{if(this.selectionMode==="none")return this;if(r==null)return this;if(!this.canSelect(n,r))return this;let i=new xl([r]);return this.sync(i)}),M(this,"setSelection",n=>{if(this.selectionMode==="none")return this;let r=new xl;for(let i of n)if(i!=null&&(r.add(i),this.selectionMode==="single"))break;return this.sync(r)}),M(this,"clearSelection",()=>{let n=this.copy();return n.deselectable&&n.size>0&&n.clear(),n}),M(this,"select",(n,r,i)=>this.selectionMode==="none"?this:this.selectionMode==="single"?this.isSelected(r)&&this.deselectable?this.toggleSelection(n,r):this.replaceSelection(n,r):this.selectionMode==="multiple"||i?this.toggleSelection(n,r):this.replaceSelection(n,r)),M(this,"deselect",n=>{let r=this.copy();return r.delete(n),r}),M(this,"isEqual",n=>Ce(Array.from(this),Array.from(n)))}};iu=class Gm{constructor(t){M(this,"options",t),M(this,"rootNode"),M(this,"isEqual",n=>Ce(this.rootNode,n.rootNode)),M(this,"getNodeChildren",n=>{var r,i,a,o;return(o=(a=(i=(r=this.options).nodeToChildren)==null?void 0:i.call(r,n))!=null?a:sa.nodeToChildren(n))!=null?o:[]}),M(this,"resolveIndexPath",n=>typeof n=="string"?this.getIndexPath(n):n),M(this,"resolveNode",n=>{let r=this.resolveIndexPath(n);return r?this.at(r):void 0}),M(this,"getNodeChildrenCount",n=>{var r,i,a;return(a=(i=(r=this.options).nodeToChildrenCount)==null?void 0:i.call(r,n))!=null?a:sa.nodeToChildrenCount(n)}),M(this,"getNodeValue",n=>{var r,i,a;return(a=(i=(r=this.options).nodeToValue)==null?void 0:i.call(r,n))!=null?a:sa.nodeToValue(n)}),M(this,"getNodeDisabled",n=>{var r,i,a;return(a=(i=(r=this.options).isNodeDisabled)==null?void 0:i.call(r,n))!=null?a:sa.isNodeDisabled(n)}),M(this,"stringify",n=>{let r=this.findNode(n);return r?this.stringifyNode(r):null}),M(this,"stringifyNode",n=>{var r,i,a;return(a=(i=(r=this.options).nodeToString)==null?void 0:i.call(r,n))!=null?a:sa.nodeToString(n)}),M(this,"getFirstNode",(n=this.rootNode,r={})=>{let i;return Rt(n,{getChildren:this.getNodeChildren,onEnter:(a,o)=>{var s;if(!this.isSameNode(a,n)){if((s=r.skip)!=null&&s.call(r,{value:this.getNodeValue(a),node:a,indexPath:o}))return"skip";if(!i&&o.length>0&&!this.getNodeDisabled(a))return i=a,"stop"}}}),i}),M(this,"getLastNode",(n=this.rootNode,r={})=>{let i;return Rt(n,{getChildren:this.getNodeChildren,onEnter:(a,o)=>{var s;if(!this.isSameNode(a,n)){if((s=r.skip)!=null&&s.call(r,{value:this.getNodeValue(a),node:a,indexPath:o}))return"skip";o.length>0&&!this.getNodeDisabled(a)&&(i=a)}}}),i}),M(this,"at",n=>_m(this.rootNode,n,{getChildren:this.getNodeChildren})),M(this,"findNode",(n,r=this.rootNode)=>fO(r,{getChildren:this.getNodeChildren,predicate:i=>this.getNodeValue(i)===n})),M(this,"findNodes",(n,r=this.rootNode)=>{let i=new Set(n.filter(a=>a!=null));return mO(r,{getChildren:this.getNodeChildren,predicate:a=>i.has(this.getNodeValue(a))})}),M(this,"sort",n=>n.reduce((r,i)=>{let a=this.getIndexPath(i);return a&&r.push({value:i,indexPath:a}),r},[]).sort((r,i)=>$m(r.indexPath,i.indexPath)).map(({value:r})=>r)),M(this,"getValue",n=>{let r=this.at(n);return r?this.getNodeValue(r):void 0}),M(this,"getValuePath",n=>{if(!n)return[];let r=[],i=[...n];for(;i.length>0;){let a=this.at(i);a&&r.unshift(this.getNodeValue(a)),i.pop()}return r}),M(this,"getDepth",n=>{var i;let r=Nm(this.rootNode,{getChildren:this.getNodeChildren,predicate:a=>this.getNodeValue(a)===n});return(i=r==null?void 0:r.length)!=null?i:0}),M(this,"isSameNode",(n,r)=>this.getNodeValue(n)===this.getNodeValue(r)),M(this,"isRootNode",n=>this.isSameNode(n,this.rootNode)),M(this,"contains",(n,r)=>!n||!r?!1:r.slice(0,n.length).every((i,a)=>n[a]===r[a])),M(this,"getNextNode",(n,r={})=>{let i=!1,a;return Rt(this.rootNode,{getChildren:this.getNodeChildren,onEnter:(o,s)=>{var c;if(this.isRootNode(o))return;let l=this.getNodeValue(o);if((c=r.skip)!=null&&c.call(r,{value:l,node:o,indexPath:s}))return l===n&&(i=!0),"skip";if(i&&!this.getNodeDisabled(o))return a=o,"stop";l===n&&(i=!0)}}),a}),M(this,"getPreviousNode",(n,r={})=>{let i,a=!1;return Rt(this.rootNode,{getChildren:this.getNodeChildren,onEnter:(o,s)=>{var c;if(this.isRootNode(o))return;let l=this.getNodeValue(o);if((c=r.skip)!=null&&c.call(r,{value:l,node:o,indexPath:s}))return"skip";if(l===n)return a=!0,"stop";this.getNodeDisabled(o)||(i=o)}}),a?i:void 0}),M(this,"getParentNodes",n=>{var a;let r=(a=this.resolveIndexPath(n))==null?void 0:a.slice();if(!r)return[];let i=[];for(;r.length>0;){r.pop();let o=this.at(r);o&&!this.isRootNode(o)&&i.unshift(o)}return i}),M(this,"getDescendantNodes",(n,r)=>{let i=this.resolveNode(n);if(!i)return[];let a=[];return Rt(i,{getChildren:this.getNodeChildren,onEnter:(o,s)=>{s.length!==0&&(!(r!=null&&r.withBranch)&&this.isBranchNode(o)||a.push(o))}}),a}),M(this,"getDescendantValues",(n,r)=>this.getDescendantNodes(n,r).map(a=>this.getNodeValue(a))),M(this,"getParentIndexPath",n=>n.slice(0,-1)),M(this,"getParentNode",n=>{let r=this.resolveIndexPath(n);return r?this.at(this.getParentIndexPath(r)):void 0}),M(this,"visit",n=>{let a=n,{skip:r}=a,i=St(a,["skip"]);Rt(this.rootNode,y(h({},i),{getChildren:this.getNodeChildren,onEnter:(o,s)=>{var l;if(!this.isRootNode(o))return r!=null&&r({value:this.getNodeValue(o),node:o,indexPath:s})?"skip":(l=i.onEnter)==null?void 0:l.call(i,o,s)}}))}),M(this,"getPreviousSibling",n=>{let r=this.getParentNode(n);if(!r)return;let i=this.getNodeChildren(r),a=n[n.length-1];for(;--a>=0;){let o=i[a];if(!this.getNodeDisabled(o))return o}}),M(this,"getNextSibling",n=>{let r=this.getParentNode(n);if(!r)return;let i=this.getNodeChildren(r),a=n[n.length-1];for(;++a{let r=this.getParentNode(n);return r?this.getNodeChildren(r):[]}),M(this,"getValues",(n=this.rootNode)=>yO(n,{getChildren:this.getNodeChildren,transform:i=>[this.getNodeValue(i)]}).slice(1)),M(this,"isValidDepth",(n,r)=>r==null?!0:typeof r=="function"?r(n.length):n.length===r),M(this,"isBranchNode",n=>this.getNodeChildren(n).length>0||this.getNodeChildrenCount(n)!=null),M(this,"getBranchValues",(n=this.rootNode,r={})=>{let i=[];return Rt(n,{getChildren:this.getNodeChildren,onEnter:(a,o)=>{var l;if(o.length===0)return;let s=this.getNodeValue(a);if((l=r.skip)!=null&&l.call(r,{value:s,node:a,indexPath:o}))return"skip";this.isBranchNode(a)&&this.isValidDepth(o,r.depth)&&i.push(this.getNodeValue(a))}}),i}),M(this,"flatten",(n=this.rootNode)=>EO(n,{getChildren:this.getNodeChildren})),M(this,"_create",(n,r)=>this.getNodeChildren(n).length>0||r.length>0?y(h({},n),{children:r}):h({},n)),M(this,"_insert",(n,r,i)=>this.copy(CO(n,{at:r,nodes:i,getChildren:this.getNodeChildren,create:this._create}))),M(this,"copy",n=>new Gm(y(h({},this.options),{rootNode:n}))),M(this,"_replace",(n,r,i)=>this.copy(wO(n,{at:r,node:i,getChildren:this.getNodeChildren,create:this._create}))),M(this,"_move",(n,r,i)=>this.copy(VO(n,{indexPaths:r,to:i,getChildren:this.getNodeChildren,create:this._create}))),M(this,"_remove",(n,r)=>this.copy(OO(n,{indexPaths:r,getChildren:this.getNodeChildren,create:this._create}))),M(this,"replace",(n,r)=>this._replace(this.rootNode,n,r)),M(this,"remove",n=>this._remove(this.rootNode,n)),M(this,"insertBefore",(n,r)=>this.getParentNode(n)?this._insert(this.rootNode,n,r):void 0),M(this,"insertAfter",(n,r)=>{if(!this.getParentNode(n))return;let a=[...n.slice(0,-1),n[n.length-1]+1];return this._insert(this.rootNode,a,r)}),M(this,"move",(n,r)=>this._move(this.rootNode,n,r)),M(this,"filter",n=>{let r=bO(this.rootNode,{predicate:n,getChildren:this.getNodeChildren,create:this._create});return this.copy(r)}),M(this,"toJSON",()=>this.getValues(this.rootNode)),this.rootNode=t.rootNode}getIndexPath(t){if(Array.isArray(t)){if(t.length===0)return[];let n=[],r=this.getNodeChildren(this.rootNode);for(let i=0;ithis.getNodeValue(s)===a);if(o===-1)break;if(n.push(o),ithis.getNodeValue(n)===t})}},sa={nodeToValue(e){return typeof e=="string"?e:un(e)&&at(e,"value")?e.value:""},nodeToString(e){return typeof e=="string"?e:un(e)&&at(e,"label")?e.label:sa.nodeToValue(e)},isNodeDisabled(e){return un(e)&&at(e,"disabled")?!!e.disabled:!1},nodeToChildren(e){return e.children},nodeToChildrenCount(e){if(un(e)&&at(e,"childrenCount"))return e.childrenCount}}});function zm(e,t){let{context:n,prop:r,scope:i,computed:a,send:o,refs:s}=e,l=r("disabled"),c=r("collection"),d=In(c)?"grid":"list",g=n.get("focused"),p=s.get("focusVisible")&&g,u=s.get("inputState"),f=n.get("value"),m=a("selectedItems"),S=n.get("highlightedValue"),T=n.get("highlightedItem"),w=a("isTypingAhead"),I=a("isInteractive"),P=S?ou(i,S):void 0;function v(E){let R=c.getItemDisabled(E.item),x=c.getItemValue(E.item);nn(x,()=>`[zag-js] No value found for item ${JSON.stringify(E.item)}`);let C=S===x;return{value:x,disabled:!!(l||R),focused:C&&g,focusVisible:C&&p,highlighted:C&&(u.focused?g:p),selected:n.get("value").includes(x)}}return{empty:f.length===0,highlightedItem:T,highlightedValue:S,clearHighlightedValue(){o({type:"HIGHLIGHTED_VALUE.SET",value:null})},selectedItems:m,hasSelectedItems:a("hasSelectedItems"),value:f,valueAsString:a("valueAsString"),collection:c,disabled:!!l,selectValue(E){o({type:"ITEM.SELECT",value:E})},setValue(E){o({type:"VALUE.SET",value:E})},selectAll(){if(!a("multiple"))throw new Error("[zag-js] Cannot select all items in a single-select listbox");o({type:"VALUE.SET",value:c.getValues()})},highlightValue(E){o({type:"HIGHLIGHTED_VALUE.SET",value:E})},highlightFirst(){o({type:"HIGHLIGHT.FIRST"})},highlightLast(){o({type:"HIGHLIGHT.LAST"})},highlightNext(){o({type:"HIGHLIGHT.NEXT"})},highlightPrevious(){o({type:"HIGHLIGHT.PREV"})},clearValue(E){o(E?{type:"ITEM.CLEAR",value:E}:{type:"VALUE.CLEAR"})},getItemState:v,getRootProps(){return t.element(y(h({},Tn.root.attrs),{dir:r("dir"),id:RO(i),"data-orientation":r("orientation"),"data-disabled":b(l)}))},getInputProps(E={}){var x;let R=(x=E.keyboardPriority)!=null?x:"caret";return t.input(y(h({},Tn.input.attrs),{dir:r("dir"),disabled:l,"data-disabled":b(l),autoComplete:"off",autoCorrect:"off","aria-haspopup":"listbox","aria-controls":au(i),"aria-autocomplete":"list","aria-activedescendant":P,spellCheck:!1,enterKeyHint:"go",onFocus(){queueMicrotask(()=>{o({type:"INPUT.FOCUS",autoHighlight:!!(E!=null&&E.autoHighlight)})})},onBlur(){o({type:"CONTENT.BLUR",src:"input"})},onInput(C){E!=null&&E.autoHighlight&&(C.currentTarget.value.trim()||queueMicrotask(()=>{o({type:"HIGHLIGHTED_VALUE.SET",value:null})}))},onKeyDown(C){if(C.defaultPrevented||Me(C))return;let A=Ot(C),N=()=>{var K;C.preventDefault();let k=i.getWin(),L=new k.KeyboardEvent(A.type,A);(K=kl(i))==null||K.dispatchEvent(L)};switch(A.key){case"ArrowLeft":case"ArrowRight":{if(!In(c)||C.ctrlKey||R!=="navigate")return;N();break}case"Home":case"End":{if(R!=="navigate"||S==null&&C.shiftKey)return;N();break}case"ArrowDown":case"ArrowUp":{N();break}case"Enter":S!=null&&(C.preventDefault(),o({type:"ITEM.CLICK",value:S}));break;default:break}}}))},getLabelProps(){return t.element(y(h({dir:r("dir"),id:qm(i)},Tn.label.attrs),{"data-disabled":b(l)}))},getValueTextProps(){return t.element(y(h({},Tn.valueText.attrs),{dir:r("dir"),"data-disabled":b(l)}))},getItemProps(E){let R=v(E);return t.element(y(h({id:ou(i,R.value),role:"option"},Tn.item.attrs),{dir:r("dir"),"data-value":R.value,"aria-selected":R.selected,"data-selected":b(R.selected),"data-layout":d,"data-state":R.selected?"checked":"unchecked","data-orientation":r("orientation"),"data-highlighted":b(R.highlighted),"data-disabled":b(R.disabled),"aria-disabled":se(R.disabled),onPointerMove(x){E.highlightOnHover&&(R.disabled||x.pointerType!=="mouse"||R.highlighted||o({type:"ITEM.POINTER_MOVE",value:R.value}))},onMouseDown(x){var C;x.preventDefault(),(C=kl(i))==null||C.focus()},onClick(x){x.defaultPrevented||jr(x)||$n(x)||pr(x)||R.disabled||o({type:"ITEM.CLICK",value:R.value,shiftKey:x.shiftKey,anchorValue:S,metaKey:xs(x)})}}))},getItemTextProps(E){let R=v(E);return t.element(y(h({},Tn.itemText.attrs),{"data-state":R.selected?"checked":"unchecked","data-disabled":b(R.disabled),"data-highlighted":b(R.highlighted)}))},getItemIndicatorProps(E){let R=v(E);return t.element(y(h({},Tn.itemIndicator.attrs),{"aria-hidden":!0,"data-state":R.selected?"checked":"unchecked",hidden:!R.selected}))},getItemGroupLabelProps(E){let{htmlFor:R}=E;return t.element(y(h({},Tn.itemGroupLabel.attrs),{id:Wm(i,R),dir:r("dir"),role:"presentation"}))},getItemGroupProps(E){let{id:R}=E;return t.element(y(h({},Tn.itemGroup.attrs),{"data-disabled":b(l),"data-orientation":r("orientation"),"data-empty":b(c.size===0),id:kO(i,R),"aria-labelledby":Wm(i,R),role:"group",dir:r("dir")}))},getContentProps(){return t.element(y(h({dir:r("dir"),id:au(i),role:"listbox"},Tn.content.attrs),{"data-activedescendant":P,"aria-activedescendant":P,"data-orientation":r("orientation"),"aria-multiselectable":a("multiple")?!0:void 0,"aria-labelledby":qm(i),tabIndex:0,"data-layout":d,"data-empty":b(c.size===0),style:{"--column-count":In(c)?c.columnCount:1},onFocus(){o({type:"CONTENT.FOCUS"})},onBlur(){o({type:"CONTENT.BLUR"})},onKeyDown(E){if(!I)return;let R=ne(E);if(!ge(E.currentTarget,ne(E)))return;let x=E.shiftKey,C={ArrowUp(N){let k=null;In(c)&&S?k=c.getPreviousRowValue(S):S&&(k=c.getPreviousValue(S)),!k&&(r("loopFocus")||!S)&&(k=c.lastValue),k&&(N.preventDefault(),o({type:"NAVIGATE",value:k,shiftKey:x,anchorValue:S}))},ArrowDown(N){let k=null;In(c)&&S?k=c.getNextRowValue(S):S&&(k=c.getNextValue(S)),!k&&(r("loopFocus")||!S)&&(k=c.firstValue),k&&(N.preventDefault(),o({type:"NAVIGATE",value:k,shiftKey:x,anchorValue:S}))},ArrowLeft(){if(!In(c)&&r("orientation")==="vertical")return;let N=S?c.getPreviousValue(S):null;!N&&r("loopFocus")&&(N=c.lastValue),N&&(E.preventDefault(),o({type:"NAVIGATE",value:N,shiftKey:x,anchorValue:S}))},ArrowRight(){if(!In(c)&&r("orientation")==="vertical")return;let N=S?c.getNextValue(S):null;!N&&r("loopFocus")&&(N=c.firstValue),N&&(E.preventDefault(),o({type:"NAVIGATE",value:N,shiftKey:x,anchorValue:S}))},Home(N){if($t(R))return;N.preventDefault();let k=c.firstValue;o({type:"NAVIGATE",value:k,shiftKey:x,anchorValue:S})},End(N){if($t(R))return;N.preventDefault();let k=c.lastValue;o({type:"NAVIGATE",value:k,shiftKey:x,anchorValue:S})},Enter(){o({type:"ITEM.CLICK",value:S})},a(N){xs(N)&&a("multiple")&&!r("disallowSelectAll")&&(N.preventDefault(),o({type:"VALUE.SET",value:c.getValues()}))},Space(N){var k;w&&r("typeahead")?o({type:"CONTENT.TYPEAHEAD",key:N.key}):(k=C.Enter)==null||k.call(C,N)},Escape(N){r("deselectable")&&f.length>0&&(N.preventDefault(),N.stopPropagation(),o({type:"VALUE.CLEAR"}))}},A=C[me(E)];if(A){A(E);return}$t(R)||ft.isValidEvent(E)&&r("typeahead")&&(o({type:"CONTENT.TYPEAHEAD",key:E.key}),E.preventDefault())}}))}}}function vo(e,t,n){let r=FO(t,e);for(let i of r)n==null||n({value:i})}function Cn(e){var t;return(t=e.value)!=null?t:""}function Rr(e,t){return t?{items:e,itemToValue:n=>Cn(n),itemToString:n=>n.label,isItemDisabled:n=>!!n.disabled,groupBy:n=>{var r;return(r=n.group)!=null?r:""}}:{items:e,itemToValue:n=>Cn(n),itemToString:n=>n.label,isItemDisabled:n=>!!n.disabled}}function su(e,t){return yo(Rr(e,t))}var AO,Tn,yo,xO,RO,au,qm,ou,kO,Wm,kl,Km,NO,LO,DO,jm,FO,Nl=ee(()=>{"use strict";ca();yn();oe();AO=z("listbox").parts("label","input","item","itemText","itemIndicator","itemGroup","itemGroupLabel","content","root","valueText"),Tn=AO.build(),yo=e=>new Sn(e);yo.empty=()=>new Sn({items:[]});xO=e=>new nu(e);xO.empty=()=>new nu({items:[],columnCount:0});RO=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`listbox:${e.id}`},au=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`listbox:${e.id}:content`},qm=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`listbox:${e.id}:label`},ou=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.item)==null?void 0:r.call(n,t))!=null?i:`listbox:${e.id}:item:${t}`},kO=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemGroup)==null?void 0:r.call(n,t))!=null?i:`listbox:${e.id}:item-group:${t}`},Wm=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemGroupLabel)==null?void 0:r.call(n,t))!=null?i:`listbox:${e.id}:item-group-label:${t}`},kl=e=>e.getById(au(e)),Km=(e,t)=>e.getById(ou(e,t));({guards:NO,createMachine:LO}=Mt()),{or:DO}=NO,jm=LO({props({props:e}){return h({loopFocus:!1,composite:!0,defaultValue:[],multiple:!1,typeahead:!0,collection:yo.empty(),orientation:"vertical",selectionMode:"single"},e)},context({prop:e,bindable:t,getContext:n}){var a,o;let r=(o=(a=e("value"))!=null?a:e("defaultValue"))!=null?o:[],i=e("collection").findMany(r);return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:Ce,onChange(s){var f,m;let l=n(),c=e("collection"),d=l.get("selectedItemMap"),g=kt({values:s,collection:c,selectedItemMap:d}),p=(f=e("value"))!=null?f:s,u=p===s?g:kt({values:p,collection:c,selectedItemMap:g.nextSelectedItemMap});return l.set("selectedItemMap",u.nextSelectedItemMap),(m=e("onValueChange"))==null?void 0:m({value:s,items:g.selectedItems})}})),highlightedValue:t(()=>({defaultValue:e("defaultHighlightedValue")||null,value:e("highlightedValue"),sync:!0,onChange(s){var l;(l=e("onHighlightChange"))==null||l({highlightedValue:s,highlightedItem:e("collection").find(s),highlightedIndex:e("collection").indexOf(s)})}})),highlightedItem:t(()=>({defaultValue:null})),selectedItemMap:t(()=>({defaultValue:la({selectedItems:i,collection:e("collection")})})),focused:t(()=>({sync:!0,defaultValue:!1}))}},refs(){return{typeahead:h({},ft.defaultOptions),focusVisible:!1,inputState:{autoHighlight:!1,focused:!1}}},computed:{hasSelectedItems:({context:e})=>e.get("value").length>0,isTypingAhead:({refs:e})=>e.get("typeahead").keysSoFar!=="",isInteractive:({prop:e})=>!e("disabled"),selection:({context:e,prop:t})=>{let n=new Mm(e.get("value"));return n.selectionMode=t("selectionMode"),n.deselectable=!!t("deselectable"),n},multiple:({prop:e})=>e("selectionMode")==="multiple"||e("selectionMode")==="extended",selectedItems:({context:e,prop:t})=>oi({values:e.get("value"),collection:t("collection"),selectedItemMap:e.get("selectedItemMap")}),valueAsString:({computed:e,prop:t})=>t("collection").stringifyItems(e("selectedItems"))},initialState(){return"idle"},watch({context:e,prop:t,track:n,action:r}){n([()=>e.get("value").toString()],()=>{r(["syncSelectedItems"])}),n([()=>e.get("highlightedValue")],()=>{r(["syncHighlightedItem"])}),n([()=>t("collection").toString()],()=>{r(["syncHighlightedValue"])})},effects:["trackFocusVisible"],on:{"HIGHLIGHTED_VALUE.SET":{actions:["setHighlightedItem"]},"ITEM.SELECT":{actions:["selectItem"]},"ITEM.CLEAR":{actions:["clearItem"]},"VALUE.SET":{actions:["setSelectedItems"]},"VALUE.CLEAR":{actions:["clearSelectedItems"]},"HIGHLIGHT.FIRST":{actions:["highlightFirstValue"]},"HIGHLIGHT.LAST":{actions:["highlightLastValue"]},"HIGHLIGHT.NEXT":{actions:["highlightNextValue"]},"HIGHLIGHT.PREV":{actions:["highlightPreviousValue"]}},states:{idle:{effects:["scrollToHighlightedItem"],on:{"INPUT.FOCUS":{actions:["setFocused","setInputState"]},"CONTENT.FOCUS":[{guard:DO("hasSelectedValue","hasHighlightedValue"),actions:["setFocused"]},{actions:["setFocused","setDefaultHighlightedValue"]}],"CONTENT.BLUR":{actions:["clearFocused","clearInputState"]},"ITEM.CLICK":{actions:["setHighlightedItem","selectHighlightedItem"]},"CONTENT.TYPEAHEAD":{actions:["setFocused","highlightMatchingItem"]},"ITEM.POINTER_MOVE":{actions:["highlightItem"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedItem"]},NAVIGATE:{actions:["setFocused","setHighlightedItem","selectWithKeyboard"]}}}},implementations:{guards:{hasSelectedValue:({context:e})=>e.get("value").length>0,hasHighlightedValue:({context:e})=>e.get("highlightedValue")!=null},effects:{trackFocusVisible:({scope:e,refs:t})=>{var n;return nt({root:(n=e.getRootNode)==null?void 0:n.call(e),onChange(r){t.set("focusVisible",r.isFocusVisible)}})},scrollToHighlightedItem({context:e,prop:t,scope:n}){let r=a=>{let o=e.get("highlightedValue");if(o==null||Sr()==="pointer")return;let l=kl(n),c=t("scrollToIndexFn");if(c){let g=t("collection").indexOf(o);c==null||c({index:g,immediate:a,getElement(){return Km(n,o)}});return}let d=Km(n,o);Un(d,{rootEl:l,block:"nearest"})};return B(()=>{Ir("virtual"),r(!0)}),Ht(()=>kl(n),{defer:!0,attributes:["data-activedescendant"],callback(){r(!1)}})}},actions:{selectHighlightedItem({context:e,prop:t,event:n,computed:r}){var s;let i=(s=n.value)!=null?s:e.get("highlightedValue"),a=t("collection");if(i==null||!a.has(i))return;let o=r("selection");if(n.shiftKey&&r("multiple")&&n.anchorValue){let l=o.extendSelection(a,n.anchorValue,i);vo(o,l,t("onSelect")),e.set("value",Array.from(l))}else{let l=o.select(a,i,n.metaKey);vo(o,l,t("onSelect")),e.set("value",Array.from(l))}},selectWithKeyboard({context:e,prop:t,event:n,computed:r}){let i=r("selection"),a=t("collection");if(n.shiftKey&&r("multiple")&&n.anchorValue){let o=i.extendSelection(a,n.anchorValue,n.value);vo(i,o,t("onSelect")),e.set("value",Array.from(o));return}if(t("selectOnHighlight")){let o=i.replaceSelection(a,n.value);vo(i,o,t("onSelect")),e.set("value",Array.from(o))}},highlightItem({context:e,event:t}){e.set("highlightedValue",t.value)},highlightMatchingItem({context:e,prop:t,event:n,refs:r}){let i=t("collection").search(n.key,{state:r.get("typeahead"),currentValue:e.get("highlightedValue")});i!=null&&e.set("highlightedValue",i)},setHighlightedItem({context:e,event:t}){e.set("highlightedValue",t.value)},highlightFirstValue({context:e,prop:t}){var n;e.set("highlightedValue",(n=t("collection").firstValue)!=null?n:null)},highlightLastValue({context:e,prop:t}){var n;e.set("highlightedValue",(n=t("collection").lastValue)!=null?n:null)},highlightNextValue({context:e,prop:t}){let n=t("collection"),r=e.get("highlightedValue"),i=null;In(n)&&r?i=n.getNextRowValue(r):r&&(i=n.getNextValue(r)),!i&&(t("loopFocus")||!r)&&(i=n.firstValue),i&&e.set("highlightedValue",i)},highlightPreviousValue({context:e,prop:t}){let n=t("collection"),r=e.get("highlightedValue"),i=null;In(n)&&r?i=n.getPreviousRowValue(r):r&&(i=n.getPreviousValue(r)),!i&&(t("loopFocus")||!r)&&(i=n.lastValue),i&&e.set("highlightedValue",i)},clearHighlightedItem({context:e}){e.set("highlightedValue",null)},selectItem({context:e,prop:t,event:n,computed:r}){let i=t("collection"),a=r("selection"),o=a.select(i,n.value);vo(a,o,t("onSelect")),e.set("value",Array.from(o))},clearItem({context:e,event:t,computed:n}){let i=n("selection").deselect(t.value);e.set("value",Array.from(i))},setSelectedItems({context:e,event:t}){e.set("value",t.value)},clearSelectedItems({context:e}){e.set("value",[])},syncSelectedItems({context:e,prop:t}){let n=kt({values:e.get("value"),collection:t("collection"),selectedItemMap:e.get("selectedItemMap")});e.set("selectedItemMap",n.nextSelectedItemMap)},syncHighlightedItem({context:e,prop:t}){let n=t("collection"),r=e.get("highlightedValue"),i=r?n.find(r):null;e.set("highlightedItem",i)},syncHighlightedValue({context:e,prop:t,refs:n}){let r=t("collection"),i=e.get("highlightedValue"),{autoHighlight:a}=n.get("inputState");if(a){queueMicrotask(()=>{var o;e.set("highlightedValue",(o=t("collection").firstValue)!=null?o:null)});return}i!=null&&!r.has(i)&&queueMicrotask(()=>{e.set("highlightedValue",null)})},setFocused({context:e}){e.set("focused",!0)},setDefaultHighlightedValue({context:e,prop:t}){let r=t("collection").firstValue;r!=null&&e.set("highlightedValue",r)},clearFocused({context:e}){e.set("focused",!1)},setInputState({refs:e,event:t}){e.set("inputState",{autoHighlight:!!t.autoHighlight,focused:!0})},clearInputState({refs:e}){e.set("inputState",{autoHighlight:!1,focused:!1})}}}}),FO=(e,t)=>{let n=new Set(e);for(let r of t)n.delete(r);return n}});function lu(e){let t=e.trim();if(!t||t.startsWith("//"))return!1;let n=_O.exec(t);if(n){let r=n[0].slice(0,-1).toLowerCase();return r==="http"||r==="https"}return!0}function wn(e,t){if(!e)return!t||!lu(t)?null:{destination:t};let n=e.getAttribute("data-redirect");if(n==="false")return null;let r=e.getAttribute("data-to")||t||e.getAttribute("data-value")||"";if(!r||!lu(r))return null;let i=MO.includes(n)?n:void 0,a=e.hasAttribute("data-new-tab");return{destination:r,mode:i,newTab:a}}function On(e,t){if(!e||!e.destination||!lu(e.destination))return!1;let{destination:n,newTab:r,mode:i}=e;if(r)return window.open(n,"_blank","noopener,noreferrer"),!0;let a=t.liveSocket.main;if(!(!a.isDead&&a.isConnected())||!i||i==="href")return window.location.href=n,!0;let s=t.liveSocket.js();return i==="patch"?s.patch(n):s.navigate(n),!0}var MO,_O,da=ee(()=>{"use strict";MO=["href","patch","navigate"],_O=/^[a-zA-Z][a-zA-Z0-9+.-]*:/});var sv={};pe(sv,{Combobox:()=>ZO,comboboxValueBinding:()=>hn,formatComboboxHiddenValue:()=>av,selectedItemLabel:()=>pu,syncComboboxHiddenInputForPhoenix:()=>gu,syncVisibleInputAttribute:()=>Fl});function qO(e,t){let{context:n,prop:r,state:i,send:a,scope:o,computed:s,event:l}=e,c=r("translations"),d=r("collection"),g=!!r("disabled"),p=s("isInteractive"),u=!!r("invalid"),f=!!r("required"),m=!!r("readOnly"),S=i.hasTag("open"),T=i.hasTag("focused"),w=r("composite"),I=n.get("highlightedValue"),P=Gt(y(h({},r("positioning")),{placement:n.get("currentPlacement")}));function v(E){let R=d.getItemDisabled(E.item),x=d.getItemValue(E.item);return nn(x,()=>`[zag-js] No value found for item ${JSON.stringify(E.item)}`),{value:x,disabled:!!(g||R),highlighted:I===x,selected:n.get("value").includes(x)}}return{focused:T,open:S,inputValue:n.get("inputValue"),highlightedValue:I,highlightedItem:n.get("highlightedItem"),value:n.get("value"),valueAsString:s("valueAsString"),hasSelectedItems:s("hasSelectedItems"),selectedItems:s("selectedItems"),collection:r("collection"),multiple:!!r("multiple"),disabled:!!g,syncSelectedItems(){a({type:"SELECTED_ITEMS.SYNC"})},reposition(E={}){a({type:"POSITIONING.SET",options:E})},setHighlightValue(E){a({type:"HIGHLIGHTED_VALUE.SET",value:E})},clearHighlightValue(){a({type:"HIGHLIGHTED_VALUE.CLEAR"})},selectValue(E){a({type:"ITEM.SELECT",value:E})},setValue(E){a({type:"VALUE.SET",value:E})},setInputValue(E,R="script"){a({type:"INPUT_VALUE.SET",value:E,src:R})},clearValue(E){E!=null?a({type:"ITEM.CLEAR",value:E}):a({type:"VALUE.CLEAR"})},focus(){var E;(E=ga(o))==null||E.focus()},setOpen(E,R="script"){i.hasTag("open")!==E&&a({type:E?"OPEN":"CLOSE",src:R})},getRootProps(){return t.element(y(h({},bt.root.attrs),{dir:r("dir"),id:HO(o),"data-invalid":b(u),"data-readonly":b(m)}))},getLabelProps(){return t.label(y(h({},bt.label.attrs),{dir:r("dir"),htmlFor:Ll(o),id:cu(o),"data-readonly":b(m),"data-disabled":b(g),"data-invalid":b(u),"data-required":b(f),"data-focus":b(T),onClick(E){var R;w||(E.preventDefault(),(R=bo(o))==null||R.focus({preventScroll:!0}))}}))},getControlProps(){return t.element(y(h({},bt.control.attrs),{dir:r("dir"),id:tv(o),"data-state":S?"open":"closed","data-focus":b(T),"data-disabled":b(g),"data-invalid":b(u)}))},getPositionerProps(){return t.element(y(h({},bt.positioner.attrs),{dir:r("dir"),id:nv(o),style:P.floating}))},getInputProps(){return t.input(y(h({},bt.input.attrs),{dir:r("dir"),"aria-invalid":se(u),"data-invalid":b(u),"data-autofocus":b(r("autoFocus")),name:r("name"),form:r("form"),disabled:g,required:r("required"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"none",spellCheck:"false",readOnly:m,placeholder:r("placeholder"),id:Ll(o),type:"text",role:"combobox",defaultValue:n.get("inputValue"),"aria-autocomplete":s("autoComplete")?"both":"list","aria-controls":Dl(o),"aria-expanded":S,"data-state":S?"open":"closed","aria-activedescendant":I?Xm(o,I):void 0,onClick(E){E.defaultPrevented||r("openOnClick")&&p&&a({type:"INPUT.CLICK",src:"input-click"})},onFocus(){g||a({type:"INPUT.FOCUS"})},onBlur(){g||a({type:"INPUT.BLUR"})},onChange(E){a({type:"INPUT.CHANGE",value:E.currentTarget.value,src:"input-change"})},onKeyDown(E){if(E.defaultPrevented||!p||E.ctrlKey||E.shiftKey||Me(E))return;let R=r("openOnKeyPress"),x=E.ctrlKey||E.metaKey||E.shiftKey,C=!0,A={ArrowDown(L){!R&&!S||(a({type:L.altKey?"OPEN":"INPUT.ARROW_DOWN",keypress:C,src:"arrow-key"}),L.preventDefault())},ArrowUp(){!R&&!S||(a({type:E.altKey?"CLOSE":"INPUT.ARROW_UP",keypress:C,src:"arrow-key"}),E.preventDefault())},Home(L){x||(a({type:"INPUT.HOME",keypress:C}),S&&L.preventDefault())},End(L){x||(a({type:"INPUT.END",keypress:C}),S&&L.preventDefault())},Enter(L){var ce;a({type:"INPUT.ENTER",keypress:C,src:"item-select"});let K=s("isCustomValue")&&r("allowCustomValue"),J=I!=null,ue=r("alwaysSubmitOnEnter");if(S&&!K&&!ue&&J&&L.preventDefault(),I==null)return;let Z=ua(o,I);_t(Z)&&((ce=r("navigate"))==null||ce({value:I,node:Z,href:Z.href}))},Escape(){a({type:"INPUT.ESCAPE",keypress:C,src:"escape-key"}),E.preventDefault()}},N=me(E,{dir:r("dir")}),k=A[N];k==null||k(E)}}))},getTriggerProps(E={}){return t.button(y(h({},bt.trigger.attrs),{dir:r("dir"),id:rv(o),"aria-haspopup":w?"listbox":"dialog",type:"button",tabIndex:E.focusable?void 0:-1,"aria-label":c.triggerLabel,"aria-expanded":S,"data-state":S?"open":"closed","aria-controls":S?Dl(o):void 0,disabled:g,"data-invalid":b(u),"data-focusable":b(E.focusable),"data-readonly":b(m),"data-disabled":b(g),onFocus(){E.focusable&&a({type:"INPUT.FOCUS",src:"trigger"})},onClick(R){R.defaultPrevented||p&&fe(R)&&a({type:"TRIGGER.CLICK",src:"trigger-click"})},onPointerDown(R){p&&R.pointerType!=="touch"&&fe(R)&&(R.preventDefault(),queueMicrotask(()=>{du(o)}))},onKeyDown(R){if(R.defaultPrevented||w)return;let x={ArrowDown(){a({type:"INPUT.ARROW_DOWN",src:"arrow-key"})},ArrowUp(){a({type:"INPUT.ARROW_UP",src:"arrow-key"})}},C=me(R,{dir:r("dir")}),A=x[C];A&&(A(R),R.preventDefault())}}))},getContentProps(){return t.element(y(h({},bt.content.attrs),{dir:r("dir"),id:Dl(o),role:w?"listbox":"dialog",tabIndex:-1,hidden:!S,"data-state":S?"open":"closed","data-placement":n.get("currentPlacement"),"aria-labelledby":cu(o),"aria-multiselectable":r("multiple")&&w?!0:void 0,"data-empty":b(d.size===0),onPointerDown(E){fe(E)&&E.preventDefault()}}))},getListProps(){return t.element(y(h({},bt.list.attrs),{role:w?void 0:"listbox","data-empty":b(d.size===0),"aria-labelledby":cu(o),"aria-multiselectable":r("multiple")&&!w?!0:void 0}))},getClearTriggerProps(){return t.button(y(h({},bt.clearTrigger.attrs),{dir:r("dir"),id:iv(o),type:"button",tabIndex:-1,disabled:g,"data-invalid":b(u),"aria-label":c.clearTriggerLabel,"aria-controls":Ll(o),hidden:!n.get("value").length,onPointerDown(E){fe(E)&&E.preventDefault()},onClick(E){E.defaultPrevented||p&&a({type:"VALUE.CLEAR",src:"clear-trigger"})}}))},getItemState:v,getItemProps(E){let R=v(E),x=R.value;return t.element(y(h({},bt.item.attrs),{dir:r("dir"),id:Xm(o,x),role:"option",tabIndex:-1,"data-highlighted":b(R.highlighted),"data-state":R.selected?"checked":"unchecked","aria-selected":se(R.selected),"aria-disabled":se(R.disabled),"data-disabled":b(R.disabled),"data-value":R.value,onPointerMove(){R.disabled||R.highlighted||a({type:"ITEM.POINTER_MOVE",value:x})},onPointerLeave(){if(E.persistFocus||R.disabled)return;let C=l.previous();C!=null&&C.type.includes("POINTER")&&a({type:"ITEM.POINTER_LEAVE",value:x})},onClick(C){jr(C)||$n(C)||pr(C)||R.disabled||a({type:"ITEM.CLICK",src:"item-select",value:x})}}))},getItemTextProps(E){let R=v(E);return t.element(y(h({},bt.itemText.attrs),{dir:r("dir"),"data-state":R.selected?"checked":"unchecked","data-disabled":b(R.disabled),"data-highlighted":b(R.highlighted)}))},getItemIndicatorProps(E){let R=v(E);return t.element(y(h({"aria-hidden":!0},bt.itemIndicator.attrs),{dir:r("dir"),"data-state":R.selected?"checked":"unchecked",hidden:!R.selected}))},getItemGroupProps(E){let{id:R}=E;return t.element(y(h({},bt.itemGroup.attrs),{dir:r("dir"),id:BO(o,R),"aria-labelledby":Ym(o,R),"data-empty":b(d.size===0),role:"group"}))},getItemGroupLabelProps(E){let{htmlFor:R}=E;return t.element(y(h({},bt.itemGroupLabel.attrs),{dir:r("dir"),id:Ym(o,R),role:"presentation"}))}}}function Qm(e){return(e.previousEvent||e).src}function av(e,t){var r;let n=t.map(i=>String(i));return n.length===0?"":O(e,"multiple")?n.join(","):(r=n[0])!=null?r:""}function gu(e,t,n){let r=V(e,"submitName");if(r&&O(e,"multiple")){sn(e,t,{onTouched:n,scope:"combobox",submitName:r,notifyLiveView:!0});return}let i=e.querySelector('[data-scope="combobox"][data-part="hidden-input"]');i&&Vr(i,()=>av(e,t),n)}function ev(e){let t=e.querySelector('[data-scope="combobox"][data-part="hidden-input"]');t&&Wt(t)}function pu(e){let t=e==null?void 0:e[0];return t&&t.label!=null?String(t.label):""}function Fl(e,t){let n=e.querySelector('[data-scope="combobox"][data-part="input"]');n&&n.setAttribute("value",t)}function ov(e,t,n,r,i,a){let o=O(e,"redirect");return{id:e.id,disabled:O(e,"disabled"),placeholder:V(e,"placeholder"),alwaysSubmitOnEnter:O(e,"alwaysSubmitOnEnter"),autoFocus:O(e,"autoFocus"),closeOnSelect:O(e,"closeOnSelect"),dir:q(e),inputBehavior:V(e,"inputBehavior"),loopFocus:O(e,"loopFocus"),multiple:o?!1:O(e,"multiple"),invalid:O(e,"invalid"),allowCustomValue:!1,selectionBehavior:"replace",readOnly:O(e,"readonly"),required:O(e,"required"),positioning:qe(e),onOpenChange:s=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,open:s.open,reason:s.reason,value:s.value},serverEventName:V(e,"onOpenChange"),clientEventName:V(e,"onOpenChangeClient")})},onInputValueChange:s=>{var l;Fl(e,(l=s.inputValue)!=null?l:""),W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,value:s.inputValue,reason:s.reason},serverEventName:V(e,"onInputValueChange"),clientEventName:V(e,"onInputValueChangeClient")})},onValueChange:s=>{var c;let l=s.value.length>0?String(s.value[0]):null;if(o&&l){let d=e.querySelector(`[data-scope="combobox"][data-part="item"][data-value="${CSS.escape(l)}"]`);On(wn(d,l),{liveSocket:r})}gu(e,s.value,a),(c=i())==null||c.restoreFilteredOptions(),Fl(e,pu(s.items)),W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,value:s.value,items:s.items},serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})}}}function XO(e,t,n,r,i,a){let o=h({},ov(e,t,n,r,i,a));return delete o.onOpenChange,delete o.onInputValueChange,delete o.onValueChange,o}var $O,bt,uu,HO,cu,tv,Ll,Dl,nv,rv,iv,BO,Ym,Xm,li,ga,Zm,Jm,bo,UO,ua,du,GO,WO,KO,zO,Et,si,jO,YO,ZO,lv=ee(()=>{"use strict";vl();bl();ii();Or();on();ai();Kt();xr();Nl();ca();da();yn();$e();Ve();be();oe();$O=z("combobox").parts("root","clearTrigger","content","control","input","item","itemGroup","itemGroupLabel","itemIndicator","itemText","label","list","positioner","trigger"),bt=$O.build(),uu=e=>new Sn(e);uu.empty=()=>new Sn({items:[]});HO=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`combobox:${e.id}`},cu=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`combobox:${e.id}:label`},tv=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`combobox:${e.id}:control`},Ll=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`combobox:${e.id}:input`},Dl=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`combobox:${e.id}:content`},nv=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`combobox:${e.id}:popper`},rv=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`combobox:${e.id}:toggle-btn`},iv=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.clearTrigger)!=null?n:`combobox:${e.id}:clear-btn`},BO=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemGroup)==null?void 0:r.call(n,t))!=null?i:`combobox:${e.id}:optgroup:${t}`},Ym=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemGroupLabel)==null?void 0:r.call(n,t))!=null?i:`combobox:${e.id}:optgroup-label:${t}`},Xm=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.item)==null?void 0:r.call(n,t))!=null?i:`combobox:${e.id}:option:${t}`},li=e=>e.getById(Dl(e)),ga=e=>e.getById(Ll(e)),Zm=e=>e.getById(nv(e)),Jm=e=>e.getById(tv(e)),bo=e=>e.getById(rv(e)),UO=e=>e.getById(iv(e)),ua=(e,t)=>{if(t==null)return null;let n=`[role=option][data-value="${CSS.escape(t)}"]`;return fr(li(e),n)},du=e=>{let t=ga(e);e.isActiveElement(t)||t==null||t.focus({preventScroll:!0}),_i(t)},GO=e=>{let t=bo(e);e.isActiveElement(t)||t==null||t.focus({preventScroll:!0})};({guards:WO,createMachine:KO,choose:zO}=Mt()),{and:Et,not:si}=WO,jO=KO({props({props:e}){return y(h({loopFocus:!0,openOnClick:!1,defaultValue:[],defaultInputValue:"",closeOnSelect:!e.multiple,allowCustomValue:!1,alwaysSubmitOnEnter:!1,inputBehavior:"none",selectionBehavior:e.multiple?"clear":"replace",openOnKeyPress:!0,openOnChange:!0,composite:!0,navigate({node:t}){Gi(t)},collection:uu.empty()},e),{positioning:h({placement:"bottom",sameWidth:!0},e.positioning),translations:h({triggerLabel:"Toggle suggestions",clearTriggerLabel:"Clear value"},e.translations)})},initialState({prop:e}){return e("open")||e("defaultOpen")?"open.suggesting":"closed.idle"},context({prop:e,bindable:t,getContext:n,getEvent:r}){var o,s;let i=(s=(o=e("value"))!=null?o:e("defaultValue"))!=null?s:[],a=e("collection").findMany(i);return{currentPlacement:t(()=>({defaultValue:void 0})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:Ce,hash(l){return l.join(",")},onChange(l){var m,S;let c=n(),d=e("collection"),g=c.get("selectedItemMap"),p=kt({values:l,collection:d,selectedItemMap:g}),u=(m=e("value"))!=null?m:l,f=u===l?p:kt({values:u,collection:d,selectedItemMap:p.nextSelectedItemMap});c.set("selectedItemMap",f.nextSelectedItemMap),(S=e("onValueChange"))==null||S({value:l,items:p.selectedItems})}})),highlightedValue:t(()=>({defaultValue:e("defaultHighlightedValue")||null,value:e("highlightedValue"),onChange(l){var d;let c=e("collection").find(l);(d=e("onHighlightChange"))==null||d({highlightedValue:l,highlightedItem:c})}})),inputValue:t(()=>{let l=e("inputValue")||e("defaultInputValue"),c=e("value")||e("defaultValue");if(!l.trim()&&!e("multiple")){let d=e("collection").stringifyMany(c);l=He(e("selectionBehavior"),{preserve:l||d,replace:d,clear:""})}return{defaultValue:l,value:e("inputValue"),onChange(d){var u;let g=r(),p=(g.previousEvent||g).src;(u=e("onInputValueChange"))==null||u({inputValue:d,reason:p})}}}),highlightedItem:t(()=>{let l=e("highlightedValue");return{defaultValue:e("collection").find(l)}}),selectedItemMap:t(()=>({defaultValue:la({selectedItems:a,collection:e("collection")})}))}},computed:{isInputValueEmpty:({context:e})=>e.get("inputValue").length===0,isInteractive:({prop:e})=>!(e("readOnly")||e("disabled")),autoComplete:({prop:e})=>e("inputBehavior")==="autocomplete",autoHighlight:({prop:e})=>e("inputBehavior")==="autohighlight",hasSelectedItems:({context:e})=>e.get("value").length>0,selectedItems:({context:e,prop:t})=>oi({values:e.get("value"),collection:t("collection"),selectedItemMap:e.get("selectedItemMap")}),valueAsString:({computed:e,prop:t})=>t("collection").stringifyItems(e("selectedItems")),isCustomValue:({context:e,computed:t})=>e.get("inputValue")!==t("valueAsString")},watch({context:e,prop:t,track:n,action:r,send:i}){n([()=>e.hash("value")],()=>{r(["syncSelectedItems"])}),n([()=>e.get("inputValue")],()=>{r(["syncInputValue"])}),n([()=>e.get("highlightedValue")],()=>{r(["syncHighlightedItem","autofillInputValue","announceHighlightedItem"])}),n([()=>t("open")],()=>{r(["toggleVisibility"])}),n([()=>t("collection").toString()],()=>{i({type:"CHILDREN_CHANGE"})})},on:{"SELECTED_ITEMS.SYNC":{actions:["syncSelectedItems"]},"HIGHLIGHTED_VALUE.SET":{actions:["setHighlightedValue"]},"HIGHLIGHTED_VALUE.CLEAR":{actions:["clearHighlightedValue"]},"ITEM.SELECT":{actions:["selectItem"]},"ITEM.CLEAR":{actions:["clearItem"]},"VALUE.SET":{actions:["setValue"]},"INPUT_VALUE.SET":{actions:["setInputValue"]},"POSITIONING.SET":{actions:["reposition"]}},entry:zO([{guard:"autoFocus",actions:["setInitialFocus"]}]),states:{closed:{tags:["closed"],initial:"idle",states:{idle:{tags:["idle"],entry:["scrollContentToTop","clearHighlightedValue"],on:{"CONTROLLED.OPEN":{target:"open.interacting"},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]},{target:"open.interacting",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]}],"INPUT.CLICK":[{guard:"isOpenControlled",actions:["highlightFirstSelectedItem","invokeOnOpen"]},{target:"open.interacting",actions:["highlightFirstSelectedItem","invokeOnOpen"]}],"INPUT.FOCUS":{target:"focused"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open.interacting",actions:["invokeOnOpen"]}],"VALUE.CLEAR":{target:"focused",actions:["clearInputValue","clearSelectedItems","setInitialFocus"]}}},focused:{tags:["focused"],entry:["scrollContentToTop","clearHighlightedValue"],on:{"CONTROLLED.OPEN":[{guard:"isChangeEvent",target:"open.suggesting"},{target:"open.interacting"}],"INPUT.CHANGE":[{guard:Et("isOpenControlled","openOnChange"),actions:["setInputValue","invokeOnOpen","highlightFirstItemIfNeeded"]},{guard:"openOnChange",target:"open.suggesting",actions:["setInputValue","invokeOnOpen","highlightFirstItemIfNeeded"]},{actions:["setInputValue"]}],"LAYER.INTERACT_OUTSIDE":{target:"idle"},"INPUT.ESCAPE":{guard:Et("isCustomValue",si("allowCustomValue")),actions:["revertInputValue"]},"INPUT.BLUR":{target:"idle"},"INPUT.CLICK":[{guard:"isOpenControlled",actions:["highlightFirstSelectedItem","invokeOnOpen"]},{target:"open.interacting",actions:["highlightFirstSelectedItem","invokeOnOpen"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]},{target:"open.interacting",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]}],"INPUT.ARROW_DOWN":[{guard:Et("isOpenControlled","autoComplete"),actions:["invokeOnOpen"]},{guard:"autoComplete",target:"open.interacting",actions:["invokeOnOpen"]},{guard:"isOpenControlled",actions:["highlightFirstOrSelectedItem","invokeOnOpen"]},{target:"open.interacting",actions:["highlightFirstOrSelectedItem","invokeOnOpen"]}],"INPUT.ARROW_UP":[{guard:Et("isOpenControlled","autoComplete"),actions:["invokeOnOpen"]},{guard:"autoComplete",target:"open.interacting",actions:["invokeOnOpen"]},{guard:"isOpenControlled",actions:["highlightLastOrSelectedItem","invokeOnOpen"]},{target:"open.interacting",actions:["highlightLastOrSelectedItem","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open.interacting",actions:["invokeOnOpen"]}],"VALUE.CLEAR":{actions:["clearInputValue","clearSelectedItems"]}}}}},open:{tags:["open","focused"],entry:["setInitialFocus"],effects:["trackFocusVisible","scrollToHighlightedItem","trackDismissableLayer","trackPlacement","trackLiveRegion"],on:{"CONTROLLED.CLOSE":[{guard:"restoreFocus",target:"closed.focused",actions:["setFinalFocus"]},{target:"closed.idle"}],"INPUT.ENTER":[{guard:Et("isOpenControlled","isCustomValue",si("hasHighlightedItem"),si("allowCustomValue")),actions:["revertInputValue","invokeOnClose"]},{guard:Et("isCustomValue",si("hasHighlightedItem"),si("allowCustomValue")),target:"closed.focused",actions:["revertInputValue","invokeOnClose"]},{guard:Et("isOpenControlled","closeOnSelect"),actions:["selectHighlightedItem","invokeOnClose"]},{guard:"closeOnSelect",target:"closed.focused",actions:["selectHighlightedItem","invokeOnClose","setFinalFocus"]},{actions:["selectHighlightedItem"]}],"ITEM.CLICK":[{guard:Et("isOpenControlled","closeOnSelect"),actions:["selectItem","invokeOnClose"]},{guard:"closeOnSelect",target:"closed.focused",actions:["selectItem","invokeOnClose","setFinalFocus"]},{actions:["selectItem"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed.focused",actions:["invokeOnClose"]}],"LAYER.INTERACT_OUTSIDE":[{guard:Et("isOpenControlled","isCustomValue",si("allowCustomValue")),actions:["revertInputValue","invokeOnClose"]},{guard:Et("isCustomValue",si("allowCustomValue")),target:"closed.idle",actions:["revertInputValue","invokeOnClose"]},{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed.idle",actions:["invokeOnClose"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed.focused",actions:["invokeOnClose","setFinalFocus"]}],"VALUE.CLEAR":[{guard:"isOpenControlled",actions:["clearInputValue","clearSelectedItems","invokeOnClose"]},{target:"closed.focused",actions:["clearInputValue","clearSelectedItems","invokeOnClose","setFinalFocus"]}]},initial:"interacting",states:{interacting:{on:{CHILDREN_CHANGE:[{guard:"isHighlightedItemRemoved",actions:["clearHighlightedValue"]},{actions:["scrollToHighlightedItem"]}],"INPUT.HOME":{actions:["highlightFirstItem"]},"INPUT.END":{actions:["highlightLastItem"]},"INPUT.ARROW_DOWN":[{guard:Et("autoComplete","isLastItemHighlighted"),actions:["clearHighlightedValue","scrollContentToTop"]},{actions:["highlightNextItem"]}],"INPUT.ARROW_UP":[{guard:Et("autoComplete","isFirstItemHighlighted"),actions:["clearHighlightedValue"]},{actions:["highlightPrevItem"]}],"INPUT.CHANGE":[{guard:"autoComplete",target:"suggesting",actions:["setInputValue"]},{target:"suggesting",actions:["clearHighlightedValue","setInputValue"]}],"ITEM.POINTER_MOVE":{actions:["setHighlightedValue"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedValue"]},"LAYER.ESCAPE":[{guard:Et("isOpenControlled","autoComplete"),actions:["syncInputValue","invokeOnClose"]},{guard:"autoComplete",target:"closed.focused",actions:["syncInputValue","invokeOnClose"]},{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed.focused",actions:["invokeOnClose","setFinalFocus"]}]}},suggesting:{on:{CHILDREN_CHANGE:[{guard:Et("isHighlightedItemRemoved","hasCollectionItems","autoHighlight"),actions:["clearHighlightedValue","highlightFirstItem"]},{guard:"isHighlightedItemRemoved",actions:["clearHighlightedValue"]},{guard:"autoHighlight",actions:["highlightFirstItem"]}],"INPUT.ARROW_DOWN":{target:"interacting",actions:["highlightNextItem"]},"INPUT.ARROW_UP":{target:"interacting",actions:["highlightPrevItem"]},"INPUT.HOME":{target:"interacting",actions:["highlightFirstItem"]},"INPUT.END":{target:"interacting",actions:["highlightLastItem"]},"INPUT.CHANGE":{actions:["setInputValue"]},"LAYER.ESCAPE":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed.focused",actions:["invokeOnClose"]}],"ITEM.POINTER_MOVE":{target:"interacting",actions:["setHighlightedValue"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedValue"]}}}}}},implementations:{guards:{isInputValueEmpty:({computed:e})=>e("isInputValueEmpty"),autoComplete:({computed:e,prop:t})=>e("autoComplete")&&!t("multiple"),autoHighlight:({computed:e})=>e("autoHighlight"),isFirstItemHighlighted:({prop:e,context:t})=>e("collection").firstValue===t.get("highlightedValue"),isLastItemHighlighted:({prop:e,context:t})=>e("collection").lastValue===t.get("highlightedValue"),isCustomValue:({computed:e})=>e("isCustomValue"),allowCustomValue:({prop:e})=>!!e("allowCustomValue"),hasHighlightedItem:({context:e})=>e.get("highlightedValue")!=null,closeOnSelect:({prop:e})=>!!e("closeOnSelect"),isOpenControlled:({prop:e})=>e("open")!=null,openOnChange:({prop:e,context:t})=>{let n=e("openOnChange");return zp(n)?n:!!(n!=null&&n({inputValue:t.get("inputValue")}))},restoreFocus:({event:e})=>{var n,r;let t=(r=e.restoreFocus)!=null?r:(n=e.previousEvent)==null?void 0:n.restoreFocus;return t==null?!0:!!t},isChangeEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="INPUT.CHANGE"},autoFocus:({prop:e})=>!!e("autoFocus"),isHighlightedItemRemoved:({prop:e,context:t})=>!e("collection").has(t.get("highlightedValue")),hasCollectionItems:({prop:e})=>e("collection").size>0},effects:{trackFocusVisible({scope:e}){var t;return nt({root:(t=e.getRootNode)==null?void 0:t.call(e)})},trackDismissableLayer({send:e,prop:t,scope:n}){return t("disableLayer")?void 0:qt(()=>li(n),{type:"listbox",defer:!0,exclude:()=>[ga(n),bo(n),UO(n)],onFocusOutside:t("onFocusOutside"),onPointerDownOutside:t("onPointerDownOutside"),onInteractOutside:t("onInteractOutside"),onEscapeKeyDown(i){i.preventDefault(),i.stopPropagation(),e({type:"LAYER.ESCAPE",src:"escape-key"})},onDismiss(){e({type:"LAYER.INTERACT_OUTSIDE",src:"interact-outside",restoreFocus:!1})}})},trackLiveRegion({refs:e,scope:t}){let n=Qi({level:"assertive",document:t.getDoc()});return e.set("liveRegion",n),()=>n.destroy()},trackPlacement({context:e,prop:t,scope:n}){let r=()=>Jm(n)||bo(n),i=()=>Zm(n);return e.set("currentPlacement",t("positioning").placement),Xe(r,i,y(h({},t("positioning")),{defer:!0,onComplete(a){e.set("currentPlacement",a.placement)}}))},scrollToHighlightedItem({context:e,prop:t,scope:n}){let r=ga(n),i=[],a=l=>{if(Sr()==="pointer")return;let d=e.get("highlightedValue");if(!d)return;let g=li(n),p=t("scrollToIndexFn");if(p){let m=t("collection").indexOf(d);p({index:m,immediate:l,getElement:()=>ua(n,d)});return}let u=ua(n,d),f=B(()=>{Un(u,{rootEl:g,block:"nearest"})});i.push(f)},o=B(()=>{Ir("virtual"),a(!0)});i.push(o);let s=Ht(r,{attributes:["aria-activedescendant"],callback:()=>a(!1)});return i.push(s),()=>{i.forEach(l=>l())}}},actions:{reposition({context:e,prop:t,scope:n,event:r}){Xe(()=>Jm(n),()=>Zm(n),y(h(h({},t("positioning")),r.options),{defer:!0,listeners:!1,onComplete(o){e.set("currentPlacement",o.placement)}}))},setHighlightedValue({context:e,event:t}){t.value!=null&&e.set("highlightedValue",t.value)},clearHighlightedValue({context:e}){e.set("highlightedValue",null)},selectHighlightedItem(e){var s;let{context:t,prop:n}=e,r=n("collection"),i=t.get("highlightedValue");if(!i||!r.has(i))return;let a=n("multiple")?tn(t.get("value"),i):[i];(s=n("onSelect"))==null||s({value:a,itemValue:i}),t.set("value",a);let o=He(n("selectionBehavior"),{preserve:t.get("inputValue"),replace:r.stringifyMany(a),clear:""});t.set("inputValue",o)},scrollToHighlightedItem({context:e,prop:t,scope:n}){Yr(()=>{let r=e.get("highlightedValue");if(r==null)return;let i=ua(n,r),a=li(n),o=t("scrollToIndexFn");if(o){let s=t("collection").indexOf(r);o({index:s,immediate:!0,getElement:()=>ua(n,r)});return}Un(i,{rootEl:a,block:"nearest"})})},selectItem(e){let{context:t,event:n,flush:r,prop:i}=e;n.value!=null&&r(()=>{var s;let a=i("multiple")?tn(t.get("value"),n.value):[n.value];(s=i("onSelect"))==null||s({value:a,itemValue:n.value}),t.set("value",a);let o=He(i("selectionBehavior"),{preserve:t.get("inputValue"),replace:i("collection").stringifyMany(a),clear:""});t.set("inputValue",o)})},clearItem(e){let{context:t,event:n,flush:r,prop:i}=e;n.value!=null&&r(()=>{let a=Ft(t.get("value"),n.value);t.set("value",a);let o=He(i("selectionBehavior"),{preserve:t.get("inputValue"),replace:i("collection").stringifyMany(a),clear:""});t.set("inputValue",o)})},setInitialFocus({scope:e}){B(()=>{du(e)})},setFinalFocus({scope:e}){B(()=>{let t=bo(e);(t==null?void 0:t.dataset.focusable)==null?du(e):GO(e)})},syncInputValue({context:e,scope:t,event:n}){let r=ga(t);r&&(r.value=e.get("inputValue"),queueMicrotask(()=>{n.current().type!=="INPUT.CHANGE"&&_i(r)}))},setInputValue({context:e,event:t}){e.set("inputValue",t.value)},clearInputValue({context:e}){e.set("inputValue","")},revertInputValue({context:e,prop:t,computed:n}){let r=t("selectionBehavior"),i=He(r,{replace:n("hasSelectedItems")?n("valueAsString"):"",preserve:e.get("inputValue"),clear:""});e.set("inputValue",i)},setValue(e){let{context:t,flush:n,event:r,prop:i}=e;n(()=>{t.set("value",r.value);let a=He(i("selectionBehavior"),{preserve:t.get("inputValue"),replace:i("collection").stringifyMany(r.value),clear:""});t.set("inputValue",a)})},clearSelectedItems(e){let{context:t,flush:n,prop:r}=e;n(()=>{t.set("value",[]);let i=He(r("selectionBehavior"),{preserve:t.get("inputValue"),replace:r("collection").stringifyMany([]),clear:""});t.set("inputValue",i)})},scrollContentToTop({prop:e,scope:t}){let n=e("scrollToIndexFn");if(n){let r=e("collection").firstValue;n({index:0,immediate:!0,getElement:()=>ua(t,r)})}else{let r=li(t);if(!r)return;r.scrollTop=0}},invokeOnOpen({prop:e,event:t,context:n}){var i;let r=Qm(t);(i=e("onOpenChange"))==null||i({open:!0,reason:r,value:n.get("value")})},invokeOnClose({prop:e,event:t,context:n}){var i;let r=Qm(t);(i=e("onOpenChange"))==null||i({open:!1,reason:r,value:n.get("value")})},highlightFirstItem({context:e,prop:t,scope:n}){(li(n)?queueMicrotask:B)(()=>{let i=t("collection").firstValue;i&&e.set("highlightedValue",i)})},highlightFirstItemIfNeeded({computed:e,action:t}){e("autoHighlight")&&t(["highlightFirstItem"])},highlightLastItem({context:e,prop:t,scope:n}){(li(n)?queueMicrotask:B)(()=>{let i=t("collection").lastValue;i&&e.set("highlightedValue",i)})},highlightNextItem({context:e,prop:t}){let n=null,r=e.get("highlightedValue"),i=t("collection");r?(n=i.getNextValue(r),!n&&t("loopFocus")&&(n=i.firstValue)):n=i.firstValue,n&&e.set("highlightedValue",n)},highlightPrevItem({context:e,prop:t}){let n=null,r=e.get("highlightedValue"),i=t("collection");r?(n=i.getPreviousValue(r),!n&&t("loopFocus")&&(n=i.lastValue)):n=i.lastValue,n&&e.set("highlightedValue",n)},highlightFirstSelectedItem({context:e,prop:t}){B(()=>{let[n]=t("collection").sort(e.get("value"));n&&e.set("highlightedValue",n)})},highlightFirstOrSelectedItem({context:e,prop:t,computed:n}){B(()=>{let r=null;n("hasSelectedItems")?r=t("collection").sort(e.get("value"))[0]:r=t("collection").firstValue,r&&e.set("highlightedValue",r)})},highlightLastOrSelectedItem({context:e,prop:t,computed:n}){B(()=>{let r=t("collection"),i=null;n("hasSelectedItems")?i=r.sort(e.get("value"))[0]:i=r.lastValue,i&&e.set("highlightedValue",i)})},autofillInputValue({context:e,computed:t,prop:n,event:r,scope:i}){let a=ga(i),o=n("collection");if(!t("autoComplete")||!a||!r.keypress)return;let s=o.stringify(e.get("highlightedValue"));B(()=>{a.value=s||e.get("inputValue")})},syncSelectedItems(e){queueMicrotask(()=>{let{context:t,prop:n}=e,r=n("collection"),i=t.get("value"),a=t.get("selectedItemMap"),o=kt({values:i,collection:r,selectedItemMap:a});t.set("selectedItemMap",o.nextSelectedItemMap);let s=He(n("selectionBehavior"),{preserve:t.get("inputValue"),replace:r.stringifyMany(i),clear:""});t.set("inputValue",s)})},syncHighlightedItem({context:e,prop:t}){let n=t("collection").find(e.get("highlightedValue"));e.set("highlightedItem",n)},announceHighlightedItem({context:e,prop:t,refs:n}){var o;if(!za())return;let r=e.get("highlightedValue"),i=r?t("collection").stringifyItem(t("collection").find(r)):null;if(!i)return;let a=r?e.get("value").includes(r):!1;(o=n.get("liveRegion"))==null||o.announce(a?`${i}, selected`:i)},toggleVisibility({event:e,send:t,prop:n}){t({type:n("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:e})}}}});YO=class extends X{constructor(t,n,r,i){super(t,n,a=>{let o=a;o.allOptions=r,o.options=r,o.hasGroups=i});Q(this,"options");Q(this,"allOptions");Q(this,"hasGroups");this.allOptions=r,this.options=r,this.hasGroups=i}setAllOptions(t){this.allOptions=t,this.options=t}restoreFilteredOptions(){this.options=this.allOptions}activeItems(){return this.options.length>0?this.options:this.allOptions}getCollection(){let t=this.activeItems();return uu(Rr(t,this.hasGroups))}initMachine(t){let n=()=>this.getCollection();return new Y(jO,y(h({},t),{get collection(){return n()},onOpenChange:r=>{r.open&&r.reason!=="input-change"&&(this.options=this.allOptions),t.onOpenChange&&t.onOpenChange(r)},onInputValueChange:r=>{var i;if(t.onInputValueChange&&t.onInputValueChange(r),this.el.hasAttribute("data-filter")){let a=String((i=r.inputValue)!=null?i:"").toLowerCase(),o=this.allOptions.filter(s=>{var d;let l=String((d=s.label)!=null?d:"").toLowerCase(),c=String(Cn(s)).toLowerCase();return l.includes(a)||c.includes(a)});this.options=o.length>0?o:this.allOptions}else this.options=this.allOptions}}))}initApi(){return this.zagConnect(qO)}getItemValue(t){var r,i;let n=(i=(r=this.api.collection).getItemValue)==null?void 0:i.call(r,t);return n!=null?n:Cn(t)}buildOrderedBlocks(t){var i;let n=[],r=null;for(let a of t){let o=(i=a.group)!=null?i:"";o===""?((r==null?void 0:r.type)!=="default"&&(r={type:"default",items:[]},n.push(r)),r.items.push(a)):(((r==null?void 0:r.type)!=="group"||r.groupId!==o)&&(r={type:"group",groupId:o,items:[]},n.push(r)),r.items.push(a))}return n}renderItems(){let t=this.el.querySelector('[data-scope="combobox"][data-part="list"]');if(!t)return;let n=a=>a.closest('[data-scope="combobox"][data-part="list"]')===t,r=Is(this.el,"combobox");if(!r)return;["empty","item-group","item"].forEach(a=>{Array.from(t.querySelectorAll(`[data-scope="combobox"][data-part="${a}"]:not([data-template])`)).filter(n).forEach(o=>o.remove())});let i=this.activeItems();if(i.length===0){let a=r.querySelector('[data-scope="combobox"][data-part="empty"][data-template]');if(a){let o=a.cloneNode(!0);o.removeAttribute("data-template"),t.appendChild(o)}return}this.hasGroups?this.renderGroupedItems(t,r,i):this.renderFlatItems(t,r,i)}renderGroupedItems(t,n,r){let i=this.buildOrderedBlocks(r);for(let a of i){if(a.type!=="group")continue;let o=n.querySelector(`[data-scope="combobox"][data-part="item-group"][data-id="${CSS.escape(a.groupId)}"][data-template]`);if(!o)continue;let s=o.cloneNode(!0);s.removeAttribute("data-template"),s.querySelectorAll("[data-template]").forEach(c=>c.removeAttribute("data-template"));let l=new Set(a.items.map(c=>this.getItemValue(c)));s.querySelectorAll('[data-scope="combobox"][data-part="item"]').forEach(c=>{var g;let d=(g=c.dataset.value)!=null?g:"";l.has(d)||c.remove()}),t.appendChild(s)}}renderFlatItems(t,n,r){for(let i of r){let a=this.getItemValue(i),o=n.querySelector(`:scope > [data-scope="combobox"][data-part="item"][data-value="${CSS.escape(a)}"][data-template]`);if(!o)continue;let s=o.cloneNode(!0);s.removeAttribute("data-template"),t.appendChild(s)}}applyItemProps(){let t=this.el.querySelector('[data-scope="combobox"][data-part="list"]');if(!t)return;let n=a=>a.closest('[data-scope="combobox"][data-part="list"]')===t;t.querySelectorAll('[data-scope="combobox"][data-part="item-group"]').forEach(a=>{var l;if(!n(a))return;let o=(l=a.dataset.id)!=null?l:"";this.spreadProps(a,this.api.getItemGroupProps({id:o}));let s=a.querySelector('[data-scope="combobox"][data-part="item-group-label"]');s&&this.spreadProps(s,this.api.getItemGroupLabelProps({htmlFor:o}))});let r=this.activeItems(),i=new Map;for(let a of r)i.set(this.getItemValue(a),a);for(let a of this.allOptions){let o=this.getItemValue(a);i.has(o)||i.set(o,a)}t.querySelectorAll('[data-scope="combobox"][data-part="item"]').forEach(a=>{var d;if(!n(a))return;let o=(d=a.dataset.value)!=null?d:"",s=i.get(o);if(!s)return;this.spreadProps(a,this.api.getItemProps({item:s}));let l=a.querySelector('[data-scope="combobox"][data-part="item-text"]');l&&this.spreadProps(l,this.api.getItemTextProps({item:s}));let c=a.querySelector('[data-scope="combobox"][data-part="item-indicator"]');c&&this.spreadProps(c,this.api.getItemIndicatorProps({item:s}))})}hiddenInputValue(){var r,i;let t=((r=this.api.value)!=null?r:[]).map(String);if(t.length===0){let a=this.el.dataset.defaultValue;a&&(t=a.split(",").filter(Boolean))}let n=this.el.hasAttribute("data-multiple");return t.length===0?"":n?t.join(","):(i=t[0])!=null?i:""}render(){let t=this.el.querySelector('[data-scope="combobox"][data-part="root"]');if(!t)return;this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="combobox"][data-part="hidden-input"]');if(n){let r=this.hiddenInputValue();n.value!==r&&(n.value=r),V(this.el,"submitName")&&(n.removeAttribute("name"),n.removeAttribute("form"))}Ji(this.el,"combobox",["hidden-input","input"]),["label","control","input","trigger","clear-trigger","positioner","content","list"].forEach(r=>{let i=this.el.querySelector(`[data-scope="combobox"][data-part="${r}"]`);if(!i)return;let a="get"+r.split("-").map(o=>o[0].toUpperCase()+o.slice(1)).join("")+"Props";this.spreadProps(i,this.api[a]())}),this.renderItems(),this.applyItemProps()}};ZO={mounted(){var f,m;let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=this;r.fieldTouched=!1;let i=()=>{r.fieldTouched=!0},a=(f=e.getAttribute("data-items"))!=null?f:"[]",o=JSON.parse(a),s=o.some(S=>!!S.group);((m=Ie(e,"defaultValue"))!=null?m:[]).length>0&&(r.fieldTouched=!0,queueMicrotask(()=>ev(e)));let c,d=h(h({},ov(e,t,n,this.liveSocket,()=>c,i)),hn(e)),g=new YO(e,d,o,s);c=g,g.init(),this.combobox=g,this.lastItemsJson=a;let p=ie(e);this.domRegistry=p,p.add("corex:combobox:set-value",S=>{g.api.setValue(S.detail.value)});let u=re(this);this.handleRegistry=u,u.add("combobox_set_value",S=>{$(e.id,H(S))&&g.api.setValue(S.value)})},updated(){var i;if(!this.combobox)return;let e=qn(this.el),t=(i=this.el.getAttribute("data-items"))!=null?i:"[]";if(t!==this.lastItemsJson){this.lastItemsJson=t;let a=JSON.parse(t),o=a.some(s=>!!s.group);this.combobox.hasGroups=o,this.combobox.setAllOptions(a)}let n=this.pushEvent.bind(this),r=()=>j(this.liveSocket);if(this.combobox.updateProps(h(h({},XO(this.el,n,r,this.liveSocket,()=>this.combobox,()=>{this.fieldTouched=!0})),e)),this.combobox.api.open&&this.combobox.api.reposition(),"value"in e){gu(this.el,e.value,void 0),ev(this.el);let a=pu(e.value.map(o=>({value:o,label:o})));Fl(this.el,a)}},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.combobox)==null||n.destroy()}}});var Ov={};pe(Ov,{ColorPicker:()=>zV,readValueProps:()=>KV});function cv(e,t){let{xChannel:n,yChannel:r,dir:i="ltr"}=t,{zChannel:a}=e.getColorAxes({xChannel:n,yChannel:r}),o=e.getChannelValue(a),{minValue:s,maxValue:l}=e.getChannelRange(a),c=["top",i==="rtl"?"left":"right"],d=!1,g={areaStyles:{},areaGradientStyles:{}},p=(o-s)/(l-s),u=e.getFormat()==="hsla";switch(a){case"red":{d=n==="green",g=tV(c,d,o);break}case"green":{d=n==="red",g=nV(c,d,o);break}case"blue":{d=n==="red",g=rV(c,d,o);break}case"hue":{d=n!=="saturation",u?g=iV(c,d,o):g=sV(c,d,o);break}case"saturation":{d=n==="hue",u?g=aV(c,d,p):g=lV(c,d,p);break}case"brightness":{d=n==="hue",g=cV(c,d,p);break}case"lightness":{d=n==="hue",g=oV(c,d,o);break}}return g}function xV(e,t){switch(t){case"hue":return kr(`hsl(${e.getChannelValue("hue")}, 100%, 50%)`);case"lightness":case"brightness":case"saturation":case"red":case"green":case"blue":return e.withChannelValue("alpha",1);case"alpha":return e;default:throw new Error("Unknown color channel: "+t)}}function bu(e,t){if(t==null)return"";if(t==="hex")return e.toString("hex");if(t==="css")return e.toString("css");if(t in e)return e.getChannelValue(t).toString();let n=e.getFormat()==="hsla";switch(t){case"hue":return n?e.toFormat("hsla").getChannelValue("hue").toString():e.toFormat("hsba").getChannelValue("hue").toString();case"saturation":return n?e.toFormat("hsla").getChannelValue("saturation").toString():e.toFormat("hsba").getChannelValue("saturation").toString();case"lightness":return e.toFormat("hsla").getChannelValue("lightness").toString();case"brightness":return e.toFormat("hsba").getChannelValue("brightness").toString();case"red":case"green":case"blue":return e.toFormat("rgba").getChannelValue(t).toString();default:return e.getChannelValue(t).toString()}}function RV(e,t){switch(t){case"hex":let n=kr("#000000"),r=kr("#FFFFFF");return{minValue:n.toHexInt(),maxValue:r.toHexInt(),pageSize:10,step:1};case"css":return;case"hue":case"saturation":case"lightness":return e.toFormat("hsla").getChannelRange(t);case"brightness":return e.toFormat("hsba").getChannelRange(t);case"red":case"green":case"blue":return e.toFormat("rgba").getChannelRange(t);default:return e.getChannelRange(t)}}function kV(e,t){return e==="vertical"?"top":t==="ltr"?"right":"left"}function LV(e,t){let{context:n,send:r,prop:i,computed:a,state:o,scope:s}=e,l=n.get("value"),c=n.get("format"),d=a("areaValue"),g=a("valueAsString"),p=a("disabled"),u=!!i("readOnly"),f=!!i("invalid"),m=!!i("required"),S=a("interactive"),T=o.hasTag("dragging"),w=o.hasTag("open"),I=o.hasTag("focused"),P=x=>{var A,N;let C=d.getChannels();return{xChannel:(A=x.xChannel)!=null?A:C[1],yChannel:(N=x.yChannel)!=null?N:C[2]}},v=n.get("currentPlacement"),E=Gt(y(h({},i("positioning")),{placement:v}));function R(x){let C=uv(x.value).toFormat(n.get("format"));return{value:C,valueAsString:C.toString("hex"),checked:C.isEqual(l),disabled:x.disabled||!S}}return{dragging:T,open:w,valueAsString:g,value:l,inline:!!i("inline"),setOpen(x){i("inline")||o.hasTag("open")===x||r({type:x?"OPEN":"CLOSE"})},setValue(x){r({type:"VALUE.SET",value:uv(x),src:"set-color"})},getChannelValue(x){return bu(l,x)},getChannelValueText(x,C){return l.formatChannelValue(x,C)},setChannelValue(x,C){let A=l.withChannelValue(x,C);r({type:"VALUE.SET",value:A,src:"set-channel"})},format:n.get("format"),setFormat(x){let C=l.toFormat(x);r({type:"VALUE.SET",value:C,src:"set-format"})},alpha:l.getChannelValue("alpha"),setAlpha(x){let C=l.withChannelValue("alpha",x);r({type:"VALUE.SET",value:C,src:"set-alpha"})},getRootProps(){return t.element(y(h({},Ne.root.attrs),{dir:i("dir"),id:yV(s),"data-disabled":b(p),"data-readonly":b(u),"data-invalid":b(f),style:{"--value":l.toString("css")}}))},getLabelProps(){return t.element(y(h({},Ne.label.attrs),{dir:i("dir"),id:gv(s),htmlFor:mu(s),"data-disabled":b(p),"data-readonly":b(u),"data-invalid":b(f),"data-required":b(m),"data-focus":b(I),onClick(x){x.preventDefault();let C=fr(wv(s),"[data-channel=hex]");C==null||C.focus({preventScroll:!0})}}))},getControlProps(){return t.element(y(h({},Ne.control.attrs),{id:Ev(s),dir:i("dir"),"data-disabled":b(p),"data-readonly":b(u),"data-invalid":b(f),"data-state":w?"open":"closed","data-focus":b(I)}))},getTriggerProps(){return t.button(y(h({},Ne.trigger.attrs),{id:Pv(s),dir:i("dir"),disabled:p,"aria-label":`select color. current color is ${g}`,"aria-controls":vu(s),"aria-labelledby":gv(s),"aria-haspopup":i("inline")?void 0:"dialog","data-disabled":b(p),"data-readonly":b(u),"data-invalid":b(f),"data-placement":v,"aria-expanded":w,"data-state":w?"open":"closed","data-focus":b(I),type:"button",onClick(){S&&r({type:"TRIGGER.CLICK"})},onBlur(){S&&r({type:"TRIGGER.BLUR"})},style:{position:"relative"}}))},getPositionerProps(){return t.element(y(h({},Ne.positioner.attrs),{id:Sv(s),dir:i("dir"),style:E.floating}))},getContentProps(){return t.element(y(h({},Ne.content.attrs),{id:vu(s),dir:i("dir"),role:i("inline")?void 0:"dialog",tabIndex:-1,"data-placement":v,"data-state":w?"open":"closed",hidden:!w}))},getValueTextProps(){return t.element(y(h({},Ne.valueText.attrs),{dir:i("dir"),"data-disabled":b(p),"data-focus":b(I)}))},getAreaProps(x={}){let{xChannel:C,yChannel:A}=P(x),{areaStyles:N}=cv(d,{xChannel:C,yChannel:A,dir:i("dir")});return t.element(y(h({},Ne.area.attrs),{id:Iv(s),role:"group","data-invalid":b(f),"data-disabled":b(p),"data-readonly":b(u),onPointerDown(k){if(!S||!fe(k)||Be(k))return;let L=et(k);r({type:"AREA.POINTER_DOWN",point:L,channel:{xChannel:C,yChannel:A},id:"area"}),k.preventDefault()},style:h({position:"relative",touchAction:"none",forcedColorAdjust:"none"},N)}))},getAreaBackgroundProps(x={}){let{xChannel:C,yChannel:A}=P(x),{areaGradientStyles:N}=cv(d,{xChannel:C,yChannel:A,dir:i("dir")});return t.element(y(h({},Ne.areaBackground.attrs),{id:EV(s),"data-invalid":b(f),"data-disabled":b(p),"data-readonly":b(u),style:h({position:"relative",touchAction:"none",forcedColorAdjust:"none"},N)}))},getAreaThumbProps(x={}){let{xChannel:C,yChannel:A}=P(x),N={xChannel:C,yChannel:A},k=d.getChannelValuePercent(C),L=1-d.getChannelValuePercent(A),J=i("dir")==="rtl"?1-k:k,ue=d.getChannelValue(C),Z=d.getChannelValue(A),ce=d.withChannelValue("alpha",1).toString("css");return t.element(y(h({},Ne.areaThumb.attrs),{id:Tv(s),dir:i("dir"),tabIndex:p?void 0:0,"data-disabled":b(p),"data-invalid":b(f),"data-readonly":b(u),role:"slider","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":ue,"aria-label":`${C} and ${A}`,"aria-roledescription":"2d slider","aria-valuetext":`${C} ${ue}, ${A} ${Z}`,style:{position:"absolute",left:`${J*100}%`,top:`${L*100}%`,transform:"translate(-50%, -50%)",touchAction:"none",forcedColorAdjust:"none","--color":ce,background:ce},onFocus(){S&&r({type:"AREA.FOCUS",id:"area",channel:N})},onKeyDown(ve){if(ve.defaultPrevented||!S)return;let le=Hn(ve),Fe={ArrowUp(){r({type:"AREA.ARROW_UP",channel:N,step:le})},ArrowDown(){r({type:"AREA.ARROW_DOWN",channel:N,step:le})},ArrowLeft(){r({type:"AREA.ARROW_LEFT",channel:N,step:le})},ArrowRight(){r({type:"AREA.ARROW_RIGHT",channel:N,step:le})},PageUp(){r({type:"AREA.PAGE_UP",channel:N,step:le})},PageDown(){r({type:"AREA.PAGE_DOWN",channel:N,step:le})},Escape(Qt){Qt.stopPropagation()}}[me(ve,{dir:i("dir")})];Fe&&(Fe(ve),ve.preventDefault())}}))},getTransparencyGridProps(x={}){let{size:C="12px"}=x;return t.element(y(h({},Ne.transparencyGrid.attrs),{style:{"--size":C,width:"100%",height:"100%",position:"absolute",backgroundColor:"#fff",backgroundImage:"conic-gradient(#eeeeee 0 25%, transparent 0 50%, #eeeeee 0 75%, transparent 0)",backgroundSize:"var(--size) var(--size)",inset:"0px",zIndex:"auto",pointerEvents:"none"}}))},getChannelSliderProps(x){let{orientation:C="horizontal",channel:A,format:N}=x;return t.element(y(h({},Ne.channelSlider.attrs),{"data-channel":A,"data-orientation":C,role:"presentation",onPointerDown(k){if(!S||!fe(k)||Be(k))return;let L=et(k);r({type:"CHANNEL_SLIDER.POINTER_DOWN",channel:A,format:N,point:L,id:A,orientation:C}),k.preventDefault()},style:{position:"relative",touchAction:"none"}}))},getChannelSliderTrackProps(x){let{orientation:C="horizontal",channel:A,format:N}=x,k=N?l.toFormat(N):d;return t.element(y(h({},Ne.channelSliderTrack.attrs),{id:Cv(s,A),role:"group","data-channel":A,"data-orientation":C,style:{position:"relative",forcedColorAdjust:"none",backgroundImage:NV({orientation:C,channel:A,dir:i("dir"),value:k})}}))},getChannelSliderLabelProps(x){let{channel:C}=x;return t.element(y(h({},Ne.channelSliderLabel.attrs),{"data-channel":C,onClick(A){var k;if(!S)return;A.preventDefault();let N=yu(s,C);(k=s.getById(N))==null||k.focus({preventScroll:!0})},style:{userSelect:"none",WebkitUserSelect:"none"}}))},getChannelSliderValueTextProps(x){return t.element(y(h({},Ne.channelSliderValueText.attrs),{"data-channel":x.channel}))},getChannelSliderThumbProps(x){let{orientation:C="horizontal",channel:A,format:N}=x,k=N?l.toFormat(N):d,L=k.getChannelRange(A),K=k.getChannelValue(A),J=(K-L.minValue)/(L.maxValue-L.minValue),ue=i("dir")==="rtl",Z=C==="horizontal"&&ue?1-J:J,ce=C==="horizontal"?{left:`${Z*100}%`,top:"50%"}:{top:`${J*100}%`,left:"50%"};return t.element(y(h({},Ne.channelSliderThumb.attrs),{id:yu(s,A),role:"slider","aria-label":A,tabIndex:p?void 0:0,"data-channel":A,"data-disabled":b(p),"data-orientation":C,"aria-disabled":b(p),"aria-orientation":C,"aria-valuemax":L.maxValue,"aria-valuemin":L.minValue,"aria-valuenow":K,"aria-valuetext":`${A} ${K}`,style:h({forcedColorAdjust:"none",position:"absolute",background:xV(d,A).toString("css")},ce),onFocus(){S&&r({type:"CHANNEL_SLIDER.FOCUS",channel:A})},onKeyDown(ve){if(ve.defaultPrevented||!S)return;let le=Hn(ve)*L.step,Fe={ArrowUp(){r({type:"CHANNEL_SLIDER.ARROW_UP",channel:A,step:le})},ArrowDown(){r({type:"CHANNEL_SLIDER.ARROW_DOWN",channel:A,step:le})},ArrowLeft(){r({type:"CHANNEL_SLIDER.ARROW_LEFT",channel:A,step:le})},ArrowRight(){r({type:"CHANNEL_SLIDER.ARROW_RIGHT",channel:A,step:le})},PageUp(){r({type:"CHANNEL_SLIDER.PAGE_UP",channel:A})},PageDown(){r({type:"CHANNEL_SLIDER.PAGE_DOWN",channel:A})},Home(){r({type:"CHANNEL_SLIDER.HOME",channel:A})},End(){r({type:"CHANNEL_SLIDER.END",channel:A})},Escape(Qt){Qt.stopPropagation()}}[me(ve,{dir:i("dir")})];Fe&&(Fe(ve),ve.preventDefault())}}))},getChannelInputProps(x){let{channel:C}=x,A=C==="hex"||C==="css",N=RV(l,C);return t.input(y(h({},Ne.channelInput.attrs),{dir:i("dir"),type:A?"text":"number","data-channel":C,"aria-label":C,spellCheck:!1,autoComplete:"off",disabled:p,"data-disabled":b(p),"data-invalid":b(f),"data-readonly":b(u),readOnly:u,defaultValue:bu(l,C),min:N==null?void 0:N.minValue,max:N==null?void 0:N.maxValue,step:N==null?void 0:N.step,onBeforeInput(k){if(A||!S)return;k.currentTarget.value.match(/[^0-9.]/g)&&k.preventDefault()},onFocus(k){S&&(r({type:"CHANNEL_INPUT.FOCUS",channel:C}),k.currentTarget.select())},onBlur(k){if(!S)return;let L=A?k.currentTarget.value:k.currentTarget.valueAsNumber;r({type:"CHANNEL_INPUT.BLUR",channel:C,value:L,isTextField:A})},onKeyDown(k){if(!k.defaultPrevented&&S&&k.key==="Enter"){let L=A?k.currentTarget.value:k.currentTarget.valueAsNumber;r({type:"CHANNEL_INPUT.CHANGE",channel:C,value:L,isTextField:A}),k.preventDefault()}},style:{appearance:"none",WebkitAppearance:"none",MozAppearance:"textfield"}}))},getHiddenInputProps(){return t.input({type:"text",disabled:p,name:i("name"),tabIndex:-1,readOnly:u,required:m,id:mu(s),style:mt,defaultValue:g})},getEyeDropperTriggerProps(){return t.button(y(h({},Ne.eyeDropperTrigger.attrs),{type:"button",dir:i("dir"),disabled:p,"data-disabled":b(p),"data-invalid":b(f),"data-readonly":b(u),"aria-label":"Pick a color from the screen",onClick(){S&&r({type:"EYEDROPPER.CLICK"})}}))},getSwatchGroupProps(){return t.element(y(h({},Ne.swatchGroup.attrs),{role:"group"}))},getSwatchTriggerState:R,getSwatchTriggerProps(x){let C=R(x);return t.button(y(h({},Ne.swatchTrigger.attrs),{disabled:C.disabled,dir:i("dir"),type:"button","aria-label":`select ${C.valueAsString} as the color`,"data-state":C.checked?"checked":"unchecked","data-value":C.valueAsString,"data-disabled":b(C.disabled),onClick(){C.disabled||r({type:"SWATCH_TRIGGER.CLICK",value:C.value})},style:{"--color":C.valueAsString,position:"relative"}}))},getSwatchIndicatorProps(x){let C=R(x);return t.element(y(h({},Ne.swatchIndicator.attrs),{dir:i("dir"),hidden:!C.checked}))},getSwatchProps(x){let{respectAlpha:C=!0}=x,A=R(x),N=A.value.toString(C?"css":"hex");return t.element(y(h({},Ne.swatch.attrs),{dir:i("dir"),"data-state":A.checked?"checked":"unchecked","data-value":A.valueAsString,style:{"--color":N,position:"relative",background:N}}))},getFormatTriggerProps(){return t.button(y(h({},Ne.formatTrigger.attrs),{dir:i("dir"),type:"button","aria-label":`change color format to ${hv(c)}`,onClick(x){if(x.currentTarget.disabled)return;let C=hv(c);r({type:"FORMAT.SET",format:C,src:"format-trigger"})}}))},getFormatSelectProps(){return t.select(y(h({},Ne.formatSelect.attrs),{"aria-label":"change color format",dir:i("dir"),defaultValue:i("format"),disabled:p,onChange(x){let C=FV(x.currentTarget.value);r({type:"FORMAT.SET",format:C,src:"format-select"})}}))}}}function hv(e){var n;let t=Bl.indexOf(e);return(n=Bl[t+1])!=null?n:Bl[0]}function FV(e){if(DV.test(e))return e;throw new Error(`Unsupported color format: ${e}`)}function _V(e){return MV.test(e)}function $V(e){return e.startsWith("#")?e:_V(e)?`#${e}`:e}function mv(e,t,n){let r=AV(e);B(()=>{r.forEach(i=>{let a=i.dataset.channel;_e(i,bu(n||t,a))})})}function GV(e,t){let n=IV(e);n&&B(()=>_e(n,t))}function WV(e){let t=io(e,"value","defaultValue");return"value"in t&&t.value?{value:pa(t.value)}:"defaultValue"in t&&t.defaultValue?{defaultValue:pa(t.defaultValue)}:{}}function fu(e,t){if(t===void 0)return;let n=e.querySelector('[data-scope="color-picker"][data-part="hidden-input"]');n&&(n.value=t,n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0})))}function KV(e){let t=V(e,"defaultValue");return{defaultValue:t?pa(t):void 0}}var JO,Ne,QO,eV,ot,tV,nV,rV,iV,aV,oV,sV,lV,cV,dV,Eu,uV,gV,pV,vv,Pu,hV,yv,Su,fV,bv,Iu,mV,vV,dv,kr,uv,yV,gv,mu,Ev,Pv,vu,Sv,bV,Iv,EV,Tv,Cv,yu,Hl,PV,SV,IV,pv,TV,CV,wv,hu,wV,OV,VV,AV,NV,Bl,DV,pa,MV,HV,BV,fv,UV,qV,zV,Vv=ee(()=>{"use strict";so();Bt();ii();Or();on();xr();$e();be();oe();JO=z("color-picker",["root","label","control","trigger","positioner","content","area","areaThumb","valueText","areaBackground","channelSlider","channelSliderLabel","channelSliderTrack","channelSliderThumb","channelSliderValueText","channelInput","transparencyGrid","swatchGroup","swatchTrigger","swatchIndicator","swatch","eyeDropperTrigger","formatTrigger","formatSelect"]),Ne=JO.build(),QO=Object.defineProperty,eV=(e,t,n)=>t in e?QO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ot=(e,t,n)=>eV(e,typeof t!="symbol"?t+"":t,n),tV=(e,t,n)=>{let r=`linear-gradient(to ${e[+!t]}, transparent, #000)`;return{areaStyles:{backgroundImage:`linear-gradient(to ${e[Number(t)]},rgb(${n},0,0),rgb(${n},255,0))`},areaGradientStyles:{backgroundImage:`linear-gradient(to ${e[Number(t)]},rgb(${n},0,255),rgb(${n},255,255))`,WebkitMaskImage:r,maskImage:r}}},nV=(e,t,n)=>{let r=`linear-gradient(to ${e[+!t]}, transparent, #000)`;return{areaStyles:{backgroundImage:`linear-gradient(to ${e[Number(t)]},rgb(0,${n},0),rgb(255,${n},0))`},areaGradientStyles:{backgroundImage:`linear-gradient(to ${e[Number(t)]},rgb(0,${n},255),rgb(255,${n},255))`,WebkitMaskImage:r,maskImage:r}}},rV=(e,t,n)=>{let r=`linear-gradient(to ${e[+!t]}, transparent, #000)`;return{areaStyles:{backgroundImage:`linear-gradient(to ${e[Number(t)]},rgb(0,0,${n}),rgb(255,0,${n}))`},areaGradientStyles:{backgroundImage:`linear-gradient(to ${e[Number(t)]},rgb(0,255,${n}),rgb(255,255,${n}))`,WebkitMaskImage:r,maskImage:r}}},iV=(e,t,n)=>({areaStyles:{},areaGradientStyles:{background:[`linear-gradient(to ${e[Number(t)]}, hsla(0,0%,0%,1) 0%, hsla(0,0%,0%,0) 50%, hsla(0,0%,100%,0) 50%, hsla(0,0%,100%,1) 100%)`,`linear-gradient(to ${e[+!t]},hsl(0,0%,50%),hsla(0,0%,50%,0))`,`hsl(${n}, 100%, 50%)`].join(",")}}),aV=(e,t,n)=>({areaStyles:{},areaGradientStyles:{background:[`linear-gradient(to ${e[+!t]}, hsla(0,0%,0%,${n}) 0%, hsla(0,0%,0%,0) 50%, hsla(0,0%,100%,0) 50%, hsla(0,0%,100%,${n}) 100%)`,`linear-gradient(to ${e[Number(t)]},hsla(0,100%,50%,${n}),hsla(60,100%,50%,${n}),hsla(120,100%,50%,${n}),hsla(180,100%,50%,${n}),hsla(240,100%,50%,${n}),hsla(300,100%,50%,${n}),hsla(359,100%,50%,${n}))`,"hsl(0, 0%, 50%)"].join(",")}}),oV=(e,t,n)=>({areaStyles:{},areaGradientStyles:{backgroundImage:[`linear-gradient(to ${e[+!t]},hsl(0,0%,${n}%),hsla(0,0%,${n}%,0))`,`linear-gradient(to ${e[Number(t)]},hsl(0,100%,${n}%),hsl(60,100%,${n}%),hsl(120,100%,${n}%),hsl(180,100%,${n}%),hsl(240,100%,${n}%),hsl(300,100%,${n}%),hsl(360,100%,${n}%))`].join(",")}}),sV=(e,t,n)=>({areaStyles:{},areaGradientStyles:{background:[`linear-gradient(to ${e[Number(t)]},hsl(0,0%,0%),hsla(0,0%,0%,0))`,`linear-gradient(to ${e[+!t]},hsl(0,0%,100%),hsla(0,0%,100%,0))`,`hsl(${n}, 100%, 50%)`].join(",")}}),lV=(e,t,n)=>({areaStyles:{},areaGradientStyles:{background:[`linear-gradient(to ${e[+!t]},hsla(0,0%,0%,${n}),hsla(0,0%,0%,0))`,`linear-gradient(to ${e[Number(t)]},hsla(0,100%,50%,${n}),hsla(60,100%,50%,${n}),hsla(120,100%,50%,${n}),hsla(180,100%,50%,${n}),hsla(240,100%,50%,${n}),hsla(300,100%,50%,${n}),hsla(359,100%,50%,${n}))`,`linear-gradient(to ${e[+!t]},hsl(0,0%,0%),hsl(0,0%,100%))`].join(",")}}),cV=(e,t,n)=>({areaStyles:{},areaGradientStyles:{background:[`linear-gradient(to ${e[+!t]},hsla(0,0%,100%,${n}),hsla(0,0%,100%,0))`,`linear-gradient(to ${e[Number(t)]},hsla(0,100%,50%,${n}),hsla(60,100%,50%,${n}),hsla(120,100%,50%,${n}),hsla(180,100%,50%,${n}),hsla(240,100%,50%,${n}),hsla(300,100%,50%,${n}),hsla(359,100%,50%,${n}))`,"#000"].join(",")}});dV=(e,t)=>{if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0},Eu=class{toHexInt(){return this.toFormat("rgba").toHexInt()}getChannelValue(e){if(e in this)return this[e];throw new Error("Unsupported color channel: "+e)}getChannelValuePercent(e,t){let n=t!=null?t:this.getChannelValue(e),{minValue:r,maxValue:i}=this.getChannelRange(e);return sf(n,r,i)}getChannelPercentValue(e,t){let{minValue:n,maxValue:r,step:i}=this.getChannelRange(e),a=lf(t,n,r,i);return lo(a,n,r,i)}withChannelValue(e,t){let{minValue:n,maxValue:r}=this.getChannelRange(e);if(e in this){let i=this.clone();return i[e]=Ae(t,n,r),i}throw new Error("Unsupported color channel: "+e)}getColorAxes(e){let{xChannel:t,yChannel:n}=e,r=t||this.getChannels().find(o=>o!==n),i=n||this.getChannels().find(o=>o!==r),a=this.getChannels().find(o=>o!==r&&o!==i);return{xChannel:r,yChannel:i,zChannel:a}}incrementChannel(e,t){let{minValue:n,maxValue:r,step:i}=this.getChannelRange(e),a=lo(Ae(this.getChannelValue(e)+t,n,r),n,r,i);return this.withChannelValue(e,a)}decrementChannel(e,t){return this.incrementChannel(e,-t)}isEqual(e){return dV(this.toJSON(),e.toJSON())&&this.getChannelValue("alpha")===e.getChannelValue("alpha")}},uV=/^#[\da-f]+$/i,gV=/^rgba?\((.*)\)$/,pV=/[^#]/gi,vv=class Ml extends Eu{constructor(t,n,r,i){super(),ot(this,"red",t),ot(this,"green",n),ot(this,"blue",r),ot(this,"alpha",i)}static parse(t){var i;let n=[];if(uV.test(t)&&[4,5,7,9].includes(t.length)){let a=(t.length<6?t.replace(pV,"$&$&"):t).slice(1).split("");for(;a.length>0;)n.push(parseInt(a.splice(0,2).join(""),16));n[3]=n[3]!==void 0?n[3]/255:void 0}let r=t.match(gV);return r!=null&&r[1]&&(n=r[1].split(",").map(a=>Number(a.trim())).map((a,o)=>Ae(a,0,o<3?255:1))),n.length<3?void 0:new Ml(n[0],n[1],n[2],(i=n[3])!=null?i:1)}toString(t="css"){switch(t){case"hex":return"#"+(this.red.toString(16).padStart(2,"0")+this.green.toString(16).padStart(2,"0")+this.blue.toString(16).padStart(2,"0")).toUpperCase();case"hexa":return"#"+(this.red.toString(16).padStart(2,"0")+this.green.toString(16).padStart(2,"0")+this.blue.toString(16).padStart(2,"0")+Math.round(this.alpha*255).toString(16).padStart(2,"0")).toUpperCase();case"rgb":return`rgb(${this.red}, ${this.green}, ${this.blue})`;case"css":case"rgba":return`rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;case"hsl":return this.toHSL().toString("hsl");case"hsb":return this.toHSB().toString("hsb");default:return this.toFormat(t).toString(t)}}toFormat(t){switch(t){case"rgba":return this;case"hsba":return this.toHSB();case"hsla":return this.toHSL();default:throw new Error("Unsupported color conversion: rgb -> "+t)}}toHexInt(){return this.red<<16|this.green<<8|this.blue}toHSB(){let t=this.red/255,n=this.green/255,r=this.blue/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=a-i,s=a===0?0:o/a,l=0;if(o!==0){switch(a){case t:l=(n-r)/o+(nNumber(l.trim().replace("%","")));return new _l(wd(i,360),Ae(a,0,100),Ae(o,0,100),Ae(s!=null?s:1,0,1))}}toString(t="css"){switch(t){case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"hsl":return`hsl(${this.hue}, ${xe(this.saturation,2)}%, ${xe(this.lightness,2)}%)`;case"css":case"hsla":return`hsla(${this.hue}, ${xe(this.saturation,2)}%, ${xe(this.lightness,2)}%, ${this.alpha})`;case"hsb":return this.toHSB().toString("hsb");case"rgb":return this.toRGB().toString("rgb");default:return this.toFormat(t).toString(t)}}toFormat(t){switch(t){case"hsla":return this;case"hsba":return this.toHSB();case"rgba":return this.toRGB();default:throw new Error("Unsupported color conversion: hsl -> "+t)}}toHSB(){let t=this.saturation/100,n=this.lightness/100,r=n+t*Math.min(n,1-n);return t=r===0?0:2*(1-n/r),new Iu(xe(this.hue,2),xe(t*100,2),xe(r*100,2),xe(this.alpha,2))}toRGB(){let t=this.hue,n=this.saturation/100,r=this.lightness/100,i=n*Math.min(r,1-r),a=(o,s=(o+t/30)%12)=>r-i*Math.max(Math.min(s-3,9-s,1),-1);return new Pu(Math.round(a(0)*255),Math.round(a(8)*255),Math.round(a(4)*255),xe(this.alpha,2))}clone(){return new _l(this.hue,this.saturation,this.lightness,this.alpha)}getChannelFormatOptions(t){switch(t){case"hue":return{style:"unit",unit:"degree",unitDisplay:"narrow"};case"saturation":case"lightness":case"alpha":return{style:"percent"};default:throw new Error("Unknown color channel: "+t)}}formatChannelValue(t,n){let r=this.getChannelFormatOptions(t),i=this.getChannelValue(t);return(t==="saturation"||t==="lightness")&&(i/=100),new Intl.NumberFormat(n,r).format(i)}getChannelRange(t){switch(t){case"hue":return{minValue:0,maxValue:360,step:1,pageSize:15};case"saturation":case"lightness":return{minValue:0,maxValue:100,step:1,pageSize:10};case"alpha":return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw new Error("Unknown color channel: "+t)}}toJSON(){return{h:this.hue,s:this.saturation,l:this.lightness,a:this.alpha}}getFormat(){return"hsla"}getChannels(){return _l.colorChannels}};ot(yv,"colorChannels",["hue","saturation","lightness"]);Su=yv,fV=/hsb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/,bv=class $l extends Eu{constructor(t,n,r,i){super(),ot(this,"hue",t),ot(this,"saturation",n),ot(this,"brightness",r),ot(this,"alpha",i)}static parse(t){var r;let n;if(n=t.match(fV)){let[i,a,o,s]=((r=n[1])!=null?r:n[2]).split(",").map(l=>Number(l.trim().replace("%","")));return new $l(wd(i,360),Ae(a,0,100),Ae(o,0,100),Ae(s!=null?s:1,0,1))}}toString(t="css"){switch(t){case"css":return this.toHSL().toString("css");case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"hsb":return`hsb(${this.hue}, ${xe(this.saturation,2)}%, ${xe(this.brightness,2)}%)`;case"hsba":return`hsba(${this.hue}, ${xe(this.saturation,2)}%, ${xe(this.brightness,2)}%, ${this.alpha})`;case"hsl":return this.toHSL().toString("hsl");case"rgb":return this.toRGB().toString("rgb");default:return this.toFormat(t).toString(t)}}toFormat(t){switch(t){case"hsba":return this;case"hsla":return this.toHSL();case"rgba":return this.toRGB();default:throw new Error("Unsupported color conversion: hsb -> "+t)}}toHSL(){let t=this.saturation/100,n=this.brightness/100,r=n*(1-t/2);return t=r===0||r===1?0:(n-r)/Math.min(r,1-r),new Su(xe(this.hue,2),xe(t*100,2),xe(r*100,2),xe(this.alpha,2))}toRGB(){let t=this.hue,n=this.saturation/100,r=this.brightness/100,i=(a,o=(a+t/60)%6)=>r-n*r*Math.max(Math.min(o,4-o,1),0);return new Pu(Math.round(i(5)*255),Math.round(i(3)*255),Math.round(i(1)*255),xe(this.alpha,2))}clone(){return new $l(this.hue,this.saturation,this.brightness,this.alpha)}getChannelFormatOptions(t){switch(t){case"hue":return{style:"unit",unit:"degree",unitDisplay:"narrow"};case"saturation":case"brightness":case"alpha":return{style:"percent"};default:throw new Error("Unknown color channel: "+t)}}formatChannelValue(t,n){let r=this.getChannelFormatOptions(t),i=this.getChannelValue(t);return(t==="saturation"||t==="brightness")&&(i/=100),new Intl.NumberFormat(n,r).format(i)}getChannelRange(t){switch(t){case"hue":return{minValue:0,maxValue:360,step:1,pageSize:15};case"saturation":case"brightness":return{minValue:0,maxValue:100,step:1,pageSize:10};case"alpha":return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw new Error("Unknown color channel: "+t)}}toJSON(){return{h:this.hue,s:this.saturation,b:this.brightness,a:this.alpha}}getFormat(){return"hsba"}getChannels(){return $l.colorChannels}};ot(bv,"colorChannels",["hue","saturation","brightness"]);Iu=bv,mV="aliceblue:f0f8ff,antiquewhite:faebd7,aqua:00ffff,aquamarine:7fffd4,azure:f0ffff,beige:f5f5dc,bisque:ffe4c4,black:000000,blanchedalmond:ffebcd,blue:0000ff,blueviolet:8a2be2,brown:a52a2a,burlywood:deb887,cadetblue:5f9ea0,chartreuse:7fff00,chocolate:d2691e,coral:ff7f50,cornflowerblue:6495ed,cornsilk:fff8dc,crimson:dc143c,cyan:00ffff,darkblue:00008b,darkcyan:008b8b,darkgoldenrod:b8860b,darkgray:a9a9a9,darkgreen:006400,darkkhaki:bdb76b,darkmagenta:8b008b,darkolivegreen:556b2f,darkorange:ff8c00,darkorchid:9932cc,darkred:8b0000,darksalmon:e9967a,darkseagreen:8fbc8f,darkslateblue:483d8b,darkslategray:2f4f4f,darkturquoise:00ced1,darkviolet:9400d3,deeppink:ff1493,deepskyblue:00bfff,dimgray:696969,dodgerblue:1e90ff,firebrick:b22222,floralwhite:fffaf0,forestgreen:228b22,fuchsia:ff00ff,gainsboro:dcdcdc,ghostwhite:f8f8ff,gold:ffd700,goldenrod:daa520,gray:808080,green:008000,greenyellow:adff2f,honeydew:f0fff0,hotpink:ff69b4,indianred:cd5c5c,indigo:4b0082,ivory:fffff0,khaki:f0e68c,lavender:e6e6fa,lavenderblush:fff0f5,lawngreen:7cfc00,lemonchiffon:fffacd,lightblue:add8e6,lightcoral:f08080,lightcyan:e0ffff,lightgoldenrodyellow:fafad2,lightgrey:d3d3d3,lightgreen:90ee90,lightpink:ffb6c1,lightsalmon:ffa07a,lightseagreen:20b2aa,lightskyblue:87cefa,lightslategray:778899,lightsteelblue:b0c4de,lightyellow:ffffe0,lime:00ff00,limegreen:32cd32,linen:faf0e6,magenta:ff00ff,maroon:800000,mediumaquamarine:66cdaa,mediumblue:0000cd,mediumorchid:ba55d3,mediumpurple:9370d8,mediumseagreen:3cb371,mediumslateblue:7b68ee,mediumspringgreen:00fa9a,mediumturquoise:48d1cc,mediumvioletred:c71585,midnightblue:191970,mintcream:f5fffa,mistyrose:ffe4e1,moccasin:ffe4b5,navajowhite:ffdead,navy:000080,oldlace:fdf5e6,olive:808000,olivedrab:6b8e23,orange:ffa500,orangered:ff4500,orchid:da70d6,palegoldenrod:eee8aa,palegreen:98fb98,paleturquoise:afeeee,palevioletred:d87093,papayawhip:ffefd5,peachpuff:ffdab9,peru:cd853f,pink:ffc0cb,plum:dda0dd,powderblue:b0e0e6,purple:800080,rebeccapurple:663399,red:ff0000,rosybrown:bc8f8f,royalblue:4169e1,saddlebrown:8b4513,salmon:fa8072,sandybrown:f4a460,seagreen:2e8b57,seashell:fff5ee,sienna:a0522d,silver:c0c0c0,skyblue:87ceeb,slateblue:6a5acd,slategray:708090,snow:fffafa,springgreen:00ff7f,steelblue:4682b4,tan:d2b48c,teal:008080,thistle:d8bfd8,tomato:ff6347,turquoise:40e0d0,violet:ee82ee,wheat:f5deb3,white:ffffff,whitesmoke:f5f5f5,yellow:ffff00,yellowgreen:9acd32",vV=e=>{let t=new Map,n=e.split(",");for(let r=0;r{var n;if(dv.has(e))return kr(dv.get(e));let t=Pu.parse(e)||Iu.parse(e)||Su.parse(e);if(!t){let r=new Error("Invalid color value: "+e);throw(n=Error.captureStackTrace)==null||n.call(Error,r,kr),r}return t},uv=e=>typeof e=="string"?kr(e):e,yV=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`color-picker:${e.id}`},gv=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`color-picker:${e.id}:label`},mu=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`color-picker:${e.id}:hidden-input`},Ev=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`color-picker:${e.id}:control`},Pv=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`color-picker:${e.id}:trigger`},vu=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`color-picker:${e.id}:content`},Sv=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`color-picker:${e.id}:positioner`},bV=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.formatSelect)!=null?n:`color-picker:${e.id}:format-select`},Iv=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.area)!=null?n:`color-picker:${e.id}:area`},EV=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.areaGradient)!=null?n:`color-picker:${e.id}:area-gradient`},Tv=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.areaThumb)!=null?n:`color-picker:${e.id}:area-thumb`},Cv=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.channelSliderTrack)==null?void 0:r.call(n,t))!=null?i:`color-picker:${e.id}:slider-track:${t}`},yu=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.channelSliderThumb)==null?void 0:r.call(n,t))!=null?i:`color-picker:${e.id}:slider-thumb:${t}`},Hl=e=>e.getById(vu(e)),PV=e=>e.getById(Tv(e)),SV=(e,t)=>e.getById(yu(e,t)),IV=e=>e.getById(bV(e)),pv=e=>e.getById(mu(e)),TV=e=>e.getById(Iv(e)),CV=(e,t,n)=>{let r=TV(e);if(!r)return;let{getPercentValue:i}=qi(t,r);return{x:i({dir:n,orientation:"horizontal"}),y:i({orientation:"vertical"})}},wv=e=>e.getById(Ev(e)),hu=e=>e.getById(Pv(e)),wV=e=>e.getById(Sv(e)),OV=(e,t)=>e.getById(Cv(e,t)),VV=(e,t,n,r)=>{let i=OV(e,n);if(!i)return;let{getPercentValue:a}=qi(t,i);return{x:a({dir:r,orientation:"horizontal"}),y:a({orientation:"vertical"})}},AV=e=>[...Oe(Hl(e),"input[data-channel]"),...Oe(wv(e),"input[data-channel]")];NV=e=>{let{channel:t,value:n,dir:r,orientation:i}=e,a=kV(i,r),{minValue:o,maxValue:s}=n.getChannelRange(t);switch(t){case"hue":return`linear-gradient(to ${a}, rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)`;case"lightness":{let l=n.withChannelValue(t,o).toString("css"),c=n.withChannelValue(t,(s-o)/2).toString("css"),d=n.withChannelValue(t,s).toString("css");return`linear-gradient(to ${a}, ${l}, ${c}, ${d})`}case"saturation":case"brightness":case"red":case"green":case"blue":case"alpha":{let l=n.withChannelValue(t,o).toString("css"),c=n.withChannelValue(t,s).toString("css");return`linear-gradient(to ${a}, ${l}, ${c})`}default:throw new Error("Unknown color channel: "+t)}};Bl=["hsba","hsla","rgba"],DV=new RegExp(`^(${Bl.join("|")})$`);pa=e=>kr(e),MV=/^[0-9a-fA-F]{3,8}$/;({and:HV}=we()),BV=e=>{var n;let t="";for(let r in e)t+=`${r}:${(n=e[r])!=null?n:""};`;return t},fv=pa("#000000"),UV=te({props({props:e}){var n,r;let t=(r=(n=e.value)!=null?n:e.defaultValue)!=null?r:fv;return y(h({dir:"ltr",defaultValue:fv,defaultFormat:t.getFormat(),openAutoFocus:!0},e),{positioning:h({placement:"bottom"},e.positioning)})},initialState({prop:e}){return e("open")||e("defaultOpen")||e("inline")?"open":"idle"},context({prop:e,bindable:t,getContext:n}){return{value:t(()=>{var r,i,a;return{defaultValue:e("defaultValue").toFormat((r=e("format"))!=null?r:e("defaultFormat")),value:(a=e("value"))==null?void 0:a.toFormat((i=e("format"))!=null?i:e("defaultFormat")),isEqual(o,s){return s!=null&&o.isEqual(s)},hash(o){return BV(o.toJSON())},onChange(o){var c;let l=n().get("format");(c=e("onValueChange"))==null||c({value:o,valueAsString:o.toString(l)})}}}),format:t(()=>({defaultValue:e("defaultFormat"),value:e("format"),onChange(r){var i;(i=e("onFormatChange"))==null||i({format:r})}})),activeId:t(()=>({defaultValue:null})),activeChannel:t(()=>({defaultValue:null})),activeOrientation:t(()=>({defaultValue:null})),fieldsetDisabled:t(()=>({defaultValue:!1})),restoreFocus:t(()=>({defaultValue:!0})),currentPlacement:t(()=>({defaultValue:void 0}))}},computed:{rtl:({prop:e})=>e("dir")==="rtl",disabled:({prop:e,context:t})=>!!e("disabled")||t.get("fieldsetDisabled"),interactive:({prop:e})=>!(e("disabled")||e("readOnly")),valueAsString:({context:e})=>e.get("value").toString(e.get("format")),areaValue:({context:e})=>{let t=e.get("format").startsWith("hsl")?"hsla":"hsba";return e.get("value").toFormat(t)}},effects:["trackFormControl"],watch({prop:e,context:t,action:n,track:r}){r([()=>t.hash("value")],()=>{n(["syncInputElements","dispatchChangeEvent"])}),r([()=>t.get("format")],()=>{n(["syncFormatSelectElement","syncValueWithFormat"])}),r([()=>e("open")],()=>{n(["toggleVisibility"])})},on:{"VALUE.SET":{actions:["setValue"]},"FORMAT.SET":{actions:["setFormat"]},"CHANNEL_INPUT.CHANGE":{actions:["setChannelColorFromInput"]},"EYEDROPPER.CLICK":{actions:["openEyeDropper"]},"SWATCH_TRIGGER.CLICK":{actions:["setValue"]}},states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["setInitialFocus"]},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen","setInitialFocus"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen","setInitialFocus"]}],"CHANNEL_INPUT.FOCUS":{target:"focused",actions:["setActiveChannel"]}}},focused:{id:"color-picker-focused",tags:["closed","focused"],on:{"CONTROLLED.OPEN":{target:"open",actions:["setInitialFocus"]},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen","setInitialFocus"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen","setInitialFocus"]}],"CHANNEL_INPUT.FOCUS":{actions:["setActiveChannel"]},"CHANNEL_INPUT.BLUR":{target:"idle",actions:["setChannelColorFromInput"]},"TRIGGER.BLUR":{target:"idle"}}},open:{tags:["open"],effects:["trackPositioning","trackDismissableElement"],initial:"idle",on:{"CONTROLLED.CLOSE":[{guard:"shouldRestoreFocus",target:"focused",actions:["setReturnFocus"]},{target:"idle"}],INTERACT_OUTSIDE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{guard:"shouldRestoreFocus",target:"focused",actions:["invokeOnClose","setReturnFocus"]},{target:"idle",actions:["invokeOnClose"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"idle",actions:["invokeOnClose"]}]},states:{idle:{on:{"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"#color-picker-focused",actions:["invokeOnClose"]}],"AREA.POINTER_DOWN":{target:"dragging",actions:["setActiveChannel","setAreaColorFromPoint","focusAreaThumb"]},"AREA.FOCUS":{actions:["setActiveChannel"]},"CHANNEL_SLIDER.POINTER_DOWN":{target:"dragging",actions:["setActiveChannel","setChannelColorFromPoint","focusChannelThumb"]},"CHANNEL_SLIDER.FOCUS":{actions:["setActiveChannel"]},"AREA.ARROW_LEFT":{actions:["decrementAreaXChannel"]},"AREA.ARROW_RIGHT":{actions:["incrementAreaXChannel"]},"AREA.ARROW_UP":{actions:["incrementAreaYChannel"]},"AREA.ARROW_DOWN":{actions:["decrementAreaYChannel"]},"AREA.PAGE_UP":{actions:["incrementAreaXChannel"]},"AREA.PAGE_DOWN":{actions:["decrementAreaXChannel"]},"CHANNEL_SLIDER.ARROW_LEFT":{actions:["decrementChannel"]},"CHANNEL_SLIDER.ARROW_RIGHT":{actions:["incrementChannel"]},"CHANNEL_SLIDER.ARROW_UP":{actions:["incrementChannel"]},"CHANNEL_SLIDER.ARROW_DOWN":{actions:["decrementChannel"]},"CHANNEL_SLIDER.PAGE_UP":{actions:["incrementChannel"]},"CHANNEL_SLIDER.PAGE_DOWN":{actions:["decrementChannel"]},"CHANNEL_SLIDER.HOME":{actions:["setChannelToMin"]},"CHANNEL_SLIDER.END":{actions:["setChannelToMax"]},"CHANNEL_INPUT.BLUR":{actions:["setChannelColorFromInput"]},"SWATCH_TRIGGER.CLICK":[{guard:HV("isOpenControlled","closeOnSelect"),actions:["setValue","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["setValue","invokeOnClose","setReturnFocus"]},{actions:["setValue"]}]}},dragging:{tags:["dragging"],exit:["clearActiveChannel"],effects:["trackPointerMove","disableTextSelection"],on:{"AREA.POINTER_MOVE":{actions:["setAreaColorFromPoint","focusAreaThumb"]},"AREA.POINTER_UP":{target:"idle",actions:["invokeOnChangeEnd"]},"CHANNEL_SLIDER.POINTER_MOVE":{actions:["setChannelColorFromPoint","focusChannelThumb"]},"CHANNEL_SLIDER.POINTER_UP":{target:"idle",actions:["invokeOnChangeEnd"]}}}}}},implementations:{guards:{closeOnSelect:({prop:e})=>!!e("closeOnSelect"),isOpenControlled:({prop:e})=>e("open")!=null||!!e("inline"),shouldRestoreFocus:({context:e})=>!!e.get("restoreFocus")},effects:{trackPositioning({context:e,prop:t,scope:n}){var a;if(t("inline"))return;e.get("currentPlacement")||e.set("currentPlacement",(a=t("positioning"))==null?void 0:a.placement);let r=hu(n);return Xe(r,()=>wV(n),y(h({},t("positioning")),{defer:!0,onComplete(o){e.set("currentPlacement",o.placement)}}))},trackDismissableElement({context:e,scope:t,prop:n,send:r}){return n("inline")?void 0:qt(()=>Hl(t),{type:"popover",exclude:hu(t),defer:!0,onInteractOutside(a){var o;(o=n("onInteractOutside"))==null||o(a),!a.defaultPrevented&&e.set("restoreFocus",!(a.detail.focusable||a.detail.contextmenu))},onPointerDownOutside:n("onPointerDownOutside"),onFocusOutside:n("onFocusOutside"),onDismiss(){r({type:"INTERACT_OUTSIDE"})}})},trackFormControl({context:e,scope:t,send:n}){let r=pv(t);return ht(r,{onFieldsetDisabledChange(i){e.set("fieldsetDisabled",i)},onFormReset(){n({type:"VALUE.SET",value:e.initial("value"),src:"form.reset"})}})},trackPointerMove({context:e,scope:t,event:n,send:r}){return pn(t.getDoc(),{onPointerMove({point:i}){var o;let a=e.get("activeId")==="area"?"AREA.POINTER_MOVE":"CHANNEL_SLIDER.POINTER_MOVE";r({type:a,point:i,format:n.format,orientation:(o=e.get("activeOrientation"))!=null?o:void 0})},onPointerUp(){let i=e.get("activeId")==="area"?"AREA.POINTER_UP":"CHANNEL_SLIDER.POINTER_UP";r({type:i})}})},disableTextSelection({scope:e}){return Za({doc:e.getDoc(),target:Hl(e)})}},actions:{openEyeDropper({scope:e,context:t}){let n=e.getWin();if(!("EyeDropper"in n))return;new n.EyeDropper().open().then(({sRGBHex:a})=>{let o=t.get("value").getFormat(),s=kr(a).toFormat(o);t.set("value",s)}).catch(()=>{})},setActiveChannel({context:e,event:t}){e.set("activeId",t.id),t.channel&&e.set("activeChannel",t.channel),t.orientation&&e.set("activeOrientation",t.orientation)},clearActiveChannel({context:e}){e.set("activeChannel",null),e.set("activeId",null),e.set("activeOrientation",null)},setAreaColorFromPoint({context:e,event:t,computed:n,scope:r,prop:i}){let a=t.format?e.get("value").toFormat(t.format):n("areaValue"),{xChannel:o,yChannel:s}=t.channel||e.get("activeChannel"),l=CV(r,t.point,i("dir"));if(!l)return;let c=a.getChannelPercentValue(o,l.x),d=a.getChannelPercentValue(s,1-l.y),g=a.withChannelValue(o,c).withChannelValue(s,d);e.set("value",g)},setChannelColorFromPoint({context:e,event:t,computed:n,scope:r,prop:i}){let a=t.channel||e.get("activeId"),o=t.format?e.get("value").toFormat(t.format):n("areaValue"),s=VV(r,t.point,a,i("dir"));if(!s)return;let c=(t.orientation||e.get("activeOrientation")||"horizontal")==="horizontal"?s.x:s.y,d=o.getChannelPercentValue(a,c),g=o.withChannelValue(a,d);e.set("value",g)},setValue({context:e,event:t}){let n=e.get("format");e.set("value",t.value.toFormat(n))},setFormat({context:e,event:t}){e.set("format",t.format)},dispatchChangeEvent({scope:e,computed:t}){Hi(pv(e),{value:t("valueAsString")})},syncInputElements({context:e,scope:t}){mv(t,e.get("value"))},invokeOnChangeEnd({context:e,prop:t,computed:n}){var r;(r=t("onValueChangeEnd"))==null||r({value:e.get("value"),valueAsString:n("valueAsString")})},setChannelColorFromInput({context:e,event:t,scope:n,prop:r}){var c;let{channel:i,isTextField:a,value:o}=t,s=e.get("value").getChannelValue("alpha"),l;if(i==="alpha"){let d=parseFloat(o);d=Number.isNaN(d)?s:d,l=e.get("value").withChannelValue("alpha",d)}else if(a)l=ed(()=>{let d=i==="hex"?$V(o):o;return pa(d).withChannelValue("alpha",s)},()=>e.get("value"));else{let d=e.get("value").toFormat(e.get("format")),g=Number.isNaN(o)?d.getChannelValue(i):o;l=d.withChannelValue(i,g)}mv(n,e.get("value"),l),e.set("value",l),(c=r("onValueChangeEnd"))==null||c({value:l,valueAsString:l.toString(e.get("format"))})},incrementChannel({context:e,event:t}){let n=e.get("value").incrementChannel(t.channel,t.step);e.set("value",n)},decrementChannel({context:e,event:t}){let n=e.get("value").decrementChannel(t.channel,t.step);e.set("value",n)},incrementAreaXChannel({context:e,event:t,computed:n}){let{xChannel:r}=t.channel,i=n("areaValue").incrementChannel(r,t.step);e.set("value",i)},decrementAreaXChannel({context:e,event:t,computed:n}){let{xChannel:r}=t.channel,i=n("areaValue").decrementChannel(r,t.step);e.set("value",i)},incrementAreaYChannel({context:e,event:t,computed:n}){let{yChannel:r}=t.channel,i=n("areaValue").incrementChannel(r,t.step);e.set("value",i)},decrementAreaYChannel({context:e,event:t,computed:n}){let{yChannel:r}=t.channel,i=n("areaValue").decrementChannel(r,t.step);e.set("value",i)},setChannelToMax({context:e,event:t}){let n=e.get("value"),r=n.getChannelRange(t.channel),i=n.withChannelValue(t.channel,r.maxValue);e.set("value",i)},setChannelToMin({context:e,event:t}){let n=e.get("value"),r=n.getChannelRange(t.channel),i=n.withChannelValue(t.channel,r.minValue);e.set("value",i)},focusAreaThumb({scope:e}){B(()=>{var t;(t=PV(e))==null||t.focus({preventScroll:!0})})},focusChannelThumb({event:e,scope:t}){B(()=>{var n;(n=SV(t,e.channel))==null||n.focus({preventScroll:!0})})},setInitialFocus({prop:e,scope:t}){e("openAutoFocus")&&B(()=>{let n=hr({root:Hl(t),getInitialEl:e("initialFocusEl")});n==null||n.focus({preventScroll:!0})})},setReturnFocus({scope:e}){B(()=>{var t;(t=hu(e))==null||t.focus({preventScroll:!0})})},syncFormatSelectElement({context:e,scope:t}){GV(t,e.get("format"))},syncValueWithFormat({context:e}){let t=e.get("value"),n=t.toFormat(e.get("format"));n.isEqual(t)||e.set("value",n)},invokeOnOpen({prop:e,context:t}){var n;e("inline")||(n=e("onOpenChange"))==null||n({open:!0,value:t.get("value")})},invokeOnClose({prop:e,context:t}){var n;e("inline")||(n=e("onOpenChange"))==null||n({open:!1,value:t.get("value")})},toggleVisibility({prop:e,event:t,send:n}){n({type:e("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:t})}}}});qV=class extends X{initMachine(e){return new Y(UV,e)}initApi(){return this.zagConnect(LV)}render(){var N;let e=this.el.querySelector('[data-part="root"]');e&&this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-part="hidden-input"]');n&&Er(n,this.el,(N=this.api.valueAsString)!=null?N:"",(k,L)=>this.spreadProps(k,L),this.api.getHiddenInputProps());let r=this.el.querySelector('[data-part="control"]');r&&this.spreadProps(r,this.api.getControlProps());let i=this.el.querySelector('[data-part="trigger"]');i&&this.spreadProps(i,this.api.getTriggerProps()),this.el.querySelectorAll('[data-part="transparency-grid"][data-size="10px"]').forEach(k=>this.spreadProps(k,this.api.getTransparencyGridProps({size:"10px"})));let o=i==null?void 0:i.querySelector('[data-part="swatch"]');o&&this.spreadProps(o,this.api.getSwatchProps({value:this.api.value})),this.el.querySelectorAll('[data-part="channel-input"][data-channel="hex"]').forEach(k=>this.spreadProps(k,this.api.getChannelInputProps({channel:"hex"}))),this.el.querySelectorAll('[data-part="channel-input"][data-channel="alpha"]').forEach(k=>this.spreadProps(k,this.api.getChannelInputProps({channel:"alpha"})));let c=this.el.querySelector('[data-part="positioner"]');c&&this.spreadProps(c,this.api.getPositionerProps());let d=this.el.querySelector('[data-part="content"]');d&&this.spreadProps(d,this.api.getContentProps());let g=this.el.querySelector('[data-part="area"]');g&&this.spreadProps(g,this.api.getAreaProps());let p=this.el.querySelector('[data-part="area-background"]');p&&this.spreadProps(p,this.api.getAreaBackgroundProps());let u=this.el.querySelector('[data-part="area-thumb"]');u&&this.spreadProps(u,this.api.getAreaThumbProps());let f=this.el.querySelector('[data-part="channel-slider"][data-channel="hue"]');f&&this.spreadProps(f,this.api.getChannelSliderProps({channel:"hue"}));let m=this.el.querySelector('[data-part="channel-slider-track"][data-channel="hue"]');m&&this.spreadProps(m,this.api.getChannelSliderTrackProps({channel:"hue"}));let S=this.el.querySelector('[data-part="channel-slider-thumb"][data-channel="hue"]');S&&this.spreadProps(S,this.api.getChannelSliderThumbProps({channel:"hue"}));let T=this.el.querySelector('[data-part="channel-slider"][data-channel="alpha"]');T&&this.spreadProps(T,this.api.getChannelSliderProps({channel:"alpha"})),this.el.querySelectorAll('[data-part="transparency-grid"][data-size="12px"]').forEach(k=>this.spreadProps(k,this.api.getTransparencyGridProps({size:"12px"})));let I=this.el.querySelector('[data-part="channel-slider-track"][data-channel="alpha"]');I&&this.spreadProps(I,this.api.getChannelSliderTrackProps({channel:"alpha"}));let P=this.el.querySelector('[data-part="channel-slider-thumb"][data-channel="alpha"]');P&&this.spreadProps(P,this.api.getChannelSliderThumbProps({channel:"alpha"})),this.el.querySelectorAll('[data-part="channel-input"][data-channel="red"]').forEach(k=>this.spreadProps(k,this.api.getChannelInputProps({channel:"red"}))),this.el.querySelectorAll('[data-part="channel-input"][data-channel="green"]').forEach(k=>this.spreadProps(k,this.api.getChannelInputProps({channel:"green"}))),this.el.querySelectorAll('[data-part="channel-input"][data-channel="blue"]').forEach(k=>this.spreadProps(k,this.api.getChannelInputProps({channel:"blue"})));let x=this.el.querySelector('[data-part="swatch-group"]');x&&this.spreadProps(x,this.api.getSwatchGroupProps()),this.el.querySelectorAll('[data-part="swatch-trigger"][data-value]').forEach(k=>{let L=k.getAttribute("data-value");L&&this.spreadProps(k,this.api.getSwatchTriggerProps({value:L}));let K=k.querySelector('[data-part="swatch"][data-value]');if(K){let J=K.getAttribute("data-value");J&&this.spreadProps(K,this.api.getSwatchProps({value:J}))}}),this.el.querySelectorAll('[data-part="transparency-grid"][data-size="var(--spacing-mini)"]').forEach(k=>this.spreadProps(k,this.api.getTransparencyGridProps({size:"var(--spacing-mini)"})))}};zV={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=WV(e),i=new qV(e,y(h({id:e.id},r),{name:V(e,"name"),defaultFormat:"rgba",closeOnSelect:O(e,"closeOnSelect"),defaultOpen:!1,openAutoFocus:O(e,"openAutoFocus"),disabled:O(e,"disabled"),invalid:O(e,"invalid"),readOnly:O(e,"readonly"),required:O(e,"required"),dir:q(e),positioning:qe(e),onValueChange:a=>{fu(e,a.valueAsString),W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,valueAsString:a.valueAsString},serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})},onValueChangeEnd:a=>{fu(e,a.valueAsString),W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,valueAsString:a.valueAsString},serverEventName:V(e,"onValueChangeEnd"),clientEventName:V(e,"onValueChangeEndClient")})},onOpenChange:a=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,open:a.open},serverEventName:V(e,"onOpenChange"),clientEventName:V(e,"onOpenChangeClient")})},onFormatChange:a=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,format:a.format},serverEventName:V(e,"onFormatChange"),clientEventName:V(e,"onFormatChangeClient")})},onPointerDownOutside:()=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id},serverEventName:V(e,"onPointerDownOutside"),clientEventName:V(e,"onPointerDownOutsideClient")})},onFocusOutside:()=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id},serverEventName:V(e,"onFocusOutside"),clientEventName:V(e,"onFocusOutsideClient")})},onInteractOutside:()=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id},serverEventName:V(e,"onInteractOutside"),clientEventName:V(e,"onInteractOutsideClient")})}}));i.init(),this.colorPicker=i,this.handlers=[],this.onSetValue=a=>{let{value:o}=a.detail;i.api.setValue(o)},e.addEventListener("corex:color-picker:set-value",this.onSetValue),this.handlers.push(this.handleEvent("color_picker_set_value",a=>{$(e.id,H(a))&&i.api.setValue(a.value)}))},updated(){let e=this.el,t=this.colorPicker,n=br(e),r="value"in n&&n.value?{value:pa(n.value)}:{};t==null||t.updateProps(y(h({},r),{name:V(e,"name"),closeOnSelect:O(e,"closeOnSelect"),openAutoFocus:O(e,"openAutoFocus"),disabled:O(e,"disabled"),invalid:O(e,"invalid"),readOnly:O(e,"readonly"),required:O(e,"required"),dir:q(e),positioning:qe(e)})),"value"in n&&n.value&&fu(e,n.value)},destroyed(){var e;if(this.onSetValue&&this.el.removeEventListener("corex:color-picker:set-value",this.onSetValue),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.colorPicker)==null||e.destroy()}}});function Vn(e,t,n){let r=[],i;return a=>{var l;let o=e(a);return(o.length!==r.length||o.some((c,d)=>!Ce(r[d],c)))&&(r=o,i=t(o,a),(l=n==null?void 0:n.onChange)==null||l.call(n,i)),i}}var Eo=ee(()=>{"use strict";oe()});var Vy={};pe(Vy,{DatePicker:()=>Nx,applyServerIsoToZagIfNeeded:()=>Bu,resolveCloseOnSelect:()=>Uu,resolveIsoListForFormSync:()=>Hu,syncDatePickerValueInput:()=>Jl,valueToIsoString:()=>Oy});function Tu(e,t){return e-t*Math.floor(e/t)}function Ul(e,t,n,r){t=Ku(e,t);let i=t-1,a=-2;return n<=2?a=0:Yl(t)&&(a=-1),qv-1+365*i+Math.floor(i/4)-Math.floor(i/100)+Math.floor(i/400)+Math.floor((367*n-362)/12+a+r)}function Yl(e){return e%4===0&&(e%100!==0||e%400===0)}function Ku(e,t){return e==="BC"?1-t:t}function YV(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}function Nt(e,t){return t=Ze(t,e.calendar),e.era===t.era&&e.year===t.year&&e.month===t.month&&e.day===t.day}function JV(e,t){return t=Ze(t,e.calendar),e=Jn(e),t=Jn(t),e.era===t.era&&e.year===t.year&&e.month===t.month}function QV(e,t){return t=Ze(t,e.calendar),e=wo(e),t=wo(t),e.era===t.era&&e.year===t.year}function eA(e,t){return tc(e.calendar,t.calendar)&&Nt(e,t)}function Po(e,t){return tc(e.calendar,t.calendar)&&JV(e,t)}function So(e,t){return tc(e.calendar,t.calendar)&&QV(e,t)}function tc(e,t){var n,r,i,a;return(a=(i=(n=e.isEqual)==null?void 0:n.call(e,t))!=null?i:(r=t.isEqual)==null?void 0:r.call(t,e))!=null?a:e.identifier===t.identifier}function tA(e,t){return Nt(e,nc(t))}function Wv(e,t,n){let r=e.calendar.toJulianDay(e),i=n?nA[n]:oA(t),a=Math.ceil(r+1-i)%7;return a<0&&(a+=7),a}function Kv(e){return Qn(Date.now(),e)}function nc(e){return ci(Kv(e))}function zv(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function rA(e,t){return Av(e)-Av(t)}function Av(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}function zu(){return Cu==null&&(Cu=new Intl.DateTimeFormat().resolvedOptions().timeZone),Cu}function jv(){return iA}function Jn(e){return e.subtract({days:e.day-1})}function Lu(e){return e.add({days:e.calendar.getDaysInMonth(e)-e.day})}function wo(e){return Jn(e.subtract({months:e.month-1}))}function aA(e){return Lu(e.add({months:e.calendar.getMonthsInYear(e)-e.month}))}function Lr(e,t,n){let r=Wv(e,t,n);return e.subtract({days:r})}function xv(e,t,n){return Lr(e,t,n).add({days:6})}function Yv(e){if(Intl.Locale){let n=Rv.get(e);return n||(n=new Intl.Locale(e).maximize().region,n&&Rv.set(e,n)),n}let t=e.split("-")[1];return t==="u"?void 0:t}function oA(e){let t=wu.get(e);if(!t){if(Intl.Locale){let r=new Intl.Locale(e);if("getWeekInfo"in r&&(t=r.getWeekInfo(),t))return wu.set(e,t),t.firstDay}let n=Yv(e);if(e.includes("-fw-")){let r=e.split("-fw-")[1].split("-")[0];r==="mon"?t={firstDay:1}:r==="tue"?t={firstDay:2}:r==="wed"?t={firstDay:3}:r==="thu"?t={firstDay:4}:r==="fri"?t={firstDay:5}:r==="sat"?t={firstDay:6}:t={firstDay:0}}else e.includes("-ca-iso8601")?t={firstDay:1}:t={firstDay:n&&ZV[n]||0};wu.set(e,t)}return t.firstDay}function sA(e,t,n){let r=e.calendar.getDaysInMonth(e);return Math.ceil((Wv(Jn(e),t,n)+r)/7)}function Xv(e,t){return e&&t?e.compare(t)<=0?e:t:e||t}function Zv(e,t){return e&&t?e.compare(t)>=0?e:t:e||t}function cA(e,t){let n=e.calendar.toJulianDay(e),r=Math.ceil(n+1)%7;r<0&&(r+=7);let i=Yv(t),[a,o]=lA[i]||[6,0];return r===a||r===o}function va(e){e=Ze(e,new ma);let t=Ku(e.era,e.year);return Jv(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Jv(e,t,n,r,i,a,o){let s=new Date;return s.setUTCHours(r,i,a,o),s.setUTCFullYear(e,t-1,n),s.getTime()}function Du(e,t){if(t==="UTC")return 0;if(e>0&&t===zu()&&!jv())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:r,day:i,hour:a,minute:o,second:s}=Qv(e,t);return Jv(n,r,i,a,o,s,0)-Math.floor(e/1e3)*1e3}function Qv(e,t){let n=kv.get(t);n||(n=new Intl.DateTimeFormat("en-US",{timeZone:t,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),kv.set(t,n));let r=n.formatToParts(new Date(e)),i={};for(let a of r)a.type!=="literal"&&(i[a.type]=a.value);return{year:i.era==="BC"||i.era==="B"?-i.year+1:+i.year,month:+i.month,day:+i.day,hour:i.hour==="24"?0:+i.hour,minute:+i.minute,second:+i.second}}function dA(e,t,n,r){return(n===r?[n]:[n,r]).filter(a=>uA(e,t,a))}function uA(e,t,n){let r=Qv(n,t);return e.year===r.year&&e.month===r.month&&e.day===r.day&&e.hour===r.hour&&e.minute===r.minute&&e.second===r.second}function Zn(e,t,n="compatible"){let r=Xt(e);if(t==="UTC")return va(r);if(t===zu()&&n==="compatible"&&!jv()){r=Ze(r,new ma);let l=new Date,c=Ku(r.era,r.year);return l.setFullYear(c,r.month-1,r.day),l.setHours(r.hour,r.minute,r.second,r.millisecond),l.getTime()}let i=va(r),a=Du(i-Nv,t),o=Du(i+Nv,t),s=dA(r,t,i-a,i-o);if(s.length===1)return s[0];if(s.length>1)switch(n){case"compatible":case"earlier":return s[0];case"later":return s[s.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(n){case"earlier":return Math.min(i-a,i-o);case"compatible":case"later":return Math.max(i-a,i-o);case"reject":throw new RangeError("No such absolute time found")}}function ey(e,t,n="compatible"){return new Date(Zn(e,t,n))}function Qn(e,t){let n=Du(e,t),r=new Date(e+n),i=r.getUTCFullYear(),a=r.getUTCMonth()+1,o=r.getUTCDate(),s=r.getUTCHours(),l=r.getUTCMinutes(),c=r.getUTCSeconds(),d=r.getUTCMilliseconds();return new cy(i<1?"BC":"AD",i<1?-i+1:i,a,o,t,n,s,l,c,d)}function ci(e){return new Dr(e.calendar,e.era,e.year,e.month,e.day)}function Xt(e,t){let n=0,r=0,i=0,a=0;if("timeZone"in e)({hour:n,minute:r,second:i,millisecond:a}=e);else if("hour"in e&&!t)return e;return t&&({hour:n,minute:r,second:i,millisecond:a}=t),new VA(e.calendar,e.era,e.year,e.month,e.day,n,r,i,a)}function Ze(e,t){if(tc(e.calendar,t))return e;let n=t.fromJulianDay(e.calendar.toJulianDay(e)),r=e.copy();return r.calendar=t,r.era=n.era,r.year=n.year,r.month=n.month,r.day=n.day,pi(r),r}function ty(e,t,n){if(e instanceof cy)return e.timeZone===t?e:pA(e,t);let r=Zn(e,t,n);return Qn(r,t)}function gA(e){let t=va(e)-e.offset;return new Date(t)}function pA(e,t){let n=va(e)-e.offset;return Ze(Qn(n,t),e.calendar)}function rc(e,t){var o,s;let n=e.copy(),r="hour"in n?vA(n,t):0;Fu(n,t.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=t.months||0,Mu(n),ny(n),n.day+=(t.weeks||0)*7,n.day+=t.days||0,n.day+=r,hA(n),n.calendar.balanceDate&&n.calendar.balanceDate(n),n.year<1&&(n.year=1,n.month=1,n.day=1);let i=n.calendar.getYearsInEra(n);if(n.year>i){let l=(s=(o=n.calendar).isInverseEra)==null?void 0:s.call(o,n);n.year=i,n.month=l?1:n.calendar.getMonthsInYear(n),n.day=l?1:n.calendar.getDaysInMonth(n)}n.month<1&&(n.month=1,n.day=1);let a=n.calendar.getMonthsInYear(n);return n.month>a&&(n.month=a,n.day=n.calendar.getDaysInMonth(n)),n.day=Math.max(1,Math.min(n.calendar.getDaysInMonth(n),n.day)),n}function Fu(e,t){var n,r;(r=(n=e.calendar).isInverseEra)!=null&&r.call(n,e)&&(t=-t),e.year+=t}function Mu(e){for(;e.month<1;)Fu(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,Fu(e,1)}function hA(e){for(;e.day<1;)e.month--,Mu(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,Mu(e)}function ny(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day))}function pi(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),ny(e)}function ry(e){let t={};for(let n in e)typeof e[n]=="number"&&(t[n]=-e[n]);return t}function iy(e,t){return rc(e,ry(t))}function ju(e,t){let n=e.copy();return t.era!=null&&(n.era=t.era),t.year!=null&&(n.year=t.year),t.month!=null&&(n.month=t.month),t.day!=null&&(n.day=t.day),pi(n),n}function Ql(e,t){let n=e.copy();return t.hour!=null&&(n.hour=t.hour),t.minute!=null&&(n.minute=t.minute),t.second!=null&&(n.second=t.second),t.millisecond!=null&&(n.millisecond=t.millisecond),mA(n),n}function fA(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=Gl(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=Gl(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=Gl(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=Gl(e.hour,24),t}function mA(e){e.millisecond=Math.max(0,Math.min(e.millisecond,1e3)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function Gl(e,t){let n=e%t;return n<0&&(n+=t),n}function vA(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,fA(e)}function Yu(e,t,n,r){var a,o;let i=e.copy();switch(t){case"era":{let s=e.calendar.getEras(),l=s.indexOf(e.era);if(l<0)throw new Error("Invalid era: "+e.era);l=er(l,n,0,s.length-1,r==null?void 0:r.round),i.era=s[l],pi(i);break}case"year":(o=(a=i.calendar).isInverseEra)!=null&&o.call(a,i)&&(n=-n),i.year=er(e.year,n,-1/0,9999,r==null?void 0:r.round),i.year===-1/0&&(i.year=1),i.calendar.balanceYearMonth&&i.calendar.balanceYearMonth(i,e);break;case"month":i.month=er(e.month,n,1,e.calendar.getMonthsInYear(e),r==null?void 0:r.round);break;case"day":i.day=er(e.day,n,1,e.calendar.getDaysInMonth(e),r==null?void 0:r.round);break;default:throw new Error("Unsupported field "+t)}return e.calendar.balanceDate&&e.calendar.balanceDate(i),pi(i),i}function ay(e,t,n,r){let i=e.copy();switch(t){case"hour":{let a=e.hour,o=0,s=23;if((r==null?void 0:r.hourCycle)===12){let l=a>=12;o=l?12:0,s=l?23:11}i.hour=er(a,n,o,s,r==null?void 0:r.round);break}case"minute":i.minute=er(e.minute,n,0,59,r==null?void 0:r.round);break;case"second":i.second=er(e.second,n,0,59,r==null?void 0:r.round);break;case"millisecond":i.millisecond=er(e.millisecond,n,0,999,r==null?void 0:r.round);break;default:throw new Error("Unsupported field "+t)}return i}function er(e,t,n,r,i=!1){if(i){e+=Math.sign(t),e0?e=Math.ceil(e/a)*a:e=Math.floor(e/a)*a,e>r&&(e=n)}else e+=t,er&&(e=n+(e-r-1));return e}function oy(e,t){let n;if(t.years!=null&&t.years!==0||t.months!=null&&t.months!==0||t.weeks!=null&&t.weeks!==0||t.days!=null&&t.days!==0){let i=rc(Xt(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days});n=Zn(i,e.timeZone)}else n=va(e)-e.offset;n+=t.milliseconds||0,n+=(t.seconds||0)*1e3,n+=(t.minutes||0)*6e4,n+=(t.hours||0)*36e5;let r=Qn(n,e.timeZone);return Ze(r,e.calendar)}function yA(e,t){return oy(e,ry(t))}function bA(e,t,n,r){switch(t){case"hour":{let i=0,a=23;if((r==null?void 0:r.hourCycle)===12){let f=e.hour>=12;i=f?12:0,a=f?23:11}let o=Xt(e),s=Ze(Ql(o,{hour:i}),new ma),l=[Zn(s,e.timeZone,"earlier"),Zn(s,e.timeZone,"later")].filter(f=>Qn(f,e.timeZone).day===s.day)[0],c=Ze(Ql(o,{hour:a}),new ma),d=[Zn(c,e.timeZone,"earlier"),Zn(c,e.timeZone,"later")].filter(f=>Qn(f,e.timeZone).day===c.day).pop(),g=va(e)-e.offset,p=Math.floor(g/Io),u=g%Io;return g=er(p,n,Math.floor(l/Io),Math.floor(d/Io),r==null?void 0:r.round)*Io+u,Ze(Qn(g,e.timeZone),e.calendar)}case"minute":case"second":case"millisecond":return ay(e,t,n,r);case"era":case"year":case"month":case"day":{let i=Yu(Xt(e),t,n,r),a=Zn(i,e.timeZone);return Ze(Qn(a,e.timeZone),e.calendar)}default:throw new Error("Unsupported field "+t)}}function EA(e,t,n){let r=Xt(e),i=Ql(ju(r,t),t);if(i.compare(r)===0)return e;let a=Zn(i,e.timeZone,n);return Ze(Qn(a,e.timeZone),e.calendar)}function TA(e){let t=e.match(PA);if(!t)throw SA.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let n=new Dr(Ou(t[1],0,9999),Ou(t[2],1,12),1);return n.day=Ou(t[3],1,n.calendar.getDaysInMonth(n)),n}function Ou(e,t,n){let r=Number(e);if(rn)throw new RangeError(`Value out of range: ${t} <= ${r} <= ${n}`);return r}function CA(e){return`${String(e.hour).padStart(2,"0")}:${String(e.minute).padStart(2,"0")}:${String(e.second).padStart(2,"0")}${e.millisecond?String(e.millisecond/1e3).slice(1):""}`}function sy(e){let t=Ze(e,new ma),n;return t.era==="BC"?n=t.year===1?"0000":"-"+String(Math.abs(1-t.year)).padStart(6,"00"):n=String(t.year).padStart(4,"0"),`${n}-${String(t.month).padStart(2,"0")}-${String(t.day).padStart(2,"0")}`}function ly(e){return`${sy(e)}T${CA(e)}`}function wA(e){let t=Math.sign(e)<0?"-":"+";e=Math.abs(e);let n=Math.floor(e/36e5),r=Math.floor(e%36e5/6e4),i=Math.floor(e%36e5%6e4/1e3),a=`${t}${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`;return i!==0&&(a+=`:${String(i).padStart(2,"0")}`),a}function OA(e){return`${ly(e)}${wA(e.offset)}[${e.timeZone}]`}function Xu(e){let t=typeof e[0]=="object"?e.shift():new ma,n;if(typeof e[0]=="string")n=e.shift();else{let o=t.getEras();n=o[o.length-1]}let r=e.shift(),i=e.shift(),a=e.shift();return[t,n,r,i,a]}function dy(e,t={}){if(typeof t.hour12=="boolean"&&xA()){t=h({},t);let i=AA[String(t.hour12)][e.split("-")[0]],a=t.hour12?"h12":"h23";t.hourCycle=i!=null?i:a,delete t.hour12}let n=e+(t?Object.entries(t).sort((i,a)=>i[0]a.type==="hour").value,10),i=parseInt(n.formatToParts(new Date(2020,2,3,23)).find(a=>a.type==="hour").value,10);if(r===0&&i===23)return"h23";if(r===24&&i===23)return"h24";if(r===0&&i===11)return"h11";if(r===12&&i===11)return"h12";throw new Error("Unexpected hour cycle result")}function NA(e,t,n,r,i){let a={};for(let s in t){let l=s,c=t[l];c!=null&&(a[l]=Math.floor(c/2),a[l]>0&&c%2===0&&a[l]--)}let o=hi(e,t,n).subtract(a);return Oo(e,o,t,n,r,i)}function hi(e,t,n,r,i){let a=e;return t.years?a=wo(e):t.months?a=Jn(e):t.weeks&&(a=Lr(e,n)),Oo(e,a,t,n,r,i)}function Zu(e,t,n,r,i){let a=h({},t);a.days?a.days--:a.weeks?a.weeks--:a.months?a.months--:a.years&&a.years--;let o=hi(e,t,n).subtract(a);return Oo(e,o,t,n,r,i)}function Oo(e,t,n,r,i,a){return i&&e.compare(i)>=0&&(t=Zv(t,hi(ci(i),n,r))),a&&e.compare(a)<=0&&(t=Xv(t,Zu(ci(a),n,r))),t}function jt(e,t,n){let r=ci(e),i=t?ci(t):void 0,a=n?ci(n):void 0,o=r;return i&&(o=Zv(o,i)),a&&(o=Xv(o,a)),o.compare(r)===0?e:"hour"in e?e.set({year:o.year,month:o.month,day:o.day}):o}function Lv(e,t,n,r,i,a){switch(t){case"start":return hi(e,n,r,i,a);case"end":return Zu(e,n,r,i,a);case"center":default:return NA(e,n,r,i,a)}}function Nr(e,t){return e==null||t==null?e===t:!("hour"in e)&&!("hour"in t)?Nt(e,t):Xt(e).compare(Xt(t))===0}function Dv(e,t,n,r,i){return e?t!=null&&t(e,n)?!0:An(e,r,i):!1}function An(e,t,n){return t!=null&&e.compare(t)<0||n!=null&&e.compare(n)>0}function LA(e,t,n){let r=e.subtract({days:1});return Nt(r,e)||An(r,t,n)}function DA(e,t,n){let r=e.add({days:1});return Nt(r,e)||An(r,t,n)}function Ju(e){let t=h({},e);for(let n in t)t[n]=1;return t}function uy(e,t){let n=h({},t);return n.days?n.days--:n.days=-1,e.add(n)}function gy(e){if(!e)return;let t=e.calendar.identifier;return t==="gregory"||t==="iso8601"?e.era==="BC"?"short":void 0:"short"}function py(e,t,n){let r=n!=null?n:Xt(nc(t));return new Yt(e,{weekday:"long",month:"long",year:"numeric",day:"numeric",era:gy(r),calendar:r.calendar.identifier,timeZone:t})}function Fv(e,t,n){let r=n!=null?n:nc(t);return new Yt(e,{month:"long",year:"numeric",era:gy(r),calendar:r.calendar.identifier,timeZone:t})}function FA(e,t,n,r,i){let a=n.formatRangeToParts(e.toDate(i),t.toDate(i)),o=-1;for(let c=0;co&&(l+=a[c].value);return r(s,l)}function ql(e,t,n,r){if(!e)return"";let i=e,a=t!=null?t:e,o=py(n,r);return Nt(i,a)?o.format(i.toDate(r)):FA(i,a,o,(s,l)=>`${s} \u2013 ${l}`,r)}function hy(e){return e!=null?MA[e]:void 0}function fy(e,t,n){let r=hy(n);return Lr(e,t,r)}function my(e,t,n,r){let i=t.add({weeks:e}),a=[],o=fy(i,n,r);for(;a.length<7;){a.push(o);let s=o.add({days:1});if(Nt(o,s))break;o=s}return a}function _A(e,t,n,r){let i=hy(r),a=n!=null?n:sA(e,t,i);return[...new Array(a).keys()].map(s=>my(s,e,t,r))}function $A(e,t){let n=new Yt(e,{weekday:"long",timeZone:t}),r=new Yt(e,{weekday:"short",timeZone:t}),i=new Yt(e,{weekday:"narrow",timeZone:t});return a=>{let o=a instanceof Date?a:a.toDate(t);return{value:a,short:r.format(o),long:n.format(o),narrow:i.format(o)}}}function HA(e,t,n,r){let i=fy(e,r,t),a=[...new Array(7).keys()],o=$A(r,n);return a.map(s=>o(i.add({days:s})))}function BA(e,t="long",n){if(!n||n.calendar.identifier==="gregory"||n.calendar.identifier==="iso8601"){let o=new Date(2021,0,1),s=[];for(let l=0;l<12;l++)s.push(o.toLocaleString(e,{month:t})),o.setMonth(o.getMonth()+1);return s}let r=n.calendar.getMonthsInYear(n),i=new Yt(e,{month:t,calendar:n.calendar.identifier}),a=[];for(let o=1;o<=r;o++){let s=n.set({month:o});a.push(i.format(s.toDate("UTC")))}return a}function Mv(e,t){let n=Lr(e,t,"mon"),r=n.year,i=n.set({month:1,day:4}),a=Lr(i,t,"mon"),o=n.calendar.toJulianDay(n),s=a.calendar.toJulianDay(a);if(o>=s)return 1+Math.floor((o-s)/7);let l=n.set({year:r-1,month:1,day:4}),c=Lr(l,t,"mon"),d=c.calendar.toJulianDay(c);return 1+Math.floor((o-d)/7)}function UA(e){let t=[];for(let n=e.from;n<=e.to;n+=1)t.push(n);return t}function WA(e,t,n){var o,s;let r=e.calendar,i=(o=t==null?void 0:t.year)!=null?o:Ze(new Dr(GA,1,1),r).year,a=(s=n==null?void 0:n.year)!=null?s:Ze(new Dr(qA,12,31),r).year;return{from:i,to:a}}function zA(e){if(e){if(e.length===3)return e.padEnd(4,"0");if(e.length===2){let t=new Date().getFullYear(),n=Math.floor(t/100)*100,r=parseInt(e.slice(-2),10),i=n+r;return i>t+KA?(i-100).toString():i.toString()}return e}}function fa(e,t){let n=t!=null&&t.strict?10:12,r=e-e%10,i=[];for(let a=0;a0?{startDate:hi(s,e,t,n,r),endDate:l,focusedDate:jt(s,n,r)}:{startDate:o,endDate:l,focusedDate:jt(s,n,r)}}}function vy(e,t,n,r,i,a){let o=Vo(n,r,i,a),s=t.add(n);return o({focusedDate:e.add(n),startDate:hi(Oo(e,s,n,r,i,a),n,r)})}function yy(e,t,n,r,i,a){let o=Vo(n,r,i,a),s=t.subtract(n);return o({focusedDate:e.subtract(n),startDate:hi(Oo(e,s,n,r,i,a),n,r)})}function jA(e,t,n,r,i,a,o){let s=Vo(r,i,a,o);if(!n&&!r.days)return s({focusedDate:e.add(Ju(r)),startDate:t});if(r.days)return vy(e,t,r,i,a,o);if(r.weeks)return s({focusedDate:e.add({months:1}),startDate:t});if(r.months||r.years)return s({focusedDate:e.add({years:1}),startDate:t})}function YA(e,t,n,r,i,a,o){let s=Vo(r,i,a,o);if(!n&&!r.days)return s({focusedDate:e.subtract(Ju(r)),startDate:t});if(r.days)return yy(e,t,r,i,a,o);if(r.weeks)return s({focusedDate:e.subtract({months:1}),startDate:t});if(r.months||r.years)return s({focusedDate:e.subtract({years:1}),startDate:t})}function JA(e,t,n){var c;let r=QA(t,n),{year:i,month:a,day:o}=(c=ex(r,e))!=null?c:{};if(i!=null||a!=null||o!=null){let d=new Date;i||(i=d.getFullYear().toString()),a||(a=(d.getMonth()+1).toString()),o||(o=d.getDate().toString())}if(_v(i)||(i=zA(i)),_v(i)&&XA(a)&&ZA(o))return new Dr(+i,+a,+o);let l=Date.parse(e);if(!isNaN(l)){let d=new Date(l);return new Dr(d.getFullYear(),d.getMonth()+1,d.getDate())}}function QA(e,t){return new Yt(e,{day:"numeric",month:"numeric",year:"numeric",timeZone:t}).formatToParts(new Date(2e3,11,25)).map(({type:i,value:a})=>i==="literal"?`${a}?`:`((?!=<${i}>)\\d+)?`).join("")}function ex(e,t){var r;let n=t.match(e);return(r=e.toString().match(/<(.+?)>/g))==null?void 0:r.map(i=>{var o;let a=i.match(/<(.+)>/);return!a||a.length<=0?null:(o=i.match(/<(.+)>/))==null?void 0:o[1]}).reduce((i,a,o)=>(a&&(n&&n.length>o?i[a]=n[o+1]:i[a]=null),i),{})}function $v(e,t,n){let r=ci(Kv(n));switch(e){case"thisWeek":return[Lr(r,t),xv(r,t)];case"thisMonth":return[Jn(r),r];case"thisQuarter":return[Jn(r).add({months:-((r.month-1)%3)}),r];case"thisYear":return[wo(r),r];case"last3Days":return[r.add({days:-2}),r];case"last7Days":return[r.add({days:-6}),r];case"last14Days":return[r.add({days:-13}),r];case"last30Days":return[r.add({days:-29}),r];case"last90Days":return[r.add({days:-89}),r];case"lastMonth":return[Jn(r.add({months:-1})),Lu(r.add({months:-1}))];case"lastQuarter":return[Jn(r.add({months:-((r.month-1)%3)-3})),Lu(r.add({months:-((r.month-1)%3)-1}))];case"lastWeek":return[Lr(r,t).add({weeks:-1}),xv(r,t).add({weeks:-1})];case"lastYear":return[wo(r.add({years:-1})),aA(r.add({years:-1}))];default:throw new Error(`Invalid date range preset: ${e}`)}}function $u(e){let[t,n]=e,r;return!t||!n?r=e:r=t.compare(n)<=0?e:[n,t],r}function ha(e,t){let[n,r]=t;return!n||!r?!1:n.compare(e)<=0&&r.compare(e)>=0}function Kl(e){return e.slice().filter(t=>t!=null).sort((t,n)=>t.compare(n))}function ux(e){return He(e,{year:"calendar decade",month:"calendar year",day:"calendar month"})}function px(e){return new Yt(e).formatToParts(new Date).map(t=>{var n;return(n=gx[t.type])!=null?n:t.value}).join("")}function fx(e){let r=new Intl.DateTimeFormat(e).formatToParts(new Date).find(i=>i.type==="literal");return r?r.value:"/"}function tr(e,t){return e?e==="day"?0:e==="month"?1:2:t||0}function Qu(e){return e===0?"day":e===1?"month":"year"}function eg(e,t,n){return Qu(Ae(tr(e,0),tr(t,0),tr(n,2)))}function vx(e,t){return tr(e,0)>tr(t,0)}function yx(e,t){return tr(e,0)e(t))}function Tx(e,t){let{state:n,context:r,prop:i,send:a,computed:o,scope:s}=e,l=r.get("startValue"),c=o("endValue"),d=r.get("value"),g=r.get("focusedValue"),p=r.get("hoveredValue"),u=p?$u([d[0],p]):[],f=!!i("disabled"),m=!!i("readOnly"),S=!!i("invalid"),T=o("isInteractive"),w=d.length===0,I=i("min"),P=i("max"),v=i("locale"),E=i("timeZone"),R=i("startOfWeek"),x=n.matches("focused"),C=n.matches("open"),A=i("selectionMode")==="range",N=i("selectionMode")==="multiple",k=i("isDateUnavailable"),L=i("maxSelectedDates"),K=N&&L!=null&&d.length>=L,J=r.get("currentPlacement"),ue=Gt(y(h({},i("positioning")),{placement:J})),Z=fx(v),ce=h(h({},mx),i("translations"));function ve(F=l){let D=i("fixedWeeks")?6:void 0;return _A(F,v,D,R)}function le(F={}){let{format:D}=F;return BA(v,D,g).map((_,U)=>{let Ee=U+1,rt=g.set({month:Ee}),We=An(rt,I,P);return{label:_,value:Ee,disabled:We}})}function De(){let F=WA(g,I,P);return UA(F).map(_=>({label:_.toString(),value:_,disabled:!Yi(_,I==null?void 0:I.year,P==null?void 0:P.year)}))}function Fe(F){return Dv(F,k,v,I,P)}function Qt(F){let D=l!=null?l:Co(E,g.calendar);a({type:"FOCUS.SET",value:D.set({month:F})})}function ts(F){let D=l!=null?l:Co(E,g.calendar);a({type:"FOCUS.SET",value:D.set({year:F})})}function Ri(F){let{value:D,disabled:_}=F,U=g.set({year:D}),rt=!fa(l.year,{strict:!0}).includes(D),We=Yi(D,I==null?void 0:I.year,P==null?void 0:P.year),dt=A&&ha(U,d),ar=A&&d[0]&&So(U,d[0]),ki=A&&d[1]&&So(U,d[1]),Wr=A&&u.length>0,Ni=Wr&&ha(U,u),or=Wr&&u[0]&&So(U,u[0]),sr=Wr&&u[1]&&So(U,u[1]),ns={focused:g.year===F.value,selectable:!rt&&We,outsideRange:rt,selected:!!d.find(rs=>rs&&rs.year===D),valueText:D.toString(),inRange:dt||Ni,firstInRange:!!ar,lastInRange:!!ki,inHoveredRange:!!Ni,firstInHoveredRange:!!or,lastInHoveredRange:!!sr,value:U,get disabled(){return _||!ns.selectable}};return ns}function Gr(F){let{value:D,disabled:_}=F,U=g.set({month:D}),Ee=Fv(v,E,g),rt=A&&ha(U,d),We=A&&d[0]&&Po(U,d[0]),dt=A&&d[1]&&Po(U,d[1]),ar=A&&u.length>0,ki=ar&&ha(U,u),Wr=ar&&u[0]&&Po(U,u[0]),Ni=ar&&u[1]&&Po(U,u[1]),or={focused:g.month===F.value,selectable:!An(U,I,P),selected:!!d.find(sr=>sr&&sr.month===D&&sr.year===g.year),valueText:Ee.format(U.toDate(E)),inRange:rt||ki,firstInRange:!!We,lastInRange:!!dt,inHoveredRange:!!ki,firstInHoveredRange:!!Wr,lastInHoveredRange:!!Ni,outsideRange:!1,value:U,get disabled(){return _||!or.selectable}};return or}function qr(F){let{value:D,disabled:_,visibleRange:U=o("visibleRange")}=F,Ee=py(v,E,g),rt=Ju(o("visibleDuration")),We=i("outsideDaySelectable"),dt=U.start.add(rt).subtract({days:1}),ar=An(D,U.start,dt),ki=A&&ha(D,d),Wr=A&&d[0]&&Nt(D,d[0]),Ni=A&&d[1]&&Nt(D,d[1]),or=A&&u.length>0,sr=or&&ha(D,u),ns=or&&u[0]&&Nt(D,u[0]),rs=or&&u[1]&&Nt(D,u[1]),yp=d.some(bp=>bp!=null&&Nt(D,bp)),is={invalid:An(D,I,P),disabled:_||!We&&ar||An(D,I,P)||K&&!yp,selected:yp,unavailable:Dv(D,k,v,I,P)&&!_,outsideRange:ar,today:tA(D,E),weekend:cA(D,v),value:D,valueText:Ee.format(D.toDate(E)),get focused(){return g!=null&&Nt(D,g)&&(!is.outsideRange||We)},get selectable(){return!is.disabled&&!is.unavailable},inRange:ki||sr,firstInRange:Wr,lastInRange:Ni,inHoveredRange:sr,firstInHoveredRange:ns,lastInHoveredRange:rs};return is}function Nc(F){let{view:D="day",id:_}=F;return[D,_].filter(Boolean).join(" ")}return{focused:x,open:C,disabled:f,invalid:S,readOnly:m,inline:!!i("inline"),numOfMonths:i("numOfMonths"),showWeekNumbers:!!i("showWeekNumbers"),selectionMode:i("selectionMode"),maxSelectedDates:L,isMaxSelected:K,view:r.get("view"),getRangePresetValue(F){return $v(F,v,E)},getWeekNumber(F){let D=F[0];return D?Mv(D,v):0},getDaysInWeek(F,D=l){return my(F,D,v,R)},getOffset(F){let D=l.add(F),_=c.add(F),U=Fv(v,E,g);return{visibleRange:{start:D,end:_},weeks:ve(D),visibleRangeText:{start:U.format(D.toDate(E)),end:U.format(_.toDate(E))}}},getMonthWeeks:ve,isUnavailable:Fe,weeks:ve(),weekDays:HA(l,R,E,v),visibleRangeText:o("visibleRangeText"),value:d,valueAsDate:d.filter(F=>F!=null).map(F=>F.toDate(E)),valueAsString:o("valueAsString"),focusedValue:g,focusedValueAsDate:g==null?void 0:g.toDate(E),focusedValueAsString:i("format")(g,{locale:v,timeZone:E}),visibleRange:o("visibleRange"),selectToday(){let F=jt(Co(E,g.calendar),I,P);a({type:"VALUE.SET",value:[F]})},setValue(F){let D=F.map(_=>jt(_,I,P));a({type:"VALUE.SET",value:D})},setTime(F,D=0){var Ee,rt,We,dt;let _=Array.from(d),U=_[D];U&&("hour"in U||(U=Xt(U)),U=U.set({hour:(Ee=F.hour)!=null?Ee:"hour"in U?U.hour:0,minute:(rt=F.minute)!=null?rt:"minute"in U?U.minute:0,second:(We=F.second)!=null?We:"second"in U?U.second:0,millisecond:(dt=F.millisecond)!=null?dt:"millisecond"in U?U.millisecond:0}),_[D]=jt(U,I,P),a({type:"VALUE.SET",value:_}))},clearValue(F={}){let{focus:D=!0}=F;a({type:"VALUE.CLEAR",focus:D})},setFocusedValue(F){a({type:"FOCUS.SET",value:F})},setOpen(F){i("inline")||n.matches("open")===F||a({type:F?"OPEN":"CLOSE"})},focusMonth:Qt,focusYear:ts,getYears:De,getMonths:le,getYearsGrid(F={}){let{columns:D=1}=F,_=fa(l.year,{strict:!0}).map(U=>({label:U.toString(),value:U,disabled:!Yi(U,I==null?void 0:I.year,P==null?void 0:P.year)}));return Ba(_,D)},getDecade(){let F=fa(l.year,{strict:!0});return{start:F.at(0),end:F.at(-1)}},getMonthsGrid(F={}){let{columns:D=1,format:_}=F;return Ba(le({format:_}),D)},format(F,D={month:"long",year:"numeric"}){return new Yt(v,y(h({},D),{calendar:F.calendar.identifier})).format(F.toDate(E))},setView(F){a({type:"VIEW.SET",view:F})},goToNext(){a({type:"GOTO.NEXT",view:r.get("view")})},goToPrev(){a({type:"GOTO.PREV",view:r.get("view")})},getRootProps(){return t.element(y(h({},Te.root.attrs),{dir:i("dir"),id:nx(s),"data-state":C?"open":"closed","data-disabled":b(f),"data-readonly":b(m),"data-empty":b(w)}))},getLabelProps(F={}){let{index:D=0}=F;return t.label(y(h({},Te.label.attrs),{id:tx(s,D),dir:i("dir"),htmlFor:Hv(s,D),"data-state":C?"open":"closed","data-index":D,"data-disabled":b(f),"data-readonly":b(m)}))},getControlProps(){return t.element(y(h({},Te.control.attrs),{dir:i("dir"),id:Ey(s),"data-disabled":b(f),"data-placeholder-shown":b(w)}))},getRangeTextProps(){return t.element(y(h({},Te.rangeText.attrs),{dir:i("dir")}))},getContentProps(){return t.element(y(h({},Te.content.attrs),{hidden:!C,dir:i("dir"),"data-state":C?"open":"closed","data-placement":J,"data-inline":b(i("inline")),id:_u(s),tabIndex:-1,role:"application","aria-roledescription":"datepicker","aria-label":ce.content}))},getTableProps(F={}){let{view:D="day",columns:_=D==="day"?7:4}=F,U=Nc(F);return t.element(y(h({},Te.table.attrs),{role:"grid","data-columns":_,"aria-roledescription":ux(D),id:rx(s,U),"aria-readonly":se(m),"aria-disabled":se(f),"aria-multiselectable":se(i("selectionMode")!=="single"),"data-view":D,dir:i("dir"),tabIndex:-1,onKeyDown(Ee){if(Ee.defaultPrevented)return;let We={Enter(){D==="day"&&Fe(g)||D==="month"&&!Gr({value:g.month}).selectable||D==="year"&&!Ri({value:g.year}).selectable||a({type:"TABLE.ENTER",view:D,columns:_,focus:!0})},ArrowLeft(){a({type:"TABLE.ARROW_LEFT",view:D,columns:_,focus:!0})},ArrowRight(){a({type:"TABLE.ARROW_RIGHT",view:D,columns:_,focus:!0})},ArrowUp(){a({type:"TABLE.ARROW_UP",view:D,columns:_,focus:!0})},ArrowDown(){a({type:"TABLE.ARROW_DOWN",view:D,columns:_,focus:!0})},PageUp(dt){a({type:"TABLE.PAGE_UP",larger:dt.shiftKey,view:D,columns:_,focus:!0})},PageDown(dt){a({type:"TABLE.PAGE_DOWN",larger:dt.shiftKey,view:D,columns:_,focus:!0})},Home(){a({type:"TABLE.HOME",view:D,columns:_,focus:!0})},End(){a({type:"TABLE.END",view:D,columns:_,focus:!0})}}[me(Ee,{dir:i("dir")})];We&&(We(Ee),Ee.preventDefault(),Ee.stopPropagation())},onPointerLeave(){a({type:"TABLE.POINTER_LEAVE"})},onPointerDown(){a({type:"TABLE.POINTER_DOWN",view:D})},onPointerUp(){a({type:"TABLE.POINTER_UP",view:D})}}))},getTableHeadProps(F={}){let{view:D="day"}=F;return t.element(y(h({},Te.tableHead.attrs),{"aria-hidden":!0,dir:i("dir"),"data-view":D,"data-disabled":b(f)}))},getTableHeaderProps(F={}){let{view:D="day"}=F;return t.element(y(h({},Te.tableHeader.attrs),{dir:i("dir"),"data-view":D,"data-disabled":b(f)}))},getTableBodyProps(F={}){let{view:D="day"}=F;return t.element(y(h({},Te.tableBody.attrs),{"data-view":D,"data-disabled":b(f)}))},getTableRowProps(F={}){let{view:D="day"}=F;return t.element(y(h({},Te.tableRow.attrs),{"aria-disabled":se(f),"data-disabled":b(f),"data-view":D}))},getWeekNumberHeaderCellProps(F={}){let{view:D="day"}=F;return t.element(y(h({},Te.tableCell.attrs),{scope:"col","aria-label":ce.weekColumnHeader,"data-view":D,"data-type":"week-number","data-disabled":b(f)}))},getWeekNumberCellProps(F){var Ee;let{weekIndex:D,week:_}=F,U=_[0]?Mv(_[0],v):0;return t.element(y(h({},Te.tableCell.attrs),{role:"rowheader","aria-label":(Ee=ce.weekNumberCell)==null?void 0:Ee.call(ce,U),"data-view":"day","data-week-index":D,"data-type":"week-number","data-disabled":b(f)}))},getDayTableCellState:qr,getDayTableCellProps(F){let{value:D}=F,_=qr(F);return t.element(y(h({},Te.tableCell.attrs),{role:"gridcell","aria-disabled":se(!_.selectable),"aria-selected":_.selected||_.inRange,"aria-invalid":se(_.invalid),"aria-current":_.today?"date":void 0,"data-value":D.toString()}))},getDayTableCellTriggerProps(F){let{value:D}=F,_=qr(F);return t.element(y(h({},Te.tableCellTrigger.attrs),{id:Ru(s,D.toString()),role:"button",dir:i("dir"),tabIndex:_.focused?0:-1,"aria-label":ce.dayCell(_),"aria-disabled":se(!_.selectable),"aria-invalid":se(_.invalid),"data-disabled":b(!_.selectable),"data-selected":b(_.selected),"data-value":D.toString(),"data-view":"day","data-today":b(_.today),"data-focus":b(_.focused),"data-unavailable":b(_.unavailable),"data-range-start":b(_.firstInRange),"data-range-end":b(_.lastInRange),"data-in-range":b(_.inRange),"data-outside-range":b(_.outsideRange),"data-weekend":b(_.weekend),"data-in-hover-range":b(_.inHoveredRange),"data-hover-range-start":b(_.firstInHoveredRange),"data-hover-range-end":b(_.lastInHoveredRange),onClick(U){U.defaultPrevented||_.selectable&&a({type:"CELL.CLICK",cell:"day",value:D})},onPointerMove:A?U=>{if(U.pointerType==="touch"||!_.selectable)return;let Ee=!s.isActiveElement(U.currentTarget);p&&eA(D,p)||a({type:"CELL.POINTER_MOVE",cell:"day",value:D,focus:Ee})}:void 0}))},getMonthTableCellState:Gr,getMonthTableCellProps(F){let{value:D,columns:_}=F,U=Gr(F);return t.element(y(h({},Te.tableCell.attrs),{dir:i("dir"),colSpan:_,role:"gridcell","aria-selected":se(U.selected||U.inRange),"data-selected":b(U.selected),"aria-disabled":se(!U.selectable),"data-value":D}))},getMonthTableCellTriggerProps(F){let{value:D}=F,_=Gr(F);return t.element(y(h({},Te.tableCellTrigger.attrs),{id:Ru(s,D.toString()),role:"button",dir:i("dir"),tabIndex:_.focused?0:-1,"aria-label":_.valueText,"aria-disabled":se(!_.selectable),"data-disabled":b(!_.selectable),"data-selected":b(_.selected),"data-value":D,"data-view":"month","data-focus":b(_.focused),"data-outside-range":b(_.outsideRange),"data-range-start":b(_.firstInRange),"data-range-end":b(_.lastInRange),"data-in-range":b(_.inRange),"data-in-hover-range":b(_.inHoveredRange),"data-hover-range-start":b(_.firstInHoveredRange),"data-hover-range-end":b(_.lastInHoveredRange),onClick(U){U.defaultPrevented||_.selectable&&a({type:"CELL.CLICK",cell:"month",value:D})},onPointerMove:A?U=>{if(U.pointerType==="touch"||!_.selectable)return;let Ee=!s.isActiveElement(U.currentTarget);p&&_.value&&Po(_.value,p)||a({type:"CELL.POINTER_MOVE",cell:"month",value:_.value,focus:Ee})}:void 0}))},getYearTableCellState:Ri,getYearTableCellProps(F){let{value:D,columns:_}=F,U=Ri(F);return t.element(y(h({},Te.tableCell.attrs),{dir:i("dir"),colSpan:_,role:"gridcell","aria-selected":se(U.selected||U.inRange),"data-selected":b(U.selected),"aria-disabled":se(!U.selectable),"data-value":D}))},getYearTableCellTriggerProps(F){let{value:D}=F,_=Ri(F);return t.element(y(h({},Te.tableCellTrigger.attrs),{id:Ru(s,D.toString()),role:"button",dir:i("dir"),tabIndex:_.focused?0:-1,"aria-label":_.valueText,"aria-disabled":se(!_.selectable),"data-disabled":b(!_.selectable),"data-selected":b(_.selected),"data-value":D,"data-view":"year","data-focus":b(_.focused),"data-outside-range":b(_.outsideRange),"data-range-start":b(_.firstInRange),"data-range-end":b(_.lastInRange),"data-in-range":b(_.inRange),"data-in-hover-range":b(_.inHoveredRange),"data-hover-range-start":b(_.firstInHoveredRange),"data-hover-range-end":b(_.lastInHoveredRange),onClick(U){U.defaultPrevented||_.selectable&&a({type:"CELL.CLICK",cell:"year",value:D})},onPointerMove:A?U=>{if(U.pointerType==="touch"||!_.selectable)return;let Ee=!s.isActiveElement(U.currentTarget);p&&_.value&&So(_.value,p)||a({type:"CELL.POINTER_MOVE",cell:"year",value:_.value,focus:Ee})}:void 0}))},getNextTriggerProps(F={}){let{view:D="day"}=F,_=f||!o("isNextVisibleRangeValid");return t.button(y(h({},Te.nextTrigger.attrs),{dir:i("dir"),id:ax(s,D),type:"button","aria-label":ce.nextTrigger(D),disabled:_,"data-disabled":b(_),onClick(U){U.defaultPrevented||a({type:"GOTO.NEXT",view:D})}}))},getPrevTriggerProps(F={}){let{view:D="day"}=F,_=f||!o("isPrevVisibleRangeValid");return t.button(y(h({},Te.prevTrigger.attrs),{dir:i("dir"),id:ix(s,D),type:"button","aria-label":ce.prevTrigger(D),disabled:_,"data-disabled":b(_),onClick(U){U.defaultPrevented||a({type:"GOTO.PREV",view:D})}}))},getClearTriggerProps(){return t.button(y(h({},Te.clearTrigger.attrs),{id:by(s),dir:i("dir"),type:"button","aria-label":ce.clearTrigger,hidden:!d.length,onClick(F){F.defaultPrevented||a({type:"VALUE.CLEAR"})}}))},getTriggerProps(){return t.button(y(h({},Te.trigger.attrs),{id:Py(s),dir:i("dir"),type:"button","data-placement":J,"aria-label":ce.trigger(C),"aria-controls":_u(s),"data-state":C?"open":"closed","data-placeholder-shown":b(w),"aria-haspopup":"grid",disabled:f,onClick(F){F.defaultPrevented||T&&a({type:"TRIGGER.CLICK"})}}))},getViewProps(F={}){let{view:D="day"}=F;return t.element(y(h({},Te.view.attrs),{"data-view":D,hidden:r.get("view")!==D}))},getViewTriggerProps(F={}){let{view:D="day"}=F;return t.button(y(h({},Te.viewTrigger.attrs),{"data-view":D,dir:i("dir"),id:ox(s,D),type:"button",disabled:f,"aria-label":ce.viewTrigger(D),onClick(_){_.defaultPrevented||T&&a({type:"VIEW.TOGGLE",src:"viewTrigger"})}}))},getViewControlProps(F={}){let{view:D="day"}=F;return t.element(y(h({},Te.viewControl.attrs),{"data-view":D,dir:i("dir")}))},getInputProps(F={}){let{index:D=0,fixOnBlur:_=!0}=F;return t.input(y(h({},Te.input.attrs),{id:Hv(s,D),autoComplete:"off",autoCorrect:"off",spellCheck:"false",dir:i("dir"),name:i("name"),"data-index":D,"data-state":C?"open":"closed","data-placeholder-shown":b(w),readOnly:m,disabled:f,required:i("required"),"aria-invalid":se(S),"data-invalid":b(S),placeholder:i("placeholder")||px(v),defaultValue:o("valueAsString")[D],onBeforeInput(U){let{data:Ee}=Ot(U);wy(Ee,Z)||U.preventDefault()},onClick(U){U.defaultPrevented||i("openOnClick")&&T&&a({type:"OPEN",src:"input.click"})},onFocus(){a({type:"INPUT.FOCUS",index:D})},onBlur(U){let Ee=U.currentTarget.value.trim();a({type:"INPUT.BLUR",value:Ee,index:D,fixOnBlur:_})},onKeyDown(U){if(U.defaultPrevented||!T)return;let rt={Enter(We){Me(We)||Fe(g)||We.currentTarget.value.trim()!==""&&a({type:"INPUT.ENTER",value:We.currentTarget.value,index:D})}}[U.key];rt&&(rt(U),U.preventDefault())},onInput(U){let Ee=U.currentTarget.value;a({type:"INPUT.CHANGE",value:hx(Ee,Z),index:D})}}))},getMonthSelectProps(){return t.select(y(h({},Te.monthSelect.attrs),{id:Iy(s),"aria-label":ce.monthSelect,disabled:f,dir:i("dir"),defaultValue:l.month,onChange(F){Qt(Number(F.currentTarget.value))}}))},getYearSelectProps(){return t.select(y(h({},Te.yearSelect.attrs),{id:Ty(s),disabled:f,"aria-label":ce.yearSelect,dir:i("dir"),defaultValue:l.year,onChange(F){ts(Number(F.currentTarget.value))}}))},getPositionerProps(){return t.element(y(h({id:Sy(s)},Te.positioner.attrs),{dir:i("dir"),style:ue.floating}))},getPresetTriggerProps(F){let D=Array.isArray(F.value)?F.value:$v(F.value,v,E),_=D.filter(U=>U!=null).map(U=>U.toDate(E).toDateString());return t.button(y(h({},Te.presetTrigger.attrs),{"aria-label":ce.presetTrigger(_),type:"button",onClick(U){U.defaultPrevented||a({type:"PRESET.CLICK",value:D})}}))}}}function Cx(e,t){if((e==null?void 0:e.length)!==(t==null?void 0:t.length))return!1;let n=Math.max(e.length,t.length);for(let r=0;rn==null?"":t("format")(n,{locale:t("locale"),timeZone:t("timeZone")}))}function Re(e,t){let{context:n,prop:r,computed:i}=e;if(!t)return;let a=Zl(e,t);if(Nr(n.get("focusedValue"),a))return;let s=Vo(i("visibleDuration"),r("locale"),r("min"),r("max"))({focusedDate:a,startDate:n.get("startValue")});n.set("startValue",s.startDate),n.set("focusedValue",s.focusedDate)}function jl(e,t){let{context:n}=e;n.set("startValue",t.startDate);let r=n.get("focusedValue");Nr(r,t.focusedDate)||n.set("focusedValue",t.focusedDate)}function zt(e){return Array.isArray(e)?e.map(t=>zt(t)):e instanceof Date?new Dr(e.getFullYear(),e.getMonth()+1,e.getDate()):TA(e)}function Vx(e){let t={};return e.content&&(t.content=e.content),e.monthSelect&&(t.monthSelect=e.monthSelect),e.yearSelect&&(t.yearSelect=e.yearSelect),e.clearTrigger&&(t.clearTrigger=e.clearTrigger),e.weekColumnHeader&&(t.weekColumnHeader=e.weekColumnHeader),e.weekNumber&&(t.weekNumberCell=n=>Ox(e.weekNumber,n)),e.openCalendar&&e.closeCalendar&&(t.trigger=n=>n?e.closeCalendar:e.openCalendar),(e.viewTriggerDay||e.viewTriggerMonth||e.viewTriggerYear)&&(t.viewTrigger=n=>Nu(n,e.viewTriggerDay,e.viewTriggerMonth,e.viewTriggerYear)),(e.prevTriggerDay||e.prevTriggerMonth||e.prevTriggerYear)&&(t.prevTrigger=n=>Nu(n,e.prevTriggerDay,e.prevTriggerMonth,e.prevTriggerYear)),(e.nextTriggerDay||e.nextTriggerMonth||e.nextTriggerYear)&&(t.nextTrigger=n=>Nu(n,e.nextTriggerDay,e.nextTriggerMonth,e.nextTriggerYear)),e.placeholderDay&&e.placeholderMonth&&e.placeholderYear&&(t.placeholder=()=>({day:e.placeholderDay,month:e.placeholderMonth,year:e.placeholderYear})),t}function Ax(e,t,n){if(n==="range"||e.querySelector('[data-scope="date-picker"][data-part="label"]'))return;let r=null,i=e.dataset.translation;if(i)try{r=JSON.parse(i)}catch(o){r=null}let a=r==null?void 0:r.input;if(a)for(let o of t)o.getAttribute("aria-labelledby")||o.setAttribute("aria-label",a)}function Rx(e){return typeof e=="object"&&e!==null&&"year"in e&&"month"in e&&"day"in e&&typeof e.year=="number"&&typeof e.month=="number"&&typeof e.day=="number"}function Oy(e){if(e==null)return"";if(typeof e=="string"){let t=e.trim();if(t==="")return"";try{return zt(t).toString()}catch(n){return t}}if(Rx(e)){let{year:t,month:n,day:r}=e,i=String(n).padStart(2,"0"),a=String(r).padStart(2,"0");return`${t}-${i}-${a}`}return String(e)}function ec(e){return e!=null&&e.length?e.map(t=>Oy(t)).filter(Boolean):[]}function kx(e){let t=e.querySelector('[data-scope="date-picker"][data-part="value-input"]');return t!=null&&t.value?t.value.split(",").map(n=>n.trim()).filter(Boolean):[]}function Hu(e,t,n){if(n!=null)return n;let r=ec(t);if(r.length>0)return r;let i=kx(e);return i.length>0?i:Wi(e,"value")}function Bu(e,t){let n=ec(e.api.value);return n.length>0?n:t.length===0?[]:(e.api.setValue(t.map(r=>zt(r))),ec(e.api.value))}function Jl(e,t,n=!1){let r=e.querySelector('[data-scope="date-picker"][data-part="value-input"]');r&&(r.value!==t&&(r.value=t),n?yt(r,t):yt(r,t,{markUsed:!1}))}function Gv(e){let t=e.dataset.translation;if(!t)return{};try{let n=JSON.parse(t);return{translations:Vx(n)}}catch(n){return{}}}function Uu(e){return O(e,"closeOnSelect")}var jV,Te,qv,XV,ma,ZV,nA,Cu,iA,Rv,wu,lA,kv,Nv,Io,PA,SA,IA,nH,Gu,di,Dr,qu,ui,VA,Wu,gi,cy,Vu,Yt,AA,Au,xu,MA,GA,qA,KA,_v,XA,ZA,tx,nx,rx,_u,Ru,ix,ax,ox,by,Ey,Hv,Py,Sy,Iy,Ty,Bv,Wl,Xl,To,sx,lx,cx,dx,Cy,gx,wy,Uv,hx,mx,Px,Ix,Pt,wx,Zl,ku,Nu,Ox,xx,Nx,Ay=ee(()=>{"use strict";Eo();Bt();bl();ii();Or();on();ai();Kt();xr();$e();be();oe();jV=z("date-picker").parts("clearTrigger","content","control","input","label","monthSelect","nextTrigger","positioner","presetTrigger","prevTrigger","rangeText","root","table","tableBody","tableCell","tableCellTrigger","tableHead","tableHeader","tableRow","trigger","view","viewControl","viewTrigger","yearSelect"),Te=jV.build();qv=1721426;XV={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]},ma=class{fromJulianDay(e){let t=e,n=t-qv,r=Math.floor(n/146097),i=Tu(n,146097),a=Math.floor(i/36524),o=Tu(i,36524),s=Math.floor(o/1461),l=Tu(o,1461),c=Math.floor(l/365),d=r*400+a*100+s*4+c+(a!==4&&c!==4?1:0),[g,p]=YV(d),u=t-Ul(g,p,1,1),f=2;t= start date");return`${this.formatter.format(e)} \u2013 ${this.formatter.format(t)}`}formatRangeToParts(e,t){if(typeof this.formatter.formatRangeToParts=="function")return this.formatter.formatRangeToParts(e,t);if(t= start date");let n=this.formatter.formatToParts(e),r=this.formatter.formatToParts(t);return[...n.map(i=>y(h({},i),{source:"startRange"})),{type:"literal",value:" \u2013 ",source:"shared"},...r.map(i=>y(h({},i),{source:"endRange"}))]}resolvedOptions(){let e=this.formatter.resolvedOptions();return RA()&&(this.resolvedHourCycle||(this.resolvedHourCycle=kA(e.locale,this.options)),e.hourCycle=this.resolvedHourCycle,e.hour12=this.resolvedHourCycle==="h11"||this.resolvedHourCycle==="h12"),e.calendar==="ethiopic-amete-alem"&&(e.calendar="ethioaa"),e}},AA={true:{ja:"h11"},false:{}};Au=null;xu=null;MA=["sun","mon","tue","wed","thu","fri","sat"];GA=1900,qA=2099;KA=10;_v=e=>e!=null&&e.length===4,XA=e=>e!=null&&parseFloat(e)<=12,ZA=e=>e!=null&&parseFloat(e)<=31;tx=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.label)==null?void 0:r.call(n,t))!=null?i:`datepicker:${e.id}:label:${t}`},nx=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`datepicker:${e.id}`},rx=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.table)==null?void 0:r.call(n,t))!=null?i:`datepicker:${e.id}:table:${t}`},_u=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`datepicker:${e.id}:content`},Ru=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.cellTrigger)==null?void 0:r.call(n,t))!=null?i:`datepicker:${e.id}:cell-trigger:${t}`},ix=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.prevTrigger)==null?void 0:r.call(n,t))!=null?i:`datepicker:${e.id}:prev:${t}`},ax=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.nextTrigger)==null?void 0:r.call(n,t))!=null?i:`datepicker:${e.id}:next:${t}`},ox=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.viewTrigger)==null?void 0:r.call(n,t))!=null?i:`datepicker:${e.id}:view:${t}`},by=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.clearTrigger)!=null?n:`datepicker:${e.id}:clear`},Ey=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`datepicker:${e.id}:control`},Hv=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.input)==null?void 0:r.call(n,t))!=null?i:`datepicker:${e.id}:input:${t}`},Py=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`datepicker:${e.id}:trigger`},Sy=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`datepicker:${e.id}:positioner`},Iy=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.monthSelect)!=null?n:`datepicker:${e.id}:month-select`},Ty=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.yearSelect)!=null?n:`datepicker:${e.id}:year-select`},Bv=(e,t)=>fr(Xl(e),`[data-part=table-cell-trigger][data-view=${t}][data-focus]:not([data-outside-range])`),Wl=e=>e.getById(Py(e)),Xl=e=>e.getById(_u(e)),To=e=>Oe(Cy(e),"[data-part=input]"),sx=e=>e.getById(Ty(e)),lx=e=>e.getById(Iy(e)),cx=e=>e.getById(by(e)),dx=e=>e.getById(Sy(e)),Cy=e=>e.getById(Ey(e));gx={day:"dd",month:"mm",year:"yyyy"};wy=(e,t)=>e?/\d/.test(e)||e===t||e.length!==1:!0,Uv=e=>!Number.isNaN(e.day)&&!Number.isNaN(e.month)&&!Number.isNaN(e.year),hx=(e,t)=>e.split("").filter(n=>wy(n,t)).join("");mx={dayCell(e){return e.unavailable?`Not available. ${e.valueText}`:e.firstInRange?`Starting range from ${e.valueText}`:e.lastInRange?`Range ending at ${e.valueText}`:e.selected?`Selected date. ${e.valueText}`:`Choose ${e.valueText}`},trigger(e){return e?"Close calendar":"Open calendar"},viewTrigger(e){return He(e,{year:"Switch to month view",month:"Switch to day view",day:"Switch to year view"})},presetTrigger(e){let[t="",n=""]=e;return`select ${t} to ${n}`},prevTrigger(e){return He(e,{year:"Switch to previous decade",month:"Switch to previous year",day:"Switch to previous month"})},nextTrigger(e){return He(e,{year:"Switch to next decade",month:"Switch to next year",day:"Switch to next month"})},placeholder(){return{day:"dd",month:"mm",year:"yyyy"}},content:"calendar",monthSelect:"Select month",yearSelect:"Select year",clearTrigger:"Clear selected dates",weekColumnHeader:"Wk",weekNumberCell(e){return`Week ${e}`}};Px=["day","month","year"];Ix=Vn(e=>[e.view,e.startValue.toString(),e.endValue.toString(),e.locale],([e],t)=>{let{startValue:n,endValue:r,locale:i,timeZone:a,selectionMode:o}=t;if(e==="year"){let g=fa(n.year,{strict:!0}),p=g.at(0).toString(),u=g.at(-1).toString();return{start:p,end:u,formatted:`${p} - ${u}`}}if(e==="month"){let g=new Yt(i,{year:"numeric",timeZone:a,calendar:n.calendar.identifier}),p=g.format(n.toDate(a)),u=g.format(r.toDate(a)),f=o==="range"?`${p} - ${u}`:p;return{start:p,end:u,formatted:f}}let s=new Yt(i,{month:"long",year:"numeric",timeZone:a,calendar:n.calendar.identifier}),l=s.format(n.toDate(a)),c=s.format(r.toDate(a)),d=o==="range"?`${l} - ${c}`:l;return{start:l,end:c,formatted:d}});({and:Pt}=we());wx=te({props({props:e}){let t=e.locale||"en-US",n=e.timeZone||"UTC",r=e.selectionMode||"single",i=e.numOfMonths||1,a;if(e.createCalendar){let f=new Intl.DateTimeFormat(t).resolvedOptions().calendar;f!=="gregory"&&f!=="iso8601"&&(a=e.createCalendar(f))}let o=u=>!a||u.calendar.identifier===a.identifier?u:Ze(u,a),s=e.defaultValue?Kl(e.defaultValue).map(u=>jt(o(u),e.min,e.max)):void 0,l=e.value?Kl(e.value).map(u=>jt(o(u),e.min,e.max)):void 0,c=e.focusedValue||e.defaultFocusedValue||(l==null?void 0:l[0])||(s==null?void 0:s[0])||Co(n,a);c=jt(o(c),e.min,e.max);let d="day",g="year",p=eg(e.view||d,d,g);return y(h({locale:t,numOfMonths:i,timeZone:n,selectionMode:r,defaultView:p,minView:d,maxView:g,outsideDaySelectable:!1,closeOnSelect:!0,format(u,{locale:f,timeZone:m}){return new Yt(f,{timeZone:m,day:"2-digit",month:"2-digit",year:"numeric",calendar:a==null?void 0:a.identifier}).format(u.toDate(m))},parse(u,{locale:f,timeZone:m}){return JA(u,f,m)}},e),{focusedValue:typeof e.focusedValue=="undefined"?void 0:c,defaultFocusedValue:c,value:l,defaultValue:s!=null?s:[],positioning:h({placement:"bottom"},e.positioning)})},initialState({prop:e}){return e("open")||e("defaultOpen")||e("inline")?"open":"idle"},refs(){return{announcer:void 0}},context({prop:e,bindable:t,getContext:n}){return{focusedValue:t(()=>({defaultValue:e("defaultFocusedValue"),value:e("focusedValue"),isEqual:Nr,hash:r=>r.toString(),sync:!0,onChange(r){var l;let i=n(),a=i.get("view"),o=i.get("value"),s=zl(o,e);(l=e("onFocusChange"))==null||l({value:o,valueAsString:s,view:a,focusedValue:r})}})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:Cx,hash:r=>r.map(i=>{var a;return(a=i==null?void 0:i.toString())!=null?a:""}).join(","),onChange(r){var o;let i=n(),a=zl(r,e);(o=e("onValueChange"))==null||o({value:r,valueAsString:a,view:i.get("view")})}})),inputValue:t(()=>({defaultValue:""})),activeIndex:t(()=>({defaultValue:0,sync:!0})),hoveredValue:t(()=>({defaultValue:null,isEqual:Nr})),view:t(()=>({defaultValue:e("defaultView"),value:e("view"),onChange(r){var i;(i=e("onViewChange"))==null||i({view:r})}})),startValue:t(()=>{let r=e("focusedValue")||e("defaultFocusedValue");return{defaultValue:Lv(r,"start",{months:e("numOfMonths")},e("locale")),isEqual:Nr,hash:i=>i.toString()}}),currentPlacement:t(()=>({defaultValue:void 0})),restoreFocus:t(()=>({defaultValue:!1}))}},computed:{isInteractive:({prop:e})=>!e("disabled")&&!e("readOnly"),visibleDuration:({prop:e})=>({months:e("numOfMonths")}),endValue:({context:e,computed:t})=>uy(e.get("startValue"),t("visibleDuration")),visibleRange:({context:e,computed:t})=>({start:e.get("startValue"),end:t("endValue")}),visibleRangeText:({context:e,prop:t,computed:n})=>Ix({view:e.get("view"),startValue:e.get("startValue"),endValue:n("endValue"),locale:t("locale"),timeZone:t("timeZone"),selectionMode:t("selectionMode")}),isPrevVisibleRangeValid:({context:e,prop:t})=>!LA(e.get("startValue"),t("min"),t("max")),isNextVisibleRangeValid:({prop:e,computed:t})=>!DA(t("endValue"),e("min"),e("max")),valueAsString:({context:e,prop:t})=>zl(e.get("value"),t)},effects:["setupLiveRegion"],watch({track:e,prop:t,context:n,action:r,computed:i}){e([()=>t("locale")],()=>{r(["setStartValue","syncInputElement"])}),e([()=>n.hash("focusedValue")],()=>{r(["setStartValue","focusActiveCellIfNeeded","setHoveredValueIfKeyboard"])}),e([()=>n.hash("startValue")],()=>{r(["syncMonthSelectElement","syncYearSelectElement","invokeOnVisibleRangeChange"])}),e([()=>n.get("inputValue")],()=>{r(["syncInputValue"])}),e([()=>n.hash("value")],()=>{r(["syncInputElement"])}),e([()=>i("valueAsString").toString()],()=>{r(["announceValueText"])}),e([()=>n.get("view")],()=>{r(["focusActiveCell"])}),e([()=>t("open")],()=>{r(["toggleVisibility"])})},on:{"VALUE.SET":{actions:["setDateValue","setFocusedDate"]},"VIEW.SET":{actions:["setView"]},"FOCUS.SET":{actions:["setFocusedDate"]},"VALUE.CLEAR":{actions:["clearDateValue","clearFocusedDate","focusFirstInputElement"]},"INPUT.CHANGE":[{guard:"isInputValueEmpty",actions:["setInputValue","clearDateValue","clearFocusedDate"]},{actions:["setInputValue","focusParsedDate"]}],"INPUT.ENTER":{actions:["focusParsedDate","selectFocusedDate"]},"INPUT.FOCUS":{actions:["setActiveIndex"]},"INPUT.BLUR":[{guard:"shouldFixOnBlur",actions:["setActiveIndexToStart","selectParsedDate"]},{actions:["setActiveIndexToStart"]}],"PRESET.CLICK":[{guard:"isOpenControlled",actions:["setDateValue","setFocusedDate","invokeOnClose"]},{target:"focused",actions:["setDateValue","setFocusedDate","focusInputElement"]}],"GOTO.NEXT":[{guard:"isYearView",actions:["focusNextDecade","announceVisibleRange"]},{guard:"isMonthView",actions:["focusNextYear","announceVisibleRange"]},{actions:["focusNextPage"]}],"GOTO.PREV":[{guard:"isYearView",actions:["focusPreviousDecade","announceVisibleRange"]},{guard:"isMonthView",actions:["focusPreviousYear","announceVisibleRange"]},{actions:["focusPreviousPage"]}]},states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["focusFirstSelectedDate","focusActiveCell"]},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}]}},focused:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["focusFirstSelectedDate","focusActiveCell"]},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}]}},open:{tags:["open"],effects:["trackDismissableElement","trackPositioning"],exit:["clearHoveredDate","resetView"],on:{"CONTROLLED.CLOSE":[{guard:Pt("shouldRestoreFocus","isInteractOutsideEvent"),target:"focused",actions:["focusTriggerElement"]},{guard:"shouldRestoreFocus",target:"focused",actions:["focusInputElement"]},{target:"idle"}],"CELL.CLICK":[{guard:"isAboveMinView",actions:["setFocusedValueForView","setPreviousView"]},{guard:Pt("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","resetSelection","setActiveIndexToEnd"]},{guard:Pt("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","setRestoreFocus"]},{guard:Pt("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","focusInputElement"]},{guard:Pt("isRangePicker","isSelectingEndDate"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setFocusedDate","setSelectedDate","setActiveIndexToEnd"]},{guard:Pt("isMultiPicker","canSelectDate"),actions:["setFocusedDate","toggleSelectedDate"]},{guard:"isMultiPicker",actions:["setFocusedDate"]},{guard:Pt("closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["setFocusedDate","setSelectedDate","invokeOnClose","focusInputElement"]},{actions:["setFocusedDate","setSelectedDate"]}],"CELL.POINTER_MOVE":{guard:Pt("isRangePicker","isSelectingEndDate"),actions:["setHoveredDate","setFocusedDate"]},"TABLE.POINTER_LEAVE":{guard:"isRangePicker",actions:["clearHoveredDate"]},"TABLE.POINTER_DOWN":{actions:["disableTextSelection"]},"TABLE.POINTER_UP":{actions:["enableTextSelection"]},"TABLE.ESCAPE":[{guard:"isOpenControlled",actions:["focusFirstSelectedDate","invokeOnClose"]},{target:"focused",actions:["focusFirstSelectedDate","invokeOnClose","focusTriggerElement"]}],"TABLE.ENTER":[{guard:"isAboveMinView",actions:["setPreviousView"]},{guard:Pt("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","clearDateValue","setSelectedDate","setActiveIndexToEnd"]},{guard:Pt("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose"]},{guard:Pt("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","focusInputElement"]},{guard:Pt("isRangePicker","isSelectingEndDate"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setSelectedDate","setActiveIndexToEnd","focusNextDay"]},{guard:Pt("isMultiPicker","canSelectDate"),actions:["toggleSelectedDate"]},{guard:"isMultiPicker"},{guard:Pt("closeOnSelect","isOpenControlled"),actions:["selectFocusedDate","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectFocusedDate","invokeOnClose","focusInputElement"]},{actions:["selectFocusedDate"]}],"TABLE.ARROW_RIGHT":[{guard:"isMonthView",actions:["focusNextMonth"]},{guard:"isYearView",actions:["focusNextYear"]},{actions:["focusNextDay","setHoveredDate"]}],"TABLE.ARROW_LEFT":[{guard:"isMonthView",actions:["focusPreviousMonth"]},{guard:"isYearView",actions:["focusPreviousYear"]},{actions:["focusPreviousDay"]}],"TABLE.ARROW_UP":[{guard:"isMonthView",actions:["focusPreviousMonthColumn"]},{guard:"isYearView",actions:["focusPreviousYearColumn"]},{actions:["focusPreviousWeek"]}],"TABLE.ARROW_DOWN":[{guard:"isMonthView",actions:["focusNextMonthColumn"]},{guard:"isYearView",actions:["focusNextYearColumn"]},{actions:["focusNextWeek"]}],"TABLE.PAGE_UP":{actions:["focusPreviousSection"]},"TABLE.PAGE_DOWN":{actions:["focusNextSection"]},"TABLE.HOME":[{guard:"isMonthView",actions:["focusFirstMonth"]},{guard:"isYearView",actions:["focusFirstYear"]},{actions:["focusSectionStart"]}],"TABLE.END":[{guard:"isMonthView",actions:["focusLastMonth"]},{guard:"isYearView",actions:["focusLastYear"]},{actions:["focusSectionEnd"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose"]}],"VIEW.TOGGLE":{actions:["setNextView"]},INTERACT_OUTSIDE:[{guard:"isOpenControlled",actions:["setActiveIndexToStart","invokeOnClose"]},{guard:"shouldRestoreFocus",target:"focused",actions:["setActiveIndexToStart","invokeOnClose","focusTriggerElement"]},{target:"idle",actions:["setActiveIndexToStart","invokeOnClose"]}],CLOSE:[{guard:"isOpenControlled",actions:["setActiveIndexToStart","invokeOnClose"]},{target:"idle",actions:["setActiveIndexToStart","invokeOnClose"]}]}}},implementations:{guards:{isAboveMinView:({context:e,prop:t})=>vx(e.get("view"),t("minView")),isDayView:({context:e,event:t})=>(t.view||e.get("view"))==="day",isMonthView:({context:e,event:t})=>(t.view||e.get("view"))==="month",isYearView:({context:e,event:t})=>(t.view||e.get("view"))==="year",isRangePicker:({prop:e})=>e("selectionMode")==="range",hasSelectedRange:({context:e})=>e.get("value").length===2,isMultiPicker:({prop:e})=>e("selectionMode")==="multiple",canSelectDate:({context:e,prop:t,event:n})=>{var s;let r=t("maxSelectedDates");if(r==null)return!0;let i=e.get("value"),a=(s=n.value)!=null?s:e.get("focusedValue");return i.some(l=>Nr(l,a))?!0:i.length!!e.get("restoreFocus"),isSelectingEndDate:({context:e})=>e.get("activeIndex")===1,closeOnSelect:({prop:e})=>!!e("closeOnSelect"),isOpenControlled:({prop:e})=>e("open")!=null||!!e("inline"),isInteractOutsideEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="INTERACT_OUTSIDE"},isInputValueEmpty:({event:e})=>e.value.trim()==="",shouldFixOnBlur:({event:e})=>!!e.fixOnBlur},effects:{trackPositioning({context:e,prop:t,scope:n}){if(t("inline"))return;e.get("currentPlacement")||e.set("currentPlacement",t("positioning").placement);let r=Cy(n);return Xe(r,()=>dx(n),y(h({},t("positioning")),{defer:!0,onComplete(a){e.set("currentPlacement",a.placement)}}))},setupLiveRegion({scope:e,refs:t}){let n=e.getDoc();return t.set("announcer",Qi({level:"assertive",document:n})),()=>{var r,i;return(i=(r=t.get("announcer"))==null?void 0:r.destroy)==null?void 0:i.call(r)}},trackDismissableElement({scope:e,send:t,context:n,prop:r}){return r("inline")?void 0:qt(()=>Xl(e),{type:"popover",defer:!0,exclude:[...To(e),Wl(e),cx(e)],onInteractOutside(a){n.set("restoreFocus",!a.detail.focusable)},onDismiss(){t({type:"INTERACT_OUTSIDE"})},onEscapeKeyDown(a){a.preventDefault(),t({type:"TABLE.ESCAPE",src:"dismissable"})}})}},actions:{setNextView({context:e,prop:t}){let n=bx(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setPreviousView({context:e,prop:t}){let n=Ex(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setView({context:e,event:t}){e.set("view",t.view)},setRestoreFocus({context:e}){e.set("restoreFocus",!0)},announceValueText({context:e,prop:t,refs:n}){var s;let r=e.get("value"),i=t("locale"),a=t("timeZone"),o;if(t("selectionMode")==="range"){let[l,c]=r;l&&c?o=ql(l,c,i,a):l?o=ql(l,null,i,a):c?o=ql(c,null,i,a):o=""}else o=r.map(l=>ql(l,null,i,a)).filter(Boolean).join(",");(s=n.get("announcer"))==null||s.announce(o,3e3)},announceVisibleRange({computed:e,refs:t}){var r;let{formatted:n}=e("visibleRangeText");(r=t.get("announcer"))==null||r.announce(n)},disableTextSelection({scope:e}){Za({target:Xl(e),doc:e.getDoc()})},enableTextSelection({scope:e}){ud({doc:e.getDoc(),target:Xl(e)})},focusFirstSelectedDate(e){let{context:t}=e;t.get("value").length&&Re(e,t.get("value")[0])},syncInputElement({scope:e,computed:t}){B(()=>{To(e).forEach((r,i)=>{_e(r,t("valueAsString")[i]||"")})})},setFocusedDate(e){let{event:t}=e,n=Array.isArray(t.value)?t.value[0]:t.value;Re(e,n)},setFocusedValueForView(e){let{context:t,event:n}=e;Re(e,t.get("focusedValue").set({[t.get("view")]:n.value}))},focusNextMonth(e){let{context:t}=e;Re(e,t.get("focusedValue").add({months:1}))},focusPreviousMonth(e){let{context:t}=e;Re(e,t.get("focusedValue").subtract({months:1}))},setDateValue({context:e,event:t,prop:n}){if(!Array.isArray(t.value))return;let r=t.value.map(i=>jt(i,n("min"),n("max")));e.set("value",r)},clearDateValue({context:e}){e.set("value",[])},setSelectedDate(e){var s;let{context:t,event:n}=e,r=Array.from(t.get("value")),i=t.get("activeIndex"),a=r[i],o=Zl(e,(s=n.value)!=null?s:t.get("focusedValue"));r[i]=ku(a,o),t.set("value",$u(r))},resetSelection(e){var a;let{context:t,event:n}=e,r=t.get("value")[0],i=Zl(e,(a=n.value)!=null?a:t.get("focusedValue"));t.set("value",[ku(r,i)])},toggleSelectedDate(e){var o;let{context:t,event:n}=e,r=Zl(e,(o=n.value)!=null?o:t.get("focusedValue")),i=t.get("value"),a=i.findIndex(s=>Nr(s,r));if(a===-1){let s=[...i,r];t.set("value",Kl(s))}else{let s=Array.from(i);s.splice(a,1),t.set("value",Kl(s))}},setHoveredDate({context:e,event:t}){e.set("hoveredValue",t.value)},clearHoveredDate({context:e}){e.set("hoveredValue",null)},selectFocusedDate({context:e,computed:t}){let n=Array.from(e.get("value")),r=e.get("activeIndex"),i=n[r],a=e.get("focusedValue").copy();n[r]=ku(i,a),e.set("value",$u(n));let o=t("valueAsString");e.set("inputValue",o[r])},focusPreviousDay(e){let{context:t}=e,n=t.get("focusedValue").subtract({days:1});Re(e,n)},focusNextDay(e){let{context:t}=e,n=t.get("focusedValue").add({days:1});Re(e,n)},focusPreviousWeek(e){let{context:t}=e,n=t.get("focusedValue").subtract({weeks:1});Re(e,n)},focusNextWeek(e){let{context:t}=e,n=t.get("focusedValue").add({weeks:1});Re(e,n)},focusNextPage(e){let{context:t,computed:n,prop:r}=e,i=vy(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),r("locale"),r("min"),r("max"));jl(e,i)},focusPreviousPage(e){let{context:t,computed:n,prop:r}=e,i=yy(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),r("locale"),r("min"),r("max"));jl(e,i)},focusSectionStart(e){let{context:t}=e;Re(e,t.get("startValue").copy())},focusSectionEnd(e){let{computed:t}=e;Re(e,t("endValue").copy())},focusNextSection(e){let{context:t,event:n,computed:r,prop:i}=e,a=jA(t.get("focusedValue"),t.get("startValue"),n.larger,r("visibleDuration"),i("locale"),i("min"),i("max"));a&&jl(e,a)},focusPreviousSection(e){let{context:t,event:n,computed:r,prop:i}=e,a=YA(t.get("focusedValue"),t.get("startValue"),n.larger,r("visibleDuration"),i("locale"),i("min"),i("max"));a&&jl(e,a)},focusNextYear(e){let{context:t}=e,n=t.get("focusedValue").add({years:1});Re(e,n)},focusPreviousYear(e){let{context:t}=e,n=t.get("focusedValue").subtract({years:1});Re(e,n)},focusNextDecade(e){let{context:t}=e,n=t.get("focusedValue").add({years:10});Re(e,n)},focusPreviousDecade(e){let{context:t}=e,n=t.get("focusedValue").subtract({years:10});Re(e,n)},clearFocusedDate(e){let{context:t,prop:n}=e,r=t.get("focusedValue").calendar;Re(e,Co(n("timeZone"),r))},focusPreviousMonthColumn(e){let{context:t,event:n}=e,r=t.get("focusedValue").subtract({months:n.columns});Re(e,r)},focusNextMonthColumn(e){let{context:t,event:n}=e,r=t.get("focusedValue").add({months:n.columns});Re(e,r)},focusPreviousYearColumn(e){let{context:t,event:n}=e,r=t.get("focusedValue").subtract({years:n.columns});Re(e,r)},focusNextYearColumn(e){let{context:t,event:n}=e,r=t.get("focusedValue").add({years:n.columns});Re(e,r)},focusFirstMonth(e){var i,a,o;let{context:t}=e,n=t.get("focusedValue"),r=(o=(a=(i=n.calendar).getMinimumMonthInYear)==null?void 0:a.call(i,n))!=null?o:1;Re(e,n.set({month:r}))},focusLastMonth(e){let{context:t}=e,n=t.get("focusedValue"),r=n.calendar.getMonthsInYear(n);Re(e,n.set({month:r}))},focusFirstYear(e){let{context:t}=e,n=fa(t.get("focusedValue").year),r=t.get("focusedValue").set({year:n[0]});Re(e,r)},focusLastYear(e){let{context:t}=e,n=fa(t.get("focusedValue").year),r=t.get("focusedValue").set({year:n[n.length-1]});Re(e,r)},setActiveIndex({context:e,event:t}){e.set("activeIndex",t.index)},setActiveIndexToEnd({context:e}){e.set("activeIndex",1)},setActiveIndexToStart({context:e}){e.set("activeIndex",0)},focusActiveCell({scope:e,context:t,event:n}){n.src!=="input.click"&&B(()=>{var i;let r=t.get("view");(i=Bv(e,r))==null||i.focus({preventScroll:!0})})},focusActiveCellIfNeeded({scope:e,context:t,event:n}){n.focus&&B(()=>{var i;let r=t.get("view");(i=Bv(e,r))==null||i.focus({preventScroll:!0})})},setHoveredValueIfKeyboard({context:e,event:t,prop:n}){!t.type.startsWith("TABLE.ARROW")||n("selectionMode")!=="range"||e.get("activeIndex")===0||e.set("hoveredValue",e.get("focusedValue").copy())},focusTriggerElement({scope:e}){B(()=>{var t;(t=Wl(e))==null||t.focus({preventScroll:!0})})},focusFirstInputElement({scope:e,event:t}){t.focus!==!1&&B(()=>{let[n]=To(e),r=n!=null?n:Wl(e);r==null||r.focus({preventScroll:!0})})},focusInputElement({scope:e}){B(()=>{var a;let t=To(e);if(t.length===0){(a=Wl(e))==null||a.focus({preventScroll:!0});return}let n=t.findLastIndex(o=>o.value!==""),r=Math.max(n,0),i=t[r];i==null||i.focus({preventScroll:!0}),i==null||i.setSelectionRange(i.value.length,i.value.length)})},syncMonthSelectElement({scope:e,context:t}){let n=lx(e);_e(n,t.get("startValue").month.toString())},syncYearSelectElement({scope:e,context:t}){let n=sx(e);_e(n,t.get("startValue").year.toString())},setInputValue({context:e,event:t}){e.get("activeIndex")===t.index&&e.set("inputValue",t.value)},syncInputValue({scope:e,context:t,event:n}){queueMicrotask(()=>{var a;let r=To(e),i=(a=n.index)!=null?a:t.get("activeIndex");_e(r[i],t.get("inputValue"))})},focusParsedDate(e){let{event:t,prop:n}=e;if(t.index==null)return;let i=n("parse")(t.value,{locale:n("locale"),timeZone:n("timeZone")});!i||!Uv(i)||Re(e,i)},selectParsedDate({context:e,event:t,prop:n}){if(t.index==null)return;let i=n("parse")(t.value,{locale:n("locale"),timeZone:n("timeZone")});if((!i||!Uv(i))&&t.value&&(i=e.get("focusedValue").copy()),!i)return;i=jt(i,n("min"),n("max"));let a=Array.from(e.get("value"));a[t.index]=i,e.set("value",a);let o=zl(a,n);e.set("inputValue",o[t.index])},resetView({context:e}){e.set("view",e.initial("view"))},setStartValue({context:e,computed:t,prop:n}){let r=e.get("focusedValue");if(!An(r,e.get("startValue"),t("endValue")))return;let a=Lv(r,"start",{months:n("numOfMonths")},n("locale"));e.set("startValue",a)},invokeOnOpen({prop:e,context:t}){var n;e("inline")||(n=e("onOpenChange"))==null||n({open:!0,value:t.get("value")})},invokeOnClose({prop:e,context:t}){var n;e("inline")||(n=e("onOpenChange"))==null||n({open:!1,value:t.get("value")})},invokeOnVisibleRangeChange({prop:e,context:t,computed:n}){var r;(r=e("onVisibleRangeChange"))==null||r({view:t.get("view"),visibleRange:n("visibleRange")})},toggleVisibility({event:e,send:t,prop:n}){t({type:n("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:e})}}}}),Zl=(e,t)=>{let{context:n,prop:r}=e,i=n.get("view"),a=typeof t=="number"?n.get("focusedValue").set({[i]:t}):t;return Sx(o=>{yx(o,r("minView"))&&(a=a.set({[o]:o==="day"?1:0}))}),a},ku=(e,t)=>{if(!e||!("hour"in e))return t;let n="timeZone"in e,r=t;return"hour"in t||(n?r=ty(Xt(t),e.timeZone):r=Xt(t)),r.set({hour:e.hour,minute:e.minute,second:e.second,millisecond:e.millisecond})};Nu=(e,t,n,r)=>e==="year"?r!=null?r:"":e==="month"?n!=null?n:"":t!=null?t:"",Ox=(e,t)=>e.split("__N__").join(String(t));xx=class extends X{constructor(){super(...arguments);Q(this,"getDayView",()=>this.el.querySelector('[data-part="day-view"]'));Q(this,"getMonthView",()=>this.el.querySelector('[data-part="month-view"]'));Q(this,"getYearView",()=>this.el.querySelector('[data-part="year-view"]'));Q(this,"renderDayTableHeader",()=>{let t=this.getDayView(),n=t==null?void 0:t.querySelector("thead");if(!n||!this.api.weekDays)return;let r=this.doc.createElement("tr");this.spreadProps(r,this.api.getTableRowProps({view:"day"})),this.api.weekDays.forEach(i=>{let a=this.doc.createElement("th");a.scope="col",a.setAttribute("aria-label",i.long),a.textContent=i.narrow,r.appendChild(a)}),n.innerHTML="",n.appendChild(r)});Q(this,"renderDayTableBody",()=>{let t=this.getDayView(),n=t==null?void 0:t.querySelector("tbody");n&&(this.spreadProps(n,this.api.getTableBodyProps({view:"day"})),this.api.weeks&&(n.innerHTML="",this.api.weeks.forEach(r=>{let i=this.doc.createElement("tr");this.spreadProps(i,this.api.getTableRowProps({view:"day"})),r.forEach(a=>{let o=this.doc.createElement("td");this.spreadProps(o,this.api.getDayTableCellProps({value:a}));let s=this.doc.createElement("div");this.spreadProps(s,this.api.getDayTableCellTriggerProps({value:a})),s.textContent=String(a.day),o.appendChild(s),i.appendChild(o)}),n.appendChild(i)})))});Q(this,"renderMonthTableBody",()=>{let t=this.getMonthView(),n=t==null?void 0:t.querySelector("tbody");if(!n)return;this.spreadProps(n,this.api.getTableBodyProps({view:"month"}));let r=this.api.getMonthsGrid({columns:4,format:"short"});n.innerHTML="",r.forEach(i=>{let a=this.doc.createElement("tr");this.spreadProps(a,this.api.getTableRowProps()),i.forEach(o=>{let s=this.doc.createElement("td");this.spreadProps(s,this.api.getMonthTableCellProps(y(h({},o),{columns:4})));let l=this.doc.createElement("div");this.spreadProps(l,this.api.getMonthTableCellTriggerProps(y(h({},o),{columns:4}))),l.textContent=o.label,s.appendChild(l),a.appendChild(s)}),n.appendChild(a)})});Q(this,"renderYearTableBody",()=>{let t=this.getYearView(),n=t==null?void 0:t.querySelector("tbody");if(!n)return;this.spreadProps(n,this.api.getTableBodyProps());let r=this.api.getYearsGrid({columns:4});n.innerHTML="",r.forEach(i=>{let a=this.doc.createElement("tr");this.spreadProps(a,this.api.getTableRowProps({view:"year"})),i.forEach(o=>{let s=this.doc.createElement("td");this.spreadProps(s,this.api.getYearTableCellProps(y(h({},o),{columns:4})));let l=this.doc.createElement("div");this.spreadProps(l,this.api.getYearTableCellTriggerProps(y(h({},o),{columns:4}))),l.textContent=o.label,s.appendChild(l),a.appendChild(s)}),n.appendChild(a)})})}initMachine(t){return new Y(wx,t)}initApi(){return this.zagConnect(Tx)}render(){let t=this.el.querySelector('[data-scope="date-picker"][data-part="root"]');t&&this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="date-picker"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps());let r=this.el.querySelector('[data-scope="date-picker"][data-part="control"]');r&&this.spreadProps(r,this.api.getControlProps());let i=Array.from(this.el.querySelectorAll('[data-scope="date-picker"][data-part="input"]')),a=this.api.selectionMode;for(let c=0;c0){let c=i[0],d=()=>{let g=this.api.valueAsString,u=(Array.isArray(g)?g:g==null||g===""?[]:[String(g)]).filter(Boolean).join(", ");c.value!==u&&(c.value=u)};d(),queueMicrotask(()=>{requestAnimationFrame(d)})}Ax(this.el,i,this.api.selectionMode);let o=this.el.querySelector('[data-scope="date-picker"][data-part="trigger"]');o&&this.spreadProps(o,this.api.getTriggerProps());let s=this.el.querySelector('[data-scope="date-picker"][data-part="positioner"]');s&&this.spreadProps(s,this.api.getPositionerProps());let l=this.el.querySelector('[data-scope="date-picker"][data-part="content"]');if(l&&this.spreadProps(l,this.api.getContentProps()),this.api.open){let c=this.getDayView(),d=this.getMonthView(),g=this.getYearView();if(c&&(c.hidden=this.api.view!=="day"),d&&(d.hidden=this.api.view!=="month"),g&&(g.hidden=this.api.view!=="year"),this.api.view==="day"&&c){let p=c.querySelector('[data-part="view-control"]');p&&this.spreadProps(p,this.api.getViewControlProps({view:"year"}));let u=c.querySelector('[data-part="prev-trigger"]');u&&this.spreadProps(u,this.api.getPrevTriggerProps());let f=c.querySelector('[data-part="view-trigger"]');f&&(this.spreadProps(f,this.api.getViewTriggerProps()),f.textContent=this.api.visibleRangeText.start);let m=c.querySelector('[data-part="next-trigger"]');m&&this.spreadProps(m,this.api.getNextTriggerProps());let S=c.querySelector("table");S&&this.spreadProps(S,this.api.getTableProps({view:"day"}));let T=c.querySelector("thead");T&&this.spreadProps(T,this.api.getTableHeaderProps({view:"day"})),this.renderDayTableHeader(),this.renderDayTableBody()}else if(this.api.view==="month"&&d){let p=d.querySelector('[data-part="view-control"]');p&&this.spreadProps(p,this.api.getViewControlProps({view:"month"}));let u=d.querySelector('[data-part="prev-trigger"]');u&&this.spreadProps(u,this.api.getPrevTriggerProps({view:"month"}));let f=d.querySelector('[data-part="view-trigger"]');f&&(this.spreadProps(f,this.api.getViewTriggerProps({view:"month"})),f.textContent=String(this.api.visibleRange.start.year));let m=d.querySelector('[data-part="next-trigger"]');m&&this.spreadProps(m,this.api.getNextTriggerProps({view:"month"}));let S=d.querySelector("table");S&&this.spreadProps(S,this.api.getTableProps({view:"month",columns:4})),this.renderMonthTableBody()}else if(this.api.view==="year"&&g){let p=g.querySelector('[data-part="view-control"]');p&&this.spreadProps(p,this.api.getViewControlProps({view:"year"}));let u=g.querySelector('[data-part="prev-trigger"]');u&&this.spreadProps(u,this.api.getPrevTriggerProps({view:"year"}));let f=g.querySelector('[data-part="decade"]');if(f){let T=this.api.getDecade();f.textContent=`${T.start} - ${T.end}`}let m=g.querySelector('[data-part="next-trigger"]');m&&this.spreadProps(m,this.api.getNextTriggerProps({view:"year"}));let S=g.querySelector("table");S&&this.spreadProps(S,this.api.getTableProps({view:"year",columns:4})),this.renderYearTableBody()}}}};Nx={mounted(){let e=this.el,t=this;t.allowFormNotify=!1;let n=this.pushEvent.bind(this),r=this.liveSocket,i=()=>j(this.liveSocket),a=V(e,"min"),o=V(e,"max"),s=d=>d?d.map(g=>zt(g)):void 0,l=d=>d?zt(d):void 0,c=new xx(e,y(h(y(h({id:e.id},(()=>{let d=hn(e);return"value"in d?{value:s(d.value)}:{defaultValue:s(d.defaultValue)}})()),{defaultFocusedValue:l(V(e,"focusedValue")),defaultView:V(e,"defaultView"),dir:V(e,"dir"),locale:V(e,"locale"),timeZone:V(e,"timeZone"),disabled:O(e,"disabled"),readOnly:O(e,"readonly"),required:O(e,"required"),invalid:O(e,"invalid"),outsideDaySelectable:O(e,"outsideDaySelectable"),closeOnSelect:Uu(e),min:a?zt(a):void 0,max:o?zt(o):void 0,startOfWeek:G(e,"startOfWeek"),fixedWeeks:O(e,"fixedWeeks"),selectionMode:V(e,"selectionMode"),maxSelectedDates:G(e,"maxSelectedDates"),placeholder:V(e,"placeholder"),minView:V(e,"minView"),maxView:V(e,"maxView"),defaultOpen:!1,inline:O(e,"inline"),positioning:qe(e)}),Gv(e)),{onValueChange:d=>{let g=ec(d.value),p=V(e,"submitName");if(p)sn(e,g,{scope:"date-picker",submitName:p,notifyLiveView:t.allowFormNotify===!0});else{let u=g.length>0?g.join(","):"";Jl(e,u,t.allowFormNotify===!0)}W({el:e,canPushServer:i(),pushEvent:n,payload:{id:e.id,value:g.length>0?g.join(","):null},serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})},onFocusChange:d=>{var p;let g=V(e,"onFocusChange");g&&r.main.isConnected()&&n(g,{id:e.id,focused:(p=d.focused)!=null?p:!1})},onViewChange:d=>{let g=V(e,"onViewChange");g&&r.main.isConnected()&&n(g,{id:e.id,view:d.view})},onVisibleRangeChange:d=>{let g=V(e,"onVisibleRangeChange");g&&r.main.isConnected()&&n(g,{id:e.id,start:d.start,end:d.end})},onOpenChange:d=>{W({el:e,canPushServer:i(),pushEvent:n,payload:{id:e.id,open:d.open},serverEventName:V(e,"onOpenChange"),clientEventName:V(e,"onOpenChangeClient")})}}));c.init(),this.datePicker=c,queueMicrotask(()=>{let d=V(e,"submitName"),g=Bu(c,Hu(e,c.api.value));d?sn(e,g,{scope:"date-picker",submitName:d,notifyLiveView:!1}):Jl(e,g.length>0?g.join(","):"",!1),t.allowFormNotify=!0}),this.handlers=[],this.handlers.push(this.handleEvent("date_picker_set_value",d=>{let g=d.date_picker_id;g&&g!==e.id||c.api.setValue([zt(d.value)])})),this.onSetValue=d=>{var p;let g=(p=d.detail)==null?void 0:p.value;typeof g=="string"&&c.api.setValue([zt(g)])},e.addEventListener("corex:date-picker:set-value",this.onSetValue)},updated(){let e=this.el,t=this.datePicker,n=V(e,"min"),r=V(e,"max"),i=qn(e),a="value"in i?{value:i.value.map(o=>zt(o))}:{};t==null||t.updateProps(h(y(h({},a),{dir:V(e,"dir"),locale:V(e,"locale"),timeZone:V(e,"timeZone"),disabled:O(e,"disabled"),readOnly:O(e,"readonly"),required:O(e,"required"),invalid:O(e,"invalid"),outsideDaySelectable:O(e,"outsideDaySelectable"),closeOnSelect:Uu(e),min:n?zt(n):void 0,max:r?zt(r):void 0,startOfWeek:G(e,"startOfWeek"),fixedWeeks:O(e,"fixedWeeks"),selectionMode:V(e,"selectionMode"),maxSelectedDates:G(e,"maxSelectedDates"),placeholder:V(e,"placeholder"),minView:V(e,"minView"),maxView:V(e,"maxView"),inline:O(e,"inline"),positioning:qe(e)}),Gv(e))),V(e,"submitName")||queueMicrotask(()=>{let o="value"in i?i.value:null,s=Hu(e,t==null?void 0:t.api.value,o);t&&(s=Bu(t,s)),Jl(e,s.join(","),!1)})},destroyed(){var e;if(this.onSetValue&&this.el.removeEventListener("corex:date-picker:set-value",this.onSetValue),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.datePicker)==null||e.destroy()}}});var Uy={};pe(Uy,{Dialog:()=>uR,readDialogLayoutProps:()=>oc});function Hx(e,t){let{state:n,send:r,context:i,prop:a,scope:o}=e,s=a("aria-label"),l=n.matches("open"),c=i.get("triggerValue");return{open:l,setOpen(d){n.matches("open")!==d&&r({type:d?"OPEN":"CLOSE"})},triggerValue:c,setTriggerValue(d){r({type:"TRIGGER_VALUE.SET",value:d})},getTriggerProps(d={}){let{value:g}=d,p=g==null?!1:c===g;return t.button(y(h({},fi.trigger.attrs),{dir:a("dir"),id:My(o,g),"data-ownedby":o.id,"data-value":g,"aria-haspopup":"dialog",type:"button","aria-expanded":g==null?l:l&&p,"data-state":l?"open":"closed","aria-controls":ig(o),"data-current":b(p),onClick(u){if(u.defaultPrevented)return;let f=l&&g!=null&&!p;r({type:f?"TRIGGER_VALUE.SET":"TOGGLE",value:g})}}))},getBackdropProps(){return t.element(y(h({},fi.backdrop.attrs),{dir:a("dir"),hidden:!l,id:Fy(o),"data-state":l?"open":"closed"}))},getPositionerProps(){return t.element(y(h({},fi.positioner.attrs),{dir:a("dir"),id:Dy(o),style:_n({pointerEvents:!l||!a("modal")?"none":void 0})}))},getContentProps(){let d=i.get("rendered");return t.element(y(h({},fi.content.attrs),{dir:a("dir"),role:a("role"),hidden:!l,id:ig(o),tabIndex:-1,"data-state":l?"open":"closed","aria-modal":a("modal"),"aria-label":s||void 0,"aria-labelledby":s||!d.title?void 0:ag(o),"aria-describedby":d.description?og(o):void 0,style:_n({pointerEvents:a("modal")?void 0:"auto"})}))},getTitleProps(){return t.element(y(h({},fi.title.attrs),{dir:a("dir"),id:ag(o)}))},getDescriptionProps(){return t.element(y(h({},fi.description.attrs),{dir:a("dir"),id:og(o)}))},getCloseTriggerProps(){return t.button(y(h({},fi.closeTrigger.attrs),{dir:a("dir"),id:_y(o),type:"button",onClick(d){d.defaultPrevented||(d.stopPropagation(),r({type:"CLOSE"}))}}))}}}function jx(e,t={}){let{defer:n=!0}=t,r=n?zx:a=>a(),i=[];return i.push(r(()=>{let o=(typeof e=="function"?e():e).filter(Boolean);o.length!==0&&i.push(Kx(o))})),()=>{i.forEach(a=>a==null?void 0:a())}}function rR(e,t={}){let n,r=B(()=>{let a=(Array.isArray(e)?e:[e]).map(s=>typeof s=="function"?s():s).filter(s=>s!=null);if(a.length===0)return;let o=a[0];n=new Jx(a,y(h({escapeDeactivates:!1,allowOutsideClick:!0,preventScroll:!0,returnFocusOnDeactivate:!0,delayInitialFocus:!1,fallbackFocus:o},t),{document:Ge(o)}));try{n.activate()}catch(s){}});return function(){n==null||n.deactivate(),r()}}function iR(e){let t=e.getBoundingClientRect().left;return Math.round(t)+e.scrollLeft?"paddingLeft":"paddingRight"}function Ny(e){let t=pt(e),n=t==null?void 0:t.scrollbarGutter;return n==="stable"||(n==null?void 0:n.startsWith("stable "))===!0}function aR(e){var u;let t=e!=null?e:document,n=(u=t.defaultView)!=null?u:window,{documentElement:r,body:i}=t;if(i.hasAttribute(rg))return;let o=Ny(r)||Ny(i),s=n.innerWidth-r.clientWidth;i.setAttribute(rg,"");let l=()=>Th(r,"--scrollbar-width",`${s}px`),c=iR(r),d=()=>{let f={overflow:"hidden"};return!o&&s>0&&(f[c]=`${s}px`),Xr(i,f)},g=()=>{var v,E;let{scrollX:f,scrollY:m,visualViewport:S}=n,T=(v=S==null?void 0:S.offsetLeft)!=null?v:0,w=(E=S==null?void 0:S.offsetTop)!=null?E:0,I={position:"fixed",overflow:"hidden",top:`${-(m-Math.floor(w))}px`,left:`${-(f-Math.floor(T))}px`,right:"0"};!o&&s>0&&(I[c]=`${s}px`);let P=Xr(i,I);return()=>{P==null||P(),n.scrollTo({left:f,top:m,behavior:"instant"})}},p=[l(),Ka()?g():d()];return()=>{p.forEach(f=>f==null?void 0:f()),i.removeAttribute(rg)}}function Hy(e){var r,i;let t=e.querySelector('[data-scope="dialog"][data-part="title"]');if((r=t==null?void 0:t.textContent)!=null&&r.trim())return;let n=(i=V(e,"dialogDefaultLabel"))==null?void 0:i.trim();return n||"Dialog"}function sR(e,t){var i,a;let n=e.querySelector('[data-scope="dialog"][data-part="title"]');if((i=n==null?void 0:n.textContent)!=null&&i.trim())t.removeAttribute("aria-label");else{t.removeAttribute("aria-labelledby");let o=Hy(e);o?t.setAttribute("aria-label",o):t.removeAttribute("aria-label")}let r=e.querySelector('[data-scope="dialog"][data-part="description"]');(a=r==null?void 0:r.textContent)!=null&&a.trim()||t.removeAttribute("aria-describedby")}function Ly(e,t){if(!t)return null;let n=e.querySelector(`#${CSS.escape(t)}`);if(n)return n;let r=document.getElementById(t);return r&&e.contains(r)?r:null}function oc(e){var i;let t=(i=V(e,"role",["dialog","alertdialog"]))!=null?i:"dialog",n=V(e,"initialFocus"),r=V(e,"finalFocus");return{id:e.id,role:t,modal:O(e,"modal"),closeOnInteractOutside:O(e,"closeOnInteractOutside"),closeOnEscape:O(e,"closeOnEscapeKeyDown"),preventScroll:O(e,"preventScroll"),restoreFocus:O(e,"restoreFocus"),dir:q(e),initialFocusEl:n?()=>Ly(e,n):void 0,finalFocusEl:r?()=>Ly(e,r):void 0}}function By(e,t){let n=vd(e),r=n.blockInteraction?e:void 0,i=e.querySelector('[data-scope="dialog"][data-part="backdrop"]'),a=e.querySelector('[data-scope="dialog"][data-part="content"]');i&&bd(i,t,n,r),a&&bd(a,t,n,r)}function dR(e,t){Vt(e)&&By(e,t)}var Lx,fi,Dy,Fy,ig,My,ag,og,_y,Ao,Dx,Fx,Mx,_x,$x,sg,xy,ya,ic,ac,tg,$y,Bx,Ux,Gx,qx,Wx,Kx,zx,Yx,Xx,Le,Ry,Zx,Jx,lg,ng,Qx,eR,xo,tR,ky,nR,rg,oR,lR,cR,uR,Gy=ee(()=>{"use strict";_s();Or();on();$e();Ve();be();oe();Lx=z("dialog").parts("trigger","backdrop","positioner","content","title","description","closeTrigger"),fi=Lx.build(),Dy=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`dialog:${e.id}:positioner`},Fy=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.backdrop)!=null?n:`dialog:${e.id}:backdrop`},ig=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`dialog:${e.id}:content`},My=(e,t)=>{var r;let n=(r=e.ids)==null?void 0:r.trigger;return n!=null?Qe(n)?n(t):n:t?`dialog:${e.id}:trigger:${t}`:`dialog:${e.id}:trigger`},ag=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.title)!=null?n:`dialog:${e.id}:title`},og=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.description)!=null?n:`dialog:${e.id}:description`},_y=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.closeTrigger)!=null?n:`dialog:${e.id}:close`},Ao=e=>e.getById(ig(e)),Dx=e=>e.getById(Dy(e)),Fx=e=>e.getById(Fy(e)),Mx=e=>e.getById(ag(e)),_x=e=>e.getById(og(e)),$x=e=>e.getById(_y(e)),sg=e=>Oe(e.getDoc(),`[data-scope="dialog"][data-part="trigger"][data-ownedby="${e.id}"]`),xy=(e,t)=>t==null?sg(e)[0]:e.getById(My(e,t));ya=new WeakMap,ic=new WeakMap,ac={},tg=0,$y=e=>e&&(e.host||$y(e.parentNode)),Bx=(e,t)=>t.map(n=>{if(e.contains(n))return n;let r=$y(n);return r&&e.contains(r)?r:(console.error("[zag-js > ariaHidden] target",n,"in not contained inside",e,". Doing nothing"),null)}).filter(n=>!!n),Ux=new Set(["script","output","status","next-route-announcer"]),Gx=e=>Ux.has(e.localName)||e.role==="status"||e.hasAttribute("aria-live")?!0:e.matches("[data-live-announcer]"),qx=(e,t)=>{let{parentNode:n,markerName:r,controlAttribute:i,explicitBooleanValue:a,followControlledElements:o=!0}=t,s=Bx(n,Array.isArray(e)?e:[e]);ac[r]||(ac[r]=new WeakMap);let l=ac[r],c=[],d=new Set,g=new Set(s),p=f=>{!f||d.has(f)||(d.add(f),p(f.parentNode))};s.forEach(f=>{p(f),o&&Pe(f)&&id(f,m=>{p(m)})});let u=f=>{!f||g.has(f)||Array.prototype.forEach.call(f.children,m=>{if(d.has(m))u(m);else try{if(Gx(m))return;let S=m.getAttribute(i),T=a?S==="true":S!==null&&S!=="false",w=(ya.get(m)||0)+1,I=(l.get(m)||0)+1;ya.set(m,w),l.set(m,I),c.push(m),w===1&&T&&ic.set(m,!0),I===1&&m.setAttribute(r,""),T||m.setAttribute(i,a?"true":"")}catch(S){console.error("[zag-js > ariaHidden] cannot operate on ",m,S)}})};return u(n),d.clear(),tg++,()=>{c.forEach(f=>{let m=ya.get(f)-1,S=l.get(f)-1;ya.set(f,m),l.set(f,S),m||(ic.has(f)||f.removeAttribute(i),ic.delete(f)),S||f.removeAttribute(r)}),tg--,tg||(ya=new WeakMap,ya=new WeakMap,ic=new WeakMap,ac={})}},Wx=e=>(Array.isArray(e)?e[0]:e).ownerDocument.body,Kx=(e,t=Wx(e),n="data-aria-hidden",r=!0)=>{if(t)return qx(e,{parentNode:t,markerName:n,controlAttribute:"aria-hidden",explicitBooleanValue:!0,followControlledElements:r})},zx=e=>{let t=requestAnimationFrame(()=>e());return()=>cancelAnimationFrame(t)};Yx=Object.defineProperty,Xx=(e,t,n)=>t in e?Yx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Le=(e,t,n)=>Xx(e,typeof t!="symbol"?t+"":t,n),Ry={activateTrap(e,t){if(e.length>0){let r=e[e.length-1];r!==t&&r.pause()}let n=e.indexOf(t);n===-1||e.splice(n,1),e.push(t)},deactivateTrap(e,t){let n=e.indexOf(t);n!==-1&&e.splice(n,1),e.length>0&&e[e.length-1].unpause()}},Zx=[],Jx=class{constructor(e,t){Le(this,"trapStack"),Le(this,"config"),Le(this,"doc"),Le(this,"state",{containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0}),Le(this,"portalContainers",new Set),Le(this,"listenerCleanups",[]),Le(this,"handleFocus",r=>{let i=ne(r),a=this.findContainerIndex(i,r)>=0;if(a||Wa(i))a&&(this.state.mostRecentlyFocusedNode=i);else{r.stopImmediatePropagation();let o,s=!0;if(this.state.mostRecentlyFocusedNode)if(Ui(this.state.mostRecentlyFocusedNode)>0){let l=this.findContainerIndex(this.state.mostRecentlyFocusedNode),{tabbableNodes:c}=this.state.containerGroups[l];if(c.length>0){let d=c.findIndex(g=>g===this.state.mostRecentlyFocusedNode);d>=0&&(this.config.isKeyForward(this.state.recentNavEvent)?d+1=0&&(o=c[d-1],s=!1))}}else this.state.containerGroups.some(l=>l.tabbableNodes.some(c=>Ui(c)>0))||(s=!1);else s=!1;s&&(o=this.findNextNavNode({target:this.state.mostRecentlyFocusedNode,isBackward:this.config.isKeyBackward(this.state.recentNavEvent)})),o?this.tryFocus(o):this.tryFocus(this.state.mostRecentlyFocusedNode||this.getInitialFocusNode())}this.state.recentNavEvent=void 0}),Le(this,"handlePointerDown",r=>{let i=ne(r);if(!(this.findContainerIndex(i,r)>=0)){if(xo(this.config.clickOutsideDeactivates,r)){this.deactivate({returnFocus:this.config.returnFocusOnDeactivate});return}xo(this.config.allowOutsideClick,r)||r.preventDefault()}}),Le(this,"handleClick",r=>{let i=ne(r);this.findContainerIndex(i,r)>=0||xo(this.config.clickOutsideDeactivates,r)||xo(this.config.allowOutsideClick,r)||(r.preventDefault(),r.stopImmediatePropagation())}),Le(this,"handleTabKey",r=>{if(this.config.isKeyForward(r)||this.config.isKeyBackward(r)){this.state.recentNavEvent=r;let i=this.config.isKeyBackward(r),a=this.findNextNavNode({event:r,isBackward:i});if(!a)return;ng(r)&&r.preventDefault(),this.tryFocus(a)}}),Le(this,"handleEscapeKey",r=>{tR(r)&&xo(this.config.escapeDeactivates,r)!==!1&&(r.preventDefault(),this.deactivate())}),Le(this,"_mutationObserver"),Le(this,"setupMutationObserver",()=>{let r=this.doc.defaultView||window;this._mutationObserver=new r.MutationObserver(i=>{i.some(s=>Array.from(s.removedNodes).some(c=>c===this.state.mostRecentlyFocusedNode))&&this.tryFocus(this.getInitialFocusNode()),i.some(s=>s.type==="attributes"&&(s.attributeName==="aria-controls"||s.attributeName==="aria-expanded")?!0:s.type==="childList"&&s.addedNodes.length>0?Array.from(s.addedNodes).some(l=>{if(l.nodeType!==Node.ELEMENT_NODE)return!1;let c=l;return lh(c)?!0:c.id&&!this.state.containers.some(d=>d.contains(c))?ch(c):!1}):!1)&&this.state.active&&!this.state.paused&&(this.updateTabbableNodes(),this.updatePortalContainers())})}),Le(this,"updateObservedNodes",()=>{var r;(r=this._mutationObserver)==null||r.disconnect(),this.state.active&&!this.state.paused&&(this.state.containers.map(i=>{var a;(a=this._mutationObserver)==null||a.observe(i,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["aria-controls","aria-expanded"]})}),this.portalContainers.forEach(i=>{this.observePortalContainer(i)}))}),Le(this,"getInitialFocusNode",()=>{let r=this.getNodeForOption("initialFocus",{hasFallback:!0});if(r===!1)return!1;if(r===void 0||r&&!ut(r)){let i=gr(this.doc);if(i&&this.findContainerIndex(i)>=0)r=i;else{let a=this.state.tabbableGroups[0];r=a&&a.firstTabbableNode||this.getNodeForOption("fallbackFocus")}}else r===null&&(r=this.getNodeForOption("fallbackFocus"));if(!r)throw new Error("Your focus-trap needs to have at least one focusable element");if(r.isConnected||(r=this.getNodeForOption("fallbackFocus")),!r||!r.isConnected)throw new Error("Your focus-trap needs to have at least one focusable element");return r}),Le(this,"tryFocus",r=>{if(r!==!1&&r!==gr(this.doc)){if(!r||!r.focus){this.tryFocus(this.getInitialFocusNode());return}r.focus({preventScroll:!!this.config.preventScroll}),this.state.mostRecentlyFocusedNode=r,nR(r)&&r.select()}}),Le(this,"deactivate",r=>{if(!this.state.active)return this;let i=h({onDeactivate:this.config.onDeactivate,onPostDeactivate:this.config.onPostDeactivate,checkCanReturnFocus:this.config.checkCanReturnFocus},r);clearTimeout(this.state.delayInitialFocusTimer),this.state.delayInitialFocusTimer=void 0,this.removeListeners(),this.state.active=!1,this.state.paused=!1,this.updateObservedNodes(),Ry.deactivateTrap(this.trapStack,this),this.portalContainers.clear();let a=this.getOption(i,"onDeactivate"),o=this.getOption(i,"onPostDeactivate"),s=this.getOption(i,"checkCanReturnFocus"),l=this.getOption(i,"returnFocus","returnFocusOnDeactivate");a==null||a();let c=()=>{ky(()=>{if(l){let d=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);this.tryFocus(d)}o==null||o()})};if(l&&s){let d=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);return s(d).then(c,c),this}return c(),this}),Le(this,"pause",r=>{if(this.state.paused||!this.state.active)return this;let i=this.getOption(r,"onPause"),a=this.getOption(r,"onPostPause");return this.state.paused=!0,i==null||i(),this.removeListeners(),this.updateObservedNodes(),a==null||a(),this}),Le(this,"unpause",r=>{if(!this.state.paused||!this.state.active)return this;let i=this.getOption(r,"onUnpause"),a=this.getOption(r,"onPostUnpause");return this.state.paused=!1,i==null||i(),this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),a==null||a(),this}),Le(this,"updateContainerElements",r=>(this.state.containers=Array.isArray(r)?r.filter(Boolean):[r].filter(Boolean),this.state.active&&this.updateTabbableNodes(),this.updateObservedNodes(),this)),Le(this,"getReturnFocusNode",r=>{let i=this.getNodeForOption("setReturnFocus",{params:[r]});return i||(i===!1?!1:r)}),Le(this,"getOption",(r,i,a)=>r&&r[i]!==void 0?r[i]:this.config[a||i]),Le(this,"getNodeForOption",(r,{hasFallback:i=!1,params:a=[]}={})=>{let o=this.config[r];if(typeof o=="function"&&(o=o(...a)),o===!0&&(o=void 0),!o){if(o===void 0||o===!1)return o;throw new Error(`\`${r}\` was specified but was not a node, or did not return a node`)}let s=o;if(typeof o=="string"){try{s=this.doc.querySelector(o)}catch(l){throw new Error(`\`${r}\` appears to be an invalid selector; error="${l.message}"`)}if(!s&&!i)throw new Error(`\`${r}\` as selector refers to no known node`)}return s}),Le(this,"findNextNavNode",r=>{let{event:i,isBackward:a=!1}=r,o=r.target||ne(i);this.updateTabbableNodes();let s=null;if(this.state.tabbableGroups.length>0){let l=this.findContainerIndex(o,i),c=l>=0?this.state.containerGroups[l]:void 0;if(l<0)a?s=this.state.tabbableGroups[this.state.tabbableGroups.length-1].lastTabbableNode:s=this.state.tabbableGroups[0].firstTabbableNode;else if(a){let d=this.state.tabbableGroups.findIndex(({firstTabbableNode:g})=>o===g);if(d<0&&((c==null?void 0:c.container)===o||ut(o)&&!lr(o)&&!(c!=null&&c.nextTabbableNode(o,!1)))&&(d=l),d>=0){let g=d===0?this.state.tabbableGroups.length-1:d-1,p=this.state.tabbableGroups[g];s=Ui(o)>=0?p.lastTabbableNode:p.lastDomTabbableNode}else ng(i)||(s=c==null?void 0:c.nextTabbableNode(o,!1))}else{let d=this.state.tabbableGroups.findIndex(({lastTabbableNode:g})=>o===g);if(d<0&&((c==null?void 0:c.container)===o||ut(o)&&!lr(o)&&!(c!=null&&c.nextTabbableNode(o)))&&(d=l),d>=0){let g=d===this.state.tabbableGroups.length-1?0:d+1,p=this.state.tabbableGroups[g];s=Ui(o)>=0?p.firstTabbableNode:p.firstDomTabbableNode}else ng(i)||(s=c==null?void 0:c.nextTabbableNode(o))}}else s=this.getNodeForOption("fallbackFocus");return s}),this.trapStack=t.trapStack||Zx;let n=h({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,followControlledElements:!0,isKeyForward:Qx,isKeyBackward:eR},t);this.doc=n.document||Ge(Array.isArray(e)?e[0]:e),this.config=n,this.updateContainerElements(e),this.setupMutationObserver()}addPortalContainer(e){let t=e.parentElement;t&&!this.portalContainers.has(t)&&(this.portalContainers.add(t),this.state.active&&!this.state.paused&&this.observePortalContainer(t))}observePortalContainer(e){var t;(t=this._mutationObserver)==null||t.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["aria-controls","aria-expanded"]})}updatePortalContainers(){this.config.followControlledElements&&this.state.containers.forEach(e=>{sh(e).forEach(n=>{this.addPortalContainer(n)})})}get active(){return this.state.active}get paused(){return this.state.paused}findContainerIndex(e,t){let n=typeof(t==null?void 0:t.composedPath)=="function"?t.composedPath():void 0;return this.state.containerGroups.findIndex(({container:r,tabbableNodes:i})=>r.contains(e)||(n==null?void 0:n.includes(r))||i.find(a=>a===e)||this.isControlledElement(r,e))}isControlledElement(e,t){return this.config.followControlledElements?Vs(e,t):!1}updateTabbableNodes(){if(this.state.containerGroups=this.state.containers.map(e=>{let t=Bn(e,{getShadowRoot:this.config.getShadowRoot}),n=Ya(e,{getShadowRoot:this.config.getShadowRoot}),r=t[0],i=t[t.length-1],a=r,o=i,s=!1;for(let c=0;c0){s=!0;break}function l(c,d=!0){let g=t.indexOf(c);if(g>=0)return t[g+(d?1:-1)];let p=n.indexOf(c);if(!(p<0)){if(d){for(let u=p+1;u=0;u--)if(lr(n[u]))return n[u]}}return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:s,firstTabbableNode:r,lastTabbableNode:i,firstDomTabbableNode:a,lastDomTabbableNode:o,nextTabbableNode:l}}),this.state.tabbableGroups=this.state.containerGroups.filter(e=>e.tabbableNodes.length>0),this.state.tabbableGroups.length<=0&&!this.getNodeForOption("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(this.state.containerGroups.find(e=>e.posTabIndexesFound)&&this.state.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")}addListeners(){if(this.state.active)return Ry.activateTrap(this.trapStack,this),this.state.delayInitialFocusTimer=this.config.delayInitialFocus?ky(()=>{this.tryFocus(this.getInitialFocusNode())}):this.tryFocus(this.getInitialFocusNode()),this.listenerCleanups.push(ae(this.doc,"focusin",this.handleFocus,!0),ae(this.doc,"mousedown",this.handlePointerDown,{capture:!0,passive:!1}),ae(this.doc,"touchstart",this.handlePointerDown,{capture:!0,passive:!1}),ae(this.doc,"click",this.handleClick,{capture:!0,passive:!1}),ae(this.doc,"keydown",this.handleTabKey,{capture:!0,passive:!1}),ae(this.doc,"keydown",this.handleEscapeKey)),this}removeListeners(){if(this.state.active)return this.listenerCleanups.forEach(e=>e()),this.listenerCleanups=[],this}activate(e){if(this.state.active)return this;let t=this.getOption(e,"onActivate"),n=this.getOption(e,"onPostActivate"),r=this.getOption(e,"checkCanFocusTrap");r||this.updateTabbableNodes(),this.state.active=!0,this.state.paused=!1,this.state.nodeFocusedBeforeActivation=gr(this.doc),t==null||t();let i=()=>{r&&this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),n==null||n()};return r?(r(this.state.containers.concat()).then(i,i),this):(i(),this)}},lg=e=>(e==null?void 0:e.type)==="keydown",ng=e=>lg(e)&&(e==null?void 0:e.key)==="Tab",Qx=e=>lg(e)&&e.key==="Tab"&&!(e!=null&&e.shiftKey),eR=e=>lg(e)&&e.key==="Tab"&&(e==null?void 0:e.shiftKey),xo=(e,...t)=>typeof e=="function"?e(...t):e,tR=e=>!e.isComposing&&e.key==="Escape",ky=e=>setTimeout(e,0),nR=e=>e.localName==="input"&&"select"in e&&typeof e.select=="function";rg="data-scroll-lock";oR=te({props({props:e,scope:t}){let n=e.role==="alertdialog",r=n?()=>$x(t):void 0,i=typeof e.modal=="boolean"?e.modal:!0;return h({role:"dialog",modal:i,trapFocus:i,preventScroll:i,closeOnInteractOutside:i&&!n,closeOnEscape:!0,restoreFocus:!0,initialFocusEl:r},e)},initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"closed"},context({bindable:e,prop:t,scope:n}){return{rendered:e(()=>({defaultValue:{title:!0,description:!0}})),triggerValue:e(()=>{var r;return{defaultValue:(r=t("defaultTriggerValue"))!=null?r:null,value:t("triggerValue"),onChange(i){let a=t("onTriggerValueChange");if(!a)return;let o=xy(n,i);a({value:i,triggerElement:o})}}})}},watch({track:e,action:t,prop:n}){e([()=>n("open")],()=>{t(["toggleVisibility"])})},states:{open:{entry:["checkRenderedElements","syncZIndex","setInitialFocus"],effects:["trackDismissableElement","trapFocus","preventScroll","hideContentBelow"],on:{"CONTROLLED.CLOSE":{target:"closed"},CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],"TRIGGER_VALUE.SET":{actions:["setTriggerValue"]}}},closed:{on:{"CONTROLLED.OPEN":{target:"open"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen","setTriggerValue"]},{target:"open",actions:["invokeOnOpen","setTriggerValue"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnOpen","setTriggerValue"]},{target:"open",actions:["invokeOnOpen","setTriggerValue"]}],"TRIGGER_VALUE.SET":{actions:["setTriggerValue"]}}}},implementations:{guards:{isOpenControlled:({prop:e})=>e("open")!=null},effects:{trackDismissableElement({scope:e,send:t,prop:n}){return qt(()=>Ao(e),{type:"dialog",defer:!0,pointerBlocking:n("modal"),exclude:sg(e),onInteractOutside(i){var a;(a=n("onInteractOutside"))==null||a(i),n("closeOnInteractOutside")||i.preventDefault()},persistentElements:n("persistentElements"),onFocusOutside:n("onFocusOutside"),onPointerDownOutside:n("onPointerDownOutside"),onRequestDismiss:n("onRequestDismiss"),onEscapeKeyDown(i){var a;(a=n("onEscapeKeyDown"))==null||a(i),n("closeOnEscape")||i.preventDefault()},onDismiss(){t({type:"CLOSE",src:"interact-outside"})}})},preventScroll({scope:e,prop:t}){if(t("preventScroll"))return aR(e.getDoc())},trapFocus({scope:e,prop:t,context:n}){return t("trapFocus")?rR(()=>Ao(e),{preventScroll:!0,returnFocusOnDeactivate:!!t("restoreFocus"),initialFocus:t("initialFocusEl"),setReturnFocus:i=>{var l;let a=(l=t("finalFocusEl"))==null?void 0:l();if(a)return a;let o=n.get("triggerValue");if(o){let c=xy(e,o);if(c)return c}let s=sg(e)[0];return s||i},getShadowRoot:!0}):void 0},hideContentBelow({scope:e,prop:t}){return t("modal")?jx(()=>[Ao(e)],{defer:!0}):void 0}},actions:{setInitialFocus({prop:e,scope:t}){e("trapFocus")||B(()=>{let n=hr({root:Ao(t),getInitialEl:e("initialFocusEl")});n==null||n.focus({preventScroll:!0})})},checkRenderedElements({context:e,scope:t}){B(()=>{e.set("rendered",{title:!!Mx(t),description:!!_x(t)})})},syncZIndex({scope:e}){B(()=>{let t=Ao(e);if(!t)return;let n=pt(t);[Dx(e),Fx(e)].forEach(i=>{i==null||i.style.setProperty("--z-index",n.zIndex),i==null||i.style.setProperty("--layer-index",n.getPropertyValue("--layer-index"))})})},invokeOnClose({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!1})},invokeOnOpen({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!0})},setTriggerValue({context:e,event:t}){t.value!==void 0&&e.set("triggerValue",t.value)},toggleVisibility({prop:e,send:t,event:n}){t({type:e("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:n})}}}});lR=class extends X{initMachine(e){return new Y(oR,e)}initApi(){return this.zagConnect(Hx)}render(){var c;let e=this.el,t=(c=e.dataset.animation)!=null?c:"instant",n=e.querySelector('[data-scope="dialog"][data-part="trigger"]');n&&this.spreadProps(n,this.api.getTriggerProps());let r=e.querySelector('[data-scope="dialog"][data-part="backdrop"]');if(r){let d=this.api.getBackdropProps();t==="instant"?this.spreadProps(r,d):(t==="js"||t==="custom")&&(this.spreadProps(r,Zr(d)),r.removeAttribute("hidden"))}let i=e.querySelector('[data-scope="dialog"][data-part="positioner"]');i&&this.spreadProps(i,this.api.getPositionerProps());let a=e.querySelector('[data-scope="dialog"][data-part="content"]');if(a){let d=this.api.getContentProps();t==="instant"?this.spreadProps(a,d):(t==="js"||t==="custom")&&(this.spreadProps(a,Zr(d)),a.removeAttribute("hidden"),this.api.open||a.style.removeProperty("pointer-events")),sR(e,a)}let o=e.querySelector('[data-scope="dialog"][data-part="title"]');o&&this.spreadProps(o,this.api.getTitleProps());let s=e.querySelector('[data-scope="dialog"][data-part="description"]');s&&this.spreadProps(s,this.api.getDescriptionProps());let l=e.querySelector('[data-scope="dialog"][data-part="close-trigger"]');l&&this.spreadProps(l,this.api.getCloseTriggerProps())}};cR='[data-scope="dialog"][data-part="backdrop"], [data-scope="dialog"][data-part="content"]';uR={mounted(){let e=this.el,t=this,n=this.pushEvent.bind(this),r=()=>j(this.liveSocket);t.lastOpen=Pd(e,"open","defaultOpen");let i=new lR(e,y(h(h({},oc(e)),zs(e,"open","defaultOpen")),{"aria-label":Hy(e),onOpenChange:s=>{var g;let l=O(e,"controlled"),c=l?Pd(e,"open","defaultOpen"):(g=t.lastOpen)!=null?g:!1;l||(t.lastOpen=s.open);let d={id:e.id,open:s.open,previousOpen:c};W({el:e,canPushServer:r(),pushEvent:n,payload:d,serverEventName:V(e,"onOpenChange"),clientEventName:V(e,"onOpenChangeClient")}),Vt(e)&&!O(e,"controlled")&&By(e,s.open)}}));i.init(),this.dialog=i,Lh(e,cR,s=>{if(s.dataset.part==="backdrop")return{scale:!1}});let a=ie(e);this.domRegistry=a,a.add("corex:dialog:set-open",s=>{let{open:l}=s.detail;i.api.setOpen(l)});let o=re(this);this.handleRegistry=o,o.add("dialog_set_open",s=>{if(!s||typeof s!="object")return;let l=s;$(e.id,H(s))&&typeof l.open=="boolean"&&i.api.setOpen(l.open)}),o.add("dialog_open",s=>{$(e.id,H(s))&&r()&&this.pushEvent("dialog_open_response",{id:e.id,value:i.api.open})})},beforeUpdate(){let{el:e}=this;O(e,"controlled")&&Vt(e)&&(this.previousOpen=O(e,"open"))},updated(){var i,a,o,s,l;let{el:e}=this,t=oc(e);if(!O(e,"controlled")){(i=this.dialog)==null||i.updateProps(t);return}let n=(a=O(e,"open"))!=null?a:!1,r=(s=(o=this.previousOpen)!=null?o:this.lastOpen)!=null?s:!1;this.previousOpen=void 0,this.lastOpen=n,(l=this.dialog)==null||l.updateProps(y(h({},t),{open:n})),n!==r&&dR(e,n)},destroyed(){var e,t,n,r;(e=this.dialog)==null||e.updateProps(h(h({},oc(this.el)),Bs(this.el,"open","defaultOpen"))),(t=this.domRegistry)==null||t.teardown(),(n=this.handleRegistry)==null||n.teardown(),(r=this.dialog)==null||r.destroy()}}});var Xy={};pe(Xy,{Editable:()=>wR,dataDefaultValue:()=>TR});function PR(e,t){var v;let{state:n,context:r,send:i,prop:a,scope:o,computed:s}=e,l=!!a("disabled"),c=s("isInteractive"),d=!!a("readOnly"),g=!!a("required"),p=!!a("invalid"),u=!!a("autoResize"),f=a("translations"),m=n.matches("edit"),S=a("placeholder"),T=typeof S=="string"?{edit:S,preview:S}:S,w=r.get("value"),I=w.trim()==="",P=I?(v=T==null?void 0:T.preview)!=null?v:"":w;return{editing:m,empty:I,value:w,valueText:P,setValue(E){i({type:"VALUE.SET",value:E,src:"setValue"})},clearValue(){i({type:"VALUE.SET",value:"",src:"clearValue"})},edit(){c&&i({type:"EDIT"})},cancel(){c&&i({type:"CANCEL"})},submit(){c&&i({type:"SUBMIT"})},getRootProps(){return t.element(y(h({},nr.root.attrs),{id:pR(o),dir:a("dir")}))},getAreaProps(){return t.element(y(h({},nr.area.attrs),{id:hR(o),dir:a("dir"),style:u?{display:"inline-grid"}:void 0,"data-focus":b(m),"data-disabled":b(l),"data-placeholder-shown":b(I)}))},getLabelProps(){return t.label(y(h({},nr.label.attrs),{id:fR(o),dir:a("dir"),htmlFor:cg(o),"data-focus":b(m),"data-invalid":b(p),"data-required":b(g),onClick(){if(m)return;let E=vR(o);E==null||E.focus({preventScroll:!0})}}))},getInputProps(){return t.input(y(h({},nr.input.attrs),{dir:a("dir"),"aria-label":f==null?void 0:f.input,name:a("name"),form:a("form"),id:cg(o),hidden:u?void 0:!m,placeholder:T==null?void 0:T.edit,maxLength:a("maxLength"),required:a("required"),disabled:l,"data-disabled":b(l),readOnly:d,"data-readonly":b(d),"aria-invalid":se(p),"data-invalid":b(p),"data-autoresize":b(u),defaultValue:w,size:u?1:void 0,onChange(E){i({type:"VALUE.SET",src:"input.change",value:E.currentTarget.value})},onKeyDown(E){if(E.defaultPrevented||Me(E))return;let x={Escape(){i({type:"CANCEL"}),E.preventDefault()},Enter(C){if(!s("submitOnEnter"))return;let{localName:A}=C.currentTarget;if(A==="textarea"){if(!(za()?C.metaKey:C.ctrlKey))return;i({type:"SUBMIT",src:"keydown.enter"});return}A==="input"&&!C.shiftKey&&!C.metaKey&&(i({type:"SUBMIT",src:"keydown.enter"}),C.preventDefault())}}[E.key];x&&x(E)},style:u?{gridArea:"1 / 1 / auto / auto",visibility:m?void 0:"hidden"}:void 0}))},getPreviewProps(){return t.element(y(h({id:Ky(o)},nr.preview.attrs),{dir:a("dir"),"data-placeholder-shown":b(I),"aria-readonly":se(d),"data-readonly":b(l),"data-disabled":b(l),"aria-disabled":se(l),"aria-invalid":se(p),"data-invalid":b(p),"aria-label":f==null?void 0:f.edit,"data-autoresize":b(u),children:P,hidden:u?void 0:m,tabIndex:c?0:void 0,onClick(){c&&a("activationMode")==="click"&&i({type:"EDIT",src:"click"})},onFocus(){c&&a("activationMode")==="focus"&&i({type:"EDIT",src:"focus"})},onDoubleClick(E){E.defaultPrevented||c&&a("activationMode")==="dblclick"&&i({type:"EDIT",src:"dblclick"})},style:u?{whiteSpace:"pre",gridArea:"1 / 1 / auto / auto",visibility:m?"hidden":void 0,overflow:"hidden",textOverflow:"ellipsis"}:void 0}))},getEditTriggerProps(){return t.button(y(h({},nr.editTrigger.attrs),{id:Yy(o),dir:a("dir"),"aria-label":f==null?void 0:f.edit,hidden:m,type:"button",disabled:l,onClick(E){E.defaultPrevented||c&&i({type:"EDIT",src:"edit.click"})}}))},getControlProps(){return t.element(y(h({id:mR(o)},nr.control.attrs),{dir:a("dir")}))},getSubmitTriggerProps(){return t.button(y(h({},nr.submitTrigger.attrs),{dir:a("dir"),id:zy(o),"aria-label":f==null?void 0:f.submit,hidden:!m,disabled:l,type:"button",onClick(E){E.defaultPrevented||c&&i({type:"SUBMIT",src:"submit.click"})}}))},getCancelTriggerProps(){return t.button(y(h({},nr.cancelTrigger.attrs),{dir:a("dir"),"aria-label":f==null?void 0:f.cancel,id:jy(o),hidden:!m,type:"button",disabled:l,onClick(E){E.defaultPrevented||c&&i({type:"CANCEL",src:"cancel.click"})}}))}}}function TR(e){var t;return(t=V(e,"defaultValue"))!=null?t:""}function lc(e){return e.querySelector(`#${e.id}-value`)}function dg(e,t,n={}){let r=lc(e);if(r){yt(r,t,n);return}let i=e.querySelector('[data-scope="editable"][data-part="input"]');i&&yt(i,t,n)}function qy(e,t,n,r,i){dg(e,r,{markUsed:i.allowFormNotify===!0}),W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,value:r},serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})}function CR(e,t){let n=e.closest("form");if(!n)return()=>{};let r=()=>{var a;if(!t.api.editing)return;let i=e.querySelector('[data-scope="editable"][data-part="input"]');dg(e,(a=i==null?void 0:i.value)!=null?a:t.api.value,{markUsed:!1})};return n.addEventListener("submit",r,!0),()=>n.removeEventListener("submit",r,!0)}function Wy(e){if(!lc(e))return V(e,"name")}var gR,nr,pR,hR,fR,Ky,cg,mR,zy,jy,Yy,sc,vR,yR,bR,ER,SR,IR,wR,Zy=ee(()=>{"use strict";on();Kt();$e();Ve();be();oe();gR=z("editable").parts("root","area","label","preview","input","editTrigger","submitTrigger","cancelTrigger","control"),nr=gR.build(),pR=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`editable:${e.id}`},hR=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.area)!=null?n:`editable:${e.id}:area`},fR=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`editable:${e.id}:label`},Ky=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.preview)!=null?n:`editable:${e.id}:preview`},cg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`editable:${e.id}:input`},mR=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`editable:${e.id}:control`},zy=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.submitTrigger)!=null?n:`editable:${e.id}:submit`},jy=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.cancelTrigger)!=null?n:`editable:${e.id}:cancel`},Yy=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.editTrigger)!=null?n:`editable:${e.id}:edit`},sc=e=>e.getById(cg(e)),vR=e=>e.getById(Ky(e)),yR=e=>e.getById(zy(e)),bR=e=>e.getById(jy(e)),ER=e=>e.getById(Yy(e));SR=te({props({props:e}){return y(h({activationMode:"focus",submitMode:"both",defaultValue:"",selectOnFocus:!0},e),{translations:h({input:"editable input",edit:"edit",submit:"submit",cancel:"cancel"},e.translations)})},initialState({prop:e}){return e("edit")||e("defaultEdit")?"edit":"preview"},entry:["focusInputIfNeeded"],context:({bindable:e,prop:t})=>({value:e(()=>({defaultValue:t("defaultValue"),value:t("value"),onChange(n){var r;return(r=t("onValueChange"))==null?void 0:r({value:n})}})),previousValue:e(()=>({defaultValue:""}))}),watch({track:e,action:t,context:n,prop:r}){e([()=>n.get("value")],()=>{t(["syncInputValue"])}),e([()=>r("edit")],()=>{t(["toggleEditing"])})},computed:{submitOnEnter({prop:e}){let t=e("submitMode");return t==="both"||t==="enter"},submitOnBlur({prop:e}){let t=e("submitMode");return t==="both"||t==="blur"},isInteractive({prop:e}){return!(e("disabled")||e("readOnly"))}},on:{"VALUE.SET":{actions:["setValue"]}},states:{preview:{entry:["blurInput"],on:{"CONTROLLED.EDIT":{target:"edit",actions:["setPreviousValue","focusInput"]},EDIT:[{guard:"isEditControlled",actions:["invokeOnEdit"]},{target:"edit",actions:["setPreviousValue","focusInput","invokeOnEdit"]}]}},edit:{effects:["trackInteractOutside"],entry:["syncInputValue"],on:{"CONTROLLED.PREVIEW":[{guard:"isSubmitEvent",target:"preview",actions:["setPreviousValue","restoreFocus","invokeOnSubmit"]},{target:"preview",actions:["revertValue","restoreFocus","invokeOnCancel"]}],CANCEL:[{guard:"isEditControlled",actions:["invokeOnPreview"]},{target:"preview",actions:["revertValue","restoreFocus","invokeOnCancel","invokeOnPreview"]}],SUBMIT:[{guard:"isEditControlled",actions:["invokeOnPreview"]},{target:"preview",actions:["setPreviousValue","restoreFocus","invokeOnSubmit","invokeOnPreview"]}]}}},implementations:{guards:{isEditControlled:({prop:e})=>e("edit")!=null,isSubmitEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="SUBMIT"}},effects:{trackInteractOutside({send:e,scope:t,prop:n,computed:r}){return aa(sc(t),{exclude(i){return[bR(t),yR(t)].some(o=>ge(o,i))},onFocusOutside:n("onFocusOutside"),onPointerDownOutside:n("onPointerDownOutside"),onInteractOutside(i){var o;if((o=n("onInteractOutside"))==null||o(i),i.defaultPrevented)return;let{focusable:a}=i.detail;e({type:r("submitOnBlur")?"SUBMIT":"CANCEL",src:"interact-outside",focusable:a})}})}},actions:{restoreFocus({event:e,scope:t,prop:n}){e.focusable||B(()=>{var i,a;let r=(a=(i=n("finalFocusEl"))==null?void 0:i())!=null?a:ER(t);r==null||r.focus({preventScroll:!0})})},clearValue({context:e}){e.set("value","")},focusInputIfNeeded({action:e,prop:t}){(t("edit")||t("defaultEdit"))&&e(["focusInput"])},focusInput({scope:e,prop:t}){B(()=>{let n=sc(e);n&&(t("selectOnFocus")?n.select():n.focus({preventScroll:!0}))})},invokeOnCancel({prop:e,context:t}){var r;let n=t.get("previousValue");(r=e("onValueRevert"))==null||r({value:n})},invokeOnSubmit({prop:e,context:t}){var r;let n=t.get("value");(r=e("onValueCommit"))==null||r({value:n})},invokeOnEdit({prop:e}){var t;(t=e("onEditChange"))==null||t({edit:!0})},invokeOnPreview({prop:e}){var t;(t=e("onEditChange"))==null||t({edit:!1})},toggleEditing({prop:e,send:t,event:n}){t({type:e("edit")?"CONTROLLED.EDIT":"CONTROLLED.PREVIEW",previousEvent:n})},syncInputValue({context:e,scope:t}){let n=sc(t);n&&_e(n,e.get("value"))},setValue({context:e,prop:t,event:n}){let r=t("maxLength"),i=r!=null?n.value.slice(0,r):n.value;e.set("value",i)},setPreviousValue({context:e}){e.set("previousValue",e.get("value"))},revertValue({context:e}){let t=e.get("previousValue");t&&e.set("value",t)},blurInput({scope:e}){var t;(t=sc(e))==null||t.blur()}}}}),IR=class extends X{initMachine(e){return new Y(SR,e)}initApi(){return this.zagConnect(PR)}render(){var d;let e=(d=this.el.querySelector('[data-scope="editable"][data-part="root"]'))!=null?d:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="editable"][data-part="control"]');t&&this.spreadProps(t,this.api.getControlProps());let n=this.el.querySelector('[data-scope="editable"][data-part="area"]');n&&this.spreadProps(n,this.api.getAreaProps());let r=this.el.querySelector('[data-scope="editable"][data-part="label"]');r&&this.spreadProps(r,this.api.getLabelProps());let i=this.el.querySelector(`#${this.el.id}-value`);i&&(i.value=this.api.value,it(i,this.el));let a=this.el.querySelector('[data-scope="editable"][data-part="input"]');a&&this.spreadProps(a,this.api.getInputProps());let o=this.el.querySelector('[data-scope="editable"][data-part="preview"]');o&&this.spreadProps(o,this.api.getPreviewProps());let s=this.el.querySelector('[data-scope="editable"][data-part="edit-trigger"]');s&&this.spreadProps(s,this.api.getEditTriggerProps());let l=this.el.querySelector('[data-scope="editable"][data-part="submit-trigger"]');l&&this.spreadProps(l,this.api.getSubmitTriggerProps());let c=this.el.querySelector('[data-scope="editable"][data-part="cancel-trigger"]');c&&this.spreadProps(c,this.api.getCancelTriggerProps())}};wR={mounted(){var d,g;let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=V(e,"placeholder"),i=V(e,"activationMode"),a=O(e,"selectOnFocus");this.allowFormNotify=!1;let o=io(e,"value","defaultValue"),s=new IR(e,y(h(h(h(h(y(h({id:e.id},"value"in o?{value:(d=o.value)!=null?d:""}:{defaultValue:(g=o.defaultValue)!=null?g:""}),{disabled:O(e,"disabled"),readOnly:O(e,"readonly"),required:O(e,"required"),invalid:O(e,"invalid"),name:Wy(e),form:lc(e)?void 0:V(e,"form"),dir:q(e)}),r!==void 0?{placeholder:r}:{}),i!==void 0?{activationMode:i}:{}),a!==void 0?{selectOnFocus:a}:{}),O(e,"controlled")?{edit:O(e,"edit")}:{defaultEdit:O(e,"defaultEdit")}),{onValueChange:p=>{qy(e,t,n,p.value,this)},onValueCommit:p=>{qy(e,t,n,p.value,this)}}));s.init(),this.editable=s,queueMicrotask(()=>{dg(e,s.api.value,{markUsed:!1}),this.allowFormNotify=!0}),this.unbindFormSubmit=CR(e,s);let l=ie(e);this.domRegistry=l,l.add("corex:editable:set-value",p=>{var f;let u=(f=p.detail)==null?void 0:f.value;s.api.setValue(u==null?"":String(u))});let c=re(this);this.handleRegistry=c,c.add("editable_set_value",p=>{$(e.id,H(p))&&s.api.setValue(ao(p))})},updated(){var i,a;let e=this.el,t=br(e),n=Uh(e),r=h({id:e.id,disabled:O(e,"disabled"),readOnly:O(e,"readonly"),required:O(e,"required"),invalid:O(e,"invalid"),name:Wy(e),form:lc(e)?void 0:V(e,"form"),dir:q(e)},n);!((i=this.editable)!=null&&i.api.editing)&&"value"in t&&Object.assign(r,t),(a=this.editable)==null||a.updateProps(r)},destroyed(){var e,t,n,r;(e=this.unbindFormSubmit)==null||e.call(this),(t=this.domRegistry)==null||t.teardown(),(n=this.handleRegistry)==null||n.teardown(),(r=this.editable)==null||r.destroy()}}});var ub={};pe(ub,{FileUpload:()=>uk,fileAcceptPayload:()=>cb,fileChangePayload:()=>lb,fileRejectPayload:()=>db});function xR(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||/\w+\/[-+.\w]+/g.test(e)}function RR(e){return/^.*\.[\w]+$/.test(e)}function kR(e){if(e!=null)return typeof e=="string"?e:Array.isArray(e)?e.filter(Jy).join(","):Object.entries(e).reduce((t,[n,r])=>[...t,n,...r],[]).filter(Jy).join(",")}function NR(e,t,n){if(Ro(e.size))if(Ro(t)&&Ro(n)){if(e.size>n)return[!1,"FILE_TOO_LARGE"];if(e.sizen)return[!1,"FILE_TOO_LARGE"]}return[!0,null]}function FR(e){let t=e.split(".").pop();return t&&DR.get(t)||null}function MR(e,t){if(e&&t){let n=Array.isArray(t)?t:typeof t=="string"?t.split(","):[];if(n.length===0)return!0;let r=e.name||"",i=(e.type||FR(r)||"").toLowerCase(),a=i.replace(/\/.*$/,"");return n.some(o=>{let s=o.trim().toLowerCase();return s.charAt(0)==="."?r.toLowerCase().endsWith(s):s.endsWith("/*")?a===s.replace(/\/.*$/,""):i===s})}return!0}function _R(e,t){let n=e.type==="application/x-moz-file"||MR(e,t);return[n,n?null:"FILE_INVALID_TYPE"]}function $R(e){let t=new Map;return function(r,i){let a=r+(i?Object.entries(i).sort((s,l)=>s[0]n==="Files"||n==="application/x-moz-file"):!!t&&"files"in t}function ek(e,t,n){let{prop:r,computed:i}=e;return!i("multiple")&&t>1?!1:!i("multiple")&&t+n.length===2?!0:!(t+n.length>r("maxFiles"))}function tb(e,t,n=[],r=[]){let{prop:i,computed:a}=e,o=[],s=[],l={acceptedFiles:n,rejectedFiles:r};return t.forEach(c=>{var T;let[d,g]=_R(c,a("acceptAttr")),[p,u]=NR(c,i("minFileSize"),i("maxFileSize")),f=n.some(w=>ba(w,c))||o.some(w=>ba(w,c)),m=(T=i("validate"))==null?void 0:T(c,l),S=m?m.length===0:!0;if(d&&p&&S&&!f)o.push(c);else{let w=[g,u];f&&w.push("FILE_EXISTS"),S||w.push(...m!=null?m:[]),s.push({file:c,errors:w.filter(Boolean)})}}),ek(e,o.length,n)||(o.forEach(c=>{s.push({file:c,errors:["TOO_MANY_FILES"]})}),o.splice(0)),{acceptedFiles:o,rejectedFiles:s}}function tk(e,t){let n=ye(e);try{if("DataTransfer"in n){let r=new n.DataTransfer;t.forEach(i=>{r.items.add(i)}),e.files=r.files}}catch(r){}}function nb(e,t){if(!e||e.getAttribute("type")==="file")return!1;let n=e.closest(nk);return n!=t&&ge(t,n)}function rk(e,t){let{state:n,send:r,prop:i,computed:a,scope:o,context:s}=e,l=!!i("disabled"),c=!!i("readOnly"),d=!!i("required"),g=i("allowDrop"),p=i("translations"),u=n.matches("dragging"),f=n.matches("focused")&&!l,m=s.get("acceptedFiles"),S=i("maxFiles");return{dragging:u,focused:f,disabled:l,readOnly:c,transforming:s.get("transforming"),maxFilesReached:m.length>=S,remainingFiles:Math.max(0,S-m.length),openFilePicker(){l||c||r({type:"OPEN"})},deleteFile(T,w=Fr){l||c||r({type:"FILE.DELETE",file:T,itemType:w})},acceptedFiles:m,rejectedFiles:s.get("rejectedFiles"),setFiles(T){l||c||r({type:"FILES.SET",files:T,count:T.length})},clearRejectedFiles(){l||c||r({type:"REJECTED_FILES.CLEAR"})},clearFiles(){l||c||r({type:"FILES.CLEAR"})},getFileSize(T){return qR(T.size,i("locale"))},createFileUrl(T,w){let I=o.getWin(),P=I.URL.createObjectURL(T);return w(P),()=>I.URL.revokeObjectURL(P)},setClipboardFiles(T){var P;if(l||c)return!1;let I=Array.from((P=T==null?void 0:T.items)!=null?P:[]).reduce((v,E)=>{if(E.kind!=="file")return v;let R=E.getAsFile();return R?[...v,R]:v},[]);return I.length?(r({type:"FILE.SELECT",files:I}),!0):!1},getRootProps(){return t.element(y(h({},Zt.root.attrs),{dir:i("dir"),id:ob(o),"data-disabled":b(l),"data-readonly":b(c),"data-dragging":b(u)}))},getDropzoneProps(T={}){return t.element(y(h({},Zt.dropzone.attrs),{dir:i("dir"),id:sb(o),tabIndex:l||c||T.disableClick?void 0:0,role:T.disableClick?"application":"button","aria-label":p.dropzone,"aria-disabled":l||c||void 0,"data-invalid":b(i("invalid")),"data-disabled":b(l),"data-readonly":b(c),"data-dragging":b(u),onKeyDown(w){if(l||c||w.defaultPrevented)return;let I=ne(w);ge(w.currentTarget,I)&&(nb(I,w.currentTarget)||T.disableClick||w.key!=="Enter"&&w.key!==" "||r({type:"DROPZONE.CLICK",src:"keydown"}))},onClick(w){if(l||c||w.defaultPrevented||T.disableClick)return;let I=ne(w);ge(w.currentTarget,I)&&(nb(I,w.currentTarget)||(w.currentTarget.localName==="label"&&w.preventDefault(),r({type:"DROPZONE.CLICK"})))},onDragOver(w){if(l||c||!g)return;w.preventDefault(),w.stopPropagation();try{w.dataTransfer.dropEffect="copy"}catch(v){}if(!eb(w))return;let P=w.dataTransfer.items.length;r({type:"DROPZONE.DRAG_OVER",count:P})},onDragLeave(w){l||c||g&&(ge(w.currentTarget,w.relatedTarget)||r({type:"DROPZONE.DRAG_LEAVE"}))},onDrop(w){l||c||(g&&(w.preventDefault(),w.stopPropagation()),!eb(w))||AR(w.dataTransfer.items,i("directory")).then(P=>{r({type:"DROPZONE.DROP",files:Xc(P)})})},onFocus(){l||c||r({type:"DROPZONE.FOCUS"})},onBlur(){l||c||r({type:"DROPZONE.BLUR"})}}))},getTriggerProps(){return t.button(y(h({},Zt.trigger.attrs),{dir:i("dir"),id:WR(o),disabled:l||c,"data-disabled":b(l),"data-readonly":b(c),"data-invalid":b(i("invalid")),type:"button",onClick(T){l||c||(ge(QR(o),T.currentTarget)&&T.stopPropagation(),r({type:"OPEN"}))}}))},getHiddenInputProps(){return t.input({id:pg(o),tabIndex:-1,disabled:l||c,type:"file",required:i("required"),capture:i("capture"),name:i("name"),accept:a("acceptAttr"),webkitdirectory:i("directory")?"":void 0,multiple:a("multiple")||i("maxFiles")>1,"aria-hidden":!0,onClick(T){T.stopPropagation(),T.currentTarget.value=""},onInput(T){if(l||c)return;let{files:w}=T.currentTarget;r({type:"FILE.SELECT",files:w?Array.from(w):[]})},style:mt})},getItemGroupProps(T={}){let{type:w=Fr}=T;return t.element(y(h({},Zt.itemGroup.attrs),{dir:i("dir"),"data-disabled":b(l),"data-type":w}))},getItemProps(T){let{file:w,type:I=Fr}=T;return t.element(y(h({},Zt.item.attrs),{dir:i("dir"),id:zR(o,ko(w)),"data-disabled":b(l),"data-type":I}))},getItemNameProps(T){let{file:w,type:I=Fr}=T;return t.element(y(h({},Zt.itemName.attrs),{dir:i("dir"),id:jR(o,ko(w)),"data-disabled":b(l),"data-type":I}))},getItemSizeTextProps(T){let{file:w,type:I=Fr}=T;return t.element(y(h({},Zt.itemSizeText.attrs),{dir:i("dir"),id:YR(o,ko(w)),"data-disabled":b(l),"data-type":I}))},getItemPreviewProps(T){let{file:w,type:I=Fr}=T;return t.element(y(h({},Zt.itemPreview.attrs),{dir:i("dir"),id:XR(o,ko(w)),"data-disabled":b(l),"data-type":I}))},getItemPreviewImageProps(T){var E;let{file:w,url:I,type:P=Fr}=T;if(!w.type.startsWith("image/"))throw new Error("Preview Image is only supported for image files");return t.img(y(h({},Zt.itemPreviewImage.attrs),{alt:(E=p.itemPreview)==null?void 0:E.call(p,w),src:I,"data-disabled":b(l),"data-type":P}))},getItemDeleteTriggerProps(T){var P;let{file:w,type:I=Fr}=T;return t.button(y(h({},Zt.itemDeleteTrigger.attrs),{dir:i("dir"),id:ZR(o,ko(w)),type:"button",disabled:l||c,"data-disabled":b(l),"data-readonly":b(c),"data-type":I,"aria-label":(P=p.deleteFile)==null?void 0:P.call(p,w),onClick(){l||c||r({type:"FILE.DELETE",file:w,itemType:I})}}))},getLabelProps(){return t.label(y(h({},Zt.label.attrs),{dir:i("dir"),id:KR(o),htmlFor:pg(o),"data-disabled":b(l),"data-required":b(d)}))},getClearTriggerProps(){return t.button(y(h({},Zt.clearTrigger.attrs),{dir:i("dir"),type:"button",disabled:l||c,hidden:m.length===0,"data-disabled":b(l),"data-readonly":b(c),onClick(T){T.defaultPrevented||l||c||r({type:"FILES.CLEAR"})}}))}}}function rb(e){return String.fromCharCode(e+(e>25?39:97))}function ak(e){let t="",n;for(n=Math.abs(e);n>52;n=n/52|0)t=rb(n%52)+t;return rb(n%52)+t}function ok(e,t){let n=t.length;for(;n;)e=e*33^t.charCodeAt(--n);return e}function sk(e){return ak(ok(5381,e)>>>0)}function No(e){return sk(`${e.name}-${e.size}`)}function lk(e){return e.includes("[")?e.replace(/\[([^\]]+)\]$/,"[$1_label]"):`${e}_label`}function ck(e,t){try{if(typeof window.DataTransfer!="undefined"){let n=new window.DataTransfer;for(let r of t)n.items.add(r);e.files=n.files}}catch(n){}}function lb(e,t){var r,i;let n=t.acceptedFiles[0];return{id:e.id,acceptedCount:t.acceptedFiles.length,rejectedCount:t.rejectedFiles.length,acceptedNames:t.acceptedFiles.map(a=>a.name),firstAcceptedName:(r=n==null?void 0:n.name)!=null?r:null,firstAcceptedType:(i=n==null?void 0:n.type)!=null?i:null}}function cb(e,t){return{id:e.id,count:t.files.length}}function db(e,t){return{id:e.id,count:t.files.length}}var OR,Zt,VR,ib,ug,gg,AR,ab,Jy,ba,Ro,LR,DR,HR,UR,GR,qR,ob,sb,pg,WR,KR,zR,jR,YR,XR,ZR,ko,JR,Qy,QR,Fr,nk,ik,rr,dk,uk,gb=ee(()=>{"use strict";ai();Kt();Ve();be();oe();OR=z("file-upload").parts("root","dropzone","item","itemDeleteTrigger","itemGroup","itemName","itemPreview","itemPreviewImage","itemSizeText","label","trigger","clearTrigger"),Zt=OR.build(),VR=e=>typeof e.getAsEntry=="function"?e.getAsEntry():typeof e.webkitGetAsEntry=="function"?e.webkitGetAsEntry():null,ib=e=>e.isDirectory,ug=e=>e.isFile,gg=(e,t)=>(Object.defineProperty(e,"relativePath",{value:t?`${t}/${e.name}`:e.name}),e),AR=(e,t)=>Promise.all(Array.from(e).filter(n=>n.kind==="file").map(n=>{let r=VR(n);if(!r)return null;if(ib(r)&&t)return ab(r.createReader(),`${r.name}`);if(ug(r)&&typeof n.getAsFile=="function"){let i=n.getAsFile();return Promise.resolve(i?gg(i,""):null)}if(ug(r))return new Promise(i=>{r.file(a=>{i(gg(a,""))})})}).filter(n=>n)),ab=(e,t="")=>new Promise(n=>{let r=[],i=()=>{e.readEntries(a=>{if(a.length===0){n(Promise.all(r).then(s=>s.flat()));return}let o=a.map(s=>{if(!s)return null;if(ib(s))return ab(s.createReader(),`${t}${s.name}`);if(ug(s))return new Promise(l=>{s.file(c=>{l(gg(c,t))})})}).filter(s=>s);r.push(Promise.all(o)),i()})};i()});Jy=e=>xR(e)||RR(e);ba=(e,t)=>e.name===t.name&&e.size===t.size&&e.type===t.type,Ro=e=>e!=null;LR="3g2_video/3gpp2[3gp,3gpp_video/3gpp[3mf_model/3mf[7z_application/x-7z-compressed[aac_audio/aac[ac_application/pkix-attr-cert[adp_audio/adpcm[adts_audio/aac[ai_application/postscript[aml_application/automationml-aml+xml[amlx_application/automationml-amlx+zip[amr_audio/amr[apk_application/vnd.android.package-archive[apng_image/apng[appcache,manifest_text/cache-manifest[appinstaller_application/appinstaller[appx_application/appx[appxbundle_application/appxbundle[asc_application/pgp-keys[atom_application/atom+xml[atomcat_application/atomcat+xml[atomdeleted_application/atomdeleted+xml[atomsvc_application/atomsvc+xml[au,snd_audio/basic[avi_video/x-msvideo[avci_image/avci[avcs_image/avcs[avif_image/avif[aw_application/applixware[bdoc_application/bdoc[bin,bpk,buffer,deb,deploy,dist,distz,dll,dmg,dms,dump,elc,exe,img,iso,lrf,mar,msi,msm,msp,pkg,so_application/octet-stream[bmp,dib_image/bmp[btf,btif_image/prs.btif[bz2_application/x-bzip2[c_text/x-c[ccxml_application/ccxml+xml[cdfx_application/cdfx+xml[cdmia_application/cdmi-capability[cdmic_application/cdmi-container[cdmid_application/cdmi-domain[cdmio_application/cdmi-object[cdmiq_application/cdmi-queue[cer_application/pkix-cert[cgm_image/cgm[cjs_application/node[class_application/java-vm[coffee,litcoffee_text/coffeescript[conf,def,in,ini,list,log,text,txt_text/plain[cpp,cxx,cc_text/x-c++src[cpl_application/cpl+xml[cpt_application/mac-compactpro[crl_application/pkix-crl[css_text/css[csv_text/csv[cu_application/cu-seeme[cwl_application/cwl[cww_application/prs.cww[davmount_application/davmount+xml[dbk_application/docbook+xml[doc_application/msword[docx_application/vnd.openxmlformats-officedocument.wordprocessingml.document[dsc_text/prs.lines.tag[dssc_application/dssc+der[dtd_application/xml-dtd[dwd_application/atsc-dwd+xml[ear,jar,war_application/java-archive[ecma_application/ecmascript[emf_image/emf[eml,mime_message/rfc822[emma_application/emma+xml[emotionml_application/emotionml+xml[eot_application/vnd.ms-fontobject[eps,ps_application/postscript[epub_application/epub+zip[exi_application/exi[exp_application/express[exr_image/aces[ez_application/andrew-inset[fdf_application/fdf[fdt_application/fdt+xml[fits_image/fits[flac_audio/flac[flv_video/x-flv[g3_image/g3fax[geojson_application/geo+json[gif_image/gif[glb_model/gltf-binary[gltf_model/gltf+json[gml_application/gml+xml[go_text/x-go[gpx_application/gpx+xml[gz_application/gzip[h_text/x-h[h261_video/h261[h263_video/h263[h264_video/h264[heic_image/heic[heics_image/heic-sequence[heif_image/heif[heifs_image/heif-sequence[htm,html,shtml_text/html[ico_image/x-icon[icns_image/x-icns[ics,ifb_text/calendar[iges,igs_model/iges[ink,inkml_application/inkml+xml[ipa_application/octet-stream[java_text/x-java-source[jp2,jpg2_image/jp2[jpeg,jpe,jpg_image/jpeg[jpf,jpx_image/jpx[jpm,jpgm_image/jpm[jpgv_video/jpeg[jph_image/jph[js,mjs_text/javascript[json_application/json[json5_application/json5[jsonld_application/ld+json[jsx_text/jsx[jxl_image/jxl[jxr_image/jxr[ktx_image/ktx[ktx2_image/ktx2[less_text/less[m1v,m2v,mpe,mpeg,mpg_video/mpeg[m4a_audio/mp4[m4v_video/x-m4v[md,markdown_text/markdown[mid,midi,kar,rmi_audio/midi[mkv_video/x-matroska[mp2,mp2a,mp3,mpga,m3a,m2a_audio/mpeg[mp4,mp4v,mpg4_video/mp4[mp4a_audio/mp4[mp4s,m4p_application/mp4[odp_application/vnd.oasis.opendocument.presentation[oda_application/oda[ods_application/vnd.oasis.opendocument.spreadsheet[odt_application/vnd.oasis.opendocument.text[oga,ogg,opus,spx_audio/ogg[ogv_video/ogg[ogx_application/ogg[otf_font/otf[p12,pfx_application/x-pkcs12[pdf_application/pdf[pem_application/x-pem-file[php_text/x-php[png_image/png[ppt_application/vnd.ms-powerpoint[pptx_application/vnd.openxmlformats-officedocument.presentationml.presentation[pskcxml_application/pskc+xml[psd_image/vnd.adobe.photoshop[py_text/x-python[qt,mov_video/quicktime[rar_application/vnd.rar[rdf_application/rdf+xml[rtf_text/rtf[sass_text/x-sass[scss_text/x-scss[sgm,sgml_text/sgml[sh_application/x-sh[svg,svgz_image/svg+xml[swf_application/x-shockwave-flash[tar_application/x-tar[tif,tiff_image/tiff[toml_application/toml[ts_video/mp2t[tsx_text/tsx[tsv_text/tab-separated-values[ttc_font/collection[ttf_font/ttf[vtt_text/vtt[wasm_application/wasm[wav_audio/wav[weba_audio/webm[webm_video/webm[webmanifest_application/manifest+json[webp_image/webp[wma_audio/x-ms-wma[wmv_video/x-ms-wmv[woff_font/woff[woff2_font/woff2[xls_application/vnd.ms-excel[xlsx_application/vnd.openxmlformats-officedocument.spreadsheetml.sheet[xml_application/xml[xz_application/x-xz[yaml,yml_text/yaml[zip_application/zip",DR=new Map(LR.split("[").flatMap(e=>{let[t,n]=e.split("_");return t.split(",").map(r=>[r,n])}));HR=$R(Intl.NumberFormat);UR=["","kilo","mega","giga","tera"],GR=["","kilo","mega","giga","tera","peta"],qR=(e,t="en-US",n={})=>{if(Number.isNaN(e))return"";if(e===0)return"0 B";let{unitSystem:r="decimal",precision:i=3,unit:a="byte",unitDisplay:o="short"}=n,s=r==="binary"?1024:1e3,l=a==="bit"?UR:GR,c=e<0,g=Math.abs(e),p=0;for(;g>=s&&p{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`file:${e.id}`},sb=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.dropzone)!=null?n:`file:${e.id}:dropzone`},pg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`file:${e.id}:input`},WR=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`file:${e.id}:trigger`},KR=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`file:${e.id}:label`},zR=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.item)==null?void 0:r.call(n,t))!=null?i:`file:${e.id}:item:${t}`},jR=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemName)==null?void 0:r.call(n,t))!=null?i:`file:${e.id}:item-name:${t}`},YR=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemSizeText)==null?void 0:r.call(n,t))!=null?i:`file:${e.id}:item-size:${t}`},XR=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemPreview)==null?void 0:r.call(n,t))!=null?i:`file:${e.id}:item-preview:${t}`},ZR=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemDeleteTrigger)==null?void 0:r.call(n,t))!=null?i:`file:${e.id}:item-delete:${t}`},ko=e=>Jp(`${e.name}-${e.size}`),JR=e=>e.getById(ob(e)),Qy=e=>e.getById(pg(e)),QR=e=>e.getById(sb(e));Fr="accepted",nk="button, a[href], input:not([type='file']), select, textarea, [tabindex], [contenteditable]";ik=te({props({props:e}){return y(h({minFileSize:0,maxFileSize:Number.POSITIVE_INFINITY,maxFiles:1,allowDrop:!0,preventDocumentDrop:!0,defaultAcceptedFiles:[]},e),{translations:h({dropzone:"dropzone",itemPreview:t=>`preview of ${t.name}`,deleteFile:t=>`delete file ${t.name}`},e.translations)})},initialState(){return"idle"},context({prop:e,bindable:t,getContext:n}){return{acceptedFiles:t(()=>({defaultValue:e("defaultAcceptedFiles"),value:e("acceptedFiles"),isEqual:(r,i)=>r.length===(i==null?void 0:i.length)&&r.every((a,o)=>ba(a,i[o])),hash(r){return r.map(i=>`${i.name}-${i.size}`).join(",")},onChange(r){var a,o;let i=n();(a=e("onFileAccept"))==null||a({files:r}),(o=e("onFileChange"))==null||o({acceptedFiles:r,rejectedFiles:i.get("rejectedFiles")})}})),rejectedFiles:t(()=>({defaultValue:[],isEqual:(r,i)=>r.length===(i==null?void 0:i.length)&&r.every((a,o)=>ba(a.file,i[o].file)),onChange(r){var a,o;let i=n();(a=e("onFileReject"))==null||a({files:r}),(o=e("onFileChange"))==null||o({acceptedFiles:i.get("acceptedFiles"),rejectedFiles:r})}})),transforming:t(()=>({defaultValue:!1}))}},computed:{acceptAttr:({prop:e})=>kR(e("accept")),multiple:({prop:e})=>e("maxFiles")>1},watch({track:e,context:t,action:n}){e([()=>t.hash("acceptedFiles")],()=>{n(["syncInputElement"])})},on:{"FILES.SET":{actions:["setFiles"]},"FILE.SELECT":{actions:["setEventFiles"]},"FILE.DELETE":{actions:["removeFile"]},"FILES.CLEAR":{actions:["clearFiles"]},"REJECTED_FILES.CLEAR":{actions:["clearRejectedFiles"]}},effects:["preventDocumentDrop"],states:{idle:{on:{OPEN:{actions:["openFilePicker"]},"DROPZONE.CLICK":{actions:["openFilePicker"]},"DROPZONE.FOCUS":{target:"focused"},"DROPZONE.DRAG_OVER":{target:"dragging"}}},focused:{on:{"DROPZONE.BLUR":{target:"idle"},OPEN:{actions:["openFilePicker"]},"DROPZONE.CLICK":{actions:["openFilePicker"]},"DROPZONE.DRAG_OVER":{target:"dragging"}}},dragging:{on:{"DROPZONE.DROP":{target:"idle",actions:["setEventFiles"]},"DROPZONE.DRAG_LEAVE":{target:"idle"}}}},implementations:{effects:{preventDocumentDrop({prop:e,scope:t}){if(!e("preventDocumentDrop")||!e("allowDrop")||e("disabled"))return;let n=t.getDoc(),r=a=>{a==null||a.preventDefault()},i=a=>{ge(JR(t),ne(a))||a.preventDefault()};return Ct(ae(n,"dragover",r,!1),ae(n,"drop",i,!1))}},actions:{syncInputElement({scope:e,context:t}){queueMicrotask(()=>{let n=Qy(e);if(!n)return;tk(n,t.get("acceptedFiles"));let r=e.getWin();n.dispatchEvent(new r.Event("change",{bubbles:!0}))})},openFilePicker({scope:e}){B(()=>{var t;(t=Qy(e))==null||t.click()})},setFiles(e){let{computed:t,context:n,event:r}=e,{acceptedFiles:i,rejectedFiles:a}=tb(e,r.files);n.set("acceptedFiles",t("multiple")?i:i.length>0?[i[0]]:[]),n.set("rejectedFiles",a)},setEventFiles(e){let{computed:t,context:n,event:r,prop:i}=e,a=n.get("acceptedFiles"),o=n.get("rejectedFiles"),{acceptedFiles:s,rejectedFiles:l}=tb(e,r.files,a,o),c=g=>{if(t("multiple")){n.set("acceptedFiles",p=>[...p,...g]),n.set("rejectedFiles",l);return}if(g.length){n.set("acceptedFiles",[g[0]]),n.set("rejectedFiles",l);return}l.length&&(n.set("acceptedFiles",n.get("acceptedFiles")),n.set("rejectedFiles",l))},d=i("transformFiles");d?(n.set("transforming",!0),d(s).then(c).catch(g=>{It(`[zag-js/file-upload] error transforming files -${g}`)}).finally(()=>{n.set("transforming",!1)})):c(s)},removeFile({context:e,event:t}){if(t.itemType==="rejected"){let n=e.get("rejectedFiles").filter(r=>!ba(r.file,t.file));e.set("rejectedFiles",n)}else{let n=e.get("acceptedFiles").filter(r=>!ba(r,t.file));e.set("acceptedFiles",n)}},clearRejectedFiles({context:e}){e.set("rejectedFiles",[])},clearFiles({context:e}){e.set("acceptedFiles",[]),e.set("rejectedFiles",[])}}}}),rr="accepted";dk=class extends X{constructor(){super(...arguments);Q(this,"previewCleanup",new Map);Q(this,"sentinelSnapshot","")}initMachine(t){return new Y(ik,t)}initApi(){return this.zagConnect(rk)}cleanupPreviews(){for(let t of this.previewCleanup.values())t();this.previewCleanup.clear()}render(){var l,c,d;let t=(l=this.el.querySelector('[data-scope="file-upload"][data-part="root"]'))!=null?l:this.el;this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="file-upload"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps());let r=this.el.querySelector('[data-scope="file-upload"][data-part="dropzone"]');r&&this.spreadProps(r,this.api.getDropzoneProps());let i=this.el.querySelector('[data-scope="file-upload"][data-part="trigger"]');i&&this.spreadProps(i,this.api.getTriggerProps());let a=(c=this.el.querySelector('[data-scope="file-upload"][data-part="hidden-input"]'))!=null?c:t.querySelector('input[type="file"]');a&&this.spreadProps(a,this.api.getHiddenInputProps());let o=this.el.querySelector('ul[data-scope="file-upload"][data-part="item-group"][data-file-type="accepted"]');o&&(this.spreadProps(o,this.api.getItemGroupProps({type:rr})),this.syncAcceptedItems(o));let s=this.el.querySelectorAll('[data-scope="file-upload"][data-part="item"]');for(let g of Array.from(s)){let p=this.getAcceptedFileForElement(g);if(!p)continue;this.spreadProps(g,this.api.getItemProps({file:p,type:rr}));let u=g.querySelector('[data-scope="file-upload"][data-part="item-name"]');u&&this.spreadProps(u,this.api.getItemNameProps({file:p,type:rr}));let f=g.querySelector('[data-scope="file-upload"][data-part="item-preview"]');f&&this.spreadProps(f,this.api.getItemPreviewProps({file:p,type:rr}));let m=g.querySelector('[data-scope="file-upload"][data-part="item-preview-image"]');if(m&&p.type.startsWith("image/")){let w=No(p);if(m.dataset.corexPreviewKey!==w||!m.getAttribute("src")){let P=this.previewCleanup.get(m);P==null||P(),m.removeAttribute("src");let v=this.api.createFileUrl(p,E=>{this.spreadProps(m,this.api.getItemPreviewImageProps({file:p,type:rr,url:E}))});this.previewCleanup.set(m,v),m.dataset.corexPreviewKey=w}else{let P=(d=m.getAttribute("src"))!=null?d:"";P&&this.spreadProps(m,this.api.getItemPreviewImageProps({file:p,type:rr,url:P}))}}let S=g.querySelector('[data-scope="file-upload"][data-part="item-size-text"]');S&&(this.spreadProps(S,this.api.getItemSizeTextProps({file:p,type:rr})),S.textContent=this.api.getFileSize(p));let T=g.querySelector('[data-scope="file-upload"][data-part="item-delete-trigger"]');T&&this.spreadProps(T,this.api.getItemDeleteTriggerProps({file:p,type:rr}))}this.syncFormSubmitInputs(),this.touchSentinel()}syncFormSubmitInputs(){let t=this.el.querySelector('[data-scope="file-upload"][data-part="hidden-input"]'),n=this.el.querySelector('[data-part="hidden-input-sentinel"]'),r=this.api.acceptedFiles,i=this.el.dataset.name;if(t&&ck(t,r),this.syncAcceptedNamesHidden(i,r),!!n){if(r.length>0){n.disabled=!0,n.removeAttribute("name");return}n.disabled=!1,i&&n.setAttribute("name",i)}}syncAcceptedNamesHidden(t,n){var l;if(!t)return;let r=lk(t),i=(l=this.el.querySelector('[data-scope="file-upload"][data-part="region"]'))!=null?l:this.el,a=i.querySelector('[data-scope="file-upload"][data-part="accepted-names-hidden"]');a||(a=document.createElement("input"),a.type="hidden",a.setAttribute("data-scope","file-upload"),a.setAttribute("data-part","accepted-names-hidden"),i.appendChild(a));let o=n.map(c=>c.name).filter(Boolean).join(", ");if(o===""){a.disabled=!0,a.removeAttribute("name"),a.value="";return}a.disabled=!1,a.name=r,a.value=o;let s=this.el.dataset.form;s?a.setAttribute("form",s):a.removeAttribute("form")}touchSentinel(){let t=this.el.querySelector('[data-part="hidden-input-sentinel"]');if(!t)return;let n=this.api.acceptedFiles.map(r=>No(r)).join(",");n!==this.sentinelSnapshot&&(this.sentinelSnapshot=n,t.dispatchEvent(new Event("input",{bubbles:!0})))}syncAcceptedItems(t){this.syncItemList(t,this.api.acceptedFiles)}syncItemList(t,n){let r=n.map(o=>No(o)),i=new Set(r),a=new Map;t.querySelectorAll("li[data-corex-file-item]").forEach(o=>{let s=o.dataset.fileKey;s&&a.set(s,o)});for(let o of[...a.keys()])if(!i.has(o)){let s=a.get(o);if(!s)continue;s.querySelectorAll('img[data-part="item-preview-image"]').forEach(l=>{let c=this.previewCleanup.get(l);c&&(c(),this.previewCleanup.delete(l))}),s.remove(),a.delete(o)}for(let o of n){let s=No(o),l=a.get(s);l||(l=this.buildItemLi(o,s),a.set(s,l)),t.appendChild(l)}}buildItemLi(t,n){let r=this.doc,i=r.createElement("li");i.setAttribute("data-scope","file-upload"),i.setAttribute("data-part","item"),i.setAttribute("data-corex-file-item",""),i.dataset.fileKey=n,i.dataset.fileType=rr;let a=r.createElement("div");if(a.setAttribute("data-scope","file-upload"),a.setAttribute("data-part","item-lead"),t.type.startsWith("image/")){let c=r.createElement("div");c.setAttribute("data-scope","file-upload"),c.setAttribute("data-part","item-preview");let d=r.createElement("img");d.setAttribute("data-scope","file-upload"),d.setAttribute("data-part","item-preview-image"),c.appendChild(d),a.appendChild(c)}i.appendChild(a);let o=r.createElement("div");o.setAttribute("data-scope","file-upload"),o.setAttribute("data-part","item-name"),o.textContent=t.name,i.appendChild(o);let s=r.createElement("div");s.setAttribute("data-scope","file-upload"),s.setAttribute("data-part","item-size-text"),i.appendChild(s);let l=r.createElement("button");return l.setAttribute("data-scope","file-upload"),l.setAttribute("data-part","item-delete-trigger"),l.type="button",this.fillDeleteTriggerContent(l),i.appendChild(l),i}fillDeleteTriggerContent(t){let n=this.el.querySelector("[data-file-upload-item-close-template]");if(!(n!=null&&n.content))return;t.replaceChildren();let r=n.content.cloneNode(!0);for(let i of Array.from(r.childNodes))i.nodeType===1&&t.appendChild(i)}getAcceptedFileForElement(t){let n=t.dataset.fileKey;if(n)return this.api.acceptedFiles.find(r=>No(r)===n)}};uk={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=G(e,"maxFiles"),i=G(e,"maxFileSize"),a=G(e,"minFileSize"),o=e.dataset.allowDrop,s=e.dataset.preventDocumentDrop,l=V(e,"translationDropzone"),c=new dk(e,{id:e.id,disabled:O(e,"disabled"),invalid:O(e,"invalid"),readOnly:O(e,"readonly"),required:O(e,"required"),name:V(e,"name"),dir:q(e),allowDrop:o===void 0?!0:o!=="false",preventDocumentDrop:s===void 0?!0:s!=="false",maxFiles:r!=null?r:1,maxFileSize:i!=null?i:Number.POSITIVE_INFINITY,minFileSize:a!=null?a:0,accept:V(e,"accept"),directory:O(e,"directory"),translations:l?{dropzone:l}:void 0,onFileChange:p=>{W({el:e,canPushServer:n(),pushEvent:t,payload:lb(e,p),serverEventName:V(e,"onFileChange"),clientEventName:V(e,"onFileChangeClient")})},onFileAccept:p=>{W({el:e,canPushServer:n(),pushEvent:t,payload:cb(e,p),serverEventName:V(e,"onFileAccept"),clientEventName:V(e,"onFileAcceptClient")})},onFileReject:p=>{W({el:e,canPushServer:n(),pushEvent:t,payload:db(e,p),serverEventName:V(e,"onFileReject"),clientEventName:V(e,"onFileRejectClient")})}});c.init(),this.fileUpload=c,this.handlers=[],this.unbindSubmitIntent=oa(e,()=>{c.syncFormSubmitInputs()});let d=ie(e);this.domRegistry=d,d.add("corex:file-upload:clear-files",()=>{c.api.clearFiles()}),d.add("corex:file-upload:clear-rejected",()=>{c.api.clearRejectedFiles()}),d.add("corex:file-upload:open",()=>{c.api.openFilePicker()});let g=re(this);this.handleRegistry=g,g.add("file_upload_clear_files",p=>{$(e.id,H(p))&&c.api.clearFiles()}),g.add("file_upload_clear_rejected",p=>{$(e.id,H(p))&&c.api.clearRejectedFiles()}),g.add("file_upload_open",p=>{$(e.id,H(p))&&c.api.openFilePicker()})},updated(){var e,t,n,r;(r=this.fileUpload)==null||r.updateProps({id:this.el.id,disabled:O(this.el,"disabled"),invalid:O(this.el,"invalid"),readOnly:O(this.el,"readonly"),required:O(this.el,"required"),name:V(this.el,"name"),dir:q(this.el),allowDrop:this.el.dataset.allowDrop===void 0?!0:this.el.dataset.allowDrop!=="false",preventDocumentDrop:this.el.dataset.preventDocumentDrop===void 0?!0:this.el.dataset.preventDocumentDrop!=="false",maxFiles:(e=G(this.el,"maxFiles"))!=null?e:1,maxFileSize:(t=G(this.el,"maxFileSize"))!=null?t:Number.POSITIVE_INFINITY,minFileSize:(n=G(this.el,"minFileSize"))!=null?n:0,accept:V(this.el,"accept"),directory:O(this.el,"directory")})},destroyed(){var e,t,n,r,i;if((e=this.unbindSubmitIntent)==null||e.call(this),this.handlers)for(let a of this.handlers)this.removeHandleEvent(a);(t=this.domRegistry)==null||t.teardown(),(n=this.handleRegistry)==null||n.teardown(),(r=this.fileUpload)==null||r.cleanupPreviews(),(i=this.fileUpload)==null||i.destroy()}}});var Rb={};pe(Rb,{FloatingPanel:()=>Mk,buildAnchorProps:()=>vg,parsePoint:()=>xb,parseSize:()=>Ia});function yk(e){if(!hg.has(e)){let t=e.ownerDocument.defaultView||window;hg.set(e,t.getComputedStyle(e))}return hg.get(e)}function wb(e,t={}){return Wn(bk(e,t))}function bk(e,t={}){let{excludeScrollbar:n=!1,excludeBorders:r=!1}=t,{x:i,y:a,width:o,height:s}=e.getBoundingClientRect(),l={x:i,y:a,width:o,height:s},c=yk(e),{borderLeftWidth:d,borderTopWidth:g,borderRightWidth:p,borderBottomWidth:u}=c,f=fb(d,p),m=fb(g,u);if(r&&(l.width-=f,l.height-=m,l.x+=fg(d),l.y+=fg(g)),n){let S=e.offsetWidth-e.clientWidth-f,T=e.offsetHeight-e.clientHeight-m;l.width-=S,l.height-=T}return l}function Ek(e,t={}){return Wn(Pk(e,t))}function Pk(e,t){let{excludeScrollbar:n=!1}=t,{innerWidth:r,innerHeight:i,document:a,visualViewport:o}=e,s=(o==null?void 0:o.width)||r,l=(o==null?void 0:o.height)||i,c={x:0,y:0,width:s,height:l};if(n){let d=r-a.documentElement.clientWidth,g=i-a.documentElement.clientHeight;c.width-=d,c.height-=g}return c}function yb(e,t){let{minX:n,minY:r,maxX:i,maxY:a,midX:o,midY:s}=e,l=t.includes("w")?n:t.includes("e")?i:o,c=t.includes("n")?r:t.includes("s")?a:s;return{x:l,y:c}}function Ik(e){return Sk[e]}function Tk(e,t,n,r){let{scalingOriginMode:i,lockAspectRatio:a}=r,o=yb(e,n),s=Ik(n),l=yb(e,s);i==="center"&&(t={x:t.x*2,y:t.y*2});let c={x:o.x+t.x,y:o.y+t.y},d={x:mb[n].x*2-1,y:mb[n].y*2-1},g={width:c.x-l.x,height:c.y-l.y},p=d.x*g.width/e.width,u=d.y*g.height/e.height,f=Sa(p)>Sa(u)?p:u,m=a?{x:f,y:f}:{x:o.x===l.x?1:p,y:o.y===l.y?1:u};switch(o.y===l.y?m.y=Sa(m.y):cc(m.y)!==cc(u)&&(m.y*=-1),o.x===l.x?m.x=Sa(m.x):cc(m.x)!==cc(p)&&(m.x*=-1),i){case"extent":return bb(e,pb.scale(m.x,m.y,l),!1);case"center":return bb(e,pb.scale(m.x,m.y,{x:e.midX,y:e.midY}),!1)}}function Ck(e,t,n=!0){return n?{x:vb(t.x,e.x),y:vb(t.y,e.y),width:Sa(t.x-e.x),height:Sa(t.y-e.y)}:{x:e.x,y:e.y,width:t.x-e.x,height:t.y-e.y}}function bb(e,t,n=!0){let r=t.applyTo({x:e.minX,y:e.minY}),i=t.applyTo({x:e.maxX,y:e.maxY});return Ck(r,i,n)}function Ok(e){switch(e){case"n":return{cursor:"n-resize",width:"100%",top:0,left:"50%",translate:"-50%"};case"e":return{cursor:"e-resize",height:"100%",right:0,top:"50%",translate:"0 -50%"};case"s":return{cursor:"s-resize",width:"100%",bottom:0,left:"50%",translate:"-50%"};case"w":return{cursor:"w-resize",height:"100%",left:0,top:"50%",translate:"0 -50%"};case"se":return{cursor:"se-resize",bottom:0,right:0};case"sw":return{cursor:"sw-resize",bottom:0,left:0};case"ne":return{cursor:"ne-resize",top:0,right:0};case"nw":return{cursor:"nw-resize",top:0,left:0};default:throw new Error(`Invalid axis: ${e}`)}}function Vk(e,t){let{state:n,send:r,scope:i,prop:a,computed:o,context:s}=e,l=n.hasTag("open"),c=n.matches("open.dragging"),d=n.matches("open.resizing"),g=s.get("isTopmost"),p=s.get("size"),u=s.get("position"),f=o("isMaximized"),m=o("isMinimized"),S=o("isStaged"),T=o("canResize"),w=o("canDrag");return{open:l,resizable:a("resizable"),draggable:a("draggable"),setOpen(I){n.hasTag("open")!==I&&r({type:I?"OPEN":"CLOSE"})},dragging:c,resizing:d,position:u,size:p,setPosition(I){r({type:"SET_POSITION",position:I})},setSize(I){r({type:"SET_SIZE",size:I})},minimize(){r({type:"MINIMIZE"})},maximize(){r({type:"MAXIMIZE"})},restore(){r({type:"RESTORE"})},getTriggerProps(){return t.button(y(h({},ln.trigger.attrs),{dir:a("dir"),type:"button",disabled:a("disabled"),id:Ob(i),"data-state":l?"open":"closed","data-dragging":b(c),"aria-controls":mg(i),onClick(I){if(I.defaultPrevented||a("disabled"))return;let P=n.hasTag("open");r({type:P?"CLOSE":"OPEN",src:"trigger"})}}))},getPositionerProps(){return t.element(y(h({},ln.positioner.attrs),{dir:a("dir"),id:Vb(i),style:{"--width":ke(p==null?void 0:p.width),"--height":ke(p==null?void 0:p.height),"--x":ke(u==null?void 0:u.x),"--y":ke(u==null?void 0:u.y),position:a("strategy"),top:"var(--y)",left:"var(--x)"}}))},getContentProps(){return t.element(y(h({},ln.content.attrs),{dir:a("dir"),role:"dialog",tabIndex:0,hidden:!l,id:mg(i),"aria-labelledby":Eb(i),"data-state":l?"open":"closed","data-dragging":b(c),"data-topmost":b(g),"data-behind":b(!g),"data-minimized":b(m),"data-maximized":b(f),"data-staged":b(S),style:{width:"var(--width)",height:"var(--height)",overflow:m?"hidden":void 0},onFocus(){r({type:"CONTENT_FOCUS"})},onKeyDown(I){if(I.defaultPrevented)return;if(I.key==="Escape"&&g){r({type:"ESCAPE"});return}if(I.currentTarget!==ne(I))return;let P=Hn(I)*a("gridSize"),E={ArrowLeft(){r({type:"MOVE",direction:"left",step:P})},ArrowRight(){r({type:"MOVE",direction:"right",step:P})},ArrowUp(){r({type:"MOVE",direction:"up",step:P})},ArrowDown(){r({type:"MOVE",direction:"down",step:P})}}[me(I,{dir:a("dir")})];E&&(I.preventDefault(),E(I))}}))},getCloseTriggerProps(){return t.button(y(h({},ln.closeTrigger.attrs),{dir:a("dir"),disabled:a("disabled"),"aria-label":"Close Window",type:"button",onClick(I){I.defaultPrevented||r({type:"CLOSE"})}}))},getStageTriggerProps(I){if(!Tb.has(I.stage))throw new Error(`[zag-js] Invalid stage: ${I.stage}. Must be one of: ${Array.from(Tb).join(", ")}`);let P=a("translations"),v=He(I.stage,{minimized:()=>({"aria-label":P.minimize,hidden:S}),maximized:()=>({"aria-label":P.maximize,hidden:S}),default:()=>({"aria-label":P.restore,hidden:!S})});return t.button(y(h(y(h({},ln.stageTrigger.attrs),{dir:a("dir"),disabled:a("disabled"),"data-stage":I.stage}),v),{type:"button",onClick(E){if(E.defaultPrevented||!a("resizable"))return;let R=He(I.stage,{minimized:()=>"MINIMIZE",maximized:()=>"MAXIMIZE",default:()=>"RESTORE"});r({type:R.toUpperCase()})}}))},getResizeTriggerProps(I){return t.element(y(h({},ln.resizeTrigger.attrs),{dir:a("dir"),"data-disabled":b(!T),"data-axis":I.axis,onPointerDown(P){T&&fe(P)&&(P.currentTarget.setPointerCapture(P.pointerId),P.stopPropagation(),r({type:"RESIZE_START",axis:I.axis,position:{x:P.clientX,y:P.clientY}}))},onPointerUp(P){if(!T)return;let v=P.currentTarget;v.hasPointerCapture(P.pointerId)&&v.releasePointerCapture(P.pointerId)},style:h({position:"absolute",touchAction:"none"},Ok(I.axis))}))},getDragTriggerProps(){return t.element(y(h({},ln.dragTrigger.attrs),{dir:a("dir"),"data-disabled":b(!w),onPointerDown(I){if(!w||!fe(I))return;let P=ne(I);P!=null&&P.closest("button")||P!=null&&P.closest("[data-no-drag]")||(I.currentTarget.setPointerCapture(I.pointerId),I.stopPropagation(),r({type:"DRAG_START",pointerId:I.pointerId,position:{x:I.clientX,y:I.clientY}}))},onPointerUp(I){if(!w)return;let P=I.currentTarget;P.hasPointerCapture(I.pointerId)&&P.releasePointerCapture(I.pointerId)},onDoubleClick(I){I.defaultPrevented||a("resizable")&&r({type:S?"RESTORE":"MAXIMIZE"})},style:{WebkitUserSelect:"none",userSelect:"none",touchAction:"none",cursor:"move"}}))},getControlProps(){return t.element(y(h({},ln.control.attrs),{dir:a("dir"),"data-disabled":b(a("disabled")),"data-stage":s.get("stage"),"data-minimized":b(m),"data-maximized":b(f),"data-staged":b(S)}))},getTitleProps(){return t.element(y(h({},ln.title.attrs),{dir:a("dir"),id:Eb(i)}))},getHeaderProps(){return t.element(y(h({},ln.header.attrs),{dir:a("dir"),id:Ab(i),"data-dragging":b(c),"data-topmost":b(g),"data-behind":b(!g),"data-minimized":b(m),"data-maximized":b(f),"data-staged":b(S)}))},getBodyProps(){return t.element(y(h({},ln.body.attrs),{dir:a("dir"),"data-dragging":b(c),"data-minimized":b(m),"data-maximized":b(f),"data-staged":b(S),hidden:m}))}}}function Dk(e,t,n,r){var x,C,A,N,k,L,K;let i=t.boundaryRect;if(!i)return;let a=(x=e.gutter)!=null?x:8,o=(C=e.shift)!=null?C:0,s=(N=(A=e.offset)==null?void 0:A.mainAxis)!=null?N:0,l=(L=(k=e.offset)==null?void 0:k.crossAxis)!=null?L:0,c=(K=e.placement)!=null?K:"bottom",{width:d,height:g}=n,p=i,u=r==="rtl",f=p.x+a,m=p.x+p.width-d-a,S=p.x+(p.width-d)/2,T=p.y+a,w=p.y+p.height-g-a,I=p.y+(p.height-g)/2,P=c.split("-"),v=P[0],E=P[1],R=()=>E==="start"?u?m:f:E==="end"?u?f:m:S;if(v==="bottom")return{x:R()+o+l,y:w-s};if(v==="top")return{x:R()+o+l,y:T+s};if(v==="left"){let J=E==="start"?T:E==="end"?w:I;return{x:p.x+a+s,y:J+o+l}}if(v==="right"){let J=E==="start"?T:E==="end"?w:I;return{x:p.x+p.width-d-a-s,y:J+o+l}}return{x:S+l,y:I+s}}function Ia(e){if(e)try{let t=JSON.parse(e);if(typeof t.width=="number"&&typeof t.height=="number")return{width:t.width,height:t.height}}catch(t){}}function xb(e){if(e)try{let t=JSON.parse(e);if(typeof t.x=="number"&&typeof t.y=="number")return{x:t.x,y:t.y}}catch(t){}}function vg(e){var a;let t=(a=Ia(e.dataset.defaultSize))!=null?a:Fk,n=xb(e.dataset.defaultPosition),r=qe(e),i=n==null&&r?o=>Dk(r,o,t,q(e)):void 0;return{defaultPosition:n,getAnchorPosition:i}}var gk,ln,pb,hb,Ea,pk,hk,Pa,fk,mk,vk,hg,fg,fb,mb,Sk,cc,Sa,vb,Ob,Vb,mg,Eb,Ab,Pb,Sb,Ib,wk,xn,Tb,Lo,Cb,Ak,xk,Rk,kk,Nk,Lk,Fk,Mk,kb=ee(()=>{"use strict";Qs();Bt();xr();Ve();be();oe();gk=z("floating-panel").parts("trigger","positioner","content","header","body","title","resizeTrigger","dragTrigger","stageTrigger","closeTrigger","control"),ln=gk.build(),pb=class ze{constructor([t,n,r,i,a,o]=[0,0,0,0,0,0]){fn(this,"m00"),fn(this,"m01"),fn(this,"m02"),fn(this,"m10"),fn(this,"m11"),fn(this,"m12"),fn(this,"rotate",(...s)=>this.prepend(ze.rotate(...s))),fn(this,"scale",(...s)=>this.prepend(ze.scale(...s))),fn(this,"translate",(...s)=>this.prepend(ze.translate(...s))),this.m00=t,this.m01=n,this.m02=r,this.m10=i,this.m11=a,this.m12=o}applyTo(t){let{x:n,y:r}=t,{m00:i,m01:a,m02:o,m10:s,m11:l,m12:c}=this;return{x:i*n+a*r+o,y:s*n+l*r+c}}prepend(t){return new ze([this.m00*t.m00+this.m01*t.m10,this.m00*t.m01+this.m01*t.m11,this.m00*t.m02+this.m01*t.m12+this.m02,this.m10*t.m00+this.m11*t.m10,this.m10*t.m01+this.m11*t.m11,this.m10*t.m02+this.m11*t.m12+this.m12])}append(t){return new ze([t.m00*this.m00+t.m01*this.m10,t.m00*this.m01+t.m01*this.m11,t.m00*this.m02+t.m01*this.m12+t.m02,t.m10*this.m00+t.m11*this.m10,t.m10*this.m01+t.m11*this.m11,t.m10*this.m02+t.m11*this.m12+t.m12])}get determinant(){return this.m00*this.m11-this.m01*this.m10}get isInvertible(){let t=this.determinant;return isFinite(t)&&isFinite(this.m02)&&isFinite(this.m12)&&t!==0}invert(){let t=this.determinant;return new ze([this.m11/t,-this.m01/t,(this.m01*this.m12-this.m11*this.m02)/t,-this.m10/t,this.m00/t,(this.m10*this.m02-this.m00*this.m12)/t])}get array(){return[this.m00,this.m01,this.m02,this.m10,this.m11,this.m12,0,0,1]}get float32Array(){return new Float32Array(this.array)}static get identity(){return new ze([1,0,0,0,1,0])}static rotate(t,n){let r=new ze([Math.cos(t),-Math.sin(t),0,Math.sin(t),Math.cos(t),0]);return n&&(n.x!==0||n.y!==0)?ze.multiply(ze.translate(n.x,n.y),r,ze.translate(-n.x,-n.y)):r}static scale(t,n=t,r={x:0,y:0}){let i=new ze([t,0,0,0,n,0]);return r.x!==0||r.y!==0?ze.multiply(ze.translate(r.x,r.y),i,ze.translate(-r.x,-r.y)):i}static translate(t,n){return new ze([1,0,t,0,1,n])}static multiply(...[t,...n]){return t?n.reduce((r,i)=>r.prepend(i),t):ze.identity}get a(){return this.m00}get b(){return this.m10}get c(){return this.m01}get d(){return this.m11}get tx(){return this.m02}get ty(){return this.m12}get scaleComponents(){return{x:this.a,y:this.d}}get translationComponents(){return{x:this.tx,y:this.ty}}get skewComponents(){return{x:this.c,y:this.b}}toString(){return`matrix(${this.a}, ${this.b}, ${this.c}, ${this.d}, ${this.tx}, ${this.ty})`}},hb=(e,t,n)=>Math.min(Math.max(e,t),n),Ea=(e,t,n)=>{let r=hb(e.x,n.x,n.x+n.width-t.width),i=hb(e.y,n.y,n.y+n.height-t.height);return{x:r,y:i}},pk={width:0,height:0},hk={width:1/0,height:1/0},Pa=(e,t=pk,n=hk)=>({width:Math.min(Math.max(e.width,t.width),n.width),height:Math.min(Math.max(e.height,t.height),n.height)}),fk=(e,t)=>{let n=Math.max(t.x,Math.min(e.x,t.x+t.width-e.width)),r=Math.max(t.y,Math.min(e.y,t.y+t.height-e.height));return{x:n,y:r,width:Math.min(e.width,t.width),height:Math.min(e.height,t.height)}},mk=(e,t)=>e.width===(t==null?void 0:t.width)&&e.height===(t==null?void 0:t.height),vk=(e,t)=>e.x===(t==null?void 0:t.x)&&e.y===(t==null?void 0:t.y),hg=new WeakMap;fg=e=>parseFloat(e.replace("px","")),fb=(...e)=>e.reduce((t,n)=>t+(n?fg(n):0),0);mb={n:{x:.5,y:0},ne:{x:1,y:0},e:{x:1,y:.5},se:{x:1,y:1},s:{x:.5,y:1},sw:{x:0,y:1},w:{x:0,y:.5},nw:{x:0,y:0}},Sk={n:"s",ne:"sw",e:"w",se:"nw",s:"n",sw:"ne",w:"e",nw:"se"},{sign:cc,abs:Sa,min:vb}=Math;Ob=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`float:${e.id}:trigger`},Vb=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`float:${e.id}:positioner`},mg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`float:${e.id}:content`},Eb=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.title)!=null?n:`float:${e.id}:title`},Ab=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.header)!=null?n:`float:${e.id}:header`},Pb=e=>e.getById(Ob(e)),Sb=e=>e.getById(Vb(e)),Ib=e=>e.getById(mg(e)),wk=e=>e.getById(Ab(e)),xn=(e,t,n)=>{let r;return Pe(t)?r=wb(t):r=Ek(e.getWin()),n&&(r=Wn({x:-r.width,y:r.minY,width:r.width*3,height:r.height*2})),dr(r,["x","y","width","height"])};Tb=new Set(["minimized","maximized","default"]);Lo=Fs({stack:[],count(){return this.stack.length},add(e){this.stack.includes(e)||this.stack.push(e)},remove(e){let t=this.stack.indexOf(e);t<0||this.stack.splice(t,1)},bringToFront(e){this.remove(e),this.add(e)},isTopmost(e){return this.stack[this.stack.length-1]===e},indexOf(e){return this.stack.indexOf(e)}}),{not:Cb,and:Ak}=we(),xk={minimize:"Minimize window",maximize:"Maximize window",restore:"Restore window"},Rk=Object.freeze({width:320,height:240}),kk=Object.freeze({x:300,y:100}),Nk=te({props({props:e}){return gn(e,["id"],"floating-panel"),y(h({strategy:"fixed",gridSize:1,allowOverflow:!0,resizable:!0,draggable:!0},e),{translations:h(h({},xk),e.translations)})},initialState({prop:e}){var n;return((n=e("open"))!=null?n:e("defaultOpen"))?"open":"closed"},context({prop:e,bindable:t}){return{size:t(()=>{var n;return{defaultValue:(n=e("defaultSize"))!=null?n:Rk,value:e("size"),isEqual:mk,hash(r){return`W:${r.width} H:${r.height}`},onChange(r){var i;(i=e("onSizeChange"))==null||i({size:r})}}}),position:t(()=>{var n;return{defaultValue:(n=e("defaultPosition"))!=null?n:kk,value:e("position"),isEqual:vk,hash(r){return`X:${r.x} Y:${r.y}`},onChange(r){var i;(i=e("onPositionChange"))==null||i({position:r})}}}),stage:t(()=>({defaultValue:"default",onChange(n){var r;(r=e("onStageChange"))==null||r({stage:n})}})),lastEventPosition:t(()=>({defaultValue:null})),prevPosition:t(()=>({defaultValue:null})),prevSize:t(()=>({defaultValue:null})),isTopmost:t(()=>({defaultValue:void 0}))}},computed:{isMaximized:({context:e})=>e.get("stage")==="maximized",isMinimized:({context:e})=>e.get("stage")==="minimized",isStaged:({context:e})=>e.get("stage")!=="default",hasSpecifiedPosition:({prop:e})=>e("defaultPosition")!=null||e("position")!=null,canResize:({context:e,prop:t})=>t("resizable")&&!t("disabled")&&e.get("stage")==="default",canDrag:({prop:e,computed:t})=>e("draggable")&&!e("disabled")&&!t("isMaximized")},watch({track:e,context:t,action:n,prop:r}){e([()=>t.hash("position")],()=>{n(["setPositionStyle"])}),e([()=>t.hash("size")],()=>{n(["setSizeStyle"])}),e([()=>r("open")],()=>{n(["toggleVisibility"])})},effects:["trackPanelStack"],on:{CONTENT_FOCUS:{actions:["bringToFrontOfPanelStack"]},SET_POSITION:{actions:["setPosition"]},SET_SIZE:{actions:["setSize"]}},states:{closed:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["setAnchorPosition","setPositionStyle","setSizeStyle","setInitialFocus"]},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen","setAnchorPosition","setPositionStyle","setSizeStyle","setInitialFocus"]}]}},open:{tags:["open"],entry:["bringToFrontOfPanelStack"],initial:"idle",on:{"CONTROLLED.CLOSE":{target:"closed",actions:["resetRect","setFinalFocus"]},CLOSE:[{guard:"isOpenControlled",target:"closed",actions:["invokeOnClose","setFinalFocus"]},{target:"closed",actions:["invokeOnClose","resetRect","setFinalFocus"]}]},states:{idle:{effects:["trackBoundaryRect"],on:{DRAG_START:{guard:Cb("isMaximized"),target:"dragging",actions:["setPrevPosition"]},RESIZE_START:{guard:Cb("isMinimized"),target:"resizing",actions:["setPrevSize"]},ESCAPE:[{guard:Ak("isOpenControlled","closeOnEsc"),actions:["invokeOnClose"]},{guard:"closeOnEsc",target:"closed",actions:["invokeOnClose","resetRect","setFinalFocus"]}],MINIMIZE:{actions:["setMinimized"]},MAXIMIZE:{actions:["setMaximized"]},RESTORE:{actions:["setRestored"]},MOVE:{actions:["setPositionFromKeyboard"]}}},dragging:{effects:["trackPointerMove"],on:{DRAG:{actions:["setPositionFromDrag"]},DRAG_END:{target:"idle",actions:["invokeOnDragEnd","clearPrevPosition"]},ESCAPE:{target:"idle",actions:["restorePosition","clearPrevPosition"]}}},resizing:{effects:["trackPointerMove"],on:{DRAG:{actions:["setSizeFromDrag"]},DRAG_END:{target:"idle",actions:["invokeOnResizeEnd","clearPrevSize"]},ESCAPE:{target:"idle",actions:["restoreSize","clearPrevSize"]}}}}}},implementations:{guards:{closeOnEsc:({prop:e})=>!!e("closeOnEscape"),isMaximized:({context:e})=>e.get("stage")==="maximized",isMinimized:({context:e})=>e.get("stage")==="minimized",isOpenControlled:({prop:e})=>e("open")!=null},effects:{trackPointerMove({scope:e,send:t,event:n,prop:r}){var s;let i=e.getDoc(),a=(s=r("getBoundaryEl"))==null?void 0:s(),o=xn(e,a,!1);return pn(i,{onPointerMove({point:l,event:c}){let{altKey:d,shiftKey:g}=c,p=Ae(l.x,o.x,o.x+o.width),u=Ae(l.y,o.y,o.y+o.height);t({type:"DRAG",position:{x:p,y:u},axis:n.axis,altKey:d,shiftKey:g})},onPointerUp(){t({type:"DRAG_END"})}})},trackBoundaryRect({context:e,scope:t,prop:n,computed:r}){var l;let i=t.getWin(),a=!0,o=()=>{var g;if(a){a=!1;return}let c=(g=n("getBoundaryEl"))==null?void 0:g(),d=xn(t,c,!1);if(!r("isMaximized")){let p=h(h({},e.get("position")),e.get("size"));d=fk(p,d)}e.set("size",dr(d,["width","height"])),e.set("position",dr(d,["x","y"]))},s=(l=n("getBoundaryEl"))==null?void 0:l();return Pe(s)?Gn.observe(s,o):ae(i,"resize",o)},trackPanelStack({context:e,scope:t}){let n=Ps(Lo,()=>{e.set("isTopmost",Lo.isTopmost(t.id));let r=Ib(t);if(!r)return;let i=Lo.indexOf(t.id);i!==-1&&r.style.setProperty("--z-index",`${i+1}`)});return()=>{Lo.remove(t.id),n()}}},actions:{setPosition({context:e,event:t,prop:n,scope:r}){var s;let i=(s=n("getBoundaryEl"))==null?void 0:s(),a=xn(r,i,n("allowOverflow")),o=Ea(t.position,e.get("size"),a);e.set("position",o)},setSize({context:e,event:t,scope:n,prop:r}){var l;let i=(l=r("getBoundaryEl"))==null?void 0:l(),a=xn(n,i,!1),o=t.size;o=Pa(o,r("minSize"),r("maxSize")),o=Pa(o,r("minSize"),a);let s=Ea(e.get("position"),o,a);e.set("size",o),e.set("position",s)},setAnchorPosition({context:e,computed:t,prop:n,scope:r}){var l,c;if(t("hasSpecifiedPosition"))return;let i=e.get("prevPosition")||e.get("prevSize");if(n("persistRect")&&i)return;let a=Pb(r),o=xn(r,(l=n("getBoundaryEl"))==null?void 0:l(),!1),s=(c=n("getAnchorPosition"))==null?void 0:c({triggerRect:a?DOMRect.fromRect(wb(a)):null,boundaryRect:DOMRect.fromRect(o)});if(!s){let d=e.get("size");s={x:o.x+(o.width-d.width)/2,y:o.y+(o.height-d.height)/2}}s&&e.set("position",s)},setPrevPosition({context:e,event:t}){e.set("prevPosition",h({},e.get("position"))),e.set("lastEventPosition",t.position)},clearPrevPosition({context:e,prop:t}){t("persistRect")||e.set("prevPosition",null),e.set("lastEventPosition",null)},restorePosition({context:e}){let t=e.get("prevPosition");t&&e.set("position",t)},setPositionFromDrag({context:e,event:t,prop:n,scope:r}){var c;let i=Td(t.position,e.get("lastEventPosition"));i.x=Math.round(i.x/n("gridSize"))*n("gridSize"),i.y=Math.round(i.y/n("gridSize"))*n("gridSize");let a=e.get("prevPosition");if(!a)return;let o=Zh(a,i),s=(c=n("getBoundaryEl"))==null?void 0:c(),l=xn(r,s,n("allowOverflow"));o=Ea(o,e.get("size"),l),e.set("position",o)},setPositionStyle({scope:e,context:t}){let n=Sb(e),r=t.get("position");n==null||n.style.setProperty("--x",`${r.x}px`),n==null||n.style.setProperty("--y",`${r.y}px`)},resetRect({context:e,prop:t}){e.set("stage","default"),t("persistRect")||(e.set("position",e.initial("position")),e.set("size",e.initial("size")))},setPrevSize({context:e,event:t}){e.set("prevSize",h({},e.get("size"))),e.set("prevPosition",h({},e.get("position"))),e.set("lastEventPosition",t.position)},clearPrevSize({context:e}){e.set("prevSize",null),e.set("prevPosition",null),e.set("lastEventPosition",null)},restoreSize({context:e}){let t=e.get("prevSize");t&&e.set("size",t);let n=e.get("prevPosition");n&&e.set("position",n)},setSizeFromDrag({context:e,event:t,scope:n,prop:r}){var f;let i=e.get("prevSize"),a=e.get("prevPosition"),o=e.get("lastEventPosition");if(!i||!a||!o)return;let s=Wn(h(h({},a),i)),l=Td(t.position,o),c=Tk(s,l,t.axis,{scalingOriginMode:t.altKey?"center":"extent",lockAspectRatio:!!r("lockAspectRatio")||t.shiftKey}),d=dr(c,["width","height"]),g=dr(c,["x","y"]),p=(f=r("getBoundaryEl"))==null?void 0:f(),u=xn(n,p,!1);if(d=Pa(d,r("minSize"),r("maxSize")),d=Pa(d,r("minSize"),u),e.set("size",d),g){let m=Ea(g,d,u);e.set("position",m)}},setSizeStyle({scope:e,context:t}){queueMicrotask(()=>{let n=Sb(e),r=t.get("size");n==null||n.style.setProperty("--width",`${r.width}px`),n==null||n.style.setProperty("--height",`${r.height}px`)})},setMaximized({context:e,prop:t,scope:n}){var d;if(e.get("stage")==="maximized")return;let r=e.get("stage")==="default",i=e.get("size"),a=e.get("position"),o=(d=t("getBoundaryEl"))==null?void 0:d(),s=xn(n,o,!1),l=dr(s,["x","y"]),c=dr(s,["height","width"]);e.set("stage","maximized"),r&&(e.set("prevSize",i),e.set("prevPosition",a)),e.set("position",l),e.set("size",c)},setMinimized({context:e,scope:t}){if(e.get("stage")==="minimized")return;let n=e.get("stage")==="default",r=e.get("size"),i=e.get("position");e.set("stage","minimized"),n&&(e.set("prevSize",r),e.set("prevPosition",i));let a=wk(t);if(!a)return;let o=y(h({},r),{height:a==null?void 0:a.offsetHeight});e.set("size",o)},setRestored({context:e,prop:t,scope:n}){var l;let r=xn(n,(l=t("getBoundaryEl"))==null?void 0:l(),!1);e.set("stage","default");let i=e.get("size"),a=e.get("prevSize");a&&(i=Pa(a,t("minSize"),t("maxSize")),i=Pa(i,t("minSize"),r));let o=e.get("position"),s=e.get("prevPosition");s&&(o=Ea(s,i,r)),e.set("size",i),e.set("position",o),e.set("prevSize",null),e.set("prevPosition",null)},setPositionFromKeyboard({context:e,event:t,prop:n,scope:r}){var c;Fi(t.step==null,"step is required");let i=e.get("position"),a=t.step,o=He(t.direction,{left:{x:i.x-a,y:i.y},right:{x:i.x+a,y:i.y},up:{x:i.x,y:i.y-a},down:{x:i.x,y:i.y+a}}),s=(c=n("getBoundaryEl"))==null?void 0:c(),l=xn(r,s,!1);o=Ea(o,e.get("size"),l),e.set("position",o)},bringToFrontOfPanelStack({prop:e}){Lo.bringToFront(e("id"))},invokeOnOpen({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!0})},invokeOnClose({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!1})},invokeOnDragEnd({context:e,prop:t}){var n;(n=t("onPositionChangeEnd"))==null||n({position:e.get("position")})},invokeOnResizeEnd({context:e,prop:t}){var n;(n=t("onSizeChangeEnd"))==null||n({size:e.get("size")})},setFinalFocus({scope:e,prop:t}){t("restoreFocus")!==!1&&B(()=>{var r,i;let n=(i=(r=t("finalFocusEl"))==null?void 0:r())!=null?i:Pb(e);n==null||n.focus({preventScroll:!0})})},setInitialFocus({scope:e,prop:t}){B(()=>{var r,i;let n=(i=(r=t("initialFocusEl"))==null?void 0:r())!=null?i:Ib(e);n==null||n.focus({preventScroll:!0})})},toggleVisibility({send:e,prop:t,event:n}){e({type:t("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:n})}}}}),Lk=class extends X{initMachine(e){return new Y(Nk,e)}initApi(){return this.zagConnect(Vk)}render(){let e=this.el.querySelector('[data-scope="floating-panel"][data-part="trigger"]');e&&this.spreadProps(e,this.api.getTriggerProps());let t=this.el.querySelector('[data-scope="floating-panel"][data-part="positioner"]');t&&this.spreadProps(t,this.api.getPositionerProps());let n=this.el.querySelector('[data-scope="floating-panel"][data-part="content"]');n&&this.spreadProps(n,this.api.getContentProps());let r=this.el.querySelector('[data-scope="floating-panel"][data-part="title"]');r&&this.spreadProps(r,this.api.getTitleProps());let i=this.el.querySelector('[data-scope="floating-panel"][data-part="header"]');i&&this.spreadProps(i,this.api.getHeaderProps());let a=this.el.querySelector('[data-scope="floating-panel"][data-part="body"]');a&&this.spreadProps(a,this.api.getBodyProps());let o=this.el.querySelector('[data-scope="floating-panel"][data-part="drag-trigger"]');o&&this.spreadProps(o,this.api.getDragTriggerProps()),["s","w","e","n","sw","nw","se","ne"].forEach(g=>{let p=this.el.querySelector(`[data-scope="floating-panel"][data-part="resize-trigger"][data-axis="${g}"]`);p&&this.spreadProps(p,this.api.getResizeTriggerProps({axis:g}))});let l=this.el.querySelector('[data-scope="floating-panel"][data-part="close-trigger"]');l&&this.spreadProps(l,this.api.getCloseTriggerProps());let c=this.el.querySelector('[data-scope="floating-panel"][data-part="control"]');c&&this.spreadProps(c,this.api.getControlProps()),["minimized","maximized","default"].forEach(g=>{let p=this.el.querySelector(`[data-scope="floating-panel"][data-part="stage-trigger"][data-stage="${g}"]`);p&&this.spreadProps(p,this.api.getStageTriggerProps({stage:g}))})}};Fk={width:320,height:240};Mk={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=Ia(e.dataset.size),i=Ia(e.dataset.defaultSize),a=vg(e),o=new Lk(e,{id:e.id,defaultOpen:!1,draggable:O(e,"draggable")!==!1,resizable:O(e,"resizable")!==!1,allowOverflow:O(e,"allowOverflow")!==!1,closeOnEscape:O(e,"closeOnEscape")!==!1,disabled:O(e,"disabled"),dir:q(e),size:r,defaultSize:i,defaultPosition:a.defaultPosition,getAnchorPosition:a.getAnchorPosition,minSize:Ia(e.dataset.minSize),maxSize:Ia(e.dataset.maxSize),persistRect:O(e,"persistRect"),gridSize:Number(e.dataset.gridSize)||1,onOpenChange:c=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,open:c.open},serverEventName:V(e,"onOpenChange"),clientEventName:V(e,"onOpenChangeClient")})},onPositionChange:c=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,position:c.position},serverEventName:V(e,"onPositionChange"),clientEventName:V(e,"onPositionChangeClient")})},onSizeChange:c=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,size:c.size},serverEventName:V(e,"onSizeChange"),clientEventName:V(e,"onSizeChangeClient")})},onStageChange:c=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,stage:c.stage},serverEventName:V(e,"onStageChange"),clientEventName:V(e,"onStageChangeClient")})}});o.init(),this.floatingPanel=o;let s=ie(e);this.domRegistry=s,s.add("corex:floating-panel:set-open",c=>{let{open:d}=c.detail;o.api.setOpen(d)});let l=re(this);this.handleRegistry=l,l.add("floating_panel_set_open",c=>{if(!c||typeof c!="object")return;let d=c;$(e.id,H(c))&&typeof d.open=="boolean"&&o.api.setOpen(d.open)})},updated(){var n;let e=this.el,t=vg(e);(n=this.floatingPanel)==null||n.updateProps({id:e.id,disabled:O(e,"disabled"),dir:q(e),getAnchorPosition:t.getAnchorPosition})},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),this.domRegistry=void 0,(t=this.handleRegistry)==null||t.teardown(),this.handleRegistry=void 0,(n=this.floatingPanel)==null||n.destroy()}}});var Lb={};pe(Lb,{Listbox:()=>$k,buildCollection:()=>su});function Nb(e,t,n){let r=O(e,"redirect");return{id:e.id,disabled:O(e,"disabled"),dir:q(e),orientation:V(e,"orientation"),loopFocus:O(e,"loopFocus"),selectionMode:r?"single":V(e,"selectionMode"),selectOnHighlight:O(e,"selectOnHighlight"),deselectable:O(e,"deselectable"),typeahead:O(e,"typeahead"),onValueChange:i=>{let a=i.value.length>0?String(i.value[0]):null;if(r&&a){let o=e.querySelector(`[data-scope="listbox"][data-part="item"][data-value="${CSS.escape(a)}"]`);On(wn(o,a),{liveSocket:t})}W({el:e,canPushServer:j(t),pushEvent:n,payload:{id:e.id,value:i.value,items:i.items},serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})}}}var _k,$k,Db=ee(()=>{"use strict";Nl();ca();da();yn();$e();Ve();be();oe();_k=class extends X{constructor(t,n){var i;super(t,n);Q(this,"_options",[]);Q(this,"hasGroups",!1);let r=n.collection;this._options=(i=r==null?void 0:r.items)!=null?i:[]}get options(){return Array.isArray(this._options)?this._options:[]}setOptions(t){this._options=Array.isArray(t)?t:[]}getCollection(){return yo(Rr(this.options,this.hasGroups))}initMachine(t){let n=this.getCollection.bind(this);return new Y(jm,y(h({},t),{get collection(){return n()}}))}initApi(){return this.zagConnect(zm)}applyItemProps(){let t=this.el.querySelector('[data-scope="listbox"][data-part="content"]');if(!t)return;let n=r=>r.closest('[data-scope="listbox"][data-part="content"]')===t;t.querySelectorAll('[data-scope="listbox"][data-part="item-group"]').forEach(r=>{var o;if(!n(r))return;let i=(o=r.dataset.id)!=null?o:"";this.spreadProps(r,this.api.getItemGroupProps({id:i}));let a=r.querySelector('[data-scope="listbox"][data-part="item-group-label"]');a&&this.spreadProps(a,this.api.getItemGroupLabelProps({htmlFor:i}))}),t.querySelectorAll('[data-scope="listbox"][data-part="item"]').forEach(r=>{var l;if(!n(r))return;let i=(l=r.dataset.value)!=null?l:"",a=this.options.find(c=>String(Cn(c))===String(i));if(!a)return;this.spreadProps(r,this.api.getItemProps({item:a}));let o=r.querySelector('[data-scope="listbox"][data-part="item-text"]');o&&this.spreadProps(o,this.api.getItemTextProps({item:a}));let s=r.querySelector('[data-scope="listbox"][data-part="item-indicator"]');s&&this.spreadProps(s,this.api.getItemIndicatorProps({item:a}))})}render(){var a;let t=(a=this.el.querySelector('[data-scope="listbox"][data-part="root"]'))!=null?a:this.el;this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="listbox"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps());let r=this.el.querySelector('[data-scope="listbox"][data-part="input"]');r&&this.spreadProps(r,this.api.getInputProps());let i=this.el.querySelector('[data-scope="listbox"][data-part="content"]');i&&(this.spreadProps(i,this.api.getContentProps()),this.applyItemProps())}};$k={mounted(){var c;let e=this.el,t=JSON.parse((c=e.dataset.items)!=null?c:"[]"),n=t.some(d=>!!d.group),r=this.pushEvent.bind(this),i=()=>j(this.liveSocket),a=new _k(e,h(y(h({},Nb(e,this.liveSocket,r)),{collection:su(t,n)}),js(e,"value","defaultValue")));a.hasGroups=n,a.setOptions(t),a.init(),this.listbox=a;let o=d=>{let g=a.api.value;Ue({respondTo:d,canPushServer:i(),pushEvent:r,serverEventName:"listbox_value_response",serverPayload:{id:e.id,value:g},el:e,domEventName:"listbox-value",domDetail:{id:e.id,value:g}})},s=ie(e);this.domRegistry=s,s.add("corex:listbox:set-value",d=>{a.api.setValue(d.detail.value)}),s.add("corex:listbox:value",d=>{o(de(d.detail))});let l=re(this);this.handleRegistry=l,l.add("listbox_set_value",d=>{$(e.id,H(d))&&a.api.setValue(d.value)}),l.add("listbox_value",d=>{$(e.id,H(d))&&o(de(d))})},updated(){var n;if(!this.listbox)return;let e=JSON.parse((n=this.el.dataset.items)!=null?n:"[]"),t=e.some(r=>!!r.group);this.listbox.hasGroups=t,this.listbox.setOptions(e),this.listbox.updateProps(h(y(h({},Nb(this.el,this.liveSocket,this.pushEvent.bind(this))),{collection:this.listbox.getCollection()}),Ks(this.el,"value","defaultValue")))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.listbox)==null||n.destroy()}}});var Mb={};pe(Mb,{Marquee:()=>Kk,readMarqueeProps:()=>yg});function Gk(e,t){let{scope:n,send:r,context:i,computed:a,prop:o}=e,s=o("side"),l=i.get("paused"),c=i.get("duration"),d=a("orientation"),g=a("multiplier"),p=a("isVertical");return{paused:l,orientation:d,side:s,multiplier:g,contentCount:g+1,pause(){r({type:"PAUSE"})},resume(){r({type:"RESUME"})},togglePause(){r({type:"TOGGLE_PAUSE"})},restart(){r({type:"RESTART"})},getRootProps(){let u=o("dir");return t.element(y(h({},Do.root.attrs),{id:cn.getRootId(n),dir:u,role:"region","aria-roledescription":"marquee","aria-live":"off","aria-label":o("translations").root,"data-state":l?"paused":"idle","data-orientation":d,"data-paused":b(l),onMouseEnter:o("pauseOnInteraction")?()=>r({type:"PAUSE"}):void 0,onMouseLeave:o("pauseOnInteraction")?()=>r({type:"RESUME"}):void 0,onFocusCapture:o("pauseOnInteraction")?f=>{f.target!==f.currentTarget&&r({type:"PAUSE"})}:void 0,onBlurCapture:o("pauseOnInteraction")?f=>{f.currentTarget.contains(f.relatedTarget)||r({type:"RESUME"})}:void 0,style:{display:"flex",flexDirection:d==="vertical"?"column":"row",position:"relative",overflow:"hidden",contain:"layout style paint","--marquee-duration":`${c}s`,"--marquee-spacing":o("spacing"),"--marquee-delay":`${o("delay")}s`,"--marquee-loop-count":o("loopCount")===0?"infinite":o("loopCount").toString(),"--marquee-translate":Uk({side:s,dir:u})}}))},getViewportProps(){return t.element(y(h({},Do.viewport.attrs),{id:cn.getViewportId(n),"data-part":"viewport","data-orientation":d,"data-side":s,onAnimationIteration(u){var f;u.target===cn.getContentEl(n,0)&&((f=o("onLoopComplete"))==null||f())},onAnimationEnd(u){var f;u.target===cn.getContentEl(n,0)&&((f=o("onComplete"))==null||f())},style:{display:"flex",[p?"height":"width"]:"100%",flexDirection:d==="vertical"?s==="bottom"?"column-reverse":"column":s==="end"?"row-reverse":"row"}}))},getContentProps(u){let{index:f}=u,m=f>0;return t.element(y(h({},Do.content.attrs),{id:cn.getContentId(n,f),dir:o("dir"),"data-part":"content","data-index":f,"data-orientation":d,"data-side":s,"data-reverse":o("reverse")?"":void 0,"data-clone":b(m),role:m?"presentation":void 0,"aria-hidden":m?!0:void 0,style:{display:"flex",flexDirection:d==="vertical"?"column":"row",flexShrink:0,backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden",willChange:l?"auto":"transform",transform:"translateZ(0)",[p?"minWidth":"minHeight"]:"auto",contain:"paint"}}))},getEdgeProps(u){let{side:f}=u,m=o("dir");return t.element(y(h({},Do.edge.attrs),{dir:m,"data-part":"edge","data-side":f,"data-orientation":d,style:h({pointerEvents:"none",position:"absolute"},Bk({side:f,dir:m}))}))},getItemProps(){return t.element(y(h({},Do.item.attrs),{dir:o("dir"),style:{[p?"marginBlock":"marginInline"]:"calc(var(--marquee-spacing) / 2)"}}))}}}function Fb(e){let{rootSize:t,contentSize:n,speed:r,multiplier:i,autoFill:a}=e;return a?n*i/r:n{"use strict";be();oe();Hk=z("marquee").parts("root","viewport","content","edge","item"),Do=Hk.build(),cn={getRootId:e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`marquee:${e.id}`},getViewportId:e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.viewport)!=null?n:`marquee:${e.id}:viewport`},getContentId:(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.content)==null?void 0:r.call(n,t))!=null?i:`marquee:${e.id}:content:${t}`},getRootEl:e=>e.getById(cn.getRootId(e)),getViewportEl:e=>e.getById(cn.getViewportId(e)),getContentEl:(e,t)=>e.getById(cn.getContentId(e,t))},Bk=e=>{let{side:t}=e;switch(t){case"start":return{top:0,insetInlineStart:0,height:"100%"};case"end":return{top:0,insetInlineEnd:0,height:"100%"};case"top":return{top:0,insetInline:0,width:"100%"};case"bottom":return{bottom:0,insetInline:0,width:"100%"}}},Uk=e=>{let{side:t,dir:n}=e;return t==="top"?"-100%":t==="bottom"?"100%":t==="start"&&n==="ltr"||t==="end"&&n==="rtl"?"-100%":"100%"};qk=te({props({props:e}){return h({dir:"ltr",side:"start",speed:50,delay:0,loopCount:0,spacing:"1rem",autoFill:!1,pauseOnInteraction:!1,reverse:!1,defaultPaused:!1,translations:{root:"Marquee content"}},e)},refs(){return{dimensions:void 0,initialDurationSet:!1}},context({prop:e,bindable:t}){return{paused:t(()=>({value:e("paused"),defaultValue:e("defaultPaused"),onChange(n){var r;(r=e("onPauseChange"))==null||r({paused:n})}})),duration:t(()=>({defaultValue:2e3/Math.max(.001,e("speed"))}))}},initialState(){return"idle"},computed:{orientation:({prop:e})=>{let t=e("side");return t==="top"||t==="bottom"?"vertical":"horizontal"},isVertical:({prop:e})=>{let t=e("side");return t==="top"||t==="bottom"},multiplier:({refs:e,prop:t})=>{if(!t("autoFill"))return 1;let n=e.get("dimensions");if(!n)return 1;let{rootSize:r,contentSize:i}=n;return i===0?1:in("speed")],()=>{t(["recalculateDuration","restartAnimation"])}),e([()=>n("spacing"),()=>n("side")],()=>{t(["recalculateDuration"])})},on:{PAUSE:{actions:["setPaused"]},RESUME:{actions:["setResumed"]},TOGGLE_PAUSE:{actions:["togglePaused"]},RESTART:{actions:["restartAnimation"]}},effects:["trackDimensions"],states:{idle:{}},implementations:{actions:{setPaused({context:e}){e.set("paused",!0)},setResumed({context:e}){e.set("paused",!1)},togglePaused({context:e}){e.set("paused",t=>!t)},restartAnimation({scope:e}){let t=cn.getViewportEl(e);if(!t)return;t.querySelectorAll('[data-part="content"]').forEach(r=>{r.style.animation="none",r.offsetHeight,r.style.animation=""})},recalculateDuration({refs:e,computed:t,context:n,prop:r}){let i=e.get("dimensions");if(!i)return;let{rootSize:a,contentSize:o}=i,s=Fb({rootSize:a,contentSize:o,speed:Math.max(.001,r("speed")),multiplier:t("multiplier"),autoFill:r("autoFill")});n.set("duration",s)}},effects:{trackDimensions({scope:e,refs:t,computed:n,context:r,prop:i}){let a=cn.getRootEl(e),o=cn.getContentEl(e,0);if(!a||!o)return;let s=e.getWin(),l=()=>{let p=n("isVertical")?a.clientHeight:a.clientWidth,u=n("isVertical")?o.clientHeight:o.clientWidth;return{rootSize:p,contentSize:u}},c=()=>{let{rootSize:p,contentSize:u}=l();if(p>0&&u>0&&(t.set("dimensions",{rootSize:p,contentSize:u}),!t.get("initialDurationSet"))){let f=Fb({rootSize:p,contentSize:u,speed:Math.max(.001,i("speed")),multiplier:n("multiplier"),autoFill:i("autoFill")});r.set("duration",f),t.set("initialDurationSet",!0)}},d=null,g=new s.ResizeObserver(()=>{d===null&&(d=s.requestAnimationFrame(()=>{let{rootSize:p,contentSize:u}=l();t.set("dimensions",{rootSize:p,contentSize:u}),d=null}))});return g.observe(a),g.observe(o),c(),()=>{g.disconnect(),d!==null&&s.cancelAnimationFrame(d)}}}}});Wk=class extends X{constructor(){super(...arguments);Q(this,"items",null)}initMachine(t){return new Y(qk,t)}initApi(){return this.zagConnect(Gk)}buildDom(){let t=this.el.querySelector('[data-part="ssr-preview"]');t&&t.remove();let n=this.el.querySelector('template[data-part="items-template"]');if(!n||(this.items=Array.from(n.content.children).map(l=>l.cloneNode(!0)),n.remove(),this.el.querySelector('[data-scope="marquee"][data-part="root"]')))return;let r=document.createElement("div");r.setAttribute("data-scope","marquee"),r.setAttribute("data-part","root"),r.id=`marquee:${this.el.id}`,r.style.cssText="display:flex;flex-direction:row;position:relative;overflow:hidden;width:100%",this.el.appendChild(r);let i=document.createElement("div");r.appendChild(i),this.spreadProps(i,this.api.getEdgeProps({side:"start"}));let a=document.createElement("div");a.setAttribute("data-scope","marquee"),a.setAttribute("data-part","viewport"),a.id=`marquee:${this.el.id}:viewport`,a.style.cssText="display:flex;width:100%",r.appendChild(a);let o=document.createElement("div");o.setAttribute("data-scope","marquee"),o.setAttribute("data-part","content"),o.setAttribute("data-index","0"),o.id=`marquee:${this.el.id}:content:0`,o.style.cssText="display:flex;flex-direction:row;flex-shrink:0",a.appendChild(o),this.items.forEach(l=>{o.appendChild(l.cloneNode(!0))});let s=document.createElement("div");r.appendChild(s),this.spreadProps(s,this.api.getEdgeProps({side:"end"}))}render(){if(!this.items)return;let t=this.el.querySelector('[data-scope="marquee"][data-part="root"]');if(!t)return;this.spreadProps(t,this.api.getRootProps());let n=t.querySelector('[data-part="edge"][data-side="start"]');n&&this.spreadProps(n,this.api.getEdgeProps({side:"start"}));let r=t.querySelector('[data-part="viewport"]');if(!r)return;this.spreadProps(r,this.api.getViewportProps());let i=Array.from(r.querySelectorAll(':scope > [data-part="content"]'));for(;i.length>this.api.contentCount;){let o=i.pop();o&&r.removeChild(o)}Array.from({length:this.api.contentCount}).forEach((o,s)=>{let l=i[s];l||(l=document.createElement("div"),r.appendChild(l),this.items.forEach(c=>{let d=c.cloneNode(!0);l.appendChild(d)})),this.spreadProps(l,this.api.getContentProps({index:s})),l.querySelectorAll('[data-part="item"]').forEach(c=>{this.spreadProps(c,this.api.getItemProps())})});let a=t.querySelector('[data-part="edge"][data-side="end"]');a&&this.spreadProps(a,this.api.getEdgeProps({side:"end"}))}};Kk={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=new Wk(e,y(h({},yg(e)),{onPauseChange:r=>{let i=V(e,"onPauseChange");i&&this.liveSocket.main.isConnected()&&t(i,{id:e.id,paused:r.paused});let a=V(e,"onPauseChangeClient");a&&e.dispatchEvent(new CustomEvent(a,{bubbles:!0,detail:{id:e.id,paused:r.paused}}))},onLoopComplete:()=>{let r=V(e,"onLoopComplete");r&&this.liveSocket.main.isConnected()&&t(r,{id:e.id});let i=V(e,"onLoopCompleteClient");i&&e.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:{id:e.id}}))},onComplete:()=>{let r=V(e,"onComplete");r&&this.liveSocket.main.isConnected()&&t(r,{id:e.id});let i=V(e,"onCompleteClient");i&&e.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:{id:e.id}}))}}));n.buildDom(),n.init(),this.marquee=n,this.onPause=()=>n.api.pause(),this.onResume=()=>n.api.resume(),this.onTogglePause=()=>n.api.togglePause(),e.addEventListener("corex:marquee:pause",this.onPause),e.addEventListener("corex:marquee:resume",this.onResume),e.addEventListener("corex:marquee:toggle-pause",this.onTogglePause),this.handlers=[],this.handlers.push(this.handleEvent("marquee_pause",r=>{$(e.id,H(r))&&n.api.pause()})),this.handlers.push(this.handleEvent("marquee_resume",r=>{$(e.id,H(r))&&n.api.resume()})),this.handlers.push(this.handleEvent("marquee_toggle_pause",r=>{$(e.id,H(r))&&n.api.togglePause()}))},updated(){var e;(e=this.marquee)==null||e.updateProps(yg(this.el))},destroyed(){var e;if(this.onPause&&this.el.removeEventListener("corex:marquee:pause",this.onPause),this.onResume&&this.el.removeEventListener("corex:marquee:resume",this.onResume),this.onTogglePause&&this.el.removeEventListener("corex:marquee:toggle-pause",this.onTogglePause),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.marquee)==null||e.destroy()}}});var tE={};pe(tE,{Menu:()=>vN,findImmediateParentMenuHookEl:()=>Jb});function Zk(...e){let t={};for(let n of e){if(!n)continue;for(let i in t){if(i.startsWith("on")&&typeof t[i]=="function"&&typeof n[i]=="function"){t[i]=Ct(n[i],t[i]);continue}if(i==="className"||i==="class"){t[i]=jk(t[i],n[i]);continue}if(i==="style"){t[i]=Xk(t[i],n[i]);continue}t[i]=n[i]!==void 0?n[i]:t[i]}for(let i in n)t[i]===void 0&&(t[i]=n[i]);let r=Object.getOwnPropertySymbols(n);for(let i of r)t[i]=n[i]}return t}function sN(e,t){if(!e)return;let n=ye(e),r=new n.CustomEvent(Eg,{detail:{value:t}});e.dispatchEvent(r)}function lN(e){var n;let t=vi(e);return(n=Rn(e))!=null?n:e.getDoc().getElementById(t)}function Yb(e,t){if(!Pe(e))return!1;for(let n in t){let r=t[n],i=lN(r.scope);if(i&&ge(i,e))return!0;let a=r.refs.get("children");if(Object.keys(a).length>0&&Yb(e,a))return!0}return!1}function cN(e,t){let n=Wn(e),{top:r,right:i,left:a,bottom:o}=Jh(n),[s]=t.split("-");return{top:[a,r,i,o],right:[r,i,o,a],bottom:[r,a,o,i],left:[i,r,a,o]}[s]}function Xb(e,t){let{x:n,y:r}=t,i=!1;for(let a=0,o=e.length-1;ar!=d>r&&n<(c-s)*(r-l)/(d-l)+s&&(i=!i)}return i}function qb(e){let t=e.parent;for(;t&&t.context.get("isSubmenu");)t=t.refs.get("parent");t==null||t.send({type:"CLOSE"})}function dN(e,t){return e?Xb(e,t):!1}function uN(e,t,n){let r=Object.keys(e).length>0;if(!t)return null;if(!r)return Fo(n,t);for(let i in e){let a=e[i],o=yi(a.scope);if(o===t)return o}return Fo(n,t)}function Ca(e,t){e&&(e.refs.set("pointerRoutingLocked",t),e.context.set("pointerRoutingMode",t?"locked":"interactive"))}function Zb(e){let t=e.context.get("highlightedValue");if(!t)return!1;let n=e.refs.get("children");for(let r in n){let i=n[r];if(i.state.hasTag("open")&&yi(i.scope)===t)return!0}return!1}function gN(e,t){e&&(e.refs.get("pointerRoutingLocked")||t&&Zb(e)||Ca(e,!1))}function pN(e){e&&(Zb(e)||Ca(e,!1))}function hN(e,t){let{context:n,send:r,state:i,computed:a,prop:o,scope:s}=e,l=i.hasTag("open"),c=n.get("isSubmenu"),d=a("isTypingAhead"),g=o("composite"),p=n.get("currentPlacement"),u=n.get("anchorPoint"),f=n.get("highlightedValue"),m=n.get("triggerValue"),S=Gt(y(h({},o("positioning")),{placement:u?"bottom":p}));function T(v){return{id:Fo(s,v.value),disabled:!!v.disabled,highlighted:f===v.value}}function w(v){var R;let E=(R=v.valueText)!=null?R:v.value;return y(h({},v),{id:v.value,valueText:E})}function I(v){let E=T(w(v));return y(h({},E),{checked:!!v.checked})}function P(v){let{closeOnSelect:E,valueText:R,value:x}=v,C=T(v),A=Fo(s,x);return t.element(y(h({},st.item.attrs),{id:A,role:"menuitem","aria-disabled":se(C.disabled),"data-disabled":b(C.disabled),"data-ownedby":vi(s),"data-highlighted":b(C.highlighted),"data-value":x,"data-valuetext":R,onDragStart(N){N.currentTarget.matches("a[href]")&&N.preventDefault()},onPointerMove(N){if(C.disabled||N.pointerType!=="mouse")return;let k=N.currentTarget;if(C.highlighted)return;let L=et(N);r({type:"ITEM_POINTERMOVE",id:A,target:k,closeOnSelect:E,point:L})},onPointerLeave(N){var K;if(C.disabled||N.pointerType!=="mouse"||!((K=e.event.previous())==null?void 0:K.type.includes("POINTER")))return;let L=N.currentTarget;r({type:"ITEM_POINTERLEAVE",id:A,target:L,closeOnSelect:E})},onPointerDown(N){if(C.disabled)return;let k=N.currentTarget;r({type:"ITEM_POINTERDOWN",target:k,id:A,closeOnSelect:E})},onClick(N){if(jr(N)||$n(N)||C.disabled)return;let k=N.currentTarget;r({type:"ITEM_CLICK",target:k,id:A,closeOnSelect:E})}}))}return{highlightedValue:f,open:l,setOpen(v){i.hasTag("open")!==v&&r({type:v?"OPEN":"CLOSE"})},triggerValue:m,setTriggerValue(v){r({type:"TRIGGER_VALUE.SET",value:v})},setHighlightedValue(v){r({type:"HIGHLIGHTED.SET",value:v})},setParent(v){r({type:"PARENT.SET",value:v,id:v.prop("id")})},setChild(v){r({type:"CHILD.SET",value:v,id:v.prop("id")})},reposition(v={}){r({type:"POSITIONING.SET",options:v})},addItemListener(v){let E=s.getById(v.id);if(!E)return;let R=()=>{var x;return(x=v.onSelect)==null?void 0:x.call(v)};return E.addEventListener(Eg,R),()=>E.removeEventListener(Eg,R)},getContextTriggerProps(v={}){let{value:E}=v,R=E==null?!1:m===E,x=bg(s,E);return t.element(y(h({},st.contextTrigger.attrs),{dir:o("dir"),id:x,"data-ownedby":s.id,"data-value":E,"data-current":b(R),"data-state":l?"open":"closed",onPointerDown(C){if(C.pointerType==="mouse")return;let A=et(C);r({type:"CONTEXT_MENU_START",point:A,value:E})},onPointerCancel(C){C.pointerType!=="mouse"&&r({type:"CONTEXT_MENU_CANCEL"})},onPointerMove(C){C.pointerType!=="mouse"&&r({type:"CONTEXT_MENU_CANCEL"})},onPointerUp(C){C.pointerType!=="mouse"&&r({type:"CONTEXT_MENU_CANCEL"})},onContextMenu(C){let A=et(C),N=l&&E!=null&&!R;r({type:N?"TRIGGER_VALUE.SET":"CONTEXT_MENU",point:A,value:E}),C.preventDefault()},style:{WebkitTouchCallout:"none",WebkitUserSelect:"none",userSelect:"none"}}))},getTriggerItemProps(v){let E=v.getTriggerProps();return Zk(P({value:E.id}),E)},getTriggerProps(v={}){let{value:E}=v,R=E==null?!1:m===E,x=yi(s,E);return t.button(y(h(y(h({},c?st.triggerItem.attrs:st.trigger.attrs),{"data-placement":n.get("currentPlacement"),type:"button",dir:o("dir"),id:x}),E!=null&&{"data-ownedby":s.id,"data-value":E,"data-current":b(R)}),{"data-uid":o("id"),"aria-haspopup":g?"menu":"dialog","aria-controls":vi(s),"data-controls":vi(s),"aria-expanded":E==null?l:l&&R,"data-state":l?"open":"closed",onPointerMove(C){if(C.pointerType!=="mouse"||uc(C.currentTarget)||!c)return;let N=et(C);r({type:"TRIGGER_POINTERMOVE",target:C.currentTarget,point:N})},onPointerLeave(C){if(uc(C.currentTarget)||C.pointerType!=="mouse"||!c)return;Ca(e.refs.get("parent"),!0);let A=et(C);r({type:"TRIGGER_POINTERLEAVE",target:C.currentTarget,point:A})},onPointerDown(C){uc(C.currentTarget)||pr(C)||C.preventDefault()},onClick(C){if(C.defaultPrevented||uc(C.currentTarget))return;let A=l&&E!=null&&!R;r({type:A?"TRIGGER_VALUE.SET":"TRIGGER_CLICK",target:C.currentTarget,value:E})},onBlur(){r({type:"TRIGGER_BLUR"})},onFocus(){r({type:"TRIGGER_FOCUS"})},onKeyDown(C){if(C.defaultPrevented)return;let A={ArrowDown(){r({type:"ARROW_DOWN",value:E})},ArrowUp(){r({type:"ARROW_UP",value:E})},Enter(){r({type:"ARROW_DOWN",src:"enter",value:E})},Space(){r({type:"ARROW_DOWN",src:"space",value:E})}},N=me(C,{orientation:"vertical",dir:o("dir")}),k=A[N];k&&(C.preventDefault(),k(C))}}))},getIndicatorProps(){return t.element(y(h({},st.indicator.attrs),{dir:o("dir"),"data-state":l?"open":"closed"}))},getPositionerProps(){return t.element(y(h({},st.positioner.attrs),{dir:o("dir"),id:Kb(s),style:S.floating}))},getArrowProps(){return t.element(y(h({id:Jk(s)},st.arrow.attrs),{dir:o("dir"),style:S.arrow}))},getArrowTipProps(){return t.element(y(h({},st.arrowTip.attrs),{dir:o("dir"),style:S.arrowTip}))},getContentProps(){return t.element(y(h({},st.content.attrs),{id:vi(s),"aria-label":o("aria-label"),hidden:!l,"data-state":l?"open":"closed",role:g?"menu":"dialog",tabIndex:0,dir:o("dir"),"aria-activedescendant":a("highlightedId")||void 0,"aria-labelledby":u?bg(s,m!=null?m:void 0):yi(s,m!=null?m:void 0),"data-placement":p,onPointerEnter(v){v.pointerType==="mouse"&&r({type:"MENU_POINTERENTER"})},onKeyDown(v){if(v.defaultPrevented||!ge(v.currentTarget,ne(v)))return;let E=ne(v);if(!((E==null?void 0:E.closest("[role=menu]"))===v.currentTarget||E===v.currentTarget))return;if(v.key==="Tab"&&!Ns(v)){v.preventDefault();return}let x={ArrowDown(){r({type:"ARROW_DOWN"})},ArrowUp(){r({type:"ARROW_UP"})},ArrowLeft(){r({type:"ARROW_LEFT"})},ArrowRight(){r({type:"ARROW_RIGHT"})},Enter(){r({type:"ENTER"})},Space(N){var k;d?r({type:"TYPEAHEAD",key:N.key}):(k=x.Enter)==null||k.call(x,N)},Home(){r({type:"HOME"})},End(){r({type:"END"})}},C=me(v,{dir:o("dir")}),A=x[C];if(A){A(v),v.stopPropagation(),v.preventDefault();return}o("typeahead")&&ph(v)&&(Be(v)||$t(E)||(r({type:"TYPEAHEAD",key:v.key}),v.preventDefault()))}}))},getSeparatorProps(){return t.element(y(h({},st.separator.attrs),{role:"separator",dir:o("dir"),"aria-orientation":"horizontal"}))},getItemState:T,getItemProps:P,getOptionItemState:I,getOptionItemProps(v){let{type:E,disabled:R,closeOnSelect:x}=v,C=w(v),A=I(v);return h(h({},P(C)),t.element(y(h({"data-type":E},st.item.attrs),{dir:o("dir"),"data-value":C.value,role:`menuitem${E}`,"aria-checked":!!A.checked,"data-state":A.checked?"checked":"unchecked",onClick(N){if(R||jr(N)||$n(N))return;let k=N.currentTarget;r({type:"ITEM_CLICK",target:k,option:C,closeOnSelect:x})}})))},getItemIndicatorProps(v){let E=I(Jc(v)),R=E.checked?"checked":"unchecked";return t.element(y(h({},st.itemIndicator.attrs),{dir:o("dir"),"data-disabled":b(E.disabled),"data-highlighted":b(E.highlighted),"data-state":at(v,"checked")?R:void 0,hidden:at(v,"checked")?!E.checked:void 0}))},getItemTextProps(v){let E=I(Jc(v)),R=E.checked?"checked":"unchecked";return t.element(y(h({},st.itemText.attrs),{dir:o("dir"),"data-disabled":b(E.disabled),"data-highlighted":b(E.highlighted),"data-state":at(v,"checked")?R:void 0}))},getItemGroupLabelProps(v){return t.element(y(h({},st.itemGroupLabel.attrs),{id:Hb(s,v.htmlFor),dir:o("dir")}))},getItemGroupProps(v){return t.element(y(h({id:Qk(s,v.id)},st.itemGroup.attrs),{dir:o("dir"),"aria-labelledby":Hb(s,v.id),role:"group"}))}}}function Jb(e){let t=e.parentElement;for(;t;){if(t.getAttribute("phx-hook")==="Menu")return t;t=t.parentElement}return null}function Pg(e){e.renderSubmenuTriggers();for(let t of e.children)Pg(t)}function Qb(e){let t=e.el;e.updateProps({id:t.id.replace(/^menu:/,""),closeOnSelect:O(t,"closeOnSelect"),loopFocus:O(t,"loopFocus"),typeahead:O(t,"typeahead"),composite:O(t,"composite"),defaultHighlightedValue:V(t,"defaultHighlightedValue"),dir:q(t),positioning:qe(t)});for(let n of e.children)Qb(n)}function eE(e){for(let t of[...e.children])eE(t),t.destroy()}var zk,st,jk,Yk,$b,Xk,yi,bg,vi,Jk,Kb,Qk,Fo,mi,Hb,Rn,Bb,zb,eN,tN,jb,Ub,dc,Mo,nN,rN,Sg,iN,aN,oN,uc,Gb,Eg,Jt,Ta,fN,mN,Wb,vN,nE=ee(()=>{"use strict";Qs();ii();Or();on();xr();da();yn();be();oe();zk=z("menu").parts("arrow","arrowTip","content","contextTrigger","indicator","item","itemGroup","itemGroupLabel","itemIndicator","itemText","positioner","separator","trigger","triggerItem"),st=zk.build(),jk=(...e)=>e.map(t=>{var n;return(n=t==null?void 0:t.trim)==null?void 0:n.call(t)}).filter(Boolean).join(" "),Yk=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g,$b=e=>{let t={},n;for(;n=Yk.exec(e);)t[n[1]]=n[2];return t},Xk=(e,t)=>{if(Ua(e)){if(Ua(t))return`${e};${t}`;e=$b(e)}else Ua(t)&&(t=$b(t));return Object.assign({},e!=null?e:{},t!=null?t:{})};yi=(e,t)=>{var r;let n=(r=e.ids)==null?void 0:r.trigger;return n!=null?Qe(n)?n(t):n:t?`menu:${e.id}:trigger:${t}`:`menu:${e.id}:trigger`},bg=(e,t)=>{var r;let n=(r=e.ids)==null?void 0:r.contextTrigger;return n!=null?Qe(n)?n(t):n:t?`menu:${e.id}:ctx-trigger:${t}`:`menu:${e.id}:ctx-trigger`},vi=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`menu:${e.id}:content`},Jk=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.arrow)!=null?n:`menu:${e.id}:arrow`},Kb=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`menu:${e.id}:popper`},Qk=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.group)==null?void 0:r.call(n,t))!=null?i:`menu:${e.id}:group:${t}`},Fo=(e,t)=>`${e.id}/${t}`,mi=e=>{var t;return(t=e==null?void 0:e.dataset.value)!=null?t:null},Hb=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.groupLabel)==null?void 0:r.call(n,t))!=null?i:`menu:${e.id}:group-label:${t}`},Rn=e=>e.getById(vi(e)),Bb=e=>e.getById(Kb(e)),zb=e=>e.getById(yi(e)),eN=(e,t)=>t?e.getById(Fo(e,t)):null,tN=e=>e.getById(bg(e)),jb=e=>Oe(e.getDoc(),`[data-scope="menu"][data-part="trigger"][data-ownedby="${e.id}"]`),Ub=e=>Oe(e.getDoc(),`[data-scope="menu"][data-part="context-trigger"][data-ownedby="${e.id}"]`),dc=(e,t)=>{var n;return t==null?(n=zb(e))!=null?n:jb(e)[0]:e.getById(yi(e,t))},Mo=e=>{let n=`[role^="menuitem"][data-ownedby=${CSS.escape(vi(e))}]:not([data-disabled])`;return Oe(Rn(e),n)},nN=e=>Dt(Mo(e)),rN=e=>en(Mo(e)),Sg=(e,t)=>t?e.id===t||e.dataset.value===t:!1,iN=(e,t)=>{var i;let n=Mo(e),r=n.findIndex(a=>Sg(a,t.value));return Wp(n,r,{loop:(i=t.loop)!=null?i:t.loopFocus})},aN=(e,t)=>{var i;let n=Mo(e),r=n.findIndex(a=>Sg(a,t.value));return Kp(n,r,{loop:(i=t.loop)!=null?i:t.loopFocus})},oN=(e,t)=>{var i;let n=Mo(e),r=n.find(a=>Sg(a,t.value));return ft(n,{state:t.typeaheadState,key:t.key,activeId:(i=r==null?void 0:r.id)!=null?i:null})},uc=e=>Pe(e)&&(e.dataset.disabled===""||e.hasAttribute("disabled")),Gb=e=>{var t;return!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))&&!!(e!=null&&e.hasAttribute("data-controls"))},Eg="menu:select";({not:Jt,and:Ta,or:fN}=we()),mN=te({props({props:e}){return y(h({closeOnSelect:!0,typeahead:!0,composite:!0,loopFocus:!1,navigate(t){Gi(t.node)}},e),{positioning:h({placement:"bottom-start",gutter:8},e.positioning)})},initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"idle"},context({bindable:e,prop:t,scope:n}){return{highlightedValue:e(()=>({defaultValue:t("defaultHighlightedValue")||null,value:t("highlightedValue"),onChange(r){var i;(i=t("onHighlightChange"))==null||i({highlightedValue:r})}})),lastHighlightedValue:e(()=>({defaultValue:null})),currentPlacement:e(()=>({defaultValue:void 0})),intentPolygon:e(()=>({defaultValue:null})),anchorPoint:e(()=>({defaultValue:null,hash(r){return`x: ${r==null?void 0:r.x}, y: ${r==null?void 0:r.y}`}})),isSubmenu:e(()=>({defaultValue:!1})),triggerValue:e(()=>{var r;return{defaultValue:(r=t("defaultTriggerValue"))!=null?r:null,value:t("triggerValue"),onChange(i){let a=t("onTriggerValueChange");if(!a)return;let o=dc(n,i);a({value:i,triggerElement:o})}}}),pointerRoutingMode:e(()=>({defaultValue:"interactive"}))}},refs(){return{parent:null,children:{},pointerRoutingLocked:!1,typeaheadState:h({},ft.defaultOptions),positioningOverride:{}}},computed:{isRtl:({prop:e})=>e("dir")==="rtl",isTypingAhead:({refs:e})=>e.get("typeaheadState").keysSoFar!=="",highlightedId:({context:e,scope:t,refs:n})=>uN(n.get("children"),e.get("highlightedValue"),t)},watch({track:e,action:t,context:n,prop:r}){e([()=>n.get("isSubmenu")],()=>{t(["setSubmenuPlacement"])}),e([()=>n.hash("anchorPoint")],()=>{n.get("anchorPoint")&&t(["reposition"])}),e([()=>r("open")],()=>{t(["toggleVisibility"])})},on:{"TRIGGER_VALUE.SET":{actions:["setTriggerValue","setAnchorPoint","reposition","focusMenu"]},"PARENT.SET":{actions:["setParentMenu"]},"CHILD.SET":{actions:["setChildMenu"]},OPEN:[{guard:"isOpenControlled",actions:["setTriggerValue","invokeOnOpen"]},{target:"open",actions:["setTriggerValue","invokeOnOpen"]}],OPEN_AUTOFOCUS:[{guard:"isOpenControlled",actions:["setTriggerValue","invokeOnOpen"]},{target:"open",actions:["setTriggerValue","highlightFirstItem","invokeOnOpen"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose","releaseParentRoutingLock"]},{target:"closed",actions:["invokeOnClose","releaseParentRoutingLock","focusTrigger"]}],"HIGHLIGHTED.RESTORE":{actions:["restoreHighlightedItem"]},"HIGHLIGHTED.SET":{actions:["setHighlightedItem"]},"HIGHLIGHTED.SUGGEST":{actions:["suggestHighlightedItem"]}},states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open"},"CONTROLLED.CLOSE":{target:"closed"},CONTEXT_MENU_START:{target:"opening:contextmenu",actions:["setAnchorPoint","setTriggerValue"]},CONTEXT_MENU:[{guard:"isOpenControlled",actions:["setAnchorPoint","setTriggerValue","invokeOnOpen"]},{target:"open",actions:["setAnchorPoint","setTriggerValue","invokeOnOpen"]}],TRIGGER_CLICK:[{guard:"isOpenControlled",actions:["invokeOnOpen","setTriggerValue"]},{target:"open",actions:["invokeOnOpen","setTriggerValue"]}],TRIGGER_FOCUS:{guard:Jt("isSubmenu"),target:"closed"},TRIGGER_POINTERMOVE:{guard:"isSubmenu",target:"opening"}}},"opening:contextmenu":{tags:["closed"],effects:["waitForLongPress"],on:{"CONTROLLED.OPEN":{target:"open"},"CONTROLLED.CLOSE":{target:"closed",actions:["focusTrigger"]},CONTEXT_MENU_CANCEL:[{guard:"isOpenControlled",actions:["invokeOnClose","releaseParentRoutingLock"]},{target:"closed",actions:["invokeOnClose","releaseParentRoutingLock","focusTrigger"]}],"LONG_PRESS.OPEN":[{guard:"isOpenControlled",actions:["setTriggerValue","invokeOnOpen"]},{target:"open",actions:["setTriggerValue","invokeOnOpen"]}]}},opening:{tags:["closed"],effects:["waitForOpenDelay"],on:{"CONTROLLED.OPEN":{target:"open"},"CONTROLLED.CLOSE":{target:"closed",actions:["focusTrigger"]},BLUR:[{guard:"isOpenControlled",actions:["invokeOnClose","releaseParentRoutingLock"]},{target:"closed",actions:["invokeOnClose","releaseParentRoutingLock","focusTrigger"]}],TRIGGER_POINTERLEAVE:[{guard:"isOpenControlled",actions:["invokeOnClose","releaseParentRoutingLock"]},{target:"closed",actions:["invokeOnClose","releaseParentRoutingLock","focusTrigger"]}],"DELAY.OPEN":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}]}},closing:{tags:["open"],effects:["trackPointerMove","trackInteractOutside","waitForCloseDelay"],on:{"CONTROLLED.OPEN":{target:"open"},"CONTROLLED.CLOSE":{target:"closed",actions:["focusParentMenu","restoreParentHighlightedItem"]},MENU_POINTERENTER:{target:"open",actions:["clearIntentPolygon"]},POINTER_MOVED_AWAY_FROM_SUBMENU:[{guard:"isOpenControlled",actions:["invokeOnClose","releaseParentRoutingLock"]},{target:"closed",actions:["focusParentMenu","restoreParentHighlightedItem"]}],"DELAY.CLOSE":[{guard:"isOpenControlled",actions:["invokeOnClose","releaseParentRoutingLock"]},{target:"closed",actions:["focusParentMenu","restoreParentHighlightedItem","invokeOnClose","releaseParentRoutingLock"]}]}},closed:{tags:["closed"],entry:["clearHighlightedItem","unlockParentOnClose","clearAnchorPoint"],on:{"CONTROLLED.OPEN":[{guard:fN("isOpenAutoFocusEvent","isArrowDownEvent"),target:"open",actions:["highlightFirstItem"]},{guard:"isArrowUpEvent",target:"open",actions:["highlightLastItem"]},{target:"open"}],CONTEXT_MENU_START:{target:"opening:contextmenu",actions:["setAnchorPoint","setTriggerValue"]},CONTEXT_MENU:[{guard:"isOpenControlled",actions:["setAnchorPoint","setTriggerValue","invokeOnOpen"]},{target:"open",actions:["setAnchorPoint","setTriggerValue","invokeOnOpen"]}],TRIGGER_CLICK:[{guard:"isOpenControlled",actions:["invokeOnOpen","setTriggerValue"]},{target:"open",actions:["invokeOnOpen","setTriggerValue"]}],TRIGGER_POINTERMOVE:{guard:"isTriggerItem",target:"opening"},TRIGGER_BLUR:{target:"idle"},ARROW_DOWN:[{guard:"isOpenControlled",actions:["setTriggerValue","invokeOnOpen"]},{target:"open",actions:["setTriggerValue","highlightFirstItem","invokeOnOpen"]}],ARROW_UP:[{guard:"isOpenControlled",actions:["setTriggerValue","invokeOnOpen"]},{target:"open",actions:["setTriggerValue","highlightLastItem","invokeOnOpen"]}]}},open:{tags:["open"],effects:["trackInteractOutside","trackFocusVisible","trackPositioning","scrollToHighlightedItem"],entry:["focusMenu","unlockParentOnOpen"],on:{"CONTROLLED.CLOSE":[{target:"closed",guard:"isArrowLeftEvent",actions:["focusParentMenu"]},{target:"closed",actions:["focusTrigger"]}],TRIGGER_CLICK:[{guard:Ta(Jt("isTriggerItem"),"isOpenControlled"),actions:["invokeOnClose","releaseParentRoutingLock"]},{guard:Jt("isTriggerItem"),target:"closed",actions:["invokeOnClose","releaseParentRoutingLock","focusTrigger"]}],CONTEXT_MENU:{actions:["setAnchorPoint","setTriggerValue","focusMenu"]},ARROW_UP:{actions:["highlightPrevItem","focusMenu"]},ARROW_DOWN:{actions:["highlightNextItem","focusMenu"]},ARROW_LEFT:[{guard:Ta("isSubmenu","isOpenControlled"),actions:["invokeOnClose","releaseParentRoutingLock"]},{guard:"isSubmenu",target:"closed",actions:["focusParentMenu","invokeOnClose","releaseParentRoutingLock"]}],HOME:{actions:["highlightFirstItem","focusMenu"]},END:{actions:["highlightLastItem","focusMenu"]},ARROW_RIGHT:{guard:"isTriggerItemHighlighted",actions:["openSubmenu"]},ENTER:[{guard:"isTriggerItemHighlighted",actions:["openSubmenu"]},{actions:["clickHighlightedItem"]}],ITEM_POINTERMOVE:[{guard:Jt("isPointerRoutingLocked"),actions:["setHighlightedItem","focusMenu","closeSiblingMenus"]},{actions:["setLastHighlightedItem","closeSiblingMenus"]}],ITEM_POINTERLEAVE:{guard:Ta(Jt("isPointerRoutingLocked"),Jt("isTriggerItem")),actions:["clearHighlightedItem"]},ITEM_CLICK:[{guard:Ta(Jt("isTriggerItemHighlighted"),Jt("isHighlightedItemEditable"),"closeOnSelect","isOpenControlled"),actions:["invokeOnSelect","setOptionState","closeRootMenu","invokeOnClose","releaseParentRoutingLock"]},{guard:Ta(Jt("isTriggerItemHighlighted"),Jt("isHighlightedItemEditable"),"closeOnSelect"),target:"closed",actions:["invokeOnSelect","setOptionState","closeRootMenu","invokeOnClose","releaseParentRoutingLock","focusTrigger"]},{guard:Ta(Jt("isTriggerItemHighlighted"),Jt("isHighlightedItemEditable")),actions:["invokeOnSelect","setOptionState"]},{actions:["setHighlightedItem"]}],TRIGGER_POINTERMOVE:{guard:"isTriggerItem",actions:["setIntentPolygon"]},TRIGGER_POINTERLEAVE:{target:"closing",actions:["setIntentPolygon"]},ITEM_POINTERDOWN:{actions:["setHighlightedItem"]},TYPEAHEAD:{actions:["highlightMatchedItem"]},FOCUS_MENU:{actions:["focusMenu"]},"POSITIONING.SET":{actions:["reposition"]}}}},implementations:{guards:{closeOnSelect:({prop:e,event:t})=>{var n;return!!((n=t==null?void 0:t.closeOnSelect)!=null?n:e("closeOnSelect"))},isTriggerItem:({event:e})=>Gb(e.target),isTriggerItemHighlighted:({event:e,scope:t,computed:n})=>{var i;let r=(i=e.target)!=null?i:t.getById(n("highlightedId"));return!!(r!=null&&r.hasAttribute("data-controls"))},isSubmenu:({context:e})=>e.get("isSubmenu"),isPointerRoutingLocked:({refs:e})=>e.get("pointerRoutingLocked"),isHighlightedItemEditable:({scope:e,computed:t})=>$t(e.getById(t("highlightedId"))),isOpenControlled:({prop:e})=>e("open")!==void 0,isArrowLeftEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="ARROW_LEFT"},isArrowUpEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="ARROW_UP"},isArrowDownEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="ARROW_DOWN"},isOpenAutoFocusEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="OPEN_AUTOFOCUS"}},effects:{waitForOpenDelay({send:e}){let t=setTimeout(()=>{e({type:"DELAY.OPEN"})},200);return()=>clearTimeout(t)},waitForCloseDelay({send:e}){let t=setTimeout(()=>{e({type:"DELAY.CLOSE"})},100);return()=>clearTimeout(t)},waitForLongPress({send:e}){let t=setTimeout(()=>{e({type:"LONG_PRESS.OPEN"})},700);return()=>clearTimeout(t)},trackFocusVisible({scope:e}){var t;return nt({root:(t=e.getRootNode)==null?void 0:t.call(e)})},trackPositioning({context:e,prop:t,scope:n,refs:r}){if(tN(n)||Ub(n).length>0)return;let a=h(h({},t("positioning")),r.get("positioningOverride"));return e.set("currentPlacement",a.placement),Xe(()=>dc(n,e.get("triggerValue")),()=>Bb(n),y(h({},a),{defer:!0,onComplete(l){e.set("currentPlacement",l.placement)}}))},trackInteractOutside({refs:e,scope:t,prop:n,context:r,send:i}){let a=()=>Rn(t),o=!0,s=l=>Ub(t).some(c=>ge(c,l));return qt(a,{type:"menu",defer:!0,exclude:[zb(t),...jb(t)].filter(Boolean),onInteractOutside:n("onInteractOutside"),onRequestDismiss:n("onRequestDismiss"),onFocusOutside(l){var d;(d=n("onFocusOutside"))==null||d(l);let c=ne(l.detail.originalEvent);if(s(c)){l.preventDefault();return}if(Yb(c,e.get("children"))){l.preventDefault();return}},onEscapeKeyDown(l){var c;(c=n("onEscapeKeyDown"))==null||c(l),r.get("isSubmenu")&&l.preventDefault(),qb({parent:e.get("parent")})},onPointerDownOutside(l){var d;(d=n("onPointerDownOutside"))==null||d(l);let c=ne(l.detail.originalEvent);if(s(c)&&l.detail.contextmenu){l.preventDefault();return}o=!l.detail.focusable},onDismiss(){i({type:"CLOSE",src:"interact-outside",restoreFocus:o})}})},trackPointerMove({context:e,scope:t,send:n,refs:r}){let i=r.get("parent");if(!i)return;Ca(i,!0);let a=t.getDoc();return ae(a,"pointermove",o=>{dN(e.get("intentPolygon"),{x:o.clientX,y:o.clientY})||(n({type:"POINTER_MOVED_AWAY_FROM_SUBMENU"}),Ca(i,!1))})},scrollToHighlightedItem({scope:e,computed:t}){let n=()=>{if(Sr()==="pointer")return;let a=e.getById(t("highlightedId")),o=Rn(e);Un(a,{rootEl:o,block:"nearest"})};return B(()=>{Ir("virtual"),n()}),Ht(()=>Rn(e),{defer:!0,attributes:["aria-activedescendant"],callback:n})}},actions:{setAnchorPoint({context:e,event:t}){e.set("anchorPoint",n=>Ce(n,t.point)?n:t.point)},setSubmenuPlacement({context:e,computed:t,refs:n}){if(!e.get("isSubmenu"))return;let r=t("isRtl")?"left-start":"right-start";n.set("positioningOverride",{placement:r,gutter:0})},reposition({context:e,scope:t,prop:n,event:r,refs:i}){var g,p,u;let a=()=>Bb(t),o=(g=r.point)!=null?g:e.get("anchorPoint"),s=o?()=>h({width:0,height:0},o):void 0,l=h(h({},n("positioning")),i.get("positioningOverride")),c=(p=r.value)!=null?p:e.get("triggerValue");Xe(()=>dc(t,c),a,y(h(y(h({},l),{defer:!0,getAnchorRect:s}),(u=r.options)!=null?u:{}),{listeners:!1,onComplete(f){e.set("currentPlacement",f.placement)}}))},setOptionState({event:e}){if(!e.option)return;let{checked:t,onCheckedChange:n,type:r}=e.option;r==="radio"?n==null||n(!0):r==="checkbox"&&(n==null||n(!t))},clickHighlightedItem({scope:e,computed:t,prop:n,context:r}){var o;let i=e.getById(t("highlightedId"));if(!i||i.dataset.disabled)return;let a=r.get("highlightedValue");_t(i)?(o=n("navigate"))==null||o({value:a,node:i,href:i.href}):queueMicrotask(()=>i.click())},setIntentPolygon({context:e,scope:t,event:n}){let r=Rn(t),i=e.get("currentPlacement");if(!r||!i)return;let a=r.getBoundingClientRect(),o=cN(a,i);if(!o)return;let l=gm(i)==="right"?-5:5;e.set("intentPolygon",[y(h({},n.point),{x:n.point.x+l}),...o])},clearIntentPolygon({context:e}){e.set("intentPolygon",null)},clearAnchorPoint({context:e}){e.set("anchorPoint",null)},unlockParentOnOpen({refs:e,context:t,scope:n}){let r=e.get("parent");if(t.get("isSubmenu")){let i=yi(n);r==null||r.send({type:"HIGHLIGHTED.SUGGEST",value:i})}Ca(r,!1)},unlockParentOnClose({refs:e,context:t}){gN(e.get("parent"),t.get("isSubmenu"))},setHighlightedItem({context:e,event:t}){let n=t.value||mi(t.target);e.set("highlightedValue",n)},clearHighlightedItem({context:e}){e.set("highlightedValue",null)},focusMenu({scope:e}){B(()=>{let t=Rn(e),n=hr({root:t,enabled:!ge(t,e.getActiveElement()),filter(r){var i;return!((i=r.role)!=null&&i.startsWith("menuitem"))}});n==null||n.focus({preventScroll:!0})})},highlightFirstItem({context:e,scope:t}){(Rn(t)?queueMicrotask:B)(()=>{let r=nN(t);r&&e.set("highlightedValue",mi(r))})},highlightLastItem({context:e,scope:t}){(Rn(t)?queueMicrotask:B)(()=>{let r=rN(t);r&&e.set("highlightedValue",mi(r))})},highlightNextItem({context:e,scope:t,event:n,prop:r}){let i=iN(t,{loop:n.loop,value:e.get("highlightedValue"),loopFocus:r("loopFocus")});e.set("highlightedValue",mi(i))},highlightPrevItem({context:e,scope:t,event:n,prop:r}){let i=aN(t,{loop:n.loop,value:e.get("highlightedValue"),loopFocus:r("loopFocus")});e.set("highlightedValue",mi(i))},invokeOnSelect({context:e,prop:t,scope:n}){var a;let r=e.get("highlightedValue");if(r==null)return;let i=eN(n,r);sN(i,r),(a=t("onSelect"))==null||a({value:r})},focusTrigger({scope:e,context:t,event:n}){t.get("isSubmenu")||t.get("anchorPoint")||n.restoreFocus===!1||queueMicrotask(()=>{let r=dc(e,t.get("triggerValue"));r==null||r.focus({preventScroll:!0})})},highlightMatchedItem({scope:e,context:t,event:n,refs:r}){let i=oN(e,{key:n.key,value:t.get("highlightedValue"),typeaheadState:r.get("typeaheadState")});i&&t.set("highlightedValue",mi(i))},setParentMenu({refs:e,event:t,context:n}){e.set("parent",t.value),n.set("isSubmenu",!0)},setChildMenu({refs:e,event:t}){let n=e.get("children");n[t.id]=t.value,e.set("children",n)},closeSiblingMenus({refs:e,event:t,scope:n}){var o;let r=t.target;if(!Gb(r))return;let i=r==null?void 0:r.getAttribute("data-uid"),a=e.get("children");for(let s in a){if(s===i)continue;let l=a[s],c=l.context.get("intentPolygon");c&&t.point&&Xb(c,t.point)||((o=Rn(n))==null||o.focus({preventScroll:!0}),l.send({type:"CLOSE"}))}},closeRootMenu({refs:e}){qb({parent:e.get("parent")})},openSubmenu({refs:e,scope:t,computed:n}){let r=t.getById(n("highlightedId")),i=r==null?void 0:r.getAttribute("data-uid"),a=e.get("children"),o=i?a[i]:null;o==null||o.send({type:"OPEN_AUTOFOCUS"})},focusParentMenu({refs:e}){var t;(t=e.get("parent"))==null||t.send({type:"FOCUS_MENU"})},setLastHighlightedItem({context:e,event:t}){e.set("lastHighlightedValue",mi(t.target))},suggestHighlightedItem({context:e,event:t}){let n=t.value;if(n){if(e.get("highlightedValue")!=null){e.set("lastHighlightedValue",n);return}e.set("highlightedValue",n)}},restoreHighlightedItem({context:e}){let t=e.get("lastHighlightedValue");e.set("lastHighlightedValue",null),t&&e.set("highlightedValue",t)},restoreParentHighlightedItem({refs:e}){var t;(t=e.get("parent"))==null||t.send({type:"HIGHLIGHTED.RESTORE"})},invokeOnOpen({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!0})},invokeOnClose({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!1})},releaseParentRoutingLock({refs:e,context:t}){t.get("isSubmenu")&&pN(e.get("parent"))},toggleVisibility({prop:e,event:t,send:n}){n({type:e("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:t})},setTriggerValue({context:e,event:t}){t.value!==void 0&&e.set("triggerValue",t.value)}}}}),Wb=class extends X{constructor(){super(...arguments);Q(this,"children",[]);Q(this,"submenuTriggerUnsubs",[]);Q(this,"destroy",()=>{this.clearSubmenuTriggerSubscriptions(),this.el.removeAttribute("data-loading"),this.machine.stop()})}initMachine(t){return new Y(mN,t)}initApi(){return this.zagConnect(hN)}setChild(t){this.api.setChild(t.machine.service),this.children.includes(t)||this.children.push(t)}setParent(t){this.api.setParent(t.machine.service)}clearSubmenuTriggerSubscriptions(){for(let t of this.submenuTriggerUnsubs)t();this.submenuTriggerUnsubs=[]}isOwnElement(t){return t.closest('[phx-hook="Menu"]')===this.el}renderSubmenuTriggers(){this.clearSubmenuTriggerSubscriptions();let t=this.el.querySelector('[data-scope="menu"][data-part="content"]');if(!t)return;let n=t.querySelectorAll('[data-scope="menu"][data-nested-menu]');for(let r of n){if(!this.isOwnElement(r))continue;let i=r.dataset.nestedMenu;if(!i)continue;let a=this.children.find(s=>s.el.id===`menu:${i}`);if(!a)continue;let o=()=>{let s=this.api.getTriggerItemProps(a.api);this.spreadProps(r,s)};o(),this.submenuTriggerUnsubs.push(this.machine.subscribe(o)),this.submenuTriggerUnsubs.push(a.machine.subscribe(o))}}render(){let t=this.el.querySelector('[data-scope="menu"][data-part="trigger"]');t&&this.spreadProps(t,this.api.getTriggerProps());let n=this.el.querySelector('[data-scope="menu"][data-part="positioner"]'),r=this.el.querySelector('[data-scope="menu"][data-part="content"]');if(n&&r){this.spreadProps(n,this.api.getPositionerProps()),this.spreadProps(r,this.api.getContentProps()),r.style.pointerEvents="auto",n.hidden=!this.api.open;let a=!this.el.querySelector('[data-scope="menu"][data-part="trigger"]');(this.api.open||a)&&(r.querySelectorAll('[data-scope="menu"][data-part="item"]').forEach(d=>{if(!this.isOwnElement(d))return;let g=d.dataset.value;if(g){let p=d.hasAttribute("data-disabled");this.spreadProps(d,this.api.getItemProps({value:g,disabled:p||void 0}))}}),r.querySelectorAll('[data-scope="menu"][data-part="item-group"]').forEach(d=>{var u;if(!this.isOwnElement(d))return;let g=(u=d.dataset.id)!=null?u:"";if(!g)return;this.spreadProps(d,this.api.getItemGroupProps({id:g}));let p=d.querySelector('[data-scope="menu"][data-part="item-group-label"]');p&&this.spreadProps(p,this.api.getItemGroupLabelProps({htmlFor:g}))}),r.querySelectorAll('[data-scope="menu"][data-part="separator"]').forEach(d=>{this.isOwnElement(d)&&this.spreadProps(d,this.api.getSeparatorProps())}))}let i=this.el.querySelector('[data-scope="menu"][data-part="indicator"]');i&&this.spreadProps(i,this.api.getIndicatorProps())}};vN={mounted(){let e=this.el;if(e.hasAttribute("data-nested"))return;let t=this.pushEvent.bind(this),n=this.liveSocket,r=()=>l=>{var c;if(O(e,"redirect")&&l.value){let d=e.querySelector(`[data-scope="menu"][data-part="item"][data-value="${CSS.escape(l.value)}"]`);On(wn(d,l.value),{liveSocket:n})}W({el:e,canPushServer:j(n),pushEvent:t,payload:{id:e.id,value:(c=l.value)!=null?c:null},serverEventName:V(e,"onSelect"),clientEventName:V(e,"onSelectClient")})},i=new Wb(e,{id:e.id.replace(/^menu:/,""),closeOnSelect:O(e,"closeOnSelect"),loopFocus:O(e,"loopFocus"),typeahead:O(e,"typeahead"),composite:O(e,"composite"),defaultHighlightedValue:V(e,"defaultHighlightedValue"),dir:q(e),positioning:qe(e),onSelect:r(),onOpenChange:l=>{var c;W({el:e,canPushServer:j(n),pushEvent:t,payload:{id:e.id,open:(c=l.open)!=null?c:!1},serverEventName:V(e,"onOpenChange"),clientEventName:V(e,"onOpenChangeClient")})}});i.init(),this.menu=i;let a=e.querySelectorAll('[data-scope="menu"][data-nested="menu"]'),o=new Map,s=[];a.forEach(l=>{let c=l.id;if(!c)return;let d=new Wb(l,{id:c.replace(/^menu:/,""),dir:q(l),closeOnSelect:O(l,"closeOnSelect"),loopFocus:O(l,"loopFocus"),typeahead:O(l,"typeahead"),composite:O(l,"composite"),positioning:qe(l),onSelect:r()});d.init(),o.set(c,d),s.push(d)}),this.submenuWireTimer=setTimeout(()=>{this.submenuWireTimer=void 0;let l=this.menu;l&&(s.forEach(c=>{let d=c.el,g=Jb(d);if(!g)return;let p=g===e?l:o.get(g.id);p&&(p.setChild(c),c.setParent(p))}),l.children.length>0&&Pg(l))},0),this.onSetOpen=l=>{let{open:c}=l.detail;i.api.open!==c&&i.api.setOpen(c)},e.addEventListener("corex:menu:set-open",this.onSetOpen),this.handlers=[],this.handlers.push(this.handleEvent("menu_set_open",l=>{let c=l.menu_id;(!c||e.id===c||e.id===`menu:${c}`)&&i.api.setOpen(l.open)})),this.handlers.push(this.handleEvent("menu_open",()=>{this.pushEvent("menu_open_response",{open:i.api.open})}))},updated(){this.el.hasAttribute("data-nested")||this.menu&&(Qb(this.menu),this.menu.children.length>0&&Pg(this.menu))},destroyed(){if(!this.el.hasAttribute("data-nested")){if(this.submenuWireTimer!==void 0&&(clearTimeout(this.submenuWireTimer),this.submenuWireTimer=void 0),this.onSetOpen&&this.el.removeEventListener("corex:menu:set-open",this.onSetOpen),this.handlers)for(let e of this.handlers)this.removeHandleEvent(e);this.menu&&(eE(this.menu),this.menu.destroy(),this.menu=void 0)}}}});var bE={};pe(bE,{NumberInput:()=>XN,buildMachineProps:()=>yE,machineState:()=>mE,syncNumberInputValueInput:()=>$o});function Og(e,t){if(!(!e||!t.isActiveElement(e)))try{let{selectionStart:n,selectionEnd:r,value:i}=e;return n==null||r==null?void 0:{start:n,end:r,value:i}}catch(n){return}}function bN(e,t,n){if(!(!e||!n.isActiveElement(e))){if(!t){let r=e.value.length;e.setSelectionRange(r,r);return}try{let r=e.value,{start:i,end:a,value:o}=t;if(r===o){e.setSelectionRange(i,a);return}let s=rE(o,r,i),l=i===a?s:rE(o,r,a),c=Math.max(0,Math.min(s,r.length)),d=Math.max(c,Math.min(l,r.length));e.setSelectionRange(c,d)}catch(r){let i=e.value.length;e.setSelectionRange(i,i)}}}function rE(e,t,n){let r=e.slice(0,n),i=e.slice(n),a=0,o=Math.min(r.length,t.length);for(let c=0;c0&&a>=r.length)return a;if(s>=i.length)return t.length-s;if(a>0)return a;if(s>0)return t.length-s;if(n===0&&a===0&&s===0)return t.length;if(e.length>0){let c=n/e.length;return Math.round(c*t.length)}return t.length}function xN(e,t){let{state:n,send:r,prop:i,scope:a,computed:o}=e,s=n.hasTag("focus"),l=o("isDisabled"),c=!!i("readOnly"),d=!!i("required"),g=n.matches("scrubbing"),p=o("isValueEmpty"),u=i("invalid")!==void 0?!!i("invalid"):o("isOutOfRange"),f=l||!o("canIncrement")||c,m=l||!o("canDecrement")||c,S=i("translations");return{focused:s,invalid:u,empty:p,value:o("formattedValue"),valueAsNumber:o("valueAsNumber"),setValue(T){r({type:"VALUE.SET",value:T})},clearValue(){r({type:"VALUE.CLEAR"})},increment(){r({type:"VALUE.INCREMENT"})},decrement(){r({type:"VALUE.DECREMENT"})},setToMax(){r({type:"VALUE.SET",value:i("max")})},setToMin(){r({type:"VALUE.SET",value:i("min")})},focus(){var T;(T=Ei(a))==null||T.focus()},getRootProps(){return t.element(y(h({id:EN(a)},Mr.root.attrs),{dir:i("dir"),"data-disabled":b(l),"data-focus":b(s),"data-invalid":b(u),"data-scrubbing":b(g)}))},getLabelProps(){return t.label(y(h({},Mr.label.attrs),{dir:i("dir"),"data-disabled":b(l),"data-focus":b(s),"data-invalid":b(u),"data-required":b(d),"data-scrubbing":b(g),id:SN(a),htmlFor:_o(a),onClick(){B(()=>{_i(Ei(a))})}}))},getControlProps(){return t.element(y(h({},Mr.control.attrs),{dir:i("dir"),role:"group","aria-disabled":l,"data-focus":b(s),"data-disabled":b(l),"data-invalid":b(u),"data-scrubbing":b(g),"aria-invalid":se(u)}))},getValueTextProps(){return t.element(y(h({},Mr.valueText.attrs),{dir:i("dir"),"data-disabled":b(l),"data-invalid":b(u),"data-focus":b(s),"data-scrubbing":b(g)}))},getInputProps(){return t.input(y(h({},Mr.input.attrs),{dir:i("dir"),name:i("name"),form:i("form"),id:_o(a),role:"spinbutton",defaultValue:o("formattedValue"),pattern:i("formatOptions")?void 0:i("pattern"),inputMode:i("inputMode"),"aria-invalid":se(u),"data-invalid":b(u),disabled:l,"data-disabled":b(l),readOnly:c,required:i("required"),autoComplete:"off",autoCorrect:"off",spellCheck:"false",type:"text","aria-roledescription":"numberfield","aria-valuemin":i("min"),"aria-valuemax":i("max"),"aria-valuenow":Number.isNaN(o("valueAsNumber"))?void 0:o("valueAsNumber"),"aria-valuetext":o("valueText"),"data-scrubbing":b(g),onFocus(){r({type:"INPUT.FOCUS"})},onBlur(){r({type:"INPUT.BLUR"})},onInput(T){let w=Og(T.currentTarget,a);r({type:"INPUT.CHANGE",target:T.currentTarget,hint:"set",selection:w})},onBeforeInput(T){var w;try{let{selectionStart:I,selectionEnd:P,value:v}=T.currentTarget,E=v.slice(0,I)+((w=T.data)!=null?w:"")+v.slice(P);o("parser").isValidPartialNumber(E)||T.preventDefault()}catch(I){}},onKeyDown(T){if(T.defaultPrevented||c||Me(T))return;let w=Hn(T)*i("step"),P={ArrowUp(){r({type:"INPUT.ARROW_UP",step:w}),T.preventDefault()},ArrowDown(){r({type:"INPUT.ARROW_DOWN",step:w}),T.preventDefault()},Home(){Be(T)||(r({type:"INPUT.HOME"}),T.preventDefault())},End(){Be(T)||(r({type:"INPUT.END"}),T.preventDefault())},Enter(v){let E=Og(v.currentTarget,a);r({type:"INPUT.ENTER",selection:E})}}[T.key];P==null||P(T)}}))},getDecrementTriggerProps(){return t.button(y(h({},Mr.decrementTrigger.attrs),{dir:i("dir"),id:uE(a),disabled:m,"data-disabled":b(m),"aria-label":S.decrementLabel,type:"button",tabIndex:-1,"aria-controls":_o(a),"data-scrubbing":b(g),onPointerDown(T){var w;m||fe(T)&&(r({type:"TRIGGER.PRESS_DOWN",hint:"decrement",pointerType:T.pointerType}),T.pointerType==="mouse"&&T.preventDefault(),T.pointerType==="touch"&&((w=T.currentTarget)==null||w.focus({preventScroll:!0})))},onPointerUp(T){r({type:"TRIGGER.PRESS_UP",hint:"decrement",pointerType:T.pointerType})},onPointerLeave(){m||r({type:"TRIGGER.PRESS_UP",hint:"decrement"})}}))},getIncrementTriggerProps(){return t.button(y(h({},Mr.incrementTrigger.attrs),{dir:i("dir"),id:dE(a),disabled:f,"data-disabled":b(f),"aria-label":S.incrementLabel,type:"button",tabIndex:-1,"aria-controls":_o(a),"data-scrubbing":b(g),onPointerDown(T){var w;f||!fe(T)||(r({type:"TRIGGER.PRESS_DOWN",hint:"increment",pointerType:T.pointerType}),T.pointerType==="mouse"&&T.preventDefault(),T.pointerType==="touch"&&((w=T.currentTarget)==null||w.focus({preventScroll:!0})))},onPointerUp(T){r({type:"TRIGGER.PRESS_UP",hint:"increment",pointerType:T.pointerType})},onPointerLeave(T){r({type:"TRIGGER.PRESS_UP",hint:"increment",pointerType:T.pointerType})}}))},getScrubberProps(){return t.element(y(h({},Mr.scrubber.attrs),{dir:i("dir"),"data-disabled":b(l),id:PN(a),role:"presentation","data-scrubbing":b(g),onMouseDown(T){if(l||!fe(T))return;let w=et(T),P=ye(T.currentTarget).devicePixelRatio;w.x=w.x-Xi(7.5,P),w.y=w.y-Xi(7.5,P),r({type:"SCRUBBER.PRESS_DOWN",point:w}),T.preventDefault(),B(()=>{_i(Ei(a))})},style:{cursor:l?void 0:"ew-resize"}}))}}}function kN(e,t={}){let{numberingSystem:n}=t;if(n&&e.includes("-nu-")&&(e.includes("-u-")||(e+="-u-"),e+=`-nu-${n}`),t.style==="unit"&&!gc){var r;let{unit:o,unitDisplay:s="short"}=t;if(!o)throw new Error('unit option must be provided with style: "unit"');if(!(!((r=hE[o])===null||r===void 0)&&r[s]))throw new Error(`Unsupported unit ${o} with unitDisplay = ${s}`);t=y(h({},t),{style:"decimal"})}let i=e+(t?Object.entries(t).sort((o,s)=>o[0]0||Object.is(n,0):t==="exceptZero"&&(Object.is(n,-0)||Object.is(n,0)?n=Math.abs(n):r=n>0),r){let i=e.format(-n),a=e.format(n),o=i.replace(a,"").replace(/\u200e|\u061C/,"");return[...o].length!==1&&console.warn("@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case"),i.replace(a,"!!!").replace(o,"+").replace("!!!",a)}else return e.format(n)}}function Tg(e,t,n){let r=aE(e,t);if(!e.includes("-nu-")&&!r.isValidPartialNumber(n)){for(let i of DN)if(i!==r.options.numberingSystem){let a=aE(e+(e.includes("-u-")?"-nu-":"-u-nu-")+i,t);if(a.isValidPartialNumber(n))return a}}return r}function aE(e,t){let n=e+(t?Object.entries(t).sort((i,a)=>i[0]l.formatToParts(A));var p;let u=(p=(i=c.find(A=>A.type==="minusSign"))===null||i===void 0?void 0:i.value)!==null&&p!==void 0?p:"-",f=(a=d.find(A=>A.type==="plusSign"))===null||a===void 0?void 0:a.value;!f&&((r==null?void 0:r.signDisplay)==="exceptZero"||(r==null?void 0:r.signDisplay)==="always")&&(f="+");let S=(o=new Intl.NumberFormat(e,y(h({},n),{minimumFractionDigits:2,maximumFractionDigits:2})).formatToParts(.001).find(A=>A.type==="decimal"))===null||o===void 0?void 0:o.value,T=(s=c.find(A=>A.type==="group"))===null||s===void 0?void 0:s.value,w=c.filter(A=>!oE.has(A.type)).map(A=>sE(A.value)),I=g.flatMap(A=>A.filter(N=>!oE.has(N.type)).map(N=>sE(N.value))),P=[...new Set([...w,...I])].sort((A,N)=>N.length-A.length),v=P.length===0?new RegExp("[\\p{White_Space}]","gu"):new RegExp(`${P.join("|")}|[\\p{White_Space}]`,"gu"),E=[...new Intl.NumberFormat(n.locale,{useGrouping:!1}).format(9876543210)].reverse(),R=new Map(E.map((A,N)=>[A,N])),x=new RegExp(`[${E.join("")}]`,"g");return{minusSign:u,plusSign:f,decimal:S,group:T,literals:v,numeral:x,index:A=>String(R.get(A))}}function wa(e,t,n){return e.replaceAll?e.replaceAll(t,n):e.split(t).join(n)}function sE(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mE(e){return{focused:e.focused,invalid:e.invalid,empty:e.empty,value:e.value,valueAsNumber:e.valueAsNumber}}function vE(e,t){var r;let n=(r=G(e,"step"))!=null?r:1;return!Number.isFinite(t)||Number.isNaN(t)?"":no(t,n)}function zN(e){var t,n;return(n=(t=V(e,"value"))!=null?t:V(e,"defaultValue"))!=null?n:""}function jN(e,t,n){var o;let r=(o=G(e,"step"))!=null?o:1;if(n!==void 0&&Number.isFinite(n)&&!Number.isNaN(n))return vE(e,n);let i=zN(e);if(i!=="")return no(i,r);let a=(t!=null?t:"").replace(/,/g,"");return a===""?"":no(a,r)}function $o(e,t,n=!1,r){let i=e.querySelector('[data-scope="number-input"][data-part="value-input"]');if(!i)return;let a=jN(e,t,r),o=i.value!==a;o&&(i.value=a),it(i,e),n&&(o||a!=="")&&(Wt(i),i.dispatchEvent(new Event("input",{bubbles:!0})),i.dispatchEvent(new Event("change",{bubbles:!0})))}function wg(e,t){var i;let n=(i=G(e.el,"step"))!=null?i:1;if(typeof t=="number"){if(Number.isNaN(t))return;e.machine.service.send({type:"VALUE.SET",value:Jr(t,n)});return}let r=t.trim();r!==""&&e.machine.service.send({type:"VALUE.SET",value:r})}function yE(e,t,n){var i;let r=(i=G(e,"step"))!=null?i:1;return y(h({id:e.id},Ws(e)),{min:G(e,"min"),max:G(e,"max"),step:r,formatOptions:$s(r),disabled:O(e,"disabled"),readOnly:O(e,"readonly"),invalid:O(e,"invalid"),required:O(e,"required"),allowMouseWheel:O(e,"allowMouseWheel"),dir:q(e),onValueChange:a=>{var o;a.value!==void 0&&$o(e,(o=a.value)!=null?o:"",!0,a.valueAsNumber),W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,value:a.value,valueAsNumber:a.valueAsNumber},serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})}})}function YN(e){var n;let t=(n=G(e,"step"))!=null?n:1;return{id:e.id,min:G(e,"min"),max:G(e,"max"),step:t,formatOptions:$s(t),disabled:O(e,"disabled"),readOnly:O(e,"readonly"),invalid:O(e,"invalid"),required:O(e,"required"),allowMouseWheel:O(e,"allowMouseWheel"),dir:q(e)}}var yN,Mr,EN,_o,dE,uE,PN,gE,SN,Ei,IN,TN,pE,CN,wN,ON,VN,AN,Ig,Vg,gc,hE,RN,LN,DN,fE,iE,FN,oE,MN,$N,HN,Cg,bi,BN,UN,GN,qN,lE,cE,WN,KN,XN,EE=ee(()=>{"use strict";Eo();so();Bt();Kt();$e();Ve();be();oe();yN=z("numberInput").parts("root","label","input","control","valueText","incrementTrigger","decrementTrigger","scrubber"),Mr=yN.build();EN=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`number-input:${e.id}`},_o=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`number-input:${e.id}:input`},dE=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.incrementTrigger)!=null?n:`number-input:${e.id}:inc`},uE=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.decrementTrigger)!=null?n:`number-input:${e.id}:dec`},PN=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.scrubber)!=null?n:`number-input:${e.id}:scrubber`},gE=e=>`number-input:${e.id}:cursor`,SN=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`number-input:${e.id}:label`},Ei=e=>e.getById(_o(e)),IN=e=>e.getById(dE(e)),TN=e=>e.getById(uE(e)),pE=e=>e.getDoc().getElementById(gE(e)),CN=(e,t)=>{let n=null;return t==="increment"&&(n=IN(e)),t==="decrement"&&(n=TN(e)),n},wN=(e,t)=>{if(!wt())return AN(e,t),()=>{var n;(n=pE(e))==null||n.remove()}},ON=e=>{let t=e.getDoc(),n=t.documentElement,r=t.body;return r.style.pointerEvents="none",n.style.userSelect="none",n.style.cursor="ew-resize",()=>{r.style.pointerEvents="",n.style.userSelect="",n.style.cursor="",n.style.length||n.removeAttribute("style"),r.style.length||r.removeAttribute("style")}},VN=(e,t)=>{let{point:n,isRtl:r,event:i}=t,a=e.getWin(),o=Xi(i.movementX,a.devicePixelRatio),s=Xi(i.movementY,a.devicePixelRatio),l=o>0?"increment":o<0?"decrement":null;r&&l==="increment"&&(l="decrement"),r&&l==="decrement"&&(l="increment");let c={x:n.x+o,y:n.y+s},d=a.innerWidth,g=Xi(7.5,a.devicePixelRatio);return c.x=rf(c.x+g,d)-g,{hint:l,point:c}},AN=(e,t)=>{let n=e.getDoc(),r=n.createElement("div");r.className="scrubber--cursor",r.id=gE(e),Object.assign(r.style,{width:"15px",height:"15px",position:"fixed",pointerEvents:"none",left:"0px",top:"0px",zIndex:Os,transform:t?`translate3d(${t.x}px, ${t.y}px, 0px)`:void 0,willChange:"transform"}),r.innerHTML=` +"use strict";var Corex=(()=>{var os=Object.defineProperty,US=Object.defineProperties,qS=Object.getOwnPropertyDescriptor,WS=Object.getOwnPropertyDescriptors,KS=Object.getOwnPropertyNames,as=Object.getOwnPropertySymbols;var Fc=Object.prototype.hasOwnProperty,Ep=Object.prototype.propertyIsEnumerable;var Lc=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Pp=e=>{throw TypeError(e)};var Dc=(e,t,n)=>t in e?os(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,h=(e,t)=>{for(var n in t||(t={}))Fc.call(t,n)&&Dc(e,n,t[n]);if(as)for(var n of as(t))Ep.call(t,n)&&Dc(e,n,t[n]);return e},y=(e,t)=>US(e,WS(t));var St=(e,t)=>{var n={};for(var r in e)Fc.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&as)for(var r of as(e))t.indexOf(r)<0&&Ep.call(e,r)&&(n[r]=e[r]);return n};var ee=(e,t)=>()=>(e&&(t=e(e=0)),t);var pe=(e,t)=>{for(var n in t)os(e,n,{get:t[n],enumerable:!0})},zS=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of KS(t))!Fc.call(e,i)&&i!==n&&os(e,i,{get:()=>t[i],enumerable:!(r=qS(t,i))||r.enumerable});return e};var jS=e=>zS(os({},"__esModule",{value:!0}),e);var Q=(e,t,n)=>Dc(e,typeof t!="symbol"?t+"":t,n);var ss=(e,t,n)=>t.has(e)?Pp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);var Ke=(e,t,n)=>new Promise((r,i)=>{var a=l=>{try{s(n.next(l))}catch(c){i(c)}},o=l=>{try{s(n.throw(l))}catch(c){i(c)}},s=l=>l.done?r(l.value):Promise.resolve(l.value).then(a,o);s((n=n.apply(e,t)).next())}),YS=function(e,t){this[0]=e,this[1]=t};var Sp=e=>{var t=e[Lc("asyncIterator")],n=!1,r,i={};return t==null?(t=e[Lc("iterator")](),r=a=>i[a]=o=>t[a](o)):(t=t.call(e),r=a=>i[a]=o=>{if(n){if(n=!1,a==="throw")throw o;return o}return n=!0,{done:!1,value:new YS(new Promise(s=>{var l=t[a](o);l instanceof Object||Pp("Object expected"),s(l)}),1)}}),i[Lc("iterator")]=()=>i,r("next"),"throw"in t?r("throw"):i.throw=a=>{throw a},"return"in t&&r("return"),i};function Na(e,t){let n=e.filter(i=>!t.includes(i)),r=t.filter(i=>!e.includes(i));return{added:n,removed:r}}var Mc=ee(()=>{"use strict"});function q(e){let t=e.dataset.dir;if(t!==void 0&&XS.includes(t))return t;let n=document.documentElement.getAttribute("dir");return n==="ltr"||n==="rtl"?n:"ltr"}function Ma(e,t){let n=e.dataset[t];return n==="indeterminate"?"indeterminate":n==="true"}function Is(e,t){let n=e.querySelector(`[data-templates="${t}"]`);return n?n instanceof HTMLTemplateElement?n.content:n:null}function j(e){return!e.main.isDead&&e.main.isConnected()}function zc(e,t){let n=V(t,"form");n&&t.closest("form")===null&&e.setAttribute("form",n)}function it(e,t){e&&(t.closest("form")!==null?e.removeAttribute("form"):zc(e,t))}function $a(e){return e==null?[]:Array.isArray(e)?e:[e]}function Mi(e,t,n={}){let{step:r=1,loop:i=!0}=n,a=t+r,o=e.length,s=o-1;return t===-1?r>0?0:s:a<0?i?s:0:a>=o?i?0:t>o?o:t:a}function Wp(e,t,n={}){return e[Mi(e,t,n)]}function Ha(e,t,n={}){let{step:r=1,loop:i=!0}=n;return Mi(e,t,{step:-r,loop:i})}function Kp(e,t,n={}){return e[Ha(e,t,n)]}function Ba(e,t){return e.reduce((n,r,i)=>{var a;return i%t===0?n.push([r]):(a=en(n))==null||a.push(r),n},[])}function Xc(e){return e.reduce((t,n)=>Array.isArray(n)?t.concat(Xc(n)):t.concat(n),[])}function Zc(e,t){return e.reduce(([n,r],i)=>(t(i)?n.push(i):r.push(i),[n,r]),[[],[]])}function He(e,t,...n){var i;if(e in t){let a=t[e];return Qe(a)?a(...n):a}let r=new Error(`No matching key: ${JSON.stringify(e)} in ${JSON.stringify(Object.keys(t))}`);throw(i=Error.captureStackTrace)==null||i.call(Error,r,He),r}function Zp(e,t=0){let n=0,r=null;return(...i)=>{let a=Date.now(),o=a-n;o>=t?(r&&(clearTimeout(r),r=null),e(...i),n=a):r||(r=setTimeout(()=>{e(...i),n=Date.now(),r=null},t-o))}}function dI(e){let t="",n;for(n=Math.abs(e);n>52;n=n/52|0)t=kp(n%52)+t;return kp(n%52)+t}function uI(e,t){let n=t.length;for(;n;)e=e*33^t.charCodeAt(--n);return e}function _n(e){if(!Da(e)||e===void 0)return e;let t=Reflect.ownKeys(e).filter(r=>typeof r=="string"),n={};for(let r of t){let i=e[r];i!==void 0&&(n[r]=_n(i))}return n}function dr(e,t){let n={};for(let r of t){let i=e[r];i!==void 0&&(n[r]=i)}return n}function It(...e){let t=e.length===1?e[0]:e[1];(e.length===2?e[0]:!0)&&console.warn(t)}function Fi(...e){let t=e.length===1?e[0]:e[1];if(e.length===2?e[0]:!0)throw new Error(t)}function nn(e,t){if(e==null)throw new Error(t())}function gn(e,t,n){let r=[];for(let i of t)e[i]==null&&r.push(i);if(r.length>0)throw new Error(`[zag-js${n?` > ${n}`:""}] missing required props: ${r.join(", ")}`)}function Gc(e){return e.join(ur)}function gI(e){return e.includes(ur)}function th(e){return e.startsWith(Qp)}function pI(e){return e.startsWith(ur)}function hI(e){return th(e)?e.slice(Qp.length):e}function Uc(e,t){return e?`${e}${ur}${t}`:t}function fI(e){let t=new Map,n=new Map,r=(i,a)=>{t.set(i,a);let o=a.id;o&&(n.has(o)&&Fi(`[zag-js] Duplicate state id: "${o}"`),n.set(o,i));let s=a.states;if(s){nn(a.initial,()=>`[zag-js] Compound state "${i}" has child states but no "initial" property`),a.initial in s||Fi(`[zag-js] Compound state "${i}" has initial "${String(a.initial)}" which is not a child state`);for(let[l,c]of Object.entries(s)){if(!c)continue;let d=Uc(i,l);r(d,c)}}};for(let[i,a]of Object.entries(e.states))a&&r(i,a);return{index:t,idIndex:n}}function qa(e){let t=Np.get(e);if(t)return t;let{index:n,idIndex:r}=fI(e);return Np.set(e,n),eh.set(e,r),n}function mI(e,t){var n;return qa(e),(n=eh.get(e))==null?void 0:n.get(t)}function td(e){return e?String(e).split(ur).filter(Boolean):[]}function ys(e,t){if(!t)return[];let n=qa(e),r=td(t),i=[],a=[];for(let o of r){a.push(o);let s=Gc(a),l=n.get(s);if(!l)break;i.push({path:s,state:l})}return i}function La(e,t){let n=qa(e),r=td(t);if(!r.length)return t;let i=[];for(let s of r){i.push(s);let l=Gc(i);if(!n.has(l))return t}let a=Gc(i),o=n.get(a);for(;o!=null&&o.initial;){let s=`${a}${ur}${o.initial}`,l=n.get(s);if(!l)break;a=s,o=l}return a}function Lp(e,t){return qa(e).has(t)}function Dp(e,t,n){let r=String(t);if(th(r)){let i=hI(r),a=mI(e,i);return nn(a,()=>`[zag-js] Unknown state id: "${i}"`),La(e,a)}if(pI(r)&&n){let i=Uc(n,r.slice(1));return La(e,i)}if(!gI(r)&&n){let i=td(n);for(let a=i.length-1;a>=1;a--){let o=i.slice(0,a).join(ur),s=Uc(o,r);if(Lp(e,s))return La(e,s)}if(Lp(e,r))return La(e,r)}return La(e,r)}function vI(e,t,n){var a,o;let r=ys(e,t);for(let s=r.length-1;s>=0;s--){let l=(a=r[s])==null?void 0:a.state.on,c=l==null?void 0:l[n];if(c)return{transitions:c,source:(o=r[s])==null?void 0:o.path}}let i=e.on;return{transitions:i==null?void 0:i[n],source:void 0}}function yI(e,t,n,r){var d,u,p,g;let i=t?ys(e,t):[],a=ys(e,n),o=0;for(;o{var i;return(i=r.state.tags)==null?void 0:i.includes(n)})}function we(){return{and:(...e)=>function(n){return e.every(r=>n.guard(r))},or:(...e)=>function(n){return e.some(r=>n.guard(r))},not:e=>function(n){return!n.guard(e)}}}function te(e){return qa(e),e}function Mt(){return{guards:we(),createMachine:e=>te(e),choose:e=>function({choose:n}){var r;return(r=n(e))==null?void 0:r.actions}}}function nh(e){if(!e)return!1;try{return e.selectionStart===0&&e.selectionEnd===0}catch(t){return e.value===""}}function _i(e){if(e)try{if(e.ownerDocument.activeElement!==e)return;let t=e.value.length;e.setSelectionRange(t,t)}catch(t){}}function VI(e){return["html","body","#document"].includes(rh(e))}function bs(e){if(!e)return!1;let t=e.getRootNode();return gr(t)===e}function $t(e){if(e==null||!Pe(e))return!1;try{return ah(e)&&e.selectionStart!=null||xI.test(e.localName)||e.isContentEditable||e.getAttribute("contenteditable")==="true"||e.getAttribute("contenteditable")===""}catch(t){return!1}}function ge(e,t){var r;if(!e||!t||!Pe(e)||!ih(t))return!1;if(Pe(t)&&e===t||e.contains(t))return!0;let n=(r=t.getRootNode)==null?void 0:r.call(t);if(n&&zr(n)){let i=t;for(;i;){if(e===i)return!0;i=i.parentNode||i.host}}return!1}function Ue(e){var t;return Wa(e)?e:OI(e)?e.document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function RI(e){return Ue(e).documentElement}function ye(e){var t,n,r;return zr(e)?ye(e.host):Wa(e)?(t=e.defaultView)!=null?t:window:Pe(e)&&(r=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?r:window}function gr(e){let t=e.activeElement;for(;t!=null&&t.shadowRoot;){let n=t.shadowRoot.activeElement;if(!n||n===t)break;t=n}return t}function kI(e){if(rh(e)==="html")return e;let t=e.assignedSlot||e.parentNode||zr(e)&&e.host||RI(e);return zr(t)?t.host:t}function nd(e){var n;let t;try{if(t=e.getRootNode({composed:!0}),Wa(t)||zr(t))return t}catch(r){}return(n=e.ownerDocument)!=null?n:document}function pt(e){return Bc.has(e)||Bc.set(e,ye(e).getComputedStyle(e)),Bc.get(e)}function Vs(e,t){let n=new Set,r=nd(e),i=a=>{let o=a.querySelectorAll("[aria-controls]");for(let s of o){if(s.getAttribute("aria-expanded")!=="true")continue;let l=oh(s);for(let c of l){if(!c||n.has(c))continue;n.add(c);let d=r.getElementById(c);if(d){let u=d.getAttribute("role"),p=d.getAttribute("aria-modal")==="true";if(u&&NI(u)&&!p&&(d===t||d.contains(t)||i(d)))return!0}}}return!1};return i(e)}function id(e,t){let n=nd(e),r=new Set,i=a=>{let o=a.querySelectorAll("[aria-controls]");for(let s of o){if(s.getAttribute("aria-expanded")!=="true")continue;let l=oh(s);for(let c of l){if(!c||r.has(c))continue;r.add(c);let d=n.getElementById(c);if(d){let u=d.getAttribute("role"),p=d.getAttribute("aria-modal")==="true";u&&rd.has(u)&&!p&&(t(d),i(d))}}}};i(e)}function sh(e){let t=new Set;return id(e,n=>{e.contains(n)||t.add(n)}),Array.from(t)}function LI(e){let t=e.getAttribute("role");return!!(t&&rd.has(t))}function DI(e){return e.hasAttribute("aria-controls")&&e.getAttribute("aria-expanded")==="true"}function lh(e){var t;return DI(e)?!0:!!((t=e.querySelector)!=null&&t.call(e,'[aria-controls][aria-expanded="true"]'))}function ch(e){if(!e.id)return!1;let t=nd(e),n=CSS.escape(e.id),r=`[aria-controls~="${n}"][aria-expanded="true"], [aria-controls="${n}"][aria-expanded="true"]`;return!!(t.querySelector(r)&&LI(e))}function dh(e,t){let{type:n,quality:r=.92,background:i}=t;if(!e)throw new Error("[zag-js > getDataUrl]: Could not find the svg element");let a=ye(e),o=a.document,s=e.getBoundingClientRect(),l=e.cloneNode(!0);l.hasAttribute("viewBox")||l.setAttribute("viewBox",`0 0 ${s.width} ${s.height}`);let d=`\r +`+new a.XMLSerializer().serializeToString(l),u="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(d);if(n==="image/svg+xml")return Promise.resolve(u).then(S=>(l.remove(),S));let p=a.devicePixelRatio||1,g=o.createElement("canvas"),f=new a.Image;f.src=u,g.width=s.width*p,g.height=s.height*p;let m=g.getContext("2d");return(n==="image/jpeg"||i)&&(m.fillStyle=i||"white",m.fillRect(0,0,g.width,g.height)),new Promise(S=>{f.onload=()=>{m==null||m.drawImage(f,0,0,g.width,g.height),S(g.toDataURL(n,r)),l.remove()}})}function FI(){var t;let e=navigator.userAgentData;return(t=e==null?void 0:e.platform)!=null?t:navigator.platform}function MI(){let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function gh(e){let{selectionStart:t,selectionEnd:n,value:r}=e.currentTarget,i=e.data;return r.slice(0,t)+(i!=null?i:"")+r.slice(n)}function UI(e){var t,n,r,i;return(i=(t=e.composedPath)==null?void 0:t.call(e))!=null?i:(r=(n=e.nativeEvent)==null?void 0:n.composedPath)==null?void 0:r.call(n)}function ne(e){var n;let t=UI(e);return(n=t==null?void 0:t[0])!=null?n:e.target}function $n(e){let t=e.currentTarget;if(!t||!t.matches("a[href], button[type='submit'], input[type='submit']"))return!1;let r=e.button===1,i=xs(e);return r||i}function jr(e){let t=e.currentTarget;if(!t)return!1;let n=t.localName;return e.altKey?n==="a"||n==="button"&&t.type==="submit"||n==="input"&&t.type==="submit":!1}function Me(e){return Ot(e).isComposing||e.keyCode===229}function xs(e){return $i()?e.metaKey:e.ctrlKey}function ph(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}function hh(e){return e.pointerType===""&&e.isTrusted?!0:GI()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function me(e,t={}){var o;let{dir:n="ltr",orientation:r="horizontal"}=t,i=e.key;return i=(o=WI[i])!=null?o:i,n==="rtl"&&r==="horizontal"&&i in Mp&&(i=Mp[i]),i}function Ot(e){var t;return(t=e.nativeEvent)!=null?t:e}function Hn(e){return e.ctrlKey||e.metaKey?.1:KI.has(e.key)||e.shiftKey&&zI.has(e.key)?10:1}function et(e,t="client"){let n=qI(e)?e.touches[0]||e.changedTouches[0]:e;return{x:n[`${t}X`],y:n[`${t}Y`]}}function fh(e,t){var a;let{type:n="HTMLInputElement",property:r="value"}=t,i=ye(e)[n].prototype;return(a=Object.getOwnPropertyDescriptor(i,r))!=null?a:{}}function jI(e){if(e.localName==="input")return"HTMLInputElement";if(e.localName==="textarea")return"HTMLTextAreaElement";if(e.localName==="select")return"HTMLSelectElement"}function _e(e,t,n="value"){var i;if(!e)return;let r=jI(e);r&&((i=fh(e,{type:r,property:n}).set)==null||i.call(e,t)),e.setAttribute(n,t)}function ja(e,t){var r;if(!e)return;(r=fh(e,{type:"HTMLInputElement",property:"checked"}).set)==null||r.call(e,t),t?e.setAttribute("checked",""):e.removeAttribute("checked")}function Hi(e,t){let{value:n,bubbles:r=!0}=t;if(!e)return;let i=ye(e);if(!(e instanceof i.HTMLInputElement))return;_e(e,`${n}`);let a=new i.Event("input",{bubbles:r});e.dispatchEvent(Rs(a))}function Bi(e,t){let{checked:n,bubbles:r=!0}=t;if(!e)return;let i=ye(e);if(!(e instanceof i.HTMLInputElement))return;ja(e,n);let a=new i.Event("click",{bubbles:r});e.dispatchEvent(Rs(a))}function YI(e){return e.matches("textarea, input, select, button")}function XI(e,t){if(!e)return;let n=YI(e)?e.form:e.closest("form"),r=i=>{i.defaultPrevented||t()};return n==null||n.addEventListener("reset",r,{passive:!0}),()=>n==null?void 0:n.removeEventListener("reset",r)}function ZI(e,t){let n=e==null?void 0:e.closest("fieldset");if(!n)return;t(n.disabled);let r=ye(n),i=new r.MutationObserver(()=>t(n.disabled));return i.observe(n,{attributes:!0,attributeFilter:["disabled"]}),()=>i.disconnect()}function ht(e,t){if(!e)return;let{onFieldsetDisabledChange:n,onFormReset:r}=t,i=[XI(e,r),ZI(e,n)];return()=>i.forEach(a=>a==null?void 0:a())}function sd(e){return Object.prototype.hasOwnProperty.call(e,mh)}function Rs(e){return sd(e)||Object.defineProperty(e,mh,{value:!0}),e}function yh(e){let t=e.getAttribute("tabindex");return t?parseInt(t,10):NaN}function tT(e){return ah(e)&&e.type==="radio"}function nT(e){var a;if(!tT(e)||!e.name||e.checked)return!0;let t=`input[type="radio"][name="${CSS.escape(e.name)}"]`,n=(a=e.form)!=null?a:e.ownerDocument,r=Array.from(n.querySelectorAll(t)).filter(o=>o.form===e.form&&ut(o)),i=r.find(o=>o.checked);return i?i===e:r[0]===e}function rT(e,t){if(!t)return null;if(t===!0)return e.shadowRoot||null;let n=t(e);return(n===!0?e.shadowRoot:n)||null}function bh(e,t,n){let r=[...e],i=[...e],a=new Set,o=new Map;e.forEach((l,c)=>o.set(l,c));let s=0;for(;s{o.set(g,p+f)});for(let g=p+d.length;g{o.set(g,p+f)})}i.push(...d)}}return r}function ut(e){return!Pe(e)||e.closest("[inert]")?!1:e.matches(ks)&&AI(e)}function Bn(e,t={}){if(!e)return[];let{includeContainer:n,getShadowRoot:r}=t,i=Array.from(e.querySelectorAll(ks));n&&lr(e)&&i.unshift(e);let a=[];for(let o of i)if(lr(o)){if(vh(o)&&o.contentDocument){let s=o.contentDocument.body;a.push(...Bn(s,{getShadowRoot:r}));continue}a.push(o)}if(r){let o=bh(a,r,lr);return!o.length&&n?i:o}return!a.length&&n?i:a}function lr(e){return Pe(e)&&e.tabIndex>0?!0:!ut(e)||eT(e)?!1:nT(e)}function iT(e,t={}){let n=Bn(e,t),r=n[0]||null,i=n[n.length-1]||null;return[r,i]}function Gi(e){return e.tabIndex<0&&(JI.test(e.localName)||$t(e))&&!QI(e)?0:e.tabIndex}function hr(e){let{root:t,getInitialEl:n,filter:r,enabled:i=!0}=e;if(!i)return;let a=null;if(a||(a=typeof n=="function"?n():n),a||(a=t==null?void 0:t.querySelector("[data-autofocus],[autofocus]")),!a){let o=Bn(t);a=r?o.filter(r)[0]:o[0]}return a||t||void 0}function Ns(e){let t=e.currentTarget;if(!t)return!1;let[n,r]=iT(t);return!(bs(n)&&e.shiftKey||bs(r)&&!e.shiftKey||!n&&!r)}function B(e){let t=ld.create();return t.request(e),t.cleanup}function Yr(e){let t=new Set;function n(r){let i=globalThis.requestAnimationFrame(r);t.add(()=>globalThis.cancelAnimationFrame(i))}return n(()=>n(e)),function(){t.forEach(i=>i())}}function aT(e,t,n){let r=B(()=>{e.removeEventListener(t,i,!0),n()}),i=()=>{r(),n()};return e.addEventListener(t,i,{once:!0,capture:!0}),r}function oT(e,t){if(!e)return;let{attributes:n,callback:r}=t,i=e.ownerDocument.defaultView||window,a=new i.MutationObserver(o=>{for(let s of o)s.type==="attributes"&&s.attributeName&&n.includes(s.attributeName)&&r(s)});return a.observe(e,{attributes:!0,attributeFilter:n}),()=>a.disconnect()}function Ht(e,t){let{defer:n}=t,r=n?B:a=>a(),i=[];return i.push(r(()=>{let a=typeof e=="function"?e():e;i.push(oT(a,t))})),()=>{i.forEach(a=>a==null?void 0:a())}}function sT(e,t){let{callback:n}=t;if(!e)return;let r=e.ownerDocument.defaultView||window,i=new r.MutationObserver(n);return i.observe(e,{childList:!0,subtree:!0}),()=>i.disconnect()}function Ls(e,t){let{defer:n}=t,r=n?B:a=>a(),i=[];return i.push(r(()=>{let a=typeof e=="function"?e():e;i.push(sT(a,t))})),()=>{i.forEach(a=>a==null?void 0:a())}}function Ui(e){let t=()=>{let n=ye(e);e.dispatchEvent(new n.MouseEvent("click"))};BI()?aT(e,"keyup",t):queueMicrotask(t)}function Xa(e){let t=kI(e);return VI(t)?Ue(t).body:Pe(t)&&dd(t)?t:Xa(t)}function cd(e,t=[]){let n=Xa(e),r=n===e.ownerDocument.body,i=ye(n);return r?t.concat(i,i.visualViewport||[],dd(n)?n:[]):t.concat(n,cd(n,[]))}function dd(e){let t=ye(e),{overflow:n,overflowX:r,overflowY:i,display:a}=t.getComputedStyle(e);return lT.test(n+i+r)&&!cT.has(a)}function dT(e){return e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth}function Gn(e,t){let i=t||{},{rootEl:n}=i,r=St(i,["rootEl"]);!e||!n||!dd(n)||!dT(n)||e.scrollIntoView(r)}function qi(e,t){let{left:n,top:r,width:i,height:a}=t.getBoundingClientRect(),o={x:e.x-n,y:e.y-r},s={x:Fp(o.x/i),y:Fp(o.y/a)};function l(c={}){let{dir:d="ltr",orientation:u="horizontal",inverted:p}=c,g=typeof p=="object"?p.x:p,f=typeof p=="object"?p.y:p;return u==="horizontal"?d==="rtl"||g?1-s.x:s.x:f?1-s.y:s.y}return{offset:o,percent:s,getPercentValue:l}}function Ph(e,t){let n=e.body,r="pointerLockElement"in e||"mozPointerLockElement"in e,i=()=>!!e.pointerLockElement;function a(){t==null||t(i())}function o(l){i()&&(t==null||t(!1)),console.error("PointerLock error occurred:",l),e.exitPointerLock()}if(!r)return;try{n.requestPointerLock()}catch(l){}let s=[ae(e,"pointerlockchange",a,!1),ae(e,"pointerlockerror",o,!1)];return()=>{s.forEach(l=>l()),e.exitPointerLock()}}function uT(e={}){let{target:t,doc:n}=e,r=n!=null?n:document,i=r.documentElement;return Ka()?(Di==="default"&&(qc=i.style.webkitUserSelect,i.style.webkitUserSelect="none"),Di="disabled"):t&&(ms.set(t,t.style.userSelect),t.style.userSelect="none"),()=>ud({target:t,doc:r})}function ud(e={}){let{target:t,doc:n}=e,i=(n!=null?n:document).documentElement;if(Ka()){if(Di!=="disabled")return;Di="restoring",setTimeout(()=>{Yr(()=>{Di==="restoring"&&(i.style.webkitUserSelect==="none"&&(i.style.webkitUserSelect=qc||""),qc="",Di="default")})},300)}else if(t&&ms.has(t)){let a=ms.get(t);t.style.userSelect==="none"&&(t.style.userSelect=a!=null?a:""),t.getAttribute("style")===""&&t.removeAttribute("style"),ms.delete(t)}}function Za(e={}){let o=e,{defer:t,target:n}=o,r=St(o,["defer","target"]),i=t?B:s=>s(),a=[];return a.push(i(()=>{let s=typeof n=="function"?n():n;a.push(uT(y(h({},r),{target:s})))})),()=>{a.forEach(s=>s==null?void 0:s())}}function pn(e,t){let{onPointerMove:n,onPointerUp:r}=t,i=s=>{let l=et(s),c=Math.sqrt(l.x**2+l.y**2),d=s.pointerType==="touch"?10:5;if(!(c{let l=et(s);r({point:l,event:s})},o=[ae(e,"pointermove",i,!1),ae(e,"pointerup",a,!1),ae(e,"pointercancel",a,!1),ae(e,"contextmenu",a,!1),Za({doc:e})];return()=>{o.forEach(s=>s())}}function Ds(e){let{pointerNode:t,keyboardNode:n=t,onPress:r,onPressStart:i,onPressEnd:a,isValidKey:o=w=>w.key==="Enter"}=e;if(!t)return Mn;let s=ye(t),l=Mn,c=Mn,d=Mn,u=w=>({point:et(w),event:w});function p(w){i==null||i(u(w))}function g(w){a==null||a(u(w))}let m=ae(t,"pointerdown",w=>{c();let P=ae(s,"pointerup",E=>{let R=ne(E);ge(t,R)?r==null||r(u(E)):a==null||a(u(E))},{passive:!r,once:!0}),v=ae(s,"pointercancel",g,{passive:!a,once:!0});c=Hc(P,v),bs(n)&&w.pointerType==="mouse"&&w.preventDefault(),p(w)},{passive:!i}),S=ae(n,"focus",T);l=Hc(m,S);function T(){let w=E=>{if(!o(E))return;let R=C=>{if(!o(C))return;let A=new s.PointerEvent("pointerup"),N=u(A);r==null||r(N),a==null||a(N)};c(),c=ae(n,"keyup",R);let x=new s.PointerEvent("pointerdown");p(x)},I=()=>{let E=new s.PointerEvent("pointercancel");g(E)},P=ae(n,"keydown",w),v=ae(n,"blur",I);d=Hc(P,v)}return()=>{l(),c(),d()}}function Oe(e,t){var n;return Array.from((n=e==null?void 0:e.querySelectorAll(t))!=null?n:[])}function fr(e,t){var n;return(n=e==null?void 0:e.querySelector(t))!=null?n:null}function pd(e,t,n=gd){return e.find(r=>n(r)===t)}function Ja(e,t,n=gd){let r=pd(e,t,n);return r?e.indexOf(r):-1}function mr(e,t,n=!0){let r=Ja(e,t);return r=n?(r+1)%e.length:Math.min(r+1,e.length-1),e[r]}function vr(e,t,n=!0){let r=Ja(e,t);return r===-1?n?e[e.length-1]:null:(r=n?(r-1+e.length)%e.length:Math.max(0,r-1),e[r])}function gT(e){let t=new WeakMap,n,r=new WeakMap,i=s=>n||(n=new s.ResizeObserver(l=>{for(let c of l){r.set(c.target,c);let d=t.get(c.target);if(d)for(let u of d)u(c)}}),n);return{observe:(s,l)=>{let c=t.get(s)||new Set;c.add(l),t.set(s,c);let d=ye(s);return i(d).observe(s,e),()=>{let u=t.get(s);u&&(u.delete(l),u.size===0&&(t.delete(s),i(d).unobserve(s)))}},unobserve:s=>{t.delete(s),n==null||n.unobserve(s)}}}function Sh(e){let t=e.getBoundingClientRect(),n=e.offsetWidth,r=e.offsetHeight,i=Math.round(t.width)!==n||Math.round(t.height)!==r,a=i?Math.round(t.width)/n:1,o=i?Math.round(t.height)/r:1;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}function mT(e,t,n,r=gd){let i=n?Ja(e,n,r):-1,a=n?II(e,i):e;return t.length===1&&(a=a.filter(s=>r(s)!==n)),a.find(s=>fT(hT(s),t))}function Ih(e,t,n){let r=e.getAttribute(t),i=r!=null;return r===n?Mn:(e.setAttribute(t,n),()=>{i?e.setAttribute(t,r):e.removeAttribute(t)})}function Xr(e,t){if(!e)return Mn;let n=Object.keys(t).reduce((r,i)=>(r[i]=e.style.getPropertyValue(i),r),{});return vT(n,t)?Mn:(Object.assign(e.style,t),()=>{Object.assign(e.style,n),e.style.length===0&&e.removeAttribute("style")})}function Th(e,t,n){if(!e)return Mn;let r=e.style.getPropertyValue(t);return r===n?Mn:(e.style.setProperty(t,n),()=>{e.style.setProperty(t,r),e.style.length===0&&e.removeAttribute("style")})}function vT(e,t){return Object.keys(e).every(n=>e[n]===t[n])}function yT(e,t){let{state:n,activeId:r,key:i,timeout:a=350,itemToId:o}=t,s=n.keysSoFar+i,c=s.length>1&&Array.from(s).every(f=>f===s[0])?s[0]:s,d=e.slice(),u=mT(d,c,r,o);function p(){clearTimeout(n.timer),n.timer=-1}function g(f){n.keysSoFar=f,p(),f!==""&&(n.timer=+setTimeout(()=>{g(""),p()},a))}return g(s),u}function bT(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}function ET(e,t,n){let{signal:r}=t;return[new Promise((o,s)=>{let l=setTimeout(()=>{s(new Error(`Timeout of ${n}ms exceeded`))},n);r.addEventListener("abort",()=>{clearTimeout(l),s(new DOMException("Promise aborted","AbortError"))}),e.then(c=>{r.aborted||(clearTimeout(l),o(c))}).catch(c=>{r.aborted||(clearTimeout(l),s(c))})}),()=>t.abort()]}function Ch(e,t){let{timeout:n,rootNode:r}=t,i=ye(r),a=Ue(r),o=new i.AbortController;return ET(new Promise(s=>{let l=e();if(l){s(l);return}let c=new i.MutationObserver(()=>{let d=e();d&&d.isConnected&&(c.disconnect(),s(d))});c.observe(a.body,{childList:!0,subtree:!0})}),o,n)}function PT(e){let t=()=>{var o,s;return(s=(o=e.getRootNode)==null?void 0:o.call(e))!=null?s:document},n=()=>Ue(t()),r=()=>{var o;return(o=n().defaultView)!=null?o:window},i=()=>gr(t()),a=o=>t().getElementById(o);return y(h({},e),{getRootNode:t,getDoc:n,getWin:r,getActiveElement:i,isActiveElement:bs,getById:a})}function ST(){if(typeof globalThis!="undefined")return globalThis;if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof global!="undefined")return global}function wh(e,t){let n=ST();return n?(n[e]||(n[e]=t()),n[e]):t()}function Fs(e={}){return RT(e)}function Ps(e,t,n){let r=Kr.get(e);Es()&&!r&&console.warn("Please use proxy object");let i,a=[],o=r[3],s=!1,c=o(d=>{if(a.push(d),n){t(a.splice(0));return}i||(i=Promise.resolve().then(()=>{i=void 0,s&&t(a.splice(0))}))});return s=!0,()=>{s=!1,c()}}function kT(e){let t=Kr.get(e);Es()&&!t&&console.warn("Please use proxy object");let[n,r,i]=t;return i(n,r())}function Ss(e){var a,o;let t=(a=e().value)!=null?a:e().defaultValue;e().debug&&console.log(`[bindable > ${e().debug}] initial`,t);let n=(o=e().isEqual)!=null?o:Object.is,r=Fs({value:t}),i=()=>e().value!==void 0;return{initial:t,ref:r,get(){return i()?e().value:r.value},set(s){var d,u;let l=i()?e().value:r.value,c=Qe(s)?s(l):s;e().debug&&console.log(`[bindable > ${e().debug}] setValue`,{next:c,prev:l}),i()||(r.value=c),n(c,l)||(u=(d=e()).onChange)==null||u.call(d,c,l)},invoke(s,l){var c,d;(d=(c=e()).onChange)==null||d.call(c,s,l)},hash(s){var l,c,d;return(d=(c=(l=e()).hash)==null?void 0:c.call(l,s))!=null?d:String(s)}}}function NT(e){let t={current:e};return{get(n){return t.current[n]},set(n,r){t.current[n]=r}}}function Oh(e,t){if(!Da(e)||!Da(t))return t===void 0?e:t;let n=h({},e);for(let r of Object.keys(t)){let i=t[r],a=e[r];i!==void 0&&(Da(a)&&Da(i)?n[r]=Oh(a,i):n[r]=i)}return n}function LT(e){return new Proxy({},{get(t,n){return n==="style"?r=>e({style:r}).style:e}})}function HT(e,t,n){let r=n||"default",i=hs.get(e);i||(i=new Map,hs.set(e,i));let a=i.get(r)||{},o=Object.keys(t),s=(m,S)=>{e.addEventListener(m.toLowerCase(),S)},l=(m,S)=>{e.removeEventListener(m.toLowerCase(),S)},c=m=>m.startsWith("on"),d=m=>!m.startsWith("on"),u=m=>s(m.substring(2),t[m]),p=m=>l(m.substring(2),t[m]),g=m=>{let S=t[m],T=a[m];if(S!==T){if(m==="class"){e.className=S!=null?S:"";return}if(Gp.has(m)){e[m]=S!=null?S:"";return}if(typeof S=="boolean"&&!m.includes("aria-")){e.toggleAttribute(fs(e,m),S);return}if(m==="children"){e.innerHTML=S;return}if(S!=null){e.setAttribute(fs(e,m),S);return}e.removeAttribute(fs(e,m))}};for(let m in a)t[m]==null&&(m==="class"?e.className="":Gp.has(m)?e[m]="":e.removeAttribute(fs(e,m)));return Object.keys(a).filter(c).forEach(m=>{l(m.substring(2),a[m])}),o.filter(c).forEach(u),o.filter(d).forEach(g),i.set(r,t),function(){o.filter(c).forEach(p);let S=hs.get(e);S&&(S.delete(r),S.size===0&&hs.delete(e))}}var XS,V,Ie,U,O,Ye,_a,ZS,JS,Se,QS,Up,eI,dn,tI,jc,qp,Dt,en,nI,Tt,Ft,Yc,gt,Ts,tn,Rp,rI,Ce,cr,zp,jp,un,Cs,Ga,Qe,Yp,at,iI,Xp,aI,Da,oI,sI,lI,Fn,Jc,cI,Qc,Ct,Ua,ed,kp,Jp,ur,Qp,Np,eh,Fa,_c,PI,SI,$c,Fp,II,Hc,Mn,ws,Os,b,se,TI,CI,wI,Pe,Wa,OI,rh,ih,zr,ah,_t,AI,xI,Bc,rd,NI,oh,As,ad,uh,_I,od,$I,HI,Ka,za,$i,wt,BI,GI,fe,pr,Be,qI,WI,Mp,KI,zI,ae,mh,vh,JI,QI,eT,ks,Ya,ld,lT,cT,Di,qc,ms,gd,Un,pT,hT,fT,ft,mt,vs,IT,TT,CT,wT,Wc,_p,Es,v1,OT,$p,Kc,VT,AT,Hp,Kr,xT,RT,Y,Bp,DT,FT,MT,hs,Gp,_T,$T,fs,X,z,Li,BT,oe=ee(()=>{"use strict";XS=["ltr","rtl"];V=(e,t,n)=>{let r=e.dataset[t];if(r!==void 0&&(!n||n.includes(r)))return r},Ie=(e,t)=>{let n=e.dataset[t];if(typeof n=="string")return n.split(",").map(r=>r.trim()).filter(r=>r.length>0)},U=(e,t,n)=>{let r=e.dataset[t];if(r===void 0)return;let i=Number(r);if(!Number.isNaN(i))return n&&!n.includes(i)?0:i},O=(e,t)=>{let r=`data-${t.replace(/([A-Z])/g,"-$1").toLowerCase()}`;if(!e.hasAttribute(r))return!1;let i=e.getAttribute(r);return!(i==="false"||i==="0")},Ye=(e,t)=>{let n=e.dataset[t];return n==="true"?!0:n==="false"?!1:void 0};_a=(e,t="element")=>e!=null&&e.id?e.id:`${t}-${Math.random().toString(36).substring(2,9)}`;ZS=Object.defineProperty,JS=(e,t,n)=>t in e?ZS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Se=(e,t,n)=>JS(e,typeof t!="symbol"?t+"":t,n),QS=Object.defineProperty,Up=e=>{throw TypeError(e)},eI=(e,t,n)=>t in e?QS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dn=(e,t,n)=>eI(e,typeof t!="symbol"?t+"":t,n),tI=(e,t,n)=>t.has(e)||Up("Cannot "+n),jc=(e,t,n)=>(tI(e,t,"read from private field"),n?n.call(e):t.get(e)),qp=(e,t,n)=>t.has(e)?Up("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);Dt=e=>e[0],en=e=>e[e.length-1],nI=(e,t)=>e.indexOf(t)!==-1,Tt=(e,...t)=>e.concat(t),Ft=(e,...t)=>e.filter(n=>!t.includes(n)),Yc=(e,t)=>e.filter((n,r)=>r!==t),gt=e=>Array.from(new Set(e)),Ts=(e,t)=>{let n=new Set(t);return e.filter(r=>!n.has(r))},tn=(e,t)=>nI(e,t)?Ft(e,t):Tt(e,t);Rp=e=>(e==null?void 0:e.constructor.name)==="Array",rI=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n{if(Object.is(e,t))return!0;if(e==null&&t!=null||e!=null&&t==null)return!1;if(typeof(e==null?void 0:e.isEqual)=="function"&&typeof(t==null?void 0:t.isEqual)=="function")return e.isEqual(t);if(typeof e=="function"&&typeof t=="function")return e.toString()===t.toString();if(Rp(e)&&Rp(t))return rI(Array.from(e),Array.from(t));if(typeof e!="object"||typeof t!="object")return!1;let n=Object.keys(t!=null?t:Object.create(null)),r=n.length;for(let i=0;iArray.isArray(e),zp=e=>e===!0||e===!1,jp=e=>e!=null&&typeof e=="object",un=e=>jp(e)&&!cr(e),Cs=e=>typeof e=="number"&&!Number.isNaN(e),Ga=e=>typeof e=="string",Qe=e=>typeof e=="function",Yp=e=>e==null,at=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),iI=e=>Object.prototype.toString.call(e),Xp=Function.prototype.toString,aI=Xp.call(Object),Da=e=>{if(!jp(e)||iI(e)!="[object Object]"||lI(e))return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let n=at(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Xp.call(n)==aI},oI=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,sI=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,lI=e=>oI(e)||sI(e),Fn=(e,...t)=>{let n=typeof e=="function"?e(...t):e;return n!=null?n:void 0},Jc=e=>e,cI=e=>e(),Qc=()=>{},Ct=(...e)=>(...t)=>{e.forEach(function(n){n==null||n(...t)})},Ua=(()=>{let e=0;return()=>(e++,e.toString(36))})();ed=(e,t)=>{var n;try{return e()}catch(r){return r instanceof Error&&((n=Error.captureStackTrace)==null||n.call(Error,r,ed)),t==null?void 0:t()}};kp=e=>String.fromCharCode(e+(e>25?39:97));Jp=e=>dI(uI(5381,e)>>>0);ur=".",Qp="#",Np=new WeakMap,eh=new WeakMap;Fa=(e=>(e.NotStarted="Not Started",e.Started="Started",e.Stopped="Stopped",e))(Fa||{}),_c="__init__",PI=Object.defineProperty,SI=(e,t,n)=>t in e?PI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$c=(e,t,n)=>SI(e,typeof t!="symbol"?t+"":t,n);Fp=e=>Math.max(0,Math.min(1,e)),II=(e,t)=>e.map((n,r)=>e[(Math.max(t,0)+r)%e.length]),Hc=(...e)=>t=>e.reduce((n,r)=>r(n),t),Mn=()=>{},ws=e=>typeof e=="object"&&e!==null,Os=2147483647,b=e=>e?"":void 0,se=e=>e?"true":void 0,TI=1,CI=9,wI=11,Pe=e=>ws(e)&&e.nodeType===TI&&typeof e.nodeName=="string",Wa=e=>ws(e)&&e.nodeType===CI,OI=e=>ws(e)&&e===e.window,rh=e=>Pe(e)?e.localName||"":"#document";ih=e=>ws(e)&&e.nodeType!==void 0,zr=e=>ih(e)&&e.nodeType===wI&&"host"in e,ah=e=>Pe(e)&&e.localName==="input",_t=e=>!!(e!=null&&e.matches("a[href]")),AI=e=>Pe(e)?e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0:!1;xI=/(textarea|select)/;Bc=new WeakMap;rd=new Set(["menu","listbox","dialog","grid","tree","region"]),NI=e=>rd.has(e),oh=e=>{var t;return((t=e.getAttribute("aria-controls"))==null?void 0:t.split(" "))||[]};As=()=>typeof document!="undefined";ad=e=>As()&&e.test(FI()),uh=e=>As()&&e.test(MI()),_I=e=>As()&&e.test(navigator.vendor),od=()=>As()&&!!navigator.maxTouchPoints,$I=()=>ad(/^iPhone/i),HI=()=>ad(/^iPad/i)||$i()&&navigator.maxTouchPoints>1,Ka=()=>$I()||HI(),za=()=>$i()||Ka(),$i=()=>ad(/^Mac/i),wt=()=>za()&&_I(/apple/i),BI=()=>uh(/Firefox/i),GI=()=>uh(/Android/i);fe=e=>e.button===0,pr=e=>e.button===2||$i()&&e.ctrlKey&&e.button===0,Be=e=>e.ctrlKey||e.altKey||e.metaKey,qI=e=>"touches"in e&&e.touches.length>0,WI={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},Mp={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};KI=new Set(["PageUp","PageDown"]),zI=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);ae=(e,t,n,r)=>{let i=typeof e=="function"?e():e;return i==null||i.addEventListener(t,n,r),()=>{i==null||i.removeEventListener(t,n,r)}};mh=Symbol.for("zag.changeEvent");vh=e=>Pe(e)&&e.tagName==="IFRAME",JI=/^(audio|video|details)$/;QI=e=>!Number.isNaN(yh(e)),eT=e=>yh(e)<0;ks="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type",Ya=(e,t={})=>{if(!e)return[];let{includeContainer:n=!1,getShadowRoot:r}=t,i=Array.from(e.querySelectorAll(ks));(n==!0||n=="if-empty"&&i.length===0)&&Pe(e)&&ut(e)&&i.unshift(e);let o=[];for(let s of i)if(ut(s)){if(vh(s)&&s.contentDocument){let l=s.contentDocument.body;o.push(...Ya(l,{getShadowRoot:r}));continue}o.push(s)}return r?bh(o,r,ut):o};ld=class Eh{constructor(){$c(this,"id",null),$c(this,"fn_cleanup"),$c(this,"cleanup",()=>{this.cancel()})}static create(){return new Eh}request(t){this.cancel(),this.id=globalThis.requestAnimationFrame(()=>{this.id=null,this.fn_cleanup=t==null?void 0:t()})}cancel(){var t;this.id!==null&&(globalThis.cancelAnimationFrame(this.id),this.id=null),(t=this.fn_cleanup)==null||t.call(this),this.fn_cleanup=void 0}isActive(){return this.id!==null}};lT=/auto|scroll|overlay|hidden|clip/,cT=new Set(["inline","contents"]);Di="default",qc="",ms=new WeakMap;gd=e=>e.id;Un=gT({box:"border-box"});pT=e=>e.split("").map(t=>{let n=t.charCodeAt(0);return n>0&&n<128?t:n>=128&&n<=255?`/x${n.toString(16)}`.replace("/","\\"):""}).join("").trim(),hT=e=>{var t,n,r;return pT((r=(n=(t=e.dataset)==null?void 0:t.valuetext)!=null?n:e.textContent)!=null?r:"")},fT=(e,t)=>e.trim().toLowerCase().startsWith(t.toLowerCase());ft=Object.assign(yT,{defaultOptions:{keysSoFar:"",timer:-1},isValidEvent:bT});mt={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"};vs=wh("__zag__refSet",()=>new WeakSet),IT=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,TT=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,CT=e=>typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeName=="string",wT=e=>IT(e)||TT(e)||CT(e),Wc=e=>e!==null&&typeof e=="object",_p=e=>Wc(e)&&!vs.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!wT(e)&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer)&&!(e instanceof Promise)&&!(e instanceof File)&&!(e instanceof Blob)&&!(e instanceof AbortController),Es=()=>!0,v1=Symbol(),OT=Symbol(),$p=Object.getPrototypeOf,Kc=new WeakMap,VT=e=>e&&(Kc.has(e)?Kc.get(e):$p(e)===Object.prototype||$p(e)===Array.prototype),AT=e=>VT(e)&&e[OT]||null,Hp=(e,t=!0)=>{Kc.set(e,t)},Kr=wh("__zag__proxyStateMap",()=>new WeakMap),xT=(e=Object.is,t=(s,l)=>new Proxy(s,l),n=new WeakMap,r=(s,l)=>{let c=n.get(s);if((c==null?void 0:c[0])===l)return c[1];let d=Array.isArray(s)?[]:Object.create(Object.getPrototypeOf(s));return Hp(d,!0),n.set(s,[l,d]),Reflect.ownKeys(s).forEach(u=>{let p=Reflect.get(s,u);vs.has(p)?(Hp(p,!1),d[u]=p):Kr.has(p)?d[u]=kT(p):d[u]=p}),Object.freeze(d)},i=new WeakMap,a=[1,1],o=s=>{if(!Wc(s))throw new Error("object required");let l=i.get(s);if(l)return l;let c=a[0],d=new Set,u=(R,x=++a[0])=>{c!==x&&(c=x,d.forEach(C=>C(R,x)))},p=a[1],g=(R=++a[1])=>(p!==R&&!d.size&&(p=R,m.forEach(([x])=>{let C=x[1](R);C>c&&(c=C)})),c),f=R=>(x,C)=>{let A=[...x];A[1]=[R,...A[1]],u(A,C)},m=new Map,S=(R,x)=>{if(Es()&&m.has(R))throw new Error("prop listener already exists");if(d.size){let C=x[3](f(R));m.set(R,[x,C])}else m.set(R,[x])},T=R=>{var C;let x=m.get(R);x&&(m.delete(R),(C=x[1])==null||C.call(x))},w=R=>(d.add(R),d.size===1&&m.forEach(([C,A],N)=>{if(Es()&&A)throw new Error("remove already exists");let k=C[3](f(N));m.set(N,[C,k])}),()=>{d.delete(R),d.size===0&&m.forEach(([C,A],N)=>{A&&(A(),m.set(N,[C]))})}),I=Array.isArray(s)?[]:Object.create(Object.getPrototypeOf(s)),v=t(I,{deleteProperty(R,x){let C=Reflect.get(R,x);T(x);let A=Reflect.deleteProperty(R,x);return A&&u(["delete",[x],C]),A},set(R,x,C,A){var K;let N=Reflect.has(R,x),k=Reflect.get(R,x,A);if(N&&(e(k,C)||i.has(C)&&e(k,i.get(C))))return!0;T(x),Wc(C)&&(C=AT(C)||C);let L=C;if(!((K=Object.getOwnPropertyDescriptor(R,x))!=null&&K.set)){!Kr.has(C)&&_p(C)&&(L=Fs(C));let J=!vs.has(L)&&Kr.get(L);J&&S(x,J)}return Reflect.set(R,x,L,A),u(["set",[x],C,k]),!0}});i.set(s,v);let E=[I,g,r,w];return Kr.set(v,E),Reflect.ownKeys(s).forEach(R=>{let x=Object.getOwnPropertyDescriptor(s,R);x.get||x.set?Object.defineProperty(I,R,x):v[R]=s[R]}),v})=>[o,Kr,vs,e,t,_p,n,r,i,a],[RT]=xT();Ss.cleanup=e=>{};Ss.ref=e=>{let t=e;return{get:()=>t,set:n=>{t=n}}};Y=class{constructor(e,t={}){var u,p,g;Se(this,"machine",e),Se(this,"scope"),Se(this,"context"),Se(this,"prop"),Se(this,"state"),Se(this,"refs"),Se(this,"computed"),Se(this,"event",{type:""}),Se(this,"previousEvent",{type:""}),Se(this,"effects",new Map),Se(this,"transition",null),Se(this,"cleanups",[]),Se(this,"subscriptions",[]),Se(this,"userPropsRef"),Se(this,"getEvent",()=>y(h({},this.event),{current:()=>this.event,previous:()=>this.previousEvent})),Se(this,"getState",()=>y(h({},this.state),{matches:(...f)=>f.some(m=>bI(this.state.get(),m)),hasTag:f=>EI(this.machine,this.state.get(),f)})),Se(this,"debug",(...f)=>{this.machine.debug&&console.log(...f)}),Se(this,"notify",()=>{this.publish()}),Se(this,"send",f=>{this.status===Fa.Started&&queueMicrotask(()=>{var E;if(!f)return;this.previousEvent=this.event,this.event=f,this.debug("send",f);let m=this.state.get(),S=f.type,{transitions:T,source:w}=vI(this.machine,m,S),I=this.choose(T);if(!I)return;this.transition=I;let P=Dp(this.machine,(E=I.target)!=null?E:m,w);this.debug("transition",I),P!==m?this.state.set(P):I.reenter?this.state.invoke(m,m):this.action(I.actions)})}),Se(this,"action",f=>{let m=Qe(f)?f(this.getParams()):f;if(!m)return;let S=m.map(T=>{var I,P;let w=(P=(I=this.machine.implementations)==null?void 0:I.actions)==null?void 0:P[T];return w||It(`[zag-js] No implementation found for action "${JSON.stringify(T)}"`),w});for(let T of S)T==null||T(this.getParams())}),Se(this,"guard",f=>{var m,S;return Qe(f)?f(this.getParams()):(S=(m=this.machine.implementations)==null?void 0:m.guards)==null?void 0:S[f](this.getParams())}),Se(this,"effect",f=>{let m=Qe(f)?f(this.getParams()):f;if(!m)return;let S=m.map(w=>{var P,v;let I=(v=(P=this.machine.implementations)==null?void 0:P.effects)==null?void 0:v[w];return I||It(`[zag-js] No implementation found for effect "${JSON.stringify(w)}"`),I}),T=[];for(let w of S){let I=w==null?void 0:w(this.getParams());I&&T.push(I)}return()=>T.forEach(w=>w==null?void 0:w())}),Se(this,"choose",f=>$a(f).find(m=>{let S=!m.guard;return Ga(m.guard)?S=!!this.guard(m.guard):Qe(m.guard)&&(S=m.guard(this.getParams())),S})),Se(this,"subscribe",f=>(this.subscriptions.push(f),()=>{let m=this.subscriptions.indexOf(f);m>-1&&this.subscriptions.splice(m,1)})),Se(this,"status",Fa.NotStarted),Se(this,"publish",()=>{this.callTrackers(),this.subscriptions.forEach(f=>f(this.service))}),Se(this,"trackers",[]),Se(this,"setupTrackers",()=>{var f,m;(m=(f=this.machine).watch)==null||m.call(f,this.getParams())}),Se(this,"callTrackers",()=>{this.trackers.forEach(({deps:f,fn:m})=>{let S=f.map(T=>T());Ce(m.prev,S)||(m(),m.prev=S)})}),Se(this,"getParams",()=>({state:this.getState(),context:this.context,event:this.getEvent(),prop:this.prop,send:this.send,action:this.action,guard:this.guard,track:(f,m)=>{m.prev=f.map(S=>S()),this.trackers.push({deps:f,fn:m})},refs:this.refs,computed:this.computed,flush:cI,scope:this.scope,choose:this.choose})),this.userPropsRef={current:t};let{id:n,ids:r,getRootNode:i}=Fn(t);this.scope=PT({id:n,ids:r,getRootNode:i});let a=f=>{var T,w;let m=Fn(this.userPropsRef.current);return((w=(T=e.props)==null?void 0:T.call(e,{props:_n(m),scope:this.scope}))!=null?w:m)[f]};this.prop=a;let o=(u=e.context)==null?void 0:u.call(e,{prop:a,bindable:Ss,scope:this.scope,flush(f){queueMicrotask(f)},getContext(){return s},getComputed(){return l},getRefs(){return c},getEvent:this.getEvent.bind(this)});o&&Object.values(o).forEach(f=>{let m=Ps(f.ref,()=>this.notify());this.cleanups.push(m)});let s={get(f){return o==null?void 0:o[f].get()},set(f,m){o==null||o[f].set(m)},initial(f){return o==null?void 0:o[f].initial},hash(f){let m=o==null?void 0:o[f].get();return o==null?void 0:o[f].hash(m)}};this.context=s;let l=f=>(nn(e.computed,()=>"[zag-js] No computed object found on machine"),e.computed[f]({context:s,event:this.getEvent(),prop:a,refs:this.refs,scope:this.scope,computed:l}));this.computed=l;let c=NT((g=(p=e.refs)==null?void 0:p.call(e,{prop:a,context:s}))!=null?g:{});this.refs=c;let d=Ss(()=>({defaultValue:Dp(e,e.initialState({prop:a})),onChange:(f,m)=>{var w,I;let{exiting:S,entering:T}=yI(this.machine,m,f,(w=this.transition)==null?void 0:w.reenter);if(S.forEach(P=>{let v=this.effects.get(P.path);v==null||v(),this.effects.delete(P.path)}),S.forEach(P=>{var v;this.action((v=P.state)==null?void 0:v.exit)}),this.action((I=this.transition)==null?void 0:I.actions),T.forEach(P=>{var E;let v=this.effect((E=P.state)==null?void 0:E.effects);v&&this.effects.set(P.path,v)}),m===_c){this.action(e.entry);let P=this.effect(e.effects);P&&this.effects.set(_c,P)}T.forEach(P=>{var v;this.action((v=P.state)==null?void 0:v.entry)})}}));this.state=d,this.cleanups.push(Ps(this.state.ref,()=>this.notify()))}updateProps(e){let t=this.userPropsRef.current;this.userPropsRef.current=()=>{let n=Fn(t),r=Fn(e);return Oh(n,r)},this.notify()}start(){this.status=Fa.Started,this.debug("initializing..."),this.state.invoke(this.state.initial,_c),this.setupTrackers()}stop(){this.effects.forEach(e=>e==null?void 0:e()),this.effects.clear(),this.transition=null,this.action(this.machine.exit),this.cleanups.forEach(e=>e()),this.cleanups=[],this.subscriptions=[],this.status=Fa.Stopped,this.debug("unmounting...")}get service(){return{state:this.getState(),send:this.send,context:this.context,prop:this.prop,scope:this.scope,refs:this.refs,computed:this.computed,event:this.getEvent(),getStatus:()=>this.status}}};Bp={onFocus:"onFocusin",onBlur:"onFocusout",onChange:"onInput",onDoubleClick:"onDblclick",htmlFor:"for",className:"class",defaultValue:"value",defaultChecked:"checked"},DT=new Set(["viewBox","preserveAspectRatio"]),FT=e=>{let t="";for(let n in e){let r=e[n];r!=null&&(n.startsWith("--")||(n=n.replace(/[A-Z]/g,i=>`-${i.toLowerCase()}`)),t+=`${n}:${r};`)}return t},MT=LT(e=>Object.entries(e).reduce((t,[n,r])=>{if(r===void 0)return t;if(n in Bp&&(n=Bp[n]),n==="style"&&typeof r=="object")return t.style=FT(r),t;let i=DT.has(n)?n:n.toLowerCase();return t[i]=r,t},{})),hs=new WeakMap,Gp=new Set(["value","checked","selected"]),_T=new Set(["viewBox","preserveAspectRatio","clipPath","clipRule","fillRule","strokeWidth","strokeLinecap","strokeLinejoin","strokeDasharray","strokeDashoffset","strokeMiterlimit"]),$T=e=>e.tagName==="svg"||e.namespaceURI==="http://www.w3.org/2000/svg",fs=(e,t)=>$T(e)&&_T.has(t)?t:t.toLowerCase();X=class{constructor(e,t,n){Q(this,"el");Q(this,"doc");Q(this,"machine");Q(this,"api");Q(this,"init",()=>{try{this.machine.start(),this.render()}finally{this.el.removeAttribute("data-loading")}this.machine.subscribe(()=>{this.api=this.initApi(),this.render()})});Q(this,"destroy",()=>{this.el.removeAttribute("data-loading"),this.machine.stop()});Q(this,"spreadProps",(e,t)=>{HT(e,t,this.machine.scope.id)});if(!e)throw new Error("Root element not found");this.el=e,this.doc=document,n==null||n(this),this.machine=this.initMachine(t),this.api=this.initApi()}updateProps(e){this.machine.updateProps(e)}zagConnect(e){return e(this.machine.service,MT)}},z=(e,t=[])=>({parts:(...n)=>{if(BT(t))return z(e,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>z(e,[...t,...n]),omit:(...n)=>z(e,t.filter(r=>!n.includes(r))),rename:n=>z(n,t),keys:()=>t,build:()=>[...new Set(t)].reduce((n,r)=>Object.assign(n,{[r]:{selector:[`&[data-scope="${Li(e)}"][data-part="${Li(r)}"]`,`& [data-scope="${Li(e)}"][data-part="${Li(r)}"]`].join(", "),attrs:{"data-scope":Li(e),"data-part":Li(r)}}}),{})}),Li=e=>e.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),BT=e=>e.length===0});function fd(e,t,n){let r=e.getAttribute(t);if(r===null)throw new Error(`[corex] missing ${n} on #${e.id}`);return r}function yr(e,t,n){let r=fd(e,t,n),i=parseFloat(r);if(Number.isNaN(i))throw new Error(`[corex] invalid ${n} on #${e.id}`);return i}function md(e){return{duration:yr(e,"data-anim-height-duration","data-anim-height-duration"),easing:fd(e,"data-anim-height-easing","data-anim-height-easing"),opacityStart:yr(e,"data-anim-height-opacity-start","data-anim-height-opacity-start"),opacityEnd:yr(e,"data-anim-height-opacity-end","data-anim-height-opacity-end"),blockInteraction:Ye(e,"animHeightBlockInteraction")!==!1}}function vd(e){return{duration:yr(e,"data-anim-scale-duration","data-anim-scale-duration"),easing:fd(e,"data-anim-scale-easing","data-anim-scale-easing"),opacityStart:yr(e,"data-anim-scale-opacity-start","data-anim-scale-opacity-start"),opacityEnd:yr(e,"data-anim-scale-opacity-end","data-anim-scale-opacity-end"),scaleStart:yr(e,"data-anim-transform-scale-start","data-anim-transform-scale-start"),scaleEnd:yr(e,"data-anim-transform-scale-end","data-anim-transform-scale-end"),blockInteraction:Ye(e,"animScaleBlockInteraction")!==!1}}function Vh(e){var n;let t=((n=Qa.get(e))!=null?n:0)+1;Qa.set(e,t),t===1&&(e.style.pointerEvents="none")}function Ah(e){var n;let t=((n=Qa.get(e))!=null?n:0)-1;t<=0?(Qa.delete(e),e.style.removeProperty("pointer-events")):Qa.set(e,t)}function GT(e,t,n){let r=e.dataset.part==="backdrop",i=(n==null?void 0:n.scale)!==!1&&!r&&(t.scaleStart!==t.scaleEnd||t.scaleStart!==1||t.scaleEnd!==1);e.style.opacity=String(t.opacityStart),i?e.style.transform=`scale(${t.scaleStart})`:e.style.removeProperty("transform")}function UT(e,t){e.style.opacity=String(t.opacityStart),e.style.height="0px",e.style.overflow="hidden",e.style.removeProperty("transform")}function Zr(e){let t=h({},e);return delete t.hidden,t}function xh(e){e.style.opacity="",e.style.height="",e.style.overflow="",e.style.removeProperty("transform")}function qT(e,t,n){e.querySelectorAll(t).forEach(r=>{r.dataset.state==="open"?xh(r):UT(r,n)})}function WT(e,t,n,r){e.querySelectorAll(t).forEach(i=>{i.dataset.state==="open"?xh(i):GT(i,n,r==null?void 0:r(i))})}function Rh(e){let{rootEl:t,selector:n,opts:r,isOpen:i,wasOpen:a}=e,o=r.blockInteraction?t:void 0;t.querySelectorAll(n).forEach(s=>{let l=a?a(s):s.dataset.state==="open",c=i(s);l!==c&&KT(s,c,r,o)})}function Vt(e){return e.dataset.animation==="js"}function hd(e,t){return!!e&&t.includes(e)}function yd(e){return e.dataset.value}function kh(e){return t=>{var n;return(n=t.closest(e))==null?void 0:n.dataset.value}}function eo(e){let{el:t,selector:n,prevOpen:r,nextOpen:i,resolveValue:a}=e;Vt(t)&&Rh({rootEl:t,selector:n,opts:md(t),wasOpen:o=>hd(a(o),r),isOpen:o=>hd(a(o),i)})}function Nh(e){let{el:t,selector:n,openValues:r,resolveValue:i}=e;Vt(t)&&Rh({rootEl:t,selector:n,opts:md(t),isOpen:a=>hd(i(a),r)})}function Ms(e,t){Vt(e)&&qT(e,t,md(e))}function Lh(e,t,n){Vt(e)&&WT(e,t,vd(e),n)}function KT(e,t,n,r){e.getAnimations().forEach(p=>p.cancel());let i=t?n.opacityStart:n.opacityEnd,a=t?n.opacityEnd:n.opacityStart;e.style.overflow="hidden",e.style.height="auto";let o=`${e.scrollHeight}px`;e.style.height=t?"0px":o;let s={opacity:i,height:t?"0px":o},l={opacity:a,height:t?o:"0px"};r&&n.blockInteraction&&Vh(r);let c=e.animate([s,l],{duration:n.duration*1e3,easing:n.easing,fill:"forwards"}),d=!1,u=()=>{d||(d=!0,c.cancel(),r&&n.blockInteraction&&Ah(r),t?(e.style.height="auto",e.style.opacity="",e.style.overflow=""):(e.style.height="0px",e.style.opacity=String(n.opacityStart),e.style.overflow="hidden"))};return c.onfinish=()=>{u()},c.oncancel=()=>{u()},c}function bd(e,t,n,r){e.getAnimations().forEach(m=>m.cancel());let i=e.dataset.part==="backdrop",a=!i&&(n.scaleStart!==n.scaleEnd||n.scaleStart!==1||n.scaleEnd!==1),o=t?n.opacityStart:n.opacityEnd,s=t?n.opacityEnd:n.opacityStart,l=t?n.scaleStart:n.scaleEnd,c=t?n.scaleEnd:n.scaleStart,d={opacity:o},u={opacity:s};a&&(d.transform=`scale(${l})`,u.transform=`scale(${c})`),r&&n.blockInteraction&&Vh(r);let p=e.animate([d,u],{duration:n.duration*1e3,easing:n.easing,fill:"forwards"}),g=!1,f=()=>{g||(g=!0,p.cancel(),r&&n.blockInteraction&&Ah(r),t?(e.style.opacity="",e.style.removeProperty("transform")):(e.style.opacity=String(n.opacityStart),i?e.style.removeProperty("transform"):a?e.style.transform=`scale(${n.scaleStart})`:e.style.removeProperty("transform")))};return p.onfinish=()=>{f()},p.oncancel=()=>{f()},p}var Qa,_s=ee(()=>{"use strict";oe();Qa=new WeakMap});function jT(e){var n;if(!Number.isFinite(e)||e===Math.trunc(e))return null;let t=(n=e.toString().split(".")[1])==null?void 0:n.replace(/0+$/,"");return t?Math.min(t.length,zT):null}function Dh(e){let t=jT(e);return t===null?{useGrouping:!0}:{maximumFractionDigits:t,minimumFractionDigits:0,useGrouping:!0}}function $s(e){return Dh(e)}function YT(e){return y(h({},Dh(e)),{useGrouping:!1})}function no(e,t){if(e==null)return"";let n=String(e).trim();if(n==="")return"";let r=typeof e=="number"?e:Number(n.replace(/,/g,""));return Number.isNaN(r)?n.replace(/,/g,""):new Intl.NumberFormat("en-US",YT(t)).format(r)}function Jr(e,t){if(e==null)return"";let n=String(e).trim();if(n==="")return"";let r=typeof e=="number"?e:Number(n.replace(/,/g,""));return Number.isNaN(r)?n:new Intl.NumberFormat("en-US",$s(t)).format(r)}function Hs(e,t,n){return io(e,t,n)}function Fh(e,t,n){return ro(e)?{value:to(V(e,t))}:{}}function Ki(e,t){let n=e.dataset[t];if(n===void 0)return;if(!n||n.trim()==="")return[];let r=n.trim();if(r.startsWith("["))try{let i=JSON.parse(r);return Array.isArray(i)&&i.every(a=>typeof a=="string")?i:[]}catch(i){return[]}}function Mh(e,t="defaultPaths"){if(!O(e,"formField"))return;let n=Ki(e,t);if(n!==void 0)return n;let r=e.dataset[t];return r?r.split(` +`).map(i=>i.trim()).filter(Boolean):[]}function Bs(e,t,n){return O(e,"controlled")?{open:O(e,t)}:{}}function ro(e){return O(e,"controlled")||O(e,"formField")}function Wi(e,t){var n,r;return(r=(n=Ki(e,t))!=null?n:Ie(e,t))!=null?r:[]}function qn(e){return ro(e)?{value:Wi(e,"value")}:{}}function hn(e){return O(e,"formField")?{defaultValue:Wi(e,"value")}:O(e,"controlled")?{value:Wi(e,"value")}:{defaultValue:Wi(e,"defaultValue")}}function br(e,t){if(!ro(e))return{};let n=V(e,"value");return O(e,"formField")&&n===t?{}:{value:to(n)}}function io(e,t,n){return O(e,"formField")?{defaultValue:to(V(e,t))}:O(e,"controlled")?{value:to(V(e,t))}:{defaultValue:to(V(e,n))}}function XT(e){return O(e,"controlled")||O(e,"formField")}function Gs(e){return XT(e)?{checked:Ma(e,"checked")}:{}}function Us(e){return O(e,"formField")?{defaultChecked:Ma(e,"checked")}:O(e,"controlled")?{checked:Ma(e,"checked")}:{defaultChecked:Ma(e,"defaultChecked")}}function Ed(e,t){let n=t==="tags"?e.dataset.tags:e.dataset.defaultTags;if(!n||n.trim()==="")return[];try{let r=JSON.parse(n);return Array.isArray(r)&&r.every(i=>typeof i=="string")?r:[]}catch(r){return[]}}function _h(e){return ro(e)?{value:Ed(e,"tags")}:{}}function $h(e){return ro(e)?{value:Ed(e,"tags")}:{defaultValue:Ed(e,"defaultTags")}}function Hh(e){var t;return(t=U(e,"step"))!=null?t:1}function qs(e,t){let n=Hh(e),r={step:n};if(O(e,"controlled")){let i=V(e,"value");return i===void 0||i===""?r:y(h({},r),{value:Jr(i,n),nextServerValue:i})}if(O(e,"formField")){let i=V(e,"value");return i===void 0||i===""||i===t?r:y(h({},r),{value:Jr(i,n),nextServerValue:i})}return r}function Ws(e){let t=Hh(e);if(O(e,"controlled")){let i=V(e,"value");return{value:i!==void 0&&i!==""?Jr(i,t):void 0,step:t}}if(O(e,"formField")){let i=V(e,"value");return{defaultValue:i!==void 0&&i!==""?Jr(i,t):void 0,step:t}}let n=V(e,"defaultValue");return{defaultValue:n!==void 0&&n!==""?Jr(n,t):void 0,step:t}}function Ks(e,t,n){return qn(e)}function Bh(e){return O(e,"controlled")?{pressed:O(e,"pressed")}:{}}function Gh(e){return O(e,"controlled")?{edit:O(e,"edit")}:{}}function zs(e,t,n){return O(e,"controlled")?{open:O(e,t)}:{defaultOpen:O(e,n)}}function Pd(e,t,n){return O(e,"controlled")?O(e,t):O(e,n)}function js(e,t,n){return hn(e)}function Uh(e,t,n){var r;return(r=O(e,"controlled")?Ie(e,t):Ie(e,n))!=null?r:[]}var zT,to,$e=ee(()=>{"use strict";oe();zT=10;to=e=>e===void 0?null:e});function re(e){let t=[];return{add(n,r){t.push(e.handleEvent(n,r))},teardown(){for(let n of t)e.removeHandleEvent(n);t.length=0}}}function ie(e){let t=[];return{add(n,r){let i=r;e.addEventListener(n,i),t.push({eventName:n,listener:i})},teardown(){for(let{eventName:n,listener:r}of t)e.removeEventListener(n,r);t.length=0}}}var Ve=ee(()=>{"use strict"});function zi(e,t){return{id:e.id,checked:t.checked}}function de(e){var t,n,r;if(e&&typeof e=="object"){let i=e,a=(r=(n=(t=i.respond_to)!=null?t:i.respondTo)!=null?n:typeof i.respond_to=="string"?i.respond_to:void 0)!=null?r:typeof i.respondTo=="string"?i.respondTo:void 0;if(a==="server"||a==="client"||a==="both")return a}return"server"}function $(e,t){return t==null||t===""?!0:e===t}function Ys(e){var r;if(!e||typeof e!="object")return;let t=e,n=(r=t.checked)!=null?r:t.checked;if(n===!0||n==="true"||n===1)return!0;if(n===!1||n==="false"||n===0)return!1}function qh(e){var r;if(!e||typeof e!="object")return;let t=e,n=(r=t.pressed)!=null?r:t.pressed;if(n===!0||n==="true"||n===1)return!0;if(n===!1||n==="false"||n===0)return!1}function Wh(e){var r;if(!e||typeof e!="object")return;let t=e,n=(r=t.value)!=null?r:t.value;if(Array.isArray(n)&&n.every(i=>typeof i=="string"))return n}function Kh(e){var r;if(!e||typeof e!="object")return;let t=e,n=(r=t.visible)!=null?r:t.visible;if(n===!0||n==="true"||n===1)return!0;if(n===!1||n==="false"||n===0)return!1}function H(e){if(!e||typeof e!="object")return;let t=e,n;for(let r of Object.keys(t)){let i=t[r];if(!(typeof i!="string"||i==="")){if(r==="id"||r==="Id")n=i;else if(r.includes("_id")||r.length>2&&r.endsWith("Id"))return i}}return n}function ao(e){var r;if(!e||typeof e!="object")return"";let t=e,n=(r=t.value)!=null?r:t.value;return n==null?"":String(n)}function W(e){let{el:t,canPushServer:n,pushEvent:r,payload:i,serverEventName:a,clientEventName:o}=e;a&&n&&r(a,h({},i)),o&&t.dispatchEvent(new CustomEvent(o,{bubbles:!0,detail:i}))}function ji(e,t){return n=>{let r=t.getValue(),i={id:e.el.id,value:r};Ge({respondTo:n,canPushServer:e.canPushServer(),pushEvent:e.pushEvent,serverEventName:t.serverEventName,serverPayload:i,el:e.el,domEventName:t.domEventName,domDetail:i})}}function Ge(e){let{respondTo:t,canPushServer:n,pushEvent:r,serverEventName:i,serverPayload:a,el:o,domEventName:s,domDetail:l}=e;t!=="client"&&n&&r(i,a),t!=="server"&&o.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:l}))}var be=ee(()=>{"use strict"});var Yh={};pe(Yh,{Accordion:()=>dC,readAccordionLayoutProps:()=>jh});function iC(e,t){let{send:n,context:r,prop:i,scope:a,computed:o}=e,s=r.get("focusedValue"),l=r.get("value"),c=i("multiple");function d(p){let g=p;!c&&g.length>1&&(g=[g[0]]),n({type:"VALUE.SET",value:g})}function u(p){var g;return{expanded:l.includes(p.value),focused:s===p.value,disabled:!!((g=p.disabled)!=null?g:i("disabled"))}}return{focusedValue:s,value:l,setValue:d,getItemState:u,getRootProps(){return t.element(y(h({},oo.root.attrs),{dir:i("dir"),id:Xs(a),"data-orientation":i("orientation")}))},getItemProps(p){let g=u(p);return t.element(y(h({},oo.item.attrs),{dir:i("dir"),id:JT(a,p.value),"data-state":g.expanded?"open":"closed","data-focus":b(g.focused),"data-disabled":b(g.disabled),"data-orientation":i("orientation")}))},getItemContentProps(p){let g=u(p);return t.element(y(h({},oo.itemContent.attrs),{dir:i("dir"),role:"region",id:Sd(a,p.value),"aria-labelledby":Zs(a,p.value),hidden:!g.expanded,"data-state":g.expanded?"open":"closed","data-disabled":b(g.disabled),"data-focus":b(g.focused),"data-orientation":i("orientation")}))},getItemIndicatorProps(p){let g=u(p);return t.element(y(h({},oo.itemIndicator.attrs),{dir:i("dir"),"aria-hidden":!0,"data-state":g.expanded?"open":"closed","data-disabled":b(g.disabled),"data-focus":b(g.focused),"data-orientation":i("orientation")}))},getItemTriggerProps(p){let{value:g}=p,f=u(p);return t.button(y(h({},oo.itemTrigger.attrs),{type:"button",dir:i("dir"),id:Zs(a,g),"aria-controls":Sd(a,g),"data-controls":Sd(a,g),"aria-expanded":f.expanded,disabled:f.disabled,"data-orientation":i("orientation"),"aria-disabled":f.disabled,"data-state":f.expanded?"open":"closed","data-focus":b(f.focused),"data-ownedby":Xs(a),onFocus(){f.disabled||n({type:"TRIGGER.FOCUS",value:g})},onBlur(){f.disabled||n({type:"TRIGGER.BLUR"})},onClick(m){f.disabled||(wt()&&m.currentTarget.focus(),n({type:"TRIGGER.CLICK",value:g}))},onKeyDown(m){if(m.defaultPrevented||f.disabled)return;let S={ArrowDown(){o("isHorizontal")||n({type:"GOTO.NEXT",value:g})},ArrowUp(){o("isHorizontal")||n({type:"GOTO.PREV",value:g})},ArrowRight(){o("isHorizontal")&&n({type:"GOTO.NEXT",value:g})},ArrowLeft(){o("isHorizontal")&&n({type:"GOTO.PREV",value:g})},Home(){n({type:"GOTO.FIRST",value:g})},End(){n({type:"GOTO.LAST",value:g})}},T=me(m,{dir:i("dir"),orientation:i("orientation")}),w=S[T];w&&(w(m),m.preventDefault())}}))}}}function jh(e){return{id:e.id,collapsible:O(e,"collapsible"),multiple:O(e,"multiple"),orientation:V(e,"orientation"),dir:q(e)}}var ZT,oo,Xs,JT,Sd,Zs,QT,Js,eC,tC,nC,rC,aC,oC,sC,lC,Id,cC,zh,dC,Xh=ee(()=>{"use strict";Mc();_s();$e();Ve();be();oe();ZT=z("accordion").parts("root","item","itemTrigger","itemContent","itemIndicator"),oo=ZT.build(),Xs=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`accordion:${e.id}`},JT=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.item)==null?void 0:r.call(n,t))!=null?i:`accordion:${e.id}:item:${t}`},Sd=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemContent)==null?void 0:r.call(n,t))!=null?i:`accordion:${e.id}:content:${t}`},Zs=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemTrigger)==null?void 0:r.call(n,t))!=null?i:`accordion:${e.id}:trigger:${t}`},QT=e=>e.getById(Xs(e)),Js=e=>{let n=`[data-controls][data-ownedby='${CSS.escape(Xs(e))}']:not([disabled])`;return Oe(QT(e),n)},eC=e=>Dt(Js(e)),tC=e=>en(Js(e)),nC=(e,t)=>mr(Js(e),Zs(e,t)),rC=(e,t)=>vr(Js(e),Zs(e,t));({and:aC,not:oC}=we()),sC=te({props({props:e}){return h({collapsible:!1,multiple:!1,orientation:"vertical",defaultValue:[]},e)},initialState(){return"idle"},context({prop:e,bindable:t}){return{focusedValue:t(()=>({defaultValue:null,sync:!0,onChange(n){var r;(r=e("onFocusChange"))==null||r({value:n})}})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var r;(r=e("onValueChange"))==null||r({value:n})}}))}},computed:{isHorizontal:({prop:e})=>e("orientation")==="horizontal"},on:{"VALUE.SET":{actions:["setValue"]}},states:{idle:{on:{"TRIGGER.FOCUS":{target:"focused",actions:["setFocusedValue"]}}},focused:{on:{"GOTO.NEXT":{actions:["focusNextTrigger"]},"GOTO.PREV":{actions:["focusPrevTrigger"]},"TRIGGER.CLICK":[{guard:aC("isExpanded","canToggle"),actions:["collapse"]},{guard:oC("isExpanded"),actions:["expand"]}],"GOTO.FIRST":{actions:["focusFirstTrigger"]},"GOTO.LAST":{actions:["focusLastTrigger"]},"TRIGGER.BLUR":{target:"idle",actions:["clearFocusedValue"]}}}},implementations:{guards:{canToggle:({prop:e})=>!!e("collapsible")||!!e("multiple"),isExpanded:({context:e,event:t})=>e.get("value").includes(t.value)},actions:{collapse({context:e,prop:t,event:n}){let r=t("multiple")?Ft(e.get("value"),n.value):[];e.set("value",r)},expand({context:e,prop:t,event:n}){let r=t("multiple")?Tt(e.get("value"),n.value):[n.value];e.set("value",r)},focusFirstTrigger({scope:e}){var t;(t=eC(e))==null||t.focus()},focusLastTrigger({scope:e}){var t;(t=tC(e))==null||t.focus()},focusNextTrigger({context:e,scope:t}){let n=e.get("focusedValue");if(!n)return;let r=nC(t,n);r==null||r.focus()},focusPrevTrigger({context:e,scope:t}){let n=e.get("focusedValue");if(!n)return;let r=rC(t,n);r==null||r.focus()},setFocusedValue({context:e,event:t}){e.set("focusedValue",t.value)},clearFocusedValue({context:e}){e.set("focusedValue",null)},setValue({context:e,event:t}){e.set("value",t.value)},coarseValue({context:e,prop:t}){!t("multiple")&&e.get("value").length>1&&(It("The value of accordion should be a single value when multiple is false."),e.set("value",[e.get("value")[0]]))}}}}),lC=class extends X{initMachine(e){return new Y(sC,e)}initApi(){return this.zagConnect(iC)}render(){var a,o;let e=(a=this.el.querySelector('[data-scope="accordion"][data-part="root"]'))!=null?a:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.id,n=t?`accordion:${t}:item:`:"",r=e.querySelectorAll('[data-scope="accordion"][data-part="item"]'),i=(o=this.el.dataset.animation)!=null?o:"instant";for(let s of r){if(n&&!s.id.startsWith(n))continue;let l=s.dataset.value;if(!l)continue;let c=s.dataset.disabled==="";this.spreadProps(s,this.api.getItemProps({value:l,disabled:c}));let d=s.querySelector('[data-scope="accordion"][data-part="item-trigger"]');d&&this.spreadProps(d,this.api.getItemTriggerProps({value:l,disabled:c}));let u=s.querySelector('[data-scope="accordion"][data-part="item-indicator"]');u&&this.spreadProps(u,this.api.getItemIndicatorProps({value:l,disabled:c}));let p=s.querySelector('[data-scope="accordion"][data-part="item-content"]');p&&(i==="instant"?this.spreadProps(p,this.api.getItemContentProps({value:l,disabled:c})):(i==="js"||i==="custom")&&(this.spreadProps(p,Zr(this.api.getItemContentProps({value:l,disabled:c}))),p.removeAttribute("hidden")))}}},Id='[data-scope="accordion"][data-part="item-content"]',cC='[data-scope="accordion"][data-part="item"]',zh=kh(cC);dC={mounted(){let e=this.el,t=this,n=this.pushEvent.bind(this),r=()=>j(this.liveSocket);t.lastValue=Uh(e,"value","defaultValue");let i=new lC(e,y(h({id:e.id},js(e,"value","defaultValue")),{collapsible:O(e,"collapsible"),multiple:O(e,"multiple"),orientation:V(e,"orientation"),dir:q(e),onValueChange:u=>{var T,w;let p=(T=u.value)!=null?T:[],g=(w=t.lastValue)!=null?w:[],{added:f,removed:m}=Na(p,g);t.lastValue=p;let S={id:e.id,value:p,previousValue:g,added:f,removed:m};W({el:e,canPushServer:r(),pushEvent:n,payload:S,serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")}),Vt(e)&&!O(e,"controlled")&&Nh({el:e,selector:Id,openValues:p,resolveValue:zh})},onFocusChange:u=>{var p;W({el:e,canPushServer:r(),pushEvent:n,payload:{id:e.id,value:(p=u.value)!=null?p:null},serverEventName:V(e,"onFocusChange"),clientEventName:V(e,"onFocusChangeClient")})}}));i.init(),this.accordion=i,Ms(e,Id);let a={el:e,pushEvent:n,canPushServer:r},o=ji(a,{getValue:()=>i.api.value,serverEventName:"accordion_value_response",domEventName:"accordion-value"}),s=ji(a,{getValue:()=>i.api.focusedValue,serverEventName:"accordion_focused_response",domEventName:"accordion-focused"}),l=(u,p,g)=>{let f={value:u,disabled:p},m=i.api.getItemState(f);Ge({respondTo:g,canPushServer:r(),pushEvent:n,serverEventName:"accordion_item_state_response",serverPayload:{id:e.id,value:u,state:{expanded:m.expanded,focused:m.focused,disabled:m.disabled}},el:e,domEventName:"accordion-item-state",domDetail:{id:e.id,value:u,state:m}})},c=ie(e);this.domRegistry=c,c.add("corex:accordion:set-value",u=>{i.api.setValue(u.detail.value)}),c.add("corex:accordion:value",u=>{o(de(u.detail))}),c.add("corex:accordion:focused",u=>{s(de(u.detail))}),c.add("corex:accordion:item-state",u=>{let p=u.detail,g=p==null?void 0:p.value;typeof g!="string"||g===""||l(g,(p==null?void 0:p.disabled)===!0,de(p))});let d=re(this);this.handleRegistry=d,d.add("accordion_set_value",u=>{$(e.id,H(u))&&i.api.setValue(u.value)}),d.add("accordion_value",u=>{$(e.id,H(u))&&o(de(u))}),d.add("accordion_focused",u=>{$(e.id,H(u))&&s(de(u))}),d.add("accordion_item_state",u=>{$(e.id,H(u))&&(typeof(u==null?void 0:u.value)!="string"||u.value===""||l(u.value,u.disabled===!0,de(u)))})},beforeUpdate(){var t;let{el:e}=this;O(e,"controlled")&&Vt(e)&&(this.previousValue=(t=Ie(e,"value"))!=null?t:[])},updated(){var i,a,o,s,l;let{el:e}=this,t=jh(e);if(!O(e,"controlled")){(i=this.accordion)==null||i.updateProps(t);return}let n=(a=Ie(e,"value"))!=null?a:[],r=(s=(o=this.previousValue)!=null?o:this.lastValue)!=null?s:[];this.previousValue=void 0,this.lastValue=n,eo({el:e,selector:Id,prevOpen:r,nextOpen:n,resolveValue:zh}),(l=this.accordion)==null||l.updateProps(y(h({},t),{value:n}))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.accordion)==null||n.destroy()}}});function uC(e){let t=h({},e);return delete t.defaultValue,delete t.value,t}function Er(e,t,n,r,i){Object.keys(i).length>0&&r(e,uC(i)),e.value=n,it(e,t)}var so=ee(()=>{"use strict";oe()});function Wn(e){let{x:t,y:n,width:r,height:i}=e,a=t+r/2,o=n+i/2;return{x:t,y:n,width:r,height:i,minX:t,minY:n,maxX:t+r,maxY:n+i,midX:a,midY:o,center:Qr(a,o)}}function Jh(e){let t=Qr(e.minX,e.minY),n=Qr(e.maxX,e.minY),r=Qr(e.maxX,e.maxY),i=Qr(e.minX,e.maxY);return{top:t,right:n,bottom:r,left:i}}var gC,pC,fn,Qr,Td,Zh,Qs=ee(()=>{"use strict";gC=Object.defineProperty,pC=(e,t,n)=>t in e?gC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fn=(e,t,n)=>pC(e,typeof t!="symbol"?t+"":t,n),Qr=(e,t)=>({x:e,y:t}),Td=(e,t)=>t?Qr(e.x-t.x,e.y-t.y):e,Zh=(e,t)=>Qr(e.x+t.x,e.y+t.y)});var nf,Qh,el,hC,fC,mC,vC,Cd,Pr,wd,rf,af,of,Yi,yC,Ae,sf,lf,ef,Xi,lo,Od,xe,tf,cf,df,uf,ke,Bt=ee(()=>{"use strict";({floor:nf,abs:Qh,round:el,min:hC,max:fC,pow:mC,sign:vC}=Math),Cd=e=>Number.isNaN(e),Pr=e=>Cd(e)?0:e,wd=(e,t)=>(e%t+t)%t,rf=(e,t)=>(e%t+t)%t,af=(e,t)=>Pr(e)>=t,of=(e,t)=>Pr(e)<=t,Yi=(e,t,n)=>{let r=Pr(e),i=t==null||r>=t,a=n==null||r<=n;return i&&a},yC=(e,t,n)=>el((Pr(e)-t)/n)*n+t,Ae=(e,t,n)=>hC(fC(Pr(e),t),n),sf=(e,t,n)=>(Pr(e)-t)/(n-t),lf=(e,t,n,r)=>Ae(yC(e*(n-t)+t,t,r),t,n),ef=(e,t)=>{let n=e,r=t.toString(),i=r.indexOf("."),a=i>=0?r.length-i:0;if(a>0){let o=mC(10,a);n=el(n*o)/o}return n},Xi=(e,t)=>typeof t=="number"?nf(e*t+.5)/t:el(e),lo=(e,t,n,r)=>{let i=t!=null?Number(t):0,a=Number(n),o=(e-i)%r,s=Qh(o)*2>=r?e+vC(o)*(r-Qh(o)):e-o;if(s=ef(s,r),!Cd(i)&&sa){let l=nf((a-i)/r),c=i+l*r;s=l<=0||ce[t]===n?e:[...e.slice(0,t),n,...e.slice(t+1)],xe=(e,t=0,n=10)=>{let r=Math.pow(n,t);return el(e*r)/r},tf=e=>{if(!Number.isFinite(e))return 0;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n+=1;return n},cf=(e,t,n)=>{let r=t==="+"?e+n:e-n;if(e%1!==0||n%1!==0){let i=10**Math.max(tf(e),tf(n));e=Math.round(e*i),n=Math.round(n*i),r=t==="+"?e+n:e-n,r/=i}return r},df=(e,t)=>cf(Pr(e),"+",t),uf=(e,t)=>cf(Pr(e),"-",t),ke=e=>typeof e=="number"?`${e}px`:e});var bf={};pe(bf,{AngleSlider:()=>xC,valueChangePayload:()=>kd});function TC(e,t,n=e.center){let r=t.x-n.x,i=t.y-n.y;return 360-(Math.atan2(r,i)*(180/Math.PI)+180)}function vf(e){return(360-e)%360}function Rd(e,t,n,r){let i=Wn(e.getBoundingClientRect()),a=TC(i,t);return n!=null?a-n:(r==="rtl"&&(a=vf(a)),a)}function CC(e,t,n,r,i){if(n==null)return Rd(e,t,null,i);let a=Rd(e,t),o=r+n;return i==="rtl"?r+o-a:a-n}function pf(e,t){return t==="rtl"?vf(e):e}function yf(e){return Math.min(Math.max(e,tl),nl)}function wC(e,t){let n=yf(e),r=Math.ceil(n/t),i=Math.round(n/t);return r>=n/t?r*t===nl?tl:r*t:i*t}function hf(e,t){return lo(e,tl,nl,t)}function OC(e,t){let{state:n,send:r,context:i,prop:a,computed:o,scope:s}=e,l=n.matches("dragging"),c=i.get("value"),d=o("valueAsDegree"),u=a("dir"),p=pf(c,u),g=a("disabled"),f=a("invalid"),m=a("readOnly"),S=o("interactive"),T=a("aria-label"),w=a("aria-labelledby");return{value:c,valueAsDegree:d,dragging:l,setValue(I){r({type:"VALUE.SET",value:I})},getRootProps(){return t.element(y(h({},ei.root.attrs),{id:EC(s),dir:a("dir"),"data-disabled":b(g),"data-invalid":b(f),"data-readonly":b(m),style:{"--value":c,"--angle":`${p}deg`}}))},getLabelProps(){return t.label(y(h({},ei.label.attrs),{id:gf(s),htmlFor:Ad(s),dir:a("dir"),"data-disabled":b(g),"data-invalid":b(f),"data-readonly":b(m),onClick(I){var P;S&&(I.preventDefault(),(P=xd(s))==null||P.focus())}}))},getHiddenInputProps(){return t.element({type:"hidden",value:c,name:a("name"),id:Ad(s),dir:a("dir")})},getControlProps(){return t.element(y(h({},ei.control.attrs),{role:"presentation",id:mf(s),dir:a("dir"),"data-disabled":b(g),"data-invalid":b(f),"data-readonly":b(m),onPointerDown(I){if(!S||!fe(I))return;let P=et(I),v=I.currentTarget,E=xd(s),R=Ot(I).composedPath(),x=E&&R.includes(E),C=null;x&&(C=Rd(v,P)-c),r({type:"CONTROL.POINTER_DOWN",point:P,angularOffset:C}),I.stopPropagation()},style:{touchAction:"none",userSelect:"none",WebkitUserSelect:"none"}}))},getThumbProps(){return t.element(y(h({},ei.thumb.attrs),{id:ff(s),role:"slider",dir:a("dir"),"aria-label":T,"aria-labelledby":w!=null?w:gf(s),"aria-valuemax":360,"aria-valuemin":0,"aria-valuenow":c,tabIndex:m||S?0:void 0,"data-disabled":b(g),"data-invalid":b(f),"data-readonly":b(m),onFocus(){r({type:"THUMB.FOCUS"})},onBlur(){r({type:"THUMB.BLUR"})},onKeyDown(I){if(!S)return;let P=Hn(I)*a("step"),v={ArrowLeft(){r({type:"THUMB.ARROW_DEC",step:P})},ArrowUp(){r({type:"THUMB.ARROW_DEC",step:P})},ArrowRight(){r({type:"THUMB.ARROW_INC",step:P})},ArrowDown(){r({type:"THUMB.ARROW_INC",step:P})},Home(){r({type:"THUMB.HOME"})},End(){r({type:"THUMB.END"})}},E=me(I,{dir:a("dir"),orientation:"horizontal"}),R=v[E];R&&(R(I),I.preventDefault())},style:{rotate:"var(--angle)"}}))},getValueTextProps(){return t.element(y(h({},ei.valueText.attrs),{id:PC(s),dir:a("dir")}))},getMarkerGroupProps(){return t.element(y(h({},ei.markerGroup.attrs),{dir:a("dir")}))},getMarkerProps(I){let P;I.valuec?P="over-value":P="at-value";let v=pf(I.value,u);return t.element(y(h({},ei.marker.attrs),{dir:a("dir"),"data-value":I.value,"data-state":P,"data-disabled":b(g),style:{"--marker-value":I.value,"--marker-display-value":v,rotate:"calc(var(--marker-display-value) * 1deg)"}}))}}}function kd(e,t){return{id:e.id,value:t.value,valueAsDegree:t.valueAsDegree}}function Vd(e,t){queueMicrotask(()=>{let n=t(),r=e.querySelector('[data-scope="angle-slider"][data-part="hidden-input"]');if(!r)return;let i=n.api.value;String(r.value)!==String(i)&&(r.value=String(i)),r.dispatchEvent(new Event("input",{bubbles:!0})),r.dispatchEvent(new Event("change",{bubbles:!0}))})}var bC,ei,EC,ff,Ad,mf,PC,gf,SC,IC,xd,tl,nl,VC,AC,xC,Ef=ee(()=>{"use strict";so();Qs();Bt();$e();Ve();be();oe();bC=z("angle-slider").parts("root","label","thumb","valueText","control","track","markerGroup","marker"),ei=bC.build(),EC=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`angle-slider:${e.id}`},ff=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.thumb)!=null?n:`angle-slider:${e.id}:thumb`},Ad=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`angle-slider:${e.id}:input`},mf=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`angle-slider:${e.id}:control`},PC=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.valueText)!=null?n:`angle-slider:${e.id}:value-text`},gf=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`angle-slider:${e.id}:label`},SC=e=>e.getById(Ad(e)),IC=e=>e.getById(mf(e)),xd=e=>e.getById(ff(e));tl=0,nl=359;VC=te({props({props:e}){return h({step:1,defaultValue:0},e)},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var r;(r=e("onValueChange"))==null||r({value:n,valueAsDegree:`${n}deg`})}}))}},refs(){return{thumbDragOffset:null}},computed:{interactive:({prop:e})=>!(e("disabled")||e("readOnly")),valueAsDegree:({context:e})=>`${e.get("value")}deg`},watch({track:e,context:t,action:n}){e([()=>t.get("value")],()=>{n(["syncInputElement"])})},initialState(){return"idle"},on:{"VALUE.SET":{actions:["setValue"]}},states:{idle:{on:{"CONTROL.POINTER_DOWN":{target:"dragging",actions:["setThumbDragOffset","setPointerValue","focusThumb"]},"THUMB.FOCUS":{target:"focused"}}},focused:{on:{"CONTROL.POINTER_DOWN":{target:"dragging",actions:["setThumbDragOffset","setPointerValue","focusThumb"]},"THUMB.ARROW_DEC":{actions:["decrementValue","invokeOnChangeEnd"]},"THUMB.ARROW_INC":{actions:["incrementValue","invokeOnChangeEnd"]},"THUMB.HOME":{actions:["setValueToMin","invokeOnChangeEnd"]},"THUMB.END":{actions:["setValueToMax","invokeOnChangeEnd"]},"THUMB.BLUR":{target:"idle"}}},dragging:{entry:["focusThumb"],effects:["trackPointerMove"],on:{"DOC.POINTER_UP":{target:"focused",actions:["invokeOnChangeEnd","clearThumbDragOffset"]},"DOC.POINTER_MOVE":{actions:["setPointerValue"]}}}},implementations:{effects:{trackPointerMove({scope:e,send:t}){return pn(e.getDoc(),{onPointerMove(n){t({type:"DOC.POINTER_MOVE",point:n.point})},onPointerUp(){t({type:"DOC.POINTER_UP"})}})}},actions:{syncInputElement({scope:e,context:t}){let n=SC(e);_e(n,t.get("value").toString())},invokeOnChangeEnd({context:e,prop:t,computed:n}){var r;(r=t("onValueChangeEnd"))==null||r({value:e.get("value"),valueAsDegree:n("valueAsDegree")})},setPointerValue({scope:e,event:t,context:n,prop:r,refs:i}){let a=IC(e);if(!a)return;let o=i.get("thumbDragOffset"),s=n.get("value"),l=CC(a,t.point,o,s,r("dir"));n.set("value",wC(l,r("step")))},setValueToMin({context:e}){e.set("value",tl)},setValueToMax({context:e}){e.set("value",nl)},setValue({context:e,event:t}){e.set("value",yf(t.value))},decrementValue({context:e,event:t,prop:n}){var i;let r=hf(e.get("value")-t.step,(i=t.step)!=null?i:n("step"));e.set("value",r)},incrementValue({context:e,event:t,prop:n}){var i;let r=hf(e.get("value")+t.step,(i=t.step)!=null?i:n("step"));e.set("value",r)},focusThumb({scope:e}){B(()=>{var t;(t=xd(e))==null||t.focus({preventScroll:!0})})},setThumbDragOffset({refs:e,event:t}){var n;e.set("thumbDragOffset",(n=t.angularOffset)!=null?n:null)},clearThumbDragOffset({refs:e}){e.set("thumbDragOffset",null)}}}}),AC=class extends X{initMachine(e){return new Y(VC,e)}initApi(){return this.zagConnect(OC)}render(){var s,l;let e=(s=this.el.querySelector('[data-scope="angle-slider"][data-part="root"]'))!=null?s:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="angle-slider"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-scope="angle-slider"][data-part="hidden-input"]');n instanceof HTMLInputElement&&Er(n,this.el,String(this.api.value),(c,d)=>this.spreadProps(c,d),this.api.getHiddenInputProps());let r=this.el.querySelector('[data-scope="angle-slider"][data-part="control"]');r&&this.spreadProps(r,this.api.getControlProps());let i=this.el.querySelector('[data-scope="angle-slider"][data-part="thumb"]');i&&this.spreadProps(i,this.api.getThumbProps());let a=this.el.querySelector('[data-scope="angle-slider"][data-part="value-text"]');if(a){this.spreadProps(a,this.api.getValueTextProps());let c=a.querySelector('[data-scope="angle-slider"][data-part="value"]'),d=this.el.dataset.valueTextAs,u=String(d==="raw"?this.api.value:(l=this.api.valueAsDegree)!=null?l:this.api.value);c&&c.textContent!==u&&(c.textContent=u)}let o=this.el.querySelector('[data-scope="angle-slider"][data-part="marker-group"]');o&&this.spreadProps(o,this.api.getMarkerGroupProps()),this.el.querySelectorAll('[data-scope="angle-slider"][data-part="marker"]').forEach(c=>{let d=c.dataset.value;if(d==null)return;let u=Number(d);Number.isNaN(u)||this.spreadProps(c,this.api.getMarkerProps({value:u}))})}};xC={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=new AC(e,y(h({id:e.id},Ws(e)),{disabled:O(e,"disabled"),readOnly:O(e,"readonly"),invalid:O(e,"invalid"),name:V(e,"name"),dir:q(e),"aria-label":V(e,"aria-label"),"aria-labelledby":V(e,"aria-labelledby"),onValueChange:s=>{W({el:e,canPushServer:n(),pushEvent:t,payload:kd(e,s),serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})},onValueChangeEnd:s=>{W({el:e,canPushServer:n(),pushEvent:t,payload:kd(e,s),serverEventName:V(e,"onValueChangeEnd"),clientEventName:V(e,"onValueChangeEndClient")}),Vd(e,()=>r)}}));r.init(),this.angleSlider=r;let i=s=>{Ge({respondTo:s,canPushServer:n(),pushEvent:t,serverEventName:"angle_slider_value_response",serverPayload:{id:e.id,value:r.api.value,valueAsDegree:r.api.valueAsDegree,dragging:r.api.dragging},el:e,domEventName:"angle-slider-value",domDetail:{id:e.id,value:r.api.value,valueAsDegree:r.api.valueAsDegree,dragging:r.api.dragging}})},a=ie(e);this.domRegistry=a,a.add("corex:angle-slider:set-value",s=>{r.api.setValue(s.detail.value),Vd(e,()=>r)}),a.add("corex:angle-slider:value",s=>{i(de(s.detail))});let o=re(this);this.handleRegistry=o,o.add("angle_slider_set_value",s=>{$(e.id,H(s))&&(r.api.setValue(s.value),Vd(e,()=>r))}),o.add("angle_slider_value",s=>{$(e.id,H(s))&&i(de(s))})},updated(){let e=this.el,t=this.angleSlider,n=qs(e);t==null||t.updateProps(y(h({id:e.id},n),{disabled:O(e,"disabled"),readOnly:O(e,"readonly"),invalid:O(e,"invalid"),name:V(e,"name"),dir:q(e)}))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.angleSlider)==null||n.destroy()}}});var Tf={};pe(Tf,{Avatar:()=>_C,statusPayload:()=>If});function LC(e,t){let{state:n,send:r,prop:i,scope:a}=e,o=n.matches("loaded");return{loaded:o,setSrc(s){let l=Ld(a);l==null||l.setAttribute("src",s)},setLoaded(){r({type:"img.loaded",src:"api"})},setError(){r({type:"img.error",src:"api"})},getRootProps(){return t.element(y(h({},Nd.root.attrs),{dir:i("dir"),id:Pf(a)}))},getImageProps(){return t.img(y(h({},Nd.image.attrs),{hidden:!o,dir:i("dir"),id:Sf(a),"data-state":o?"visible":"hidden",onLoad(){r({type:"img.loaded",src:"element"})},onError(){r({type:"img.error",src:"element"})}}))},getFallbackProps(){return t.element(y(h({},Nd.fallback.attrs),{dir:i("dir"),id:kC(a),hidden:o,"data-state":o?"hidden":"visible"}))}}}function FC(e){return e.complete&&e.naturalWidth!==0&&e.naturalHeight!==0}function If(e,t){return{id:e.id,status:t.status}}var RC,Nd,Pf,Sf,kC,NC,Ld,DC,MC,_C,Cf=ee(()=>{"use strict";Ve();be();oe();RC=z("avatar").parts("root","image","fallback"),Nd=RC.build(),Pf=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`avatar:${e.id}`},Sf=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.image)!=null?n:`avatar:${e.id}:image`},kC=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.fallback)!=null?n:`avatar:${e.id}:fallback`},NC=e=>e.getById(Pf(e)),Ld=e=>e.getById(Sf(e));DC=te({initialState(){return"loading"},effects:["trackImageRemoval","trackSrcChange"],on:{"src.change":{target:"loading"},"img.unmount":{target:"error"}},states:{loading:{entry:["checkImageStatus"],on:{"img.loaded":{target:"loaded",actions:["invokeOnLoad"]},"img.error":{target:"error",actions:["invokeOnError"]}}},error:{on:{"img.loaded":{target:"loaded",actions:["invokeOnLoad"]}}},loaded:{on:{"img.error":{target:"error",actions:["invokeOnError"]}}}},implementations:{actions:{invokeOnLoad({prop:e}){var t;(t=e("onStatusChange"))==null||t({status:"loaded"})},invokeOnError({prop:e}){var t;(t=e("onStatusChange"))==null||t({status:"error"})},checkImageStatus({send:e,scope:t}){let n=Ld(t);if(!(n!=null&&n.complete))return;let r=FC(n)?"img.loaded":"img.error";e({type:r,src:"ssr"})}},effects:{trackImageRemoval({send:e,scope:t}){let n=NC(t);return Ls(n,{callback(r){Array.from(r[0].removedNodes).find(o=>o.nodeType===Node.ELEMENT_NODE&&o.matches("[data-scope=avatar][data-part=image]"))&&e({type:"img.unmount"})}})},trackSrcChange({send:e,scope:t}){let n=Ld(t);return Ht(n,{attributes:["src","srcset"],callback(){e({type:"src.change"})}})}}}});MC=class extends X{initMachine(e){return new Y(DC,e)}initApi(){return this.zagConnect(LC)}render(){var i;let e=(i=this.el.querySelector('[data-scope="avatar"][data-part="root"]'))!=null?i:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="avatar"][data-part="image"]');t&&this.spreadProps(t,this.api.getImageProps());let n=this.el.querySelector('[data-scope="avatar"][data-part="fallback"]');n&&this.spreadProps(n,this.api.getFallbackProps());let r=this.el.querySelector('[data-scope="avatar"][data-part="skeleton"]');if(r){let a=this.machine.service.state,o=a.matches("loaded"),s=a.matches("error");r.hidden=o||s,r.setAttribute("data-state",o||s?"hidden":"visible")}}};_C={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=V(e,"src"),i=new MC(e,{id:e.id,dir:V(e,"dir"),onStatusChange:l=>{let c=If(e,l);W({el:e,canPushServer:n(),pushEvent:t,payload:c,serverEventName:V(e,"onStatusChange"),clientEventName:V(e,"onStatusChangeClient")})}});i.init(),this.avatar=i,this.lastSrc=r;let a=l=>{let c=i.api.loaded;Ge({respondTo:l,canPushServer:n(),pushEvent:t,serverEventName:"avatar_loaded_response",serverPayload:{id:e.id,loaded:c},el:e,domEventName:"avatar-loaded",domDetail:{id:e.id,loaded:c}})},o=ie(e);this.domRegistry=o,o.add("corex:avatar:set-src",l=>{var d;let c=(d=l.detail)==null?void 0:d.src;typeof c=="string"&&(i.api.setSrc(c),this.lastSrc=c,e.dataset.src=c)}),o.add("corex:avatar:loaded",l=>{a(de(l.detail))});let s=re(this);this.handleRegistry=s,s.add("avatar_set_src",l=>{$(e.id,H(l))&&(i.api.setSrc(l.src),this.lastSrc=l.src,e.dataset.src=l.src)}),s.add("avatar_loaded",l=>{$(e.id,H(l))&&a(de(l))})},updated(){let e=V(this.el,"src"),t=V(this.el,"dir");this.avatar&&this.avatar.updateProps(h({},t!==void 0?{dir:t}:{})),this.avatar&&e!==void 0&&e!==this.lastSrc&&(this.avatar.api.setSrc(e),this.lastSrc=e),this.avatar&&e===void 0&&this.lastSrc!==void 0&&(this.avatar.api.setSrc(""),this.lastSrc=void 0)},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.avatar)==null||n.destroy()}}});var Lf={};pe(Lf,{Carousel:()=>e0,fromZagPage:()=>Nf,readCorexPage:()=>al,readInstant:()=>co,toZagPage:()=>kf});function KC(e,t){let{state:n,context:r,computed:i,send:a,scope:o,prop:s}=e,l=n.matches("autoplay"),c=n.matches("dragging"),d=i("canScrollNext"),u=i("canScrollPrev"),p=i("isHorizontal"),g=s("autoSize"),f=Array.from(r.get("pageSnapPoints")),m=r.get("page"),S=f.length?Ae(m,0,f.length-1):0,T=s("slidesPerPage"),w=s("padding"),I=s("translations");return{isPlaying:l,isDragging:c,page:S,pageSnapPoints:f,canScrollNext:d,canScrollPrev:u,getProgress(){return S/f.length},getProgressText(){var v,E;let P={page:S+1,totalPages:f.length};return(E=(v=I.progressText)==null?void 0:v.call(I,P))!=null?E:""},scrollToIndex(P,v){a({type:"INDEX.SET",index:P,instant:v})},scrollTo(P,v){a({type:"PAGE.SET",index:P,instant:v})},scrollNext(P){a({type:"PAGE.NEXT",instant:P})},scrollPrev(P){a({type:"PAGE.PREV",instant:P})},play(){a({type:"AUTOPLAY.START"})},pause(){a({type:"AUTOPLAY.PAUSE"})},isInView(P){return Array.from(r.get("slidesInView")).includes(P)},refresh(){a({type:"SNAP.REFRESH"})},getRootProps(){return t.element(y(h({},mn.root.attrs),{id:HC(o),role:"region","aria-roledescription":"carousel","data-orientation":s("orientation"),dir:s("dir"),style:{"--slides-per-page":T,"--slide-spacing":s("spacing"),"--slide-item-size":g?"auto":"calc(100% / var(--slides-per-page) - var(--slide-spacing) * (var(--slides-per-page) - 1) / var(--slides-per-page))"}}))},getItemGroupProps(){return t.element(y(h({},mn.itemGroup.attrs),{id:il(o),"data-orientation":s("orientation"),"data-dragging":b(c),dir:s("dir"),"aria-live":l?"off":"polite",onFocus(P){ge(P.currentTarget,ne(P))&&a({type:"VIEWPORT.FOCUS"})},onBlur(P){ge(P.currentTarget,P.relatedTarget)||a({type:"VIEWPORT.BLUR"})},onMouseDown(P){if(P.defaultPrevented||!s("allowMouseDrag")||!fe(P))return;let v=ne(P);ut(v)&&v!==P.currentTarget||(P.preventDefault(),a({type:"DRAGGING.START"}))},onWheel:Zp(P=>{let v=s("orientation")==="horizontal"?"deltaX":"deltaY";P[v]<0&&!i("canScrollPrev")||P[v]>0&&!i("canScrollNext")||a({type:"USER.SCROLL"})},150),onTouchStart(){a({type:"USER.SCROLL"})},style:{display:g?"flex":"grid",gap:"var(--slide-spacing)",scrollSnapType:[p?"x":"y",s("snapType")].join(" "),gridAutoFlow:p?"column":"row",scrollbarWidth:"none",overscrollBehaviorX:"contain",[p?"gridAutoColumns":"gridAutoRows"]:g?void 0:"var(--slide-item-size)",[p?"scrollPaddingInline":"scrollPaddingBlock"]:w,[p?"paddingInline":"paddingBlock"]:w,[p?"overflowX":"overflowY"]:"auto"}}))},getItemProps(P){let v=r.get("slidesInView").includes(P.index);return t.element(y(h({},mn.item.attrs),{id:BC(o,P.index),dir:s("dir"),role:"group","data-index":P.index,"data-inview":b(v),"aria-roledescription":"slide","data-orientation":s("orientation"),"aria-label":I.item(P.index,s("slideCount")),"aria-hidden":se(!v),style:{flex:"0 0 auto",[p?"maxWidth":"maxHeight"]:"100%",scrollSnapAlign:(()=>{var A;let E=(A=P.snapAlign)!=null?A:"start",R=s("slidesPerMove"),x=R==="auto"?Math.floor(s("slidesPerPage")):R;return(P.index+x)%x===0?E:void 0})()}}))},getControlProps(){return t.element(y(h({},mn.control.attrs),{"data-orientation":s("orientation")}))},getPrevTriggerProps(){return t.button(y(h({},mn.prevTrigger.attrs),{id:UC(o),type:"button",disabled:!u,dir:s("dir"),"aria-label":I.prevTrigger,"data-orientation":s("orientation"),"aria-controls":il(o),onClick(P){P.defaultPrevented||a({type:"PAGE.PREV",src:"trigger"})}}))},getNextTriggerProps(){return t.button(y(h({},mn.nextTrigger.attrs),{dir:s("dir"),id:GC(o),type:"button","aria-label":I.nextTrigger,"data-orientation":s("orientation"),"aria-controls":il(o),disabled:!d,onClick(P){P.defaultPrevented||a({type:"PAGE.NEXT",src:"trigger"})}}))},getIndicatorGroupProps(){return t.element(y(h({},mn.indicatorGroup.attrs),{dir:s("dir"),id:qC(o),"data-orientation":s("orientation"),onKeyDown(P){if(P.defaultPrevented)return;let v="indicator",E={ArrowDown(C){p||(a({type:"PAGE.NEXT",src:v}),C.preventDefault())},ArrowUp(C){p||(a({type:"PAGE.PREV",src:v}),C.preventDefault())},ArrowRight(C){p&&(a({type:"PAGE.NEXT",src:v}),C.preventDefault())},ArrowLeft(C){p&&(a({type:"PAGE.PREV",src:v}),C.preventDefault())},Home(C){a({type:"PAGE.SET",index:0,src:v}),C.preventDefault()},End(C){a({type:"PAGE.SET",index:f.length-1,src:v}),C.preventDefault()}},R=me(P,{dir:s("dir"),orientation:s("orientation")}),x=E[R];x==null||x(P)}}))},getIndicatorProps(P){return t.button(y(h({},mn.indicator.attrs),{dir:s("dir"),id:Vf(o,P.index),type:"button","data-orientation":s("orientation"),"data-index":P.index,"data-readonly":b(P.readOnly),"data-current":b(P.index===S),"aria-label":I.indicator(P.index),onClick(v){v.defaultPrevented||P.readOnly||a({type:"PAGE.SET",index:P.index,src:"indicator"})}}))},getAutoplayTriggerProps(){return t.button(y(h({},mn.autoplayTrigger.attrs),{type:"button","data-orientation":s("orientation"),"data-pressed":b(l),"aria-label":l?I.autoplayStop:I.autoplayStart,onClick(P){P.defaultPrevented||a({type:l?"AUTOPLAY.PAUSE":"AUTOPLAY.START"})}}))},getProgressTextProps(){return t.element(h({},mn.progressText.attrs))}}}function Af(e){let t=pt(e),n=e.offsetWidth,r=e.offsetHeight,i=t.getPropertyValue("scroll-padding-left").replace("auto","0px"),a=t.getPropertyValue("scroll-padding-top").replace("auto","0px"),o=t.getPropertyValue("scroll-padding-right").replace("auto","0px"),s=t.getPropertyValue("scroll-padding-bottom").replace("auto","0px"),l=rl(i,n),c=rl(a,r),d=rl(o,n),u=rl(s,r);return{x:{before:l,after:d},y:{before:c,after:u}}}function zC(e,t,n="both"){return n==="x"&&e.right>=t.left&&e.left<=t.right||n==="y"&&e.bottom>=t.top&&e.top<=t.bottom||n==="both"&&e.right>=t.left&&e.left<=t.right&&e.bottom>=t.top&&e.top<=t.bottom}function xf(e){let t=[];for(let n of e.children)t=t.concat(n,xf(n));return t}function Rf(e,t=!1){let n=e.getBoundingClientRect(),i=Md(e)==="rtl",a=Sh(e),o={x:{start:[],center:[],end:[]},y:{start:[],center:[],end:[]}},s=t?xf(e):e.children;for(let l of["x","y"]){let c=l==="x"?"y":"x",d=l==="x"?"left":"top",u=l==="x"?"right":"bottom",p=l==="x"?"width":"height",g=l==="x"?"scrollLeft":"scrollTop",f=l==="x"?a.x:a.y,m=i&&l==="x";for(let S of s){let T=S.getBoundingClientRect();if(!zC(n,T,c))continue;let w=pt(S),[I,P]=w.getPropertyValue("scroll-snap-align").split(" ");typeof P=="undefined"&&(P=I);let v=l==="x"?P:I,E,R,x;if(m){let C=Math.abs(e[g]),A=(n[u]-T[u])/f+C;E=A,R=A+T[p]/f,x=A+T[p]/(2*f)}else E=(T[d]-n[d])/f+e[g],R=E+T[p]/f,x=E+T[p]/(2*f);switch(v){case"none":break;case"start":o[l].start.push({node:S,position:E});break;case"center":o[l].center.push({node:S,position:x});break;case"end":o[l].end.push({node:S,position:R});break}}}return o}function jC(e){let t=Md(e),n=Af(e),r=Rf(e),i=e.offsetWidth,a=e.offsetHeight,o={x:e.scrollWidth-e.offsetWidth,y:e.scrollHeight-e.offsetHeight},s=t==="rtl",l=s&&e.scrollLeft<=0,c;return s?(c=Dd([...r.x.start.map(d=>d.position-n.x.after),...r.x.center.map(d=>d.position-i/2),...r.x.end.map(d=>d.position-i+n.x.before)].map(Fd(0,o.x))),l&&(c=c.map(d=>-d))):c=Dd([...r.x.start.map(d=>d.position-n.x.before),...r.x.center.map(d=>d.position-i/2),...r.x.end.map(d=>d.position-i+n.x.after)].map(Fd(0,o.x))),{x:c,y:Dd([...r.y.start.map(d=>d.position-n.y.before),...r.y.center.map(d=>d.position-a/2),...r.y.end.map(d=>d.position-a+n.y.after)].map(Fd(0,o.y)))}}function YC(e,t,n){let r=Md(e),i=Af(e),a=Rf(e),o=[...a[t].start,...a[t].center,...a[t].end],s=r==="rtl",l=s&&t==="x"&&e.scrollLeft<=0;for(let c of o)if(n(c.node)){let d;return t==="x"&&s?(d=c.position-i.x.after,l&&(d=-d)):d=c.position-(t==="x"?i.x.before:i.y.before),d}}function JC(e,t,n){if(e==null||n<=0)return[];let r=[],i=t==="auto"?Math.floor(n):t;if(i<=0)return[];for(let a=0;ae);a+=i)r.push(a);return r}function kf(e){if(e!=null)return Math.max(0,e-1)}function Nf(e){return e+1}function al(e,t){return kf(U(e,t==="page"?"page":"defaultPage"))}function co(e){if(e&&typeof e=="object"&&"instant"in e){let t=e.instant;return t===!0||t==="true"}return!1}var $C,mn,HC,BC,il,GC,UC,qC,Vf,tt,wf,WC,Of,Md,rl,Dd,Fd,XC,ZC,QC,e0,Df=ee(()=>{"use strict";Bt();Ve();be();oe();$C=z("carousel").parts("root","itemGroup","item","control","nextTrigger","prevTrigger","indicatorGroup","indicator","autoplayTrigger","progressText"),mn=$C.build(),HC=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`carousel:${e.id}`},BC=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.item)==null?void 0:r.call(n,t))!=null?i:`carousel:${e.id}:item:${t}`},il=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.itemGroup)!=null?n:`carousel:${e.id}:item-group`},GC=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.nextTrigger)!=null?n:`carousel:${e.id}:next-trigger`},UC=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.prevTrigger)!=null?n:`carousel:${e.id}:prev-trigger`},qC=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.indicatorGroup)!=null?n:`carousel:${e.id}:indicator-group`},Vf=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.indicator)==null?void 0:r.call(n,t))!=null?i:`carousel:${e.id}:indicator:${t}`},tt=e=>e.getById(il(e)),wf=e=>Oe(tt(e),"[data-part=item]"),WC=(e,t)=>e.getById(Vf(e,t)),Of=e=>{let t=tt(e);if(!t)return;let n=Bn(t);t.setAttribute("tabindex",n.length>0?"-1":"0")};Md=e=>pt(e).direction,rl=(e,t)=>{let n=parseFloat(e);return/%/.test(e)&&(n/=100,n*=t),Number.isNaN(n)?0:n};Dd=e=>[...new Set(e)],Fd=(e,t)=>n=>Math.max(e,Math.min(t,n)),XC=1,ZC=te({props({props:e}){return gn(e,["slideCount"],"carousel"),y(h({dir:"ltr",defaultPage:0,orientation:"horizontal",snapType:"mandatory",loop:!!e.autoplay,slidesPerPage:1,slidesPerMove:"auto",spacing:"0px",autoplay:!1,allowMouseDrag:!1,inViewThreshold:.6,autoSize:!1},e),{translations:h({nextTrigger:"Next slide",prevTrigger:"Previous slide",indicator:t=>`Go to slide ${t+1}`,item:(t,n)=>`${t+1} of ${n}`,autoplayStart:"Start slide rotation",autoplayStop:"Stop slide rotation",progressText:({page:t,totalPages:n})=>`${t} / ${n}`},e.translations)})},refs(){return{timeoutRef:void 0}},initialState({prop:e}){return e("autoplay")?"autoplay":"idle"},context({prop:e,bindable:t,getContext:n}){return{page:t(()=>({defaultValue:e("defaultPage"),value:e("page"),onChange(r){var o;let a=n().get("pageSnapPoints");(o=e("onPageChange"))==null||o({page:r,pageSnapPoint:a[r]})}})),pageSnapPoints:t(()=>({defaultValue:e("autoSize")?Array.from({length:e("slideCount")},(r,i)=>i):JC(e("slideCount"),e("slidesPerMove"),e("slidesPerPage"))})),slidesInView:t(()=>({defaultValue:[]}))}},computed:{isRtl:({prop:e})=>e("dir")==="rtl",isHorizontal:({prop:e})=>e("orientation")==="horizontal",canScrollNext:({prop:e,context:t})=>e("loop")||t.get("page")e("loop")||t.get("page")>0,autoplayInterval:({prop:e})=>{let t=e("autoplay");return un(t)?t.delay:4e3}},watch({track:e,action:t,context:n,prop:r,send:i}){e([()=>r("slidesPerPage"),()=>r("slidesPerMove")],()=>{t(["setSnapPoints"])}),e([()=>n.get("page")],()=>{t(["scrollToPage","focusIndicatorEl"])}),e([()=>r("orientation"),()=>r("autoSize"),()=>r("dir")],()=>{t(["setSnapPoints","scrollToPage"])}),e([()=>r("slideCount")],()=>{i({type:"SNAP.REFRESH",src:"slide.count"})}),e([()=>!!r("autoplay")],()=>{i({type:r("autoplay")?"AUTOPLAY.START":"AUTOPLAY.PAUSE",src:"autoplay.prop.change"})})},on:{"PAGE.NEXT":{target:"idle",actions:["clearScrollEndTimer","setNextPage"]},"PAGE.PREV":{target:"idle",actions:["clearScrollEndTimer","setPrevPage"]},"PAGE.SET":{target:"idle",actions:["clearScrollEndTimer","setPage"]},"INDEX.SET":{target:"idle",actions:["clearScrollEndTimer","setMatchingPage"]},"SNAP.REFRESH":{actions:["setSnapPoints","scrollToPageIfDrifted"]},"PAGE.SCROLL":{actions:["scrollToPage"]}},effects:["trackSlideMutation","trackSlideIntersections","trackSlideResize"],entry:["setSnapPoints","setPage"],exit:["clearScrollEndTimer"],states:{idle:{on:{"DRAGGING.START":{target:"dragging",actions:["invokeDragStart"]},"AUTOPLAY.START":{target:"autoplay",actions:["invokeAutoplayStart"]},"USER.SCROLL":{target:"userScroll"},"VIEWPORT.FOCUS":{target:"focus"}}},focus:{effects:["trackKeyboardScroll"],on:{"VIEWPORT.BLUR":{target:"idle"},"PAGE.NEXT":{actions:["clearScrollEndTimer","setNextPage"]},"PAGE.PREV":{actions:["clearScrollEndTimer","setPrevPage"]},"PAGE.SET":{actions:["clearScrollEndTimer","setPage"]},"INDEX.SET":{actions:["clearScrollEndTimer","setMatchingPage"]},"USER.SCROLL":{target:"userScroll"}}},dragging:{effects:["trackPointerMove"],entry:["disableScrollSnap"],on:{DRAGGING:{actions:["scrollSlides","invokeDragging"]},"DRAGGING.END":{target:"settling",actions:["endDragging"]}}},settling:{effects:["trackSettlingScroll"],on:{"DRAGGING.START":{target:"dragging",actions:["clearScrollEndTimer","invokeDragStart"]},"SCROLL.END":[{guard:"isFocused",target:"focus",actions:["clearScrollEndTimer","setClosestPage","invokeDraggingEnd"]},{target:"idle",actions:["clearScrollEndTimer","setClosestPage","invokeDraggingEnd"]}]}},userScroll:{effects:["trackScroll"],on:{"DRAGGING.START":{target:"dragging",actions:["invokeDragStart"]},"SCROLL.END":[{guard:"isFocused",target:"focus",actions:["setClosestPage"]},{target:"idle",actions:["setClosestPage"]}]}},autoplay:{effects:["trackDocumentVisibility","trackScroll","autoUpdateSlide"],exit:["invokeAutoplayEnd"],on:{"AUTOPLAY.TICK":{actions:["setNextPage","invokeAutoplay"]},"DRAGGING.START":{target:"dragging",actions:["invokeDragStart"]},"AUTOPLAY.PAUSE":{target:"idle"}}}},implementations:{guards:{isFocused:({scope:e})=>e.isActiveElement(tt(e))},effects:{autoUpdateSlide({computed:e,send:t}){let n=setInterval(()=>{t({type:e("canScrollNext")?"AUTOPLAY.TICK":"AUTOPLAY.PAUSE",src:"autoplay.interval"})},e("autoplayInterval"));return()=>clearInterval(n)},trackSlideMutation({scope:e,send:t}){let n=tt(e);if(!n)return;let r=e.getWin(),i=new r.MutationObserver(()=>{t({type:"SNAP.REFRESH",src:"slide.mutation"}),Of(e)});return Of(e),i.observe(n,{childList:!0,subtree:!0}),()=>i.disconnect()},trackSlideResize({scope:e,send:t}){let n=tt(e);if(!n)return;let r=()=>{t({type:"SNAP.REFRESH",src:"slide.resize"})};B(()=>{r(),B(()=>{t({type:"PAGE.SCROLL",instant:!0})})});let i=wf(e);i.forEach(r);let a=[Un.observe(n,r),...i.map(o=>Un.observe(o,r))];return Ct(...a)},trackSlideIntersections({scope:e,prop:t,context:n}){let r=tt(e),i=e.getWin(),a=new i.IntersectionObserver(o=>{let s=o.reduce((l,c)=>{var p;let d=c.target,u=Number((p=d.dataset.index)!=null?p:"-1");return u==null||Number.isNaN(u)||u===-1?l:c.isIntersecting?Tt(l,u):Ft(l,u)},n.get("slidesInView"));n.set("slidesInView",gt(s))},{root:r,threshold:t("inViewThreshold")});return wf(e).forEach(o=>a.observe(o)),()=>a.disconnect()},trackScroll({send:e,refs:t,scope:n}){let r=tt(n);return r?ae(r,"scroll",()=>{clearTimeout(t.get("timeoutRef")),t.set("timeoutRef",void 0),t.set("timeoutRef",setTimeout(()=>{e({type:"SCROLL.END"})},150))},{passive:!0}):void 0},trackSettlingScroll({send:e,refs:t,scope:n}){let r=tt(n);if(!r)return;let i=()=>{clearTimeout(t.get("timeoutRef")),t.set("timeoutRef",void 0),t.set("timeoutRef",setTimeout(()=>{e({type:"SCROLL.END"})},200))};i();let o=ae(r,"scroll",()=>{i()},{passive:!0});return()=>{o(),clearTimeout(t.get("timeoutRef")),t.set("timeoutRef",void 0)}},trackDocumentVisibility({scope:e,send:t}){let n=e.getDoc();return ae(n,"visibilitychange",()=>{n.visibilityState!=="visible"&&t({type:"AUTOPLAY.PAUSE",src:"doc.hidden"})})},trackPointerMove({scope:e,send:t}){let n=e.getDoc();return pn(n,{onPointerMove({event:r}){t({type:"DRAGGING",left:-r.movementX,top:-r.movementY})},onPointerUp(){t({type:"DRAGGING.END"})}})},trackKeyboardScroll({scope:e,send:t,context:n}){let r=e.getWin();return ae(r,"keydown",a=>{switch(a.key){case"ArrowRight":a.preventDefault(),t({type:"PAGE.NEXT"});break;case"ArrowLeft":a.preventDefault(),t({type:"PAGE.PREV"});break;case"Home":a.preventDefault(),t({type:"PAGE.SET",index:0});break;case"End":a.preventDefault(),t({type:"PAGE.SET",index:n.get("pageSnapPoints").length-1})}},{capture:!0})}},actions:{clearScrollEndTimer({refs:e}){e.get("timeoutRef")!=null&&(clearTimeout(e.get("timeoutRef")),e.set("timeoutRef",void 0))},scrollToPage({context:e,event:t,scope:n,computed:r,flush:i}){var c;let a=t.instant?"instant":"smooth",o=Ae((c=t.index)!=null?c:e.get("page"),0,e.get("pageSnapPoints").length-1),s=tt(n);if(!s)return;let l=r("isHorizontal")?"left":"top";i(()=>{s.scrollTo({[l]:e.get("pageSnapPoints")[o],behavior:a})})},scrollToPageIfDrifted({context:e,scope:t,computed:n}){let r=tt(t);if(!r)return;let i=e.get("pageSnapPoints")[e.get("page")];if(i==null)return;let a=n("isHorizontal")?r.scrollLeft:r.scrollTop;if(Math.abs(a-i)<=XC)return;let o=n("isHorizontal")?"left":"top";r.scrollTo({[o]:i,behavior:"instant"})},setClosestPage({context:e,scope:t,computed:n}){let r=tt(t);if(!r)return;let i=n("isHorizontal")?r.scrollLeft:r.scrollTop,a=e.get("pageSnapPoints");if(!a.length)return;let o=a.reduce((s,l,c)=>{let d=Math.abs(l-i),u=Math.abs(a[s]-i);return ds.dataset.index===t.index.toString());if(a==null)return;let o=e.get("pageSnapPoints").findIndex(s=>Math.abs(s-a)<1);e.set("page",o)},setPage({context:e,event:t}){var r;let n=(r=t.index)!=null?r:e.get("page");e.set("page",n)},setSnapPoints({context:e,computed:t,scope:n}){let r=tt(n);if(!r)return;let i=jC(r),a=t("isHorizontal")?i.x:i.y;if(e.set("pageSnapPoints",a),!a.length)return;let o=Ae(e.get("page"),0,a.length-1);e.set("page",o)},disableScrollSnap({scope:e}){let t=tt(e);if(!t)return;let n=getComputedStyle(t);t.dataset.scrollSnapType=n.getPropertyValue("scroll-snap-type"),t.style.setProperty("scroll-snap-type","none")},scrollSlides({scope:e,event:t}){let n=tt(e);n==null||n.scrollBy({left:t.left,top:t.top,behavior:"instant"})},endDragging({scope:e,context:t,computed:n}){let r=tt(e);if(!r)return;let i=n("isHorizontal"),a=i?r.scrollLeft:r.scrollTop,o=t.get("pageSnapPoints");if(!o.length)return;let s=o.reduce((l,c)=>Math.abs(c-a){r.scrollTo({left:i?s:r.scrollLeft,top:i?r.scrollTop:s,behavior:"smooth"});let l=r.dataset.scrollSnapType;l&&(r.style.setProperty("scroll-snap-type",l),delete r.dataset.scrollSnapType)})},focusIndicatorEl({context:e,event:t,scope:n}){if(t.src!=="indicator")return;let r=WC(n,e.get("page"));r&&B(()=>r.focus({preventScroll:!0}))},invokeDragStart({context:e,prop:t}){var n;(n=t("onDragStatusChange"))==null||n({type:"dragging.start",isDragging:!0,page:e.get("page")})},invokeDragging({context:e,prop:t}){var n;(n=t("onDragStatusChange"))==null||n({type:"dragging",isDragging:!0,page:e.get("page")})},invokeDraggingEnd({context:e,prop:t}){var n;(n=t("onDragStatusChange"))==null||n({type:"dragging.end",isDragging:!1,page:e.get("page")})},invokeAutoplay({context:e,prop:t}){var n;(n=t("onAutoplayStatusChange"))==null||n({type:"autoplay",isPlaying:!0,page:e.get("page")})},invokeAutoplayStart({context:e,prop:t}){var n;(n=t("onAutoplayStatusChange"))==null||n({type:"autoplay.start",isPlaying:!0,page:e.get("page")})},invokeAutoplayEnd({context:e,prop:t}){var n;(n=t("onAutoplayStatusChange"))==null||n({type:"autoplay.stop",isPlaying:!1,page:e.get("page")})}}}});QC=class extends X{initMachine(e){return new Y(ZC,e)}initApi(){return this.zagConnect(KC)}updateProps(e){super.updateProps(e),this.machine.service.send({type:"SNAP.REFRESH"})}render(){var d;let e=(d=this.el.querySelector('[data-scope="carousel"][data-part="root"]'))!=null?d:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="carousel"][data-part="control"]');t&&this.spreadProps(t,this.api.getControlProps());let n=this.el.querySelector('[data-scope="carousel"][data-part="item-group"]');n&&this.spreadProps(n,this.api.getItemGroupProps());let r=Number(this.el.dataset.slideCount)||0;for(let u=0;uj(this.liveSocket),r=O(e,"controlled"),i=U(e,"slideCount");if(i==null||i<1)return;let a=new QC(e,y(h({id:e.id,slideCount:i},r?{page:al(e,"page")}:{defaultPage:al(e,"defaultPage")}),{dir:q(e),orientation:V(e,"orientation"),slidesPerPage:U(e,"slidesPerPage"),slidesPerMove:V(e,"slidesPerMove")==="auto"?"auto":U(e,"slidesPerMove"),loop:O(e,"loop"),autoplay:O(e,"autoplay")?{delay:U(e,"autoplayDelay")}:!1,allowMouseDrag:O(e,"allowMouseDrag"),spacing:V(e,"spacing"),padding:V(e,"padding"),inViewThreshold:U(e,"inViewThreshold"),snapType:V(e,"snapType"),autoSize:O(e,"autoSize"),onPageChange:l=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,page:Nf(l.page),pageSnapPoint:l.pageSnapPoint},serverEventName:V(e,"onPageChange"),clientEventName:V(e,"onPageChangeClient")})}}));a.init(),this.carousel=a;let o=ie(e);this.domRegistry=o,o.add("corex:carousel:play",()=>{a.api.play()}),o.add("corex:carousel:pause",()=>{a.api.pause()}),o.add("corex:carousel:scroll-next",l=>{a.api.scrollNext(co(l.detail))}),o.add("corex:carousel:scroll-prev",l=>{a.api.scrollPrev(co(l.detail))});let s=re(this);this.handleRegistry=s,s.add("carousel_play",l=>{$(e.id,H(l))&&a.api.play()}),s.add("carousel_pause",l=>{$(e.id,H(l))&&a.api.pause()}),s.add("carousel_scroll_next",l=>{$(e.id,H(l))&&a.api.scrollNext(co(l))}),s.add("carousel_scroll_prev",l=>{$(e.id,H(l))&&a.api.scrollPrev(co(l))})},updated(){var n;let e=U(this.el,"slideCount");if(e==null||e<1)return;let t=O(this.el,"controlled");(n=this.carousel)==null||n.updateProps(y(h({id:this.el.id,slideCount:e},t?{page:al(this.el,"page")}:{}),{dir:q(this.el),orientation:V(this.el,"orientation"),slidesPerPage:U(this.el,"slidesPerPage"),slidesPerMove:V(this.el,"slidesPerMove")==="auto"?"auto":U(this.el,"slidesPerMove"),loop:O(this.el,"loop"),autoplay:O(this.el,"autoplay")?{delay:U(this.el,"autoplayDelay")}:!1,allowMouseDrag:O(this.el,"allowMouseDrag"),spacing:V(this.el,"spacing"),padding:V(this.el,"padding"),inViewThreshold:U(this.el,"inViewThreshold"),snapType:V(this.el,"snapType"),autoSize:O(this.el,"autoSize")}))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.carousel)==null||n.destroy()}}});function _d(e){let t=h({},e);return delete t.defaultChecked,delete t.checked,t}function ol(e,t,n,r,i){r(e,_d(i)),e.checked=n,it(e,t)}var sl=ee(()=>{"use strict";oe()});function t0(e){return!(e.metaKey||!$i()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function r0(e,t,n){let r=n?ne(n):null,i=Ue(r),a=ye(r),o=gr(i);return e=e||o instanceof a.HTMLInputElement&&!n0.has(o==null?void 0:o.type)||o instanceof a.HTMLTextAreaElement||o instanceof a.HTMLElement&&o.isContentEditable,!(e&&t==="keyboard"&&n instanceof a.KeyboardEvent&&!Reflect.has(i0,n.key))}function dl(e,t){for(let n of $d)n(e,t)}function cl(e){ti=!0,t0(e)&&(Kn="keyboard",dl("keyboard",e))}function Gt(e){Kn="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(ti=!0,dl("pointer",e))}function Mf(e){hh(e)&&(ti=!0,Kn="virtual")}function _f(e){let t=ne(e);t===ye(t)||t===Ue(t)||Ff||!e.isTrusted||(!ti&&!Hd&&(Kn="virtual",dl("virtual",e)),ti=!1,Hd=!1)}function $f(){Ff||(ti=!1,Hd=!0)}function a0(e){if(typeof window=="undefined"||ll.get(ye(e)))return;let t=ye(e),n=Ue(e),r=t.HTMLElement.prototype.focus;function i(){ti=!0,r.apply(this,arguments)}try{Object.defineProperty(t.HTMLElement.prototype,"focus",{configurable:!0,value:i})}catch(a){}n.addEventListener("keydown",cl,!0),n.addEventListener("keyup",cl,!0),n.addEventListener("click",Mf,!0),t.addEventListener("focus",_f,!0),t.addEventListener("blur",$f,!1),typeof t.PointerEvent!="undefined"?(n.addEventListener("pointerdown",Gt,!0),n.addEventListener("pointermove",Gt,!0),n.addEventListener("pointerup",Gt,!0)):(n.addEventListener("mousedown",Gt,!0),n.addEventListener("mousemove",Gt,!0),n.addEventListener("mouseup",Gt,!0)),t.addEventListener("beforeunload",()=>{o0(e)},{once:!0}),ll.set(t,{focus:r})}function Sr(){return Kn}function Ir(e){Kn=e,dl(e,null)}function vn(){return Kn==="keyboard"||Kn==="virtual"}function nt(e={}){let{isTextInput:t,autoFocus:n,onChange:r,root:i}=e;a0(i),r==null||r({isFocusVisible:n||vn(),modality:Kn});let a=(o,s)=>{r0(!!t,o,s)&&(r==null||r({isFocusVisible:vn(),modality:o}))};return $d.add(a),()=>{$d.delete(a)}}var n0,Kn,$d,ll,ti,Hd,Ff,i0,o0,yn=ee(()=>{"use strict";oe();n0=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);Kn=null,$d=new Set,ll=new Map,ti=!1,Hd=!1,Ff=!1,i0={Tab:!0,Escape:!0};o0=(e,t)=>{let n=ye(e),r=Ue(e);t&&r.removeEventListener("DOMContentLoaded",t);let i=ll.get(n);if(i){try{Object.defineProperty(n.HTMLElement.prototype,"focus",{configurable:!0,value:i.focus})}catch(a){}r.removeEventListener("keydown",cl,!0),r.removeEventListener("keyup",cl,!0),r.removeEventListener("click",Mf,!0),n.removeEventListener("focus",_f,!0),n.removeEventListener("blur",$f,!1),typeof n.PointerEvent!="undefined"?(r.removeEventListener("pointerdown",Gt,!0),r.removeEventListener("pointermove",Gt,!0),r.removeEventListener("pointerup",Gt,!0)):(r.removeEventListener("mousedown",Gt,!0),r.removeEventListener("mousemove",Gt,!0),r.removeEventListener("mouseup",Gt,!0)),ll.delete(n)}}});var Uf={};pe(Uf,{Checkbox:()=>h0,checkedChangePayload:()=>zi});function d0(e,t){let{send:n,context:r,prop:i,computed:a,scope:o}=e,s=!!i("disabled"),l=!!i("readOnly"),c=!!i("required"),d=!!i("invalid"),u=!s&&r.get("focused"),p=!s&&r.get("focusVisible"),g=a("checked"),f=a("indeterminate"),m=r.get("checked"),S={"data-active":b(r.get("active")),"data-focus":b(u),"data-focus-visible":b(p),"data-readonly":b(l),"data-hover":b(r.get("hovered")),"data-disabled":b(s),"data-state":f?"indeterminate":g?"checked":"unchecked","data-invalid":b(d),"data-required":b(c)};return{checked:g,disabled:s,indeterminate:f,focused:u,checkedState:m,setChecked(T){n({type:"CHECKED.SET",checked:T,isTrusted:!1})},toggleChecked(){n({type:"CHECKED.TOGGLE",checked:g,isTrusted:!1})},getRootProps(){return t.label(y(h(h({},ul.root.attrs),S),{dir:i("dir"),id:Gf(o),htmlFor:Bd(o),onPointerMove(){s||n({type:"CONTEXT.SET",context:{hovered:!0}})},onPointerLeave(){s||n({type:"CONTEXT.SET",context:{hovered:!1}})},onClick(T){ne(T)===uo(o)&&T.stopPropagation()}}))},getLabelProps(){return t.element(y(h(h({},ul.label.attrs),S),{dir:i("dir"),id:Hf(o)}))},getControlProps(){return t.element(y(h(h({},ul.control.attrs),S),{dir:i("dir"),id:l0(o),"aria-hidden":!0}))},getIndicatorProps(){return t.element(y(h(h({},ul.indicator.attrs),S),{dir:i("dir"),hidden:!f&&!g}))},getHiddenInputProps(){return t.input({id:Bd(o),type:"checkbox",required:i("required"),defaultChecked:g,disabled:s,"aria-labelledby":Hf(o),"aria-invalid":d,name:i("name"),form:i("form"),value:i("value"),style:mt,onFocus(){let T=vn();n({type:"CONTEXT.SET",context:{focused:!0,focusVisible:T}})},onBlur(){n({type:"CONTEXT.SET",context:{focused:!1,focusVisible:!1}})},onClick(T){if(l){T.preventDefault();return}let w=T.currentTarget.checked;n({type:"CHECKED.SET",checked:w,isTrusted:!0})}})}}}function gl(e){return e==="indeterminate"}function g0(e){return gl(e)?!1:!!e}var s0,ul,Gf,Hf,l0,Bd,c0,uo,Bf,u0,p0,h0,qf=ee(()=>{"use strict";sl();yn();$e();Ve();be();oe();s0=z("checkbox").parts("root","label","control","indicator"),ul=s0.build(),Gf=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`checkbox:${e.id}`},Hf=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`checkbox:${e.id}:label`},l0=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`checkbox:${e.id}:control`},Bd=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`checkbox:${e.id}:input`},c0=e=>e.getById(Gf(e)),uo=e=>e.getById(Bd(e));({not:Bf}=we()),u0=te({props({props:e}){var t;return y(h({value:"on"},e),{defaultChecked:(t=e.defaultChecked)!=null?t:!1})},initialState(){return"ready"},context({prop:e,bindable:t}){return{checked:t(()=>({defaultValue:e("defaultChecked"),value:e("checked"),onChange(n){var r;(r=e("onCheckedChange"))==null||r({checked:n})}})),fieldsetDisabled:t(()=>({defaultValue:!1})),focusVisible:t(()=>({defaultValue:!1})),active:t(()=>({defaultValue:!1})),focused:t(()=>({defaultValue:!1})),hovered:t(()=>({defaultValue:!1}))}},watch({track:e,context:t,prop:n,action:r}){e([()=>n("disabled")],()=>{r(["removeFocusIfNeeded"])}),e([()=>t.get("checked")],()=>{r(["syncInputElement"])})},effects:["trackFormControlState","trackPressEvent","trackFocusVisible"],on:{"CHECKED.TOGGLE":[{guard:Bf("isTrusted"),actions:["toggleChecked","dispatchChangeEvent"]},{actions:["toggleChecked"]}],"CHECKED.SET":[{guard:Bf("isTrusted"),actions:["setChecked","dispatchChangeEvent"]},{actions:["setChecked"]}],"CONTEXT.SET":{actions:["setContext"]}},computed:{indeterminate:({context:e})=>gl(e.get("checked")),checked:({context:e})=>g0(e.get("checked")),disabled:({context:e,prop:t})=>!!t("disabled")||e.get("fieldsetDisabled")},states:{ready:{}},implementations:{guards:{isTrusted:({event:e})=>!!e.isTrusted},effects:{trackPressEvent({context:e,computed:t,scope:n}){if(!t("disabled"))return Ds({pointerNode:c0(n),keyboardNode:uo(n),isValidKey:r=>r.key===" ",onPress:()=>e.set("active",!1),onPressStart:()=>e.set("active",!0),onPressEnd:()=>e.set("active",!1)})},trackFocusVisible({computed:e,scope:t}){var n;if(!e("disabled"))return nt({root:(n=t.getRootNode)==null?void 0:n.call(t)})},trackFormControlState({context:e,scope:t}){return ht(uo(t),{onFieldsetDisabledChange(n){e.set("fieldsetDisabled",n)},onFormReset(){e.set("checked",e.initial("checked"))}})}},actions:{setContext({context:e,event:t}){for(let n in t.context)e.set(n,t.context[n])},syncInputElement({context:e,computed:t,scope:n}){let r=uo(n);r&&(ja(r,t("checked")),r.indeterminate=gl(e.get("checked")))},removeFocusIfNeeded({context:e,prop:t}){t("disabled")&&e.get("focused")&&(e.set("focused",!1),e.set("focusVisible",!1))},setChecked({context:e,event:t}){e.set("checked",t.checked)},toggleChecked({context:e,computed:t}){let n=gl(t("checked"))?!0:!t("checked");e.set("checked",n)},dispatchChangeEvent({computed:e,scope:t}){queueMicrotask(()=>{let n=uo(t);Bi(n,{checked:e("checked")})})}}}});p0=class extends X{initMachine(e){return new Y(u0,e)}initApi(){return this.zagConnect(d0)}render(){let e=this.el.querySelector('[data-scope="checkbox"][data-part="root"]');if(!e)return;this.spreadProps(e,this.api.getRootProps());let t=e.querySelector(':scope > [data-scope="checkbox"][data-part="hidden-input"]');t instanceof HTMLInputElement&&ol(t,this.el,this.api.checked===!0,(i,a)=>this.spreadProps(i,a),this.api.getHiddenInputProps());let n=e.querySelector(':scope > [data-scope="checkbox"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps());let r=e.querySelector(':scope > [data-scope="checkbox"][data-part="control"]');if(r){this.spreadProps(r,this.api.getControlProps());let i=r.querySelector(':scope > [data-scope="checkbox"][data-part="indicator"]');i&&this.spreadProps(i,this.api.getIndicatorProps())}}},h0={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=new p0(e,y(h({id:e.id},Us(e)),{disabled:O(e,"disabled"),name:V(e,"name"),form:V(e,"form"),value:V(e,"value"),dir:q(e),invalid:O(e,"invalid"),required:O(e,"required"),readOnly:O(e,"readonly"),onCheckedChange:s=>{W({el:e,canPushServer:n(),pushEvent:t,payload:zi(e,s),serverEventName:V(e,"onCheckedChange"),clientEventName:V(e,"onCheckedChangeClient")});let l=e.querySelector('[data-scope="checkbox"][data-part="hidden-input"]');l&&queueMicrotask(()=>{l.checked=s.checked===!0,l.dispatchEvent(new Event("input",{bubbles:!0})),l.dispatchEvent(new Event("change",{bubbles:!0}))})}}));r.init(),this.checkbox=r;let i=ie(e);this.domRegistry=i,i.add("corex:checkbox:set-checked",s=>{let{checked:l}=s.detail;r.api.setChecked(l)}),i.add("corex:checkbox:toggle-checked",()=>{r.api.toggleChecked()});let a=re(this);this.handleRegistry=a,a.add("checkbox_set_checked",s=>{if(!$(e.id,H(s)))return;let l=Ys(s);typeof l=="boolean"&&r.api.setChecked(l)}),a.add("checkbox_toggle_checked",s=>{$(e.id,H(s))&&r.api.toggleChecked()});let o=(s,l,c,d)=>{let u={id:e.id,value:d};Ge({respondTo:s,canPushServer:n(),pushEvent:t,serverEventName:l,serverPayload:u,el:e,domEventName:c,domDetail:u})};a.add("checkbox_checked",s=>{$(e.id,H(s))&&o(de(s),"checkbox_checked_response","corex:checkbox:checked",r.api.checked)}),a.add("checkbox_focused",s=>{$(e.id,H(s))&&o(de(s),"checkbox_focused_response","corex:checkbox:focused",r.api.focused)}),a.add("checkbox_disabled",s=>{$(e.id,H(s))&&o(de(s),"checkbox_disabled_response","corex:checkbox:disabled",r.api.disabled)})},updated(){let e=this.checkbox;e&&e.updateProps(y(h({id:this.el.id},Gs(this.el)),{disabled:O(this.el,"disabled"),name:V(this.el,"name"),form:V(this.el,"form"),value:V(this.el,"value"),dir:q(this.el),invalid:O(this.el,"invalid"),required:O(this.el,"required"),readOnly:O(this.el,"readonly")}))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.checkbox)==null||n.destroy()}}});function Kf(e,t){let n=new Wf(({now:r,deltaMs:i})=>{if(i>=t){let a=t>0?r-i%t:r;n.setStartMs(a),e({startMs:a,deltaMs:i})}});return n.start(),()=>n.stop()}function Tr(e,t){let n=new Wf(({deltaMs:r})=>{if(r>=t)return e(),!1});return n.start(),()=>n.stop()}var pl,hl,Wf,fl=ee(()=>{"use strict";oe();pl=()=>performance.now(),Wf=class{constructor(e){dn(this,"onTick",e),dn(this,"frameId",null),dn(this,"pausedAtMs",null),dn(this,"context"),dn(this,"cancelFrame",()=>{this.frameId!==null&&(cancelAnimationFrame(this.frameId),this.frameId=null)}),dn(this,"setStartMs",t=>{this.context.startMs=t}),dn(this,"start",()=>{if(this.frameId!==null)return;let t=pl();this.pausedAtMs!==null?(this.context.startMs+=t-this.pausedAtMs,this.pausedAtMs=null):this.context.startMs=t,this.frameId=requestAnimationFrame(jc(this,hl))}),dn(this,"pause",()=>{this.frameId!==null&&(this.cancelFrame(),this.pausedAtMs=pl())}),dn(this,"stop",()=>{this.frameId!==null&&(this.cancelFrame(),this.pausedAtMs=null)}),qp(this,hl,t=>{if(this.context.now=t,this.context.deltaMs=t-this.context.startMs,this.onTick(this.context)===!1){this.stop();return}this.frameId=requestAnimationFrame(jc(this,hl))}),this.context={now:0,startMs:pl(),deltaMs:0}}get elapsedMs(){return this.pausedAtMs!==null?this.pausedAtMs-this.context.startMs:pl()-this.context.startMs}};hl=new WeakMap});var jf={};pe(jf,{Clipboard:()=>w0,copyPayload:()=>zf});function E0(e,t){let n=e.createElement("pre");return Object.assign(n.style,{width:"1px",height:"1px",position:"fixed",top:"5px"}),n.textContent=t,n}function P0(e){let n=ye(e).getSelection();if(n==null)return Promise.reject(new Error);n.removeAllRanges();let r=e.ownerDocument,i=r.createRange();return i.selectNodeContents(e),n.addRange(i),r.execCommand("copy"),n.removeAllRanges(),Promise.resolve()}function S0(e,t){var i;let n=e.defaultView||window;if(((i=n.navigator.clipboard)==null?void 0:i.writeText)!==void 0)return n.navigator.clipboard.writeText(t);if(!e.body)return Promise.reject(new Error);let r=E0(e,t);return e.body.appendChild(r),P0(r),e.body.removeChild(r),Promise.resolve()}function I0(e,t){let{state:n,send:r,context:i,scope:a,prop:o}=e,s=n.matches("copied"),l=o("translations");return{copied:s,value:i.get("value"),setValue(c){r({type:"VALUE.SET",value:c})},copy(){r({type:"COPY"})},getRootProps(){return t.element(y(h({},Zi.root.attrs),{"data-copied":b(s),id:m0(a)}))},getLabelProps(){return t.label(y(h({},Zi.label.attrs),{htmlFor:Gd(a),"data-copied":b(s),id:v0(a)}))},getControlProps(){return t.element(y(h({},Zi.control.attrs),{"data-copied":b(s)}))},getInputProps(){return t.input(y(h({},Zi.input.attrs),{defaultValue:i.get("value"),"data-copied":b(s),readOnly:!0,"data-readonly":"true",id:Gd(a),onFocus(c){c.currentTarget.select()},onCopy(){r({type:"INPUT.COPY"})}}))},getTriggerProps(){var c;return t.button(y(h({},Zi.trigger.attrs),{type:"button","aria-label":(c=l.triggerLabel)==null?void 0:c.call(l,s),"data-copied":b(s),onClick(){r({type:"COPY"})}}))},getIndicatorProps(c){return t.element(y(h({},Zi.indicator.attrs),{hidden:c.copied!==s}))}}}function zf(e,t){return{id:e.id,value:t}}var f0,Zi,m0,Gd,v0,y0,b0,T0,C0,w0,Yf=ee(()=>{"use strict";fl();Ve();be();oe();f0=z("clipboard").parts("root","control","trigger","indicator","input","label"),Zi=f0.build(),m0=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`clip:${e.id}`},Gd=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`clip:${e.id}:input`},v0=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`clip:${e.id}:label`},y0=e=>e.getById(Gd(e)),b0=(e,t)=>S0(e.getDoc(),t);T0=te({props({props:e}){return y(h({timeout:3e3,defaultValue:""},e),{translations:h({triggerLabel:t=>t?"Copied to clipboard":"Copy to clipboard"},e.translations)})},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var r;(r=e("onValueChange"))==null||r({value:n})}}))}},watch({track:e,context:t,action:n}){e([()=>t.get("value")],()=>{n(["syncInputElement"])})},on:{"VALUE.SET":{actions:["setValue"]},COPY:{target:"copied",actions:["copyToClipboard","invokeOnCopy"]}},states:{idle:{on:{"INPUT.COPY":{target:"copied",actions:["invokeOnCopy"]}}},copied:{effects:["waitForTimeout"],on:{"COPY.DONE":{target:"idle"},COPY:{target:"copied",actions:["copyToClipboard","invokeOnCopy"]},"INPUT.COPY":{actions:["invokeOnCopy"]}}}},implementations:{effects:{waitForTimeout({prop:e,send:t}){return Tr(()=>{t({type:"COPY.DONE"})},e("timeout"))}},actions:{setValue({context:e,event:t}){e.set("value",t.value)},copyToClipboard({context:e,scope:t}){b0(t,e.get("value"))},invokeOnCopy({prop:e}){var t;(t=e("onStatusChange"))==null||t({copied:!0})},syncInputElement({context:e,scope:t}){let n=y0(t);n&&_e(n,e.get("value"))}}}}),C0=class extends X{initMachine(e){return new Y(T0,e)}initApi(){return this.zagConnect(I0)}render(){let e=this.el.querySelector('[data-scope="clipboard"][data-part="root"]');if(e){this.spreadProps(e,this.api.getRootProps());let t=e.querySelector('[data-scope="clipboard"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=e.querySelector('[data-scope="clipboard"][data-part="control"]');if(n){this.spreadProps(n,this.api.getControlProps());let r=n.querySelector('[data-scope="clipboard"][data-part="input"]');if(r){let a=h({},this.api.getInputProps()),o=this.el.dataset.inputAriaLabel;o&&(a["aria-label"]=o),this.spreadProps(r,a)}let i=n.querySelector('[data-scope="clipboard"][data-part="trigger"]');if(i){let a=h({},this.api.getTriggerProps()),o=this.el.dataset.triggerAriaLabel;o&&(a["aria-label"]=o),this.spreadProps(i,a)}}}}};w0={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=new C0(e,{id:e.id,timeout:U(e,"timeout"),defaultValue:V(e,"defaultValue"),onStatusChange:o=>{var l;if((o==null?void 0:o.copied)!==!0)return;let s=(l=r.api.value)!=null?l:V(e,"defaultValue");W({el:e,canPushServer:n(),pushEvent:t,payload:zf(e,s),serverEventName:V(e,"onCopy"),clientEventName:V(e,"onCopyClient")})}});r.init(),this.clipboard=r;let i=ie(e);this.domRegistry=i,i.add("corex:clipboard:copy",()=>{r.api.copy()}),i.add("corex:clipboard:set-value",o=>{var l;let s=(l=o.detail)==null?void 0:l.value;typeof s=="string"&&r.api.setValue(s)});let a=re(this);this.handleRegistry=a,a.add("clipboard_copy",o=>{$(e.id,H(o))&&r.api.copy()}),a.add("clipboard_set_value",o=>{var c;if(!$(e.id,H(o))||!o||typeof o!="object")return;let s=o,l=(c=s.value)!=null?c:s.value;typeof l=="string"&&r.api.setValue(l)})},updated(){var e;(e=this.clipboard)==null||e.updateProps({id:this.el.id,timeout:U(this.el,"timeout")})},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.clipboard)==null||n.destroy()}}});var Zf={};pe(Zf,{Collapsible:()=>N0,openChangePayload:()=>Xf});function x0(e,t){let{state:n,send:r,context:i,scope:a,prop:o}=e,s=n.matches("open")||n.matches("closing"),l=n.matches("open"),c=n.matches("closed"),{width:d,height:u}=i.get("size"),p=!!o("disabled"),g=o("collapsedHeight"),f=o("collapsedWidth"),m=g!=null,S=f!=null,T=m||S,w=!i.get("initial")&&l;return{disabled:p,visible:s,open:l,measureSize(){r({type:"size.measure"})},setOpen(I){n.matches("open")!==I&&r({type:I?"open":"close"})},getRootProps(){return t.element(y(h({},ml.root.attrs),{"data-state":l?"open":"closed",dir:o("dir"),id:V0(a)}))},getContentProps(){return t.element(y(h({},ml.content.attrs),{id:Ud(a),"data-collapsible":"","data-state":w?void 0:l?"open":"closed","data-disabled":b(p),"data-has-collapsed-size":b(T),hidden:!s&&!T,dir:o("dir"),style:h(h({"--height":ke(u),"--width":ke(d),"--collapsed-height":ke(g),"--collapsed-width":ke(f)},c&&m&&{overflow:"hidden",minHeight:ke(g),maxHeight:ke(g)}),c&&S&&{overflow:"hidden",minWidth:ke(f),maxWidth:ke(f)})}))},getTriggerProps(){return t.element(y(h({},ml.trigger.attrs),{id:A0(a),dir:o("dir"),type:"button","data-state":l?"open":"closed","data-disabled":b(p),"aria-controls":Ud(a),"aria-expanded":s||!1,onClick(I){I.defaultPrevented||p||r({type:l?"close":"open"})}}))},getIndicatorProps(){return t.element(y(h({},ml.indicator.attrs),{dir:o("dir"),"data-state":l?"open":"closed","data-disabled":b(p)}))}}}function Xf(e,t){return{id:e.id,open:t.open}}var O0,ml,V0,Ud,A0,go,R0,k0,N0,Jf=ee(()=>{"use strict";Bt();$e();Ve();be();oe();O0=z("collapsible").parts("root","trigger","content","indicator"),ml=O0.build(),V0=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`collapsible:${e.id}`},Ud=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`collapsible:${e.id}:content`},A0=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`collapsible:${e.id}:trigger`},go=e=>e.getById(Ud(e));R0=te({initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"closed"},context({bindable:e}){return{size:e(()=>({defaultValue:{height:0,width:0},sync:!0})),initial:e(()=>({defaultValue:!1}))}},refs(){return{cleanup:void 0,stylesRef:void 0}},watch({track:e,prop:t,action:n}){e([()=>t("open")],()=>{n(["setInitial","computeSize","toggleVisibility"])})},exit:["cleanupNode"],states:{closed:{effects:["trackTabbableElements"],on:{"controlled.open":{target:"open"},open:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitial","computeSize","invokeOnOpen"]}]}},closing:{effects:["trackExitAnimation"],on:{"controlled.close":{target:"closed"},"controlled.open":{target:"open"},open:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitial","invokeOnOpen"]}],close:[{guard:"isOpenControlled",actions:["invokeOnExitComplete"]},{target:"closed",actions:["setInitial","computeSize","invokeOnExitComplete"]}],"animation.end":{target:"closed",actions:["invokeOnExitComplete","clearInitial"]}}},open:{effects:["trackEnterAnimation"],on:{"controlled.close":{target:"closing"},close:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closing",actions:["setInitial","computeSize","invokeOnClose"]}],"size.measure":{actions:["measureSize"]},"animation.end":{actions:["clearInitial"]}}}},implementations:{guards:{isOpenControlled:({prop:e})=>e("open")!=null},effects:{trackEnterAnimation:({send:e,scope:t})=>{let n,r=B(()=>{let i=go(t);if(!i)return;let a=pt(i).animationName;if(!a||a==="none"){e({type:"animation.end"});return}let s=l=>{ne(l)===i&&e({type:"animation.end"})};i.addEventListener("animationend",s),n=()=>{i.removeEventListener("animationend",s)}});return()=>{r(),n==null||n()}},trackExitAnimation:({send:e,scope:t})=>{let n,r=B(()=>{let i=go(t);if(!i)return;let a=pt(i).animationName;if(!a||a==="none"){e({type:"animation.end"});return}let s=c=>{ne(c)===i&&e({type:"animation.end"})};i.addEventListener("animationend",s);let l=Xr(i,{animationFillMode:"forwards"});n=()=>{i.removeEventListener("animationend",s),Yr(()=>l())}});return()=>{r(),n==null||n()}},trackTabbableElements:({scope:e,prop:t})=>{if(!t("collapsedHeight")&&!t("collapsedWidth"))return;let n=go(e);if(!n)return;let r=()=>{let s=Bn(n).map(l=>Ih(l,"inert",""));return()=>{s.forEach(l=>l())}},i=r(),a=Ls(n,{callback(){i(),i=r()}});return()=>{i(),a()}}},actions:{setInitial:({context:e,flush:t})=>{t(()=>{e.set("initial",!0)})},clearInitial:({context:e})=>{e.set("initial",!1)},cleanupNode:({refs:e})=>{e.set("stylesRef",null)},measureSize:({context:e,scope:t})=>{let n=go(t);if(!n)return;let{height:r,width:i}=n.getBoundingClientRect();e.set("size",{height:r,width:i})},computeSize:({refs:e,scope:t,context:n})=>{var i;(i=e.get("cleanup"))==null||i();let r=B(()=>{let a=go(t);if(!a)return;let o=a.hidden;a.style.animationName="none",a.style.animationDuration="0s",a.hidden=!1;let s=a.getBoundingClientRect();n.set("size",{height:s.height,width:s.width}),n.get("initial")&&(a.style.animationName="",a.style.animationDuration=""),a.hidden=o});e.set("cleanup",r)},invokeOnOpen:({prop:e})=>{var t;(t=e("onOpenChange"))==null||t({open:!0})},invokeOnClose:({prop:e})=>{var t;(t=e("onOpenChange"))==null||t({open:!1})},invokeOnExitComplete:({prop:e})=>{var t;(t=e("onExitComplete"))==null||t()},toggleVisibility:({prop:e,send:t})=>{t({type:e("open")?"controlled.open":"controlled.close"})}}}}),k0=class extends X{initMachine(e){return new Y(R0,e)}initApi(){return this.zagConnect(x0)}render(){let e=this.el.dataset.orientation,t=this.el.querySelector('[data-scope="collapsible"][data-part="root"]');if(t){this.spreadProps(t,this.api.getRootProps()),e&&(t.dataset.orientation=e);let n=t.querySelector('[data-scope="collapsible"][data-part="trigger"]');n&&(this.spreadProps(n,this.api.getTriggerProps()),e&&(n.dataset.orientation=e));let r=t.querySelector('[data-scope="collapsible"][data-part="content"]');r&&(this.spreadProps(r,this.api.getContentProps()),e&&(r.dataset.orientation=e))}}};N0={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=new k0(e,y(h({id:e.id},zs(e,"open","defaultOpen")),{disabled:O(e,"disabled"),dir:q(e),onOpenChange:s=>{W({el:e,canPushServer:n(),pushEvent:t,payload:Xf(e,s),serverEventName:V(e,"onOpenChange"),clientEventName:V(e,"onOpenChangeClient")})}}));r.init(),this.collapsible=r;let i=s=>{Ge({respondTo:s,canPushServer:n(),pushEvent:t,serverEventName:"collapsible_open_response",serverPayload:{id:e.id,open:r.api.open,disabled:r.api.disabled},el:e,domEventName:"collapsible-open",domDetail:{id:e.id,open:r.api.open,disabled:r.api.disabled}})},a=ie(e);this.domRegistry=a,a.add("corex:collapsible:set-open",s=>{let{open:l}=s.detail;r.api.setOpen(l)}),a.add("corex:collapsible:open",s=>{i(de(s.detail))});let o=re(this);this.handleRegistry=o,o.add("collapsible_set_open",s=>{$(e.id,H(s))&&r.api.setOpen(s.open)}),o.add("collapsible_open",s=>{$(e.id,H(s))&&i(de(s))})},updated(){var e;(e=this.collapsible)==null||e.updateProps(y(h({id:this.el.id},Bs(this.el,"open","defaultOpen")),{disabled:O(this.el,"disabled"),dir:q(this.el)}))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.collapsible)==null||n.destroy()}}});function L0(e){return V(e,"submitName")!==void 0}function Ji(e,t,n=["hidden-input"]){if(L0(e))for(let r of n){let i=e.querySelector(`[data-scope="${t}"][data-part="${r}"]`);i&&(i.removeAttribute("name"),i.removeAttribute("form"))}}var vl=ee(()=>{"use strict";oe()});function Qi(e={}){var c;let{level:t="polite",document:n=document,root:r,delay:i=0}=e,a=(c=n.defaultView)!=null?c:window,o=r!=null?r:n.body;function s(d,u){let p=n.getElementById(yl);p==null||p.remove(),u=u!=null?u:i;let g=n.createElement("span");g.id=yl,g.dataset.liveAnnouncer="true";let f=t!=="assertive"?"status":"alert";g.setAttribute("aria-live",t),g.setAttribute("role",f),Object.assign(g.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}),o.appendChild(g),a.setTimeout(()=>{g.textContent=d},u)}function l(){let d=n.getElementById(yl);d==null||d.remove()}return{announce:s,destroy:l,toJSON(){return yl}}}var yl,bl=ee(()=>{"use strict";yl="__live-region__"});function D0(e){let[t,n]=e.split("-");return{side:t,align:n,hasAlign:n!=null}}function gm(e){return e.split("-")[0]}function Kd(e,t,n){return At(e,Cr(t,n))}function jn(e,t){return typeof e=="function"?e(t):e}function Yn(e){return e.split("-")[0]}function ra(e){return e.split("-")[1]}function Yd(e){return e==="x"?"y":"x"}function Xd(e){return e==="y"?"height":"width"}function bn(e){let t=e[0];return t==="t"||t==="b"?"y":"x"}function Zd(e){return Yd(bn(e))}function _0(e,t,n){n===void 0&&(n=!1);let r=ra(e),i=Zd(e),a=Xd(i),o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(o=Sl(o)),[o,Sl(o)]}function $0(e){let t=Sl(e);return[zd(e),t,zd(t)]}function zd(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}function G0(e,t,n){switch(e){case"top":case"bottom":return n?t?em:Qf:t?Qf:em;case"left":case"right":return t?H0:B0;default:return[]}}function U0(e,t,n,r){let i=ra(e),a=G0(Yn(e),n==="start",r);return i&&(a=a.map(o=>o+"-"+i),t&&(a=a.concat(a.map(zd)))),a}function Sl(e){let t=Yn(e);return M0[t]+e.slice(t.length)}function q0(e){return h({top:0,right:0,bottom:0,left:0},e)}function pm(e){return typeof e!="number"?q0(e):{top:e,right:e,bottom:e,left:e}}function Il(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function tm(e,t,n){let{reference:r,floating:i}=e,a=bn(t),o=Zd(t),s=Xd(o),l=Yn(t),c=a==="y",d=r.x+r.width/2-i.width/2,u=r.y+r.height/2-i.height/2,p=r[s]/2-i[s]/2,g;switch(l){case"top":g={x:d,y:r.y-i.height};break;case"bottom":g={x:d,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:u};break;case"left":g={x:r.x-i.width,y:u};break;default:g={x:r.x,y:r.y}}switch(ra(t)){case"start":g[o]-=p*(n&&c?-1:1);break;case"end":g[o]+=p*(n&&c?-1:1);break}return g}function W0(e,t){return Ke(this,null,function*(){var n;t===void 0&&(t={});let{x:r,y:i,platform:a,rects:o,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:p=!1,padding:g=0}=jn(t,e),f=pm(g),S=s[p?u==="floating"?"reference":"floating":u],T=Il(yield a.getClippingRect({element:(n=yield a.isElement==null?void 0:a.isElement(S))==null||n?S:S.contextElement||(yield a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:c,rootBoundary:d,strategy:l})),w=u==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,I=yield a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating),P=(yield a.isElement==null?void 0:a.isElement(I))?(yield a.getScale==null?void 0:a.getScale(I))||{x:1,y:1}:{x:1,y:1},v=Il(a.convertOffsetParentRelativeRectToViewportRelativeRect?yield a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:w,offsetParent:I,strategy:l}):w);return{top:(T.top-v.top+f.top)/P.y,bottom:(v.bottom-T.bottom+f.bottom)/P.y,left:(T.left-v.left+f.left)/P.x,right:(v.right-T.right+f.right)/P.x}})}function nm(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function rm(e){return F0.some(t=>e[t]>=0)}function Z0(e,t){return Ke(this,null,function*(){let{placement:n,platform:r,elements:i}=e,a=yield r.isRTL==null?void 0:r.isRTL(i.floating),o=Yn(n),s=ra(n),l=bn(n)==="y",c=hm.has(o)?-1:1,d=a&&l?-1:1,u=jn(t,e),{mainAxis:p,crossAxis:g,alignmentAxis:f}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&typeof f=="number"&&(g=s==="end"?f*-1:f),l?{x:g*d,y:p*c}:{x:p*c,y:g*d}})}function Tl(){return typeof window!="undefined"}function ia(e){return fm(e)?(e.nodeName||"").toLowerCase():"#document"}function xt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Pn(e){var t;return(t=(fm(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function fm(e){return Tl()?e instanceof Node||e instanceof xt(e).Node:!1}function rn(e){return Tl()?e instanceof Element||e instanceof xt(e).Element:!1}function Xn(e){return Tl()?e instanceof HTMLElement||e instanceof xt(e).HTMLElement:!1}function im(e){return!Tl()||typeof ShadowRoot=="undefined"?!1:e instanceof ShadowRoot||e instanceof xt(e).ShadowRoot}function fo(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=an(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function nw(e){return/^(table|td|th)$/.test(ia(e))}function Cl(e){try{if(e.matches(":popover-open"))return!0}catch(t){}try{return e.matches(":modal")}catch(t){return!1}}function Jd(e){let t=rn(e)?an(e):e;return ni(t.transform)||ni(t.translate)||ni(t.scale)||ni(t.rotate)||ni(t.perspective)||!Qd()&&(ni(t.backdropFilter)||ni(t.filter))||rw.test(t.willChange||"")||iw.test(t.contain||"")}function aw(e){let t=wr(e);for(;Xn(t)&&!na(t);){if(Jd(t))return t;if(Cl(t))return null;t=wr(t)}return null}function Qd(){return qd==null&&(qd=typeof CSS!="undefined"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),qd}function na(e){return/^(html|body|#document)$/.test(ia(e))}function an(e){return xt(e).getComputedStyle(e)}function wl(e){return rn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function wr(e){if(ia(e)==="html")return e;let t=e.assignedSlot||e.parentNode||im(e)&&e.host||Pn(e);return im(t)?t.host:t}function mm(e){let t=wr(e);return na(t)?e.ownerDocument?e.ownerDocument.body:e.body:Xn(t)&&fo(t)?t:mm(t)}function ho(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);let i=mm(e),a=i===((r=e.ownerDocument)==null?void 0:r.body),o=xt(i);if(a){let s=jd(o);return t.concat(o,o.visualViewport||[],fo(i)?i:[],s&&n?ho(s):[])}else return t.concat(i,ho(i,[],n))}function jd(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function vm(e){let t=an(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Xn(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Pl(n)!==a||Pl(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function eu(e){return rn(e)?e:e.contextElement}function ta(e){let t=eu(e);if(!Xn(t))return En(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=vm(t),o=(a?Pl(n.width):n.width)/r,s=(a?Pl(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}function ym(e){let t=xt(e);return!Qd()||!t.visualViewport?ow:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function sw(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==xt(e)?!1:t}function ri(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=eu(e),o=En(1);t&&(r?rn(r)&&(o=ta(r)):o=ta(e));let s=sw(a,n,r)?ym(a):En(0),l=(i.left+s.x)/o.x,c=(i.top+s.y)/o.y,d=i.width/o.x,u=i.height/o.y;if(a){let p=xt(a),g=r&&rn(r)?xt(r):r,f=p,m=jd(f);for(;m&&r&&g!==f;){let S=ta(m),T=m.getBoundingClientRect(),w=an(m),I=T.left+(m.clientLeft+parseFloat(w.paddingLeft))*S.x,P=T.top+(m.clientTop+parseFloat(w.paddingTop))*S.y;l*=S.x,c*=S.y,d*=S.x,u*=S.y,l+=I,c+=P,f=xt(m),m=jd(f)}}return Il({width:d,height:u,x:l,y:c})}function Ol(e,t){let n=wl(e).scrollLeft;return t?t.left+n:ri(Pn(e)).left+n}function bm(e,t){let n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ol(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function lw(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i==="fixed",o=Pn(r),s=t?Cl(t.floating):!1;if(r===o||s&&a)return n;let l={scrollLeft:0,scrollTop:0},c=En(1),d=En(0),u=Xn(r);if((u||!u&&!a)&&((ia(r)!=="body"||fo(o))&&(l=wl(r)),u)){let g=ri(r);c=ta(r),d.x=g.x+r.clientLeft,d.y=g.y+r.clientTop}let p=o&&!u&&!a?bm(o,l):En(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+p.x,y:n.y*c.y-l.scrollTop*c.y+d.y+p.y}}function cw(e){return Array.from(e.getClientRects())}function dw(e){let t=Pn(e),n=wl(e),r=e.ownerDocument.body,i=At(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=At(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Ol(e),s=-n.scrollTop;return an(r).direction==="rtl"&&(o+=At(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function uw(e,t){let n=xt(e),r=Pn(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,l=0;if(i){a=i.width,o=i.height;let d=Qd();(!d||d&&t==="fixed")&&(s=i.offsetLeft,l=i.offsetTop)}let c=Ol(r);if(c<=0){let d=r.ownerDocument,u=d.body,p=getComputedStyle(u),g=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,f=Math.abs(r.clientWidth-u.clientWidth-g);f<=am&&(a-=f)}else c<=am&&(a+=c);return{width:a,height:o,x:s,y:l}}function gw(e,t){let n=ri(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Xn(e)?ta(e):En(1),o=e.clientWidth*a.x,s=e.clientHeight*a.y,l=i*a.x,c=r*a.y;return{width:o,height:s,x:l,y:c}}function om(e,t,n){let r;if(t==="viewport")r=uw(e,n);else if(t==="document")r=dw(Pn(e));else if(rn(t))r=gw(t,n);else{let i=ym(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Il(r)}function Em(e,t){let n=wr(e);return n===t||!rn(n)||na(n)?!1:an(n).position==="fixed"||Em(n,t)}function pw(e,t){let n=t.get(e);if(n)return n;let r=ho(e,[],!1).filter(s=>rn(s)&&ia(s)!=="body"),i=null,a=an(e).position==="fixed",o=a?wr(e):e;for(;rn(o)&&!na(o);){let s=an(o),l=Jd(o);!l&&s.position==="fixed"&&(i=null),(a?!l&&!i:!l&&s.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||fo(o)&&!l&&Em(e,o))?r=r.filter(d=>d!==o):i=s,o=wr(o)}return t.set(e,r),r}function hw(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,o=[...n==="clippingAncestors"?Cl(t)?[]:pw(t,this._c):[].concat(n),r],s=om(t,o[0],i),l=s.top,c=s.right,d=s.bottom,u=s.left;for(let p=1;p{o(!1,1e-7)},1e3)}R===1&&!Sm(c,e.getBoundingClientRect())&&o(),P=!1}try{n=new IntersectionObserver(v,y(h({},I),{root:i.ownerDocument}))}catch(E){n=new IntersectionObserver(v,I)}n.observe(e)}return o(!0),a}function Pw(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=eu(e),d=i||a?[...c?ho(c):[],...t?ho(t):[]]:[];d.forEach(T=>{i&&T.addEventListener("scroll",n,{passive:!0}),a&&T.addEventListener("resize",n)});let u=c&&s?Ew(c,n):null,p=-1,g=null;o&&(g=new ResizeObserver(T=>{let[w]=T;w&&w.target===c&&g&&t&&(g.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var I;(I=g)==null||I.observe(t)})),n()}),c&&!l&&g.observe(c),t&&g.observe(t));let f,m=l?ri(e):null;l&&S();function S(){let T=ri(e);m&&!Sm(m,T)&&n(),m=T,f=requestAnimationFrame(S)}return n(),()=>{var T;d.forEach(w=>{i&&w.removeEventListener("scroll",n),a&&w.removeEventListener("resize",n)}),u==null||u(),(T=g)==null||T.disconnect(),g=null,l&&cancelAnimationFrame(f)}}function lm(e=0,t=0,n=0,r=0){if(typeof DOMRect=="function")return new DOMRect(e,t,n,r);let i={x:e,y:t,width:n,height:r,top:t,right:e+n,bottom:t+r,left:e};return y(h({},i),{toJSON:()=>i})}function xw(e){if(!e)return lm();let{x:t,y:n,width:r,height:i}=e;return lm(t,n,r,i)}function Rw(e,t){return{contextElement:Pe(e)?e:e==null?void 0:e.contextElement,getBoundingClientRect:()=>{let n=e,r=t==null?void 0:t(n);return r||!n?xw(r):n.getBoundingClientRect()}}}function Nw(e,t){return{name:"transformOrigin",fn(n){var C,A,N,k,L;let{elements:r,middlewareData:i,placement:a,rects:o,y:s}=n,l=a.split("-")[0],c=kw(l),d=((C=i.arrow)==null?void 0:C.x)||0,u=((A=i.arrow)==null?void 0:A.y)||0,p=(t==null?void 0:t.clientWidth)||0,g=(t==null?void 0:t.clientHeight)||0,f=d+p/2,m=u+g/2,S=Math.abs(((N=i.shift)==null?void 0:N.y)||0),T=o.reference.height/2,w=g/2,I=(L=(k=e.offset)==null?void 0:k.mainAxis)!=null?L:e.gutter,P=typeof I=="number"?I+w:I!=null?I:w,v=S>P,E={top:`${f}px calc(100% + ${P}px)`,bottom:`${f}px ${-P}px`,left:`calc(100% + ${P}px) ${m}px`,right:`${-P}px ${m}px`}[l],R=`${f}px ${o.reference.y+T-s}px`,x=!!e.overlap&&c==="y"&&v;return r.floating.style.setProperty(zn.transformOrigin.variable,x?R:E),{data:{transformOrigin:x?R:E}}}}}function cm(e,t){let n=e.devicePixelRatio||1;return Math.round(t*n)/n}function ea(e,t){return e!=null&&Math.abs(e-t)<.5}function tu(e){return typeof e=="function"?e():e==="clipping-ancestors"?"clippingAncestors":e}function Mw(e,t,n){let r=e||t.createElement("div");return Ow({element:r,padding:n.arrowPadding})}function _w(e,t){var n;if(!Yp((n=t.offset)!=null?n:t.gutter))return Sw(({placement:r})=>{var d,u,p,g;let i=((e==null?void 0:e.clientHeight)||0)/2,a=(u=(d=t.offset)==null?void 0:d.mainAxis)!=null?u:t.gutter,o=typeof a=="number"?a+i:a!=null?a:i,{hasAlign:s}=D0(r),l=s?void 0:t.shift,c=(g=(p=t.offset)==null?void 0:p.crossAxis)!=null?g:l;return _n({crossAxis:c,mainAxis:o,alignmentAxis:t.shift})})}function $w(e){if(!e.flip)return;let t=tu(e.boundary);return Tw(y(h({},t?{boundary:t}:void 0),{padding:e.overflowPadding,fallbackPlacements:e.flip===!0?void 0:e.flip}))}function Hw(e){if(!e.slide&&!e.overlap)return;let t=tu(e.boundary);return Iw(y(h({},t?{boundary:t}:void 0),{mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:Vw()}))}function Bw(e){if(e.sizeMiddleware===!1&&!e.sameWidth&&!e.fitViewport)return;let t,n,r,i;return Cw({padding:e.overflowPadding,apply({elements:a,rects:o,availableHeight:s,availableWidth:l}){let c=a.floating,d=Math.round(o.reference.width),u=Math.round(o.reference.height);l=Math.floor(l),s=Math.floor(s),ea(t,d)||(c.style.setProperty("--reference-width",`${d}px`),t=d),ea(n,u)||(c.style.setProperty("--reference-height",`${u}px`),n=u),ea(r,l)||(c.style.setProperty("--available-width",`${l}px`),r=l),ea(i,s)||(c.style.setProperty("--available-height",`${s}px`),i=s)}})}function Gw(e){var t;if(e.hideWhenDetached)return ww({strategy:"referenceHidden",boundary:(t=tu(e.boundary))!=null?t:"clippingAncestors"})}function Uw(e){return e?e===!0?{ancestorResize:!0,ancestorScroll:!0,elementResize:!0,layoutShift:!0}:e:{}}function dm(e,t){if(!e)return Qc;let n=new Map(t.map(r=>[r,e.style.getPropertyValue(r)]));return()=>{n.forEach((r,i)=>{r?e.style.setProperty(i,r):e.style.removeProperty(i)}),e.style.length===0&&e.removeAttribute("style")}}function um(e){return e==null?null:Pe(e)?e:typeof e=="object"&&e&&"contextElement"in e&&e.contextElement?e.contextElement:e}function Kw(e,t,n={}){let r=()=>{let A=typeof t=="function"?t():t;return A!=null?A:null},i=()=>{var N,k;let A=typeof e=="function"?e():e;return(k=(N=n.getAnchorElement)==null?void 0:N.call(n))!=null?k:A},a=()=>{let A=i();return!A&&!n.getAnchorRect?null:Rw(A,n.getAnchorRect)},o=Object.assign({},Fw,n),s=[],l=null,c,d;function u(A){c==null||c(),d==null||d(),l=A,c=o.restoreStyles?dm(A,qw):void 0;let N=A.querySelector("[data-part=arrow]");d=o.restoreStyles?dm(N,Ww):void 0,s=[_w(N,o),$w(o),Hw(o),Mw(N,A.ownerDocument,o),Dw(N),Nw({gutter:o.gutter,offset:o.offset,overlap:o.overlap},N),Bw(o),Gw(o),Lw]}let{placement:p,strategy:g,onComplete:f,onPositioned:m}=o,S,T,w=!1,I,P,v=Qc,E=Uw(o.listeners);function R(){if(!o.listeners)return;let A=i(),N=a(),k=r();if(!N||!k)return;(um(A)!==um(I)||k!==P)&&(v(),I=A,P=k,v=Pw(N,k,C,E))}function x(){return Ke(this,null,function*(){var ue;R();let A=r();if(!A)return;A!==l&&(u(A),w=!1);let N=a();if(!N)return;let k=yield Aw(N,A,{placement:p,middleware:s,strategy:g});f==null||f(k);let L=ye(A),K=cm(L,k.x),J=cm(L,k.y);if(ea(S,K)||(A.style.setProperty("--x",`${K}px`),S=K),ea(T,J)||(A.style.setProperty("--y",`${J}px`),T=J),o.hideWhenDetached&&(((ue=k.middlewareData.hide)==null?void 0:ue.referenceHidden)?(A.style.setProperty("visibility","hidden"),A.style.setProperty("pointer-events","none")):(A.style.removeProperty("visibility"),A.style.removeProperty("pointer-events"))),!w){let Z=A.firstElementChild;Z&&(A.style.setProperty("--z-index",pt(Z).zIndex),w=!0)}})}function C(){return Ke(this,null,function*(){n.updatePosition?(yield n.updatePosition({updatePosition:x,floatingElement:r()}),m==null||m({placed:!0})):yield x()})}return C(),()=>{v(),d==null||d(),c==null||c(),m==null||m({placed:!1})}}function Xe(e,t,n={}){let s=n,{defer:r}=s,i=St(s,["defer"]),a=r?B:l=>l(),o=[];return o.push(a(()=>{o.push(Kw(e,t,i))})),()=>{o.forEach(l=>l==null?void 0:l())}}function Ut(e={}){let{placement:t,sameWidth:n,fitViewport:r,strategy:i="absolute"}=e;return{arrow:{position:"absolute",width:zn.arrowSize.reference,height:zn.arrowSize.reference,[zn.arrowSizeHalf.variable]:`calc(${zn.arrowSize.reference} / 2)`,[zn.arrowOffset.variable]:`calc(${zn.arrowSizeHalf.reference} * -1)`},arrowTip:{transform:t?zw[t.split("-")[0]]:void 0,background:zn.arrowBg.reference,top:"0",left:"0",width:"100%",height:"100%",position:"absolute",zIndex:"inherit"},floating:{position:i,isolation:"isolate",minWidth:n?void 0:"max-content",width:n?"var(--reference-width)":void 0,maxWidth:r?"var(--available-width)":void 0,maxHeight:r?"var(--available-height)":void 0,pointerEvents:t?void 0:"none",top:"0px",left:"0px",transform:t?"translate3d(var(--x), var(--y), 0)":"translate3d(0, -100vh, 0)",zIndex:"var(--z-index)"}}}var F0,Cr,At,Pl,El,En,M0,Qf,em,H0,B0,K0,z0,j0,Y0,X0,hm,J0,Q0,ew,tw,rw,iw,ni,qd,ow,am,vw,bw,Sw,Iw,Tw,Cw,ww,Ow,Vw,Aw,po,zn,kw,Lw,Dw,Fw,qw,Ww,zw,ii=ee(()=>{"use strict";oe();F0=["top","right","bottom","left"],Cr=Math.min,At=Math.max,Pl=Math.round,El=Math.floor,En=e=>({x:e,y:e}),M0={left:"right",right:"left",bottom:"top",top:"bottom"};Qf=["left","right"],em=["right","left"],H0=["top","bottom"],B0=["bottom","top"];K0=50,z0=(e,t,n)=>Ke(null,null,function*(){let{placement:r="bottom",strategy:i="absolute",middleware:a=[],platform:o}=n,s=o.detectOverflow?o:y(h({},o),{detectOverflow:W0}),l=yield o.isRTL==null?void 0:o.isRTL(t),c=yield o.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:u}=tm(c,r,l),p=r,g=0,f={};for(let m=0;m({name:"arrow",options:e,fn(n){return Ke(this,null,function*(){let{x:r,y:i,placement:a,rects:o,platform:s,elements:l,middlewareData:c}=n,{element:d,padding:u=0}=jn(e,n)||{};if(d==null)return{};let p=pm(u),g={x:r,y:i},f=Zd(a),m=Xd(f),S=yield s.getDimensions(d),T=f==="y",w=T?"top":"left",I=T?"bottom":"right",P=T?"clientHeight":"clientWidth",v=o.reference[m]+o.reference[f]-g[f]-o.floating[m],E=g[f]-o.reference[f],R=yield s.getOffsetParent==null?void 0:s.getOffsetParent(d),x=R?R[P]:0;(!x||!(yield s.isElement==null?void 0:s.isElement(R)))&&(x=l.floating[P]||o.floating[m]);let C=v/2-E/2,A=x/2-S[m]/2-1,N=Cr(p[w],A),k=Cr(p[I],A),L=N,K=x-S[m]-k,J=x/2-S[m]/2+C,ue=Kd(L,J,K),Z=!c.arrow&&ra(a)!=null&&J!==ue&&o.reference[m]/2-(Jue<=0)){var k,L;let ue=(((k=o.flip)==null?void 0:k.index)||0)+1,Z=x[ue];if(Z&&(!(p==="alignment"?I!==bn(Z):!1)||N.every(le=>bn(le.placement)===I?le.overflows[0]>0:!0)))return{data:{index:ue,overflows:N},reset:{placement:Z}};let ce=(L=N.filter(ve=>ve.overflows[0]<=0).sort((ve,le)=>ve.overflows[1]-le.overflows[1])[0])==null?void 0:L.placement;if(!ce)switch(f){case"bestFit":{var K;let ve=(K=N.filter(le=>{if(R){let De=bn(le.placement);return De===I||De==="y"}return!0}).map(le=>[le.placement,le.overflows.filter(De=>De>0).reduce((De,Fe)=>De+Fe,0)]).sort((le,De)=>le[1]-De[1])[0])==null?void 0:K[0];ve&&(ce=ve);break}case"initialPlacement":ce=l;break}if(a!==ce)return{reset:{placement:ce}}}return{}})}}};X0=function(e){return e===void 0&&(e={}),{name:"hide",options:e,fn(n){return Ke(this,null,function*(){let{rects:r,platform:i}=n,s=jn(e,n),{strategy:a="referenceHidden"}=s,o=St(s,["strategy"]);switch(a){case"referenceHidden":{let l=yield i.detectOverflow(n,y(h({},o),{elementContext:"reference"})),c=nm(l,r.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:rm(c)}}}case"escaped":{let l=yield i.detectOverflow(n,y(h({},o),{altBoundary:!0})),c=nm(l,r.floating);return{data:{escapedOffsets:c,escaped:rm(c)}}}default:return{}}})}}},hm=new Set(["left","top"]);J0=function(e){return e===void 0&&(e=0),{name:"offset",options:e,fn(n){return Ke(this,null,function*(){var r,i;let{x:a,y:o,placement:s,middlewareData:l}=n,c=yield Z0(n,e);return s===((r=l.offset)==null?void 0:r.placement)&&(i=l.arrow)!=null&&i.alignmentOffset?{}:{x:a+c.x,y:o+c.y,data:y(h({},c),{placement:s})}})}}},Q0=function(e){return e===void 0&&(e={}),{name:"shift",options:e,fn(n){return Ke(this,null,function*(){let{x:r,y:i,placement:a,platform:o}=n,w=jn(e,n),{mainAxis:s=!0,crossAxis:l=!1,limiter:c={fn:I=>{let{x:P,y:v}=I;return{x:P,y:v}}}}=w,d=St(w,["mainAxis","crossAxis","limiter"]),u={x:r,y:i},p=yield o.detectOverflow(n,d),g=bn(Yn(a)),f=Yd(g),m=u[f],S=u[g];if(s){let I=f==="y"?"top":"left",P=f==="y"?"bottom":"right",v=m+p[I],E=m-p[P];m=Kd(v,m,E)}if(l){let I=g==="y"?"top":"left",P=g==="y"?"bottom":"right",v=S+p[I],E=S-p[P];S=Kd(v,S,E)}let T=c.fn(y(h({},n),{[f]:m,[g]:S}));return y(h({},T),{data:{x:T.x-r,y:T.y-i,enabled:{[f]:s,[g]:l}}})})}}},ew=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=jn(e,t),d={x:n,y:r},u=bn(i),p=Yd(u),g=d[p],f=d[u],m=jn(s,t),S=typeof m=="number"?{mainAxis:m,crossAxis:0}:h({mainAxis:0,crossAxis:0},m);if(l){let I=p==="y"?"height":"width",P=a.reference[p]-a.floating[I]+S.mainAxis,v=a.reference[p]+a.reference[I]-S.mainAxis;gv&&(g=v)}if(c){var T,w;let I=p==="y"?"width":"height",P=hm.has(Yn(i)),v=a.reference[u]-a.floating[I]+(P&&((T=o.offset)==null?void 0:T[u])||0)+(P?0:S.crossAxis),E=a.reference[u]+a.reference[I]+(P?0:((w=o.offset)==null?void 0:w[u])||0)-(P?S.crossAxis:0);fE&&(f=E)}return{[p]:g,[u]:f}}}},tw=function(e){return e===void 0&&(e={}),{name:"size",options:e,fn(n){return Ke(this,null,function*(){var r,i;let{placement:a,rects:o,platform:s,elements:l}=n,N=jn(e,n),{apply:c=()=>{}}=N,d=St(N,["apply"]),u=yield s.detectOverflow(n,d),p=Yn(a),g=ra(a),f=bn(a)==="y",{width:m,height:S}=o.floating,T,w;p==="top"||p==="bottom"?(T=p,w=g===((yield s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(w=p,T=g==="end"?"top":"bottom");let I=S-u.top-u.bottom,P=m-u.left-u.right,v=Cr(S-u[T],I),E=Cr(m-u[w],P),R=!n.middlewareData.shift,x=v,C=E;if((r=n.middlewareData.shift)!=null&&r.enabled.x&&(C=P),(i=n.middlewareData.shift)!=null&&i.enabled.y&&(x=I),R&&!g){let k=At(u.left,0),L=At(u.right,0),K=At(u.top,0),J=At(u.bottom,0);f?C=m-2*(k!==0||L!==0?k+L:At(u.left,u.right)):x=S-2*(K!==0||J!==0?K+J:At(u.top,u.bottom))}yield c(y(h({},n),{availableWidth:C,availableHeight:x}));let A=yield s.getDimensions(l.floating);return m!==A.width||S!==A.height?{reset:{rects:!0}}:{}})}}};rw=/transform|translate|scale|rotate|perspective|filter/,iw=/paint|layout|strict|content/,ni=e=>!!e&&e!=="none";ow=En(0);am=25;vw=function(e){return Ke(this,null,function*(){let t=this.getOffsetParent||Pm,n=this.getDimensions,r=yield n(e.floating);return{reference:mw(e.reference,yield t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}})};bw={convertOffsetParentRelativeRectToViewportRelativeRect:lw,getDocumentElement:Pn,getClippingRect:hw,getOffsetParent:Pm,getElementRects:vw,getClientRects:cw,getDimensions:fw,getScale:ta,isElement:rn,isRTL:yw};Sw=J0,Iw=Q0,Tw=Y0,Cw=tw,ww=X0,Ow=j0,Vw=ew,Aw=(e,t,n)=>{let r=new Map,i=h({platform:bw},n),a=y(h({},i.platform),{_c:r});return z0(e,t,y(h({},i),{platform:a}))};po=e=>({variable:e,reference:`var(${e})`}),zn={arrowSize:po("--arrow-size"),arrowSizeHalf:po("--arrow-size-half"),arrowBg:po("--arrow-background"),transformOrigin:po("--transform-origin"),arrowOffset:po("--arrow-offset")},kw=e=>e==="top"||e==="bottom"?"y":"x";Lw={name:"rects",fn({rects:e}){return{data:e}}},Dw=e=>{if(e)return{name:"shiftArrow",fn({placement:t,middlewareData:n}){if(!n.arrow)return{};let{x:r,y:i}=n.arrow,a=t.split("-")[0];return Object.assign(e.style,{left:r!=null?`${r}px`:"",top:i!=null?`${i}px`:"",[a]:`calc(100% + ${zn.arrowOffset.reference})`}),{}}}},Fw={strategy:"absolute",placement:"bottom",listeners:!0,restoreStyles:!1,gutter:8,flip:!0,slide:!0,overlap:!1,sameWidth:!1,fitViewport:!1,overflowPadding:8,arrowPadding:4};qw=["transform","visibility","pointer-events","--x","--y","--z-index","--reference-width","--reference-height","--available-width","--available-height","--transform-origin"],Ww=["top","right","bottom","left"];zw={bottom:"rotate(45deg)",left:"rotate(135deg)",top:"rotate(225deg)",right:"rotate(315deg)"}});function jw(e){let t={each(n){var r;for(let i=0;i<((r=e.frames)==null?void 0:r.length);i+=1){let a=e.frames[i];a&&n(a)}},addEventListener(n,r,i){return t.each(a=>{try{a.document.addEventListener(n,r,i)}catch(o){}}),()=>{try{t.removeEventListener(n,r,i)}catch(a){}}},removeEventListener(n,r,i){t.each(a=>{try{a.document.removeEventListener(n,r,i)}catch(o){}})}};return t}function Yw(e){let t=e.frameElement!=null?e.parent:null;return{addEventListener:(n,r,i)=>{try{t==null||t.addEventListener(n,r,i)}catch(a){}return()=>{try{t==null||t.removeEventListener(n,r,i)}catch(a){}}},removeEventListener:(n,r,i)=>{try{t==null||t.removeEventListener(n,r,i)}catch(a){}}}}function Xw(e){for(let t of e)if(Pe(t)&&ut(t))return!0;return!1}function Zw(e,t){if(!Om(t)||!e)return!1;let n=e.getBoundingClientRect();return n.width===0||n.height===0?!1:n.top<=t.clientY&&t.clientY<=n.top+n.height&&n.left<=t.clientX&&t.clientX<=n.left+n.width}function Jw(e,t){return e.y<=t.y&&t.y<=e.y+e.height&&e.x<=t.x&&t.x<=e.x+e.width}function Cm(e,t){if(!t||!Om(e))return!1;let n=t.scrollHeight>t.clientHeight,r=n&&e.clientX>t.offsetLeft+t.clientWidth,i=t.scrollWidth>t.clientWidth,a=i&&e.clientY>t.offsetTop+t.clientHeight,o={x:t.offsetLeft,y:t.offsetTop,width:t.clientWidth+(n?16:0),height:t.clientHeight+(i?16:0)},s={x:e.clientX,y:e.clientY};return Jw(o,s)?r||a:!1}function Qw(e,t){let{exclude:n,onFocusOutside:r,onPointerDownOutside:i,onInteractOutside:a,defer:o,followControlledElements:s=!0}=t;if(!e)return;let l=Ue(e),c=ye(e),d=jw(c),u=Yw(c);function p(P,v){if(!Pe(v)||!v.isConnected||ge(e,v)||Zw(e,P)||s&&Vs(e,v))return!1;let E=l.querySelector(`[aria-controls="${e.id}"]`);if(E){let x=Xa(E);if(Cm(P,x))return!1}let R=Xa(e);return Cm(P,R)?!1:!(n!=null&&n(v))}let g=new Set,f=zr(e==null?void 0:e.getRootNode()),m=!1;function S(P){m=!0;let v=()=>{m=!1};l.addEventListener("pointerup",v,{once:!0}),c.addEventListener("pointerup",v,{once:!0});function E(R){var N,k;let x=o&&!od()?B:L=>L(),C=R!=null?R:P,A=(k=(N=C==null?void 0:C.composedPath)==null?void 0:N.call(C))!=null?k:[C==null?void 0:C.target];x(()=>{let L=f?A[0]:ne(P);if(!(!e||!p(P,L))){if(i||a){let K=Ct(i,a);e.addEventListener(Im,K,{once:!0})}wm(e,Im,{bubbles:!1,cancelable:!0,detail:{originalEvent:C,contextmenu:pr(C),focusable:Xw(A),target:L}})}})}P.pointerType==="touch"?(g.forEach(R=>R()),g.add(ae(l,"click",E,{once:!0})),g.add(u.addEventListener("click",E,{once:!0})),g.add(d.addEventListener("click",E,{once:!0}))):E()}let T=new Set,w=setTimeout(()=>{T.add(ae(l,"pointerdown",S,!0)),T.add(u.addEventListener("pointerdown",S,!0)),T.add(d.addEventListener("pointerdown",S,!0))},0);function I(P){if(m)return;(o?B:E=>E())(()=>{var x,C;let E=(C=(x=P==null?void 0:P.composedPath)==null?void 0:x.call(P))!=null?C:[P==null?void 0:P.target],R=f?E[0]:ne(P);if(!(!e||!p(P,R))){if(r||a){let A=Ct(r,a);e.addEventListener(Tm,A,{once:!0})}wm(e,Tm,{bubbles:!1,cancelable:!0,detail:{originalEvent:P,contextmenu:!1,focusable:ut(R),target:R}})}})}return od()||(T.add(ae(l,"focusin",I,!0)),T.add(u.addEventListener("focusin",I,!0)),T.add(d.addEventListener("focusin",I,!0))),()=>{clearTimeout(w),g.forEach(P=>P()),T.forEach(P=>P())}}function aa(e,t){let{defer:n}=t,r=n?B:a=>a(),i=[];return i.push(r(()=>{let a=typeof e=="function"?e():e;i.push(Qw(a,t))})),()=>{i.forEach(a=>a==null?void 0:a())}}function wm(e,t,n){let r=e.ownerDocument.defaultView||window,i=new r.CustomEvent(t,n);return e.dispatchEvent(i)}var Im,Tm,Om,on=ee(()=>{"use strict";oe();Im="pointerdown.outside",Tm="focus.outside";Om=e=>"clientY"in e});function eO(e,t){let n=r=>{r.key==="Escape"&&(r.isComposing||t==null||t(r))};return ae(Ue(e),"keydown",n,{capture:!0})}function tO(e,t,n){let r=e.ownerDocument.defaultView||window,i=new r.CustomEvent(t,{cancelable:!0,bubbles:!0,detail:n});return e.dispatchEvent(i)}function nO(e,t,n){e.addEventListener(t,n,{once:!0})}function xm(){vt.layers.forEach(({node:e})=>{e.style.pointerEvents=vt.isBelowPointerBlockingLayer(e)?"none":"auto"})}function rO(e){e.style.pointerEvents=""}function iO(e,t){let n=Ue(e),r=[];return vt.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(Am=document.body.style.pointerEvents,queueMicrotask(()=>{n.body.style.pointerEvents="none",n.body.setAttribute("data-inert","")})),t==null||t.forEach(i=>{let[a,o]=Ch(()=>{let s=i();return Pe(s)?s:null},{timeout:1e3});a.then(s=>r.push(Xr(s,{pointerEvents:"auto"}))),r.push(o)}),()=>{vt.hasPointerBlockingLayer()||(queueMicrotask(()=>{n.body.style.pointerEvents=Am,n.body.removeAttribute("data-inert"),n.body.style.length===0&&n.body.removeAttribute("style")}),r.forEach(i=>i()))}}function aO(e,t){let{warnOnMissingNode:n=!0}=t;if(n&&!e){It("[@zag-js/dismissable] node is `null` or `undefined`");return}if(!e)return;let{onDismiss:r,onRequestDismiss:i,pointerBlocking:a,exclude:o,debug:s,type:l="dialog"}=t,c={dismiss:r,node:e,type:l,pointerBlocking:a,requestDismiss:i};vt.add(c),xm();function d(m){var T,w;let S=ne(m.detail.originalEvent);vt.isBelowPointerBlockingLayer(e)||vt.isInBranch(S)||((T=t.onPointerDownOutside)==null||T.call(t,m),(w=t.onInteractOutside)==null||w.call(t,m),!m.defaultPrevented&&(s&&console.log("onPointerDownOutside:",m.detail.originalEvent),r==null||r()))}function u(m){var T,w;let S=ne(m.detail.originalEvent);vt.isInBranch(S)||((T=t.onFocusOutside)==null||T.call(t,m),(w=t.onInteractOutside)==null||w.call(t,m),!m.defaultPrevented&&(s&&console.log("onFocusOutside:",m.detail.originalEvent),r==null||r()))}function p(m){var S;vt.isTopMost(e)&&((S=t.onEscapeKeyDown)==null||S.call(t,m),!m.defaultPrevented&&r&&(m.preventDefault(),r()))}function g(m){var I;if(!e)return!1;let S=typeof o=="function"?o():o,T=Array.isArray(S)?S:[S],w=(I=t.persistentElements)==null?void 0:I.map(P=>P()).filter(Pe);return w&&T.push(...w),T.some(P=>ge(P,m))||vt.isInNestedLayer(e,m)}let f=[a?iO(e,t.persistentElements):void 0,eO(e,p),aa(e,{exclude:g,onFocusOutside:u,onPointerDownOutside:d,defer:t.defer})];return()=>{vt.remove(e),xm(),rO(e),f.forEach(m=>m==null?void 0:m())}}function qt(e,t){let{defer:n}=t,r=n?B:a=>a(),i=[];return i.push(r(()=>{let a=Qe(e)?e():e;i.push(aO(a,t))})),()=>{i.forEach(a=>a==null?void 0:a())}}function Rm(e,t={}){let{defer:n}=t,r=n?B:a=>a(),i=[];return i.push(r(()=>{let a=Qe(e)?e():e;if(!a){It("[@zag-js/dismissable] branch node is `null` or `undefined`");return}vt.addBranch(a),i.push(()=>{vt.removeBranch(a)})})),()=>{i.forEach(a=>a==null?void 0:a())}}var Vm,vt,Am,Or=ee(()=>{"use strict";on();oe();Vm="layer:request-dismiss",vt={layers:[],branches:[],recentlyRemoved:new Set,count(){return this.layers.length},pointerBlockingLayers(){return this.layers.filter(e=>e.pointerBlocking)},topMostPointerBlockingLayer(){return[...this.pointerBlockingLayers()].slice(-1)[0]},hasPointerBlockingLayer(){return this.pointerBlockingLayers().length>0},isBelowPointerBlockingLayer(e){var r;let t=this.indexOf(e),n=this.topMostPointerBlockingLayer()?this.indexOf((r=this.topMostPointerBlockingLayer())==null?void 0:r.node):-1;return tt.type===e)},getNestedLayersByType(e,t){let n=this.indexOf(e);return n===-1?[]:this.layers.slice(n+1).filter(r=>r.type===t)},getParentLayerOfType(e,t){let n=this.indexOf(e);if(!(n<=0))return this.layers.slice(0,n).reverse().find(r=>r.type===t)},countNestedLayersOfType(e,t){return this.getNestedLayersByType(e,t).length},isInNestedLayer(e,t){return!!(this.getNestedLayers(e).some(r=>ge(r.node,t))||this.recentlyRemoved.size>0)},isInBranch(e){return Array.from(this.branches).some(t=>ge(t,e))},add(e){this.layers.push(e),this.syncLayers()},addBranch(e){this.branches.push(e)},remove(e){let t=this.indexOf(e);t<0||(this.recentlyRemoved.add(e),Yr(()=>this.recentlyRemoved.delete(e)),tvt.dismiss(r.node,e)),this.layers.splice(t,1),this.syncLayers())},removeBranch(e){let t=this.branches.indexOf(e);t>=0&&this.branches.splice(t,1)},syncLayers(){this.layers.forEach((e,t)=>{e.node.style.setProperty("--layer-index",`${t}`),e.node.removeAttribute("data-nested"),e.node.removeAttribute("data-has-nested"),this.getParentLayerOfType(e.node,e.type)&&e.node.setAttribute("data-nested",e.type);let r=this.countNestedLayersOfType(e.node,e.type);r>0&&e.node.setAttribute("data-has-nested",e.type),e.node.style.setProperty("--nested-layer-count",`${r}`)})},indexOf(e){return this.layers.findIndex(t=>t.node===e)},dismiss(e,t){let n=this.indexOf(e);if(n===-1)return;let r=this.layers[n];nO(e,Vm,i=>{var a;(a=r.requestDismiss)==null||a.call(r,i),i.defaultPrevented||r==null||r.dismiss()}),tO(e,Vm,{originalLayer:e,targetLayer:t,originalIndex:n,targetIndex:t?this.indexOf(t):-1}),this.syncLayers()},clear(){this.remove(this.layers[0].node)}}});function Wt(e){let t=e;t.phxPrivate||(t.phxPrivate={}),t.phxPrivate[oO]=!0}function yt(e,t,n={}){var r;String(e.value)!==String(t)&&(e.value=t),(r=n.onTouched)==null||r.call(n),n.markUsed!==!1&&(Wt(e),e.dispatchEvent(new Event("input",{bubbles:!0})),n.change!==!1&&e.dispatchEvent(new Event("change",{bubbles:!0})))}function Vr(e,t,n){queueMicrotask(()=>{yt(e,t(),{onTouched:n})})}var oO,Kt=ee(()=>{"use strict";oO="phx-has-focused"});function Ar(e,t=!1){return t||O(e,"fieldUsed")===!0}function sO(e,t){let n=e.map(r=>String(r));for(;n.lengthu.remove());let d=km(t,a?n:void 0,r,"",!0);return e.appendChild(d),d}o.filter(d=>d.hasAttribute("data-empty")).forEach(d=>d.remove());let l=o.filter(d=>!d.hasAttribute("data-empty"));for(;l.lengthi.length;){let d=l[l.length-1];d==null||d.remove(),l=l.slice(0,-1)}return l.forEach((d,u)=>{var p;d.value=(p=i[u])!=null?p:""}),(c=l[l.length-1])!=null?c:null}function sn(e,t,n={}){var u,p,g,f;let r=(u=n.scope)!=null?u:"tags-input",i=(p=n.submitName)!=null?p:V(e,"submitName");if(!i)return;let a=n.fixedLength,o=a!==void 0?sO(t,a):t.map(m=>String(m)),s=Ar(e,n.fieldTouched===!0),l=e.querySelector(`[data-scope="${r}"][data-part="array-inputs"]`);if(!l){let m=(g=e.querySelector(`[data-scope="${r}"][data-part="root"]`))!=null?g:e;l=document.createElement("div"),l.setAttribute("data-scope",r),l.setAttribute("data-part","array-inputs"),l.setAttribute("phx-update","ignore"),l.id=`${r}:${e.id}:array-inputs`,m.prepend(l)}let c=lO(l,r,i,e,o,s);s&&l.querySelectorAll(`[data-scope="${r}"][data-part="array-input"][name="${CSS.escape(i)}"]`).forEach(m=>Wt(m)),!(!((f=n.notifyLiveView)!=null&&f)||!c)&&queueMicrotask(()=>{var m;(m=n.onTouched)==null||m.call(n),yt(c,c.value,{onTouched:void 0})})}function oa(e,t){let n=e.closest("form");if(!n)return()=>{};let r=()=>{t()};return n.addEventListener("submit",r,{capture:!0}),()=>n.removeEventListener("submit",r,{capture:!0})}var ai=ee(()=>{"use strict";Kt();oe()});function cO(e){let t=e.dataset.positionFlip;if(t==null)return;if(t==="true")return!0;if(t==="false")return!1;let n=t.split(",").map(r=>r.trim()).filter(Boolean);return n.length>0?n:void 0}function qe(e){let t={},n=V(e,"positionStrategy");n&&(t.strategy=n);let r=V(e,"positionPlacement");r&&(t.placement=r);let i=U(e,"positionGutter");i!==void 0&&(t.gutter=i);let a=U(e,"positionShift");a!==void 0&&(t.shift=a);let o=U(e,"positionOverflowPadding");o!==void 0&&(t.overflowPadding=o);let s=U(e,"positionArrowPadding");s!==void 0&&(t.arrowPadding=s);let l=U(e,"positionOffsetMainAxis"),c=U(e,"positionOffsetCrossAxis");if(l!==void 0||c!==void 0){let S={};l!==void 0&&(S.mainAxis=l),c!==void 0&&(S.crossAxis=c),t.offset=S}let d=cO(e);d!==void 0&&(t.flip=d);let u=Ye(e,"positionSlide");u!==void 0&&(t.slide=u);let p=Ye(e,"positionOverlap");p!==void 0&&(t.overlap=p);let g=Ye(e,"positionSameWidth");g!==void 0&&(t.sameWidth=g);let f=Ye(e,"positionFitViewport");f!==void 0&&(t.fitViewport=f);let m=Ye(e,"positionHideWhenDetached");return m!==void 0&&(t.hideWhenDetached=m),Object.keys(t).length>0?t:void 0}var xr=ee(()=>{"use strict";oe()});function mo(e,t,...n){return[...e.slice(0,t),...n,...e.slice(t)]}function Vl(e,t,n){t=[...t].sort((i,a)=>i-a);let r=t.map(i=>e[i]);for(let i=t.length-1;i>=0;i--)e=[...e.slice(0,t[i]),...e.slice(t[i]+1)];return n=Math.max(0,n-t.filter(i=>it.getItemValue(n)).filter(Boolean),selectedItems:e,collection:t})}function _m(e,t,n){for(let r=0;rt[n])return 1}return e.length-t.length}function hO(e){return e.sort($m)}function fO(e,t){let n;return Rt(e,y(h({},t),{onEnter:(r,i)=>{if(t.predicate(r,i))return n=r,"stop"}})),n}function mO(e,t){let n=[];return Rt(e,{onEnter:(r,i)=>{t.predicate(r,i)&&n.push(r)},getChildren:t.getChildren}),n}function Nm(e,t){let n;return Rt(e,{onEnter:(r,i)=>{if(t.predicate(r,i))return n=[...i],"stop"},getChildren:t.getChildren}),n}function vO(e,t){let n=t.initialResult;return Rt(e,y(h({},t),{onEnter:(r,i)=>{n=t.nextResult(n,r,i)}})),n}function yO(e,t){return vO(e,y(h({},t),{initialResult:[],nextResult:(n,r,i)=>(n.push(...t.transform(r,i)),n)}))}function bO(e,t){let{predicate:n,create:r,getChildren:i}=t,a=(o,s)=>{let l=i(o,s),c=[];l.forEach((g,f)=>{let m=[...s,f],S=a(g,m);S&&c.push(S)});let d=s.length===0,u=n(o,s),p=c.length>0;return d||u||p?r(o,c,s):null};return a(e,[])||r(e,[],[])}function EO(e,t){let n=[],r=0,i=new Map,a=new Map;return Rt(e,{getChildren:t.getChildren,onEnter:(o,s)=>{i.has(o)||i.set(o,r++);let l=t.getChildren(o,s);l.forEach(g=>{a.has(g)||a.set(g,o),i.has(g)||i.set(g,r++)});let c=l.length>0?l.map(g=>i.get(g)):void 0,d=a.get(o),u=d?i.get(d):void 0,p=i.get(o);n.push(y(h({},o),{_children:c,_parent:u,_index:p}))}}),n}function PO(e,t){return{type:"insert",index:e,nodes:t}}function SO(e){return{type:"remove",indexes:e}}function ru(){return{type:"replace"}}function Hm(e){return[e.slice(0,-1),e[e.length-1]]}function Bm(e,t,n=new Map){var o;let[r,i]=Hm(e);for(let s=r.length-1;s>=0;s--){let l=r.slice(0,s).join();switch((o=n.get(l))==null?void 0:o.type){case"remove":continue}n.set(l,ru())}let a=n.get(r.join());switch(a==null?void 0:a.type){case"remove":n.set(r.join(),{type:"removeThenInsert",removeIndexes:a.indexes,insertIndex:i,insertNodes:t});break;default:n.set(r.join(),PO(i,t))}return n}function Gm(e){var r;let t=new Map,n=new Map;for(let i of e){let a=i.slice(0,-1).join(),o=(r=n.get(a))!=null?r:[];o.push(i[i.length-1]),n.set(a,o.sort((s,l)=>s-l))}for(let i of e)for(let a=i.length-2;a>=0;a--){let o=i.slice(0,a).join();t.has(o)||t.set(o,ru())}for(let[i,a]of n)t.set(i,SO(a));return t}function IO(e,t){let n=new Map,[r,i]=Hm(e);for(let a=r.length-1;a>=0;a--){let o=r.slice(0,a).join();n.set(o,ru())}return n.set(r.join(),{type:"removeThenInsert",removeIndexes:[i],insertIndex:i,insertNodes:[t]}),n}function Rl(e,t,n){return TO(e,y(h({},n),{getChildren:(r,i)=>{let a=i.join(),o=t.get(a);switch(o==null?void 0:o.type){case"replace":case"remove":case"removeThenInsert":case"insert":return n.getChildren(r,i);default:return[]}},transform:(r,i,a)=>{let o=a.join(),s=t.get(o);switch(s==null?void 0:s.type){case"remove":return n.create(r,i.filter((d,u)=>!s.indexes.includes(u)),a);case"removeThenInsert":let l=i.filter((d,u)=>!s.removeIndexes.includes(u)),c=s.removeIndexes.reduce((d,u)=>u{var d,u;let a=[0,...i],o=a.join(),s=t.transform(r,(d=n[o])!=null?d:[],i),l=a.slice(0,-1).join(),c=(u=n[l])!=null?u:[];c.push(s),n[l]=c}})),n[""][0]}function CO(e,t){let{nodes:n,at:r}=t;if(r.length===0)throw new Error("Can't insert nodes at the root");let i=Bm(r,n);return Rl(e,i,t)}function wO(e,t){if(t.at.length===0)return t.node;let n=IO(t.at,t.node);return Rl(e,n,t)}function OO(e,t){if(t.indexPaths.length===0)return e;for(let r of t.indexPaths)if(r.length===0)throw new Error("Can't remove the root node");let n=Gm(t.indexPaths);return Rl(e,n,t)}function VO(e,t){if(t.indexPaths.length===0)return e;for(let a of t.indexPaths)if(a.length===0)throw new Error("Can't move the root node");if(t.to.length===0)throw new Error("Can't move nodes to the root");let n=pO(t.indexPaths),r=n.map(a=>_m(e,a,t)),i=Bm(t.to,r,Gm(n));return Rl(e,i,t)}function Rt(e,t){let{onEnter:n,onLeave:r,getChildren:i}=t,a=[],o=[{node:e}],s=t.reuseIndexPath?()=>a:()=>a.slice();for(;o.length>0;){let l=o[o.length-1];if(l.state===void 0){let d=n==null?void 0:n(l.node,s());if(d==="stop")return;l.state=d==="skip"?-1:0}let c=l.children||i(l.node,s());if(l.children||(l.children=c),l.state!==-1){if(l.state{"use strict";oe();dO=Object.defineProperty,uO=(e,t,n)=>t in e?dO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,M=(e,t,n)=>uO(e,typeof t!="symbol"?t+"":t,n),Al={itemToValue(e){return typeof e=="string"?e:un(e)&&at(e,"value")?e.value:""},itemToString(e){return typeof e=="string"?e:un(e)&&at(e,"label")?e.label:Al.itemToValue(e)},isItemDisabled(e){return un(e)&&at(e,"disabled")?!!e.disabled:!1}},Sn=class Dm{constructor(t){M(this,"options",t),M(this,"items"),M(this,"indexMap",null),M(this,"copy",n=>new Dm(y(h({},this.options),{items:n!=null?n:[...this.items]}))),M(this,"isEqual",n=>Ce(this.items,n.items)),M(this,"setItems",n=>this.copy(n)),M(this,"getValues",(n=this.items)=>{let r=[];for(let i of n){let a=this.getItemValue(i);a!=null&&r.push(a)}return r}),M(this,"find",n=>{if(n==null)return null;let r=this.indexOf(n);return r!==-1?this.at(r):null}),M(this,"findMany",n=>{let r=[];for(let i of n){let a=this.find(i);a!=null&&r.push(a)}return r}),M(this,"at",n=>{var a;if(!this.options.groupBy&&!this.options.groupSort)return(a=this.items[n])!=null?a:null;let r=0,i=this.group();for(let[,o]of i)for(let s of o){if(r===n)return s;r++}return null}),M(this,"sortFn",(n,r)=>{let i=this.indexOf(n),a=this.indexOf(r);return(i!=null?i:0)-(a!=null?a:0)}),M(this,"sort",n=>[...n].sort(this.sortFn.bind(this))),M(this,"getItemValue",n=>{var r,i,a;return n==null?null:(a=(i=(r=this.options).itemToValue)==null?void 0:i.call(r,n))!=null?a:Al.itemToValue(n)}),M(this,"getItemDisabled",n=>{var r,i,a;return n==null?!1:(a=(i=(r=this.options).isItemDisabled)==null?void 0:i.call(r,n))!=null?a:Al.isItemDisabled(n)}),M(this,"stringifyItem",n=>{var r,i,a;return n==null?null:(a=(i=(r=this.options).itemToString)==null?void 0:i.call(r,n))!=null?a:Al.itemToString(n)}),M(this,"stringify",n=>n==null?null:this.stringifyItem(this.find(n))),M(this,"stringifyItems",(n,r=", ")=>{let i=[];for(let a of n){let o=this.stringifyItem(a);o!=null&&i.push(o)}return i.join(r)}),M(this,"stringifyMany",(n,r)=>this.stringifyItems(this.findMany(n),r)),M(this,"has",n=>this.indexOf(n)!==-1),M(this,"hasItem",n=>n==null?!1:this.has(this.getItemValue(n))),M(this,"group",()=>{let{groupBy:n,groupSort:r}=this.options;if(!n)return[["",[...this.items]]];let i=new Map;this.items.forEach((o,s)=>{let l=n(o,s);i.has(l)||i.set(l,[]),i.get(l).push(o)});let a=Array.from(i.entries());return r&&a.sort(([o],[s])=>{if(typeof r=="function")return r(o,s);if(Array.isArray(r)){let l=r.indexOf(o),c=r.indexOf(s);return l===-1?1:c===-1?-1:l-c}return r==="asc"?o.localeCompare(s):r==="desc"?s.localeCompare(o):0}),a}),M(this,"getNextValue",(n,r=1,i=!1)=>{let a=this.indexOf(n);if(a===-1)return null;for(a=i?Math.min(a+r,this.size-1):a+r;a<=this.size&&this.getItemDisabled(this.at(a));)a++;return this.getItemValue(this.at(a))}),M(this,"getPreviousValue",(n,r=1,i=!1)=>{let a=this.indexOf(n);if(a===-1)return null;for(a=i?Math.max(a-r,0):a-r;a>=0&&this.getItemDisabled(this.at(a));)a--;return this.getItemValue(this.at(a))}),M(this,"indexOf",n=>{var r;if(n==null)return-1;if(!this.options.groupBy&&!this.options.groupSort)return this.items.findIndex(i=>this.getItemValue(i)===n);if(!this.indexMap){this.indexMap=new Map;let i=0,a=this.group();for(let[,o]of a)for(let s of o){let l=this.getItemValue(s);l!=null&&this.indexMap.set(l,i),i++}}return(r=this.indexMap.get(n))!=null?r:-1}),M(this,"getByText",(n,r)=>{let i=r!=null?this.indexOf(r):-1,a=n.length===1;for(let o=0;o{let{state:i,currentValue:a,timeout:o=350}=r,s=i.keysSoFar+n,c=s.length>1&&Array.from(s).every(f=>f===s[0])?s[0]:s,d=this.getByText(c,a),u=this.getItemValue(d);function p(){clearTimeout(i.timer),i.timer=-1}function g(f){i.keysSoFar=f,p(),f!==""&&(i.timer=+setTimeout(()=>{g(""),p()},o))}return g(s),u}),M(this,"update",(n,r)=>{let i=this.indexOf(n);return i===-1?this:this.copy([...this.items.slice(0,i),r,...this.items.slice(i+1)])}),M(this,"upsert",(n,r,i="append")=>{let a=this.indexOf(n);return a===-1?(i==="append"?this.append:this.prepend)(r):this.copy([...this.items.slice(0,a),r,...this.items.slice(a+1)])}),M(this,"insert",(n,...r)=>this.copy(mo(this.items,n,...r))),M(this,"insertBefore",(n,...r)=>{let i=this.indexOf(n);if(i===-1)if(this.items.length===0)i=0;else return this;return this.copy(mo(this.items,i,...r))}),M(this,"insertAfter",(n,...r)=>{let i=this.indexOf(n);if(i===-1)if(this.items.length===0)i=0;else return this;return this.copy(mo(this.items,i+1,...r))}),M(this,"prepend",(...n)=>this.copy(mo(this.items,0,...n))),M(this,"append",(...n)=>this.copy(mo(this.items,this.items.length,...n))),M(this,"filter",n=>{let r=this.items.filter((i,a)=>n(this.stringifyItem(i),a,i));return this.copy(r)}),M(this,"remove",(...n)=>{let r=n.map(i=>typeof i=="string"?i:this.getItemValue(i));return this.copy(this.items.filter(i=>{let a=this.getItemValue(i);return a==null?!1:!r.includes(a)}))}),M(this,"move",(n,r)=>{let i=this.indexOf(n);return i===-1?this:this.copy(Vl(this.items,[i],r))}),M(this,"moveBefore",(n,...r)=>{let i=this.items.findIndex(o=>this.getItemValue(o)===n);if(i===-1)return this;let a=r.map(o=>this.items.findIndex(s=>this.getItemValue(s)===o)).sort((o,s)=>o-s);return this.copy(Vl(this.items,a,i))}),M(this,"moveAfter",(n,...r)=>{let i=this.items.findIndex(o=>this.getItemValue(o)===n);if(i===-1)return this;let a=r.map(o=>this.items.findIndex(s=>this.getItemValue(s)===o)).sort((o,s)=>o-s);return this.copy(Vl(this.items,a,i+1))}),M(this,"reorder",(n,r)=>this.copy(Vl(this.items,[n],r))),M(this,"compareValue",(n,r)=>{let i=this.indexOf(n),a=this.indexOf(r);return ia?1:0}),M(this,"range",(n,r)=>{let i=[],a=n;for(;a!=null;){if(this.find(a)&&i.push(a),a===r)return i;a=this.getNextValue(a)}return[]}),M(this,"getValueRange",(n,r)=>n&&r?this.compareValue(n,r)<=0?this.range(n,r):this.range(r,n):[]),M(this,"toString",()=>{let n="";for(let r of this.items){let i=this.getItemValue(r),a=this.stringifyItem(r),o=this.getItemDisabled(r),s=[i,a,o].filter(Boolean).join(":");n+=s+","}return n}),M(this,"toJSON",()=>({size:this.size,first:this.firstValue,last:this.lastValue})),this.items=[...t.items]}get size(){return this.items.length}get firstValue(){let t=0;for(;this.getItemDisabled(this.at(t));)t++;return this.getItemValue(this.at(t))}get lastValue(){let t=this.size-1;for(;this.getItemDisabled(this.at(t));)t--;return this.getItemValue(this.at(t))}*[Symbol.iterator](){yield*Sp(this.items)}},gO=(e,t)=>!!(e!=null&&e.toLowerCase().startsWith(t.toLowerCase()));nu=class extends Sn{constructor(e){let{columnCount:t}=e;super(e),M(this,"columnCount"),M(this,"rows",null),M(this,"getRows",()=>(this.rows||(this.rows=Ba([...this.items],this.columnCount)),this.rows)),M(this,"getRowCount",()=>Math.ceil(this.items.length/this.columnCount)),M(this,"getCellIndex",(n,r)=>n*this.columnCount+r),M(this,"getCell",(n,r)=>this.at(this.getCellIndex(n,r))),M(this,"getValueCell",n=>{let r=this.indexOf(n);if(r===-1)return null;let i=Math.floor(r/this.columnCount),a=r%this.columnCount;return{row:i,column:a}}),M(this,"getLastEnabledColumnIndex",n=>{for(let r=this.columnCount-1;r>=0;r--){let i=this.getCell(n,r);if(i&&!this.getItemDisabled(i))return r}return null}),M(this,"getFirstEnabledColumnIndex",n=>{for(let r=0;r{let i=this.getValueCell(n);if(i===null)return null;let a=this.getRows(),o=a.length,s=i.row,l=i.column;for(let c=1;c<=o;c++){s=Ha(a,s,{loop:r});let d=a[s];if(!d)continue;if(!d[l]){let g=this.getLastEnabledColumnIndex(s);g!=null&&(l=g)}let p=this.getCell(s,l);if(!this.getItemDisabled(p))return this.getItemValue(p)}return this.firstValue}),M(this,"getNextRowValue",(n,r=!1)=>{let i=this.getValueCell(n);if(i===null)return null;let a=this.getRows(),o=a.length,s=i.row,l=i.column;for(let c=1;c<=o;c++){s=Mi(a,s,{loop:r});let d=a[s];if(!d)continue;if(!d[l]){let g=this.getLastEnabledColumnIndex(s);g!=null&&(l=g)}let p=this.getCell(s,l);if(!this.getItemDisabled(p))return this.getItemValue(p)}return this.lastValue}),this.columnCount=t}};Mm=class xl extends Set{constructor(t=[]){super(t),M(this,"selectionMode","single"),M(this,"deselectable",!0),M(this,"copy",()=>{let n=new xl([...this]);return this.sync(n)}),M(this,"sync",n=>(n.selectionMode=this.selectionMode,n.deselectable=this.deselectable,n)),M(this,"isEmpty",()=>this.size===0),M(this,"isSelected",n=>this.selectionMode==="none"||n==null?!1:this.has(n)),M(this,"canSelect",(n,r)=>this.selectionMode!=="none"||!n.getItemDisabled(n.find(r))),M(this,"firstSelectedValue",n=>{let r=null;for(let i of this)(!r||n.compareValue(i,r)<0)&&(r=i);return r}),M(this,"lastSelectedValue",n=>{let r=null;for(let i of this)(!r||n.compareValue(i,r)>0)&&(r=i);return r}),M(this,"extendSelection",(n,r,i)=>{if(this.selectionMode==="none")return this;if(this.selectionMode==="single")return this.replaceSelection(n,i);let a=this.copy(),o=Array.from(this).pop();for(let s of n.getValueRange(r,o!=null?o:i))a.delete(s);for(let s of n.getValueRange(i,r))this.canSelect(n,s)&&a.add(s);return a}),M(this,"toggleSelection",(n,r)=>{if(this.selectionMode==="none")return this;if(this.selectionMode==="single"&&!this.isSelected(r))return this.replaceSelection(n,r);let i=this.copy();return i.has(r)?i.delete(r):i.canSelect(n,r)&&i.add(r),i}),M(this,"replaceSelection",(n,r)=>{if(this.selectionMode==="none")return this;if(r==null)return this;if(!this.canSelect(n,r))return this;let i=new xl([r]);return this.sync(i)}),M(this,"setSelection",n=>{if(this.selectionMode==="none")return this;let r=new xl;for(let i of n)if(i!=null&&(r.add(i),this.selectionMode==="single"))break;return this.sync(r)}),M(this,"clearSelection",()=>{let n=this.copy();return n.deselectable&&n.size>0&&n.clear(),n}),M(this,"select",(n,r,i)=>this.selectionMode==="none"?this:this.selectionMode==="single"?this.isSelected(r)&&this.deselectable?this.toggleSelection(n,r):this.replaceSelection(n,r):this.selectionMode==="multiple"||i?this.toggleSelection(n,r):this.replaceSelection(n,r)),M(this,"deselect",n=>{let r=this.copy();return r.delete(n),r}),M(this,"isEqual",n=>Ce(Array.from(this),Array.from(n)))}};iu=class Um{constructor(t){M(this,"options",t),M(this,"rootNode"),M(this,"isEqual",n=>Ce(this.rootNode,n.rootNode)),M(this,"getNodeChildren",n=>{var r,i,a,o;return(o=(a=(i=(r=this.options).nodeToChildren)==null?void 0:i.call(r,n))!=null?a:sa.nodeToChildren(n))!=null?o:[]}),M(this,"resolveIndexPath",n=>typeof n=="string"?this.getIndexPath(n):n),M(this,"resolveNode",n=>{let r=this.resolveIndexPath(n);return r?this.at(r):void 0}),M(this,"getNodeChildrenCount",n=>{var r,i,a;return(a=(i=(r=this.options).nodeToChildrenCount)==null?void 0:i.call(r,n))!=null?a:sa.nodeToChildrenCount(n)}),M(this,"getNodeValue",n=>{var r,i,a;return(a=(i=(r=this.options).nodeToValue)==null?void 0:i.call(r,n))!=null?a:sa.nodeToValue(n)}),M(this,"getNodeDisabled",n=>{var r,i,a;return(a=(i=(r=this.options).isNodeDisabled)==null?void 0:i.call(r,n))!=null?a:sa.isNodeDisabled(n)}),M(this,"stringify",n=>{let r=this.findNode(n);return r?this.stringifyNode(r):null}),M(this,"stringifyNode",n=>{var r,i,a;return(a=(i=(r=this.options).nodeToString)==null?void 0:i.call(r,n))!=null?a:sa.nodeToString(n)}),M(this,"getFirstNode",(n=this.rootNode,r={})=>{let i;return Rt(n,{getChildren:this.getNodeChildren,onEnter:(a,o)=>{var s;if(!this.isSameNode(a,n)){if((s=r.skip)!=null&&s.call(r,{value:this.getNodeValue(a),node:a,indexPath:o}))return"skip";if(!i&&o.length>0&&!this.getNodeDisabled(a))return i=a,"stop"}}}),i}),M(this,"getLastNode",(n=this.rootNode,r={})=>{let i;return Rt(n,{getChildren:this.getNodeChildren,onEnter:(a,o)=>{var s;if(!this.isSameNode(a,n)){if((s=r.skip)!=null&&s.call(r,{value:this.getNodeValue(a),node:a,indexPath:o}))return"skip";o.length>0&&!this.getNodeDisabled(a)&&(i=a)}}}),i}),M(this,"at",n=>_m(this.rootNode,n,{getChildren:this.getNodeChildren})),M(this,"findNode",(n,r=this.rootNode)=>fO(r,{getChildren:this.getNodeChildren,predicate:i=>this.getNodeValue(i)===n})),M(this,"findNodes",(n,r=this.rootNode)=>{let i=new Set(n.filter(a=>a!=null));return mO(r,{getChildren:this.getNodeChildren,predicate:a=>i.has(this.getNodeValue(a))})}),M(this,"sort",n=>n.reduce((r,i)=>{let a=this.getIndexPath(i);return a&&r.push({value:i,indexPath:a}),r},[]).sort((r,i)=>$m(r.indexPath,i.indexPath)).map(({value:r})=>r)),M(this,"getValue",n=>{let r=this.at(n);return r?this.getNodeValue(r):void 0}),M(this,"getValuePath",n=>{if(!n)return[];let r=[],i=[...n];for(;i.length>0;){let a=this.at(i);a&&r.unshift(this.getNodeValue(a)),i.pop()}return r}),M(this,"getDepth",n=>{var i;let r=Nm(this.rootNode,{getChildren:this.getNodeChildren,predicate:a=>this.getNodeValue(a)===n});return(i=r==null?void 0:r.length)!=null?i:0}),M(this,"isSameNode",(n,r)=>this.getNodeValue(n)===this.getNodeValue(r)),M(this,"isRootNode",n=>this.isSameNode(n,this.rootNode)),M(this,"contains",(n,r)=>!n||!r?!1:r.slice(0,n.length).every((i,a)=>n[a]===r[a])),M(this,"getNextNode",(n,r={})=>{let i=!1,a;return Rt(this.rootNode,{getChildren:this.getNodeChildren,onEnter:(o,s)=>{var c;if(this.isRootNode(o))return;let l=this.getNodeValue(o);if((c=r.skip)!=null&&c.call(r,{value:l,node:o,indexPath:s}))return l===n&&(i=!0),"skip";if(i&&!this.getNodeDisabled(o))return a=o,"stop";l===n&&(i=!0)}}),a}),M(this,"getPreviousNode",(n,r={})=>{let i,a=!1;return Rt(this.rootNode,{getChildren:this.getNodeChildren,onEnter:(o,s)=>{var c;if(this.isRootNode(o))return;let l=this.getNodeValue(o);if((c=r.skip)!=null&&c.call(r,{value:l,node:o,indexPath:s}))return"skip";if(l===n)return a=!0,"stop";this.getNodeDisabled(o)||(i=o)}}),a?i:void 0}),M(this,"getParentNodes",n=>{var a;let r=(a=this.resolveIndexPath(n))==null?void 0:a.slice();if(!r)return[];let i=[];for(;r.length>0;){r.pop();let o=this.at(r);o&&!this.isRootNode(o)&&i.unshift(o)}return i}),M(this,"getDescendantNodes",(n,r)=>{let i=this.resolveNode(n);if(!i)return[];let a=[];return Rt(i,{getChildren:this.getNodeChildren,onEnter:(o,s)=>{s.length!==0&&(!(r!=null&&r.withBranch)&&this.isBranchNode(o)||a.push(o))}}),a}),M(this,"getDescendantValues",(n,r)=>this.getDescendantNodes(n,r).map(a=>this.getNodeValue(a))),M(this,"getParentIndexPath",n=>n.slice(0,-1)),M(this,"getParentNode",n=>{let r=this.resolveIndexPath(n);return r?this.at(this.getParentIndexPath(r)):void 0}),M(this,"visit",n=>{let a=n,{skip:r}=a,i=St(a,["skip"]);Rt(this.rootNode,y(h({},i),{getChildren:this.getNodeChildren,onEnter:(o,s)=>{var l;if(!this.isRootNode(o))return r!=null&&r({value:this.getNodeValue(o),node:o,indexPath:s})?"skip":(l=i.onEnter)==null?void 0:l.call(i,o,s)}}))}),M(this,"getPreviousSibling",n=>{let r=this.getParentNode(n);if(!r)return;let i=this.getNodeChildren(r),a=n[n.length-1];for(;--a>=0;){let o=i[a];if(!this.getNodeDisabled(o))return o}}),M(this,"getNextSibling",n=>{let r=this.getParentNode(n);if(!r)return;let i=this.getNodeChildren(r),a=n[n.length-1];for(;++a{let r=this.getParentNode(n);return r?this.getNodeChildren(r):[]}),M(this,"getValues",(n=this.rootNode)=>yO(n,{getChildren:this.getNodeChildren,transform:i=>[this.getNodeValue(i)]}).slice(1)),M(this,"isValidDepth",(n,r)=>r==null?!0:typeof r=="function"?r(n.length):n.length===r),M(this,"isBranchNode",n=>this.getNodeChildren(n).length>0||this.getNodeChildrenCount(n)!=null),M(this,"getBranchValues",(n=this.rootNode,r={})=>{let i=[];return Rt(n,{getChildren:this.getNodeChildren,onEnter:(a,o)=>{var l;if(o.length===0)return;let s=this.getNodeValue(a);if((l=r.skip)!=null&&l.call(r,{value:s,node:a,indexPath:o}))return"skip";this.isBranchNode(a)&&this.isValidDepth(o,r.depth)&&i.push(this.getNodeValue(a))}}),i}),M(this,"flatten",(n=this.rootNode)=>EO(n,{getChildren:this.getNodeChildren})),M(this,"_create",(n,r)=>this.getNodeChildren(n).length>0||r.length>0?y(h({},n),{children:r}):h({},n)),M(this,"_insert",(n,r,i)=>this.copy(CO(n,{at:r,nodes:i,getChildren:this.getNodeChildren,create:this._create}))),M(this,"copy",n=>new Um(y(h({},this.options),{rootNode:n}))),M(this,"_replace",(n,r,i)=>this.copy(wO(n,{at:r,node:i,getChildren:this.getNodeChildren,create:this._create}))),M(this,"_move",(n,r,i)=>this.copy(VO(n,{indexPaths:r,to:i,getChildren:this.getNodeChildren,create:this._create}))),M(this,"_remove",(n,r)=>this.copy(OO(n,{indexPaths:r,getChildren:this.getNodeChildren,create:this._create}))),M(this,"replace",(n,r)=>this._replace(this.rootNode,n,r)),M(this,"remove",n=>this._remove(this.rootNode,n)),M(this,"insertBefore",(n,r)=>this.getParentNode(n)?this._insert(this.rootNode,n,r):void 0),M(this,"insertAfter",(n,r)=>{if(!this.getParentNode(n))return;let a=[...n.slice(0,-1),n[n.length-1]+1];return this._insert(this.rootNode,a,r)}),M(this,"move",(n,r)=>this._move(this.rootNode,n,r)),M(this,"filter",n=>{let r=bO(this.rootNode,{predicate:n,getChildren:this.getNodeChildren,create:this._create});return this.copy(r)}),M(this,"toJSON",()=>this.getValues(this.rootNode)),this.rootNode=t.rootNode}getIndexPath(t){if(Array.isArray(t)){if(t.length===0)return[];let n=[],r=this.getNodeChildren(this.rootNode);for(let i=0;ithis.getNodeValue(s)===a);if(o===-1)break;if(n.push(o),ithis.getNodeValue(n)===t})}},sa={nodeToValue(e){return typeof e=="string"?e:un(e)&&at(e,"value")?e.value:""},nodeToString(e){return typeof e=="string"?e:un(e)&&at(e,"label")?e.label:sa.nodeToValue(e)},isNodeDisabled(e){return un(e)&&at(e,"disabled")?!!e.disabled:!1},nodeToChildren(e){return e.children},nodeToChildrenCount(e){if(un(e)&&at(e,"childrenCount"))return e.childrenCount}}});function zm(e,t){let{context:n,prop:r,scope:i,computed:a,send:o,refs:s}=e,l=r("disabled"),c=r("collection"),d=In(c)?"grid":"list",u=n.get("focused"),p=s.get("focusVisible")&&u,g=s.get("inputState"),f=n.get("value"),m=a("selectedItems"),S=n.get("highlightedValue"),T=n.get("highlightedItem"),w=a("isTypingAhead"),I=a("isInteractive"),P=S?ou(i,S):void 0;function v(E){let R=c.getItemDisabled(E.item),x=c.getItemValue(E.item);nn(x,()=>`[zag-js] No value found for item ${JSON.stringify(E.item)}`);let C=S===x;return{value:x,disabled:!!(l||R),focused:C&&u,focusVisible:C&&p,highlighted:C&&(g.focused?u:p),selected:n.get("value").includes(x)}}return{empty:f.length===0,highlightedItem:T,highlightedValue:S,clearHighlightedValue(){o({type:"HIGHLIGHTED_VALUE.SET",value:null})},selectedItems:m,hasSelectedItems:a("hasSelectedItems"),value:f,valueAsString:a("valueAsString"),collection:c,disabled:!!l,selectValue(E){o({type:"ITEM.SELECT",value:E})},setValue(E){o({type:"VALUE.SET",value:E})},selectAll(){if(!a("multiple"))throw new Error("[zag-js] Cannot select all items in a single-select listbox");o({type:"VALUE.SET",value:c.getValues()})},highlightValue(E){o({type:"HIGHLIGHTED_VALUE.SET",value:E})},highlightFirst(){o({type:"HIGHLIGHT.FIRST"})},highlightLast(){o({type:"HIGHLIGHT.LAST"})},highlightNext(){o({type:"HIGHLIGHT.NEXT"})},highlightPrevious(){o({type:"HIGHLIGHT.PREV"})},clearValue(E){o(E?{type:"ITEM.CLEAR",value:E}:{type:"VALUE.CLEAR"})},getItemState:v,getRootProps(){return t.element(y(h({},Tn.root.attrs),{dir:r("dir"),id:RO(i),"data-orientation":r("orientation"),"data-disabled":b(l)}))},getInputProps(E={}){var x;let R=(x=E.keyboardPriority)!=null?x:"caret";return t.input(y(h({},Tn.input.attrs),{dir:r("dir"),disabled:l,"data-disabled":b(l),autoComplete:"off",autoCorrect:"off","aria-haspopup":"listbox","aria-controls":au(i),"aria-autocomplete":"list","aria-activedescendant":P,spellCheck:!1,enterKeyHint:"go",onFocus(){queueMicrotask(()=>{o({type:"INPUT.FOCUS",autoHighlight:!!(E!=null&&E.autoHighlight)})})},onBlur(){o({type:"CONTENT.BLUR",src:"input"})},onInput(C){E!=null&&E.autoHighlight&&(C.currentTarget.value.trim()||queueMicrotask(()=>{o({type:"HIGHLIGHTED_VALUE.SET",value:null})}))},onKeyDown(C){if(C.defaultPrevented||Me(C))return;let A=Ot(C),N=()=>{var K;C.preventDefault();let k=i.getWin(),L=new k.KeyboardEvent(A.type,A);(K=kl(i))==null||K.dispatchEvent(L)};switch(A.key){case"ArrowLeft":case"ArrowRight":{if(!In(c)||C.ctrlKey||R!=="navigate")return;N();break}case"Home":case"End":{if(R!=="navigate"||S==null&&C.shiftKey)return;N();break}case"ArrowDown":case"ArrowUp":{N();break}case"Enter":S!=null&&(C.preventDefault(),o({type:"ITEM.CLICK",value:S}));break;default:break}}}))},getLabelProps(){return t.element(y(h({dir:r("dir"),id:qm(i)},Tn.label.attrs),{"data-disabled":b(l)}))},getValueTextProps(){return t.element(y(h({},Tn.valueText.attrs),{dir:r("dir"),"data-disabled":b(l)}))},getItemProps(E){let R=v(E);return t.element(y(h({id:ou(i,R.value),role:"option"},Tn.item.attrs),{dir:r("dir"),"data-value":R.value,"aria-selected":R.selected,"data-selected":b(R.selected),"data-layout":d,"data-state":R.selected?"checked":"unchecked","data-orientation":r("orientation"),"data-highlighted":b(R.highlighted),"data-disabled":b(R.disabled),"aria-disabled":se(R.disabled),onPointerMove(x){E.highlightOnHover&&(R.disabled||x.pointerType!=="mouse"||R.highlighted||o({type:"ITEM.POINTER_MOVE",value:R.value}))},onMouseDown(x){var C;x.preventDefault(),(C=kl(i))==null||C.focus()},onClick(x){x.defaultPrevented||jr(x)||$n(x)||pr(x)||R.disabled||o({type:"ITEM.CLICK",value:R.value,shiftKey:x.shiftKey,anchorValue:S,metaKey:xs(x)})}}))},getItemTextProps(E){let R=v(E);return t.element(y(h({},Tn.itemText.attrs),{"data-state":R.selected?"checked":"unchecked","data-disabled":b(R.disabled),"data-highlighted":b(R.highlighted)}))},getItemIndicatorProps(E){let R=v(E);return t.element(y(h({},Tn.itemIndicator.attrs),{"aria-hidden":!0,"data-state":R.selected?"checked":"unchecked",hidden:!R.selected}))},getItemGroupLabelProps(E){let{htmlFor:R}=E;return t.element(y(h({},Tn.itemGroupLabel.attrs),{id:Wm(i,R),dir:r("dir"),role:"presentation"}))},getItemGroupProps(E){let{id:R}=E;return t.element(y(h({},Tn.itemGroup.attrs),{"data-disabled":b(l),"data-orientation":r("orientation"),"data-empty":b(c.size===0),id:kO(i,R),"aria-labelledby":Wm(i,R),role:"group",dir:r("dir")}))},getContentProps(){return t.element(y(h({dir:r("dir"),id:au(i),role:"listbox"},Tn.content.attrs),{"data-activedescendant":P,"aria-activedescendant":P,"data-orientation":r("orientation"),"aria-multiselectable":a("multiple")?!0:void 0,"aria-labelledby":qm(i),tabIndex:0,"data-layout":d,"data-empty":b(c.size===0),style:{"--column-count":In(c)?c.columnCount:1},onFocus(){o({type:"CONTENT.FOCUS"})},onBlur(){o({type:"CONTENT.BLUR"})},onKeyDown(E){if(!I)return;let R=ne(E);if(!ge(E.currentTarget,ne(E)))return;let x=E.shiftKey,C={ArrowUp(N){let k=null;In(c)&&S?k=c.getPreviousRowValue(S):S&&(k=c.getPreviousValue(S)),!k&&(r("loopFocus")||!S)&&(k=c.lastValue),k&&(N.preventDefault(),o({type:"NAVIGATE",value:k,shiftKey:x,anchorValue:S}))},ArrowDown(N){let k=null;In(c)&&S?k=c.getNextRowValue(S):S&&(k=c.getNextValue(S)),!k&&(r("loopFocus")||!S)&&(k=c.firstValue),k&&(N.preventDefault(),o({type:"NAVIGATE",value:k,shiftKey:x,anchorValue:S}))},ArrowLeft(){if(!In(c)&&r("orientation")==="vertical")return;let N=S?c.getPreviousValue(S):null;!N&&r("loopFocus")&&(N=c.lastValue),N&&(E.preventDefault(),o({type:"NAVIGATE",value:N,shiftKey:x,anchorValue:S}))},ArrowRight(){if(!In(c)&&r("orientation")==="vertical")return;let N=S?c.getNextValue(S):null;!N&&r("loopFocus")&&(N=c.firstValue),N&&(E.preventDefault(),o({type:"NAVIGATE",value:N,shiftKey:x,anchorValue:S}))},Home(N){if($t(R))return;N.preventDefault();let k=c.firstValue;o({type:"NAVIGATE",value:k,shiftKey:x,anchorValue:S})},End(N){if($t(R))return;N.preventDefault();let k=c.lastValue;o({type:"NAVIGATE",value:k,shiftKey:x,anchorValue:S})},Enter(){o({type:"ITEM.CLICK",value:S})},a(N){xs(N)&&a("multiple")&&!r("disallowSelectAll")&&(N.preventDefault(),o({type:"VALUE.SET",value:c.getValues()}))},Space(N){var k;w&&r("typeahead")?o({type:"CONTENT.TYPEAHEAD",key:N.key}):(k=C.Enter)==null||k.call(C,N)},Escape(N){r("deselectable")&&f.length>0&&(N.preventDefault(),N.stopPropagation(),o({type:"VALUE.CLEAR"}))}},A=C[me(E)];if(A){A(E);return}$t(R)||ft.isValidEvent(E)&&r("typeahead")&&(o({type:"CONTENT.TYPEAHEAD",key:E.key}),E.preventDefault())}}))}}}function vo(e,t,n){let r=FO(t,e);for(let i of r)n==null||n({value:i})}function Cn(e){var t;return(t=e.value)!=null?t:""}function Rr(e,t){return t?{items:e,itemToValue:n=>Cn(n),itemToString:n=>n.label,isItemDisabled:n=>!!n.disabled,groupBy:n=>{var r;return(r=n.group)!=null?r:""}}:{items:e,itemToValue:n=>Cn(n),itemToString:n=>n.label,isItemDisabled:n=>!!n.disabled}}function su(e,t){return yo(Rr(e,t))}var AO,Tn,yo,xO,RO,au,qm,ou,kO,Wm,kl,Km,NO,LO,DO,jm,FO,Nl=ee(()=>{"use strict";ca();yn();oe();AO=z("listbox").parts("label","input","item","itemText","itemIndicator","itemGroup","itemGroupLabel","content","root","valueText"),Tn=AO.build(),yo=e=>new Sn(e);yo.empty=()=>new Sn({items:[]});xO=e=>new nu(e);xO.empty=()=>new nu({items:[],columnCount:0});RO=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`listbox:${e.id}`},au=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`listbox:${e.id}:content`},qm=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`listbox:${e.id}:label`},ou=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.item)==null?void 0:r.call(n,t))!=null?i:`listbox:${e.id}:item:${t}`},kO=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemGroup)==null?void 0:r.call(n,t))!=null?i:`listbox:${e.id}:item-group:${t}`},Wm=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemGroupLabel)==null?void 0:r.call(n,t))!=null?i:`listbox:${e.id}:item-group-label:${t}`},kl=e=>e.getById(au(e)),Km=(e,t)=>e.getById(ou(e,t));({guards:NO,createMachine:LO}=Mt()),{or:DO}=NO,jm=LO({props({props:e}){return h({loopFocus:!1,composite:!0,defaultValue:[],multiple:!1,typeahead:!0,collection:yo.empty(),orientation:"vertical",selectionMode:"single"},e)},context({prop:e,bindable:t,getContext:n}){var a,o;let r=(o=(a=e("value"))!=null?a:e("defaultValue"))!=null?o:[],i=e("collection").findMany(r);return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:Ce,onChange(s){var f,m;let l=n(),c=e("collection"),d=l.get("selectedItemMap"),u=kt({values:s,collection:c,selectedItemMap:d}),p=(f=e("value"))!=null?f:s,g=p===s?u:kt({values:p,collection:c,selectedItemMap:u.nextSelectedItemMap});return l.set("selectedItemMap",g.nextSelectedItemMap),(m=e("onValueChange"))==null?void 0:m({value:s,items:u.selectedItems})}})),highlightedValue:t(()=>({defaultValue:e("defaultHighlightedValue")||null,value:e("highlightedValue"),sync:!0,onChange(s){var l;(l=e("onHighlightChange"))==null||l({highlightedValue:s,highlightedItem:e("collection").find(s),highlightedIndex:e("collection").indexOf(s)})}})),highlightedItem:t(()=>({defaultValue:null})),selectedItemMap:t(()=>({defaultValue:la({selectedItems:i,collection:e("collection")})})),focused:t(()=>({sync:!0,defaultValue:!1}))}},refs(){return{typeahead:h({},ft.defaultOptions),focusVisible:!1,inputState:{autoHighlight:!1,focused:!1}}},computed:{hasSelectedItems:({context:e})=>e.get("value").length>0,isTypingAhead:({refs:e})=>e.get("typeahead").keysSoFar!=="",isInteractive:({prop:e})=>!e("disabled"),selection:({context:e,prop:t})=>{let n=new Mm(e.get("value"));return n.selectionMode=t("selectionMode"),n.deselectable=!!t("deselectable"),n},multiple:({prop:e})=>e("selectionMode")==="multiple"||e("selectionMode")==="extended",selectedItems:({context:e,prop:t})=>oi({values:e.get("value"),collection:t("collection"),selectedItemMap:e.get("selectedItemMap")}),valueAsString:({computed:e,prop:t})=>t("collection").stringifyItems(e("selectedItems"))},initialState(){return"idle"},watch({context:e,prop:t,track:n,action:r}){n([()=>e.get("value").toString()],()=>{r(["syncSelectedItems"])}),n([()=>e.get("highlightedValue")],()=>{r(["syncHighlightedItem"])}),n([()=>t("collection").toString()],()=>{r(["syncHighlightedValue"])})},effects:["trackFocusVisible"],on:{"HIGHLIGHTED_VALUE.SET":{actions:["setHighlightedItem"]},"ITEM.SELECT":{actions:["selectItem"]},"ITEM.CLEAR":{actions:["clearItem"]},"VALUE.SET":{actions:["setSelectedItems"]},"VALUE.CLEAR":{actions:["clearSelectedItems"]},"HIGHLIGHT.FIRST":{actions:["highlightFirstValue"]},"HIGHLIGHT.LAST":{actions:["highlightLastValue"]},"HIGHLIGHT.NEXT":{actions:["highlightNextValue"]},"HIGHLIGHT.PREV":{actions:["highlightPreviousValue"]}},states:{idle:{effects:["scrollToHighlightedItem"],on:{"INPUT.FOCUS":{actions:["setFocused","setInputState"]},"CONTENT.FOCUS":[{guard:DO("hasSelectedValue","hasHighlightedValue"),actions:["setFocused"]},{actions:["setFocused","setDefaultHighlightedValue"]}],"CONTENT.BLUR":{actions:["clearFocused","clearInputState"]},"ITEM.CLICK":{actions:["setHighlightedItem","selectHighlightedItem"]},"CONTENT.TYPEAHEAD":{actions:["setFocused","highlightMatchingItem"]},"ITEM.POINTER_MOVE":{actions:["highlightItem"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedItem"]},NAVIGATE:{actions:["setFocused","setHighlightedItem","selectWithKeyboard"]}}}},implementations:{guards:{hasSelectedValue:({context:e})=>e.get("value").length>0,hasHighlightedValue:({context:e})=>e.get("highlightedValue")!=null},effects:{trackFocusVisible:({scope:e,refs:t})=>{var n;return nt({root:(n=e.getRootNode)==null?void 0:n.call(e),onChange(r){t.set("focusVisible",r.isFocusVisible)}})},scrollToHighlightedItem({context:e,prop:t,scope:n}){let r=a=>{let o=e.get("highlightedValue");if(o==null||Sr()==="pointer")return;let l=kl(n),c=t("scrollToIndexFn");if(c){let u=t("collection").indexOf(o);c==null||c({index:u,immediate:a,getElement(){return Km(n,o)}});return}let d=Km(n,o);Gn(d,{rootEl:l,block:"nearest"})};return B(()=>{Ir("virtual"),r(!0)}),Ht(()=>kl(n),{defer:!0,attributes:["data-activedescendant"],callback(){r(!1)}})}},actions:{selectHighlightedItem({context:e,prop:t,event:n,computed:r}){var s;let i=(s=n.value)!=null?s:e.get("highlightedValue"),a=t("collection");if(i==null||!a.has(i))return;let o=r("selection");if(n.shiftKey&&r("multiple")&&n.anchorValue){let l=o.extendSelection(a,n.anchorValue,i);vo(o,l,t("onSelect")),e.set("value",Array.from(l))}else{let l=o.select(a,i,n.metaKey);vo(o,l,t("onSelect")),e.set("value",Array.from(l))}},selectWithKeyboard({context:e,prop:t,event:n,computed:r}){let i=r("selection"),a=t("collection");if(n.shiftKey&&r("multiple")&&n.anchorValue){let o=i.extendSelection(a,n.anchorValue,n.value);vo(i,o,t("onSelect")),e.set("value",Array.from(o));return}if(t("selectOnHighlight")){let o=i.replaceSelection(a,n.value);vo(i,o,t("onSelect")),e.set("value",Array.from(o))}},highlightItem({context:e,event:t}){e.set("highlightedValue",t.value)},highlightMatchingItem({context:e,prop:t,event:n,refs:r}){let i=t("collection").search(n.key,{state:r.get("typeahead"),currentValue:e.get("highlightedValue")});i!=null&&e.set("highlightedValue",i)},setHighlightedItem({context:e,event:t}){e.set("highlightedValue",t.value)},highlightFirstValue({context:e,prop:t}){var n;e.set("highlightedValue",(n=t("collection").firstValue)!=null?n:null)},highlightLastValue({context:e,prop:t}){var n;e.set("highlightedValue",(n=t("collection").lastValue)!=null?n:null)},highlightNextValue({context:e,prop:t}){let n=t("collection"),r=e.get("highlightedValue"),i=null;In(n)&&r?i=n.getNextRowValue(r):r&&(i=n.getNextValue(r)),!i&&(t("loopFocus")||!r)&&(i=n.firstValue),i&&e.set("highlightedValue",i)},highlightPreviousValue({context:e,prop:t}){let n=t("collection"),r=e.get("highlightedValue"),i=null;In(n)&&r?i=n.getPreviousRowValue(r):r&&(i=n.getPreviousValue(r)),!i&&(t("loopFocus")||!r)&&(i=n.lastValue),i&&e.set("highlightedValue",i)},clearHighlightedItem({context:e}){e.set("highlightedValue",null)},selectItem({context:e,prop:t,event:n,computed:r}){let i=t("collection"),a=r("selection"),o=a.select(i,n.value);vo(a,o,t("onSelect")),e.set("value",Array.from(o))},clearItem({context:e,event:t,computed:n}){let i=n("selection").deselect(t.value);e.set("value",Array.from(i))},setSelectedItems({context:e,event:t}){e.set("value",t.value)},clearSelectedItems({context:e}){e.set("value",[])},syncSelectedItems({context:e,prop:t}){let n=kt({values:e.get("value"),collection:t("collection"),selectedItemMap:e.get("selectedItemMap")});e.set("selectedItemMap",n.nextSelectedItemMap)},syncHighlightedItem({context:e,prop:t}){let n=t("collection"),r=e.get("highlightedValue"),i=r?n.find(r):null;e.set("highlightedItem",i)},syncHighlightedValue({context:e,prop:t,refs:n}){let r=t("collection"),i=e.get("highlightedValue"),{autoHighlight:a}=n.get("inputState");if(a){queueMicrotask(()=>{var o;e.set("highlightedValue",(o=t("collection").firstValue)!=null?o:null)});return}i!=null&&!r.has(i)&&queueMicrotask(()=>{e.set("highlightedValue",null)})},setFocused({context:e}){e.set("focused",!0)},setDefaultHighlightedValue({context:e,prop:t}){let r=t("collection").firstValue;r!=null&&e.set("highlightedValue",r)},clearFocused({context:e}){e.set("focused",!1)},setInputState({refs:e,event:t}){e.set("inputState",{autoHighlight:!!t.autoHighlight,focused:!0})},clearInputState({refs:e}){e.set("inputState",{autoHighlight:!1,focused:!1})}}}}),FO=(e,t)=>{let n=new Set(e);for(let r of t)n.delete(r);return n}});function lu(e){let t=e.trim();if(!t||t.startsWith("//"))return!1;let n=_O.exec(t);if(n){let r=n[0].slice(0,-1).toLowerCase();return r==="http"||r==="https"}return!0}function wn(e,t){if(!e)return!t||!lu(t)?null:{destination:t};let n=e.getAttribute("data-redirect");if(n==="false")return null;let r=e.getAttribute("data-to")||t||e.getAttribute("data-value")||"";if(!r||!lu(r))return null;let i=MO.includes(n)?n:void 0,a=e.hasAttribute("data-new-tab");return{destination:r,mode:i,newTab:a}}function On(e,t){if(!e||!e.destination||!lu(e.destination))return!1;let{destination:n,newTab:r,mode:i}=e;if(r)return window.open(n,"_blank","noopener,noreferrer"),!0;let a=t.liveSocket.main;if(!(!a.isDead&&a.isConnected())||!i||i==="href")return window.location.href=n,!0;let s=t.liveSocket.js();return i==="patch"?s.patch(n):s.navigate(n),!0}var MO,_O,da=ee(()=>{"use strict";MO=["href","patch","navigate"],_O=/^[a-zA-Z][a-zA-Z0-9+.-]*:/});var sv={};pe(sv,{Combobox:()=>ZO,comboboxValueBinding:()=>hn,formatComboboxHiddenValue:()=>av,selectedItemLabel:()=>pu,syncComboboxHiddenInputForPhoenix:()=>gu,syncVisibleInputAttribute:()=>Fl});function qO(e,t){let{context:n,prop:r,state:i,send:a,scope:o,computed:s,event:l}=e,c=r("translations"),d=r("collection"),u=!!r("disabled"),p=s("isInteractive"),g=!!r("invalid"),f=!!r("required"),m=!!r("readOnly"),S=i.hasTag("open"),T=i.hasTag("focused"),w=r("composite"),I=n.get("highlightedValue"),P=Ut(y(h({},r("positioning")),{placement:n.get("currentPlacement")}));function v(E){let R=d.getItemDisabled(E.item),x=d.getItemValue(E.item);return nn(x,()=>`[zag-js] No value found for item ${JSON.stringify(E.item)}`),{value:x,disabled:!!(u||R),highlighted:I===x,selected:n.get("value").includes(x)}}return{focused:T,open:S,inputValue:n.get("inputValue"),highlightedValue:I,highlightedItem:n.get("highlightedItem"),value:n.get("value"),valueAsString:s("valueAsString"),hasSelectedItems:s("hasSelectedItems"),selectedItems:s("selectedItems"),collection:r("collection"),multiple:!!r("multiple"),disabled:!!u,syncSelectedItems(){a({type:"SELECTED_ITEMS.SYNC"})},reposition(E={}){a({type:"POSITIONING.SET",options:E})},setHighlightValue(E){a({type:"HIGHLIGHTED_VALUE.SET",value:E})},clearHighlightValue(){a({type:"HIGHLIGHTED_VALUE.CLEAR"})},selectValue(E){a({type:"ITEM.SELECT",value:E})},setValue(E){a({type:"VALUE.SET",value:E})},setInputValue(E,R="script"){a({type:"INPUT_VALUE.SET",value:E,src:R})},clearValue(E){E!=null?a({type:"ITEM.CLEAR",value:E}):a({type:"VALUE.CLEAR"})},focus(){var E;(E=ga(o))==null||E.focus()},setOpen(E,R="script"){i.hasTag("open")!==E&&a({type:E?"OPEN":"CLOSE",src:R})},getRootProps(){return t.element(y(h({},bt.root.attrs),{dir:r("dir"),id:HO(o),"data-invalid":b(g),"data-readonly":b(m)}))},getLabelProps(){return t.label(y(h({},bt.label.attrs),{dir:r("dir"),htmlFor:Ll(o),id:cu(o),"data-readonly":b(m),"data-disabled":b(u),"data-invalid":b(g),"data-required":b(f),"data-focus":b(T),onClick(E){var R;w||(E.preventDefault(),(R=bo(o))==null||R.focus({preventScroll:!0}))}}))},getControlProps(){return t.element(y(h({},bt.control.attrs),{dir:r("dir"),id:tv(o),"data-state":S?"open":"closed","data-focus":b(T),"data-disabled":b(u),"data-invalid":b(g)}))},getPositionerProps(){return t.element(y(h({},bt.positioner.attrs),{dir:r("dir"),id:nv(o),style:P.floating}))},getInputProps(){return t.input(y(h({},bt.input.attrs),{dir:r("dir"),"aria-invalid":se(g),"data-invalid":b(g),"data-autofocus":b(r("autoFocus")),name:r("name"),form:r("form"),disabled:u,required:r("required"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"none",spellCheck:"false",readOnly:m,placeholder:r("placeholder"),id:Ll(o),type:"text",role:"combobox",defaultValue:n.get("inputValue"),"aria-autocomplete":s("autoComplete")?"both":"list","aria-controls":Dl(o),"aria-expanded":S,"data-state":S?"open":"closed","aria-activedescendant":I?Xm(o,I):void 0,onClick(E){E.defaultPrevented||r("openOnClick")&&p&&a({type:"INPUT.CLICK",src:"input-click"})},onFocus(){u||a({type:"INPUT.FOCUS"})},onBlur(){u||a({type:"INPUT.BLUR"})},onChange(E){a({type:"INPUT.CHANGE",value:E.currentTarget.value,src:"input-change"})},onKeyDown(E){if(E.defaultPrevented||!p||E.ctrlKey||E.shiftKey||Me(E))return;let R=r("openOnKeyPress"),x=E.ctrlKey||E.metaKey||E.shiftKey,C=!0,A={ArrowDown(L){!R&&!S||(a({type:L.altKey?"OPEN":"INPUT.ARROW_DOWN",keypress:C,src:"arrow-key"}),L.preventDefault())},ArrowUp(){!R&&!S||(a({type:E.altKey?"CLOSE":"INPUT.ARROW_UP",keypress:C,src:"arrow-key"}),E.preventDefault())},Home(L){x||(a({type:"INPUT.HOME",keypress:C}),S&&L.preventDefault())},End(L){x||(a({type:"INPUT.END",keypress:C}),S&&L.preventDefault())},Enter(L){var ce;a({type:"INPUT.ENTER",keypress:C,src:"item-select"});let K=s("isCustomValue")&&r("allowCustomValue"),J=I!=null,ue=r("alwaysSubmitOnEnter");if(S&&!K&&!ue&&J&&L.preventDefault(),I==null)return;let Z=ua(o,I);_t(Z)&&((ce=r("navigate"))==null||ce({value:I,node:Z,href:Z.href}))},Escape(){a({type:"INPUT.ESCAPE",keypress:C,src:"escape-key"}),E.preventDefault()}},N=me(E,{dir:r("dir")}),k=A[N];k==null||k(E)}}))},getTriggerProps(E={}){return t.button(y(h({},bt.trigger.attrs),{dir:r("dir"),id:rv(o),"aria-haspopup":w?"listbox":"dialog",type:"button",tabIndex:E.focusable?void 0:-1,"aria-label":c.triggerLabel,"aria-expanded":S,"data-state":S?"open":"closed","aria-controls":S?Dl(o):void 0,disabled:u,"data-invalid":b(g),"data-focusable":b(E.focusable),"data-readonly":b(m),"data-disabled":b(u),onFocus(){E.focusable&&a({type:"INPUT.FOCUS",src:"trigger"})},onClick(R){R.defaultPrevented||p&&fe(R)&&a({type:"TRIGGER.CLICK",src:"trigger-click"})},onPointerDown(R){p&&R.pointerType!=="touch"&&fe(R)&&(R.preventDefault(),queueMicrotask(()=>{du(o)}))},onKeyDown(R){if(R.defaultPrevented||w)return;let x={ArrowDown(){a({type:"INPUT.ARROW_DOWN",src:"arrow-key"})},ArrowUp(){a({type:"INPUT.ARROW_UP",src:"arrow-key"})}},C=me(R,{dir:r("dir")}),A=x[C];A&&(A(R),R.preventDefault())}}))},getContentProps(){return t.element(y(h({},bt.content.attrs),{dir:r("dir"),id:Dl(o),role:w?"listbox":"dialog",tabIndex:-1,hidden:!S,"data-state":S?"open":"closed","data-placement":n.get("currentPlacement"),"aria-labelledby":cu(o),"aria-multiselectable":r("multiple")&&w?!0:void 0,"data-empty":b(d.size===0),onPointerDown(E){fe(E)&&E.preventDefault()}}))},getListProps(){return t.element(y(h({},bt.list.attrs),{role:w?void 0:"listbox","data-empty":b(d.size===0),"aria-labelledby":cu(o),"aria-multiselectable":r("multiple")&&!w?!0:void 0}))},getClearTriggerProps(){return t.button(y(h({},bt.clearTrigger.attrs),{dir:r("dir"),id:iv(o),type:"button",tabIndex:-1,disabled:u,"data-invalid":b(g),"aria-label":c.clearTriggerLabel,"aria-controls":Ll(o),hidden:!n.get("value").length,onPointerDown(E){fe(E)&&E.preventDefault()},onClick(E){E.defaultPrevented||p&&a({type:"VALUE.CLEAR",src:"clear-trigger"})}}))},getItemState:v,getItemProps(E){let R=v(E),x=R.value;return t.element(y(h({},bt.item.attrs),{dir:r("dir"),id:Xm(o,x),role:"option",tabIndex:-1,"data-highlighted":b(R.highlighted),"data-state":R.selected?"checked":"unchecked","aria-selected":se(R.selected),"aria-disabled":se(R.disabled),"data-disabled":b(R.disabled),"data-value":R.value,onPointerMove(){R.disabled||R.highlighted||a({type:"ITEM.POINTER_MOVE",value:x})},onPointerLeave(){if(E.persistFocus||R.disabled)return;let C=l.previous();C!=null&&C.type.includes("POINTER")&&a({type:"ITEM.POINTER_LEAVE",value:x})},onClick(C){jr(C)||$n(C)||pr(C)||R.disabled||a({type:"ITEM.CLICK",src:"item-select",value:x})}}))},getItemTextProps(E){let R=v(E);return t.element(y(h({},bt.itemText.attrs),{dir:r("dir"),"data-state":R.selected?"checked":"unchecked","data-disabled":b(R.disabled),"data-highlighted":b(R.highlighted)}))},getItemIndicatorProps(E){let R=v(E);return t.element(y(h({"aria-hidden":!0},bt.itemIndicator.attrs),{dir:r("dir"),"data-state":R.selected?"checked":"unchecked",hidden:!R.selected}))},getItemGroupProps(E){let{id:R}=E;return t.element(y(h({},bt.itemGroup.attrs),{dir:r("dir"),id:BO(o,R),"aria-labelledby":Ym(o,R),"data-empty":b(d.size===0),role:"group"}))},getItemGroupLabelProps(E){let{htmlFor:R}=E;return t.element(y(h({},bt.itemGroupLabel.attrs),{dir:r("dir"),id:Ym(o,R),role:"presentation"}))}}}function Qm(e){return(e.previousEvent||e).src}function av(e,t){var r;let n=t.map(i=>String(i));return n.length===0?"":O(e,"multiple")?n.join(","):(r=n[0])!=null?r:""}function gu(e,t,n){let r=V(e,"submitName");if(r&&O(e,"multiple")){sn(e,t,{onTouched:n,scope:"combobox",submitName:r,notifyLiveView:!0});return}let i=e.querySelector('[data-scope="combobox"][data-part="hidden-input"]');i&&Vr(i,()=>av(e,t),n)}function ev(e){let t=e.querySelector('[data-scope="combobox"][data-part="hidden-input"]');t&&Wt(t)}function pu(e){let t=e==null?void 0:e[0];return t&&t.label!=null?String(t.label):""}function Fl(e,t){let n=e.querySelector('[data-scope="combobox"][data-part="input"]');n&&n.setAttribute("value",t)}function ov(e,t,n,r,i,a){let o=O(e,"redirect");return{id:e.id,disabled:O(e,"disabled"),placeholder:V(e,"placeholder"),alwaysSubmitOnEnter:O(e,"alwaysSubmitOnEnter"),autoFocus:O(e,"autoFocus"),closeOnSelect:O(e,"closeOnSelect"),dir:q(e),inputBehavior:V(e,"inputBehavior"),loopFocus:O(e,"loopFocus"),multiple:o?!1:O(e,"multiple"),invalid:O(e,"invalid"),allowCustomValue:!1,selectionBehavior:"replace",readOnly:O(e,"readonly"),required:O(e,"required"),positioning:qe(e),onOpenChange:s=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,open:s.open,reason:s.reason,value:s.value},serverEventName:V(e,"onOpenChange"),clientEventName:V(e,"onOpenChangeClient")})},onInputValueChange:s=>{var l;Fl(e,(l=s.inputValue)!=null?l:""),W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,value:s.inputValue,reason:s.reason},serverEventName:V(e,"onInputValueChange"),clientEventName:V(e,"onInputValueChangeClient")})},onValueChange:s=>{var c;let l=s.value.length>0?String(s.value[0]):null;if(o&&l){let d=e.querySelector(`[data-scope="combobox"][data-part="item"][data-value="${CSS.escape(l)}"]`);On(wn(d,l),{liveSocket:r})}gu(e,s.value,a),(c=i())==null||c.restoreFilteredOptions(),Fl(e,pu(s.items)),W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,value:s.value,items:s.items},serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})}}}function XO(e,t,n,r,i,a){let o=h({},ov(e,t,n,r,i,a));return delete o.onOpenChange,delete o.onInputValueChange,delete o.onValueChange,o}var $O,bt,uu,HO,cu,tv,Ll,Dl,nv,rv,iv,BO,Ym,Xm,li,ga,Zm,Jm,bo,GO,ua,du,UO,WO,KO,zO,Et,si,jO,YO,ZO,lv=ee(()=>{"use strict";vl();bl();ii();Or();on();ai();Kt();xr();Nl();ca();da();yn();$e();Ve();be();oe();$O=z("combobox").parts("root","clearTrigger","content","control","input","item","itemGroup","itemGroupLabel","itemIndicator","itemText","label","list","positioner","trigger"),bt=$O.build(),uu=e=>new Sn(e);uu.empty=()=>new Sn({items:[]});HO=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`combobox:${e.id}`},cu=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`combobox:${e.id}:label`},tv=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`combobox:${e.id}:control`},Ll=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`combobox:${e.id}:input`},Dl=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`combobox:${e.id}:content`},nv=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`combobox:${e.id}:popper`},rv=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`combobox:${e.id}:toggle-btn`},iv=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.clearTrigger)!=null?n:`combobox:${e.id}:clear-btn`},BO=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemGroup)==null?void 0:r.call(n,t))!=null?i:`combobox:${e.id}:optgroup:${t}`},Ym=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemGroupLabel)==null?void 0:r.call(n,t))!=null?i:`combobox:${e.id}:optgroup-label:${t}`},Xm=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.item)==null?void 0:r.call(n,t))!=null?i:`combobox:${e.id}:option:${t}`},li=e=>e.getById(Dl(e)),ga=e=>e.getById(Ll(e)),Zm=e=>e.getById(nv(e)),Jm=e=>e.getById(tv(e)),bo=e=>e.getById(rv(e)),GO=e=>e.getById(iv(e)),ua=(e,t)=>{if(t==null)return null;let n=`[role=option][data-value="${CSS.escape(t)}"]`;return fr(li(e),n)},du=e=>{let t=ga(e);e.isActiveElement(t)||t==null||t.focus({preventScroll:!0}),_i(t)},UO=e=>{let t=bo(e);e.isActiveElement(t)||t==null||t.focus({preventScroll:!0})};({guards:WO,createMachine:KO,choose:zO}=Mt()),{and:Et,not:si}=WO,jO=KO({props({props:e}){return y(h({loopFocus:!0,openOnClick:!1,defaultValue:[],defaultInputValue:"",closeOnSelect:!e.multiple,allowCustomValue:!1,alwaysSubmitOnEnter:!1,inputBehavior:"none",selectionBehavior:e.multiple?"clear":"replace",openOnKeyPress:!0,openOnChange:!0,composite:!0,navigate({node:t}){Ui(t)},collection:uu.empty()},e),{positioning:h({placement:"bottom",sameWidth:!0},e.positioning),translations:h({triggerLabel:"Toggle suggestions",clearTriggerLabel:"Clear value"},e.translations)})},initialState({prop:e}){return e("open")||e("defaultOpen")?"open.suggesting":"closed.idle"},context({prop:e,bindable:t,getContext:n,getEvent:r}){var o,s;let i=(s=(o=e("value"))!=null?o:e("defaultValue"))!=null?s:[],a=e("collection").findMany(i);return{currentPlacement:t(()=>({defaultValue:void 0})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:Ce,hash(l){return l.join(",")},onChange(l){var m,S;let c=n(),d=e("collection"),u=c.get("selectedItemMap"),p=kt({values:l,collection:d,selectedItemMap:u}),g=(m=e("value"))!=null?m:l,f=g===l?p:kt({values:g,collection:d,selectedItemMap:p.nextSelectedItemMap});c.set("selectedItemMap",f.nextSelectedItemMap),(S=e("onValueChange"))==null||S({value:l,items:p.selectedItems})}})),highlightedValue:t(()=>({defaultValue:e("defaultHighlightedValue")||null,value:e("highlightedValue"),onChange(l){var d;let c=e("collection").find(l);(d=e("onHighlightChange"))==null||d({highlightedValue:l,highlightedItem:c})}})),inputValue:t(()=>{let l=e("inputValue")||e("defaultInputValue"),c=e("value")||e("defaultValue");if(!l.trim()&&!e("multiple")){let d=e("collection").stringifyMany(c);l=He(e("selectionBehavior"),{preserve:l||d,replace:d,clear:""})}return{defaultValue:l,value:e("inputValue"),onChange(d){var g;let u=r(),p=(u.previousEvent||u).src;(g=e("onInputValueChange"))==null||g({inputValue:d,reason:p})}}}),highlightedItem:t(()=>{let l=e("highlightedValue");return{defaultValue:e("collection").find(l)}}),selectedItemMap:t(()=>({defaultValue:la({selectedItems:a,collection:e("collection")})}))}},computed:{isInputValueEmpty:({context:e})=>e.get("inputValue").length===0,isInteractive:({prop:e})=>!(e("readOnly")||e("disabled")),autoComplete:({prop:e})=>e("inputBehavior")==="autocomplete",autoHighlight:({prop:e})=>e("inputBehavior")==="autohighlight",hasSelectedItems:({context:e})=>e.get("value").length>0,selectedItems:({context:e,prop:t})=>oi({values:e.get("value"),collection:t("collection"),selectedItemMap:e.get("selectedItemMap")}),valueAsString:({computed:e,prop:t})=>t("collection").stringifyItems(e("selectedItems")),isCustomValue:({context:e,computed:t})=>e.get("inputValue")!==t("valueAsString")},watch({context:e,prop:t,track:n,action:r,send:i}){n([()=>e.hash("value")],()=>{r(["syncSelectedItems"])}),n([()=>e.get("inputValue")],()=>{r(["syncInputValue"])}),n([()=>e.get("highlightedValue")],()=>{r(["syncHighlightedItem","autofillInputValue","announceHighlightedItem"])}),n([()=>t("open")],()=>{r(["toggleVisibility"])}),n([()=>t("collection").toString()],()=>{i({type:"CHILDREN_CHANGE"})})},on:{"SELECTED_ITEMS.SYNC":{actions:["syncSelectedItems"]},"HIGHLIGHTED_VALUE.SET":{actions:["setHighlightedValue"]},"HIGHLIGHTED_VALUE.CLEAR":{actions:["clearHighlightedValue"]},"ITEM.SELECT":{actions:["selectItem"]},"ITEM.CLEAR":{actions:["clearItem"]},"VALUE.SET":{actions:["setValue"]},"INPUT_VALUE.SET":{actions:["setInputValue"]},"POSITIONING.SET":{actions:["reposition"]}},entry:zO([{guard:"autoFocus",actions:["setInitialFocus"]}]),states:{closed:{tags:["closed"],initial:"idle",states:{idle:{tags:["idle"],entry:["scrollContentToTop","clearHighlightedValue"],on:{"CONTROLLED.OPEN":{target:"open.interacting"},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]},{target:"open.interacting",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]}],"INPUT.CLICK":[{guard:"isOpenControlled",actions:["highlightFirstSelectedItem","invokeOnOpen"]},{target:"open.interacting",actions:["highlightFirstSelectedItem","invokeOnOpen"]}],"INPUT.FOCUS":{target:"focused"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open.interacting",actions:["invokeOnOpen"]}],"VALUE.CLEAR":{target:"focused",actions:["clearInputValue","clearSelectedItems","setInitialFocus"]}}},focused:{tags:["focused"],entry:["scrollContentToTop","clearHighlightedValue"],on:{"CONTROLLED.OPEN":[{guard:"isChangeEvent",target:"open.suggesting"},{target:"open.interacting"}],"INPUT.CHANGE":[{guard:Et("isOpenControlled","openOnChange"),actions:["setInputValue","invokeOnOpen","highlightFirstItemIfNeeded"]},{guard:"openOnChange",target:"open.suggesting",actions:["setInputValue","invokeOnOpen","highlightFirstItemIfNeeded"]},{actions:["setInputValue"]}],"LAYER.INTERACT_OUTSIDE":{target:"idle"},"INPUT.ESCAPE":{guard:Et("isCustomValue",si("allowCustomValue")),actions:["revertInputValue"]},"INPUT.BLUR":{target:"idle"},"INPUT.CLICK":[{guard:"isOpenControlled",actions:["highlightFirstSelectedItem","invokeOnOpen"]},{target:"open.interacting",actions:["highlightFirstSelectedItem","invokeOnOpen"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]},{target:"open.interacting",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]}],"INPUT.ARROW_DOWN":[{guard:Et("isOpenControlled","autoComplete"),actions:["invokeOnOpen"]},{guard:"autoComplete",target:"open.interacting",actions:["invokeOnOpen"]},{guard:"isOpenControlled",actions:["highlightFirstOrSelectedItem","invokeOnOpen"]},{target:"open.interacting",actions:["highlightFirstOrSelectedItem","invokeOnOpen"]}],"INPUT.ARROW_UP":[{guard:Et("isOpenControlled","autoComplete"),actions:["invokeOnOpen"]},{guard:"autoComplete",target:"open.interacting",actions:["invokeOnOpen"]},{guard:"isOpenControlled",actions:["highlightLastOrSelectedItem","invokeOnOpen"]},{target:"open.interacting",actions:["highlightLastOrSelectedItem","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open.interacting",actions:["invokeOnOpen"]}],"VALUE.CLEAR":{actions:["clearInputValue","clearSelectedItems"]}}}}},open:{tags:["open","focused"],entry:["setInitialFocus"],effects:["trackFocusVisible","scrollToHighlightedItem","trackDismissableLayer","trackPlacement","trackLiveRegion"],on:{"CONTROLLED.CLOSE":[{guard:"restoreFocus",target:"closed.focused",actions:["setFinalFocus"]},{target:"closed.idle"}],"INPUT.ENTER":[{guard:Et("isOpenControlled","isCustomValue",si("hasHighlightedItem"),si("allowCustomValue")),actions:["revertInputValue","invokeOnClose"]},{guard:Et("isCustomValue",si("hasHighlightedItem"),si("allowCustomValue")),target:"closed.focused",actions:["revertInputValue","invokeOnClose"]},{guard:Et("isOpenControlled","closeOnSelect"),actions:["selectHighlightedItem","invokeOnClose"]},{guard:"closeOnSelect",target:"closed.focused",actions:["selectHighlightedItem","invokeOnClose","setFinalFocus"]},{actions:["selectHighlightedItem"]}],"ITEM.CLICK":[{guard:Et("isOpenControlled","closeOnSelect"),actions:["selectItem","invokeOnClose"]},{guard:"closeOnSelect",target:"closed.focused",actions:["selectItem","invokeOnClose","setFinalFocus"]},{actions:["selectItem"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed.focused",actions:["invokeOnClose"]}],"LAYER.INTERACT_OUTSIDE":[{guard:Et("isOpenControlled","isCustomValue",si("allowCustomValue")),actions:["revertInputValue","invokeOnClose"]},{guard:Et("isCustomValue",si("allowCustomValue")),target:"closed.idle",actions:["revertInputValue","invokeOnClose"]},{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed.idle",actions:["invokeOnClose"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed.focused",actions:["invokeOnClose","setFinalFocus"]}],"VALUE.CLEAR":[{guard:"isOpenControlled",actions:["clearInputValue","clearSelectedItems","invokeOnClose"]},{target:"closed.focused",actions:["clearInputValue","clearSelectedItems","invokeOnClose","setFinalFocus"]}]},initial:"interacting",states:{interacting:{on:{CHILDREN_CHANGE:[{guard:"isHighlightedItemRemoved",actions:["clearHighlightedValue"]},{actions:["scrollToHighlightedItem"]}],"INPUT.HOME":{actions:["highlightFirstItem"]},"INPUT.END":{actions:["highlightLastItem"]},"INPUT.ARROW_DOWN":[{guard:Et("autoComplete","isLastItemHighlighted"),actions:["clearHighlightedValue","scrollContentToTop"]},{actions:["highlightNextItem"]}],"INPUT.ARROW_UP":[{guard:Et("autoComplete","isFirstItemHighlighted"),actions:["clearHighlightedValue"]},{actions:["highlightPrevItem"]}],"INPUT.CHANGE":[{guard:"autoComplete",target:"suggesting",actions:["setInputValue"]},{target:"suggesting",actions:["clearHighlightedValue","setInputValue"]}],"ITEM.POINTER_MOVE":{actions:["setHighlightedValue"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedValue"]},"LAYER.ESCAPE":[{guard:Et("isOpenControlled","autoComplete"),actions:["syncInputValue","invokeOnClose"]},{guard:"autoComplete",target:"closed.focused",actions:["syncInputValue","invokeOnClose"]},{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed.focused",actions:["invokeOnClose","setFinalFocus"]}]}},suggesting:{on:{CHILDREN_CHANGE:[{guard:Et("isHighlightedItemRemoved","hasCollectionItems","autoHighlight"),actions:["clearHighlightedValue","highlightFirstItem"]},{guard:"isHighlightedItemRemoved",actions:["clearHighlightedValue"]},{guard:"autoHighlight",actions:["highlightFirstItem"]}],"INPUT.ARROW_DOWN":{target:"interacting",actions:["highlightNextItem"]},"INPUT.ARROW_UP":{target:"interacting",actions:["highlightPrevItem"]},"INPUT.HOME":{target:"interacting",actions:["highlightFirstItem"]},"INPUT.END":{target:"interacting",actions:["highlightLastItem"]},"INPUT.CHANGE":{actions:["setInputValue"]},"LAYER.ESCAPE":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed.focused",actions:["invokeOnClose"]}],"ITEM.POINTER_MOVE":{target:"interacting",actions:["setHighlightedValue"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedValue"]}}}}}},implementations:{guards:{isInputValueEmpty:({computed:e})=>e("isInputValueEmpty"),autoComplete:({computed:e,prop:t})=>e("autoComplete")&&!t("multiple"),autoHighlight:({computed:e})=>e("autoHighlight"),isFirstItemHighlighted:({prop:e,context:t})=>e("collection").firstValue===t.get("highlightedValue"),isLastItemHighlighted:({prop:e,context:t})=>e("collection").lastValue===t.get("highlightedValue"),isCustomValue:({computed:e})=>e("isCustomValue"),allowCustomValue:({prop:e})=>!!e("allowCustomValue"),hasHighlightedItem:({context:e})=>e.get("highlightedValue")!=null,closeOnSelect:({prop:e})=>!!e("closeOnSelect"),isOpenControlled:({prop:e})=>e("open")!=null,openOnChange:({prop:e,context:t})=>{let n=e("openOnChange");return zp(n)?n:!!(n!=null&&n({inputValue:t.get("inputValue")}))},restoreFocus:({event:e})=>{var n,r;let t=(r=e.restoreFocus)!=null?r:(n=e.previousEvent)==null?void 0:n.restoreFocus;return t==null?!0:!!t},isChangeEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="INPUT.CHANGE"},autoFocus:({prop:e})=>!!e("autoFocus"),isHighlightedItemRemoved:({prop:e,context:t})=>!e("collection").has(t.get("highlightedValue")),hasCollectionItems:({prop:e})=>e("collection").size>0},effects:{trackFocusVisible({scope:e}){var t;return nt({root:(t=e.getRootNode)==null?void 0:t.call(e)})},trackDismissableLayer({send:e,prop:t,scope:n}){return t("disableLayer")?void 0:qt(()=>li(n),{type:"listbox",defer:!0,exclude:()=>[ga(n),bo(n),GO(n)],onFocusOutside:t("onFocusOutside"),onPointerDownOutside:t("onPointerDownOutside"),onInteractOutside:t("onInteractOutside"),onEscapeKeyDown(i){i.preventDefault(),i.stopPropagation(),e({type:"LAYER.ESCAPE",src:"escape-key"})},onDismiss(){e({type:"LAYER.INTERACT_OUTSIDE",src:"interact-outside",restoreFocus:!1})}})},trackLiveRegion({refs:e,scope:t}){let n=Qi({level:"assertive",document:t.getDoc()});return e.set("liveRegion",n),()=>n.destroy()},trackPlacement({context:e,prop:t,scope:n}){let r=()=>Jm(n)||bo(n),i=()=>Zm(n);return e.set("currentPlacement",t("positioning").placement),Xe(r,i,y(h({},t("positioning")),{defer:!0,onComplete(a){e.set("currentPlacement",a.placement)}}))},scrollToHighlightedItem({context:e,prop:t,scope:n}){let r=ga(n),i=[],a=l=>{if(Sr()==="pointer")return;let d=e.get("highlightedValue");if(!d)return;let u=li(n),p=t("scrollToIndexFn");if(p){let m=t("collection").indexOf(d);p({index:m,immediate:l,getElement:()=>ua(n,d)});return}let g=ua(n,d),f=B(()=>{Gn(g,{rootEl:u,block:"nearest"})});i.push(f)},o=B(()=>{Ir("virtual"),a(!0)});i.push(o);let s=Ht(r,{attributes:["aria-activedescendant"],callback:()=>a(!1)});return i.push(s),()=>{i.forEach(l=>l())}}},actions:{reposition({context:e,prop:t,scope:n,event:r}){Xe(()=>Jm(n),()=>Zm(n),y(h(h({},t("positioning")),r.options),{defer:!0,listeners:!1,onComplete(o){e.set("currentPlacement",o.placement)}}))},setHighlightedValue({context:e,event:t}){t.value!=null&&e.set("highlightedValue",t.value)},clearHighlightedValue({context:e}){e.set("highlightedValue",null)},selectHighlightedItem(e){var s;let{context:t,prop:n}=e,r=n("collection"),i=t.get("highlightedValue");if(!i||!r.has(i))return;let a=n("multiple")?tn(t.get("value"),i):[i];(s=n("onSelect"))==null||s({value:a,itemValue:i}),t.set("value",a);let o=He(n("selectionBehavior"),{preserve:t.get("inputValue"),replace:r.stringifyMany(a),clear:""});t.set("inputValue",o)},scrollToHighlightedItem({context:e,prop:t,scope:n}){Yr(()=>{let r=e.get("highlightedValue");if(r==null)return;let i=ua(n,r),a=li(n),o=t("scrollToIndexFn");if(o){let s=t("collection").indexOf(r);o({index:s,immediate:!0,getElement:()=>ua(n,r)});return}Gn(i,{rootEl:a,block:"nearest"})})},selectItem(e){let{context:t,event:n,flush:r,prop:i}=e;n.value!=null&&r(()=>{var s;let a=i("multiple")?tn(t.get("value"),n.value):[n.value];(s=i("onSelect"))==null||s({value:a,itemValue:n.value}),t.set("value",a);let o=He(i("selectionBehavior"),{preserve:t.get("inputValue"),replace:i("collection").stringifyMany(a),clear:""});t.set("inputValue",o)})},clearItem(e){let{context:t,event:n,flush:r,prop:i}=e;n.value!=null&&r(()=>{let a=Ft(t.get("value"),n.value);t.set("value",a);let o=He(i("selectionBehavior"),{preserve:t.get("inputValue"),replace:i("collection").stringifyMany(a),clear:""});t.set("inputValue",o)})},setInitialFocus({scope:e}){B(()=>{du(e)})},setFinalFocus({scope:e}){B(()=>{let t=bo(e);(t==null?void 0:t.dataset.focusable)==null?du(e):UO(e)})},syncInputValue({context:e,scope:t,event:n}){let r=ga(t);r&&(r.value=e.get("inputValue"),queueMicrotask(()=>{n.current().type!=="INPUT.CHANGE"&&_i(r)}))},setInputValue({context:e,event:t}){e.set("inputValue",t.value)},clearInputValue({context:e}){e.set("inputValue","")},revertInputValue({context:e,prop:t,computed:n}){let r=t("selectionBehavior"),i=He(r,{replace:n("hasSelectedItems")?n("valueAsString"):"",preserve:e.get("inputValue"),clear:""});e.set("inputValue",i)},setValue(e){let{context:t,flush:n,event:r,prop:i}=e;n(()=>{t.set("value",r.value);let a=He(i("selectionBehavior"),{preserve:t.get("inputValue"),replace:i("collection").stringifyMany(r.value),clear:""});t.set("inputValue",a)})},clearSelectedItems(e){let{context:t,flush:n,prop:r}=e;n(()=>{t.set("value",[]);let i=He(r("selectionBehavior"),{preserve:t.get("inputValue"),replace:r("collection").stringifyMany([]),clear:""});t.set("inputValue",i)})},scrollContentToTop({prop:e,scope:t}){let n=e("scrollToIndexFn");if(n){let r=e("collection").firstValue;n({index:0,immediate:!0,getElement:()=>ua(t,r)})}else{let r=li(t);if(!r)return;r.scrollTop=0}},invokeOnOpen({prop:e,event:t,context:n}){var i;let r=Qm(t);(i=e("onOpenChange"))==null||i({open:!0,reason:r,value:n.get("value")})},invokeOnClose({prop:e,event:t,context:n}){var i;let r=Qm(t);(i=e("onOpenChange"))==null||i({open:!1,reason:r,value:n.get("value")})},highlightFirstItem({context:e,prop:t,scope:n}){(li(n)?queueMicrotask:B)(()=>{let i=t("collection").firstValue;i&&e.set("highlightedValue",i)})},highlightFirstItemIfNeeded({computed:e,action:t}){e("autoHighlight")&&t(["highlightFirstItem"])},highlightLastItem({context:e,prop:t,scope:n}){(li(n)?queueMicrotask:B)(()=>{let i=t("collection").lastValue;i&&e.set("highlightedValue",i)})},highlightNextItem({context:e,prop:t}){let n=null,r=e.get("highlightedValue"),i=t("collection");r?(n=i.getNextValue(r),!n&&t("loopFocus")&&(n=i.firstValue)):n=i.firstValue,n&&e.set("highlightedValue",n)},highlightPrevItem({context:e,prop:t}){let n=null,r=e.get("highlightedValue"),i=t("collection");r?(n=i.getPreviousValue(r),!n&&t("loopFocus")&&(n=i.lastValue)):n=i.lastValue,n&&e.set("highlightedValue",n)},highlightFirstSelectedItem({context:e,prop:t}){B(()=>{let[n]=t("collection").sort(e.get("value"));n&&e.set("highlightedValue",n)})},highlightFirstOrSelectedItem({context:e,prop:t,computed:n}){B(()=>{let r=null;n("hasSelectedItems")?r=t("collection").sort(e.get("value"))[0]:r=t("collection").firstValue,r&&e.set("highlightedValue",r)})},highlightLastOrSelectedItem({context:e,prop:t,computed:n}){B(()=>{let r=t("collection"),i=null;n("hasSelectedItems")?i=r.sort(e.get("value"))[0]:i=r.lastValue,i&&e.set("highlightedValue",i)})},autofillInputValue({context:e,computed:t,prop:n,event:r,scope:i}){let a=ga(i),o=n("collection");if(!t("autoComplete")||!a||!r.keypress)return;let s=o.stringify(e.get("highlightedValue"));B(()=>{a.value=s||e.get("inputValue")})},syncSelectedItems(e){queueMicrotask(()=>{let{context:t,prop:n}=e,r=n("collection"),i=t.get("value"),a=t.get("selectedItemMap"),o=kt({values:i,collection:r,selectedItemMap:a});t.set("selectedItemMap",o.nextSelectedItemMap);let s=He(n("selectionBehavior"),{preserve:t.get("inputValue"),replace:r.stringifyMany(i),clear:""});t.set("inputValue",s)})},syncHighlightedItem({context:e,prop:t}){let n=t("collection").find(e.get("highlightedValue"));e.set("highlightedItem",n)},announceHighlightedItem({context:e,prop:t,refs:n}){var o;if(!za())return;let r=e.get("highlightedValue"),i=r?t("collection").stringifyItem(t("collection").find(r)):null;if(!i)return;let a=r?e.get("value").includes(r):!1;(o=n.get("liveRegion"))==null||o.announce(a?`${i}, selected`:i)},toggleVisibility({event:e,send:t,prop:n}){t({type:n("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:e})}}}});YO=class extends X{constructor(t,n,r,i){super(t,n,a=>{let o=a;o.allOptions=r,o.options=r,o.hasGroups=i});Q(this,"options");Q(this,"allOptions");Q(this,"hasGroups");this.allOptions=r,this.options=r,this.hasGroups=i}setAllOptions(t){this.allOptions=t,this.options=t}restoreFilteredOptions(){this.options=this.allOptions}activeItems(){return this.options.length>0?this.options:this.allOptions}getCollection(){let t=this.activeItems();return uu(Rr(t,this.hasGroups))}initMachine(t){let n=()=>this.getCollection();return new Y(jO,y(h({},t),{get collection(){return n()},onOpenChange:r=>{r.open&&r.reason!=="input-change"&&(this.options=this.allOptions),t.onOpenChange&&t.onOpenChange(r)},onInputValueChange:r=>{var i;if(t.onInputValueChange&&t.onInputValueChange(r),this.el.hasAttribute("data-filter")){let a=String((i=r.inputValue)!=null?i:"").toLowerCase(),o=this.allOptions.filter(s=>{var d;let l=String((d=s.label)!=null?d:"").toLowerCase(),c=String(Cn(s)).toLowerCase();return l.includes(a)||c.includes(a)});this.options=o.length>0?o:this.allOptions}else this.options=this.allOptions}}))}initApi(){return this.zagConnect(qO)}getItemValue(t){var r,i;let n=(i=(r=this.api.collection).getItemValue)==null?void 0:i.call(r,t);return n!=null?n:Cn(t)}buildOrderedBlocks(t){var i;let n=[],r=null;for(let a of t){let o=(i=a.group)!=null?i:"";o===""?((r==null?void 0:r.type)!=="default"&&(r={type:"default",items:[]},n.push(r)),r.items.push(a)):(((r==null?void 0:r.type)!=="group"||r.groupId!==o)&&(r={type:"group",groupId:o,items:[]},n.push(r)),r.items.push(a))}return n}isOwnedByList(t,n){return n.closest('[data-scope="combobox"][data-part="list"]')===t}listPartElements(t,n){return Array.from(t.querySelectorAll(`[data-scope="combobox"][data-part="${n}"]:not([data-template])`)).filter(r=>this.isOwnedByList(t,r))}directListPartElements(t,n){return Array.from(t.children).filter(r=>r instanceof HTMLElement&&r.getAttribute("data-scope")==="combobox"&&r.getAttribute("data-part")===n&&!r.hasAttribute("data-template"))}removeListParts(t,n){for(let r of n)this.listPartElements(t,r).forEach(i=>i.remove())}cloneItemFromTemplate(t,n){let r=t.querySelector(`:scope > [data-scope="combobox"][data-part="item"][data-value="${CSS.escape(n)}"][data-template]`);if(!r)return null;let i=r.cloneNode(!0);return i.removeAttribute("data-template"),i}cloneGroupFromTemplate(t,n){let r=t.querySelector(`[data-scope="combobox"][data-part="item-group"][data-id="${CSS.escape(n)}"][data-template]`);if(!r)return null;let i=r.cloneNode(!0);return i.removeAttribute("data-template"),i.querySelectorAll("[data-template]").forEach(a=>a.removeAttribute("data-template")),i}syncFlatItems(t,n,r){var s,l,c;let i=r.map(d=>this.getItemValue(d)),a=new Set(i);this.listPartElements(t,"item").forEach(d=>{var p;let u=(p=d.dataset.value)!=null?p:"";a.has(u)||d.remove()});let o=new Map;this.listPartElements(t,"item").forEach(d=>{var u;o.set((u=d.dataset.value)!=null?u:"",d)});for(let d=0;di.length;)(c=t.lastElementChild)==null||c.remove()}syncGroupItems(t,n,r){var c,d,u;let i=t.querySelector("ul");if(!i)return;let a=n.map(p=>this.getItemValue(p)),o=new Set(a),s=(c=t.dataset.id)!=null?c:"";Array.from(i.querySelectorAll('[data-scope="combobox"][data-part="item"]:not([data-template])')).forEach(p=>{var f;let g=(f=p.dataset.value)!=null?f:"";o.has(g)||p.remove()});let l=new Map;Array.from(i.children).forEach(p=>{var g;p instanceof HTMLElement&&p.getAttribute("data-part")==="item"&&l.set((g=p.dataset.value)!=null?g:"",p)});for(let p=0;pa.length;)(u=i.lastElementChild)==null||u.remove()}syncGroupedItems(t,n,r){var s,l,c;let i=this.buildOrderedBlocks(r).filter(d=>d.type==="group"),a=new Set(i.map(d=>d.groupId));this.listPartElements(t,"item-group").forEach(d=>{var p;let u=(p=d.dataset.id)!=null?p:"";a.has(u)||d.remove()});let o=new Map;this.listPartElements(t,"item-group").forEach(d=>{var u;o.set((u=d.dataset.id)!=null?u:"",d)});for(let d=0;di.length;)(c=t.lastElementChild)==null||c.remove()}syncEmptyState(t,n){if(this.removeListParts(t,["item","item-group"]),this.listPartElements(t,"empty").length>0)return;let r=n.querySelector('[data-scope="combobox"][data-part="empty"][data-template]');if(!r)return;let i=r.cloneNode(!0);i.removeAttribute("data-template"),t.appendChild(i)}renderItems(){let t=this.el.querySelector('[data-scope="combobox"][data-part="list"]');if(!t)return;let n=Is(this.el,"combobox");if(!n)return;let r=this.activeItems();if(r.length===0){this.syncEmptyState(t,n);return}this.removeListParts(t,["empty"]),this.hasGroups?(this.directListPartElements(t,"item").forEach(i=>i.remove()),this.syncGroupedItems(t,n,r)):(this.removeListParts(t,["item-group"]),this.syncFlatItems(t,n,r))}applyItemProps(){let t=this.el.querySelector('[data-scope="combobox"][data-part="list"]');if(!t)return;let n=a=>a.closest('[data-scope="combobox"][data-part="list"]')===t;t.querySelectorAll('[data-scope="combobox"][data-part="item-group"]').forEach(a=>{var l;if(!n(a))return;let o=(l=a.dataset.id)!=null?l:"";this.spreadProps(a,this.api.getItemGroupProps({id:o}));let s=a.querySelector('[data-scope="combobox"][data-part="item-group-label"]');s&&this.spreadProps(s,this.api.getItemGroupLabelProps({htmlFor:o}))});let r=this.activeItems(),i=new Map;for(let a of r)i.set(this.getItemValue(a),a);for(let a of this.allOptions){let o=this.getItemValue(a);i.has(o)||i.set(o,a)}t.querySelectorAll('[data-scope="combobox"][data-part="item"]').forEach(a=>{var d;if(!n(a))return;let o=(d=a.dataset.value)!=null?d:"",s=i.get(o);if(!s)return;this.spreadProps(a,this.api.getItemProps({item:s}));let l=a.querySelector('[data-scope="combobox"][data-part="item-text"]');l&&this.spreadProps(l,this.api.getItemTextProps({item:s}));let c=a.querySelector('[data-scope="combobox"][data-part="item-indicator"]');c&&this.spreadProps(c,this.api.getItemIndicatorProps({item:s}))})}hiddenInputValue(){var r,i;let t=((r=this.api.value)!=null?r:[]).map(String);if(t.length===0){let a=this.el.dataset.defaultValue;a&&(t=a.split(",").filter(Boolean))}let n=this.el.hasAttribute("data-multiple");return t.length===0?"":n?t.join(","):(i=t[0])!=null?i:""}render(){let t=this.el.querySelector('[data-scope="combobox"][data-part="root"]');if(!t)return;this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="combobox"][data-part="hidden-input"]');if(n){let r=this.hiddenInputValue();n.value!==r&&(n.value=r),V(this.el,"submitName")&&(n.removeAttribute("name"),n.removeAttribute("form"))}Ji(this.el,"combobox",["hidden-input","input"]),["label","control","input","trigger","clear-trigger","positioner","content","list"].forEach(r=>{let i=this.el.querySelector(`[data-scope="combobox"][data-part="${r}"]`);if(!i)return;let a="get"+r.split("-").map(o=>o[0].toUpperCase()+o.slice(1)).join("")+"Props";this.spreadProps(i,this.api[a]())}),this.renderItems(),this.applyItemProps()}};ZO={mounted(){var f,m;let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=this;r.fieldTouched=!1;let i=()=>{r.fieldTouched=!0},a=(f=e.getAttribute("data-items"))!=null?f:"[]",o=JSON.parse(a),s=o.some(S=>!!S.group);((m=Ie(e,"defaultValue"))!=null?m:[]).length>0&&(r.fieldTouched=!0,queueMicrotask(()=>ev(e)));let c,d=h(h({},ov(e,t,n,this.liveSocket,()=>c,i)),hn(e)),u=new YO(e,d,o,s);c=u,u.init(),this.combobox=u,this.lastItemsJson=a;let p=ie(e);this.domRegistry=p,p.add("corex:combobox:set-value",S=>{u.api.setValue(S.detail.value)});let g=re(this);this.handleRegistry=g,g.add("combobox_set_value",S=>{$(e.id,H(S))&&u.api.setValue(S.value)})},updated(){var i;if(!this.combobox)return;let e=qn(this.el),t=(i=this.el.getAttribute("data-items"))!=null?i:"[]";if(t!==this.lastItemsJson){this.lastItemsJson=t;let a=JSON.parse(t),o=a.some(s=>!!s.group);this.combobox.hasGroups=o,this.combobox.setAllOptions(a)}let n=this.pushEvent.bind(this),r=()=>j(this.liveSocket);if(this.combobox.updateProps(h(h({},XO(this.el,n,r,this.liveSocket,()=>this.combobox,()=>{this.fieldTouched=!0})),e)),this.combobox.api.open&&this.combobox.api.reposition(),"value"in e){gu(this.el,e.value,void 0),ev(this.el);let a=pu(e.value.map(o=>({value:o,label:o})));Fl(this.el,a)}},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.combobox)==null||n.destroy()}}});var Ov={};pe(Ov,{ColorPicker:()=>zV,readValueProps:()=>KV});function cv(e,t){let{xChannel:n,yChannel:r,dir:i="ltr"}=t,{zChannel:a}=e.getColorAxes({xChannel:n,yChannel:r}),o=e.getChannelValue(a),{minValue:s,maxValue:l}=e.getChannelRange(a),c=["top",i==="rtl"?"left":"right"],d=!1,u={areaStyles:{},areaGradientStyles:{}},p=(o-s)/(l-s),g=e.getFormat()==="hsla";switch(a){case"red":{d=n==="green",u=tV(c,d,o);break}case"green":{d=n==="red",u=nV(c,d,o);break}case"blue":{d=n==="red",u=rV(c,d,o);break}case"hue":{d=n!=="saturation",g?u=iV(c,d,o):u=sV(c,d,o);break}case"saturation":{d=n==="hue",g?u=aV(c,d,p):u=lV(c,d,p);break}case"brightness":{d=n==="hue",u=cV(c,d,p);break}case"lightness":{d=n==="hue",u=oV(c,d,o);break}}return u}function xV(e,t){switch(t){case"hue":return kr(`hsl(${e.getChannelValue("hue")}, 100%, 50%)`);case"lightness":case"brightness":case"saturation":case"red":case"green":case"blue":return e.withChannelValue("alpha",1);case"alpha":return e;default:throw new Error("Unknown color channel: "+t)}}function bu(e,t){if(t==null)return"";if(t==="hex")return e.toString("hex");if(t==="css")return e.toString("css");if(t in e)return e.getChannelValue(t).toString();let n=e.getFormat()==="hsla";switch(t){case"hue":return n?e.toFormat("hsla").getChannelValue("hue").toString():e.toFormat("hsba").getChannelValue("hue").toString();case"saturation":return n?e.toFormat("hsla").getChannelValue("saturation").toString():e.toFormat("hsba").getChannelValue("saturation").toString();case"lightness":return e.toFormat("hsla").getChannelValue("lightness").toString();case"brightness":return e.toFormat("hsba").getChannelValue("brightness").toString();case"red":case"green":case"blue":return e.toFormat("rgba").getChannelValue(t).toString();default:return e.getChannelValue(t).toString()}}function RV(e,t){switch(t){case"hex":let n=kr("#000000"),r=kr("#FFFFFF");return{minValue:n.toHexInt(),maxValue:r.toHexInt(),pageSize:10,step:1};case"css":return;case"hue":case"saturation":case"lightness":return e.toFormat("hsla").getChannelRange(t);case"brightness":return e.toFormat("hsba").getChannelRange(t);case"red":case"green":case"blue":return e.toFormat("rgba").getChannelRange(t);default:return e.getChannelRange(t)}}function kV(e,t){return e==="vertical"?"top":t==="ltr"?"right":"left"}function LV(e,t){let{context:n,send:r,prop:i,computed:a,state:o,scope:s}=e,l=n.get("value"),c=n.get("format"),d=a("areaValue"),u=a("valueAsString"),p=a("disabled"),g=!!i("readOnly"),f=!!i("invalid"),m=!!i("required"),S=a("interactive"),T=o.hasTag("dragging"),w=o.hasTag("open"),I=o.hasTag("focused"),P=x=>{var A,N;let C=d.getChannels();return{xChannel:(A=x.xChannel)!=null?A:C[1],yChannel:(N=x.yChannel)!=null?N:C[2]}},v=n.get("currentPlacement"),E=Ut(y(h({},i("positioning")),{placement:v}));function R(x){let C=uv(x.value).toFormat(n.get("format"));return{value:C,valueAsString:C.toString("hex"),checked:C.isEqual(l),disabled:x.disabled||!S}}return{dragging:T,open:w,valueAsString:u,value:l,inline:!!i("inline"),setOpen(x){i("inline")||o.hasTag("open")===x||r({type:x?"OPEN":"CLOSE"})},setValue(x){r({type:"VALUE.SET",value:uv(x),src:"set-color"})},getChannelValue(x){return bu(l,x)},getChannelValueText(x,C){return l.formatChannelValue(x,C)},setChannelValue(x,C){let A=l.withChannelValue(x,C);r({type:"VALUE.SET",value:A,src:"set-channel"})},format:n.get("format"),setFormat(x){let C=l.toFormat(x);r({type:"VALUE.SET",value:C,src:"set-format"})},alpha:l.getChannelValue("alpha"),setAlpha(x){let C=l.withChannelValue("alpha",x);r({type:"VALUE.SET",value:C,src:"set-alpha"})},getRootProps(){return t.element(y(h({},Ne.root.attrs),{dir:i("dir"),id:yV(s),"data-disabled":b(p),"data-readonly":b(g),"data-invalid":b(f),style:{"--value":l.toString("css")}}))},getLabelProps(){return t.element(y(h({},Ne.label.attrs),{dir:i("dir"),id:gv(s),htmlFor:mu(s),"data-disabled":b(p),"data-readonly":b(g),"data-invalid":b(f),"data-required":b(m),"data-focus":b(I),onClick(x){x.preventDefault();let C=fr(wv(s),"[data-channel=hex]");C==null||C.focus({preventScroll:!0})}}))},getControlProps(){return t.element(y(h({},Ne.control.attrs),{id:Ev(s),dir:i("dir"),"data-disabled":b(p),"data-readonly":b(g),"data-invalid":b(f),"data-state":w?"open":"closed","data-focus":b(I)}))},getTriggerProps(){return t.button(y(h({},Ne.trigger.attrs),{id:Pv(s),dir:i("dir"),disabled:p,"aria-label":`select color. current color is ${u}`,"aria-controls":vu(s),"aria-labelledby":gv(s),"aria-haspopup":i("inline")?void 0:"dialog","data-disabled":b(p),"data-readonly":b(g),"data-invalid":b(f),"data-placement":v,"aria-expanded":w,"data-state":w?"open":"closed","data-focus":b(I),type:"button",onClick(){S&&r({type:"TRIGGER.CLICK"})},onBlur(){S&&r({type:"TRIGGER.BLUR"})},style:{position:"relative"}}))},getPositionerProps(){return t.element(y(h({},Ne.positioner.attrs),{id:Sv(s),dir:i("dir"),style:E.floating}))},getContentProps(){return t.element(y(h({},Ne.content.attrs),{id:vu(s),dir:i("dir"),role:i("inline")?void 0:"dialog",tabIndex:-1,"data-placement":v,"data-state":w?"open":"closed",hidden:!w}))},getValueTextProps(){return t.element(y(h({},Ne.valueText.attrs),{dir:i("dir"),"data-disabled":b(p),"data-focus":b(I)}))},getAreaProps(x={}){let{xChannel:C,yChannel:A}=P(x),{areaStyles:N}=cv(d,{xChannel:C,yChannel:A,dir:i("dir")});return t.element(y(h({},Ne.area.attrs),{id:Iv(s),role:"group","data-invalid":b(f),"data-disabled":b(p),"data-readonly":b(g),onPointerDown(k){if(!S||!fe(k)||Be(k))return;let L=et(k);r({type:"AREA.POINTER_DOWN",point:L,channel:{xChannel:C,yChannel:A},id:"area"}),k.preventDefault()},style:h({position:"relative",touchAction:"none",forcedColorAdjust:"none"},N)}))},getAreaBackgroundProps(x={}){let{xChannel:C,yChannel:A}=P(x),{areaGradientStyles:N}=cv(d,{xChannel:C,yChannel:A,dir:i("dir")});return t.element(y(h({},Ne.areaBackground.attrs),{id:EV(s),"data-invalid":b(f),"data-disabled":b(p),"data-readonly":b(g),style:h({position:"relative",touchAction:"none",forcedColorAdjust:"none"},N)}))},getAreaThumbProps(x={}){let{xChannel:C,yChannel:A}=P(x),N={xChannel:C,yChannel:A},k=d.getChannelValuePercent(C),L=1-d.getChannelValuePercent(A),J=i("dir")==="rtl"?1-k:k,ue=d.getChannelValue(C),Z=d.getChannelValue(A),ce=d.withChannelValue("alpha",1).toString("css");return t.element(y(h({},Ne.areaThumb.attrs),{id:Tv(s),dir:i("dir"),tabIndex:p?void 0:0,"data-disabled":b(p),"data-invalid":b(f),"data-readonly":b(g),role:"slider","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":ue,"aria-label":`${C} and ${A}`,"aria-roledescription":"2d slider","aria-valuetext":`${C} ${ue}, ${A} ${Z}`,style:{position:"absolute",left:`${J*100}%`,top:`${L*100}%`,transform:"translate(-50%, -50%)",touchAction:"none",forcedColorAdjust:"none","--color":ce,background:ce},onFocus(){S&&r({type:"AREA.FOCUS",id:"area",channel:N})},onKeyDown(ve){if(ve.defaultPrevented||!S)return;let le=Hn(ve),Fe={ArrowUp(){r({type:"AREA.ARROW_UP",channel:N,step:le})},ArrowDown(){r({type:"AREA.ARROW_DOWN",channel:N,step:le})},ArrowLeft(){r({type:"AREA.ARROW_LEFT",channel:N,step:le})},ArrowRight(){r({type:"AREA.ARROW_RIGHT",channel:N,step:le})},PageUp(){r({type:"AREA.PAGE_UP",channel:N,step:le})},PageDown(){r({type:"AREA.PAGE_DOWN",channel:N,step:le})},Escape(Qt){Qt.stopPropagation()}}[me(ve,{dir:i("dir")})];Fe&&(Fe(ve),ve.preventDefault())}}))},getTransparencyGridProps(x={}){let{size:C="12px"}=x;return t.element(y(h({},Ne.transparencyGrid.attrs),{style:{"--size":C,width:"100%",height:"100%",position:"absolute",backgroundColor:"#fff",backgroundImage:"conic-gradient(#eeeeee 0 25%, transparent 0 50%, #eeeeee 0 75%, transparent 0)",backgroundSize:"var(--size) var(--size)",inset:"0px",zIndex:"auto",pointerEvents:"none"}}))},getChannelSliderProps(x){let{orientation:C="horizontal",channel:A,format:N}=x;return t.element(y(h({},Ne.channelSlider.attrs),{"data-channel":A,"data-orientation":C,role:"presentation",onPointerDown(k){if(!S||!fe(k)||Be(k))return;let L=et(k);r({type:"CHANNEL_SLIDER.POINTER_DOWN",channel:A,format:N,point:L,id:A,orientation:C}),k.preventDefault()},style:{position:"relative",touchAction:"none"}}))},getChannelSliderTrackProps(x){let{orientation:C="horizontal",channel:A,format:N}=x,k=N?l.toFormat(N):d;return t.element(y(h({},Ne.channelSliderTrack.attrs),{id:Cv(s,A),role:"group","data-channel":A,"data-orientation":C,style:{position:"relative",forcedColorAdjust:"none",backgroundImage:NV({orientation:C,channel:A,dir:i("dir"),value:k})}}))},getChannelSliderLabelProps(x){let{channel:C}=x;return t.element(y(h({},Ne.channelSliderLabel.attrs),{"data-channel":C,onClick(A){var k;if(!S)return;A.preventDefault();let N=yu(s,C);(k=s.getById(N))==null||k.focus({preventScroll:!0})},style:{userSelect:"none",WebkitUserSelect:"none"}}))},getChannelSliderValueTextProps(x){return t.element(y(h({},Ne.channelSliderValueText.attrs),{"data-channel":x.channel}))},getChannelSliderThumbProps(x){let{orientation:C="horizontal",channel:A,format:N}=x,k=N?l.toFormat(N):d,L=k.getChannelRange(A),K=k.getChannelValue(A),J=(K-L.minValue)/(L.maxValue-L.minValue),ue=i("dir")==="rtl",Z=C==="horizontal"&&ue?1-J:J,ce=C==="horizontal"?{left:`${Z*100}%`,top:"50%"}:{top:`${J*100}%`,left:"50%"};return t.element(y(h({},Ne.channelSliderThumb.attrs),{id:yu(s,A),role:"slider","aria-label":A,tabIndex:p?void 0:0,"data-channel":A,"data-disabled":b(p),"data-orientation":C,"aria-disabled":b(p),"aria-orientation":C,"aria-valuemax":L.maxValue,"aria-valuemin":L.minValue,"aria-valuenow":K,"aria-valuetext":`${A} ${K}`,style:h({forcedColorAdjust:"none",position:"absolute",background:xV(d,A).toString("css")},ce),onFocus(){S&&r({type:"CHANNEL_SLIDER.FOCUS",channel:A})},onKeyDown(ve){if(ve.defaultPrevented||!S)return;let le=Hn(ve)*L.step,Fe={ArrowUp(){r({type:"CHANNEL_SLIDER.ARROW_UP",channel:A,step:le})},ArrowDown(){r({type:"CHANNEL_SLIDER.ARROW_DOWN",channel:A,step:le})},ArrowLeft(){r({type:"CHANNEL_SLIDER.ARROW_LEFT",channel:A,step:le})},ArrowRight(){r({type:"CHANNEL_SLIDER.ARROW_RIGHT",channel:A,step:le})},PageUp(){r({type:"CHANNEL_SLIDER.PAGE_UP",channel:A})},PageDown(){r({type:"CHANNEL_SLIDER.PAGE_DOWN",channel:A})},Home(){r({type:"CHANNEL_SLIDER.HOME",channel:A})},End(){r({type:"CHANNEL_SLIDER.END",channel:A})},Escape(Qt){Qt.stopPropagation()}}[me(ve,{dir:i("dir")})];Fe&&(Fe(ve),ve.preventDefault())}}))},getChannelInputProps(x){let{channel:C}=x,A=C==="hex"||C==="css",N=RV(l,C);return t.input(y(h({},Ne.channelInput.attrs),{dir:i("dir"),type:A?"text":"number","data-channel":C,"aria-label":C,spellCheck:!1,autoComplete:"off",disabled:p,"data-disabled":b(p),"data-invalid":b(f),"data-readonly":b(g),readOnly:g,defaultValue:bu(l,C),min:N==null?void 0:N.minValue,max:N==null?void 0:N.maxValue,step:N==null?void 0:N.step,onBeforeInput(k){if(A||!S)return;k.currentTarget.value.match(/[^0-9.]/g)&&k.preventDefault()},onFocus(k){S&&(r({type:"CHANNEL_INPUT.FOCUS",channel:C}),k.currentTarget.select())},onBlur(k){if(!S)return;let L=A?k.currentTarget.value:k.currentTarget.valueAsNumber;r({type:"CHANNEL_INPUT.BLUR",channel:C,value:L,isTextField:A})},onKeyDown(k){if(!k.defaultPrevented&&S&&k.key==="Enter"){let L=A?k.currentTarget.value:k.currentTarget.valueAsNumber;r({type:"CHANNEL_INPUT.CHANGE",channel:C,value:L,isTextField:A}),k.preventDefault()}},style:{appearance:"none",WebkitAppearance:"none",MozAppearance:"textfield"}}))},getHiddenInputProps(){return t.input({type:"text",disabled:p,name:i("name"),tabIndex:-1,readOnly:g,required:m,id:mu(s),style:mt,defaultValue:u})},getEyeDropperTriggerProps(){return t.button(y(h({},Ne.eyeDropperTrigger.attrs),{type:"button",dir:i("dir"),disabled:p,"data-disabled":b(p),"data-invalid":b(f),"data-readonly":b(g),"aria-label":"Pick a color from the screen",onClick(){S&&r({type:"EYEDROPPER.CLICK"})}}))},getSwatchGroupProps(){return t.element(y(h({},Ne.swatchGroup.attrs),{role:"group"}))},getSwatchTriggerState:R,getSwatchTriggerProps(x){let C=R(x);return t.button(y(h({},Ne.swatchTrigger.attrs),{disabled:C.disabled,dir:i("dir"),type:"button","aria-label":`select ${C.valueAsString} as the color`,"data-state":C.checked?"checked":"unchecked","data-value":C.valueAsString,"data-disabled":b(C.disabled),onClick(){C.disabled||r({type:"SWATCH_TRIGGER.CLICK",value:C.value})},style:{"--color":C.valueAsString,position:"relative"}}))},getSwatchIndicatorProps(x){let C=R(x);return t.element(y(h({},Ne.swatchIndicator.attrs),{dir:i("dir"),hidden:!C.checked}))},getSwatchProps(x){let{respectAlpha:C=!0}=x,A=R(x),N=A.value.toString(C?"css":"hex");return t.element(y(h({},Ne.swatch.attrs),{dir:i("dir"),"data-state":A.checked?"checked":"unchecked","data-value":A.valueAsString,style:{"--color":N,position:"relative",background:N}}))},getFormatTriggerProps(){return t.button(y(h({},Ne.formatTrigger.attrs),{dir:i("dir"),type:"button","aria-label":`change color format to ${hv(c)}`,onClick(x){if(x.currentTarget.disabled)return;let C=hv(c);r({type:"FORMAT.SET",format:C,src:"format-trigger"})}}))},getFormatSelectProps(){return t.select(y(h({},Ne.formatSelect.attrs),{"aria-label":"change color format",dir:i("dir"),defaultValue:i("format"),disabled:p,onChange(x){let C=FV(x.currentTarget.value);r({type:"FORMAT.SET",format:C,src:"format-select"})}}))}}}function hv(e){var n;let t=Bl.indexOf(e);return(n=Bl[t+1])!=null?n:Bl[0]}function FV(e){if(DV.test(e))return e;throw new Error(`Unsupported color format: ${e}`)}function _V(e){return MV.test(e)}function $V(e){return e.startsWith("#")?e:_V(e)?`#${e}`:e}function mv(e,t,n){let r=AV(e);B(()=>{r.forEach(i=>{let a=i.dataset.channel;_e(i,bu(n||t,a))})})}function UV(e,t){let n=IV(e);n&&B(()=>_e(n,t))}function WV(e){let t=io(e,"value","defaultValue");return"value"in t&&t.value?{value:pa(t.value)}:"defaultValue"in t&&t.defaultValue?{defaultValue:pa(t.defaultValue)}:{}}function fu(e,t){if(t===void 0)return;let n=e.querySelector('[data-scope="color-picker"][data-part="hidden-input"]');n&&(n.value=t,n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0})))}function KV(e){let t=V(e,"defaultValue");return{defaultValue:t?pa(t):void 0}}var JO,Ne,QO,eV,ot,tV,nV,rV,iV,aV,oV,sV,lV,cV,dV,Eu,uV,gV,pV,vv,Pu,hV,yv,Su,fV,bv,Iu,mV,vV,dv,kr,uv,yV,gv,mu,Ev,Pv,vu,Sv,bV,Iv,EV,Tv,Cv,yu,Hl,PV,SV,IV,pv,TV,CV,wv,hu,wV,OV,VV,AV,NV,Bl,DV,pa,MV,HV,BV,fv,GV,qV,zV,Vv=ee(()=>{"use strict";so();Bt();ii();Or();on();xr();$e();be();oe();JO=z("color-picker",["root","label","control","trigger","positioner","content","area","areaThumb","valueText","areaBackground","channelSlider","channelSliderLabel","channelSliderTrack","channelSliderThumb","channelSliderValueText","channelInput","transparencyGrid","swatchGroup","swatchTrigger","swatchIndicator","swatch","eyeDropperTrigger","formatTrigger","formatSelect"]),Ne=JO.build(),QO=Object.defineProperty,eV=(e,t,n)=>t in e?QO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ot=(e,t,n)=>eV(e,typeof t!="symbol"?t+"":t,n),tV=(e,t,n)=>{let r=`linear-gradient(to ${e[+!t]}, transparent, #000)`;return{areaStyles:{backgroundImage:`linear-gradient(to ${e[Number(t)]},rgb(${n},0,0),rgb(${n},255,0))`},areaGradientStyles:{backgroundImage:`linear-gradient(to ${e[Number(t)]},rgb(${n},0,255),rgb(${n},255,255))`,WebkitMaskImage:r,maskImage:r}}},nV=(e,t,n)=>{let r=`linear-gradient(to ${e[+!t]}, transparent, #000)`;return{areaStyles:{backgroundImage:`linear-gradient(to ${e[Number(t)]},rgb(0,${n},0),rgb(255,${n},0))`},areaGradientStyles:{backgroundImage:`linear-gradient(to ${e[Number(t)]},rgb(0,${n},255),rgb(255,${n},255))`,WebkitMaskImage:r,maskImage:r}}},rV=(e,t,n)=>{let r=`linear-gradient(to ${e[+!t]}, transparent, #000)`;return{areaStyles:{backgroundImage:`linear-gradient(to ${e[Number(t)]},rgb(0,0,${n}),rgb(255,0,${n}))`},areaGradientStyles:{backgroundImage:`linear-gradient(to ${e[Number(t)]},rgb(0,255,${n}),rgb(255,255,${n}))`,WebkitMaskImage:r,maskImage:r}}},iV=(e,t,n)=>({areaStyles:{},areaGradientStyles:{background:[`linear-gradient(to ${e[Number(t)]}, hsla(0,0%,0%,1) 0%, hsla(0,0%,0%,0) 50%, hsla(0,0%,100%,0) 50%, hsla(0,0%,100%,1) 100%)`,`linear-gradient(to ${e[+!t]},hsl(0,0%,50%),hsla(0,0%,50%,0))`,`hsl(${n}, 100%, 50%)`].join(",")}}),aV=(e,t,n)=>({areaStyles:{},areaGradientStyles:{background:[`linear-gradient(to ${e[+!t]}, hsla(0,0%,0%,${n}) 0%, hsla(0,0%,0%,0) 50%, hsla(0,0%,100%,0) 50%, hsla(0,0%,100%,${n}) 100%)`,`linear-gradient(to ${e[Number(t)]},hsla(0,100%,50%,${n}),hsla(60,100%,50%,${n}),hsla(120,100%,50%,${n}),hsla(180,100%,50%,${n}),hsla(240,100%,50%,${n}),hsla(300,100%,50%,${n}),hsla(359,100%,50%,${n}))`,"hsl(0, 0%, 50%)"].join(",")}}),oV=(e,t,n)=>({areaStyles:{},areaGradientStyles:{backgroundImage:[`linear-gradient(to ${e[+!t]},hsl(0,0%,${n}%),hsla(0,0%,${n}%,0))`,`linear-gradient(to ${e[Number(t)]},hsl(0,100%,${n}%),hsl(60,100%,${n}%),hsl(120,100%,${n}%),hsl(180,100%,${n}%),hsl(240,100%,${n}%),hsl(300,100%,${n}%),hsl(360,100%,${n}%))`].join(",")}}),sV=(e,t,n)=>({areaStyles:{},areaGradientStyles:{background:[`linear-gradient(to ${e[Number(t)]},hsl(0,0%,0%),hsla(0,0%,0%,0))`,`linear-gradient(to ${e[+!t]},hsl(0,0%,100%),hsla(0,0%,100%,0))`,`hsl(${n}, 100%, 50%)`].join(",")}}),lV=(e,t,n)=>({areaStyles:{},areaGradientStyles:{background:[`linear-gradient(to ${e[+!t]},hsla(0,0%,0%,${n}),hsla(0,0%,0%,0))`,`linear-gradient(to ${e[Number(t)]},hsla(0,100%,50%,${n}),hsla(60,100%,50%,${n}),hsla(120,100%,50%,${n}),hsla(180,100%,50%,${n}),hsla(240,100%,50%,${n}),hsla(300,100%,50%,${n}),hsla(359,100%,50%,${n}))`,`linear-gradient(to ${e[+!t]},hsl(0,0%,0%),hsl(0,0%,100%))`].join(",")}}),cV=(e,t,n)=>({areaStyles:{},areaGradientStyles:{background:[`linear-gradient(to ${e[+!t]},hsla(0,0%,100%,${n}),hsla(0,0%,100%,0))`,`linear-gradient(to ${e[Number(t)]},hsla(0,100%,50%,${n}),hsla(60,100%,50%,${n}),hsla(120,100%,50%,${n}),hsla(180,100%,50%,${n}),hsla(240,100%,50%,${n}),hsla(300,100%,50%,${n}),hsla(359,100%,50%,${n}))`,"#000"].join(",")}});dV=(e,t)=>{if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0},Eu=class{toHexInt(){return this.toFormat("rgba").toHexInt()}getChannelValue(e){if(e in this)return this[e];throw new Error("Unsupported color channel: "+e)}getChannelValuePercent(e,t){let n=t!=null?t:this.getChannelValue(e),{minValue:r,maxValue:i}=this.getChannelRange(e);return sf(n,r,i)}getChannelPercentValue(e,t){let{minValue:n,maxValue:r,step:i}=this.getChannelRange(e),a=lf(t,n,r,i);return lo(a,n,r,i)}withChannelValue(e,t){let{minValue:n,maxValue:r}=this.getChannelRange(e);if(e in this){let i=this.clone();return i[e]=Ae(t,n,r),i}throw new Error("Unsupported color channel: "+e)}getColorAxes(e){let{xChannel:t,yChannel:n}=e,r=t||this.getChannels().find(o=>o!==n),i=n||this.getChannels().find(o=>o!==r),a=this.getChannels().find(o=>o!==r&&o!==i);return{xChannel:r,yChannel:i,zChannel:a}}incrementChannel(e,t){let{minValue:n,maxValue:r,step:i}=this.getChannelRange(e),a=lo(Ae(this.getChannelValue(e)+t,n,r),n,r,i);return this.withChannelValue(e,a)}decrementChannel(e,t){return this.incrementChannel(e,-t)}isEqual(e){return dV(this.toJSON(),e.toJSON())&&this.getChannelValue("alpha")===e.getChannelValue("alpha")}},uV=/^#[\da-f]+$/i,gV=/^rgba?\((.*)\)$/,pV=/[^#]/gi,vv=class Ml extends Eu{constructor(t,n,r,i){super(),ot(this,"red",t),ot(this,"green",n),ot(this,"blue",r),ot(this,"alpha",i)}static parse(t){var i;let n=[];if(uV.test(t)&&[4,5,7,9].includes(t.length)){let a=(t.length<6?t.replace(pV,"$&$&"):t).slice(1).split("");for(;a.length>0;)n.push(parseInt(a.splice(0,2).join(""),16));n[3]=n[3]!==void 0?n[3]/255:void 0}let r=t.match(gV);return r!=null&&r[1]&&(n=r[1].split(",").map(a=>Number(a.trim())).map((a,o)=>Ae(a,0,o<3?255:1))),n.length<3?void 0:new Ml(n[0],n[1],n[2],(i=n[3])!=null?i:1)}toString(t="css"){switch(t){case"hex":return"#"+(this.red.toString(16).padStart(2,"0")+this.green.toString(16).padStart(2,"0")+this.blue.toString(16).padStart(2,"0")).toUpperCase();case"hexa":return"#"+(this.red.toString(16).padStart(2,"0")+this.green.toString(16).padStart(2,"0")+this.blue.toString(16).padStart(2,"0")+Math.round(this.alpha*255).toString(16).padStart(2,"0")).toUpperCase();case"rgb":return`rgb(${this.red}, ${this.green}, ${this.blue})`;case"css":case"rgba":return`rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;case"hsl":return this.toHSL().toString("hsl");case"hsb":return this.toHSB().toString("hsb");default:return this.toFormat(t).toString(t)}}toFormat(t){switch(t){case"rgba":return this;case"hsba":return this.toHSB();case"hsla":return this.toHSL();default:throw new Error("Unsupported color conversion: rgb -> "+t)}}toHexInt(){return this.red<<16|this.green<<8|this.blue}toHSB(){let t=this.red/255,n=this.green/255,r=this.blue/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=a-i,s=a===0?0:o/a,l=0;if(o!==0){switch(a){case t:l=(n-r)/o+(nNumber(l.trim().replace("%","")));return new _l(wd(i,360),Ae(a,0,100),Ae(o,0,100),Ae(s!=null?s:1,0,1))}}toString(t="css"){switch(t){case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"hsl":return`hsl(${this.hue}, ${xe(this.saturation,2)}%, ${xe(this.lightness,2)}%)`;case"css":case"hsla":return`hsla(${this.hue}, ${xe(this.saturation,2)}%, ${xe(this.lightness,2)}%, ${this.alpha})`;case"hsb":return this.toHSB().toString("hsb");case"rgb":return this.toRGB().toString("rgb");default:return this.toFormat(t).toString(t)}}toFormat(t){switch(t){case"hsla":return this;case"hsba":return this.toHSB();case"rgba":return this.toRGB();default:throw new Error("Unsupported color conversion: hsl -> "+t)}}toHSB(){let t=this.saturation/100,n=this.lightness/100,r=n+t*Math.min(n,1-n);return t=r===0?0:2*(1-n/r),new Iu(xe(this.hue,2),xe(t*100,2),xe(r*100,2),xe(this.alpha,2))}toRGB(){let t=this.hue,n=this.saturation/100,r=this.lightness/100,i=n*Math.min(r,1-r),a=(o,s=(o+t/30)%12)=>r-i*Math.max(Math.min(s-3,9-s,1),-1);return new Pu(Math.round(a(0)*255),Math.round(a(8)*255),Math.round(a(4)*255),xe(this.alpha,2))}clone(){return new _l(this.hue,this.saturation,this.lightness,this.alpha)}getChannelFormatOptions(t){switch(t){case"hue":return{style:"unit",unit:"degree",unitDisplay:"narrow"};case"saturation":case"lightness":case"alpha":return{style:"percent"};default:throw new Error("Unknown color channel: "+t)}}formatChannelValue(t,n){let r=this.getChannelFormatOptions(t),i=this.getChannelValue(t);return(t==="saturation"||t==="lightness")&&(i/=100),new Intl.NumberFormat(n,r).format(i)}getChannelRange(t){switch(t){case"hue":return{minValue:0,maxValue:360,step:1,pageSize:15};case"saturation":case"lightness":return{minValue:0,maxValue:100,step:1,pageSize:10};case"alpha":return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw new Error("Unknown color channel: "+t)}}toJSON(){return{h:this.hue,s:this.saturation,l:this.lightness,a:this.alpha}}getFormat(){return"hsla"}getChannels(){return _l.colorChannels}};ot(yv,"colorChannels",["hue","saturation","lightness"]);Su=yv,fV=/hsb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/,bv=class $l extends Eu{constructor(t,n,r,i){super(),ot(this,"hue",t),ot(this,"saturation",n),ot(this,"brightness",r),ot(this,"alpha",i)}static parse(t){var r;let n;if(n=t.match(fV)){let[i,a,o,s]=((r=n[1])!=null?r:n[2]).split(",").map(l=>Number(l.trim().replace("%","")));return new $l(wd(i,360),Ae(a,0,100),Ae(o,0,100),Ae(s!=null?s:1,0,1))}}toString(t="css"){switch(t){case"css":return this.toHSL().toString("css");case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"hsb":return`hsb(${this.hue}, ${xe(this.saturation,2)}%, ${xe(this.brightness,2)}%)`;case"hsba":return`hsba(${this.hue}, ${xe(this.saturation,2)}%, ${xe(this.brightness,2)}%, ${this.alpha})`;case"hsl":return this.toHSL().toString("hsl");case"rgb":return this.toRGB().toString("rgb");default:return this.toFormat(t).toString(t)}}toFormat(t){switch(t){case"hsba":return this;case"hsla":return this.toHSL();case"rgba":return this.toRGB();default:throw new Error("Unsupported color conversion: hsb -> "+t)}}toHSL(){let t=this.saturation/100,n=this.brightness/100,r=n*(1-t/2);return t=r===0||r===1?0:(n-r)/Math.min(r,1-r),new Su(xe(this.hue,2),xe(t*100,2),xe(r*100,2),xe(this.alpha,2))}toRGB(){let t=this.hue,n=this.saturation/100,r=this.brightness/100,i=(a,o=(a+t/60)%6)=>r-n*r*Math.max(Math.min(o,4-o,1),0);return new Pu(Math.round(i(5)*255),Math.round(i(3)*255),Math.round(i(1)*255),xe(this.alpha,2))}clone(){return new $l(this.hue,this.saturation,this.brightness,this.alpha)}getChannelFormatOptions(t){switch(t){case"hue":return{style:"unit",unit:"degree",unitDisplay:"narrow"};case"saturation":case"brightness":case"alpha":return{style:"percent"};default:throw new Error("Unknown color channel: "+t)}}formatChannelValue(t,n){let r=this.getChannelFormatOptions(t),i=this.getChannelValue(t);return(t==="saturation"||t==="brightness")&&(i/=100),new Intl.NumberFormat(n,r).format(i)}getChannelRange(t){switch(t){case"hue":return{minValue:0,maxValue:360,step:1,pageSize:15};case"saturation":case"brightness":return{minValue:0,maxValue:100,step:1,pageSize:10};case"alpha":return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw new Error("Unknown color channel: "+t)}}toJSON(){return{h:this.hue,s:this.saturation,b:this.brightness,a:this.alpha}}getFormat(){return"hsba"}getChannels(){return $l.colorChannels}};ot(bv,"colorChannels",["hue","saturation","brightness"]);Iu=bv,mV="aliceblue:f0f8ff,antiquewhite:faebd7,aqua:00ffff,aquamarine:7fffd4,azure:f0ffff,beige:f5f5dc,bisque:ffe4c4,black:000000,blanchedalmond:ffebcd,blue:0000ff,blueviolet:8a2be2,brown:a52a2a,burlywood:deb887,cadetblue:5f9ea0,chartreuse:7fff00,chocolate:d2691e,coral:ff7f50,cornflowerblue:6495ed,cornsilk:fff8dc,crimson:dc143c,cyan:00ffff,darkblue:00008b,darkcyan:008b8b,darkgoldenrod:b8860b,darkgray:a9a9a9,darkgreen:006400,darkkhaki:bdb76b,darkmagenta:8b008b,darkolivegreen:556b2f,darkorange:ff8c00,darkorchid:9932cc,darkred:8b0000,darksalmon:e9967a,darkseagreen:8fbc8f,darkslateblue:483d8b,darkslategray:2f4f4f,darkturquoise:00ced1,darkviolet:9400d3,deeppink:ff1493,deepskyblue:00bfff,dimgray:696969,dodgerblue:1e90ff,firebrick:b22222,floralwhite:fffaf0,forestgreen:228b22,fuchsia:ff00ff,gainsboro:dcdcdc,ghostwhite:f8f8ff,gold:ffd700,goldenrod:daa520,gray:808080,green:008000,greenyellow:adff2f,honeydew:f0fff0,hotpink:ff69b4,indianred:cd5c5c,indigo:4b0082,ivory:fffff0,khaki:f0e68c,lavender:e6e6fa,lavenderblush:fff0f5,lawngreen:7cfc00,lemonchiffon:fffacd,lightblue:add8e6,lightcoral:f08080,lightcyan:e0ffff,lightgoldenrodyellow:fafad2,lightgrey:d3d3d3,lightgreen:90ee90,lightpink:ffb6c1,lightsalmon:ffa07a,lightseagreen:20b2aa,lightskyblue:87cefa,lightslategray:778899,lightsteelblue:b0c4de,lightyellow:ffffe0,lime:00ff00,limegreen:32cd32,linen:faf0e6,magenta:ff00ff,maroon:800000,mediumaquamarine:66cdaa,mediumblue:0000cd,mediumorchid:ba55d3,mediumpurple:9370d8,mediumseagreen:3cb371,mediumslateblue:7b68ee,mediumspringgreen:00fa9a,mediumturquoise:48d1cc,mediumvioletred:c71585,midnightblue:191970,mintcream:f5fffa,mistyrose:ffe4e1,moccasin:ffe4b5,navajowhite:ffdead,navy:000080,oldlace:fdf5e6,olive:808000,olivedrab:6b8e23,orange:ffa500,orangered:ff4500,orchid:da70d6,palegoldenrod:eee8aa,palegreen:98fb98,paleturquoise:afeeee,palevioletred:d87093,papayawhip:ffefd5,peachpuff:ffdab9,peru:cd853f,pink:ffc0cb,plum:dda0dd,powderblue:b0e0e6,purple:800080,rebeccapurple:663399,red:ff0000,rosybrown:bc8f8f,royalblue:4169e1,saddlebrown:8b4513,salmon:fa8072,sandybrown:f4a460,seagreen:2e8b57,seashell:fff5ee,sienna:a0522d,silver:c0c0c0,skyblue:87ceeb,slateblue:6a5acd,slategray:708090,snow:fffafa,springgreen:00ff7f,steelblue:4682b4,tan:d2b48c,teal:008080,thistle:d8bfd8,tomato:ff6347,turquoise:40e0d0,violet:ee82ee,wheat:f5deb3,white:ffffff,whitesmoke:f5f5f5,yellow:ffff00,yellowgreen:9acd32",vV=e=>{let t=new Map,n=e.split(",");for(let r=0;r{var n;if(dv.has(e))return kr(dv.get(e));let t=Pu.parse(e)||Iu.parse(e)||Su.parse(e);if(!t){let r=new Error("Invalid color value: "+e);throw(n=Error.captureStackTrace)==null||n.call(Error,r,kr),r}return t},uv=e=>typeof e=="string"?kr(e):e,yV=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`color-picker:${e.id}`},gv=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`color-picker:${e.id}:label`},mu=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`color-picker:${e.id}:hidden-input`},Ev=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`color-picker:${e.id}:control`},Pv=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`color-picker:${e.id}:trigger`},vu=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`color-picker:${e.id}:content`},Sv=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`color-picker:${e.id}:positioner`},bV=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.formatSelect)!=null?n:`color-picker:${e.id}:format-select`},Iv=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.area)!=null?n:`color-picker:${e.id}:area`},EV=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.areaGradient)!=null?n:`color-picker:${e.id}:area-gradient`},Tv=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.areaThumb)!=null?n:`color-picker:${e.id}:area-thumb`},Cv=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.channelSliderTrack)==null?void 0:r.call(n,t))!=null?i:`color-picker:${e.id}:slider-track:${t}`},yu=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.channelSliderThumb)==null?void 0:r.call(n,t))!=null?i:`color-picker:${e.id}:slider-thumb:${t}`},Hl=e=>e.getById(vu(e)),PV=e=>e.getById(Tv(e)),SV=(e,t)=>e.getById(yu(e,t)),IV=e=>e.getById(bV(e)),pv=e=>e.getById(mu(e)),TV=e=>e.getById(Iv(e)),CV=(e,t,n)=>{let r=TV(e);if(!r)return;let{getPercentValue:i}=qi(t,r);return{x:i({dir:n,orientation:"horizontal"}),y:i({orientation:"vertical"})}},wv=e=>e.getById(Ev(e)),hu=e=>e.getById(Pv(e)),wV=e=>e.getById(Sv(e)),OV=(e,t)=>e.getById(Cv(e,t)),VV=(e,t,n,r)=>{let i=OV(e,n);if(!i)return;let{getPercentValue:a}=qi(t,i);return{x:a({dir:r,orientation:"horizontal"}),y:a({orientation:"vertical"})}},AV=e=>[...Oe(Hl(e),"input[data-channel]"),...Oe(wv(e),"input[data-channel]")];NV=e=>{let{channel:t,value:n,dir:r,orientation:i}=e,a=kV(i,r),{minValue:o,maxValue:s}=n.getChannelRange(t);switch(t){case"hue":return`linear-gradient(to ${a}, rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)`;case"lightness":{let l=n.withChannelValue(t,o).toString("css"),c=n.withChannelValue(t,(s-o)/2).toString("css"),d=n.withChannelValue(t,s).toString("css");return`linear-gradient(to ${a}, ${l}, ${c}, ${d})`}case"saturation":case"brightness":case"red":case"green":case"blue":case"alpha":{let l=n.withChannelValue(t,o).toString("css"),c=n.withChannelValue(t,s).toString("css");return`linear-gradient(to ${a}, ${l}, ${c})`}default:throw new Error("Unknown color channel: "+t)}};Bl=["hsba","hsla","rgba"],DV=new RegExp(`^(${Bl.join("|")})$`);pa=e=>kr(e),MV=/^[0-9a-fA-F]{3,8}$/;({and:HV}=we()),BV=e=>{var n;let t="";for(let r in e)t+=`${r}:${(n=e[r])!=null?n:""};`;return t},fv=pa("#000000"),GV=te({props({props:e}){var n,r;let t=(r=(n=e.value)!=null?n:e.defaultValue)!=null?r:fv;return y(h({dir:"ltr",defaultValue:fv,defaultFormat:t.getFormat(),openAutoFocus:!0},e),{positioning:h({placement:"bottom"},e.positioning)})},initialState({prop:e}){return e("open")||e("defaultOpen")||e("inline")?"open":"idle"},context({prop:e,bindable:t,getContext:n}){return{value:t(()=>{var r,i,a;return{defaultValue:e("defaultValue").toFormat((r=e("format"))!=null?r:e("defaultFormat")),value:(a=e("value"))==null?void 0:a.toFormat((i=e("format"))!=null?i:e("defaultFormat")),isEqual(o,s){return s!=null&&o.isEqual(s)},hash(o){return BV(o.toJSON())},onChange(o){var c;let l=n().get("format");(c=e("onValueChange"))==null||c({value:o,valueAsString:o.toString(l)})}}}),format:t(()=>({defaultValue:e("defaultFormat"),value:e("format"),onChange(r){var i;(i=e("onFormatChange"))==null||i({format:r})}})),activeId:t(()=>({defaultValue:null})),activeChannel:t(()=>({defaultValue:null})),activeOrientation:t(()=>({defaultValue:null})),fieldsetDisabled:t(()=>({defaultValue:!1})),restoreFocus:t(()=>({defaultValue:!0})),currentPlacement:t(()=>({defaultValue:void 0}))}},computed:{rtl:({prop:e})=>e("dir")==="rtl",disabled:({prop:e,context:t})=>!!e("disabled")||t.get("fieldsetDisabled"),interactive:({prop:e})=>!(e("disabled")||e("readOnly")),valueAsString:({context:e})=>e.get("value").toString(e.get("format")),areaValue:({context:e})=>{let t=e.get("format").startsWith("hsl")?"hsla":"hsba";return e.get("value").toFormat(t)}},effects:["trackFormControl"],watch({prop:e,context:t,action:n,track:r}){r([()=>t.hash("value")],()=>{n(["syncInputElements","dispatchChangeEvent"])}),r([()=>t.get("format")],()=>{n(["syncFormatSelectElement","syncValueWithFormat"])}),r([()=>e("open")],()=>{n(["toggleVisibility"])})},on:{"VALUE.SET":{actions:["setValue"]},"FORMAT.SET":{actions:["setFormat"]},"CHANNEL_INPUT.CHANGE":{actions:["setChannelColorFromInput"]},"EYEDROPPER.CLICK":{actions:["openEyeDropper"]},"SWATCH_TRIGGER.CLICK":{actions:["setValue"]}},states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["setInitialFocus"]},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen","setInitialFocus"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen","setInitialFocus"]}],"CHANNEL_INPUT.FOCUS":{target:"focused",actions:["setActiveChannel"]}}},focused:{id:"color-picker-focused",tags:["closed","focused"],on:{"CONTROLLED.OPEN":{target:"open",actions:["setInitialFocus"]},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen","setInitialFocus"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen","setInitialFocus"]}],"CHANNEL_INPUT.FOCUS":{actions:["setActiveChannel"]},"CHANNEL_INPUT.BLUR":{target:"idle",actions:["setChannelColorFromInput"]},"TRIGGER.BLUR":{target:"idle"}}},open:{tags:["open"],effects:["trackPositioning","trackDismissableElement"],initial:"idle",on:{"CONTROLLED.CLOSE":[{guard:"shouldRestoreFocus",target:"focused",actions:["setReturnFocus"]},{target:"idle"}],INTERACT_OUTSIDE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{guard:"shouldRestoreFocus",target:"focused",actions:["invokeOnClose","setReturnFocus"]},{target:"idle",actions:["invokeOnClose"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"idle",actions:["invokeOnClose"]}]},states:{idle:{on:{"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"#color-picker-focused",actions:["invokeOnClose"]}],"AREA.POINTER_DOWN":{target:"dragging",actions:["setActiveChannel","setAreaColorFromPoint","focusAreaThumb"]},"AREA.FOCUS":{actions:["setActiveChannel"]},"CHANNEL_SLIDER.POINTER_DOWN":{target:"dragging",actions:["setActiveChannel","setChannelColorFromPoint","focusChannelThumb"]},"CHANNEL_SLIDER.FOCUS":{actions:["setActiveChannel"]},"AREA.ARROW_LEFT":{actions:["decrementAreaXChannel"]},"AREA.ARROW_RIGHT":{actions:["incrementAreaXChannel"]},"AREA.ARROW_UP":{actions:["incrementAreaYChannel"]},"AREA.ARROW_DOWN":{actions:["decrementAreaYChannel"]},"AREA.PAGE_UP":{actions:["incrementAreaXChannel"]},"AREA.PAGE_DOWN":{actions:["decrementAreaXChannel"]},"CHANNEL_SLIDER.ARROW_LEFT":{actions:["decrementChannel"]},"CHANNEL_SLIDER.ARROW_RIGHT":{actions:["incrementChannel"]},"CHANNEL_SLIDER.ARROW_UP":{actions:["incrementChannel"]},"CHANNEL_SLIDER.ARROW_DOWN":{actions:["decrementChannel"]},"CHANNEL_SLIDER.PAGE_UP":{actions:["incrementChannel"]},"CHANNEL_SLIDER.PAGE_DOWN":{actions:["decrementChannel"]},"CHANNEL_SLIDER.HOME":{actions:["setChannelToMin"]},"CHANNEL_SLIDER.END":{actions:["setChannelToMax"]},"CHANNEL_INPUT.BLUR":{actions:["setChannelColorFromInput"]},"SWATCH_TRIGGER.CLICK":[{guard:HV("isOpenControlled","closeOnSelect"),actions:["setValue","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["setValue","invokeOnClose","setReturnFocus"]},{actions:["setValue"]}]}},dragging:{tags:["dragging"],exit:["clearActiveChannel"],effects:["trackPointerMove","disableTextSelection"],on:{"AREA.POINTER_MOVE":{actions:["setAreaColorFromPoint","focusAreaThumb"]},"AREA.POINTER_UP":{target:"idle",actions:["invokeOnChangeEnd"]},"CHANNEL_SLIDER.POINTER_MOVE":{actions:["setChannelColorFromPoint","focusChannelThumb"]},"CHANNEL_SLIDER.POINTER_UP":{target:"idle",actions:["invokeOnChangeEnd"]}}}}}},implementations:{guards:{closeOnSelect:({prop:e})=>!!e("closeOnSelect"),isOpenControlled:({prop:e})=>e("open")!=null||!!e("inline"),shouldRestoreFocus:({context:e})=>!!e.get("restoreFocus")},effects:{trackPositioning({context:e,prop:t,scope:n}){var a;if(t("inline"))return;e.get("currentPlacement")||e.set("currentPlacement",(a=t("positioning"))==null?void 0:a.placement);let r=hu(n);return Xe(r,()=>wV(n),y(h({},t("positioning")),{defer:!0,onComplete(o){e.set("currentPlacement",o.placement)}}))},trackDismissableElement({context:e,scope:t,prop:n,send:r}){return n("inline")?void 0:qt(()=>Hl(t),{type:"popover",exclude:hu(t),defer:!0,onInteractOutside(a){var o;(o=n("onInteractOutside"))==null||o(a),!a.defaultPrevented&&e.set("restoreFocus",!(a.detail.focusable||a.detail.contextmenu))},onPointerDownOutside:n("onPointerDownOutside"),onFocusOutside:n("onFocusOutside"),onDismiss(){r({type:"INTERACT_OUTSIDE"})}})},trackFormControl({context:e,scope:t,send:n}){let r=pv(t);return ht(r,{onFieldsetDisabledChange(i){e.set("fieldsetDisabled",i)},onFormReset(){n({type:"VALUE.SET",value:e.initial("value"),src:"form.reset"})}})},trackPointerMove({context:e,scope:t,event:n,send:r}){return pn(t.getDoc(),{onPointerMove({point:i}){var o;let a=e.get("activeId")==="area"?"AREA.POINTER_MOVE":"CHANNEL_SLIDER.POINTER_MOVE";r({type:a,point:i,format:n.format,orientation:(o=e.get("activeOrientation"))!=null?o:void 0})},onPointerUp(){let i=e.get("activeId")==="area"?"AREA.POINTER_UP":"CHANNEL_SLIDER.POINTER_UP";r({type:i})}})},disableTextSelection({scope:e}){return Za({doc:e.getDoc(),target:Hl(e)})}},actions:{openEyeDropper({scope:e,context:t}){let n=e.getWin();if(!("EyeDropper"in n))return;new n.EyeDropper().open().then(({sRGBHex:a})=>{let o=t.get("value").getFormat(),s=kr(a).toFormat(o);t.set("value",s)}).catch(()=>{})},setActiveChannel({context:e,event:t}){e.set("activeId",t.id),t.channel&&e.set("activeChannel",t.channel),t.orientation&&e.set("activeOrientation",t.orientation)},clearActiveChannel({context:e}){e.set("activeChannel",null),e.set("activeId",null),e.set("activeOrientation",null)},setAreaColorFromPoint({context:e,event:t,computed:n,scope:r,prop:i}){let a=t.format?e.get("value").toFormat(t.format):n("areaValue"),{xChannel:o,yChannel:s}=t.channel||e.get("activeChannel"),l=CV(r,t.point,i("dir"));if(!l)return;let c=a.getChannelPercentValue(o,l.x),d=a.getChannelPercentValue(s,1-l.y),u=a.withChannelValue(o,c).withChannelValue(s,d);e.set("value",u)},setChannelColorFromPoint({context:e,event:t,computed:n,scope:r,prop:i}){let a=t.channel||e.get("activeId"),o=t.format?e.get("value").toFormat(t.format):n("areaValue"),s=VV(r,t.point,a,i("dir"));if(!s)return;let c=(t.orientation||e.get("activeOrientation")||"horizontal")==="horizontal"?s.x:s.y,d=o.getChannelPercentValue(a,c),u=o.withChannelValue(a,d);e.set("value",u)},setValue({context:e,event:t}){let n=e.get("format");e.set("value",t.value.toFormat(n))},setFormat({context:e,event:t}){e.set("format",t.format)},dispatchChangeEvent({scope:e,computed:t}){Hi(pv(e),{value:t("valueAsString")})},syncInputElements({context:e,scope:t}){mv(t,e.get("value"))},invokeOnChangeEnd({context:e,prop:t,computed:n}){var r;(r=t("onValueChangeEnd"))==null||r({value:e.get("value"),valueAsString:n("valueAsString")})},setChannelColorFromInput({context:e,event:t,scope:n,prop:r}){var c;let{channel:i,isTextField:a,value:o}=t,s=e.get("value").getChannelValue("alpha"),l;if(i==="alpha"){let d=parseFloat(o);d=Number.isNaN(d)?s:d,l=e.get("value").withChannelValue("alpha",d)}else if(a)l=ed(()=>{let d=i==="hex"?$V(o):o;return pa(d).withChannelValue("alpha",s)},()=>e.get("value"));else{let d=e.get("value").toFormat(e.get("format")),u=Number.isNaN(o)?d.getChannelValue(i):o;l=d.withChannelValue(i,u)}mv(n,e.get("value"),l),e.set("value",l),(c=r("onValueChangeEnd"))==null||c({value:l,valueAsString:l.toString(e.get("format"))})},incrementChannel({context:e,event:t}){let n=e.get("value").incrementChannel(t.channel,t.step);e.set("value",n)},decrementChannel({context:e,event:t}){let n=e.get("value").decrementChannel(t.channel,t.step);e.set("value",n)},incrementAreaXChannel({context:e,event:t,computed:n}){let{xChannel:r}=t.channel,i=n("areaValue").incrementChannel(r,t.step);e.set("value",i)},decrementAreaXChannel({context:e,event:t,computed:n}){let{xChannel:r}=t.channel,i=n("areaValue").decrementChannel(r,t.step);e.set("value",i)},incrementAreaYChannel({context:e,event:t,computed:n}){let{yChannel:r}=t.channel,i=n("areaValue").incrementChannel(r,t.step);e.set("value",i)},decrementAreaYChannel({context:e,event:t,computed:n}){let{yChannel:r}=t.channel,i=n("areaValue").decrementChannel(r,t.step);e.set("value",i)},setChannelToMax({context:e,event:t}){let n=e.get("value"),r=n.getChannelRange(t.channel),i=n.withChannelValue(t.channel,r.maxValue);e.set("value",i)},setChannelToMin({context:e,event:t}){let n=e.get("value"),r=n.getChannelRange(t.channel),i=n.withChannelValue(t.channel,r.minValue);e.set("value",i)},focusAreaThumb({scope:e}){B(()=>{var t;(t=PV(e))==null||t.focus({preventScroll:!0})})},focusChannelThumb({event:e,scope:t}){B(()=>{var n;(n=SV(t,e.channel))==null||n.focus({preventScroll:!0})})},setInitialFocus({prop:e,scope:t}){e("openAutoFocus")&&B(()=>{let n=hr({root:Hl(t),getInitialEl:e("initialFocusEl")});n==null||n.focus({preventScroll:!0})})},setReturnFocus({scope:e}){B(()=>{var t;(t=hu(e))==null||t.focus({preventScroll:!0})})},syncFormatSelectElement({context:e,scope:t}){UV(t,e.get("format"))},syncValueWithFormat({context:e}){let t=e.get("value"),n=t.toFormat(e.get("format"));n.isEqual(t)||e.set("value",n)},invokeOnOpen({prop:e,context:t}){var n;e("inline")||(n=e("onOpenChange"))==null||n({open:!0,value:t.get("value")})},invokeOnClose({prop:e,context:t}){var n;e("inline")||(n=e("onOpenChange"))==null||n({open:!1,value:t.get("value")})},toggleVisibility({prop:e,event:t,send:n}){n({type:e("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:t})}}}});qV=class extends X{initMachine(e){return new Y(GV,e)}initApi(){return this.zagConnect(LV)}render(){var N;let e=this.el.querySelector('[data-part="root"]');e&&this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-part="hidden-input"]');n&&Er(n,this.el,(N=this.api.valueAsString)!=null?N:"",(k,L)=>this.spreadProps(k,L),this.api.getHiddenInputProps());let r=this.el.querySelector('[data-part="control"]');r&&this.spreadProps(r,this.api.getControlProps());let i=this.el.querySelector('[data-part="trigger"]');i&&this.spreadProps(i,this.api.getTriggerProps()),this.el.querySelectorAll('[data-part="transparency-grid"][data-size="10px"]').forEach(k=>this.spreadProps(k,this.api.getTransparencyGridProps({size:"10px"})));let o=i==null?void 0:i.querySelector('[data-part="swatch"]');o&&this.spreadProps(o,this.api.getSwatchProps({value:this.api.value})),this.el.querySelectorAll('[data-part="channel-input"][data-channel="hex"]').forEach(k=>this.spreadProps(k,this.api.getChannelInputProps({channel:"hex"}))),this.el.querySelectorAll('[data-part="channel-input"][data-channel="alpha"]').forEach(k=>this.spreadProps(k,this.api.getChannelInputProps({channel:"alpha"})));let c=this.el.querySelector('[data-part="positioner"]');c&&this.spreadProps(c,this.api.getPositionerProps());let d=this.el.querySelector('[data-part="content"]');d&&this.spreadProps(d,this.api.getContentProps());let u=this.el.querySelector('[data-part="area"]');u&&this.spreadProps(u,this.api.getAreaProps());let p=this.el.querySelector('[data-part="area-background"]');p&&this.spreadProps(p,this.api.getAreaBackgroundProps());let g=this.el.querySelector('[data-part="area-thumb"]');g&&this.spreadProps(g,this.api.getAreaThumbProps());let f=this.el.querySelector('[data-part="channel-slider"][data-channel="hue"]');f&&this.spreadProps(f,this.api.getChannelSliderProps({channel:"hue"}));let m=this.el.querySelector('[data-part="channel-slider-track"][data-channel="hue"]');m&&this.spreadProps(m,this.api.getChannelSliderTrackProps({channel:"hue"}));let S=this.el.querySelector('[data-part="channel-slider-thumb"][data-channel="hue"]');S&&this.spreadProps(S,this.api.getChannelSliderThumbProps({channel:"hue"}));let T=this.el.querySelector('[data-part="channel-slider"][data-channel="alpha"]');T&&this.spreadProps(T,this.api.getChannelSliderProps({channel:"alpha"})),this.el.querySelectorAll('[data-part="transparency-grid"][data-size="12px"]').forEach(k=>this.spreadProps(k,this.api.getTransparencyGridProps({size:"12px"})));let I=this.el.querySelector('[data-part="channel-slider-track"][data-channel="alpha"]');I&&this.spreadProps(I,this.api.getChannelSliderTrackProps({channel:"alpha"}));let P=this.el.querySelector('[data-part="channel-slider-thumb"][data-channel="alpha"]');P&&this.spreadProps(P,this.api.getChannelSliderThumbProps({channel:"alpha"})),this.el.querySelectorAll('[data-part="channel-input"][data-channel="red"]').forEach(k=>this.spreadProps(k,this.api.getChannelInputProps({channel:"red"}))),this.el.querySelectorAll('[data-part="channel-input"][data-channel="green"]').forEach(k=>this.spreadProps(k,this.api.getChannelInputProps({channel:"green"}))),this.el.querySelectorAll('[data-part="channel-input"][data-channel="blue"]').forEach(k=>this.spreadProps(k,this.api.getChannelInputProps({channel:"blue"})));let x=this.el.querySelector('[data-part="swatch-group"]');x&&this.spreadProps(x,this.api.getSwatchGroupProps()),this.el.querySelectorAll('[data-part="swatch-trigger"][data-value]').forEach(k=>{let L=k.getAttribute("data-value");L&&this.spreadProps(k,this.api.getSwatchTriggerProps({value:L}));let K=k.querySelector('[data-part="swatch"][data-value]');if(K){let J=K.getAttribute("data-value");J&&this.spreadProps(K,this.api.getSwatchProps({value:J}))}}),this.el.querySelectorAll('[data-part="transparency-grid"][data-size="var(--spacing-mini)"]').forEach(k=>this.spreadProps(k,this.api.getTransparencyGridProps({size:"var(--spacing-mini)"})))}};zV={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=WV(e),i=new qV(e,y(h({id:e.id},r),{name:V(e,"name"),defaultFormat:"rgba",closeOnSelect:O(e,"closeOnSelect"),defaultOpen:!1,openAutoFocus:O(e,"openAutoFocus"),disabled:O(e,"disabled"),invalid:O(e,"invalid"),readOnly:O(e,"readonly"),required:O(e,"required"),dir:q(e),positioning:qe(e),onValueChange:a=>{fu(e,a.valueAsString),W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,valueAsString:a.valueAsString},serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})},onValueChangeEnd:a=>{fu(e,a.valueAsString),W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,valueAsString:a.valueAsString},serverEventName:V(e,"onValueChangeEnd"),clientEventName:V(e,"onValueChangeEndClient")})},onOpenChange:a=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,open:a.open},serverEventName:V(e,"onOpenChange"),clientEventName:V(e,"onOpenChangeClient")})},onFormatChange:a=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,format:a.format},serverEventName:V(e,"onFormatChange"),clientEventName:V(e,"onFormatChangeClient")})},onPointerDownOutside:()=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id},serverEventName:V(e,"onPointerDownOutside"),clientEventName:V(e,"onPointerDownOutsideClient")})},onFocusOutside:()=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id},serverEventName:V(e,"onFocusOutside"),clientEventName:V(e,"onFocusOutsideClient")})},onInteractOutside:()=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id},serverEventName:V(e,"onInteractOutside"),clientEventName:V(e,"onInteractOutsideClient")})}}));i.init(),this.colorPicker=i,this.handlers=[],this.onSetValue=a=>{let{value:o}=a.detail;i.api.setValue(o)},e.addEventListener("corex:color-picker:set-value",this.onSetValue),this.handlers.push(this.handleEvent("color_picker_set_value",a=>{$(e.id,H(a))&&i.api.setValue(a.value)}))},updated(){let e=this.el,t=this.colorPicker,n=br(e),r="value"in n&&n.value?{value:pa(n.value)}:{};t==null||t.updateProps(y(h({},r),{name:V(e,"name"),closeOnSelect:O(e,"closeOnSelect"),openAutoFocus:O(e,"openAutoFocus"),disabled:O(e,"disabled"),invalid:O(e,"invalid"),readOnly:O(e,"readonly"),required:O(e,"required"),dir:q(e),positioning:qe(e)})),"value"in n&&n.value&&fu(e,n.value)},destroyed(){var e;if(this.onSetValue&&this.el.removeEventListener("corex:color-picker:set-value",this.onSetValue),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.colorPicker)==null||e.destroy()}}});function Vn(e,t,n){let r=[],i;return a=>{var l;let o=e(a);return(o.length!==r.length||o.some((c,d)=>!Ce(r[d],c)))&&(r=o,i=t(o,a),(l=n==null?void 0:n.onChange)==null||l.call(n,i)),i}}var Eo=ee(()=>{"use strict";oe()});var Vy={};pe(Vy,{DatePicker:()=>Nx,applyServerIsoToZagIfNeeded:()=>Bu,resolveCloseOnSelect:()=>Gu,resolveIsoListForFormSync:()=>Hu,syncDatePickerValueInput:()=>Jl,valueToIsoString:()=>Oy});function Tu(e,t){return e-t*Math.floor(e/t)}function Gl(e,t,n,r){t=Ku(e,t);let i=t-1,a=-2;return n<=2?a=0:Yl(t)&&(a=-1),qv-1+365*i+Math.floor(i/4)-Math.floor(i/100)+Math.floor(i/400)+Math.floor((367*n-362)/12+a+r)}function Yl(e){return e%4===0&&(e%100!==0||e%400===0)}function Ku(e,t){return e==="BC"?1-t:t}function YV(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}function Nt(e,t){return t=Ze(t,e.calendar),e.era===t.era&&e.year===t.year&&e.month===t.month&&e.day===t.day}function JV(e,t){return t=Ze(t,e.calendar),e=Jn(e),t=Jn(t),e.era===t.era&&e.year===t.year&&e.month===t.month}function QV(e,t){return t=Ze(t,e.calendar),e=wo(e),t=wo(t),e.era===t.era&&e.year===t.year}function eA(e,t){return tc(e.calendar,t.calendar)&&Nt(e,t)}function Po(e,t){return tc(e.calendar,t.calendar)&&JV(e,t)}function So(e,t){return tc(e.calendar,t.calendar)&&QV(e,t)}function tc(e,t){var n,r,i,a;return(a=(i=(n=e.isEqual)==null?void 0:n.call(e,t))!=null?i:(r=t.isEqual)==null?void 0:r.call(t,e))!=null?a:e.identifier===t.identifier}function tA(e,t){return Nt(e,nc(t))}function Wv(e,t,n){let r=e.calendar.toJulianDay(e),i=n?nA[n]:oA(t),a=Math.ceil(r+1-i)%7;return a<0&&(a+=7),a}function Kv(e){return Qn(Date.now(),e)}function nc(e){return ci(Kv(e))}function zv(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function rA(e,t){return Av(e)-Av(t)}function Av(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}function zu(){return Cu==null&&(Cu=new Intl.DateTimeFormat().resolvedOptions().timeZone),Cu}function jv(){return iA}function Jn(e){return e.subtract({days:e.day-1})}function Lu(e){return e.add({days:e.calendar.getDaysInMonth(e)-e.day})}function wo(e){return Jn(e.subtract({months:e.month-1}))}function aA(e){return Lu(e.add({months:e.calendar.getMonthsInYear(e)-e.month}))}function Lr(e,t,n){let r=Wv(e,t,n);return e.subtract({days:r})}function xv(e,t,n){return Lr(e,t,n).add({days:6})}function Yv(e){if(Intl.Locale){let n=Rv.get(e);return n||(n=new Intl.Locale(e).maximize().region,n&&Rv.set(e,n)),n}let t=e.split("-")[1];return t==="u"?void 0:t}function oA(e){let t=wu.get(e);if(!t){if(Intl.Locale){let r=new Intl.Locale(e);if("getWeekInfo"in r&&(t=r.getWeekInfo(),t))return wu.set(e,t),t.firstDay}let n=Yv(e);if(e.includes("-fw-")){let r=e.split("-fw-")[1].split("-")[0];r==="mon"?t={firstDay:1}:r==="tue"?t={firstDay:2}:r==="wed"?t={firstDay:3}:r==="thu"?t={firstDay:4}:r==="fri"?t={firstDay:5}:r==="sat"?t={firstDay:6}:t={firstDay:0}}else e.includes("-ca-iso8601")?t={firstDay:1}:t={firstDay:n&&ZV[n]||0};wu.set(e,t)}return t.firstDay}function sA(e,t,n){let r=e.calendar.getDaysInMonth(e);return Math.ceil((Wv(Jn(e),t,n)+r)/7)}function Xv(e,t){return e&&t?e.compare(t)<=0?e:t:e||t}function Zv(e,t){return e&&t?e.compare(t)>=0?e:t:e||t}function cA(e,t){let n=e.calendar.toJulianDay(e),r=Math.ceil(n+1)%7;r<0&&(r+=7);let i=Yv(t),[a,o]=lA[i]||[6,0];return r===a||r===o}function va(e){e=Ze(e,new ma);let t=Ku(e.era,e.year);return Jv(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Jv(e,t,n,r,i,a,o){let s=new Date;return s.setUTCHours(r,i,a,o),s.setUTCFullYear(e,t-1,n),s.getTime()}function Du(e,t){if(t==="UTC")return 0;if(e>0&&t===zu()&&!jv())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:r,day:i,hour:a,minute:o,second:s}=Qv(e,t);return Jv(n,r,i,a,o,s,0)-Math.floor(e/1e3)*1e3}function Qv(e,t){let n=kv.get(t);n||(n=new Intl.DateTimeFormat("en-US",{timeZone:t,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),kv.set(t,n));let r=n.formatToParts(new Date(e)),i={};for(let a of r)a.type!=="literal"&&(i[a.type]=a.value);return{year:i.era==="BC"||i.era==="B"?-i.year+1:+i.year,month:+i.month,day:+i.day,hour:i.hour==="24"?0:+i.hour,minute:+i.minute,second:+i.second}}function dA(e,t,n,r){return(n===r?[n]:[n,r]).filter(a=>uA(e,t,a))}function uA(e,t,n){let r=Qv(n,t);return e.year===r.year&&e.month===r.month&&e.day===r.day&&e.hour===r.hour&&e.minute===r.minute&&e.second===r.second}function Zn(e,t,n="compatible"){let r=Xt(e);if(t==="UTC")return va(r);if(t===zu()&&n==="compatible"&&!jv()){r=Ze(r,new ma);let l=new Date,c=Ku(r.era,r.year);return l.setFullYear(c,r.month-1,r.day),l.setHours(r.hour,r.minute,r.second,r.millisecond),l.getTime()}let i=va(r),a=Du(i-Nv,t),o=Du(i+Nv,t),s=dA(r,t,i-a,i-o);if(s.length===1)return s[0];if(s.length>1)switch(n){case"compatible":case"earlier":return s[0];case"later":return s[s.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(n){case"earlier":return Math.min(i-a,i-o);case"compatible":case"later":return Math.max(i-a,i-o);case"reject":throw new RangeError("No such absolute time found")}}function ey(e,t,n="compatible"){return new Date(Zn(e,t,n))}function Qn(e,t){let n=Du(e,t),r=new Date(e+n),i=r.getUTCFullYear(),a=r.getUTCMonth()+1,o=r.getUTCDate(),s=r.getUTCHours(),l=r.getUTCMinutes(),c=r.getUTCSeconds(),d=r.getUTCMilliseconds();return new cy(i<1?"BC":"AD",i<1?-i+1:i,a,o,t,n,s,l,c,d)}function ci(e){return new Dr(e.calendar,e.era,e.year,e.month,e.day)}function Xt(e,t){let n=0,r=0,i=0,a=0;if("timeZone"in e)({hour:n,minute:r,second:i,millisecond:a}=e);else if("hour"in e&&!t)return e;return t&&({hour:n,minute:r,second:i,millisecond:a}=t),new VA(e.calendar,e.era,e.year,e.month,e.day,n,r,i,a)}function Ze(e,t){if(tc(e.calendar,t))return e;let n=t.fromJulianDay(e.calendar.toJulianDay(e)),r=e.copy();return r.calendar=t,r.era=n.era,r.year=n.year,r.month=n.month,r.day=n.day,pi(r),r}function ty(e,t,n){if(e instanceof cy)return e.timeZone===t?e:pA(e,t);let r=Zn(e,t,n);return Qn(r,t)}function gA(e){let t=va(e)-e.offset;return new Date(t)}function pA(e,t){let n=va(e)-e.offset;return Ze(Qn(n,t),e.calendar)}function rc(e,t){var o,s;let n=e.copy(),r="hour"in n?vA(n,t):0;Fu(n,t.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=t.months||0,Mu(n),ny(n),n.day+=(t.weeks||0)*7,n.day+=t.days||0,n.day+=r,hA(n),n.calendar.balanceDate&&n.calendar.balanceDate(n),n.year<1&&(n.year=1,n.month=1,n.day=1);let i=n.calendar.getYearsInEra(n);if(n.year>i){let l=(s=(o=n.calendar).isInverseEra)==null?void 0:s.call(o,n);n.year=i,n.month=l?1:n.calendar.getMonthsInYear(n),n.day=l?1:n.calendar.getDaysInMonth(n)}n.month<1&&(n.month=1,n.day=1);let a=n.calendar.getMonthsInYear(n);return n.month>a&&(n.month=a,n.day=n.calendar.getDaysInMonth(n)),n.day=Math.max(1,Math.min(n.calendar.getDaysInMonth(n),n.day)),n}function Fu(e,t){var n,r;(r=(n=e.calendar).isInverseEra)!=null&&r.call(n,e)&&(t=-t),e.year+=t}function Mu(e){for(;e.month<1;)Fu(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,Fu(e,1)}function hA(e){for(;e.day<1;)e.month--,Mu(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,Mu(e)}function ny(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day))}function pi(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),ny(e)}function ry(e){let t={};for(let n in e)typeof e[n]=="number"&&(t[n]=-e[n]);return t}function iy(e,t){return rc(e,ry(t))}function ju(e,t){let n=e.copy();return t.era!=null&&(n.era=t.era),t.year!=null&&(n.year=t.year),t.month!=null&&(n.month=t.month),t.day!=null&&(n.day=t.day),pi(n),n}function Ql(e,t){let n=e.copy();return t.hour!=null&&(n.hour=t.hour),t.minute!=null&&(n.minute=t.minute),t.second!=null&&(n.second=t.second),t.millisecond!=null&&(n.millisecond=t.millisecond),mA(n),n}function fA(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=Ul(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=Ul(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=Ul(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=Ul(e.hour,24),t}function mA(e){e.millisecond=Math.max(0,Math.min(e.millisecond,1e3)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function Ul(e,t){let n=e%t;return n<0&&(n+=t),n}function vA(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,fA(e)}function Yu(e,t,n,r){var a,o;let i=e.copy();switch(t){case"era":{let s=e.calendar.getEras(),l=s.indexOf(e.era);if(l<0)throw new Error("Invalid era: "+e.era);l=er(l,n,0,s.length-1,r==null?void 0:r.round),i.era=s[l],pi(i);break}case"year":(o=(a=i.calendar).isInverseEra)!=null&&o.call(a,i)&&(n=-n),i.year=er(e.year,n,-1/0,9999,r==null?void 0:r.round),i.year===-1/0&&(i.year=1),i.calendar.balanceYearMonth&&i.calendar.balanceYearMonth(i,e);break;case"month":i.month=er(e.month,n,1,e.calendar.getMonthsInYear(e),r==null?void 0:r.round);break;case"day":i.day=er(e.day,n,1,e.calendar.getDaysInMonth(e),r==null?void 0:r.round);break;default:throw new Error("Unsupported field "+t)}return e.calendar.balanceDate&&e.calendar.balanceDate(i),pi(i),i}function ay(e,t,n,r){let i=e.copy();switch(t){case"hour":{let a=e.hour,o=0,s=23;if((r==null?void 0:r.hourCycle)===12){let l=a>=12;o=l?12:0,s=l?23:11}i.hour=er(a,n,o,s,r==null?void 0:r.round);break}case"minute":i.minute=er(e.minute,n,0,59,r==null?void 0:r.round);break;case"second":i.second=er(e.second,n,0,59,r==null?void 0:r.round);break;case"millisecond":i.millisecond=er(e.millisecond,n,0,999,r==null?void 0:r.round);break;default:throw new Error("Unsupported field "+t)}return i}function er(e,t,n,r,i=!1){if(i){e+=Math.sign(t),e0?e=Math.ceil(e/a)*a:e=Math.floor(e/a)*a,e>r&&(e=n)}else e+=t,er&&(e=n+(e-r-1));return e}function oy(e,t){let n;if(t.years!=null&&t.years!==0||t.months!=null&&t.months!==0||t.weeks!=null&&t.weeks!==0||t.days!=null&&t.days!==0){let i=rc(Xt(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days});n=Zn(i,e.timeZone)}else n=va(e)-e.offset;n+=t.milliseconds||0,n+=(t.seconds||0)*1e3,n+=(t.minutes||0)*6e4,n+=(t.hours||0)*36e5;let r=Qn(n,e.timeZone);return Ze(r,e.calendar)}function yA(e,t){return oy(e,ry(t))}function bA(e,t,n,r){switch(t){case"hour":{let i=0,a=23;if((r==null?void 0:r.hourCycle)===12){let f=e.hour>=12;i=f?12:0,a=f?23:11}let o=Xt(e),s=Ze(Ql(o,{hour:i}),new ma),l=[Zn(s,e.timeZone,"earlier"),Zn(s,e.timeZone,"later")].filter(f=>Qn(f,e.timeZone).day===s.day)[0],c=Ze(Ql(o,{hour:a}),new ma),d=[Zn(c,e.timeZone,"earlier"),Zn(c,e.timeZone,"later")].filter(f=>Qn(f,e.timeZone).day===c.day).pop(),u=va(e)-e.offset,p=Math.floor(u/Io),g=u%Io;return u=er(p,n,Math.floor(l/Io),Math.floor(d/Io),r==null?void 0:r.round)*Io+g,Ze(Qn(u,e.timeZone),e.calendar)}case"minute":case"second":case"millisecond":return ay(e,t,n,r);case"era":case"year":case"month":case"day":{let i=Yu(Xt(e),t,n,r),a=Zn(i,e.timeZone);return Ze(Qn(a,e.timeZone),e.calendar)}default:throw new Error("Unsupported field "+t)}}function EA(e,t,n){let r=Xt(e),i=Ql(ju(r,t),t);if(i.compare(r)===0)return e;let a=Zn(i,e.timeZone,n);return Ze(Qn(a,e.timeZone),e.calendar)}function TA(e){let t=e.match(PA);if(!t)throw SA.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let n=new Dr(Ou(t[1],0,9999),Ou(t[2],1,12),1);return n.day=Ou(t[3],1,n.calendar.getDaysInMonth(n)),n}function Ou(e,t,n){let r=Number(e);if(rn)throw new RangeError(`Value out of range: ${t} <= ${r} <= ${n}`);return r}function CA(e){return`${String(e.hour).padStart(2,"0")}:${String(e.minute).padStart(2,"0")}:${String(e.second).padStart(2,"0")}${e.millisecond?String(e.millisecond/1e3).slice(1):""}`}function sy(e){let t=Ze(e,new ma),n;return t.era==="BC"?n=t.year===1?"0000":"-"+String(Math.abs(1-t.year)).padStart(6,"00"):n=String(t.year).padStart(4,"0"),`${n}-${String(t.month).padStart(2,"0")}-${String(t.day).padStart(2,"0")}`}function ly(e){return`${sy(e)}T${CA(e)}`}function wA(e){let t=Math.sign(e)<0?"-":"+";e=Math.abs(e);let n=Math.floor(e/36e5),r=Math.floor(e%36e5/6e4),i=Math.floor(e%36e5%6e4/1e3),a=`${t}${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`;return i!==0&&(a+=`:${String(i).padStart(2,"0")}`),a}function OA(e){return`${ly(e)}${wA(e.offset)}[${e.timeZone}]`}function Xu(e){let t=typeof e[0]=="object"?e.shift():new ma,n;if(typeof e[0]=="string")n=e.shift();else{let o=t.getEras();n=o[o.length-1]}let r=e.shift(),i=e.shift(),a=e.shift();return[t,n,r,i,a]}function dy(e,t={}){if(typeof t.hour12=="boolean"&&xA()){t=h({},t);let i=AA[String(t.hour12)][e.split("-")[0]],a=t.hour12?"h12":"h23";t.hourCycle=i!=null?i:a,delete t.hour12}let n=e+(t?Object.entries(t).sort((i,a)=>i[0]a.type==="hour").value,10),i=parseInt(n.formatToParts(new Date(2020,2,3,23)).find(a=>a.type==="hour").value,10);if(r===0&&i===23)return"h23";if(r===24&&i===23)return"h24";if(r===0&&i===11)return"h11";if(r===12&&i===11)return"h12";throw new Error("Unexpected hour cycle result")}function NA(e,t,n,r,i){let a={};for(let s in t){let l=s,c=t[l];c!=null&&(a[l]=Math.floor(c/2),a[l]>0&&c%2===0&&a[l]--)}let o=hi(e,t,n).subtract(a);return Oo(e,o,t,n,r,i)}function hi(e,t,n,r,i){let a=e;return t.years?a=wo(e):t.months?a=Jn(e):t.weeks&&(a=Lr(e,n)),Oo(e,a,t,n,r,i)}function Zu(e,t,n,r,i){let a=h({},t);a.days?a.days--:a.weeks?a.weeks--:a.months?a.months--:a.years&&a.years--;let o=hi(e,t,n).subtract(a);return Oo(e,o,t,n,r,i)}function Oo(e,t,n,r,i,a){return i&&e.compare(i)>=0&&(t=Zv(t,hi(ci(i),n,r))),a&&e.compare(a)<=0&&(t=Xv(t,Zu(ci(a),n,r))),t}function jt(e,t,n){let r=ci(e),i=t?ci(t):void 0,a=n?ci(n):void 0,o=r;return i&&(o=Zv(o,i)),a&&(o=Xv(o,a)),o.compare(r)===0?e:"hour"in e?e.set({year:o.year,month:o.month,day:o.day}):o}function Lv(e,t,n,r,i,a){switch(t){case"start":return hi(e,n,r,i,a);case"end":return Zu(e,n,r,i,a);case"center":default:return NA(e,n,r,i,a)}}function Nr(e,t){return e==null||t==null?e===t:!("hour"in e)&&!("hour"in t)?Nt(e,t):Xt(e).compare(Xt(t))===0}function Dv(e,t,n,r,i){return e?t!=null&&t(e,n)?!0:An(e,r,i):!1}function An(e,t,n){return t!=null&&e.compare(t)<0||n!=null&&e.compare(n)>0}function LA(e,t,n){let r=e.subtract({days:1});return Nt(r,e)||An(r,t,n)}function DA(e,t,n){let r=e.add({days:1});return Nt(r,e)||An(r,t,n)}function Ju(e){let t=h({},e);for(let n in t)t[n]=1;return t}function uy(e,t){let n=h({},t);return n.days?n.days--:n.days=-1,e.add(n)}function gy(e){if(!e)return;let t=e.calendar.identifier;return t==="gregory"||t==="iso8601"?e.era==="BC"?"short":void 0:"short"}function py(e,t,n){let r=n!=null?n:Xt(nc(t));return new Yt(e,{weekday:"long",month:"long",year:"numeric",day:"numeric",era:gy(r),calendar:r.calendar.identifier,timeZone:t})}function Fv(e,t,n){let r=n!=null?n:nc(t);return new Yt(e,{month:"long",year:"numeric",era:gy(r),calendar:r.calendar.identifier,timeZone:t})}function FA(e,t,n,r,i){let a=n.formatRangeToParts(e.toDate(i),t.toDate(i)),o=-1;for(let c=0;co&&(l+=a[c].value);return r(s,l)}function ql(e,t,n,r){if(!e)return"";let i=e,a=t!=null?t:e,o=py(n,r);return Nt(i,a)?o.format(i.toDate(r)):FA(i,a,o,(s,l)=>`${s} \u2013 ${l}`,r)}function hy(e){return e!=null?MA[e]:void 0}function fy(e,t,n){let r=hy(n);return Lr(e,t,r)}function my(e,t,n,r){let i=t.add({weeks:e}),a=[],o=fy(i,n,r);for(;a.length<7;){a.push(o);let s=o.add({days:1});if(Nt(o,s))break;o=s}return a}function _A(e,t,n,r){let i=hy(r),a=n!=null?n:sA(e,t,i);return[...new Array(a).keys()].map(s=>my(s,e,t,r))}function $A(e,t){let n=new Yt(e,{weekday:"long",timeZone:t}),r=new Yt(e,{weekday:"short",timeZone:t}),i=new Yt(e,{weekday:"narrow",timeZone:t});return a=>{let o=a instanceof Date?a:a.toDate(t);return{value:a,short:r.format(o),long:n.format(o),narrow:i.format(o)}}}function HA(e,t,n,r){let i=fy(e,r,t),a=[...new Array(7).keys()],o=$A(r,n);return a.map(s=>o(i.add({days:s})))}function BA(e,t="long",n){if(!n||n.calendar.identifier==="gregory"||n.calendar.identifier==="iso8601"){let o=new Date(2021,0,1),s=[];for(let l=0;l<12;l++)s.push(o.toLocaleString(e,{month:t})),o.setMonth(o.getMonth()+1);return s}let r=n.calendar.getMonthsInYear(n),i=new Yt(e,{month:t,calendar:n.calendar.identifier}),a=[];for(let o=1;o<=r;o++){let s=n.set({month:o});a.push(i.format(s.toDate("UTC")))}return a}function Mv(e,t){let n=Lr(e,t,"mon"),r=n.year,i=n.set({month:1,day:4}),a=Lr(i,t,"mon"),o=n.calendar.toJulianDay(n),s=a.calendar.toJulianDay(a);if(o>=s)return 1+Math.floor((o-s)/7);let l=n.set({year:r-1,month:1,day:4}),c=Lr(l,t,"mon"),d=c.calendar.toJulianDay(c);return 1+Math.floor((o-d)/7)}function GA(e){let t=[];for(let n=e.from;n<=e.to;n+=1)t.push(n);return t}function WA(e,t,n){var o,s;let r=e.calendar,i=(o=t==null?void 0:t.year)!=null?o:Ze(new Dr(UA,1,1),r).year,a=(s=n==null?void 0:n.year)!=null?s:Ze(new Dr(qA,12,31),r).year;return{from:i,to:a}}function zA(e){if(e){if(e.length===3)return e.padEnd(4,"0");if(e.length===2){let t=new Date().getFullYear(),n=Math.floor(t/100)*100,r=parseInt(e.slice(-2),10),i=n+r;return i>t+KA?(i-100).toString():i.toString()}return e}}function fa(e,t){let n=t!=null&&t.strict?10:12,r=e-e%10,i=[];for(let a=0;a0?{startDate:hi(s,e,t,n,r),endDate:l,focusedDate:jt(s,n,r)}:{startDate:o,endDate:l,focusedDate:jt(s,n,r)}}}function vy(e,t,n,r,i,a){let o=Vo(n,r,i,a),s=t.add(n);return o({focusedDate:e.add(n),startDate:hi(Oo(e,s,n,r,i,a),n,r)})}function yy(e,t,n,r,i,a){let o=Vo(n,r,i,a),s=t.subtract(n);return o({focusedDate:e.subtract(n),startDate:hi(Oo(e,s,n,r,i,a),n,r)})}function jA(e,t,n,r,i,a,o){let s=Vo(r,i,a,o);if(!n&&!r.days)return s({focusedDate:e.add(Ju(r)),startDate:t});if(r.days)return vy(e,t,r,i,a,o);if(r.weeks)return s({focusedDate:e.add({months:1}),startDate:t});if(r.months||r.years)return s({focusedDate:e.add({years:1}),startDate:t})}function YA(e,t,n,r,i,a,o){let s=Vo(r,i,a,o);if(!n&&!r.days)return s({focusedDate:e.subtract(Ju(r)),startDate:t});if(r.days)return yy(e,t,r,i,a,o);if(r.weeks)return s({focusedDate:e.subtract({months:1}),startDate:t});if(r.months||r.years)return s({focusedDate:e.subtract({years:1}),startDate:t})}function JA(e,t,n){var c;let r=QA(t,n),{year:i,month:a,day:o}=(c=ex(r,e))!=null?c:{};if(i!=null||a!=null||o!=null){let d=new Date;i||(i=d.getFullYear().toString()),a||(a=(d.getMonth()+1).toString()),o||(o=d.getDate().toString())}if(_v(i)||(i=zA(i)),_v(i)&&XA(a)&&ZA(o))return new Dr(+i,+a,+o);let l=Date.parse(e);if(!isNaN(l)){let d=new Date(l);return new Dr(d.getFullYear(),d.getMonth()+1,d.getDate())}}function QA(e,t){return new Yt(e,{day:"numeric",month:"numeric",year:"numeric",timeZone:t}).formatToParts(new Date(2e3,11,25)).map(({type:i,value:a})=>i==="literal"?`${a}?`:`((?!=<${i}>)\\d+)?`).join("")}function ex(e,t){var r;let n=t.match(e);return(r=e.toString().match(/<(.+?)>/g))==null?void 0:r.map(i=>{var o;let a=i.match(/<(.+)>/);return!a||a.length<=0?null:(o=i.match(/<(.+)>/))==null?void 0:o[1]}).reduce((i,a,o)=>(a&&(n&&n.length>o?i[a]=n[o+1]:i[a]=null),i),{})}function $v(e,t,n){let r=ci(Kv(n));switch(e){case"thisWeek":return[Lr(r,t),xv(r,t)];case"thisMonth":return[Jn(r),r];case"thisQuarter":return[Jn(r).add({months:-((r.month-1)%3)}),r];case"thisYear":return[wo(r),r];case"last3Days":return[r.add({days:-2}),r];case"last7Days":return[r.add({days:-6}),r];case"last14Days":return[r.add({days:-13}),r];case"last30Days":return[r.add({days:-29}),r];case"last90Days":return[r.add({days:-89}),r];case"lastMonth":return[Jn(r.add({months:-1})),Lu(r.add({months:-1}))];case"lastQuarter":return[Jn(r.add({months:-((r.month-1)%3)-3})),Lu(r.add({months:-((r.month-1)%3)-1}))];case"lastWeek":return[Lr(r,t).add({weeks:-1}),xv(r,t).add({weeks:-1})];case"lastYear":return[wo(r.add({years:-1})),aA(r.add({years:-1}))];default:throw new Error(`Invalid date range preset: ${e}`)}}function $u(e){let[t,n]=e,r;return!t||!n?r=e:r=t.compare(n)<=0?e:[n,t],r}function ha(e,t){let[n,r]=t;return!n||!r?!1:n.compare(e)<=0&&r.compare(e)>=0}function Kl(e){return e.slice().filter(t=>t!=null).sort((t,n)=>t.compare(n))}function ux(e){return He(e,{year:"calendar decade",month:"calendar year",day:"calendar month"})}function px(e){return new Yt(e).formatToParts(new Date).map(t=>{var n;return(n=gx[t.type])!=null?n:t.value}).join("")}function fx(e){let r=new Intl.DateTimeFormat(e).formatToParts(new Date).find(i=>i.type==="literal");return r?r.value:"/"}function tr(e,t){return e?e==="day"?0:e==="month"?1:2:t||0}function Qu(e){return e===0?"day":e===1?"month":"year"}function eg(e,t,n){return Qu(Ae(tr(e,0),tr(t,0),tr(n,2)))}function vx(e,t){return tr(e,0)>tr(t,0)}function yx(e,t){return tr(e,0)e(t))}function Tx(e,t){let{state:n,context:r,prop:i,send:a,computed:o,scope:s}=e,l=r.get("startValue"),c=o("endValue"),d=r.get("value"),u=r.get("focusedValue"),p=r.get("hoveredValue"),g=p?$u([d[0],p]):[],f=!!i("disabled"),m=!!i("readOnly"),S=!!i("invalid"),T=o("isInteractive"),w=d.length===0,I=i("min"),P=i("max"),v=i("locale"),E=i("timeZone"),R=i("startOfWeek"),x=n.matches("focused"),C=n.matches("open"),A=i("selectionMode")==="range",N=i("selectionMode")==="multiple",k=i("isDateUnavailable"),L=i("maxSelectedDates"),K=N&&L!=null&&d.length>=L,J=r.get("currentPlacement"),ue=Ut(y(h({},i("positioning")),{placement:J})),Z=fx(v),ce=h(h({},mx),i("translations"));function ve(F=l){let D=i("fixedWeeks")?6:void 0;return _A(F,v,D,R)}function le(F={}){let{format:D}=F;return BA(v,D,u).map((_,G)=>{let Ee=G+1,rt=u.set({month:Ee}),We=An(rt,I,P);return{label:_,value:Ee,disabled:We}})}function De(){let F=WA(u,I,P);return GA(F).map(_=>({label:_.toString(),value:_,disabled:!Yi(_,I==null?void 0:I.year,P==null?void 0:P.year)}))}function Fe(F){return Dv(F,k,v,I,P)}function Qt(F){let D=l!=null?l:Co(E,u.calendar);a({type:"FOCUS.SET",value:D.set({month:F})})}function ts(F){let D=l!=null?l:Co(E,u.calendar);a({type:"FOCUS.SET",value:D.set({year:F})})}function Ri(F){let{value:D,disabled:_}=F,G=u.set({year:D}),rt=!fa(l.year,{strict:!0}).includes(D),We=Yi(D,I==null?void 0:I.year,P==null?void 0:P.year),dt=A&&ha(G,d),ar=A&&d[0]&&So(G,d[0]),ki=A&&d[1]&&So(G,d[1]),Wr=A&&g.length>0,Ni=Wr&&ha(G,g),or=Wr&&g[0]&&So(G,g[0]),sr=Wr&&g[1]&&So(G,g[1]),ns={focused:u.year===F.value,selectable:!rt&&We,outsideRange:rt,selected:!!d.find(rs=>rs&&rs.year===D),valueText:D.toString(),inRange:dt||Ni,firstInRange:!!ar,lastInRange:!!ki,inHoveredRange:!!Ni,firstInHoveredRange:!!or,lastInHoveredRange:!!sr,value:G,get disabled(){return _||!ns.selectable}};return ns}function Ur(F){let{value:D,disabled:_}=F,G=u.set({month:D}),Ee=Fv(v,E,u),rt=A&&ha(G,d),We=A&&d[0]&&Po(G,d[0]),dt=A&&d[1]&&Po(G,d[1]),ar=A&&g.length>0,ki=ar&&ha(G,g),Wr=ar&&g[0]&&Po(G,g[0]),Ni=ar&&g[1]&&Po(G,g[1]),or={focused:u.month===F.value,selectable:!An(G,I,P),selected:!!d.find(sr=>sr&&sr.month===D&&sr.year===u.year),valueText:Ee.format(G.toDate(E)),inRange:rt||ki,firstInRange:!!We,lastInRange:!!dt,inHoveredRange:!!ki,firstInHoveredRange:!!Wr,lastInHoveredRange:!!Ni,outsideRange:!1,value:G,get disabled(){return _||!or.selectable}};return or}function qr(F){let{value:D,disabled:_,visibleRange:G=o("visibleRange")}=F,Ee=py(v,E,u),rt=Ju(o("visibleDuration")),We=i("outsideDaySelectable"),dt=G.start.add(rt).subtract({days:1}),ar=An(D,G.start,dt),ki=A&&ha(D,d),Wr=A&&d[0]&&Nt(D,d[0]),Ni=A&&d[1]&&Nt(D,d[1]),or=A&&g.length>0,sr=or&&ha(D,g),ns=or&&g[0]&&Nt(D,g[0]),rs=or&&g[1]&&Nt(D,g[1]),yp=d.some(bp=>bp!=null&&Nt(D,bp)),is={invalid:An(D,I,P),disabled:_||!We&&ar||An(D,I,P)||K&&!yp,selected:yp,unavailable:Dv(D,k,v,I,P)&&!_,outsideRange:ar,today:tA(D,E),weekend:cA(D,v),value:D,valueText:Ee.format(D.toDate(E)),get focused(){return u!=null&&Nt(D,u)&&(!is.outsideRange||We)},get selectable(){return!is.disabled&&!is.unavailable},inRange:ki||sr,firstInRange:Wr,lastInRange:Ni,inHoveredRange:sr,firstInHoveredRange:ns,lastInHoveredRange:rs};return is}function Nc(F){let{view:D="day",id:_}=F;return[D,_].filter(Boolean).join(" ")}return{focused:x,open:C,disabled:f,invalid:S,readOnly:m,inline:!!i("inline"),numOfMonths:i("numOfMonths"),showWeekNumbers:!!i("showWeekNumbers"),selectionMode:i("selectionMode"),maxSelectedDates:L,isMaxSelected:K,view:r.get("view"),getRangePresetValue(F){return $v(F,v,E)},getWeekNumber(F){let D=F[0];return D?Mv(D,v):0},getDaysInWeek(F,D=l){return my(F,D,v,R)},getOffset(F){let D=l.add(F),_=c.add(F),G=Fv(v,E,u);return{visibleRange:{start:D,end:_},weeks:ve(D),visibleRangeText:{start:G.format(D.toDate(E)),end:G.format(_.toDate(E))}}},getMonthWeeks:ve,isUnavailable:Fe,weeks:ve(),weekDays:HA(l,R,E,v),visibleRangeText:o("visibleRangeText"),value:d,valueAsDate:d.filter(F=>F!=null).map(F=>F.toDate(E)),valueAsString:o("valueAsString"),focusedValue:u,focusedValueAsDate:u==null?void 0:u.toDate(E),focusedValueAsString:i("format")(u,{locale:v,timeZone:E}),visibleRange:o("visibleRange"),selectToday(){let F=jt(Co(E,u.calendar),I,P);a({type:"VALUE.SET",value:[F]})},setValue(F){let D=F.map(_=>jt(_,I,P));a({type:"VALUE.SET",value:D})},setTime(F,D=0){var Ee,rt,We,dt;let _=Array.from(d),G=_[D];G&&("hour"in G||(G=Xt(G)),G=G.set({hour:(Ee=F.hour)!=null?Ee:"hour"in G?G.hour:0,minute:(rt=F.minute)!=null?rt:"minute"in G?G.minute:0,second:(We=F.second)!=null?We:"second"in G?G.second:0,millisecond:(dt=F.millisecond)!=null?dt:"millisecond"in G?G.millisecond:0}),_[D]=jt(G,I,P),a({type:"VALUE.SET",value:_}))},clearValue(F={}){let{focus:D=!0}=F;a({type:"VALUE.CLEAR",focus:D})},setFocusedValue(F){a({type:"FOCUS.SET",value:F})},setOpen(F){i("inline")||n.matches("open")===F||a({type:F?"OPEN":"CLOSE"})},focusMonth:Qt,focusYear:ts,getYears:De,getMonths:le,getYearsGrid(F={}){let{columns:D=1}=F,_=fa(l.year,{strict:!0}).map(G=>({label:G.toString(),value:G,disabled:!Yi(G,I==null?void 0:I.year,P==null?void 0:P.year)}));return Ba(_,D)},getDecade(){let F=fa(l.year,{strict:!0});return{start:F.at(0),end:F.at(-1)}},getMonthsGrid(F={}){let{columns:D=1,format:_}=F;return Ba(le({format:_}),D)},format(F,D={month:"long",year:"numeric"}){return new Yt(v,y(h({},D),{calendar:F.calendar.identifier})).format(F.toDate(E))},setView(F){a({type:"VIEW.SET",view:F})},goToNext(){a({type:"GOTO.NEXT",view:r.get("view")})},goToPrev(){a({type:"GOTO.PREV",view:r.get("view")})},getRootProps(){return t.element(y(h({},Te.root.attrs),{dir:i("dir"),id:nx(s),"data-state":C?"open":"closed","data-disabled":b(f),"data-readonly":b(m),"data-empty":b(w)}))},getLabelProps(F={}){let{index:D=0}=F;return t.label(y(h({},Te.label.attrs),{id:tx(s,D),dir:i("dir"),htmlFor:Hv(s,D),"data-state":C?"open":"closed","data-index":D,"data-disabled":b(f),"data-readonly":b(m)}))},getControlProps(){return t.element(y(h({},Te.control.attrs),{dir:i("dir"),id:Ey(s),"data-disabled":b(f),"data-placeholder-shown":b(w)}))},getRangeTextProps(){return t.element(y(h({},Te.rangeText.attrs),{dir:i("dir")}))},getContentProps(){return t.element(y(h({},Te.content.attrs),{hidden:!C,dir:i("dir"),"data-state":C?"open":"closed","data-placement":J,"data-inline":b(i("inline")),id:_u(s),tabIndex:-1,role:"application","aria-roledescription":"datepicker","aria-label":ce.content}))},getTableProps(F={}){let{view:D="day",columns:_=D==="day"?7:4}=F,G=Nc(F);return t.element(y(h({},Te.table.attrs),{role:"grid","data-columns":_,"aria-roledescription":ux(D),id:rx(s,G),"aria-readonly":se(m),"aria-disabled":se(f),"aria-multiselectable":se(i("selectionMode")!=="single"),"data-view":D,dir:i("dir"),tabIndex:-1,onKeyDown(Ee){if(Ee.defaultPrevented)return;let We={Enter(){D==="day"&&Fe(u)||D==="month"&&!Ur({value:u.month}).selectable||D==="year"&&!Ri({value:u.year}).selectable||a({type:"TABLE.ENTER",view:D,columns:_,focus:!0})},ArrowLeft(){a({type:"TABLE.ARROW_LEFT",view:D,columns:_,focus:!0})},ArrowRight(){a({type:"TABLE.ARROW_RIGHT",view:D,columns:_,focus:!0})},ArrowUp(){a({type:"TABLE.ARROW_UP",view:D,columns:_,focus:!0})},ArrowDown(){a({type:"TABLE.ARROW_DOWN",view:D,columns:_,focus:!0})},PageUp(dt){a({type:"TABLE.PAGE_UP",larger:dt.shiftKey,view:D,columns:_,focus:!0})},PageDown(dt){a({type:"TABLE.PAGE_DOWN",larger:dt.shiftKey,view:D,columns:_,focus:!0})},Home(){a({type:"TABLE.HOME",view:D,columns:_,focus:!0})},End(){a({type:"TABLE.END",view:D,columns:_,focus:!0})}}[me(Ee,{dir:i("dir")})];We&&(We(Ee),Ee.preventDefault(),Ee.stopPropagation())},onPointerLeave(){a({type:"TABLE.POINTER_LEAVE"})},onPointerDown(){a({type:"TABLE.POINTER_DOWN",view:D})},onPointerUp(){a({type:"TABLE.POINTER_UP",view:D})}}))},getTableHeadProps(F={}){let{view:D="day"}=F;return t.element(y(h({},Te.tableHead.attrs),{"aria-hidden":!0,dir:i("dir"),"data-view":D,"data-disabled":b(f)}))},getTableHeaderProps(F={}){let{view:D="day"}=F;return t.element(y(h({},Te.tableHeader.attrs),{dir:i("dir"),"data-view":D,"data-disabled":b(f)}))},getTableBodyProps(F={}){let{view:D="day"}=F;return t.element(y(h({},Te.tableBody.attrs),{"data-view":D,"data-disabled":b(f)}))},getTableRowProps(F={}){let{view:D="day"}=F;return t.element(y(h({},Te.tableRow.attrs),{"aria-disabled":se(f),"data-disabled":b(f),"data-view":D}))},getWeekNumberHeaderCellProps(F={}){let{view:D="day"}=F;return t.element(y(h({},Te.tableCell.attrs),{scope:"col","aria-label":ce.weekColumnHeader,"data-view":D,"data-type":"week-number","data-disabled":b(f)}))},getWeekNumberCellProps(F){var Ee;let{weekIndex:D,week:_}=F,G=_[0]?Mv(_[0],v):0;return t.element(y(h({},Te.tableCell.attrs),{role:"rowheader","aria-label":(Ee=ce.weekNumberCell)==null?void 0:Ee.call(ce,G),"data-view":"day","data-week-index":D,"data-type":"week-number","data-disabled":b(f)}))},getDayTableCellState:qr,getDayTableCellProps(F){let{value:D}=F,_=qr(F);return t.element(y(h({},Te.tableCell.attrs),{role:"gridcell","aria-disabled":se(!_.selectable),"aria-selected":_.selected||_.inRange,"aria-invalid":se(_.invalid),"aria-current":_.today?"date":void 0,"data-value":D.toString()}))},getDayTableCellTriggerProps(F){let{value:D}=F,_=qr(F);return t.element(y(h({},Te.tableCellTrigger.attrs),{id:Ru(s,D.toString()),role:"button",dir:i("dir"),tabIndex:_.focused?0:-1,"aria-label":ce.dayCell(_),"aria-disabled":se(!_.selectable),"aria-invalid":se(_.invalid),"data-disabled":b(!_.selectable),"data-selected":b(_.selected),"data-value":D.toString(),"data-view":"day","data-today":b(_.today),"data-focus":b(_.focused),"data-unavailable":b(_.unavailable),"data-range-start":b(_.firstInRange),"data-range-end":b(_.lastInRange),"data-in-range":b(_.inRange),"data-outside-range":b(_.outsideRange),"data-weekend":b(_.weekend),"data-in-hover-range":b(_.inHoveredRange),"data-hover-range-start":b(_.firstInHoveredRange),"data-hover-range-end":b(_.lastInHoveredRange),onClick(G){G.defaultPrevented||_.selectable&&a({type:"CELL.CLICK",cell:"day",value:D})},onPointerMove:A?G=>{if(G.pointerType==="touch"||!_.selectable)return;let Ee=!s.isActiveElement(G.currentTarget);p&&eA(D,p)||a({type:"CELL.POINTER_MOVE",cell:"day",value:D,focus:Ee})}:void 0}))},getMonthTableCellState:Ur,getMonthTableCellProps(F){let{value:D,columns:_}=F,G=Ur(F);return t.element(y(h({},Te.tableCell.attrs),{dir:i("dir"),colSpan:_,role:"gridcell","aria-selected":se(G.selected||G.inRange),"data-selected":b(G.selected),"aria-disabled":se(!G.selectable),"data-value":D}))},getMonthTableCellTriggerProps(F){let{value:D}=F,_=Ur(F);return t.element(y(h({},Te.tableCellTrigger.attrs),{id:Ru(s,D.toString()),role:"button",dir:i("dir"),tabIndex:_.focused?0:-1,"aria-label":_.valueText,"aria-disabled":se(!_.selectable),"data-disabled":b(!_.selectable),"data-selected":b(_.selected),"data-value":D,"data-view":"month","data-focus":b(_.focused),"data-outside-range":b(_.outsideRange),"data-range-start":b(_.firstInRange),"data-range-end":b(_.lastInRange),"data-in-range":b(_.inRange),"data-in-hover-range":b(_.inHoveredRange),"data-hover-range-start":b(_.firstInHoveredRange),"data-hover-range-end":b(_.lastInHoveredRange),onClick(G){G.defaultPrevented||_.selectable&&a({type:"CELL.CLICK",cell:"month",value:D})},onPointerMove:A?G=>{if(G.pointerType==="touch"||!_.selectable)return;let Ee=!s.isActiveElement(G.currentTarget);p&&_.value&&Po(_.value,p)||a({type:"CELL.POINTER_MOVE",cell:"month",value:_.value,focus:Ee})}:void 0}))},getYearTableCellState:Ri,getYearTableCellProps(F){let{value:D,columns:_}=F,G=Ri(F);return t.element(y(h({},Te.tableCell.attrs),{dir:i("dir"),colSpan:_,role:"gridcell","aria-selected":se(G.selected||G.inRange),"data-selected":b(G.selected),"aria-disabled":se(!G.selectable),"data-value":D}))},getYearTableCellTriggerProps(F){let{value:D}=F,_=Ri(F);return t.element(y(h({},Te.tableCellTrigger.attrs),{id:Ru(s,D.toString()),role:"button",dir:i("dir"),tabIndex:_.focused?0:-1,"aria-label":_.valueText,"aria-disabled":se(!_.selectable),"data-disabled":b(!_.selectable),"data-selected":b(_.selected),"data-value":D,"data-view":"year","data-focus":b(_.focused),"data-outside-range":b(_.outsideRange),"data-range-start":b(_.firstInRange),"data-range-end":b(_.lastInRange),"data-in-range":b(_.inRange),"data-in-hover-range":b(_.inHoveredRange),"data-hover-range-start":b(_.firstInHoveredRange),"data-hover-range-end":b(_.lastInHoveredRange),onClick(G){G.defaultPrevented||_.selectable&&a({type:"CELL.CLICK",cell:"year",value:D})},onPointerMove:A?G=>{if(G.pointerType==="touch"||!_.selectable)return;let Ee=!s.isActiveElement(G.currentTarget);p&&_.value&&So(_.value,p)||a({type:"CELL.POINTER_MOVE",cell:"year",value:_.value,focus:Ee})}:void 0}))},getNextTriggerProps(F={}){let{view:D="day"}=F,_=f||!o("isNextVisibleRangeValid");return t.button(y(h({},Te.nextTrigger.attrs),{dir:i("dir"),id:ax(s,D),type:"button","aria-label":ce.nextTrigger(D),disabled:_,"data-disabled":b(_),onClick(G){G.defaultPrevented||a({type:"GOTO.NEXT",view:D})}}))},getPrevTriggerProps(F={}){let{view:D="day"}=F,_=f||!o("isPrevVisibleRangeValid");return t.button(y(h({},Te.prevTrigger.attrs),{dir:i("dir"),id:ix(s,D),type:"button","aria-label":ce.prevTrigger(D),disabled:_,"data-disabled":b(_),onClick(G){G.defaultPrevented||a({type:"GOTO.PREV",view:D})}}))},getClearTriggerProps(){return t.button(y(h({},Te.clearTrigger.attrs),{id:by(s),dir:i("dir"),type:"button","aria-label":ce.clearTrigger,hidden:!d.length,onClick(F){F.defaultPrevented||a({type:"VALUE.CLEAR"})}}))},getTriggerProps(){return t.button(y(h({},Te.trigger.attrs),{id:Py(s),dir:i("dir"),type:"button","data-placement":J,"aria-label":ce.trigger(C),"aria-controls":_u(s),"data-state":C?"open":"closed","data-placeholder-shown":b(w),"aria-haspopup":"grid",disabled:f,onClick(F){F.defaultPrevented||T&&a({type:"TRIGGER.CLICK"})}}))},getViewProps(F={}){let{view:D="day"}=F;return t.element(y(h({},Te.view.attrs),{"data-view":D,hidden:r.get("view")!==D}))},getViewTriggerProps(F={}){let{view:D="day"}=F;return t.button(y(h({},Te.viewTrigger.attrs),{"data-view":D,dir:i("dir"),id:ox(s,D),type:"button",disabled:f,"aria-label":ce.viewTrigger(D),onClick(_){_.defaultPrevented||T&&a({type:"VIEW.TOGGLE",src:"viewTrigger"})}}))},getViewControlProps(F={}){let{view:D="day"}=F;return t.element(y(h({},Te.viewControl.attrs),{"data-view":D,dir:i("dir")}))},getInputProps(F={}){let{index:D=0,fixOnBlur:_=!0}=F;return t.input(y(h({},Te.input.attrs),{id:Hv(s,D),autoComplete:"off",autoCorrect:"off",spellCheck:"false",dir:i("dir"),name:i("name"),"data-index":D,"data-state":C?"open":"closed","data-placeholder-shown":b(w),readOnly:m,disabled:f,required:i("required"),"aria-invalid":se(S),"data-invalid":b(S),placeholder:i("placeholder")||px(v),defaultValue:o("valueAsString")[D],onBeforeInput(G){let{data:Ee}=Ot(G);wy(Ee,Z)||G.preventDefault()},onClick(G){G.defaultPrevented||i("openOnClick")&&T&&a({type:"OPEN",src:"input.click"})},onFocus(){a({type:"INPUT.FOCUS",index:D})},onBlur(G){let Ee=G.currentTarget.value.trim();a({type:"INPUT.BLUR",value:Ee,index:D,fixOnBlur:_})},onKeyDown(G){if(G.defaultPrevented||!T)return;let rt={Enter(We){Me(We)||Fe(u)||We.currentTarget.value.trim()!==""&&a({type:"INPUT.ENTER",value:We.currentTarget.value,index:D})}}[G.key];rt&&(rt(G),G.preventDefault())},onInput(G){let Ee=G.currentTarget.value;a({type:"INPUT.CHANGE",value:hx(Ee,Z),index:D})}}))},getMonthSelectProps(){return t.select(y(h({},Te.monthSelect.attrs),{id:Iy(s),"aria-label":ce.monthSelect,disabled:f,dir:i("dir"),defaultValue:l.month,onChange(F){Qt(Number(F.currentTarget.value))}}))},getYearSelectProps(){return t.select(y(h({},Te.yearSelect.attrs),{id:Ty(s),disabled:f,"aria-label":ce.yearSelect,dir:i("dir"),defaultValue:l.year,onChange(F){ts(Number(F.currentTarget.value))}}))},getPositionerProps(){return t.element(y(h({id:Sy(s)},Te.positioner.attrs),{dir:i("dir"),style:ue.floating}))},getPresetTriggerProps(F){let D=Array.isArray(F.value)?F.value:$v(F.value,v,E),_=D.filter(G=>G!=null).map(G=>G.toDate(E).toDateString());return t.button(y(h({},Te.presetTrigger.attrs),{"aria-label":ce.presetTrigger(_),type:"button",onClick(G){G.defaultPrevented||a({type:"PRESET.CLICK",value:D})}}))}}}function Cx(e,t){if((e==null?void 0:e.length)!==(t==null?void 0:t.length))return!1;let n=Math.max(e.length,t.length);for(let r=0;rn==null?"":t("format")(n,{locale:t("locale"),timeZone:t("timeZone")}))}function Re(e,t){let{context:n,prop:r,computed:i}=e;if(!t)return;let a=Zl(e,t);if(Nr(n.get("focusedValue"),a))return;let s=Vo(i("visibleDuration"),r("locale"),r("min"),r("max"))({focusedDate:a,startDate:n.get("startValue")});n.set("startValue",s.startDate),n.set("focusedValue",s.focusedDate)}function jl(e,t){let{context:n}=e;n.set("startValue",t.startDate);let r=n.get("focusedValue");Nr(r,t.focusedDate)||n.set("focusedValue",t.focusedDate)}function zt(e){return Array.isArray(e)?e.map(t=>zt(t)):e instanceof Date?new Dr(e.getFullYear(),e.getMonth()+1,e.getDate()):TA(e)}function Vx(e){let t={};return e.content&&(t.content=e.content),e.monthSelect&&(t.monthSelect=e.monthSelect),e.yearSelect&&(t.yearSelect=e.yearSelect),e.clearTrigger&&(t.clearTrigger=e.clearTrigger),e.weekColumnHeader&&(t.weekColumnHeader=e.weekColumnHeader),e.weekNumber&&(t.weekNumberCell=n=>Ox(e.weekNumber,n)),e.openCalendar&&e.closeCalendar&&(t.trigger=n=>n?e.closeCalendar:e.openCalendar),(e.viewTriggerDay||e.viewTriggerMonth||e.viewTriggerYear)&&(t.viewTrigger=n=>Nu(n,e.viewTriggerDay,e.viewTriggerMonth,e.viewTriggerYear)),(e.prevTriggerDay||e.prevTriggerMonth||e.prevTriggerYear)&&(t.prevTrigger=n=>Nu(n,e.prevTriggerDay,e.prevTriggerMonth,e.prevTriggerYear)),(e.nextTriggerDay||e.nextTriggerMonth||e.nextTriggerYear)&&(t.nextTrigger=n=>Nu(n,e.nextTriggerDay,e.nextTriggerMonth,e.nextTriggerYear)),e.placeholderDay&&e.placeholderMonth&&e.placeholderYear&&(t.placeholder=()=>({day:e.placeholderDay,month:e.placeholderMonth,year:e.placeholderYear})),t}function Ax(e,t,n){if(n==="range"||e.querySelector('[data-scope="date-picker"][data-part="label"]'))return;let r=null,i=e.dataset.translation;if(i)try{r=JSON.parse(i)}catch(o){r=null}let a=r==null?void 0:r.input;if(a)for(let o of t)o.getAttribute("aria-labelledby")||o.setAttribute("aria-label",a)}function Rx(e){return typeof e=="object"&&e!==null&&"year"in e&&"month"in e&&"day"in e&&typeof e.year=="number"&&typeof e.month=="number"&&typeof e.day=="number"}function Oy(e){if(e==null)return"";if(typeof e=="string"){let t=e.trim();if(t==="")return"";try{return zt(t).toString()}catch(n){return t}}if(Rx(e)){let{year:t,month:n,day:r}=e,i=String(n).padStart(2,"0"),a=String(r).padStart(2,"0");return`${t}-${i}-${a}`}return String(e)}function ec(e){return e!=null&&e.length?e.map(t=>Oy(t)).filter(Boolean):[]}function kx(e){let t=e.querySelector('[data-scope="date-picker"][data-part="value-input"]');return t!=null&&t.value?t.value.split(",").map(n=>n.trim()).filter(Boolean):[]}function Hu(e,t,n){if(n!=null)return n;let r=ec(t);if(r.length>0)return r;let i=kx(e);return i.length>0?i:Wi(e,"value")}function Bu(e,t){let n=ec(e.api.value);return n.length>0?n:t.length===0?[]:(e.api.setValue(t.map(r=>zt(r))),ec(e.api.value))}function Jl(e,t,n=!1){let r=e.querySelector('[data-scope="date-picker"][data-part="value-input"]');r&&(r.value!==t&&(r.value=t),n?yt(r,t):yt(r,t,{markUsed:!1}))}function Uv(e){let t=e.dataset.translation;if(!t)return{};try{let n=JSON.parse(t);return{translations:Vx(n)}}catch(n){return{}}}function Gu(e){return O(e,"closeOnSelect")}var jV,Te,qv,XV,ma,ZV,nA,Cu,iA,Rv,wu,lA,kv,Nv,Io,PA,SA,IA,nH,Uu,di,Dr,qu,ui,VA,Wu,gi,cy,Vu,Yt,AA,Au,xu,MA,UA,qA,KA,_v,XA,ZA,tx,nx,rx,_u,Ru,ix,ax,ox,by,Ey,Hv,Py,Sy,Iy,Ty,Bv,Wl,Xl,To,sx,lx,cx,dx,Cy,gx,wy,Gv,hx,mx,Px,Ix,Pt,wx,Zl,ku,Nu,Ox,xx,Nx,Ay=ee(()=>{"use strict";Eo();Bt();bl();ii();Or();on();ai();Kt();xr();$e();be();oe();jV=z("date-picker").parts("clearTrigger","content","control","input","label","monthSelect","nextTrigger","positioner","presetTrigger","prevTrigger","rangeText","root","table","tableBody","tableCell","tableCellTrigger","tableHead","tableHeader","tableRow","trigger","view","viewControl","viewTrigger","yearSelect"),Te=jV.build();qv=1721426;XV={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]},ma=class{fromJulianDay(e){let t=e,n=t-qv,r=Math.floor(n/146097),i=Tu(n,146097),a=Math.floor(i/36524),o=Tu(i,36524),s=Math.floor(o/1461),l=Tu(o,1461),c=Math.floor(l/365),d=r*400+a*100+s*4+c+(a!==4&&c!==4?1:0),[u,p]=YV(d),g=t-Gl(u,p,1,1),f=2;t= start date");return`${this.formatter.format(e)} \u2013 ${this.formatter.format(t)}`}formatRangeToParts(e,t){if(typeof this.formatter.formatRangeToParts=="function")return this.formatter.formatRangeToParts(e,t);if(t= start date");let n=this.formatter.formatToParts(e),r=this.formatter.formatToParts(t);return[...n.map(i=>y(h({},i),{source:"startRange"})),{type:"literal",value:" \u2013 ",source:"shared"},...r.map(i=>y(h({},i),{source:"endRange"}))]}resolvedOptions(){let e=this.formatter.resolvedOptions();return RA()&&(this.resolvedHourCycle||(this.resolvedHourCycle=kA(e.locale,this.options)),e.hourCycle=this.resolvedHourCycle,e.hour12=this.resolvedHourCycle==="h11"||this.resolvedHourCycle==="h12"),e.calendar==="ethiopic-amete-alem"&&(e.calendar="ethioaa"),e}},AA={true:{ja:"h11"},false:{}};Au=null;xu=null;MA=["sun","mon","tue","wed","thu","fri","sat"];UA=1900,qA=2099;KA=10;_v=e=>e!=null&&e.length===4,XA=e=>e!=null&&parseFloat(e)<=12,ZA=e=>e!=null&&parseFloat(e)<=31;tx=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.label)==null?void 0:r.call(n,t))!=null?i:`datepicker:${e.id}:label:${t}`},nx=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`datepicker:${e.id}`},rx=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.table)==null?void 0:r.call(n,t))!=null?i:`datepicker:${e.id}:table:${t}`},_u=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`datepicker:${e.id}:content`},Ru=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.cellTrigger)==null?void 0:r.call(n,t))!=null?i:`datepicker:${e.id}:cell-trigger:${t}`},ix=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.prevTrigger)==null?void 0:r.call(n,t))!=null?i:`datepicker:${e.id}:prev:${t}`},ax=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.nextTrigger)==null?void 0:r.call(n,t))!=null?i:`datepicker:${e.id}:next:${t}`},ox=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.viewTrigger)==null?void 0:r.call(n,t))!=null?i:`datepicker:${e.id}:view:${t}`},by=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.clearTrigger)!=null?n:`datepicker:${e.id}:clear`},Ey=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`datepicker:${e.id}:control`},Hv=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.input)==null?void 0:r.call(n,t))!=null?i:`datepicker:${e.id}:input:${t}`},Py=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`datepicker:${e.id}:trigger`},Sy=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`datepicker:${e.id}:positioner`},Iy=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.monthSelect)!=null?n:`datepicker:${e.id}:month-select`},Ty=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.yearSelect)!=null?n:`datepicker:${e.id}:year-select`},Bv=(e,t)=>fr(Xl(e),`[data-part=table-cell-trigger][data-view=${t}][data-focus]:not([data-outside-range])`),Wl=e=>e.getById(Py(e)),Xl=e=>e.getById(_u(e)),To=e=>Oe(Cy(e),"[data-part=input]"),sx=e=>e.getById(Ty(e)),lx=e=>e.getById(Iy(e)),cx=e=>e.getById(by(e)),dx=e=>e.getById(Sy(e)),Cy=e=>e.getById(Ey(e));gx={day:"dd",month:"mm",year:"yyyy"};wy=(e,t)=>e?/\d/.test(e)||e===t||e.length!==1:!0,Gv=e=>!Number.isNaN(e.day)&&!Number.isNaN(e.month)&&!Number.isNaN(e.year),hx=(e,t)=>e.split("").filter(n=>wy(n,t)).join("");mx={dayCell(e){return e.unavailable?`Not available. ${e.valueText}`:e.firstInRange?`Starting range from ${e.valueText}`:e.lastInRange?`Range ending at ${e.valueText}`:e.selected?`Selected date. ${e.valueText}`:`Choose ${e.valueText}`},trigger(e){return e?"Close calendar":"Open calendar"},viewTrigger(e){return He(e,{year:"Switch to month view",month:"Switch to day view",day:"Switch to year view"})},presetTrigger(e){let[t="",n=""]=e;return`select ${t} to ${n}`},prevTrigger(e){return He(e,{year:"Switch to previous decade",month:"Switch to previous year",day:"Switch to previous month"})},nextTrigger(e){return He(e,{year:"Switch to next decade",month:"Switch to next year",day:"Switch to next month"})},placeholder(){return{day:"dd",month:"mm",year:"yyyy"}},content:"calendar",monthSelect:"Select month",yearSelect:"Select year",clearTrigger:"Clear selected dates",weekColumnHeader:"Wk",weekNumberCell(e){return`Week ${e}`}};Px=["day","month","year"];Ix=Vn(e=>[e.view,e.startValue.toString(),e.endValue.toString(),e.locale],([e],t)=>{let{startValue:n,endValue:r,locale:i,timeZone:a,selectionMode:o}=t;if(e==="year"){let u=fa(n.year,{strict:!0}),p=u.at(0).toString(),g=u.at(-1).toString();return{start:p,end:g,formatted:`${p} - ${g}`}}if(e==="month"){let u=new Yt(i,{year:"numeric",timeZone:a,calendar:n.calendar.identifier}),p=u.format(n.toDate(a)),g=u.format(r.toDate(a)),f=o==="range"?`${p} - ${g}`:p;return{start:p,end:g,formatted:f}}let s=new Yt(i,{month:"long",year:"numeric",timeZone:a,calendar:n.calendar.identifier}),l=s.format(n.toDate(a)),c=s.format(r.toDate(a)),d=o==="range"?`${l} - ${c}`:l;return{start:l,end:c,formatted:d}});({and:Pt}=we());wx=te({props({props:e}){let t=e.locale||"en-US",n=e.timeZone||"UTC",r=e.selectionMode||"single",i=e.numOfMonths||1,a;if(e.createCalendar){let f=new Intl.DateTimeFormat(t).resolvedOptions().calendar;f!=="gregory"&&f!=="iso8601"&&(a=e.createCalendar(f))}let o=g=>!a||g.calendar.identifier===a.identifier?g:Ze(g,a),s=e.defaultValue?Kl(e.defaultValue).map(g=>jt(o(g),e.min,e.max)):void 0,l=e.value?Kl(e.value).map(g=>jt(o(g),e.min,e.max)):void 0,c=e.focusedValue||e.defaultFocusedValue||(l==null?void 0:l[0])||(s==null?void 0:s[0])||Co(n,a);c=jt(o(c),e.min,e.max);let d="day",u="year",p=eg(e.view||d,d,u);return y(h({locale:t,numOfMonths:i,timeZone:n,selectionMode:r,defaultView:p,minView:d,maxView:u,outsideDaySelectable:!1,closeOnSelect:!0,format(g,{locale:f,timeZone:m}){return new Yt(f,{timeZone:m,day:"2-digit",month:"2-digit",year:"numeric",calendar:a==null?void 0:a.identifier}).format(g.toDate(m))},parse(g,{locale:f,timeZone:m}){return JA(g,f,m)}},e),{focusedValue:typeof e.focusedValue=="undefined"?void 0:c,defaultFocusedValue:c,value:l,defaultValue:s!=null?s:[],positioning:h({placement:"bottom"},e.positioning)})},initialState({prop:e}){return e("open")||e("defaultOpen")||e("inline")?"open":"idle"},refs(){return{announcer:void 0}},context({prop:e,bindable:t,getContext:n}){return{focusedValue:t(()=>({defaultValue:e("defaultFocusedValue"),value:e("focusedValue"),isEqual:Nr,hash:r=>r.toString(),sync:!0,onChange(r){var l;let i=n(),a=i.get("view"),o=i.get("value"),s=zl(o,e);(l=e("onFocusChange"))==null||l({value:o,valueAsString:s,view:a,focusedValue:r})}})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:Cx,hash:r=>r.map(i=>{var a;return(a=i==null?void 0:i.toString())!=null?a:""}).join(","),onChange(r){var o;let i=n(),a=zl(r,e);(o=e("onValueChange"))==null||o({value:r,valueAsString:a,view:i.get("view")})}})),inputValue:t(()=>({defaultValue:""})),activeIndex:t(()=>({defaultValue:0,sync:!0})),hoveredValue:t(()=>({defaultValue:null,isEqual:Nr})),view:t(()=>({defaultValue:e("defaultView"),value:e("view"),onChange(r){var i;(i=e("onViewChange"))==null||i({view:r})}})),startValue:t(()=>{let r=e("focusedValue")||e("defaultFocusedValue");return{defaultValue:Lv(r,"start",{months:e("numOfMonths")},e("locale")),isEqual:Nr,hash:i=>i.toString()}}),currentPlacement:t(()=>({defaultValue:void 0})),restoreFocus:t(()=>({defaultValue:!1}))}},computed:{isInteractive:({prop:e})=>!e("disabled")&&!e("readOnly"),visibleDuration:({prop:e})=>({months:e("numOfMonths")}),endValue:({context:e,computed:t})=>uy(e.get("startValue"),t("visibleDuration")),visibleRange:({context:e,computed:t})=>({start:e.get("startValue"),end:t("endValue")}),visibleRangeText:({context:e,prop:t,computed:n})=>Ix({view:e.get("view"),startValue:e.get("startValue"),endValue:n("endValue"),locale:t("locale"),timeZone:t("timeZone"),selectionMode:t("selectionMode")}),isPrevVisibleRangeValid:({context:e,prop:t})=>!LA(e.get("startValue"),t("min"),t("max")),isNextVisibleRangeValid:({prop:e,computed:t})=>!DA(t("endValue"),e("min"),e("max")),valueAsString:({context:e,prop:t})=>zl(e.get("value"),t)},effects:["setupLiveRegion"],watch({track:e,prop:t,context:n,action:r,computed:i}){e([()=>t("locale")],()=>{r(["setStartValue","syncInputElement"])}),e([()=>n.hash("focusedValue")],()=>{r(["setStartValue","focusActiveCellIfNeeded","setHoveredValueIfKeyboard"])}),e([()=>n.hash("startValue")],()=>{r(["syncMonthSelectElement","syncYearSelectElement","invokeOnVisibleRangeChange"])}),e([()=>n.get("inputValue")],()=>{r(["syncInputValue"])}),e([()=>n.hash("value")],()=>{r(["syncInputElement"])}),e([()=>i("valueAsString").toString()],()=>{r(["announceValueText"])}),e([()=>n.get("view")],()=>{r(["focusActiveCell"])}),e([()=>t("open")],()=>{r(["toggleVisibility"])})},on:{"VALUE.SET":{actions:["setDateValue","setFocusedDate"]},"VIEW.SET":{actions:["setView"]},"FOCUS.SET":{actions:["setFocusedDate"]},"VALUE.CLEAR":{actions:["clearDateValue","clearFocusedDate","focusFirstInputElement"]},"INPUT.CHANGE":[{guard:"isInputValueEmpty",actions:["setInputValue","clearDateValue","clearFocusedDate"]},{actions:["setInputValue","focusParsedDate"]}],"INPUT.ENTER":{actions:["focusParsedDate","selectFocusedDate"]},"INPUT.FOCUS":{actions:["setActiveIndex"]},"INPUT.BLUR":[{guard:"shouldFixOnBlur",actions:["setActiveIndexToStart","selectParsedDate"]},{actions:["setActiveIndexToStart"]}],"PRESET.CLICK":[{guard:"isOpenControlled",actions:["setDateValue","setFocusedDate","invokeOnClose"]},{target:"focused",actions:["setDateValue","setFocusedDate","focusInputElement"]}],"GOTO.NEXT":[{guard:"isYearView",actions:["focusNextDecade","announceVisibleRange"]},{guard:"isMonthView",actions:["focusNextYear","announceVisibleRange"]},{actions:["focusNextPage"]}],"GOTO.PREV":[{guard:"isYearView",actions:["focusPreviousDecade","announceVisibleRange"]},{guard:"isMonthView",actions:["focusPreviousYear","announceVisibleRange"]},{actions:["focusPreviousPage"]}]},states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["focusFirstSelectedDate","focusActiveCell"]},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}]}},focused:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["focusFirstSelectedDate","focusActiveCell"]},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}]}},open:{tags:["open"],effects:["trackDismissableElement","trackPositioning"],exit:["clearHoveredDate","resetView"],on:{"CONTROLLED.CLOSE":[{guard:Pt("shouldRestoreFocus","isInteractOutsideEvent"),target:"focused",actions:["focusTriggerElement"]},{guard:"shouldRestoreFocus",target:"focused",actions:["focusInputElement"]},{target:"idle"}],"CELL.CLICK":[{guard:"isAboveMinView",actions:["setFocusedValueForView","setPreviousView"]},{guard:Pt("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","resetSelection","setActiveIndexToEnd"]},{guard:Pt("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","setRestoreFocus"]},{guard:Pt("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","focusInputElement"]},{guard:Pt("isRangePicker","isSelectingEndDate"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setFocusedDate","setSelectedDate","setActiveIndexToEnd"]},{guard:Pt("isMultiPicker","canSelectDate"),actions:["setFocusedDate","toggleSelectedDate"]},{guard:"isMultiPicker",actions:["setFocusedDate"]},{guard:Pt("closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["setFocusedDate","setSelectedDate","invokeOnClose","focusInputElement"]},{actions:["setFocusedDate","setSelectedDate"]}],"CELL.POINTER_MOVE":{guard:Pt("isRangePicker","isSelectingEndDate"),actions:["setHoveredDate","setFocusedDate"]},"TABLE.POINTER_LEAVE":{guard:"isRangePicker",actions:["clearHoveredDate"]},"TABLE.POINTER_DOWN":{actions:["disableTextSelection"]},"TABLE.POINTER_UP":{actions:["enableTextSelection"]},"TABLE.ESCAPE":[{guard:"isOpenControlled",actions:["focusFirstSelectedDate","invokeOnClose"]},{target:"focused",actions:["focusFirstSelectedDate","invokeOnClose","focusTriggerElement"]}],"TABLE.ENTER":[{guard:"isAboveMinView",actions:["setPreviousView"]},{guard:Pt("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","clearDateValue","setSelectedDate","setActiveIndexToEnd"]},{guard:Pt("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose"]},{guard:Pt("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","focusInputElement"]},{guard:Pt("isRangePicker","isSelectingEndDate"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setSelectedDate","setActiveIndexToEnd","focusNextDay"]},{guard:Pt("isMultiPicker","canSelectDate"),actions:["toggleSelectedDate"]},{guard:"isMultiPicker"},{guard:Pt("closeOnSelect","isOpenControlled"),actions:["selectFocusedDate","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectFocusedDate","invokeOnClose","focusInputElement"]},{actions:["selectFocusedDate"]}],"TABLE.ARROW_RIGHT":[{guard:"isMonthView",actions:["focusNextMonth"]},{guard:"isYearView",actions:["focusNextYear"]},{actions:["focusNextDay","setHoveredDate"]}],"TABLE.ARROW_LEFT":[{guard:"isMonthView",actions:["focusPreviousMonth"]},{guard:"isYearView",actions:["focusPreviousYear"]},{actions:["focusPreviousDay"]}],"TABLE.ARROW_UP":[{guard:"isMonthView",actions:["focusPreviousMonthColumn"]},{guard:"isYearView",actions:["focusPreviousYearColumn"]},{actions:["focusPreviousWeek"]}],"TABLE.ARROW_DOWN":[{guard:"isMonthView",actions:["focusNextMonthColumn"]},{guard:"isYearView",actions:["focusNextYearColumn"]},{actions:["focusNextWeek"]}],"TABLE.PAGE_UP":{actions:["focusPreviousSection"]},"TABLE.PAGE_DOWN":{actions:["focusNextSection"]},"TABLE.HOME":[{guard:"isMonthView",actions:["focusFirstMonth"]},{guard:"isYearView",actions:["focusFirstYear"]},{actions:["focusSectionStart"]}],"TABLE.END":[{guard:"isMonthView",actions:["focusLastMonth"]},{guard:"isYearView",actions:["focusLastYear"]},{actions:["focusSectionEnd"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose"]}],"VIEW.TOGGLE":{actions:["setNextView"]},INTERACT_OUTSIDE:[{guard:"isOpenControlled",actions:["setActiveIndexToStart","invokeOnClose"]},{guard:"shouldRestoreFocus",target:"focused",actions:["setActiveIndexToStart","invokeOnClose","focusTriggerElement"]},{target:"idle",actions:["setActiveIndexToStart","invokeOnClose"]}],CLOSE:[{guard:"isOpenControlled",actions:["setActiveIndexToStart","invokeOnClose"]},{target:"idle",actions:["setActiveIndexToStart","invokeOnClose"]}]}}},implementations:{guards:{isAboveMinView:({context:e,prop:t})=>vx(e.get("view"),t("minView")),isDayView:({context:e,event:t})=>(t.view||e.get("view"))==="day",isMonthView:({context:e,event:t})=>(t.view||e.get("view"))==="month",isYearView:({context:e,event:t})=>(t.view||e.get("view"))==="year",isRangePicker:({prop:e})=>e("selectionMode")==="range",hasSelectedRange:({context:e})=>e.get("value").length===2,isMultiPicker:({prop:e})=>e("selectionMode")==="multiple",canSelectDate:({context:e,prop:t,event:n})=>{var s;let r=t("maxSelectedDates");if(r==null)return!0;let i=e.get("value"),a=(s=n.value)!=null?s:e.get("focusedValue");return i.some(l=>Nr(l,a))?!0:i.length!!e.get("restoreFocus"),isSelectingEndDate:({context:e})=>e.get("activeIndex")===1,closeOnSelect:({prop:e})=>!!e("closeOnSelect"),isOpenControlled:({prop:e})=>e("open")!=null||!!e("inline"),isInteractOutsideEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="INTERACT_OUTSIDE"},isInputValueEmpty:({event:e})=>e.value.trim()==="",shouldFixOnBlur:({event:e})=>!!e.fixOnBlur},effects:{trackPositioning({context:e,prop:t,scope:n}){if(t("inline"))return;e.get("currentPlacement")||e.set("currentPlacement",t("positioning").placement);let r=Cy(n);return Xe(r,()=>dx(n),y(h({},t("positioning")),{defer:!0,onComplete(a){e.set("currentPlacement",a.placement)}}))},setupLiveRegion({scope:e,refs:t}){let n=e.getDoc();return t.set("announcer",Qi({level:"assertive",document:n})),()=>{var r,i;return(i=(r=t.get("announcer"))==null?void 0:r.destroy)==null?void 0:i.call(r)}},trackDismissableElement({scope:e,send:t,context:n,prop:r}){return r("inline")?void 0:qt(()=>Xl(e),{type:"popover",defer:!0,exclude:[...To(e),Wl(e),cx(e)],onInteractOutside(a){n.set("restoreFocus",!a.detail.focusable)},onDismiss(){t({type:"INTERACT_OUTSIDE"})},onEscapeKeyDown(a){a.preventDefault(),t({type:"TABLE.ESCAPE",src:"dismissable"})}})}},actions:{setNextView({context:e,prop:t}){let n=bx(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setPreviousView({context:e,prop:t}){let n=Ex(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setView({context:e,event:t}){e.set("view",t.view)},setRestoreFocus({context:e}){e.set("restoreFocus",!0)},announceValueText({context:e,prop:t,refs:n}){var s;let r=e.get("value"),i=t("locale"),a=t("timeZone"),o;if(t("selectionMode")==="range"){let[l,c]=r;l&&c?o=ql(l,c,i,a):l?o=ql(l,null,i,a):c?o=ql(c,null,i,a):o=""}else o=r.map(l=>ql(l,null,i,a)).filter(Boolean).join(",");(s=n.get("announcer"))==null||s.announce(o,3e3)},announceVisibleRange({computed:e,refs:t}){var r;let{formatted:n}=e("visibleRangeText");(r=t.get("announcer"))==null||r.announce(n)},disableTextSelection({scope:e}){Za({target:Xl(e),doc:e.getDoc()})},enableTextSelection({scope:e}){ud({doc:e.getDoc(),target:Xl(e)})},focusFirstSelectedDate(e){let{context:t}=e;t.get("value").length&&Re(e,t.get("value")[0])},syncInputElement({scope:e,computed:t}){B(()=>{To(e).forEach((r,i)=>{_e(r,t("valueAsString")[i]||"")})})},setFocusedDate(e){let{event:t}=e,n=Array.isArray(t.value)?t.value[0]:t.value;Re(e,n)},setFocusedValueForView(e){let{context:t,event:n}=e;Re(e,t.get("focusedValue").set({[t.get("view")]:n.value}))},focusNextMonth(e){let{context:t}=e;Re(e,t.get("focusedValue").add({months:1}))},focusPreviousMonth(e){let{context:t}=e;Re(e,t.get("focusedValue").subtract({months:1}))},setDateValue({context:e,event:t,prop:n}){if(!Array.isArray(t.value))return;let r=t.value.map(i=>jt(i,n("min"),n("max")));e.set("value",r)},clearDateValue({context:e}){e.set("value",[])},setSelectedDate(e){var s;let{context:t,event:n}=e,r=Array.from(t.get("value")),i=t.get("activeIndex"),a=r[i],o=Zl(e,(s=n.value)!=null?s:t.get("focusedValue"));r[i]=ku(a,o),t.set("value",$u(r))},resetSelection(e){var a;let{context:t,event:n}=e,r=t.get("value")[0],i=Zl(e,(a=n.value)!=null?a:t.get("focusedValue"));t.set("value",[ku(r,i)])},toggleSelectedDate(e){var o;let{context:t,event:n}=e,r=Zl(e,(o=n.value)!=null?o:t.get("focusedValue")),i=t.get("value"),a=i.findIndex(s=>Nr(s,r));if(a===-1){let s=[...i,r];t.set("value",Kl(s))}else{let s=Array.from(i);s.splice(a,1),t.set("value",Kl(s))}},setHoveredDate({context:e,event:t}){e.set("hoveredValue",t.value)},clearHoveredDate({context:e}){e.set("hoveredValue",null)},selectFocusedDate({context:e,computed:t}){let n=Array.from(e.get("value")),r=e.get("activeIndex"),i=n[r],a=e.get("focusedValue").copy();n[r]=ku(i,a),e.set("value",$u(n));let o=t("valueAsString");e.set("inputValue",o[r])},focusPreviousDay(e){let{context:t}=e,n=t.get("focusedValue").subtract({days:1});Re(e,n)},focusNextDay(e){let{context:t}=e,n=t.get("focusedValue").add({days:1});Re(e,n)},focusPreviousWeek(e){let{context:t}=e,n=t.get("focusedValue").subtract({weeks:1});Re(e,n)},focusNextWeek(e){let{context:t}=e,n=t.get("focusedValue").add({weeks:1});Re(e,n)},focusNextPage(e){let{context:t,computed:n,prop:r}=e,i=vy(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),r("locale"),r("min"),r("max"));jl(e,i)},focusPreviousPage(e){let{context:t,computed:n,prop:r}=e,i=yy(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),r("locale"),r("min"),r("max"));jl(e,i)},focusSectionStart(e){let{context:t}=e;Re(e,t.get("startValue").copy())},focusSectionEnd(e){let{computed:t}=e;Re(e,t("endValue").copy())},focusNextSection(e){let{context:t,event:n,computed:r,prop:i}=e,a=jA(t.get("focusedValue"),t.get("startValue"),n.larger,r("visibleDuration"),i("locale"),i("min"),i("max"));a&&jl(e,a)},focusPreviousSection(e){let{context:t,event:n,computed:r,prop:i}=e,a=YA(t.get("focusedValue"),t.get("startValue"),n.larger,r("visibleDuration"),i("locale"),i("min"),i("max"));a&&jl(e,a)},focusNextYear(e){let{context:t}=e,n=t.get("focusedValue").add({years:1});Re(e,n)},focusPreviousYear(e){let{context:t}=e,n=t.get("focusedValue").subtract({years:1});Re(e,n)},focusNextDecade(e){let{context:t}=e,n=t.get("focusedValue").add({years:10});Re(e,n)},focusPreviousDecade(e){let{context:t}=e,n=t.get("focusedValue").subtract({years:10});Re(e,n)},clearFocusedDate(e){let{context:t,prop:n}=e,r=t.get("focusedValue").calendar;Re(e,Co(n("timeZone"),r))},focusPreviousMonthColumn(e){let{context:t,event:n}=e,r=t.get("focusedValue").subtract({months:n.columns});Re(e,r)},focusNextMonthColumn(e){let{context:t,event:n}=e,r=t.get("focusedValue").add({months:n.columns});Re(e,r)},focusPreviousYearColumn(e){let{context:t,event:n}=e,r=t.get("focusedValue").subtract({years:n.columns});Re(e,r)},focusNextYearColumn(e){let{context:t,event:n}=e,r=t.get("focusedValue").add({years:n.columns});Re(e,r)},focusFirstMonth(e){var i,a,o;let{context:t}=e,n=t.get("focusedValue"),r=(o=(a=(i=n.calendar).getMinimumMonthInYear)==null?void 0:a.call(i,n))!=null?o:1;Re(e,n.set({month:r}))},focusLastMonth(e){let{context:t}=e,n=t.get("focusedValue"),r=n.calendar.getMonthsInYear(n);Re(e,n.set({month:r}))},focusFirstYear(e){let{context:t}=e,n=fa(t.get("focusedValue").year),r=t.get("focusedValue").set({year:n[0]});Re(e,r)},focusLastYear(e){let{context:t}=e,n=fa(t.get("focusedValue").year),r=t.get("focusedValue").set({year:n[n.length-1]});Re(e,r)},setActiveIndex({context:e,event:t}){e.set("activeIndex",t.index)},setActiveIndexToEnd({context:e}){e.set("activeIndex",1)},setActiveIndexToStart({context:e}){e.set("activeIndex",0)},focusActiveCell({scope:e,context:t,event:n}){n.src!=="input.click"&&B(()=>{var i;let r=t.get("view");(i=Bv(e,r))==null||i.focus({preventScroll:!0})})},focusActiveCellIfNeeded({scope:e,context:t,event:n}){n.focus&&B(()=>{var i;let r=t.get("view");(i=Bv(e,r))==null||i.focus({preventScroll:!0})})},setHoveredValueIfKeyboard({context:e,event:t,prop:n}){!t.type.startsWith("TABLE.ARROW")||n("selectionMode")!=="range"||e.get("activeIndex")===0||e.set("hoveredValue",e.get("focusedValue").copy())},focusTriggerElement({scope:e}){B(()=>{var t;(t=Wl(e))==null||t.focus({preventScroll:!0})})},focusFirstInputElement({scope:e,event:t}){t.focus!==!1&&B(()=>{let[n]=To(e),r=n!=null?n:Wl(e);r==null||r.focus({preventScroll:!0})})},focusInputElement({scope:e}){B(()=>{var a;let t=To(e);if(t.length===0){(a=Wl(e))==null||a.focus({preventScroll:!0});return}let n=t.findLastIndex(o=>o.value!==""),r=Math.max(n,0),i=t[r];i==null||i.focus({preventScroll:!0}),i==null||i.setSelectionRange(i.value.length,i.value.length)})},syncMonthSelectElement({scope:e,context:t}){let n=lx(e);_e(n,t.get("startValue").month.toString())},syncYearSelectElement({scope:e,context:t}){let n=sx(e);_e(n,t.get("startValue").year.toString())},setInputValue({context:e,event:t}){e.get("activeIndex")===t.index&&e.set("inputValue",t.value)},syncInputValue({scope:e,context:t,event:n}){queueMicrotask(()=>{var a;let r=To(e),i=(a=n.index)!=null?a:t.get("activeIndex");_e(r[i],t.get("inputValue"))})},focusParsedDate(e){let{event:t,prop:n}=e;if(t.index==null)return;let i=n("parse")(t.value,{locale:n("locale"),timeZone:n("timeZone")});!i||!Gv(i)||Re(e,i)},selectParsedDate({context:e,event:t,prop:n}){if(t.index==null)return;let i=n("parse")(t.value,{locale:n("locale"),timeZone:n("timeZone")});if((!i||!Gv(i))&&t.value&&(i=e.get("focusedValue").copy()),!i)return;i=jt(i,n("min"),n("max"));let a=Array.from(e.get("value"));a[t.index]=i,e.set("value",a);let o=zl(a,n);e.set("inputValue",o[t.index])},resetView({context:e}){e.set("view",e.initial("view"))},setStartValue({context:e,computed:t,prop:n}){let r=e.get("focusedValue");if(!An(r,e.get("startValue"),t("endValue")))return;let a=Lv(r,"start",{months:n("numOfMonths")},n("locale"));e.set("startValue",a)},invokeOnOpen({prop:e,context:t}){var n;e("inline")||(n=e("onOpenChange"))==null||n({open:!0,value:t.get("value")})},invokeOnClose({prop:e,context:t}){var n;e("inline")||(n=e("onOpenChange"))==null||n({open:!1,value:t.get("value")})},invokeOnVisibleRangeChange({prop:e,context:t,computed:n}){var r;(r=e("onVisibleRangeChange"))==null||r({view:t.get("view"),visibleRange:n("visibleRange")})},toggleVisibility({event:e,send:t,prop:n}){t({type:n("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:e})}}}}),Zl=(e,t)=>{let{context:n,prop:r}=e,i=n.get("view"),a=typeof t=="number"?n.get("focusedValue").set({[i]:t}):t;return Sx(o=>{yx(o,r("minView"))&&(a=a.set({[o]:o==="day"?1:0}))}),a},ku=(e,t)=>{if(!e||!("hour"in e))return t;let n="timeZone"in e,r=t;return"hour"in t||(n?r=ty(Xt(t),e.timeZone):r=Xt(t)),r.set({hour:e.hour,minute:e.minute,second:e.second,millisecond:e.millisecond})};Nu=(e,t,n,r)=>e==="year"?r!=null?r:"":e==="month"?n!=null?n:"":t!=null?t:"",Ox=(e,t)=>e.split("__N__").join(String(t));xx=class extends X{constructor(){super(...arguments);Q(this,"getDayView",()=>this.el.querySelector('[data-part="day-view"]'));Q(this,"getMonthView",()=>this.el.querySelector('[data-part="month-view"]'));Q(this,"getYearView",()=>this.el.querySelector('[data-part="year-view"]'));Q(this,"renderDayTableHeader",()=>{let t=this.getDayView(),n=t==null?void 0:t.querySelector("thead");if(!n||!this.api.weekDays)return;let r=n.querySelector("tr");(!r||r.children.length!==this.api.weekDays.length)&&(r=this.doc.createElement("tr"),n.replaceChildren(r),this.api.weekDays.forEach(()=>{let i=this.doc.createElement("th");i.scope="col",r.appendChild(i)})),this.spreadProps(r,this.api.getTableRowProps({view:"day"})),this.api.weekDays.forEach((i,a)=>{let o=r.children[a];o.setAttribute("aria-label",i.long),o.textContent!==i.narrow&&(o.textContent=i.narrow)})});Q(this,"renderDayTableBody",()=>{let t=this.getDayView(),n=t==null?void 0:t.querySelector("tbody");if(!n)return;if(this.spreadProps(n,this.api.getTableBodyProps({view:"day"})),!this.api.weeks){n.replaceChildren();return}let r=this.api.weeks;this.trimTableRows(n,r.length),r.forEach((i,a)=>{let o=this.ensureTableRow(n,a);this.spreadProps(o,this.api.getTableRowProps({view:"day"})),this.trimTableCells(o,i.length),i.forEach((s,l)=>{let c=`${s.year}-${s.month}-${s.day}`,{td:d,trigger:u}=this.ensureTableCell(o,l,c);this.spreadProps(d,this.api.getDayTableCellProps({value:s})),this.spreadProps(u,this.api.getDayTableCellTriggerProps({value:s}));let p=String(s.day);u.textContent!==p&&(u.textContent=p)})})});Q(this,"renderMonthTableBody",()=>{let t=this.getMonthView(),n=t==null?void 0:t.querySelector("tbody");if(!n)return;this.spreadProps(n,this.api.getTableBodyProps({view:"month"}));let r=this.api.getMonthsGrid({columns:4,format:"short"});this.trimTableRows(n,r.length),r.forEach((i,a)=>{let o=this.ensureTableRow(n,a);this.spreadProps(o,this.api.getTableRowProps()),this.trimTableCells(o,i.length),i.forEach((s,l)=>{let c=`${this.api.visibleRange.start.year}-${s.value}`,{td:d,trigger:u}=this.ensureTableCell(o,l,c);this.spreadProps(d,this.api.getMonthTableCellProps(y(h({},s),{columns:4}))),this.spreadProps(u,this.api.getMonthTableCellTriggerProps(y(h({},s),{columns:4}))),u.textContent!==s.label&&(u.textContent=s.label)})})});Q(this,"renderYearTableBody",()=>{let t=this.getYearView(),n=t==null?void 0:t.querySelector("tbody");if(!n)return;this.spreadProps(n,this.api.getTableBodyProps());let r=this.api.getYearsGrid({columns:4});this.trimTableRows(n,r.length),r.forEach((i,a)=>{let o=this.ensureTableRow(n,a);this.spreadProps(o,this.api.getTableRowProps({view:"year"})),this.trimTableCells(o,i.length),i.forEach((s,l)=>{let c=String(s.value),{td:d,trigger:u}=this.ensureTableCell(o,l,c);this.spreadProps(d,this.api.getYearTableCellProps(y(h({},s),{columns:4}))),this.spreadProps(u,this.api.getYearTableCellTriggerProps(y(h({},s),{columns:4}))),u.textContent!==s.label&&(u.textContent=s.label)})})})}initMachine(t){return new Y(wx,t)}initApi(){return this.zagConnect(Tx)}ensureTableRow(t,n){var i;let r=t.children[n];if(!r||r.tagName!=="TR"){r=this.doc.createElement("tr");let a=(i=t.children[n])!=null?i:null;t.insertBefore(r,a)}return r}ensureTableCell(t,n,r){var o;let i=t.children[n];if(i&&(i.tagName!=="TD"||i.dataset.dateCell!==r)&&(i.remove(),i=void 0),!i){i=this.doc.createElement("td"),i.dataset.dateCell=r;let s=this.doc.createElement("div");i.appendChild(s);let l=(o=t.children[n])!=null?o:null;t.insertBefore(i,l)}let a=i.querySelector("div");return{td:i,trigger:a}}trimTableRows(t,n){var r;for(;t.children.length>n;)(r=t.lastElementChild)==null||r.remove()}trimTableCells(t,n){var r;for(;t.children.length>n;)(r=t.lastElementChild)==null||r.remove()}render(){let t=this.el.querySelector('[data-scope="date-picker"][data-part="root"]');t&&this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="date-picker"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps());let r=this.el.querySelector('[data-scope="date-picker"][data-part="control"]');r&&this.spreadProps(r,this.api.getControlProps());let i=Array.from(this.el.querySelectorAll('[data-scope="date-picker"][data-part="input"]')),a=this.api.selectionMode;for(let c=0;c0){let c=i[0],d=()=>{let u=this.api.valueAsString,g=(Array.isArray(u)?u:u==null||u===""?[]:[String(u)]).filter(Boolean).join(", ");c.value!==g&&(c.value=g)};d(),queueMicrotask(()=>{requestAnimationFrame(d)})}Ax(this.el,i,this.api.selectionMode);let o=this.el.querySelector('[data-scope="date-picker"][data-part="trigger"]');o&&this.spreadProps(o,this.api.getTriggerProps());let s=this.el.querySelector('[data-scope="date-picker"][data-part="positioner"]');s&&this.spreadProps(s,this.api.getPositionerProps());let l=this.el.querySelector('[data-scope="date-picker"][data-part="content"]');if(l&&this.spreadProps(l,this.api.getContentProps()),this.api.open){let c=this.getDayView(),d=this.getMonthView(),u=this.getYearView();if(c&&(c.hidden=this.api.view!=="day"),d&&(d.hidden=this.api.view!=="month"),u&&(u.hidden=this.api.view!=="year"),this.api.view==="day"&&c){let p=c.querySelector('[data-part="view-control"]');p&&this.spreadProps(p,this.api.getViewControlProps({view:"year"}));let g=c.querySelector('[data-part="prev-trigger"]');g&&this.spreadProps(g,this.api.getPrevTriggerProps());let f=c.querySelector('[data-part="view-trigger"]');f&&(this.spreadProps(f,this.api.getViewTriggerProps()),f.textContent=this.api.visibleRangeText.start);let m=c.querySelector('[data-part="next-trigger"]');m&&this.spreadProps(m,this.api.getNextTriggerProps());let S=c.querySelector("table");S&&this.spreadProps(S,this.api.getTableProps({view:"day"}));let T=c.querySelector("thead");T&&this.spreadProps(T,this.api.getTableHeaderProps({view:"day"})),this.renderDayTableHeader(),this.renderDayTableBody()}else if(this.api.view==="month"&&d){let p=d.querySelector('[data-part="view-control"]');p&&this.spreadProps(p,this.api.getViewControlProps({view:"month"}));let g=d.querySelector('[data-part="prev-trigger"]');g&&this.spreadProps(g,this.api.getPrevTriggerProps({view:"month"}));let f=d.querySelector('[data-part="view-trigger"]');f&&(this.spreadProps(f,this.api.getViewTriggerProps({view:"month"})),f.textContent=String(this.api.visibleRange.start.year));let m=d.querySelector('[data-part="next-trigger"]');m&&this.spreadProps(m,this.api.getNextTriggerProps({view:"month"}));let S=d.querySelector("table");S&&this.spreadProps(S,this.api.getTableProps({view:"month",columns:4})),this.renderMonthTableBody()}else if(this.api.view==="year"&&u){let p=u.querySelector('[data-part="view-control"]');p&&this.spreadProps(p,this.api.getViewControlProps({view:"year"}));let g=u.querySelector('[data-part="prev-trigger"]');g&&this.spreadProps(g,this.api.getPrevTriggerProps({view:"year"}));let f=u.querySelector('[data-part="decade"]');if(f){let T=this.api.getDecade();f.textContent=`${T.start} - ${T.end}`}let m=u.querySelector('[data-part="next-trigger"]');m&&this.spreadProps(m,this.api.getNextTriggerProps({view:"year"}));let S=u.querySelector("table");S&&this.spreadProps(S,this.api.getTableProps({view:"year",columns:4})),this.renderYearTableBody()}}}};Nx={mounted(){let e=this.el,t=this;t.allowFormNotify=!1;let n=this.pushEvent.bind(this),r=this.liveSocket,i=()=>j(this.liveSocket),a=V(e,"min"),o=V(e,"max"),s=d=>d?d.map(u=>zt(u)):void 0,l=d=>d?zt(d):void 0,c=new xx(e,y(h(y(h({id:e.id},(()=>{let d=hn(e);return"value"in d?{value:s(d.value)}:{defaultValue:s(d.defaultValue)}})()),{defaultFocusedValue:l(V(e,"focusedValue")),defaultView:V(e,"defaultView"),dir:V(e,"dir"),locale:V(e,"locale"),timeZone:V(e,"timeZone"),disabled:O(e,"disabled"),readOnly:O(e,"readonly"),required:O(e,"required"),invalid:O(e,"invalid"),outsideDaySelectable:O(e,"outsideDaySelectable"),closeOnSelect:Gu(e),min:a?zt(a):void 0,max:o?zt(o):void 0,startOfWeek:U(e,"startOfWeek"),fixedWeeks:O(e,"fixedWeeks"),selectionMode:V(e,"selectionMode"),maxSelectedDates:U(e,"maxSelectedDates"),placeholder:V(e,"placeholder"),minView:V(e,"minView"),maxView:V(e,"maxView"),defaultOpen:!1,inline:O(e,"inline"),positioning:qe(e)}),Uv(e)),{onValueChange:d=>{let u=ec(d.value),p=V(e,"submitName");if(p)sn(e,u,{scope:"date-picker",submitName:p,notifyLiveView:t.allowFormNotify===!0});else{let g=u.length>0?u.join(","):"";Jl(e,g,t.allowFormNotify===!0)}W({el:e,canPushServer:i(),pushEvent:n,payload:{id:e.id,value:u.length>0?u.join(","):null},serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})},onFocusChange:d=>{var p;let u=V(e,"onFocusChange");u&&r.main.isConnected()&&n(u,{id:e.id,focused:(p=d.focused)!=null?p:!1})},onViewChange:d=>{let u=V(e,"onViewChange");u&&r.main.isConnected()&&n(u,{id:e.id,view:d.view})},onVisibleRangeChange:d=>{let u=V(e,"onVisibleRangeChange");u&&r.main.isConnected()&&n(u,{id:e.id,start:d.start,end:d.end})},onOpenChange:d=>{W({el:e,canPushServer:i(),pushEvent:n,payload:{id:e.id,open:d.open},serverEventName:V(e,"onOpenChange"),clientEventName:V(e,"onOpenChangeClient")})}}));c.init(),this.datePicker=c,queueMicrotask(()=>{let d=V(e,"submitName"),u=Bu(c,Hu(e,c.api.value));d?sn(e,u,{scope:"date-picker",submitName:d,notifyLiveView:!1}):Jl(e,u.length>0?u.join(","):"",!1),t.allowFormNotify=!0}),this.handlers=[],this.handlers.push(this.handleEvent("date_picker_set_value",d=>{let u=d.date_picker_id;u&&u!==e.id||c.api.setValue([zt(d.value)])})),this.onSetValue=d=>{var p;let u=(p=d.detail)==null?void 0:p.value;typeof u=="string"&&c.api.setValue([zt(u)])},e.addEventListener("corex:date-picker:set-value",this.onSetValue)},updated(){let e=this.el,t=this.datePicker,n=V(e,"min"),r=V(e,"max"),i=qn(e),a="value"in i?{value:i.value.map(o=>zt(o))}:{};t==null||t.updateProps(h(y(h({},a),{dir:V(e,"dir"),locale:V(e,"locale"),timeZone:V(e,"timeZone"),disabled:O(e,"disabled"),readOnly:O(e,"readonly"),required:O(e,"required"),invalid:O(e,"invalid"),outsideDaySelectable:O(e,"outsideDaySelectable"),closeOnSelect:Gu(e),min:n?zt(n):void 0,max:r?zt(r):void 0,startOfWeek:U(e,"startOfWeek"),fixedWeeks:O(e,"fixedWeeks"),selectionMode:V(e,"selectionMode"),maxSelectedDates:U(e,"maxSelectedDates"),placeholder:V(e,"placeholder"),minView:V(e,"minView"),maxView:V(e,"maxView"),inline:O(e,"inline"),positioning:qe(e)}),Uv(e))),V(e,"submitName")||queueMicrotask(()=>{let o="value"in i?i.value:null,s=Hu(e,t==null?void 0:t.api.value,o);t&&(s=Bu(t,s)),Jl(e,s.join(","),!1)})},destroyed(){var e;if(this.onSetValue&&this.el.removeEventListener("corex:date-picker:set-value",this.onSetValue),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.datePicker)==null||e.destroy()}}});var Gy={};pe(Gy,{Dialog:()=>uR,readDialogLayoutProps:()=>oc});function Hx(e,t){let{state:n,send:r,context:i,prop:a,scope:o}=e,s=a("aria-label"),l=n.matches("open"),c=i.get("triggerValue");return{open:l,setOpen(d){n.matches("open")!==d&&r({type:d?"OPEN":"CLOSE"})},triggerValue:c,setTriggerValue(d){r({type:"TRIGGER_VALUE.SET",value:d})},getTriggerProps(d={}){let{value:u}=d,p=u==null?!1:c===u;return t.button(y(h({},fi.trigger.attrs),{dir:a("dir"),id:My(o,u),"data-ownedby":o.id,"data-value":u,"aria-haspopup":"dialog",type:"button","aria-expanded":u==null?l:l&&p,"data-state":l?"open":"closed","aria-controls":ig(o),"data-current":b(p),onClick(g){if(g.defaultPrevented)return;let f=l&&u!=null&&!p;r({type:f?"TRIGGER_VALUE.SET":"TOGGLE",value:u})}}))},getBackdropProps(){return t.element(y(h({},fi.backdrop.attrs),{dir:a("dir"),hidden:!l,id:Fy(o),"data-state":l?"open":"closed"}))},getPositionerProps(){return t.element(y(h({},fi.positioner.attrs),{dir:a("dir"),id:Dy(o),style:_n({pointerEvents:!l||!a("modal")?"none":void 0})}))},getContentProps(){let d=i.get("rendered");return t.element(y(h({},fi.content.attrs),{dir:a("dir"),role:a("role"),hidden:!l,id:ig(o),tabIndex:-1,"data-state":l?"open":"closed","aria-modal":a("modal"),"aria-label":s||void 0,"aria-labelledby":s||!d.title?void 0:ag(o),"aria-describedby":d.description?og(o):void 0,style:_n({pointerEvents:a("modal")?void 0:"auto"})}))},getTitleProps(){return t.element(y(h({},fi.title.attrs),{dir:a("dir"),id:ag(o)}))},getDescriptionProps(){return t.element(y(h({},fi.description.attrs),{dir:a("dir"),id:og(o)}))},getCloseTriggerProps(){return t.button(y(h({},fi.closeTrigger.attrs),{dir:a("dir"),id:_y(o),type:"button",onClick(d){d.defaultPrevented||(d.stopPropagation(),r({type:"CLOSE"}))}}))}}}function jx(e,t={}){let{defer:n=!0}=t,r=n?zx:a=>a(),i=[];return i.push(r(()=>{let o=(typeof e=="function"?e():e).filter(Boolean);o.length!==0&&i.push(Kx(o))})),()=>{i.forEach(a=>a==null?void 0:a())}}function rR(e,t={}){let n,r=B(()=>{let a=(Array.isArray(e)?e:[e]).map(s=>typeof s=="function"?s():s).filter(s=>s!=null);if(a.length===0)return;let o=a[0];n=new Jx(a,y(h({escapeDeactivates:!1,allowOutsideClick:!0,preventScroll:!0,returnFocusOnDeactivate:!0,delayInitialFocus:!1,fallbackFocus:o},t),{document:Ue(o)}));try{n.activate()}catch(s){}});return function(){n==null||n.deactivate(),r()}}function iR(e){let t=e.getBoundingClientRect().left;return Math.round(t)+e.scrollLeft?"paddingLeft":"paddingRight"}function Ny(e){let t=pt(e),n=t==null?void 0:t.scrollbarGutter;return n==="stable"||(n==null?void 0:n.startsWith("stable "))===!0}function aR(e){var g;let t=e!=null?e:document,n=(g=t.defaultView)!=null?g:window,{documentElement:r,body:i}=t;if(i.hasAttribute(rg))return;let o=Ny(r)||Ny(i),s=n.innerWidth-r.clientWidth;i.setAttribute(rg,"");let l=()=>Th(r,"--scrollbar-width",`${s}px`),c=iR(r),d=()=>{let f={overflow:"hidden"};return!o&&s>0&&(f[c]=`${s}px`),Xr(i,f)},u=()=>{var v,E;let{scrollX:f,scrollY:m,visualViewport:S}=n,T=(v=S==null?void 0:S.offsetLeft)!=null?v:0,w=(E=S==null?void 0:S.offsetTop)!=null?E:0,I={position:"fixed",overflow:"hidden",top:`${-(m-Math.floor(w))}px`,left:`${-(f-Math.floor(T))}px`,right:"0"};!o&&s>0&&(I[c]=`${s}px`);let P=Xr(i,I);return()=>{P==null||P(),n.scrollTo({left:f,top:m,behavior:"instant"})}},p=[l(),Ka()?u():d()];return()=>{p.forEach(f=>f==null?void 0:f()),i.removeAttribute(rg)}}function Hy(e){var r,i;let t=e.querySelector('[data-scope="dialog"][data-part="title"]');if((r=t==null?void 0:t.textContent)!=null&&r.trim())return;let n=(i=V(e,"dialogDefaultLabel"))==null?void 0:i.trim();return n||"Dialog"}function sR(e,t){var i,a;let n=e.querySelector('[data-scope="dialog"][data-part="title"]');if((i=n==null?void 0:n.textContent)!=null&&i.trim())t.removeAttribute("aria-label");else{t.removeAttribute("aria-labelledby");let o=Hy(e);o?t.setAttribute("aria-label",o):t.removeAttribute("aria-label")}let r=e.querySelector('[data-scope="dialog"][data-part="description"]');(a=r==null?void 0:r.textContent)!=null&&a.trim()||t.removeAttribute("aria-describedby")}function Ly(e,t){if(!t)return null;let n=e.querySelector(`#${CSS.escape(t)}`);if(n)return n;let r=document.getElementById(t);return r&&e.contains(r)?r:null}function oc(e){var i;let t=(i=V(e,"role",["dialog","alertdialog"]))!=null?i:"dialog",n=V(e,"initialFocus"),r=V(e,"finalFocus");return{id:e.id,role:t,modal:O(e,"modal"),closeOnInteractOutside:O(e,"closeOnInteractOutside"),closeOnEscape:O(e,"closeOnEscapeKeyDown"),preventScroll:O(e,"preventScroll"),restoreFocus:O(e,"restoreFocus"),dir:q(e),initialFocusEl:n?()=>Ly(e,n):void 0,finalFocusEl:r?()=>Ly(e,r):void 0}}function By(e,t){let n=vd(e),r=n.blockInteraction?e:void 0,i=e.querySelector('[data-scope="dialog"][data-part="backdrop"]'),a=e.querySelector('[data-scope="dialog"][data-part="content"]');i&&bd(i,t,n,r),a&&bd(a,t,n,r)}function dR(e,t){Vt(e)&&By(e,t)}var Lx,fi,Dy,Fy,ig,My,ag,og,_y,Ao,Dx,Fx,Mx,_x,$x,sg,xy,ya,ic,ac,tg,$y,Bx,Gx,Ux,qx,Wx,Kx,zx,Yx,Xx,Le,Ry,Zx,Jx,lg,ng,Qx,eR,xo,tR,ky,nR,rg,oR,lR,cR,uR,Uy=ee(()=>{"use strict";_s();Or();on();$e();Ve();be();oe();Lx=z("dialog").parts("trigger","backdrop","positioner","content","title","description","closeTrigger"),fi=Lx.build(),Dy=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`dialog:${e.id}:positioner`},Fy=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.backdrop)!=null?n:`dialog:${e.id}:backdrop`},ig=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`dialog:${e.id}:content`},My=(e,t)=>{var r;let n=(r=e.ids)==null?void 0:r.trigger;return n!=null?Qe(n)?n(t):n:t?`dialog:${e.id}:trigger:${t}`:`dialog:${e.id}:trigger`},ag=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.title)!=null?n:`dialog:${e.id}:title`},og=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.description)!=null?n:`dialog:${e.id}:description`},_y=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.closeTrigger)!=null?n:`dialog:${e.id}:close`},Ao=e=>e.getById(ig(e)),Dx=e=>e.getById(Dy(e)),Fx=e=>e.getById(Fy(e)),Mx=e=>e.getById(ag(e)),_x=e=>e.getById(og(e)),$x=e=>e.getById(_y(e)),sg=e=>Oe(e.getDoc(),`[data-scope="dialog"][data-part="trigger"][data-ownedby="${e.id}"]`),xy=(e,t)=>t==null?sg(e)[0]:e.getById(My(e,t));ya=new WeakMap,ic=new WeakMap,ac={},tg=0,$y=e=>e&&(e.host||$y(e.parentNode)),Bx=(e,t)=>t.map(n=>{if(e.contains(n))return n;let r=$y(n);return r&&e.contains(r)?r:(console.error("[zag-js > ariaHidden] target",n,"in not contained inside",e,". Doing nothing"),null)}).filter(n=>!!n),Gx=new Set(["script","output","status","next-route-announcer"]),Ux=e=>Gx.has(e.localName)||e.role==="status"||e.hasAttribute("aria-live")?!0:e.matches("[data-live-announcer]"),qx=(e,t)=>{let{parentNode:n,markerName:r,controlAttribute:i,explicitBooleanValue:a,followControlledElements:o=!0}=t,s=Bx(n,Array.isArray(e)?e:[e]);ac[r]||(ac[r]=new WeakMap);let l=ac[r],c=[],d=new Set,u=new Set(s),p=f=>{!f||d.has(f)||(d.add(f),p(f.parentNode))};s.forEach(f=>{p(f),o&&Pe(f)&&id(f,m=>{p(m)})});let g=f=>{!f||u.has(f)||Array.prototype.forEach.call(f.children,m=>{if(d.has(m))g(m);else try{if(Ux(m))return;let S=m.getAttribute(i),T=a?S==="true":S!==null&&S!=="false",w=(ya.get(m)||0)+1,I=(l.get(m)||0)+1;ya.set(m,w),l.set(m,I),c.push(m),w===1&&T&&ic.set(m,!0),I===1&&m.setAttribute(r,""),T||m.setAttribute(i,a?"true":"")}catch(S){console.error("[zag-js > ariaHidden] cannot operate on ",m,S)}})};return g(n),d.clear(),tg++,()=>{c.forEach(f=>{let m=ya.get(f)-1,S=l.get(f)-1;ya.set(f,m),l.set(f,S),m||(ic.has(f)||f.removeAttribute(i),ic.delete(f)),S||f.removeAttribute(r)}),tg--,tg||(ya=new WeakMap,ya=new WeakMap,ic=new WeakMap,ac={})}},Wx=e=>(Array.isArray(e)?e[0]:e).ownerDocument.body,Kx=(e,t=Wx(e),n="data-aria-hidden",r=!0)=>{if(t)return qx(e,{parentNode:t,markerName:n,controlAttribute:"aria-hidden",explicitBooleanValue:!0,followControlledElements:r})},zx=e=>{let t=requestAnimationFrame(()=>e());return()=>cancelAnimationFrame(t)};Yx=Object.defineProperty,Xx=(e,t,n)=>t in e?Yx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Le=(e,t,n)=>Xx(e,typeof t!="symbol"?t+"":t,n),Ry={activateTrap(e,t){if(e.length>0){let r=e[e.length-1];r!==t&&r.pause()}let n=e.indexOf(t);n===-1||e.splice(n,1),e.push(t)},deactivateTrap(e,t){let n=e.indexOf(t);n!==-1&&e.splice(n,1),e.length>0&&e[e.length-1].unpause()}},Zx=[],Jx=class{constructor(e,t){Le(this,"trapStack"),Le(this,"config"),Le(this,"doc"),Le(this,"state",{containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0}),Le(this,"portalContainers",new Set),Le(this,"listenerCleanups",[]),Le(this,"handleFocus",r=>{let i=ne(r),a=this.findContainerIndex(i,r)>=0;if(a||Wa(i))a&&(this.state.mostRecentlyFocusedNode=i);else{r.stopImmediatePropagation();let o,s=!0;if(this.state.mostRecentlyFocusedNode)if(Gi(this.state.mostRecentlyFocusedNode)>0){let l=this.findContainerIndex(this.state.mostRecentlyFocusedNode),{tabbableNodes:c}=this.state.containerGroups[l];if(c.length>0){let d=c.findIndex(u=>u===this.state.mostRecentlyFocusedNode);d>=0&&(this.config.isKeyForward(this.state.recentNavEvent)?d+1=0&&(o=c[d-1],s=!1))}}else this.state.containerGroups.some(l=>l.tabbableNodes.some(c=>Gi(c)>0))||(s=!1);else s=!1;s&&(o=this.findNextNavNode({target:this.state.mostRecentlyFocusedNode,isBackward:this.config.isKeyBackward(this.state.recentNavEvent)})),o?this.tryFocus(o):this.tryFocus(this.state.mostRecentlyFocusedNode||this.getInitialFocusNode())}this.state.recentNavEvent=void 0}),Le(this,"handlePointerDown",r=>{let i=ne(r);if(!(this.findContainerIndex(i,r)>=0)){if(xo(this.config.clickOutsideDeactivates,r)){this.deactivate({returnFocus:this.config.returnFocusOnDeactivate});return}xo(this.config.allowOutsideClick,r)||r.preventDefault()}}),Le(this,"handleClick",r=>{let i=ne(r);this.findContainerIndex(i,r)>=0||xo(this.config.clickOutsideDeactivates,r)||xo(this.config.allowOutsideClick,r)||(r.preventDefault(),r.stopImmediatePropagation())}),Le(this,"handleTabKey",r=>{if(this.config.isKeyForward(r)||this.config.isKeyBackward(r)){this.state.recentNavEvent=r;let i=this.config.isKeyBackward(r),a=this.findNextNavNode({event:r,isBackward:i});if(!a)return;ng(r)&&r.preventDefault(),this.tryFocus(a)}}),Le(this,"handleEscapeKey",r=>{tR(r)&&xo(this.config.escapeDeactivates,r)!==!1&&(r.preventDefault(),this.deactivate())}),Le(this,"_mutationObserver"),Le(this,"setupMutationObserver",()=>{let r=this.doc.defaultView||window;this._mutationObserver=new r.MutationObserver(i=>{i.some(s=>Array.from(s.removedNodes).some(c=>c===this.state.mostRecentlyFocusedNode))&&this.tryFocus(this.getInitialFocusNode()),i.some(s=>s.type==="attributes"&&(s.attributeName==="aria-controls"||s.attributeName==="aria-expanded")?!0:s.type==="childList"&&s.addedNodes.length>0?Array.from(s.addedNodes).some(l=>{if(l.nodeType!==Node.ELEMENT_NODE)return!1;let c=l;return lh(c)?!0:c.id&&!this.state.containers.some(d=>d.contains(c))?ch(c):!1}):!1)&&this.state.active&&!this.state.paused&&(this.updateTabbableNodes(),this.updatePortalContainers())})}),Le(this,"updateObservedNodes",()=>{var r;(r=this._mutationObserver)==null||r.disconnect(),this.state.active&&!this.state.paused&&(this.state.containers.map(i=>{var a;(a=this._mutationObserver)==null||a.observe(i,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["aria-controls","aria-expanded"]})}),this.portalContainers.forEach(i=>{this.observePortalContainer(i)}))}),Le(this,"getInitialFocusNode",()=>{let r=this.getNodeForOption("initialFocus",{hasFallback:!0});if(r===!1)return!1;if(r===void 0||r&&!ut(r)){let i=gr(this.doc);if(i&&this.findContainerIndex(i)>=0)r=i;else{let a=this.state.tabbableGroups[0];r=a&&a.firstTabbableNode||this.getNodeForOption("fallbackFocus")}}else r===null&&(r=this.getNodeForOption("fallbackFocus"));if(!r)throw new Error("Your focus-trap needs to have at least one focusable element");if(r.isConnected||(r=this.getNodeForOption("fallbackFocus")),!r||!r.isConnected)throw new Error("Your focus-trap needs to have at least one focusable element");return r}),Le(this,"tryFocus",r=>{if(r!==!1&&r!==gr(this.doc)){if(!r||!r.focus){this.tryFocus(this.getInitialFocusNode());return}r.focus({preventScroll:!!this.config.preventScroll}),this.state.mostRecentlyFocusedNode=r,nR(r)&&r.select()}}),Le(this,"deactivate",r=>{if(!this.state.active)return this;let i=h({onDeactivate:this.config.onDeactivate,onPostDeactivate:this.config.onPostDeactivate,checkCanReturnFocus:this.config.checkCanReturnFocus},r);clearTimeout(this.state.delayInitialFocusTimer),this.state.delayInitialFocusTimer=void 0,this.removeListeners(),this.state.active=!1,this.state.paused=!1,this.updateObservedNodes(),Ry.deactivateTrap(this.trapStack,this),this.portalContainers.clear();let a=this.getOption(i,"onDeactivate"),o=this.getOption(i,"onPostDeactivate"),s=this.getOption(i,"checkCanReturnFocus"),l=this.getOption(i,"returnFocus","returnFocusOnDeactivate");a==null||a();let c=()=>{ky(()=>{if(l){let d=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);this.tryFocus(d)}o==null||o()})};if(l&&s){let d=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);return s(d).then(c,c),this}return c(),this}),Le(this,"pause",r=>{if(this.state.paused||!this.state.active)return this;let i=this.getOption(r,"onPause"),a=this.getOption(r,"onPostPause");return this.state.paused=!0,i==null||i(),this.removeListeners(),this.updateObservedNodes(),a==null||a(),this}),Le(this,"unpause",r=>{if(!this.state.paused||!this.state.active)return this;let i=this.getOption(r,"onUnpause"),a=this.getOption(r,"onPostUnpause");return this.state.paused=!1,i==null||i(),this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),a==null||a(),this}),Le(this,"updateContainerElements",r=>(this.state.containers=Array.isArray(r)?r.filter(Boolean):[r].filter(Boolean),this.state.active&&this.updateTabbableNodes(),this.updateObservedNodes(),this)),Le(this,"getReturnFocusNode",r=>{let i=this.getNodeForOption("setReturnFocus",{params:[r]});return i||(i===!1?!1:r)}),Le(this,"getOption",(r,i,a)=>r&&r[i]!==void 0?r[i]:this.config[a||i]),Le(this,"getNodeForOption",(r,{hasFallback:i=!1,params:a=[]}={})=>{let o=this.config[r];if(typeof o=="function"&&(o=o(...a)),o===!0&&(o=void 0),!o){if(o===void 0||o===!1)return o;throw new Error(`\`${r}\` was specified but was not a node, or did not return a node`)}let s=o;if(typeof o=="string"){try{s=this.doc.querySelector(o)}catch(l){throw new Error(`\`${r}\` appears to be an invalid selector; error="${l.message}"`)}if(!s&&!i)throw new Error(`\`${r}\` as selector refers to no known node`)}return s}),Le(this,"findNextNavNode",r=>{let{event:i,isBackward:a=!1}=r,o=r.target||ne(i);this.updateTabbableNodes();let s=null;if(this.state.tabbableGroups.length>0){let l=this.findContainerIndex(o,i),c=l>=0?this.state.containerGroups[l]:void 0;if(l<0)a?s=this.state.tabbableGroups[this.state.tabbableGroups.length-1].lastTabbableNode:s=this.state.tabbableGroups[0].firstTabbableNode;else if(a){let d=this.state.tabbableGroups.findIndex(({firstTabbableNode:u})=>o===u);if(d<0&&((c==null?void 0:c.container)===o||ut(o)&&!lr(o)&&!(c!=null&&c.nextTabbableNode(o,!1)))&&(d=l),d>=0){let u=d===0?this.state.tabbableGroups.length-1:d-1,p=this.state.tabbableGroups[u];s=Gi(o)>=0?p.lastTabbableNode:p.lastDomTabbableNode}else ng(i)||(s=c==null?void 0:c.nextTabbableNode(o,!1))}else{let d=this.state.tabbableGroups.findIndex(({lastTabbableNode:u})=>o===u);if(d<0&&((c==null?void 0:c.container)===o||ut(o)&&!lr(o)&&!(c!=null&&c.nextTabbableNode(o)))&&(d=l),d>=0){let u=d===this.state.tabbableGroups.length-1?0:d+1,p=this.state.tabbableGroups[u];s=Gi(o)>=0?p.firstTabbableNode:p.firstDomTabbableNode}else ng(i)||(s=c==null?void 0:c.nextTabbableNode(o))}}else s=this.getNodeForOption("fallbackFocus");return s}),this.trapStack=t.trapStack||Zx;let n=h({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,followControlledElements:!0,isKeyForward:Qx,isKeyBackward:eR},t);this.doc=n.document||Ue(Array.isArray(e)?e[0]:e),this.config=n,this.updateContainerElements(e),this.setupMutationObserver()}addPortalContainer(e){let t=e.parentElement;t&&!this.portalContainers.has(t)&&(this.portalContainers.add(t),this.state.active&&!this.state.paused&&this.observePortalContainer(t))}observePortalContainer(e){var t;(t=this._mutationObserver)==null||t.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["aria-controls","aria-expanded"]})}updatePortalContainers(){this.config.followControlledElements&&this.state.containers.forEach(e=>{sh(e).forEach(n=>{this.addPortalContainer(n)})})}get active(){return this.state.active}get paused(){return this.state.paused}findContainerIndex(e,t){let n=typeof(t==null?void 0:t.composedPath)=="function"?t.composedPath():void 0;return this.state.containerGroups.findIndex(({container:r,tabbableNodes:i})=>r.contains(e)||(n==null?void 0:n.includes(r))||i.find(a=>a===e)||this.isControlledElement(r,e))}isControlledElement(e,t){return this.config.followControlledElements?Vs(e,t):!1}updateTabbableNodes(){if(this.state.containerGroups=this.state.containers.map(e=>{let t=Bn(e,{getShadowRoot:this.config.getShadowRoot}),n=Ya(e,{getShadowRoot:this.config.getShadowRoot}),r=t[0],i=t[t.length-1],a=r,o=i,s=!1;for(let c=0;c0){s=!0;break}function l(c,d=!0){let u=t.indexOf(c);if(u>=0)return t[u+(d?1:-1)];let p=n.indexOf(c);if(!(p<0)){if(d){for(let g=p+1;g=0;g--)if(lr(n[g]))return n[g]}}return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:s,firstTabbableNode:r,lastTabbableNode:i,firstDomTabbableNode:a,lastDomTabbableNode:o,nextTabbableNode:l}}),this.state.tabbableGroups=this.state.containerGroups.filter(e=>e.tabbableNodes.length>0),this.state.tabbableGroups.length<=0&&!this.getNodeForOption("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(this.state.containerGroups.find(e=>e.posTabIndexesFound)&&this.state.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")}addListeners(){if(this.state.active)return Ry.activateTrap(this.trapStack,this),this.state.delayInitialFocusTimer=this.config.delayInitialFocus?ky(()=>{this.tryFocus(this.getInitialFocusNode())}):this.tryFocus(this.getInitialFocusNode()),this.listenerCleanups.push(ae(this.doc,"focusin",this.handleFocus,!0),ae(this.doc,"mousedown",this.handlePointerDown,{capture:!0,passive:!1}),ae(this.doc,"touchstart",this.handlePointerDown,{capture:!0,passive:!1}),ae(this.doc,"click",this.handleClick,{capture:!0,passive:!1}),ae(this.doc,"keydown",this.handleTabKey,{capture:!0,passive:!1}),ae(this.doc,"keydown",this.handleEscapeKey)),this}removeListeners(){if(this.state.active)return this.listenerCleanups.forEach(e=>e()),this.listenerCleanups=[],this}activate(e){if(this.state.active)return this;let t=this.getOption(e,"onActivate"),n=this.getOption(e,"onPostActivate"),r=this.getOption(e,"checkCanFocusTrap");r||this.updateTabbableNodes(),this.state.active=!0,this.state.paused=!1,this.state.nodeFocusedBeforeActivation=gr(this.doc),t==null||t();let i=()=>{r&&this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),n==null||n()};return r?(r(this.state.containers.concat()).then(i,i),this):(i(),this)}},lg=e=>(e==null?void 0:e.type)==="keydown",ng=e=>lg(e)&&(e==null?void 0:e.key)==="Tab",Qx=e=>lg(e)&&e.key==="Tab"&&!(e!=null&&e.shiftKey),eR=e=>lg(e)&&e.key==="Tab"&&(e==null?void 0:e.shiftKey),xo=(e,...t)=>typeof e=="function"?e(...t):e,tR=e=>!e.isComposing&&e.key==="Escape",ky=e=>setTimeout(e,0),nR=e=>e.localName==="input"&&"select"in e&&typeof e.select=="function";rg="data-scroll-lock";oR=te({props({props:e,scope:t}){let n=e.role==="alertdialog",r=n?()=>$x(t):void 0,i=typeof e.modal=="boolean"?e.modal:!0;return h({role:"dialog",modal:i,trapFocus:i,preventScroll:i,closeOnInteractOutside:i&&!n,closeOnEscape:!0,restoreFocus:!0,initialFocusEl:r},e)},initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"closed"},context({bindable:e,prop:t,scope:n}){return{rendered:e(()=>({defaultValue:{title:!0,description:!0}})),triggerValue:e(()=>{var r;return{defaultValue:(r=t("defaultTriggerValue"))!=null?r:null,value:t("triggerValue"),onChange(i){let a=t("onTriggerValueChange");if(!a)return;let o=xy(n,i);a({value:i,triggerElement:o})}}})}},watch({track:e,action:t,prop:n}){e([()=>n("open")],()=>{t(["toggleVisibility"])})},states:{open:{entry:["checkRenderedElements","syncZIndex","setInitialFocus"],effects:["trackDismissableElement","trapFocus","preventScroll","hideContentBelow"],on:{"CONTROLLED.CLOSE":{target:"closed"},CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],"TRIGGER_VALUE.SET":{actions:["setTriggerValue"]}}},closed:{on:{"CONTROLLED.OPEN":{target:"open"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen","setTriggerValue"]},{target:"open",actions:["invokeOnOpen","setTriggerValue"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnOpen","setTriggerValue"]},{target:"open",actions:["invokeOnOpen","setTriggerValue"]}],"TRIGGER_VALUE.SET":{actions:["setTriggerValue"]}}}},implementations:{guards:{isOpenControlled:({prop:e})=>e("open")!=null},effects:{trackDismissableElement({scope:e,send:t,prop:n}){return qt(()=>Ao(e),{type:"dialog",defer:!0,pointerBlocking:n("modal"),exclude:sg(e),onInteractOutside(i){var a;(a=n("onInteractOutside"))==null||a(i),n("closeOnInteractOutside")||i.preventDefault()},persistentElements:n("persistentElements"),onFocusOutside:n("onFocusOutside"),onPointerDownOutside:n("onPointerDownOutside"),onRequestDismiss:n("onRequestDismiss"),onEscapeKeyDown(i){var a;(a=n("onEscapeKeyDown"))==null||a(i),n("closeOnEscape")||i.preventDefault()},onDismiss(){t({type:"CLOSE",src:"interact-outside"})}})},preventScroll({scope:e,prop:t}){if(t("preventScroll"))return aR(e.getDoc())},trapFocus({scope:e,prop:t,context:n}){return t("trapFocus")?rR(()=>Ao(e),{preventScroll:!0,returnFocusOnDeactivate:!!t("restoreFocus"),initialFocus:t("initialFocusEl"),setReturnFocus:i=>{var l;let a=(l=t("finalFocusEl"))==null?void 0:l();if(a)return a;let o=n.get("triggerValue");if(o){let c=xy(e,o);if(c)return c}let s=sg(e)[0];return s||i},getShadowRoot:!0}):void 0},hideContentBelow({scope:e,prop:t}){return t("modal")?jx(()=>[Ao(e)],{defer:!0}):void 0}},actions:{setInitialFocus({prop:e,scope:t}){e("trapFocus")||B(()=>{let n=hr({root:Ao(t),getInitialEl:e("initialFocusEl")});n==null||n.focus({preventScroll:!0})})},checkRenderedElements({context:e,scope:t}){B(()=>{e.set("rendered",{title:!!Mx(t),description:!!_x(t)})})},syncZIndex({scope:e}){B(()=>{let t=Ao(e);if(!t)return;let n=pt(t);[Dx(e),Fx(e)].forEach(i=>{i==null||i.style.setProperty("--z-index",n.zIndex),i==null||i.style.setProperty("--layer-index",n.getPropertyValue("--layer-index"))})})},invokeOnClose({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!1})},invokeOnOpen({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!0})},setTriggerValue({context:e,event:t}){t.value!==void 0&&e.set("triggerValue",t.value)},toggleVisibility({prop:e,send:t,event:n}){t({type:e("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:n})}}}});lR=class extends X{initMachine(e){return new Y(oR,e)}initApi(){return this.zagConnect(Hx)}render(){var c;let e=this.el,t=(c=e.dataset.animation)!=null?c:"instant",n=e.querySelector('[data-scope="dialog"][data-part="trigger"]');n&&this.spreadProps(n,this.api.getTriggerProps());let r=e.querySelector('[data-scope="dialog"][data-part="backdrop"]');if(r){let d=this.api.getBackdropProps();t==="instant"?this.spreadProps(r,d):(t==="js"||t==="custom")&&(this.spreadProps(r,Zr(d)),r.removeAttribute("hidden"))}let i=e.querySelector('[data-scope="dialog"][data-part="positioner"]');i&&this.spreadProps(i,this.api.getPositionerProps());let a=e.querySelector('[data-scope="dialog"][data-part="content"]');if(a){let d=this.api.getContentProps();t==="instant"?this.spreadProps(a,d):(t==="js"||t==="custom")&&(this.spreadProps(a,Zr(d)),a.removeAttribute("hidden"),this.api.open||a.style.removeProperty("pointer-events")),sR(e,a)}let o=e.querySelector('[data-scope="dialog"][data-part="title"]');o&&this.spreadProps(o,this.api.getTitleProps());let s=e.querySelector('[data-scope="dialog"][data-part="description"]');s&&this.spreadProps(s,this.api.getDescriptionProps());let l=e.querySelector('[data-scope="dialog"][data-part="close-trigger"]');l&&this.spreadProps(l,this.api.getCloseTriggerProps())}};cR='[data-scope="dialog"][data-part="backdrop"], [data-scope="dialog"][data-part="content"]';uR={mounted(){let e=this.el,t=this,n=this.pushEvent.bind(this),r=()=>j(this.liveSocket);t.lastOpen=Pd(e,"open","defaultOpen");let i=new lR(e,y(h(h({},oc(e)),zs(e,"open","defaultOpen")),{"aria-label":Hy(e),onOpenChange:s=>{var u;let l=O(e,"controlled"),c=l?Pd(e,"open","defaultOpen"):(u=t.lastOpen)!=null?u:!1;l||(t.lastOpen=s.open);let d={id:e.id,open:s.open,previousOpen:c};W({el:e,canPushServer:r(),pushEvent:n,payload:d,serverEventName:V(e,"onOpenChange"),clientEventName:V(e,"onOpenChangeClient")}),Vt(e)&&!O(e,"controlled")&&By(e,s.open)}}));i.init(),this.dialog=i,Lh(e,cR,s=>{if(s.dataset.part==="backdrop")return{scale:!1}});let a=ie(e);this.domRegistry=a,a.add("corex:dialog:set-open",s=>{let{open:l}=s.detail;i.api.setOpen(l)});let o=re(this);this.handleRegistry=o,o.add("dialog_set_open",s=>{if(!s||typeof s!="object")return;let l=s;$(e.id,H(s))&&typeof l.open=="boolean"&&i.api.setOpen(l.open)}),o.add("dialog_open",s=>{$(e.id,H(s))&&r()&&this.pushEvent("dialog_open_response",{id:e.id,value:i.api.open})})},beforeUpdate(){let{el:e}=this;O(e,"controlled")&&Vt(e)&&(this.previousOpen=O(e,"open"))},updated(){var i,a,o,s,l;let{el:e}=this,t=oc(e);if(!O(e,"controlled")){(i=this.dialog)==null||i.updateProps(t);return}let n=(a=O(e,"open"))!=null?a:!1,r=(s=(o=this.previousOpen)!=null?o:this.lastOpen)!=null?s:!1;this.previousOpen=void 0,this.lastOpen=n,(l=this.dialog)==null||l.updateProps(y(h({},t),{open:n})),n!==r&&dR(e,n)},destroyed(){var e,t,n,r;(e=this.dialog)==null||e.updateProps(h(h({},oc(this.el)),Bs(this.el,"open","defaultOpen"))),(t=this.domRegistry)==null||t.teardown(),(n=this.handleRegistry)==null||n.teardown(),(r=this.dialog)==null||r.destroy()}}});var Xy={};pe(Xy,{Editable:()=>wR,dataDefaultValue:()=>TR});function PR(e,t){var v;let{state:n,context:r,send:i,prop:a,scope:o,computed:s}=e,l=!!a("disabled"),c=s("isInteractive"),d=!!a("readOnly"),u=!!a("required"),p=!!a("invalid"),g=!!a("autoResize"),f=a("translations"),m=n.matches("edit"),S=a("placeholder"),T=typeof S=="string"?{edit:S,preview:S}:S,w=r.get("value"),I=w.trim()==="",P=I?(v=T==null?void 0:T.preview)!=null?v:"":w;return{editing:m,empty:I,value:w,valueText:P,setValue(E){i({type:"VALUE.SET",value:E,src:"setValue"})},clearValue(){i({type:"VALUE.SET",value:"",src:"clearValue"})},edit(){c&&i({type:"EDIT"})},cancel(){c&&i({type:"CANCEL"})},submit(){c&&i({type:"SUBMIT"})},getRootProps(){return t.element(y(h({},nr.root.attrs),{id:pR(o),dir:a("dir")}))},getAreaProps(){return t.element(y(h({},nr.area.attrs),{id:hR(o),dir:a("dir"),style:g?{display:"inline-grid"}:void 0,"data-focus":b(m),"data-disabled":b(l),"data-placeholder-shown":b(I)}))},getLabelProps(){return t.label(y(h({},nr.label.attrs),{id:fR(o),dir:a("dir"),htmlFor:cg(o),"data-focus":b(m),"data-invalid":b(p),"data-required":b(u),onClick(){if(m)return;let E=vR(o);E==null||E.focus({preventScroll:!0})}}))},getInputProps(){return t.input(y(h({},nr.input.attrs),{dir:a("dir"),"aria-label":f==null?void 0:f.input,name:a("name"),form:a("form"),id:cg(o),hidden:g?void 0:!m,placeholder:T==null?void 0:T.edit,maxLength:a("maxLength"),required:a("required"),disabled:l,"data-disabled":b(l),readOnly:d,"data-readonly":b(d),"aria-invalid":se(p),"data-invalid":b(p),"data-autoresize":b(g),defaultValue:w,size:g?1:void 0,onChange(E){i({type:"VALUE.SET",src:"input.change",value:E.currentTarget.value})},onKeyDown(E){if(E.defaultPrevented||Me(E))return;let x={Escape(){i({type:"CANCEL"}),E.preventDefault()},Enter(C){if(!s("submitOnEnter"))return;let{localName:A}=C.currentTarget;if(A==="textarea"){if(!(za()?C.metaKey:C.ctrlKey))return;i({type:"SUBMIT",src:"keydown.enter"});return}A==="input"&&!C.shiftKey&&!C.metaKey&&(i({type:"SUBMIT",src:"keydown.enter"}),C.preventDefault())}}[E.key];x&&x(E)},style:g?{gridArea:"1 / 1 / auto / auto",visibility:m?void 0:"hidden"}:void 0}))},getPreviewProps(){return t.element(y(h({id:Ky(o)},nr.preview.attrs),{dir:a("dir"),"data-placeholder-shown":b(I),"aria-readonly":se(d),"data-readonly":b(l),"data-disabled":b(l),"aria-disabled":se(l),"aria-invalid":se(p),"data-invalid":b(p),"aria-label":f==null?void 0:f.edit,"data-autoresize":b(g),children:P,hidden:g?void 0:m,tabIndex:c?0:void 0,onClick(){c&&a("activationMode")==="click"&&i({type:"EDIT",src:"click"})},onFocus(){c&&a("activationMode")==="focus"&&i({type:"EDIT",src:"focus"})},onDoubleClick(E){E.defaultPrevented||c&&a("activationMode")==="dblclick"&&i({type:"EDIT",src:"dblclick"})},style:g?{whiteSpace:"pre",gridArea:"1 / 1 / auto / auto",visibility:m?"hidden":void 0,overflow:"hidden",textOverflow:"ellipsis"}:void 0}))},getEditTriggerProps(){return t.button(y(h({},nr.editTrigger.attrs),{id:Yy(o),dir:a("dir"),"aria-label":f==null?void 0:f.edit,hidden:m,type:"button",disabled:l,onClick(E){E.defaultPrevented||c&&i({type:"EDIT",src:"edit.click"})}}))},getControlProps(){return t.element(y(h({id:mR(o)},nr.control.attrs),{dir:a("dir")}))},getSubmitTriggerProps(){return t.button(y(h({},nr.submitTrigger.attrs),{dir:a("dir"),id:zy(o),"aria-label":f==null?void 0:f.submit,hidden:!m,disabled:l,type:"button",onClick(E){E.defaultPrevented||c&&i({type:"SUBMIT",src:"submit.click"})}}))},getCancelTriggerProps(){return t.button(y(h({},nr.cancelTrigger.attrs),{dir:a("dir"),"aria-label":f==null?void 0:f.cancel,id:jy(o),hidden:!m,type:"button",disabled:l,onClick(E){E.defaultPrevented||c&&i({type:"CANCEL",src:"cancel.click"})}}))}}}function TR(e){var t;return(t=V(e,"defaultValue"))!=null?t:""}function lc(e){return e.querySelector(`#${e.id}-value`)}function dg(e,t,n={}){let r=lc(e);if(r){yt(r,t,n);return}let i=e.querySelector('[data-scope="editable"][data-part="input"]');i&&yt(i,t,n)}function qy(e,t,n,r,i){dg(e,r,{markUsed:i.allowFormNotify===!0}),W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,value:r},serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})}function CR(e,t){let n=e.closest("form");if(!n)return()=>{};let r=()=>{var a;if(!t.api.editing)return;let i=e.querySelector('[data-scope="editable"][data-part="input"]');dg(e,(a=i==null?void 0:i.value)!=null?a:t.api.value,{markUsed:!1})};return n.addEventListener("submit",r,!0),()=>n.removeEventListener("submit",r,!0)}function Wy(e){if(!lc(e))return V(e,"name")}var gR,nr,pR,hR,fR,Ky,cg,mR,zy,jy,Yy,sc,vR,yR,bR,ER,SR,IR,wR,Zy=ee(()=>{"use strict";on();Kt();$e();Ve();be();oe();gR=z("editable").parts("root","area","label","preview","input","editTrigger","submitTrigger","cancelTrigger","control"),nr=gR.build(),pR=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`editable:${e.id}`},hR=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.area)!=null?n:`editable:${e.id}:area`},fR=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`editable:${e.id}:label`},Ky=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.preview)!=null?n:`editable:${e.id}:preview`},cg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`editable:${e.id}:input`},mR=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`editable:${e.id}:control`},zy=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.submitTrigger)!=null?n:`editable:${e.id}:submit`},jy=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.cancelTrigger)!=null?n:`editable:${e.id}:cancel`},Yy=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.editTrigger)!=null?n:`editable:${e.id}:edit`},sc=e=>e.getById(cg(e)),vR=e=>e.getById(Ky(e)),yR=e=>e.getById(zy(e)),bR=e=>e.getById(jy(e)),ER=e=>e.getById(Yy(e));SR=te({props({props:e}){return y(h({activationMode:"focus",submitMode:"both",defaultValue:"",selectOnFocus:!0},e),{translations:h({input:"editable input",edit:"edit",submit:"submit",cancel:"cancel"},e.translations)})},initialState({prop:e}){return e("edit")||e("defaultEdit")?"edit":"preview"},entry:["focusInputIfNeeded"],context:({bindable:e,prop:t})=>({value:e(()=>({defaultValue:t("defaultValue"),value:t("value"),onChange(n){var r;return(r=t("onValueChange"))==null?void 0:r({value:n})}})),previousValue:e(()=>({defaultValue:""}))}),watch({track:e,action:t,context:n,prop:r}){e([()=>n.get("value")],()=>{t(["syncInputValue"])}),e([()=>r("edit")],()=>{t(["toggleEditing"])})},computed:{submitOnEnter({prop:e}){let t=e("submitMode");return t==="both"||t==="enter"},submitOnBlur({prop:e}){let t=e("submitMode");return t==="both"||t==="blur"},isInteractive({prop:e}){return!(e("disabled")||e("readOnly"))}},on:{"VALUE.SET":{actions:["setValue"]}},states:{preview:{entry:["blurInput"],on:{"CONTROLLED.EDIT":{target:"edit",actions:["setPreviousValue","focusInput"]},EDIT:[{guard:"isEditControlled",actions:["invokeOnEdit"]},{target:"edit",actions:["setPreviousValue","focusInput","invokeOnEdit"]}]}},edit:{effects:["trackInteractOutside"],entry:["syncInputValue"],on:{"CONTROLLED.PREVIEW":[{guard:"isSubmitEvent",target:"preview",actions:["setPreviousValue","restoreFocus","invokeOnSubmit"]},{target:"preview",actions:["revertValue","restoreFocus","invokeOnCancel"]}],CANCEL:[{guard:"isEditControlled",actions:["invokeOnPreview"]},{target:"preview",actions:["revertValue","restoreFocus","invokeOnCancel","invokeOnPreview"]}],SUBMIT:[{guard:"isEditControlled",actions:["invokeOnPreview"]},{target:"preview",actions:["setPreviousValue","restoreFocus","invokeOnSubmit","invokeOnPreview"]}]}}},implementations:{guards:{isEditControlled:({prop:e})=>e("edit")!=null,isSubmitEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="SUBMIT"}},effects:{trackInteractOutside({send:e,scope:t,prop:n,computed:r}){return aa(sc(t),{exclude(i){return[bR(t),yR(t)].some(o=>ge(o,i))},onFocusOutside:n("onFocusOutside"),onPointerDownOutside:n("onPointerDownOutside"),onInteractOutside(i){var o;if((o=n("onInteractOutside"))==null||o(i),i.defaultPrevented)return;let{focusable:a}=i.detail;e({type:r("submitOnBlur")?"SUBMIT":"CANCEL",src:"interact-outside",focusable:a})}})}},actions:{restoreFocus({event:e,scope:t,prop:n}){e.focusable||B(()=>{var i,a;let r=(a=(i=n("finalFocusEl"))==null?void 0:i())!=null?a:ER(t);r==null||r.focus({preventScroll:!0})})},clearValue({context:e}){e.set("value","")},focusInputIfNeeded({action:e,prop:t}){(t("edit")||t("defaultEdit"))&&e(["focusInput"])},focusInput({scope:e,prop:t}){B(()=>{let n=sc(e);n&&(t("selectOnFocus")?n.select():n.focus({preventScroll:!0}))})},invokeOnCancel({prop:e,context:t}){var r;let n=t.get("previousValue");(r=e("onValueRevert"))==null||r({value:n})},invokeOnSubmit({prop:e,context:t}){var r;let n=t.get("value");(r=e("onValueCommit"))==null||r({value:n})},invokeOnEdit({prop:e}){var t;(t=e("onEditChange"))==null||t({edit:!0})},invokeOnPreview({prop:e}){var t;(t=e("onEditChange"))==null||t({edit:!1})},toggleEditing({prop:e,send:t,event:n}){t({type:e("edit")?"CONTROLLED.EDIT":"CONTROLLED.PREVIEW",previousEvent:n})},syncInputValue({context:e,scope:t}){let n=sc(t);n&&_e(n,e.get("value"))},setValue({context:e,prop:t,event:n}){let r=t("maxLength"),i=r!=null?n.value.slice(0,r):n.value;e.set("value",i)},setPreviousValue({context:e}){e.set("previousValue",e.get("value"))},revertValue({context:e}){let t=e.get("previousValue");t&&e.set("value",t)},blurInput({scope:e}){var t;(t=sc(e))==null||t.blur()}}}}),IR=class extends X{initMachine(e){return new Y(SR,e)}initApi(){return this.zagConnect(PR)}render(){var d;let e=(d=this.el.querySelector('[data-scope="editable"][data-part="root"]'))!=null?d:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="editable"][data-part="control"]');t&&this.spreadProps(t,this.api.getControlProps());let n=this.el.querySelector('[data-scope="editable"][data-part="area"]');n&&this.spreadProps(n,this.api.getAreaProps());let r=this.el.querySelector('[data-scope="editable"][data-part="label"]');r&&this.spreadProps(r,this.api.getLabelProps());let i=this.el.querySelector(`#${this.el.id}-value`);i&&(i.value=this.api.value,it(i,this.el));let a=this.el.querySelector('[data-scope="editable"][data-part="input"]');a&&this.spreadProps(a,this.api.getInputProps());let o=this.el.querySelector('[data-scope="editable"][data-part="preview"]');o&&this.spreadProps(o,this.api.getPreviewProps());let s=this.el.querySelector('[data-scope="editable"][data-part="edit-trigger"]');s&&this.spreadProps(s,this.api.getEditTriggerProps());let l=this.el.querySelector('[data-scope="editable"][data-part="submit-trigger"]');l&&this.spreadProps(l,this.api.getSubmitTriggerProps());let c=this.el.querySelector('[data-scope="editable"][data-part="cancel-trigger"]');c&&this.spreadProps(c,this.api.getCancelTriggerProps())}};wR={mounted(){var d,u;let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=V(e,"placeholder"),i=V(e,"activationMode"),a=O(e,"selectOnFocus");this.allowFormNotify=!1;let o=io(e,"value","defaultValue"),s=new IR(e,y(h(h(h(h(y(h({id:e.id},"value"in o?{value:(d=o.value)!=null?d:""}:{defaultValue:(u=o.defaultValue)!=null?u:""}),{disabled:O(e,"disabled"),readOnly:O(e,"readonly"),required:O(e,"required"),invalid:O(e,"invalid"),name:Wy(e),form:lc(e)?void 0:V(e,"form"),dir:q(e)}),r!==void 0?{placeholder:r}:{}),i!==void 0?{activationMode:i}:{}),a!==void 0?{selectOnFocus:a}:{}),O(e,"controlled")?{edit:O(e,"edit")}:{defaultEdit:O(e,"defaultEdit")}),{onValueChange:p=>{qy(e,t,n,p.value,this)},onValueCommit:p=>{qy(e,t,n,p.value,this)}}));s.init(),this.editable=s,queueMicrotask(()=>{dg(e,s.api.value,{markUsed:!1}),this.allowFormNotify=!0}),this.unbindFormSubmit=CR(e,s);let l=ie(e);this.domRegistry=l,l.add("corex:editable:set-value",p=>{var f;let g=(f=p.detail)==null?void 0:f.value;s.api.setValue(g==null?"":String(g))});let c=re(this);this.handleRegistry=c,c.add("editable_set_value",p=>{$(e.id,H(p))&&s.api.setValue(ao(p))})},updated(){var i,a;let e=this.el,t=br(e),n=Gh(e),r=h({id:e.id,disabled:O(e,"disabled"),readOnly:O(e,"readonly"),required:O(e,"required"),invalid:O(e,"invalid"),name:Wy(e),form:lc(e)?void 0:V(e,"form"),dir:q(e)},n);!((i=this.editable)!=null&&i.api.editing)&&"value"in t&&Object.assign(r,t),(a=this.editable)==null||a.updateProps(r)},destroyed(){var e,t,n,r;(e=this.unbindFormSubmit)==null||e.call(this),(t=this.domRegistry)==null||t.teardown(),(n=this.handleRegistry)==null||n.teardown(),(r=this.editable)==null||r.destroy()}}});var ub={};pe(ub,{FileUpload:()=>uk,fileAcceptPayload:()=>cb,fileChangePayload:()=>lb,fileRejectPayload:()=>db});function xR(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||/\w+\/[-+.\w]+/g.test(e)}function RR(e){return/^.*\.[\w]+$/.test(e)}function kR(e){if(e!=null)return typeof e=="string"?e:Array.isArray(e)?e.filter(Jy).join(","):Object.entries(e).reduce((t,[n,r])=>[...t,n,...r],[]).filter(Jy).join(",")}function NR(e,t,n){if(Ro(e.size))if(Ro(t)&&Ro(n)){if(e.size>n)return[!1,"FILE_TOO_LARGE"];if(e.sizen)return[!1,"FILE_TOO_LARGE"]}return[!0,null]}function FR(e){let t=e.split(".").pop();return t&&DR.get(t)||null}function MR(e,t){if(e&&t){let n=Array.isArray(t)?t:typeof t=="string"?t.split(","):[];if(n.length===0)return!0;let r=e.name||"",i=(e.type||FR(r)||"").toLowerCase(),a=i.replace(/\/.*$/,"");return n.some(o=>{let s=o.trim().toLowerCase();return s.charAt(0)==="."?r.toLowerCase().endsWith(s):s.endsWith("/*")?a===s.replace(/\/.*$/,""):i===s})}return!0}function _R(e,t){let n=e.type==="application/x-moz-file"||MR(e,t);return[n,n?null:"FILE_INVALID_TYPE"]}function $R(e){let t=new Map;return function(r,i){let a=r+(i?Object.entries(i).sort((s,l)=>s[0]n==="Files"||n==="application/x-moz-file"):!!t&&"files"in t}function ek(e,t,n){let{prop:r,computed:i}=e;return!i("multiple")&&t>1?!1:!i("multiple")&&t+n.length===2?!0:!(t+n.length>r("maxFiles"))}function tb(e,t,n=[],r=[]){let{prop:i,computed:a}=e,o=[],s=[],l={acceptedFiles:n,rejectedFiles:r};return t.forEach(c=>{var T;let[d,u]=_R(c,a("acceptAttr")),[p,g]=NR(c,i("minFileSize"),i("maxFileSize")),f=n.some(w=>ba(w,c))||o.some(w=>ba(w,c)),m=(T=i("validate"))==null?void 0:T(c,l),S=m?m.length===0:!0;if(d&&p&&S&&!f)o.push(c);else{let w=[u,g];f&&w.push("FILE_EXISTS"),S||w.push(...m!=null?m:[]),s.push({file:c,errors:w.filter(Boolean)})}}),ek(e,o.length,n)||(o.forEach(c=>{s.push({file:c,errors:["TOO_MANY_FILES"]})}),o.splice(0)),{acceptedFiles:o,rejectedFiles:s}}function tk(e,t){let n=ye(e);try{if("DataTransfer"in n){let r=new n.DataTransfer;t.forEach(i=>{r.items.add(i)}),e.files=r.files}}catch(r){}}function nb(e,t){if(!e||e.getAttribute("type")==="file")return!1;let n=e.closest(nk);return n!=t&&ge(t,n)}function rk(e,t){let{state:n,send:r,prop:i,computed:a,scope:o,context:s}=e,l=!!i("disabled"),c=!!i("readOnly"),d=!!i("required"),u=i("allowDrop"),p=i("translations"),g=n.matches("dragging"),f=n.matches("focused")&&!l,m=s.get("acceptedFiles"),S=i("maxFiles");return{dragging:g,focused:f,disabled:l,readOnly:c,transforming:s.get("transforming"),maxFilesReached:m.length>=S,remainingFiles:Math.max(0,S-m.length),openFilePicker(){l||c||r({type:"OPEN"})},deleteFile(T,w=Fr){l||c||r({type:"FILE.DELETE",file:T,itemType:w})},acceptedFiles:m,rejectedFiles:s.get("rejectedFiles"),setFiles(T){l||c||r({type:"FILES.SET",files:T,count:T.length})},clearRejectedFiles(){l||c||r({type:"REJECTED_FILES.CLEAR"})},clearFiles(){l||c||r({type:"FILES.CLEAR"})},getFileSize(T){return qR(T.size,i("locale"))},createFileUrl(T,w){let I=o.getWin(),P=I.URL.createObjectURL(T);return w(P),()=>I.URL.revokeObjectURL(P)},setClipboardFiles(T){var P;if(l||c)return!1;let I=Array.from((P=T==null?void 0:T.items)!=null?P:[]).reduce((v,E)=>{if(E.kind!=="file")return v;let R=E.getAsFile();return R?[...v,R]:v},[]);return I.length?(r({type:"FILE.SELECT",files:I}),!0):!1},getRootProps(){return t.element(y(h({},Zt.root.attrs),{dir:i("dir"),id:ob(o),"data-disabled":b(l),"data-readonly":b(c),"data-dragging":b(g)}))},getDropzoneProps(T={}){return t.element(y(h({},Zt.dropzone.attrs),{dir:i("dir"),id:sb(o),tabIndex:l||c||T.disableClick?void 0:0,role:T.disableClick?"application":"button","aria-label":p.dropzone,"aria-disabled":l||c||void 0,"data-invalid":b(i("invalid")),"data-disabled":b(l),"data-readonly":b(c),"data-dragging":b(g),onKeyDown(w){if(l||c||w.defaultPrevented)return;let I=ne(w);ge(w.currentTarget,I)&&(nb(I,w.currentTarget)||T.disableClick||w.key!=="Enter"&&w.key!==" "||r({type:"DROPZONE.CLICK",src:"keydown"}))},onClick(w){if(l||c||w.defaultPrevented||T.disableClick)return;let I=ne(w);ge(w.currentTarget,I)&&(nb(I,w.currentTarget)||(w.currentTarget.localName==="label"&&w.preventDefault(),r({type:"DROPZONE.CLICK"})))},onDragOver(w){if(l||c||!u)return;w.preventDefault(),w.stopPropagation();try{w.dataTransfer.dropEffect="copy"}catch(v){}if(!eb(w))return;let P=w.dataTransfer.items.length;r({type:"DROPZONE.DRAG_OVER",count:P})},onDragLeave(w){l||c||u&&(ge(w.currentTarget,w.relatedTarget)||r({type:"DROPZONE.DRAG_LEAVE"}))},onDrop(w){l||c||(u&&(w.preventDefault(),w.stopPropagation()),!eb(w))||AR(w.dataTransfer.items,i("directory")).then(P=>{r({type:"DROPZONE.DROP",files:Xc(P)})})},onFocus(){l||c||r({type:"DROPZONE.FOCUS"})},onBlur(){l||c||r({type:"DROPZONE.BLUR"})}}))},getTriggerProps(){return t.button(y(h({},Zt.trigger.attrs),{dir:i("dir"),id:WR(o),disabled:l||c,"data-disabled":b(l),"data-readonly":b(c),"data-invalid":b(i("invalid")),type:"button",onClick(T){l||c||(ge(QR(o),T.currentTarget)&&T.stopPropagation(),r({type:"OPEN"}))}}))},getHiddenInputProps(){return t.input({id:pg(o),tabIndex:-1,disabled:l||c,type:"file",required:i("required"),capture:i("capture"),name:i("name"),accept:a("acceptAttr"),webkitdirectory:i("directory")?"":void 0,multiple:a("multiple")||i("maxFiles")>1,"aria-hidden":!0,onClick(T){T.stopPropagation(),T.currentTarget.value=""},onInput(T){if(l||c)return;let{files:w}=T.currentTarget;r({type:"FILE.SELECT",files:w?Array.from(w):[]})},style:mt})},getItemGroupProps(T={}){let{type:w=Fr}=T;return t.element(y(h({},Zt.itemGroup.attrs),{dir:i("dir"),"data-disabled":b(l),"data-type":w}))},getItemProps(T){let{file:w,type:I=Fr}=T;return t.element(y(h({},Zt.item.attrs),{dir:i("dir"),id:zR(o,ko(w)),"data-disabled":b(l),"data-type":I}))},getItemNameProps(T){let{file:w,type:I=Fr}=T;return t.element(y(h({},Zt.itemName.attrs),{dir:i("dir"),id:jR(o,ko(w)),"data-disabled":b(l),"data-type":I}))},getItemSizeTextProps(T){let{file:w,type:I=Fr}=T;return t.element(y(h({},Zt.itemSizeText.attrs),{dir:i("dir"),id:YR(o,ko(w)),"data-disabled":b(l),"data-type":I}))},getItemPreviewProps(T){let{file:w,type:I=Fr}=T;return t.element(y(h({},Zt.itemPreview.attrs),{dir:i("dir"),id:XR(o,ko(w)),"data-disabled":b(l),"data-type":I}))},getItemPreviewImageProps(T){var E;let{file:w,url:I,type:P=Fr}=T;if(!w.type.startsWith("image/"))throw new Error("Preview Image is only supported for image files");return t.img(y(h({},Zt.itemPreviewImage.attrs),{alt:(E=p.itemPreview)==null?void 0:E.call(p,w),src:I,"data-disabled":b(l),"data-type":P}))},getItemDeleteTriggerProps(T){var P;let{file:w,type:I=Fr}=T;return t.button(y(h({},Zt.itemDeleteTrigger.attrs),{dir:i("dir"),id:ZR(o,ko(w)),type:"button",disabled:l||c,"data-disabled":b(l),"data-readonly":b(c),"data-type":I,"aria-label":(P=p.deleteFile)==null?void 0:P.call(p,w),onClick(){l||c||r({type:"FILE.DELETE",file:w,itemType:I})}}))},getLabelProps(){return t.label(y(h({},Zt.label.attrs),{dir:i("dir"),id:KR(o),htmlFor:pg(o),"data-disabled":b(l),"data-required":b(d)}))},getClearTriggerProps(){return t.button(y(h({},Zt.clearTrigger.attrs),{dir:i("dir"),type:"button",disabled:l||c,hidden:m.length===0,"data-disabled":b(l),"data-readonly":b(c),onClick(T){T.defaultPrevented||l||c||r({type:"FILES.CLEAR"})}}))}}}function rb(e){return String.fromCharCode(e+(e>25?39:97))}function ak(e){let t="",n;for(n=Math.abs(e);n>52;n=n/52|0)t=rb(n%52)+t;return rb(n%52)+t}function ok(e,t){let n=t.length;for(;n;)e=e*33^t.charCodeAt(--n);return e}function sk(e){return ak(ok(5381,e)>>>0)}function No(e){return sk(`${e.name}-${e.size}`)}function lk(e){return e.includes("[")?e.replace(/\[([^\]]+)\]$/,"[$1_label]"):`${e}_label`}function ck(e,t){try{if(typeof window.DataTransfer!="undefined"){let n=new window.DataTransfer;for(let r of t)n.items.add(r);e.files=n.files}}catch(n){}}function lb(e,t){var r,i;let n=t.acceptedFiles[0];return{id:e.id,acceptedCount:t.acceptedFiles.length,rejectedCount:t.rejectedFiles.length,acceptedNames:t.acceptedFiles.map(a=>a.name),firstAcceptedName:(r=n==null?void 0:n.name)!=null?r:null,firstAcceptedType:(i=n==null?void 0:n.type)!=null?i:null}}function cb(e,t){return{id:e.id,count:t.files.length}}function db(e,t){return{id:e.id,count:t.files.length}}var OR,Zt,VR,ib,ug,gg,AR,ab,Jy,ba,Ro,LR,DR,HR,GR,UR,qR,ob,sb,pg,WR,KR,zR,jR,YR,XR,ZR,ko,JR,Qy,QR,Fr,nk,ik,rr,dk,uk,gb=ee(()=>{"use strict";ai();Kt();Ve();be();oe();OR=z("file-upload").parts("root","dropzone","item","itemDeleteTrigger","itemGroup","itemName","itemPreview","itemPreviewImage","itemSizeText","label","trigger","clearTrigger"),Zt=OR.build(),VR=e=>typeof e.getAsEntry=="function"?e.getAsEntry():typeof e.webkitGetAsEntry=="function"?e.webkitGetAsEntry():null,ib=e=>e.isDirectory,ug=e=>e.isFile,gg=(e,t)=>(Object.defineProperty(e,"relativePath",{value:t?`${t}/${e.name}`:e.name}),e),AR=(e,t)=>Promise.all(Array.from(e).filter(n=>n.kind==="file").map(n=>{let r=VR(n);if(!r)return null;if(ib(r)&&t)return ab(r.createReader(),`${r.name}`);if(ug(r)&&typeof n.getAsFile=="function"){let i=n.getAsFile();return Promise.resolve(i?gg(i,""):null)}if(ug(r))return new Promise(i=>{r.file(a=>{i(gg(a,""))})})}).filter(n=>n)),ab=(e,t="")=>new Promise(n=>{let r=[],i=()=>{e.readEntries(a=>{if(a.length===0){n(Promise.all(r).then(s=>s.flat()));return}let o=a.map(s=>{if(!s)return null;if(ib(s))return ab(s.createReader(),`${t}${s.name}`);if(ug(s))return new Promise(l=>{s.file(c=>{l(gg(c,t))})})}).filter(s=>s);r.push(Promise.all(o)),i()})};i()});Jy=e=>xR(e)||RR(e);ba=(e,t)=>e.name===t.name&&e.size===t.size&&e.type===t.type,Ro=e=>e!=null;LR="3g2_video/3gpp2[3gp,3gpp_video/3gpp[3mf_model/3mf[7z_application/x-7z-compressed[aac_audio/aac[ac_application/pkix-attr-cert[adp_audio/adpcm[adts_audio/aac[ai_application/postscript[aml_application/automationml-aml+xml[amlx_application/automationml-amlx+zip[amr_audio/amr[apk_application/vnd.android.package-archive[apng_image/apng[appcache,manifest_text/cache-manifest[appinstaller_application/appinstaller[appx_application/appx[appxbundle_application/appxbundle[asc_application/pgp-keys[atom_application/atom+xml[atomcat_application/atomcat+xml[atomdeleted_application/atomdeleted+xml[atomsvc_application/atomsvc+xml[au,snd_audio/basic[avi_video/x-msvideo[avci_image/avci[avcs_image/avcs[avif_image/avif[aw_application/applixware[bdoc_application/bdoc[bin,bpk,buffer,deb,deploy,dist,distz,dll,dmg,dms,dump,elc,exe,img,iso,lrf,mar,msi,msm,msp,pkg,so_application/octet-stream[bmp,dib_image/bmp[btf,btif_image/prs.btif[bz2_application/x-bzip2[c_text/x-c[ccxml_application/ccxml+xml[cdfx_application/cdfx+xml[cdmia_application/cdmi-capability[cdmic_application/cdmi-container[cdmid_application/cdmi-domain[cdmio_application/cdmi-object[cdmiq_application/cdmi-queue[cer_application/pkix-cert[cgm_image/cgm[cjs_application/node[class_application/java-vm[coffee,litcoffee_text/coffeescript[conf,def,in,ini,list,log,text,txt_text/plain[cpp,cxx,cc_text/x-c++src[cpl_application/cpl+xml[cpt_application/mac-compactpro[crl_application/pkix-crl[css_text/css[csv_text/csv[cu_application/cu-seeme[cwl_application/cwl[cww_application/prs.cww[davmount_application/davmount+xml[dbk_application/docbook+xml[doc_application/msword[docx_application/vnd.openxmlformats-officedocument.wordprocessingml.document[dsc_text/prs.lines.tag[dssc_application/dssc+der[dtd_application/xml-dtd[dwd_application/atsc-dwd+xml[ear,jar,war_application/java-archive[ecma_application/ecmascript[emf_image/emf[eml,mime_message/rfc822[emma_application/emma+xml[emotionml_application/emotionml+xml[eot_application/vnd.ms-fontobject[eps,ps_application/postscript[epub_application/epub+zip[exi_application/exi[exp_application/express[exr_image/aces[ez_application/andrew-inset[fdf_application/fdf[fdt_application/fdt+xml[fits_image/fits[flac_audio/flac[flv_video/x-flv[g3_image/g3fax[geojson_application/geo+json[gif_image/gif[glb_model/gltf-binary[gltf_model/gltf+json[gml_application/gml+xml[go_text/x-go[gpx_application/gpx+xml[gz_application/gzip[h_text/x-h[h261_video/h261[h263_video/h263[h264_video/h264[heic_image/heic[heics_image/heic-sequence[heif_image/heif[heifs_image/heif-sequence[htm,html,shtml_text/html[ico_image/x-icon[icns_image/x-icns[ics,ifb_text/calendar[iges,igs_model/iges[ink,inkml_application/inkml+xml[ipa_application/octet-stream[java_text/x-java-source[jp2,jpg2_image/jp2[jpeg,jpe,jpg_image/jpeg[jpf,jpx_image/jpx[jpm,jpgm_image/jpm[jpgv_video/jpeg[jph_image/jph[js,mjs_text/javascript[json_application/json[json5_application/json5[jsonld_application/ld+json[jsx_text/jsx[jxl_image/jxl[jxr_image/jxr[ktx_image/ktx[ktx2_image/ktx2[less_text/less[m1v,m2v,mpe,mpeg,mpg_video/mpeg[m4a_audio/mp4[m4v_video/x-m4v[md,markdown_text/markdown[mid,midi,kar,rmi_audio/midi[mkv_video/x-matroska[mp2,mp2a,mp3,mpga,m3a,m2a_audio/mpeg[mp4,mp4v,mpg4_video/mp4[mp4a_audio/mp4[mp4s,m4p_application/mp4[odp_application/vnd.oasis.opendocument.presentation[oda_application/oda[ods_application/vnd.oasis.opendocument.spreadsheet[odt_application/vnd.oasis.opendocument.text[oga,ogg,opus,spx_audio/ogg[ogv_video/ogg[ogx_application/ogg[otf_font/otf[p12,pfx_application/x-pkcs12[pdf_application/pdf[pem_application/x-pem-file[php_text/x-php[png_image/png[ppt_application/vnd.ms-powerpoint[pptx_application/vnd.openxmlformats-officedocument.presentationml.presentation[pskcxml_application/pskc+xml[psd_image/vnd.adobe.photoshop[py_text/x-python[qt,mov_video/quicktime[rar_application/vnd.rar[rdf_application/rdf+xml[rtf_text/rtf[sass_text/x-sass[scss_text/x-scss[sgm,sgml_text/sgml[sh_application/x-sh[svg,svgz_image/svg+xml[swf_application/x-shockwave-flash[tar_application/x-tar[tif,tiff_image/tiff[toml_application/toml[ts_video/mp2t[tsx_text/tsx[tsv_text/tab-separated-values[ttc_font/collection[ttf_font/ttf[vtt_text/vtt[wasm_application/wasm[wav_audio/wav[weba_audio/webm[webm_video/webm[webmanifest_application/manifest+json[webp_image/webp[wma_audio/x-ms-wma[wmv_video/x-ms-wmv[woff_font/woff[woff2_font/woff2[xls_application/vnd.ms-excel[xlsx_application/vnd.openxmlformats-officedocument.spreadsheetml.sheet[xml_application/xml[xz_application/x-xz[yaml,yml_text/yaml[zip_application/zip",DR=new Map(LR.split("[").flatMap(e=>{let[t,n]=e.split("_");return t.split(",").map(r=>[r,n])}));HR=$R(Intl.NumberFormat);GR=["","kilo","mega","giga","tera"],UR=["","kilo","mega","giga","tera","peta"],qR=(e,t="en-US",n={})=>{if(Number.isNaN(e))return"";if(e===0)return"0 B";let{unitSystem:r="decimal",precision:i=3,unit:a="byte",unitDisplay:o="short"}=n,s=r==="binary"?1024:1e3,l=a==="bit"?GR:UR,c=e<0,u=Math.abs(e),p=0;for(;u>=s&&p{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`file:${e.id}`},sb=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.dropzone)!=null?n:`file:${e.id}:dropzone`},pg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`file:${e.id}:input`},WR=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`file:${e.id}:trigger`},KR=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`file:${e.id}:label`},zR=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.item)==null?void 0:r.call(n,t))!=null?i:`file:${e.id}:item:${t}`},jR=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemName)==null?void 0:r.call(n,t))!=null?i:`file:${e.id}:item-name:${t}`},YR=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemSizeText)==null?void 0:r.call(n,t))!=null?i:`file:${e.id}:item-size:${t}`},XR=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemPreview)==null?void 0:r.call(n,t))!=null?i:`file:${e.id}:item-preview:${t}`},ZR=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemDeleteTrigger)==null?void 0:r.call(n,t))!=null?i:`file:${e.id}:item-delete:${t}`},ko=e=>Jp(`${e.name}-${e.size}`),JR=e=>e.getById(ob(e)),Qy=e=>e.getById(pg(e)),QR=e=>e.getById(sb(e));Fr="accepted",nk="button, a[href], input:not([type='file']), select, textarea, [tabindex], [contenteditable]";ik=te({props({props:e}){return y(h({minFileSize:0,maxFileSize:Number.POSITIVE_INFINITY,maxFiles:1,allowDrop:!0,preventDocumentDrop:!0,defaultAcceptedFiles:[]},e),{translations:h({dropzone:"dropzone",itemPreview:t=>`preview of ${t.name}`,deleteFile:t=>`delete file ${t.name}`},e.translations)})},initialState(){return"idle"},context({prop:e,bindable:t,getContext:n}){return{acceptedFiles:t(()=>({defaultValue:e("defaultAcceptedFiles"),value:e("acceptedFiles"),isEqual:(r,i)=>r.length===(i==null?void 0:i.length)&&r.every((a,o)=>ba(a,i[o])),hash(r){return r.map(i=>`${i.name}-${i.size}`).join(",")},onChange(r){var a,o;let i=n();(a=e("onFileAccept"))==null||a({files:r}),(o=e("onFileChange"))==null||o({acceptedFiles:r,rejectedFiles:i.get("rejectedFiles")})}})),rejectedFiles:t(()=>({defaultValue:[],isEqual:(r,i)=>r.length===(i==null?void 0:i.length)&&r.every((a,o)=>ba(a.file,i[o].file)),onChange(r){var a,o;let i=n();(a=e("onFileReject"))==null||a({files:r}),(o=e("onFileChange"))==null||o({acceptedFiles:i.get("acceptedFiles"),rejectedFiles:r})}})),transforming:t(()=>({defaultValue:!1}))}},computed:{acceptAttr:({prop:e})=>kR(e("accept")),multiple:({prop:e})=>e("maxFiles")>1},watch({track:e,context:t,action:n}){e([()=>t.hash("acceptedFiles")],()=>{n(["syncInputElement"])})},on:{"FILES.SET":{actions:["setFiles"]},"FILE.SELECT":{actions:["setEventFiles"]},"FILE.DELETE":{actions:["removeFile"]},"FILES.CLEAR":{actions:["clearFiles"]},"REJECTED_FILES.CLEAR":{actions:["clearRejectedFiles"]}},effects:["preventDocumentDrop"],states:{idle:{on:{OPEN:{actions:["openFilePicker"]},"DROPZONE.CLICK":{actions:["openFilePicker"]},"DROPZONE.FOCUS":{target:"focused"},"DROPZONE.DRAG_OVER":{target:"dragging"}}},focused:{on:{"DROPZONE.BLUR":{target:"idle"},OPEN:{actions:["openFilePicker"]},"DROPZONE.CLICK":{actions:["openFilePicker"]},"DROPZONE.DRAG_OVER":{target:"dragging"}}},dragging:{on:{"DROPZONE.DROP":{target:"idle",actions:["setEventFiles"]},"DROPZONE.DRAG_LEAVE":{target:"idle"}}}},implementations:{effects:{preventDocumentDrop({prop:e,scope:t}){if(!e("preventDocumentDrop")||!e("allowDrop")||e("disabled"))return;let n=t.getDoc(),r=a=>{a==null||a.preventDefault()},i=a=>{ge(JR(t),ne(a))||a.preventDefault()};return Ct(ae(n,"dragover",r,!1),ae(n,"drop",i,!1))}},actions:{syncInputElement({scope:e,context:t}){queueMicrotask(()=>{let n=Qy(e);if(!n)return;tk(n,t.get("acceptedFiles"));let r=e.getWin();n.dispatchEvent(new r.Event("change",{bubbles:!0}))})},openFilePicker({scope:e}){B(()=>{var t;(t=Qy(e))==null||t.click()})},setFiles(e){let{computed:t,context:n,event:r}=e,{acceptedFiles:i,rejectedFiles:a}=tb(e,r.files);n.set("acceptedFiles",t("multiple")?i:i.length>0?[i[0]]:[]),n.set("rejectedFiles",a)},setEventFiles(e){let{computed:t,context:n,event:r,prop:i}=e,a=n.get("acceptedFiles"),o=n.get("rejectedFiles"),{acceptedFiles:s,rejectedFiles:l}=tb(e,r.files,a,o),c=u=>{if(t("multiple")){n.set("acceptedFiles",p=>[...p,...u]),n.set("rejectedFiles",l);return}if(u.length){n.set("acceptedFiles",[u[0]]),n.set("rejectedFiles",l);return}l.length&&(n.set("acceptedFiles",n.get("acceptedFiles")),n.set("rejectedFiles",l))},d=i("transformFiles");d?(n.set("transforming",!0),d(s).then(c).catch(u=>{It(`[zag-js/file-upload] error transforming files +${u}`)}).finally(()=>{n.set("transforming",!1)})):c(s)},removeFile({context:e,event:t}){if(t.itemType==="rejected"){let n=e.get("rejectedFiles").filter(r=>!ba(r.file,t.file));e.set("rejectedFiles",n)}else{let n=e.get("acceptedFiles").filter(r=>!ba(r,t.file));e.set("acceptedFiles",n)}},clearRejectedFiles({context:e}){e.set("rejectedFiles",[])},clearFiles({context:e}){e.set("acceptedFiles",[]),e.set("rejectedFiles",[])}}}}),rr="accepted";dk=class extends X{constructor(){super(...arguments);Q(this,"previewCleanup",new Map);Q(this,"sentinelSnapshot","")}initMachine(t){return new Y(ik,t)}initApi(){return this.zagConnect(rk)}cleanupPreviews(){for(let t of this.previewCleanup.values())t();this.previewCleanup.clear()}render(){var l,c,d;let t=(l=this.el.querySelector('[data-scope="file-upload"][data-part="root"]'))!=null?l:this.el;this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="file-upload"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps());let r=this.el.querySelector('[data-scope="file-upload"][data-part="dropzone"]');r&&this.spreadProps(r,this.api.getDropzoneProps());let i=this.el.querySelector('[data-scope="file-upload"][data-part="trigger"]');i&&this.spreadProps(i,this.api.getTriggerProps());let a=(c=this.el.querySelector('[data-scope="file-upload"][data-part="hidden-input"]'))!=null?c:t.querySelector('input[type="file"]');a&&this.spreadProps(a,this.api.getHiddenInputProps());let o=this.el.querySelector('ul[data-scope="file-upload"][data-part="item-group"][data-file-type="accepted"]');o&&(this.spreadProps(o,this.api.getItemGroupProps({type:rr})),this.syncAcceptedItems(o));let s=this.el.querySelectorAll('[data-scope="file-upload"][data-part="item"]');for(let u of Array.from(s)){let p=this.getAcceptedFileForElement(u);if(!p)continue;this.spreadProps(u,this.api.getItemProps({file:p,type:rr}));let g=u.querySelector('[data-scope="file-upload"][data-part="item-name"]');g&&this.spreadProps(g,this.api.getItemNameProps({file:p,type:rr}));let f=u.querySelector('[data-scope="file-upload"][data-part="item-preview"]');f&&this.spreadProps(f,this.api.getItemPreviewProps({file:p,type:rr}));let m=u.querySelector('[data-scope="file-upload"][data-part="item-preview-image"]');if(m&&p.type.startsWith("image/")){let w=No(p);if(m.dataset.corexPreviewKey!==w||!m.getAttribute("src")){let P=this.previewCleanup.get(m);P==null||P(),m.removeAttribute("src");let v=this.api.createFileUrl(p,E=>{this.spreadProps(m,this.api.getItemPreviewImageProps({file:p,type:rr,url:E}))});this.previewCleanup.set(m,v),m.dataset.corexPreviewKey=w}else{let P=(d=m.getAttribute("src"))!=null?d:"";P&&this.spreadProps(m,this.api.getItemPreviewImageProps({file:p,type:rr,url:P}))}}let S=u.querySelector('[data-scope="file-upload"][data-part="item-size-text"]');S&&(this.spreadProps(S,this.api.getItemSizeTextProps({file:p,type:rr})),S.textContent=this.api.getFileSize(p));let T=u.querySelector('[data-scope="file-upload"][data-part="item-delete-trigger"]');T&&this.spreadProps(T,this.api.getItemDeleteTriggerProps({file:p,type:rr}))}this.syncFormSubmitInputs(),this.touchSentinel()}syncFormSubmitInputs(){let t=this.el.querySelector('[data-scope="file-upload"][data-part="hidden-input"]'),n=this.el.querySelector('[data-part="hidden-input-sentinel"]'),r=this.api.acceptedFiles,i=this.el.dataset.name;if(t&&ck(t,r),this.syncAcceptedNamesHidden(i,r),!!n){if(r.length>0){n.disabled=!0,n.removeAttribute("name");return}n.disabled=!1,i&&n.setAttribute("name",i)}}syncAcceptedNamesHidden(t,n){var l;if(!t)return;let r=lk(t),i=(l=this.el.querySelector('[data-scope="file-upload"][data-part="region"]'))!=null?l:this.el,a=i.querySelector('[data-scope="file-upload"][data-part="accepted-names-hidden"]');a||(a=document.createElement("input"),a.type="hidden",a.setAttribute("data-scope","file-upload"),a.setAttribute("data-part","accepted-names-hidden"),i.appendChild(a));let o=n.map(c=>c.name).filter(Boolean).join(", ");if(o===""){a.disabled=!0,a.removeAttribute("name"),a.value="";return}a.disabled=!1,a.name=r,a.value=o;let s=this.el.dataset.form;s?a.setAttribute("form",s):a.removeAttribute("form")}touchSentinel(){let t=this.el.querySelector('[data-part="hidden-input-sentinel"]');if(!t)return;let n=this.api.acceptedFiles.map(r=>No(r)).join(",");n!==this.sentinelSnapshot&&(this.sentinelSnapshot=n,t.dispatchEvent(new Event("input",{bubbles:!0})))}syncAcceptedItems(t){this.syncItemList(t,this.api.acceptedFiles)}syncItemList(t,n){let r=n.map(o=>No(o)),i=new Set(r),a=new Map;t.querySelectorAll("li[data-corex-file-item]").forEach(o=>{let s=o.dataset.fileKey;s&&a.set(s,o)});for(let o of[...a.keys()])if(!i.has(o)){let s=a.get(o);if(!s)continue;s.querySelectorAll('img[data-part="item-preview-image"]').forEach(l=>{let c=this.previewCleanup.get(l);c&&(c(),this.previewCleanup.delete(l))}),s.remove(),a.delete(o)}for(let o of n){let s=No(o),l=a.get(s);l||(l=this.buildItemLi(o,s),a.set(s,l)),t.appendChild(l)}}buildItemLi(t,n){let r=this.doc,i=r.createElement("li");i.setAttribute("data-scope","file-upload"),i.setAttribute("data-part","item"),i.setAttribute("data-corex-file-item",""),i.dataset.fileKey=n,i.dataset.fileType=rr;let a=r.createElement("div");if(a.setAttribute("data-scope","file-upload"),a.setAttribute("data-part","item-lead"),t.type.startsWith("image/")){let c=r.createElement("div");c.setAttribute("data-scope","file-upload"),c.setAttribute("data-part","item-preview");let d=r.createElement("img");d.setAttribute("data-scope","file-upload"),d.setAttribute("data-part","item-preview-image"),c.appendChild(d),a.appendChild(c)}i.appendChild(a);let o=r.createElement("div");o.setAttribute("data-scope","file-upload"),o.setAttribute("data-part","item-name"),o.textContent=t.name,i.appendChild(o);let s=r.createElement("div");s.setAttribute("data-scope","file-upload"),s.setAttribute("data-part","item-size-text"),i.appendChild(s);let l=r.createElement("button");return l.setAttribute("data-scope","file-upload"),l.setAttribute("data-part","item-delete-trigger"),l.type="button",this.fillDeleteTriggerContent(l),i.appendChild(l),i}fillDeleteTriggerContent(t){let n=this.el.querySelector("[data-file-upload-item-close-template]");if(!(n!=null&&n.content))return;t.replaceChildren();let r=n.content.cloneNode(!0);for(let i of Array.from(r.childNodes))i.nodeType===1&&t.appendChild(i)}getAcceptedFileForElement(t){let n=t.dataset.fileKey;if(n)return this.api.acceptedFiles.find(r=>No(r)===n)}};uk={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=U(e,"maxFiles"),i=U(e,"maxFileSize"),a=U(e,"minFileSize"),o=e.dataset.allowDrop,s=e.dataset.preventDocumentDrop,l=V(e,"translationDropzone"),c=new dk(e,{id:e.id,disabled:O(e,"disabled"),invalid:O(e,"invalid"),readOnly:O(e,"readonly"),required:O(e,"required"),name:V(e,"name"),dir:q(e),allowDrop:o===void 0?!0:o!=="false",preventDocumentDrop:s===void 0?!0:s!=="false",maxFiles:r!=null?r:1,maxFileSize:i!=null?i:Number.POSITIVE_INFINITY,minFileSize:a!=null?a:0,accept:V(e,"accept"),directory:O(e,"directory"),translations:l?{dropzone:l}:void 0,onFileChange:p=>{W({el:e,canPushServer:n(),pushEvent:t,payload:lb(e,p),serverEventName:V(e,"onFileChange"),clientEventName:V(e,"onFileChangeClient")})},onFileAccept:p=>{W({el:e,canPushServer:n(),pushEvent:t,payload:cb(e,p),serverEventName:V(e,"onFileAccept"),clientEventName:V(e,"onFileAcceptClient")})},onFileReject:p=>{W({el:e,canPushServer:n(),pushEvent:t,payload:db(e,p),serverEventName:V(e,"onFileReject"),clientEventName:V(e,"onFileRejectClient")})}});c.init(),this.fileUpload=c,this.handlers=[],this.unbindSubmitIntent=oa(e,()=>{c.syncFormSubmitInputs()});let d=ie(e);this.domRegistry=d,d.add("corex:file-upload:clear-files",()=>{c.api.clearFiles()}),d.add("corex:file-upload:clear-rejected",()=>{c.api.clearRejectedFiles()}),d.add("corex:file-upload:open",()=>{c.api.openFilePicker()});let u=re(this);this.handleRegistry=u,u.add("file_upload_clear_files",p=>{$(e.id,H(p))&&c.api.clearFiles()}),u.add("file_upload_clear_rejected",p=>{$(e.id,H(p))&&c.api.clearRejectedFiles()}),u.add("file_upload_open",p=>{$(e.id,H(p))&&c.api.openFilePicker()})},updated(){var e,t,n,r;(r=this.fileUpload)==null||r.updateProps({id:this.el.id,disabled:O(this.el,"disabled"),invalid:O(this.el,"invalid"),readOnly:O(this.el,"readonly"),required:O(this.el,"required"),name:V(this.el,"name"),dir:q(this.el),allowDrop:this.el.dataset.allowDrop===void 0?!0:this.el.dataset.allowDrop!=="false",preventDocumentDrop:this.el.dataset.preventDocumentDrop===void 0?!0:this.el.dataset.preventDocumentDrop!=="false",maxFiles:(e=U(this.el,"maxFiles"))!=null?e:1,maxFileSize:(t=U(this.el,"maxFileSize"))!=null?t:Number.POSITIVE_INFINITY,minFileSize:(n=U(this.el,"minFileSize"))!=null?n:0,accept:V(this.el,"accept"),directory:O(this.el,"directory")})},destroyed(){var e,t,n,r,i;if((e=this.unbindSubmitIntent)==null||e.call(this),this.handlers)for(let a of this.handlers)this.removeHandleEvent(a);(t=this.domRegistry)==null||t.teardown(),(n=this.handleRegistry)==null||n.teardown(),(r=this.fileUpload)==null||r.cleanupPreviews(),(i=this.fileUpload)==null||i.destroy()}}});var Rb={};pe(Rb,{FloatingPanel:()=>Mk,buildAnchorProps:()=>vg,parsePoint:()=>xb,parseSize:()=>Ia});function yk(e){if(!hg.has(e)){let t=e.ownerDocument.defaultView||window;hg.set(e,t.getComputedStyle(e))}return hg.get(e)}function wb(e,t={}){return Wn(bk(e,t))}function bk(e,t={}){let{excludeScrollbar:n=!1,excludeBorders:r=!1}=t,{x:i,y:a,width:o,height:s}=e.getBoundingClientRect(),l={x:i,y:a,width:o,height:s},c=yk(e),{borderLeftWidth:d,borderTopWidth:u,borderRightWidth:p,borderBottomWidth:g}=c,f=fb(d,p),m=fb(u,g);if(r&&(l.width-=f,l.height-=m,l.x+=fg(d),l.y+=fg(u)),n){let S=e.offsetWidth-e.clientWidth-f,T=e.offsetHeight-e.clientHeight-m;l.width-=S,l.height-=T}return l}function Ek(e,t={}){return Wn(Pk(e,t))}function Pk(e,t){let{excludeScrollbar:n=!1}=t,{innerWidth:r,innerHeight:i,document:a,visualViewport:o}=e,s=(o==null?void 0:o.width)||r,l=(o==null?void 0:o.height)||i,c={x:0,y:0,width:s,height:l};if(n){let d=r-a.documentElement.clientWidth,u=i-a.documentElement.clientHeight;c.width-=d,c.height-=u}return c}function yb(e,t){let{minX:n,minY:r,maxX:i,maxY:a,midX:o,midY:s}=e,l=t.includes("w")?n:t.includes("e")?i:o,c=t.includes("n")?r:t.includes("s")?a:s;return{x:l,y:c}}function Ik(e){return Sk[e]}function Tk(e,t,n,r){let{scalingOriginMode:i,lockAspectRatio:a}=r,o=yb(e,n),s=Ik(n),l=yb(e,s);i==="center"&&(t={x:t.x*2,y:t.y*2});let c={x:o.x+t.x,y:o.y+t.y},d={x:mb[n].x*2-1,y:mb[n].y*2-1},u={width:c.x-l.x,height:c.y-l.y},p=d.x*u.width/e.width,g=d.y*u.height/e.height,f=Sa(p)>Sa(g)?p:g,m=a?{x:f,y:f}:{x:o.x===l.x?1:p,y:o.y===l.y?1:g};switch(o.y===l.y?m.y=Sa(m.y):cc(m.y)!==cc(g)&&(m.y*=-1),o.x===l.x?m.x=Sa(m.x):cc(m.x)!==cc(p)&&(m.x*=-1),i){case"extent":return bb(e,pb.scale(m.x,m.y,l),!1);case"center":return bb(e,pb.scale(m.x,m.y,{x:e.midX,y:e.midY}),!1)}}function Ck(e,t,n=!0){return n?{x:vb(t.x,e.x),y:vb(t.y,e.y),width:Sa(t.x-e.x),height:Sa(t.y-e.y)}:{x:e.x,y:e.y,width:t.x-e.x,height:t.y-e.y}}function bb(e,t,n=!0){let r=t.applyTo({x:e.minX,y:e.minY}),i=t.applyTo({x:e.maxX,y:e.maxY});return Ck(r,i,n)}function Ok(e){switch(e){case"n":return{cursor:"n-resize",width:"100%",top:0,left:"50%",translate:"-50%"};case"e":return{cursor:"e-resize",height:"100%",right:0,top:"50%",translate:"0 -50%"};case"s":return{cursor:"s-resize",width:"100%",bottom:0,left:"50%",translate:"-50%"};case"w":return{cursor:"w-resize",height:"100%",left:0,top:"50%",translate:"0 -50%"};case"se":return{cursor:"se-resize",bottom:0,right:0};case"sw":return{cursor:"sw-resize",bottom:0,left:0};case"ne":return{cursor:"ne-resize",top:0,right:0};case"nw":return{cursor:"nw-resize",top:0,left:0};default:throw new Error(`Invalid axis: ${e}`)}}function Vk(e,t){let{state:n,send:r,scope:i,prop:a,computed:o,context:s}=e,l=n.hasTag("open"),c=n.matches("open.dragging"),d=n.matches("open.resizing"),u=s.get("isTopmost"),p=s.get("size"),g=s.get("position"),f=o("isMaximized"),m=o("isMinimized"),S=o("isStaged"),T=o("canResize"),w=o("canDrag");return{open:l,resizable:a("resizable"),draggable:a("draggable"),setOpen(I){n.hasTag("open")!==I&&r({type:I?"OPEN":"CLOSE"})},dragging:c,resizing:d,position:g,size:p,setPosition(I){r({type:"SET_POSITION",position:I})},setSize(I){r({type:"SET_SIZE",size:I})},minimize(){r({type:"MINIMIZE"})},maximize(){r({type:"MAXIMIZE"})},restore(){r({type:"RESTORE"})},getTriggerProps(){return t.button(y(h({},ln.trigger.attrs),{dir:a("dir"),type:"button",disabled:a("disabled"),id:Ob(i),"data-state":l?"open":"closed","data-dragging":b(c),"aria-controls":mg(i),onClick(I){if(I.defaultPrevented||a("disabled"))return;let P=n.hasTag("open");r({type:P?"CLOSE":"OPEN",src:"trigger"})}}))},getPositionerProps(){return t.element(y(h({},ln.positioner.attrs),{dir:a("dir"),id:Vb(i),style:{"--width":ke(p==null?void 0:p.width),"--height":ke(p==null?void 0:p.height),"--x":ke(g==null?void 0:g.x),"--y":ke(g==null?void 0:g.y),position:a("strategy"),top:"var(--y)",left:"var(--x)"}}))},getContentProps(){return t.element(y(h({},ln.content.attrs),{dir:a("dir"),role:"dialog",tabIndex:0,hidden:!l,id:mg(i),"aria-labelledby":Eb(i),"data-state":l?"open":"closed","data-dragging":b(c),"data-topmost":b(u),"data-behind":b(!u),"data-minimized":b(m),"data-maximized":b(f),"data-staged":b(S),style:{width:"var(--width)",height:"var(--height)",overflow:m?"hidden":void 0},onFocus(){r({type:"CONTENT_FOCUS"})},onKeyDown(I){if(I.defaultPrevented)return;if(I.key==="Escape"&&u){r({type:"ESCAPE"});return}if(I.currentTarget!==ne(I))return;let P=Hn(I)*a("gridSize"),E={ArrowLeft(){r({type:"MOVE",direction:"left",step:P})},ArrowRight(){r({type:"MOVE",direction:"right",step:P})},ArrowUp(){r({type:"MOVE",direction:"up",step:P})},ArrowDown(){r({type:"MOVE",direction:"down",step:P})}}[me(I,{dir:a("dir")})];E&&(I.preventDefault(),E(I))}}))},getCloseTriggerProps(){return t.button(y(h({},ln.closeTrigger.attrs),{dir:a("dir"),disabled:a("disabled"),"aria-label":"Close Window",type:"button",onClick(I){I.defaultPrevented||r({type:"CLOSE"})}}))},getStageTriggerProps(I){if(!Tb.has(I.stage))throw new Error(`[zag-js] Invalid stage: ${I.stage}. Must be one of: ${Array.from(Tb).join(", ")}`);let P=a("translations"),v=He(I.stage,{minimized:()=>({"aria-label":P.minimize,hidden:S}),maximized:()=>({"aria-label":P.maximize,hidden:S}),default:()=>({"aria-label":P.restore,hidden:!S})});return t.button(y(h(y(h({},ln.stageTrigger.attrs),{dir:a("dir"),disabled:a("disabled"),"data-stage":I.stage}),v),{type:"button",onClick(E){if(E.defaultPrevented||!a("resizable"))return;let R=He(I.stage,{minimized:()=>"MINIMIZE",maximized:()=>"MAXIMIZE",default:()=>"RESTORE"});r({type:R.toUpperCase()})}}))},getResizeTriggerProps(I){return t.element(y(h({},ln.resizeTrigger.attrs),{dir:a("dir"),"data-disabled":b(!T),"data-axis":I.axis,onPointerDown(P){T&&fe(P)&&(P.currentTarget.setPointerCapture(P.pointerId),P.stopPropagation(),r({type:"RESIZE_START",axis:I.axis,position:{x:P.clientX,y:P.clientY}}))},onPointerUp(P){if(!T)return;let v=P.currentTarget;v.hasPointerCapture(P.pointerId)&&v.releasePointerCapture(P.pointerId)},style:h({position:"absolute",touchAction:"none"},Ok(I.axis))}))},getDragTriggerProps(){return t.element(y(h({},ln.dragTrigger.attrs),{dir:a("dir"),"data-disabled":b(!w),onPointerDown(I){if(!w||!fe(I))return;let P=ne(I);P!=null&&P.closest("button")||P!=null&&P.closest("[data-no-drag]")||(I.currentTarget.setPointerCapture(I.pointerId),I.stopPropagation(),r({type:"DRAG_START",pointerId:I.pointerId,position:{x:I.clientX,y:I.clientY}}))},onPointerUp(I){if(!w)return;let P=I.currentTarget;P.hasPointerCapture(I.pointerId)&&P.releasePointerCapture(I.pointerId)},onDoubleClick(I){I.defaultPrevented||a("resizable")&&r({type:S?"RESTORE":"MAXIMIZE"})},style:{WebkitUserSelect:"none",userSelect:"none",touchAction:"none",cursor:"move"}}))},getControlProps(){return t.element(y(h({},ln.control.attrs),{dir:a("dir"),"data-disabled":b(a("disabled")),"data-stage":s.get("stage"),"data-minimized":b(m),"data-maximized":b(f),"data-staged":b(S)}))},getTitleProps(){return t.element(y(h({},ln.title.attrs),{dir:a("dir"),id:Eb(i)}))},getHeaderProps(){return t.element(y(h({},ln.header.attrs),{dir:a("dir"),id:Ab(i),"data-dragging":b(c),"data-topmost":b(u),"data-behind":b(!u),"data-minimized":b(m),"data-maximized":b(f),"data-staged":b(S)}))},getBodyProps(){return t.element(y(h({},ln.body.attrs),{dir:a("dir"),"data-dragging":b(c),"data-minimized":b(m),"data-maximized":b(f),"data-staged":b(S),hidden:m}))}}}function Dk(e,t,n,r){var x,C,A,N,k,L,K;let i=t.boundaryRect;if(!i)return;let a=(x=e.gutter)!=null?x:8,o=(C=e.shift)!=null?C:0,s=(N=(A=e.offset)==null?void 0:A.mainAxis)!=null?N:0,l=(L=(k=e.offset)==null?void 0:k.crossAxis)!=null?L:0,c=(K=e.placement)!=null?K:"bottom",{width:d,height:u}=n,p=i,g=r==="rtl",f=p.x+a,m=p.x+p.width-d-a,S=p.x+(p.width-d)/2,T=p.y+a,w=p.y+p.height-u-a,I=p.y+(p.height-u)/2,P=c.split("-"),v=P[0],E=P[1],R=()=>E==="start"?g?m:f:E==="end"?g?f:m:S;if(v==="bottom")return{x:R()+o+l,y:w-s};if(v==="top")return{x:R()+o+l,y:T+s};if(v==="left"){let J=E==="start"?T:E==="end"?w:I;return{x:p.x+a+s,y:J+o+l}}if(v==="right"){let J=E==="start"?T:E==="end"?w:I;return{x:p.x+p.width-d-a-s,y:J+o+l}}return{x:S+l,y:I+s}}function Ia(e){if(e)try{let t=JSON.parse(e);if(typeof t.width=="number"&&typeof t.height=="number")return{width:t.width,height:t.height}}catch(t){}}function xb(e){if(e)try{let t=JSON.parse(e);if(typeof t.x=="number"&&typeof t.y=="number")return{x:t.x,y:t.y}}catch(t){}}function vg(e){var a;let t=(a=Ia(e.dataset.defaultSize))!=null?a:Fk,n=xb(e.dataset.defaultPosition),r=qe(e),i=n==null&&r?o=>Dk(r,o,t,q(e)):void 0;return{defaultPosition:n,getAnchorPosition:i}}var gk,ln,pb,hb,Ea,pk,hk,Pa,fk,mk,vk,hg,fg,fb,mb,Sk,cc,Sa,vb,Ob,Vb,mg,Eb,Ab,Pb,Sb,Ib,wk,xn,Tb,Lo,Cb,Ak,xk,Rk,kk,Nk,Lk,Fk,Mk,kb=ee(()=>{"use strict";Qs();Bt();xr();Ve();be();oe();gk=z("floating-panel").parts("trigger","positioner","content","header","body","title","resizeTrigger","dragTrigger","stageTrigger","closeTrigger","control"),ln=gk.build(),pb=class ze{constructor([t,n,r,i,a,o]=[0,0,0,0,0,0]){fn(this,"m00"),fn(this,"m01"),fn(this,"m02"),fn(this,"m10"),fn(this,"m11"),fn(this,"m12"),fn(this,"rotate",(...s)=>this.prepend(ze.rotate(...s))),fn(this,"scale",(...s)=>this.prepend(ze.scale(...s))),fn(this,"translate",(...s)=>this.prepend(ze.translate(...s))),this.m00=t,this.m01=n,this.m02=r,this.m10=i,this.m11=a,this.m12=o}applyTo(t){let{x:n,y:r}=t,{m00:i,m01:a,m02:o,m10:s,m11:l,m12:c}=this;return{x:i*n+a*r+o,y:s*n+l*r+c}}prepend(t){return new ze([this.m00*t.m00+this.m01*t.m10,this.m00*t.m01+this.m01*t.m11,this.m00*t.m02+this.m01*t.m12+this.m02,this.m10*t.m00+this.m11*t.m10,this.m10*t.m01+this.m11*t.m11,this.m10*t.m02+this.m11*t.m12+this.m12])}append(t){return new ze([t.m00*this.m00+t.m01*this.m10,t.m00*this.m01+t.m01*this.m11,t.m00*this.m02+t.m01*this.m12+t.m02,t.m10*this.m00+t.m11*this.m10,t.m10*this.m01+t.m11*this.m11,t.m10*this.m02+t.m11*this.m12+t.m12])}get determinant(){return this.m00*this.m11-this.m01*this.m10}get isInvertible(){let t=this.determinant;return isFinite(t)&&isFinite(this.m02)&&isFinite(this.m12)&&t!==0}invert(){let t=this.determinant;return new ze([this.m11/t,-this.m01/t,(this.m01*this.m12-this.m11*this.m02)/t,-this.m10/t,this.m00/t,(this.m10*this.m02-this.m00*this.m12)/t])}get array(){return[this.m00,this.m01,this.m02,this.m10,this.m11,this.m12,0,0,1]}get float32Array(){return new Float32Array(this.array)}static get identity(){return new ze([1,0,0,0,1,0])}static rotate(t,n){let r=new ze([Math.cos(t),-Math.sin(t),0,Math.sin(t),Math.cos(t),0]);return n&&(n.x!==0||n.y!==0)?ze.multiply(ze.translate(n.x,n.y),r,ze.translate(-n.x,-n.y)):r}static scale(t,n=t,r={x:0,y:0}){let i=new ze([t,0,0,0,n,0]);return r.x!==0||r.y!==0?ze.multiply(ze.translate(r.x,r.y),i,ze.translate(-r.x,-r.y)):i}static translate(t,n){return new ze([1,0,t,0,1,n])}static multiply(...[t,...n]){return t?n.reduce((r,i)=>r.prepend(i),t):ze.identity}get a(){return this.m00}get b(){return this.m10}get c(){return this.m01}get d(){return this.m11}get tx(){return this.m02}get ty(){return this.m12}get scaleComponents(){return{x:this.a,y:this.d}}get translationComponents(){return{x:this.tx,y:this.ty}}get skewComponents(){return{x:this.c,y:this.b}}toString(){return`matrix(${this.a}, ${this.b}, ${this.c}, ${this.d}, ${this.tx}, ${this.ty})`}},hb=(e,t,n)=>Math.min(Math.max(e,t),n),Ea=(e,t,n)=>{let r=hb(e.x,n.x,n.x+n.width-t.width),i=hb(e.y,n.y,n.y+n.height-t.height);return{x:r,y:i}},pk={width:0,height:0},hk={width:1/0,height:1/0},Pa=(e,t=pk,n=hk)=>({width:Math.min(Math.max(e.width,t.width),n.width),height:Math.min(Math.max(e.height,t.height),n.height)}),fk=(e,t)=>{let n=Math.max(t.x,Math.min(e.x,t.x+t.width-e.width)),r=Math.max(t.y,Math.min(e.y,t.y+t.height-e.height));return{x:n,y:r,width:Math.min(e.width,t.width),height:Math.min(e.height,t.height)}},mk=(e,t)=>e.width===(t==null?void 0:t.width)&&e.height===(t==null?void 0:t.height),vk=(e,t)=>e.x===(t==null?void 0:t.x)&&e.y===(t==null?void 0:t.y),hg=new WeakMap;fg=e=>parseFloat(e.replace("px","")),fb=(...e)=>e.reduce((t,n)=>t+(n?fg(n):0),0);mb={n:{x:.5,y:0},ne:{x:1,y:0},e:{x:1,y:.5},se:{x:1,y:1},s:{x:.5,y:1},sw:{x:0,y:1},w:{x:0,y:.5},nw:{x:0,y:0}},Sk={n:"s",ne:"sw",e:"w",se:"nw",s:"n",sw:"ne",w:"e",nw:"se"},{sign:cc,abs:Sa,min:vb}=Math;Ob=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`float:${e.id}:trigger`},Vb=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`float:${e.id}:positioner`},mg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`float:${e.id}:content`},Eb=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.title)!=null?n:`float:${e.id}:title`},Ab=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.header)!=null?n:`float:${e.id}:header`},Pb=e=>e.getById(Ob(e)),Sb=e=>e.getById(Vb(e)),Ib=e=>e.getById(mg(e)),wk=e=>e.getById(Ab(e)),xn=(e,t,n)=>{let r;return Pe(t)?r=wb(t):r=Ek(e.getWin()),n&&(r=Wn({x:-r.width,y:r.minY,width:r.width*3,height:r.height*2})),dr(r,["x","y","width","height"])};Tb=new Set(["minimized","maximized","default"]);Lo=Fs({stack:[],count(){return this.stack.length},add(e){this.stack.includes(e)||this.stack.push(e)},remove(e){let t=this.stack.indexOf(e);t<0||this.stack.splice(t,1)},bringToFront(e){this.remove(e),this.add(e)},isTopmost(e){return this.stack[this.stack.length-1]===e},indexOf(e){return this.stack.indexOf(e)}}),{not:Cb,and:Ak}=we(),xk={minimize:"Minimize window",maximize:"Maximize window",restore:"Restore window"},Rk=Object.freeze({width:320,height:240}),kk=Object.freeze({x:300,y:100}),Nk=te({props({props:e}){return gn(e,["id"],"floating-panel"),y(h({strategy:"fixed",gridSize:1,allowOverflow:!0,resizable:!0,draggable:!0},e),{translations:h(h({},xk),e.translations)})},initialState({prop:e}){var n;return((n=e("open"))!=null?n:e("defaultOpen"))?"open":"closed"},context({prop:e,bindable:t}){return{size:t(()=>{var n;return{defaultValue:(n=e("defaultSize"))!=null?n:Rk,value:e("size"),isEqual:mk,hash(r){return`W:${r.width} H:${r.height}`},onChange(r){var i;(i=e("onSizeChange"))==null||i({size:r})}}}),position:t(()=>{var n;return{defaultValue:(n=e("defaultPosition"))!=null?n:kk,value:e("position"),isEqual:vk,hash(r){return`X:${r.x} Y:${r.y}`},onChange(r){var i;(i=e("onPositionChange"))==null||i({position:r})}}}),stage:t(()=>({defaultValue:"default",onChange(n){var r;(r=e("onStageChange"))==null||r({stage:n})}})),lastEventPosition:t(()=>({defaultValue:null})),prevPosition:t(()=>({defaultValue:null})),prevSize:t(()=>({defaultValue:null})),isTopmost:t(()=>({defaultValue:void 0}))}},computed:{isMaximized:({context:e})=>e.get("stage")==="maximized",isMinimized:({context:e})=>e.get("stage")==="minimized",isStaged:({context:e})=>e.get("stage")!=="default",hasSpecifiedPosition:({prop:e})=>e("defaultPosition")!=null||e("position")!=null,canResize:({context:e,prop:t})=>t("resizable")&&!t("disabled")&&e.get("stage")==="default",canDrag:({prop:e,computed:t})=>e("draggable")&&!e("disabled")&&!t("isMaximized")},watch({track:e,context:t,action:n,prop:r}){e([()=>t.hash("position")],()=>{n(["setPositionStyle"])}),e([()=>t.hash("size")],()=>{n(["setSizeStyle"])}),e([()=>r("open")],()=>{n(["toggleVisibility"])})},effects:["trackPanelStack"],on:{CONTENT_FOCUS:{actions:["bringToFrontOfPanelStack"]},SET_POSITION:{actions:["setPosition"]},SET_SIZE:{actions:["setSize"]}},states:{closed:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["setAnchorPosition","setPositionStyle","setSizeStyle","setInitialFocus"]},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen","setAnchorPosition","setPositionStyle","setSizeStyle","setInitialFocus"]}]}},open:{tags:["open"],entry:["bringToFrontOfPanelStack"],initial:"idle",on:{"CONTROLLED.CLOSE":{target:"closed",actions:["resetRect","setFinalFocus"]},CLOSE:[{guard:"isOpenControlled",target:"closed",actions:["invokeOnClose","setFinalFocus"]},{target:"closed",actions:["invokeOnClose","resetRect","setFinalFocus"]}]},states:{idle:{effects:["trackBoundaryRect"],on:{DRAG_START:{guard:Cb("isMaximized"),target:"dragging",actions:["setPrevPosition"]},RESIZE_START:{guard:Cb("isMinimized"),target:"resizing",actions:["setPrevSize"]},ESCAPE:[{guard:Ak("isOpenControlled","closeOnEsc"),actions:["invokeOnClose"]},{guard:"closeOnEsc",target:"closed",actions:["invokeOnClose","resetRect","setFinalFocus"]}],MINIMIZE:{actions:["setMinimized"]},MAXIMIZE:{actions:["setMaximized"]},RESTORE:{actions:["setRestored"]},MOVE:{actions:["setPositionFromKeyboard"]}}},dragging:{effects:["trackPointerMove"],on:{DRAG:{actions:["setPositionFromDrag"]},DRAG_END:{target:"idle",actions:["invokeOnDragEnd","clearPrevPosition"]},ESCAPE:{target:"idle",actions:["restorePosition","clearPrevPosition"]}}},resizing:{effects:["trackPointerMove"],on:{DRAG:{actions:["setSizeFromDrag"]},DRAG_END:{target:"idle",actions:["invokeOnResizeEnd","clearPrevSize"]},ESCAPE:{target:"idle",actions:["restoreSize","clearPrevSize"]}}}}}},implementations:{guards:{closeOnEsc:({prop:e})=>!!e("closeOnEscape"),isMaximized:({context:e})=>e.get("stage")==="maximized",isMinimized:({context:e})=>e.get("stage")==="minimized",isOpenControlled:({prop:e})=>e("open")!=null},effects:{trackPointerMove({scope:e,send:t,event:n,prop:r}){var s;let i=e.getDoc(),a=(s=r("getBoundaryEl"))==null?void 0:s(),o=xn(e,a,!1);return pn(i,{onPointerMove({point:l,event:c}){let{altKey:d,shiftKey:u}=c,p=Ae(l.x,o.x,o.x+o.width),g=Ae(l.y,o.y,o.y+o.height);t({type:"DRAG",position:{x:p,y:g},axis:n.axis,altKey:d,shiftKey:u})},onPointerUp(){t({type:"DRAG_END"})}})},trackBoundaryRect({context:e,scope:t,prop:n,computed:r}){var l;let i=t.getWin(),a=!0,o=()=>{var u;if(a){a=!1;return}let c=(u=n("getBoundaryEl"))==null?void 0:u(),d=xn(t,c,!1);if(!r("isMaximized")){let p=h(h({},e.get("position")),e.get("size"));d=fk(p,d)}e.set("size",dr(d,["width","height"])),e.set("position",dr(d,["x","y"]))},s=(l=n("getBoundaryEl"))==null?void 0:l();return Pe(s)?Un.observe(s,o):ae(i,"resize",o)},trackPanelStack({context:e,scope:t}){let n=Ps(Lo,()=>{e.set("isTopmost",Lo.isTopmost(t.id));let r=Ib(t);if(!r)return;let i=Lo.indexOf(t.id);i!==-1&&r.style.setProperty("--z-index",`${i+1}`)});return()=>{Lo.remove(t.id),n()}}},actions:{setPosition({context:e,event:t,prop:n,scope:r}){var s;let i=(s=n("getBoundaryEl"))==null?void 0:s(),a=xn(r,i,n("allowOverflow")),o=Ea(t.position,e.get("size"),a);e.set("position",o)},setSize({context:e,event:t,scope:n,prop:r}){var l;let i=(l=r("getBoundaryEl"))==null?void 0:l(),a=xn(n,i,!1),o=t.size;o=Pa(o,r("minSize"),r("maxSize")),o=Pa(o,r("minSize"),a);let s=Ea(e.get("position"),o,a);e.set("size",o),e.set("position",s)},setAnchorPosition({context:e,computed:t,prop:n,scope:r}){var l,c;if(t("hasSpecifiedPosition"))return;let i=e.get("prevPosition")||e.get("prevSize");if(n("persistRect")&&i)return;let a=Pb(r),o=xn(r,(l=n("getBoundaryEl"))==null?void 0:l(),!1),s=(c=n("getAnchorPosition"))==null?void 0:c({triggerRect:a?DOMRect.fromRect(wb(a)):null,boundaryRect:DOMRect.fromRect(o)});if(!s){let d=e.get("size");s={x:o.x+(o.width-d.width)/2,y:o.y+(o.height-d.height)/2}}s&&e.set("position",s)},setPrevPosition({context:e,event:t}){e.set("prevPosition",h({},e.get("position"))),e.set("lastEventPosition",t.position)},clearPrevPosition({context:e,prop:t}){t("persistRect")||e.set("prevPosition",null),e.set("lastEventPosition",null)},restorePosition({context:e}){let t=e.get("prevPosition");t&&e.set("position",t)},setPositionFromDrag({context:e,event:t,prop:n,scope:r}){var c;let i=Td(t.position,e.get("lastEventPosition"));i.x=Math.round(i.x/n("gridSize"))*n("gridSize"),i.y=Math.round(i.y/n("gridSize"))*n("gridSize");let a=e.get("prevPosition");if(!a)return;let o=Zh(a,i),s=(c=n("getBoundaryEl"))==null?void 0:c(),l=xn(r,s,n("allowOverflow"));o=Ea(o,e.get("size"),l),e.set("position",o)},setPositionStyle({scope:e,context:t}){let n=Sb(e),r=t.get("position");n==null||n.style.setProperty("--x",`${r.x}px`),n==null||n.style.setProperty("--y",`${r.y}px`)},resetRect({context:e,prop:t}){e.set("stage","default"),t("persistRect")||(e.set("position",e.initial("position")),e.set("size",e.initial("size")))},setPrevSize({context:e,event:t}){e.set("prevSize",h({},e.get("size"))),e.set("prevPosition",h({},e.get("position"))),e.set("lastEventPosition",t.position)},clearPrevSize({context:e}){e.set("prevSize",null),e.set("prevPosition",null),e.set("lastEventPosition",null)},restoreSize({context:e}){let t=e.get("prevSize");t&&e.set("size",t);let n=e.get("prevPosition");n&&e.set("position",n)},setSizeFromDrag({context:e,event:t,scope:n,prop:r}){var f;let i=e.get("prevSize"),a=e.get("prevPosition"),o=e.get("lastEventPosition");if(!i||!a||!o)return;let s=Wn(h(h({},a),i)),l=Td(t.position,o),c=Tk(s,l,t.axis,{scalingOriginMode:t.altKey?"center":"extent",lockAspectRatio:!!r("lockAspectRatio")||t.shiftKey}),d=dr(c,["width","height"]),u=dr(c,["x","y"]),p=(f=r("getBoundaryEl"))==null?void 0:f(),g=xn(n,p,!1);if(d=Pa(d,r("minSize"),r("maxSize")),d=Pa(d,r("minSize"),g),e.set("size",d),u){let m=Ea(u,d,g);e.set("position",m)}},setSizeStyle({scope:e,context:t}){queueMicrotask(()=>{let n=Sb(e),r=t.get("size");n==null||n.style.setProperty("--width",`${r.width}px`),n==null||n.style.setProperty("--height",`${r.height}px`)})},setMaximized({context:e,prop:t,scope:n}){var d;if(e.get("stage")==="maximized")return;let r=e.get("stage")==="default",i=e.get("size"),a=e.get("position"),o=(d=t("getBoundaryEl"))==null?void 0:d(),s=xn(n,o,!1),l=dr(s,["x","y"]),c=dr(s,["height","width"]);e.set("stage","maximized"),r&&(e.set("prevSize",i),e.set("prevPosition",a)),e.set("position",l),e.set("size",c)},setMinimized({context:e,scope:t}){if(e.get("stage")==="minimized")return;let n=e.get("stage")==="default",r=e.get("size"),i=e.get("position");e.set("stage","minimized"),n&&(e.set("prevSize",r),e.set("prevPosition",i));let a=wk(t);if(!a)return;let o=y(h({},r),{height:a==null?void 0:a.offsetHeight});e.set("size",o)},setRestored({context:e,prop:t,scope:n}){var l;let r=xn(n,(l=t("getBoundaryEl"))==null?void 0:l(),!1);e.set("stage","default");let i=e.get("size"),a=e.get("prevSize");a&&(i=Pa(a,t("minSize"),t("maxSize")),i=Pa(i,t("minSize"),r));let o=e.get("position"),s=e.get("prevPosition");s&&(o=Ea(s,i,r)),e.set("size",i),e.set("position",o),e.set("prevSize",null),e.set("prevPosition",null)},setPositionFromKeyboard({context:e,event:t,prop:n,scope:r}){var c;Fi(t.step==null,"step is required");let i=e.get("position"),a=t.step,o=He(t.direction,{left:{x:i.x-a,y:i.y},right:{x:i.x+a,y:i.y},up:{x:i.x,y:i.y-a},down:{x:i.x,y:i.y+a}}),s=(c=n("getBoundaryEl"))==null?void 0:c(),l=xn(r,s,!1);o=Ea(o,e.get("size"),l),e.set("position",o)},bringToFrontOfPanelStack({prop:e}){Lo.bringToFront(e("id"))},invokeOnOpen({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!0})},invokeOnClose({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!1})},invokeOnDragEnd({context:e,prop:t}){var n;(n=t("onPositionChangeEnd"))==null||n({position:e.get("position")})},invokeOnResizeEnd({context:e,prop:t}){var n;(n=t("onSizeChangeEnd"))==null||n({size:e.get("size")})},setFinalFocus({scope:e,prop:t}){t("restoreFocus")!==!1&&B(()=>{var r,i;let n=(i=(r=t("finalFocusEl"))==null?void 0:r())!=null?i:Pb(e);n==null||n.focus({preventScroll:!0})})},setInitialFocus({scope:e,prop:t}){B(()=>{var r,i;let n=(i=(r=t("initialFocusEl"))==null?void 0:r())!=null?i:Ib(e);n==null||n.focus({preventScroll:!0})})},toggleVisibility({send:e,prop:t,event:n}){e({type:t("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:n})}}}}),Lk=class extends X{initMachine(e){return new Y(Nk,e)}initApi(){return this.zagConnect(Vk)}render(){let e=this.el.querySelector('[data-scope="floating-panel"][data-part="trigger"]');e&&this.spreadProps(e,this.api.getTriggerProps());let t=this.el.querySelector('[data-scope="floating-panel"][data-part="positioner"]');t&&this.spreadProps(t,this.api.getPositionerProps());let n=this.el.querySelector('[data-scope="floating-panel"][data-part="content"]');n&&this.spreadProps(n,this.api.getContentProps());let r=this.el.querySelector('[data-scope="floating-panel"][data-part="title"]');r&&this.spreadProps(r,this.api.getTitleProps());let i=this.el.querySelector('[data-scope="floating-panel"][data-part="header"]');i&&this.spreadProps(i,this.api.getHeaderProps());let a=this.el.querySelector('[data-scope="floating-panel"][data-part="body"]');a&&this.spreadProps(a,this.api.getBodyProps());let o=this.el.querySelector('[data-scope="floating-panel"][data-part="drag-trigger"]');o&&this.spreadProps(o,this.api.getDragTriggerProps()),["s","w","e","n","sw","nw","se","ne"].forEach(u=>{let p=this.el.querySelector(`[data-scope="floating-panel"][data-part="resize-trigger"][data-axis="${u}"]`);p&&this.spreadProps(p,this.api.getResizeTriggerProps({axis:u}))});let l=this.el.querySelector('[data-scope="floating-panel"][data-part="close-trigger"]');l&&this.spreadProps(l,this.api.getCloseTriggerProps());let c=this.el.querySelector('[data-scope="floating-panel"][data-part="control"]');c&&this.spreadProps(c,this.api.getControlProps()),["minimized","maximized","default"].forEach(u=>{let p=this.el.querySelector(`[data-scope="floating-panel"][data-part="stage-trigger"][data-stage="${u}"]`);p&&this.spreadProps(p,this.api.getStageTriggerProps({stage:u}))})}};Fk={width:320,height:240};Mk={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=Ia(e.dataset.size),i=Ia(e.dataset.defaultSize),a=vg(e),o=new Lk(e,{id:e.id,defaultOpen:!1,draggable:O(e,"draggable")!==!1,resizable:O(e,"resizable")!==!1,allowOverflow:O(e,"allowOverflow")!==!1,closeOnEscape:O(e,"closeOnEscape")!==!1,disabled:O(e,"disabled"),dir:q(e),size:r,defaultSize:i,defaultPosition:a.defaultPosition,getAnchorPosition:a.getAnchorPosition,minSize:Ia(e.dataset.minSize),maxSize:Ia(e.dataset.maxSize),persistRect:O(e,"persistRect"),gridSize:Number(e.dataset.gridSize)||1,onOpenChange:c=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,open:c.open},serverEventName:V(e,"onOpenChange"),clientEventName:V(e,"onOpenChangeClient")})},onPositionChange:c=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,position:c.position},serverEventName:V(e,"onPositionChange"),clientEventName:V(e,"onPositionChangeClient")})},onSizeChange:c=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,size:c.size},serverEventName:V(e,"onSizeChange"),clientEventName:V(e,"onSizeChangeClient")})},onStageChange:c=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,stage:c.stage},serverEventName:V(e,"onStageChange"),clientEventName:V(e,"onStageChangeClient")})}});o.init(),this.floatingPanel=o;let s=ie(e);this.domRegistry=s,s.add("corex:floating-panel:set-open",c=>{let{open:d}=c.detail;o.api.setOpen(d)});let l=re(this);this.handleRegistry=l,l.add("floating_panel_set_open",c=>{if(!c||typeof c!="object")return;let d=c;$(e.id,H(c))&&typeof d.open=="boolean"&&o.api.setOpen(d.open)})},updated(){var n;let e=this.el,t=vg(e);(n=this.floatingPanel)==null||n.updateProps({id:e.id,disabled:O(e,"disabled"),dir:q(e),getAnchorPosition:t.getAnchorPosition})},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),this.domRegistry=void 0,(t=this.handleRegistry)==null||t.teardown(),this.handleRegistry=void 0,(n=this.floatingPanel)==null||n.destroy()}}});var Lb={};pe(Lb,{Listbox:()=>$k,buildCollection:()=>su});function Nb(e,t,n){let r=O(e,"redirect");return{id:e.id,disabled:O(e,"disabled"),dir:q(e),orientation:V(e,"orientation"),loopFocus:O(e,"loopFocus"),selectionMode:r?"single":V(e,"selectionMode"),selectOnHighlight:O(e,"selectOnHighlight"),deselectable:O(e,"deselectable"),typeahead:O(e,"typeahead"),onValueChange:i=>{let a=i.value.length>0?String(i.value[0]):null;if(r&&a){let o=e.querySelector(`[data-scope="listbox"][data-part="item"][data-value="${CSS.escape(a)}"]`);On(wn(o,a),{liveSocket:t})}W({el:e,canPushServer:j(t),pushEvent:n,payload:{id:e.id,value:i.value,items:i.items},serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})}}}var _k,$k,Db=ee(()=>{"use strict";Nl();ca();da();yn();$e();Ve();be();oe();_k=class extends X{constructor(t,n){var i;super(t,n);Q(this,"_options",[]);Q(this,"hasGroups",!1);let r=n.collection;this._options=(i=r==null?void 0:r.items)!=null?i:[]}get options(){return Array.isArray(this._options)?this._options:[]}setOptions(t){this._options=Array.isArray(t)?t:[]}getCollection(){return yo(Rr(this.options,this.hasGroups))}initMachine(t){let n=this.getCollection.bind(this);return new Y(jm,y(h({},t),{get collection(){return n()}}))}initApi(){return this.zagConnect(zm)}applyItemProps(){let t=this.el.querySelector('[data-scope="listbox"][data-part="content"]');if(!t)return;let n=r=>r.closest('[data-scope="listbox"][data-part="content"]')===t;t.querySelectorAll('[data-scope="listbox"][data-part="item-group"]').forEach(r=>{var o;if(!n(r))return;let i=(o=r.dataset.id)!=null?o:"";this.spreadProps(r,this.api.getItemGroupProps({id:i}));let a=r.querySelector('[data-scope="listbox"][data-part="item-group-label"]');a&&this.spreadProps(a,this.api.getItemGroupLabelProps({htmlFor:i}))}),t.querySelectorAll('[data-scope="listbox"][data-part="item"]').forEach(r=>{var l;if(!n(r))return;let i=(l=r.dataset.value)!=null?l:"",a=this.options.find(c=>String(Cn(c))===String(i));if(!a)return;this.spreadProps(r,this.api.getItemProps({item:a}));let o=r.querySelector('[data-scope="listbox"][data-part="item-text"]');o&&this.spreadProps(o,this.api.getItemTextProps({item:a}));let s=r.querySelector('[data-scope="listbox"][data-part="item-indicator"]');s&&this.spreadProps(s,this.api.getItemIndicatorProps({item:a}))})}render(){var a;let t=(a=this.el.querySelector('[data-scope="listbox"][data-part="root"]'))!=null?a:this.el;this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="listbox"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps());let r=this.el.querySelector('[data-scope="listbox"][data-part="input"]');r&&this.spreadProps(r,this.api.getInputProps());let i=this.el.querySelector('[data-scope="listbox"][data-part="content"]');i&&(this.spreadProps(i,this.api.getContentProps()),this.applyItemProps())}};$k={mounted(){var c;let e=this.el,t=JSON.parse((c=e.dataset.items)!=null?c:"[]"),n=t.some(d=>!!d.group),r=this.pushEvent.bind(this),i=()=>j(this.liveSocket),a=new _k(e,h(y(h({},Nb(e,this.liveSocket,r)),{collection:su(t,n)}),js(e,"value","defaultValue")));a.hasGroups=n,a.setOptions(t),a.init(),this.listbox=a;let o=d=>{let u=a.api.value;Ge({respondTo:d,canPushServer:i(),pushEvent:r,serverEventName:"listbox_value_response",serverPayload:{id:e.id,value:u},el:e,domEventName:"listbox-value",domDetail:{id:e.id,value:u}})},s=ie(e);this.domRegistry=s,s.add("corex:listbox:set-value",d=>{a.api.setValue(d.detail.value)}),s.add("corex:listbox:value",d=>{o(de(d.detail))});let l=re(this);this.handleRegistry=l,l.add("listbox_set_value",d=>{$(e.id,H(d))&&a.api.setValue(d.value)}),l.add("listbox_value",d=>{$(e.id,H(d))&&o(de(d))})},updated(){var n;if(!this.listbox)return;let e=JSON.parse((n=this.el.dataset.items)!=null?n:"[]"),t=e.some(r=>!!r.group);this.listbox.hasGroups=t,this.listbox.setOptions(e),this.listbox.updateProps(h(y(h({},Nb(this.el,this.liveSocket,this.pushEvent.bind(this))),{collection:this.listbox.getCollection()}),Ks(this.el,"value","defaultValue")))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.listbox)==null||n.destroy()}}});var Mb={};pe(Mb,{Marquee:()=>Kk,readMarqueeProps:()=>yg});function Uk(e,t){let{scope:n,send:r,context:i,computed:a,prop:o}=e,s=o("side"),l=i.get("paused"),c=i.get("duration"),d=a("orientation"),u=a("multiplier"),p=a("isVertical");return{paused:l,orientation:d,side:s,multiplier:u,contentCount:u+1,pause(){r({type:"PAUSE"})},resume(){r({type:"RESUME"})},togglePause(){r({type:"TOGGLE_PAUSE"})},restart(){r({type:"RESTART"})},getRootProps(){let g=o("dir");return t.element(y(h({},Do.root.attrs),{id:cn.getRootId(n),dir:g,role:"region","aria-roledescription":"marquee","aria-live":"off","aria-label":o("translations").root,"data-state":l?"paused":"idle","data-orientation":d,"data-paused":b(l),onMouseEnter:o("pauseOnInteraction")?()=>r({type:"PAUSE"}):void 0,onMouseLeave:o("pauseOnInteraction")?()=>r({type:"RESUME"}):void 0,onFocusCapture:o("pauseOnInteraction")?f=>{f.target!==f.currentTarget&&r({type:"PAUSE"})}:void 0,onBlurCapture:o("pauseOnInteraction")?f=>{f.currentTarget.contains(f.relatedTarget)||r({type:"RESUME"})}:void 0,style:{display:"flex",flexDirection:d==="vertical"?"column":"row",position:"relative",overflow:"hidden",contain:"layout style paint","--marquee-duration":`${c}s`,"--marquee-spacing":o("spacing"),"--marquee-delay":`${o("delay")}s`,"--marquee-loop-count":o("loopCount")===0?"infinite":o("loopCount").toString(),"--marquee-translate":Gk({side:s,dir:g})}}))},getViewportProps(){return t.element(y(h({},Do.viewport.attrs),{id:cn.getViewportId(n),"data-part":"viewport","data-orientation":d,"data-side":s,onAnimationIteration(g){var f;g.target===cn.getContentEl(n,0)&&((f=o("onLoopComplete"))==null||f())},onAnimationEnd(g){var f;g.target===cn.getContentEl(n,0)&&((f=o("onComplete"))==null||f())},style:{display:"flex",[p?"height":"width"]:"100%",flexDirection:d==="vertical"?s==="bottom"?"column-reverse":"column":s==="end"?"row-reverse":"row"}}))},getContentProps(g){let{index:f}=g,m=f>0;return t.element(y(h({},Do.content.attrs),{id:cn.getContentId(n,f),dir:o("dir"),"data-part":"content","data-index":f,"data-orientation":d,"data-side":s,"data-reverse":o("reverse")?"":void 0,"data-clone":b(m),role:m?"presentation":void 0,"aria-hidden":m?!0:void 0,style:{display:"flex",flexDirection:d==="vertical"?"column":"row",flexShrink:0,backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden",willChange:l?"auto":"transform",transform:"translateZ(0)",[p?"minWidth":"minHeight"]:"auto",contain:"paint"}}))},getEdgeProps(g){let{side:f}=g,m=o("dir");return t.element(y(h({},Do.edge.attrs),{dir:m,"data-part":"edge","data-side":f,"data-orientation":d,style:h({pointerEvents:"none",position:"absolute"},Bk({side:f,dir:m}))}))},getItemProps(){return t.element(y(h({},Do.item.attrs),{dir:o("dir"),style:{[p?"marginBlock":"marginInline"]:"calc(var(--marquee-spacing) / 2)"}}))}}}function Fb(e){let{rootSize:t,contentSize:n,speed:r,multiplier:i,autoFill:a}=e;return a?n*i/r:n{"use strict";be();oe();Hk=z("marquee").parts("root","viewport","content","edge","item"),Do=Hk.build(),cn={getRootId:e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`marquee:${e.id}`},getViewportId:e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.viewport)!=null?n:`marquee:${e.id}:viewport`},getContentId:(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.content)==null?void 0:r.call(n,t))!=null?i:`marquee:${e.id}:content:${t}`},getRootEl:e=>e.getById(cn.getRootId(e)),getViewportEl:e=>e.getById(cn.getViewportId(e)),getContentEl:(e,t)=>e.getById(cn.getContentId(e,t))},Bk=e=>{let{side:t}=e;switch(t){case"start":return{top:0,insetInlineStart:0,height:"100%"};case"end":return{top:0,insetInlineEnd:0,height:"100%"};case"top":return{top:0,insetInline:0,width:"100%"};case"bottom":return{bottom:0,insetInline:0,width:"100%"}}},Gk=e=>{let{side:t,dir:n}=e;return t==="top"?"-100%":t==="bottom"?"100%":t==="start"&&n==="ltr"||t==="end"&&n==="rtl"?"-100%":"100%"};qk=te({props({props:e}){return h({dir:"ltr",side:"start",speed:50,delay:0,loopCount:0,spacing:"1rem",autoFill:!1,pauseOnInteraction:!1,reverse:!1,defaultPaused:!1,translations:{root:"Marquee content"}},e)},refs(){return{dimensions:void 0,initialDurationSet:!1}},context({prop:e,bindable:t}){return{paused:t(()=>({value:e("paused"),defaultValue:e("defaultPaused"),onChange(n){var r;(r=e("onPauseChange"))==null||r({paused:n})}})),duration:t(()=>({defaultValue:2e3/Math.max(.001,e("speed"))}))}},initialState(){return"idle"},computed:{orientation:({prop:e})=>{let t=e("side");return t==="top"||t==="bottom"?"vertical":"horizontal"},isVertical:({prop:e})=>{let t=e("side");return t==="top"||t==="bottom"},multiplier:({refs:e,prop:t})=>{if(!t("autoFill"))return 1;let n=e.get("dimensions");if(!n)return 1;let{rootSize:r,contentSize:i}=n;return i===0?1:in("speed")],()=>{t(["recalculateDuration","restartAnimation"])}),e([()=>n("spacing"),()=>n("side")],()=>{t(["recalculateDuration"])})},on:{PAUSE:{actions:["setPaused"]},RESUME:{actions:["setResumed"]},TOGGLE_PAUSE:{actions:["togglePaused"]},RESTART:{actions:["restartAnimation"]}},effects:["trackDimensions"],states:{idle:{}},implementations:{actions:{setPaused({context:e}){e.set("paused",!0)},setResumed({context:e}){e.set("paused",!1)},togglePaused({context:e}){e.set("paused",t=>!t)},restartAnimation({scope:e}){let t=cn.getViewportEl(e);if(!t)return;t.querySelectorAll('[data-part="content"]').forEach(r=>{r.style.animation="none",r.offsetHeight,r.style.animation=""})},recalculateDuration({refs:e,computed:t,context:n,prop:r}){let i=e.get("dimensions");if(!i)return;let{rootSize:a,contentSize:o}=i,s=Fb({rootSize:a,contentSize:o,speed:Math.max(.001,r("speed")),multiplier:t("multiplier"),autoFill:r("autoFill")});n.set("duration",s)}},effects:{trackDimensions({scope:e,refs:t,computed:n,context:r,prop:i}){let a=cn.getRootEl(e),o=cn.getContentEl(e,0);if(!a||!o)return;let s=e.getWin(),l=()=>{let p=n("isVertical")?a.clientHeight:a.clientWidth,g=n("isVertical")?o.clientHeight:o.clientWidth;return{rootSize:p,contentSize:g}},c=()=>{let{rootSize:p,contentSize:g}=l();if(p>0&&g>0&&(t.set("dimensions",{rootSize:p,contentSize:g}),!t.get("initialDurationSet"))){let f=Fb({rootSize:p,contentSize:g,speed:Math.max(.001,i("speed")),multiplier:n("multiplier"),autoFill:i("autoFill")});r.set("duration",f),t.set("initialDurationSet",!0)}},d=null,u=new s.ResizeObserver(()=>{d===null&&(d=s.requestAnimationFrame(()=>{let{rootSize:p,contentSize:g}=l();t.set("dimensions",{rootSize:p,contentSize:g}),d=null}))});return u.observe(a),u.observe(o),c(),()=>{u.disconnect(),d!==null&&s.cancelAnimationFrame(d)}}}}});Wk=class extends X{constructor(){super(...arguments);Q(this,"items",null)}initMachine(t){return new Y(qk,t)}initApi(){return this.zagConnect(Uk)}buildDom(){let t=this.el.querySelector('[data-part="ssr-preview"]');t&&t.remove();let n=this.el.querySelector('template[data-part="items-template"]');if(!n||(this.items=Array.from(n.content.children).map(l=>l.cloneNode(!0)),n.remove(),this.el.querySelector('[data-scope="marquee"][data-part="root"]')))return;let r=document.createElement("div");r.setAttribute("data-scope","marquee"),r.setAttribute("data-part","root"),r.id=`marquee:${this.el.id}`,r.style.cssText="display:flex;flex-direction:row;position:relative;overflow:hidden;width:100%",this.el.appendChild(r);let i=document.createElement("div");r.appendChild(i),this.spreadProps(i,this.api.getEdgeProps({side:"start"}));let a=document.createElement("div");a.setAttribute("data-scope","marquee"),a.setAttribute("data-part","viewport"),a.id=`marquee:${this.el.id}:viewport`,a.style.cssText="display:flex;width:100%",r.appendChild(a);let o=document.createElement("div");o.setAttribute("data-scope","marquee"),o.setAttribute("data-part","content"),o.setAttribute("data-index","0"),o.id=`marquee:${this.el.id}:content:0`,o.style.cssText="display:flex;flex-direction:row;flex-shrink:0",a.appendChild(o),this.items.forEach(l=>{o.appendChild(l.cloneNode(!0))});let s=document.createElement("div");r.appendChild(s),this.spreadProps(s,this.api.getEdgeProps({side:"end"}))}render(){if(!this.items)return;let t=this.el.querySelector('[data-scope="marquee"][data-part="root"]');if(!t)return;this.spreadProps(t,this.api.getRootProps());let n=t.querySelector('[data-part="edge"][data-side="start"]');n&&this.spreadProps(n,this.api.getEdgeProps({side:"start"}));let r=t.querySelector('[data-part="viewport"]');if(!r)return;this.spreadProps(r,this.api.getViewportProps());let i=Array.from(r.querySelectorAll(':scope > [data-part="content"]'));for(;i.length>this.api.contentCount;){let o=i.pop();o&&r.removeChild(o)}Array.from({length:this.api.contentCount}).forEach((o,s)=>{let l=i[s];l||(l=document.createElement("div"),r.appendChild(l),this.items.forEach(c=>{let d=c.cloneNode(!0);l.appendChild(d)})),this.spreadProps(l,this.api.getContentProps({index:s})),l.querySelectorAll('[data-part="item"]').forEach(c=>{this.spreadProps(c,this.api.getItemProps())})});let a=t.querySelector('[data-part="edge"][data-side="end"]');a&&this.spreadProps(a,this.api.getEdgeProps({side:"end"}))}};Kk={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=new Wk(e,y(h({},yg(e)),{onPauseChange:r=>{let i=V(e,"onPauseChange");i&&this.liveSocket.main.isConnected()&&t(i,{id:e.id,paused:r.paused});let a=V(e,"onPauseChangeClient");a&&e.dispatchEvent(new CustomEvent(a,{bubbles:!0,detail:{id:e.id,paused:r.paused}}))},onLoopComplete:()=>{let r=V(e,"onLoopComplete");r&&this.liveSocket.main.isConnected()&&t(r,{id:e.id});let i=V(e,"onLoopCompleteClient");i&&e.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:{id:e.id}}))},onComplete:()=>{let r=V(e,"onComplete");r&&this.liveSocket.main.isConnected()&&t(r,{id:e.id});let i=V(e,"onCompleteClient");i&&e.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:{id:e.id}}))}}));n.buildDom(),n.init(),this.marquee=n,this.onPause=()=>n.api.pause(),this.onResume=()=>n.api.resume(),this.onTogglePause=()=>n.api.togglePause(),e.addEventListener("corex:marquee:pause",this.onPause),e.addEventListener("corex:marquee:resume",this.onResume),e.addEventListener("corex:marquee:toggle-pause",this.onTogglePause),this.handlers=[],this.handlers.push(this.handleEvent("marquee_pause",r=>{$(e.id,H(r))&&n.api.pause()})),this.handlers.push(this.handleEvent("marquee_resume",r=>{$(e.id,H(r))&&n.api.resume()})),this.handlers.push(this.handleEvent("marquee_toggle_pause",r=>{$(e.id,H(r))&&n.api.togglePause()}))},updated(){var e;(e=this.marquee)==null||e.updateProps(yg(this.el))},destroyed(){var e;if(this.onPause&&this.el.removeEventListener("corex:marquee:pause",this.onPause),this.onResume&&this.el.removeEventListener("corex:marquee:resume",this.onResume),this.onTogglePause&&this.el.removeEventListener("corex:marquee:toggle-pause",this.onTogglePause),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.marquee)==null||e.destroy()}}});var tE={};pe(tE,{Menu:()=>vN,findImmediateParentMenuHookEl:()=>Jb});function Zk(...e){let t={};for(let n of e){if(!n)continue;for(let i in t){if(i.startsWith("on")&&typeof t[i]=="function"&&typeof n[i]=="function"){t[i]=Ct(n[i],t[i]);continue}if(i==="className"||i==="class"){t[i]=jk(t[i],n[i]);continue}if(i==="style"){t[i]=Xk(t[i],n[i]);continue}t[i]=n[i]!==void 0?n[i]:t[i]}for(let i in n)t[i]===void 0&&(t[i]=n[i]);let r=Object.getOwnPropertySymbols(n);for(let i of r)t[i]=n[i]}return t}function sN(e,t){if(!e)return;let n=ye(e),r=new n.CustomEvent(Eg,{detail:{value:t}});e.dispatchEvent(r)}function lN(e){var n;let t=vi(e);return(n=Rn(e))!=null?n:e.getDoc().getElementById(t)}function Yb(e,t){if(!Pe(e))return!1;for(let n in t){let r=t[n],i=lN(r.scope);if(i&&ge(i,e))return!0;let a=r.refs.get("children");if(Object.keys(a).length>0&&Yb(e,a))return!0}return!1}function cN(e,t){let n=Wn(e),{top:r,right:i,left:a,bottom:o}=Jh(n),[s]=t.split("-");return{top:[a,r,i,o],right:[r,i,o,a],bottom:[r,a,o,i],left:[i,r,a,o]}[s]}function Xb(e,t){let{x:n,y:r}=t,i=!1;for(let a=0,o=e.length-1;ar!=d>r&&n<(c-s)*(r-l)/(d-l)+s&&(i=!i)}return i}function qb(e){let t=e.parent;for(;t&&t.context.get("isSubmenu");)t=t.refs.get("parent");t==null||t.send({type:"CLOSE"})}function dN(e,t){return e?Xb(e,t):!1}function uN(e,t,n){let r=Object.keys(e).length>0;if(!t)return null;if(!r)return Fo(n,t);for(let i in e){let a=e[i],o=yi(a.scope);if(o===t)return o}return Fo(n,t)}function Ca(e,t){e&&(e.refs.set("pointerRoutingLocked",t),e.context.set("pointerRoutingMode",t?"locked":"interactive"))}function Zb(e){let t=e.context.get("highlightedValue");if(!t)return!1;let n=e.refs.get("children");for(let r in n){let i=n[r];if(i.state.hasTag("open")&&yi(i.scope)===t)return!0}return!1}function gN(e,t){e&&(e.refs.get("pointerRoutingLocked")||t&&Zb(e)||Ca(e,!1))}function pN(e){e&&(Zb(e)||Ca(e,!1))}function hN(e,t){let{context:n,send:r,state:i,computed:a,prop:o,scope:s}=e,l=i.hasTag("open"),c=n.get("isSubmenu"),d=a("isTypingAhead"),u=o("composite"),p=n.get("currentPlacement"),g=n.get("anchorPoint"),f=n.get("highlightedValue"),m=n.get("triggerValue"),S=Ut(y(h({},o("positioning")),{placement:g?"bottom":p}));function T(v){return{id:Fo(s,v.value),disabled:!!v.disabled,highlighted:f===v.value}}function w(v){var R;let E=(R=v.valueText)!=null?R:v.value;return y(h({},v),{id:v.value,valueText:E})}function I(v){let E=T(w(v));return y(h({},E),{checked:!!v.checked})}function P(v){let{closeOnSelect:E,valueText:R,value:x}=v,C=T(v),A=Fo(s,x);return t.element(y(h({},st.item.attrs),{id:A,role:"menuitem","aria-disabled":se(C.disabled),"data-disabled":b(C.disabled),"data-ownedby":vi(s),"data-highlighted":b(C.highlighted),"data-value":x,"data-valuetext":R,onDragStart(N){N.currentTarget.matches("a[href]")&&N.preventDefault()},onPointerMove(N){if(C.disabled||N.pointerType!=="mouse")return;let k=N.currentTarget;if(C.highlighted)return;let L=et(N);r({type:"ITEM_POINTERMOVE",id:A,target:k,closeOnSelect:E,point:L})},onPointerLeave(N){var K;if(C.disabled||N.pointerType!=="mouse"||!((K=e.event.previous())==null?void 0:K.type.includes("POINTER")))return;let L=N.currentTarget;r({type:"ITEM_POINTERLEAVE",id:A,target:L,closeOnSelect:E})},onPointerDown(N){if(C.disabled)return;let k=N.currentTarget;r({type:"ITEM_POINTERDOWN",target:k,id:A,closeOnSelect:E})},onClick(N){if(jr(N)||$n(N)||C.disabled)return;let k=N.currentTarget;r({type:"ITEM_CLICK",target:k,id:A,closeOnSelect:E})}}))}return{highlightedValue:f,open:l,setOpen(v){i.hasTag("open")!==v&&r({type:v?"OPEN":"CLOSE"})},triggerValue:m,setTriggerValue(v){r({type:"TRIGGER_VALUE.SET",value:v})},setHighlightedValue(v){r({type:"HIGHLIGHTED.SET",value:v})},setParent(v){r({type:"PARENT.SET",value:v,id:v.prop("id")})},setChild(v){r({type:"CHILD.SET",value:v,id:v.prop("id")})},reposition(v={}){r({type:"POSITIONING.SET",options:v})},addItemListener(v){let E=s.getById(v.id);if(!E)return;let R=()=>{var x;return(x=v.onSelect)==null?void 0:x.call(v)};return E.addEventListener(Eg,R),()=>E.removeEventListener(Eg,R)},getContextTriggerProps(v={}){let{value:E}=v,R=E==null?!1:m===E,x=bg(s,E);return t.element(y(h({},st.contextTrigger.attrs),{dir:o("dir"),id:x,"data-ownedby":s.id,"data-value":E,"data-current":b(R),"data-state":l?"open":"closed",onPointerDown(C){if(C.pointerType==="mouse")return;let A=et(C);r({type:"CONTEXT_MENU_START",point:A,value:E})},onPointerCancel(C){C.pointerType!=="mouse"&&r({type:"CONTEXT_MENU_CANCEL"})},onPointerMove(C){C.pointerType!=="mouse"&&r({type:"CONTEXT_MENU_CANCEL"})},onPointerUp(C){C.pointerType!=="mouse"&&r({type:"CONTEXT_MENU_CANCEL"})},onContextMenu(C){let A=et(C),N=l&&E!=null&&!R;r({type:N?"TRIGGER_VALUE.SET":"CONTEXT_MENU",point:A,value:E}),C.preventDefault()},style:{WebkitTouchCallout:"none",WebkitUserSelect:"none",userSelect:"none"}}))},getTriggerItemProps(v){let E=v.getTriggerProps();return Zk(P({value:E.id}),E)},getTriggerProps(v={}){let{value:E}=v,R=E==null?!1:m===E,x=yi(s,E);return t.button(y(h(y(h({},c?st.triggerItem.attrs:st.trigger.attrs),{"data-placement":n.get("currentPlacement"),type:"button",dir:o("dir"),id:x}),E!=null&&{"data-ownedby":s.id,"data-value":E,"data-current":b(R)}),{"data-uid":o("id"),"aria-haspopup":u?"menu":"dialog","aria-controls":vi(s),"data-controls":vi(s),"aria-expanded":E==null?l:l&&R,"data-state":l?"open":"closed",onPointerMove(C){if(C.pointerType!=="mouse"||uc(C.currentTarget)||!c)return;let N=et(C);r({type:"TRIGGER_POINTERMOVE",target:C.currentTarget,point:N})},onPointerLeave(C){if(uc(C.currentTarget)||C.pointerType!=="mouse"||!c)return;Ca(e.refs.get("parent"),!0);let A=et(C);r({type:"TRIGGER_POINTERLEAVE",target:C.currentTarget,point:A})},onPointerDown(C){uc(C.currentTarget)||pr(C)||C.preventDefault()},onClick(C){if(C.defaultPrevented||uc(C.currentTarget))return;let A=l&&E!=null&&!R;r({type:A?"TRIGGER_VALUE.SET":"TRIGGER_CLICK",target:C.currentTarget,value:E})},onBlur(){r({type:"TRIGGER_BLUR"})},onFocus(){r({type:"TRIGGER_FOCUS"})},onKeyDown(C){if(C.defaultPrevented)return;let A={ArrowDown(){r({type:"ARROW_DOWN",value:E})},ArrowUp(){r({type:"ARROW_UP",value:E})},Enter(){r({type:"ARROW_DOWN",src:"enter",value:E})},Space(){r({type:"ARROW_DOWN",src:"space",value:E})}},N=me(C,{orientation:"vertical",dir:o("dir")}),k=A[N];k&&(C.preventDefault(),k(C))}}))},getIndicatorProps(){return t.element(y(h({},st.indicator.attrs),{dir:o("dir"),"data-state":l?"open":"closed"}))},getPositionerProps(){return t.element(y(h({},st.positioner.attrs),{dir:o("dir"),id:Kb(s),style:S.floating}))},getArrowProps(){return t.element(y(h({id:Jk(s)},st.arrow.attrs),{dir:o("dir"),style:S.arrow}))},getArrowTipProps(){return t.element(y(h({},st.arrowTip.attrs),{dir:o("dir"),style:S.arrowTip}))},getContentProps(){return t.element(y(h({},st.content.attrs),{id:vi(s),"aria-label":o("aria-label"),hidden:!l,"data-state":l?"open":"closed",role:u?"menu":"dialog",tabIndex:0,dir:o("dir"),"aria-activedescendant":a("highlightedId")||void 0,"aria-labelledby":g?bg(s,m!=null?m:void 0):yi(s,m!=null?m:void 0),"data-placement":p,onPointerEnter(v){v.pointerType==="mouse"&&r({type:"MENU_POINTERENTER"})},onKeyDown(v){if(v.defaultPrevented||!ge(v.currentTarget,ne(v)))return;let E=ne(v);if(!((E==null?void 0:E.closest("[role=menu]"))===v.currentTarget||E===v.currentTarget))return;if(v.key==="Tab"&&!Ns(v)){v.preventDefault();return}let x={ArrowDown(){r({type:"ARROW_DOWN"})},ArrowUp(){r({type:"ARROW_UP"})},ArrowLeft(){r({type:"ARROW_LEFT"})},ArrowRight(){r({type:"ARROW_RIGHT"})},Enter(){r({type:"ENTER"})},Space(N){var k;d?r({type:"TYPEAHEAD",key:N.key}):(k=x.Enter)==null||k.call(x,N)},Home(){r({type:"HOME"})},End(){r({type:"END"})}},C=me(v,{dir:o("dir")}),A=x[C];if(A){A(v),v.stopPropagation(),v.preventDefault();return}o("typeahead")&&ph(v)&&(Be(v)||$t(E)||(r({type:"TYPEAHEAD",key:v.key}),v.preventDefault()))}}))},getSeparatorProps(){return t.element(y(h({},st.separator.attrs),{role:"separator",dir:o("dir"),"aria-orientation":"horizontal"}))},getItemState:T,getItemProps:P,getOptionItemState:I,getOptionItemProps(v){let{type:E,disabled:R,closeOnSelect:x}=v,C=w(v),A=I(v);return h(h({},P(C)),t.element(y(h({"data-type":E},st.item.attrs),{dir:o("dir"),"data-value":C.value,role:`menuitem${E}`,"aria-checked":!!A.checked,"data-state":A.checked?"checked":"unchecked",onClick(N){if(R||jr(N)||$n(N))return;let k=N.currentTarget;r({type:"ITEM_CLICK",target:k,option:C,closeOnSelect:x})}})))},getItemIndicatorProps(v){let E=I(Jc(v)),R=E.checked?"checked":"unchecked";return t.element(y(h({},st.itemIndicator.attrs),{dir:o("dir"),"data-disabled":b(E.disabled),"data-highlighted":b(E.highlighted),"data-state":at(v,"checked")?R:void 0,hidden:at(v,"checked")?!E.checked:void 0}))},getItemTextProps(v){let E=I(Jc(v)),R=E.checked?"checked":"unchecked";return t.element(y(h({},st.itemText.attrs),{dir:o("dir"),"data-disabled":b(E.disabled),"data-highlighted":b(E.highlighted),"data-state":at(v,"checked")?R:void 0}))},getItemGroupLabelProps(v){return t.element(y(h({},st.itemGroupLabel.attrs),{id:Hb(s,v.htmlFor),dir:o("dir")}))},getItemGroupProps(v){return t.element(y(h({id:Qk(s,v.id)},st.itemGroup.attrs),{dir:o("dir"),"aria-labelledby":Hb(s,v.id),role:"group"}))}}}function Jb(e){let t=e.parentElement;for(;t;){if(t.getAttribute("phx-hook")==="Menu")return t;t=t.parentElement}return null}function Pg(e){e.renderSubmenuTriggers();for(let t of e.children)Pg(t)}function Qb(e){let t=e.el;e.updateProps({id:t.id.replace(/^menu:/,""),closeOnSelect:O(t,"closeOnSelect"),loopFocus:O(t,"loopFocus"),typeahead:O(t,"typeahead"),composite:O(t,"composite"),defaultHighlightedValue:V(t,"defaultHighlightedValue"),dir:q(t),positioning:qe(t)});for(let n of e.children)Qb(n)}function eE(e){for(let t of[...e.children])eE(t),t.destroy()}var zk,st,jk,Yk,$b,Xk,yi,bg,vi,Jk,Kb,Qk,Fo,mi,Hb,Rn,Bb,zb,eN,tN,jb,Gb,dc,Mo,nN,rN,Sg,iN,aN,oN,uc,Ub,Eg,Jt,Ta,fN,mN,Wb,vN,nE=ee(()=>{"use strict";Qs();ii();Or();on();xr();da();yn();be();oe();zk=z("menu").parts("arrow","arrowTip","content","contextTrigger","indicator","item","itemGroup","itemGroupLabel","itemIndicator","itemText","positioner","separator","trigger","triggerItem"),st=zk.build(),jk=(...e)=>e.map(t=>{var n;return(n=t==null?void 0:t.trim)==null?void 0:n.call(t)}).filter(Boolean).join(" "),Yk=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g,$b=e=>{let t={},n;for(;n=Yk.exec(e);)t[n[1]]=n[2];return t},Xk=(e,t)=>{if(Ga(e)){if(Ga(t))return`${e};${t}`;e=$b(e)}else Ga(t)&&(t=$b(t));return Object.assign({},e!=null?e:{},t!=null?t:{})};yi=(e,t)=>{var r;let n=(r=e.ids)==null?void 0:r.trigger;return n!=null?Qe(n)?n(t):n:t?`menu:${e.id}:trigger:${t}`:`menu:${e.id}:trigger`},bg=(e,t)=>{var r;let n=(r=e.ids)==null?void 0:r.contextTrigger;return n!=null?Qe(n)?n(t):n:t?`menu:${e.id}:ctx-trigger:${t}`:`menu:${e.id}:ctx-trigger`},vi=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`menu:${e.id}:content`},Jk=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.arrow)!=null?n:`menu:${e.id}:arrow`},Kb=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`menu:${e.id}:popper`},Qk=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.group)==null?void 0:r.call(n,t))!=null?i:`menu:${e.id}:group:${t}`},Fo=(e,t)=>`${e.id}/${t}`,mi=e=>{var t;return(t=e==null?void 0:e.dataset.value)!=null?t:null},Hb=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.groupLabel)==null?void 0:r.call(n,t))!=null?i:`menu:${e.id}:group-label:${t}`},Rn=e=>e.getById(vi(e)),Bb=e=>e.getById(Kb(e)),zb=e=>e.getById(yi(e)),eN=(e,t)=>t?e.getById(Fo(e,t)):null,tN=e=>e.getById(bg(e)),jb=e=>Oe(e.getDoc(),`[data-scope="menu"][data-part="trigger"][data-ownedby="${e.id}"]`),Gb=e=>Oe(e.getDoc(),`[data-scope="menu"][data-part="context-trigger"][data-ownedby="${e.id}"]`),dc=(e,t)=>{var n;return t==null?(n=zb(e))!=null?n:jb(e)[0]:e.getById(yi(e,t))},Mo=e=>{let n=`[role^="menuitem"][data-ownedby=${CSS.escape(vi(e))}]:not([data-disabled])`;return Oe(Rn(e),n)},nN=e=>Dt(Mo(e)),rN=e=>en(Mo(e)),Sg=(e,t)=>t?e.id===t||e.dataset.value===t:!1,iN=(e,t)=>{var i;let n=Mo(e),r=n.findIndex(a=>Sg(a,t.value));return Wp(n,r,{loop:(i=t.loop)!=null?i:t.loopFocus})},aN=(e,t)=>{var i;let n=Mo(e),r=n.findIndex(a=>Sg(a,t.value));return Kp(n,r,{loop:(i=t.loop)!=null?i:t.loopFocus})},oN=(e,t)=>{var i;let n=Mo(e),r=n.find(a=>Sg(a,t.value));return ft(n,{state:t.typeaheadState,key:t.key,activeId:(i=r==null?void 0:r.id)!=null?i:null})},uc=e=>Pe(e)&&(e.dataset.disabled===""||e.hasAttribute("disabled")),Ub=e=>{var t;return!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))&&!!(e!=null&&e.hasAttribute("data-controls"))},Eg="menu:select";({not:Jt,and:Ta,or:fN}=we()),mN=te({props({props:e}){return y(h({closeOnSelect:!0,typeahead:!0,composite:!0,loopFocus:!1,navigate(t){Ui(t.node)}},e),{positioning:h({placement:"bottom-start",gutter:8},e.positioning)})},initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"idle"},context({bindable:e,prop:t,scope:n}){return{highlightedValue:e(()=>({defaultValue:t("defaultHighlightedValue")||null,value:t("highlightedValue"),onChange(r){var i;(i=t("onHighlightChange"))==null||i({highlightedValue:r})}})),lastHighlightedValue:e(()=>({defaultValue:null})),currentPlacement:e(()=>({defaultValue:void 0})),intentPolygon:e(()=>({defaultValue:null})),anchorPoint:e(()=>({defaultValue:null,hash(r){return`x: ${r==null?void 0:r.x}, y: ${r==null?void 0:r.y}`}})),isSubmenu:e(()=>({defaultValue:!1})),triggerValue:e(()=>{var r;return{defaultValue:(r=t("defaultTriggerValue"))!=null?r:null,value:t("triggerValue"),onChange(i){let a=t("onTriggerValueChange");if(!a)return;let o=dc(n,i);a({value:i,triggerElement:o})}}}),pointerRoutingMode:e(()=>({defaultValue:"interactive"}))}},refs(){return{parent:null,children:{},pointerRoutingLocked:!1,typeaheadState:h({},ft.defaultOptions),positioningOverride:{}}},computed:{isRtl:({prop:e})=>e("dir")==="rtl",isTypingAhead:({refs:e})=>e.get("typeaheadState").keysSoFar!=="",highlightedId:({context:e,scope:t,refs:n})=>uN(n.get("children"),e.get("highlightedValue"),t)},watch({track:e,action:t,context:n,prop:r}){e([()=>n.get("isSubmenu")],()=>{t(["setSubmenuPlacement"])}),e([()=>n.hash("anchorPoint")],()=>{n.get("anchorPoint")&&t(["reposition"])}),e([()=>r("open")],()=>{t(["toggleVisibility"])})},on:{"TRIGGER_VALUE.SET":{actions:["setTriggerValue","setAnchorPoint","reposition","focusMenu"]},"PARENT.SET":{actions:["setParentMenu"]},"CHILD.SET":{actions:["setChildMenu"]},OPEN:[{guard:"isOpenControlled",actions:["setTriggerValue","invokeOnOpen"]},{target:"open",actions:["setTriggerValue","invokeOnOpen"]}],OPEN_AUTOFOCUS:[{guard:"isOpenControlled",actions:["setTriggerValue","invokeOnOpen"]},{target:"open",actions:["setTriggerValue","highlightFirstItem","invokeOnOpen"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose","releaseParentRoutingLock"]},{target:"closed",actions:["invokeOnClose","releaseParentRoutingLock","focusTrigger"]}],"HIGHLIGHTED.RESTORE":{actions:["restoreHighlightedItem"]},"HIGHLIGHTED.SET":{actions:["setHighlightedItem"]},"HIGHLIGHTED.SUGGEST":{actions:["suggestHighlightedItem"]}},states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open"},"CONTROLLED.CLOSE":{target:"closed"},CONTEXT_MENU_START:{target:"opening:contextmenu",actions:["setAnchorPoint","setTriggerValue"]},CONTEXT_MENU:[{guard:"isOpenControlled",actions:["setAnchorPoint","setTriggerValue","invokeOnOpen"]},{target:"open",actions:["setAnchorPoint","setTriggerValue","invokeOnOpen"]}],TRIGGER_CLICK:[{guard:"isOpenControlled",actions:["invokeOnOpen","setTriggerValue"]},{target:"open",actions:["invokeOnOpen","setTriggerValue"]}],TRIGGER_FOCUS:{guard:Jt("isSubmenu"),target:"closed"},TRIGGER_POINTERMOVE:{guard:"isSubmenu",target:"opening"}}},"opening:contextmenu":{tags:["closed"],effects:["waitForLongPress"],on:{"CONTROLLED.OPEN":{target:"open"},"CONTROLLED.CLOSE":{target:"closed",actions:["focusTrigger"]},CONTEXT_MENU_CANCEL:[{guard:"isOpenControlled",actions:["invokeOnClose","releaseParentRoutingLock"]},{target:"closed",actions:["invokeOnClose","releaseParentRoutingLock","focusTrigger"]}],"LONG_PRESS.OPEN":[{guard:"isOpenControlled",actions:["setTriggerValue","invokeOnOpen"]},{target:"open",actions:["setTriggerValue","invokeOnOpen"]}]}},opening:{tags:["closed"],effects:["waitForOpenDelay"],on:{"CONTROLLED.OPEN":{target:"open"},"CONTROLLED.CLOSE":{target:"closed",actions:["focusTrigger"]},BLUR:[{guard:"isOpenControlled",actions:["invokeOnClose","releaseParentRoutingLock"]},{target:"closed",actions:["invokeOnClose","releaseParentRoutingLock","focusTrigger"]}],TRIGGER_POINTERLEAVE:[{guard:"isOpenControlled",actions:["invokeOnClose","releaseParentRoutingLock"]},{target:"closed",actions:["invokeOnClose","releaseParentRoutingLock","focusTrigger"]}],"DELAY.OPEN":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}]}},closing:{tags:["open"],effects:["trackPointerMove","trackInteractOutside","waitForCloseDelay"],on:{"CONTROLLED.OPEN":{target:"open"},"CONTROLLED.CLOSE":{target:"closed",actions:["focusParentMenu","restoreParentHighlightedItem"]},MENU_POINTERENTER:{target:"open",actions:["clearIntentPolygon"]},POINTER_MOVED_AWAY_FROM_SUBMENU:[{guard:"isOpenControlled",actions:["invokeOnClose","releaseParentRoutingLock"]},{target:"closed",actions:["focusParentMenu","restoreParentHighlightedItem"]}],"DELAY.CLOSE":[{guard:"isOpenControlled",actions:["invokeOnClose","releaseParentRoutingLock"]},{target:"closed",actions:["focusParentMenu","restoreParentHighlightedItem","invokeOnClose","releaseParentRoutingLock"]}]}},closed:{tags:["closed"],entry:["clearHighlightedItem","unlockParentOnClose","clearAnchorPoint"],on:{"CONTROLLED.OPEN":[{guard:fN("isOpenAutoFocusEvent","isArrowDownEvent"),target:"open",actions:["highlightFirstItem"]},{guard:"isArrowUpEvent",target:"open",actions:["highlightLastItem"]},{target:"open"}],CONTEXT_MENU_START:{target:"opening:contextmenu",actions:["setAnchorPoint","setTriggerValue"]},CONTEXT_MENU:[{guard:"isOpenControlled",actions:["setAnchorPoint","setTriggerValue","invokeOnOpen"]},{target:"open",actions:["setAnchorPoint","setTriggerValue","invokeOnOpen"]}],TRIGGER_CLICK:[{guard:"isOpenControlled",actions:["invokeOnOpen","setTriggerValue"]},{target:"open",actions:["invokeOnOpen","setTriggerValue"]}],TRIGGER_POINTERMOVE:{guard:"isTriggerItem",target:"opening"},TRIGGER_BLUR:{target:"idle"},ARROW_DOWN:[{guard:"isOpenControlled",actions:["setTriggerValue","invokeOnOpen"]},{target:"open",actions:["setTriggerValue","highlightFirstItem","invokeOnOpen"]}],ARROW_UP:[{guard:"isOpenControlled",actions:["setTriggerValue","invokeOnOpen"]},{target:"open",actions:["setTriggerValue","highlightLastItem","invokeOnOpen"]}]}},open:{tags:["open"],effects:["trackInteractOutside","trackFocusVisible","trackPositioning","scrollToHighlightedItem"],entry:["focusMenu","unlockParentOnOpen"],on:{"CONTROLLED.CLOSE":[{target:"closed",guard:"isArrowLeftEvent",actions:["focusParentMenu"]},{target:"closed",actions:["focusTrigger"]}],TRIGGER_CLICK:[{guard:Ta(Jt("isTriggerItem"),"isOpenControlled"),actions:["invokeOnClose","releaseParentRoutingLock"]},{guard:Jt("isTriggerItem"),target:"closed",actions:["invokeOnClose","releaseParentRoutingLock","focusTrigger"]}],CONTEXT_MENU:{actions:["setAnchorPoint","setTriggerValue","focusMenu"]},ARROW_UP:{actions:["highlightPrevItem","focusMenu"]},ARROW_DOWN:{actions:["highlightNextItem","focusMenu"]},ARROW_LEFT:[{guard:Ta("isSubmenu","isOpenControlled"),actions:["invokeOnClose","releaseParentRoutingLock"]},{guard:"isSubmenu",target:"closed",actions:["focusParentMenu","invokeOnClose","releaseParentRoutingLock"]}],HOME:{actions:["highlightFirstItem","focusMenu"]},END:{actions:["highlightLastItem","focusMenu"]},ARROW_RIGHT:{guard:"isTriggerItemHighlighted",actions:["openSubmenu"]},ENTER:[{guard:"isTriggerItemHighlighted",actions:["openSubmenu"]},{actions:["clickHighlightedItem"]}],ITEM_POINTERMOVE:[{guard:Jt("isPointerRoutingLocked"),actions:["setHighlightedItem","focusMenu","closeSiblingMenus"]},{actions:["setLastHighlightedItem","closeSiblingMenus"]}],ITEM_POINTERLEAVE:{guard:Ta(Jt("isPointerRoutingLocked"),Jt("isTriggerItem")),actions:["clearHighlightedItem"]},ITEM_CLICK:[{guard:Ta(Jt("isTriggerItemHighlighted"),Jt("isHighlightedItemEditable"),"closeOnSelect","isOpenControlled"),actions:["invokeOnSelect","setOptionState","closeRootMenu","invokeOnClose","releaseParentRoutingLock"]},{guard:Ta(Jt("isTriggerItemHighlighted"),Jt("isHighlightedItemEditable"),"closeOnSelect"),target:"closed",actions:["invokeOnSelect","setOptionState","closeRootMenu","invokeOnClose","releaseParentRoutingLock","focusTrigger"]},{guard:Ta(Jt("isTriggerItemHighlighted"),Jt("isHighlightedItemEditable")),actions:["invokeOnSelect","setOptionState"]},{actions:["setHighlightedItem"]}],TRIGGER_POINTERMOVE:{guard:"isTriggerItem",actions:["setIntentPolygon"]},TRIGGER_POINTERLEAVE:{target:"closing",actions:["setIntentPolygon"]},ITEM_POINTERDOWN:{actions:["setHighlightedItem"]},TYPEAHEAD:{actions:["highlightMatchedItem"]},FOCUS_MENU:{actions:["focusMenu"]},"POSITIONING.SET":{actions:["reposition"]}}}},implementations:{guards:{closeOnSelect:({prop:e,event:t})=>{var n;return!!((n=t==null?void 0:t.closeOnSelect)!=null?n:e("closeOnSelect"))},isTriggerItem:({event:e})=>Ub(e.target),isTriggerItemHighlighted:({event:e,scope:t,computed:n})=>{var i;let r=(i=e.target)!=null?i:t.getById(n("highlightedId"));return!!(r!=null&&r.hasAttribute("data-controls"))},isSubmenu:({context:e})=>e.get("isSubmenu"),isPointerRoutingLocked:({refs:e})=>e.get("pointerRoutingLocked"),isHighlightedItemEditable:({scope:e,computed:t})=>$t(e.getById(t("highlightedId"))),isOpenControlled:({prop:e})=>e("open")!==void 0,isArrowLeftEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="ARROW_LEFT"},isArrowUpEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="ARROW_UP"},isArrowDownEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="ARROW_DOWN"},isOpenAutoFocusEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="OPEN_AUTOFOCUS"}},effects:{waitForOpenDelay({send:e}){let t=setTimeout(()=>{e({type:"DELAY.OPEN"})},200);return()=>clearTimeout(t)},waitForCloseDelay({send:e}){let t=setTimeout(()=>{e({type:"DELAY.CLOSE"})},100);return()=>clearTimeout(t)},waitForLongPress({send:e}){let t=setTimeout(()=>{e({type:"LONG_PRESS.OPEN"})},700);return()=>clearTimeout(t)},trackFocusVisible({scope:e}){var t;return nt({root:(t=e.getRootNode)==null?void 0:t.call(e)})},trackPositioning({context:e,prop:t,scope:n,refs:r}){if(tN(n)||Gb(n).length>0)return;let a=h(h({},t("positioning")),r.get("positioningOverride"));return e.set("currentPlacement",a.placement),Xe(()=>dc(n,e.get("triggerValue")),()=>Bb(n),y(h({},a),{defer:!0,onComplete(l){e.set("currentPlacement",l.placement)}}))},trackInteractOutside({refs:e,scope:t,prop:n,context:r,send:i}){let a=()=>Rn(t),o=!0,s=l=>Gb(t).some(c=>ge(c,l));return qt(a,{type:"menu",defer:!0,exclude:[zb(t),...jb(t)].filter(Boolean),onInteractOutside:n("onInteractOutside"),onRequestDismiss:n("onRequestDismiss"),onFocusOutside(l){var d;(d=n("onFocusOutside"))==null||d(l);let c=ne(l.detail.originalEvent);if(s(c)){l.preventDefault();return}if(Yb(c,e.get("children"))){l.preventDefault();return}},onEscapeKeyDown(l){var c;(c=n("onEscapeKeyDown"))==null||c(l),r.get("isSubmenu")&&l.preventDefault(),qb({parent:e.get("parent")})},onPointerDownOutside(l){var d;(d=n("onPointerDownOutside"))==null||d(l);let c=ne(l.detail.originalEvent);if(s(c)&&l.detail.contextmenu){l.preventDefault();return}o=!l.detail.focusable},onDismiss(){i({type:"CLOSE",src:"interact-outside",restoreFocus:o})}})},trackPointerMove({context:e,scope:t,send:n,refs:r}){let i=r.get("parent");if(!i)return;Ca(i,!0);let a=t.getDoc();return ae(a,"pointermove",o=>{dN(e.get("intentPolygon"),{x:o.clientX,y:o.clientY})||(n({type:"POINTER_MOVED_AWAY_FROM_SUBMENU"}),Ca(i,!1))})},scrollToHighlightedItem({scope:e,computed:t}){let n=()=>{if(Sr()==="pointer")return;let a=e.getById(t("highlightedId")),o=Rn(e);Gn(a,{rootEl:o,block:"nearest"})};return B(()=>{Ir("virtual"),n()}),Ht(()=>Rn(e),{defer:!0,attributes:["aria-activedescendant"],callback:n})}},actions:{setAnchorPoint({context:e,event:t}){e.set("anchorPoint",n=>Ce(n,t.point)?n:t.point)},setSubmenuPlacement({context:e,computed:t,refs:n}){if(!e.get("isSubmenu"))return;let r=t("isRtl")?"left-start":"right-start";n.set("positioningOverride",{placement:r,gutter:0})},reposition({context:e,scope:t,prop:n,event:r,refs:i}){var u,p,g;let a=()=>Bb(t),o=(u=r.point)!=null?u:e.get("anchorPoint"),s=o?()=>h({width:0,height:0},o):void 0,l=h(h({},n("positioning")),i.get("positioningOverride")),c=(p=r.value)!=null?p:e.get("triggerValue");Xe(()=>dc(t,c),a,y(h(y(h({},l),{defer:!0,getAnchorRect:s}),(g=r.options)!=null?g:{}),{listeners:!1,onComplete(f){e.set("currentPlacement",f.placement)}}))},setOptionState({event:e}){if(!e.option)return;let{checked:t,onCheckedChange:n,type:r}=e.option;r==="radio"?n==null||n(!0):r==="checkbox"&&(n==null||n(!t))},clickHighlightedItem({scope:e,computed:t,prop:n,context:r}){var o;let i=e.getById(t("highlightedId"));if(!i||i.dataset.disabled)return;let a=r.get("highlightedValue");_t(i)?(o=n("navigate"))==null||o({value:a,node:i,href:i.href}):queueMicrotask(()=>i.click())},setIntentPolygon({context:e,scope:t,event:n}){let r=Rn(t),i=e.get("currentPlacement");if(!r||!i)return;let a=r.getBoundingClientRect(),o=cN(a,i);if(!o)return;let l=gm(i)==="right"?-5:5;e.set("intentPolygon",[y(h({},n.point),{x:n.point.x+l}),...o])},clearIntentPolygon({context:e}){e.set("intentPolygon",null)},clearAnchorPoint({context:e}){e.set("anchorPoint",null)},unlockParentOnOpen({refs:e,context:t,scope:n}){let r=e.get("parent");if(t.get("isSubmenu")){let i=yi(n);r==null||r.send({type:"HIGHLIGHTED.SUGGEST",value:i})}Ca(r,!1)},unlockParentOnClose({refs:e,context:t}){gN(e.get("parent"),t.get("isSubmenu"))},setHighlightedItem({context:e,event:t}){let n=t.value||mi(t.target);e.set("highlightedValue",n)},clearHighlightedItem({context:e}){e.set("highlightedValue",null)},focusMenu({scope:e}){B(()=>{let t=Rn(e),n=hr({root:t,enabled:!ge(t,e.getActiveElement()),filter(r){var i;return!((i=r.role)!=null&&i.startsWith("menuitem"))}});n==null||n.focus({preventScroll:!0})})},highlightFirstItem({context:e,scope:t}){(Rn(t)?queueMicrotask:B)(()=>{let r=nN(t);r&&e.set("highlightedValue",mi(r))})},highlightLastItem({context:e,scope:t}){(Rn(t)?queueMicrotask:B)(()=>{let r=rN(t);r&&e.set("highlightedValue",mi(r))})},highlightNextItem({context:e,scope:t,event:n,prop:r}){let i=iN(t,{loop:n.loop,value:e.get("highlightedValue"),loopFocus:r("loopFocus")});e.set("highlightedValue",mi(i))},highlightPrevItem({context:e,scope:t,event:n,prop:r}){let i=aN(t,{loop:n.loop,value:e.get("highlightedValue"),loopFocus:r("loopFocus")});e.set("highlightedValue",mi(i))},invokeOnSelect({context:e,prop:t,scope:n}){var a;let r=e.get("highlightedValue");if(r==null)return;let i=eN(n,r);sN(i,r),(a=t("onSelect"))==null||a({value:r})},focusTrigger({scope:e,context:t,event:n}){t.get("isSubmenu")||t.get("anchorPoint")||n.restoreFocus===!1||queueMicrotask(()=>{let r=dc(e,t.get("triggerValue"));r==null||r.focus({preventScroll:!0})})},highlightMatchedItem({scope:e,context:t,event:n,refs:r}){let i=oN(e,{key:n.key,value:t.get("highlightedValue"),typeaheadState:r.get("typeaheadState")});i&&t.set("highlightedValue",mi(i))},setParentMenu({refs:e,event:t,context:n}){e.set("parent",t.value),n.set("isSubmenu",!0)},setChildMenu({refs:e,event:t}){let n=e.get("children");n[t.id]=t.value,e.set("children",n)},closeSiblingMenus({refs:e,event:t,scope:n}){var o;let r=t.target;if(!Ub(r))return;let i=r==null?void 0:r.getAttribute("data-uid"),a=e.get("children");for(let s in a){if(s===i)continue;let l=a[s],c=l.context.get("intentPolygon");c&&t.point&&Xb(c,t.point)||((o=Rn(n))==null||o.focus({preventScroll:!0}),l.send({type:"CLOSE"}))}},closeRootMenu({refs:e}){qb({parent:e.get("parent")})},openSubmenu({refs:e,scope:t,computed:n}){let r=t.getById(n("highlightedId")),i=r==null?void 0:r.getAttribute("data-uid"),a=e.get("children"),o=i?a[i]:null;o==null||o.send({type:"OPEN_AUTOFOCUS"})},focusParentMenu({refs:e}){var t;(t=e.get("parent"))==null||t.send({type:"FOCUS_MENU"})},setLastHighlightedItem({context:e,event:t}){e.set("lastHighlightedValue",mi(t.target))},suggestHighlightedItem({context:e,event:t}){let n=t.value;if(n){if(e.get("highlightedValue")!=null){e.set("lastHighlightedValue",n);return}e.set("highlightedValue",n)}},restoreHighlightedItem({context:e}){let t=e.get("lastHighlightedValue");e.set("lastHighlightedValue",null),t&&e.set("highlightedValue",t)},restoreParentHighlightedItem({refs:e}){var t;(t=e.get("parent"))==null||t.send({type:"HIGHLIGHTED.RESTORE"})},invokeOnOpen({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!0})},invokeOnClose({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!1})},releaseParentRoutingLock({refs:e,context:t}){t.get("isSubmenu")&&pN(e.get("parent"))},toggleVisibility({prop:e,event:t,send:n}){n({type:e("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:t})},setTriggerValue({context:e,event:t}){t.value!==void 0&&e.set("triggerValue",t.value)}}}}),Wb=class extends X{constructor(){super(...arguments);Q(this,"children",[]);Q(this,"submenuTriggerUnsubs",[]);Q(this,"destroy",()=>{this.clearSubmenuTriggerSubscriptions(),this.el.removeAttribute("data-loading"),this.machine.stop()})}initMachine(t){return new Y(mN,t)}initApi(){return this.zagConnect(hN)}setChild(t){this.api.setChild(t.machine.service),this.children.includes(t)||this.children.push(t)}setParent(t){this.api.setParent(t.machine.service)}clearSubmenuTriggerSubscriptions(){for(let t of this.submenuTriggerUnsubs)t();this.submenuTriggerUnsubs=[]}isOwnElement(t){return t.closest('[phx-hook="Menu"]')===this.el}renderSubmenuTriggers(){this.clearSubmenuTriggerSubscriptions();let t=this.el.querySelector('[data-scope="menu"][data-part="content"]');if(!t)return;let n=t.querySelectorAll('[data-scope="menu"][data-nested-menu]');for(let r of n){if(!this.isOwnElement(r))continue;let i=r.dataset.nestedMenu;if(!i)continue;let a=this.children.find(s=>s.el.id===`menu:${i}`);if(!a)continue;let o=()=>{let s=this.api.getTriggerItemProps(a.api);this.spreadProps(r,s)};o(),this.submenuTriggerUnsubs.push(this.machine.subscribe(o)),this.submenuTriggerUnsubs.push(a.machine.subscribe(o))}}render(){let t=this.el.querySelector('[data-scope="menu"][data-part="trigger"]');t&&this.spreadProps(t,this.api.getTriggerProps());let n=this.el.querySelector('[data-scope="menu"][data-part="positioner"]'),r=this.el.querySelector('[data-scope="menu"][data-part="content"]');if(n&&r){this.spreadProps(n,this.api.getPositionerProps()),this.spreadProps(r,this.api.getContentProps()),r.style.pointerEvents="auto",n.hidden=!this.api.open;let a=!this.el.querySelector('[data-scope="menu"][data-part="trigger"]');(this.api.open||a)&&(r.querySelectorAll('[data-scope="menu"][data-part="item"]').forEach(d=>{if(!this.isOwnElement(d))return;let u=d.dataset.value;if(u){let p=d.hasAttribute("data-disabled");this.spreadProps(d,this.api.getItemProps({value:u,disabled:p||void 0}))}}),r.querySelectorAll('[data-scope="menu"][data-part="item-group"]').forEach(d=>{var g;if(!this.isOwnElement(d))return;let u=(g=d.dataset.id)!=null?g:"";if(!u)return;this.spreadProps(d,this.api.getItemGroupProps({id:u}));let p=d.querySelector('[data-scope="menu"][data-part="item-group-label"]');p&&this.spreadProps(p,this.api.getItemGroupLabelProps({htmlFor:u}))}),r.querySelectorAll('[data-scope="menu"][data-part="separator"]').forEach(d=>{this.isOwnElement(d)&&this.spreadProps(d,this.api.getSeparatorProps())}))}let i=this.el.querySelector('[data-scope="menu"][data-part="indicator"]');i&&this.spreadProps(i,this.api.getIndicatorProps())}};vN={mounted(){let e=this.el;if(e.hasAttribute("data-nested"))return;let t=this.pushEvent.bind(this),n=this.liveSocket,r=()=>l=>{var c;if(O(e,"redirect")&&l.value){let d=e.querySelector(`[data-scope="menu"][data-part="item"][data-value="${CSS.escape(l.value)}"]`);On(wn(d,l.value),{liveSocket:n})}W({el:e,canPushServer:j(n),pushEvent:t,payload:{id:e.id,value:(c=l.value)!=null?c:null},serverEventName:V(e,"onSelect"),clientEventName:V(e,"onSelectClient")})},i=new Wb(e,{id:e.id.replace(/^menu:/,""),closeOnSelect:O(e,"closeOnSelect"),loopFocus:O(e,"loopFocus"),typeahead:O(e,"typeahead"),composite:O(e,"composite"),defaultHighlightedValue:V(e,"defaultHighlightedValue"),dir:q(e),positioning:qe(e),onSelect:r(),onOpenChange:l=>{var c;W({el:e,canPushServer:j(n),pushEvent:t,payload:{id:e.id,open:(c=l.open)!=null?c:!1},serverEventName:V(e,"onOpenChange"),clientEventName:V(e,"onOpenChangeClient")})}});i.init(),this.menu=i;let a=e.querySelectorAll('[data-scope="menu"][data-nested="menu"]'),o=new Map,s=[];a.forEach(l=>{let c=l.id;if(!c)return;let d=new Wb(l,{id:c.replace(/^menu:/,""),dir:q(l),closeOnSelect:O(l,"closeOnSelect"),loopFocus:O(l,"loopFocus"),typeahead:O(l,"typeahead"),composite:O(l,"composite"),positioning:qe(l),onSelect:r()});d.init(),o.set(c,d),s.push(d)}),this.submenuWireTimer=setTimeout(()=>{this.submenuWireTimer=void 0;let l=this.menu;l&&(s.forEach(c=>{let d=c.el,u=Jb(d);if(!u)return;let p=u===e?l:o.get(u.id);p&&(p.setChild(c),c.setParent(p))}),l.children.length>0&&Pg(l))},0),this.onSetOpen=l=>{let{open:c}=l.detail;i.api.open!==c&&i.api.setOpen(c)},e.addEventListener("corex:menu:set-open",this.onSetOpen),this.handlers=[],this.handlers.push(this.handleEvent("menu_set_open",l=>{let c=l.menu_id;(!c||e.id===c||e.id===`menu:${c}`)&&i.api.setOpen(l.open)})),this.handlers.push(this.handleEvent("menu_open",()=>{this.pushEvent("menu_open_response",{open:i.api.open})}))},updated(){this.el.hasAttribute("data-nested")||this.menu&&(Qb(this.menu),this.menu.children.length>0&&Pg(this.menu))},destroyed(){if(!this.el.hasAttribute("data-nested")){if(this.submenuWireTimer!==void 0&&(clearTimeout(this.submenuWireTimer),this.submenuWireTimer=void 0),this.onSetOpen&&this.el.removeEventListener("corex:menu:set-open",this.onSetOpen),this.handlers)for(let e of this.handlers)this.removeHandleEvent(e);this.menu&&(eE(this.menu),this.menu.destroy(),this.menu=void 0)}}}});var bE={};pe(bE,{NumberInput:()=>XN,buildMachineProps:()=>yE,machineState:()=>mE,syncNumberInputValueInput:()=>$o});function Og(e,t){if(!(!e||!t.isActiveElement(e)))try{let{selectionStart:n,selectionEnd:r,value:i}=e;return n==null||r==null?void 0:{start:n,end:r,value:i}}catch(n){return}}function bN(e,t,n){if(!(!e||!n.isActiveElement(e))){if(!t){let r=e.value.length;e.setSelectionRange(r,r);return}try{let r=e.value,{start:i,end:a,value:o}=t;if(r===o){e.setSelectionRange(i,a);return}let s=rE(o,r,i),l=i===a?s:rE(o,r,a),c=Math.max(0,Math.min(s,r.length)),d=Math.max(c,Math.min(l,r.length));e.setSelectionRange(c,d)}catch(r){let i=e.value.length;e.setSelectionRange(i,i)}}}function rE(e,t,n){let r=e.slice(0,n),i=e.slice(n),a=0,o=Math.min(r.length,t.length);for(let c=0;c0&&a>=r.length)return a;if(s>=i.length)return t.length-s;if(a>0)return a;if(s>0)return t.length-s;if(n===0&&a===0&&s===0)return t.length;if(e.length>0){let c=n/e.length;return Math.round(c*t.length)}return t.length}function xN(e,t){let{state:n,send:r,prop:i,scope:a,computed:o}=e,s=n.hasTag("focus"),l=o("isDisabled"),c=!!i("readOnly"),d=!!i("required"),u=n.matches("scrubbing"),p=o("isValueEmpty"),g=i("invalid")!==void 0?!!i("invalid"):o("isOutOfRange"),f=l||!o("canIncrement")||c,m=l||!o("canDecrement")||c,S=i("translations");return{focused:s,invalid:g,empty:p,value:o("formattedValue"),valueAsNumber:o("valueAsNumber"),setValue(T){r({type:"VALUE.SET",value:T})},clearValue(){r({type:"VALUE.CLEAR"})},increment(){r({type:"VALUE.INCREMENT"})},decrement(){r({type:"VALUE.DECREMENT"})},setToMax(){r({type:"VALUE.SET",value:i("max")})},setToMin(){r({type:"VALUE.SET",value:i("min")})},focus(){var T;(T=Ei(a))==null||T.focus()},getRootProps(){return t.element(y(h({id:EN(a)},Mr.root.attrs),{dir:i("dir"),"data-disabled":b(l),"data-focus":b(s),"data-invalid":b(g),"data-scrubbing":b(u)}))},getLabelProps(){return t.label(y(h({},Mr.label.attrs),{dir:i("dir"),"data-disabled":b(l),"data-focus":b(s),"data-invalid":b(g),"data-required":b(d),"data-scrubbing":b(u),id:SN(a),htmlFor:_o(a),onClick(){B(()=>{_i(Ei(a))})}}))},getControlProps(){return t.element(y(h({},Mr.control.attrs),{dir:i("dir"),role:"group","aria-disabled":l,"data-focus":b(s),"data-disabled":b(l),"data-invalid":b(g),"data-scrubbing":b(u),"aria-invalid":se(g)}))},getValueTextProps(){return t.element(y(h({},Mr.valueText.attrs),{dir:i("dir"),"data-disabled":b(l),"data-invalid":b(g),"data-focus":b(s),"data-scrubbing":b(u)}))},getInputProps(){return t.input(y(h({},Mr.input.attrs),{dir:i("dir"),name:i("name"),form:i("form"),id:_o(a),role:"spinbutton",defaultValue:o("formattedValue"),pattern:i("formatOptions")?void 0:i("pattern"),inputMode:i("inputMode"),"aria-invalid":se(g),"data-invalid":b(g),disabled:l,"data-disabled":b(l),readOnly:c,required:i("required"),autoComplete:"off",autoCorrect:"off",spellCheck:"false",type:"text","aria-roledescription":"numberfield","aria-valuemin":i("min"),"aria-valuemax":i("max"),"aria-valuenow":Number.isNaN(o("valueAsNumber"))?void 0:o("valueAsNumber"),"aria-valuetext":o("valueText"),"data-scrubbing":b(u),onFocus(){r({type:"INPUT.FOCUS"})},onBlur(){r({type:"INPUT.BLUR"})},onInput(T){let w=Og(T.currentTarget,a);r({type:"INPUT.CHANGE",target:T.currentTarget,hint:"set",selection:w})},onBeforeInput(T){var w;try{let{selectionStart:I,selectionEnd:P,value:v}=T.currentTarget,E=v.slice(0,I)+((w=T.data)!=null?w:"")+v.slice(P);o("parser").isValidPartialNumber(E)||T.preventDefault()}catch(I){}},onKeyDown(T){if(T.defaultPrevented||c||Me(T))return;let w=Hn(T)*i("step"),P={ArrowUp(){r({type:"INPUT.ARROW_UP",step:w}),T.preventDefault()},ArrowDown(){r({type:"INPUT.ARROW_DOWN",step:w}),T.preventDefault()},Home(){Be(T)||(r({type:"INPUT.HOME"}),T.preventDefault())},End(){Be(T)||(r({type:"INPUT.END"}),T.preventDefault())},Enter(v){let E=Og(v.currentTarget,a);r({type:"INPUT.ENTER",selection:E})}}[T.key];P==null||P(T)}}))},getDecrementTriggerProps(){return t.button(y(h({},Mr.decrementTrigger.attrs),{dir:i("dir"),id:uE(a),disabled:m,"data-disabled":b(m),"aria-label":S.decrementLabel,type:"button",tabIndex:-1,"aria-controls":_o(a),"data-scrubbing":b(u),onPointerDown(T){var w;m||fe(T)&&(r({type:"TRIGGER.PRESS_DOWN",hint:"decrement",pointerType:T.pointerType}),T.pointerType==="mouse"&&T.preventDefault(),T.pointerType==="touch"&&((w=T.currentTarget)==null||w.focus({preventScroll:!0})))},onPointerUp(T){r({type:"TRIGGER.PRESS_UP",hint:"decrement",pointerType:T.pointerType})},onPointerLeave(){m||r({type:"TRIGGER.PRESS_UP",hint:"decrement"})}}))},getIncrementTriggerProps(){return t.button(y(h({},Mr.incrementTrigger.attrs),{dir:i("dir"),id:dE(a),disabled:f,"data-disabled":b(f),"aria-label":S.incrementLabel,type:"button",tabIndex:-1,"aria-controls":_o(a),"data-scrubbing":b(u),onPointerDown(T){var w;f||!fe(T)||(r({type:"TRIGGER.PRESS_DOWN",hint:"increment",pointerType:T.pointerType}),T.pointerType==="mouse"&&T.preventDefault(),T.pointerType==="touch"&&((w=T.currentTarget)==null||w.focus({preventScroll:!0})))},onPointerUp(T){r({type:"TRIGGER.PRESS_UP",hint:"increment",pointerType:T.pointerType})},onPointerLeave(T){r({type:"TRIGGER.PRESS_UP",hint:"increment",pointerType:T.pointerType})}}))},getScrubberProps(){return t.element(y(h({},Mr.scrubber.attrs),{dir:i("dir"),"data-disabled":b(l),id:PN(a),role:"presentation","data-scrubbing":b(u),onMouseDown(T){if(l||!fe(T))return;let w=et(T),P=ye(T.currentTarget).devicePixelRatio;w.x=w.x-Xi(7.5,P),w.y=w.y-Xi(7.5,P),r({type:"SCRUBBER.PRESS_DOWN",point:w}),T.preventDefault(),B(()=>{_i(Ei(a))})},style:{cursor:l?void 0:"ew-resize"}}))}}}function kN(e,t={}){let{numberingSystem:n}=t;if(n&&e.includes("-nu-")&&(e.includes("-u-")||(e+="-u-"),e+=`-nu-${n}`),t.style==="unit"&&!gc){var r;let{unit:o,unitDisplay:s="short"}=t;if(!o)throw new Error('unit option must be provided with style: "unit"');if(!(!((r=hE[o])===null||r===void 0)&&r[s]))throw new Error(`Unsupported unit ${o} with unitDisplay = ${s}`);t=y(h({},t),{style:"decimal"})}let i=e+(t?Object.entries(t).sort((o,s)=>o[0]0||Object.is(n,0):t==="exceptZero"&&(Object.is(n,-0)||Object.is(n,0)?n=Math.abs(n):r=n>0),r){let i=e.format(-n),a=e.format(n),o=i.replace(a,"").replace(/\u200e|\u061C/,"");return[...o].length!==1&&console.warn("@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case"),i.replace(a,"!!!").replace(o,"+").replace("!!!",a)}else return e.format(n)}}function Tg(e,t,n){let r=aE(e,t);if(!e.includes("-nu-")&&!r.isValidPartialNumber(n)){for(let i of DN)if(i!==r.options.numberingSystem){let a=aE(e+(e.includes("-u-")?"-nu-":"-u-nu-")+i,t);if(a.isValidPartialNumber(n))return a}}return r}function aE(e,t){let n=e+(t?Object.entries(t).sort((i,a)=>i[0]l.formatToParts(A));var p;let g=(p=(i=c.find(A=>A.type==="minusSign"))===null||i===void 0?void 0:i.value)!==null&&p!==void 0?p:"-",f=(a=d.find(A=>A.type==="plusSign"))===null||a===void 0?void 0:a.value;!f&&((r==null?void 0:r.signDisplay)==="exceptZero"||(r==null?void 0:r.signDisplay)==="always")&&(f="+");let S=(o=new Intl.NumberFormat(e,y(h({},n),{minimumFractionDigits:2,maximumFractionDigits:2})).formatToParts(.001).find(A=>A.type==="decimal"))===null||o===void 0?void 0:o.value,T=(s=c.find(A=>A.type==="group"))===null||s===void 0?void 0:s.value,w=c.filter(A=>!oE.has(A.type)).map(A=>sE(A.value)),I=u.flatMap(A=>A.filter(N=>!oE.has(N.type)).map(N=>sE(N.value))),P=[...new Set([...w,...I])].sort((A,N)=>N.length-A.length),v=P.length===0?new RegExp("[\\p{White_Space}]","gu"):new RegExp(`${P.join("|")}|[\\p{White_Space}]`,"gu"),E=[...new Intl.NumberFormat(n.locale,{useGrouping:!1}).format(9876543210)].reverse(),R=new Map(E.map((A,N)=>[A,N])),x=new RegExp(`[${E.join("")}]`,"g");return{minusSign:g,plusSign:f,decimal:S,group:T,literals:v,numeral:x,index:A=>String(R.get(A))}}function wa(e,t,n){return e.replaceAll?e.replaceAll(t,n):e.split(t).join(n)}function sE(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mE(e){return{focused:e.focused,invalid:e.invalid,empty:e.empty,value:e.value,valueAsNumber:e.valueAsNumber}}function vE(e,t){var r;let n=(r=U(e,"step"))!=null?r:1;return!Number.isFinite(t)||Number.isNaN(t)?"":no(t,n)}function zN(e){var t,n;return(n=(t=V(e,"value"))!=null?t:V(e,"defaultValue"))!=null?n:""}function jN(e,t,n){var o;let r=(o=U(e,"step"))!=null?o:1;if(n!==void 0&&Number.isFinite(n)&&!Number.isNaN(n))return vE(e,n);let i=zN(e);if(i!=="")return no(i,r);let a=(t!=null?t:"").replace(/,/g,"");return a===""?"":no(a,r)}function $o(e,t,n=!1,r){let i=e.querySelector('[data-scope="number-input"][data-part="value-input"]');if(!i)return;let a=jN(e,t,r),o=i.value!==a;o&&(i.value=a),it(i,e),n&&(o||a!=="")&&(Wt(i),i.dispatchEvent(new Event("input",{bubbles:!0})),i.dispatchEvent(new Event("change",{bubbles:!0})))}function wg(e,t){var i;let n=(i=U(e.el,"step"))!=null?i:1;if(typeof t=="number"){if(Number.isNaN(t))return;e.machine.service.send({type:"VALUE.SET",value:Jr(t,n)});return}let r=t.trim();r!==""&&e.machine.service.send({type:"VALUE.SET",value:r})}function yE(e,t,n){var i;let r=(i=U(e,"step"))!=null?i:1;return y(h({id:e.id},Ws(e)),{min:U(e,"min"),max:U(e,"max"),step:r,formatOptions:$s(r),disabled:O(e,"disabled"),readOnly:O(e,"readonly"),invalid:O(e,"invalid"),required:O(e,"required"),allowMouseWheel:O(e,"allowMouseWheel"),dir:q(e),onValueChange:a=>{var o;a.value!==void 0&&$o(e,(o=a.value)!=null?o:"",!0,a.valueAsNumber),W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,value:a.value,valueAsNumber:a.valueAsNumber},serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})}})}function YN(e){var n;let t=(n=U(e,"step"))!=null?n:1;return{id:e.id,min:U(e,"min"),max:U(e,"max"),step:t,formatOptions:$s(t),disabled:O(e,"disabled"),readOnly:O(e,"readonly"),invalid:O(e,"invalid"),required:O(e,"required"),allowMouseWheel:O(e,"allowMouseWheel"),dir:q(e)}}var yN,Mr,EN,_o,dE,uE,PN,gE,SN,Ei,IN,TN,pE,CN,wN,ON,VN,AN,Ig,Vg,gc,hE,RN,LN,DN,fE,iE,FN,oE,MN,$N,HN,Cg,bi,BN,GN,UN,qN,lE,cE,WN,KN,XN,EE=ee(()=>{"use strict";Eo();so();Bt();Kt();$e();Ve();be();oe();yN=z("numberInput").parts("root","label","input","control","valueText","incrementTrigger","decrementTrigger","scrubber"),Mr=yN.build();EN=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`number-input:${e.id}`},_o=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`number-input:${e.id}:input`},dE=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.incrementTrigger)!=null?n:`number-input:${e.id}:inc`},uE=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.decrementTrigger)!=null?n:`number-input:${e.id}:dec`},PN=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.scrubber)!=null?n:`number-input:${e.id}:scrubber`},gE=e=>`number-input:${e.id}:cursor`,SN=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`number-input:${e.id}:label`},Ei=e=>e.getById(_o(e)),IN=e=>e.getById(dE(e)),TN=e=>e.getById(uE(e)),pE=e=>e.getDoc().getElementById(gE(e)),CN=(e,t)=>{let n=null;return t==="increment"&&(n=IN(e)),t==="decrement"&&(n=TN(e)),n},wN=(e,t)=>{if(!wt())return AN(e,t),()=>{var n;(n=pE(e))==null||n.remove()}},ON=e=>{let t=e.getDoc(),n=t.documentElement,r=t.body;return r.style.pointerEvents="none",n.style.userSelect="none",n.style.cursor="ew-resize",()=>{r.style.pointerEvents="",n.style.userSelect="",n.style.cursor="",n.style.length||n.removeAttribute("style"),r.style.length||r.removeAttribute("style")}},VN=(e,t)=>{let{point:n,isRtl:r,event:i}=t,a=e.getWin(),o=Xi(i.movementX,a.devicePixelRatio),s=Xi(i.movementY,a.devicePixelRatio),l=o>0?"increment":o<0?"decrement":null;r&&l==="increment"&&(l="decrement"),r&&l==="decrement"&&(l="increment");let c={x:n.x+o,y:n.y+s},d=a.innerWidth,u=Xi(7.5,a.devicePixelRatio);return c.x=rf(c.x+u,d)-u,{hint:l,point:c}},AN=(e,t)=>{let n=e.getDoc(),r=n.createElement("div");r.className="scrubber--cursor",r.id=gE(e),Object.assign(r.style,{width:"15px",height:"15px",position:"fixed",pointerEvents:"none",left:"0px",top:"0px",zIndex:Os,transform:t?`translate3d(${t.x}px, ${t.y}px, 0px)`:void 0,willChange:"transform"}),r.innerHTML=` - `,n.body.appendChild(r)};Ig=new Map,Vg=!1;try{Vg=new Intl.NumberFormat("de-DE",{signDisplay:"exceptZero"}).resolvedOptions().signDisplay==="exceptZero"}catch(e){}gc=!1;try{gc=new Intl.NumberFormat("de-DE",{style:"unit",unit:"degree"}).resolvedOptions().style==="unit"}catch(e){}hE={degree:{narrow:{default:"\xB0","ja-JP":" \u5EA6","zh-TW":"\u5EA6","sl-SI":" \xB0"}}},RN=class{format(e){let t="";if(!Vg&&this.options.signDisplay!=null?t=NN(this.numberFormatter,this.options.signDisplay,e):t=this.numberFormatter.format(e),this.options.style==="unit"&&!gc){var n;let{unit:r,unitDisplay:i="short",locale:a}=this.resolvedOptions();if(!r)return t;let o=(n=hE[r])===null||n===void 0?void 0:n[i];t+=o[a]||o.default}return t}formatToParts(e){return this.numberFormatter.formatToParts(e)}formatRange(e,t){if(typeof this.numberFormatter.formatRange=="function")return this.numberFormatter.formatRange(e,t);if(t= start date");return`${this.format(e)} \u2013 ${this.format(t)}`}formatRangeToParts(e,t){if(typeof this.numberFormatter.formatRangeToParts=="function")return this.numberFormatter.formatRangeToParts(e,t);if(t= start date");let n=this.numberFormatter.formatToParts(e),r=this.numberFormatter.formatToParts(t);return[...n.map(i=>y(h({},i),{source:"startRange"})),{type:"literal",value:" \u2013 ",source:"shared"},...r.map(i=>y(h({},i),{source:"endRange"}))]}resolvedOptions(){let e=this.numberFormatter.resolvedOptions();return!Vg&&this.options.signDisplay!=null&&(e=y(h({},e),{signDisplay:this.options.signDisplay})),!gc&&this.options.style==="unit"&&(e=y(h({},e),{style:"unit",unit:this.options.unit,unitDisplay:this.options.unitDisplay})),e}constructor(e,t={}){this.numberFormatter=kN(e,t),this.options=t}};LN=new RegExp("^.*\\(.*\\).*$"),DN=["latn","arab","hanidec","deva","beng","fullwide"],fE=class{parse(e){return Tg(this.locale,this.options,e).parse(e)}isValidPartialNumber(e,t,n){return Tg(this.locale,this.options,e).isValidPartialNumber(e,t,n)}getNumberingSystem(e){return Tg(this.locale,this.options,e).options.numberingSystem}constructor(e,t={}){this.locale=e,this.options=t}},iE=new Map;FN=class{parse(e){let t=this.sanitize(e);if(this.symbols.group&&(t=wa(t,this.symbols.group,"")),this.symbols.decimal&&(t=t.replace(this.symbols.decimal,".")),this.symbols.minusSign&&(t=t.replace(this.symbols.minusSign,"-")),t=t.replace(this.symbols.numeral,this.symbols.index),this.options.style==="percent"){let a=t.indexOf("-");t=t.replace("-",""),t=t.replace("+","");let o=t.indexOf(".");o===-1&&(o=t.length),t=t.replace(".",""),o-2===0?t=`0.${t}`:o-2===-1?t=`0.0${t}`:o-2===-2?t="0.00":t=`${t.slice(0,o-2)}.${t.slice(o-2)}`,a>-1&&(t=`-${t}`)}let n=t?+t:NaN;if(isNaN(n))return NaN;if(this.options.style==="percent"){var r,i;let a=y(h({},this.options),{style:"decimal",minimumFractionDigits:Math.min(((r=this.options.minimumFractionDigits)!==null&&r!==void 0?r:0)+2,20),maximumFractionDigits:Math.min(((i=this.options.maximumFractionDigits)!==null&&i!==void 0?i:0)+2,20)});return new fE(this.locale,a).parse(new RN(this.locale,a).format(n))}return this.options.currencySign==="accounting"&&LN.test(e)&&(n=-1*n),n}sanitize(e){return e=e.replace(this.symbols.literals,""),this.symbols.minusSign&&(e=e.replace("-",this.symbols.minusSign)),this.options.numberingSystem==="arab"&&(this.symbols.decimal&&(e=e.replace(",",this.symbols.decimal),e=e.replace("\u060C",this.symbols.decimal)),this.symbols.group&&(e=wa(e,".",this.symbols.group))),this.symbols.group==="\u2019"&&e.includes("'")&&(e=wa(e,"'",this.symbols.group)),this.options.locale==="fr-FR"&&this.symbols.group&&(e=wa(e," ",this.symbols.group),e=wa(e,/\u00A0/g,this.symbols.group)),e}isValidPartialNumber(e,t=-1/0,n=1/0){return e=this.sanitize(e),this.symbols.minusSign&&e.startsWith(this.symbols.minusSign)&&t<0?e=e.slice(this.symbols.minusSign.length):this.symbols.plusSign&&e.startsWith(this.symbols.plusSign)&&n>0&&(e=e.slice(this.symbols.plusSign.length)),this.symbols.group&&e.startsWith(this.symbols.group)||this.symbols.decimal&&e.indexOf(this.symbols.decimal)>-1&&this.options.maximumFractionDigits===0?!1:(this.symbols.group&&(e=wa(e,this.symbols.group,"")),e=e.replace(this.symbols.numeral,""),this.symbols.decimal&&(e=e.replace(this.symbols.decimal,"")),e.length===0)}constructor(e,t={}){this.locale=e,t.roundingIncrement!==1&&t.roundingIncrement!=null&&(t.maximumFractionDigits==null&&t.minimumFractionDigits==null?(t.maximumFractionDigits=0,t.minimumFractionDigits=0):t.maximumFractionDigits==null?t.maximumFractionDigits=t.minimumFractionDigits:t.minimumFractionDigits==null&&(t.minimumFractionDigits=t.maximumFractionDigits)),this.formatter=new Intl.NumberFormat(e,t),this.options=this.formatter.resolvedOptions(),this.symbols=_N(e,this.formatter,this.options,t);var n,r;this.options.style==="percent"&&(((n=this.options.minimumFractionDigits)!==null&&n!==void 0?n:0)>18||((r=this.options.maximumFractionDigits)!==null&&r!==void 0?r:0)>18)&&console.warn("NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.")}},oE=new Set(["decimal","fraction","integer","minusSign","plusSign","group"]),MN=[0,4,2,1,11,20,3,7,100,21,.1,1.1];$N=(e,t={})=>new Intl.NumberFormat(e,t),HN=(e,t={})=>new fE(e,t),Cg=(e,t)=>{let{prop:n,computed:r}=t;return n("formatOptions")?e===""?Number.NaN:r("parser").parse(e):parseFloat(e)},bi=(e,t)=>{let{prop:n,computed:r}=t;return Number.isNaN(e)?"":n("formatOptions")?r("formatter").format(e):e.toString()},BN=(e,t)=>{let n=e!==void 0&&!Number.isNaN(e)?e:1;return(t==null?void 0:t.style)==="percent"&&(e===void 0||Number.isNaN(e))&&(n=.01),n},{choose:UN,guards:GN,createMachine:qN}=Mt(),{not:lE,and:cE}=GN,WN=qN({props({props:e}){let t=BN(e.step,e.formatOptions);return y(h({dir:"ltr",locale:"en-US",focusInputOnChange:!0,clampValueOnBlur:!e.allowOverflow,allowOverflow:!1,inputMode:"decimal",pattern:"-?[0-9]*(.[0-9]+)?",defaultValue:"",step:t,min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,spinOnPress:!0},e),{translations:h({incrementLabel:"increment value",decrementLabel:"decrease value"},e.translations)})},initialState(){return"idle"},context({prop:e,bindable:t,getComputed:n}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(r){var o;let i=n(),a=Cg(r,{computed:i,prop:e});(o=e("onValueChange"))==null||o({value:r,valueAsNumber:a})}})),hint:t(()=>({defaultValue:null})),scrubberCursorPoint:t(()=>({defaultValue:null,hash(r){return r?`x:${r.x}, y:${r.y}`:""}})),fieldsetDisabled:t(()=>({defaultValue:!1}))}},computed:{isRtl:({prop:e})=>e("dir")==="rtl",valueAsNumber:({context:e,computed:t,prop:n})=>Cg(e.get("value"),{computed:t,prop:n}),formattedValue:({computed:e,prop:t})=>bi(e("valueAsNumber"),{computed:e,prop:t}),isAtMin:({computed:e,prop:t})=>of(e("valueAsNumber"),t("min")),isAtMax:({computed:e,prop:t})=>af(e("valueAsNumber"),t("max")),isOutOfRange:({computed:e,prop:t})=>!Yi(e("valueAsNumber"),t("min"),t("max")),isValueEmpty:({context:e})=>e.get("value")==="",isDisabled:({prop:e,context:t})=>!!e("disabled")||t.get("fieldsetDisabled"),canIncrement:({prop:e,computed:t})=>e("allowOverflow")||!t("isAtMax"),canDecrement:({prop:e,computed:t})=>e("allowOverflow")||!t("isAtMin"),valueText:({prop:e,context:t})=>{var n,r;return(r=(n=e("translations")).valueText)==null?void 0:r.call(n,t.get("value"))},formatter:Vn(({prop:e})=>[e("locale"),e("formatOptions")],([e,t])=>$N(e,t)),parser:Vn(({prop:e})=>[e("locale"),e("formatOptions")],([e,t])=>HN(e,t))},watch({track:e,action:t,context:n,computed:r,prop:i}){e([()=>n.get("value"),()=>i("locale"),()=>JSON.stringify(i("formatOptions"))],()=>{t(["syncInputElement"])}),e([()=>r("isOutOfRange")],()=>{t(["invokeOnInvalid"])}),e([()=>n.hash("scrubberCursorPoint")],()=>{t(["setVirtualCursorPosition"])})},effects:["trackFormControl"],on:{"VALUE.SET":{actions:["setRawValue"]},"VALUE.CLEAR":{actions:["clearValue"]},"VALUE.INCREMENT":{actions:["increment"]},"VALUE.DECREMENT":{actions:["decrement"]}},states:{idle:{on:{"TRIGGER.PRESS_DOWN":[{guard:"isTouchPointer",target:"before:spin",actions:["setHint"]},{target:"before:spin",actions:["focusInput","invokeOnFocus","setHint"]}],"SCRUBBER.PRESS_DOWN":{target:"scrubbing",actions:["focusInput","invokeOnFocus","setHint","setCursorPoint"]},"INPUT.FOCUS":{target:"focused",actions:["focusInput","invokeOnFocus"]}}},focused:{tags:["focus"],effects:["attachWheelListener"],on:{"TRIGGER.PRESS_DOWN":[{guard:"isTouchPointer",target:"before:spin",actions:["setHint"]},{target:"before:spin",actions:["focusInput","setHint"]}],"SCRUBBER.PRESS_DOWN":{target:"scrubbing",actions:["focusInput","setHint","setCursorPoint"]},"INPUT.ARROW_UP":{actions:["increment"]},"INPUT.ARROW_DOWN":{actions:["decrement"]},"INPUT.HOME":{actions:["decrementToMin"]},"INPUT.END":{actions:["incrementToMax"]},"INPUT.CHANGE":{actions:["setValue","setHint"]},"INPUT.BLUR":[{guard:cE("clampValueOnBlur",lE("isInRange")),target:"idle",actions:["setClampedValue","clearHint","invokeOnBlur","invokeOnValueCommit"]},{guard:lE("isInRange"),target:"idle",actions:["setFormattedValue","clearHint","invokeOnBlur","invokeOnInvalid","invokeOnValueCommit"]},{target:"idle",actions:["setFormattedValue","clearHint","invokeOnBlur","invokeOnValueCommit"]}],"INPUT.ENTER":{actions:["setFormattedValue","clearHint","invokeOnBlur","invokeOnValueCommit"]}}},"before:spin":{tags:["focus"],effects:["trackButtonDisabled","waitForChangeDelay"],entry:UN([{guard:"isIncrementHint",actions:["increment"]},{guard:"isDecrementHint",actions:["decrement"]}]),on:{CHANGE_DELAY:{target:"spinning",guard:cE("isInRange","spinOnPress")},"TRIGGER.PRESS_UP":[{guard:"isTouchPointer",target:"focused",actions:["clearHint"]},{target:"focused",actions:["focusInput","clearHint"]}]}},spinning:{tags:["focus"],effects:["trackButtonDisabled","spinValue"],on:{SPIN:[{guard:"isIncrementHint",actions:["increment"]},{guard:"isDecrementHint",actions:["decrement"]}],"TRIGGER.PRESS_UP":{target:"focused",actions:["focusInput","clearHint"]}}},scrubbing:{tags:["focus"],effects:["activatePointerLock","trackMousemove","setupVirtualCursor","preventTextSelection"],on:{"SCRUBBER.POINTER_UP":{target:"focused",actions:["focusInput","clearCursorPoint"]},"SCRUBBER.POINTER_MOVE":[{guard:"isIncrementHint",actions:["increment","setCursorPoint"]},{guard:"isDecrementHint",actions:["decrement","setCursorPoint"]}]}}},implementations:{guards:{clampValueOnBlur:({prop:e})=>e("clampValueOnBlur"),spinOnPress:({prop:e})=>!!e("spinOnPress"),isInRange:({computed:e})=>!e("isOutOfRange"),isDecrementHint:({context:e,event:t})=>{var n;return((n=t.hint)!=null?n:e.get("hint"))==="decrement"},isIncrementHint:({context:e,event:t})=>{var n;return((n=t.hint)!=null?n:e.get("hint"))==="increment"},isTouchPointer:({event:e})=>e.pointerType==="touch"},effects:{waitForChangeDelay({send:e}){let t=setTimeout(()=>{e({type:"CHANGE_DELAY"})},300);return()=>clearTimeout(t)},spinValue({send:e}){let t=setInterval(()=>{e({type:"SPIN"})},50);return()=>clearInterval(t)},trackFormControl({context:e,scope:t}){let n=Ei(t);return ht(n,{onFieldsetDisabledChange(r){e.set("fieldsetDisabled",r)},onFormReset(){e.set("value",e.initial("value"))}})},setupVirtualCursor({context:e,scope:t}){let n=e.get("scrubberCursorPoint");return wN(t,n)},preventTextSelection({scope:e}){return ON(e)},trackButtonDisabled({context:e,scope:t,send:n}){let r=e.get("hint"),i=CN(t,r);return Ht(i,{attributes:["disabled"],callback(){n({type:"TRIGGER.PRESS_UP",src:"attr"})}})},attachWheelListener({scope:e,send:t,prop:n}){let r=Ei(e);if(!r||!e.isActiveElement(r)||!n("allowMouseWheel"))return;function i(a){a.preventDefault();let o=Math.sign(a.deltaY)*-1;o===1?t({type:"VALUE.INCREMENT"}):o===-1&&t({type:"VALUE.DECREMENT"})}return ae(r,"wheel",i,{passive:!1})},activatePointerLock({scope:e}){if(!wt())return Ph(e.getDoc())},trackMousemove({scope:e,send:t,context:n,computed:r}){let i=e.getDoc();function a(s){let l=n.get("scrubberCursorPoint"),c=r("isRtl"),d=VN(e,{point:l,isRtl:c,event:s});d.hint&&t({type:"SCRUBBER.POINTER_MOVE",hint:d.hint,point:d.point})}function o(){t({type:"SCRUBBER.POINTER_UP"})}return Ct(ae(i,"mousemove",a,!1),ae(i,"mouseup",o,!1))}},actions:{focusInput({scope:e,prop:t}){if(!t("focusInputOnChange"))return;let n=Ei(e);e.isActiveElement(n)||B(()=>n==null?void 0:n.focus({preventScroll:!0}))},increment({context:e,event:t,prop:n,computed:r}){var a;let i=df(r("valueAsNumber"),(a=t.step)!=null?a:n("step"));n("allowOverflow")||(i=Ae(i,n("min"),n("max"))),e.set("value",bi(i,{computed:r,prop:n}))},decrement({context:e,event:t,prop:n,computed:r}){var a;let i=uf(r("valueAsNumber"),(a=t.step)!=null?a:n("step"));n("allowOverflow")||(i=Ae(i,n("min"),n("max"))),e.set("value",bi(i,{computed:r,prop:n}))},setClampedValue({context:e,prop:t,computed:n}){let r=Ae(n("valueAsNumber"),t("min"),t("max"));e.set("value",bi(r,{computed:n,prop:t}))},setRawValue({context:e,event:t,prop:n,computed:r}){let i=Cg(t.value,{computed:r,prop:n});n("allowOverflow")||(i=Ae(i,n("min"),n("max"))),e.set("value",bi(i,{computed:r,prop:n}))},setValue({context:e,event:t}){var r,i;let n=(i=(r=t.target)==null?void 0:r.value)!=null?i:t.value;e.set("value",n)},clearValue({context:e}){e.set("value","")},incrementToMax({context:e,prop:t,computed:n}){let r=bi(t("max"),{computed:n,prop:t});e.set("value",r)},decrementToMin({context:e,prop:t,computed:n}){let r=bi(t("min"),{computed:n,prop:t});e.set("value",r)},setHint({context:e,event:t}){e.set("hint",t.hint)},clearHint({context:e}){e.set("hint",null)},invokeOnFocus({computed:e,prop:t}){var n;(n=t("onFocusChange"))==null||n({focused:!0,value:e("formattedValue"),valueAsNumber:e("valueAsNumber")})},invokeOnBlur({computed:e,prop:t}){var n;(n=t("onFocusChange"))==null||n({focused:!1,value:e("formattedValue"),valueAsNumber:e("valueAsNumber")})},invokeOnInvalid({computed:e,prop:t,event:n}){var i;if(n.type==="INPUT.CHANGE")return;let r=e("valueAsNumber")>t("max")?"rangeOverflow":"rangeUnderflow";(i=t("onValueInvalid"))==null||i({reason:r,value:e("formattedValue"),valueAsNumber:e("valueAsNumber")})},invokeOnValueCommit({computed:e,prop:t}){var n;(n=t("onValueCommit"))==null||n({value:e("formattedValue"),valueAsNumber:e("valueAsNumber")})},syncInputElement({context:e,event:t,computed:n,scope:r}){var s;let i=t.type.endsWith("CHANGE")?e.get("value"):n("formattedValue"),a=Ei(r),o=(s=t.selection)!=null?s:Og(a,r);B(()=>{_e(a,i),bN(a,o,r)})},setFormattedValue({context:e,computed:t,action:n}){e.set("value",t("formattedValue")),n(["syncInputElement"])},setCursorPoint({context:e,event:t}){e.set("scrubberCursorPoint",t.point)},clearCursorPoint({context:e}){e.set("scrubberCursorPoint",null)},setVirtualCursorPosition({context:e,scope:t}){let n=pE(t),r=e.get("scrubberCursorPoint");!n||!r||(n.style.transform=`translate3d(${r.x}px, ${r.y}px, 0px)`)}}}}),KN=class extends X{initMachine(e){return new Y(WN,e)}initApi(){return this.zagConnect(xN)}render(){var l,c,d,g,p;let e=(l=this.el.querySelector('[data-scope="number-input"][data-part="root"]'))!=null?l:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="number-input"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-scope="number-input"][data-part="control"]');n&&this.spreadProps(n,this.api.getControlProps());let r=this.el.querySelector('[data-scope="number-input"][data-part="value-text"]');r&&this.spreadProps(r,this.api.getValueTextProps());let i=this.el.querySelector('[data-scope="number-input"][data-part="input"]');if(i instanceof HTMLInputElement){let u=h({},this.api.getInputProps());delete u.name,delete u.form,this.spreadProps(i,u);let f=(c=this.api.value)!=null?c:"";i.value!==f&&(i.value=f)}let a=this.el.querySelector('[data-scope="number-input"][data-part="decrement-trigger"]');a&&this.spreadProps(a,this.api.getDecrementTriggerProps());let o=this.el.querySelector('[data-scope="number-input"][data-part="increment-trigger"]');o&&this.spreadProps(o,this.api.getIncrementTriggerProps());let s=this.el.querySelector('[data-scope="number-input"][data-part="value-input"]');if(s instanceof HTMLInputElement){let u=(d=G(this.el,"step"))!=null?d:1,f=this.api.valueAsNumber,m=(p=(g=V(this.el,"value"))!=null?g:V(this.el,"defaultValue"))!=null?p:"",S=Number.isFinite(f)&&!Number.isNaN(f)?no(f,u):m;Er(s,this.el,S,(T,w)=>this.spreadProps(T,w),{})}}};XN={mounted(){var c,d,g;let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=new KN(e,yE(e,t,n));r.init(),this.numberInput=r,this.lastServerValue=(d=(c=V(e,"value"))!=null?c:V(e,"defaultValue"))!=null?d:void 0;let i=vE(e,r.api.valueAsNumber);$o(e,(g=r.api.value)!=null?g:"",!0,r.api.valueAsNumber);let a=e.querySelector('[data-scope="number-input"][data-part="value-input"]');a&&Vr(a,()=>i);let o=p=>{let u=mE(r.api);Ue({respondTo:p,canPushServer:n(),pushEvent:t,serverEventName:"number_input_state_response",serverPayload:h({id:e.id},u),el:e,domEventName:"number-input-state",domDetail:h({id:e.id},u)})},s=ie(e);this.domRegistry=s,s.add("corex:number-input:set-value",p=>{var f;let u=(f=p.detail)==null?void 0:f.value;(typeof u=="number"&&!Number.isNaN(u)||typeof u=="string")&&wg(r,u)}),s.add("corex:number-input:clear-value",()=>{r.api.clearValue()}),s.add("corex:number-input:increment",()=>{r.api.increment()}),s.add("corex:number-input:decrement",()=>{r.api.decrement()}),s.add("corex:number-input:set-to-min",()=>{r.api.setToMin()}),s.add("corex:number-input:set-to-max",()=>{r.api.setToMax()}),s.add("corex:number-input:focus",()=>{r.api.focus()}),s.add("corex:number-input:state",p=>{o(de(p.detail))});let l=re(this);this.handleRegistry=l,l.add("number_input_set_value",p=>{$(e.id,H(p))&&typeof p.value=="number"&&!Number.isNaN(p.value)&&wg(r,p.value)}),l.add("number_input_clear_value",p=>{$(e.id,H(p))&&r.api.clearValue()}),l.add("number_input_increment",p=>{$(e.id,H(p))&&r.api.increment()}),l.add("number_input_decrement",p=>{$(e.id,H(p))&&r.api.decrement()}),l.add("number_input_set_to_min",p=>{$(e.id,H(p))&&r.api.setToMin()}),l.add("number_input_set_to_max",p=>{$(e.id,H(p))&&r.api.setToMax()}),l.add("number_input_focus",p=>{$(e.id,H(p))&&r.api.focus()}),l.add("number_input_state",p=>{$(e.id,H(p))&&o(de(p))})},updated(){let e=this.el,t=this.numberInput,n=qs(e,this.lastServerValue);n.nextServerValue!==void 0&&(this.lastServerValue=n.nextServerValue);let r=h({},n);delete r.nextServerValue,t==null||t.updateProps(h(h({},YN(e)),r)),queueMicrotask(()=>{var o,s,l;t&&"value"in r?$o(e,String((o=r.value)!=null?o:""),!1,t.api.valueAsNumber):t&&$o(e,(l=(s=t.api.value)!=null?s:V(e,"defaultValue"))!=null?l:"",!1,t.api.valueAsNumber);let i=e.querySelector('[data-scope="number-input"][data-part="input"]');i&&(O(e,"readonly")||(i.readOnly=!1,i.removeAttribute("readonly")),O(e,"disabled")||(i.disabled=!1,i.removeAttribute("disabled"))),e.querySelectorAll('[data-scope="number-input"][data-part="increment-trigger"], [data-scope="number-input"][data-part="decrement-trigger"]').forEach(c=>{c.hasAttribute("data-disabled")||(c.disabled=!1,c.removeAttribute("disabled"))})})},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.numberInput)==null||n.destroy()}}});var CE={};pe(CE,{Pagination:()=>vL,readPayloadPage:()=>SE,readPayloadPageSize:()=>IE});function lL(e,t){let{send:n,scope:r,prop:i,computed:a,context:o}=e,s=a("totalPages"),l=o.get("page"),c=o.get("pageSize"),d=i("translations"),g=i("count"),p=i("getPageUrl"),u=i("type"),f=a("previousPage"),m=a("nextPage"),S=a("pageRange"),T=l===1,w=l>=s,I=sL({page:l,totalPages:s,siblingCount:i("siblingCount"),boundaryCount:i("boundaryCount")});return{count:g,page:l,pageSize:c,totalPages:s,pages:I,previousPage:f,nextPage:m,pageRange:S,slice(P){return P.slice(S.start,S.end)},setPageSize(P){n({type:"SET_PAGE_SIZE",size:P})},setPage(P){n({type:"SET_PAGE",page:P})},goToNextPage(){n({type:"NEXT_PAGE"})},goToPrevPage(){n({type:"PREVIOUS_PAGE"})},goToFirstPage(){n({type:"FIRST_PAGE"})},goToLastPage(){n({type:"LAST_PAGE"})},getRootProps(){return t.element(y(h({id:JN(r)},Pi.root.attrs),{dir:i("dir"),"aria-label":d.rootLabel}))},getEllipsisProps(P){return t.element(y(h({id:rL(r,P.index)},Pi.ellipsis.attrs),{dir:i("dir")}))},getItemProps(P){var R;let v=P.value,E=v===l;return t.element(h(h(y(h({id:iL(r,v)},Pi.item.attrs),{dir:i("dir"),"data-index":v,"data-selected":b(E),"aria-current":E?"page":void 0,"aria-label":(R=d.itemLabel)==null?void 0:R.call(d,{page:v,totalPages:s}),onClick(){n({type:"SET_PAGE",page:v})}}),u==="button"&&{type:"button"}),u==="link"&&p&&{href:p({page:v,pageSize:c})}))},getPrevTriggerProps(){return t.element(h(h(y(h({id:eL(r)},Pi.prevTrigger.attrs),{dir:i("dir"),"data-disabled":b(T),"aria-label":d.prevTriggerLabel,onClick(){n({type:"PREVIOUS_PAGE"})}}),u==="button"&&{disabled:T,type:"button"}),u==="link"&&p&&f&&{href:p({page:f,pageSize:c})}))},getFirstTriggerProps(){return t.element(h(h(y(h({id:QN(r)},Pi.firstTrigger.attrs),{dir:i("dir"),"data-disabled":b(T),"aria-label":d.firstTriggerLabel,onClick(){n({type:"FIRST_PAGE"})}}),u==="button"&&{disabled:T,type:"button"}),u==="link"&&p&&{href:p({page:1,pageSize:c})}))},getNextTriggerProps(){return t.element(h(h(y(h({id:tL(r)},Pi.nextTrigger.attrs),{dir:i("dir"),"data-disabled":b(w),"aria-label":d.nextTriggerLabel,onClick(){n({type:"NEXT_PAGE"})}}),u==="button"&&{disabled:w,type:"button"}),u==="link"&&p&&m&&{href:p({page:m,pageSize:c})}))},getLastTriggerProps(){return t.element(h(h(y(h({id:nL(r)},Pi.lastTrigger.attrs),{dir:i("dir"),"data-disabled":b(w),"aria-label":d.lastTriggerLabel,onClick(){n({type:"LAST_PAGE"})}}),u==="button"&&{disabled:w,type:"button"}),u==="link"&&p&&{href:p({page:s,pageSize:c})}))}}}function uL(e,t){var r;let n=((r=t==null?void 0:t.rootLabel)==null?void 0:r.trim())||"Pagination";return y(h({},t),{rootLabel:`${n} (${e.id})`})}function gL(e){let t=e.dataset.translation;if(t)try{let n=JSON.parse(t),r={};if(typeof n.rootLabel=="string"&&n.rootLabel.length>0&&(r.rootLabel=n.rootLabel),typeof n.prevTriggerLabel=="string"&&n.prevTriggerLabel.length>0&&(r.prevTriggerLabel=n.prevTriggerLabel),typeof n.nextTriggerLabel=="string"&&n.nextTriggerLabel.length>0&&(r.nextTriggerLabel=n.nextTriggerLabel),typeof n.itemLabel=="string"&&n.itemLabel.length>0){let i=n.itemLabel;r.itemLabel=a=>i.replace("%{page}",String(a.page)).replace("%{total_pages}",String(a.totalPages))}return Object.keys(r).length>0?r:void 0}catch(n){return}}function PE(e,t){if(V(e,"type")!=="link"||t.tagName!=="A")return;let n=V(e,"redirect",["href","patch","navigate"]);n==="patch"?(t.setAttribute("data-phx-link","patch"),t.setAttribute("data-phx-link-state","push")):n==="navigate"?(t.setAttribute("data-phx-link","redirect"),t.setAttribute("data-phx-link-state","push")):(t.removeAttribute("data-phx-link"),t.removeAttribute("data-phx-link-state"))}function pL(e){let t=['[data-scope="pagination"][data-part="item"]','[data-scope="pagination"][data-part="prev-trigger"]','[data-scope="pagination"][data-part="next-trigger"]'];for(let n of t)e.querySelectorAll(n).forEach(r=>{PE(e,r)})}function hL(e){var a,o;let t=V(e,"type"),n=e.dataset.to;if(t!=="link"||!n)return;let r=(a=e.dataset.pageParam)!=null?a:"page",i=(o=e.dataset.pageSizeParam)!=null?o:"page_size";return({page:s,pageSize:l})=>{let c=n.includes("?")?"&":"?";return`${n}${c}${encodeURIComponent(r)}=${s}&${encodeURIComponent(i)}=${l}`}}function SE(e){var r;if(!e||typeof e!="object")return;let t=e,n=(r=t.page)!=null?r:t.page;return typeof n=="number"?n:void 0}function IE(e){var r,i;if(!e||typeof e!="object")return;let t=e,n=(i=(r=t.page_size)!=null?r:t.pageSize)!=null?i:t.page_size;return typeof n=="number"?n:void 0}function TE(e,t,n){var a,o;let r=(a=V(e,"type",["button","link"]))!=null?a:"button",i=(o=G(e,"count"))!=null?o:0;return{id:e.id,count:i,siblingCount:G(e,"siblingCount"),boundaryCount:G(e,"boundaryCount"),dir:q(e),type:r,translations:uL(e,gL(e)),getPageUrl:hL(e),onPageChange:s=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,page:s.page,page_size:s.pageSize},serverEventName:V(e,"onPageChange"),clientEventName:V(e,"onPageChangeClient")})},onPageSizeChange:s=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,page_size:s.pageSize},serverEventName:V(e,"onPageSizeChange"),clientEventName:V(e,"onPageSizeChangeClient")})}}}function fL(e,t,n){var a,o;let r=O(e,"controlled"),i=O(e,"controlledPageSize");return h(h(h({},TE(e,t,n)),r?{page:G(e,"page")}:{defaultPage:(a=G(e,"defaultPage"))!=null?a:G(e,"page")}),i?{pageSize:G(e,"pageSize")}:{defaultPageSize:(o=G(e,"defaultPageSize"))!=null?o:G(e,"pageSize")})}function mL(e,t,n){let r=O(e,"controlled"),i=O(e,"controlledPageSize"),a=TE(e,t,n);return delete a.onPageChange,delete a.onPageSizeChange,h(h(h({},a),r?{page:G(e,"page")}:{}),i?{pageSize:G(e,"pageSize")}:{})}var ZN,Pi,JN,QN,eL,tL,nL,rL,iL,ir,aL,Ho,oL,sL,cL,Ag,dL,vL,wE=ee(()=>{"use strict";Eo();Ve();be();oe();ZN=z("pagination").parts("root","item","ellipsis","firstTrigger","prevTrigger","nextTrigger","lastTrigger"),Pi=ZN.build(),JN=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`pagination:${e.id}`},QN=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.firstTrigger)!=null?n:`pagination:${e.id}:first`},eL=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.prevTrigger)!=null?n:`pagination:${e.id}:prev`},tL=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.nextTrigger)!=null?n:`pagination:${e.id}:next`},nL=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.lastTrigger)!=null?n:`pagination:${e.id}:last`},rL=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.ellipsis)==null?void 0:r.call(n,t))!=null?i:`pagination:${e.id}:ellipsis:${t}`},iL=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.item)==null?void 0:r.call(n,t))!=null?i:`pagination:${e.id}:item:${t}`},ir=(e,t)=>{let n=t-e+1;return Array.from({length:n},(r,i)=>i+e)},aL=e=>e.map(t=>Cs(t)?{type:"page",value:t}:{type:"ellipsis"}),Ho="ellipsis",oL=e=>{let{page:t,totalPages:n,siblingCount:r,boundaryCount:i=1}=e;if(n<=0)return[];if(n===1)return[1];let a=1,o=n,s=Math.max(t-r,a),l=Math.min(t+r,o),c=Math.min(r*2+3+i*2,n);if(n<=c)return ir(a,o);let d=c-1-i,g=s>a+i+1&&Math.abs(s-a)>i+1,p=li+1,u=[];if(!g&&p){let f=ir(1,d);u.push(...f,Ho),u.push(...ir(o-i+1,o))}else if(g&&!p){u.push(...ir(a,a+i-1)),u.push(Ho);let f=ir(o-d+1,o);u.push(...f)}else if(g&&p){u.push(...ir(a,a+i-1)),u.push(Ho);let f=ir(s,l);u.push(...f),u.push(Ho),u.push(...ir(o-i+1,o))}else u.push(...ir(a,o));for(let f=0;faL(oL(e));cL=te({props({props:e}){return y(h({defaultPageSize:10,siblingCount:1,boundaryCount:1,defaultPage:1,type:"button",count:1},e),{translations:h({rootLabel:"pagination",firstTriggerLabel:"first page",prevTriggerLabel:"previous page",nextTriggerLabel:"next page",lastTriggerLabel:"last page",itemLabel({page:t,totalPages:n}){return`${n>1&&t===n?"last page, ":""}page ${t}`}},e.translations)})},initialState(){return"idle"},context({prop:e,bindable:t,getContext:n}){return{page:t(()=>({value:e("page"),defaultValue:e("defaultPage"),onChange(r){var a;let i=n();(a=e("onPageChange"))==null||a({page:r,pageSize:i.get("pageSize")})}})),pageSize:t(()=>({value:e("pageSize"),defaultValue:e("defaultPageSize"),onChange(r){var i;(i=e("onPageSizeChange"))==null||i({pageSize:r})}}))}},watch({track:e,context:t,action:n}){e([()=>t.get("pageSize")],()=>{n(["setPageIfNeeded"])})},computed:{totalPages:Vn(({prop:e,context:t})=>[t.get("pageSize"),e("count")],([e,t])=>Math.ceil(t/e)),pageRange:Vn(({context:e,prop:t})=>[e.get("page"),e.get("pageSize"),t("count")],([e,t,n])=>{let r=(e-1)*t;return{start:r,end:Math.min(r+t,n)}}),previousPage:({context:e})=>e.get("page")===1?null:e.get("page")-1,nextPage:({context:e,computed:t})=>e.get("page")===t("totalPages")?null:e.get("page")+1,isValidPage:({context:e,computed:t})=>e.get("page")>=1&&e.get("page")<=t("totalPages")},on:{SET_PAGE:{guard:"isValidPage",actions:["setPage"]},SET_PAGE_SIZE:{actions:["setPageSize"]},FIRST_PAGE:{actions:["goToFirstPage"]},LAST_PAGE:{actions:["goToLastPage"]},PREVIOUS_PAGE:{guard:"canGoToPrevPage",actions:["goToPrevPage"]},NEXT_PAGE:{guard:"canGoToNextPage",actions:["goToNextPage"]}},states:{idle:{}},implementations:{guards:{isValidPage:({event:e,computed:t})=>e.page>=1&&e.page<=t("totalPages"),isValidCount:({context:e,event:t})=>e.get("page")>t.count,canGoToNextPage:({context:e,computed:t})=>e.get("page")e.get("page")>1},actions:{setPage({context:e,event:t,computed:n}){let r=Ag(t.page,n("totalPages"));e.set("page",r)},setPageSize({context:e,event:t}){e.set("pageSize",t.size)},goToFirstPage({context:e}){e.set("page",1)},goToLastPage({context:e,computed:t}){e.set("page",t("totalPages"))},goToPrevPage({context:e,computed:t}){e.set("page",n=>Ag(n-1,t("totalPages")))},goToNextPage({context:e,computed:t}){e.set("page",n=>Ag(n+1,t("totalPages")))},setPageIfNeeded({context:e,computed:t}){t("isValidPage")||e.set("page",1)}}}}),Ag=(e,t)=>Math.min(Math.max(e,1),t),dL=class extends X{initMachine(e){return new Y(cL,e)}initApi(){return this.zagConnect(lL)}render(){let e=this.el.querySelector('[data-scope="pagination"][data-part="root"]');e&&this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="pagination"][data-part="prev-trigger"]');t&&this.spreadProps(t,this.api.getPrevTriggerProps());let n=this.el.querySelector('[data-scope="pagination"][data-part="next-trigger"]');n&&this.spreadProps(n,this.api.getNextTriggerProps()),this.syncPages(),pL(this.el)}directPageElements(e){return Array.from(e.querySelectorAll(':scope > [data-pagination-part="page"]'))}syncPages(){var s,l;let e=this.el.querySelector('[data-pagination-part="next"]'),t=e==null?void 0:e.parentElement;if(!t||!e)return;let n=this.el.querySelector("[data-pagination-ellipsis-template]"),r=(s=n==null?void 0:n.innerHTML)!=null?s:"…",i=(l=V(this.el,"type"))!=null?l:"button",a=this.api.pages,o=this.directPageElements(t);for(;o.length>a.length;)o[o.length-1].remove(),o=this.directPageElements(t);for(let c=0;cj(this.liveSocket),r=new dL(e,fL(e,t,n));r.init(),this.pagination=r;let i=ie(e);this.domRegistry=i,i.add("corex:pagination:set-page",o=>{var l;let s=(l=o.detail)==null?void 0:l.page;typeof s=="number"&&r.api.setPage(s)}),i.add("corex:pagination:set-page-size",o=>{var l;let s=(l=o.detail)==null?void 0:l.page_size;typeof s=="number"&&r.api.setPageSize(s)}),i.add("corex:pagination:go-to-next-page",()=>{r.api.goToNextPage()}),i.add("corex:pagination:go-to-prev-page",()=>{r.api.goToPrevPage()}),i.add("corex:pagination:go-to-first-page",()=>{r.api.goToFirstPage()}),i.add("corex:pagination:go-to-last-page",()=>{r.api.goToLastPage()});let a=re(this);this.handleRegistry=a,a.add("pagination_set_page",o=>{if(!$(e.id,H(o)))return;let s=SE(o);s!=null&&r.api.setPage(s)}),a.add("pagination_set_page_size",o=>{if(!$(e.id,H(o)))return;let s=IE(o);s!=null&&r.api.setPageSize(s)}),a.add("pagination_go_to_next_page",o=>{$(e.id,H(o))&&r.api.goToNextPage()}),a.add("pagination_go_to_prev_page",o=>{$(e.id,H(o))&&r.api.goToPrevPage()}),a.add("pagination_go_to_first_page",o=>{$(e.id,H(o))&&r.api.goToFirstPage()}),a.add("pagination_go_to_last_page",o=>{$(e.id,H(o))&&r.api.goToLastPage()})},updated(){var n;let e=this.pushEvent.bind(this),t=()=>j(this.liveSocket);(n=this.pagination)==null||n.updateProps(mL(this.el,e,t))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.pagination)==null||n.destroy()}}});var VE={};pe(VE,{PasswordInput:()=>IL,visibilityChangePayload:()=>OE});function bL(e,t){let{scope:n,prop:r,context:i}=e,a=i.get("visible"),o=!!r("disabled"),s=!!r("invalid"),l=!!r("readOnly"),c=!!r("required"),d=!(l||o),g=r("translations");return{visible:a,disabled:o,invalid:s,focus(){var p;(p=xg(n))==null||p.focus()},setVisible(p){e.send({type:"VISIBILITY.SET",value:p})},toggleVisible(){e.send({type:"VISIBILITY.SET",value:!a})},getRootProps(){return t.element(y(h({},Oa.root.attrs),{dir:r("dir"),"data-disabled":b(o),"data-invalid":b(s),"data-readonly":b(l)}))},getLabelProps(){return t.label(y(h({},Oa.label.attrs),{htmlFor:pc(n),"data-disabled":b(o),"data-invalid":b(s),"data-readonly":b(l),"data-required":b(c)}))},getInputProps(){return t.input(h(y(h({},Oa.input.attrs),{id:pc(n),autoCapitalize:"off",name:r("name"),required:r("required"),autoComplete:r("autoComplete"),spellCheck:!1,readOnly:l,disabled:o,type:a?"text":"password","data-state":a?"visible":"hidden","aria-invalid":se(s),"data-disabled":b(o),"data-invalid":b(s),"data-readonly":b(l)}),r("ignorePasswordManagers")?EL:{}))},getVisibilityTriggerProps(){var p;return t.button(y(h({},Oa.visibilityTrigger.attrs),{type:"button",tabIndex:-1,"aria-controls":pc(n),"aria-expanded":a,"data-readonly":b(l),disabled:o,"data-disabled":b(o),"data-state":a?"visible":"hidden","aria-label":(p=g==null?void 0:g.visibilityTrigger)==null?void 0:p.call(g,a),onPointerDown(u){fe(u)&&d&&(u.preventDefault(),e.send({type:"TRIGGER.CLICK"}))}}))},getIndicatorProps(){return t.element(y(h({},Oa.indicator.attrs),{"aria-hidden":!0,"data-state":a?"visible":"hidden","data-disabled":b(o),"data-invalid":b(s),"data-readonly":b(l)}))},getControlProps(){return t.element(y(h({},Oa.control.attrs),{"data-disabled":b(o),"data-invalid":b(s),"data-readonly":b(l)}))}}}function OE(e,t){return{id:e.id,visible:t.visible}}var yL,Oa,pc,xg,EL,PL,SL,IL,AE=ee(()=>{"use strict";$e();Ve();be();oe();yL=z("password-input").parts("root","input","label","control","indicator","visibilityTrigger"),Oa=yL.build(),pc=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`p-input-${e.id}-input`},xg=e=>e.getById(pc(e));EL={"data-1p-ignore":"","data-lpignore":"true","data-bwignore":"true","data-form-type":"other","data-protonpass-ignore":"true"},PL=te({props({props:e}){return y(h({id:Ga(),defaultVisible:!1,autoComplete:"current-password",ignorePasswordManagers:!1},e),{translations:h({visibilityTrigger(t){return t?"Hide password":"Show password"}},e.translations)})},context({prop:e,bindable:t}){return{visible:t(()=>({value:e("visible"),defaultValue:e("defaultVisible"),onChange(n){var r;(r=e("onVisibilityChange"))==null||r({visible:n})}}))}},initialState(){return"idle"},effects:["trackFormEvents"],states:{idle:{on:{"VISIBILITY.SET":{actions:["setVisibility"]},"TRIGGER.CLICK":{actions:["toggleVisibility","focusInputEl"]}}}},implementations:{actions:{setVisibility({context:e,event:t}){e.set("visible",t.value)},toggleVisibility({context:e}){e.set("visible",t=>!t)},focusInputEl({scope:e}){let t=xg(e);t==null||t.focus()}},effects:{trackFormEvents({scope:e,send:t}){let n=xg(e),r=n==null?void 0:n.form;if(!r)return;let i=e.getWin(),a=new i.AbortController;return r.addEventListener("reset",o=>{o.defaultPrevented||t({type:"VISIBILITY.SET",value:!1})},{signal:a.signal}),r.addEventListener("submit",()=>{t({type:"VISIBILITY.SET",value:!1})},{signal:a.signal}),()=>a.abort()}}}}),SL=class extends X{initMachine(e){return new Y(PL,e)}initApi(){return this.zagConnect(bL)}render(){var o;let e=(o=this.el.querySelector('[data-scope="password-input"][data-part="root"]'))!=null?o:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="password-input"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-scope="password-input"][data-part="control"]');n&&this.spreadProps(n,this.api.getControlProps());let r=this.el.querySelector('[data-scope="password-input"][data-part="input"]');r&&this.spreadProps(r,this.api.getInputProps());let i=this.el.querySelector('[data-scope="password-input"][data-part="visibility-trigger"]');i&&this.spreadProps(i,this.api.getVisibilityTriggerProps());let a=this.el.querySelector('[data-scope="password-input"][data-part="indicator"]');a&&this.spreadProps(a,this.api.getIndicatorProps())}};IL={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=new SL(e,{id:e.id,defaultVisible:O(e,"defaultVisible"),disabled:O(e,"disabled"),invalid:O(e,"invalid"),readOnly:O(e,"readonly"),required:O(e,"required"),ignorePasswordManagers:O(e,"ignorePasswordManagers"),name:V(e,"name"),dir:q(e),autoComplete:V(e,"autoComplete"),onVisibilityChange:o=>{W({el:e,canPushServer:n(),pushEvent:t,payload:OE(e,o),serverEventName:V(e,"onVisibilityChange"),clientEventName:V(e,"onVisibilityChangeClient")})}});r.init(),this.passwordInput=r,this.handlers=[];let i=ie(e);this.domRegistry=i,i.add("corex:password-input:set-visible",o=>{var l;let s=(l=o.detail)==null?void 0:l.visible;typeof s=="boolean"&&r.api.setVisible(s)}),i.add("corex:password-input:toggle-visible",()=>{r.api.toggleVisible()}),i.add("corex:password-input:focus",()=>{r.api.focus()});let a=re(this);this.handleRegistry=a,a.add("password_input_set_visible",o=>{if(!$(e.id,H(o)))return;let s=Kh(o);typeof s=="boolean"&&r.api.setVisible(s)}),a.add("password_input_toggle_visible",o=>{$(e.id,H(o))&&r.api.toggleVisible()}),a.add("password_input_focus",o=>{$(e.id,H(o))&&r.api.focus()})},updated(){var n;let e=this.el,t=br(e);if((n=this.passwordInput)==null||n.updateProps(y(h({id:e.id},t),{disabled:O(e,"disabled"),invalid:O(e,"invalid"),readOnly:O(e,"readonly"),required:O(e,"required"),name:V(e,"name"),dir:q(e)})),"value"in t&&t.value!==null){let r=e.querySelector('[data-scope="password-input"][data-part="input"]');r&&r.value!==t.value&&(r.value=t.value)}},destroyed(){var e,t,n;if(this.handlers)for(let r of this.handlers)this.removeHandleEvent(r);(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.passwordInput)==null||n.destroy()}}});var FE={};pe(FE,{PinInput:()=>HL,padToCount:()=>Si,parseValueWithEmpties:()=>kE,readDefaultValueList:()=>ML,readPinValueList:()=>NE,readUpdatedPinValue:()=>LE,syncPinInputFormForPhoenix:()=>vc});function RL(e,t){var n;return e?!!((n=xL[e])!=null&&n.test(t)):!0}function xE(e,t,n){return n?new RegExp(n,"g").test(e):RL(t,e)}function kL(e,t){let{send:n,context:r,computed:i,prop:a,scope:o}=e,s=i("isValueComplete"),l=!!a("disabled"),c=!!a("readOnly"),d=!!a("invalid"),g=!!a("required"),p=a("translations"),u=r.get("focusedIndex");function f(){var m;(m=AL(o))==null||m.focus()}return{focus:f,count:r.get("count"),items:Array.from({length:r.get("count")}).map((m,S)=>S),value:r.get("value"),valueAsString:i("valueAsString"),complete:s,setValue(m){Array.isArray(m)||Fi("[pin-input/setValue] value must be an array"),n({type:"VALUE.SET",value:m})},clearValue(){n({type:"VALUE.CLEAR"})},setValueAtIndex(m,S){n({type:"VALUE.SET",value:S,index:m})},getRootProps(){return t.element(y(h({dir:a("dir")},hc.root.attrs),{id:Uo(o),"data-invalid":b(d),"data-disabled":b(l),"data-complete":b(s),"data-readonly":b(c)}))},getLabelProps(){return t.label(y(h({},hc.label.attrs),{dir:a("dir"),htmlFor:Ng(o),id:wL(o),"data-invalid":b(d),"data-disabled":b(l),"data-complete":b(s),"data-required":b(g),"data-readonly":b(c),onClick(m){m.preventDefault(),f()}}))},getHiddenInputProps(){return t.input({"aria-hidden":!0,type:"text",tabIndex:-1,id:Ng(o),readOnly:c,disabled:l,required:g,name:a("name"),form:a("form"),style:mt,maxLength:i("valueLength"),defaultValue:i("valueAsString")})},getControlProps(){return t.element(y(h({},hc.control.attrs),{dir:a("dir"),id:OL(o)}))},getInputProps(m){var P;let{index:S}=m,T=a("type")==="numeric"?"tel":"text",w=i("valueLength"),I=u!==-1?u:Math.min(i("filledValueLength"),w-1);return t.input(y(h({},hc.input.attrs),{dir:a("dir"),disabled:l,tabIndex:S===I?0:-1,"data-disabled":b(l),"data-complete":b(s),"data-filled":b(r.get("value")[S]!==""),id:CL(o,S.toString()),"data-index":S,"data-ownedby":Uo(o),"aria-label":(P=p==null?void 0:p.inputLabel)==null?void 0:P.call(p,S,i("valueLength")),inputMode:a("otp")||a("type")==="numeric"?"numeric":"text","aria-invalid":se(d),"data-invalid":b(d),enterKeyHint:S===w-1?"done":"next",type:a("mask")?"password":T,defaultValue:r.get("value")[S]||"",readOnly:c,autoCapitalize:"none",autoComplete:a("otp")?"one-time-code":"off",placeholder:u===S?"":a("placeholder"),onPaste(v){var C;let E=(C=v.clipboardData)==null?void 0:C.getData("text/plain");if(!E)return;let R=a("sanitizeValue");if(R&&(E=R(E)),!xE(E,a("type"),a("pattern"))){n({type:"VALUE.INVALID",value:E}),v.preventDefault();return}v.preventDefault(),n({type:"INPUT.PASTE",value:E})},onBeforeInput(v){try{let E=gh(v);xE(E,a("type"),a("pattern"))||(n({type:"VALUE.INVALID",value:E}),v.preventDefault()),E.length>1&&v.currentTarget.setSelectionRange(0,1,"forward")}catch(E){}},onChange(v){let E=Ot(v),{value:R}=v.currentTarget;if(E.inputType==="insertFromPaste"){v.currentTarget.value=R[0]||"";return}if(R.length>2){n({type:"INPUT.PASTE",value:R}),v.currentTarget.value=R[0],v.preventDefault();return}if(E.inputType==="deleteContentBackward"){n({type:"INPUT.BACKSPACE"});return}if(E.inputType==="deleteByCut"){n({type:"INPUT.DELETE"});return}R!==i("focusedValue")&&n({type:"INPUT.CHANGE",value:R,index:S})},onKeyDown(v){if(v.defaultPrevented||Me(v)||Be(v))return;if(v.key.length===1&&i("focusedValue")===v.key){v.preventDefault(),n({type:"INPUT.ADVANCE"});return}let R={Backspace(){n({type:"INPUT.BACKSPACE"})},Delete(){n({type:"INPUT.DELETE"})},ArrowLeft(){n({type:"INPUT.ARROW_LEFT"})},ArrowRight(){n({type:"INPUT.ARROW_RIGHT"})},Enter(){n({type:"INPUT.ENTER"})},Home(){n({type:"INPUT.HOME"})},End(){n({type:"INPUT.END"})}}[me(v,{dir:a("dir"),orientation:"horizontal"})];R&&(R(v),v.preventDefault())},onFocus(){n({type:"INPUT.FOCUS",index:S})},onBlur(v){let E=v.relatedTarget;Pe(E)&&E.dataset.ownedby===Uo(o)||n({type:"INPUT.BLUR",index:S})}}))}}}function RE(e,t){let n=t;e[0]===t[0]?n=t[1]:e[0]===t[1]&&(n=t[0]);let r=n.split("");return n=r[r.length-1],n!=null?n:""}function fc(e,t){return Array.from({length:t}).fill("").map((n,r)=>e[r]||n)}function kE(e){return e.split(",").map(t=>t.trim())}function Si(e,t){let n=[...e];for(;n.length{vc(e,o.value,void 0,{notifyLiveView:(r==null?void 0:r())===!0}),W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,value:o.value,valueAsString:o.valueAsString},serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})},onValueComplete:o=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,value:o.value,valueAsString:o.valueAsString},serverEventName:V(e,"onValueComplete"),clientEventName:V(e,"onValueCompleteClient")})}})}var TL,hc,Uo,CL,Ng,wL,OL,VL,mc,Bo,AL,Rg,kg,xL,NL,LL,DL,FL,HL,ME=ee(()=>{"use strict";so();Bt();vl();ai();Kt();$e();Ve();be();oe();TL=z("pinInput").parts("root","label","input","control"),hc=TL.build(),Uo=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`pin-input:${e.id}`},CL=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.input)==null?void 0:r.call(n,t))!=null?i:`pin-input:${e.id}:${t}`},Ng=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`pin-input:${e.id}:hidden`},wL=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`pin-input:${e.id}:label`},OL=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`pin-input:${e.id}:control`},VL=e=>e.getById(Uo(e)),mc=e=>{let n=`input[data-ownedby=${CSS.escape(Uo(e))}]`;return Oe(VL(e),n)},Bo=(e,t)=>mc(e)[t],AL=e=>mc(e)[0],Rg=e=>e.getById(Ng(e)),kg=(e,t)=>{e.value=t,e.setAttribute("value",t)},xL={numeric:/^[0-9]+$/,alphabetic:/^[A-Za-z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/i};({choose:NL,createMachine:LL}=Mt()),DL=LL({props({props:e}){return y(h({placeholder:"\u25CB",otp:!1,type:"numeric",defaultValue:e.count?fc([],e.count):[]},e),{translations:h({inputLabel:(t,n)=>`pin code ${t+1} of ${n}`},e.translations)})},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({value:e("value"),defaultValue:e("defaultValue"),isEqual:Ce,onChange(n){var r;(r=e("onValueChange"))==null||r({value:n,valueAsString:n.join("")})}})),focusedIndex:t(()=>({sync:!0,defaultValue:-1})),count:t(()=>({defaultValue:e("count")}))}},computed:{_value:({context:e})=>fc(e.get("value"),e.get("count")),valueLength:({computed:e})=>e("_value").length,filledValueLength:({computed:e})=>e("_value").filter(t=>(t==null?void 0:t.trim())!=="").length,isValueComplete:({computed:e})=>e("valueLength")===e("filledValueLength"),valueAsString:({computed:e})=>e("_value").join(""),focusedValue:({computed:e,context:t})=>e("_value")[t.get("focusedIndex")]||""},entry:NL([{guard:"autoFocus",actions:["setInputCount","setFocusIndexToFirst"]},{actions:["setInputCount"]}]),watch({action:e,track:t,context:n,computed:r}){t([()=>n.get("focusedIndex")],()=>{e(["focusInput","selectInputIfNeeded"])}),t([()=>n.get("value").join(",")],()=>{e(["syncInputElements","dispatchInputEvent"])}),t([()=>r("isValueComplete")],()=>{e(["invokeOnComplete","blurFocusedInputIfNeeded","autoSubmitIfNeeded"])})},on:{"VALUE.SET":[{guard:"hasIndex",actions:["setValueAtIndex"]},{actions:["setValue"]}],"VALUE.CLEAR":{actions:["clearValue","setFocusIndexToFirst"]}},states:{idle:{on:{"INPUT.FOCUS":{target:"focused",actions:["setFocusedIndex"]}}},focused:{on:{"INPUT.CHANGE":{actions:["setFocusedValue","syncInputValue","advanceFocusedIndex"]},"INPUT.ADVANCE":{actions:["advanceFocusedIndex"]},"INPUT.PASTE":{actions:["setPastedValue","setLastValueFocusIndex"]},"INPUT.FOCUS":{actions:["setFocusedIndex","focusInput"]},"INPUT.BLUR":{target:"idle",actions:["clearFocusedIndex"]},"INPUT.DELETE":{guard:"hasValue",actions:["clearFocusedValue"]},"INPUT.ARROW_LEFT":{actions:["setPrevFocusedIndex"]},"INPUT.ARROW_RIGHT":{actions:["setNextFocusedIndex"]},"INPUT.HOME":{actions:["setFocusIndexToFirst"]},"INPUT.END":{actions:["setFocusIndexToLast"]},"INPUT.BACKSPACE":[{guard:"hasValue",actions:["clearFocusedValue","setPrevFocusedIndex"]},{actions:["setPrevFocusedIndex","clearFocusedValue"]}],"INPUT.ENTER":{guard:"isValueComplete",actions:["requestFormSubmit"]},"VALUE.INVALID":{actions:["invokeOnInvalid"]}}}},implementations:{guards:{autoFocus:({prop:e})=>!!e("autoFocus"),hasValue:({context:e})=>e.get("value")[e.get("focusedIndex")]!=="",isValueComplete:({computed:e})=>e("isValueComplete"),hasIndex:({event:e})=>e.index!==void 0},actions:{dispatchInputEvent({computed:e,scope:t}){let n=Rg(t);Hi(n,{value:e("valueAsString")})},setInputCount({scope:e,context:t,prop:n}){if(n("count"))return;let r=mc(e);t.set("count",r.length)},focusInput({context:e,scope:t}){let n=e.get("focusedIndex");n!==-1&&queueMicrotask(()=>{var r;(r=Bo(t,n))==null||r.focus({preventScroll:!0})})},selectInputIfNeeded({context:e,prop:t,scope:n}){let r=e.get("focusedIndex");!t("selectOnFocus")||r===-1||B(()=>{var i;(i=Bo(n,r))==null||i.select()})},invokeOnComplete({computed:e,prop:t}){var n;e("isValueComplete")&&((n=t("onValueComplete"))==null||n({value:e("_value"),valueAsString:e("valueAsString")}))},invokeOnInvalid({context:e,event:t,prop:n}){var r;(r=n("onValueInvalid"))==null||r({value:t.value,index:e.get("focusedIndex")})},clearFocusedIndex({context:e}){e.set("focusedIndex",-1)},setFocusedIndex({context:e,event:t,computed:n}){let r=Math.min(n("filledValueLength"),n("valueLength")-1);e.set("focusedIndex",Math.min(t.index,r))},setValue({context:e,event:t}){let n=fc(t.value,e.get("count"));e.set("value",n)},setFocusedValue({context:e,event:t,computed:n,flush:r}){let i=n("focusedValue"),a=e.get("focusedIndex"),o=RE(i,t.value);r(()=>{e.set("value",Od(n("_value"),a,o))})},revertInputValue({context:e,computed:t,scope:n}){let r=Bo(n,e.get("focusedIndex"));kg(r,t("focusedValue"))},syncInputValue({context:e,event:t,scope:n}){let r=e.get("value"),i=Bo(n,t.index);kg(i,r[t.index])},syncInputElements({context:e,scope:t}){let n=mc(t),r=e.get("value");n.forEach((i,a)=>{kg(i,r[a])})},setPastedValue({context:e,event:t,computed:n,flush:r}){B(()=>{let i=n("valueAsString"),a=e.get("focusedIndex"),o=n("valueLength"),s=n("filledValueLength"),l=Math.min(a,s),c=l>0?i.substring(0,a):"",d=t.value.substring(0,o-l),g=fc(`${c}${d}`.split(""),o);r(()=>{e.set("value",g)})})},setValueAtIndex({context:e,event:t,computed:n}){let r=RE(n("focusedValue"),t.value);e.set("value",Od(n("_value"),t.index,r))},clearValue({context:e}){let t=Array.from({length:e.get("count")}).fill("");queueMicrotask(()=>{e.set("value",t)})},clearFocusedValue({context:e,computed:t}){let n=e.get("focusedIndex");if(n===-1)return;let r=[...t("_value")];r.splice(n,1),r.push(""),e.set("value",r)},setFocusIndexToFirst({context:e}){e.set("focusedIndex",0)},setFocusIndexToLast({context:e,computed:t}){e.set("focusedIndex",Math.max(t("filledValueLength")-1,0))},advanceFocusedIndex({context:e,computed:t}){e.set("focusedIndex",Math.min(e.get("focusedIndex")+1,t("valueLength")-1))},setNextFocusedIndex({context:e,computed:t}){let n=e.get("focusedIndex")+1,r=Math.min(t("filledValueLength"),t("valueLength")-1);e.set("focusedIndex",Math.min(n,r))},setPrevFocusedIndex({context:e}){e.set("focusedIndex",Math.max(e.get("focusedIndex")-1,0))},setLastValueFocusIndex({context:e,computed:t}){B(()=>{e.set("focusedIndex",Math.min(t("filledValueLength"),t("valueLength")-1))})},blurFocusedInputIfNeeded({context:e,computed:t,prop:n,scope:r}){!n("blurOnComplete")||!t("isValueComplete")||B(()=>{var i;(i=Bo(r,e.get("focusedIndex")))==null||i.blur()})},requestFormSubmit({computed:e,prop:t,scope:n}){var i;if(!t("name")||!e("isValueComplete"))return;let r=Rg(n);(i=r==null?void 0:r.form)==null||i.requestSubmit()},autoSubmitIfNeeded({computed:e,prop:t,scope:n}){var i;if(!t("autoSubmit")||!e("isValueComplete"))return;let r=Rg(n);(i=r==null?void 0:r.form)==null||i.requestSubmit()}}}});FL=class extends X{initMachine(e){return new Y(DL,e)}initApi(){return this.zagConnect(kL)}render(){var i,a;let e=(i=this.el.querySelector('[data-scope="pin-input"][data-part="root"]'))!=null?i:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="pin-input"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-scope="pin-input"][data-part="hidden-input"]');n instanceof HTMLInputElement&&(Er(n,this.el,(a=this.api.valueAsString)!=null?a:"",(o,s)=>this.spreadProps(o,s),this.api.getHiddenInputProps()),V(this.el,"submitName")&&(n.removeAttribute("name"),n.removeAttribute("form"))),Ji(this.el,"pin-input");let r=this.el.querySelector('[data-scope="pin-input"][data-part="control"]');r&&this.spreadProps(r,this.api.getControlProps()),this.api.items.forEach(o=>{let s=this.el.querySelector(`[data-scope="pin-input"][data-part="input"][data-index="${o}"]`);s&&this.spreadProps(s,this.api.getInputProps({index:o}))})}};HL={mounted(){let e=this.el,t=this;t.allowFormNotify=!1;let n=this.pushEvent.bind(this),r=()=>j(this.liveSocket),i=()=>t.allowFormNotify===!0,a=new FL(e,$L(e,n,r,i));try{a.init(),this.pinInput=a}finally{e.removeAttribute("data-loading")}queueMicrotask(()=>{vc(e,a.api.value,void 0,{notifyLiveView:!1}),t.allowFormNotify=!0});let o=c=>{let d=a.api,g=d.value,p=d.valueAsString;Ue({respondTo:c,canPushServer:r(),pushEvent:n,serverEventName:"pin_input_value_response",serverPayload:{id:e.id,value:g,valueAsString:p},el:e,domEventName:"pin-input-value",domDetail:{id:e.id,value:g,valueAsString:p}})},s=ie(e);this.domRegistry=s,s.add("corex:pin-input:set-value",c=>{var g;let d=(g=c.detail)==null?void 0:g.value;Array.isArray(d)&&a.api.setValue(d)}),s.add("corex:pin-input:clear",()=>{a.api.clearValue()}),s.add("corex:pin-input:value",c=>{o(de(c.detail))});let l=re(this);this.handleRegistry=l,l.add("pin_input_set_value",c=>{$(e.id,H(c))&&Array.isArray(c.value)&&a.api.setValue(c.value)}),l.add("pin_input_clear",c=>{$(e.id,H(c))&&a.api.clearValue()}),l.add("pin_input_value",c=>{$(e.id,H(c))&&o(de(c))})},updated(){var i;let e=this.el,t=this.pinInput,n=(i=G(e,"count"))!=null?i:0,r=LE(e,n);t==null||t.updateProps(y(h({id:e.id,count:n},r),{disabled:O(e,"disabled"),invalid:O(e,"invalid"),required:O(e,"required"),readOnly:O(e,"readonly"),mask:O(e,"mask"),otp:O(e,"otp"),blurOnComplete:O(e,"blurOnComplete"),selectOnFocus:O(e,"selectOnFocus"),name:DE(e),form:V(e,"submitName")?void 0:V(e,"form"),dir:q(e),type:V(e,"type"),placeholder:V(e,"placeholder")})),"value"in r&&vc(e,r.value,void 0,{notifyLiveView:!1})},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.pinInput)==null||n.destroy()}}});var qE={};pe(qE,{RadioGroup:()=>iD,valueChangePayload:()=>GE});function YL(e,t){let{context:n,send:r,computed:i,prop:a,scope:o}=e,s=i("isDisabled"),l=a("invalid"),c=a("readOnly");function d(u){return{value:u.value,invalid:!!u.invalid||!!l,disabled:!!u.disabled||s,checked:n.get("value")===u.value,focused:n.get("focusedValue")===u.value,focusVisible:n.get("focusVisibleValue")===u.value,hovered:n.get("hoveredValue")===u.value,active:n.get("activeValue")===u.value}}function g(u){let f=d(u);return{"data-focus":b(f.focused),"data-focus-visible":b(f.focusVisible),"data-disabled":b(f.disabled),"data-readonly":b(c),"data-state":f.checked?"checked":"unchecked","data-hover":b(f.hovered),"data-invalid":b(f.invalid),"data-orientation":a("orientation"),"data-ssr":b(n.get("ssr"))}}let p=()=>{var f;let u=(f=KL(o))!=null?f:WL(o);u==null||u.focus()};return{focus:p,value:n.get("value"),setValue(u){r({type:"SET_VALUE",value:u,isTrusted:!1})},clearValue(){r({type:"SET_VALUE",value:null,isTrusted:!1})},getRootProps(){return t.element(y(h({},Va.root.attrs),{role:"radiogroup",id:yc(o),"aria-labelledby":_E(o),"aria-required":a("required")||void 0,"aria-disabled":s||void 0,"aria-readonly":c||void 0,"data-orientation":a("orientation"),"data-disabled":b(s),"data-invalid":b(l),"data-required":b(a("required")),"aria-orientation":a("orientation"),dir:a("dir"),style:{position:"relative"}}))},getLabelProps(){return t.element(y(h({},Va.label.attrs),{dir:a("dir"),"data-orientation":a("orientation"),"data-disabled":b(s),"data-invalid":b(l),"data-required":b(a("required")),id:_E(o),onClick:p}))},getItemState:d,getItemProps(u){let f=d(u);return t.label(y(h(y(h({},Va.item.attrs),{dir:a("dir"),id:BE(o,u.value),htmlFor:Fg(o,u.value)}),g(u)),{onPointerMove(){f.disabled||f.hovered||r({type:"SET_HOVERED",value:u.value,hovered:!0})},onPointerLeave(){f.disabled||r({type:"SET_HOVERED",value:null})},onPointerDown(m){f.disabled||fe(m)&&(f.focused&&m.pointerType==="mouse"&&m.preventDefault(),r({type:"SET_ACTIVE",value:u.value,active:!0}))},onPointerUp(){f.disabled||r({type:"SET_ACTIVE",value:null})},onClick(){var m;!f.disabled&&wt()&&((m=GL(o,u.value))==null||m.focus())}}))},getItemTextProps(u){return t.element(h(y(h({},Va.itemText.attrs),{dir:a("dir"),id:$E(o,u.value)}),g(u)))},getItemControlProps(u){let f=d(u);return t.element(h(y(h({},Va.itemControl.attrs),{dir:a("dir"),id:UL(o,u.value),"data-active":b(f.active),"aria-hidden":!0}),g(u)))},getItemHiddenInputProps(u){let f=d(u);return t.input({"data-ownedby":yc(o),id:Fg(o,u.value),type:"radio",name:a("name")||a("id"),form:a("form"),value:u.value,required:a("required"),"aria-labelledby":$E(o,u.value),"aria-invalid":f.invalid||void 0,onClick(m){if(c){m.preventDefault();return}m.currentTarget.checked&&r({type:"SET_VALUE",value:u.value,isTrusted:!0})},onBlur(){r({type:"SET_FOCUSED",value:null,focused:!1,focusVisible:!1})},onFocus(){let m=vn();r({type:"SET_FOCUSED",value:u.value,focused:!0,focusVisible:m})},onKeyDown(m){m.defaultPrevented||m.key===" "&&r({type:"SET_ACTIVE",value:u.value,active:!0})},onKeyUp(m){m.defaultPrevented||m.key===" "&&r({type:"SET_ACTIVE",value:null})},disabled:f.disabled||c,defaultChecked:f.checked,style:mt})},getIndicatorProps(){let u=n.get("indicatorRect"),f=n.get("animateIndicator");return t.element(y(h({id:UE(o)},Va.indicator.attrs),{dir:a("dir"),hidden:n.get("value")==null||XL(u),"data-disabled":b(s),"data-orientation":a("orientation"),onTransitionEnd(m){ne(m)===m.currentTarget&&r({type:"INDICATOR_TRANSITION_END"})},style:{"--transition-property":"left, top, width, height","--left":ke(u==null?void 0:u.x),"--top":ke(u==null?void 0:u.y),"--width":ke(u==null?void 0:u.width),"--height":ke(u==null?void 0:u.height),position:"absolute",willChange:f?"var(--transition-property)":"auto",transitionProperty:f?"var(--transition-property)":"none",transitionDuration:f?"var(--transition-duration, 150ms)":"0ms",transitionTimingFunction:"var(--transition-timing-function)",[a("orientation")==="horizontal"?"left":"top"]:a("orientation")==="horizontal"?"var(--left)":"var(--top)"}}))}}}function Lg(e){return O(e,"formField")}function eD(e,t){t?e.setAttribute("data-invalid",""):e.removeAttribute("data-invalid")}function tD(e,t,n){e.querySelectorAll(`[data-scope="${t}"][data-part="error"]`).forEach(r=>{r.hidden=!n})}function nD(e,t){eD(e,!1),tD(e,t,!1)}function rD(e){return e!=null&&e!==""}function Dg(e,t,n={}){let r=e.querySelector('[data-scope="radio-group"][data-part="value-input"]');r&&yt(r,t!=null?t:"",n)}function GE(e,t){return{id:e.id,value:t.value}}var BL,Va,yc,_E,BE,Fg,UL,$E,UE,bc,GL,qL,WL,KL,HE,zL,jL,XL,ZL,JL,QL,iD,WE=ee(()=>{"use strict";sl();Bt();Kt();yn();$e();Ve();be();oe();BL=z("radio-group").parts("root","label","item","itemText","itemControl","indicator"),Va=BL.build(),yc=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`radio-group:${e.id}`},_E=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`radio-group:${e.id}:label`},BE=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.item)==null?void 0:r.call(n,t))!=null?i:`radio-group:${e.id}:radio:${t}`},Fg=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemHiddenInput)==null?void 0:r.call(n,t))!=null?i:`radio-group:${e.id}:radio:input:${t}`},UL=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemControl)==null?void 0:r.call(n,t))!=null?i:`radio-group:${e.id}:radio:control:${t}`},$E=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemLabel)==null?void 0:r.call(n,t))!=null?i:`radio-group:${e.id}:radio:label:${t}`},UE=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.indicator)!=null?n:`radio-group:${e.id}:indicator`},bc=e=>e.getById(yc(e)),GL=(e,t)=>e.getById(Fg(e,t)),qL=e=>e.getById(UE(e)),WL=e=>{var t;return(t=bc(e))==null?void 0:t.querySelector("input:not(:disabled)")},KL=e=>{var t;return(t=bc(e))==null?void 0:t.querySelector("input:not(:disabled):checked")},HE=e=>{let n=`input[type=radio][data-ownedby='${CSS.escape(yc(e))}']:not([disabled])`;return Oe(bc(e),n)},zL=(e,t)=>{if(t)return e.getById(BE(e,t))},jL=e=>{var t,n,r,i;return{x:(t=e==null?void 0:e.offsetLeft)!=null?t:0,y:(n=e==null?void 0:e.offsetTop)!=null?n:0,width:(r=e==null?void 0:e.offsetWidth)!=null?r:0,height:(i=e==null?void 0:e.offsetHeight)!=null?i:0}};XL=e=>e==null||e.width===0&&e.height===0&&e.x===0&&e.y===0,{not:ZL}=we(),JL=te({props({props:e}){return h({orientation:"vertical"},e)},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var r;(r=e("onValueChange"))==null||r({value:n})}})),activeValue:t(()=>({defaultValue:null})),focusedValue:t(()=>({defaultValue:null})),focusVisibleValue:t(()=>({defaultValue:null})),hoveredValue:t(()=>({defaultValue:null})),indicatorRect:t(()=>({defaultValue:null})),animateIndicator:t(()=>({defaultValue:!1})),fieldsetDisabled:t(()=>({defaultValue:!1})),ssr:t(()=>({defaultValue:!0}))}},refs(){return{indicatorCleanup:null,focusVisibleValue:null,prevValue:null}},computed:{isDisabled:({prop:e,context:t})=>!!e("disabled")||t.get("fieldsetDisabled")},entry:["syncPrevValue","syncIndicatorRect","syncSsr"],exit:["cleanupObserver"],effects:["trackFormControlState","trackFocusVisible"],watch({track:e,action:t,context:n}){e([()=>n.get("value")],()=>{t(["syncIndicatorAnimation","syncIndicatorRect","syncInputElements"])})},on:{SET_VALUE:[{guard:ZL("isTrusted"),actions:["setValue","dispatchChangeEvent"]},{actions:["setValue"]}],SET_HOVERED:{actions:["setHovered"]},SET_ACTIVE:{actions:["setActive"]},SET_FOCUSED:{actions:["setFocused"]},INDICATOR_TRANSITION_END:{actions:["clearIndicatorAnimation"]}},states:{idle:{}},implementations:{guards:{isTrusted:({event:e})=>!!e.isTrusted},effects:{trackFormControlState({context:e,scope:t}){return ht(bc(t),{onFieldsetDisabledChange(n){e.set("fieldsetDisabled",n)},onFormReset(){e.set("value",e.initial("value"))}})},trackFocusVisible({scope:e}){var t;return nt({root:(t=e.getRootNode)==null?void 0:t.call(e)})}},actions:{setValue({context:e,event:t}){e.set("value",t.value)},setHovered({context:e,event:t}){e.set("hoveredValue",t.value)},setActive({context:e,event:t}){e.set("activeValue",t.value)},setFocused({context:e,event:t}){e.set("focusedValue",t.value);let n=t.value!=null&&t.focusVisible?t.value:null;e.set("focusVisibleValue",n)},syncPrevValue({context:e,refs:t}){t.set("prevValue",e.get("value"))},syncIndicatorAnimation({context:e,refs:t}){let n=t.get("prevValue"),r=e.get("value"),i=n!=null&&r!=null&&n!==r;e.set("animateIndicator",i),t.set("prevValue",r)},clearIndicatorAnimation({context:e}){e.set("animateIndicator",!1)},syncInputElements({context:e,scope:t}){HE(t).forEach(r=>{r.checked=r.value===e.get("value")})},cleanupObserver({refs:e}){var t;(t=e.get("indicatorCleanup"))==null||t()},syncSsr({context:e}){e.set("ssr",!1)},syncIndicatorRect({context:e,scope:t,refs:n}){var s;if((s=n.get("indicatorCleanup"))==null||s(),!qL(t))return;let r=e.get("value"),i=zL(t,r);if(r==null||!i){e.set("indicatorRect",null);return}let a=()=>{e.set("indicatorRect",jL(i))};a();let o=Gn.observe(i,a);n.set("indicatorCleanup",o)},dispatchChangeEvent({context:e,scope:t}){HE(t).forEach(r=>{let i=r.value===e.get("value");i!==r.checked&&Bi(r,{checked:i})})}}}}),QL=class extends X{initMachine(e){return new Y(JL,e)}initApi(){return this.zagConnect(YL)}render(){var r;let e=(r=this.el.querySelector('[data-scope="radio-group"][data-part="root"]'))!=null?r:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="radio-group"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-scope="radio-group"][data-part="indicator"]');n&&this.spreadProps(n,this.api.getIndicatorProps()),this.el.querySelectorAll('[data-scope="radio-group"][data-part="item"]').forEach(i=>{let a=i.dataset.value;if(a==null)return;let o=i.dataset.disabled==="true",s=i.dataset.invalid==="true";this.spreadProps(i,this.api.getItemProps({value:a,disabled:o,invalid:s}));let l=i.querySelector('[data-scope="radio-group"][data-part="item-text"]');l&&this.spreadProps(l,this.api.getItemTextProps({value:a,disabled:o,invalid:s}));let c=i.querySelector('[data-scope="radio-group"][data-part="item-control"]');c&&this.spreadProps(c,this.api.getItemControlProps({value:a,disabled:o,invalid:s}));let d=i.querySelector('[data-scope="radio-group"][data-part="item-hidden-input"]');d instanceof HTMLInputElement&&(this.spreadProps(d,_d(this.api.getItemHiddenInputProps({value:a,disabled:o,invalid:s}))),d.checked=this.api.value===a,it(d,this.el))})}};iD={mounted(){var l;let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=new QL(e,y(h({id:e.id},Hs(e,"value","defaultValue")),{name:V(e,"name"),form:V(e,"form"),disabled:O(e,"disabled"),invalid:O(e,"invalid"),required:O(e,"required"),readOnly:O(e,"readonly"),dir:q(e),orientation:V(e,"orientation"),onValueChange:c=>{let d=c.value;if(Lg(e)&&(this.lastServerValue=d!=null?d:void 0),e.querySelectorAll('[data-scope="radio-group"][data-part="item-hidden-input"]').forEach(p=>{let u=p.value===d;p.checked!==u&&(p.checked=u),it(p,e)}),Dg(e,d),Lg(e)&&rD(d)&&(nD(e,"radio-group"),r.updateProps({invalid:!1})),!e.querySelector('[data-scope="radio-group"][data-part="value-input"]')){let p=e.querySelector('[data-scope="radio-group"][data-part="item-hidden-input"]:checked');p&&(Wt(p),p.dispatchEvent(new Event("input",{bubbles:!0})),p.dispatchEvent(new Event("change",{bubbles:!0})))}W({el:e,canPushServer:n(),pushEvent:t,payload:GE(e,c),serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})}}));r.init(),this.radioGroup=r,this.lastServerValue=(l=V(e,"value"))!=null?l:void 0,queueMicrotask(()=>{var c;Lg(e)&&Dg(e,(c=r.api.value)!=null?c:null,{markUsed:!1})});let i=e.querySelector('[data-scope="radio-group"][data-part="value-input"]');i&&it(i,e);let a=c=>{let d=r.api.value;Ue({respondTo:c,canPushServer:n(),pushEvent:t,serverEventName:"radio_group_value_response",serverPayload:{id:e.id,value:d},el:e,domEventName:"radio-group-value",domDetail:{id:e.id,value:d}})},o=ie(e);this.domRegistry=o,o.add("corex:radio-group:set-value",c=>{r.api.setValue(c.detail.value)}),o.add("corex:radio-group:clear-value",()=>{r.api.clearValue()}),o.add("corex:radio-group:focus",()=>{r.api.focus()}),o.add("corex:radio-group:value",c=>{a(de(c.detail))});let s=re(this);this.handleRegistry=s,s.add("radio_group_set_value",c=>{$(e.id,H(c))&&r.api.setValue(c.value)}),s.add("radio_group_clear_value",c=>{$(e.id,H(c))&&r.api.clearValue()}),s.add("radio_group_focus",c=>{$(e.id,H(c))&&r.api.focus()}),s.add("radio_group_value",c=>{$(e.id,H(c))&&a(de(c))})},updated(){var r,i;let e=this.el,t=this.radioGroup,n=br(e,this.lastServerValue);"value"in n&&(this.lastServerValue=(r=n.value)!=null?r:void 0),t==null||t.updateProps(y(h({id:e.id},n),{name:V(e,"name"),disabled:O(e,"disabled"),invalid:O(e,"invalid"),required:O(e,"required"),readOnly:O(e,"readonly"),orientation:V(e,"orientation"),dir:q(e)})),"value"in n&&Dg(e,(i=n.value)!=null?i:null,{markUsed:!1})},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.radioGroup)==null||n.destroy()}}});var tP={};pe(tP,{Select:()=>fD,buildCollection:()=>QE,formatSelectHiddenValue:()=>Gg,reapplySelectInteractiveState:()=>eP,syncSelectHiddenInputForPhoenix:()=>JE,syncSelectHiddenSelectForPhoenix:()=>Sc});function dD(e,t){let{context:n,prop:r,scope:i,state:a,computed:o,send:s}=e,l=r("translations"),c=r("disabled")||n.get("fieldsetDisabled"),d=!!r("invalid"),g=!!r("required"),p=!!r("readOnly"),u=r("composite"),f=r("collection"),m=a.hasTag("open"),S=a.matches("focused"),T=n.get("highlightedValue"),w=n.get("highlightedItem"),I=o("selectedItems"),P=n.get("currentPlacement"),v=o("isTypingAhead"),E=o("isInteractive"),R=T?Bg(i,T):void 0;function x(A){let N=f.getItemDisabled(A.item),k=f.getItemValue(A.item);return nn(k,()=>`[zag-js] No value found for item ${JSON.stringify(A.item)}`),{value:k,disabled:!!(c||N),highlighted:T===k,selected:n.get("value").includes(k)}}let C=Gt(y(h({},r("positioning")),{placement:P}));return{open:m,focused:S,empty:n.get("value").length===0,highlightedItem:w,highlightedValue:T,selectedItems:I,hasSelectedItems:o("hasSelectedItems"),value:n.get("value"),valueAsString:o("valueAsString"),collection:f,multiple:!!r("multiple"),disabled:!!c,reposition(A={}){s({type:"POSITIONING.SET",options:A})},focus(){var A;(A=Ti(i))==null||A.focus({preventScroll:!0})},setOpen(A){a.hasTag("open")!==A&&s({type:A?"OPEN":"CLOSE"})},selectValue(A){s({type:"ITEM.SELECT",value:A})},setValue(A){s({type:"VALUE.SET",value:A})},selectAll(){s({type:"VALUE.SET",value:f.getValues()})},setHighlightValue(A){s({type:"HIGHLIGHTED_VALUE.SET",value:A})},clearHighlightValue(){s({type:"HIGHLIGHTED_VALUE.CLEAR"})},clearValue(A){s(A?{type:"ITEM.CLEAR",value:A}:{type:"VALUE.CLEAR"})},getItemState:x,getRootProps(){return t.element(y(h({},lt.root.attrs),{dir:r("dir"),id:oD(i),"data-invalid":b(d),"data-readonly":b(p)}))},getLabelProps(){return t.label(y(h({dir:r("dir"),id:Ec(i)},lt.label.attrs),{"data-disabled":b(c),"data-invalid":b(d),"data-readonly":b(p),"data-required":b(g),htmlFor:Ug(i),onClick(A){var N;A.defaultPrevented||c||(N=Ti(i))==null||N.focus({preventScroll:!0})}}))},getControlProps(){return t.element(y(h({},lt.control.attrs),{dir:r("dir"),id:sD(i),"data-state":m?"open":"closed","data-focus":b(S),"data-disabled":b(c),"data-invalid":b(d)}))},getValueTextProps(){return t.element(y(h({},lt.valueText.attrs),{dir:r("dir"),"data-disabled":b(c),"data-invalid":b(d),"data-focus":b(S)}))},getTriggerProps(){return t.button(y(h({id:Hg(i),disabled:c,dir:r("dir"),type:"button",role:"combobox","aria-controls":$g(i),"aria-expanded":m,"aria-haspopup":"listbox","data-state":m?"open":"closed","aria-invalid":d,"aria-required":g,"aria-labelledby":Ec(i)},lt.trigger.attrs),{"data-disabled":b(c),"data-invalid":b(d),"data-readonly":b(p),"data-placement":P,"data-placeholder-shown":b(!o("hasSelectedItems")),onClick(A){E&&(A.defaultPrevented||s({type:"TRIGGER.CLICK"}))},onFocus(){s({type:"TRIGGER.FOCUS"})},onBlur(){s({type:"TRIGGER.BLUR"})},onKeyDown(A){if(A.defaultPrevented||!E)return;let k={ArrowUp(){s({type:"TRIGGER.ARROW_UP"})},ArrowDown(L){s({type:L.altKey?"OPEN":"TRIGGER.ARROW_DOWN"})},ArrowLeft(){s({type:"TRIGGER.ARROW_LEFT"})},ArrowRight(){s({type:"TRIGGER.ARROW_RIGHT"})},Home(){s({type:"TRIGGER.HOME"})},End(){s({type:"TRIGGER.END"})},Enter(){s({type:"TRIGGER.ENTER"})},Space(L){s(v?{type:"TRIGGER.TYPEAHEAD",key:L.key}:{type:"TRIGGER.ENTER"})}}[me(A,{dir:r("dir"),orientation:"vertical"})];if(k){k(A),A.preventDefault();return}ft.isValidEvent(A)&&(s({type:"TRIGGER.TYPEAHEAD",key:A.key}),A.preventDefault())}}))},getIndicatorProps(){return t.element(y(h({},lt.indicator.attrs),{dir:r("dir"),"aria-hidden":!0,"data-state":m?"open":"closed","data-disabled":b(c),"data-invalid":b(d),"data-readonly":b(p)}))},getItemProps(A){let N=x(A);return t.element(y(h({id:Bg(i,N.value),role:"option"},lt.item.attrs),{dir:r("dir"),"data-value":N.value,"aria-selected":N.selected,"data-state":N.selected?"checked":"unchecked","data-highlighted":b(N.highlighted),"data-disabled":b(N.disabled),"aria-disabled":se(N.disabled),onPointerMove(k){N.disabled||k.pointerType!=="mouse"||N.value!==T&&s({type:"ITEM.POINTER_MOVE",value:N.value})},onClick(k){k.defaultPrevented||N.disabled||s({type:"ITEM.CLICK",src:"pointerup",value:N.value})},onPointerLeave(k){var K;N.disabled||A.persistFocus||k.pointerType!=="mouse"||!((K=e.event.previous())!=null&&K.type.includes("POINTER"))||s({type:"ITEM.POINTER_LEAVE"})}}))},getItemTextProps(A){let N=x(A);return t.element(y(h({},lt.itemText.attrs),{"data-state":N.selected?"checked":"unchecked","data-disabled":b(N.disabled),"data-highlighted":b(N.highlighted)}))},getItemIndicatorProps(A){let N=x(A);return t.element(y(h({"aria-hidden":!0},lt.itemIndicator.attrs),{"data-state":N.selected?"checked":"unchecked",hidden:!N.selected}))},getItemGroupLabelProps(A){let{htmlFor:N}=A;return t.element(y(h({},lt.itemGroupLabel.attrs),{id:KE(i,N),dir:r("dir"),role:"presentation"}))},getItemGroupProps(A){let{id:N}=A;return t.element(y(h({},lt.itemGroup.attrs),{"data-disabled":b(c),id:lD(i,N),"aria-labelledby":KE(i,N),role:"group",dir:r("dir")}))},getClearTriggerProps(){return t.button(y(h({},lt.clearTrigger.attrs),{id:XE(i),type:"button","aria-label":l.clearTriggerLabel,"data-invalid":b(d),disabled:c,hidden:!o("hasSelectedItems"),dir:r("dir"),onClick(A){A.defaultPrevented||s({type:"CLEAR.CLICK"})}}))},getHiddenSelectProps(){let A=n.get("value"),N=r("multiple")?A:A==null?void 0:A[0],k=L=>{let K=Ot(L);sd(K)||s({type:"VALUE.SET",value:uD(L.currentTarget)})};return t.select({name:r("name"),form:r("form"),disabled:c,multiple:r("multiple"),required:r("required"),"aria-hidden":!0,id:Ug(i),defaultValue:N,style:mt,tabIndex:-1,autoComplete:r("autoComplete"),onChange:k,onInput:k,onFocus(){var L;(L=Ti(i))==null||L.focus({preventScroll:!0})},"aria-labelledby":Ec(i)})},getPositionerProps(){return t.element(y(h({},lt.positioner.attrs),{dir:r("dir"),id:ZE(i),style:C.floating}))},getContentProps(){return t.element(y(h({hidden:!m,dir:r("dir"),id:$g(i),role:u?"listbox":"dialog"},lt.content.attrs),{"data-state":m?"open":"closed","data-placement":P,"data-activedescendant":R,"aria-activedescendant":u?R:void 0,"aria-multiselectable":r("multiple")&&u?!0:void 0,"aria-labelledby":Ec(i),tabIndex:0,onKeyDown(A){if(!E||!ge(A.currentTarget,ne(A)))return;if(A.key==="Tab"&&!Ns(A)){A.preventDefault();return}let N={ArrowUp(){s({type:"CONTENT.ARROW_UP"})},ArrowDown(){s({type:"CONTENT.ARROW_DOWN"})},Home(){s({type:"CONTENT.HOME"})},End(){s({type:"CONTENT.END"})},Enter(){s({type:"ITEM.CLICK",src:"keydown.enter"})},Space(K){var J;v?s({type:"CONTENT.TYPEAHEAD",key:K.key}):(J=N.Enter)==null||J.call(N,K)}},k=N[me(A)];if(k){k(A),A.preventDefault();return}let L=ne(A);$t(L)||ft.isValidEvent(A)&&(s({type:"CONTENT.TYPEAHEAD",key:A.key}),A.preventDefault())}}))},getListProps(){return t.element(y(h({},lt.list.attrs),{tabIndex:0,role:u?void 0:"listbox","aria-labelledby":Hg(i),"aria-activedescendant":u?void 0:R,"aria-multiselectable":!u&&r("multiple")?!0:void 0}))}}}function jE(e){var n,r;let t=(r=e.restoreFocus)!=null?r:(n=e.previousEvent)==null?void 0:n.restoreFocus;return t==null||!!t}function Pc(e){let t=e.querySelector('[data-scope="select"][data-part="hidden-select"]');if(!t)return null;let n=V(e,"hiddenSelectName");return n?(t.name=n,t.disabled=!1,t):t.name?t:null}function Gg(e,t){var r;let n=t.map(i=>String(i));return n.length===0||O(e,"multiple")&&Pc(e)?"":O(e,"multiple")?n.join(","):(r=n[0])!=null?r:""}function Sc(e,t,n){let r=new Set(t.map(String));Array.from(e.options).forEach(i=>{if(i.value===""){i.selected=!1;return}i.selected=r.has(i.value)}),queueMicrotask(()=>{n==null||n(),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))})}function JE(e,t,n){let r=Pc(e);if(r&&O(e,"multiple")){Sc(r,t,n);return}let i=e.querySelector('[data-scope="select"][data-part="value-input"]');i&&Vr(i,()=>Gg(e,t),n)}function QE(e,t){return Ic(Rr(e,t))}function YE(e,t,n,r,i){let a=O(e,"redirect");return{id:e.id,disabled:O(e,"disabled"),closeOnSelect:O(e,"closeOnSelect"),dir:q(e),loopFocus:O(e,"loopFocus"),multiple:a?!1:O(e,"multiple"),invalid:O(e,"invalid"),name:V(e,"name"),form:V(e,"form"),readOnly:O(e,"readonly"),required:O(e,"required"),deselectable:O(e,"deselectable"),positioning:qe(e),onValueChange:o=>{let s=o.value.length>0?String(o.value[0]):null;if(O(e,"redirect")&&s){let l=e.querySelector(`[data-scope="select"][data-part="item"][data-value="${CSS.escape(s)}"]`);On(wn(l,s),{liveSocket:t})}JE(e,o.value,i),W({el:e,canPushServer:r(),pushEvent:n,payload:{id:e.id,value:o.value,items:o.items},serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})}}}function eP(e){if(e.removeAttribute("data-loading"),O(e,"disabled")||O(e,"readonly"))return;let t=e.querySelector('[data-scope="select"][data-part="trigger"]');!t||O(t,"disabled")||(t.disabled=!1,t.removeAttribute("disabled"))}var aD,lt,Ic,oD,$g,Hg,XE,Ec,sD,Bg,Ug,ZE,lD,KE,Mg,Go,Ti,cD,zE,_g,uD,qo,Ii,gD,pD,hD,fD,nP=ee(()=>{"use strict";ii();Or();on();Kt();xr();Nl();ca();da();yn();$e();Ve();be();oe();aD=z("select").parts("label","positioner","trigger","indicator","clearTrigger","item","itemText","itemIndicator","itemGroup","itemGroupLabel","list","content","root","control","valueText"),lt=aD.build(),Ic=e=>new Sn(e);Ic.empty=()=>new Sn({items:[]});oD=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`select:${e.id}`},$g=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`select:${e.id}:content`},Hg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`select:${e.id}:trigger`},XE=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.clearTrigger)!=null?n:`select:${e.id}:clear-trigger`},Ec=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`select:${e.id}:label`},sD=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`select:${e.id}:control`},Bg=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.item)==null?void 0:r.call(n,t))!=null?i:`select:${e.id}:option:${t}`},Ug=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenSelect)!=null?n:`select:${e.id}:select`},ZE=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`select:${e.id}:positioner`},lD=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemGroup)==null?void 0:r.call(n,t))!=null?i:`select:${e.id}:optgroup:${t}`},KE=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemGroupLabel)==null?void 0:r.call(n,t))!=null?i:`select:${e.id}:optgroup-label:${t}`},Mg=e=>e.getById(Ug(e)),Go=e=>e.getById($g(e)),Ti=e=>e.getById(Hg(e)),cD=e=>e.getById(XE(e)),zE=e=>e.getById(ZE(e)),_g=(e,t)=>t==null?null:e.getById(Bg(e,t));uD=e=>e.multiple?Array.from(e.selectedOptions,t=>t.value):e.value?[e.value]:[],{and:qo,not:Ii,or:gD}=we(),pD=te({props({props:e}){var t;return y(h({loopFocus:!1,closeOnSelect:!e.multiple,composite:!0,defaultValue:[]},e),{collection:(t=e.collection)!=null?t:Ic.empty(),translations:h({clearTriggerLabel:"Clear value"},e.translations),positioning:h({placement:"bottom-start",gutter:8},e.positioning)})},context({prop:e,bindable:t,getContext:n}){var a,o;let r=(o=(a=e("value"))!=null?a:e("defaultValue"))!=null?o:[],i=e("collection").findMany(r);return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:Ce,onChange(s){var f,m;let l=n(),c=e("collection"),d=l.get("selectedItemMap"),g=kt({values:s,collection:c,selectedItemMap:d}),p=(f=e("value"))!=null?f:s,u=p===s?g:kt({values:p,collection:c,selectedItemMap:g.nextSelectedItemMap});return l.set("selectedItemMap",u.nextSelectedItemMap),(m=e("onValueChange"))==null?void 0:m({value:s,items:g.selectedItems})}})),highlightedValue:t(()=>({defaultValue:e("defaultHighlightedValue")||null,value:e("highlightedValue"),onChange(s){var l;(l=e("onHighlightChange"))==null||l({highlightedValue:s,highlightedItem:e("collection").find(s),highlightedIndex:e("collection").indexOf(s)})}})),currentPlacement:t(()=>({defaultValue:void 0})),fieldsetDisabled:t(()=>({defaultValue:!1})),highlightedItem:t(()=>({defaultValue:null})),selectedItemMap:t(()=>({defaultValue:la({selectedItems:i,collection:e("collection")})}))}},refs(){return{typeahead:h({},ft.defaultOptions)}},computed:{hasSelectedItems:({context:e})=>e.get("value").length>0,isTypingAhead:({refs:e})=>e.get("typeahead").keysSoFar!=="",isDisabled:({prop:e,context:t})=>!!e("disabled")||!!t.get("fieldsetDisabled"),isInteractive:({prop:e})=>!(e("disabled")||e("readOnly")),selectedItems:({context:e,prop:t})=>oi({values:e.get("value"),collection:t("collection"),selectedItemMap:e.get("selectedItemMap")}),valueAsString:({computed:e,prop:t})=>t("collection").stringifyItems(e("selectedItems"))},initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"idle"},entry:["syncSelectElement"],watch({context:e,prop:t,track:n,action:r}){n([()=>e.get("value").toString()],()=>{r(["syncSelectedItems","syncSelectElement","dispatchChangeEvent"])}),n([()=>t("open")],()=>{r(["toggleVisibility"])}),n([()=>e.get("highlightedValue")],()=>{r(["syncHighlightedItem"])}),n([()=>t("collection").toString()],()=>{r(["syncCollection"])})},on:{"HIGHLIGHTED_VALUE.SET":{actions:["setHighlightedItem"]},"HIGHLIGHTED_VALUE.CLEAR":{actions:["clearHighlightedItem"]},"ITEM.SELECT":{actions:["selectItem"]},"ITEM.CLEAR":{actions:["clearItem"]},"VALUE.SET":{actions:["setSelectedItems"]},"VALUE.CLEAR":{actions:["clearSelectedItems"]},"CLEAR.CLICK":{actions:["clearSelectedItems","focusTriggerEl"]}},effects:["trackFormControlState"],states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":[{guard:"isTriggerClickEvent",target:"open",actions:["setInitialFocus","highlightFirstSelectedItem"]},{target:"open",actions:["setInitialFocus"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen","setInitialFocus","highlightFirstSelectedItem"]}],"TRIGGER.FOCUS":{target:"focused"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen"]}]}},focused:{tags:["closed"],on:{"CONTROLLED.OPEN":[{guard:"isTriggerClickEvent",target:"open",actions:["setInitialFocus","highlightFirstSelectedItem"]},{guard:"isTriggerArrowUpEvent",target:"open",actions:["setInitialFocus","highlightComputedLastItem"]},{guard:gD("isTriggerArrowDownEvent","isTriggerEnterEvent"),target:"open",actions:["setInitialFocus","highlightComputedFirstItem"]},{target:"open",actions:["setInitialFocus"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen"]}],"TRIGGER.BLUR":{target:"idle"},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightFirstSelectedItem"]}],"TRIGGER.ENTER":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedFirstItem"]}],"TRIGGER.ARROW_UP":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedLastItem"]}],"TRIGGER.ARROW_DOWN":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedFirstItem"]}],"TRIGGER.ARROW_LEFT":[{guard:qo(Ii("multiple"),"hasSelectedItems"),actions:["selectPreviousItem"]},{guard:Ii("multiple"),actions:["selectLastItem"]}],"TRIGGER.ARROW_RIGHT":[{guard:qo(Ii("multiple"),"hasSelectedItems"),actions:["selectNextItem"]},{guard:Ii("multiple"),actions:["selectFirstItem"]}],"TRIGGER.HOME":{guard:Ii("multiple"),actions:["selectFirstItem"]},"TRIGGER.END":{guard:Ii("multiple"),actions:["selectLastItem"]},"TRIGGER.TYPEAHEAD":{guard:Ii("multiple"),actions:["selectMatchingItem"]}}},open:{tags:["open"],exit:["scrollContentToTop"],effects:["trackDismissableElement","trackFocusVisible","computePlacement","scrollToHighlightedItem"],on:{"CONTROLLED.CLOSE":[{guard:"restoreFocus",target:"focused",actions:["focusTriggerEl","clearHighlightedItem"]},{target:"idle",actions:["clearHighlightedItem"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{guard:"restoreFocus",target:"focused",actions:["invokeOnClose","focusTriggerEl","clearHighlightedItem"]},{target:"idle",actions:["invokeOnClose","clearHighlightedItem"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose","clearHighlightedItem"]}],"ITEM.CLICK":[{guard:qo("closeOnSelect","isOpenControlled"),actions:["selectHighlightedItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectHighlightedItem","invokeOnClose","focusTriggerEl","clearHighlightedItem"]},{actions:["selectHighlightedItem"]}],"CONTENT.HOME":{actions:["highlightFirstItem"]},"CONTENT.END":{actions:["highlightLastItem"]},"CONTENT.ARROW_DOWN":[{guard:qo("hasHighlightedItem","loop","isLastItemHighlighted"),actions:["highlightFirstItem"]},{guard:"hasHighlightedItem",actions:["highlightNextItem"]},{actions:["highlightFirstItem"]}],"CONTENT.ARROW_UP":[{guard:qo("hasHighlightedItem","loop","isFirstItemHighlighted"),actions:["highlightLastItem"]},{guard:"hasHighlightedItem",actions:["highlightPreviousItem"]},{actions:["highlightLastItem"]}],"CONTENT.TYPEAHEAD":{actions:["highlightMatchingItem"]},"ITEM.POINTER_MOVE":{actions:["highlightItem"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedItem"]},"POSITIONING.SET":{actions:["reposition"]}}}},implementations:{guards:{loop:({prop:e})=>!!e("loopFocus"),multiple:({prop:e})=>!!e("multiple"),hasSelectedItems:({computed:e})=>!!e("hasSelectedItems"),hasHighlightedItem:({context:e})=>e.get("highlightedValue")!=null,isFirstItemHighlighted:({context:e,prop:t})=>e.get("highlightedValue")===t("collection").firstValue,isLastItemHighlighted:({context:e,prop:t})=>e.get("highlightedValue")===t("collection").lastValue,closeOnSelect:({prop:e,event:t})=>{var n;return!!((n=t.closeOnSelect)!=null?n:e("closeOnSelect"))},restoreFocus:({event:e})=>jE(e),isOpenControlled:({prop:e})=>e("open")!==void 0,isTriggerClickEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="TRIGGER.CLICK"},isTriggerEnterEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="TRIGGER.ENTER"},isTriggerArrowUpEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="TRIGGER.ARROW_UP"},isTriggerArrowDownEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="TRIGGER.ARROW_DOWN"}},effects:{trackFocusVisible({scope:e}){var t;return nt({root:(t=e.getRootNode)==null?void 0:t.call(e)})},trackFormControlState({context:e,scope:t}){return ht(Mg(t),{onFieldsetDisabledChange(n){e.set("fieldsetDisabled",n)},onFormReset(){let n=e.initial("value");e.set("value",n)}})},trackDismissableElement({scope:e,send:t,prop:n}){let r=()=>Go(e),i=!0;return qt(r,{type:"listbox",defer:!0,exclude:[Ti(e),cD(e)],onFocusOutside:n("onFocusOutside"),onPointerDownOutside:n("onPointerDownOutside"),onInteractOutside(a){var o;(o=n("onInteractOutside"))==null||o(a),i=!(a.detail.focusable||a.detail.contextmenu)},onDismiss(){t({type:"CLOSE",src:"interact-outside",restoreFocus:i})}})},computePlacement({context:e,prop:t,scope:n}){let r=t("positioning");return e.set("currentPlacement",r.placement),Xe(()=>Ti(n),()=>zE(n),y(h({defer:!0},r),{onComplete(o){e.set("currentPlacement",o.placement)}}))},scrollToHighlightedItem({context:e,prop:t,scope:n}){let r=a=>{let o=e.get("highlightedValue");if(o==null||Sr()==="pointer")return;let l=Go(n),c=t("scrollToIndexFn");if(c){let g=t("collection").indexOf(o);c==null||c({index:g,immediate:a,getElement:()=>_g(n,o)});return}let d=_g(n,o);Un(d,{rootEl:l,block:"nearest"})};return B(()=>{Ir("virtual"),r(!0)}),Ht(()=>Go(n),{defer:!0,attributes:["data-activedescendant"],callback(){r(!1)}})}},actions:{reposition({context:e,prop:t,scope:n,event:r}){let i=()=>zE(n);Xe(Ti(n),i,y(h(h({},t("positioning")),r.options),{defer:!0,listeners:!1,onComplete(a){e.set("currentPlacement",a.placement)}}))},toggleVisibility({send:e,prop:t,event:n}){e({type:t("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:n})},highlightPreviousItem({context:e,prop:t}){let n=e.get("highlightedValue");if(n==null)return;let r=t("collection").getPreviousValue(n,1,t("loopFocus"));r!=null&&e.set("highlightedValue",r)},highlightNextItem({context:e,prop:t}){let n=e.get("highlightedValue");if(n==null)return;let r=t("collection").getNextValue(n,1,t("loopFocus"));r!=null&&e.set("highlightedValue",r)},highlightFirstItem({context:e,prop:t}){let n=t("collection").firstValue;e.set("highlightedValue",n)},highlightLastItem({context:e,prop:t}){let n=t("collection").lastValue;e.set("highlightedValue",n)},setInitialFocus({scope:e}){B(()=>{let t=hr({root:Go(e)});t==null||t.focus({preventScroll:!0})})},focusTriggerEl({event:e,scope:t}){jE(e)&&B(()=>{let n=Ti(t);n==null||n.focus({preventScroll:!0})})},selectHighlightedItem({context:e,prop:t,event:n}){var a,o;let r=(a=n.value)!=null?a:e.get("highlightedValue");if(r==null||!t("collection").has(r))return;(o=t("onSelect"))==null||o({value:r}),r=t("deselectable")&&!t("multiple")&&e.get("value").includes(r)?null:r,e.set("value",s=>r==null?[]:t("multiple")?tn(s,r):[r])},highlightComputedFirstItem({context:e,prop:t,computed:n}){let r=t("collection"),i=n("hasSelectedItems")?r.sort(e.get("value"))[0]:r.firstValue;e.set("highlightedValue",i)},highlightComputedLastItem({context:e,prop:t,computed:n}){let r=t("collection"),i=n("hasSelectedItems")?r.sort(e.get("value"))[0]:r.lastValue;e.set("highlightedValue",i)},highlightFirstSelectedItem({context:e,prop:t,computed:n}){if(!n("hasSelectedItems"))return;let r=t("collection").sort(e.get("value"))[0];e.set("highlightedValue",r)},highlightItem({context:e,event:t}){e.set("highlightedValue",t.value)},highlightMatchingItem({context:e,prop:t,event:n,refs:r}){let i=t("collection").search(n.key,{state:r.get("typeahead"),currentValue:e.get("highlightedValue")});i!=null&&e.set("highlightedValue",i)},setHighlightedItem({context:e,event:t}){e.set("highlightedValue",t.value)},clearHighlightedItem({context:e}){e.set("highlightedValue",null)},selectItem({context:e,prop:t,event:n}){var a;(a=t("onSelect"))==null||a({value:n.value});let i=t("deselectable")&&!t("multiple")&&e.get("value").includes(n.value)?null:n.value;e.set("value",o=>i==null?[]:t("multiple")?tn(o,i):[i])},clearItem({context:e,event:t}){e.set("value",n=>n.filter(r=>r!==t.value))},setSelectedItems({context:e,event:t}){e.set("value",t.value)},clearSelectedItems({context:e}){e.set("value",[])},selectPreviousItem({context:e,prop:t}){let[n]=e.get("value"),r=t("collection").getPreviousValue(n);r&&e.set("value",[r])},selectNextItem({context:e,prop:t}){let[n]=e.get("value"),r=t("collection").getNextValue(n);r&&e.set("value",[r])},selectFirstItem({context:e,prop:t}){let n=t("collection").firstValue;n&&e.set("value",[n])},selectLastItem({context:e,prop:t}){let n=t("collection").lastValue;n&&e.set("value",[n])},selectMatchingItem({context:e,prop:t,event:n,refs:r}){let i=t("collection").search(n.key,{state:r.get("typeahead"),currentValue:e.get("value")[0]});i!=null&&e.set("value",[i])},scrollContentToTop({prop:e,scope:t}){var n,r;if(e("scrollToIndexFn")){let i=e("collection").firstValue;(n=e("scrollToIndexFn"))==null||n({index:0,immediate:!0,getElement:()=>_g(t,i)})}else(r=Go(t))==null||r.scrollTo(0,0)},invokeOnOpen({prop:e,context:t}){var n;(n=e("onOpenChange"))==null||n({open:!0,value:t.get("value")})},invokeOnClose({prop:e,context:t}){var n;(n=e("onOpenChange"))==null||n({open:!1,value:t.get("value")})},syncSelectElement({context:e,prop:t,scope:n}){let r=Mg(n);if(r){if(e.get("value").length===0&&!t("multiple")){r.selectedIndex=-1;return}for(let i of r.options)i.selected=e.get("value").includes(i.value)}},syncCollection({context:e,prop:t}){let n=t("collection"),r=n.find(e.get("highlightedValue"));r&&e.set("highlightedItem",r);let i=kt({values:e.get("value"),collection:n,selectedItemMap:e.get("selectedItemMap")});e.set("selectedItemMap",i.nextSelectedItemMap)},syncSelectedItems({context:e,prop:t}){let n=kt({values:e.get("value"),collection:t("collection"),selectedItemMap:e.get("selectedItemMap")});e.set("selectedItemMap",n.nextSelectedItemMap)},syncHighlightedItem({context:e,prop:t}){let n=t("collection"),r=e.get("highlightedValue"),i=r?n.find(r):null;e.set("highlightedItem",i)},dispatchChangeEvent({scope:e}){queueMicrotask(()=>{let t=Mg(e);if(!t)return;let n=e.getWin(),r=new n.Event("change",{bubbles:!0,composed:!0});t.dispatchEvent(Rs(r))})}}}});hD=class extends X{constructor(t,n){var i;super(t,n);Q(this,"_options",[]);Q(this,"hasGroups",!1);Q(this,"placeholder","");let r=n.collection;this._options=(i=r==null?void 0:r.items)!=null?i:[],this.placeholder=V(this.el,"placeholder")||""}get options(){return Array.isArray(this._options)?this._options:[]}setOptions(t){this._options=Array.isArray(t)?t:[]}getCollection(){return Ic(Rr(this.options,this.hasGroups))}initMachine(t){let n=this.getCollection.bind(this);return new Y(pD,y(h({},t),{get collection(){return n()}}))}initApi(){return this.zagConnect(dD)}applyItemProps(){let t=this.el.querySelector('[data-scope="select"][data-part="content"]');if(!t)return;let n=r=>r.closest('[data-scope="select"][data-part="content"]')===t;t.querySelectorAll('[data-scope="select"][data-part="item-group"]').forEach(r=>{var o;if(!n(r))return;let i=(o=r.dataset.id)!=null?o:"";this.spreadProps(r,this.api.getItemGroupProps({id:i}));let a=r.querySelector('[data-scope="select"][data-part="item-group-label"]');a&&this.spreadProps(a,this.api.getItemGroupLabelProps({htmlFor:i}))}),t.querySelectorAll('[data-scope="select"][data-part="item"]').forEach(r=>{var l;if(!n(r))return;let i=(l=r.dataset.value)!=null?l:"";if(!i)return;let a=this.options.find(c=>String(Cn(c))===String(i));if(!a)return;this.spreadProps(r,this.api.getItemProps({item:a}));let o=r.querySelector('[data-scope="select"][data-part="item-text"]');o&&this.spreadProps(o,this.api.getItemTextProps({item:a}));let s=r.querySelector('[data-scope="select"][data-part="item-indicator"]');s&&this.spreadProps(s,this.api.getItemIndicatorProps({item:a}))})}render(){var s,l,c,d;let t=(s=this.el.querySelector('[data-scope="select"][data-part="root"]'))!=null?s:this.el;this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="select"][data-part="value-input"]'),r=V(this.el,"hiddenSelectName");if(n&&(it(n,this.el),n.name&&!r)){let g=(l=this.api.value)!=null&&l.length?this.api.value.map(String).join(","):"";n.value=g}let i=this.el.querySelector('[data-scope="select"][data-part="hidden-select"]');if(i){if(this.spreadProps(i,this.api.getHiddenSelectProps()),r){i.name=r,i.disabled=!1;let g=new Set(((c=this.api.value)!=null?c:[]).map(String));Array.from(i.options).forEach(p=>{if(p.value===""){p.selected=!1;return}p.selected=g.has(p.value)}),n&&n.removeAttribute("name")}else if(i.name){let g=new Set(((d=this.api.value)!=null?d:[]).map(String));Array.from(i.options).forEach(p=>{if(p.value===""){p.selected=!1;return}p.selected=g.has(p.value)})}else i.disabled=!0,i.removeAttribute("name");it(i,this.el)}["label","control","trigger","indicator","clear-trigger","positioner"].forEach(g=>{let p=this.el.querySelector(`[data-scope="select"][data-part="${g}"]`);if(!p)return;let u="get"+g.split("-").map(f=>f[0].toUpperCase()+f.slice(1)).join("")+"Props";this.spreadProps(p,this.api[u]())});let a=this.el.querySelector('[data-scope="select"][data-part="item-text"]');if(a&&this.el.dataset.updateTrigger!=="false"){let g=this.api.valueAsString;if(this.api.value&&this.api.value.length>0&&!g){let p=this.api.value[0],u=this.options.find(f=>String(Cn(f))===String(p));a.textContent=(u==null?void 0:u.label)||this.placeholder}else a.textContent=g||this.placeholder}let o=this.el.querySelector('[data-scope="select"][data-part="content"]');o&&(this.spreadProps(o,this.api.getContentProps()),this.applyItemProps())}};fD={mounted(){var g;let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=this;r.fieldTouched=!1;let i=()=>{r.fieldTouched=!0},a=(g=Ie(e,"defaultValue"))!=null?g:[];a.length>0&&(r.fieldTouched=!0,queueMicrotask(()=>{let p=Pc(e);if(p&&O(e,"multiple")){Sc(p,a);return}let u=e.querySelector('[data-scope="select"][data-part="value-input"]');u&&Wt(u)}));let o=JSON.parse(e.dataset.items||"[]"),s=o.some(p=>!!p.group),l=new hD(e,h(y(h({},YE(e,this.liveSocket,t,n,i)),{collection:QE(o,s)}),hn(e)));l.hasGroups=s,l.setOptions(o),l.init(),this.select=l,this.handlers=[];let c=ie(e);this.domRegistry=c,c.add("corex:select:set-value",p=>{l.api.setValue(p.detail.value)}),c.add("corex:select:set-open",p=>{l.api.setOpen(p.detail.open)});let d=re(this);this.handleRegistry=d,d.add("select_set_value",p=>{$(e.id,H(p))&&l.api.setValue(p.value)}),d.add("select_set_open",p=>{$(e.id,H(p))&&typeof p.open=="boolean"&&l.api.setOpen(p.open)})},updated(){if(!this.select)return;let e=qn(this.el),t=JSON.parse(this.el.dataset.items||"[]"),n=t.some(a=>!!a.group);this.select.hasGroups=n,this.select.setOptions(t);let r=this.pushEvent.bind(this),i=()=>j(this.liveSocket);this.select.updateProps(h(y(h({},YE(this.el,this.liveSocket,r,i,()=>{this.fieldTouched=!0})),{collection:this.select.getCollection()}),e)),queueMicrotask(()=>{if(eP(this.el),!("value"in e)||!this.select)return;let a=e.value,o=Pc(this.el);if(o&&O(this.el,"multiple")){Sc(o,a);return}let s=this.el.querySelector('[data-scope="select"][data-part="value-input"]');if(!s)return;let l=Gg(this.el,a);s.value!==l&&(s.value=l),Wt(s)})},destroyed(){var e,t,n;if(this.handlers)for(let r of this.handlers)this.removeHandleEvent(r);(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.select)==null||n.destroy()}}});var IP={};pe(IP,{SignaturePad:()=>BD,buildDrawingOptions:()=>jg,parsePathsFromDataset:()=>SP});function ED(e,t){let{state:n,send:r,prop:i,computed:a,context:o,scope:s}=e,l=n.matches("drawing"),c=a("isEmpty"),d=a("isInteractive"),g=!!i("disabled"),p=!!i("required"),u=i("translations");return{empty:c,drawing:l,currentPath:o.get("currentPath"),paths:o.get("paths"),clear(){r({type:"CLEAR"})},getDataUrl(f,m){return a("isEmpty")?Promise.resolve(""):vP(s,{type:f,quality:m})},getLabelProps(){return t.label(y(h({},Ci.label.attrs),{id:yD(s),"data-disabled":b(g),"data-required":b(p),htmlFor:rP(s),onClick(f){if(!d||f.defaultPrevented)return;let m=Cc(s);m==null||m.focus({preventScroll:!0})}}))},getRootProps(){return t.element(y(h({},Ci.root.attrs),{"data-disabled":b(g),id:vD(s)}))},getControlProps(){return t.element(y(h({},Ci.control.attrs),{tabIndex:g?void 0:0,id:mP(s),role:"application","aria-roledescription":"signature pad","aria-label":u.control,"aria-disabled":g,"data-disabled":b(g),onPointerDown(f){if(!fe(f)||Be(f)||!d)return;let m=ne(f);if(m!=null&&m.closest("[data-part=clear-trigger]"))return;f.currentTarget.setPointerCapture(f.pointerId);let S={x:f.clientX,y:f.clientY},T=Cc(s);if(!T)return;let{offset:w}=qi(S,T);r({type:"POINTER_DOWN",point:w,pressure:f.pressure})},onPointerUp(f){d&&f.currentTarget.hasPointerCapture(f.pointerId)&&f.currentTarget.releasePointerCapture(f.pointerId)},style:{position:"relative",touchAction:"none",userSelect:"none",WebkitUserSelect:"none"}}))},getSegmentProps(){return t.svg(y(h({},Ci.segment.attrs),{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",fill:i("drawing").fill}}))},getSegmentPathProps(f){return t.path(y(h({},Ci.segmentPath.attrs),{d:f.path}))},getGuideProps(){return t.element(y(h({},Ci.guide.attrs),{"data-disabled":b(g)}))},getClearTriggerProps(){return t.button(y(h({},Ci.clearTrigger.attrs),{type:"button","aria-label":u.clearTrigger,hidden:!o.get("paths").length||l,disabled:g,onClick(){r({type:"CLEAR"})}}))},getHiddenInputProps(f){return t.input({id:rP(s),type:"text",hidden:!0,disabled:g,required:i("required"),readOnly:!0,name:i("name"),value:f.value})}}}function oP(e,t,n,r=i=>i){return e*r(.5-t*(.5-n))}function yP(e,t,n){let r=qg(1,t/n);return qg(1,e+(qg(1,1-r)-e)*(r*.275))}function SD(e){return[-e[0],-e[1]]}function kn(e,t){return[e[0]+t[0],e[1]+t[1]]}function sP(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}function Br(e,t){return[e[0]-t[0],e[1]-t[1]]}function zg(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}function Hr(e,t){return[e[0]*t,e[1]*t]}function Wg(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}function ID(e,t){return[e[0]/t,e[1]/t]}function bP(e){return[e[1],-e[0]]}function Kg(e,t){let n=t[0];return e[0]=t[1],e[1]=-n,e}function lP(e,t){return e[0]*t[0]+e[1]*t[1]}function TD(e,t){return e[0]===t[0]&&e[1]===t[1]}function CD(e){return Math.hypot(e[0],e[1])}function cP(e,t){let n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function EP(e){return ID(e,CD(e))}function wD(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function Yg(e,t,n){let r=Math.sin(n),i=Math.cos(n),a=e[0]-t[0],o=e[1]-t[1],s=a*i-o*r,l=a*r+o*i;return[s+t[0],l+t[1]]}function dP(e,t,n,r){let i=Math.sin(r),a=Math.cos(r),o=t[0]-n[0],s=t[1]-n[1],l=o*a-s*i,c=o*i+s*a;return e[0]=l+n[0],e[1]=c+n[1],e}function uP(e,t,n){return kn(e,Hr(Br(t,e),n))}function OD(e,t,n,r){let i=n[0]-t[0],a=n[1]-t[1];return e[0]=t[0]+i*r,e[1]=t[1]+a*r,e}function PP(e,t,n){return kn(e,Hr(t,n))}function VD(e,t){let n=PP(e,EP(bP(Br(e,kn(e,[1,1])))),-t),r=[],i=1/13;for(let a=i;a<=1;a+=i)r.push(Yg(n,e,Ko*2*a));return r}function AD(e,t,n){let r=[],i=1/n;for(let a=i;a<=1;a+=i)r.push(Yg(t,e,Ko*a));return r}function xD(e,t,n){let r=Br(t,n),i=Hr(r,.5),a=Hr(r,.51);return[Br(e,i),Br(e,a),kn(e,a),kn(e,i)]}function RD(e,t,n,r){let i=[],a=PP(e,t,n),o=1/r;for(let s=o;s<1;s+=o)i.push(Yg(a,e,Ko*3*s));return i}function kD(e,t,n){return[kn(e,Hr(t,n)),kn(e,Hr(t,n*.99)),Br(e,Hr(t,n*.99)),Br(e,Hr(t,n))]}function gP(e,t,n){return e===!1||e===void 0?0:e===!0?Math.max(t,n):e}function ND(e,t,n){return e.slice(0,10).reduce((r,i)=>{let a=i.pressure;return t&&(a=yP(r,i.distance,n)),(r+a)/2},e[0].pressure)}function LD(e,t={}){let{size:n=16,smoothing:r=.5,thinning:i=.5,simulatePressure:a=!0,easing:o=Z=>Z,start:s={},end:l={},last:c=!1}=t,{cap:d=!0,easing:g=Z=>Z*(2-Z)}=s,{cap:p=!0,easing:u=Z=>--Z*Z*Z+1}=l;if(e.length===0||n<=0)return[];let f=e[e.length-1].runningLength,m=gP(s.taper,n,f),S=gP(l.taper,n,f),T=(n*r)**2,w=[],I=[],P=ND(e,a,n),v=oP(n,i,e[e.length-1].pressure,o),E,R=e[0].vector,x=e[0].point,C=x,A=x,N=C,k=!1;for(let Z=0;ZT)&&(w.push(A),x=A),sP($r,ve,Je),N=[$r[0],$r[1]],(Z<=1||cP(C,N)>T)&&(I.push(N),C=N),P=ce,R=le}let L=[e[0].point[0],e[0].point[1]],K=e.length>1?[e[e.length-1].point[0],e[e.length-1].point[1]]:kn(e[0].point,[1,1]),J=[],ue=[];if(e.length===1){if(!(m||S)||c)return VD(L,E||v)}else{m||S&&e.length===1||(d?J.push(...AD(L,I[0],13)):J.push(...xD(L,w[0],I[0])));let Z=bP(SD(e[e.length-1].vector));S||m&&e.length===1?ue.push(K):p?ue.push(...RD(K,Z,v,29)):ue.push(...kD(K,Z,v))}return w.concat(ue,I.reverse(),J)}function hP(e){return e!=null&&e>=0}function DD(e,t={}){var p;let{streamline:n=.5,size:r=16,last:i=!1}=t;if(e.length===0)return[];let a=.15+(1-n)*.85,o=Array.isArray(e[0])?e:e.map(({x:u,y:f,pressure:m=iP})=>[u,f,m]);if(o.length===2){let u=o[1];o=o.slice(0,-1);for(let f=1;f<5;f++)o.push(uP(o[0],u,f/4))}o.length===1&&(o=[...o,[...kn(o[0],aP),...o[0].slice(2)]]);let s=[{point:[o[0][0],o[0][1]],pressure:hP(o[0][2])?o[0][2]:.25,vector:[...aP],distance:0,runningLength:0}],l=!1,c=0,d=s[0],g=o.length-1;for(let u=1;ui.trim()).filter(Boolean):[]}function jg(e){let t={fill:V(e,"drawingFill"),size:G(e,"drawingSize"),simulatePressure:O(e,"drawingSimulatePressure"),smoothing:G(e,"drawingSmoothing"),thinning:G(e,"drawingThinning"),streamline:G(e,"drawingStreamline")},n=V(e,"drawingEasing");return n&&(t.easing=n),t}function fP(e){if(!V(e,"submitName"))return V(e,"name")}function Wo(e,t,n){var o;let r=V(e,"submitName"),i=n.fieldTouched===!0;if(r){sn(e,t,{onTouched:n.onPadTouched,scope:"signature-pad",submitName:r,notifyLiveView:(o=n.notifyLiveView)!=null?o:!0,fieldTouched:i});return}let a=e.querySelector('[data-scope="signature-pad"][data-part="hidden-input"]');if(a){if(n.notifyLiveView===!1){a.value=t.length>0?t.join(` + `,n.body.appendChild(r)};Ig=new Map,Vg=!1;try{Vg=new Intl.NumberFormat("de-DE",{signDisplay:"exceptZero"}).resolvedOptions().signDisplay==="exceptZero"}catch(e){}gc=!1;try{gc=new Intl.NumberFormat("de-DE",{style:"unit",unit:"degree"}).resolvedOptions().style==="unit"}catch(e){}hE={degree:{narrow:{default:"\xB0","ja-JP":" \u5EA6","zh-TW":"\u5EA6","sl-SI":" \xB0"}}},RN=class{format(e){let t="";if(!Vg&&this.options.signDisplay!=null?t=NN(this.numberFormatter,this.options.signDisplay,e):t=this.numberFormatter.format(e),this.options.style==="unit"&&!gc){var n;let{unit:r,unitDisplay:i="short",locale:a}=this.resolvedOptions();if(!r)return t;let o=(n=hE[r])===null||n===void 0?void 0:n[i];t+=o[a]||o.default}return t}formatToParts(e){return this.numberFormatter.formatToParts(e)}formatRange(e,t){if(typeof this.numberFormatter.formatRange=="function")return this.numberFormatter.formatRange(e,t);if(t= start date");return`${this.format(e)} \u2013 ${this.format(t)}`}formatRangeToParts(e,t){if(typeof this.numberFormatter.formatRangeToParts=="function")return this.numberFormatter.formatRangeToParts(e,t);if(t= start date");let n=this.numberFormatter.formatToParts(e),r=this.numberFormatter.formatToParts(t);return[...n.map(i=>y(h({},i),{source:"startRange"})),{type:"literal",value:" \u2013 ",source:"shared"},...r.map(i=>y(h({},i),{source:"endRange"}))]}resolvedOptions(){let e=this.numberFormatter.resolvedOptions();return!Vg&&this.options.signDisplay!=null&&(e=y(h({},e),{signDisplay:this.options.signDisplay})),!gc&&this.options.style==="unit"&&(e=y(h({},e),{style:"unit",unit:this.options.unit,unitDisplay:this.options.unitDisplay})),e}constructor(e,t={}){this.numberFormatter=kN(e,t),this.options=t}};LN=new RegExp("^.*\\(.*\\).*$"),DN=["latn","arab","hanidec","deva","beng","fullwide"],fE=class{parse(e){return Tg(this.locale,this.options,e).parse(e)}isValidPartialNumber(e,t,n){return Tg(this.locale,this.options,e).isValidPartialNumber(e,t,n)}getNumberingSystem(e){return Tg(this.locale,this.options,e).options.numberingSystem}constructor(e,t={}){this.locale=e,this.options=t}},iE=new Map;FN=class{parse(e){let t=this.sanitize(e);if(this.symbols.group&&(t=wa(t,this.symbols.group,"")),this.symbols.decimal&&(t=t.replace(this.symbols.decimal,".")),this.symbols.minusSign&&(t=t.replace(this.symbols.minusSign,"-")),t=t.replace(this.symbols.numeral,this.symbols.index),this.options.style==="percent"){let a=t.indexOf("-");t=t.replace("-",""),t=t.replace("+","");let o=t.indexOf(".");o===-1&&(o=t.length),t=t.replace(".",""),o-2===0?t=`0.${t}`:o-2===-1?t=`0.0${t}`:o-2===-2?t="0.00":t=`${t.slice(0,o-2)}.${t.slice(o-2)}`,a>-1&&(t=`-${t}`)}let n=t?+t:NaN;if(isNaN(n))return NaN;if(this.options.style==="percent"){var r,i;let a=y(h({},this.options),{style:"decimal",minimumFractionDigits:Math.min(((r=this.options.minimumFractionDigits)!==null&&r!==void 0?r:0)+2,20),maximumFractionDigits:Math.min(((i=this.options.maximumFractionDigits)!==null&&i!==void 0?i:0)+2,20)});return new fE(this.locale,a).parse(new RN(this.locale,a).format(n))}return this.options.currencySign==="accounting"&&LN.test(e)&&(n=-1*n),n}sanitize(e){return e=e.replace(this.symbols.literals,""),this.symbols.minusSign&&(e=e.replace("-",this.symbols.minusSign)),this.options.numberingSystem==="arab"&&(this.symbols.decimal&&(e=e.replace(",",this.symbols.decimal),e=e.replace("\u060C",this.symbols.decimal)),this.symbols.group&&(e=wa(e,".",this.symbols.group))),this.symbols.group==="\u2019"&&e.includes("'")&&(e=wa(e,"'",this.symbols.group)),this.options.locale==="fr-FR"&&this.symbols.group&&(e=wa(e," ",this.symbols.group),e=wa(e,/\u00A0/g,this.symbols.group)),e}isValidPartialNumber(e,t=-1/0,n=1/0){return e=this.sanitize(e),this.symbols.minusSign&&e.startsWith(this.symbols.minusSign)&&t<0?e=e.slice(this.symbols.minusSign.length):this.symbols.plusSign&&e.startsWith(this.symbols.plusSign)&&n>0&&(e=e.slice(this.symbols.plusSign.length)),this.symbols.group&&e.startsWith(this.symbols.group)||this.symbols.decimal&&e.indexOf(this.symbols.decimal)>-1&&this.options.maximumFractionDigits===0?!1:(this.symbols.group&&(e=wa(e,this.symbols.group,"")),e=e.replace(this.symbols.numeral,""),this.symbols.decimal&&(e=e.replace(this.symbols.decimal,"")),e.length===0)}constructor(e,t={}){this.locale=e,t.roundingIncrement!==1&&t.roundingIncrement!=null&&(t.maximumFractionDigits==null&&t.minimumFractionDigits==null?(t.maximumFractionDigits=0,t.minimumFractionDigits=0):t.maximumFractionDigits==null?t.maximumFractionDigits=t.minimumFractionDigits:t.minimumFractionDigits==null&&(t.minimumFractionDigits=t.maximumFractionDigits)),this.formatter=new Intl.NumberFormat(e,t),this.options=this.formatter.resolvedOptions(),this.symbols=_N(e,this.formatter,this.options,t);var n,r;this.options.style==="percent"&&(((n=this.options.minimumFractionDigits)!==null&&n!==void 0?n:0)>18||((r=this.options.maximumFractionDigits)!==null&&r!==void 0?r:0)>18)&&console.warn("NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.")}},oE=new Set(["decimal","fraction","integer","minusSign","plusSign","group"]),MN=[0,4,2,1,11,20,3,7,100,21,.1,1.1];$N=(e,t={})=>new Intl.NumberFormat(e,t),HN=(e,t={})=>new fE(e,t),Cg=(e,t)=>{let{prop:n,computed:r}=t;return n("formatOptions")?e===""?Number.NaN:r("parser").parse(e):parseFloat(e)},bi=(e,t)=>{let{prop:n,computed:r}=t;return Number.isNaN(e)?"":n("formatOptions")?r("formatter").format(e):e.toString()},BN=(e,t)=>{let n=e!==void 0&&!Number.isNaN(e)?e:1;return(t==null?void 0:t.style)==="percent"&&(e===void 0||Number.isNaN(e))&&(n=.01),n},{choose:GN,guards:UN,createMachine:qN}=Mt(),{not:lE,and:cE}=UN,WN=qN({props({props:e}){let t=BN(e.step,e.formatOptions);return y(h({dir:"ltr",locale:"en-US",focusInputOnChange:!0,clampValueOnBlur:!e.allowOverflow,allowOverflow:!1,inputMode:"decimal",pattern:"-?[0-9]*(.[0-9]+)?",defaultValue:"",step:t,min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,spinOnPress:!0},e),{translations:h({incrementLabel:"increment value",decrementLabel:"decrease value"},e.translations)})},initialState(){return"idle"},context({prop:e,bindable:t,getComputed:n}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(r){var o;let i=n(),a=Cg(r,{computed:i,prop:e});(o=e("onValueChange"))==null||o({value:r,valueAsNumber:a})}})),hint:t(()=>({defaultValue:null})),scrubberCursorPoint:t(()=>({defaultValue:null,hash(r){return r?`x:${r.x}, y:${r.y}`:""}})),fieldsetDisabled:t(()=>({defaultValue:!1}))}},computed:{isRtl:({prop:e})=>e("dir")==="rtl",valueAsNumber:({context:e,computed:t,prop:n})=>Cg(e.get("value"),{computed:t,prop:n}),formattedValue:({computed:e,prop:t})=>bi(e("valueAsNumber"),{computed:e,prop:t}),isAtMin:({computed:e,prop:t})=>of(e("valueAsNumber"),t("min")),isAtMax:({computed:e,prop:t})=>af(e("valueAsNumber"),t("max")),isOutOfRange:({computed:e,prop:t})=>!Yi(e("valueAsNumber"),t("min"),t("max")),isValueEmpty:({context:e})=>e.get("value")==="",isDisabled:({prop:e,context:t})=>!!e("disabled")||t.get("fieldsetDisabled"),canIncrement:({prop:e,computed:t})=>e("allowOverflow")||!t("isAtMax"),canDecrement:({prop:e,computed:t})=>e("allowOverflow")||!t("isAtMin"),valueText:({prop:e,context:t})=>{var n,r;return(r=(n=e("translations")).valueText)==null?void 0:r.call(n,t.get("value"))},formatter:Vn(({prop:e})=>[e("locale"),e("formatOptions")],([e,t])=>$N(e,t)),parser:Vn(({prop:e})=>[e("locale"),e("formatOptions")],([e,t])=>HN(e,t))},watch({track:e,action:t,context:n,computed:r,prop:i}){e([()=>n.get("value"),()=>i("locale"),()=>JSON.stringify(i("formatOptions"))],()=>{t(["syncInputElement"])}),e([()=>r("isOutOfRange")],()=>{t(["invokeOnInvalid"])}),e([()=>n.hash("scrubberCursorPoint")],()=>{t(["setVirtualCursorPosition"])})},effects:["trackFormControl"],on:{"VALUE.SET":{actions:["setRawValue"]},"VALUE.CLEAR":{actions:["clearValue"]},"VALUE.INCREMENT":{actions:["increment"]},"VALUE.DECREMENT":{actions:["decrement"]}},states:{idle:{on:{"TRIGGER.PRESS_DOWN":[{guard:"isTouchPointer",target:"before:spin",actions:["setHint"]},{target:"before:spin",actions:["focusInput","invokeOnFocus","setHint"]}],"SCRUBBER.PRESS_DOWN":{target:"scrubbing",actions:["focusInput","invokeOnFocus","setHint","setCursorPoint"]},"INPUT.FOCUS":{target:"focused",actions:["focusInput","invokeOnFocus"]}}},focused:{tags:["focus"],effects:["attachWheelListener"],on:{"TRIGGER.PRESS_DOWN":[{guard:"isTouchPointer",target:"before:spin",actions:["setHint"]},{target:"before:spin",actions:["focusInput","setHint"]}],"SCRUBBER.PRESS_DOWN":{target:"scrubbing",actions:["focusInput","setHint","setCursorPoint"]},"INPUT.ARROW_UP":{actions:["increment"]},"INPUT.ARROW_DOWN":{actions:["decrement"]},"INPUT.HOME":{actions:["decrementToMin"]},"INPUT.END":{actions:["incrementToMax"]},"INPUT.CHANGE":{actions:["setValue","setHint"]},"INPUT.BLUR":[{guard:cE("clampValueOnBlur",lE("isInRange")),target:"idle",actions:["setClampedValue","clearHint","invokeOnBlur","invokeOnValueCommit"]},{guard:lE("isInRange"),target:"idle",actions:["setFormattedValue","clearHint","invokeOnBlur","invokeOnInvalid","invokeOnValueCommit"]},{target:"idle",actions:["setFormattedValue","clearHint","invokeOnBlur","invokeOnValueCommit"]}],"INPUT.ENTER":{actions:["setFormattedValue","clearHint","invokeOnBlur","invokeOnValueCommit"]}}},"before:spin":{tags:["focus"],effects:["trackButtonDisabled","waitForChangeDelay"],entry:GN([{guard:"isIncrementHint",actions:["increment"]},{guard:"isDecrementHint",actions:["decrement"]}]),on:{CHANGE_DELAY:{target:"spinning",guard:cE("isInRange","spinOnPress")},"TRIGGER.PRESS_UP":[{guard:"isTouchPointer",target:"focused",actions:["clearHint"]},{target:"focused",actions:["focusInput","clearHint"]}]}},spinning:{tags:["focus"],effects:["trackButtonDisabled","spinValue"],on:{SPIN:[{guard:"isIncrementHint",actions:["increment"]},{guard:"isDecrementHint",actions:["decrement"]}],"TRIGGER.PRESS_UP":{target:"focused",actions:["focusInput","clearHint"]}}},scrubbing:{tags:["focus"],effects:["activatePointerLock","trackMousemove","setupVirtualCursor","preventTextSelection"],on:{"SCRUBBER.POINTER_UP":{target:"focused",actions:["focusInput","clearCursorPoint"]},"SCRUBBER.POINTER_MOVE":[{guard:"isIncrementHint",actions:["increment","setCursorPoint"]},{guard:"isDecrementHint",actions:["decrement","setCursorPoint"]}]}}},implementations:{guards:{clampValueOnBlur:({prop:e})=>e("clampValueOnBlur"),spinOnPress:({prop:e})=>!!e("spinOnPress"),isInRange:({computed:e})=>!e("isOutOfRange"),isDecrementHint:({context:e,event:t})=>{var n;return((n=t.hint)!=null?n:e.get("hint"))==="decrement"},isIncrementHint:({context:e,event:t})=>{var n;return((n=t.hint)!=null?n:e.get("hint"))==="increment"},isTouchPointer:({event:e})=>e.pointerType==="touch"},effects:{waitForChangeDelay({send:e}){let t=setTimeout(()=>{e({type:"CHANGE_DELAY"})},300);return()=>clearTimeout(t)},spinValue({send:e}){let t=setInterval(()=>{e({type:"SPIN"})},50);return()=>clearInterval(t)},trackFormControl({context:e,scope:t}){let n=Ei(t);return ht(n,{onFieldsetDisabledChange(r){e.set("fieldsetDisabled",r)},onFormReset(){e.set("value",e.initial("value"))}})},setupVirtualCursor({context:e,scope:t}){let n=e.get("scrubberCursorPoint");return wN(t,n)},preventTextSelection({scope:e}){return ON(e)},trackButtonDisabled({context:e,scope:t,send:n}){let r=e.get("hint"),i=CN(t,r);return Ht(i,{attributes:["disabled"],callback(){n({type:"TRIGGER.PRESS_UP",src:"attr"})}})},attachWheelListener({scope:e,send:t,prop:n}){let r=Ei(e);if(!r||!e.isActiveElement(r)||!n("allowMouseWheel"))return;function i(a){a.preventDefault();let o=Math.sign(a.deltaY)*-1;o===1?t({type:"VALUE.INCREMENT"}):o===-1&&t({type:"VALUE.DECREMENT"})}return ae(r,"wheel",i,{passive:!1})},activatePointerLock({scope:e}){if(!wt())return Ph(e.getDoc())},trackMousemove({scope:e,send:t,context:n,computed:r}){let i=e.getDoc();function a(s){let l=n.get("scrubberCursorPoint"),c=r("isRtl"),d=VN(e,{point:l,isRtl:c,event:s});d.hint&&t({type:"SCRUBBER.POINTER_MOVE",hint:d.hint,point:d.point})}function o(){t({type:"SCRUBBER.POINTER_UP"})}return Ct(ae(i,"mousemove",a,!1),ae(i,"mouseup",o,!1))}},actions:{focusInput({scope:e,prop:t}){if(!t("focusInputOnChange"))return;let n=Ei(e);e.isActiveElement(n)||B(()=>n==null?void 0:n.focus({preventScroll:!0}))},increment({context:e,event:t,prop:n,computed:r}){var a;let i=df(r("valueAsNumber"),(a=t.step)!=null?a:n("step"));n("allowOverflow")||(i=Ae(i,n("min"),n("max"))),e.set("value",bi(i,{computed:r,prop:n}))},decrement({context:e,event:t,prop:n,computed:r}){var a;let i=uf(r("valueAsNumber"),(a=t.step)!=null?a:n("step"));n("allowOverflow")||(i=Ae(i,n("min"),n("max"))),e.set("value",bi(i,{computed:r,prop:n}))},setClampedValue({context:e,prop:t,computed:n}){let r=Ae(n("valueAsNumber"),t("min"),t("max"));e.set("value",bi(r,{computed:n,prop:t}))},setRawValue({context:e,event:t,prop:n,computed:r}){let i=Cg(t.value,{computed:r,prop:n});n("allowOverflow")||(i=Ae(i,n("min"),n("max"))),e.set("value",bi(i,{computed:r,prop:n}))},setValue({context:e,event:t}){var r,i;let n=(i=(r=t.target)==null?void 0:r.value)!=null?i:t.value;e.set("value",n)},clearValue({context:e}){e.set("value","")},incrementToMax({context:e,prop:t,computed:n}){let r=bi(t("max"),{computed:n,prop:t});e.set("value",r)},decrementToMin({context:e,prop:t,computed:n}){let r=bi(t("min"),{computed:n,prop:t});e.set("value",r)},setHint({context:e,event:t}){e.set("hint",t.hint)},clearHint({context:e}){e.set("hint",null)},invokeOnFocus({computed:e,prop:t}){var n;(n=t("onFocusChange"))==null||n({focused:!0,value:e("formattedValue"),valueAsNumber:e("valueAsNumber")})},invokeOnBlur({computed:e,prop:t}){var n;(n=t("onFocusChange"))==null||n({focused:!1,value:e("formattedValue"),valueAsNumber:e("valueAsNumber")})},invokeOnInvalid({computed:e,prop:t,event:n}){var i;if(n.type==="INPUT.CHANGE")return;let r=e("valueAsNumber")>t("max")?"rangeOverflow":"rangeUnderflow";(i=t("onValueInvalid"))==null||i({reason:r,value:e("formattedValue"),valueAsNumber:e("valueAsNumber")})},invokeOnValueCommit({computed:e,prop:t}){var n;(n=t("onValueCommit"))==null||n({value:e("formattedValue"),valueAsNumber:e("valueAsNumber")})},syncInputElement({context:e,event:t,computed:n,scope:r}){var s;let i=t.type.endsWith("CHANGE")?e.get("value"):n("formattedValue"),a=Ei(r),o=(s=t.selection)!=null?s:Og(a,r);B(()=>{_e(a,i),bN(a,o,r)})},setFormattedValue({context:e,computed:t,action:n}){e.set("value",t("formattedValue")),n(["syncInputElement"])},setCursorPoint({context:e,event:t}){e.set("scrubberCursorPoint",t.point)},clearCursorPoint({context:e}){e.set("scrubberCursorPoint",null)},setVirtualCursorPosition({context:e,scope:t}){let n=pE(t),r=e.get("scrubberCursorPoint");!n||!r||(n.style.transform=`translate3d(${r.x}px, ${r.y}px, 0px)`)}}}}),KN=class extends X{initMachine(e){return new Y(WN,e)}initApi(){return this.zagConnect(xN)}render(){var l,c,d,u,p;let e=(l=this.el.querySelector('[data-scope="number-input"][data-part="root"]'))!=null?l:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="number-input"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-scope="number-input"][data-part="control"]');n&&this.spreadProps(n,this.api.getControlProps());let r=this.el.querySelector('[data-scope="number-input"][data-part="value-text"]');r&&this.spreadProps(r,this.api.getValueTextProps());let i=this.el.querySelector('[data-scope="number-input"][data-part="input"]');if(i instanceof HTMLInputElement){let g=h({},this.api.getInputProps());delete g.name,delete g.form,this.spreadProps(i,g);let f=(c=this.api.value)!=null?c:"";i.value!==f&&(i.value=f)}let a=this.el.querySelector('[data-scope="number-input"][data-part="decrement-trigger"]');a&&this.spreadProps(a,this.api.getDecrementTriggerProps());let o=this.el.querySelector('[data-scope="number-input"][data-part="increment-trigger"]');o&&this.spreadProps(o,this.api.getIncrementTriggerProps());let s=this.el.querySelector('[data-scope="number-input"][data-part="value-input"]');if(s instanceof HTMLInputElement){let g=(d=U(this.el,"step"))!=null?d:1,f=this.api.valueAsNumber,m=(p=(u=V(this.el,"value"))!=null?u:V(this.el,"defaultValue"))!=null?p:"",S=Number.isFinite(f)&&!Number.isNaN(f)?no(f,g):m;Er(s,this.el,S,(T,w)=>this.spreadProps(T,w),{})}}};XN={mounted(){var c,d,u;let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=new KN(e,yE(e,t,n));r.init(),this.numberInput=r,this.lastServerValue=(d=(c=V(e,"value"))!=null?c:V(e,"defaultValue"))!=null?d:void 0;let i=vE(e,r.api.valueAsNumber);$o(e,(u=r.api.value)!=null?u:"",!0,r.api.valueAsNumber);let a=e.querySelector('[data-scope="number-input"][data-part="value-input"]');a&&Vr(a,()=>i);let o=p=>{let g=mE(r.api);Ge({respondTo:p,canPushServer:n(),pushEvent:t,serverEventName:"number_input_state_response",serverPayload:h({id:e.id},g),el:e,domEventName:"number-input-state",domDetail:h({id:e.id},g)})},s=ie(e);this.domRegistry=s,s.add("corex:number-input:set-value",p=>{var f;let g=(f=p.detail)==null?void 0:f.value;(typeof g=="number"&&!Number.isNaN(g)||typeof g=="string")&&wg(r,g)}),s.add("corex:number-input:clear-value",()=>{r.api.clearValue()}),s.add("corex:number-input:increment",()=>{r.api.increment()}),s.add("corex:number-input:decrement",()=>{r.api.decrement()}),s.add("corex:number-input:set-to-min",()=>{r.api.setToMin()}),s.add("corex:number-input:set-to-max",()=>{r.api.setToMax()}),s.add("corex:number-input:focus",()=>{r.api.focus()}),s.add("corex:number-input:state",p=>{o(de(p.detail))});let l=re(this);this.handleRegistry=l,l.add("number_input_set_value",p=>{$(e.id,H(p))&&typeof p.value=="number"&&!Number.isNaN(p.value)&&wg(r,p.value)}),l.add("number_input_clear_value",p=>{$(e.id,H(p))&&r.api.clearValue()}),l.add("number_input_increment",p=>{$(e.id,H(p))&&r.api.increment()}),l.add("number_input_decrement",p=>{$(e.id,H(p))&&r.api.decrement()}),l.add("number_input_set_to_min",p=>{$(e.id,H(p))&&r.api.setToMin()}),l.add("number_input_set_to_max",p=>{$(e.id,H(p))&&r.api.setToMax()}),l.add("number_input_focus",p=>{$(e.id,H(p))&&r.api.focus()}),l.add("number_input_state",p=>{$(e.id,H(p))&&o(de(p))})},updated(){let e=this.el,t=this.numberInput,n=qs(e,this.lastServerValue);n.nextServerValue!==void 0&&(this.lastServerValue=n.nextServerValue);let r=h({},n);delete r.nextServerValue,t==null||t.updateProps(h(h({},YN(e)),r)),queueMicrotask(()=>{var o,s,l;t&&"value"in r?$o(e,String((o=r.value)!=null?o:""),!1,t.api.valueAsNumber):t&&$o(e,(l=(s=t.api.value)!=null?s:V(e,"defaultValue"))!=null?l:"",!1,t.api.valueAsNumber);let i=e.querySelector('[data-scope="number-input"][data-part="input"]');i&&(O(e,"readonly")||(i.readOnly=!1,i.removeAttribute("readonly")),O(e,"disabled")||(i.disabled=!1,i.removeAttribute("disabled"))),e.querySelectorAll('[data-scope="number-input"][data-part="increment-trigger"], [data-scope="number-input"][data-part="decrement-trigger"]').forEach(c=>{c.hasAttribute("data-disabled")||(c.disabled=!1,c.removeAttribute("disabled"))})})},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.numberInput)==null||n.destroy()}}});var CE={};pe(CE,{Pagination:()=>vL,readPayloadPage:()=>SE,readPayloadPageSize:()=>IE});function lL(e,t){let{send:n,scope:r,prop:i,computed:a,context:o}=e,s=a("totalPages"),l=o.get("page"),c=o.get("pageSize"),d=i("translations"),u=i("count"),p=i("getPageUrl"),g=i("type"),f=a("previousPage"),m=a("nextPage"),S=a("pageRange"),T=l===1,w=l>=s,I=sL({page:l,totalPages:s,siblingCount:i("siblingCount"),boundaryCount:i("boundaryCount")});return{count:u,page:l,pageSize:c,totalPages:s,pages:I,previousPage:f,nextPage:m,pageRange:S,slice(P){return P.slice(S.start,S.end)},setPageSize(P){n({type:"SET_PAGE_SIZE",size:P})},setPage(P){n({type:"SET_PAGE",page:P})},goToNextPage(){n({type:"NEXT_PAGE"})},goToPrevPage(){n({type:"PREVIOUS_PAGE"})},goToFirstPage(){n({type:"FIRST_PAGE"})},goToLastPage(){n({type:"LAST_PAGE"})},getRootProps(){return t.element(y(h({id:JN(r)},Pi.root.attrs),{dir:i("dir"),"aria-label":d.rootLabel}))},getEllipsisProps(P){return t.element(y(h({id:rL(r,P.index)},Pi.ellipsis.attrs),{dir:i("dir")}))},getItemProps(P){var R;let v=P.value,E=v===l;return t.element(h(h(y(h({id:iL(r,v)},Pi.item.attrs),{dir:i("dir"),"data-index":v,"data-selected":b(E),"aria-current":E?"page":void 0,"aria-label":(R=d.itemLabel)==null?void 0:R.call(d,{page:v,totalPages:s}),onClick(){n({type:"SET_PAGE",page:v})}}),g==="button"&&{type:"button"}),g==="link"&&p&&{href:p({page:v,pageSize:c})}))},getPrevTriggerProps(){return t.element(h(h(y(h({id:eL(r)},Pi.prevTrigger.attrs),{dir:i("dir"),"data-disabled":b(T),"aria-label":d.prevTriggerLabel,onClick(){n({type:"PREVIOUS_PAGE"})}}),g==="button"&&{disabled:T,type:"button"}),g==="link"&&p&&f&&{href:p({page:f,pageSize:c})}))},getFirstTriggerProps(){return t.element(h(h(y(h({id:QN(r)},Pi.firstTrigger.attrs),{dir:i("dir"),"data-disabled":b(T),"aria-label":d.firstTriggerLabel,onClick(){n({type:"FIRST_PAGE"})}}),g==="button"&&{disabled:T,type:"button"}),g==="link"&&p&&{href:p({page:1,pageSize:c})}))},getNextTriggerProps(){return t.element(h(h(y(h({id:tL(r)},Pi.nextTrigger.attrs),{dir:i("dir"),"data-disabled":b(w),"aria-label":d.nextTriggerLabel,onClick(){n({type:"NEXT_PAGE"})}}),g==="button"&&{disabled:w,type:"button"}),g==="link"&&p&&m&&{href:p({page:m,pageSize:c})}))},getLastTriggerProps(){return t.element(h(h(y(h({id:nL(r)},Pi.lastTrigger.attrs),{dir:i("dir"),"data-disabled":b(w),"aria-label":d.lastTriggerLabel,onClick(){n({type:"LAST_PAGE"})}}),g==="button"&&{disabled:w,type:"button"}),g==="link"&&p&&{href:p({page:s,pageSize:c})}))}}}function uL(e,t){var r;let n=((r=t==null?void 0:t.rootLabel)==null?void 0:r.trim())||"Pagination";return y(h({},t),{rootLabel:`${n} (${e.id})`})}function gL(e){let t=e.dataset.translation;if(t)try{let n=JSON.parse(t),r={};if(typeof n.rootLabel=="string"&&n.rootLabel.length>0&&(r.rootLabel=n.rootLabel),typeof n.prevTriggerLabel=="string"&&n.prevTriggerLabel.length>0&&(r.prevTriggerLabel=n.prevTriggerLabel),typeof n.nextTriggerLabel=="string"&&n.nextTriggerLabel.length>0&&(r.nextTriggerLabel=n.nextTriggerLabel),typeof n.itemLabel=="string"&&n.itemLabel.length>0){let i=n.itemLabel;r.itemLabel=a=>i.replace("%{page}",String(a.page)).replace("%{total_pages}",String(a.totalPages))}return Object.keys(r).length>0?r:void 0}catch(n){return}}function PE(e,t){if(V(e,"type")!=="link"||t.tagName!=="A")return;let n=V(e,"redirect",["href","patch","navigate"]);n==="patch"?(t.setAttribute("data-phx-link","patch"),t.setAttribute("data-phx-link-state","push")):n==="navigate"?(t.setAttribute("data-phx-link","redirect"),t.setAttribute("data-phx-link-state","push")):(t.removeAttribute("data-phx-link"),t.removeAttribute("data-phx-link-state"))}function pL(e){let t=['[data-scope="pagination"][data-part="item"]','[data-scope="pagination"][data-part="prev-trigger"]','[data-scope="pagination"][data-part="next-trigger"]'];for(let n of t)e.querySelectorAll(n).forEach(r=>{PE(e,r)})}function hL(e){var a,o;let t=V(e,"type"),n=e.dataset.to;if(t!=="link"||!n)return;let r=(a=e.dataset.pageParam)!=null?a:"page",i=(o=e.dataset.pageSizeParam)!=null?o:"page_size";return({page:s,pageSize:l})=>{let c=n.includes("?")?"&":"?";return`${n}${c}${encodeURIComponent(r)}=${s}&${encodeURIComponent(i)}=${l}`}}function SE(e){var r;if(!e||typeof e!="object")return;let t=e,n=(r=t.page)!=null?r:t.page;return typeof n=="number"?n:void 0}function IE(e){var r,i;if(!e||typeof e!="object")return;let t=e,n=(i=(r=t.page_size)!=null?r:t.pageSize)!=null?i:t.page_size;return typeof n=="number"?n:void 0}function TE(e,t,n){var a,o;let r=(a=V(e,"type",["button","link"]))!=null?a:"button",i=(o=U(e,"count"))!=null?o:0;return{id:e.id,count:i,siblingCount:U(e,"siblingCount"),boundaryCount:U(e,"boundaryCount"),dir:q(e),type:r,translations:uL(e,gL(e)),getPageUrl:hL(e),onPageChange:s=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,page:s.page,page_size:s.pageSize},serverEventName:V(e,"onPageChange"),clientEventName:V(e,"onPageChangeClient")})},onPageSizeChange:s=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,page_size:s.pageSize},serverEventName:V(e,"onPageSizeChange"),clientEventName:V(e,"onPageSizeChangeClient")})}}}function fL(e,t,n){var a,o;let r=O(e,"controlled"),i=O(e,"controlledPageSize");return h(h(h({},TE(e,t,n)),r?{page:U(e,"page")}:{defaultPage:(a=U(e,"defaultPage"))!=null?a:U(e,"page")}),i?{pageSize:U(e,"pageSize")}:{defaultPageSize:(o=U(e,"defaultPageSize"))!=null?o:U(e,"pageSize")})}function mL(e,t,n){let r=O(e,"controlled"),i=O(e,"controlledPageSize"),a=TE(e,t,n);return delete a.onPageChange,delete a.onPageSizeChange,h(h(h({},a),r?{page:U(e,"page")}:{}),i?{pageSize:U(e,"pageSize")}:{})}var ZN,Pi,JN,QN,eL,tL,nL,rL,iL,ir,aL,Ho,oL,sL,cL,Ag,dL,vL,wE=ee(()=>{"use strict";Eo();Ve();be();oe();ZN=z("pagination").parts("root","item","ellipsis","firstTrigger","prevTrigger","nextTrigger","lastTrigger"),Pi=ZN.build(),JN=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`pagination:${e.id}`},QN=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.firstTrigger)!=null?n:`pagination:${e.id}:first`},eL=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.prevTrigger)!=null?n:`pagination:${e.id}:prev`},tL=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.nextTrigger)!=null?n:`pagination:${e.id}:next`},nL=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.lastTrigger)!=null?n:`pagination:${e.id}:last`},rL=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.ellipsis)==null?void 0:r.call(n,t))!=null?i:`pagination:${e.id}:ellipsis:${t}`},iL=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.item)==null?void 0:r.call(n,t))!=null?i:`pagination:${e.id}:item:${t}`},ir=(e,t)=>{let n=t-e+1;return Array.from({length:n},(r,i)=>i+e)},aL=e=>e.map(t=>Cs(t)?{type:"page",value:t}:{type:"ellipsis"}),Ho="ellipsis",oL=e=>{let{page:t,totalPages:n,siblingCount:r,boundaryCount:i=1}=e;if(n<=0)return[];if(n===1)return[1];let a=1,o=n,s=Math.max(t-r,a),l=Math.min(t+r,o),c=Math.min(r*2+3+i*2,n);if(n<=c)return ir(a,o);let d=c-1-i,u=s>a+i+1&&Math.abs(s-a)>i+1,p=li+1,g=[];if(!u&&p){let f=ir(1,d);g.push(...f,Ho),g.push(...ir(o-i+1,o))}else if(u&&!p){g.push(...ir(a,a+i-1)),g.push(Ho);let f=ir(o-d+1,o);g.push(...f)}else if(u&&p){g.push(...ir(a,a+i-1)),g.push(Ho);let f=ir(s,l);g.push(...f),g.push(Ho),g.push(...ir(o-i+1,o))}else g.push(...ir(a,o));for(let f=0;faL(oL(e));cL=te({props({props:e}){return y(h({defaultPageSize:10,siblingCount:1,boundaryCount:1,defaultPage:1,type:"button",count:1},e),{translations:h({rootLabel:"pagination",firstTriggerLabel:"first page",prevTriggerLabel:"previous page",nextTriggerLabel:"next page",lastTriggerLabel:"last page",itemLabel({page:t,totalPages:n}){return`${n>1&&t===n?"last page, ":""}page ${t}`}},e.translations)})},initialState(){return"idle"},context({prop:e,bindable:t,getContext:n}){return{page:t(()=>({value:e("page"),defaultValue:e("defaultPage"),onChange(r){var a;let i=n();(a=e("onPageChange"))==null||a({page:r,pageSize:i.get("pageSize")})}})),pageSize:t(()=>({value:e("pageSize"),defaultValue:e("defaultPageSize"),onChange(r){var i;(i=e("onPageSizeChange"))==null||i({pageSize:r})}}))}},watch({track:e,context:t,action:n}){e([()=>t.get("pageSize")],()=>{n(["setPageIfNeeded"])})},computed:{totalPages:Vn(({prop:e,context:t})=>[t.get("pageSize"),e("count")],([e,t])=>Math.ceil(t/e)),pageRange:Vn(({context:e,prop:t})=>[e.get("page"),e.get("pageSize"),t("count")],([e,t,n])=>{let r=(e-1)*t;return{start:r,end:Math.min(r+t,n)}}),previousPage:({context:e})=>e.get("page")===1?null:e.get("page")-1,nextPage:({context:e,computed:t})=>e.get("page")===t("totalPages")?null:e.get("page")+1,isValidPage:({context:e,computed:t})=>e.get("page")>=1&&e.get("page")<=t("totalPages")},on:{SET_PAGE:{guard:"isValidPage",actions:["setPage"]},SET_PAGE_SIZE:{actions:["setPageSize"]},FIRST_PAGE:{actions:["goToFirstPage"]},LAST_PAGE:{actions:["goToLastPage"]},PREVIOUS_PAGE:{guard:"canGoToPrevPage",actions:["goToPrevPage"]},NEXT_PAGE:{guard:"canGoToNextPage",actions:["goToNextPage"]}},states:{idle:{}},implementations:{guards:{isValidPage:({event:e,computed:t})=>e.page>=1&&e.page<=t("totalPages"),isValidCount:({context:e,event:t})=>e.get("page")>t.count,canGoToNextPage:({context:e,computed:t})=>e.get("page")e.get("page")>1},actions:{setPage({context:e,event:t,computed:n}){let r=Ag(t.page,n("totalPages"));e.set("page",r)},setPageSize({context:e,event:t}){e.set("pageSize",t.size)},goToFirstPage({context:e}){e.set("page",1)},goToLastPage({context:e,computed:t}){e.set("page",t("totalPages"))},goToPrevPage({context:e,computed:t}){e.set("page",n=>Ag(n-1,t("totalPages")))},goToNextPage({context:e,computed:t}){e.set("page",n=>Ag(n+1,t("totalPages")))},setPageIfNeeded({context:e,computed:t}){t("isValidPage")||e.set("page",1)}}}}),Ag=(e,t)=>Math.min(Math.max(e,1),t),dL=class extends X{initMachine(e){return new Y(cL,e)}initApi(){return this.zagConnect(lL)}render(){let e=this.el.querySelector('[data-scope="pagination"][data-part="root"]');e&&this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="pagination"][data-part="prev-trigger"]');t&&this.spreadProps(t,this.api.getPrevTriggerProps());let n=this.el.querySelector('[data-scope="pagination"][data-part="next-trigger"]');n&&this.spreadProps(n,this.api.getNextTriggerProps()),this.syncPages(),pL(this.el)}directPageElements(e){return Array.from(e.querySelectorAll(':scope > [data-pagination-part="page"]'))}syncPages(){var s,l;let e=this.el.querySelector('[data-pagination-part="next"]'),t=e==null?void 0:e.parentElement;if(!t||!e)return;let n=this.el.querySelector("[data-pagination-ellipsis-template]"),r=(s=n==null?void 0:n.innerHTML)!=null?s:"…",i=(l=V(this.el,"type"))!=null?l:"button",a=this.api.pages,o=this.directPageElements(t);for(;o.length>a.length;)o[o.length-1].remove(),o=this.directPageElements(t);for(let c=0;cj(this.liveSocket),r=new dL(e,fL(e,t,n));r.init(),this.pagination=r;let i=ie(e);this.domRegistry=i,i.add("corex:pagination:set-page",o=>{var l;let s=(l=o.detail)==null?void 0:l.page;typeof s=="number"&&r.api.setPage(s)}),i.add("corex:pagination:set-page-size",o=>{var l;let s=(l=o.detail)==null?void 0:l.page_size;typeof s=="number"&&r.api.setPageSize(s)}),i.add("corex:pagination:go-to-next-page",()=>{r.api.goToNextPage()}),i.add("corex:pagination:go-to-prev-page",()=>{r.api.goToPrevPage()}),i.add("corex:pagination:go-to-first-page",()=>{r.api.goToFirstPage()}),i.add("corex:pagination:go-to-last-page",()=>{r.api.goToLastPage()});let a=re(this);this.handleRegistry=a,a.add("pagination_set_page",o=>{if(!$(e.id,H(o)))return;let s=SE(o);s!=null&&r.api.setPage(s)}),a.add("pagination_set_page_size",o=>{if(!$(e.id,H(o)))return;let s=IE(o);s!=null&&r.api.setPageSize(s)}),a.add("pagination_go_to_next_page",o=>{$(e.id,H(o))&&r.api.goToNextPage()}),a.add("pagination_go_to_prev_page",o=>{$(e.id,H(o))&&r.api.goToPrevPage()}),a.add("pagination_go_to_first_page",o=>{$(e.id,H(o))&&r.api.goToFirstPage()}),a.add("pagination_go_to_last_page",o=>{$(e.id,H(o))&&r.api.goToLastPage()})},updated(){var n;let e=this.pushEvent.bind(this),t=()=>j(this.liveSocket);(n=this.pagination)==null||n.updateProps(mL(this.el,e,t))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.pagination)==null||n.destroy()}}});var VE={};pe(VE,{PasswordInput:()=>IL,visibilityChangePayload:()=>OE});function bL(e,t){let{scope:n,prop:r,context:i}=e,a=i.get("visible"),o=!!r("disabled"),s=!!r("invalid"),l=!!r("readOnly"),c=!!r("required"),d=!(l||o),u=r("translations");return{visible:a,disabled:o,invalid:s,focus(){var p;(p=xg(n))==null||p.focus()},setVisible(p){e.send({type:"VISIBILITY.SET",value:p})},toggleVisible(){e.send({type:"VISIBILITY.SET",value:!a})},getRootProps(){return t.element(y(h({},Oa.root.attrs),{dir:r("dir"),"data-disabled":b(o),"data-invalid":b(s),"data-readonly":b(l)}))},getLabelProps(){return t.label(y(h({},Oa.label.attrs),{htmlFor:pc(n),"data-disabled":b(o),"data-invalid":b(s),"data-readonly":b(l),"data-required":b(c)}))},getInputProps(){return t.input(h(y(h({},Oa.input.attrs),{id:pc(n),autoCapitalize:"off",name:r("name"),required:r("required"),autoComplete:r("autoComplete"),spellCheck:!1,readOnly:l,disabled:o,type:a?"text":"password","data-state":a?"visible":"hidden","aria-invalid":se(s),"data-disabled":b(o),"data-invalid":b(s),"data-readonly":b(l)}),r("ignorePasswordManagers")?EL:{}))},getVisibilityTriggerProps(){var p;return t.button(y(h({},Oa.visibilityTrigger.attrs),{type:"button",tabIndex:-1,"aria-controls":pc(n),"aria-expanded":a,"data-readonly":b(l),disabled:o,"data-disabled":b(o),"data-state":a?"visible":"hidden","aria-label":(p=u==null?void 0:u.visibilityTrigger)==null?void 0:p.call(u,a),onPointerDown(g){fe(g)&&d&&(g.preventDefault(),e.send({type:"TRIGGER.CLICK"}))}}))},getIndicatorProps(){return t.element(y(h({},Oa.indicator.attrs),{"aria-hidden":!0,"data-state":a?"visible":"hidden","data-disabled":b(o),"data-invalid":b(s),"data-readonly":b(l)}))},getControlProps(){return t.element(y(h({},Oa.control.attrs),{"data-disabled":b(o),"data-invalid":b(s),"data-readonly":b(l)}))}}}function OE(e,t){return{id:e.id,visible:t.visible}}var yL,Oa,pc,xg,EL,PL,SL,IL,AE=ee(()=>{"use strict";$e();Ve();be();oe();yL=z("password-input").parts("root","input","label","control","indicator","visibilityTrigger"),Oa=yL.build(),pc=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`p-input-${e.id}-input`},xg=e=>e.getById(pc(e));EL={"data-1p-ignore":"","data-lpignore":"true","data-bwignore":"true","data-form-type":"other","data-protonpass-ignore":"true"},PL=te({props({props:e}){return y(h({id:Ua(),defaultVisible:!1,autoComplete:"current-password",ignorePasswordManagers:!1},e),{translations:h({visibilityTrigger(t){return t?"Hide password":"Show password"}},e.translations)})},context({prop:e,bindable:t}){return{visible:t(()=>({value:e("visible"),defaultValue:e("defaultVisible"),onChange(n){var r;(r=e("onVisibilityChange"))==null||r({visible:n})}}))}},initialState(){return"idle"},effects:["trackFormEvents"],states:{idle:{on:{"VISIBILITY.SET":{actions:["setVisibility"]},"TRIGGER.CLICK":{actions:["toggleVisibility","focusInputEl"]}}}},implementations:{actions:{setVisibility({context:e,event:t}){e.set("visible",t.value)},toggleVisibility({context:e}){e.set("visible",t=>!t)},focusInputEl({scope:e}){let t=xg(e);t==null||t.focus()}},effects:{trackFormEvents({scope:e,send:t}){let n=xg(e),r=n==null?void 0:n.form;if(!r)return;let i=e.getWin(),a=new i.AbortController;return r.addEventListener("reset",o=>{o.defaultPrevented||t({type:"VISIBILITY.SET",value:!1})},{signal:a.signal}),r.addEventListener("submit",()=>{t({type:"VISIBILITY.SET",value:!1})},{signal:a.signal}),()=>a.abort()}}}}),SL=class extends X{initMachine(e){return new Y(PL,e)}initApi(){return this.zagConnect(bL)}render(){var o;let e=(o=this.el.querySelector('[data-scope="password-input"][data-part="root"]'))!=null?o:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="password-input"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-scope="password-input"][data-part="control"]');n&&this.spreadProps(n,this.api.getControlProps());let r=this.el.querySelector('[data-scope="password-input"][data-part="input"]');r&&this.spreadProps(r,this.api.getInputProps());let i=this.el.querySelector('[data-scope="password-input"][data-part="visibility-trigger"]');i&&this.spreadProps(i,this.api.getVisibilityTriggerProps());let a=this.el.querySelector('[data-scope="password-input"][data-part="indicator"]');a&&this.spreadProps(a,this.api.getIndicatorProps())}};IL={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=new SL(e,{id:e.id,defaultVisible:O(e,"defaultVisible"),disabled:O(e,"disabled"),invalid:O(e,"invalid"),readOnly:O(e,"readonly"),required:O(e,"required"),ignorePasswordManagers:O(e,"ignorePasswordManagers"),name:V(e,"name"),dir:q(e),autoComplete:V(e,"autoComplete"),onVisibilityChange:o=>{W({el:e,canPushServer:n(),pushEvent:t,payload:OE(e,o),serverEventName:V(e,"onVisibilityChange"),clientEventName:V(e,"onVisibilityChangeClient")})}});r.init(),this.passwordInput=r,this.handlers=[];let i=ie(e);this.domRegistry=i,i.add("corex:password-input:set-visible",o=>{var l;let s=(l=o.detail)==null?void 0:l.visible;typeof s=="boolean"&&r.api.setVisible(s)}),i.add("corex:password-input:toggle-visible",()=>{r.api.toggleVisible()}),i.add("corex:password-input:focus",()=>{r.api.focus()});let a=re(this);this.handleRegistry=a,a.add("password_input_set_visible",o=>{if(!$(e.id,H(o)))return;let s=Kh(o);typeof s=="boolean"&&r.api.setVisible(s)}),a.add("password_input_toggle_visible",o=>{$(e.id,H(o))&&r.api.toggleVisible()}),a.add("password_input_focus",o=>{$(e.id,H(o))&&r.api.focus()})},updated(){var n;let e=this.el,t=br(e);if((n=this.passwordInput)==null||n.updateProps(y(h({id:e.id},t),{disabled:O(e,"disabled"),invalid:O(e,"invalid"),readOnly:O(e,"readonly"),required:O(e,"required"),name:V(e,"name"),dir:q(e)})),"value"in t&&t.value!==null){let r=e.querySelector('[data-scope="password-input"][data-part="input"]');r&&r.value!==t.value&&(r.value=t.value)}},destroyed(){var e,t,n;if(this.handlers)for(let r of this.handlers)this.removeHandleEvent(r);(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.passwordInput)==null||n.destroy()}}});var FE={};pe(FE,{PinInput:()=>HL,padToCount:()=>Si,parseValueWithEmpties:()=>kE,readDefaultValueList:()=>ML,readPinValueList:()=>NE,readUpdatedPinValue:()=>LE,syncPinInputFormForPhoenix:()=>vc});function RL(e,t){var n;return e?!!((n=xL[e])!=null&&n.test(t)):!0}function xE(e,t,n){return n?new RegExp(n,"g").test(e):RL(t,e)}function kL(e,t){let{send:n,context:r,computed:i,prop:a,scope:o}=e,s=i("isValueComplete"),l=!!a("disabled"),c=!!a("readOnly"),d=!!a("invalid"),u=!!a("required"),p=a("translations"),g=r.get("focusedIndex");function f(){var m;(m=AL(o))==null||m.focus()}return{focus:f,count:r.get("count"),items:Array.from({length:r.get("count")}).map((m,S)=>S),value:r.get("value"),valueAsString:i("valueAsString"),complete:s,setValue(m){Array.isArray(m)||Fi("[pin-input/setValue] value must be an array"),n({type:"VALUE.SET",value:m})},clearValue(){n({type:"VALUE.CLEAR"})},setValueAtIndex(m,S){n({type:"VALUE.SET",value:S,index:m})},getRootProps(){return t.element(y(h({dir:a("dir")},hc.root.attrs),{id:Go(o),"data-invalid":b(d),"data-disabled":b(l),"data-complete":b(s),"data-readonly":b(c)}))},getLabelProps(){return t.label(y(h({},hc.label.attrs),{dir:a("dir"),htmlFor:Ng(o),id:wL(o),"data-invalid":b(d),"data-disabled":b(l),"data-complete":b(s),"data-required":b(u),"data-readonly":b(c),onClick(m){m.preventDefault(),f()}}))},getHiddenInputProps(){return t.input({"aria-hidden":!0,type:"text",tabIndex:-1,id:Ng(o),readOnly:c,disabled:l,required:u,name:a("name"),form:a("form"),style:mt,maxLength:i("valueLength"),defaultValue:i("valueAsString")})},getControlProps(){return t.element(y(h({},hc.control.attrs),{dir:a("dir"),id:OL(o)}))},getInputProps(m){var P;let{index:S}=m,T=a("type")==="numeric"?"tel":"text",w=i("valueLength"),I=g!==-1?g:Math.min(i("filledValueLength"),w-1);return t.input(y(h({},hc.input.attrs),{dir:a("dir"),disabled:l,tabIndex:S===I?0:-1,"data-disabled":b(l),"data-complete":b(s),"data-filled":b(r.get("value")[S]!==""),id:CL(o,S.toString()),"data-index":S,"data-ownedby":Go(o),"aria-label":(P=p==null?void 0:p.inputLabel)==null?void 0:P.call(p,S,i("valueLength")),inputMode:a("otp")||a("type")==="numeric"?"numeric":"text","aria-invalid":se(d),"data-invalid":b(d),enterKeyHint:S===w-1?"done":"next",type:a("mask")?"password":T,defaultValue:r.get("value")[S]||"",readOnly:c,autoCapitalize:"none",autoComplete:a("otp")?"one-time-code":"off",placeholder:g===S?"":a("placeholder"),onPaste(v){var C;let E=(C=v.clipboardData)==null?void 0:C.getData("text/plain");if(!E)return;let R=a("sanitizeValue");if(R&&(E=R(E)),!xE(E,a("type"),a("pattern"))){n({type:"VALUE.INVALID",value:E}),v.preventDefault();return}v.preventDefault(),n({type:"INPUT.PASTE",value:E})},onBeforeInput(v){try{let E=gh(v);xE(E,a("type"),a("pattern"))||(n({type:"VALUE.INVALID",value:E}),v.preventDefault()),E.length>1&&v.currentTarget.setSelectionRange(0,1,"forward")}catch(E){}},onChange(v){let E=Ot(v),{value:R}=v.currentTarget;if(E.inputType==="insertFromPaste"){v.currentTarget.value=R[0]||"";return}if(R.length>2){n({type:"INPUT.PASTE",value:R}),v.currentTarget.value=R[0],v.preventDefault();return}if(E.inputType==="deleteContentBackward"){n({type:"INPUT.BACKSPACE"});return}if(E.inputType==="deleteByCut"){n({type:"INPUT.DELETE"});return}R!==i("focusedValue")&&n({type:"INPUT.CHANGE",value:R,index:S})},onKeyDown(v){if(v.defaultPrevented||Me(v)||Be(v))return;if(v.key.length===1&&i("focusedValue")===v.key){v.preventDefault(),n({type:"INPUT.ADVANCE"});return}let R={Backspace(){n({type:"INPUT.BACKSPACE"})},Delete(){n({type:"INPUT.DELETE"})},ArrowLeft(){n({type:"INPUT.ARROW_LEFT"})},ArrowRight(){n({type:"INPUT.ARROW_RIGHT"})},Enter(){n({type:"INPUT.ENTER"})},Home(){n({type:"INPUT.HOME"})},End(){n({type:"INPUT.END"})}}[me(v,{dir:a("dir"),orientation:"horizontal"})];R&&(R(v),v.preventDefault())},onFocus(){n({type:"INPUT.FOCUS",index:S})},onBlur(v){let E=v.relatedTarget;Pe(E)&&E.dataset.ownedby===Go(o)||n({type:"INPUT.BLUR",index:S})}}))}}}function RE(e,t){let n=t;e[0]===t[0]?n=t[1]:e[0]===t[1]&&(n=t[0]);let r=n.split("");return n=r[r.length-1],n!=null?n:""}function fc(e,t){return Array.from({length:t}).fill("").map((n,r)=>e[r]||n)}function kE(e){return e.split(",").map(t=>t.trim())}function Si(e,t){let n=[...e];for(;n.length{vc(e,o.value,void 0,{notifyLiveView:(r==null?void 0:r())===!0}),W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,value:o.value,valueAsString:o.valueAsString},serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})},onValueComplete:o=>{W({el:e,canPushServer:n(),pushEvent:t,payload:{id:e.id,value:o.value,valueAsString:o.valueAsString},serverEventName:V(e,"onValueComplete"),clientEventName:V(e,"onValueCompleteClient")})}})}var TL,hc,Go,CL,Ng,wL,OL,VL,mc,Bo,AL,Rg,kg,xL,NL,LL,DL,FL,HL,ME=ee(()=>{"use strict";so();Bt();vl();ai();Kt();$e();Ve();be();oe();TL=z("pinInput").parts("root","label","input","control"),hc=TL.build(),Go=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`pin-input:${e.id}`},CL=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.input)==null?void 0:r.call(n,t))!=null?i:`pin-input:${e.id}:${t}`},Ng=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`pin-input:${e.id}:hidden`},wL=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`pin-input:${e.id}:label`},OL=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`pin-input:${e.id}:control`},VL=e=>e.getById(Go(e)),mc=e=>{let n=`input[data-ownedby=${CSS.escape(Go(e))}]`;return Oe(VL(e),n)},Bo=(e,t)=>mc(e)[t],AL=e=>mc(e)[0],Rg=e=>e.getById(Ng(e)),kg=(e,t)=>{e.value=t,e.setAttribute("value",t)},xL={numeric:/^[0-9]+$/,alphabetic:/^[A-Za-z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/i};({choose:NL,createMachine:LL}=Mt()),DL=LL({props({props:e}){return y(h({placeholder:"\u25CB",otp:!1,type:"numeric",defaultValue:e.count?fc([],e.count):[]},e),{translations:h({inputLabel:(t,n)=>`pin code ${t+1} of ${n}`},e.translations)})},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({value:e("value"),defaultValue:e("defaultValue"),isEqual:Ce,onChange(n){var r;(r=e("onValueChange"))==null||r({value:n,valueAsString:n.join("")})}})),focusedIndex:t(()=>({sync:!0,defaultValue:-1})),count:t(()=>({defaultValue:e("count")}))}},computed:{_value:({context:e})=>fc(e.get("value"),e.get("count")),valueLength:({computed:e})=>e("_value").length,filledValueLength:({computed:e})=>e("_value").filter(t=>(t==null?void 0:t.trim())!=="").length,isValueComplete:({computed:e})=>e("valueLength")===e("filledValueLength"),valueAsString:({computed:e})=>e("_value").join(""),focusedValue:({computed:e,context:t})=>e("_value")[t.get("focusedIndex")]||""},entry:NL([{guard:"autoFocus",actions:["setInputCount","setFocusIndexToFirst"]},{actions:["setInputCount"]}]),watch({action:e,track:t,context:n,computed:r}){t([()=>n.get("focusedIndex")],()=>{e(["focusInput","selectInputIfNeeded"])}),t([()=>n.get("value").join(",")],()=>{e(["syncInputElements","dispatchInputEvent"])}),t([()=>r("isValueComplete")],()=>{e(["invokeOnComplete","blurFocusedInputIfNeeded","autoSubmitIfNeeded"])})},on:{"VALUE.SET":[{guard:"hasIndex",actions:["setValueAtIndex"]},{actions:["setValue"]}],"VALUE.CLEAR":{actions:["clearValue","setFocusIndexToFirst"]}},states:{idle:{on:{"INPUT.FOCUS":{target:"focused",actions:["setFocusedIndex"]}}},focused:{on:{"INPUT.CHANGE":{actions:["setFocusedValue","syncInputValue","advanceFocusedIndex"]},"INPUT.ADVANCE":{actions:["advanceFocusedIndex"]},"INPUT.PASTE":{actions:["setPastedValue","setLastValueFocusIndex"]},"INPUT.FOCUS":{actions:["setFocusedIndex","focusInput"]},"INPUT.BLUR":{target:"idle",actions:["clearFocusedIndex"]},"INPUT.DELETE":{guard:"hasValue",actions:["clearFocusedValue"]},"INPUT.ARROW_LEFT":{actions:["setPrevFocusedIndex"]},"INPUT.ARROW_RIGHT":{actions:["setNextFocusedIndex"]},"INPUT.HOME":{actions:["setFocusIndexToFirst"]},"INPUT.END":{actions:["setFocusIndexToLast"]},"INPUT.BACKSPACE":[{guard:"hasValue",actions:["clearFocusedValue","setPrevFocusedIndex"]},{actions:["setPrevFocusedIndex","clearFocusedValue"]}],"INPUT.ENTER":{guard:"isValueComplete",actions:["requestFormSubmit"]},"VALUE.INVALID":{actions:["invokeOnInvalid"]}}}},implementations:{guards:{autoFocus:({prop:e})=>!!e("autoFocus"),hasValue:({context:e})=>e.get("value")[e.get("focusedIndex")]!=="",isValueComplete:({computed:e})=>e("isValueComplete"),hasIndex:({event:e})=>e.index!==void 0},actions:{dispatchInputEvent({computed:e,scope:t}){let n=Rg(t);Hi(n,{value:e("valueAsString")})},setInputCount({scope:e,context:t,prop:n}){if(n("count"))return;let r=mc(e);t.set("count",r.length)},focusInput({context:e,scope:t}){let n=e.get("focusedIndex");n!==-1&&queueMicrotask(()=>{var r;(r=Bo(t,n))==null||r.focus({preventScroll:!0})})},selectInputIfNeeded({context:e,prop:t,scope:n}){let r=e.get("focusedIndex");!t("selectOnFocus")||r===-1||B(()=>{var i;(i=Bo(n,r))==null||i.select()})},invokeOnComplete({computed:e,prop:t}){var n;e("isValueComplete")&&((n=t("onValueComplete"))==null||n({value:e("_value"),valueAsString:e("valueAsString")}))},invokeOnInvalid({context:e,event:t,prop:n}){var r;(r=n("onValueInvalid"))==null||r({value:t.value,index:e.get("focusedIndex")})},clearFocusedIndex({context:e}){e.set("focusedIndex",-1)},setFocusedIndex({context:e,event:t,computed:n}){let r=Math.min(n("filledValueLength"),n("valueLength")-1);e.set("focusedIndex",Math.min(t.index,r))},setValue({context:e,event:t}){let n=fc(t.value,e.get("count"));e.set("value",n)},setFocusedValue({context:e,event:t,computed:n,flush:r}){let i=n("focusedValue"),a=e.get("focusedIndex"),o=RE(i,t.value);r(()=>{e.set("value",Od(n("_value"),a,o))})},revertInputValue({context:e,computed:t,scope:n}){let r=Bo(n,e.get("focusedIndex"));kg(r,t("focusedValue"))},syncInputValue({context:e,event:t,scope:n}){let r=e.get("value"),i=Bo(n,t.index);kg(i,r[t.index])},syncInputElements({context:e,scope:t}){let n=mc(t),r=e.get("value");n.forEach((i,a)=>{kg(i,r[a])})},setPastedValue({context:e,event:t,computed:n,flush:r}){B(()=>{let i=n("valueAsString"),a=e.get("focusedIndex"),o=n("valueLength"),s=n("filledValueLength"),l=Math.min(a,s),c=l>0?i.substring(0,a):"",d=t.value.substring(0,o-l),u=fc(`${c}${d}`.split(""),o);r(()=>{e.set("value",u)})})},setValueAtIndex({context:e,event:t,computed:n}){let r=RE(n("focusedValue"),t.value);e.set("value",Od(n("_value"),t.index,r))},clearValue({context:e}){let t=Array.from({length:e.get("count")}).fill("");queueMicrotask(()=>{e.set("value",t)})},clearFocusedValue({context:e,computed:t}){let n=e.get("focusedIndex");if(n===-1)return;let r=[...t("_value")];r.splice(n,1),r.push(""),e.set("value",r)},setFocusIndexToFirst({context:e}){e.set("focusedIndex",0)},setFocusIndexToLast({context:e,computed:t}){e.set("focusedIndex",Math.max(t("filledValueLength")-1,0))},advanceFocusedIndex({context:e,computed:t}){e.set("focusedIndex",Math.min(e.get("focusedIndex")+1,t("valueLength")-1))},setNextFocusedIndex({context:e,computed:t}){let n=e.get("focusedIndex")+1,r=Math.min(t("filledValueLength"),t("valueLength")-1);e.set("focusedIndex",Math.min(n,r))},setPrevFocusedIndex({context:e}){e.set("focusedIndex",Math.max(e.get("focusedIndex")-1,0))},setLastValueFocusIndex({context:e,computed:t}){B(()=>{e.set("focusedIndex",Math.min(t("filledValueLength"),t("valueLength")-1))})},blurFocusedInputIfNeeded({context:e,computed:t,prop:n,scope:r}){!n("blurOnComplete")||!t("isValueComplete")||B(()=>{var i;(i=Bo(r,e.get("focusedIndex")))==null||i.blur()})},requestFormSubmit({computed:e,prop:t,scope:n}){var i;if(!t("name")||!e("isValueComplete"))return;let r=Rg(n);(i=r==null?void 0:r.form)==null||i.requestSubmit()},autoSubmitIfNeeded({computed:e,prop:t,scope:n}){var i;if(!t("autoSubmit")||!e("isValueComplete"))return;let r=Rg(n);(i=r==null?void 0:r.form)==null||i.requestSubmit()}}}});FL=class extends X{initMachine(e){return new Y(DL,e)}initApi(){return this.zagConnect(kL)}render(){var i,a;let e=(i=this.el.querySelector('[data-scope="pin-input"][data-part="root"]'))!=null?i:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="pin-input"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-scope="pin-input"][data-part="hidden-input"]');n instanceof HTMLInputElement&&(Er(n,this.el,(a=this.api.valueAsString)!=null?a:"",(o,s)=>this.spreadProps(o,s),this.api.getHiddenInputProps()),V(this.el,"submitName")&&(n.removeAttribute("name"),n.removeAttribute("form"))),Ji(this.el,"pin-input");let r=this.el.querySelector('[data-scope="pin-input"][data-part="control"]');r&&this.spreadProps(r,this.api.getControlProps()),this.api.items.forEach(o=>{let s=this.el.querySelector(`[data-scope="pin-input"][data-part="input"][data-index="${o}"]`);s&&this.spreadProps(s,this.api.getInputProps({index:o}))})}};HL={mounted(){let e=this.el,t=this;t.allowFormNotify=!1;let n=this.pushEvent.bind(this),r=()=>j(this.liveSocket),i=()=>t.allowFormNotify===!0,a=new FL(e,$L(e,n,r,i));try{a.init(),this.pinInput=a}finally{e.removeAttribute("data-loading")}queueMicrotask(()=>{vc(e,a.api.value,void 0,{notifyLiveView:!1}),t.allowFormNotify=!0});let o=c=>{let d=a.api,u=d.value,p=d.valueAsString;Ge({respondTo:c,canPushServer:r(),pushEvent:n,serverEventName:"pin_input_value_response",serverPayload:{id:e.id,value:u,valueAsString:p},el:e,domEventName:"pin-input-value",domDetail:{id:e.id,value:u,valueAsString:p}})},s=ie(e);this.domRegistry=s,s.add("corex:pin-input:set-value",c=>{var u;let d=(u=c.detail)==null?void 0:u.value;Array.isArray(d)&&a.api.setValue(d)}),s.add("corex:pin-input:clear",()=>{a.api.clearValue()}),s.add("corex:pin-input:value",c=>{o(de(c.detail))});let l=re(this);this.handleRegistry=l,l.add("pin_input_set_value",c=>{$(e.id,H(c))&&Array.isArray(c.value)&&a.api.setValue(c.value)}),l.add("pin_input_clear",c=>{$(e.id,H(c))&&a.api.clearValue()}),l.add("pin_input_value",c=>{$(e.id,H(c))&&o(de(c))})},updated(){var i;let e=this.el,t=this.pinInput,n=(i=U(e,"count"))!=null?i:0,r=LE(e,n);t==null||t.updateProps(y(h({id:e.id,count:n},r),{disabled:O(e,"disabled"),invalid:O(e,"invalid"),required:O(e,"required"),readOnly:O(e,"readonly"),mask:O(e,"mask"),otp:O(e,"otp"),blurOnComplete:O(e,"blurOnComplete"),selectOnFocus:O(e,"selectOnFocus"),name:DE(e),form:V(e,"submitName")?void 0:V(e,"form"),dir:q(e),type:V(e,"type"),placeholder:V(e,"placeholder")})),"value"in r&&vc(e,r.value,void 0,{notifyLiveView:!1})},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.pinInput)==null||n.destroy()}}});var qE={};pe(qE,{RadioGroup:()=>iD,valueChangePayload:()=>UE});function YL(e,t){let{context:n,send:r,computed:i,prop:a,scope:o}=e,s=i("isDisabled"),l=a("invalid"),c=a("readOnly");function d(g){return{value:g.value,invalid:!!g.invalid||!!l,disabled:!!g.disabled||s,checked:n.get("value")===g.value,focused:n.get("focusedValue")===g.value,focusVisible:n.get("focusVisibleValue")===g.value,hovered:n.get("hoveredValue")===g.value,active:n.get("activeValue")===g.value}}function u(g){let f=d(g);return{"data-focus":b(f.focused),"data-focus-visible":b(f.focusVisible),"data-disabled":b(f.disabled),"data-readonly":b(c),"data-state":f.checked?"checked":"unchecked","data-hover":b(f.hovered),"data-invalid":b(f.invalid),"data-orientation":a("orientation"),"data-ssr":b(n.get("ssr"))}}let p=()=>{var f;let g=(f=KL(o))!=null?f:WL(o);g==null||g.focus()};return{focus:p,value:n.get("value"),setValue(g){r({type:"SET_VALUE",value:g,isTrusted:!1})},clearValue(){r({type:"SET_VALUE",value:null,isTrusted:!1})},getRootProps(){return t.element(y(h({},Va.root.attrs),{role:"radiogroup",id:yc(o),"aria-labelledby":_E(o),"aria-required":a("required")||void 0,"aria-disabled":s||void 0,"aria-readonly":c||void 0,"data-orientation":a("orientation"),"data-disabled":b(s),"data-invalid":b(l),"data-required":b(a("required")),"aria-orientation":a("orientation"),dir:a("dir"),style:{position:"relative"}}))},getLabelProps(){return t.element(y(h({},Va.label.attrs),{dir:a("dir"),"data-orientation":a("orientation"),"data-disabled":b(s),"data-invalid":b(l),"data-required":b(a("required")),id:_E(o),onClick:p}))},getItemState:d,getItemProps(g){let f=d(g);return t.label(y(h(y(h({},Va.item.attrs),{dir:a("dir"),id:BE(o,g.value),htmlFor:Fg(o,g.value)}),u(g)),{onPointerMove(){f.disabled||f.hovered||r({type:"SET_HOVERED",value:g.value,hovered:!0})},onPointerLeave(){f.disabled||r({type:"SET_HOVERED",value:null})},onPointerDown(m){f.disabled||fe(m)&&(f.focused&&m.pointerType==="mouse"&&m.preventDefault(),r({type:"SET_ACTIVE",value:g.value,active:!0}))},onPointerUp(){f.disabled||r({type:"SET_ACTIVE",value:null})},onClick(){var m;!f.disabled&&wt()&&((m=UL(o,g.value))==null||m.focus())}}))},getItemTextProps(g){return t.element(h(y(h({},Va.itemText.attrs),{dir:a("dir"),id:$E(o,g.value)}),u(g)))},getItemControlProps(g){let f=d(g);return t.element(h(y(h({},Va.itemControl.attrs),{dir:a("dir"),id:GL(o,g.value),"data-active":b(f.active),"aria-hidden":!0}),u(g)))},getItemHiddenInputProps(g){let f=d(g);return t.input({"data-ownedby":yc(o),id:Fg(o,g.value),type:"radio",name:a("name")||a("id"),form:a("form"),value:g.value,required:a("required"),"aria-labelledby":$E(o,g.value),"aria-invalid":f.invalid||void 0,onClick(m){if(c){m.preventDefault();return}m.currentTarget.checked&&r({type:"SET_VALUE",value:g.value,isTrusted:!0})},onBlur(){r({type:"SET_FOCUSED",value:null,focused:!1,focusVisible:!1})},onFocus(){let m=vn();r({type:"SET_FOCUSED",value:g.value,focused:!0,focusVisible:m})},onKeyDown(m){m.defaultPrevented||m.key===" "&&r({type:"SET_ACTIVE",value:g.value,active:!0})},onKeyUp(m){m.defaultPrevented||m.key===" "&&r({type:"SET_ACTIVE",value:null})},disabled:f.disabled||c,defaultChecked:f.checked,style:mt})},getIndicatorProps(){let g=n.get("indicatorRect"),f=n.get("animateIndicator");return t.element(y(h({id:GE(o)},Va.indicator.attrs),{dir:a("dir"),hidden:n.get("value")==null||XL(g),"data-disabled":b(s),"data-orientation":a("orientation"),onTransitionEnd(m){ne(m)===m.currentTarget&&r({type:"INDICATOR_TRANSITION_END"})},style:{"--transition-property":"left, top, width, height","--left":ke(g==null?void 0:g.x),"--top":ke(g==null?void 0:g.y),"--width":ke(g==null?void 0:g.width),"--height":ke(g==null?void 0:g.height),position:"absolute",willChange:f?"var(--transition-property)":"auto",transitionProperty:f?"var(--transition-property)":"none",transitionDuration:f?"var(--transition-duration, 150ms)":"0ms",transitionTimingFunction:"var(--transition-timing-function)",[a("orientation")==="horizontal"?"left":"top"]:a("orientation")==="horizontal"?"var(--left)":"var(--top)"}}))}}}function Lg(e){return O(e,"formField")}function eD(e,t){t?e.setAttribute("data-invalid",""):e.removeAttribute("data-invalid")}function tD(e,t,n){e.querySelectorAll(`[data-scope="${t}"][data-part="error"]`).forEach(r=>{r.hidden=!n})}function nD(e,t){eD(e,!1),tD(e,t,!1)}function rD(e){return e!=null&&e!==""}function Dg(e,t,n={}){let r=e.querySelector('[data-scope="radio-group"][data-part="value-input"]');r&&yt(r,t!=null?t:"",n)}function UE(e,t){return{id:e.id,value:t.value}}var BL,Va,yc,_E,BE,Fg,GL,$E,GE,bc,UL,qL,WL,KL,HE,zL,jL,XL,ZL,JL,QL,iD,WE=ee(()=>{"use strict";sl();Bt();Kt();yn();$e();Ve();be();oe();BL=z("radio-group").parts("root","label","item","itemText","itemControl","indicator"),Va=BL.build(),yc=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`radio-group:${e.id}`},_E=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`radio-group:${e.id}:label`},BE=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.item)==null?void 0:r.call(n,t))!=null?i:`radio-group:${e.id}:radio:${t}`},Fg=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemHiddenInput)==null?void 0:r.call(n,t))!=null?i:`radio-group:${e.id}:radio:input:${t}`},GL=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemControl)==null?void 0:r.call(n,t))!=null?i:`radio-group:${e.id}:radio:control:${t}`},$E=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemLabel)==null?void 0:r.call(n,t))!=null?i:`radio-group:${e.id}:radio:label:${t}`},GE=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.indicator)!=null?n:`radio-group:${e.id}:indicator`},bc=e=>e.getById(yc(e)),UL=(e,t)=>e.getById(Fg(e,t)),qL=e=>e.getById(GE(e)),WL=e=>{var t;return(t=bc(e))==null?void 0:t.querySelector("input:not(:disabled)")},KL=e=>{var t;return(t=bc(e))==null?void 0:t.querySelector("input:not(:disabled):checked")},HE=e=>{let n=`input[type=radio][data-ownedby='${CSS.escape(yc(e))}']:not([disabled])`;return Oe(bc(e),n)},zL=(e,t)=>{if(t)return e.getById(BE(e,t))},jL=e=>{var t,n,r,i;return{x:(t=e==null?void 0:e.offsetLeft)!=null?t:0,y:(n=e==null?void 0:e.offsetTop)!=null?n:0,width:(r=e==null?void 0:e.offsetWidth)!=null?r:0,height:(i=e==null?void 0:e.offsetHeight)!=null?i:0}};XL=e=>e==null||e.width===0&&e.height===0&&e.x===0&&e.y===0,{not:ZL}=we(),JL=te({props({props:e}){return h({orientation:"vertical"},e)},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var r;(r=e("onValueChange"))==null||r({value:n})}})),activeValue:t(()=>({defaultValue:null})),focusedValue:t(()=>({defaultValue:null})),focusVisibleValue:t(()=>({defaultValue:null})),hoveredValue:t(()=>({defaultValue:null})),indicatorRect:t(()=>({defaultValue:null})),animateIndicator:t(()=>({defaultValue:!1})),fieldsetDisabled:t(()=>({defaultValue:!1})),ssr:t(()=>({defaultValue:!0}))}},refs(){return{indicatorCleanup:null,focusVisibleValue:null,prevValue:null}},computed:{isDisabled:({prop:e,context:t})=>!!e("disabled")||t.get("fieldsetDisabled")},entry:["syncPrevValue","syncIndicatorRect","syncSsr"],exit:["cleanupObserver"],effects:["trackFormControlState","trackFocusVisible"],watch({track:e,action:t,context:n}){e([()=>n.get("value")],()=>{t(["syncIndicatorAnimation","syncIndicatorRect","syncInputElements"])})},on:{SET_VALUE:[{guard:ZL("isTrusted"),actions:["setValue","dispatchChangeEvent"]},{actions:["setValue"]}],SET_HOVERED:{actions:["setHovered"]},SET_ACTIVE:{actions:["setActive"]},SET_FOCUSED:{actions:["setFocused"]},INDICATOR_TRANSITION_END:{actions:["clearIndicatorAnimation"]}},states:{idle:{}},implementations:{guards:{isTrusted:({event:e})=>!!e.isTrusted},effects:{trackFormControlState({context:e,scope:t}){return ht(bc(t),{onFieldsetDisabledChange(n){e.set("fieldsetDisabled",n)},onFormReset(){e.set("value",e.initial("value"))}})},trackFocusVisible({scope:e}){var t;return nt({root:(t=e.getRootNode)==null?void 0:t.call(e)})}},actions:{setValue({context:e,event:t}){e.set("value",t.value)},setHovered({context:e,event:t}){e.set("hoveredValue",t.value)},setActive({context:e,event:t}){e.set("activeValue",t.value)},setFocused({context:e,event:t}){e.set("focusedValue",t.value);let n=t.value!=null&&t.focusVisible?t.value:null;e.set("focusVisibleValue",n)},syncPrevValue({context:e,refs:t}){t.set("prevValue",e.get("value"))},syncIndicatorAnimation({context:e,refs:t}){let n=t.get("prevValue"),r=e.get("value"),i=n!=null&&r!=null&&n!==r;e.set("animateIndicator",i),t.set("prevValue",r)},clearIndicatorAnimation({context:e}){e.set("animateIndicator",!1)},syncInputElements({context:e,scope:t}){HE(t).forEach(r=>{r.checked=r.value===e.get("value")})},cleanupObserver({refs:e}){var t;(t=e.get("indicatorCleanup"))==null||t()},syncSsr({context:e}){e.set("ssr",!1)},syncIndicatorRect({context:e,scope:t,refs:n}){var s;if((s=n.get("indicatorCleanup"))==null||s(),!qL(t))return;let r=e.get("value"),i=zL(t,r);if(r==null||!i){e.set("indicatorRect",null);return}let a=()=>{e.set("indicatorRect",jL(i))};a();let o=Un.observe(i,a);n.set("indicatorCleanup",o)},dispatchChangeEvent({context:e,scope:t}){HE(t).forEach(r=>{let i=r.value===e.get("value");i!==r.checked&&Bi(r,{checked:i})})}}}}),QL=class extends X{initMachine(e){return new Y(JL,e)}initApi(){return this.zagConnect(YL)}render(){var r;let e=(r=this.el.querySelector('[data-scope="radio-group"][data-part="root"]'))!=null?r:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="radio-group"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-scope="radio-group"][data-part="indicator"]');n&&this.spreadProps(n,this.api.getIndicatorProps()),this.el.querySelectorAll('[data-scope="radio-group"][data-part="item"]').forEach(i=>{let a=i.dataset.value;if(a==null)return;let o=i.dataset.disabled==="true",s=i.dataset.invalid==="true";this.spreadProps(i,this.api.getItemProps({value:a,disabled:o,invalid:s}));let l=i.querySelector('[data-scope="radio-group"][data-part="item-text"]');l&&this.spreadProps(l,this.api.getItemTextProps({value:a,disabled:o,invalid:s}));let c=i.querySelector('[data-scope="radio-group"][data-part="item-control"]');c&&this.spreadProps(c,this.api.getItemControlProps({value:a,disabled:o,invalid:s}));let d=i.querySelector('[data-scope="radio-group"][data-part="item-hidden-input"]');d instanceof HTMLInputElement&&(this.spreadProps(d,_d(this.api.getItemHiddenInputProps({value:a,disabled:o,invalid:s}))),d.checked=this.api.value===a,it(d,this.el))})}};iD={mounted(){var l;let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=new QL(e,y(h({id:e.id},Hs(e,"value","defaultValue")),{name:V(e,"name"),form:V(e,"form"),disabled:O(e,"disabled"),invalid:O(e,"invalid"),required:O(e,"required"),readOnly:O(e,"readonly"),dir:q(e),orientation:V(e,"orientation"),onValueChange:c=>{let d=c.value;if(Lg(e)&&(this.lastServerValue=d!=null?d:void 0),e.querySelectorAll('[data-scope="radio-group"][data-part="item-hidden-input"]').forEach(p=>{let g=p.value===d;p.checked!==g&&(p.checked=g),it(p,e)}),Dg(e,d),Lg(e)&&rD(d)&&(nD(e,"radio-group"),r.updateProps({invalid:!1})),!e.querySelector('[data-scope="radio-group"][data-part="value-input"]')){let p=e.querySelector('[data-scope="radio-group"][data-part="item-hidden-input"]:checked');p&&(Wt(p),p.dispatchEvent(new Event("input",{bubbles:!0})),p.dispatchEvent(new Event("change",{bubbles:!0})))}W({el:e,canPushServer:n(),pushEvent:t,payload:UE(e,c),serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})}}));r.init(),this.radioGroup=r,this.lastServerValue=(l=V(e,"value"))!=null?l:void 0,queueMicrotask(()=>{var c;Lg(e)&&Dg(e,(c=r.api.value)!=null?c:null,{markUsed:!1})});let i=e.querySelector('[data-scope="radio-group"][data-part="value-input"]');i&&it(i,e);let a=c=>{let d=r.api.value;Ge({respondTo:c,canPushServer:n(),pushEvent:t,serverEventName:"radio_group_value_response",serverPayload:{id:e.id,value:d},el:e,domEventName:"radio-group-value",domDetail:{id:e.id,value:d}})},o=ie(e);this.domRegistry=o,o.add("corex:radio-group:set-value",c=>{r.api.setValue(c.detail.value)}),o.add("corex:radio-group:clear-value",()=>{r.api.clearValue()}),o.add("corex:radio-group:focus",()=>{r.api.focus()}),o.add("corex:radio-group:value",c=>{a(de(c.detail))});let s=re(this);this.handleRegistry=s,s.add("radio_group_set_value",c=>{$(e.id,H(c))&&r.api.setValue(c.value)}),s.add("radio_group_clear_value",c=>{$(e.id,H(c))&&r.api.clearValue()}),s.add("radio_group_focus",c=>{$(e.id,H(c))&&r.api.focus()}),s.add("radio_group_value",c=>{$(e.id,H(c))&&a(de(c))})},updated(){var r,i;let e=this.el,t=this.radioGroup,n=br(e,this.lastServerValue);"value"in n&&(this.lastServerValue=(r=n.value)!=null?r:void 0),t==null||t.updateProps(y(h({id:e.id},n),{name:V(e,"name"),disabled:O(e,"disabled"),invalid:O(e,"invalid"),required:O(e,"required"),readOnly:O(e,"readonly"),orientation:V(e,"orientation"),dir:q(e)})),"value"in n&&Dg(e,(i=n.value)!=null?i:null,{markUsed:!1})},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.radioGroup)==null||n.destroy()}}});var tP={};pe(tP,{Select:()=>fD,buildCollection:()=>QE,formatSelectHiddenValue:()=>Ug,reapplySelectInteractiveState:()=>eP,syncSelectHiddenInputForPhoenix:()=>JE,syncSelectHiddenSelectForPhoenix:()=>Sc});function dD(e,t){let{context:n,prop:r,scope:i,state:a,computed:o,send:s}=e,l=r("translations"),c=r("disabled")||n.get("fieldsetDisabled"),d=!!r("invalid"),u=!!r("required"),p=!!r("readOnly"),g=r("composite"),f=r("collection"),m=a.hasTag("open"),S=a.matches("focused"),T=n.get("highlightedValue"),w=n.get("highlightedItem"),I=o("selectedItems"),P=n.get("currentPlacement"),v=o("isTypingAhead"),E=o("isInteractive"),R=T?Bg(i,T):void 0;function x(A){let N=f.getItemDisabled(A.item),k=f.getItemValue(A.item);return nn(k,()=>`[zag-js] No value found for item ${JSON.stringify(A.item)}`),{value:k,disabled:!!(c||N),highlighted:T===k,selected:n.get("value").includes(k)}}let C=Ut(y(h({},r("positioning")),{placement:P}));return{open:m,focused:S,empty:n.get("value").length===0,highlightedItem:w,highlightedValue:T,selectedItems:I,hasSelectedItems:o("hasSelectedItems"),value:n.get("value"),valueAsString:o("valueAsString"),collection:f,multiple:!!r("multiple"),disabled:!!c,reposition(A={}){s({type:"POSITIONING.SET",options:A})},focus(){var A;(A=Ti(i))==null||A.focus({preventScroll:!0})},setOpen(A){a.hasTag("open")!==A&&s({type:A?"OPEN":"CLOSE"})},selectValue(A){s({type:"ITEM.SELECT",value:A})},setValue(A){s({type:"VALUE.SET",value:A})},selectAll(){s({type:"VALUE.SET",value:f.getValues()})},setHighlightValue(A){s({type:"HIGHLIGHTED_VALUE.SET",value:A})},clearHighlightValue(){s({type:"HIGHLIGHTED_VALUE.CLEAR"})},clearValue(A){s(A?{type:"ITEM.CLEAR",value:A}:{type:"VALUE.CLEAR"})},getItemState:x,getRootProps(){return t.element(y(h({},lt.root.attrs),{dir:r("dir"),id:oD(i),"data-invalid":b(d),"data-readonly":b(p)}))},getLabelProps(){return t.label(y(h({dir:r("dir"),id:Ec(i)},lt.label.attrs),{"data-disabled":b(c),"data-invalid":b(d),"data-readonly":b(p),"data-required":b(u),htmlFor:Gg(i),onClick(A){var N;A.defaultPrevented||c||(N=Ti(i))==null||N.focus({preventScroll:!0})}}))},getControlProps(){return t.element(y(h({},lt.control.attrs),{dir:r("dir"),id:sD(i),"data-state":m?"open":"closed","data-focus":b(S),"data-disabled":b(c),"data-invalid":b(d)}))},getValueTextProps(){return t.element(y(h({},lt.valueText.attrs),{dir:r("dir"),"data-disabled":b(c),"data-invalid":b(d),"data-focus":b(S)}))},getTriggerProps(){return t.button(y(h({id:Hg(i),disabled:c,dir:r("dir"),type:"button",role:"combobox","aria-controls":$g(i),"aria-expanded":m,"aria-haspopup":"listbox","data-state":m?"open":"closed","aria-invalid":d,"aria-required":u,"aria-labelledby":Ec(i)},lt.trigger.attrs),{"data-disabled":b(c),"data-invalid":b(d),"data-readonly":b(p),"data-placement":P,"data-placeholder-shown":b(!o("hasSelectedItems")),onClick(A){E&&(A.defaultPrevented||s({type:"TRIGGER.CLICK"}))},onFocus(){s({type:"TRIGGER.FOCUS"})},onBlur(){s({type:"TRIGGER.BLUR"})},onKeyDown(A){if(A.defaultPrevented||!E)return;let k={ArrowUp(){s({type:"TRIGGER.ARROW_UP"})},ArrowDown(L){s({type:L.altKey?"OPEN":"TRIGGER.ARROW_DOWN"})},ArrowLeft(){s({type:"TRIGGER.ARROW_LEFT"})},ArrowRight(){s({type:"TRIGGER.ARROW_RIGHT"})},Home(){s({type:"TRIGGER.HOME"})},End(){s({type:"TRIGGER.END"})},Enter(){s({type:"TRIGGER.ENTER"})},Space(L){s(v?{type:"TRIGGER.TYPEAHEAD",key:L.key}:{type:"TRIGGER.ENTER"})}}[me(A,{dir:r("dir"),orientation:"vertical"})];if(k){k(A),A.preventDefault();return}ft.isValidEvent(A)&&(s({type:"TRIGGER.TYPEAHEAD",key:A.key}),A.preventDefault())}}))},getIndicatorProps(){return t.element(y(h({},lt.indicator.attrs),{dir:r("dir"),"aria-hidden":!0,"data-state":m?"open":"closed","data-disabled":b(c),"data-invalid":b(d),"data-readonly":b(p)}))},getItemProps(A){let N=x(A);return t.element(y(h({id:Bg(i,N.value),role:"option"},lt.item.attrs),{dir:r("dir"),"data-value":N.value,"aria-selected":N.selected,"data-state":N.selected?"checked":"unchecked","data-highlighted":b(N.highlighted),"data-disabled":b(N.disabled),"aria-disabled":se(N.disabled),onPointerMove(k){N.disabled||k.pointerType!=="mouse"||N.value!==T&&s({type:"ITEM.POINTER_MOVE",value:N.value})},onClick(k){k.defaultPrevented||N.disabled||s({type:"ITEM.CLICK",src:"pointerup",value:N.value})},onPointerLeave(k){var K;N.disabled||A.persistFocus||k.pointerType!=="mouse"||!((K=e.event.previous())!=null&&K.type.includes("POINTER"))||s({type:"ITEM.POINTER_LEAVE"})}}))},getItemTextProps(A){let N=x(A);return t.element(y(h({},lt.itemText.attrs),{"data-state":N.selected?"checked":"unchecked","data-disabled":b(N.disabled),"data-highlighted":b(N.highlighted)}))},getItemIndicatorProps(A){let N=x(A);return t.element(y(h({"aria-hidden":!0},lt.itemIndicator.attrs),{"data-state":N.selected?"checked":"unchecked",hidden:!N.selected}))},getItemGroupLabelProps(A){let{htmlFor:N}=A;return t.element(y(h({},lt.itemGroupLabel.attrs),{id:KE(i,N),dir:r("dir"),role:"presentation"}))},getItemGroupProps(A){let{id:N}=A;return t.element(y(h({},lt.itemGroup.attrs),{"data-disabled":b(c),id:lD(i,N),"aria-labelledby":KE(i,N),role:"group",dir:r("dir")}))},getClearTriggerProps(){return t.button(y(h({},lt.clearTrigger.attrs),{id:XE(i),type:"button","aria-label":l.clearTriggerLabel,"data-invalid":b(d),disabled:c,hidden:!o("hasSelectedItems"),dir:r("dir"),onClick(A){A.defaultPrevented||s({type:"CLEAR.CLICK"})}}))},getHiddenSelectProps(){let A=n.get("value"),N=r("multiple")?A:A==null?void 0:A[0],k=L=>{let K=Ot(L);sd(K)||s({type:"VALUE.SET",value:uD(L.currentTarget)})};return t.select({name:r("name"),form:r("form"),disabled:c,multiple:r("multiple"),required:r("required"),"aria-hidden":!0,id:Gg(i),defaultValue:N,style:mt,tabIndex:-1,autoComplete:r("autoComplete"),onChange:k,onInput:k,onFocus(){var L;(L=Ti(i))==null||L.focus({preventScroll:!0})},"aria-labelledby":Ec(i)})},getPositionerProps(){return t.element(y(h({},lt.positioner.attrs),{dir:r("dir"),id:ZE(i),style:C.floating}))},getContentProps(){return t.element(y(h({hidden:!m,dir:r("dir"),id:$g(i),role:g?"listbox":"dialog"},lt.content.attrs),{"data-state":m?"open":"closed","data-placement":P,"data-activedescendant":R,"aria-activedescendant":g?R:void 0,"aria-multiselectable":r("multiple")&&g?!0:void 0,"aria-labelledby":Ec(i),tabIndex:0,onKeyDown(A){if(!E||!ge(A.currentTarget,ne(A)))return;if(A.key==="Tab"&&!Ns(A)){A.preventDefault();return}let N={ArrowUp(){s({type:"CONTENT.ARROW_UP"})},ArrowDown(){s({type:"CONTENT.ARROW_DOWN"})},Home(){s({type:"CONTENT.HOME"})},End(){s({type:"CONTENT.END"})},Enter(){s({type:"ITEM.CLICK",src:"keydown.enter"})},Space(K){var J;v?s({type:"CONTENT.TYPEAHEAD",key:K.key}):(J=N.Enter)==null||J.call(N,K)}},k=N[me(A)];if(k){k(A),A.preventDefault();return}let L=ne(A);$t(L)||ft.isValidEvent(A)&&(s({type:"CONTENT.TYPEAHEAD",key:A.key}),A.preventDefault())}}))},getListProps(){return t.element(y(h({},lt.list.attrs),{tabIndex:0,role:g?void 0:"listbox","aria-labelledby":Hg(i),"aria-activedescendant":g?void 0:R,"aria-multiselectable":!g&&r("multiple")?!0:void 0}))}}}function jE(e){var n,r;let t=(r=e.restoreFocus)!=null?r:(n=e.previousEvent)==null?void 0:n.restoreFocus;return t==null||!!t}function Pc(e){let t=e.querySelector('[data-scope="select"][data-part="hidden-select"]');if(!t)return null;let n=V(e,"hiddenSelectName");return n?(t.name=n,t.disabled=!1,t):t.name?t:null}function Ug(e,t){var r;let n=t.map(i=>String(i));return n.length===0||O(e,"multiple")&&Pc(e)?"":O(e,"multiple")?n.join(","):(r=n[0])!=null?r:""}function Sc(e,t,n){let r=new Set(t.map(String));Array.from(e.options).forEach(i=>{if(i.value===""){i.selected=!1;return}i.selected=r.has(i.value)}),queueMicrotask(()=>{n==null||n(),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))})}function JE(e,t,n){let r=Pc(e);if(r&&O(e,"multiple")){Sc(r,t,n);return}let i=e.querySelector('[data-scope="select"][data-part="value-input"]');i&&Vr(i,()=>Ug(e,t),n)}function QE(e,t){return Ic(Rr(e,t))}function YE(e,t,n,r,i){let a=O(e,"redirect");return{id:e.id,disabled:O(e,"disabled"),closeOnSelect:O(e,"closeOnSelect"),dir:q(e),loopFocus:O(e,"loopFocus"),multiple:a?!1:O(e,"multiple"),invalid:O(e,"invalid"),name:V(e,"name"),form:V(e,"form"),readOnly:O(e,"readonly"),required:O(e,"required"),deselectable:O(e,"deselectable"),positioning:qe(e),onValueChange:o=>{let s=o.value.length>0?String(o.value[0]):null;if(O(e,"redirect")&&s){let l=e.querySelector(`[data-scope="select"][data-part="item"][data-value="${CSS.escape(s)}"]`);On(wn(l,s),{liveSocket:t})}JE(e,o.value,i),W({el:e,canPushServer:r(),pushEvent:n,payload:{id:e.id,value:o.value,items:o.items},serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})}}}function eP(e){if(e.removeAttribute("data-loading"),O(e,"disabled")||O(e,"readonly"))return;let t=e.querySelector('[data-scope="select"][data-part="trigger"]');!t||O(t,"disabled")||(t.disabled=!1,t.removeAttribute("disabled"))}var aD,lt,Ic,oD,$g,Hg,XE,Ec,sD,Bg,Gg,ZE,lD,KE,Mg,Uo,Ti,cD,zE,_g,uD,qo,Ii,gD,pD,hD,fD,nP=ee(()=>{"use strict";ii();Or();on();Kt();xr();Nl();ca();da();yn();$e();Ve();be();oe();aD=z("select").parts("label","positioner","trigger","indicator","clearTrigger","item","itemText","itemIndicator","itemGroup","itemGroupLabel","list","content","root","control","valueText"),lt=aD.build(),Ic=e=>new Sn(e);Ic.empty=()=>new Sn({items:[]});oD=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`select:${e.id}`},$g=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`select:${e.id}:content`},Hg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`select:${e.id}:trigger`},XE=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.clearTrigger)!=null?n:`select:${e.id}:clear-trigger`},Ec=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`select:${e.id}:label`},sD=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`select:${e.id}:control`},Bg=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.item)==null?void 0:r.call(n,t))!=null?i:`select:${e.id}:option:${t}`},Gg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenSelect)!=null?n:`select:${e.id}:select`},ZE=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`select:${e.id}:positioner`},lD=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemGroup)==null?void 0:r.call(n,t))!=null?i:`select:${e.id}:optgroup:${t}`},KE=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemGroupLabel)==null?void 0:r.call(n,t))!=null?i:`select:${e.id}:optgroup-label:${t}`},Mg=e=>e.getById(Gg(e)),Uo=e=>e.getById($g(e)),Ti=e=>e.getById(Hg(e)),cD=e=>e.getById(XE(e)),zE=e=>e.getById(ZE(e)),_g=(e,t)=>t==null?null:e.getById(Bg(e,t));uD=e=>e.multiple?Array.from(e.selectedOptions,t=>t.value):e.value?[e.value]:[],{and:qo,not:Ii,or:gD}=we(),pD=te({props({props:e}){var t;return y(h({loopFocus:!1,closeOnSelect:!e.multiple,composite:!0,defaultValue:[]},e),{collection:(t=e.collection)!=null?t:Ic.empty(),translations:h({clearTriggerLabel:"Clear value"},e.translations),positioning:h({placement:"bottom-start",gutter:8},e.positioning)})},context({prop:e,bindable:t,getContext:n}){var a,o;let r=(o=(a=e("value"))!=null?a:e("defaultValue"))!=null?o:[],i=e("collection").findMany(r);return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:Ce,onChange(s){var f,m;let l=n(),c=e("collection"),d=l.get("selectedItemMap"),u=kt({values:s,collection:c,selectedItemMap:d}),p=(f=e("value"))!=null?f:s,g=p===s?u:kt({values:p,collection:c,selectedItemMap:u.nextSelectedItemMap});return l.set("selectedItemMap",g.nextSelectedItemMap),(m=e("onValueChange"))==null?void 0:m({value:s,items:u.selectedItems})}})),highlightedValue:t(()=>({defaultValue:e("defaultHighlightedValue")||null,value:e("highlightedValue"),onChange(s){var l;(l=e("onHighlightChange"))==null||l({highlightedValue:s,highlightedItem:e("collection").find(s),highlightedIndex:e("collection").indexOf(s)})}})),currentPlacement:t(()=>({defaultValue:void 0})),fieldsetDisabled:t(()=>({defaultValue:!1})),highlightedItem:t(()=>({defaultValue:null})),selectedItemMap:t(()=>({defaultValue:la({selectedItems:i,collection:e("collection")})}))}},refs(){return{typeahead:h({},ft.defaultOptions)}},computed:{hasSelectedItems:({context:e})=>e.get("value").length>0,isTypingAhead:({refs:e})=>e.get("typeahead").keysSoFar!=="",isDisabled:({prop:e,context:t})=>!!e("disabled")||!!t.get("fieldsetDisabled"),isInteractive:({prop:e})=>!(e("disabled")||e("readOnly")),selectedItems:({context:e,prop:t})=>oi({values:e.get("value"),collection:t("collection"),selectedItemMap:e.get("selectedItemMap")}),valueAsString:({computed:e,prop:t})=>t("collection").stringifyItems(e("selectedItems"))},initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"idle"},entry:["syncSelectElement"],watch({context:e,prop:t,track:n,action:r}){n([()=>e.get("value").toString()],()=>{r(["syncSelectedItems","syncSelectElement","dispatchChangeEvent"])}),n([()=>t("open")],()=>{r(["toggleVisibility"])}),n([()=>e.get("highlightedValue")],()=>{r(["syncHighlightedItem"])}),n([()=>t("collection").toString()],()=>{r(["syncCollection"])})},on:{"HIGHLIGHTED_VALUE.SET":{actions:["setHighlightedItem"]},"HIGHLIGHTED_VALUE.CLEAR":{actions:["clearHighlightedItem"]},"ITEM.SELECT":{actions:["selectItem"]},"ITEM.CLEAR":{actions:["clearItem"]},"VALUE.SET":{actions:["setSelectedItems"]},"VALUE.CLEAR":{actions:["clearSelectedItems"]},"CLEAR.CLICK":{actions:["clearSelectedItems","focusTriggerEl"]}},effects:["trackFormControlState"],states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":[{guard:"isTriggerClickEvent",target:"open",actions:["setInitialFocus","highlightFirstSelectedItem"]},{target:"open",actions:["setInitialFocus"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen","setInitialFocus","highlightFirstSelectedItem"]}],"TRIGGER.FOCUS":{target:"focused"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen"]}]}},focused:{tags:["closed"],on:{"CONTROLLED.OPEN":[{guard:"isTriggerClickEvent",target:"open",actions:["setInitialFocus","highlightFirstSelectedItem"]},{guard:"isTriggerArrowUpEvent",target:"open",actions:["setInitialFocus","highlightComputedLastItem"]},{guard:gD("isTriggerArrowDownEvent","isTriggerEnterEvent"),target:"open",actions:["setInitialFocus","highlightComputedFirstItem"]},{target:"open",actions:["setInitialFocus"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen"]}],"TRIGGER.BLUR":{target:"idle"},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightFirstSelectedItem"]}],"TRIGGER.ENTER":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedFirstItem"]}],"TRIGGER.ARROW_UP":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedLastItem"]}],"TRIGGER.ARROW_DOWN":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedFirstItem"]}],"TRIGGER.ARROW_LEFT":[{guard:qo(Ii("multiple"),"hasSelectedItems"),actions:["selectPreviousItem"]},{guard:Ii("multiple"),actions:["selectLastItem"]}],"TRIGGER.ARROW_RIGHT":[{guard:qo(Ii("multiple"),"hasSelectedItems"),actions:["selectNextItem"]},{guard:Ii("multiple"),actions:["selectFirstItem"]}],"TRIGGER.HOME":{guard:Ii("multiple"),actions:["selectFirstItem"]},"TRIGGER.END":{guard:Ii("multiple"),actions:["selectLastItem"]},"TRIGGER.TYPEAHEAD":{guard:Ii("multiple"),actions:["selectMatchingItem"]}}},open:{tags:["open"],exit:["scrollContentToTop"],effects:["trackDismissableElement","trackFocusVisible","computePlacement","scrollToHighlightedItem"],on:{"CONTROLLED.CLOSE":[{guard:"restoreFocus",target:"focused",actions:["focusTriggerEl","clearHighlightedItem"]},{target:"idle",actions:["clearHighlightedItem"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{guard:"restoreFocus",target:"focused",actions:["invokeOnClose","focusTriggerEl","clearHighlightedItem"]},{target:"idle",actions:["invokeOnClose","clearHighlightedItem"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose","clearHighlightedItem"]}],"ITEM.CLICK":[{guard:qo("closeOnSelect","isOpenControlled"),actions:["selectHighlightedItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectHighlightedItem","invokeOnClose","focusTriggerEl","clearHighlightedItem"]},{actions:["selectHighlightedItem"]}],"CONTENT.HOME":{actions:["highlightFirstItem"]},"CONTENT.END":{actions:["highlightLastItem"]},"CONTENT.ARROW_DOWN":[{guard:qo("hasHighlightedItem","loop","isLastItemHighlighted"),actions:["highlightFirstItem"]},{guard:"hasHighlightedItem",actions:["highlightNextItem"]},{actions:["highlightFirstItem"]}],"CONTENT.ARROW_UP":[{guard:qo("hasHighlightedItem","loop","isFirstItemHighlighted"),actions:["highlightLastItem"]},{guard:"hasHighlightedItem",actions:["highlightPreviousItem"]},{actions:["highlightLastItem"]}],"CONTENT.TYPEAHEAD":{actions:["highlightMatchingItem"]},"ITEM.POINTER_MOVE":{actions:["highlightItem"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedItem"]},"POSITIONING.SET":{actions:["reposition"]}}}},implementations:{guards:{loop:({prop:e})=>!!e("loopFocus"),multiple:({prop:e})=>!!e("multiple"),hasSelectedItems:({computed:e})=>!!e("hasSelectedItems"),hasHighlightedItem:({context:e})=>e.get("highlightedValue")!=null,isFirstItemHighlighted:({context:e,prop:t})=>e.get("highlightedValue")===t("collection").firstValue,isLastItemHighlighted:({context:e,prop:t})=>e.get("highlightedValue")===t("collection").lastValue,closeOnSelect:({prop:e,event:t})=>{var n;return!!((n=t.closeOnSelect)!=null?n:e("closeOnSelect"))},restoreFocus:({event:e})=>jE(e),isOpenControlled:({prop:e})=>e("open")!==void 0,isTriggerClickEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="TRIGGER.CLICK"},isTriggerEnterEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="TRIGGER.ENTER"},isTriggerArrowUpEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="TRIGGER.ARROW_UP"},isTriggerArrowDownEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="TRIGGER.ARROW_DOWN"}},effects:{trackFocusVisible({scope:e}){var t;return nt({root:(t=e.getRootNode)==null?void 0:t.call(e)})},trackFormControlState({context:e,scope:t}){return ht(Mg(t),{onFieldsetDisabledChange(n){e.set("fieldsetDisabled",n)},onFormReset(){let n=e.initial("value");e.set("value",n)}})},trackDismissableElement({scope:e,send:t,prop:n}){let r=()=>Uo(e),i=!0;return qt(r,{type:"listbox",defer:!0,exclude:[Ti(e),cD(e)],onFocusOutside:n("onFocusOutside"),onPointerDownOutside:n("onPointerDownOutside"),onInteractOutside(a){var o;(o=n("onInteractOutside"))==null||o(a),i=!(a.detail.focusable||a.detail.contextmenu)},onDismiss(){t({type:"CLOSE",src:"interact-outside",restoreFocus:i})}})},computePlacement({context:e,prop:t,scope:n}){let r=t("positioning");return e.set("currentPlacement",r.placement),Xe(()=>Ti(n),()=>zE(n),y(h({defer:!0},r),{onComplete(o){e.set("currentPlacement",o.placement)}}))},scrollToHighlightedItem({context:e,prop:t,scope:n}){let r=a=>{let o=e.get("highlightedValue");if(o==null||Sr()==="pointer")return;let l=Uo(n),c=t("scrollToIndexFn");if(c){let u=t("collection").indexOf(o);c==null||c({index:u,immediate:a,getElement:()=>_g(n,o)});return}let d=_g(n,o);Gn(d,{rootEl:l,block:"nearest"})};return B(()=>{Ir("virtual"),r(!0)}),Ht(()=>Uo(n),{defer:!0,attributes:["data-activedescendant"],callback(){r(!1)}})}},actions:{reposition({context:e,prop:t,scope:n,event:r}){let i=()=>zE(n);Xe(Ti(n),i,y(h(h({},t("positioning")),r.options),{defer:!0,listeners:!1,onComplete(a){e.set("currentPlacement",a.placement)}}))},toggleVisibility({send:e,prop:t,event:n}){e({type:t("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:n})},highlightPreviousItem({context:e,prop:t}){let n=e.get("highlightedValue");if(n==null)return;let r=t("collection").getPreviousValue(n,1,t("loopFocus"));r!=null&&e.set("highlightedValue",r)},highlightNextItem({context:e,prop:t}){let n=e.get("highlightedValue");if(n==null)return;let r=t("collection").getNextValue(n,1,t("loopFocus"));r!=null&&e.set("highlightedValue",r)},highlightFirstItem({context:e,prop:t}){let n=t("collection").firstValue;e.set("highlightedValue",n)},highlightLastItem({context:e,prop:t}){let n=t("collection").lastValue;e.set("highlightedValue",n)},setInitialFocus({scope:e}){B(()=>{let t=hr({root:Uo(e)});t==null||t.focus({preventScroll:!0})})},focusTriggerEl({event:e,scope:t}){jE(e)&&B(()=>{let n=Ti(t);n==null||n.focus({preventScroll:!0})})},selectHighlightedItem({context:e,prop:t,event:n}){var a,o;let r=(a=n.value)!=null?a:e.get("highlightedValue");if(r==null||!t("collection").has(r))return;(o=t("onSelect"))==null||o({value:r}),r=t("deselectable")&&!t("multiple")&&e.get("value").includes(r)?null:r,e.set("value",s=>r==null?[]:t("multiple")?tn(s,r):[r])},highlightComputedFirstItem({context:e,prop:t,computed:n}){let r=t("collection"),i=n("hasSelectedItems")?r.sort(e.get("value"))[0]:r.firstValue;e.set("highlightedValue",i)},highlightComputedLastItem({context:e,prop:t,computed:n}){let r=t("collection"),i=n("hasSelectedItems")?r.sort(e.get("value"))[0]:r.lastValue;e.set("highlightedValue",i)},highlightFirstSelectedItem({context:e,prop:t,computed:n}){if(!n("hasSelectedItems"))return;let r=t("collection").sort(e.get("value"))[0];e.set("highlightedValue",r)},highlightItem({context:e,event:t}){e.set("highlightedValue",t.value)},highlightMatchingItem({context:e,prop:t,event:n,refs:r}){let i=t("collection").search(n.key,{state:r.get("typeahead"),currentValue:e.get("highlightedValue")});i!=null&&e.set("highlightedValue",i)},setHighlightedItem({context:e,event:t}){e.set("highlightedValue",t.value)},clearHighlightedItem({context:e}){e.set("highlightedValue",null)},selectItem({context:e,prop:t,event:n}){var a;(a=t("onSelect"))==null||a({value:n.value});let i=t("deselectable")&&!t("multiple")&&e.get("value").includes(n.value)?null:n.value;e.set("value",o=>i==null?[]:t("multiple")?tn(o,i):[i])},clearItem({context:e,event:t}){e.set("value",n=>n.filter(r=>r!==t.value))},setSelectedItems({context:e,event:t}){e.set("value",t.value)},clearSelectedItems({context:e}){e.set("value",[])},selectPreviousItem({context:e,prop:t}){let[n]=e.get("value"),r=t("collection").getPreviousValue(n);r&&e.set("value",[r])},selectNextItem({context:e,prop:t}){let[n]=e.get("value"),r=t("collection").getNextValue(n);r&&e.set("value",[r])},selectFirstItem({context:e,prop:t}){let n=t("collection").firstValue;n&&e.set("value",[n])},selectLastItem({context:e,prop:t}){let n=t("collection").lastValue;n&&e.set("value",[n])},selectMatchingItem({context:e,prop:t,event:n,refs:r}){let i=t("collection").search(n.key,{state:r.get("typeahead"),currentValue:e.get("value")[0]});i!=null&&e.set("value",[i])},scrollContentToTop({prop:e,scope:t}){var n,r;if(e("scrollToIndexFn")){let i=e("collection").firstValue;(n=e("scrollToIndexFn"))==null||n({index:0,immediate:!0,getElement:()=>_g(t,i)})}else(r=Uo(t))==null||r.scrollTo(0,0)},invokeOnOpen({prop:e,context:t}){var n;(n=e("onOpenChange"))==null||n({open:!0,value:t.get("value")})},invokeOnClose({prop:e,context:t}){var n;(n=e("onOpenChange"))==null||n({open:!1,value:t.get("value")})},syncSelectElement({context:e,prop:t,scope:n}){let r=Mg(n);if(r){if(e.get("value").length===0&&!t("multiple")){r.selectedIndex=-1;return}for(let i of r.options)i.selected=e.get("value").includes(i.value)}},syncCollection({context:e,prop:t}){let n=t("collection"),r=n.find(e.get("highlightedValue"));r&&e.set("highlightedItem",r);let i=kt({values:e.get("value"),collection:n,selectedItemMap:e.get("selectedItemMap")});e.set("selectedItemMap",i.nextSelectedItemMap)},syncSelectedItems({context:e,prop:t}){let n=kt({values:e.get("value"),collection:t("collection"),selectedItemMap:e.get("selectedItemMap")});e.set("selectedItemMap",n.nextSelectedItemMap)},syncHighlightedItem({context:e,prop:t}){let n=t("collection"),r=e.get("highlightedValue"),i=r?n.find(r):null;e.set("highlightedItem",i)},dispatchChangeEvent({scope:e}){queueMicrotask(()=>{let t=Mg(e);if(!t)return;let n=e.getWin(),r=new n.Event("change",{bubbles:!0,composed:!0});t.dispatchEvent(Rs(r))})}}}});hD=class extends X{constructor(t,n){var i;super(t,n);Q(this,"_options",[]);Q(this,"hasGroups",!1);Q(this,"placeholder","");let r=n.collection;this._options=(i=r==null?void 0:r.items)!=null?i:[],this.placeholder=V(this.el,"placeholder")||""}get options(){return Array.isArray(this._options)?this._options:[]}setOptions(t){this._options=Array.isArray(t)?t:[]}getCollection(){return Ic(Rr(this.options,this.hasGroups))}initMachine(t){let n=this.getCollection.bind(this);return new Y(pD,y(h({},t),{get collection(){return n()}}))}initApi(){return this.zagConnect(dD)}applyItemProps(){let t=this.el.querySelector('[data-scope="select"][data-part="content"]');if(!t)return;let n=r=>r.closest('[data-scope="select"][data-part="content"]')===t;t.querySelectorAll('[data-scope="select"][data-part="item-group"]').forEach(r=>{var o;if(!n(r))return;let i=(o=r.dataset.id)!=null?o:"";this.spreadProps(r,this.api.getItemGroupProps({id:i}));let a=r.querySelector('[data-scope="select"][data-part="item-group-label"]');a&&this.spreadProps(a,this.api.getItemGroupLabelProps({htmlFor:i}))}),t.querySelectorAll('[data-scope="select"][data-part="item"]').forEach(r=>{var l;if(!n(r))return;let i=(l=r.dataset.value)!=null?l:"";if(!i)return;let a=this.options.find(c=>String(Cn(c))===String(i));if(!a)return;this.spreadProps(r,this.api.getItemProps({item:a}));let o=r.querySelector('[data-scope="select"][data-part="item-text"]');o&&this.spreadProps(o,this.api.getItemTextProps({item:a}));let s=r.querySelector('[data-scope="select"][data-part="item-indicator"]');s&&this.spreadProps(s,this.api.getItemIndicatorProps({item:a}))})}render(){var s,l,c,d;let t=(s=this.el.querySelector('[data-scope="select"][data-part="root"]'))!=null?s:this.el;this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="select"][data-part="value-input"]'),r=V(this.el,"hiddenSelectName");if(n&&(it(n,this.el),n.name&&!r)){let u=(l=this.api.value)!=null&&l.length?this.api.value.map(String).join(","):"";n.value=u}let i=this.el.querySelector('[data-scope="select"][data-part="hidden-select"]');if(i){if(this.spreadProps(i,this.api.getHiddenSelectProps()),r){i.name=r,i.disabled=!1;let u=new Set(((c=this.api.value)!=null?c:[]).map(String));Array.from(i.options).forEach(p=>{if(p.value===""){p.selected=!1;return}p.selected=u.has(p.value)}),n&&n.removeAttribute("name")}else if(i.name){let u=new Set(((d=this.api.value)!=null?d:[]).map(String));Array.from(i.options).forEach(p=>{if(p.value===""){p.selected=!1;return}p.selected=u.has(p.value)})}else i.disabled=!0,i.removeAttribute("name");it(i,this.el)}["label","control","trigger","indicator","clear-trigger","positioner"].forEach(u=>{let p=this.el.querySelector(`[data-scope="select"][data-part="${u}"]`);if(!p)return;let g="get"+u.split("-").map(f=>f[0].toUpperCase()+f.slice(1)).join("")+"Props";this.spreadProps(p,this.api[g]())});let a=this.el.querySelector('[data-scope="select"][data-part="item-text"]');if(a&&this.el.dataset.updateTrigger!=="false"){let u=this.api.valueAsString;if(this.api.value&&this.api.value.length>0&&!u){let p=this.api.value[0],g=this.options.find(f=>String(Cn(f))===String(p));a.textContent=(g==null?void 0:g.label)||this.placeholder}else a.textContent=u||this.placeholder}let o=this.el.querySelector('[data-scope="select"][data-part="content"]');o&&(this.spreadProps(o,this.api.getContentProps()),this.applyItemProps())}};fD={mounted(){var u;let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=this;r.fieldTouched=!1;let i=()=>{r.fieldTouched=!0},a=(u=Ie(e,"defaultValue"))!=null?u:[];a.length>0&&(r.fieldTouched=!0,queueMicrotask(()=>{let p=Pc(e);if(p&&O(e,"multiple")){Sc(p,a);return}let g=e.querySelector('[data-scope="select"][data-part="value-input"]');g&&Wt(g)}));let o=JSON.parse(e.dataset.items||"[]"),s=o.some(p=>!!p.group),l=new hD(e,h(y(h({},YE(e,this.liveSocket,t,n,i)),{collection:QE(o,s)}),hn(e)));l.hasGroups=s,l.setOptions(o),l.init(),this.select=l,this.handlers=[];let c=ie(e);this.domRegistry=c,c.add("corex:select:set-value",p=>{l.api.setValue(p.detail.value)}),c.add("corex:select:set-open",p=>{l.api.setOpen(p.detail.open)});let d=re(this);this.handleRegistry=d,d.add("select_set_value",p=>{$(e.id,H(p))&&l.api.setValue(p.value)}),d.add("select_set_open",p=>{$(e.id,H(p))&&typeof p.open=="boolean"&&l.api.setOpen(p.open)})},updated(){if(!this.select)return;let e=qn(this.el),t=JSON.parse(this.el.dataset.items||"[]"),n=t.some(a=>!!a.group);this.select.hasGroups=n,this.select.setOptions(t);let r=this.pushEvent.bind(this),i=()=>j(this.liveSocket);this.select.updateProps(h(y(h({},YE(this.el,this.liveSocket,r,i,()=>{this.fieldTouched=!0})),{collection:this.select.getCollection()}),e)),queueMicrotask(()=>{if(eP(this.el),!("value"in e)||!this.select)return;let a=e.value,o=Pc(this.el);if(o&&O(this.el,"multiple")){Sc(o,a);return}let s=this.el.querySelector('[data-scope="select"][data-part="value-input"]');if(!s)return;let l=Ug(this.el,a);s.value!==l&&(s.value=l),Wt(s)})},destroyed(){var e,t,n;if(this.handlers)for(let r of this.handlers)this.removeHandleEvent(r);(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.select)==null||n.destroy()}}});var IP={};pe(IP,{SignaturePad:()=>BD,buildDrawingOptions:()=>jg,parsePathsFromDataset:()=>SP});function ED(e,t){let{state:n,send:r,prop:i,computed:a,context:o,scope:s}=e,l=n.matches("drawing"),c=a("isEmpty"),d=a("isInteractive"),u=!!i("disabled"),p=!!i("required"),g=i("translations");return{empty:c,drawing:l,currentPath:o.get("currentPath"),paths:o.get("paths"),clear(){r({type:"CLEAR"})},getDataUrl(f,m){return a("isEmpty")?Promise.resolve(""):vP(s,{type:f,quality:m})},getLabelProps(){return t.label(y(h({},Ci.label.attrs),{id:yD(s),"data-disabled":b(u),"data-required":b(p),htmlFor:rP(s),onClick(f){if(!d||f.defaultPrevented)return;let m=Cc(s);m==null||m.focus({preventScroll:!0})}}))},getRootProps(){return t.element(y(h({},Ci.root.attrs),{"data-disabled":b(u),id:vD(s)}))},getControlProps(){return t.element(y(h({},Ci.control.attrs),{tabIndex:u?void 0:0,id:mP(s),role:"application","aria-roledescription":"signature pad","aria-label":g.control,"aria-disabled":u,"data-disabled":b(u),onPointerDown(f){if(!fe(f)||Be(f)||!d)return;let m=ne(f);if(m!=null&&m.closest("[data-part=clear-trigger]"))return;f.currentTarget.setPointerCapture(f.pointerId);let S={x:f.clientX,y:f.clientY},T=Cc(s);if(!T)return;let{offset:w}=qi(S,T);r({type:"POINTER_DOWN",point:w,pressure:f.pressure})},onPointerUp(f){d&&f.currentTarget.hasPointerCapture(f.pointerId)&&f.currentTarget.releasePointerCapture(f.pointerId)},style:{position:"relative",touchAction:"none",userSelect:"none",WebkitUserSelect:"none"}}))},getSegmentProps(){return t.svg(y(h({},Ci.segment.attrs),{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",fill:i("drawing").fill}}))},getSegmentPathProps(f){return t.path(y(h({},Ci.segmentPath.attrs),{d:f.path}))},getGuideProps(){return t.element(y(h({},Ci.guide.attrs),{"data-disabled":b(u)}))},getClearTriggerProps(){return t.button(y(h({},Ci.clearTrigger.attrs),{type:"button","aria-label":g.clearTrigger,hidden:!o.get("paths").length||l,disabled:u,onClick(){r({type:"CLEAR"})}}))},getHiddenInputProps(f){return t.input({id:rP(s),type:"text",hidden:!0,disabled:u,required:i("required"),readOnly:!0,name:i("name"),value:f.value})}}}function oP(e,t,n,r=i=>i){return e*r(.5-t*(.5-n))}function yP(e,t,n){let r=qg(1,t/n);return qg(1,e+(qg(1,1-r)-e)*(r*.275))}function SD(e){return[-e[0],-e[1]]}function kn(e,t){return[e[0]+t[0],e[1]+t[1]]}function sP(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}function Br(e,t){return[e[0]-t[0],e[1]-t[1]]}function zg(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}function Hr(e,t){return[e[0]*t,e[1]*t]}function Wg(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}function ID(e,t){return[e[0]/t,e[1]/t]}function bP(e){return[e[1],-e[0]]}function Kg(e,t){let n=t[0];return e[0]=t[1],e[1]=-n,e}function lP(e,t){return e[0]*t[0]+e[1]*t[1]}function TD(e,t){return e[0]===t[0]&&e[1]===t[1]}function CD(e){return Math.hypot(e[0],e[1])}function cP(e,t){let n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function EP(e){return ID(e,CD(e))}function wD(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function Yg(e,t,n){let r=Math.sin(n),i=Math.cos(n),a=e[0]-t[0],o=e[1]-t[1],s=a*i-o*r,l=a*r+o*i;return[s+t[0],l+t[1]]}function dP(e,t,n,r){let i=Math.sin(r),a=Math.cos(r),o=t[0]-n[0],s=t[1]-n[1],l=o*a-s*i,c=o*i+s*a;return e[0]=l+n[0],e[1]=c+n[1],e}function uP(e,t,n){return kn(e,Hr(Br(t,e),n))}function OD(e,t,n,r){let i=n[0]-t[0],a=n[1]-t[1];return e[0]=t[0]+i*r,e[1]=t[1]+a*r,e}function PP(e,t,n){return kn(e,Hr(t,n))}function VD(e,t){let n=PP(e,EP(bP(Br(e,kn(e,[1,1])))),-t),r=[],i=1/13;for(let a=i;a<=1;a+=i)r.push(Yg(n,e,Ko*2*a));return r}function AD(e,t,n){let r=[],i=1/n;for(let a=i;a<=1;a+=i)r.push(Yg(t,e,Ko*a));return r}function xD(e,t,n){let r=Br(t,n),i=Hr(r,.5),a=Hr(r,.51);return[Br(e,i),Br(e,a),kn(e,a),kn(e,i)]}function RD(e,t,n,r){let i=[],a=PP(e,t,n),o=1/r;for(let s=o;s<1;s+=o)i.push(Yg(a,e,Ko*3*s));return i}function kD(e,t,n){return[kn(e,Hr(t,n)),kn(e,Hr(t,n*.99)),Br(e,Hr(t,n*.99)),Br(e,Hr(t,n))]}function gP(e,t,n){return e===!1||e===void 0?0:e===!0?Math.max(t,n):e}function ND(e,t,n){return e.slice(0,10).reduce((r,i)=>{let a=i.pressure;return t&&(a=yP(r,i.distance,n)),(r+a)/2},e[0].pressure)}function LD(e,t={}){let{size:n=16,smoothing:r=.5,thinning:i=.5,simulatePressure:a=!0,easing:o=Z=>Z,start:s={},end:l={},last:c=!1}=t,{cap:d=!0,easing:u=Z=>Z*(2-Z)}=s,{cap:p=!0,easing:g=Z=>--Z*Z*Z+1}=l;if(e.length===0||n<=0)return[];let f=e[e.length-1].runningLength,m=gP(s.taper,n,f),S=gP(l.taper,n,f),T=(n*r)**2,w=[],I=[],P=ND(e,a,n),v=oP(n,i,e[e.length-1].pressure,o),E,R=e[0].vector,x=e[0].point,C=x,A=x,N=C,k=!1;for(let Z=0;ZT)&&(w.push(A),x=A),sP($r,ve,Je),N=[$r[0],$r[1]],(Z<=1||cP(C,N)>T)&&(I.push(N),C=N),P=ce,R=le}let L=[e[0].point[0],e[0].point[1]],K=e.length>1?[e[e.length-1].point[0],e[e.length-1].point[1]]:kn(e[0].point,[1,1]),J=[],ue=[];if(e.length===1){if(!(m||S)||c)return VD(L,E||v)}else{m||S&&e.length===1||(d?J.push(...AD(L,I[0],13)):J.push(...xD(L,w[0],I[0])));let Z=bP(SD(e[e.length-1].vector));S||m&&e.length===1?ue.push(K):p?ue.push(...RD(K,Z,v,29)):ue.push(...kD(K,Z,v))}return w.concat(ue,I.reverse(),J)}function hP(e){return e!=null&&e>=0}function DD(e,t={}){var p;let{streamline:n=.5,size:r=16,last:i=!1}=t;if(e.length===0)return[];let a=.15+(1-n)*.85,o=Array.isArray(e[0])?e:e.map(({x:g,y:f,pressure:m=iP})=>[g,f,m]);if(o.length===2){let g=o[1];o=o.slice(0,-1);for(let f=1;f<5;f++)o.push(uP(o[0],g,f/4))}o.length===1&&(o=[...o,[...kn(o[0],aP),...o[0].slice(2)]]);let s=[{point:[o[0][0],o[0][1]],pressure:hP(o[0][2])?o[0][2]:.25,vector:[...aP],distance:0,runningLength:0}],l=!1,c=0,d=s[0],u=o.length-1;for(let g=1;gi.trim()).filter(Boolean):[]}function jg(e){let t={fill:V(e,"drawingFill"),size:U(e,"drawingSize"),simulatePressure:O(e,"drawingSimulatePressure"),smoothing:U(e,"drawingSmoothing"),thinning:U(e,"drawingThinning"),streamline:U(e,"drawingStreamline")},n=V(e,"drawingEasing");return n&&(t.easing=n),t}function fP(e){if(!V(e,"submitName"))return V(e,"name")}function Wo(e,t,n){var o;let r=V(e,"submitName"),i=n.fieldTouched===!0;if(r){sn(e,t,{onTouched:n.onPadTouched,scope:"signature-pad",submitName:r,notifyLiveView:(o=n.notifyLiveView)!=null?o:!0,fieldTouched:i});return}let a=e.querySelector('[data-scope="signature-pad"][data-part="hidden-input"]');if(a){if(n.notifyLiveView===!1){a.value=t.length>0?t.join(` `):"";return}Vr(a,()=>t.length>0?t.join(` `):"",n.onPadTouched)}}var mD,Ci,vD,mP,yD,rP,Cc,bD,vP,PD,Ko,iP,aP,qg,Je,_r,$r,pP,MD,Tc,$D,HD,BD,TP=ee(()=>{"use strict";vl();ai();Kt();$e();be();oe();mD=z("signature-pad").parts("root","control","segment","segmentPath","guide","clearTrigger","label"),Ci=mD.build(),vD=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`signature-${e.id}`},mP=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`signature-control-${e.id}`},yD=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`signature-label-${e.id}`},rP=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`signature-input-${e.id}`},Cc=e=>e.getById(mP(e)),bD=e=>fr(Cc(e),"[data-part=segment]"),vP=(e,t)=>dh(bD(e),t);({PI:PD}=Math),Ko=PD+1e-4,iP=.5,aP=[1,1];({min:qg}=Math);Je=[0,0],_r=[0,0],$r=[0,0];pP=[0,0];MD=FD,Tc=(e,t)=>(e+t)/2;$D=te({props({props:e}){return y(h({defaultPaths:[]},e),{drawing:h({size:2,simulatePressure:!1,thinning:.7,smoothing:.4,streamline:.6},e.drawing),translations:h({control:"signature pad",clearTrigger:"clear signature"},e.translations)})},initialState(){return"idle"},context({prop:e,bindable:t}){return{paths:t(()=>({defaultValue:e("defaultPaths"),value:e("paths"),sync:!0,onChange(n){var r;(r=e("onDraw"))==null||r({paths:n})}})),currentPoints:t(()=>({defaultValue:[]})),currentPath:t(()=>({defaultValue:null}))}},computed:{isInteractive:({prop:e})=>!(e("disabled")||e("readOnly")),isEmpty:({context:e})=>e.get("paths").length===0},on:{CLEAR:{actions:["clearPoints","invokeOnDrawEnd","focusCanvasEl"]}},states:{idle:{on:{POINTER_DOWN:{target:"drawing",actions:["addPoint"]}}},drawing:{effects:["trackPointerMove"],on:{POINTER_MOVE:{actions:["addPoint","invokeOnDraw"]},POINTER_UP:{target:"idle",actions:["endStroke","invokeOnDrawEnd"]}}}},implementations:{effects:{trackPointerMove({scope:e,send:t}){let n=e.getDoc();return pn(n,{onPointerMove({event:r,point:i}){let a=Cc(e);if(!a)return;let{offset:o}=qi(i,a);t({type:"POINTER_MOVE",point:o,pressure:r.pressure})},onPointerUp(){t({type:"POINTER_UP"})}})}},actions:{addPoint({context:e,event:t,prop:n}){let r=[...e.get("currentPoints"),t.point];e.set("currentPoints",r);let i=MD(r,n("drawing"));e.set("currentPath",_D(i))},endStroke({context:e}){let t=[...e.get("paths"),e.get("currentPath")];e.set("paths",t),e.set("currentPoints",[]),e.set("currentPath",null)},clearPoints({context:e}){e.set("currentPoints",[]),e.set("paths",[]),e.set("currentPath",null)},focusCanvasEl({scope:e}){queueMicrotask(()=>{var t;(t=e.getActiveElement())==null||t.focus({preventScroll:!0})})},invokeOnDraw({context:e,prop:t}){var n;(n=t("onDraw"))==null||n({paths:[...e.get("paths"),e.get("currentPath")]})},invokeOnDrawEnd({context:e,prop:t,scope:n,computed:r}){var i;(i=t("onDrawEnd"))==null||i({paths:[...e.get("paths")],getDataUrl(a,o=.92){return r("isEmpty")?Promise.resolve(""):vP(n,{type:a,quality:o})}})}}}}),HD=class extends X{constructor(){super(...arguments);Q(this,"imageURL","");Q(this,"paths",[]);Q(this,"name");Q(this,"applyPartDir",t=>{t instanceof HTMLElement&&t.setAttribute("dir",q(this.el))});Q(this,"syncPaths",()=>{let t=this.el.querySelector('[data-scope="signature-pad"][data-part="segment"]');if(!t)return;if(this.api.paths.length+(this.api.currentPath?1:0)===0){t.innerHTML="",this.imageURL="",this.paths=[];let r=this.el.querySelector('[data-scope="signature-pad"][data-part="hidden-input"]');r&&r.value!==""&&(r.value="");return}if(t.innerHTML="",this.api.paths.forEach(r=>{let i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttribute("data-scope","signature-pad"),i.setAttribute("data-part","path"),this.spreadProps(i,this.api.getSegmentPathProps({path:r})),t.appendChild(i)}),this.api.currentPath){let r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("data-scope","signature-pad"),r.setAttribute("data-part","current-path"),this.spreadProps(r,this.api.getSegmentPathProps({path:this.api.currentPath})),t.appendChild(r)}})}initMachine(t){return this.name=t.name,new Y($D,t)}setName(t){this.name=t}setPaths(t){this.paths=t}initApi(){return this.zagConnect(ED)}render(){let t=this.el.querySelector('[data-scope="signature-pad"][data-part="root"]');if(!t)return;this.spreadProps(t,this.api.getRootProps()),this.applyPartDir(t);let n=t.querySelector('[data-scope="signature-pad"][data-part="label"]');n&&(this.spreadProps(n,this.api.getLabelProps()),this.applyPartDir(n));let r=t.querySelector('[data-scope="signature-pad"][data-part="control"]');r&&(this.spreadProps(r,this.api.getControlProps()),this.applyPartDir(r));let i=t.querySelector('[data-scope="signature-pad"][data-part="segment"]');i&&(this.spreadProps(i,this.api.getSegmentProps()),this.applyPartDir(i));let a=t.querySelector('[data-scope="signature-pad"][data-part="guide"]');a&&(this.spreadProps(a,this.api.getGuideProps()),this.applyPartDir(a));let o=t.querySelector('[data-scope="signature-pad"][data-part="clear-trigger"]');o&&(this.spreadProps(o,this.api.getClearTriggerProps()),this.applyPartDir(o));let s=t.querySelector('[data-scope="signature-pad"][data-part="hidden-input"]');s&&(this.spreadProps(s,this.api.getHiddenInputProps({value:this.api.paths.length>0?this.api.paths.join(` -`):""})),this.applyPartDir(s),V(this.el,"submitName")&&(s.removeAttribute("name"),s.removeAttribute("form"))),Ji(this.el,"signature-pad"),this.syncPaths()}};BD={mounted(){let e=this.el,t=this,n=this.pushEvent.bind(this);t.padTouched=!1;let r=()=>{t.padTouched=!0},i=SP(e,"defaultPaths"),a=new HD(e,y(h({id:e.id,name:fP(e),dir:q(e)},i.length>0?{defaultPaths:i}:{}),{drawing:jg(e),onDrawEnd:s=>{a.setPaths(s.paths),Wo(e,s.paths,{onPadTouched:r,notifyLiveView:!0,fieldTouched:!0}),s.getDataUrl("image/png").then(l=>{a.imageURL=l;let c=V(e,"onDrawEnd");c&&this.liveSocket.main.isConnected()&&n(c,{id:e.id,paths:s.paths,url:l});let d=V(e,"onDrawEndClient");d&&e.dispatchEvent(new CustomEvent(d,{bubbles:!0,detail:{id:e.id,paths:s.paths,url:l}}))})}}));a.init(),this.signaturePad=a;let o=(s,l)=>{Wo(e,s,{onPadTouched:()=>{},notifyLiveView:l.notifyLiveView,fieldTouched:Ar(e,t.padTouched||l.fieldTouched===!0)})};queueMicrotask(()=>{t.padTouched||o(i,{notifyLiveView:!1,fieldTouched:!1})}),t.unbindSubmitIntent=oa(e,()=>{var l;t.padTouched=!0;let s=(l=a.api.paths)!=null?l:[];o(s.length>0?s:[],{notifyLiveView:!1,fieldTouched:!0})}),this.onClear=s=>{let{id:l}=s.detail;l&&l!==e.id||(a.api.clear(),Wo(e,[],{onPadTouched:r,notifyLiveView:!0,fieldTouched:!0}))},e.addEventListener("corex:signature-pad:clear",this.onClear),this.handlers=[],this.handlers.push(this.handleEvent("signature_pad_clear",s=>{$(e.id,H(s))&&(a.api.clear(),Wo(e,[],{onPadTouched:r,notifyLiveView:!0,fieldTouched:!0}))}))},updated(){var n,r;let e=this.el;(n=this.signaturePad)==null||n.updateProps({id:e.id,name:fP(e),dir:q(e),drawing:jg(e)});let t=Mh(e);t!==void 0&&!this.padTouched&&((r=this.signaturePad)==null||r.setPaths(t),Wo(e,t,{onPadTouched:()=>{},notifyLiveView:!1,fieldTouched:Ar(e,this.padTouched)}))},destroyed(){var e,t;if((e=this.unbindSubmitIntent)==null||e.call(this),this.onClear&&this.el.removeEventListener("corex:signature-pad:clear",this.onClear),this.handlers)for(let n of this.handlers)this.removeHandleEvent(n);(t=this.signaturePad)==null||t.destroy()}}});var VP={};pe(VP,{Switch:()=>YD,checkedChangePayload:()=>zi});function KD(e,t){let{context:n,send:r,prop:i,scope:a}=e,o=!!i("disabled"),s=!!i("readOnly"),l=!!i("required"),c=!!n.get("checked"),d=!o&&n.get("focused"),g=!o&&n.get("focusVisible"),p=!o&&n.get("active"),u={"data-active":b(p),"data-focus":b(d),"data-focus-visible":b(g),"data-readonly":b(s),"data-hover":b(n.get("hovered")),"data-disabled":b(o),"data-state":c?"checked":"unchecked","data-invalid":b(i("invalid")),"data-required":b(l)};return{checked:c,disabled:o,focused:d,setChecked(f){r({type:"CHECKED.SET",checked:f,isTrusted:!1})},toggleChecked(){r({type:"CHECKED.TOGGLE",checked:c,isTrusted:!1})},getRootProps(){return t.label(y(h(h({},wc.root.attrs),u),{dir:i("dir"),id:OP(a),htmlFor:Xg(a),onPointerMove(){o||r({type:"CONTEXT.SET",context:{hovered:!0}})},onPointerLeave(){o||r({type:"CONTEXT.SET",context:{hovered:!1}})},onClick(f){var S;if(o)return;ne(f)===Aa(a)&&f.stopPropagation(),wt()&&((S=Aa(a))==null||S.focus())}}))},getLabelProps(){return t.element(y(h(h({},wc.label.attrs),u),{dir:i("dir"),id:CP(a)}))},getThumbProps(){return t.element(y(h(h({},wc.thumb.attrs),u),{dir:i("dir"),id:GD(a),"aria-hidden":!0}))},getControlProps(){return t.element(y(h(h({},wc.control.attrs),u),{dir:i("dir"),id:qD(a),"aria-hidden":!0}))},getHiddenInputProps(){return t.input({id:Xg(a),type:"checkbox",required:i("required"),defaultChecked:c,disabled:o,"aria-labelledby":CP(a),"aria-invalid":i("invalid"),name:i("name"),form:i("form"),value:i("value"),style:mt,onFocus(){let f=vn();r({type:"CONTEXT.SET",context:{focused:!0,focusVisible:f}})},onBlur(){r({type:"CONTEXT.SET",context:{focused:!1,focusVisible:!1}})},onClick(f){if(s){f.preventDefault();return}let m=f.currentTarget.checked;r({type:"CHECKED.SET",checked:m,isTrusted:!0})}})}}}var UD,wc,OP,CP,GD,qD,Xg,WD,Aa,wP,zD,jD,YD,AP=ee(()=>{"use strict";sl();yn();$e();Ve();be();oe();UD=z("switch").parts("root","label","control","thumb"),wc=UD.build(),OP=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`switch:${e.id}`},CP=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`switch:${e.id}:label`},GD=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.thumb)!=null?n:`switch:${e.id}:thumb`},qD=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`switch:${e.id}:control`},Xg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`switch:${e.id}:input`},WD=e=>e.getById(OP(e)),Aa=e=>e.getById(Xg(e));({not:wP}=we()),zD=te({props({props:e}){return h({defaultChecked:!1,label:"switch",value:"on"},e)},initialState(){return"ready"},context({prop:e,bindable:t}){return{checked:t(()=>({defaultValue:e("defaultChecked"),value:e("checked"),onChange(n){var r;(r=e("onCheckedChange"))==null||r({checked:n})}})),fieldsetDisabled:t(()=>({defaultValue:!1})),focusVisible:t(()=>({defaultValue:!1})),active:t(()=>({defaultValue:!1})),focused:t(()=>({defaultValue:!1})),hovered:t(()=>({defaultValue:!1}))}},computed:{isDisabled:({context:e,prop:t})=>t("disabled")||e.get("fieldsetDisabled")},watch({track:e,prop:t,context:n,action:r}){e([()=>t("disabled")],()=>{r(["removeFocusIfNeeded"])}),e([()=>n.get("checked")],()=>{r(["syncInputElement"])})},effects:["trackFormControlState","trackPressEvent","trackFocusVisible"],on:{"CHECKED.TOGGLE":[{guard:wP("isTrusted"),actions:["toggleChecked","dispatchChangeEvent"]},{actions:["toggleChecked"]}],"CHECKED.SET":[{guard:wP("isTrusted"),actions:["setChecked","dispatchChangeEvent"]},{actions:["setChecked"]}],"CONTEXT.SET":{actions:["setContext"]}},states:{ready:{}},implementations:{guards:{isTrusted:({event:e})=>!!e.isTrusted},effects:{trackPressEvent({computed:e,scope:t,context:n}){if(!e("isDisabled"))return Ds({pointerNode:WD(t),keyboardNode:Aa(t),isValidKey:r=>r.key===" ",onPress:()=>n.set("active",!1),onPressStart:()=>n.set("active",!0),onPressEnd:()=>n.set("active",!1)})},trackFocusVisible({computed:e,scope:t}){if(!e("isDisabled"))return nt({root:t.getRootNode()})},trackFormControlState({context:e,send:t,scope:n}){return ht(Aa(n),{onFieldsetDisabledChange(r){e.set("fieldsetDisabled",r)},onFormReset(){let r=e.initial("checked");t({type:"CHECKED.SET",checked:!!r,src:"form-reset"})}})}},actions:{setContext({context:e,event:t}){for(let n in t.context)e.set(n,t.context[n])},syncInputElement({context:e,scope:t}){let n=Aa(t);n&&ja(n,!!e.get("checked"))},removeFocusIfNeeded({context:e,prop:t}){t("disabled")&&e.set("focused",!1)},setChecked({context:e,event:t}){e.set("checked",t.checked)},toggleChecked({context:e}){e.set("checked",!e.get("checked"))},dispatchChangeEvent({context:e,scope:t}){queueMicrotask(()=>{let n=Aa(t);Bi(n,{checked:e.get("checked")})})}}}}),jD=class extends X{initMachine(e){return new Y(zD,e)}initApi(){return this.zagConnect(KD)}render(){let e=this.el.querySelector('[data-scope="switch"][data-part="root"]');if(!e)return;this.spreadProps(e,this.api.getRootProps());let t=e.querySelector(':scope > [data-scope="switch"][data-part="hidden-input"]');t instanceof HTMLInputElement&&ol(t,this.el,this.api.checked===!0,(r,i)=>this.spreadProps(r,i),this.api.getHiddenInputProps()),e.querySelectorAll(':scope > [data-scope="switch"][data-part="label"]').forEach(r=>{this.spreadProps(r,this.api.getLabelProps())});let n=e.querySelector(':scope > [data-scope="switch"][data-part="control"]');if(n){this.spreadProps(n,this.api.getControlProps());let r=n.querySelector(':scope > [data-scope="switch"][data-part="thumb"]');r&&this.spreadProps(r,this.api.getThumbProps())}}},YD={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=new jD(e,y(h({id:e.id},(()=>{let o=Gs(e);return"checked"in o?{checked:o.checked===!0}:{defaultChecked:o.defaultChecked===!0}})()),{disabled:O(e,"disabled"),name:V(e,"name"),form:V(e,"form"),value:V(e,"value"),dir:q(e),invalid:O(e,"invalid"),required:O(e,"required"),readOnly:O(e,"readonly"),onCheckedChange:o=>{W({el:e,canPushServer:n(),pushEvent:t,payload:zi(e,o),serverEventName:V(e,"onCheckedChange"),clientEventName:V(e,"onCheckedChangeClient")});let s=e.querySelector('[data-scope="switch"][data-part="hidden-input"]');s&&queueMicrotask(()=>{s.checked=o.checked===!0,s.dispatchEvent(new Event("input",{bubbles:!0})),s.dispatchEvent(new Event("change",{bubbles:!0}))})}}));r.init(),this.zagSwitch=r;let i=ie(e);this.domRegistry=i,i.add("corex:switch:set-checked",o=>{let{checked:s}=o.detail;r.api.setChecked(s)}),i.add("corex:switch:toggle-checked",()=>{r.api.toggleChecked()});let a=re(this);this.handleRegistry=a,a.add("switch_set_checked",o=>{if(!$(e.id,H(o)))return;let s=Ys(o);typeof s=="boolean"&&r.api.setChecked(s)}),a.add("switch_toggle_checked",o=>{$(e.id,H(o))&&r.api.toggleChecked()}),a.add("switch_checked",o=>{$(e.id,H(o))&&n()&&this.pushEvent("switch_checked_response",{id:e.id,value:r.api.checked})}),a.add("switch_focused",o=>{$(e.id,H(o))&&n()&&this.pushEvent("switch_focused_response",{id:e.id,value:r.api.focused})}),a.add("switch_disabled",o=>{$(e.id,H(o))&&n()&&this.pushEvent("switch_disabled_response",{id:e.id,value:r.api.disabled})})},updated(){let e=this.zagSwitch;e&&e.updateProps(y(h({id:this.el.id},Us(this.el)),{disabled:O(this.el,"disabled"),name:V(this.el,"name"),form:V(this.el,"form"),value:V(this.el,"value"),dir:q(this.el),invalid:O(this.el,"invalid"),required:O(this.el,"required"),readOnly:O(this.el,"readonly")}))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.zagSwitch)==null||n.destroy()}}});var HP={};pe(HP,{TagsInput:()=>CF,blurBehavior:()=>ep,maxProp:()=>tp,parseJsonTags:()=>TF,readPlaceholderFromMainInput:()=>np});function gF(e,t){let{state:n,send:r,computed:i,prop:a,scope:o,context:s}=e,l=i("isInteractive"),c=!!a("disabled"),d=!!a("readOnly"),g=!!a("required"),p=a("invalid")||i("isOverflowing"),u=a("translations"),f=n.hasTag("focused"),m=n.matches("editing:tag"),S=i("count")===0;function T(w){let I=Yo(o,w),P=s.get("editedTagId"),v=s.get("highlightedTagId");return{id:I,editing:m&&P===I,highlighted:I===v,disabled:!!(w.disabled||c)}}return{empty:S,inputValue:s.get("inputValue"),value:s.get("value"),valueAsString:i("valueAsString"),count:i("count"),atMax:i("isAtMax"),setValue(w){r({type:"SET_VALUE",value:w})},clearValue(w){r(w?{type:"CLEAR_TAG",id:w}:{type:"CLEAR_VALUE"})},addValue(w){r({type:"ADD_TAG",value:w})},setValueAtIndex(w,I){r({type:"SET_VALUE_AT_INDEX",index:w,value:I})},setInputValue(w){r({type:"SET_INPUT_VALUE",value:w})},clearInputValue(){r({type:"SET_INPUT_VALUE",value:""})},focus(){var w;(w=xa(o))==null||w.focus()},getItemState:T,getRootProps(){return t.element(y(h({dir:a("dir")},Nn.root.attrs),{"data-invalid":b(p),"data-readonly":b(d),"data-disabled":b(c),"data-focus":b(f),"data-empty":b(S),id:DP(o),onPointerDown(){l&&r({type:"POINTER_DOWN"})}}))},getLabelProps(){return t.label(y(h({},Nn.label.attrs),{"data-disabled":b(c),"data-invalid":b(p),"data-readonly":b(d),"data-required":b(g),id:JD(o),dir:a("dir"),htmlFor:Qg(o)}))},getControlProps(){return t.element(y(h({id:QD(o)},Nn.control.attrs),{dir:a("dir"),tabIndex:d?0:void 0,"data-disabled":b(c),"data-readonly":b(d),"data-invalid":b(p),"data-focus":b(f)}))},getInputProps(){return t.input(y(h({},Nn.input.attrs),{dir:a("dir"),"data-invalid":b(p),"aria-invalid":se(p),"data-readonly":b(d),"data-empty":b(S),maxLength:a("maxLength"),id:Qg(o),defaultValue:s.get("inputValue"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"none",enterKeyHint:"done",disabled:c||d,placeholder:S?a("placeholder"):void 0,onInput(w){let I=Ot(w),P=w.currentTarget.value;if(I.inputType==="insertFromPaste"){r({type:"PASTE",value:P});return}if(pF(P,a("delimiter"))){r({type:"DELIMITER_KEY"});return}r({type:"TYPE",value:P,key:I.inputType})},onFocus(){queueMicrotask(()=>{r({type:"FOCUS"})})},onKeyDown(w){if(w.defaultPrevented||Me(w))return;let I=w.currentTarget,P=I.getAttribute("role")==="combobox",v=I.ariaExpanded==="true",E={ArrowDown(){r({type:"ARROW_DOWN"})},ArrowLeft(){P&&v||r({type:"ARROW_LEFT"})},ArrowRight(C){s.get("highlightedTagId")&&C.preventDefault(),!(P&&v)&&r({type:"ARROW_RIGHT"})},Escape(C){C.preventDefault(),r({type:"ESCAPE"})},Backspace(){r({type:"BACKSPACE"})},Delete(){r({type:"DELETE"})},Enter(C){let A=I.getAttribute("aria-activedescendant");P&&v&&A||(r({type:"ENTER"}),C.preventDefault())}},R=me(w,{dir:a("dir")}),x=E[R];if(x){x(w);return}}}))},getHiddenInputProps(){return t.input({type:"text",hidden:!0,name:a("name"),form:a("form"),disabled:c,readOnly:d,required:a("required"),id:FP(o),defaultValue:i("valueAsString")})},getItemProps(w){return t.element(y(h({},Nn.item.attrs),{dir:a("dir"),"data-value":w.value,"data-disabled":b(c)}))},getItemPreviewProps(w){let I=T(w);return t.element(y(h({},Nn.itemPreview.attrs),{id:I.id,dir:a("dir"),hidden:I.editing,"data-value":w.value,"data-disabled":b(c),"data-highlighted":b(I.highlighted),onPointerDown(P){!l||I.disabled||fe(P)&&(P.preventDefault(),r({type:"POINTER_DOWN_TAG",id:I.id}))},onDoubleClick(){!l||I.disabled||r({type:"DOUBLE_CLICK_TAG",id:I.id})}}))},getItemTextProps(w){let I=T(w);return t.element(y(h({},Nn.itemText.attrs),{dir:a("dir"),"data-disabled":b(c),"data-highlighted":b(I.highlighted)}))},getItemInputProps(w){var P;let I=T(w);return t.input(y(h({},Nn.itemInput.attrs),{dir:a("dir"),"aria-label":(P=u==null?void 0:u.tagEdited)==null?void 0:P.call(u,w.value),disabled:c,id:MP(o,w),tabIndex:-1,hidden:!I.editing,maxLength:a("maxLength"),defaultValue:I.editing?s.get("editedTagValue"):"",onInput(v){r({type:"TAG_INPUT_TYPE",value:v.currentTarget.value})},onBlur(v){queueMicrotask(()=>{r({type:"TAG_INPUT_BLUR",target:v.relatedTarget,id:I.id})})},onKeyDown(v){if(v.defaultPrevented||Me(v))return;let R={Enter(){r({type:"TAG_INPUT_ENTER"})},Escape(){r({type:"TAG_INPUT_ESCAPE"})}}[v.key];R&&(v.preventDefault(),R(v))}}))},getItemDeleteTriggerProps(w){var P;let I=T(w);return t.button(y(h({},Nn.itemDeleteTrigger.attrs),{dir:a("dir"),"data-disabled":b(I.disabled),"aria-disabled":I.disabled,"data-highlighted":b(I.highlighted),id:eF(o,w),type:"button",disabled:I.disabled,"aria-label":(P=u==null?void 0:u.deleteTagTriggerLabel)==null?void 0:P.call(u,w.value),tabIndex:-1,onPointerDown(v){fe(v)&&(l||v.preventDefault())},onPointerMove(v){l&&cF(v.currentTarget)},onPointerLeave(v){l&&dF(v.currentTarget)},onClick(v){v.defaultPrevented||l&&r({type:"CLICK_DELETE_TAG",id:I.id})}}))},getClearTriggerProps(){return t.button(y(h({},Nn.clearTrigger.attrs),{dir:a("dir"),id:ZD(o),type:"button","data-readonly":b(d),disabled:c,"aria-label":u==null?void 0:u.clearTriggerLabel,hidden:S,onClick(){l&&r({type:"CLEAR_VALUE"})}}))}}}function pF(e,t){return t?typeof t=="string"?e.endsWith(t):new RegExp(`${t.source}$`).test(e):!1}function hF(e){if(!e)return;let t=pt(e);return"box-sizing:"+t.boxSizing+";border-left:"+t.borderLeftWidth+" solid red;border-right:"+t.borderRightWidth+" solid red;font-family:"+t.fontFamily+";font-feature-settings:"+t.fontFeatureSettings+";font-kerning:"+t.fontKerning+";font-size:"+t.fontSize+";font-stretch:"+t.fontStretch+";font-style:"+t.fontStyle+";font-variant:"+t.fontVariant+";font-variant-caps:"+t.fontVariantCaps+";font-variant-ligatures:"+t.fontVariantLigatures+";font-variant-numeric:"+t.fontVariantNumeric+";font-weight:"+t.fontWeight+";letter-spacing:"+t.letterSpacing+";margin-left:"+t.marginLeft+";margin-right:"+t.marginRight+";padding-left:"+t.paddingLeft+";padding-right:"+t.paddingRight+";text-indent:"+t.textIndent+";text-transform:"+t.textTransform}function fF(e){let t=e.createElement("div");return t.id="ghost",t.style.cssText="display:inline-block;height:0;overflow:hidden;position:absolute;top:0;visibility:hidden;white-space:nowrap;",e.body.appendChild(t),t}function mF(e){if(!e)return;let t=Ge(e),n=ye(e),r=fF(t),i=hF(e);i&&(r.style.cssText+=i);function a(){n.requestAnimationFrame(()=>{r.innerHTML=e.value;let o=n.getComputedStyle(r);e==null||e.style.setProperty("width",o.width)})}return a(),e==null||e.addEventListener("input",a),e==null||e.addEventListener("change",a),()=>{t.body.removeChild(r),e==null||e.removeEventListener("input",a),e==null||e.removeEventListener("change",a)}}function RP(e,t){return e.split(bF).join(t)}function Zg(e){var r,i;let t=(r=e.deleteTagTriggerLabel)!=null?r:EF,n=(i=e.tagEdited)!=null?i:PF;return{deleteTagTriggerLabel:a=>RP(t,a),tagEdited:a=>RP(n,a)}}function kP(e){let t=e.dataset.translation;if(!t)return{translations:Zg({})};try{let n=JSON.parse(t);return{translations:Zg(n)}}catch(n){return{translations:Zg({})}}}function Oc(e){return Array.from(e.querySelectorAll(':scope > [data-scope="tags-input"][data-part="item"]'))}function NP(e){return e?!e.hidden:!1}function IF(e,t,n,r={}){sn(e,t,{onTouched:n,scope:"tags-input",notifyLiveView:r.notifyLiveView,fieldTouched:r.fieldTouched===!0})}function Jg(e,t,n,r={}){IF(e,t,n,r)}function TF(e,t){let n=e.dataset[t];if(!n||n.trim()==="")return[];try{let r=JSON.parse(n);return Array.isArray(r)&&r.every(i=>typeof i=="string")?r:[]}catch(r){return[]}}function ep(e){return V(e,"blurBehavior",["add","clear"])}function tp(e){let t=G(e,"max");if(t!==void 0&&!(!Number.isFinite(t)||t<=0))return t}function np(e){let t=e.querySelector('[data-scope="tags-input"][data-part="input"]'),n=t==null?void 0:t.getAttribute("placeholder");return typeof n=="string"&&n!==""?n:void 0}function LP(e){if(!V(e,"submitName"))return V(e,"name")}var XD,Nn,DP,Qg,ZD,FP,JD,QD,Yo,eF,MP,tF,xP,nF,rF,_P,xa,$P,Oi,iF,aF,oF,sF,lF,zo,cF,dF,uF,jo,wi,vF,yF,bF,EF,PF,SF,CF,BP=ee(()=>{"use strict";bl();on();ai();Kt();$e();Ve();be();oe();XD=z("tagsInput").parts("root","label","control","input","clearTrigger","item","itemPreview","itemInput","itemText","itemDeleteTrigger"),Nn=XD.build(),DP=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`tags-input:${e.id}`},Qg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`tags-input:${e.id}:input`},ZD=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.clearBtn)!=null?n:`tags-input:${e.id}:clear-btn`},FP=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`tags-input:${e.id}:hidden-input`},JD=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`tags-input:${e.id}:label`},QD=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`tags-input:${e.id}:control`},Yo=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.item)==null?void 0:r.call(n,t))!=null?i:`tags-input:${e.id}:tag:${t.value}:${t.index}`},eF=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemDeleteTrigger)==null?void 0:r.call(n,t))!=null?i:`${Yo(e,t)}:delete-btn`},MP=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemInput)==null?void 0:r.call(n,t))!=null?i:`${Yo(e,t)}:input`},tF=e=>`${e}:input`,xP=(e,t)=>e.getById(tF(t)),nF=e=>Oe(_P(e),"[data-part=item]"),rF=(e,t)=>e.getById(MP(e,t)),_P=e=>e.getById(DP(e)),xa=e=>e.getById(Qg(e)),$P=e=>e.getById(FP(e)),Oi=e=>Oe(_P(e),"[data-part=item-preview]:not([data-disabled])"),iF=e=>Oi(e)[0],aF=e=>Oi(e)[Oi(e).length-1],oF=(e,t)=>vr(Oi(e),t,!1),sF=(e,t)=>mr(Oi(e),t,!1),lF=(e,t)=>Oi(e)[t],zo=(e,t)=>Ja(Oi(e),t),cF=e=>{let t=e.closest("[data-part=item-preview]");t&&(t.dataset.deleteIntent="")},dF=e=>{let t=e.closest("[data-part=item-preview]");t&&delete t.dataset.deleteIntent},uF=(e,t)=>{let n=$P(e);n&&Hi(n,{value:t})};({and:jo,not:wi,or:vF}=we()),yF=te({props({props:e}){return y(h({dir:"ltr",addOnPaste:!1,editable:!0,validate:()=>!0,allowDuplicates:!1,delimiter:",",defaultValue:[],defaultInputValue:"",max:1/0,sanitizeValue:t=>t.trim()},e),{translations:h({clearTriggerLabel:"Clear all tags",deleteTagTriggerLabel:t=>`Delete tag ${t}`,tagAdded:t=>`Added tag ${t}`,tagsPasted:t=>`Pasted ${t.length} tags`,tagEdited:t=>`Editing tag ${t}. Press enter to save or escape to cancel.`,tagUpdated:t=>`Tag update to ${t}`,tagDeleted:t=>`Tag ${t} deleted`,tagSelected:t=>`Tag ${t} selected. Press enter to edit, delete or backspace to remove.`},e.translations)})},initialState({prop:e}){return e("autoFocus")?"focused:input":"idle"},refs(){return{liveRegion:null,log:{current:null,prev:null}}},context({bindable:e,prop:t}){return{value:e(()=>({defaultValue:t("defaultValue"),value:t("value"),isEqual:Ce,hash(n){return n.join(", ")},onChange(n){var r;(r=t("onValueChange"))==null||r({value:n})}})),inputValue:e(()=>({sync:!0,defaultValue:t("defaultInputValue"),value:t("inputValue"),onChange(n){var r;(r=t("onInputValueChange"))==null||r({inputValue:n})}})),fieldsetDisabled:e(()=>({defaultValue:!1})),editedTagValue:e(()=>({defaultValue:""})),editedTagId:e(()=>({defaultValue:null})),editedTagIndex:e(()=>({defaultValue:null,sync:!0})),highlightedTagId:e(()=>({defaultValue:null,sync:!0,onChange(n){var r;(r=t("onHighlightChange"))==null||r({highlightedValue:n})}}))}},computed:{count:({context:e})=>e.get("value").length,valueAsString:({context:e})=>e.hash("value"),sanitizedInputValue:({context:e,prop:t})=>t("sanitizeValue")(e.get("inputValue")),isDisabled:({prop:e})=>!!e("disabled"),isInteractive:({prop:e})=>!(e("readOnly")||e("disabled")),isAtMax:({context:e,prop:t})=>e.get("value").length===t("max"),isOverflowing:({context:e,prop:t})=>e.get("value").length>t("max")},watch({track:e,context:t,action:n,computed:r,refs:i}){e([()=>t.get("editedTagValue")],()=>{n(["syncEditedTagInputValue"])}),e([()=>t.get("inputValue")],()=>{n(["syncInputValue"])}),e([()=>t.get("highlightedTagId")],()=>{n(["logHighlightedTag"])}),e([()=>r("isOverflowing")],()=>{n(["invokeOnInvalid"])}),e([()=>JSON.stringify(i.get("log"))],()=>{n(["announceLog"])})},effects:["trackLiveRegion","trackFormControlState"],exit:["clearLog"],on:{DOUBLE_CLICK_TAG:{guard:"isTagEditable",target:"editing:tag",actions:["setEditedId"]},POINTER_DOWN_TAG:{target:"navigating:tag",actions:["highlightTag","focusInput"]},CLICK_DELETE_TAG:{target:"focused:input",actions:["deleteTag"]},SET_INPUT_VALUE:{actions:["setInputValue"]},SET_VALUE:{actions:["setValue"]},CLEAR_TAG:{actions:["deleteTag"]},SET_VALUE_AT_INDEX:{actions:["setValueAtIndex"]},CLEAR_VALUE:{actions:["clearTags","clearInputValue","focusInput"]},ADD_TAG:{actions:["addTag"]},INSERT_TAG:{guard:jo(vF(wi("isAtMax"),"allowOverflow"),wi("isInputValueEmpty")),actions:["addTag","clearInputValue"]},EXTERNAL_BLUR:[{guard:"addOnBlur",actions:["raiseInsertTagEvent"]},{guard:"clearOnBlur",actions:["clearInputValue"]}]},states:{idle:{on:{FOCUS:{target:"focused:input"},POINTER_DOWN:{guard:wi("hasHighlightedTag"),target:"focused:input"}}},"focused:input":{tags:["focused"],entry:["focusInput","clearHighlightedId"],effects:["trackInteractOutside"],on:{TYPE:{actions:["setInputValue"]},BLUR:[{guard:"addOnBlur",target:"idle",actions:["raiseInsertTagEvent"]},{guard:"clearOnBlur",target:"idle",actions:["clearInputValue"]},{target:"idle"}],ENTER:{actions:["raiseInsertTagEvent"]},DELIMITER_KEY:{actions:["raiseInsertTagEvent"]},ARROW_LEFT:{guard:jo("hasTags","isCaretAtStart"),target:"navigating:tag",actions:["highlightLastTag"]},BACKSPACE:{target:"navigating:tag",guard:jo("hasTags","isCaretAtStart"),actions:["highlightLastTag"]},DELETE:{guard:"hasHighlightedTag",actions:["deleteHighlightedTag","highlightTagAtIndex"]},PASTE:[{guard:"addOnPaste",actions:["setInputValue","addTagFromPaste"]},{actions:["setInputValue"]}]}},"navigating:tag":{tags:["focused"],effects:["trackInteractOutside"],on:{ARROW_RIGHT:[{guard:jo("hasTags","isCaretAtStart",wi("isLastTagHighlighted")),actions:["highlightNextTag"]},{target:"focused:input"}],ARROW_LEFT:[{guard:wi("isCaretAtStart"),target:"focused:input"},{actions:["highlightPrevTag"]}],BLUR:{target:"idle",actions:["clearHighlightedId"]},ENTER:{guard:jo("isTagEditable","hasHighlightedTag"),target:"editing:tag",actions:["setEditedId","focusEditedTagInput"]},ARROW_DOWN:{target:"focused:input"},ESCAPE:{target:"focused:input"},TYPE:{target:"focused:input",actions:["setInputValue"]},BACKSPACE:[{guard:wi("isCaretAtStart"),target:"focused:input"},{guard:"isFirstTagHighlighted",actions:["deleteHighlightedTag","highlightFirstTag"]},{guard:"hasHighlightedTag",actions:["deleteHighlightedTag","highlightPrevTag"]},{actions:["highlightLastTag"]}],DELETE:[{guard:wi("isCaretAtStart"),target:"focused:input"},{target:"focused:input",actions:["deleteHighlightedTag","highlightTagAtIndex"]}],PASTE:[{guard:"addOnPaste",target:"focused:input",actions:["setInputValue","addTagFromPaste"]},{target:"focused:input",actions:["setInputValue"]}]}},"editing:tag":{tags:["editing","focused"],entry:["focusEditedTagInput"],effects:["autoResize"],on:{TAG_INPUT_TYPE:{actions:["setEditedTagValue"]},TAG_INPUT_ESCAPE:{target:"navigating:tag",actions:["clearEditedTagValue","focusInput","clearEditedId","highlightTagAtIndex"]},TAG_INPUT_BLUR:[{guard:"isInputRelatedTarget",target:"navigating:tag",actions:["clearEditedTagValue","clearHighlightedId","clearEditedId"]},{target:"idle",actions:["clearEditedTagValue","clearHighlightedId","clearEditedId","raiseExternalBlurEvent"]}],TAG_INPUT_ENTER:[{guard:"isEditedTagEmpty",target:"navigating:tag",actions:["deleteHighlightedTag","focusInput","clearEditedId","highlightTagAtIndex"]},{target:"navigating:tag",actions:["submitEditedTagValue","focusInput","clearEditedId","highlightTagAtIndex"]}]}}},implementations:{guards:{isInputRelatedTarget:({scope:e,event:t})=>t.relatedTarget===xa(e),isAtMax:({computed:e})=>e("isAtMax"),hasHighlightedTag:({context:e})=>e.get("highlightedTagId")!=null,isFirstTagHighlighted:({context:e,scope:t})=>{let n=e.get("value");return Yo(t,{value:n[0],index:0})===e.get("highlightedTagId")},isEditedTagEmpty:({context:e,prop:t})=>t("sanitizeValue")(e.get("editedTagValue"))==="",isLastTagHighlighted:({context:e,scope:t})=>{let n=e.get("value"),r=n.length-1;return Yo(t,{value:n[r],index:r})===e.get("highlightedTagId")},isInputValueEmpty:({context:e,prop:t})=>t("sanitizeValue")(e.get("inputValue")).length===0,hasTags:({context:e})=>e.get("value").length>0,allowOverflow:({prop:e})=>!!e("allowOverflow"),autoFocus:({prop:e})=>!!e("autoFocus"),addOnBlur:({prop:e})=>e("blurBehavior")==="add",clearOnBlur:({prop:e})=>e("blurBehavior")==="clear",addOnPaste:({prop:e})=>!!e("addOnPaste"),isTagEditable:({prop:e})=>!!e("editable"),isCaretAtStart:({scope:e})=>nh(xa(e))},effects:{trackInteractOutside({scope:e,prop:t,send:n}){return aa(xa(e),{exclude(r){return nF(e).some(a=>ge(a,r))},onFocusOutside:t("onFocusOutside"),onPointerDownOutside:t("onPointerDownOutside"),onInteractOutside(r){var i;(i=t("onInteractOutside"))==null||i(r),!r.defaultPrevented&&n({type:"BLUR",src:"interact-outside"})}})},trackFormControlState({context:e,send:t,scope:n}){return ht($P(n),{onFieldsetDisabledChange(r){e.set("fieldsetDisabled",r)},onFormReset(){let r=e.initial("value");t({type:"SET_VALUE",value:r,src:"form-reset"})}})},autoResize({context:e,prop:t,scope:n}){let r;return queueMicrotask(()=>{let i=e.get("editedTagValue"),a=e.get("editedTagIndex");if(!i||a==null||!t("editable"))return;let o=rF(n,{value:i,index:a});r=mF(o)}),()=>{r==null||r()}},trackLiveRegion({scope:e,refs:t}){let n=Qi({level:"assertive",document:e.getDoc()});return t.set("liveRegion",n),()=>n.destroy()}},actions:{raiseInsertTagEvent({send:e}){e({type:"INSERT_TAG"})},raiseExternalBlurEvent({send:e,event:t}){e({type:"EXTERNAL_BLUR",id:t.id})},dispatchChangeEvent({scope:e,computed:t}){uF(e,t("valueAsString"))},highlightNextTag({context:e,scope:t}){var i;let n=e.get("highlightedTagId");if(n==null)return;let r=sF(t,n);e.set("highlightedTagId",(i=r==null?void 0:r.id)!=null?i:null)},highlightFirstTag({context:e,scope:t}){B(()=>{var r;let n=iF(t);e.set("highlightedTagId",(r=n==null?void 0:n.id)!=null?r:null)})},highlightLastTag({context:e,scope:t}){var r;let n=aF(t);e.set("highlightedTagId",(r=n==null?void 0:n.id)!=null?r:null)},highlightPrevTag({context:e,scope:t}){var i;let n=e.get("highlightedTagId");if(n==null)return;let r=oF(t,n);e.set("highlightedTagId",(i=r==null?void 0:r.id)!=null?i:null)},highlightTag({context:e,event:t}){e.set("highlightedTagId",t.id)},highlightTagAtIndex({context:e,scope:t}){B(()=>{let n=e.get("editedTagIndex");if(n==null)return;let r=lF(t,n);r!=null&&(e.set("highlightedTagId",r.id),e.set("editedTagIndex",null))})},deleteTag({context:e,scope:t,event:n,refs:r}){let i=zo(t,n.id),a=e.get("value")[i],o=r.get("log");r.set("log",{prev:o.current,current:{type:"delete",value:a}}),e.set("value",s=>Yc(s,i))},deleteHighlightedTag({context:e,scope:t,refs:n}){let r=e.get("highlightedTagId");if(r==null)return;let i=zo(t,r);e.set("editedTagIndex",i);let a=e.get("value"),o=n.get("log");n.set("log",{prev:o.current,current:{type:"delete",value:a[i]}}),e.set("value",s=>Yc(s,i))},setEditedId({context:e,event:t,scope:n}){var s;let r=e.get("highlightedTagId"),i=(s=t.id)!=null?s:r;e.set("editedTagId",i);let a=zo(n,i),o=e.get("value")[a];e.set("editedTagIndex",a),e.set("editedTagValue",o)},clearEditedId({context:e}){e.set("editedTagId",null)},clearEditedTagValue({context:e}){e.set("editedTagValue","")},setEditedTagValue({context:e,event:t}){e.set("editedTagValue",t.value)},submitEditedTagValue({context:e,scope:t,refs:n,prop:r}){let i=e.get("editedTagId");if(!i)return;let a=zo(t,i),o=e.get("editedTagValue"),s=e.get("value"),l=s.some((d,g)=>g!==a&&d===o);if(!r("allowDuplicates")&&l||s[a]===o)return;e.set("value",d=>{let g=d.slice();return g[a]=o,g});let c=n.get("log");n.set("log",{prev:c.current,current:{type:"update",value:o}})},setValueAtIndex({context:e,event:t,refs:n,prop:r}){if(t.value){let i=e.get("value"),a=i.some((s,l)=>l!==t.index&&s===t.value);if(!r("allowDuplicates")&&a||i[t.index]===t.value)return;e.set("value",s=>{let l=s.slice();return l[t.index]=t.value,l});let o=n.get("log");n.set("log",{prev:o.current,current:{type:"update",value:t.value}})}else It("You need to provide a value for the tag")},focusEditedTagInput({context:e,scope:t}){B(()=>{let n=e.get("editedTagId");if(!n)return;let r=xP(t,n);r==null||r.select()})},setInputValue({context:e,event:t}){e.set("inputValue",t.value)},clearHighlightedId({context:e}){e.set("highlightedTagId",null)},focusInput({scope:e}){B(()=>{var t;(t=xa(e))==null||t.focus()})},clearInputValue({context:e}){B(()=>{e.set("inputValue","")})},syncInputValue({context:e,scope:t}){let n=xa(t);n&&_e(n,e.get("inputValue"))},syncEditedTagInputValue({context:e,event:t,scope:n}){let r=e.get("editedTagId")||e.get("highlightedTagId")||t.id;if(r==null)return;let i=xP(n,r);i&&_e(i,e.get("editedTagValue"))},addTag({context:e,event:t,computed:n,prop:r,refs:i}){var l,c,d;let a=(l=t.value)!=null?l:n("sanitizedInputValue"),o=e.get("value");if((c=r("validate"))==null?void 0:c({inputValue:a,value:Array.from(o)})){let g=r("allowDuplicates")?o.concat(a):gt(o.concat(a));e.set("value",g);let p=i.get("log");i.set("log",{prev:p.current,current:{type:"add",value:a}})}else(d=r("onValueInvalid"))==null||d({reason:"invalidTag"})},addTagFromPaste({context:e,computed:t,prop:n,refs:r}){B(()=>{var l,c;let i=t("sanitizedInputValue"),a=e.get("value"),o=n("sanitizeValue");if((l=n("validate"))==null?void 0:l({inputValue:i,value:Array.from(a)})){let d=n("delimiter"),g=d?i.split(d).map(o):[i],p=n("allowDuplicates")?a.concat(...g):gt(a.concat(...g));e.set("value",p);let u=r.get("log");r.set("log",{prev:u.current,current:{type:"paste",values:g}})}else(c=n("onValueInvalid"))==null||c({reason:"invalidTag"});e.set("inputValue","")})},clearTags({context:e,refs:t}){e.set("value",[]);let n=t.get("log");t.set("log",{prev:n.current,current:{type:"clear"}})},setValue({context:e,event:t}){e.set("value",t.value)},invokeOnInvalid({prop:e,computed:t}){var n;t("isOverflowing")&&((n=e("onValueInvalid"))==null||n({reason:"rangeOverflow"}))},clearLog({refs:e}){let t=e.get("log");t.prev=t.current=null},logHighlightedTag({refs:e,context:t,scope:n}){let r=t.get("highlightedTagId"),i=e.get("log");if(r==null||!i.current)return;let a=zo(n,r),o=t.get("value")[a],s=e.get("log");e.set("log",{prev:s.current,current:{type:"select",value:o}})},announceLog({refs:e,prop:t}){let n=e.get("liveRegion"),r=t("translations"),i=e.get("log");if(!i.current||n==null)return;let a=n,{current:o,prev:s}=i,l;switch(o.type){case"add":l=r.tagAdded(o.value);break;case"delete":l=r.tagDeleted(o.value);break;case"update":l=r.tagUpdated(o.value);break;case"paste":l=r.tagsPasted(o.values);break;case"select":l=r.tagSelected(o.value),(s==null?void 0:s.type)==="delete"?l=`${r.tagDeleted(s.value)}. ${l}`:(s==null?void 0:s.type)==="update"&&(l=`${r.tagUpdated(s.value)}. ${l}`);break;default:break}l&&a.announce(l)}}}}),bF="%{tag}",EF="Delete tag %{tag}",PF="Editing tag %{tag}. Press enter to save or escape to cancel.";SF=class extends X{initMachine(e){return new Y(yF,e)}initApi(){return this.zagConnect(gF)}spreadItemParts(e,t,n){this.spreadProps(e,this.api.getItemProps({index:t,value:n}));let r=e.querySelector('[data-scope="tags-input"][data-part="item-preview"]');r&&this.spreadProps(r,this.api.getItemPreviewProps({index:t,value:n}));let i=e.querySelector('[data-scope="tags-input"][data-part="item-text"]');i&&this.spreadProps(i,this.api.getItemTextProps({index:t,value:n}));let a=e.querySelector('[data-scope="tags-input"][data-part="item-delete-trigger"]');if(a){for(;a.childElementCount>1;)a.removeChild(a.lastElementChild);this.spreadProps(a,this.api.getItemDeleteTriggerProps({index:t,value:n}))}let o=e.querySelector('[data-scope="tags-input"][data-part="item-input"]');o&&this.spreadProps(o,this.api.getItemInputProps({index:t,value:n})),i&&!NP(o)&&(i.textContent=n)}renderItems(){var o,s;let e=this.el.querySelector('[data-scope="tags-input"][data-part="control"]');if(!e)return;let t=e.querySelector(':scope > [data-scope="tags-input"][data-part="input"]');if(!t)return;let n=Is(this.el,"tags-input");if(!n)return;let r=n.querySelector('[data-scope="tags-input"][data-part="item"][data-template]');if(!r)return;let i=(o=this.api.value)!=null?o:[],a=Oc(e);for(;a.length>i.length;)a[a.length-1].remove(),a=Oc(e);for(let l=0;lj(this.liveSocket),i=ep(e),a=tp(e),o=V(e,"delimiter"),s=np(e),l=new SF(e,y(h(h(h(h(y(h(y(h(h({id:e.id},kP(e)),$h(e)),{disabled:O(e,"disabled"),readOnly:O(e,"readonly"),invalid:O(e,"invalid"),required:O(e,"required"),name:LP(e),form:V(e,"submitName")?void 0:V(e,"form"),dir:q(e),addOnPaste:O(e,"addOnPaste"),allowDuplicates:O(e,"allowDuplicates"),allowOverflow:O(e,"allowOverflow")}),Ye(e,"editable")===void 0?{}:{editable:Ye(e,"editable")===!0}),{autoFocus:O(e,"autoFocus")}),i!==void 0?{blurBehavior:i}:{}),a!==void 0?{max:a}:{}),o!==void 0&&o!==""?{delimiter:o}:{}),s!==void 0?{placeholder:s}:{}),{onValueChange:p=>{t.fieldTouched=!0,Jg(e,p.value,void 0,{notifyLiveView:t.allowFormNotify===!0,fieldTouched:!0}),W({el:e,canPushServer:r(),pushEvent:n,payload:{id:e.id,value:p.value},serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})},onInputValueChange:p=>{t.fieldTouched=!0,W({el:e,canPushServer:r(),pushEvent:n,payload:{id:e.id,inputValue:p.inputValue},serverEventName:V(e,"onInputValueChange"),clientEventName:V(e,"onInputValueChangeClient")})},onHighlightChange:p=>{W({el:e,canPushServer:r(),pushEvent:n,payload:{id:e.id,highlightedValue:p.highlightedValue},serverEventName:V(e,"onHighlightChange"),clientEventName:V(e,"onHighlightChangeClient")})},onValueInvalid:p=>{W({el:e,canPushServer:r(),pushEvent:n,payload:{id:e.id,reason:p.reason},serverEventName:V(e,"onValueInvalid"),clientEventName:V(e,"onValueInvalidClient")})}}));l.init(),this.tagsInput=l;let c=(p,u={})=>{Jg(e,p,void 0,{notifyLiveView:u.notifyLiveView,fieldTouched:Ar(e,t.fieldTouched===!0)})};queueMicrotask(()=>{Ar(e,t.fieldTouched===!0)||c(l.api.value,{notifyLiveView:!1}),t.allowFormNotify=!0}),t.unbindSubmitIntent=oa(e,()=>{t.fieldTouched=!0,c(l.api.value,{notifyLiveView:!1})});let d=ie(e);this.domRegistry=d,d.add("corex:tags-input:set-value",p=>{var f;let u=(f=p.detail)==null?void 0:f.value;Array.isArray(u)&&u.every(m=>typeof m=="string")&&l.api.setValue(u)}),d.add("corex:tags-input:clear-value",()=>{l.api.clearValue()}),d.add("corex:tags-input:add-value",p=>{var f;let u=(f=p.detail)==null?void 0:f.value;typeof u=="string"&&u!==""&&l.api.addValue(u)}),d.add("corex:tags-input:remove-value",p=>{var f;let u=(f=p.detail)==null?void 0:f.value;typeof u!="string"||u===""||l.api.setValue(l.api.value.filter(m=>m!==u))});let g=re(this);this.handleRegistry=g,g.add("tags_input_set_value",p=>{if(!$(e.id,H(p)))return;let u=Wh(p);u&&l.api.setValue(u)}),g.add("tags_input_clear_value",p=>{$(e.id,H(p))&&l.api.clearValue()}),g.add("tags_input_add_value",p=>{if(!$(e.id,H(p)))return;let u=ao(p);u!==""&&l.api.addValue(u)}),g.add("tags_input_remove_value",p=>{if(!$(e.id,H(p)))return;let u=ao(p);u!==""&&l.api.setValue(l.api.value.filter(f=>f!==u))})},updated(){var o,s;let e=this.el,t=_h(e),n=ep(e),r=tp(e),i=V(e,"delimiter"),a=np(e);(o=this.tagsInput)==null||o.updateProps(h(h(h(h(y(h(y(h(h({id:e.id},kP(e)),t),{disabled:O(e,"disabled"),readOnly:O(e,"readonly"),invalid:O(e,"invalid"),required:O(e,"required"),name:LP(e),form:V(e,"submitName")?void 0:V(e,"form"),dir:q(e),addOnPaste:O(e,"addOnPaste"),allowDuplicates:O(e,"allowDuplicates"),allowOverflow:O(e,"allowOverflow")}),Ye(e,"editable")===void 0?{}:{editable:Ye(e,"editable")===!0}),{autoFocus:O(e,"autoFocus")}),n!==void 0?{blurBehavior:n}:{}),r!==void 0?{max:r}:{}),i!==void 0&&i!==""?{delimiter:i}:{}),a!==void 0?{placeholder:a}:{})),"value"in t&&Jg(e,t.value,void 0,{notifyLiveView:!1,fieldTouched:Ar(e,this.fieldTouched===!0)}),(s=this.tagsInput)==null||s.render()},destroyed(){var e,t,n,r;(e=this.unbindSubmitIntent)==null||e.call(this),(t=this.domRegistry)==null||t.teardown(),(n=this.handleRegistry)==null||n.teardown(),(r=this.tagsInput)==null||r.destroy()}}});var jP={};pe(jP,{Tabs:()=>HF,readTabsLayoutProps:()=>ip,tabsFocusChangePayload:()=>zP,tabsValueChangePayload:()=>KP});function DF(e,t){let{state:n,send:r,context:i,prop:a,scope:o}=e,s=a("translations"),l=n.matches("focused"),c=a("orientation")==="vertical",d=a("orientation")==="horizontal",g=a("composite");function p(u){return{selected:i.get("value")===u.value,focused:i.get("focusedValue")===u.value,disabled:!!u.disabled}}return{value:i.get("value"),focusedValue:i.get("focusedValue"),setValue(u){r({type:"SET_VALUE",value:u})},clearValue(){r({type:"CLEAR_VALUE"})},setIndicatorRect(u){let f=Vi(o,u);r({type:"SET_INDICATOR_RECT",id:f})},syncTabIndex(){r({type:"SYNC_TAB_INDEX"})},selectNext(u){r({type:"TAB_FOCUS",value:u,src:"selectNext"}),r({type:"ARROW_NEXT",src:"selectNext"})},selectPrev(u){r({type:"TAB_FOCUS",value:u,src:"selectPrev"}),r({type:"ARROW_PREV",src:"selectPrev"})},focus(){var f;let u=i.get("value");u&&((f=Vc(o,u))==null||f.focus())},getRootProps(){return t.element(y(h({},Xo.root.attrs),{id:OF(o),"data-orientation":a("orientation"),"data-focus":b(l),dir:a("dir")}))},getListProps(){return t.element(y(h({},Xo.list.attrs),{id:Zo(o),role:"tablist",dir:a("dir"),"data-focus":b(l),"aria-orientation":a("orientation"),"data-orientation":a("orientation"),"aria-label":s==null?void 0:s.listLabel,onKeyDown(u){if(u.defaultPrevented||Me(u)||!ge(u.currentTarget,ne(u)))return;let f={ArrowDown(){d||r({type:"ARROW_NEXT",key:"ArrowDown"})},ArrowUp(){d||r({type:"ARROW_PREV",key:"ArrowUp"})},ArrowLeft(){c||r({type:"ARROW_PREV",key:"ArrowLeft"})},ArrowRight(){c||r({type:"ARROW_NEXT",key:"ArrowRight"})},Home(){r({type:"HOME"})},End(){r({type:"END"})}},m=me(u,{dir:a("dir"),orientation:a("orientation")}),S=f[m];if(S){u.preventDefault(),S(u);return}}}))},getTriggerState:p,getTriggerProps(u){let{value:f,disabled:m}=u,S=p(u);return t.button(y(h({},Xo.trigger.attrs),{role:"tab",type:"button",disabled:m,dir:a("dir"),"data-orientation":a("orientation"),"data-disabled":b(m),"aria-disabled":m,"data-value":f,"aria-selected":S.selected,"data-selected":b(S.selected),"data-focus":b(S.focused),"aria-controls":S.selected?rp(o,f):void 0,"data-ownedby":Zo(o),"data-ssr":b(i.get("ssr")),id:Vi(o,f),tabIndex:S.selected&&g?0:-1,onFocus(){r({type:"TAB_FOCUS",value:f})},onBlur(T){let w=T.relatedTarget;(w==null?void 0:w.getAttribute("role"))!=="tab"&&r({type:"TAB_BLUR"})},onClick(T){T.defaultPrevented||$n(T)||m||(wt()&&T.currentTarget.focus(),r({type:"TAB_CLICK",value:f}))}}))},getContentProps(u){let{value:f}=u,m=i.get("value")===f;return t.element(y(h({},Xo.content.attrs),{dir:a("dir"),id:rp(o,f),tabIndex:g?0:-1,"aria-labelledby":Vi(o,f),role:"tabpanel","data-ownedby":Zo(o),"data-selected":b(m),"data-orientation":a("orientation"),hidden:!m}))},getIndicatorProps(){let u=i.get("indicatorRect"),f=i.get("animateIndicator");return t.element(y(h({id:qP(o)},Xo.indicator.attrs),{dir:a("dir"),"data-orientation":a("orientation"),hidden:FF(u),onTransitionEnd(m){ne(m)===m.currentTarget&&r({type:"INDICATOR_TRANSITION_END"})},style:{"--transition-property":"left, right, top, bottom, width, height","--left":ke(u==null?void 0:u.x),"--top":ke(u==null?void 0:u.y),"--width":ke(u==null?void 0:u.width),"--height":ke(u==null?void 0:u.height),position:"absolute",willChange:f?"var(--transition-property)":"auto",transitionProperty:f?"var(--transition-property)":"none",transitionDuration:f?"var(--transition-duration, 150ms)":"0ms",transitionTimingFunction:"var(--transition-timing-function)",[d?"left":"top"]:d?"var(--left)":"var(--top)"}}))}}}function GP(e){return{root:`tabs-${e}-root`,list:`tabs-${e}-list`,indicator:`tabs-${e}-indicator`,content:t=>`tabs-${e}-content-${t}`,trigger:t=>`tabs-${e}-trigger-${t}`}}function KP(e,t){var n;return{id:e.id,value:(n=t.value)!=null?n:null}}function zP(e,t){var n;return{id:e.id,value:(n=t.focusedValue)!=null?n:null}}function ip(e){return{orientation:V(e,"orientation"),dir:q(e)}}var wF,Xo,OF,Zo,rp,Vi,qP,VF,AF,Vc,UP,Ra,xF,RF,kF,NF,WP,LF,FF,MF,_F,$F,HF,YP=ee(()=>{"use strict";Bt();$e();Ve();be();oe();wF=z("tabs").parts("root","list","trigger","content","indicator"),Xo=wF.build(),OF=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`tabs:${e.id}`},Zo=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.list)!=null?n:`tabs:${e.id}:list`},rp=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.content)==null?void 0:r.call(n,t))!=null?i:`tabs:${e.id}:content-${t}`},Vi=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.trigger)==null?void 0:r.call(n,t))!=null?i:`tabs:${e.id}:trigger-${t}`},qP=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.indicator)!=null?n:`tabs:${e.id}:indicator`},VF=e=>e.getById(Zo(e)),AF=(e,t)=>e.getById(rp(e,t)),Vc=(e,t)=>t!=null?e.getById(Vi(e,t)):null,UP=e=>e.getById(qP(e)),Ra=e=>{let n=`[role=tab][data-ownedby='${CSS.escape(Zo(e))}']:not([disabled])`;return Oe(VF(e),n)},xF=e=>Dt(Ra(e)),RF=e=>en(Ra(e)),kF=(e,t)=>mr(Ra(e),Vi(e,t.value),t.loopFocus),NF=(e,t)=>vr(Ra(e),Vi(e,t.value),t.loopFocus),WP=e=>{var t,n,r,i;return{x:(t=e==null?void 0:e.offsetLeft)!=null?t:0,y:(n=e==null?void 0:e.offsetTop)!=null?n:0,width:(r=e==null?void 0:e.offsetWidth)!=null?r:0,height:(i=e==null?void 0:e.offsetHeight)!=null?i:0}},LF=(e,t)=>{let n=pd(Ra(e),Vi(e,t));return WP(n)};FF=e=>e==null||e.width===0&&e.height===0&&e.x===0&&e.y===0,{createMachine:MF}=Mt(),_F=MF({props({props:e}){return h({dir:"ltr",orientation:"horizontal",activationMode:"automatic",loopFocus:!0,composite:!0,navigate(t){Gi(t.node)},defaultValue:null},e)},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var r;(r=e("onValueChange"))==null||r({value:n})}})),focusedValue:t(()=>({defaultValue:e("value")||e("defaultValue"),sync:!0,onChange(n){var r;(r=e("onFocusChange"))==null||r({focusedValue:n})}})),ssr:t(()=>({defaultValue:!0})),indicatorRect:t(()=>({defaultValue:null})),animateIndicator:t(()=>({defaultValue:!1}))}},refs(){return{indicatorCleanup:null,prevValue:null}},watch({context:e,prop:t,track:n,action:r}){n([()=>e.get("value")],()=>{r(["syncIndicatorAnimation","syncIndicatorRect","syncTabIndex","navigateIfNeeded"])}),n([()=>t("dir"),()=>t("orientation")],()=>{r(["syncIndicatorRect"])})},on:{SET_VALUE:{actions:["setValue"]},CLEAR_VALUE:{actions:["clearValue"]},SET_INDICATOR_RECT:{actions:["setIndicatorRect"]},SYNC_TAB_INDEX:{actions:["syncTabIndex"]},INDICATOR_TRANSITION_END:{actions:["clearIndicatorAnimation"]}},entry:["syncPrevValue","syncIndicatorRect","syncTabIndex","syncSsr"],exit:["cleanupObserver"],states:{idle:{on:{TAB_FOCUS:{target:"focused",actions:["setFocusedValue"]},TAB_CLICK:{target:"focused",actions:["setFocusedValue","setValue"]}}},focused:{on:{TAB_CLICK:{actions:["setFocusedValue","setValue"]},ARROW_PREV:[{guard:"selectOnFocus",actions:["focusPrevTab","selectFocusedTab"]},{actions:["focusPrevTab"]}],ARROW_NEXT:[{guard:"selectOnFocus",actions:["focusNextTab","selectFocusedTab"]},{actions:["focusNextTab"]}],HOME:[{guard:"selectOnFocus",actions:["focusFirstTab","selectFocusedTab"]},{actions:["focusFirstTab"]}],END:[{guard:"selectOnFocus",actions:["focusLastTab","selectFocusedTab"]},{actions:["focusLastTab"]}],TAB_FOCUS:{actions:["setFocusedValue"]},TAB_BLUR:{target:"idle",actions:["clearFocusedValue"]}}}},implementations:{guards:{selectOnFocus:({prop:e})=>e("activationMode")==="automatic"},actions:{selectFocusedTab({context:e,prop:t}){B(()=>{let n=e.get("focusedValue");if(!n)return;let i=t("deselectable")&&e.get("value")===n?null:n;e.set("value",i)})},setFocusedValue({context:e,event:t,flush:n}){t.value!=null&&n(()=>{e.set("focusedValue",t.value)})},clearFocusedValue({context:e}){e.set("focusedValue",null)},setValue({context:e,event:t,prop:n}){let r=n("deselectable")&&e.get("value")===e.get("focusedValue");e.set("value",r?null:t.value)},clearValue({context:e}){e.set("value",null)},focusFirstTab({scope:e}){B(()=>{var t;(t=xF(e))==null||t.focus()})},focusLastTab({scope:e}){B(()=>{var t;(t=RF(e))==null||t.focus()})},focusNextTab({context:e,prop:t,scope:n,event:r}){var o;let i=(o=r.value)!=null?o:e.get("focusedValue");if(!i)return;let a=kF(n,{value:i,loopFocus:t("loopFocus")});B(()=>{t("composite")?a==null||a.focus():(a==null?void 0:a.dataset.value)!=null&&e.set("focusedValue",a.dataset.value)})},focusPrevTab({context:e,prop:t,scope:n,event:r}){var o;let i=(o=r.value)!=null?o:e.get("focusedValue");if(!i)return;let a=NF(n,{value:i,loopFocus:t("loopFocus")});B(()=>{t("composite")?a==null||a.focus():(a==null?void 0:a.dataset.value)!=null&&e.set("focusedValue",a.dataset.value)})},syncTabIndex({context:e,scope:t}){B(()=>{let n=e.get("value");if(!n)return;let r=AF(t,n);if(!r)return;Ya(r).length>0?r.removeAttribute("tabindex"):r.setAttribute("tabindex","0")})},cleanupObserver({refs:e}){let t=e.get("indicatorCleanup");t&&t()},setIndicatorRect({context:e,event:t,scope:n}){var o;let r=(o=t.id)!=null?o:e.get("value");!UP(n)||!r||!Vc(n,r)||e.set("indicatorRect",LF(n,r))},syncSsr({context:e}){e.set("ssr",!1)},syncPrevValue({context:e,refs:t}){t.set("prevValue",e.get("value"))},syncIndicatorAnimation({context:e,refs:t}){let n=t.get("prevValue"),r=e.get("value"),i=n!=null&&r!=null&&n!==r;e.set("animateIndicator",i),t.set("prevValue",r)},clearIndicatorAnimation({context:e}){e.set("animateIndicator",!1)},syncIndicatorRect({context:e,refs:t,scope:n}){let r=t.get("indicatorCleanup");if(r&&r(),!UP(n))return;let a=()=>{let l=Vc(n,e.get("value"));if(!l)return;let c=WP(l);e.set("indicatorRect",d=>Ce(d,c)?d:c)};a();let o=Ra(n),s=Ct(...o.map(l=>Gn.observe(l,a)));t.set("indicatorCleanup",s)},navigateIfNeeded({context:e,prop:t,scope:n}){var a;let r=e.get("value");if(!r)return;let i=Vc(n,r);_t(i)&&((a=t("navigate"))==null||a({value:r,node:i,href:i.href}))}}}});$F=class extends X{constructor(){super(...arguments);Q(this,"updateProps",t=>{var i;let n=t,r=(i=n.id)!=null?i:this.el.id;this.machine.updateProps(y(h({},n),{id:r,ids:GP(r)}))})}initMachine(t){var r;let n=(r=t.id)!=null?r:this.el.id;return new Y(_F,y(h({},t),{id:n,ids:GP(n)}))}initApi(){return this.zagConnect(DF)}render(){let t=this.el.querySelector('[data-scope="tabs"][data-part="root"]');if(!t)return;this.spreadProps(t,this.api.getRootProps());let n=t.querySelector(':scope > [data-scope="tabs"][data-part="list"]');if(!n)return;this.spreadProps(n,this.api.getListProps()),n.querySelectorAll(':scope > [data-scope="tabs"][data-part="trigger"]').forEach(a=>{let o=a.dataset.value,s=a.dataset.disabled=="";o&&this.spreadProps(a,this.api.getTriggerProps({value:o,disabled:s}))}),t.querySelectorAll(':scope > [data-scope="tabs"][data-part="content"]').forEach(a=>{let o=a.dataset.value;o&&this.spreadProps(a,this.api.getContentProps({value:o}))})}};HF={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=new $F(e,y(h(h({id:e.id},Hs(e,"value","defaultValue")),ip(e)),{onValueChange:o=>{W({el:e,canPushServer:n(),pushEvent:t,payload:KP(e,o),serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})},onFocusChange:o=>{W({el:e,canPushServer:n(),pushEvent:t,payload:zP(e,o),serverEventName:V(e,"onFocusChange"),clientEventName:V(e,"onFocusChangeClient")})}}));r.init(),this.tabs=r;let i=ie(e);this.domRegistry=i,i.add("corex:tabs:set-value",o=>{r.api.setValue(o.detail.value)});let a=re(this);this.handleRegistry=a,a.add("tabs_set_value",o=>{$(e.id,H(o))&&r.api.setValue(o.value)}),a.add("tabs_value",o=>{$(e.id,H(o))&&n()&&this.pushEvent("tabs_value_response",{id:e.id,value:r.api.value})}),a.add("tabs_focused_value",o=>{$(e.id,H(o))&&n()&&this.pushEvent("tabs_focused_value_response",{id:e.id,value:r.api.focusedValue})})},updated(){var e;(e=this.tabs)==null||e.updateProps(h(h({id:this.el.id},Fh(this.el,"value","defaultValue")),ip(this.el)))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.tabs)==null||n.destroy()}}});var eS={};pe(eS,{Timer:()=>tM,parseTimerTranslations:()=>QP});function qF(e,t){let{state:n,send:r,computed:i,scope:a,prop:o}=e,s=o("translations"),l=n.matches("running"),c=n.matches("paused"),d=i("time"),g=i("formattedTime"),p=i("progressPercent");return{running:l,paused:c,time:d,formattedTime:g,progressPercent:p,start(){r({type:"START"})},pause(){r({type:"PAUSE"})},resume(){r({type:"RESUME"})},reset(){r({type:"RESET"})},restart(){r({type:"RESTART"})},getRootProps(){return t.element(h({id:UF(a)},Ur.root.attrs))},getAreaProps(){var u;return t.element(h({role:"timer",id:GF(a),"aria-label":(u=s.areaLabel)==null?void 0:u.call(s,d,g),"aria-atomic":!0},Ur.area.attrs))},getControlProps(){return t.element(h({},Ur.control.attrs))},getItemProps(u){let f=d[u.type];return t.element(y(h({},Ur.item.attrs),{"data-type":u.type,style:{"--value":f}}))},getItemLabelProps(u){return t.element(y(h({},Ur.itemLabel.attrs),{"data-type":u.type}))},getItemValueProps(u){return t.element(y(h({},Ur.itemValue.attrs),{"data-type":u.type}))},getSeparatorProps(){return t.element(h({"aria-hidden":!0},Ur.separator.attrs))},getActionTriggerProps(u){if(!XP.has(u.action))throw new Error(`[zag-js] Invalid action: ${u.action}. Must be one of: ${Array.from(XP).join(", ")}`);return t.button(y(h({},Ur.actionTrigger.attrs),{hidden:He(u.action,{start:()=>l||c,pause:()=>!l,reset:()=>!l&&!c,resume:()=>!c,restart:()=>!1}),type:"button",onClick(f){f.defaultPrevented||r({type:u.action.toUpperCase()})}}))}}}function KF(e){let t=Math.max(0,e),n=t%1e3,r=Math.floor(t/1e3)%60,i=Math.floor(t/(1e3*60))%60,a=Math.floor(t/(1e3*60*60))%24;return{days:Math.floor(t/(1e3*60*60*24)),hours:a,minutes:i,seconds:r,milliseconds:n}}function ZP(e,t,n){let r=n-t;return r===0?0:(e-t)/r}function Jo(e,t=2){return e.toString().padStart(t,"0")}function zF(e,t){return Math.floor(e/t)*t}function jF(e){let{days:t,hours:n,minutes:r,seconds:i}=e;return{days:Jo(t),hours:Jo(n),minutes:Jo(r),seconds:Jo(i),milliseconds:Jo(e.milliseconds,3)}}function YF(e){let{startMs:t,targetMs:n,countdown:r,interval:i}=e;if(i!=null&&(typeof i!="number"||i<=0))throw new Error(`[timer] Invalid interval: ${i}. Must be a positive number.`);if(t!=null&&(typeof t!="number"||t<0))throw new Error(`[timer] Invalid startMs: ${t}. Must be a non-negative number.`);if(n!=null&&(typeof n!="number"||n<0))throw new Error(`[timer] Invalid targetMs: ${n}. Must be a non-negative number.`);if(r&&t!=null&&n!=null&&t<=n)throw new Error(`[timer] Invalid countdown configuration: startMs (${t}) must be greater than targetMs (${n}).`);if(!r&&t!=null&&n!=null&&t>=n)throw new Error(`[timer] Invalid stopwatch configuration: startMs (${t}) must be less than targetMs (${n}).`);if(r&&n==null&&t!=null&&t<=0)throw new Error(`[timer] Invalid countdown configuration: startMs (${t}) must be greater than 0 when no targetMs is provided.`)}function XF(e){let t=n=>{if(n>2)return n;let r=e.length-n;return n<3&&e[n]===0&&r>2?t(n+1):n};return t(0)}function ZF(e,t){let n=["days","hours","minutes","seconds"],r=[t.days,t.hours,t.minutes,t.seconds].map(Number),i=Ie(e,"segments"),a=e.dataset.countdown==="true",o=e.dataset.collapseLeadingZeros;if(i&&i.length>0)return n.map(s=>!i.includes(s));if(o==="false")return[!1,!1,!1,!1];if(o==="true"||o!=="false"&&a){let s=XF(r);return n.map((l,c)=>c{let s=e.querySelector(`[data-timer-segment][data-type="${a}"]`);s&&(n[o]?s.setAttribute("hidden",""):s.removeAttribute("hidden"));let l=e.querySelector(`[data-scope="timer"][data-part="item"][data-type="${a}"]`);l&&(n[o]?(l.setAttribute("hidden",""),l.setAttribute("aria-hidden","true")):(l.removeAttribute("hidden"),l.setAttribute("aria-hidden","false")))});for(let a=0;a<3;a++){let o=`timer:${i}:sep:${a}`,s=e.querySelector(`[id="${CSS.escape(o)}"]`);s&&(n[a]?s.setAttribute("hidden",""):s.removeAttribute("hidden"))}}function eM(e){return{running:e.running,paused:e.paused,progressPercent:e.progressPercent,time:e.time,formattedTime:e.formattedTime}}function QP(e){let t=e.dataset.translation;if(t)try{let n=JSON.parse(t);if(typeof n.areaLabel=="string"&&n.areaLabel.length>0){let r=n.areaLabel;return{areaLabel:()=>r}}}catch(n){return}}function JP(e,t,n){return{id:e.id,countdown:O(e,"countdown"),startMs:G(e,"startMs"),targetMs:G(e,"targetMs"),autoStart:O(e,"autoStart"),interval:G(e,"interval"),dir:q(e),orientation:V(e,"orientation"),translations:QP(e),onTick:r=>{let i=V(e,"onTick");i&&n()&&t(i,{value:r.value,time:r.time,formattedTime:r.formattedTime,id:e.id});let a=V(e,"onTickClient");a&&e.dispatchEvent(new CustomEvent(a,{bubbles:!0,detail:{id:e.id,value:r.value,time:r.time,formattedTime:r.formattedTime}}))},onComplete:()=>{let r=V(e,"onComplete");r&&n()&&t(r,{id:e.id});let i=V(e,"onCompleteClient");i&&e.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:{id:e.id}}))}}}var BF,Ur,UF,GF,XP,WF,QF,tM,tS=ee(()=>{"use strict";Eo();fl();Bt();Ve();be();oe();BF=z("timer").parts("root","area","control","item","itemValue","itemLabel","actionTrigger","separator"),Ur=BF.build(),UF=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`timer:${e.id}:root`},GF=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.area)!=null?n:`timer:${e.id}:area`},XP=new Set(["start","pause","resume","reset","restart"]);WF=te({props({props:e}){return YF(e),y(h({interval:1e3,startMs:0},e),{translations:h({areaLabel:(t,n)=>`${t.days} days ${n.hours}:${n.minutes}:${n.seconds}`},e.translations)})},initialState({prop:e}){return e("autoStart")?"running":"idle"},context({prop:e,bindable:t}){return{currentMs:t(()=>({defaultValue:e("startMs")}))}},watch({track:e,send:t,prop:n}){e([()=>n("startMs")],()=>{t({type:"RESTART"})})},on:{RESTART:{target:"running:temp",actions:["resetTime"]}},computed:{time:({context:e})=>KF(e.get("currentMs")),formattedTime:({computed:e})=>jF(e("time")),progressPercent:Vn(({context:e,prop:t})=>[e.get("currentMs"),t("targetMs"),t("startMs"),t("countdown")],([e,t=0,n,r])=>{let i=r?ZP(e,t,n):ZP(e,n,t);return Ae(i,0,1)})},states:{idle:{on:{START:{target:"running"},RESET:{actions:["resetTime"]}}},"running:temp":{effects:["waitForNextTick"],on:{CONTINUE:{target:"running"}}},running:{effects:["keepTicking"],on:{PAUSE:{target:"paused"},TICK:[{target:"idle",guard:"hasReachedTarget",actions:["invokeOnComplete"]},{actions:["updateTime","invokeOnTick"]}],RESET:{actions:["resetTime"]}}},paused:{on:{RESUME:{target:"running"},RESET:{target:"idle",actions:["resetTime"]}}}},implementations:{effects:{keepTicking({prop:e,send:t}){return Kf(({deltaMs:n})=>{t({type:"TICK",deltaMs:n})},e("interval"))},waitForNextTick({send:e}){return Tr(()=>{e({type:"CONTINUE"})},0)}},actions:{updateTime({context:e,prop:t,event:n}){let r=t("countdown")?-1:1,i=zF(n.deltaMs,t("interval"));e.set("currentMs",a=>{let o=a+r*i,s=t("targetMs");return s==null&&t("countdown")&&(s=0),t("countdown")&&s!=null?Math.max(o,s):!t("countdown")&&s!=null?Math.min(o,s):o})},resetTime({context:e,prop:t}){var r;let n=t("targetMs");n==null&&t("countdown")&&(n=0),e.set("currentMs",(r=t("startMs"))!=null?r:0)},invokeOnTick({context:e,prop:t,computed:n}){var r;(r=t("onTick"))==null||r({value:e.get("currentMs"),time:n("time"),formattedTime:n("formattedTime")})},invokeOnComplete({prop:e}){var t;(t=e("onComplete"))==null||t()}},guards:{hasReachedTarget:({context:e,prop:t})=>{let n=t("targetMs");if(n==null&&t("countdown")&&(n=0),n==null)return!1;let r=e.get("currentMs");return t("countdown")?r<=n:r>=n}}}});QF=class extends X{constructor(){super(...arguments);Q(this,"init",()=>{this.machine.subscribe(()=>{this.api=this.initApi(),this.render()});try{this.machine.start(),this.api=this.initApi(),this.render()}finally{this.el.removeAttribute("data-loading")}})}initMachine(t){return new Y(WF,t)}initApi(){return this.zagConnect(qF)}render(){var o;let t=(o=this.el.querySelector('[data-scope="timer"][data-part="root"]'))!=null?o:this.el;this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="timer"][data-part="area"]');n&&this.spreadProps(n,this.api.getAreaProps());let r=this.el.querySelector('[data-scope="timer"][data-part="control"]');r&&this.spreadProps(r,this.api.getControlProps()),["days","hours","minutes","seconds"].forEach(s=>{let l=this.el.querySelector(`[data-scope="timer"][data-part="item"][data-type="${s}"]`);l&&this.spreadProps(l,this.api.getItemProps({type:s}));let c=this.el.querySelector(`[data-scope="timer"][data-part="item-label"][data-type="${s}"]`);c&&this.spreadProps(c,this.api.getItemLabelProps({type:s}))}),this.el.querySelectorAll('[data-scope="timer"][data-part="separator"]').forEach(s=>{this.spreadProps(s,this.api.getSeparatorProps())}),["start","pause","resume","reset"].forEach(s=>{let l=this.el.querySelector(`[data-scope="timer"][data-part="action-trigger"][data-action="${s}"]`);l&&this.spreadProps(l,this.api.getActionTriggerProps({action:s}))}),JF(this.el,this.api)}};tM={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=new QF(e,JP(e,t,n));r.init(),this.timer=r;let i=s=>{let l=eM(r.api);Ue({respondTo:s,canPushServer:n(),pushEvent:t,serverEventName:"timer_state_response",serverPayload:h({id:e.id},l),el:e,domEventName:"timer-state",domDetail:h({id:e.id},l)})},a=ie(e);this.domRegistry=a,a.add("corex:timer:start",()=>{r.api.start()}),a.add("corex:timer:pause",()=>{r.api.pause()}),a.add("corex:timer:resume",()=>{r.api.resume()}),a.add("corex:timer:reset",()=>{r.api.reset()}),a.add("corex:timer:restart",()=>{r.api.restart()}),a.add("corex:timer:state",s=>{i(de(s.detail))});let o=re(this);this.handleRegistry=o,o.add("timer_start",s=>{$(e.id,H(s))&&r.api.start()}),o.add("timer_pause",s=>{$(e.id,H(s))&&r.api.pause()}),o.add("timer_resume",s=>{$(e.id,H(s))&&r.api.resume()}),o.add("timer_reset",s=>{$(e.id,H(s))&&r.api.reset()}),o.add("timer_restart",s=>{$(e.id,H(s))&&r.api.restart()}),o.add("timer_state",s=>{$(e.id,H(s))&&i(de(s))})},updated(){var r;let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket);(r=this.timer)==null||r.updateProps(JP(e,t,n))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.timer)==null||n.destroy()}}});var hS={};pe(hS,{Toast:()=>xM,parseActionSpec:()=>lp,parseSingleExecJsEffect:()=>pS});function ap(e,t){var n;return(n=e!=null?e:oS[t])!=null?n:oS.DEFAULT}function oM(e,t){var m;let{prop:n,computed:r,context:i}=e,{offsets:a,gap:o}=n("store").attrs,s=i.get("heights"),l=aM(a),c=n("dir")==="rtl",d=t.replace("-start",c?"-right":"-left").replace("-end",c?"-left":"-right"),g=d.includes("right"),p=d.includes("left"),u={position:"fixed",pointerEvents:r("count")>0?void 0:"none",display:"flex",flexDirection:"column","--gap":`${o}px`,"--first-height":`${((m=s[0])==null?void 0:m.height)||0}px`,"--viewport-offset-left":l.left,"--viewport-offset-right":l.right,"--viewport-offset-top":l.top,"--viewport-offset-bottom":l.bottom,zIndex:Os},f="center";if(g&&(f="flex-end"),p&&(f="flex-start"),u.alignItems=f,d.includes("top")){let S=l.top;u.top=`max(env(safe-area-inset-top, 0px), ${S})`}if(d.includes("bottom")){let S=l.bottom;u.bottom=`max(env(safe-area-inset-bottom, 0px), ${S})`}if(!d.includes("left")){let S=l.right;u.insetInlineEnd=`calc(env(safe-area-inset-right, 0px) + ${S})`}if(!d.includes("right")){let S=l.left;u.insetInlineStart=`calc(env(safe-area-inset-left, 0px) + ${S})`}return u}function sM(e,t){let{prop:n,context:r,computed:i}=e,a=n("parent"),o=a.computed("placement"),{gap:s}=a.prop("store").attrs,[l]=o.split("-"),c=r.get("mounted"),d=r.get("remainingTime"),g=i("height"),p=i("frontmost"),u=!p,f=!n("stacked"),m=n("stacked"),T=n("type")==="loading"?Number.MAX_SAFE_INTEGER:d,w=i("heightIndex")*s+i("heightBefore"),I={position:"absolute",pointerEvents:"auto","--opacity":"0","--remove-delay":`${n("removeDelay")}ms`,"--duration":`${T}ms`,"--initial-height":`${g}px`,"--offset":`${w}px`,"--index":n("index"),"--z-index":i("zIndex"),"--lift-amount":"calc(var(--lift) * var(--gap))","--y":"100%","--x":"0"},P=v=>Object.assign(I,v);return l==="top"?P({top:"0","--sign":"-1","--y":"-100%","--lift":"1"}):l==="bottom"&&P({bottom:"0","--sign":"1","--y":"100%","--lift":"-1"}),c&&(P({"--y":"0","--opacity":"1"}),m&&P({"--y":"calc(var(--lift) * var(--offset))","--height":"var(--initial-height)"})),t||P({"--opacity":"0",pointerEvents:"none"}),u&&f&&(P({"--base-scale":"var(--index) * 0.05 + 1","--y":"calc(var(--lift-amount) * var(--index))","--scale":"calc(-1 * var(--base-scale))","--height":"var(--first-height)"}),t||P({"--y":"calc(var(--sign) * 40%)"})),u&&m&&!t&&P({"--y":"calc(var(--lift) * var(--offset) + var(--lift) * -100%)"}),p&&!t&&P({"--y":"calc(var(--lift) * -100%)"}),I}function lM(e,t){let{computed:n}=e,r={position:"absolute",inset:"0",scale:"1 2",pointerEvents:t?"none":"auto"},i=a=>Object.assign(r,a);return n("frontmost")&&!t&&i({height:"calc(var(--initial-height) + 80%)"}),r}function cM(){return{position:"absolute",left:"0",height:"calc(var(--gap) + 2px)",bottom:"100%",width:"100%"}}function dM(e,t){let{context:n,prop:r,send:i,refs:a,computed:o}=e;return{getCount(){return n.get("toasts").length},getToasts(){return n.get("toasts")},getGroupProps(s={}){let{label:l="Notifications"}=s,{hotkey:c}=r("store").attrs,d=c.join("+").replace(/Key/g,"").replace(/Digit/g,""),g=o("placement"),[p,u="center"]=g.split("-");return t.element(y(h({},ka.group.attrs),{dir:r("dir"),tabIndex:-1,role:"region","aria-label":`${l}, ${g} (${d})`,id:rM(g),"data-placement":g,"data-side":p,"data-align":u,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",style:oM(e,g),onMouseEnter(){a.get("ignoreMouseTimer").isActive()||i({type:"REGION.POINTER_ENTER",placement:g})},onMouseMove(){a.get("ignoreMouseTimer").isActive()||i({type:"REGION.POINTER_ENTER",placement:g})},onMouseLeave(){a.get("ignoreMouseTimer").isActive()||i({type:"REGION.POINTER_LEAVE",placement:g})},onFocus(f){i({type:"REGION.FOCUS",target:f.relatedTarget})},onBlur(f){a.get("isFocusWithin")&&!ge(f.currentTarget,f.relatedTarget)&&queueMicrotask(()=>i({type:"REGION.BLUR"}))}}))},subscribe(s){return r("store").subscribe(()=>s(n.get("toasts")))}}}function fM(e,t){let{state:n,send:r,prop:i,scope:a,context:o,computed:s}=e,l=i("translations"),c=n.hasTag("visible"),d=n.hasTag("paused"),g=o.get("mounted"),p=s("frontmost"),u=i("parent").computed("placement"),f=i("type"),m=i("stacked"),S=i("title"),T=i("description"),w=i("action"),[I,P="center"]=u.split("-");return{type:f,title:S,description:T,placement:u,visible:c,paused:d,closable:!!i("closable"),pause(){r({type:"PAUSE"})},resume(){r({type:"RESUME"})},dismiss(){r({type:"DISMISS",src:"programmatic"})},getRootProps(){return t.element(y(h({},ka.root.attrs),{dir:i("dir"),id:dS(a),"data-state":c?"open":"closed","data-type":f,"data-placement":u,"data-align":P,"data-side":I,"data-mounted":b(g),"data-paused":b(d),"data-first":b(p),"data-sibling":b(!p),"data-stack":b(m),"data-overlap":b(!m),role:"status","aria-atomic":"true","aria-describedby":T?aS(a):void 0,"aria-labelledby":S?iS(a):void 0,tabIndex:0,style:sM(e,c),onKeyDown(v){v.defaultPrevented||v.key=="Escape"&&(r({type:"DISMISS",src:"keyboard"}),v.preventDefault())}}))},getGhostBeforeProps(){return t.element({"data-ghost":"before",style:lM(e,c)})},getGhostAfterProps(){return t.element({"data-ghost":"after",style:cM()})},getTitleProps(){return t.element(y(h({},ka.title.attrs),{id:iS(a)}))},getDescriptionProps(){return t.element(y(h({},ka.description.attrs),{id:aS(a)}))},getActionTriggerProps(){return t.button(y(h({},ka.actionTrigger.attrs),{type:"button",onClick(v){var E;v.defaultPrevented||((E=w==null?void 0:w.onClick)==null||E.call(w),r({type:"DISMISS",src:"user"}))}}))},getCloseTriggerProps(){return t.button(y(h({id:iM(a)},ka.closeTrigger.attrs),{type:"button","aria-label":l==null?void 0:l.closeTriggerLabel,onClick(v){v.defaultPrevented||r({type:"DISMISS",src:"user"})}}))}}}function sS(e,t){let{id:n,height:r}=t;e.context.set("heights",i=>i.find(o=>o.id===n)?i.map(o=>o.id===n?y(h({},o),{height:r}):o):[{id:n,height:r},...i])}function PM(e={}){let t=yM(e,{placement:"bottom",overlap:!1,max:24,gap:16,offsets:"1rem",hotkey:["altKey","KeyT"],removeDelay:200,pauseOnPageIdle:!0}),n=[],r=[],i=new Set,a=[],o=k=>(n.push(k),()=>{let L=n.indexOf(k);n.splice(L,1)}),s=k=>(n.forEach(L=>L(k)),k),l=k=>{if(r.length>=t.max){a.push(k);return}s(k),r.unshift(k)},c=()=>{for(a=EM(a);a.length>0&&r.length{var J,ue;let L=(J=k.id)!=null?J:`toast:${Ga()}`,K=r.find(Z=>Z.id===L);if(i.has(L)&&i.delete(L),K)r=r.map(Z=>Z.id===L?s(y(h(h({},Z),k),{id:L})):Z);else{let Z=y(h({id:L,duration:t.duration,removeDelay:t.removeDelay,type:uS},k),{stacked:!t.overlap,gap:t.gap}),ce=(ue=Z.priority)!=null?ue:op(Z.type,!!Z.action);l(y(h({},Z),{priority:ce}))}return L},g=k=>(i.add(k),k?(n.forEach(L=>L({id:k,dismiss:!0})),r=r.filter(L=>L.id!==k),c()):(r.forEach(L=>{n.forEach(K=>K({id:L.id,dismiss:!0}))}),r=[],a=[]),k);return{attrs:t,subscribe:o,create:d,update:(k,L)=>d(h({id:k},L)),remove:g,dismiss:k=>{k!=null?r=r.map(L=>L.id===k?s(y(h({},L),{message:"DISMISS"})):L):r=r.map(L=>s(y(h({},L),{message:"DISMISS"})))},error:k=>d(y(h({},k),{type:"error"})),success:k=>d(y(h({},k),{type:"success"})),info:k=>d(y(h({},k),{type:"info"})),warning:k=>d(y(h({},k),{type:"warning"})),loading:k=>d(y(h({},k),{type:"loading"})),getVisibleToasts:()=>r.filter(k=>!i.has(k.id)),getCount:()=>r.length,promise:(k,L,K={})=>{if(!L||!L.loading){It("[zag-js > toast] toaster.promise() requires at least a 'loading' option to be specified");return}let J=d(y(h(h({},K),L.loading),{promise:k,type:"loading"})),ue=!0,Z,ce=Fn(k).then(le=>Ke(null,null,function*(){var De;if(Z=["resolve",le],SM(le)&&!le.ok){ue=!1;let Fe=Fn(L.error,`HTTP Error! status: ${le.status}`);d(y(h(h({},K),Fe),{id:J,type:"error"}))}else if(L.success!==void 0){ue=!1;let Fe=Fn(L.success,le);d(y(h(h({},K),Fe),{id:J,type:(De=Fe.type)!=null?De:"success"}))}})).catch(le=>Ke(null,null,function*(){if(Z=["reject",le],L.error!==void 0){ue=!1;let De=Fn(L.error,le);d(y(h(h({},K),De),{id:J,type:"error"}))}})).finally(()=>{var le;ue&&g(J),(le=L.finally)==null||le.call(L)});return{id:J,unwrap:()=>new Promise((le,De)=>ce.then(()=>Z[0]==="reject"?De(Z[1]):le(Z[1])).catch(De))}},pause:k=>{k!=null?r=r.map(L=>L.id===k?s(y(h({},L),{message:"PAUSE"})):L):r=r.map(L=>s(y(h({},L),{message:"PAUSE"})))},resume:k=>{k!=null?r=r.map(L=>L.id===k?s(y(h({},L),{message:"RESUME"})):L):r=r.map(L=>s(y(h({},L),{message:"RESUME"})))},isVisible:k=>!i.has(k)&&!!r.find(L=>L.id===k),isDismissed:k=>i.has(k),expand:()=>{r=r.map(k=>s(y(h({},k),{stacked:!0})))},collapse:()=>{r=r.map(k=>s(y(h({},k),{stacked:!1})))}}}function IM(e){if(e==null||typeof e!="object")return[];let t=e.className;return typeof t!="string"?[]:t.trim().split(/\s+/).filter(Boolean)}function wM(e,t){var a,o,s;let n=(a=t==null?void 0:t.id)!=null?a:e.id,r=(s=t==null?void 0:t.store)!=null?s:PM({placement:(o=t==null?void 0:t.placement)!=null?o:"bottom",overlap:t==null?void 0:t.overlap,max:t==null?void 0:t.max,gap:t==null?void 0:t.gap,offsets:t==null?void 0:t.offsets,pauseOnPageIdle:t==null?void 0:t.pauseOnPageIdle}),i=new CM(e,{id:n,store:r,dir:q(e)});return i.init(),sp.set(n,i),Ac.set(n,r),e.dataset.toastGroup="true",e.dataset.toastGroupId=n,{group:i,store:r}}function OM(e){let t=sp.get(e);if(!t)return;let n=t.el;t.destroy(),sp.delete(e),Ac.delete(e),delete n.dataset.toastGroup,delete n.dataset.toastGroupId}function Ai(e){if(e)return Ac.get(e);let t=document.querySelector("[data-toast-group]");if(!t)return;let n=t.dataset.toastGroupId||t.id;return n?Ac.get(n):void 0}function gS(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function pS(e){let t=gS(e);if(t.kind!=="exec_js")return null;let n=t.encoded;return typeof n!="string"||n.length===0?null:n}function lp(e){let t=gS(e),n=t.label;if(typeof n!="string"||n.length===0)return null;let r=t.effects;if(!Array.isArray(r)||r.length!==1)return null;let i=pS(r[0]);if(i==null)return null;let a={label:n,encoded:i},o=t.class;return typeof o=="string"&&o.trim()&&(a.className=o.trim()),a}function cS(e,t){let n={label:e.label,onClick:()=>{t.execJs(e.encoded)}};return e.className&&(n.className=e.className),n}function AM(e){return{pushEvent:(t,n)=>{e.pushEvent(t,n!=null?n:{})},execJs:t=>{e.js().exec(t)},redirectCtx:{liveSocket:e.liveSocket}}}var nM,ka,rM,nS,dS,rS,iS,aS,iM,oS,aM,uM,gM,pM,hM,mM,vM,yM,bM,uS,op,EM,SM,lS,sp,Ac,TM,CM,VM,xM,fS=ee(()=>{"use strict";fl();Or();on();oe();nM=z("toast").parts("group","root","title","description","actionTrigger","closeTrigger"),ka=nM.build(),rM=e=>`toast-group:${e}`,nS=(e,t)=>e.getById(`toast-group:${t}`),dS=e=>`toast:${e.id}`,rS=e=>e.getById(dS(e)),iS=e=>`toast:${e.id}:title`,aS=e=>`toast:${e.id}:description`,iM=e=>`toast${e.id}:close`,oS={info:5e3,error:5e3,success:2e3,loading:1/0,warning:5e3,DEFAULT:5e3};aM=e=>typeof e=="string"?{left:e,right:e,bottom:e,top:e}:e;({guards:uM,createMachine:gM}=Mt()),{and:pM}=uM,hM=gM({props({props:e}){return y(h({dir:"ltr",id:Ga()},e),{store:e.store})},initialState({prop:e}){return e("store").attrs.overlap?"overlap":"stack"},refs(){return{lastFocusedEl:null,isFocusWithin:!1,isPointerWithin:!1,ignoreMouseTimer:ld.create(),dismissableCleanup:void 0}},context({bindable:e}){return{toasts:e(()=>({defaultValue:[],sync:!0,hash:t=>t.map(n=>n.id).join(",")})),heights:e(()=>({defaultValue:[],sync:!0}))}},computed:{count:({context:e})=>e.get("toasts").length,overlap:({prop:e})=>e("store").attrs.overlap,placement:({prop:e})=>e("store").attrs.placement},effects:["subscribeToStore","trackDocumentVisibility","trackHotKeyPress"],watch({track:e,context:t,action:n}){e([()=>t.hash("toasts")],()=>{queueMicrotask(()=>{n(["collapsedIfEmpty","setDismissableBranch"])})})},exit:["clearDismissableBranch","clearLastFocusedEl","clearMouseEventTimer"],on:{"DOC.HOTKEY":{actions:["focusRegionEl"]},"REGION.BLUR":[{guard:pM("isOverlapping","isPointerOut"),target:"overlap",actions:["collapseToasts","resumeToasts","restoreFocusIfPointerOut"]},{guard:"isPointerOut",target:"stack",actions:["resumeToasts","restoreFocusIfPointerOut"]},{actions:["clearFocusWithin"]}],"TOAST.REMOVE":{actions:["removeToast","removeHeight","ignoreMouseEventsTemporarily"]},"TOAST.PAUSE":{actions:["pauseToasts"]}},states:{stack:{on:{"REGION.POINTER_LEAVE":[{guard:"isOverlapping",target:"overlap",actions:["clearPointerWithin","resumeToasts","collapseToasts"]},{actions:["clearPointerWithin","resumeToasts"]}],"REGION.OVERLAP":{target:"overlap",actions:["collapseToasts"]},"REGION.FOCUS":{actions:["setLastFocusedEl","pauseToasts"]},"REGION.POINTER_ENTER":{actions:["setPointerWithin","pauseToasts"]}}},overlap:{on:{"REGION.STACK":{target:"stack",actions:["expandToasts"]},"REGION.POINTER_ENTER":{target:"stack",actions:["setPointerWithin","pauseToasts","expandToasts"]},"REGION.FOCUS":{target:"stack",actions:["setLastFocusedEl","pauseToasts","expandToasts"]}}}},implementations:{guards:{isOverlapping:({computed:e})=>e("overlap"),isPointerOut:({refs:e})=>!e.get("isPointerWithin")},effects:{subscribeToStore({context:e,prop:t}){let n=t("store");return e.set("toasts",n.getVisibleToasts()),n.subscribe(r=>{if(r.dismiss){e.set("toasts",i=>i.filter(a=>a.id!==r.id));return}e.set("toasts",i=>{let a=i.findIndex(o=>o.id===r.id);return a!==-1?[...i.slice(0,a),h(h({},i[a]),r),...i.slice(a+1)]:[r,...i]})})},trackHotKeyPress({prop:e,send:t}){return ae(document,"keydown",r=>{let{hotkey:i}=e("store").attrs;i.every(o=>r[o]||r.code===o)&&t({type:"DOC.HOTKEY"})},{capture:!0})},trackDocumentVisibility({prop:e,send:t,scope:n}){let{pauseOnPageIdle:r}=e("store").attrs;if(!r)return;let i=n.getDoc();return ae(i,"visibilitychange",()=>{let a=i.visibilityState==="hidden";t({type:a?"PAUSE_ALL":"RESUME_ALL"})})}},actions:{setDismissableBranch({refs:e,context:t,computed:n,scope:r}){var c;let i=t.get("toasts"),a=n("placement"),o=i.length>0;if(!o){(c=e.get("dismissableCleanup"))==null||c();return}if(o&&e.get("dismissableCleanup"))return;let l=Rm(()=>nS(r,a),{defer:!0});e.set("dismissableCleanup",l)},clearDismissableBranch({refs:e}){var t;(t=e.get("dismissableCleanup"))==null||t()},focusRegionEl({scope:e,computed:t}){queueMicrotask(()=>{var n;(n=nS(e,t("placement")))==null||n.focus()})},pauseToasts({prop:e}){e("store").pause()},resumeToasts({prop:e}){e("store").resume()},expandToasts({prop:e}){e("store").expand()},collapseToasts({prop:e}){e("store").collapse()},removeToast({prop:e,event:t}){e("store").remove(t.id)},removeHeight({event:e,context:t}){(e==null?void 0:e.id)!=null&&queueMicrotask(()=>{t.set("heights",n=>n.filter(r=>r.id!==e.id))})},collapsedIfEmpty({send:e,computed:t}){!t("overlap")||t("count")>1||e({type:"REGION.OVERLAP"})},setLastFocusedEl({refs:e,event:t}){e.get("isFocusWithin")||!t.target||(e.set("isFocusWithin",!0),e.set("lastFocusedEl",t.target))},restoreFocusIfPointerOut({refs:e}){var t;!e.get("lastFocusedEl")||e.get("isPointerWithin")||((t=e.get("lastFocusedEl"))==null||t.focus({preventScroll:!0}),e.set("lastFocusedEl",null),e.set("isFocusWithin",!1))},setPointerWithin({refs:e}){e.set("isPointerWithin",!0)},clearPointerWithin({refs:e}){var t;e.set("isPointerWithin",!1),e.get("lastFocusedEl")&&!e.get("isFocusWithin")&&((t=e.get("lastFocusedEl"))==null||t.focus({preventScroll:!0}),e.set("lastFocusedEl",null))},clearFocusWithin({refs:e}){e.set("isFocusWithin",!1)},clearLastFocusedEl({refs:e}){var t;e.get("lastFocusedEl")&&((t=e.get("lastFocusedEl"))==null||t.focus({preventScroll:!0}),e.set("lastFocusedEl",null),e.set("isFocusWithin",!1))},ignoreMouseEventsTemporarily({refs:e}){e.get("ignoreMouseTimer").request()},clearMouseEventTimer({refs:e}){e.get("ignoreMouseTimer").cancel()}}}});({not:mM}=we()),vM=te({props({props:e}){return gn(e,["id","type","parent","removeDelay"],"toast"),y(h({closable:!0},e),{translations:h({closeTriggerLabel:"Dismiss notification"},e.translations),duration:ap(e.duration,e.type)})},initialState({prop:e}){return e("type")==="loading"||e("duration")===1/0?"visible:persist":"visible"},context({prop:e,bindable:t}){return{remainingTime:t(()=>({defaultValue:ap(e("duration"),e("type"))})),createdAt:t(()=>({defaultValue:Date.now()})),mounted:t(()=>({defaultValue:!1})),initialHeight:t(()=>({defaultValue:0}))}},refs(){return{closeTimerStartTime:Date.now(),lastCloseStartTimerStartTime:0}},computed:{zIndex:({prop:e})=>{let t=e("parent").context.get("toasts"),n=t.findIndex(r=>r.id===e("id"));return t.length-n},height:({prop:e})=>{var r;let n=e("parent").context.get("heights").find(i=>i.id===e("id"));return(r=n==null?void 0:n.height)!=null?r:0},heightIndex:({prop:e})=>e("parent").context.get("heights").findIndex(n=>n.id===e("id")),frontmost:({prop:e})=>e("index")===0,heightBefore:({prop:e})=>{let t=e("parent").context.get("heights"),n=t.findIndex(r=>r.id===e("id"));return t.reduce((r,i,a)=>a>=n?r:r+i.height,0)},shouldPersist:({prop:e})=>e("type")==="loading"||e("duration")===1/0},watch({track:e,prop:t,send:n}){e([()=>t("message")],()=>{let r=t("message");r&&n({type:r,src:"programmatic"})}),e([()=>t("type"),()=>t("duration")],()=>{n({type:"UPDATE"})})},on:{UPDATE:[{guard:"shouldPersist",target:"visible:persist",actions:["resetCloseTimer"]},{target:"visible:updating",actions:["resetCloseTimer"]}],MEASURE:{actions:["measureHeight"]}},entry:["setMounted","measureHeight","invokeOnVisible"],effects:["trackHeight"],states:{"visible:updating":{tags:["visible","updating"],effects:["waitForNextTick"],on:{SHOW:{target:"visible"}}},"visible:persist":{tags:["visible","paused"],on:{RESUME:{guard:mM("isLoadingType"),target:"visible",actions:["setCloseTimer"]},DISMISS:{target:"dismissing"}}},visible:{tags:["visible"],effects:["waitForDuration"],on:{DISMISS:{target:"dismissing"},PAUSE:{target:"visible:persist",actions:["syncRemainingTime"]}}},dismissing:{entry:["invokeOnDismiss"],effects:["waitForRemoveDelay"],on:{REMOVE:{target:"unmounted",actions:["notifyParentToRemove"]}}},unmounted:{entry:["invokeOnUnmount"]}},implementations:{effects:{waitForRemoveDelay({prop:e,send:t}){return Tr(()=>{t({type:"REMOVE",src:"timer"})},e("removeDelay"))},waitForDuration({send:e,context:t,computed:n}){if(!n("shouldPersist"))return Tr(()=>{e({type:"DISMISS",src:"timer"})},t.get("remainingTime"))},waitForNextTick({send:e}){return Tr(()=>{e({type:"SHOW",src:"timer"})},0)},trackHeight({scope:e,prop:t}){let n;return B(()=>{let r=rS(e);if(!r)return;let i=()=>{let s=r.style.height;r.style.height="auto";let l=r.getBoundingClientRect().height;r.style.height=s;let c={id:t("id"),height:l};sS(t("parent"),c)},a=e.getWin(),o=new a.MutationObserver(i);o.observe(r,{childList:!0,subtree:!0,characterData:!0}),n=()=>o.disconnect()}),()=>n==null?void 0:n()}},guards:{isLoadingType:({prop:e})=>e("type")==="loading",shouldPersist:({computed:e})=>e("shouldPersist")},actions:{setMounted({context:e}){B(()=>{e.set("mounted",!0)})},measureHeight({scope:e,prop:t,context:n}){queueMicrotask(()=>{let r=rS(e);if(!r)return;let i=r.style.height;r.style.height="auto";let a=r.getBoundingClientRect().height;r.style.height=i,n.set("initialHeight",a);let o={id:t("id"),height:a};sS(t("parent"),o)})},setCloseTimer({refs:e}){e.set("closeTimerStartTime",Date.now())},resetCloseTimer({context:e,refs:t,prop:n}){t.set("closeTimerStartTime",Date.now()),e.set("remainingTime",ap(n("duration"),n("type")))},syncRemainingTime({context:e,refs:t}){e.set("remainingTime",n=>{let r=t.get("closeTimerStartTime"),i=Date.now()-r;return t.set("lastCloseStartTimerStartTime",Date.now()),n-i})},notifyParentToRemove({prop:e}){e("parent").send({type:"TOAST.REMOVE",id:e("id")})},invokeOnDismiss({prop:e,event:t}){var n;(n=e("onStatusChange"))==null||n({status:"dismissing",src:t.src})},invokeOnUnmount({prop:e}){var t;(t=e("onStatusChange"))==null||t({status:"unmounted"})},invokeOnVisible({prop:e}){var t;(t=e("onStatusChange"))==null||t({status:"visible"})}}}});yM=(e,t)=>h(h({},t),_n(e)),bM={error:[1,2],warning:[3,6],loading:[4,5],success:[5,7],info:[6,8]},uS="info",op=(e,t)=>{let[n,r]=bM[e!=null?e:uS];return t?n:r},EM=e=>e.sort((t,n)=>{var a,o;let r=(a=t.priority)!=null?a:op(t.type,!!t.action),i=(o=n.priority)!=null?o:op(n.type,!!n.action);return r-i});SM=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",lS={connect:dM,machine:hM};sp=new Map,Ac=new Map,TM=class extends X{constructor(t,n){var r,i;super(t,n);Q(this,"parts");Q(this,"latestProps");Q(this,"hadAction",!1);Q(this,"duration");Q(this,"showLoading");Q(this,"updateProps",t=>{Object.assign(this.latestProps,t),super.updateProps(t)});Q(this,"destroy",()=>{this.machine.stop(),this.el.remove()});this.latestProps=n,this.duration=n.duration,this.showLoading=((r=n.meta)==null?void 0:r.loading)===!0,this.hadAction=!!((i=n.action)!=null&&i.label),this.el.setAttribute("data-scope","toast"),this.el.setAttribute("data-part","root"),this.el.classList.add("toast-item"),this.el.innerHTML=` +`):""})),this.applyPartDir(s),V(this.el,"submitName")&&(s.removeAttribute("name"),s.removeAttribute("form"))),Ji(this.el,"signature-pad"),this.syncPaths()}};BD={mounted(){let e=this.el,t=this,n=this.pushEvent.bind(this);t.padTouched=!1;let r=()=>{t.padTouched=!0},i=SP(e,"defaultPaths"),a=new HD(e,y(h({id:e.id,name:fP(e),dir:q(e)},i.length>0?{defaultPaths:i}:{}),{drawing:jg(e),onDrawEnd:s=>{a.setPaths(s.paths),Wo(e,s.paths,{onPadTouched:r,notifyLiveView:!0,fieldTouched:!0}),s.getDataUrl("image/png").then(l=>{a.imageURL=l;let c=V(e,"onDrawEnd");c&&this.liveSocket.main.isConnected()&&n(c,{id:e.id,paths:s.paths,url:l});let d=V(e,"onDrawEndClient");d&&e.dispatchEvent(new CustomEvent(d,{bubbles:!0,detail:{id:e.id,paths:s.paths,url:l}}))})}}));a.init(),this.signaturePad=a;let o=(s,l)=>{Wo(e,s,{onPadTouched:()=>{},notifyLiveView:l.notifyLiveView,fieldTouched:Ar(e,t.padTouched||l.fieldTouched===!0)})};queueMicrotask(()=>{t.padTouched||o(i,{notifyLiveView:!1,fieldTouched:!1})}),t.unbindSubmitIntent=oa(e,()=>{var l;t.padTouched=!0;let s=(l=a.api.paths)!=null?l:[];o(s.length>0?s:[],{notifyLiveView:!1,fieldTouched:!0})}),this.onClear=s=>{let{id:l}=s.detail;l&&l!==e.id||(a.api.clear(),Wo(e,[],{onPadTouched:r,notifyLiveView:!0,fieldTouched:!0}))},e.addEventListener("corex:signature-pad:clear",this.onClear),this.handlers=[],this.handlers.push(this.handleEvent("signature_pad_clear",s=>{$(e.id,H(s))&&(a.api.clear(),Wo(e,[],{onPadTouched:r,notifyLiveView:!0,fieldTouched:!0}))}))},updated(){var n,r;let e=this.el;(n=this.signaturePad)==null||n.updateProps({id:e.id,name:fP(e),dir:q(e),drawing:jg(e)});let t=Mh(e);t!==void 0&&!this.padTouched&&((r=this.signaturePad)==null||r.setPaths(t),Wo(e,t,{onPadTouched:()=>{},notifyLiveView:!1,fieldTouched:Ar(e,this.padTouched)}))},destroyed(){var e,t;if((e=this.unbindSubmitIntent)==null||e.call(this),this.onClear&&this.el.removeEventListener("corex:signature-pad:clear",this.onClear),this.handlers)for(let n of this.handlers)this.removeHandleEvent(n);(t=this.signaturePad)==null||t.destroy()}}});var VP={};pe(VP,{Switch:()=>YD,checkedChangePayload:()=>zi});function KD(e,t){let{context:n,send:r,prop:i,scope:a}=e,o=!!i("disabled"),s=!!i("readOnly"),l=!!i("required"),c=!!n.get("checked"),d=!o&&n.get("focused"),u=!o&&n.get("focusVisible"),p=!o&&n.get("active"),g={"data-active":b(p),"data-focus":b(d),"data-focus-visible":b(u),"data-readonly":b(s),"data-hover":b(n.get("hovered")),"data-disabled":b(o),"data-state":c?"checked":"unchecked","data-invalid":b(i("invalid")),"data-required":b(l)};return{checked:c,disabled:o,focused:d,setChecked(f){r({type:"CHECKED.SET",checked:f,isTrusted:!1})},toggleChecked(){r({type:"CHECKED.TOGGLE",checked:c,isTrusted:!1})},getRootProps(){return t.label(y(h(h({},wc.root.attrs),g),{dir:i("dir"),id:OP(a),htmlFor:Xg(a),onPointerMove(){o||r({type:"CONTEXT.SET",context:{hovered:!0}})},onPointerLeave(){o||r({type:"CONTEXT.SET",context:{hovered:!1}})},onClick(f){var S;if(o)return;ne(f)===Aa(a)&&f.stopPropagation(),wt()&&((S=Aa(a))==null||S.focus())}}))},getLabelProps(){return t.element(y(h(h({},wc.label.attrs),g),{dir:i("dir"),id:CP(a)}))},getThumbProps(){return t.element(y(h(h({},wc.thumb.attrs),g),{dir:i("dir"),id:UD(a),"aria-hidden":!0}))},getControlProps(){return t.element(y(h(h({},wc.control.attrs),g),{dir:i("dir"),id:qD(a),"aria-hidden":!0}))},getHiddenInputProps(){return t.input({id:Xg(a),type:"checkbox",required:i("required"),defaultChecked:c,disabled:o,"aria-labelledby":CP(a),"aria-invalid":i("invalid"),name:i("name"),form:i("form"),value:i("value"),style:mt,onFocus(){let f=vn();r({type:"CONTEXT.SET",context:{focused:!0,focusVisible:f}})},onBlur(){r({type:"CONTEXT.SET",context:{focused:!1,focusVisible:!1}})},onClick(f){if(s){f.preventDefault();return}let m=f.currentTarget.checked;r({type:"CHECKED.SET",checked:m,isTrusted:!0})}})}}}var GD,wc,OP,CP,UD,qD,Xg,WD,Aa,wP,zD,jD,YD,AP=ee(()=>{"use strict";sl();yn();$e();Ve();be();oe();GD=z("switch").parts("root","label","control","thumb"),wc=GD.build(),OP=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`switch:${e.id}`},CP=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`switch:${e.id}:label`},UD=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.thumb)!=null?n:`switch:${e.id}:thumb`},qD=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`switch:${e.id}:control`},Xg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`switch:${e.id}:input`},WD=e=>e.getById(OP(e)),Aa=e=>e.getById(Xg(e));({not:wP}=we()),zD=te({props({props:e}){return h({defaultChecked:!1,label:"switch",value:"on"},e)},initialState(){return"ready"},context({prop:e,bindable:t}){return{checked:t(()=>({defaultValue:e("defaultChecked"),value:e("checked"),onChange(n){var r;(r=e("onCheckedChange"))==null||r({checked:n})}})),fieldsetDisabled:t(()=>({defaultValue:!1})),focusVisible:t(()=>({defaultValue:!1})),active:t(()=>({defaultValue:!1})),focused:t(()=>({defaultValue:!1})),hovered:t(()=>({defaultValue:!1}))}},computed:{isDisabled:({context:e,prop:t})=>t("disabled")||e.get("fieldsetDisabled")},watch({track:e,prop:t,context:n,action:r}){e([()=>t("disabled")],()=>{r(["removeFocusIfNeeded"])}),e([()=>n.get("checked")],()=>{r(["syncInputElement"])})},effects:["trackFormControlState","trackPressEvent","trackFocusVisible"],on:{"CHECKED.TOGGLE":[{guard:wP("isTrusted"),actions:["toggleChecked","dispatchChangeEvent"]},{actions:["toggleChecked"]}],"CHECKED.SET":[{guard:wP("isTrusted"),actions:["setChecked","dispatchChangeEvent"]},{actions:["setChecked"]}],"CONTEXT.SET":{actions:["setContext"]}},states:{ready:{}},implementations:{guards:{isTrusted:({event:e})=>!!e.isTrusted},effects:{trackPressEvent({computed:e,scope:t,context:n}){if(!e("isDisabled"))return Ds({pointerNode:WD(t),keyboardNode:Aa(t),isValidKey:r=>r.key===" ",onPress:()=>n.set("active",!1),onPressStart:()=>n.set("active",!0),onPressEnd:()=>n.set("active",!1)})},trackFocusVisible({computed:e,scope:t}){if(!e("isDisabled"))return nt({root:t.getRootNode()})},trackFormControlState({context:e,send:t,scope:n}){return ht(Aa(n),{onFieldsetDisabledChange(r){e.set("fieldsetDisabled",r)},onFormReset(){let r=e.initial("checked");t({type:"CHECKED.SET",checked:!!r,src:"form-reset"})}})}},actions:{setContext({context:e,event:t}){for(let n in t.context)e.set(n,t.context[n])},syncInputElement({context:e,scope:t}){let n=Aa(t);n&&ja(n,!!e.get("checked"))},removeFocusIfNeeded({context:e,prop:t}){t("disabled")&&e.set("focused",!1)},setChecked({context:e,event:t}){e.set("checked",t.checked)},toggleChecked({context:e}){e.set("checked",!e.get("checked"))},dispatchChangeEvent({context:e,scope:t}){queueMicrotask(()=>{let n=Aa(t);Bi(n,{checked:e.get("checked")})})}}}}),jD=class extends X{initMachine(e){return new Y(zD,e)}initApi(){return this.zagConnect(KD)}render(){let e=this.el.querySelector('[data-scope="switch"][data-part="root"]');if(!e)return;this.spreadProps(e,this.api.getRootProps());let t=e.querySelector(':scope > [data-scope="switch"][data-part="hidden-input"]');t instanceof HTMLInputElement&&ol(t,this.el,this.api.checked===!0,(r,i)=>this.spreadProps(r,i),this.api.getHiddenInputProps()),e.querySelectorAll(':scope > [data-scope="switch"][data-part="label"]').forEach(r=>{this.spreadProps(r,this.api.getLabelProps())});let n=e.querySelector(':scope > [data-scope="switch"][data-part="control"]');if(n){this.spreadProps(n,this.api.getControlProps());let r=n.querySelector(':scope > [data-scope="switch"][data-part="thumb"]');r&&this.spreadProps(r,this.api.getThumbProps())}}},YD={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=new jD(e,y(h({id:e.id},(()=>{let o=Us(e);return"checked"in o?{checked:o.checked===!0}:{defaultChecked:o.defaultChecked===!0}})()),{disabled:O(e,"disabled"),name:V(e,"name"),form:V(e,"form"),value:V(e,"value"),dir:q(e),invalid:O(e,"invalid"),required:O(e,"required"),readOnly:O(e,"readonly"),onCheckedChange:o=>{W({el:e,canPushServer:n(),pushEvent:t,payload:zi(e,o),serverEventName:V(e,"onCheckedChange"),clientEventName:V(e,"onCheckedChangeClient")});let s=e.querySelector('[data-scope="switch"][data-part="hidden-input"]');s&&queueMicrotask(()=>{s.checked=o.checked===!0,s.dispatchEvent(new Event("input",{bubbles:!0})),s.dispatchEvent(new Event("change",{bubbles:!0}))})}}));r.init(),this.zagSwitch=r;let i=ie(e);this.domRegistry=i,i.add("corex:switch:set-checked",o=>{let{checked:s}=o.detail;r.api.setChecked(s)}),i.add("corex:switch:toggle-checked",()=>{r.api.toggleChecked()});let a=re(this);this.handleRegistry=a,a.add("switch_set_checked",o=>{if(!$(e.id,H(o)))return;let s=Ys(o);typeof s=="boolean"&&r.api.setChecked(s)}),a.add("switch_toggle_checked",o=>{$(e.id,H(o))&&r.api.toggleChecked()}),a.add("switch_checked",o=>{$(e.id,H(o))&&n()&&this.pushEvent("switch_checked_response",{id:e.id,value:r.api.checked})}),a.add("switch_focused",o=>{$(e.id,H(o))&&n()&&this.pushEvent("switch_focused_response",{id:e.id,value:r.api.focused})}),a.add("switch_disabled",o=>{$(e.id,H(o))&&n()&&this.pushEvent("switch_disabled_response",{id:e.id,value:r.api.disabled})})},updated(){let e=this.zagSwitch;e&&e.updateProps(y(h({id:this.el.id},Gs(this.el)),{disabled:O(this.el,"disabled"),name:V(this.el,"name"),form:V(this.el,"form"),value:V(this.el,"value"),dir:q(this.el),invalid:O(this.el,"invalid"),required:O(this.el,"required"),readOnly:O(this.el,"readonly")}))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.zagSwitch)==null||n.destroy()}}});var HP={};pe(HP,{TagsInput:()=>CF,blurBehavior:()=>ep,maxProp:()=>tp,parseJsonTags:()=>TF,readPlaceholderFromMainInput:()=>np});function gF(e,t){let{state:n,send:r,computed:i,prop:a,scope:o,context:s}=e,l=i("isInteractive"),c=!!a("disabled"),d=!!a("readOnly"),u=!!a("required"),p=a("invalid")||i("isOverflowing"),g=a("translations"),f=n.hasTag("focused"),m=n.matches("editing:tag"),S=i("count")===0;function T(w){let I=Yo(o,w),P=s.get("editedTagId"),v=s.get("highlightedTagId");return{id:I,editing:m&&P===I,highlighted:I===v,disabled:!!(w.disabled||c)}}return{empty:S,inputValue:s.get("inputValue"),value:s.get("value"),valueAsString:i("valueAsString"),count:i("count"),atMax:i("isAtMax"),setValue(w){r({type:"SET_VALUE",value:w})},clearValue(w){r(w?{type:"CLEAR_TAG",id:w}:{type:"CLEAR_VALUE"})},addValue(w){r({type:"ADD_TAG",value:w})},setValueAtIndex(w,I){r({type:"SET_VALUE_AT_INDEX",index:w,value:I})},setInputValue(w){r({type:"SET_INPUT_VALUE",value:w})},clearInputValue(){r({type:"SET_INPUT_VALUE",value:""})},focus(){var w;(w=xa(o))==null||w.focus()},getItemState:T,getRootProps(){return t.element(y(h({dir:a("dir")},Nn.root.attrs),{"data-invalid":b(p),"data-readonly":b(d),"data-disabled":b(c),"data-focus":b(f),"data-empty":b(S),id:DP(o),onPointerDown(){l&&r({type:"POINTER_DOWN"})}}))},getLabelProps(){return t.label(y(h({},Nn.label.attrs),{"data-disabled":b(c),"data-invalid":b(p),"data-readonly":b(d),"data-required":b(u),id:JD(o),dir:a("dir"),htmlFor:Qg(o)}))},getControlProps(){return t.element(y(h({id:QD(o)},Nn.control.attrs),{dir:a("dir"),tabIndex:d?0:void 0,"data-disabled":b(c),"data-readonly":b(d),"data-invalid":b(p),"data-focus":b(f)}))},getInputProps(){return t.input(y(h({},Nn.input.attrs),{dir:a("dir"),"data-invalid":b(p),"aria-invalid":se(p),"data-readonly":b(d),"data-empty":b(S),maxLength:a("maxLength"),id:Qg(o),defaultValue:s.get("inputValue"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"none",enterKeyHint:"done",disabled:c||d,placeholder:S?a("placeholder"):void 0,onInput(w){let I=Ot(w),P=w.currentTarget.value;if(I.inputType==="insertFromPaste"){r({type:"PASTE",value:P});return}if(pF(P,a("delimiter"))){r({type:"DELIMITER_KEY"});return}r({type:"TYPE",value:P,key:I.inputType})},onFocus(){queueMicrotask(()=>{r({type:"FOCUS"})})},onKeyDown(w){if(w.defaultPrevented||Me(w))return;let I=w.currentTarget,P=I.getAttribute("role")==="combobox",v=I.ariaExpanded==="true",E={ArrowDown(){r({type:"ARROW_DOWN"})},ArrowLeft(){P&&v||r({type:"ARROW_LEFT"})},ArrowRight(C){s.get("highlightedTagId")&&C.preventDefault(),!(P&&v)&&r({type:"ARROW_RIGHT"})},Escape(C){C.preventDefault(),r({type:"ESCAPE"})},Backspace(){r({type:"BACKSPACE"})},Delete(){r({type:"DELETE"})},Enter(C){let A=I.getAttribute("aria-activedescendant");P&&v&&A||(r({type:"ENTER"}),C.preventDefault())}},R=me(w,{dir:a("dir")}),x=E[R];if(x){x(w);return}}}))},getHiddenInputProps(){return t.input({type:"text",hidden:!0,name:a("name"),form:a("form"),disabled:c,readOnly:d,required:a("required"),id:FP(o),defaultValue:i("valueAsString")})},getItemProps(w){return t.element(y(h({},Nn.item.attrs),{dir:a("dir"),"data-value":w.value,"data-disabled":b(c)}))},getItemPreviewProps(w){let I=T(w);return t.element(y(h({},Nn.itemPreview.attrs),{id:I.id,dir:a("dir"),hidden:I.editing,"data-value":w.value,"data-disabled":b(c),"data-highlighted":b(I.highlighted),onPointerDown(P){!l||I.disabled||fe(P)&&(P.preventDefault(),r({type:"POINTER_DOWN_TAG",id:I.id}))},onDoubleClick(){!l||I.disabled||r({type:"DOUBLE_CLICK_TAG",id:I.id})}}))},getItemTextProps(w){let I=T(w);return t.element(y(h({},Nn.itemText.attrs),{dir:a("dir"),"data-disabled":b(c),"data-highlighted":b(I.highlighted)}))},getItemInputProps(w){var P;let I=T(w);return t.input(y(h({},Nn.itemInput.attrs),{dir:a("dir"),"aria-label":(P=g==null?void 0:g.tagEdited)==null?void 0:P.call(g,w.value),disabled:c,id:MP(o,w),tabIndex:-1,hidden:!I.editing,maxLength:a("maxLength"),defaultValue:I.editing?s.get("editedTagValue"):"",onInput(v){r({type:"TAG_INPUT_TYPE",value:v.currentTarget.value})},onBlur(v){queueMicrotask(()=>{r({type:"TAG_INPUT_BLUR",target:v.relatedTarget,id:I.id})})},onKeyDown(v){if(v.defaultPrevented||Me(v))return;let R={Enter(){r({type:"TAG_INPUT_ENTER"})},Escape(){r({type:"TAG_INPUT_ESCAPE"})}}[v.key];R&&(v.preventDefault(),R(v))}}))},getItemDeleteTriggerProps(w){var P;let I=T(w);return t.button(y(h({},Nn.itemDeleteTrigger.attrs),{dir:a("dir"),"data-disabled":b(I.disabled),"aria-disabled":I.disabled,"data-highlighted":b(I.highlighted),id:eF(o,w),type:"button",disabled:I.disabled,"aria-label":(P=g==null?void 0:g.deleteTagTriggerLabel)==null?void 0:P.call(g,w.value),tabIndex:-1,onPointerDown(v){fe(v)&&(l||v.preventDefault())},onPointerMove(v){l&&cF(v.currentTarget)},onPointerLeave(v){l&&dF(v.currentTarget)},onClick(v){v.defaultPrevented||l&&r({type:"CLICK_DELETE_TAG",id:I.id})}}))},getClearTriggerProps(){return t.button(y(h({},Nn.clearTrigger.attrs),{dir:a("dir"),id:ZD(o),type:"button","data-readonly":b(d),disabled:c,"aria-label":g==null?void 0:g.clearTriggerLabel,hidden:S,onClick(){l&&r({type:"CLEAR_VALUE"})}}))}}}function pF(e,t){return t?typeof t=="string"?e.endsWith(t):new RegExp(`${t.source}$`).test(e):!1}function hF(e){if(!e)return;let t=pt(e);return"box-sizing:"+t.boxSizing+";border-left:"+t.borderLeftWidth+" solid red;border-right:"+t.borderRightWidth+" solid red;font-family:"+t.fontFamily+";font-feature-settings:"+t.fontFeatureSettings+";font-kerning:"+t.fontKerning+";font-size:"+t.fontSize+";font-stretch:"+t.fontStretch+";font-style:"+t.fontStyle+";font-variant:"+t.fontVariant+";font-variant-caps:"+t.fontVariantCaps+";font-variant-ligatures:"+t.fontVariantLigatures+";font-variant-numeric:"+t.fontVariantNumeric+";font-weight:"+t.fontWeight+";letter-spacing:"+t.letterSpacing+";margin-left:"+t.marginLeft+";margin-right:"+t.marginRight+";padding-left:"+t.paddingLeft+";padding-right:"+t.paddingRight+";text-indent:"+t.textIndent+";text-transform:"+t.textTransform}function fF(e){let t=e.createElement("div");return t.id="ghost",t.style.cssText="display:inline-block;height:0;overflow:hidden;position:absolute;top:0;visibility:hidden;white-space:nowrap;",e.body.appendChild(t),t}function mF(e){if(!e)return;let t=Ue(e),n=ye(e),r=fF(t),i=hF(e);i&&(r.style.cssText+=i);function a(){n.requestAnimationFrame(()=>{r.innerHTML=e.value;let o=n.getComputedStyle(r);e==null||e.style.setProperty("width",o.width)})}return a(),e==null||e.addEventListener("input",a),e==null||e.addEventListener("change",a),()=>{t.body.removeChild(r),e==null||e.removeEventListener("input",a),e==null||e.removeEventListener("change",a)}}function RP(e,t){return e.split(bF).join(t)}function Zg(e){var r,i;let t=(r=e.deleteTagTriggerLabel)!=null?r:EF,n=(i=e.tagEdited)!=null?i:PF;return{deleteTagTriggerLabel:a=>RP(t,a),tagEdited:a=>RP(n,a)}}function kP(e){let t=e.dataset.translation;if(!t)return{translations:Zg({})};try{let n=JSON.parse(t);return{translations:Zg(n)}}catch(n){return{translations:Zg({})}}}function Oc(e){return Array.from(e.querySelectorAll(':scope > [data-scope="tags-input"][data-part="item"]'))}function NP(e){return e?!e.hidden:!1}function IF(e,t,n,r={}){sn(e,t,{onTouched:n,scope:"tags-input",notifyLiveView:r.notifyLiveView,fieldTouched:r.fieldTouched===!0})}function Jg(e,t,n,r={}){IF(e,t,n,r)}function TF(e,t){let n=e.dataset[t];if(!n||n.trim()==="")return[];try{let r=JSON.parse(n);return Array.isArray(r)&&r.every(i=>typeof i=="string")?r:[]}catch(r){return[]}}function ep(e){return V(e,"blurBehavior",["add","clear"])}function tp(e){let t=U(e,"max");if(t!==void 0&&!(!Number.isFinite(t)||t<=0))return t}function np(e){let t=e.querySelector('[data-scope="tags-input"][data-part="input"]'),n=t==null?void 0:t.getAttribute("placeholder");return typeof n=="string"&&n!==""?n:void 0}function LP(e){if(!V(e,"submitName"))return V(e,"name")}var XD,Nn,DP,Qg,ZD,FP,JD,QD,Yo,eF,MP,tF,xP,nF,rF,_P,xa,$P,Oi,iF,aF,oF,sF,lF,zo,cF,dF,uF,jo,wi,vF,yF,bF,EF,PF,SF,CF,BP=ee(()=>{"use strict";bl();on();ai();Kt();$e();Ve();be();oe();XD=z("tagsInput").parts("root","label","control","input","clearTrigger","item","itemPreview","itemInput","itemText","itemDeleteTrigger"),Nn=XD.build(),DP=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`tags-input:${e.id}`},Qg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`tags-input:${e.id}:input`},ZD=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.clearBtn)!=null?n:`tags-input:${e.id}:clear-btn`},FP=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`tags-input:${e.id}:hidden-input`},JD=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`tags-input:${e.id}:label`},QD=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`tags-input:${e.id}:control`},Yo=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.item)==null?void 0:r.call(n,t))!=null?i:`tags-input:${e.id}:tag:${t.value}:${t.index}`},eF=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemDeleteTrigger)==null?void 0:r.call(n,t))!=null?i:`${Yo(e,t)}:delete-btn`},MP=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.itemInput)==null?void 0:r.call(n,t))!=null?i:`${Yo(e,t)}:input`},tF=e=>`${e}:input`,xP=(e,t)=>e.getById(tF(t)),nF=e=>Oe(_P(e),"[data-part=item]"),rF=(e,t)=>e.getById(MP(e,t)),_P=e=>e.getById(DP(e)),xa=e=>e.getById(Qg(e)),$P=e=>e.getById(FP(e)),Oi=e=>Oe(_P(e),"[data-part=item-preview]:not([data-disabled])"),iF=e=>Oi(e)[0],aF=e=>Oi(e)[Oi(e).length-1],oF=(e,t)=>vr(Oi(e),t,!1),sF=(e,t)=>mr(Oi(e),t,!1),lF=(e,t)=>Oi(e)[t],zo=(e,t)=>Ja(Oi(e),t),cF=e=>{let t=e.closest("[data-part=item-preview]");t&&(t.dataset.deleteIntent="")},dF=e=>{let t=e.closest("[data-part=item-preview]");t&&delete t.dataset.deleteIntent},uF=(e,t)=>{let n=$P(e);n&&Hi(n,{value:t})};({and:jo,not:wi,or:vF}=we()),yF=te({props({props:e}){return y(h({dir:"ltr",addOnPaste:!1,editable:!0,validate:()=>!0,allowDuplicates:!1,delimiter:",",defaultValue:[],defaultInputValue:"",max:1/0,sanitizeValue:t=>t.trim()},e),{translations:h({clearTriggerLabel:"Clear all tags",deleteTagTriggerLabel:t=>`Delete tag ${t}`,tagAdded:t=>`Added tag ${t}`,tagsPasted:t=>`Pasted ${t.length} tags`,tagEdited:t=>`Editing tag ${t}. Press enter to save or escape to cancel.`,tagUpdated:t=>`Tag update to ${t}`,tagDeleted:t=>`Tag ${t} deleted`,tagSelected:t=>`Tag ${t} selected. Press enter to edit, delete or backspace to remove.`},e.translations)})},initialState({prop:e}){return e("autoFocus")?"focused:input":"idle"},refs(){return{liveRegion:null,log:{current:null,prev:null}}},context({bindable:e,prop:t}){return{value:e(()=>({defaultValue:t("defaultValue"),value:t("value"),isEqual:Ce,hash(n){return n.join(", ")},onChange(n){var r;(r=t("onValueChange"))==null||r({value:n})}})),inputValue:e(()=>({sync:!0,defaultValue:t("defaultInputValue"),value:t("inputValue"),onChange(n){var r;(r=t("onInputValueChange"))==null||r({inputValue:n})}})),fieldsetDisabled:e(()=>({defaultValue:!1})),editedTagValue:e(()=>({defaultValue:""})),editedTagId:e(()=>({defaultValue:null})),editedTagIndex:e(()=>({defaultValue:null,sync:!0})),highlightedTagId:e(()=>({defaultValue:null,sync:!0,onChange(n){var r;(r=t("onHighlightChange"))==null||r({highlightedValue:n})}}))}},computed:{count:({context:e})=>e.get("value").length,valueAsString:({context:e})=>e.hash("value"),sanitizedInputValue:({context:e,prop:t})=>t("sanitizeValue")(e.get("inputValue")),isDisabled:({prop:e})=>!!e("disabled"),isInteractive:({prop:e})=>!(e("readOnly")||e("disabled")),isAtMax:({context:e,prop:t})=>e.get("value").length===t("max"),isOverflowing:({context:e,prop:t})=>e.get("value").length>t("max")},watch({track:e,context:t,action:n,computed:r,refs:i}){e([()=>t.get("editedTagValue")],()=>{n(["syncEditedTagInputValue"])}),e([()=>t.get("inputValue")],()=>{n(["syncInputValue"])}),e([()=>t.get("highlightedTagId")],()=>{n(["logHighlightedTag"])}),e([()=>r("isOverflowing")],()=>{n(["invokeOnInvalid"])}),e([()=>JSON.stringify(i.get("log"))],()=>{n(["announceLog"])})},effects:["trackLiveRegion","trackFormControlState"],exit:["clearLog"],on:{DOUBLE_CLICK_TAG:{guard:"isTagEditable",target:"editing:tag",actions:["setEditedId"]},POINTER_DOWN_TAG:{target:"navigating:tag",actions:["highlightTag","focusInput"]},CLICK_DELETE_TAG:{target:"focused:input",actions:["deleteTag"]},SET_INPUT_VALUE:{actions:["setInputValue"]},SET_VALUE:{actions:["setValue"]},CLEAR_TAG:{actions:["deleteTag"]},SET_VALUE_AT_INDEX:{actions:["setValueAtIndex"]},CLEAR_VALUE:{actions:["clearTags","clearInputValue","focusInput"]},ADD_TAG:{actions:["addTag"]},INSERT_TAG:{guard:jo(vF(wi("isAtMax"),"allowOverflow"),wi("isInputValueEmpty")),actions:["addTag","clearInputValue"]},EXTERNAL_BLUR:[{guard:"addOnBlur",actions:["raiseInsertTagEvent"]},{guard:"clearOnBlur",actions:["clearInputValue"]}]},states:{idle:{on:{FOCUS:{target:"focused:input"},POINTER_DOWN:{guard:wi("hasHighlightedTag"),target:"focused:input"}}},"focused:input":{tags:["focused"],entry:["focusInput","clearHighlightedId"],effects:["trackInteractOutside"],on:{TYPE:{actions:["setInputValue"]},BLUR:[{guard:"addOnBlur",target:"idle",actions:["raiseInsertTagEvent"]},{guard:"clearOnBlur",target:"idle",actions:["clearInputValue"]},{target:"idle"}],ENTER:{actions:["raiseInsertTagEvent"]},DELIMITER_KEY:{actions:["raiseInsertTagEvent"]},ARROW_LEFT:{guard:jo("hasTags","isCaretAtStart"),target:"navigating:tag",actions:["highlightLastTag"]},BACKSPACE:{target:"navigating:tag",guard:jo("hasTags","isCaretAtStart"),actions:["highlightLastTag"]},DELETE:{guard:"hasHighlightedTag",actions:["deleteHighlightedTag","highlightTagAtIndex"]},PASTE:[{guard:"addOnPaste",actions:["setInputValue","addTagFromPaste"]},{actions:["setInputValue"]}]}},"navigating:tag":{tags:["focused"],effects:["trackInteractOutside"],on:{ARROW_RIGHT:[{guard:jo("hasTags","isCaretAtStart",wi("isLastTagHighlighted")),actions:["highlightNextTag"]},{target:"focused:input"}],ARROW_LEFT:[{guard:wi("isCaretAtStart"),target:"focused:input"},{actions:["highlightPrevTag"]}],BLUR:{target:"idle",actions:["clearHighlightedId"]},ENTER:{guard:jo("isTagEditable","hasHighlightedTag"),target:"editing:tag",actions:["setEditedId","focusEditedTagInput"]},ARROW_DOWN:{target:"focused:input"},ESCAPE:{target:"focused:input"},TYPE:{target:"focused:input",actions:["setInputValue"]},BACKSPACE:[{guard:wi("isCaretAtStart"),target:"focused:input"},{guard:"isFirstTagHighlighted",actions:["deleteHighlightedTag","highlightFirstTag"]},{guard:"hasHighlightedTag",actions:["deleteHighlightedTag","highlightPrevTag"]},{actions:["highlightLastTag"]}],DELETE:[{guard:wi("isCaretAtStart"),target:"focused:input"},{target:"focused:input",actions:["deleteHighlightedTag","highlightTagAtIndex"]}],PASTE:[{guard:"addOnPaste",target:"focused:input",actions:["setInputValue","addTagFromPaste"]},{target:"focused:input",actions:["setInputValue"]}]}},"editing:tag":{tags:["editing","focused"],entry:["focusEditedTagInput"],effects:["autoResize"],on:{TAG_INPUT_TYPE:{actions:["setEditedTagValue"]},TAG_INPUT_ESCAPE:{target:"navigating:tag",actions:["clearEditedTagValue","focusInput","clearEditedId","highlightTagAtIndex"]},TAG_INPUT_BLUR:[{guard:"isInputRelatedTarget",target:"navigating:tag",actions:["clearEditedTagValue","clearHighlightedId","clearEditedId"]},{target:"idle",actions:["clearEditedTagValue","clearHighlightedId","clearEditedId","raiseExternalBlurEvent"]}],TAG_INPUT_ENTER:[{guard:"isEditedTagEmpty",target:"navigating:tag",actions:["deleteHighlightedTag","focusInput","clearEditedId","highlightTagAtIndex"]},{target:"navigating:tag",actions:["submitEditedTagValue","focusInput","clearEditedId","highlightTagAtIndex"]}]}}},implementations:{guards:{isInputRelatedTarget:({scope:e,event:t})=>t.relatedTarget===xa(e),isAtMax:({computed:e})=>e("isAtMax"),hasHighlightedTag:({context:e})=>e.get("highlightedTagId")!=null,isFirstTagHighlighted:({context:e,scope:t})=>{let n=e.get("value");return Yo(t,{value:n[0],index:0})===e.get("highlightedTagId")},isEditedTagEmpty:({context:e,prop:t})=>t("sanitizeValue")(e.get("editedTagValue"))==="",isLastTagHighlighted:({context:e,scope:t})=>{let n=e.get("value"),r=n.length-1;return Yo(t,{value:n[r],index:r})===e.get("highlightedTagId")},isInputValueEmpty:({context:e,prop:t})=>t("sanitizeValue")(e.get("inputValue")).length===0,hasTags:({context:e})=>e.get("value").length>0,allowOverflow:({prop:e})=>!!e("allowOverflow"),autoFocus:({prop:e})=>!!e("autoFocus"),addOnBlur:({prop:e})=>e("blurBehavior")==="add",clearOnBlur:({prop:e})=>e("blurBehavior")==="clear",addOnPaste:({prop:e})=>!!e("addOnPaste"),isTagEditable:({prop:e})=>!!e("editable"),isCaretAtStart:({scope:e})=>nh(xa(e))},effects:{trackInteractOutside({scope:e,prop:t,send:n}){return aa(xa(e),{exclude(r){return nF(e).some(a=>ge(a,r))},onFocusOutside:t("onFocusOutside"),onPointerDownOutside:t("onPointerDownOutside"),onInteractOutside(r){var i;(i=t("onInteractOutside"))==null||i(r),!r.defaultPrevented&&n({type:"BLUR",src:"interact-outside"})}})},trackFormControlState({context:e,send:t,scope:n}){return ht($P(n),{onFieldsetDisabledChange(r){e.set("fieldsetDisabled",r)},onFormReset(){let r=e.initial("value");t({type:"SET_VALUE",value:r,src:"form-reset"})}})},autoResize({context:e,prop:t,scope:n}){let r;return queueMicrotask(()=>{let i=e.get("editedTagValue"),a=e.get("editedTagIndex");if(!i||a==null||!t("editable"))return;let o=rF(n,{value:i,index:a});r=mF(o)}),()=>{r==null||r()}},trackLiveRegion({scope:e,refs:t}){let n=Qi({level:"assertive",document:e.getDoc()});return t.set("liveRegion",n),()=>n.destroy()}},actions:{raiseInsertTagEvent({send:e}){e({type:"INSERT_TAG"})},raiseExternalBlurEvent({send:e,event:t}){e({type:"EXTERNAL_BLUR",id:t.id})},dispatchChangeEvent({scope:e,computed:t}){uF(e,t("valueAsString"))},highlightNextTag({context:e,scope:t}){var i;let n=e.get("highlightedTagId");if(n==null)return;let r=sF(t,n);e.set("highlightedTagId",(i=r==null?void 0:r.id)!=null?i:null)},highlightFirstTag({context:e,scope:t}){B(()=>{var r;let n=iF(t);e.set("highlightedTagId",(r=n==null?void 0:n.id)!=null?r:null)})},highlightLastTag({context:e,scope:t}){var r;let n=aF(t);e.set("highlightedTagId",(r=n==null?void 0:n.id)!=null?r:null)},highlightPrevTag({context:e,scope:t}){var i;let n=e.get("highlightedTagId");if(n==null)return;let r=oF(t,n);e.set("highlightedTagId",(i=r==null?void 0:r.id)!=null?i:null)},highlightTag({context:e,event:t}){e.set("highlightedTagId",t.id)},highlightTagAtIndex({context:e,scope:t}){B(()=>{let n=e.get("editedTagIndex");if(n==null)return;let r=lF(t,n);r!=null&&(e.set("highlightedTagId",r.id),e.set("editedTagIndex",null))})},deleteTag({context:e,scope:t,event:n,refs:r}){let i=zo(t,n.id),a=e.get("value")[i],o=r.get("log");r.set("log",{prev:o.current,current:{type:"delete",value:a}}),e.set("value",s=>Yc(s,i))},deleteHighlightedTag({context:e,scope:t,refs:n}){let r=e.get("highlightedTagId");if(r==null)return;let i=zo(t,r);e.set("editedTagIndex",i);let a=e.get("value"),o=n.get("log");n.set("log",{prev:o.current,current:{type:"delete",value:a[i]}}),e.set("value",s=>Yc(s,i))},setEditedId({context:e,event:t,scope:n}){var s;let r=e.get("highlightedTagId"),i=(s=t.id)!=null?s:r;e.set("editedTagId",i);let a=zo(n,i),o=e.get("value")[a];e.set("editedTagIndex",a),e.set("editedTagValue",o)},clearEditedId({context:e}){e.set("editedTagId",null)},clearEditedTagValue({context:e}){e.set("editedTagValue","")},setEditedTagValue({context:e,event:t}){e.set("editedTagValue",t.value)},submitEditedTagValue({context:e,scope:t,refs:n,prop:r}){let i=e.get("editedTagId");if(!i)return;let a=zo(t,i),o=e.get("editedTagValue"),s=e.get("value"),l=s.some((d,u)=>u!==a&&d===o);if(!r("allowDuplicates")&&l||s[a]===o)return;e.set("value",d=>{let u=d.slice();return u[a]=o,u});let c=n.get("log");n.set("log",{prev:c.current,current:{type:"update",value:o}})},setValueAtIndex({context:e,event:t,refs:n,prop:r}){if(t.value){let i=e.get("value"),a=i.some((s,l)=>l!==t.index&&s===t.value);if(!r("allowDuplicates")&&a||i[t.index]===t.value)return;e.set("value",s=>{let l=s.slice();return l[t.index]=t.value,l});let o=n.get("log");n.set("log",{prev:o.current,current:{type:"update",value:t.value}})}else It("You need to provide a value for the tag")},focusEditedTagInput({context:e,scope:t}){B(()=>{let n=e.get("editedTagId");if(!n)return;let r=xP(t,n);r==null||r.select()})},setInputValue({context:e,event:t}){e.set("inputValue",t.value)},clearHighlightedId({context:e}){e.set("highlightedTagId",null)},focusInput({scope:e}){B(()=>{var t;(t=xa(e))==null||t.focus()})},clearInputValue({context:e}){B(()=>{e.set("inputValue","")})},syncInputValue({context:e,scope:t}){let n=xa(t);n&&_e(n,e.get("inputValue"))},syncEditedTagInputValue({context:e,event:t,scope:n}){let r=e.get("editedTagId")||e.get("highlightedTagId")||t.id;if(r==null)return;let i=xP(n,r);i&&_e(i,e.get("editedTagValue"))},addTag({context:e,event:t,computed:n,prop:r,refs:i}){var l,c,d;let a=(l=t.value)!=null?l:n("sanitizedInputValue"),o=e.get("value");if((c=r("validate"))==null?void 0:c({inputValue:a,value:Array.from(o)})){let u=r("allowDuplicates")?o.concat(a):gt(o.concat(a));e.set("value",u);let p=i.get("log");i.set("log",{prev:p.current,current:{type:"add",value:a}})}else(d=r("onValueInvalid"))==null||d({reason:"invalidTag"})},addTagFromPaste({context:e,computed:t,prop:n,refs:r}){B(()=>{var l,c;let i=t("sanitizedInputValue"),a=e.get("value"),o=n("sanitizeValue");if((l=n("validate"))==null?void 0:l({inputValue:i,value:Array.from(a)})){let d=n("delimiter"),u=d?i.split(d).map(o):[i],p=n("allowDuplicates")?a.concat(...u):gt(a.concat(...u));e.set("value",p);let g=r.get("log");r.set("log",{prev:g.current,current:{type:"paste",values:u}})}else(c=n("onValueInvalid"))==null||c({reason:"invalidTag"});e.set("inputValue","")})},clearTags({context:e,refs:t}){e.set("value",[]);let n=t.get("log");t.set("log",{prev:n.current,current:{type:"clear"}})},setValue({context:e,event:t}){e.set("value",t.value)},invokeOnInvalid({prop:e,computed:t}){var n;t("isOverflowing")&&((n=e("onValueInvalid"))==null||n({reason:"rangeOverflow"}))},clearLog({refs:e}){let t=e.get("log");t.prev=t.current=null},logHighlightedTag({refs:e,context:t,scope:n}){let r=t.get("highlightedTagId"),i=e.get("log");if(r==null||!i.current)return;let a=zo(n,r),o=t.get("value")[a],s=e.get("log");e.set("log",{prev:s.current,current:{type:"select",value:o}})},announceLog({refs:e,prop:t}){let n=e.get("liveRegion"),r=t("translations"),i=e.get("log");if(!i.current||n==null)return;let a=n,{current:o,prev:s}=i,l;switch(o.type){case"add":l=r.tagAdded(o.value);break;case"delete":l=r.tagDeleted(o.value);break;case"update":l=r.tagUpdated(o.value);break;case"paste":l=r.tagsPasted(o.values);break;case"select":l=r.tagSelected(o.value),(s==null?void 0:s.type)==="delete"?l=`${r.tagDeleted(s.value)}. ${l}`:(s==null?void 0:s.type)==="update"&&(l=`${r.tagUpdated(s.value)}. ${l}`);break;default:break}l&&a.announce(l)}}}}),bF="%{tag}",EF="Delete tag %{tag}",PF="Editing tag %{tag}. Press enter to save or escape to cancel.";SF=class extends X{initMachine(e){return new Y(yF,e)}initApi(){return this.zagConnect(gF)}spreadItemParts(e,t,n){this.spreadProps(e,this.api.getItemProps({index:t,value:n}));let r=e.querySelector('[data-scope="tags-input"][data-part="item-preview"]');r&&this.spreadProps(r,this.api.getItemPreviewProps({index:t,value:n}));let i=e.querySelector('[data-scope="tags-input"][data-part="item-text"]');i&&this.spreadProps(i,this.api.getItemTextProps({index:t,value:n}));let a=e.querySelector('[data-scope="tags-input"][data-part="item-delete-trigger"]');if(a){for(;a.childElementCount>1;)a.removeChild(a.lastElementChild);this.spreadProps(a,this.api.getItemDeleteTriggerProps({index:t,value:n}))}let o=e.querySelector('[data-scope="tags-input"][data-part="item-input"]');o&&this.spreadProps(o,this.api.getItemInputProps({index:t,value:n})),i&&!NP(o)&&(i.textContent=n)}renderItems(){var o,s;let e=this.el.querySelector('[data-scope="tags-input"][data-part="control"]');if(!e)return;let t=e.querySelector(':scope > [data-scope="tags-input"][data-part="input"]');if(!t)return;let n=Is(this.el,"tags-input");if(!n)return;let r=n.querySelector('[data-scope="tags-input"][data-part="item"][data-template]');if(!r)return;let i=(o=this.api.value)!=null?o:[],a=Oc(e);for(;a.length>i.length;)a[a.length-1].remove(),a=Oc(e);for(let l=0;lj(this.liveSocket),i=ep(e),a=tp(e),o=V(e,"delimiter"),s=np(e),l=new SF(e,y(h(h(h(h(y(h(y(h(h({id:e.id},kP(e)),$h(e)),{disabled:O(e,"disabled"),readOnly:O(e,"readonly"),invalid:O(e,"invalid"),required:O(e,"required"),name:LP(e),form:V(e,"submitName")?void 0:V(e,"form"),dir:q(e),addOnPaste:O(e,"addOnPaste"),allowDuplicates:O(e,"allowDuplicates"),allowOverflow:O(e,"allowOverflow")}),Ye(e,"editable")===void 0?{}:{editable:Ye(e,"editable")===!0}),{autoFocus:O(e,"autoFocus")}),i!==void 0?{blurBehavior:i}:{}),a!==void 0?{max:a}:{}),o!==void 0&&o!==""?{delimiter:o}:{}),s!==void 0?{placeholder:s}:{}),{onValueChange:p=>{t.fieldTouched=!0,Jg(e,p.value,void 0,{notifyLiveView:t.allowFormNotify===!0,fieldTouched:!0}),W({el:e,canPushServer:r(),pushEvent:n,payload:{id:e.id,value:p.value},serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})},onInputValueChange:p=>{t.fieldTouched=!0,W({el:e,canPushServer:r(),pushEvent:n,payload:{id:e.id,inputValue:p.inputValue},serverEventName:V(e,"onInputValueChange"),clientEventName:V(e,"onInputValueChangeClient")})},onHighlightChange:p=>{W({el:e,canPushServer:r(),pushEvent:n,payload:{id:e.id,highlightedValue:p.highlightedValue},serverEventName:V(e,"onHighlightChange"),clientEventName:V(e,"onHighlightChangeClient")})},onValueInvalid:p=>{W({el:e,canPushServer:r(),pushEvent:n,payload:{id:e.id,reason:p.reason},serverEventName:V(e,"onValueInvalid"),clientEventName:V(e,"onValueInvalidClient")})}}));l.init(),this.tagsInput=l;let c=(p,g={})=>{Jg(e,p,void 0,{notifyLiveView:g.notifyLiveView,fieldTouched:Ar(e,t.fieldTouched===!0)})};queueMicrotask(()=>{Ar(e,t.fieldTouched===!0)||c(l.api.value,{notifyLiveView:!1}),t.allowFormNotify=!0}),t.unbindSubmitIntent=oa(e,()=>{t.fieldTouched=!0,c(l.api.value,{notifyLiveView:!1})});let d=ie(e);this.domRegistry=d,d.add("corex:tags-input:set-value",p=>{var f;let g=(f=p.detail)==null?void 0:f.value;Array.isArray(g)&&g.every(m=>typeof m=="string")&&l.api.setValue(g)}),d.add("corex:tags-input:clear-value",()=>{l.api.clearValue()}),d.add("corex:tags-input:add-value",p=>{var f;let g=(f=p.detail)==null?void 0:f.value;typeof g=="string"&&g!==""&&l.api.addValue(g)}),d.add("corex:tags-input:remove-value",p=>{var f;let g=(f=p.detail)==null?void 0:f.value;typeof g!="string"||g===""||l.api.setValue(l.api.value.filter(m=>m!==g))});let u=re(this);this.handleRegistry=u,u.add("tags_input_set_value",p=>{if(!$(e.id,H(p)))return;let g=Wh(p);g&&l.api.setValue(g)}),u.add("tags_input_clear_value",p=>{$(e.id,H(p))&&l.api.clearValue()}),u.add("tags_input_add_value",p=>{if(!$(e.id,H(p)))return;let g=ao(p);g!==""&&l.api.addValue(g)}),u.add("tags_input_remove_value",p=>{if(!$(e.id,H(p)))return;let g=ao(p);g!==""&&l.api.setValue(l.api.value.filter(f=>f!==g))})},updated(){var o,s;let e=this.el,t=_h(e),n=ep(e),r=tp(e),i=V(e,"delimiter"),a=np(e);(o=this.tagsInput)==null||o.updateProps(h(h(h(h(y(h(y(h(h({id:e.id},kP(e)),t),{disabled:O(e,"disabled"),readOnly:O(e,"readonly"),invalid:O(e,"invalid"),required:O(e,"required"),name:LP(e),form:V(e,"submitName")?void 0:V(e,"form"),dir:q(e),addOnPaste:O(e,"addOnPaste"),allowDuplicates:O(e,"allowDuplicates"),allowOverflow:O(e,"allowOverflow")}),Ye(e,"editable")===void 0?{}:{editable:Ye(e,"editable")===!0}),{autoFocus:O(e,"autoFocus")}),n!==void 0?{blurBehavior:n}:{}),r!==void 0?{max:r}:{}),i!==void 0&&i!==""?{delimiter:i}:{}),a!==void 0?{placeholder:a}:{})),"value"in t&&Jg(e,t.value,void 0,{notifyLiveView:!1,fieldTouched:Ar(e,this.fieldTouched===!0)}),(s=this.tagsInput)==null||s.render()},destroyed(){var e,t,n,r;(e=this.unbindSubmitIntent)==null||e.call(this),(t=this.domRegistry)==null||t.teardown(),(n=this.handleRegistry)==null||n.teardown(),(r=this.tagsInput)==null||r.destroy()}}});var jP={};pe(jP,{Tabs:()=>HF,readTabsLayoutProps:()=>ip,tabsFocusChangePayload:()=>zP,tabsValueChangePayload:()=>KP});function DF(e,t){let{state:n,send:r,context:i,prop:a,scope:o}=e,s=a("translations"),l=n.matches("focused"),c=a("orientation")==="vertical",d=a("orientation")==="horizontal",u=a("composite");function p(g){return{selected:i.get("value")===g.value,focused:i.get("focusedValue")===g.value,disabled:!!g.disabled}}return{value:i.get("value"),focusedValue:i.get("focusedValue"),setValue(g){r({type:"SET_VALUE",value:g})},clearValue(){r({type:"CLEAR_VALUE"})},setIndicatorRect(g){let f=Vi(o,g);r({type:"SET_INDICATOR_RECT",id:f})},syncTabIndex(){r({type:"SYNC_TAB_INDEX"})},selectNext(g){r({type:"TAB_FOCUS",value:g,src:"selectNext"}),r({type:"ARROW_NEXT",src:"selectNext"})},selectPrev(g){r({type:"TAB_FOCUS",value:g,src:"selectPrev"}),r({type:"ARROW_PREV",src:"selectPrev"})},focus(){var f;let g=i.get("value");g&&((f=Vc(o,g))==null||f.focus())},getRootProps(){return t.element(y(h({},Xo.root.attrs),{id:OF(o),"data-orientation":a("orientation"),"data-focus":b(l),dir:a("dir")}))},getListProps(){return t.element(y(h({},Xo.list.attrs),{id:Zo(o),role:"tablist",dir:a("dir"),"data-focus":b(l),"aria-orientation":a("orientation"),"data-orientation":a("orientation"),"aria-label":s==null?void 0:s.listLabel,onKeyDown(g){if(g.defaultPrevented||Me(g)||!ge(g.currentTarget,ne(g)))return;let f={ArrowDown(){d||r({type:"ARROW_NEXT",key:"ArrowDown"})},ArrowUp(){d||r({type:"ARROW_PREV",key:"ArrowUp"})},ArrowLeft(){c||r({type:"ARROW_PREV",key:"ArrowLeft"})},ArrowRight(){c||r({type:"ARROW_NEXT",key:"ArrowRight"})},Home(){r({type:"HOME"})},End(){r({type:"END"})}},m=me(g,{dir:a("dir"),orientation:a("orientation")}),S=f[m];if(S){g.preventDefault(),S(g);return}}}))},getTriggerState:p,getTriggerProps(g){let{value:f,disabled:m}=g,S=p(g);return t.button(y(h({},Xo.trigger.attrs),{role:"tab",type:"button",disabled:m,dir:a("dir"),"data-orientation":a("orientation"),"data-disabled":b(m),"aria-disabled":m,"data-value":f,"aria-selected":S.selected,"data-selected":b(S.selected),"data-focus":b(S.focused),"aria-controls":S.selected?rp(o,f):void 0,"data-ownedby":Zo(o),"data-ssr":b(i.get("ssr")),id:Vi(o,f),tabIndex:S.selected&&u?0:-1,onFocus(){r({type:"TAB_FOCUS",value:f})},onBlur(T){let w=T.relatedTarget;(w==null?void 0:w.getAttribute("role"))!=="tab"&&r({type:"TAB_BLUR"})},onClick(T){T.defaultPrevented||$n(T)||m||(wt()&&T.currentTarget.focus(),r({type:"TAB_CLICK",value:f}))}}))},getContentProps(g){let{value:f}=g,m=i.get("value")===f;return t.element(y(h({},Xo.content.attrs),{dir:a("dir"),id:rp(o,f),tabIndex:u?0:-1,"aria-labelledby":Vi(o,f),role:"tabpanel","data-ownedby":Zo(o),"data-selected":b(m),"data-orientation":a("orientation"),hidden:!m}))},getIndicatorProps(){let g=i.get("indicatorRect"),f=i.get("animateIndicator");return t.element(y(h({id:qP(o)},Xo.indicator.attrs),{dir:a("dir"),"data-orientation":a("orientation"),hidden:FF(g),onTransitionEnd(m){ne(m)===m.currentTarget&&r({type:"INDICATOR_TRANSITION_END"})},style:{"--transition-property":"left, right, top, bottom, width, height","--left":ke(g==null?void 0:g.x),"--top":ke(g==null?void 0:g.y),"--width":ke(g==null?void 0:g.width),"--height":ke(g==null?void 0:g.height),position:"absolute",willChange:f?"var(--transition-property)":"auto",transitionProperty:f?"var(--transition-property)":"none",transitionDuration:f?"var(--transition-duration, 150ms)":"0ms",transitionTimingFunction:"var(--transition-timing-function)",[d?"left":"top"]:d?"var(--left)":"var(--top)"}}))}}}function UP(e){return{root:`tabs-${e}-root`,list:`tabs-${e}-list`,indicator:`tabs-${e}-indicator`,content:t=>`tabs-${e}-content-${t}`,trigger:t=>`tabs-${e}-trigger-${t}`}}function KP(e,t){var n;return{id:e.id,value:(n=t.value)!=null?n:null}}function zP(e,t){var n;return{id:e.id,value:(n=t.focusedValue)!=null?n:null}}function ip(e){return{orientation:V(e,"orientation"),dir:q(e)}}var wF,Xo,OF,Zo,rp,Vi,qP,VF,AF,Vc,GP,Ra,xF,RF,kF,NF,WP,LF,FF,MF,_F,$F,HF,YP=ee(()=>{"use strict";Bt();$e();Ve();be();oe();wF=z("tabs").parts("root","list","trigger","content","indicator"),Xo=wF.build(),OF=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`tabs:${e.id}`},Zo=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.list)!=null?n:`tabs:${e.id}:list`},rp=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.content)==null?void 0:r.call(n,t))!=null?i:`tabs:${e.id}:content-${t}`},Vi=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.trigger)==null?void 0:r.call(n,t))!=null?i:`tabs:${e.id}:trigger-${t}`},qP=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.indicator)!=null?n:`tabs:${e.id}:indicator`},VF=e=>e.getById(Zo(e)),AF=(e,t)=>e.getById(rp(e,t)),Vc=(e,t)=>t!=null?e.getById(Vi(e,t)):null,GP=e=>e.getById(qP(e)),Ra=e=>{let n=`[role=tab][data-ownedby='${CSS.escape(Zo(e))}']:not([disabled])`;return Oe(VF(e),n)},xF=e=>Dt(Ra(e)),RF=e=>en(Ra(e)),kF=(e,t)=>mr(Ra(e),Vi(e,t.value),t.loopFocus),NF=(e,t)=>vr(Ra(e),Vi(e,t.value),t.loopFocus),WP=e=>{var t,n,r,i;return{x:(t=e==null?void 0:e.offsetLeft)!=null?t:0,y:(n=e==null?void 0:e.offsetTop)!=null?n:0,width:(r=e==null?void 0:e.offsetWidth)!=null?r:0,height:(i=e==null?void 0:e.offsetHeight)!=null?i:0}},LF=(e,t)=>{let n=pd(Ra(e),Vi(e,t));return WP(n)};FF=e=>e==null||e.width===0&&e.height===0&&e.x===0&&e.y===0,{createMachine:MF}=Mt(),_F=MF({props({props:e}){return h({dir:"ltr",orientation:"horizontal",activationMode:"automatic",loopFocus:!0,composite:!0,navigate(t){Ui(t.node)},defaultValue:null},e)},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var r;(r=e("onValueChange"))==null||r({value:n})}})),focusedValue:t(()=>({defaultValue:e("value")||e("defaultValue"),sync:!0,onChange(n){var r;(r=e("onFocusChange"))==null||r({focusedValue:n})}})),ssr:t(()=>({defaultValue:!0})),indicatorRect:t(()=>({defaultValue:null})),animateIndicator:t(()=>({defaultValue:!1}))}},refs(){return{indicatorCleanup:null,prevValue:null}},watch({context:e,prop:t,track:n,action:r}){n([()=>e.get("value")],()=>{r(["syncIndicatorAnimation","syncIndicatorRect","syncTabIndex","navigateIfNeeded"])}),n([()=>t("dir"),()=>t("orientation")],()=>{r(["syncIndicatorRect"])})},on:{SET_VALUE:{actions:["setValue"]},CLEAR_VALUE:{actions:["clearValue"]},SET_INDICATOR_RECT:{actions:["setIndicatorRect"]},SYNC_TAB_INDEX:{actions:["syncTabIndex"]},INDICATOR_TRANSITION_END:{actions:["clearIndicatorAnimation"]}},entry:["syncPrevValue","syncIndicatorRect","syncTabIndex","syncSsr"],exit:["cleanupObserver"],states:{idle:{on:{TAB_FOCUS:{target:"focused",actions:["setFocusedValue"]},TAB_CLICK:{target:"focused",actions:["setFocusedValue","setValue"]}}},focused:{on:{TAB_CLICK:{actions:["setFocusedValue","setValue"]},ARROW_PREV:[{guard:"selectOnFocus",actions:["focusPrevTab","selectFocusedTab"]},{actions:["focusPrevTab"]}],ARROW_NEXT:[{guard:"selectOnFocus",actions:["focusNextTab","selectFocusedTab"]},{actions:["focusNextTab"]}],HOME:[{guard:"selectOnFocus",actions:["focusFirstTab","selectFocusedTab"]},{actions:["focusFirstTab"]}],END:[{guard:"selectOnFocus",actions:["focusLastTab","selectFocusedTab"]},{actions:["focusLastTab"]}],TAB_FOCUS:{actions:["setFocusedValue"]},TAB_BLUR:{target:"idle",actions:["clearFocusedValue"]}}}},implementations:{guards:{selectOnFocus:({prop:e})=>e("activationMode")==="automatic"},actions:{selectFocusedTab({context:e,prop:t}){B(()=>{let n=e.get("focusedValue");if(!n)return;let i=t("deselectable")&&e.get("value")===n?null:n;e.set("value",i)})},setFocusedValue({context:e,event:t,flush:n}){t.value!=null&&n(()=>{e.set("focusedValue",t.value)})},clearFocusedValue({context:e}){e.set("focusedValue",null)},setValue({context:e,event:t,prop:n}){let r=n("deselectable")&&e.get("value")===e.get("focusedValue");e.set("value",r?null:t.value)},clearValue({context:e}){e.set("value",null)},focusFirstTab({scope:e}){B(()=>{var t;(t=xF(e))==null||t.focus()})},focusLastTab({scope:e}){B(()=>{var t;(t=RF(e))==null||t.focus()})},focusNextTab({context:e,prop:t,scope:n,event:r}){var o;let i=(o=r.value)!=null?o:e.get("focusedValue");if(!i)return;let a=kF(n,{value:i,loopFocus:t("loopFocus")});B(()=>{t("composite")?a==null||a.focus():(a==null?void 0:a.dataset.value)!=null&&e.set("focusedValue",a.dataset.value)})},focusPrevTab({context:e,prop:t,scope:n,event:r}){var o;let i=(o=r.value)!=null?o:e.get("focusedValue");if(!i)return;let a=NF(n,{value:i,loopFocus:t("loopFocus")});B(()=>{t("composite")?a==null||a.focus():(a==null?void 0:a.dataset.value)!=null&&e.set("focusedValue",a.dataset.value)})},syncTabIndex({context:e,scope:t}){B(()=>{let n=e.get("value");if(!n)return;let r=AF(t,n);if(!r)return;Ya(r).length>0?r.removeAttribute("tabindex"):r.setAttribute("tabindex","0")})},cleanupObserver({refs:e}){let t=e.get("indicatorCleanup");t&&t()},setIndicatorRect({context:e,event:t,scope:n}){var o;let r=(o=t.id)!=null?o:e.get("value");!GP(n)||!r||!Vc(n,r)||e.set("indicatorRect",LF(n,r))},syncSsr({context:e}){e.set("ssr",!1)},syncPrevValue({context:e,refs:t}){t.set("prevValue",e.get("value"))},syncIndicatorAnimation({context:e,refs:t}){let n=t.get("prevValue"),r=e.get("value"),i=n!=null&&r!=null&&n!==r;e.set("animateIndicator",i),t.set("prevValue",r)},clearIndicatorAnimation({context:e}){e.set("animateIndicator",!1)},syncIndicatorRect({context:e,refs:t,scope:n}){let r=t.get("indicatorCleanup");if(r&&r(),!GP(n))return;let a=()=>{let l=Vc(n,e.get("value"));if(!l)return;let c=WP(l);e.set("indicatorRect",d=>Ce(d,c)?d:c)};a();let o=Ra(n),s=Ct(...o.map(l=>Un.observe(l,a)));t.set("indicatorCleanup",s)},navigateIfNeeded({context:e,prop:t,scope:n}){var a;let r=e.get("value");if(!r)return;let i=Vc(n,r);_t(i)&&((a=t("navigate"))==null||a({value:r,node:i,href:i.href}))}}}});$F=class extends X{constructor(){super(...arguments);Q(this,"updateProps",t=>{var i;let n=t,r=(i=n.id)!=null?i:this.el.id;this.machine.updateProps(y(h({},n),{id:r,ids:UP(r)}))})}initMachine(t){var r;let n=(r=t.id)!=null?r:this.el.id;return new Y(_F,y(h({},t),{id:n,ids:UP(n)}))}initApi(){return this.zagConnect(DF)}render(){let t=this.el.querySelector('[data-scope="tabs"][data-part="root"]');if(!t)return;this.spreadProps(t,this.api.getRootProps());let n=t.querySelector(':scope > [data-scope="tabs"][data-part="list"]');if(!n)return;this.spreadProps(n,this.api.getListProps()),n.querySelectorAll(':scope > [data-scope="tabs"][data-part="trigger"]').forEach(a=>{let o=a.dataset.value,s=a.dataset.disabled=="";o&&this.spreadProps(a,this.api.getTriggerProps({value:o,disabled:s}))}),t.querySelectorAll(':scope > [data-scope="tabs"][data-part="content"]').forEach(a=>{let o=a.dataset.value;o&&this.spreadProps(a,this.api.getContentProps({value:o}))})}};HF={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=new $F(e,y(h(h({id:e.id},Hs(e,"value","defaultValue")),ip(e)),{onValueChange:o=>{W({el:e,canPushServer:n(),pushEvent:t,payload:KP(e,o),serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})},onFocusChange:o=>{W({el:e,canPushServer:n(),pushEvent:t,payload:zP(e,o),serverEventName:V(e,"onFocusChange"),clientEventName:V(e,"onFocusChangeClient")})}}));r.init(),this.tabs=r;let i=ie(e);this.domRegistry=i,i.add("corex:tabs:set-value",o=>{r.api.setValue(o.detail.value)});let a=re(this);this.handleRegistry=a,a.add("tabs_set_value",o=>{$(e.id,H(o))&&r.api.setValue(o.value)}),a.add("tabs_value",o=>{$(e.id,H(o))&&n()&&this.pushEvent("tabs_value_response",{id:e.id,value:r.api.value})}),a.add("tabs_focused_value",o=>{$(e.id,H(o))&&n()&&this.pushEvent("tabs_focused_value_response",{id:e.id,value:r.api.focusedValue})})},updated(){var e;(e=this.tabs)==null||e.updateProps(h(h({id:this.el.id},Fh(this.el,"value","defaultValue")),ip(this.el)))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.tabs)==null||n.destroy()}}});var eS={};pe(eS,{Timer:()=>tM,parseTimerTranslations:()=>QP});function qF(e,t){let{state:n,send:r,computed:i,scope:a,prop:o}=e,s=o("translations"),l=n.matches("running"),c=n.matches("paused"),d=i("time"),u=i("formattedTime"),p=i("progressPercent");return{running:l,paused:c,time:d,formattedTime:u,progressPercent:p,start(){r({type:"START"})},pause(){r({type:"PAUSE"})},resume(){r({type:"RESUME"})},reset(){r({type:"RESET"})},restart(){r({type:"RESTART"})},getRootProps(){return t.element(h({id:GF(a)},Gr.root.attrs))},getAreaProps(){var g;return t.element(h({role:"timer",id:UF(a),"aria-label":(g=s.areaLabel)==null?void 0:g.call(s,d,u),"aria-atomic":!0},Gr.area.attrs))},getControlProps(){return t.element(h({},Gr.control.attrs))},getItemProps(g){let f=d[g.type];return t.element(y(h({},Gr.item.attrs),{"data-type":g.type,style:{"--value":f}}))},getItemLabelProps(g){return t.element(y(h({},Gr.itemLabel.attrs),{"data-type":g.type}))},getItemValueProps(g){return t.element(y(h({},Gr.itemValue.attrs),{"data-type":g.type}))},getSeparatorProps(){return t.element(h({"aria-hidden":!0},Gr.separator.attrs))},getActionTriggerProps(g){if(!XP.has(g.action))throw new Error(`[zag-js] Invalid action: ${g.action}. Must be one of: ${Array.from(XP).join(", ")}`);return t.button(y(h({},Gr.actionTrigger.attrs),{hidden:He(g.action,{start:()=>l||c,pause:()=>!l,reset:()=>!l&&!c,resume:()=>!c,restart:()=>!1}),type:"button",onClick(f){f.defaultPrevented||r({type:g.action.toUpperCase()})}}))}}}function KF(e){let t=Math.max(0,e),n=t%1e3,r=Math.floor(t/1e3)%60,i=Math.floor(t/(1e3*60))%60,a=Math.floor(t/(1e3*60*60))%24;return{days:Math.floor(t/(1e3*60*60*24)),hours:a,minutes:i,seconds:r,milliseconds:n}}function ZP(e,t,n){let r=n-t;return r===0?0:(e-t)/r}function Jo(e,t=2){return e.toString().padStart(t,"0")}function zF(e,t){return Math.floor(e/t)*t}function jF(e){let{days:t,hours:n,minutes:r,seconds:i}=e;return{days:Jo(t),hours:Jo(n),minutes:Jo(r),seconds:Jo(i),milliseconds:Jo(e.milliseconds,3)}}function YF(e){let{startMs:t,targetMs:n,countdown:r,interval:i}=e;if(i!=null&&(typeof i!="number"||i<=0))throw new Error(`[timer] Invalid interval: ${i}. Must be a positive number.`);if(t!=null&&(typeof t!="number"||t<0))throw new Error(`[timer] Invalid startMs: ${t}. Must be a non-negative number.`);if(n!=null&&(typeof n!="number"||n<0))throw new Error(`[timer] Invalid targetMs: ${n}. Must be a non-negative number.`);if(r&&t!=null&&n!=null&&t<=n)throw new Error(`[timer] Invalid countdown configuration: startMs (${t}) must be greater than targetMs (${n}).`);if(!r&&t!=null&&n!=null&&t>=n)throw new Error(`[timer] Invalid stopwatch configuration: startMs (${t}) must be less than targetMs (${n}).`);if(r&&n==null&&t!=null&&t<=0)throw new Error(`[timer] Invalid countdown configuration: startMs (${t}) must be greater than 0 when no targetMs is provided.`)}function XF(e){let t=n=>{if(n>2)return n;let r=e.length-n;return n<3&&e[n]===0&&r>2?t(n+1):n};return t(0)}function ZF(e,t){let n=["days","hours","minutes","seconds"],r=[t.days,t.hours,t.minutes,t.seconds].map(Number),i=Ie(e,"segments"),a=e.dataset.countdown==="true",o=e.dataset.collapseLeadingZeros;if(i&&i.length>0)return n.map(s=>!i.includes(s));if(o==="false")return[!1,!1,!1,!1];if(o==="true"||o!=="false"&&a){let s=XF(r);return n.map((l,c)=>c{let s=e.querySelector(`[data-timer-segment][data-type="${a}"]`);s&&(n[o]?s.setAttribute("hidden",""):s.removeAttribute("hidden"));let l=e.querySelector(`[data-scope="timer"][data-part="item"][data-type="${a}"]`);l&&(n[o]?(l.setAttribute("hidden",""),l.setAttribute("aria-hidden","true")):(l.removeAttribute("hidden"),l.setAttribute("aria-hidden","false")))});for(let a=0;a<3;a++){let o=`timer:${i}:sep:${a}`,s=e.querySelector(`[id="${CSS.escape(o)}"]`);s&&(n[a]?s.setAttribute("hidden",""):s.removeAttribute("hidden"))}}function eM(e){return{running:e.running,paused:e.paused,progressPercent:e.progressPercent,time:e.time,formattedTime:e.formattedTime}}function QP(e){let t=e.dataset.translation;if(t)try{let n=JSON.parse(t);if(typeof n.areaLabel=="string"&&n.areaLabel.length>0){let r=n.areaLabel;return{areaLabel:()=>r}}}catch(n){return}}function JP(e,t,n){return{id:e.id,countdown:O(e,"countdown"),startMs:U(e,"startMs"),targetMs:U(e,"targetMs"),autoStart:O(e,"autoStart"),interval:U(e,"interval"),dir:q(e),orientation:V(e,"orientation"),translations:QP(e),onTick:r=>{let i=V(e,"onTick");i&&n()&&t(i,{value:r.value,time:r.time,formattedTime:r.formattedTime,id:e.id});let a=V(e,"onTickClient");a&&e.dispatchEvent(new CustomEvent(a,{bubbles:!0,detail:{id:e.id,value:r.value,time:r.time,formattedTime:r.formattedTime}}))},onComplete:()=>{let r=V(e,"onComplete");r&&n()&&t(r,{id:e.id});let i=V(e,"onCompleteClient");i&&e.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:{id:e.id}}))}}}var BF,Gr,GF,UF,XP,WF,QF,tM,tS=ee(()=>{"use strict";Eo();fl();Bt();Ve();be();oe();BF=z("timer").parts("root","area","control","item","itemValue","itemLabel","actionTrigger","separator"),Gr=BF.build(),GF=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`timer:${e.id}:root`},UF=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.area)!=null?n:`timer:${e.id}:area`},XP=new Set(["start","pause","resume","reset","restart"]);WF=te({props({props:e}){return YF(e),y(h({interval:1e3,startMs:0},e),{translations:h({areaLabel:(t,n)=>`${t.days} days ${n.hours}:${n.minutes}:${n.seconds}`},e.translations)})},initialState({prop:e}){return e("autoStart")?"running":"idle"},context({prop:e,bindable:t}){return{currentMs:t(()=>({defaultValue:e("startMs")}))}},watch({track:e,send:t,prop:n}){e([()=>n("startMs")],()=>{t({type:"RESTART"})})},on:{RESTART:{target:"running:temp",actions:["resetTime"]}},computed:{time:({context:e})=>KF(e.get("currentMs")),formattedTime:({computed:e})=>jF(e("time")),progressPercent:Vn(({context:e,prop:t})=>[e.get("currentMs"),t("targetMs"),t("startMs"),t("countdown")],([e,t=0,n,r])=>{let i=r?ZP(e,t,n):ZP(e,n,t);return Ae(i,0,1)})},states:{idle:{on:{START:{target:"running"},RESET:{actions:["resetTime"]}}},"running:temp":{effects:["waitForNextTick"],on:{CONTINUE:{target:"running"}}},running:{effects:["keepTicking"],on:{PAUSE:{target:"paused"},TICK:[{target:"idle",guard:"hasReachedTarget",actions:["invokeOnComplete"]},{actions:["updateTime","invokeOnTick"]}],RESET:{actions:["resetTime"]}}},paused:{on:{RESUME:{target:"running"},RESET:{target:"idle",actions:["resetTime"]}}}},implementations:{effects:{keepTicking({prop:e,send:t}){return Kf(({deltaMs:n})=>{t({type:"TICK",deltaMs:n})},e("interval"))},waitForNextTick({send:e}){return Tr(()=>{e({type:"CONTINUE"})},0)}},actions:{updateTime({context:e,prop:t,event:n}){let r=t("countdown")?-1:1,i=zF(n.deltaMs,t("interval"));e.set("currentMs",a=>{let o=a+r*i,s=t("targetMs");return s==null&&t("countdown")&&(s=0),t("countdown")&&s!=null?Math.max(o,s):!t("countdown")&&s!=null?Math.min(o,s):o})},resetTime({context:e,prop:t}){var r;let n=t("targetMs");n==null&&t("countdown")&&(n=0),e.set("currentMs",(r=t("startMs"))!=null?r:0)},invokeOnTick({context:e,prop:t,computed:n}){var r;(r=t("onTick"))==null||r({value:e.get("currentMs"),time:n("time"),formattedTime:n("formattedTime")})},invokeOnComplete({prop:e}){var t;(t=e("onComplete"))==null||t()}},guards:{hasReachedTarget:({context:e,prop:t})=>{let n=t("targetMs");if(n==null&&t("countdown")&&(n=0),n==null)return!1;let r=e.get("currentMs");return t("countdown")?r<=n:r>=n}}}});QF=class extends X{constructor(){super(...arguments);Q(this,"init",()=>{this.machine.subscribe(()=>{this.api=this.initApi(),this.render()});try{this.machine.start(),this.api=this.initApi(),this.render()}finally{this.el.removeAttribute("data-loading")}})}initMachine(t){return new Y(WF,t)}initApi(){return this.zagConnect(qF)}render(){var o;let t=(o=this.el.querySelector('[data-scope="timer"][data-part="root"]'))!=null?o:this.el;this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="timer"][data-part="area"]');n&&this.spreadProps(n,this.api.getAreaProps());let r=this.el.querySelector('[data-scope="timer"][data-part="control"]');r&&this.spreadProps(r,this.api.getControlProps()),["days","hours","minutes","seconds"].forEach(s=>{let l=this.el.querySelector(`[data-scope="timer"][data-part="item"][data-type="${s}"]`);l&&this.spreadProps(l,this.api.getItemProps({type:s}));let c=this.el.querySelector(`[data-scope="timer"][data-part="item-label"][data-type="${s}"]`);c&&this.spreadProps(c,this.api.getItemLabelProps({type:s}))}),this.el.querySelectorAll('[data-scope="timer"][data-part="separator"]').forEach(s=>{this.spreadProps(s,this.api.getSeparatorProps())}),["start","pause","resume","reset"].forEach(s=>{let l=this.el.querySelector(`[data-scope="timer"][data-part="action-trigger"][data-action="${s}"]`);l&&this.spreadProps(l,this.api.getActionTriggerProps({action:s}))}),JF(this.el,this.api)}};tM={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=new QF(e,JP(e,t,n));r.init(),this.timer=r;let i=s=>{let l=eM(r.api);Ge({respondTo:s,canPushServer:n(),pushEvent:t,serverEventName:"timer_state_response",serverPayload:h({id:e.id},l),el:e,domEventName:"timer-state",domDetail:h({id:e.id},l)})},a=ie(e);this.domRegistry=a,a.add("corex:timer:start",()=>{r.api.start()}),a.add("corex:timer:pause",()=>{r.api.pause()}),a.add("corex:timer:resume",()=>{r.api.resume()}),a.add("corex:timer:reset",()=>{r.api.reset()}),a.add("corex:timer:restart",()=>{r.api.restart()}),a.add("corex:timer:state",s=>{i(de(s.detail))});let o=re(this);this.handleRegistry=o,o.add("timer_start",s=>{$(e.id,H(s))&&r.api.start()}),o.add("timer_pause",s=>{$(e.id,H(s))&&r.api.pause()}),o.add("timer_resume",s=>{$(e.id,H(s))&&r.api.resume()}),o.add("timer_reset",s=>{$(e.id,H(s))&&r.api.reset()}),o.add("timer_restart",s=>{$(e.id,H(s))&&r.api.restart()}),o.add("timer_state",s=>{$(e.id,H(s))&&i(de(s))})},updated(){var r;let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket);(r=this.timer)==null||r.updateProps(JP(e,t,n))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.timer)==null||n.destroy()}}});var hS={};pe(hS,{Toast:()=>xM,parseActionSpec:()=>lp,parseSingleExecJsEffect:()=>pS});function ap(e,t){var n;return(n=e!=null?e:oS[t])!=null?n:oS.DEFAULT}function oM(e,t){var m;let{prop:n,computed:r,context:i}=e,{offsets:a,gap:o}=n("store").attrs,s=i.get("heights"),l=aM(a),c=n("dir")==="rtl",d=t.replace("-start",c?"-right":"-left").replace("-end",c?"-left":"-right"),u=d.includes("right"),p=d.includes("left"),g={position:"fixed",pointerEvents:r("count")>0?void 0:"none",display:"flex",flexDirection:"column","--gap":`${o}px`,"--first-height":`${((m=s[0])==null?void 0:m.height)||0}px`,"--viewport-offset-left":l.left,"--viewport-offset-right":l.right,"--viewport-offset-top":l.top,"--viewport-offset-bottom":l.bottom,zIndex:Os},f="center";if(u&&(f="flex-end"),p&&(f="flex-start"),g.alignItems=f,d.includes("top")){let S=l.top;g.top=`max(env(safe-area-inset-top, 0px), ${S})`}if(d.includes("bottom")){let S=l.bottom;g.bottom=`max(env(safe-area-inset-bottom, 0px), ${S})`}if(!d.includes("left")){let S=l.right;g.insetInlineEnd=`calc(env(safe-area-inset-right, 0px) + ${S})`}if(!d.includes("right")){let S=l.left;g.insetInlineStart=`calc(env(safe-area-inset-left, 0px) + ${S})`}return g}function sM(e,t){let{prop:n,context:r,computed:i}=e,a=n("parent"),o=a.computed("placement"),{gap:s}=a.prop("store").attrs,[l]=o.split("-"),c=r.get("mounted"),d=r.get("remainingTime"),u=i("height"),p=i("frontmost"),g=!p,f=!n("stacked"),m=n("stacked"),T=n("type")==="loading"?Number.MAX_SAFE_INTEGER:d,w=i("heightIndex")*s+i("heightBefore"),I={position:"absolute",pointerEvents:"auto","--opacity":"0","--remove-delay":`${n("removeDelay")}ms`,"--duration":`${T}ms`,"--initial-height":`${u}px`,"--offset":`${w}px`,"--index":n("index"),"--z-index":i("zIndex"),"--lift-amount":"calc(var(--lift) * var(--gap))","--y":"100%","--x":"0"},P=v=>Object.assign(I,v);return l==="top"?P({top:"0","--sign":"-1","--y":"-100%","--lift":"1"}):l==="bottom"&&P({bottom:"0","--sign":"1","--y":"100%","--lift":"-1"}),c&&(P({"--y":"0","--opacity":"1"}),m&&P({"--y":"calc(var(--lift) * var(--offset))","--height":"var(--initial-height)"})),t||P({"--opacity":"0",pointerEvents:"none"}),g&&f&&(P({"--base-scale":"var(--index) * 0.05 + 1","--y":"calc(var(--lift-amount) * var(--index))","--scale":"calc(-1 * var(--base-scale))","--height":"var(--first-height)"}),t||P({"--y":"calc(var(--sign) * 40%)"})),g&&m&&!t&&P({"--y":"calc(var(--lift) * var(--offset) + var(--lift) * -100%)"}),p&&!t&&P({"--y":"calc(var(--lift) * -100%)"}),I}function lM(e,t){let{computed:n}=e,r={position:"absolute",inset:"0",scale:"1 2",pointerEvents:t?"none":"auto"},i=a=>Object.assign(r,a);return n("frontmost")&&!t&&i({height:"calc(var(--initial-height) + 80%)"}),r}function cM(){return{position:"absolute",left:"0",height:"calc(var(--gap) + 2px)",bottom:"100%",width:"100%"}}function dM(e,t){let{context:n,prop:r,send:i,refs:a,computed:o}=e;return{getCount(){return n.get("toasts").length},getToasts(){return n.get("toasts")},getGroupProps(s={}){let{label:l="Notifications"}=s,{hotkey:c}=r("store").attrs,d=c.join("+").replace(/Key/g,"").replace(/Digit/g,""),u=o("placement"),[p,g="center"]=u.split("-");return t.element(y(h({},ka.group.attrs),{dir:r("dir"),tabIndex:-1,role:"region","aria-label":`${l}, ${u} (${d})`,id:rM(u),"data-placement":u,"data-side":p,"data-align":g,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",style:oM(e,u),onMouseEnter(){a.get("ignoreMouseTimer").isActive()||i({type:"REGION.POINTER_ENTER",placement:u})},onMouseMove(){a.get("ignoreMouseTimer").isActive()||i({type:"REGION.POINTER_ENTER",placement:u})},onMouseLeave(){a.get("ignoreMouseTimer").isActive()||i({type:"REGION.POINTER_LEAVE",placement:u})},onFocus(f){i({type:"REGION.FOCUS",target:f.relatedTarget})},onBlur(f){a.get("isFocusWithin")&&!ge(f.currentTarget,f.relatedTarget)&&queueMicrotask(()=>i({type:"REGION.BLUR"}))}}))},subscribe(s){return r("store").subscribe(()=>s(n.get("toasts")))}}}function fM(e,t){let{state:n,send:r,prop:i,scope:a,context:o,computed:s}=e,l=i("translations"),c=n.hasTag("visible"),d=n.hasTag("paused"),u=o.get("mounted"),p=s("frontmost"),g=i("parent").computed("placement"),f=i("type"),m=i("stacked"),S=i("title"),T=i("description"),w=i("action"),[I,P="center"]=g.split("-");return{type:f,title:S,description:T,placement:g,visible:c,paused:d,closable:!!i("closable"),pause(){r({type:"PAUSE"})},resume(){r({type:"RESUME"})},dismiss(){r({type:"DISMISS",src:"programmatic"})},getRootProps(){return t.element(y(h({},ka.root.attrs),{dir:i("dir"),id:dS(a),"data-state":c?"open":"closed","data-type":f,"data-placement":g,"data-align":P,"data-side":I,"data-mounted":b(u),"data-paused":b(d),"data-first":b(p),"data-sibling":b(!p),"data-stack":b(m),"data-overlap":b(!m),role:"status","aria-atomic":"true","aria-describedby":T?aS(a):void 0,"aria-labelledby":S?iS(a):void 0,tabIndex:0,style:sM(e,c),onKeyDown(v){v.defaultPrevented||v.key=="Escape"&&(r({type:"DISMISS",src:"keyboard"}),v.preventDefault())}}))},getGhostBeforeProps(){return t.element({"data-ghost":"before",style:lM(e,c)})},getGhostAfterProps(){return t.element({"data-ghost":"after",style:cM()})},getTitleProps(){return t.element(y(h({},ka.title.attrs),{id:iS(a)}))},getDescriptionProps(){return t.element(y(h({},ka.description.attrs),{id:aS(a)}))},getActionTriggerProps(){return t.button(y(h({},ka.actionTrigger.attrs),{type:"button",onClick(v){var E;v.defaultPrevented||((E=w==null?void 0:w.onClick)==null||E.call(w),r({type:"DISMISS",src:"user"}))}}))},getCloseTriggerProps(){return t.button(y(h({id:iM(a)},ka.closeTrigger.attrs),{type:"button","aria-label":l==null?void 0:l.closeTriggerLabel,onClick(v){v.defaultPrevented||r({type:"DISMISS",src:"user"})}}))}}}function sS(e,t){let{id:n,height:r}=t;e.context.set("heights",i=>i.find(o=>o.id===n)?i.map(o=>o.id===n?y(h({},o),{height:r}):o):[{id:n,height:r},...i])}function PM(e={}){let t=yM(e,{placement:"bottom",overlap:!1,max:24,gap:16,offsets:"1rem",hotkey:["altKey","KeyT"],removeDelay:200,pauseOnPageIdle:!0}),n=[],r=[],i=new Set,a=[],o=k=>(n.push(k),()=>{let L=n.indexOf(k);n.splice(L,1)}),s=k=>(n.forEach(L=>L(k)),k),l=k=>{if(r.length>=t.max){a.push(k);return}s(k),r.unshift(k)},c=()=>{for(a=EM(a);a.length>0&&r.length{var J,ue;let L=(J=k.id)!=null?J:`toast:${Ua()}`,K=r.find(Z=>Z.id===L);if(i.has(L)&&i.delete(L),K)r=r.map(Z=>Z.id===L?s(y(h(h({},Z),k),{id:L})):Z);else{let Z=y(h({id:L,duration:t.duration,removeDelay:t.removeDelay,type:uS},k),{stacked:!t.overlap,gap:t.gap}),ce=(ue=Z.priority)!=null?ue:op(Z.type,!!Z.action);l(y(h({},Z),{priority:ce}))}return L},u=k=>(i.add(k),k?(n.forEach(L=>L({id:k,dismiss:!0})),r=r.filter(L=>L.id!==k),c()):(r.forEach(L=>{n.forEach(K=>K({id:L.id,dismiss:!0}))}),r=[],a=[]),k);return{attrs:t,subscribe:o,create:d,update:(k,L)=>d(h({id:k},L)),remove:u,dismiss:k=>{k!=null?r=r.map(L=>L.id===k?s(y(h({},L),{message:"DISMISS"})):L):r=r.map(L=>s(y(h({},L),{message:"DISMISS"})))},error:k=>d(y(h({},k),{type:"error"})),success:k=>d(y(h({},k),{type:"success"})),info:k=>d(y(h({},k),{type:"info"})),warning:k=>d(y(h({},k),{type:"warning"})),loading:k=>d(y(h({},k),{type:"loading"})),getVisibleToasts:()=>r.filter(k=>!i.has(k.id)),getCount:()=>r.length,promise:(k,L,K={})=>{if(!L||!L.loading){It("[zag-js > toast] toaster.promise() requires at least a 'loading' option to be specified");return}let J=d(y(h(h({},K),L.loading),{promise:k,type:"loading"})),ue=!0,Z,ce=Fn(k).then(le=>Ke(null,null,function*(){var De;if(Z=["resolve",le],SM(le)&&!le.ok){ue=!1;let Fe=Fn(L.error,`HTTP Error! status: ${le.status}`);d(y(h(h({},K),Fe),{id:J,type:"error"}))}else if(L.success!==void 0){ue=!1;let Fe=Fn(L.success,le);d(y(h(h({},K),Fe),{id:J,type:(De=Fe.type)!=null?De:"success"}))}})).catch(le=>Ke(null,null,function*(){if(Z=["reject",le],L.error!==void 0){ue=!1;let De=Fn(L.error,le);d(y(h(h({},K),De),{id:J,type:"error"}))}})).finally(()=>{var le;ue&&u(J),(le=L.finally)==null||le.call(L)});return{id:J,unwrap:()=>new Promise((le,De)=>ce.then(()=>Z[0]==="reject"?De(Z[1]):le(Z[1])).catch(De))}},pause:k=>{k!=null?r=r.map(L=>L.id===k?s(y(h({},L),{message:"PAUSE"})):L):r=r.map(L=>s(y(h({},L),{message:"PAUSE"})))},resume:k=>{k!=null?r=r.map(L=>L.id===k?s(y(h({},L),{message:"RESUME"})):L):r=r.map(L=>s(y(h({},L),{message:"RESUME"})))},isVisible:k=>!i.has(k)&&!!r.find(L=>L.id===k),isDismissed:k=>i.has(k),expand:()=>{r=r.map(k=>s(y(h({},k),{stacked:!0})))},collapse:()=>{r=r.map(k=>s(y(h({},k),{stacked:!1})))}}}function IM(e){if(e==null||typeof e!="object")return[];let t=e.className;return typeof t!="string"?[]:t.trim().split(/\s+/).filter(Boolean)}function wM(e,t){var a,o,s;let n=(a=t==null?void 0:t.id)!=null?a:e.id,r=(s=t==null?void 0:t.store)!=null?s:PM({placement:(o=t==null?void 0:t.placement)!=null?o:"bottom",overlap:t==null?void 0:t.overlap,max:t==null?void 0:t.max,gap:t==null?void 0:t.gap,offsets:t==null?void 0:t.offsets,pauseOnPageIdle:t==null?void 0:t.pauseOnPageIdle}),i=new CM(e,{id:n,store:r,dir:q(e)});return i.init(),sp.set(n,i),Ac.set(n,r),e.dataset.toastGroup="true",e.dataset.toastGroupId=n,{group:i,store:r}}function OM(e){let t=sp.get(e);if(!t)return;let n=t.el;t.destroy(),sp.delete(e),Ac.delete(e),delete n.dataset.toastGroup,delete n.dataset.toastGroupId}function Ai(e){if(e)return Ac.get(e);let t=document.querySelector("[data-toast-group]");if(!t)return;let n=t.dataset.toastGroupId||t.id;return n?Ac.get(n):void 0}function gS(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function pS(e){let t=gS(e);if(t.kind!=="exec_js")return null;let n=t.encoded;return typeof n!="string"||n.length===0?null:n}function lp(e){let t=gS(e),n=t.label;if(typeof n!="string"||n.length===0)return null;let r=t.effects;if(!Array.isArray(r)||r.length!==1)return null;let i=pS(r[0]);if(i==null)return null;let a={label:n,encoded:i},o=t.class;return typeof o=="string"&&o.trim()&&(a.className=o.trim()),a}function cS(e,t){let n={label:e.label,onClick:()=>{t.execJs(e.encoded)}};return e.className&&(n.className=e.className),n}function AM(e){return{pushEvent:(t,n)=>{e.pushEvent(t,n!=null?n:{})},execJs:t=>{e.js().exec(t)},redirectCtx:{liveSocket:e.liveSocket}}}var nM,ka,rM,nS,dS,rS,iS,aS,iM,oS,aM,uM,gM,pM,hM,mM,vM,yM,bM,uS,op,EM,SM,lS,sp,Ac,TM,CM,VM,xM,fS=ee(()=>{"use strict";fl();Or();on();oe();nM=z("toast").parts("group","root","title","description","actionTrigger","closeTrigger"),ka=nM.build(),rM=e=>`toast-group:${e}`,nS=(e,t)=>e.getById(`toast-group:${t}`),dS=e=>`toast:${e.id}`,rS=e=>e.getById(dS(e)),iS=e=>`toast:${e.id}:title`,aS=e=>`toast:${e.id}:description`,iM=e=>`toast${e.id}:close`,oS={info:5e3,error:5e3,success:2e3,loading:1/0,warning:5e3,DEFAULT:5e3};aM=e=>typeof e=="string"?{left:e,right:e,bottom:e,top:e}:e;({guards:uM,createMachine:gM}=Mt()),{and:pM}=uM,hM=gM({props({props:e}){return y(h({dir:"ltr",id:Ua()},e),{store:e.store})},initialState({prop:e}){return e("store").attrs.overlap?"overlap":"stack"},refs(){return{lastFocusedEl:null,isFocusWithin:!1,isPointerWithin:!1,ignoreMouseTimer:ld.create(),dismissableCleanup:void 0}},context({bindable:e}){return{toasts:e(()=>({defaultValue:[],sync:!0,hash:t=>t.map(n=>n.id).join(",")})),heights:e(()=>({defaultValue:[],sync:!0}))}},computed:{count:({context:e})=>e.get("toasts").length,overlap:({prop:e})=>e("store").attrs.overlap,placement:({prop:e})=>e("store").attrs.placement},effects:["subscribeToStore","trackDocumentVisibility","trackHotKeyPress"],watch({track:e,context:t,action:n}){e([()=>t.hash("toasts")],()=>{queueMicrotask(()=>{n(["collapsedIfEmpty","setDismissableBranch"])})})},exit:["clearDismissableBranch","clearLastFocusedEl","clearMouseEventTimer"],on:{"DOC.HOTKEY":{actions:["focusRegionEl"]},"REGION.BLUR":[{guard:pM("isOverlapping","isPointerOut"),target:"overlap",actions:["collapseToasts","resumeToasts","restoreFocusIfPointerOut"]},{guard:"isPointerOut",target:"stack",actions:["resumeToasts","restoreFocusIfPointerOut"]},{actions:["clearFocusWithin"]}],"TOAST.REMOVE":{actions:["removeToast","removeHeight","ignoreMouseEventsTemporarily"]},"TOAST.PAUSE":{actions:["pauseToasts"]}},states:{stack:{on:{"REGION.POINTER_LEAVE":[{guard:"isOverlapping",target:"overlap",actions:["clearPointerWithin","resumeToasts","collapseToasts"]},{actions:["clearPointerWithin","resumeToasts"]}],"REGION.OVERLAP":{target:"overlap",actions:["collapseToasts"]},"REGION.FOCUS":{actions:["setLastFocusedEl","pauseToasts"]},"REGION.POINTER_ENTER":{actions:["setPointerWithin","pauseToasts"]}}},overlap:{on:{"REGION.STACK":{target:"stack",actions:["expandToasts"]},"REGION.POINTER_ENTER":{target:"stack",actions:["setPointerWithin","pauseToasts","expandToasts"]},"REGION.FOCUS":{target:"stack",actions:["setLastFocusedEl","pauseToasts","expandToasts"]}}}},implementations:{guards:{isOverlapping:({computed:e})=>e("overlap"),isPointerOut:({refs:e})=>!e.get("isPointerWithin")},effects:{subscribeToStore({context:e,prop:t}){let n=t("store");return e.set("toasts",n.getVisibleToasts()),n.subscribe(r=>{if(r.dismiss){e.set("toasts",i=>i.filter(a=>a.id!==r.id));return}e.set("toasts",i=>{let a=i.findIndex(o=>o.id===r.id);return a!==-1?[...i.slice(0,a),h(h({},i[a]),r),...i.slice(a+1)]:[r,...i]})})},trackHotKeyPress({prop:e,send:t}){return ae(document,"keydown",r=>{let{hotkey:i}=e("store").attrs;i.every(o=>r[o]||r.code===o)&&t({type:"DOC.HOTKEY"})},{capture:!0})},trackDocumentVisibility({prop:e,send:t,scope:n}){let{pauseOnPageIdle:r}=e("store").attrs;if(!r)return;let i=n.getDoc();return ae(i,"visibilitychange",()=>{let a=i.visibilityState==="hidden";t({type:a?"PAUSE_ALL":"RESUME_ALL"})})}},actions:{setDismissableBranch({refs:e,context:t,computed:n,scope:r}){var c;let i=t.get("toasts"),a=n("placement"),o=i.length>0;if(!o){(c=e.get("dismissableCleanup"))==null||c();return}if(o&&e.get("dismissableCleanup"))return;let l=Rm(()=>nS(r,a),{defer:!0});e.set("dismissableCleanup",l)},clearDismissableBranch({refs:e}){var t;(t=e.get("dismissableCleanup"))==null||t()},focusRegionEl({scope:e,computed:t}){queueMicrotask(()=>{var n;(n=nS(e,t("placement")))==null||n.focus()})},pauseToasts({prop:e}){e("store").pause()},resumeToasts({prop:e}){e("store").resume()},expandToasts({prop:e}){e("store").expand()},collapseToasts({prop:e}){e("store").collapse()},removeToast({prop:e,event:t}){e("store").remove(t.id)},removeHeight({event:e,context:t}){(e==null?void 0:e.id)!=null&&queueMicrotask(()=>{t.set("heights",n=>n.filter(r=>r.id!==e.id))})},collapsedIfEmpty({send:e,computed:t}){!t("overlap")||t("count")>1||e({type:"REGION.OVERLAP"})},setLastFocusedEl({refs:e,event:t}){e.get("isFocusWithin")||!t.target||(e.set("isFocusWithin",!0),e.set("lastFocusedEl",t.target))},restoreFocusIfPointerOut({refs:e}){var t;!e.get("lastFocusedEl")||e.get("isPointerWithin")||((t=e.get("lastFocusedEl"))==null||t.focus({preventScroll:!0}),e.set("lastFocusedEl",null),e.set("isFocusWithin",!1))},setPointerWithin({refs:e}){e.set("isPointerWithin",!0)},clearPointerWithin({refs:e}){var t;e.set("isPointerWithin",!1),e.get("lastFocusedEl")&&!e.get("isFocusWithin")&&((t=e.get("lastFocusedEl"))==null||t.focus({preventScroll:!0}),e.set("lastFocusedEl",null))},clearFocusWithin({refs:e}){e.set("isFocusWithin",!1)},clearLastFocusedEl({refs:e}){var t;e.get("lastFocusedEl")&&((t=e.get("lastFocusedEl"))==null||t.focus({preventScroll:!0}),e.set("lastFocusedEl",null),e.set("isFocusWithin",!1))},ignoreMouseEventsTemporarily({refs:e}){e.get("ignoreMouseTimer").request()},clearMouseEventTimer({refs:e}){e.get("ignoreMouseTimer").cancel()}}}});({not:mM}=we()),vM=te({props({props:e}){return gn(e,["id","type","parent","removeDelay"],"toast"),y(h({closable:!0},e),{translations:h({closeTriggerLabel:"Dismiss notification"},e.translations),duration:ap(e.duration,e.type)})},initialState({prop:e}){return e("type")==="loading"||e("duration")===1/0?"visible:persist":"visible"},context({prop:e,bindable:t}){return{remainingTime:t(()=>({defaultValue:ap(e("duration"),e("type"))})),createdAt:t(()=>({defaultValue:Date.now()})),mounted:t(()=>({defaultValue:!1})),initialHeight:t(()=>({defaultValue:0}))}},refs(){return{closeTimerStartTime:Date.now(),lastCloseStartTimerStartTime:0}},computed:{zIndex:({prop:e})=>{let t=e("parent").context.get("toasts"),n=t.findIndex(r=>r.id===e("id"));return t.length-n},height:({prop:e})=>{var r;let n=e("parent").context.get("heights").find(i=>i.id===e("id"));return(r=n==null?void 0:n.height)!=null?r:0},heightIndex:({prop:e})=>e("parent").context.get("heights").findIndex(n=>n.id===e("id")),frontmost:({prop:e})=>e("index")===0,heightBefore:({prop:e})=>{let t=e("parent").context.get("heights"),n=t.findIndex(r=>r.id===e("id"));return t.reduce((r,i,a)=>a>=n?r:r+i.height,0)},shouldPersist:({prop:e})=>e("type")==="loading"||e("duration")===1/0},watch({track:e,prop:t,send:n}){e([()=>t("message")],()=>{let r=t("message");r&&n({type:r,src:"programmatic"})}),e([()=>t("type"),()=>t("duration")],()=>{n({type:"UPDATE"})})},on:{UPDATE:[{guard:"shouldPersist",target:"visible:persist",actions:["resetCloseTimer"]},{target:"visible:updating",actions:["resetCloseTimer"]}],MEASURE:{actions:["measureHeight"]}},entry:["setMounted","measureHeight","invokeOnVisible"],effects:["trackHeight"],states:{"visible:updating":{tags:["visible","updating"],effects:["waitForNextTick"],on:{SHOW:{target:"visible"}}},"visible:persist":{tags:["visible","paused"],on:{RESUME:{guard:mM("isLoadingType"),target:"visible",actions:["setCloseTimer"]},DISMISS:{target:"dismissing"}}},visible:{tags:["visible"],effects:["waitForDuration"],on:{DISMISS:{target:"dismissing"},PAUSE:{target:"visible:persist",actions:["syncRemainingTime"]}}},dismissing:{entry:["invokeOnDismiss"],effects:["waitForRemoveDelay"],on:{REMOVE:{target:"unmounted",actions:["notifyParentToRemove"]}}},unmounted:{entry:["invokeOnUnmount"]}},implementations:{effects:{waitForRemoveDelay({prop:e,send:t}){return Tr(()=>{t({type:"REMOVE",src:"timer"})},e("removeDelay"))},waitForDuration({send:e,context:t,computed:n}){if(!n("shouldPersist"))return Tr(()=>{e({type:"DISMISS",src:"timer"})},t.get("remainingTime"))},waitForNextTick({send:e}){return Tr(()=>{e({type:"SHOW",src:"timer"})},0)},trackHeight({scope:e,prop:t}){let n;return B(()=>{let r=rS(e);if(!r)return;let i=()=>{let s=r.style.height;r.style.height="auto";let l=r.getBoundingClientRect().height;r.style.height=s;let c={id:t("id"),height:l};sS(t("parent"),c)},a=e.getWin(),o=new a.MutationObserver(i);o.observe(r,{childList:!0,subtree:!0,characterData:!0}),n=()=>o.disconnect()}),()=>n==null?void 0:n()}},guards:{isLoadingType:({prop:e})=>e("type")==="loading",shouldPersist:({computed:e})=>e("shouldPersist")},actions:{setMounted({context:e}){B(()=>{e.set("mounted",!0)})},measureHeight({scope:e,prop:t,context:n}){queueMicrotask(()=>{let r=rS(e);if(!r)return;let i=r.style.height;r.style.height="auto";let a=r.getBoundingClientRect().height;r.style.height=i,n.set("initialHeight",a);let o={id:t("id"),height:a};sS(t("parent"),o)})},setCloseTimer({refs:e}){e.set("closeTimerStartTime",Date.now())},resetCloseTimer({context:e,refs:t,prop:n}){t.set("closeTimerStartTime",Date.now()),e.set("remainingTime",ap(n("duration"),n("type")))},syncRemainingTime({context:e,refs:t}){e.set("remainingTime",n=>{let r=t.get("closeTimerStartTime"),i=Date.now()-r;return t.set("lastCloseStartTimerStartTime",Date.now()),n-i})},notifyParentToRemove({prop:e}){e("parent").send({type:"TOAST.REMOVE",id:e("id")})},invokeOnDismiss({prop:e,event:t}){var n;(n=e("onStatusChange"))==null||n({status:"dismissing",src:t.src})},invokeOnUnmount({prop:e}){var t;(t=e("onStatusChange"))==null||t({status:"unmounted"})},invokeOnVisible({prop:e}){var t;(t=e("onStatusChange"))==null||t({status:"visible"})}}}});yM=(e,t)=>h(h({},t),_n(e)),bM={error:[1,2],warning:[3,6],loading:[4,5],success:[5,7],info:[6,8]},uS="info",op=(e,t)=>{let[n,r]=bM[e!=null?e:uS];return t?n:r},EM=e=>e.sort((t,n)=>{var a,o;let r=(a=t.priority)!=null?a:op(t.type,!!t.action),i=(o=n.priority)!=null?o:op(n.type,!!n.action);return r-i});SM=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",lS={connect:dM,machine:hM};sp=new Map,Ac=new Map,TM=class extends X{constructor(t,n){var r,i;super(t,n);Q(this,"parts");Q(this,"latestProps");Q(this,"hadAction",!1);Q(this,"duration");Q(this,"showLoading");Q(this,"updateProps",t=>{Object.assign(this.latestProps,t),super.updateProps(t)});Q(this,"destroy",()=>{this.machine.stop(),this.el.remove()});this.latestProps=n,this.duration=n.duration,this.showLoading=((r=n.meta)==null?void 0:r.loading)===!0,this.hadAction=!!((i=n.action)!=null&&i.label),this.el.setAttribute("data-scope","toast"),this.el.setAttribute("data-part","root"),this.el.classList.add("toast-item"),this.el.innerHTML=`
@@ -28,4 +28,4 @@ ${g}`)}).finally(()=>{n.set("transforming",!1)})):c(s)},removeFile({context:e,ev - `,this.parts={title:this.el.querySelector('[data-part="title"]'),description:this.el.querySelector('[data-part="description"]'),close:this.el.querySelector('[data-part="close-trigger"]'),action:this.el.querySelector('[data-part="action-trigger"]'),ghostBefore:this.el.querySelector('[data-part="ghost-before"]'),ghostAfter:this.el.querySelector('[data-part="ghost-after"]'),progressbar:this.el.querySelector('[data-part="progressbar"]'),loadingSpinner:this.el.querySelector('[data-part="loading-spinner"]')}}initMachine(t){return new Y(vM,t)}initApi(){return this.zagConnect(fM)}render(){var c,d,g,p,u;this.spreadProps(this.el,this.api.getRootProps()),this.spreadProps(this.parts.close,this.api.getCloseTriggerProps()),this.spreadProps(this.parts.ghostBefore,this.api.getGhostBeforeProps()),this.spreadProps(this.parts.ghostAfter,this.api.getGhostAfterProps());let t=this.el.closest('[phx-hook="Toast"]'),n=t==null?void 0:t.querySelector("[data-loading-icon-template]"),r=t==null?void 0:t.querySelector("[data-close-icon-template]"),i=n==null?void 0:n.innerHTML,a=r==null?void 0:r.innerHTML;a?this.parts.close.innerHTML!==a&&(this.parts.close.innerHTML=a):this.parts.close.innerHTML||(this.parts.close.innerHTML="\xD7"),this.parts.title.textContent!==this.api.title&&(this.parts.title.textContent=(c=this.api.title)!=null?c:""),this.parts.description.textContent!==this.api.description&&(this.parts.description.textContent=(d=this.api.description)!=null?d:""),this.spreadProps(this.parts.title,this.api.getTitleProps()),this.spreadProps(this.parts.description,this.api.getDescriptionProps());let o=!!((g=this.latestProps.action)!=null&&g.label);if(this.hadAction&&!o){let f=document.createElement("button");f.type="button",f.setAttribute("data-scope","toast"),f.setAttribute("data-part","action-trigger"),f.hidden=!0,this.parts.action.replaceWith(f),this.parts.action=f}if(this.hadAction=o,o){this.parts.action.hidden=!1,this.spreadProps(this.parts.action,this.api.getActionTriggerProps());let f=(u=(p=this.latestProps.action)==null?void 0:p.label)!=null?u:"";this.parts.action.textContent!==f&&(this.parts.action.textContent=f);let m=IM(this.latestProps.action);m.length&&this.parts.action.classList.add(...m)}else this.parts.action.hidden=!0,this.parts.action.textContent&&(this.parts.action.textContent="");let s=this.duration;s==="Infinity"||s===1/0||s===Number.POSITIVE_INFINITY?(this.parts.progressbar.style.display="none",this.el.setAttribute("data-duration-infinity","true")):(this.parts.progressbar.style.display="block",this.el.removeAttribute("data-duration-infinity")),this.showLoading?(this.parts.loadingSpinner.style.display="flex",i&&this.parts.loadingSpinner.innerHTML!==i&&(this.parts.loadingSpinner.innerHTML=i)):this.parts.loadingSpinner.style.display="none"}},CM=class extends X{constructor(t,n){var r;super(t,n);Q(this,"toastComponents",new Map);Q(this,"groupEl");Q(this,"store");Q(this,"destroy",()=>{for(let t of this.toastComponents.values())t.destroy();this.toastComponents.clear(),this.machine.stop()});this.store=n.store,this.groupEl=(r=t.querySelector('[data-part="group"]'))!=null?r:(()=>{let i=document.createElement("div");return i.setAttribute("data-scope","toast"),i.setAttribute("data-part","group"),t.appendChild(i),i})()}initMachine(t){return new Y(lS.machine,t)}initApi(){return this.zagConnect(lS.connect)}render(){this.spreadProps(this.groupEl,this.api.getGroupProps());let t=this.api.getToasts().filter(r=>typeof r.id=="string"),n=new Set(t.map(r=>r.id));t.forEach((r,i)=>{var o;let a=this.toastComponents.get(r.id);if(a)a.duration=r.duration,a.showLoading=((o=r.meta)==null?void 0:o.loading)===!0,a.updateProps(y(h({},r),{parent:this.machine.service,index:i}));else{let s=document.createElement("div");s.classList.add("toast-item"),s.setAttribute("data-scope","toast"),s.setAttribute("data-part","root"),this.groupEl.appendChild(s),a=new TM(s,y(h({},r),{parent:this.machine.service,index:i})),a.init(),this.toastComponents.set(r.id,a)}});for(let[r,i]of this.toastComponents)n.has(r)||(i.destroy(),this.toastComponents.delete(r))}};VM=e=>e===!0||e==="true"?{meta:{loading:!0}}:{};xM={mounted(){var R;let e=this.el;e.id||(e.id=_a(e,"toast")),this.groupId=e.id;let t=x=>{if(x)try{return x.includes("{")?JSON.parse(x):x}catch(C){return x}},n=x=>x==="Infinity"||x===1/0?1/0:typeof x=="string"?parseInt(x,10)||void 0:x,r=x=>{if(x==null)return;let C=typeof x=="string"?parseInt(x,10):x;if(!(!Number.isFinite(C)||C<1||C>8))return C},i=(R=V(e,"placement",["top-start","top","top-end","bottom-start","bottom","bottom-end"]))!=null?R:"bottom-end";wM(e,{id:this.groupId,placement:i,overlap:O(e,"overlap"),max:G(e,"max"),gap:G(e,"gap"),offsets:t(V(e,"offset")),pauseOnPageIdle:O(e,"pauseOnPageIdle")}),e.setAttribute("data-ready","");let a=Ai(this.groupId),o=e.getAttribute("data-flash-info"),s=e.getAttribute("data-flash-info-title"),l=e.getAttribute("data-flash-error"),c=e.getAttribute("data-flash-error-title"),d=e.getAttribute("data-flash-info-duration"),g=e.getAttribute("data-flash-error-duration");if(a&&o)try{a.create({title:s||"Success",description:o,type:"info",id:_a(void 0,"toast"),duration:n(d!=null?d:void 0)})}catch(x){console.error("Failed to create flash info toast:",x)}if(a&&l)try{a.create({title:c||"Error",description:l,type:"error",id:_a(void 0,"toast"),duration:n(g!=null?g:void 0)})}catch(x){console.error("Failed to create flash error toast:",x)}let p=AM(this),u=x=>{var k;let C=lp(x.action),A=h({title:(k=x.title)!=null?k:"",description:x.description,type:x.type||"info",id:x.id||_a(void 0,"toast"),duration:n(x.duration)},VM(x.loading));C&&(A.action=cS(C,p));let N=r(x.priority);return N!==void 0&&(A.priority=N),A},f=x=>{let C={};x.title!==void 0&&(C.title=x.title),x.description!==void 0&&(C.description=x.description),x.type!==void 0&&(C.type=x.type),x.duration!==void 0&&(C.duration=n(x.duration)),x.loading===!0||x.loading==="true"?C.meta={loading:!0}:(x.loading===!1||x.loading==="false")&&(C.meta={loading:!1});let A=lp(x.action);A?C.action=cS(A,p):x.action===null&&(C.action=void 0);let N=r(x.priority);return N!==void 0&&(C.priority=N),C},m=x=>{let C=Ai(x.groupId||this.groupId);if(C)try{C.dismiss(x.id)}catch(A){console.error("Failed to dismiss toast:",A)}},S=x=>{let C=Ai(x.groupId||this.groupId);if(C)try{C.remove(x.id)}catch(A){console.error("Failed to remove toast:",A)}};this.handlers=[],this.handlers.push(this.handleEvent("toast-create",x=>{let C=Ai(x.groupId||this.groupId);if(C)try{C.create(u(x))}catch(A){console.error("Failed to create toast:",A)}})),this.handlers.push(this.handleEvent("toast-update",x=>{let C=Ai(x.groupId||this.groupId);if(!(!C||!x.id))try{C.update(x.id,f(x))}catch(A){console.error("Failed to update toast:",A)}})),this.handlers.push(this.handleEvent("toast-dismiss",m)),this.handlers.push(this.handleEvent("toast-remove",S));let T=x=>{let{detail:C}=x,A=Ai(C.groupId||this.groupId);if(A)try{A.create(u(C))}catch(N){console.error("Failed to create toast:",N)}},w=x=>{let{detail:C}=x,A=Ai(C.groupId||this.groupId);if(!(!A||!C.id))try{A.update(C.id,f(C))}catch(N){console.error("Failed to update toast:",N)}},I=x=>{m(x.detail)},P=x=>{S(x.detail)},v=[],E=(x,C)=>{e.addEventListener(x,C),v.push({el:e,name:x,fn:C})};this.domListeners=v,E("toast:create",T),E("toast:update",w),E("toast:dismiss",I),E("toast:remove",P)},destroyed(){var e;for(let{el:t,name:n,fn:r}of(e=this.domListeners)!=null?e:[])t.removeEventListener(n,r);if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);this.groupId&&OM(this.groupId)}}});var ES={};pe(ES,{Tooltip:()=>HM,getCloseDelay:()=>dp});function kM(e,t=Object.is){let n=h({},e),r=new Set,i=d=>(r.add(d),()=>r.delete(d)),a=()=>{r.forEach(d=>d())};return{subscribe:i,get:d=>n[d],set:(d,g)=>{t(n[d],g)||(n[d]=g,a())},update:d=>{let g=!1;for(let p in d){let u=d[p];u!==void 0&&!t(n[p],u)&&(n[p]=u,g=!0)}g&&a()},snapshot:()=>h({},n)}}function FM(e,t){let{state:n,context:r,send:i,scope:a,prop:o,event:s}=e,l=o("id"),c=!!o("aria-label"),d=n.matches("open","closing"),g=r.get("triggerValue"),p=NM(a),u=o("disabled"),f=Gt(y(h({},o("positioning")),{placement:r.get("currentPlacement")}));return{open:d,setOpen(m){n.matches("open","closing")!==m&&i({type:m?"open":"close"})},triggerValue:g,setTriggerValue(m){i({type:"triggerValue.set",value:m!=null?m:void 0})},reposition(m={}){i({type:"positioning.set",options:m})},getTriggerProps(m={}){let{value:S}=m,T=S==null?!1:g===S,w=yS(a,S);return t.button(y(h({},Qo.trigger.attrs),{id:w,"data-ownedby":a.id,"data-value":S,"data-current":b(T),dir:o("dir"),"data-expanded":b(d),"data-state":d?"open":"closed","aria-describedby":d?p:void 0,onClick(I){if(I.defaultPrevented||u||!o("closeOnClick"))return;let P=d&&S!=null&&!T;i({type:P?"triggerValue.set":"close",src:"trigger.click",value:S,triggerId:w})},onFocus(I){if(I.defaultPrevented||u||!vn())return;let P=d&&S!=null&&!T;i({type:P?"triggerValue.set":"open",src:"trigger.focus",value:S,triggerId:w})},onBlur(I){var E;if(I.defaultPrevented||u||l!==Lt.get("id"))return;let P=(E=I.relatedTarget)!=null?E:a.getDoc().activeElement;(P==null?void 0:P.closest(`[data-ownedby="${a.id}"]`))!=null||i({type:"close",src:"trigger.blur",value:S,triggerId:w})},onPointerDown(I){I.defaultPrevented||u||fe(I)&&o("closeOnPointerDown")&&l===Lt.get("id")&&i({type:"close",src:"trigger.pointerdown",value:S,triggerId:w})},onPointerMove(I){if(I.defaultPrevented||u||I.pointerType==="touch")return;let P=d&&S!=null&&!T;i({type:P?"triggerValue.set":"pointer.move",value:S,triggerId:w})},onPointerOver(I){I.defaultPrevented||u||I.pointerType!=="touch"&&i({type:"pointer.move",value:S,triggerId:w})},onPointerLeave(){u||i({type:"pointer.leave"})},onPointerCancel(){u||i({type:"pointer.leave"})}}))},getArrowProps(){return t.element(y(h({id:LM(a)},Qo.arrow.attrs),{dir:o("dir"),style:f.arrow}))},getArrowTipProps(){return t.element(y(h({},Qo.arrowTip.attrs),{dir:o("dir"),style:f.arrowTip}))},getPositionerProps(){return t.element(y(h({id:bS(a)},Qo.positioner.attrs),{dir:o("dir"),style:f.floating}))},getContentProps(){let m=Lt.get("id")===l,S=Lt.get("prevId")===l,T=Lt.get("instant")&&(d&&m||S);return t.element(y(h({},Qo.content.attrs),{dir:o("dir"),hidden:!d,"data-state":d?"open":"closed","data-instant":b(T),role:c?void 0:"tooltip",id:c?void 0:p,"data-placement":r.get("currentPlacement"),onPointerEnter(){i({type:"content.pointer.move"})},onPointerLeave(){i({type:"content.pointer.leave"})},style:{pointerEvents:o("interactive")?"auto":"none"}}))}}}function vS(e,t,n){return{onOpenChange:a=>{let o=V(e,"onOpenChange");o&&j(n)&&t(o,{id:e.id,open:a.open});let s=V(e,"onOpenChangeClient");s&&e.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:{id:e.id,open:a.open}}))},onTriggerValueChange:a=>{var s;let o=V(e,"onTriggerValueChange");o&&j(n)&&t(o,{id:e.id,value:(s=a.value)!=null?s:""})}}}function dp(e){let t=O(e,"interactive"),n=G(e,"closeDelay");return t&&(n===void 0||n===0)?400:n}var RM,Qo,yS,NM,LM,bS,cp,DM,es,Lt,MM,mS,_M,$M,HM,PS=ee(()=>{"use strict";ii();xr();yn();be();oe();RM=z("tooltip").parts("trigger","arrow","arrowTip","positioner","content"),Qo=RM.build();yS=(e,t)=>{var r;let n=(r=e.ids)==null?void 0:r.trigger;return n!=null?Qe(n)?n(t):n:t?`tooltip:${e.id}:trigger:${t}`:`tooltip:${e.id}:trigger`},NM=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`tooltip:${e.id}:content`},LM=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.arrow)!=null?n:`tooltip:${e.id}:arrow`},bS=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`tooltip:${e.id}:popper`},cp=e=>e.getById(bS(e)),DM=e=>Oe(e.getDoc(),`[data-scope="tooltip"][data-part="trigger"][data-ownedby="${e.id}"]`),es=(e,t)=>t==null?DM(e)[0]:e.getById(yS(e,t)),Lt=kM({id:null,prevId:null,instant:!1});({and:MM,not:mS}=we()),_M=te({initialState:({prop:e})=>e("open")||e("defaultOpen")?"open":"closed",props({props:e}){var r,i;gn(e,["id"]);let t=(r=e.closeOnClick)!=null?r:!0,n=(i=e.closeOnPointerDown)!=null?i:t;return y(h({openDelay:400,closeDelay:150,closeOnEscape:!0,interactive:!1,closeOnScroll:!0,disabled:!1},e),{closeOnPointerDown:n,closeOnClick:t,positioning:h({placement:"bottom"},e.positioning)})},effects:["trackFocusVisible","trackStore"],context:({bindable:e,prop:t,scope:n})=>({currentPlacement:e(()=>({defaultValue:void 0})),hasPointerMoveOpened:e(()=>({defaultValue:null})),triggerValue:e(()=>{var r;return{defaultValue:(r=t("defaultTriggerValue"))!=null?r:null,value:t("triggerValue"),onChange(i){let a=t("onTriggerValueChange");if(!a)return;let o=es(n,i);a({value:i,triggerElement:o})}}})}),watch({track:e,action:t,prop:n}){e([()=>n("disabled")],()=>{t(["closeIfDisabled"])}),e([()=>n("open")],()=>{t(["toggleVisibility"])}),e([()=>n("triggerValue")],()=>{t(["repositionImmediate"])})},on:{"triggerValue.set":{actions:["setTriggerValue","repositionImmediate"]}},states:{closed:{entry:["clearGlobalId"],on:{"controlled.open":{target:"open"},open:[{guard:"isOpenControlled",actions:["setTriggerValue","invokeOnOpen"]},{target:"open",actions:["setTriggerValue","invokeOnOpen"]}],"pointer.leave":{actions:["clearPointerMoveOpened"]},"pointer.move":[{guard:MM("noVisibleTooltip",mS("hasPointerMoveOpened")),target:"opening",actions:["setTriggerValue"]},{guard:mS("hasPointerMoveOpened"),target:"open",actions:["setPointerMoveOpened","invokeOnOpen","setTriggerValue"]}]}},opening:{effects:["trackScroll","trackPointerlockChange","waitForOpenDelay"],on:{"after.openDelay":[{guard:"isOpenControlled",actions:["setPointerMoveOpened","invokeOnOpen"]},{target:"open",actions:["setPointerMoveOpened","invokeOnOpen"]}],"controlled.open":{target:"open"},"controlled.close":{target:"closed"},open:[{guard:"isOpenControlled",actions:["setTriggerValue","invokeOnOpen"]},{target:"open",actions:["setTriggerValue","invokeOnOpen"]}],"pointer.leave":[{guard:"isOpenControlled",actions:["clearPointerMoveOpened","invokeOnClose","toggleVisibility"]},{target:"closed",actions:["clearPointerMoveOpened","invokeOnClose"]}],close:[{guard:"isOpenControlled",actions:["invokeOnClose","toggleVisibility"]},{target:"closed",actions:["invokeOnClose"]}]}},open:{effects:["trackEscapeKey","trackScroll","trackPointerlockChange","trackPositioning"],entry:["setGlobalId"],on:{"controlled.close":{target:"closed"},close:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],"pointer.leave":[{guard:"isVisible",target:"closing",actions:["clearPointerMoveOpened"]},{guard:"isOpenControlled",actions:["clearPointerMoveOpened","invokeOnClose"]},{target:"closed",actions:["clearPointerMoveOpened","invokeOnClose"]}],"content.pointer.leave":{guard:"isInteractive",target:"closing"},"positioning.set":{actions:["reposition"]},"triggerValue.set":{target:"closing",actions:["setTriggerValue","immediateReopen"]}}},closing:{effects:["trackPositioning","waitForCloseDelay"],on:{"after.closeDelay":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],"controlled.close":{target:"closed"},"controlled.open":{target:"open"},close:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],"pointer.move":[{guard:"isOpenControlled",actions:["setPointerMoveOpened","setTriggerValue","invokeOnOpen","toggleVisibility"]},{target:"open",actions:["setPointerMoveOpened","setTriggerValue","invokeOnOpen"]}],"triggerValue.set":{target:"open",actions:["setTriggerValue","repositionImmediate"]},reopen:{target:"open"},"content.pointer.move":{guard:"isInteractive",target:"open"},"positioning.set":{actions:["reposition"]}}}},implementations:{guards:{noVisibleTooltip:()=>Lt.get("id")===null,isVisible:({prop:e})=>e("id")===Lt.get("id"),isInteractive:({prop:e})=>!!e("interactive"),hasPointerMoveOpened:({context:e})=>!!e.get("hasPointerMoveOpened"),isOpenControlled:({prop:e})=>e("open")!==void 0},actions:{setGlobalId:({prop:e})=>{let t=Lt.get("id"),n=t!==null&&t!==e("id");Lt.update({id:e("id"),prevId:n?t:null,instant:n})},clearGlobalId:({prop:e})=>{e("id")===Lt.get("id")&&Lt.update({id:null,prevId:null,instant:!1})},invokeOnOpen:({prop:e})=>{var t;(t=e("onOpenChange"))==null||t({open:!0})},invokeOnClose:({prop:e})=>{var t;(t=e("onOpenChange"))==null||t({open:!1})},closeIfDisabled:({prop:e,send:t})=>{e("disabled")&&t({type:"close",src:"disabled.change"})},reposition:({context:e,event:t,prop:n,scope:r})=>{if(t.type!=="positioning.set")return;Xe(()=>es(r,e.get("triggerValue")),()=>cp(r),y(h(h({},n("positioning")),t.options),{listeners:!1,onComplete(o){e.set("currentPlacement",o.placement)}}))},repositionImmediate:({context:e,event:t,prop:n,scope:r})=>{var s;let i=(s=t.value)!=null?s:e.get("triggerValue");return Xe(()=>es(r,i),()=>cp(r),y(h({},n("positioning")),{onComplete(l){e.set("currentPlacement",l.placement)}}))},toggleVisibility:({prop:e,event:t,send:n})=>{queueMicrotask(()=>{n({type:e("open")?"controlled.open":"controlled.close",previousEvent:t})})},setPointerMoveOpened:({context:e,event:t})=>{var r,i;let n=(i=t.triggerId)!=null?i:(r=t.previousEvent)==null?void 0:r.triggerId;e.set("hasPointerMoveOpened",n!=null?n:null)},clearPointerMoveOpened:({context:e})=>{e.set("hasPointerMoveOpened",null)},setTriggerValue:({context:e,event:t})=>{t.value!==void 0&&e.set("triggerValue",t.value)},immediateReopen:({send:e})=>{queueMicrotask(()=>{e({type:"reopen"})})}},effects:{trackFocusVisible:({scope:e})=>{var t;return nt({root:(t=e.getRootNode)==null?void 0:t.call(e)})},trackPositioning:({context:e,prop:t,scope:n})=>(e.get("currentPlacement")||e.set("currentPlacement",t("positioning").placement),Xe(()=>es(n,e.get("triggerValue")),()=>cp(n),y(h({},t("positioning")),{defer:!0,onComplete(a){e.set("currentPlacement",a.placement)}}))),trackPointerlockChange:({send:e,scope:t})=>{let n=t.getDoc();return ae(n,"pointerlockchange",()=>e({type:"close",src:"pointerlock:change"}),!1)},trackScroll:({send:e,prop:t,scope:n,context:r})=>{if(!t("closeOnScroll"))return;let i=r.get("triggerValue"),a=es(n,i);if(!a)return;let s=cd(a).map(l=>ae(l,"scroll",()=>{e({type:"close",src:"scroll"})},{passive:!0,capture:!0}));return()=>{s.forEach(l=>l==null?void 0:l())}},trackStore:({prop:e,send:t})=>{let n;return queueMicrotask(()=>{n=Lt.subscribe(()=>{Lt.get("id")!==e("id")&&t({type:"close",src:"id.change"})})}),()=>n==null?void 0:n()},trackEscapeKey:({send:e,prop:t})=>t("closeOnEscape")?ae(document,"keydown",r=>{Me(r)||r.key==="Escape"&&(r.stopPropagation(),e({type:"close",src:"keydown.escape"}))},!0):void 0,waitForOpenDelay:({send:e,prop:t,event:n})=>{let r=setTimeout(()=>{e({type:"after.openDelay",previousEvent:n})},t("openDelay"));return()=>clearTimeout(r)},waitForCloseDelay:({send:e,prop:t,event:n})=>{let r=setTimeout(()=>{e({type:"after.closeDelay",previousEvent:n})},t("closeDelay"));return()=>clearTimeout(r)}}}}),$M=class extends X{initMachine(e){return new Y(_M,e)}initApi(){return this.zagConnect(FM)}syncDom(){this.api=this.initApi(),this.render()}render(){let e=this.el;e.querySelectorAll('[data-scope="tooltip"][data-part="trigger"]').forEach(o=>{let s=o.dataset.value,l=s!=null&&s!==""?{value:s}:{};this.spreadProps(o,this.api.getTriggerProps(l))});let n=e.querySelector('[data-scope="tooltip"][data-part="positioner"]');n&&this.spreadProps(n,this.api.getPositionerProps());let r=e.querySelector('[data-scope="tooltip"][data-part="content"]');r&&this.spreadProps(r,this.api.getContentProps());let i=e.querySelector('[data-scope="tooltip"][data-part="arrow"]');i&&this.spreadProps(i,this.api.getArrowProps());let a=e.querySelector('[data-scope="tooltip"][data-part="arrow-tip"]');a&&this.spreadProps(a,this.api.getArrowTipProps())}};HM={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=this.liveSocket,r=qe(e),i=vS(e,t,n),a=new $M(e,h({id:e.id,defaultOpen:O(e,"defaultOpen"),disabled:O(e,"disabled"),dir:q(e),openDelay:G(e,"openDelay"),closeDelay:dp(e),positioning:r,closeOnEscape:O(e,"closeOnEscape"),closeOnClick:O(e,"closeOnClick"),closeOnPointerDown:O(e,"closeOnPointerDown"),closeOnScroll:O(e,"closeOnScroll"),interactive:O(e,"interactive")},i));a.init(),this.tooltip=a,this.onSetOpen=o=>{let{open:s}=o.detail;a.api.setOpen(s)},e.addEventListener("corex:tooltip:set-open",this.onSetOpen),this.handlers=[],this.handlers.push(this.handleEvent("tooltip_set_open",o=>{$(e.id,H(o))&&a.api.setOpen(o.open)}))},updated(){var a;let e=this.el,t=this.pushEvent.bind(this),n=this.liveSocket,r=qe(e),i=vS(e,t,n);(a=this.tooltip)==null||a.updateProps(h({id:e.id,disabled:O(e,"disabled"),dir:q(e),openDelay:G(e,"openDelay"),closeDelay:dp(e),positioning:r,closeOnEscape:O(e,"closeOnEscape"),closeOnClick:O(e,"closeOnClick"),closeOnPointerDown:O(e,"closeOnPointerDown"),closeOnScroll:O(e,"closeOnScroll"),interactive:O(e,"interactive")},i)),queueMicrotask(()=>{var o,s,l,c;(o=this.tooltip)==null||o.syncDom(),(c=(s=this.tooltip)==null?void 0:(l=s.api).reposition)==null||c.call(l)})},destroyed(){var e;if(this.onSetOpen&&this.el.removeEventListener("corex:tooltip:set-open",this.onSetOpen),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.tooltip)==null||e.destroy()}}});var TS={};pe(TS,{Toggle:()=>WM,pressedChangePayload:()=>IS});function UM(e,t){let{context:n,prop:r,send:i}=e,a=n.get("pressed");return{pressed:a,disabled:!!r("disabled"),setPressed(o){i({type:"PRESS.SET",value:o})},getRootProps(){return t.element(y(h({type:"button"},SS.root.attrs),{disabled:r("disabled"),"aria-pressed":a,"data-state":a?"on":"off","data-pressed":b(a),"data-disabled":b(r("disabled")),onClick(o){o.defaultPrevented||r("disabled")||i({type:"PRESS.TOGGLE"})}}))},getIndicatorProps(){return t.element(y(h({},SS.indicator.attrs),{"data-disabled":b(r("disabled")),"data-pressed":b(a),"data-state":a?"on":"off"}))}}}function IS(e,t){return{id:e.id,pressed:t}}var BM,SS,GM,qM,WM,CS=ee(()=>{"use strict";$e();Ve();be();oe();BM=z("toggle",["root","indicator"]),SS=BM.build();GM=te({props({props:e}){return h({defaultPressed:!1},e)},context({prop:e,bindable:t}){return{pressed:t(()=>({value:e("pressed"),defaultValue:e("defaultPressed"),onChange(n){var r;(r=e("onPressedChange"))==null||r(n)}}))}},initialState(){return"idle"},on:{"PRESS.TOGGLE":{actions:["togglePressed"]},"PRESS.SET":{actions:["setPressed"]}},states:{idle:{}},implementations:{actions:{togglePressed({context:e}){e.set("pressed",!e.get("pressed"))},setPressed({context:e,event:t}){e.set("pressed",t.value)}}}}),qM=class extends X{initMachine(e){return new Y(GM,e)}initApi(){return this.zagConnect(UM)}render(){let e=this.el.querySelector('[data-scope="toggle"][data-part="root"]');if(!e)return;this.spreadProps(e,this.api.getRootProps());let t=e.querySelector(':scope > [data-scope="toggle"][data-part="indicator"]');t&&this.spreadProps(t,this.api.getIndicatorProps())}};WM={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=O(e,"controlled"),i=Ye(e,"pressed"),a=Ye(e,"defaultPressed"),o=new qM(e,y(h({id:e.id},r?{pressed:i===!0}:{defaultPressed:a===!0}),{disabled:O(e,"disabled"),dir:q(e),onPressedChange:c=>{W({el:e,canPushServer:n(),pushEvent:t,payload:IS(e,c),serverEventName:V(e,"onPressedChange"),clientEventName:V(e,"onPressedChangeClient")})}}));o.init(),this.zagToggle=o;let s=ie(e);this.domRegistry=s,s.add("corex:toggle:set-pressed",c=>{var g;let d=(g=c.detail)==null?void 0:g.pressed;typeof d=="boolean"&&o.api.setPressed(d)}),s.add("corex:toggle:toggle-pressed",()=>{o.api.setPressed(!o.api.pressed)});let l=re(this);this.handleRegistry=l,l.add("toggle_set_pressed",c=>{if(!$(e.id,H(c)))return;let d=qh(c);typeof d=="boolean"&&o.api.setPressed(d)}),l.add("toggle_toggle_pressed",c=>{$(e.id,H(c))&&o.api.setPressed(!o.api.pressed)}),l.add("toggle_pressed",c=>{$(e.id,H(c))&&n()&&this.pushEvent("toggle_pressed_response",{id:e.id,value:o.api.pressed})})},updated(){var e;(e=this.zagToggle)==null||e.updateProps(y(h({id:this.el.id},Bh(this.el)),{disabled:O(this.el,"disabled"),dir:q(this.el)}))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.zagToggle)==null||n.destroy()}}});var kS={};pe(kS,{ToggleGroup:()=>t1,readToggleGroupPayloadValue:()=>RS,valueChangePayload:()=>xS});function ZM(e,t){let{context:n,send:r,prop:i,scope:a}=e,o=n.get("value"),s=i("disabled"),l=!i("multiple"),c=i("rovingFocus"),d=i("orientation")==="horizontal";function g(p){let u=zM(a,p.value);return{id:u,disabled:!!(p.disabled||s),pressed:!!o.includes(p.value),focused:n.get("focusedId")===u}}return{value:o,setValue(p){r({type:"VALUE.SET",value:p})},getRootProps(){return t.element(y(h({},wS.root.attrs),{id:xc(a),dir:i("dir"),role:l?"radiogroup":"group",tabIndex:n.get("isTabbingBackward")?-1:0,"data-disabled":b(s),"data-orientation":i("orientation"),"data-focus":b(n.get("focusedId")!=null),style:{outline:"none"},onMouseDown(){s||r({type:"ROOT.MOUSE_DOWN"})},onFocus(p){s||p.currentTarget===ne(p)&&(n.get("isClickFocus")||n.get("isTabbingBackward")||r({type:"ROOT.FOCUS"}))},onBlur(p){let u=p.relatedTarget;ge(p.currentTarget,u)||s||r({type:"ROOT.BLUR"})}}))},getItemState:g,getItemProps(p){let u=g(p),f=u.focused?0:-1;return t.button(y(h({},wS.item.attrs),{id:u.id,type:"button","data-ownedby":xc(a),"data-focus":b(u.focused),disabled:u.disabled,tabIndex:c?f:void 0,role:l?"radio":void 0,"aria-checked":l?u.pressed:void 0,"aria-pressed":l?void 0:u.pressed,"data-disabled":b(u.disabled),"data-orientation":i("orientation"),dir:i("dir"),"data-state":u.pressed?"on":"off",onFocus(){u.disabled||r({type:"TOGGLE.FOCUS",id:u.id})},onClick(m){u.disabled||(r({type:"TOGGLE.CLICK",id:u.id,value:p.value}),wt()&&m.currentTarget.focus({preventScroll:!0}))},onKeyDown(m){if(m.defaultPrevented||!ge(m.currentTarget,ne(m))||u.disabled)return;let T={Tab(w){let I=w.shiftKey;r({type:"TOGGLE.SHIFT_TAB",isShiftTab:I})},ArrowLeft(){!c||!d||r({type:"TOGGLE.FOCUS_PREV"})},ArrowRight(){!c||!d||r({type:"TOGGLE.FOCUS_NEXT"})},ArrowUp(){!c||d||r({type:"TOGGLE.FOCUS_PREV"})},ArrowDown(){!c||d||r({type:"TOGGLE.FOCUS_NEXT"})},Home(){c&&r({type:"TOGGLE.FOCUS_FIRST"})},End(){c&&r({type:"TOGGLE.FOCUS_LAST"})}}[me(m)];T&&(T(m),m.key!=="Tab"&&m.preventDefault())}}))}}}function xS(e,t){return{id:e.id,value:t.value}}function RS(e){var r;if(!e||typeof e!="object")return;let t=e,n=(r=t.value)!=null?r:t.value;if(Array.isArray(n)&&n.every(i=>typeof i=="string"))return n}var KM,wS,xc,zM,AS,Rc,OS,jM,YM,XM,VS,JM,QM,e1,t1,NS=ee(()=>{"use strict";$e();Ve();be();oe();KM=z("toggle-group").parts("root","item"),wS=KM.build(),xc=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`toggle-group:${e.id}`},zM=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.item)==null?void 0:r.call(n,t))!=null?i:`toggle-group:${e.id}:${t}`},AS=e=>e.getById(xc(e)),Rc=e=>{let n=`[data-ownedby='${CSS.escape(xc(e))}']:not([data-disabled])`;return Oe(AS(e),n)},OS=e=>Dt(Rc(e)),jM=e=>en(Rc(e)),YM=(e,t,n)=>mr(Rc(e),t,n),XM=(e,t,n)=>vr(Rc(e),t,n);({not:VS,and:JM}=we()),QM=te({props({props:e}){return h({defaultValue:[],orientation:"horizontal",rovingFocus:!0,loopFocus:!0,deselectable:!0},e)},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var r;(r=e("onValueChange"))==null||r({value:n})}})),focusedId:t(()=>({defaultValue:null})),isTabbingBackward:t(()=>({defaultValue:!1})),isClickFocus:t(()=>({defaultValue:!1})),isWithinToolbar:t(()=>({defaultValue:!1}))}},computed:{currentLoopFocus:({context:e,prop:t})=>t("loopFocus")&&!e.get("isWithinToolbar")},entry:["checkIfWithinToolbar"],on:{"VALUE.SET":{actions:["setValue"]},"TOGGLE.CLICK":{actions:["setValue"]},"ROOT.MOUSE_DOWN":{actions:["setClickFocus"]}},states:{idle:{on:{"ROOT.FOCUS":{target:"focused",guard:VS(JM("isClickFocus","isTabbingBackward")),actions:["focusFirstToggle","clearClickFocus"]},"TOGGLE.FOCUS":{target:"focused",actions:["setFocusedId"]}}},focused:{on:{"ROOT.BLUR":{target:"idle",actions:["clearIsTabbingBackward","clearFocusedId","clearClickFocus"]},"TOGGLE.FOCUS":{actions:["setFocusedId"]},"TOGGLE.FOCUS_NEXT":{actions:["focusNextToggle"]},"TOGGLE.FOCUS_PREV":{actions:["focusPrevToggle"]},"TOGGLE.FOCUS_FIRST":{actions:["focusFirstToggle"]},"TOGGLE.FOCUS_LAST":{actions:["focusLastToggle"]},"TOGGLE.SHIFT_TAB":[{guard:VS("isFirstToggleFocused"),target:"idle",actions:["setIsTabbingBackward"]},{actions:["setIsTabbingBackward"]}]}}},implementations:{guards:{isClickFocus:({context:e})=>e.get("isClickFocus"),isTabbingBackward:({context:e})=>e.get("isTabbingBackward"),isFirstToggleFocused:({context:e,scope:t})=>{var n;return e.get("focusedId")===((n=OS(t))==null?void 0:n.id)}},actions:{setIsTabbingBackward({context:e}){e.set("isTabbingBackward",!0)},clearIsTabbingBackward({context:e}){e.set("isTabbingBackward",!1)},setClickFocus({context:e}){e.set("isClickFocus",!0)},clearClickFocus({context:e}){e.set("isClickFocus",!1)},checkIfWithinToolbar({context:e,scope:t}){var r;let n=(r=AS(t))==null?void 0:r.closest("[role=toolbar]");e.set("isWithinToolbar",!!n)},setFocusedId({context:e,event:t}){e.set("focusedId",t.id)},clearFocusedId({context:e}){e.set("focusedId",null)},setValue({context:e,event:t,prop:n}){gn(t,["value"]);let r=e.get("value");cr(t.value)?r=t.value:n("multiple")?r=tn(r,t.value):r=Ce(r,[t.value])&&n("deselectable")?[]:[t.value],e.set("value",r)},focusNextToggle({context:e,scope:t,prop:n}){B(()=>{var i;let r=e.get("focusedId");r&&((i=YM(t,r,n("loopFocus")))==null||i.focus({preventScroll:!0}))})},focusPrevToggle({context:e,scope:t,prop:n}){B(()=>{var i;let r=e.get("focusedId");r&&((i=XM(t,r,n("loopFocus")))==null||i.focus({preventScroll:!0}))})},focusFirstToggle({scope:e}){B(()=>{var t;(t=OS(e))==null||t.focus({preventScroll:!0})})},focusLastToggle({scope:e}){B(()=>{var t;(t=jM(e))==null||t.focus({preventScroll:!0})})}}}}),e1=class extends X{initMachine(e){return new Y(QM,e)}initApi(){return this.zagConnect(ZM)}render(){let e=this.el.querySelector('[data-scope="toggle-group"][data-part="root"]');if(!e)return;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelectorAll('[data-scope="toggle-group"][data-part="item"]');for(let n=0;nj(this.liveSocket),r=y(h({id:e.id},O(e,"controlled")?{value:Ie(e,"value")}:{defaultValue:Ie(e,"defaultValue")}),{deselectable:O(e,"deselectable"),loopFocus:O(e,"loopFocus"),rovingFocus:O(e,"rovingFocus"),disabled:O(e,"disabled"),multiple:O(e,"multiple"),orientation:V(e,"orientation"),dir:q(e),onValueChange:s=>{W({el:e,canPushServer:n(),pushEvent:t,payload:xS(e,s),serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})}}),i=new e1(e,r);i.init(),this.toggleGroup=i;let a=ie(e);this.domRegistry=a,a.add("corex:toggle-group:set-value",s=>{let{value:l}=s.detail;i.api.setValue(l)});let o=re(this);this.handleRegistry=o,o.add("toggle-group_set_value",s=>{if(!$(e.id,H(s)))return;let l=RS(s);l&&i.api.setValue(l)}),o.add("toggle-group:value",s=>{$(e.id,H(s))&&n()&&this.pushEvent("toggle-group:value_response",{id:e.id,value:i.api.value})})},updated(){var e;(e=this.toggleGroup)==null||e.updateProps(y(h({},Ks(this.el,"value","defaultValue")),{deselectable:O(this.el,"deselectable"),loopFocus:O(this.el,"loopFocus"),rovingFocus:O(this.el,"rovingFocus"),disabled:O(this.el,"disabled"),multiple:O(this.el,"multiple"),orientation:V(this.el,"orientation"),dir:q(this.el)}))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.toggleGroup)==null||n.destroy()}}});var HS={};pe(HS,{TreeView:()=>c1,parseRootNode:()=>fp,readExpandedAttr:()=>pp,readSelectedAttr:()=>hp,readTreeViewInteractionProps:()=>$S});function _S(e,t,n){let r=e.getNodeValue(t);if(!e.isBranchNode(t))return n.includes(r);let i=e.getDescendantValues(r),a=i.every(s=>n.includes(s)),o=i.some(s=>n.includes(s));return a?!0:o?"indeterminate":!1}function i1(e,t,n){let r=e.getDescendantValues(t),i=r.every(a=>n.includes(a));return gt(i?Ft(n,...r):Tt(n,...r))}function a1(e,t){let n=new Map;return e.visit({onEnter:r=>{let i=e.getNodeValue(r),a=e.isBranchNode(r),o=_S(e,r,t);n.set(i,{type:a?"branch":"leaf",checked:o})}}),n}function o1(e,t){let{context:n,scope:r,computed:i,prop:a,send:o}=e,s=a("collection"),l=a("translations"),c=Array.from(n.get("expandedValue")),d=Array.from(n.get("selectedValue")),g=Array.from(n.get("checkedValue")),p=i("isTypingAhead"),u=n.get("focusedValue"),f=n.get("loadingStatus"),m=n.get("renamingValue"),S=({indexPath:P})=>s.getValuePath(P).slice(0,-1).some(E=>!c.includes(E)),T=s.getFirstNode(void 0,{skip:S}),w=T?s.getNodeValue(T):null;function I(P){let{node:v,indexPath:E}=P,R=s.getNodeValue(v);return{id:vp(r,R),value:R,indexPath:E,valuePath:s.getValuePath(E),disabled:!!v.disabled,focused:u==null?w===R:u===R,selected:d.includes(R),expanded:c.includes(R),loading:f[R]==="loading",depth:E.length,isBranch:s.isBranchNode(v),renaming:m===R,get checked(){return _S(s,v,g)}}}return{collection:s,expandedValue:c,selectedValue:d,checkedValue:g,toggleChecked(P,v){o({type:"CHECKED.TOGGLE",value:P,isBranch:v})},setChecked(P){o({type:"CHECKED.SET",value:P})},clearChecked(){o({type:"CHECKED.CLEAR"})},getCheckedMap(){return a1(s,g)},expand(P){o({type:P?"BRANCH.EXPAND":"EXPANDED.ALL",value:P})},collapse(P){o({type:P?"BRANCH.COLLAPSE":"EXPANDED.CLEAR",value:P})},deselect(P){o({type:P?"NODE.DESELECT":"SELECTED.CLEAR",value:P})},select(P){o({type:P?"NODE.SELECT":"SELECTED.ALL",value:P,isTrusted:!1})},getVisibleNodes(){return i("visibleNodes")},focus(P){je(r,P)},selectParent(P){let v=s.getParentNode(P);if(!v)return;let E=Tt(d,s.getNodeValue(v));o({type:"SELECTED.SET",value:E,src:"select.parent"})},expandParent(P){let v=s.getParentNode(P);if(!v)return;let E=Tt(c,s.getNodeValue(v));o({type:"EXPANDED.SET",value:E,src:"expand.parent"})},setExpandedValue(P){let v=gt(P);o({type:"EXPANDED.SET",value:v})},setSelectedValue(P){let v=gt(P);o({type:"SELECTED.SET",value:v})},startRenaming(P){o({type:"NODE.RENAME",value:P})},submitRenaming(P,v){o({type:"RENAME.SUBMIT",value:P,label:v})},cancelRenaming(){o({type:"RENAME.CANCEL"})},getRootProps(){return t.element(y(h({},ct.root.attrs),{id:r1(r),dir:a("dir")}))},getLabelProps(){return t.element(y(h({},ct.label.attrs),{id:LS(r),dir:a("dir")}))},getTreeProps(){return t.element(y(h({},ct.tree.attrs),{id:up(r),dir:a("dir"),role:"tree","aria-label":l.treeLabel,"aria-labelledby":LS(r),"aria-multiselectable":a("selectionMode")==="multiple"||void 0,tabIndex:-1,onKeyDown(P){if(P.defaultPrevented||Me(P))return;let v=ne(P);if($t(v))return;let E=v==null?void 0:v.closest("[data-part=branch-control], [data-part=item]");if(!E)return;let R=E.dataset.value;if(R==null){console.warn("[zag-js/tree-view] Node id not found for node",E);return}let x=E.matches("[data-part=branch-control]"),C={ArrowDown(k){Be(k)||(k.preventDefault(),o({type:"NODE.ARROW_DOWN",id:R,shiftKey:k.shiftKey}))},ArrowUp(k){Be(k)||(k.preventDefault(),o({type:"NODE.ARROW_UP",id:R,shiftKey:k.shiftKey}))},ArrowLeft(k){Be(k)||E.dataset.disabled||(k.preventDefault(),o({type:x?"BRANCH_NODE.ARROW_LEFT":"NODE.ARROW_LEFT",id:R}))},ArrowRight(k){!x||E.dataset.disabled||(k.preventDefault(),o({type:"BRANCH_NODE.ARROW_RIGHT",id:R}))},Home(k){Be(k)||(k.preventDefault(),o({type:"NODE.HOME",id:R,shiftKey:k.shiftKey}))},End(k){Be(k)||(k.preventDefault(),o({type:"NODE.END",id:R,shiftKey:k.shiftKey}))},Space(k){var L;E.dataset.disabled||(p?o({type:"TREE.TYPEAHEAD",key:k.key}):(L=C.Enter)==null||L.call(C,k))},Enter(k){E.dataset.disabled||_t(v)&&Be(k)||(o({type:x?"BRANCH_NODE.CLICK":"NODE.CLICK",id:R,src:"keyboard"}),_t(v)||k.preventDefault())},"*"(k){E.dataset.disabled||(k.preventDefault(),o({type:"SIBLINGS.EXPAND",id:R}))},a(k){!k.metaKey||E.dataset.disabled||(k.preventDefault(),o({type:"SELECTED.ALL",moveFocus:!0}))},F2(k){if(E.dataset.disabled)return;let L=a("canRename");if(!L)return;let K=s.getIndexPath(R);if(K){let J=s.at(K);if(J&&!L(J,K))return}k.preventDefault(),o({type:"NODE.RENAME",value:R})}},A=me(P,{dir:a("dir")}),N=C[A];if(N){N(P);return}ft.isValidEvent(P)&&(o({type:"TREE.TYPEAHEAD",key:P.key,id:R}),P.preventDefault())}}))},getNodeState:I,getItemProps(P){let v=I(P);return t.element(y(h({},ct.item.attrs),{id:v.id,dir:a("dir"),"data-ownedby":up(r),"data-path":P.indexPath.join("/"),"data-value":v.value,tabIndex:v.focused?0:-1,"data-focus":b(v.focused),role:"treeitem","aria-current":v.selected?"true":void 0,"aria-selected":v.disabled?void 0:v.selected,"data-selected":b(v.selected),"aria-disabled":se(v.disabled),"data-disabled":b(v.disabled),"data-renaming":b(v.renaming),"data-checked":b(v.checked===!0),"data-indeterminate":b(v.checked==="indeterminate"),"aria-level":v.depth,"data-depth":v.depth,style:{"--depth":v.depth},onFocus(E){E.stopPropagation(),o({type:"NODE.FOCUS",id:v.value})},onClick(E){if(v.disabled||!fe(E)||_t(E.currentTarget)&&Be(E))return;let R=E.metaKey||E.ctrlKey;o({type:"NODE.CLICK",id:v.value,shiftKey:E.shiftKey,ctrlKey:R}),E.stopPropagation(),_t(E.currentTarget)||E.preventDefault()}}))},getItemTextProps(P){let v=I(P);return t.element(y(h({},ct.itemText.attrs),{"data-disabled":b(v.disabled),"data-selected":b(v.selected),"data-focus":b(v.focused)}))},getItemIndicatorProps(P){let v=I(P);return t.element(y(h({},ct.itemIndicator.attrs),{"aria-hidden":!0,"data-disabled":b(v.disabled),"data-selected":b(v.selected),"data-focus":b(v.focused),hidden:!v.selected}))},getBranchProps(P){let v=I(P);return t.element(y(h({},ct.branch.attrs),{"data-depth":v.depth,dir:a("dir"),"data-branch":v.value,role:"treeitem","data-ownedby":up(r),"data-value":v.value,"aria-level":v.depth,"aria-selected":v.disabled?void 0:v.selected,"data-path":P.indexPath.join("/"),"data-selected":b(v.selected),"aria-expanded":v.expanded,"data-state":v.expanded?"open":"closed","aria-disabled":se(v.disabled),"data-disabled":b(v.disabled),"data-loading":b(v.loading),"aria-busy":se(v.loading),style:{"--depth":v.depth}}))},getBranchIndicatorProps(P){let v=I(P);return t.element(y(h({},ct.branchIndicator.attrs),{"aria-hidden":!0,"data-state":v.expanded?"open":"closed","data-disabled":b(v.disabled),"data-selected":b(v.selected),"data-focus":b(v.focused),"data-loading":b(v.loading)}))},getBranchTriggerProps(P){let v=I(P);return t.element(y(h({},ct.branchTrigger.attrs),{role:"button",dir:a("dir"),"data-disabled":b(v.disabled),"data-state":v.expanded?"open":"closed","data-value":v.value,"data-loading":b(v.loading),disabled:v.loading,onClick(E){v.disabled||v.loading||(o({type:"BRANCH_TOGGLE.CLICK",id:v.value}),E.stopPropagation())}}))},getBranchControlProps(P){let v=I(P);return t.element(y(h({},ct.branchControl.attrs),{role:"button",id:v.id,dir:a("dir"),tabIndex:v.focused?0:-1,"data-path":P.indexPath.join("/"),"data-state":v.expanded?"open":"closed","data-disabled":b(v.disabled),"data-selected":b(v.selected),"data-focus":b(v.focused),"data-renaming":b(v.renaming),"data-checked":b(v.checked===!0),"data-indeterminate":b(v.checked==="indeterminate"),"data-value":v.value,"data-depth":v.depth,"data-loading":b(v.loading),"aria-busy":se(v.loading),onFocus(E){o({type:"NODE.FOCUS",id:v.value}),E.stopPropagation()},onClick(E){if(v.disabled||v.loading||!fe(E)||_t(E.currentTarget)&&Be(E))return;let R=E.metaKey||E.ctrlKey;o({type:"BRANCH_NODE.CLICK",id:v.value,shiftKey:E.shiftKey,ctrlKey:R}),E.stopPropagation()}}))},getBranchTextProps(P){let v=I(P);return t.element(y(h({},ct.branchText.attrs),{dir:a("dir"),"data-disabled":b(v.disabled),"data-state":v.expanded?"open":"closed","data-loading":b(v.loading)}))},getBranchContentProps(P){let v=I(P);return t.element(y(h({},ct.branchContent.attrs),{role:"group",dir:a("dir"),"data-state":v.expanded?"open":"closed","data-depth":v.depth,"data-path":P.indexPath.join("/"),"data-value":v.value,hidden:!v.expanded}))},getBranchIndentGuideProps(P){let v=I(P);return t.element(y(h({},ct.branchIndentGuide.attrs),{"data-depth":v.depth}))},getNodeCheckboxProps(P){let v=I(P),E=v.checked;return t.element(y(h({},ct.nodeCheckbox.attrs),{tabIndex:-1,role:"checkbox","data-state":E===!0?"checked":E===!1?"unchecked":"indeterminate","aria-checked":E===!0?"true":E===!1?"false":"mixed","data-disabled":b(v.disabled),onClick(R){if(R.defaultPrevented||v.disabled||!fe(R))return;o({type:"CHECKED.TOGGLE",value:v.value,isBranch:v.isBranch}),R.stopPropagation();let x=R.currentTarget.closest("[role=treeitem]");x==null||x.focus({preventScroll:!0})}}))},getNodeRenameInputProps(P){let v=I(P);return t.input(y(h({},ct.nodeRenameInput.attrs),{id:MS(r,v.value),type:"text","aria-label":l.renameInputLabel,hidden:!v.renaming,onKeyDown(E){Me(E)||(E.key==="Escape"&&(o({type:"RENAME.CANCEL"}),E.preventDefault()),E.key==="Enter"&&(o({type:"RENAME.SUBMIT",label:E.currentTarget.value}),E.preventDefault()),E.stopPropagation())},onBlur(E){o({type:"RENAME.SUBMIT",label:E.currentTarget.value})}}))}}}function kc(e,t){let{context:n,prop:r,refs:i}=e;if(!r("loadChildren")){n.set("expandedValue",m=>gt(Tt(m,...t)));return}let a=n.get("loadingStatus"),[o,s]=Zc(t,m=>a[m]==="loaded");if(o.length>0&&n.set("expandedValue",m=>gt(Tt(m,...o))),s.length===0)return;let l=r("collection"),[c,d]=Zc(s,m=>{let S=l.findNode(m);return l.getNodeChildren(S).length>0});if(c.length>0&&n.set("expandedValue",m=>gt(Tt(m,...c))),d.length===0)return;n.set("loadingStatus",m=>h(h({},m),d.reduce((S,T)=>y(h({},S),{[T]:"loading"}),{})));let g=d.map(m=>{let S=l.getIndexPath(m),T=l.getValuePath(S),w=l.findNode(m);return{id:m,indexPath:S,valuePath:T,node:w}}),p=i.get("pendingAborts"),u=r("loadChildren");nn(u,()=>"[zag-js/tree-view] `loadChildren` is required for async expansion");let f=g.map(({id:m,indexPath:S,valuePath:T,node:w})=>{let I=p.get(m);I&&(I.abort(),p.delete(m));let P=new AbortController;return p.set(m,P),u({valuePath:T,indexPath:S,node:w,signal:P.signal})});Promise.allSettled(f).then(m=>{var P,v;let S=[],T=[],w=n.get("loadingStatus"),I=r("collection");m.forEach((E,R)=>{let{id:x,indexPath:C,node:A,valuePath:N}=g[R];E.status==="fulfilled"?(w[x]="loaded",S.push(x),I=I.replace(C,y(h({},A),{children:E.value}))):(p.delete(x),Reflect.deleteProperty(w,x),T.push({node:A,error:E.reason,indexPath:C,valuePath:N}))}),n.set("loadingStatus",w),S.length&&(n.set("expandedValue",E=>gt(Tt(E,...S))),(P=r("onLoadChildrenComplete"))==null||P({collection:I})),T.length&&((v=r("onLoadChildrenError"))==null||v({nodes:T}))})}function Ln(e){let{prop:t,context:n}=e;return function({indexPath:i}){return t("collection").getValuePath(i).slice(0,-1).some(o=>!n.get("expandedValue").includes(o))}}function xi(e,t){let{prop:n,scope:r,computed:i}=e,a=n("scrollToIndexFn");if(!a)return!1;let o=n("collection"),s=i("visibleNodes");for(let l=0;lr.getById(vp(r,t))}),!0}return!1}function FS(e){return mp({nodeToValue:t=>t.value,nodeToString:t=>t.name,rootNode:e})}function pp(e){var t,n;return O(e,"controlled")?(t=e.getAttribute("data-expanded-value"))!=null?t:"":(n=e.getAttribute("data-default-expanded-value"))!=null?n:""}function hp(e){var t,n;return O(e,"controlled")?(t=e.getAttribute("data-selected-value"))!=null?t:"":(n=e.getAttribute("data-default-selected-value"))!=null?n:""}function fp(e){let t=e.dataset.tree;if(t==null||t==="")throw new Error("TreeView: missing data-tree");return JSON.parse(t)}function $S(e){var t;return{selectionMode:(t=V(e,"selectionMode"))!=null?t:"single",typeahead:e.dataset.typeahead!=="false",dir:q(e)}}var n1,ct,mp,r1,LS,vp,up,je,MS,DS,Dn,s1,l1,gp,c1,BS=ee(()=>{"use strict";Mc();_s();ca();da();Ve();be();oe();n1=z("tree-view").parts("branch","branchContent","branchControl","branchIndentGuide","branchIndicator","branchText","branchTrigger","item","itemIndicator","itemText","label","nodeCheckbox","nodeRenameInput","root","tree"),ct=n1.build(),mp=e=>new iu(e);mp.empty=()=>new iu({rootNode:{children:[]}});r1=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`tree:${e.id}:root`},LS=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`tree:${e.id}:label`},vp=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.node)==null?void 0:r.call(n,t))!=null?i:`tree:${e.id}:node:${t}`},up=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.tree)!=null?n:`tree:${e.id}:tree`},je=(e,t)=>{var n;t!=null&&((n=e.getById(vp(e,t)))==null||n.focus())},MS=(e,t)=>`tree:${e.id}:rename-input:${t}`,DS=(e,t)=>e.getById(MS(e,t));({and:Dn}=we()),s1=te({props({props:e}){return y(h({selectionMode:"single",collection:mp.empty(),typeahead:!0,expandOnClick:!0,defaultExpandedValue:[],defaultSelectedValue:[]},e),{translations:h({treeLabel:"Tree View",renameInputLabel:"Rename tree item"},e.translations)})},initialState(){return"idle"},context({prop:e,bindable:t,getContext:n}){return{expandedValue:t(()=>({defaultValue:e("defaultExpandedValue"),value:e("expandedValue"),isEqual:Ce,onChange(r){var o;let a=n().get("focusedValue");(o=e("onExpandedChange"))==null||o({expandedValue:r,focusedValue:a,get expandedNodes(){return e("collection").findNodes(r)}})}})),selectedValue:t(()=>({defaultValue:e("defaultSelectedValue"),value:e("selectedValue"),isEqual:Ce,onChange(r){var o;let a=n().get("focusedValue");(o=e("onSelectionChange"))==null||o({selectedValue:r,focusedValue:a,get selectedNodes(){return e("collection").findNodes(r)}})}})),focusedValue:t(()=>({defaultValue:e("defaultFocusedValue")||null,value:e("focusedValue"),onChange(r){var i;(i=e("onFocusChange"))==null||i({focusedValue:r,get focusedNode(){return r?e("collection").findNode(r):null}})}})),loadingStatus:t(()=>({defaultValue:{}})),checkedValue:t(()=>({defaultValue:e("defaultCheckedValue")||[],value:e("checkedValue"),isEqual:Ce,onChange(r){var i;(i=e("onCheckedChange"))==null||i({checkedValue:r})}})),renamingValue:t(()=>({sync:!0,defaultValue:null}))}},refs(){return{typeaheadState:h({},ft.defaultOptions),pendingAborts:new Map}},computed:{isMultipleSelection:({prop:e})=>e("selectionMode")==="multiple",isTypingAhead:({refs:e})=>e.get("typeaheadState").keysSoFar.length>0,visibleNodes:({prop:e,context:t})=>{let n=[];return e("collection").visit({skip:Ln({prop:e,context:t}),onEnter:(r,i)=>{n.push({node:r,indexPath:i})}}),n}},on:{"EXPANDED.SET":{actions:["setExpanded"]},"EXPANDED.CLEAR":{actions:["clearExpanded"]},"EXPANDED.ALL":{actions:["expandAllBranches"]},"BRANCH.EXPAND":{actions:["expandBranches"]},"BRANCH.COLLAPSE":{actions:["collapseBranches"]},"SELECTED.SET":{actions:["setSelected"]},"SELECTED.ALL":[{guard:Dn("isMultipleSelection","moveFocus"),actions:["selectAllNodes","focusTreeLastNode"]},{guard:"isMultipleSelection",actions:["selectAllNodes"]}],"SELECTED.CLEAR":{actions:["clearSelected"]},"NODE.SELECT":{actions:["selectNode"]},"NODE.DESELECT":{actions:["deselectNode"]},"CHECKED.TOGGLE":{actions:["toggleChecked"]},"CHECKED.SET":{actions:["setChecked"]},"CHECKED.CLEAR":{actions:["clearChecked"]},"NODE.FOCUS":{actions:["setFocusedNode"]},"NODE.ARROW_DOWN":[{guard:Dn("isShiftKey","isMultipleSelection"),actions:["focusTreeNextNode","extendSelectionToNextNode"]},{actions:["focusTreeNextNode"]}],"NODE.ARROW_UP":[{guard:Dn("isShiftKey","isMultipleSelection"),actions:["focusTreePrevNode","extendSelectionToPrevNode"]},{actions:["focusTreePrevNode"]}],"NODE.ARROW_LEFT":{actions:["focusBranchNode"]},"BRANCH_NODE.ARROW_LEFT":[{guard:"isBranchExpanded",actions:["collapseBranch"]},{actions:["focusBranchNode"]}],"BRANCH_NODE.ARROW_RIGHT":[{guard:Dn("isBranchFocused","isBranchExpanded"),actions:["focusBranchFirstNode"]},{actions:["expandBranch"]}],"SIBLINGS.EXPAND":{actions:["expandSiblingBranches"]},"NODE.HOME":[{guard:Dn("isShiftKey","isMultipleSelection"),actions:["extendSelectionToFirstNode","focusTreeFirstNode"]},{actions:["focusTreeFirstNode"]}],"NODE.END":[{guard:Dn("isShiftKey","isMultipleSelection"),actions:["extendSelectionToLastNode","focusTreeLastNode"]},{actions:["focusTreeLastNode"]}],"NODE.CLICK":[{guard:Dn("isCtrlKey","isMultipleSelection"),actions:["toggleNodeSelection"]},{guard:Dn("isShiftKey","isMultipleSelection"),actions:["extendSelectionToNode"]},{actions:["selectNode"]}],"BRANCH_NODE.CLICK":[{guard:Dn("isCtrlKey","isMultipleSelection"),actions:["toggleNodeSelection"]},{guard:Dn("isShiftKey","isMultipleSelection"),actions:["extendSelectionToNode"]},{guard:"expandOnClick",actions:["selectNode","toggleBranchNode"]},{actions:["selectNode"]}],"BRANCH_TOGGLE.CLICK":{actions:["toggleBranchNode"]},"TREE.TYPEAHEAD":{actions:["focusMatchedNode"]}},exit:["clearPendingAborts"],states:{idle:{on:{"NODE.RENAME":{target:"renaming",actions:["setRenamingValue"]}}},renaming:{entry:["syncRenameInput","focusRenameInput"],on:{"RENAME.SUBMIT":{guard:"isRenameLabelValid",target:"idle",actions:["submitRenaming"]},"RENAME.CANCEL":{target:"idle",actions:["cancelRenaming"]}}}},implementations:{guards:{isBranchFocused:({context:e,event:t})=>e.get("focusedValue")===t.id,isBranchExpanded:({context:e,event:t})=>e.get("expandedValue").includes(t.id),isShiftKey:({event:e})=>e.shiftKey,isCtrlKey:({event:e})=>e.ctrlKey,hasSelectedItems:({context:e})=>e.get("selectedValue").length>0,isMultipleSelection:({prop:e})=>e("selectionMode")==="multiple",moveFocus:({event:e})=>!!e.moveFocus,expandOnClick:({prop:e})=>!!e("expandOnClick"),isRenameLabelValid:({event:e})=>e.label.trim()!==""},actions:{selectNode({context:e,event:t}){let n=t.id||t.value;e.set("selectedValue",r=>n==null?r:!t.isTrusted&&cr(n)?r.concat(...n):[cr(n)?en(n):n].filter(Boolean))},deselectNode({context:e,event:t}){let n=$a(t.id||t.value);e.set("selectedValue",r=>Ft(r,...n))},setFocusedNode({context:e,event:t}){e.set("focusedValue",t.id)},clearFocusedNode({context:e}){e.set("focusedValue",null)},clearSelectedItem({context:e}){e.set("selectedValue",[])},toggleBranchNode({context:e,event:t,action:n}){let r=e.get("expandedValue").includes(t.id);n(r?["collapseBranch"]:["expandBranch"])},expandBranch(e){let{event:t}=e;kc(e,[t.id])},expandBranches(e){let{context:t,event:n}=e,r=$a(n.value);kc(e,Ts(r,t.get("expandedValue")))},collapseBranch({context:e,event:t}){e.set("expandedValue",n=>Ft(n,t.id))},collapseBranches(e){let{context:t,event:n}=e,r=$a(n.value);t.set("expandedValue",i=>Ft(i,...r))},setExpanded({context:e,event:t}){cr(t.value)&&e.set("expandedValue",t.value)},clearExpanded({context:e}){e.set("expandedValue",[])},setSelected({context:e,event:t}){cr(t.value)&&e.set("selectedValue",t.value)},clearSelected({context:e}){e.set("selectedValue",[])},focusTreeFirstNode(e){let{prop:t,scope:n}=e,r=t("collection"),i=r.getFirstNode(void 0,{skip:Ln(e)});if(!i)return;let a=r.getNodeValue(i);xi(e,a)?B(()=>je(n,a)):je(n,a)},focusTreeLastNode(e){let{prop:t,scope:n}=e,r=t("collection"),i=r.getLastNode(void 0,{skip:Ln(e)}),a=r.getNodeValue(i);xi(e,a)?B(()=>je(n,a)):je(n,a)},focusBranchFirstNode(e){let{event:t,prop:n,scope:r}=e,i=n("collection"),a=i.findNode(t.id),o=i.getFirstNode(a,{skip:Ln(e)});if(!o)return;let s=i.getNodeValue(o);xi(e,s)?B(()=>je(r,s)):je(r,s)},focusTreeNextNode(e){let{event:t,prop:n,scope:r}=e,i=n("collection"),a=i.getNextNode(t.id,{skip:Ln(e)});if(!a)return;let o=i.getNodeValue(a);xi(e,o)?B(()=>je(r,o)):je(r,o)},focusTreePrevNode(e){let{event:t,prop:n,scope:r}=e,i=n("collection"),a=i.getPreviousNode(t.id,{skip:Ln(e)});if(!a)return;let o=i.getNodeValue(a);xi(e,o)?B(()=>je(r,o)):je(r,o)},focusBranchNode(e){let{event:t,prop:n,scope:r}=e,i=n("collection"),a=i.getParentNode(t.id),o=a?i.getNodeValue(a):void 0;if(!o)return;xi(e,o)?B(()=>je(r,o)):je(r,o)},selectAllNodes({context:e,prop:t}){e.set("selectedValue",t("collection").getValues())},focusMatchedNode(e){let{context:t,prop:n,refs:r,event:i,scope:a,computed:o}=e,l=o("visibleNodes").map(({node:g})=>({textContent:n("collection").stringifyNode(g),id:n("collection").getNodeValue(g)})),c=ft(l,{state:r.get("typeaheadState"),activeId:t.get("focusedValue"),key:i.key});if(!(c!=null&&c.id))return;xi(e,c.id)?B(()=>je(a,c.id)):je(a,c.id)},toggleNodeSelection({context:e,event:t}){let n=tn(e.get("selectedValue"),t.id);e.set("selectedValue",n)},expandAllBranches(e){let{context:t,prop:n}=e,r=n("collection").getBranchValues(),i=Ts(r,t.get("expandedValue"));kc(e,i)},expandSiblingBranches(e){let{context:t,event:n,prop:r}=e,i=r("collection"),a=i.getIndexPath(n.id);if(!a)return;let s=i.getSiblingNodes(a).map(c=>i.getNodeValue(c)),l=Ts(s,t.get("expandedValue"));kc(e,l)},extendSelectionToNode(e){let{context:t,event:n,prop:r,computed:i}=e,a=r("collection"),o=Dt(t.get("selectedValue"))||a.getNodeValue(a.getFirstNode()),s=n.id,l=[o,s],c=0;i("visibleNodes").forEach(({node:g})=>{let p=a.getNodeValue(g);c===1&&l.push(p),(p===o||p===s)&&c++}),t.set("selectedValue",gt(l))},extendSelectionToNextNode(e){let{context:t,event:n,prop:r}=e,i=r("collection"),a=i.getNextNode(n.id,{skip:Ln(e)});if(!a)return;let o=new Set(t.get("selectedValue")),s=i.getNodeValue(a);s!=null&&(o.has(n.id)&&o.has(s)?o.delete(n.id):o.has(s)||o.add(s),t.set("selectedValue",Array.from(o)))},extendSelectionToPrevNode(e){let{context:t,event:n,prop:r}=e,i=r("collection"),a=i.getPreviousNode(n.id,{skip:Ln(e)});if(!a)return;let o=new Set(t.get("selectedValue")),s=i.getNodeValue(a);s!=null&&(o.has(n.id)&&o.has(s)?o.delete(n.id):o.has(s)||o.add(s),t.set("selectedValue",Array.from(o)))},extendSelectionToFirstNode(e){let{context:t,prop:n}=e,r=n("collection"),i=Dt(t.get("selectedValue")),a=[];r.visit({skip:Ln(e),onEnter:o=>{let s=r.getNodeValue(o);if(a.push(s),s===i)return"stop"}}),t.set("selectedValue",a)},extendSelectionToLastNode(e){let{context:t,prop:n}=e,r=n("collection"),i=Dt(t.get("selectedValue")),a=[],o=!1;r.visit({skip:Ln(e),onEnter:s=>{let l=r.getNodeValue(s);l===i&&(o=!0),o&&a.push(l)}}),t.set("selectedValue",a)},clearPendingAborts({refs:e}){let t=e.get("pendingAborts");t.forEach(n=>n.abort()),t.clear()},toggleChecked({context:e,event:t,prop:n}){let r=n("collection");e.set("checkedValue",i=>t.isBranch?i1(r,t.value,i):tn(i,t.value))},setChecked({context:e,event:t}){e.set("checkedValue",t.value)},clearChecked({context:e}){e.set("checkedValue",[])},setRenamingValue({context:e,event:t,prop:n}){e.set("renamingValue",t.value);let r=n("onRenameStart");if(r){let i=n("collection"),a=i.getIndexPath(t.value);if(a){let o=i.at(a);o&&r({value:t.value,node:o,indexPath:a})}}},submitRenaming({context:e,event:t,prop:n,scope:r}){var c;let i=e.get("renamingValue");if(!i)return;let o=n("collection").getIndexPath(i);if(!o)return;let s=t.label.trim(),l=n("onBeforeRename");if(l&&!l({value:i,label:s,indexPath:o})){e.set("renamingValue",null),je(r,i);return}(c=n("onRenameComplete"))==null||c({value:i,label:s,indexPath:o}),e.set("renamingValue",null),je(r,i)},cancelRenaming({context:e,scope:t}){let n=e.get("renamingValue");e.set("renamingValue",null),n&&je(t,n)},syncRenameInput({context:e,scope:t,prop:n}){let r=e.get("renamingValue");if(!r)return;let i=n("collection"),a=i.findNode(r);if(!a)return;let o=i.stringifyNode(a),s=DS(t,r);_e(s,o)},focusRenameInput({context:e,scope:t}){let n=e.get("renamingValue");if(!n)return;let r=DS(t,n);r&&(r.focus(),r.select())}}}});l1=class extends X{constructor(t,n){let o=n,{rootNode:r}=o,i=St(o,["rootNode"]),a=FS(r);super(t,y(h({},i),{collection:a}));Q(this,"treeCollection");Q(this,"syncTree",()=>{let t=this.el.querySelector('[data-scope="tree-view"][data-part="tree"]');t&&(this.spreadProps(t,this.api.getTreeProps()),this.updateExistingTree(t))});this.treeCollection=a}replaceRootNode(t){let n=FS(t);this.treeCollection=n,this.updateProps({collection:n})}initMachine(t){return new Y(s1,h({},t))}initApi(){return this.zagConnect(o1)}getNodeAt(t){var r;if(t.length===0)return;let n=this.treeCollection.rootNode;for(let i of t)if(n=(r=n==null?void 0:n.children)==null?void 0:r[i],!n)return;return n}updateExistingTree(t){var o;this.spreadProps(t,this.api.getTreeProps());let n=(o=this.el.dataset.animation)!=null?o:"instant",r=s=>s.closest('[data-scope="tree-view"][data-part="tree"]')===t,i=t.querySelectorAll('[data-scope="tree-view"][data-part="branch"]');for(let s of i){if(!r(s))continue;let l=s.getAttribute("data-path");if(l==null)continue;let c=l.split("/").map(T=>parseInt(T,10)),d=this.getNodeAt(c);if(!d)continue;let g={indexPath:c,node:d};this.spreadProps(s,this.api.getBranchProps(g));let p=s.querySelector('[data-scope="tree-view"][data-part="branch-control"]');p&&this.spreadProps(p,this.api.getBranchControlProps(g));let u=s.querySelector('[data-scope="tree-view"][data-part="branch-text"]');u&&this.spreadProps(u,this.api.getBranchTextProps(g));let f=s.querySelector('[data-scope="tree-view"][data-part="branch-indicator"]');f&&this.spreadProps(f,this.api.getBranchIndicatorProps(g));let m=s.querySelector('[data-scope="tree-view"][data-part="branch-content"]');if(m){let T=this.api.getBranchContentProps(g);n==="instant"?this.spreadProps(m,T):(n==="js"||n==="custom")&&(this.spreadProps(m,Zr(T)),m.removeAttribute("hidden"))}let S=s.querySelector('[data-scope="tree-view"][data-part="branch-indent-guide"]');S&&this.spreadProps(S,this.api.getBranchIndentGuideProps(g))}let a=t.querySelectorAll('[data-scope="tree-view"][data-part="item"]');for(let s of a){if(!r(s))continue;let l=s.getAttribute("data-path");if(l==null)continue;let c=l.split("/").map(f=>parseInt(f,10)),d=this.getNodeAt(c);if(!d)continue;let g={indexPath:c,node:d};this.spreadProps(s,this.api.getItemProps(g));let p=s.querySelector('[data-scope="tree-view"][data-part="item-text"]');p&&this.spreadProps(p,this.api.getItemTextProps(g));let u=s.querySelector('[data-scope="tree-view"][data-part="item-indicator"]');u&&this.spreadProps(u,this.api.getItemIndicatorProps(g))}}render(){var r;let t=(r=this.el.querySelector('[data-scope="tree-view"][data-part="root"]'))!=null?r:this.el;this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="tree-view"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps()),this.syncTree()}};gp='[data-scope="tree-view"][data-part="branch-content"]';c1={mounted(){var p,u,f,m,S,T,w,I,P;let e=this.el,t=this,n=this.pushEvent.bind(this),r=()=>j(this.liveSocket),i=fp(e);this.lastDataTree=e.dataset.tree;let a=O(e,"controlled");t.lastExpanded=a?(p=Ie(e,"expandedValue"))!=null?p:[]:(u=Ie(e,"defaultExpandedValue"))!=null?u:[],t.lastSelected=a?(f=Ie(e,"selectedValue"))!=null?f:[]:(m=Ie(e,"defaultSelectedValue"))!=null?m:[],t.lastExpandedAttr=pp(e),t.lastSelectedAttr=hp(e);let o=new l1(e,y(h({id:e.id,rootNode:i},a?{expandedValue:(S=Ie(e,"expandedValue"))!=null?S:[],selectedValue:(T=Ie(e,"selectedValue"))!=null?T:[]}:{defaultExpandedValue:(w=Ie(e,"defaultExpandedValue"))!=null?w:[],defaultSelectedValue:(I=Ie(e,"defaultSelectedValue"))!=null?I:[]}),{selectionMode:(P=V(e,"selectionMode"))!=null?P:"single",typeahead:e.dataset.typeahead!=="false",dir:q(e),onSelectionChange:v=>{var J,ue,Z;let E=O(e,"redirect"),R=(J=v.selectedValue)!=null&&J.length?v.selectedValue[0]:void 0,x=R?e.querySelector(`[data-scope="tree-view"][data-part="item"][data-value="${CSS.escape(R)}"]`):null,C=!!x;E&&C&&On(wn(x,R),{liveSocket:this.liveSocket});let A=(ue=v.selectedValue)!=null?ue:[],N=(Z=t.lastSelected)!=null?Z:[],{added:k,removed:L}=Na(A,N);t.lastSelected=A;let K={id:e.id,selectedValue:A,previousSelectedValue:N,added:k,removed:L,focusedValue:v.focusedValue,isItem:C};W({el:e,canPushServer:r(),pushEvent:n,payload:K,serverEventName:V(e,"onSelectionChange"),clientEventName:V(e,"onSelectionChangeClient")})},onExpandedChange:v=>{var N,k;let E=(N=v.expandedValue)!=null?N:[],R=(k=t.lastExpanded)!=null?k:[],{added:x,removed:C}=Na(E,R);t.lastExpanded=E;let A={id:e.id,expandedValue:E,previousExpandedValue:R,added:x,removed:C,focusedValue:v.focusedValue};W({el:e,canPushServer:r(),pushEvent:n,payload:A,serverEventName:V(e,"onExpandedChange"),clientEventName:V(e,"onExpandedChangeClient")}),eo({el:e,selector:gp,prevOpen:R,nextOpen:E,resolveValue:yd})}}));o.init(),this.treeView=o,Ms(e,gp);let s={el:e,pushEvent:n,canPushServer:r},l=ji(s,{getValue:()=>o.api.selectedValue,serverEventName:"tree_view_value_response",domEventName:"tree-view-value"}),c=ji(s,{getValue:()=>o.api.expandedValue,serverEventName:"tree_view_expanded_value_response",domEventName:"tree-view-expanded-value"}),d=ie(e);this.domRegistry=d,d.add("corex:tree-view:set-expanded-value",v=>{o.api.setExpandedValue(v.detail.value)}),d.add("corex:tree-view:set-selected-value",v=>{o.api.setSelectedValue(v.detail.value)}),d.add("corex:tree-view:value",v=>{l(de(v.detail))}),d.add("corex:tree-view:expanded-value",v=>{c(de(v.detail))});let g=re(this);this.handleRegistry=g,g.add("tree_view_set_expanded_value",v=>{$(e.id,H(v))&&o.api.setExpandedValue(v.value)}),g.add("tree_view_set_selected_value",v=>{$(e.id,H(v))&&o.api.setSelectedValue(v.value)}),g.add("tree_view_value",v=>{$(e.id,H(v))&&l(de(v))}),g.add("tree_view_expanded_value",v=>{$(e.id,H(v))&&c(de(v))})},beforeUpdate(){var t;let{el:e}=this;O(e,"controlled")&&Vt(e)&&(this.previousExpanded=(t=Ie(e,"expandedValue"))!=null?t:[])},updated(){var p,u,f,m,S,T;let{el:e}=this,t=this.treeView;if(!t)return;let n=e.dataset.tree;n!=null&&n!==this.lastDataTree&&(this.lastDataTree=n,t.replaceRootNode(fp(e)));let r=O(e,"controlled"),i=$S(e),a=r?(p=Ie(e,"selectedValue"))!=null?p:[]:(u=Ie(e,"defaultSelectedValue"))!=null?u:[],o=r?(f=Ie(e,"expandedValue"))!=null?f:[]:(m=Ie(e,"defaultExpandedValue"))!=null?m:[],s=pp(e),l=hp(e),c=s!==this.lastExpandedAttr,d=l!==this.lastSelectedAttr;if(this.lastExpandedAttr=s,this.lastSelectedAttr=l,!r){t.updateProps(i),c&&t.api.setExpandedValue(o),d&&t.api.setSelectedValue(a);return}let g=(T=(S=this.previousExpanded)!=null?S:this.lastExpanded)!=null?T:[];this.previousExpanded=void 0,c&&(this.lastExpanded=o),d&&(this.lastSelected=a),eo({el:e,selector:gp,prevOpen:g,nextOpen:o,resolveValue:yd}),t.updateProps(y(h({},i),{expandedValue:o,selectedValue:a}))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.treeView)==null||n.destroy()}}});var u1={};pe(u1,{Hooks:()=>US,animateHeightClose:()=>Vp,animateHeightOpen:()=>Op,animateScaleClose:()=>xp,animateScaleOpen:()=>Ap,applyClosedHeight:()=>ls,applyClosedScale:()=>ds,applyOpenHeight:()=>cs,applyOpenScale:()=>us,default:()=>d1,findAccordionContent:()=>Ip,findDialogBackdrop:()=>Cp,findDialogContent:()=>wp,findTreeBranch:()=>Tp});var gs="ease-out";function ps(){return typeof window!="undefined"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function ls(e){e.style.opacity="0",e.style.height="0px",e.style.overflow="hidden"}function cs(e){e.style.opacity="",e.style.height="",e.style.overflow=""}function Ip(e,t){return e.querySelector(`[data-scope="accordion"][data-part="item"][data-value="${CSS.escape(t)}"] [data-part="item-content"]`)}function Tp(e,t){return e.querySelector(`[data-scope="tree-view"][data-part="branch-content"][data-value="${CSS.escape(t)}"]`)}function Cp(e){return e.querySelector('[data-scope="dialog"][data-part="backdrop"]')}function wp(e){return e.querySelector('[data-scope="dialog"][data-part="content"]')}function ds(e,t={}){var a,o;let n=e.dataset.part==="backdrop",r=(a=t.opacityStart)!=null?a:0,i=(o=t.scaleStart)!=null?o:.96;e.style.opacity=String(r),!n&&i!==1?e.style.transform=`scale(${i})`:e.style.removeProperty("transform")}function us(e){e.style.opacity="",e.style.removeProperty("transform")}function Op(e,t){var s,l,c,d;if(ps())return cs(e),Promise.resolve();let n=(s=t.duration)!=null?s:.3,r=(l=t.easing)!=null?l:gs,i=(c=t.opacityStart)!=null?c:0,a=(d=t.opacityEnd)!=null?d:1,o=`${e.scrollHeight}px`;return e.style.height="0px",e.style.overflow="hidden",Promise.resolve(t.animator(e,{height:["0px",o],opacity:[i,a]},{duration:n,easing:r}).finished.then(()=>{cs(e)})).then(()=>{})}function Vp(e,t){var s,l,c,d;if(ps())return ls(e),Promise.resolve();let n=(s=t.duration)!=null?s:.3,r=(l=t.easing)!=null?l:gs,i=(c=t.opacityStart)!=null?c:0,a=(d=t.opacityEnd)!=null?d:1,o=`${e.scrollHeight}px`;return e.style.height=o,e.style.overflow="hidden",Promise.resolve(t.animator(e,{height:[o,"0px"],opacity:[a,i]},{duration:n,easing:r}).finished.then(()=>{ls(e)})).then(()=>{})}function Ap(e,t){var d,g,p,u,f,m;let n=e.dataset.part==="backdrop";if(ps())return us(e),Promise.resolve();let r=(d=t.duration)!=null?d:.3,i=(g=t.easing)!=null?g:gs,a=(p=t.opacityStart)!=null?p:0,o=(u=t.opacityEnd)!=null?u:1,s=(f=t.scaleStart)!=null?f:.96,l=(m=t.scaleEnd)!=null?m:1,c={opacity:[a,o]};return!n&&(s!==l||s!==1||l!==1)&&(c.transform=[`scale(${s})`,`scale(${l})`]),Promise.resolve(t.animator(e,c,{duration:r,easing:i}).finished.then(()=>{us(e)})).then(()=>{})}function xp(e,t){var d,g,p,u,f,m;let n=e.dataset.part==="backdrop";if(ps())return ds(e,{scaleStart:t.scaleStart,opacityStart:t.opacityStart}),Promise.resolve();let r=(d=t.duration)!=null?d:.3,i=(g=t.easing)!=null?g:gs,a=(p=t.opacityStart)!=null?p:0,o=(u=t.opacityEnd)!=null?u:1,s=(f=t.scaleStart)!=null?f:.96,l=(m=t.scaleEnd)!=null?m:1,c={opacity:[o,a]};return!n&&(s!==l||s!==1||l!==1)&&(c.transform=[`scale(${l})`,`scale(${s})`]),Promise.resolve(t.animator(e,c,{duration:r,easing:i}).finished.then(()=>{ds(e,{scaleStart:s,opacityStart:a})})).then(()=>{})}function he(e,t){return{mounted(){return Ke(this,null,function*(){let r=this.el;try{let a=(yield e())[t];this._realHook=a,a!=null&&a.mounted&&(yield a.mounted.call(this))}finally{r.removeAttribute("data-loading")}})},updated(){var r,i;(i=(r=this._realHook)==null?void 0:r.updated)==null||i.call(this)},destroyed(){var r,i;(i=(r=this._realHook)==null?void 0:r.destroyed)==null||i.call(this)},disconnected(){var r,i;(i=(r=this._realHook)==null?void 0:r.disconnected)==null||i.call(this)},reconnected(){var r,i;(i=(r=this._realHook)==null?void 0:r.reconnected)==null||i.call(this)},beforeUpdate(){var r,i;(i=(r=this._realHook)==null?void 0:r.beforeUpdate)==null||i.call(this)}}}var US={Accordion:he(()=>Promise.resolve().then(()=>(Xh(),Yh)),"Accordion"),AngleSlider:he(()=>Promise.resolve().then(()=>(Ef(),bf)),"AngleSlider"),Avatar:he(()=>Promise.resolve().then(()=>(Cf(),Tf)),"Avatar"),Carousel:he(()=>Promise.resolve().then(()=>(Df(),Lf)),"Carousel"),Checkbox:he(()=>Promise.resolve().then(()=>(qf(),Gf)),"Checkbox"),Clipboard:he(()=>Promise.resolve().then(()=>(Yf(),jf)),"Clipboard"),Collapsible:he(()=>Promise.resolve().then(()=>(Jf(),Zf)),"Collapsible"),Combobox:he(()=>Promise.resolve().then(()=>(lv(),sv)),"Combobox"),ColorPicker:he(()=>Promise.resolve().then(()=>(Vv(),Ov)),"ColorPicker"),DatePicker:he(()=>Promise.resolve().then(()=>(Ay(),Vy)),"DatePicker"),Dialog:he(()=>Promise.resolve().then(()=>(Gy(),Uy)),"Dialog"),Editable:he(()=>Promise.resolve().then(()=>(Zy(),Xy)),"Editable"),FileUpload:he(()=>Promise.resolve().then(()=>(gb(),ub)),"FileUpload"),FloatingPanel:he(()=>Promise.resolve().then(()=>(kb(),Rb)),"FloatingPanel"),Listbox:he(()=>Promise.resolve().then(()=>(Db(),Lb)),"Listbox"),Marquee:he(()=>Promise.resolve().then(()=>(_b(),Mb)),"Marquee"),Menu:he(()=>Promise.resolve().then(()=>(nE(),tE)),"Menu"),NumberInput:he(()=>Promise.resolve().then(()=>(EE(),bE)),"NumberInput"),Pagination:he(()=>Promise.resolve().then(()=>(wE(),CE)),"Pagination"),PasswordInput:he(()=>Promise.resolve().then(()=>(AE(),VE)),"PasswordInput"),PinInput:he(()=>Promise.resolve().then(()=>(ME(),FE)),"PinInput"),RadioGroup:he(()=>Promise.resolve().then(()=>(WE(),qE)),"RadioGroup"),Select:he(()=>Promise.resolve().then(()=>(nP(),tP)),"Select"),SignaturePad:he(()=>Promise.resolve().then(()=>(TP(),IP)),"SignaturePad"),Switch:he(()=>Promise.resolve().then(()=>(AP(),VP)),"Switch"),TagsInput:he(()=>Promise.resolve().then(()=>(BP(),HP)),"TagsInput"),Tabs:he(()=>Promise.resolve().then(()=>(YP(),jP)),"Tabs"),Timer:he(()=>Promise.resolve().then(()=>(tS(),eS)),"Timer"),Toast:he(()=>Promise.resolve().then(()=>(fS(),hS)),"Toast"),Tooltip:he(()=>Promise.resolve().then(()=>(PS(),ES)),"Tooltip"),Toggle:he(()=>Promise.resolve().then(()=>(CS(),TS)),"Toggle"),ToggleGroup:he(()=>Promise.resolve().then(()=>(NS(),kS)),"ToggleGroup"),TreeView:he(()=>Promise.resolve().then(()=>(BS(),HS)),"TreeView")},d1=US;return jS(u1);})(); + `,this.parts={title:this.el.querySelector('[data-part="title"]'),description:this.el.querySelector('[data-part="description"]'),close:this.el.querySelector('[data-part="close-trigger"]'),action:this.el.querySelector('[data-part="action-trigger"]'),ghostBefore:this.el.querySelector('[data-part="ghost-before"]'),ghostAfter:this.el.querySelector('[data-part="ghost-after"]'),progressbar:this.el.querySelector('[data-part="progressbar"]'),loadingSpinner:this.el.querySelector('[data-part="loading-spinner"]')}}initMachine(t){return new Y(vM,t)}initApi(){return this.zagConnect(fM)}render(){var c,d,u,p,g;this.spreadProps(this.el,this.api.getRootProps()),this.spreadProps(this.parts.close,this.api.getCloseTriggerProps()),this.spreadProps(this.parts.ghostBefore,this.api.getGhostBeforeProps()),this.spreadProps(this.parts.ghostAfter,this.api.getGhostAfterProps());let t=this.el.closest('[phx-hook="Toast"]'),n=t==null?void 0:t.querySelector("[data-loading-icon-template]"),r=t==null?void 0:t.querySelector("[data-close-icon-template]"),i=n==null?void 0:n.innerHTML,a=r==null?void 0:r.innerHTML;a?this.parts.close.innerHTML!==a&&(this.parts.close.innerHTML=a):this.parts.close.innerHTML||(this.parts.close.innerHTML="\xD7"),this.parts.title.textContent!==this.api.title&&(this.parts.title.textContent=(c=this.api.title)!=null?c:""),this.parts.description.textContent!==this.api.description&&(this.parts.description.textContent=(d=this.api.description)!=null?d:""),this.spreadProps(this.parts.title,this.api.getTitleProps()),this.spreadProps(this.parts.description,this.api.getDescriptionProps());let o=!!((u=this.latestProps.action)!=null&&u.label);if(this.hadAction&&!o){let f=document.createElement("button");f.type="button",f.setAttribute("data-scope","toast"),f.setAttribute("data-part","action-trigger"),f.hidden=!0,this.parts.action.replaceWith(f),this.parts.action=f}if(this.hadAction=o,o){this.parts.action.hidden=!1,this.spreadProps(this.parts.action,this.api.getActionTriggerProps());let f=(g=(p=this.latestProps.action)==null?void 0:p.label)!=null?g:"";this.parts.action.textContent!==f&&(this.parts.action.textContent=f);let m=IM(this.latestProps.action);m.length&&this.parts.action.classList.add(...m)}else this.parts.action.hidden=!0,this.parts.action.textContent&&(this.parts.action.textContent="");let s=this.duration;s==="Infinity"||s===1/0||s===Number.POSITIVE_INFINITY?(this.parts.progressbar.style.display="none",this.el.setAttribute("data-duration-infinity","true")):(this.parts.progressbar.style.display="block",this.el.removeAttribute("data-duration-infinity")),this.showLoading?(this.parts.loadingSpinner.style.display="flex",i&&this.parts.loadingSpinner.innerHTML!==i&&(this.parts.loadingSpinner.innerHTML=i)):this.parts.loadingSpinner.style.display="none"}},CM=class extends X{constructor(t,n){var r;super(t,n);Q(this,"toastComponents",new Map);Q(this,"groupEl");Q(this,"store");Q(this,"destroy",()=>{for(let t of this.toastComponents.values())t.destroy();this.toastComponents.clear(),this.machine.stop()});this.store=n.store,this.groupEl=(r=t.querySelector('[data-part="group"]'))!=null?r:(()=>{let i=document.createElement("div");return i.setAttribute("data-scope","toast"),i.setAttribute("data-part","group"),t.appendChild(i),i})()}initMachine(t){return new Y(lS.machine,t)}initApi(){return this.zagConnect(lS.connect)}render(){this.spreadProps(this.groupEl,this.api.getGroupProps());let t=this.api.getToasts().filter(r=>typeof r.id=="string"),n=new Set(t.map(r=>r.id));t.forEach((r,i)=>{var o;let a=this.toastComponents.get(r.id);if(a)a.duration=r.duration,a.showLoading=((o=r.meta)==null?void 0:o.loading)===!0,a.updateProps(y(h({},r),{parent:this.machine.service,index:i}));else{let s=document.createElement("div");s.classList.add("toast-item"),s.setAttribute("data-scope","toast"),s.setAttribute("data-part","root"),this.groupEl.appendChild(s),a=new TM(s,y(h({},r),{parent:this.machine.service,index:i})),a.init(),this.toastComponents.set(r.id,a)}});for(let[r,i]of this.toastComponents)n.has(r)||(i.destroy(),this.toastComponents.delete(r))}};VM=e=>e===!0||e==="true"?{meta:{loading:!0}}:{};xM={mounted(){var R;let e=this.el;e.id||(e.id=_a(e,"toast")),this.groupId=e.id;let t=x=>{if(x)try{return x.includes("{")?JSON.parse(x):x}catch(C){return x}},n=x=>x==="Infinity"||x===1/0?1/0:typeof x=="string"?parseInt(x,10)||void 0:x,r=x=>{if(x==null)return;let C=typeof x=="string"?parseInt(x,10):x;if(!(!Number.isFinite(C)||C<1||C>8))return C},i=(R=V(e,"placement",["top-start","top","top-end","bottom-start","bottom","bottom-end"]))!=null?R:"bottom-end";wM(e,{id:this.groupId,placement:i,overlap:O(e,"overlap"),max:U(e,"max"),gap:U(e,"gap"),offsets:t(V(e,"offset")),pauseOnPageIdle:O(e,"pauseOnPageIdle")}),e.setAttribute("data-ready","");let a=Ai(this.groupId),o=e.getAttribute("data-flash-info"),s=e.getAttribute("data-flash-info-title"),l=e.getAttribute("data-flash-error"),c=e.getAttribute("data-flash-error-title"),d=e.getAttribute("data-flash-info-duration"),u=e.getAttribute("data-flash-error-duration");if(a&&o)try{a.create({title:s||"Success",description:o,type:"info",id:_a(void 0,"toast"),duration:n(d!=null?d:void 0)})}catch(x){console.error("Failed to create flash info toast:",x)}if(a&&l)try{a.create({title:c||"Error",description:l,type:"error",id:_a(void 0,"toast"),duration:n(u!=null?u:void 0)})}catch(x){console.error("Failed to create flash error toast:",x)}let p=AM(this),g=x=>{var k;let C=lp(x.action),A=h({title:(k=x.title)!=null?k:"",description:x.description,type:x.type||"info",id:x.id||_a(void 0,"toast"),duration:n(x.duration)},VM(x.loading));C&&(A.action=cS(C,p));let N=r(x.priority);return N!==void 0&&(A.priority=N),A},f=x=>{let C={};x.title!==void 0&&(C.title=x.title),x.description!==void 0&&(C.description=x.description),x.type!==void 0&&(C.type=x.type),x.duration!==void 0&&(C.duration=n(x.duration)),x.loading===!0||x.loading==="true"?C.meta={loading:!0}:(x.loading===!1||x.loading==="false")&&(C.meta={loading:!1});let A=lp(x.action);A?C.action=cS(A,p):x.action===null&&(C.action=void 0);let N=r(x.priority);return N!==void 0&&(C.priority=N),C},m=x=>{let C=Ai(x.groupId||this.groupId);if(C)try{C.dismiss(x.id)}catch(A){console.error("Failed to dismiss toast:",A)}},S=x=>{let C=Ai(x.groupId||this.groupId);if(C)try{C.remove(x.id)}catch(A){console.error("Failed to remove toast:",A)}};this.handlers=[],this.handlers.push(this.handleEvent("toast-create",x=>{let C=Ai(x.groupId||this.groupId);if(C)try{C.create(g(x))}catch(A){console.error("Failed to create toast:",A)}})),this.handlers.push(this.handleEvent("toast-update",x=>{let C=Ai(x.groupId||this.groupId);if(!(!C||!x.id))try{C.update(x.id,f(x))}catch(A){console.error("Failed to update toast:",A)}})),this.handlers.push(this.handleEvent("toast-dismiss",m)),this.handlers.push(this.handleEvent("toast-remove",S));let T=x=>{let{detail:C}=x,A=Ai(C.groupId||this.groupId);if(A)try{A.create(g(C))}catch(N){console.error("Failed to create toast:",N)}},w=x=>{let{detail:C}=x,A=Ai(C.groupId||this.groupId);if(!(!A||!C.id))try{A.update(C.id,f(C))}catch(N){console.error("Failed to update toast:",N)}},I=x=>{m(x.detail)},P=x=>{S(x.detail)},v=[],E=(x,C)=>{e.addEventListener(x,C),v.push({el:e,name:x,fn:C})};this.domListeners=v,E("toast:create",T),E("toast:update",w),E("toast:dismiss",I),E("toast:remove",P)},destroyed(){var e;for(let{el:t,name:n,fn:r}of(e=this.domListeners)!=null?e:[])t.removeEventListener(n,r);if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);this.groupId&&OM(this.groupId)}}});var ES={};pe(ES,{Tooltip:()=>HM,getCloseDelay:()=>dp});function kM(e,t=Object.is){let n=h({},e),r=new Set,i=d=>(r.add(d),()=>r.delete(d)),a=()=>{r.forEach(d=>d())};return{subscribe:i,get:d=>n[d],set:(d,u)=>{t(n[d],u)||(n[d]=u,a())},update:d=>{let u=!1;for(let p in d){let g=d[p];g!==void 0&&!t(n[p],g)&&(n[p]=g,u=!0)}u&&a()},snapshot:()=>h({},n)}}function FM(e,t){let{state:n,context:r,send:i,scope:a,prop:o,event:s}=e,l=o("id"),c=!!o("aria-label"),d=n.matches("open","closing"),u=r.get("triggerValue"),p=NM(a),g=o("disabled"),f=Ut(y(h({},o("positioning")),{placement:r.get("currentPlacement")}));return{open:d,setOpen(m){n.matches("open","closing")!==m&&i({type:m?"open":"close"})},triggerValue:u,setTriggerValue(m){i({type:"triggerValue.set",value:m!=null?m:void 0})},reposition(m={}){i({type:"positioning.set",options:m})},getTriggerProps(m={}){let{value:S}=m,T=S==null?!1:u===S,w=yS(a,S);return t.button(y(h({},Qo.trigger.attrs),{id:w,"data-ownedby":a.id,"data-value":S,"data-current":b(T),dir:o("dir"),"data-expanded":b(d),"data-state":d?"open":"closed","aria-describedby":d?p:void 0,onClick(I){if(I.defaultPrevented||g||!o("closeOnClick"))return;let P=d&&S!=null&&!T;i({type:P?"triggerValue.set":"close",src:"trigger.click",value:S,triggerId:w})},onFocus(I){if(I.defaultPrevented||g||!vn())return;let P=d&&S!=null&&!T;i({type:P?"triggerValue.set":"open",src:"trigger.focus",value:S,triggerId:w})},onBlur(I){var E;if(I.defaultPrevented||g||l!==Lt.get("id"))return;let P=(E=I.relatedTarget)!=null?E:a.getDoc().activeElement;(P==null?void 0:P.closest(`[data-ownedby="${a.id}"]`))!=null||i({type:"close",src:"trigger.blur",value:S,triggerId:w})},onPointerDown(I){I.defaultPrevented||g||fe(I)&&o("closeOnPointerDown")&&l===Lt.get("id")&&i({type:"close",src:"trigger.pointerdown",value:S,triggerId:w})},onPointerMove(I){if(I.defaultPrevented||g||I.pointerType==="touch")return;let P=d&&S!=null&&!T;i({type:P?"triggerValue.set":"pointer.move",value:S,triggerId:w})},onPointerOver(I){I.defaultPrevented||g||I.pointerType!=="touch"&&i({type:"pointer.move",value:S,triggerId:w})},onPointerLeave(){g||i({type:"pointer.leave"})},onPointerCancel(){g||i({type:"pointer.leave"})}}))},getArrowProps(){return t.element(y(h({id:LM(a)},Qo.arrow.attrs),{dir:o("dir"),style:f.arrow}))},getArrowTipProps(){return t.element(y(h({},Qo.arrowTip.attrs),{dir:o("dir"),style:f.arrowTip}))},getPositionerProps(){return t.element(y(h({id:bS(a)},Qo.positioner.attrs),{dir:o("dir"),style:f.floating}))},getContentProps(){let m=Lt.get("id")===l,S=Lt.get("prevId")===l,T=Lt.get("instant")&&(d&&m||S);return t.element(y(h({},Qo.content.attrs),{dir:o("dir"),hidden:!d,"data-state":d?"open":"closed","data-instant":b(T),role:c?void 0:"tooltip",id:c?void 0:p,"data-placement":r.get("currentPlacement"),onPointerEnter(){i({type:"content.pointer.move"})},onPointerLeave(){i({type:"content.pointer.leave"})},style:{pointerEvents:o("interactive")?"auto":"none"}}))}}}function vS(e,t,n){return{onOpenChange:a=>{let o=V(e,"onOpenChange");o&&j(n)&&t(o,{id:e.id,open:a.open});let s=V(e,"onOpenChangeClient");s&&e.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:{id:e.id,open:a.open}}))},onTriggerValueChange:a=>{var s;let o=V(e,"onTriggerValueChange");o&&j(n)&&t(o,{id:e.id,value:(s=a.value)!=null?s:""})}}}function dp(e){let t=O(e,"interactive"),n=U(e,"closeDelay");return t&&(n===void 0||n===0)?400:n}var RM,Qo,yS,NM,LM,bS,cp,DM,es,Lt,MM,mS,_M,$M,HM,PS=ee(()=>{"use strict";ii();xr();yn();be();oe();RM=z("tooltip").parts("trigger","arrow","arrowTip","positioner","content"),Qo=RM.build();yS=(e,t)=>{var r;let n=(r=e.ids)==null?void 0:r.trigger;return n!=null?Qe(n)?n(t):n:t?`tooltip:${e.id}:trigger:${t}`:`tooltip:${e.id}:trigger`},NM=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`tooltip:${e.id}:content`},LM=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.arrow)!=null?n:`tooltip:${e.id}:arrow`},bS=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`tooltip:${e.id}:popper`},cp=e=>e.getById(bS(e)),DM=e=>Oe(e.getDoc(),`[data-scope="tooltip"][data-part="trigger"][data-ownedby="${e.id}"]`),es=(e,t)=>t==null?DM(e)[0]:e.getById(yS(e,t)),Lt=kM({id:null,prevId:null,instant:!1});({and:MM,not:mS}=we()),_M=te({initialState:({prop:e})=>e("open")||e("defaultOpen")?"open":"closed",props({props:e}){var r,i;gn(e,["id"]);let t=(r=e.closeOnClick)!=null?r:!0,n=(i=e.closeOnPointerDown)!=null?i:t;return y(h({openDelay:400,closeDelay:150,closeOnEscape:!0,interactive:!1,closeOnScroll:!0,disabled:!1},e),{closeOnPointerDown:n,closeOnClick:t,positioning:h({placement:"bottom"},e.positioning)})},effects:["trackFocusVisible","trackStore"],context:({bindable:e,prop:t,scope:n})=>({currentPlacement:e(()=>({defaultValue:void 0})),hasPointerMoveOpened:e(()=>({defaultValue:null})),triggerValue:e(()=>{var r;return{defaultValue:(r=t("defaultTriggerValue"))!=null?r:null,value:t("triggerValue"),onChange(i){let a=t("onTriggerValueChange");if(!a)return;let o=es(n,i);a({value:i,triggerElement:o})}}})}),watch({track:e,action:t,prop:n}){e([()=>n("disabled")],()=>{t(["closeIfDisabled"])}),e([()=>n("open")],()=>{t(["toggleVisibility"])}),e([()=>n("triggerValue")],()=>{t(["repositionImmediate"])})},on:{"triggerValue.set":{actions:["setTriggerValue","repositionImmediate"]}},states:{closed:{entry:["clearGlobalId"],on:{"controlled.open":{target:"open"},open:[{guard:"isOpenControlled",actions:["setTriggerValue","invokeOnOpen"]},{target:"open",actions:["setTriggerValue","invokeOnOpen"]}],"pointer.leave":{actions:["clearPointerMoveOpened"]},"pointer.move":[{guard:MM("noVisibleTooltip",mS("hasPointerMoveOpened")),target:"opening",actions:["setTriggerValue"]},{guard:mS("hasPointerMoveOpened"),target:"open",actions:["setPointerMoveOpened","invokeOnOpen","setTriggerValue"]}]}},opening:{effects:["trackScroll","trackPointerlockChange","waitForOpenDelay"],on:{"after.openDelay":[{guard:"isOpenControlled",actions:["setPointerMoveOpened","invokeOnOpen"]},{target:"open",actions:["setPointerMoveOpened","invokeOnOpen"]}],"controlled.open":{target:"open"},"controlled.close":{target:"closed"},open:[{guard:"isOpenControlled",actions:["setTriggerValue","invokeOnOpen"]},{target:"open",actions:["setTriggerValue","invokeOnOpen"]}],"pointer.leave":[{guard:"isOpenControlled",actions:["clearPointerMoveOpened","invokeOnClose","toggleVisibility"]},{target:"closed",actions:["clearPointerMoveOpened","invokeOnClose"]}],close:[{guard:"isOpenControlled",actions:["invokeOnClose","toggleVisibility"]},{target:"closed",actions:["invokeOnClose"]}]}},open:{effects:["trackEscapeKey","trackScroll","trackPointerlockChange","trackPositioning"],entry:["setGlobalId"],on:{"controlled.close":{target:"closed"},close:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],"pointer.leave":[{guard:"isVisible",target:"closing",actions:["clearPointerMoveOpened"]},{guard:"isOpenControlled",actions:["clearPointerMoveOpened","invokeOnClose"]},{target:"closed",actions:["clearPointerMoveOpened","invokeOnClose"]}],"content.pointer.leave":{guard:"isInteractive",target:"closing"},"positioning.set":{actions:["reposition"]},"triggerValue.set":{target:"closing",actions:["setTriggerValue","immediateReopen"]}}},closing:{effects:["trackPositioning","waitForCloseDelay"],on:{"after.closeDelay":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],"controlled.close":{target:"closed"},"controlled.open":{target:"open"},close:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],"pointer.move":[{guard:"isOpenControlled",actions:["setPointerMoveOpened","setTriggerValue","invokeOnOpen","toggleVisibility"]},{target:"open",actions:["setPointerMoveOpened","setTriggerValue","invokeOnOpen"]}],"triggerValue.set":{target:"open",actions:["setTriggerValue","repositionImmediate"]},reopen:{target:"open"},"content.pointer.move":{guard:"isInteractive",target:"open"},"positioning.set":{actions:["reposition"]}}}},implementations:{guards:{noVisibleTooltip:()=>Lt.get("id")===null,isVisible:({prop:e})=>e("id")===Lt.get("id"),isInteractive:({prop:e})=>!!e("interactive"),hasPointerMoveOpened:({context:e})=>!!e.get("hasPointerMoveOpened"),isOpenControlled:({prop:e})=>e("open")!==void 0},actions:{setGlobalId:({prop:e})=>{let t=Lt.get("id"),n=t!==null&&t!==e("id");Lt.update({id:e("id"),prevId:n?t:null,instant:n})},clearGlobalId:({prop:e})=>{e("id")===Lt.get("id")&&Lt.update({id:null,prevId:null,instant:!1})},invokeOnOpen:({prop:e})=>{var t;(t=e("onOpenChange"))==null||t({open:!0})},invokeOnClose:({prop:e})=>{var t;(t=e("onOpenChange"))==null||t({open:!1})},closeIfDisabled:({prop:e,send:t})=>{e("disabled")&&t({type:"close",src:"disabled.change"})},reposition:({context:e,event:t,prop:n,scope:r})=>{if(t.type!=="positioning.set")return;Xe(()=>es(r,e.get("triggerValue")),()=>cp(r),y(h(h({},n("positioning")),t.options),{listeners:!1,onComplete(o){e.set("currentPlacement",o.placement)}}))},repositionImmediate:({context:e,event:t,prop:n,scope:r})=>{var s;let i=(s=t.value)!=null?s:e.get("triggerValue");return Xe(()=>es(r,i),()=>cp(r),y(h({},n("positioning")),{onComplete(l){e.set("currentPlacement",l.placement)}}))},toggleVisibility:({prop:e,event:t,send:n})=>{queueMicrotask(()=>{n({type:e("open")?"controlled.open":"controlled.close",previousEvent:t})})},setPointerMoveOpened:({context:e,event:t})=>{var r,i;let n=(i=t.triggerId)!=null?i:(r=t.previousEvent)==null?void 0:r.triggerId;e.set("hasPointerMoveOpened",n!=null?n:null)},clearPointerMoveOpened:({context:e})=>{e.set("hasPointerMoveOpened",null)},setTriggerValue:({context:e,event:t})=>{t.value!==void 0&&e.set("triggerValue",t.value)},immediateReopen:({send:e})=>{queueMicrotask(()=>{e({type:"reopen"})})}},effects:{trackFocusVisible:({scope:e})=>{var t;return nt({root:(t=e.getRootNode)==null?void 0:t.call(e)})},trackPositioning:({context:e,prop:t,scope:n})=>(e.get("currentPlacement")||e.set("currentPlacement",t("positioning").placement),Xe(()=>es(n,e.get("triggerValue")),()=>cp(n),y(h({},t("positioning")),{defer:!0,onComplete(a){e.set("currentPlacement",a.placement)}}))),trackPointerlockChange:({send:e,scope:t})=>{let n=t.getDoc();return ae(n,"pointerlockchange",()=>e({type:"close",src:"pointerlock:change"}),!1)},trackScroll:({send:e,prop:t,scope:n,context:r})=>{if(!t("closeOnScroll"))return;let i=r.get("triggerValue"),a=es(n,i);if(!a)return;let s=cd(a).map(l=>ae(l,"scroll",()=>{e({type:"close",src:"scroll"})},{passive:!0,capture:!0}));return()=>{s.forEach(l=>l==null?void 0:l())}},trackStore:({prop:e,send:t})=>{let n;return queueMicrotask(()=>{n=Lt.subscribe(()=>{Lt.get("id")!==e("id")&&t({type:"close",src:"id.change"})})}),()=>n==null?void 0:n()},trackEscapeKey:({send:e,prop:t})=>t("closeOnEscape")?ae(document,"keydown",r=>{Me(r)||r.key==="Escape"&&(r.stopPropagation(),e({type:"close",src:"keydown.escape"}))},!0):void 0,waitForOpenDelay:({send:e,prop:t,event:n})=>{let r=setTimeout(()=>{e({type:"after.openDelay",previousEvent:n})},t("openDelay"));return()=>clearTimeout(r)},waitForCloseDelay:({send:e,prop:t,event:n})=>{let r=setTimeout(()=>{e({type:"after.closeDelay",previousEvent:n})},t("closeDelay"));return()=>clearTimeout(r)}}}}),$M=class extends X{initMachine(e){return new Y(_M,e)}initApi(){return this.zagConnect(FM)}syncDom(){this.api=this.initApi(),this.render()}render(){let e=this.el;e.querySelectorAll('[data-scope="tooltip"][data-part="trigger"]').forEach(o=>{let s=o.dataset.value,l=s!=null&&s!==""?{value:s}:{};this.spreadProps(o,this.api.getTriggerProps(l))});let n=e.querySelector('[data-scope="tooltip"][data-part="positioner"]');n&&this.spreadProps(n,this.api.getPositionerProps());let r=e.querySelector('[data-scope="tooltip"][data-part="content"]');r&&this.spreadProps(r,this.api.getContentProps());let i=e.querySelector('[data-scope="tooltip"][data-part="arrow"]');i&&this.spreadProps(i,this.api.getArrowProps());let a=e.querySelector('[data-scope="tooltip"][data-part="arrow-tip"]');a&&this.spreadProps(a,this.api.getArrowTipProps())}};HM={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=this.liveSocket,r=qe(e),i=vS(e,t,n),a=new $M(e,h({id:e.id,defaultOpen:O(e,"defaultOpen"),disabled:O(e,"disabled"),dir:q(e),openDelay:U(e,"openDelay"),closeDelay:dp(e),positioning:r,closeOnEscape:O(e,"closeOnEscape"),closeOnClick:O(e,"closeOnClick"),closeOnPointerDown:O(e,"closeOnPointerDown"),closeOnScroll:O(e,"closeOnScroll"),interactive:O(e,"interactive")},i));a.init(),this.tooltip=a,this.onSetOpen=o=>{let{open:s}=o.detail;a.api.setOpen(s)},e.addEventListener("corex:tooltip:set-open",this.onSetOpen),this.handlers=[],this.handlers.push(this.handleEvent("tooltip_set_open",o=>{$(e.id,H(o))&&a.api.setOpen(o.open)}))},updated(){var a;let e=this.el,t=this.pushEvent.bind(this),n=this.liveSocket,r=qe(e),i=vS(e,t,n);(a=this.tooltip)==null||a.updateProps(h({id:e.id,disabled:O(e,"disabled"),dir:q(e),openDelay:U(e,"openDelay"),closeDelay:dp(e),positioning:r,closeOnEscape:O(e,"closeOnEscape"),closeOnClick:O(e,"closeOnClick"),closeOnPointerDown:O(e,"closeOnPointerDown"),closeOnScroll:O(e,"closeOnScroll"),interactive:O(e,"interactive")},i)),queueMicrotask(()=>{var o,s,l,c;(o=this.tooltip)==null||o.syncDom(),(c=(s=this.tooltip)==null?void 0:(l=s.api).reposition)==null||c.call(l)})},destroyed(){var e;if(this.onSetOpen&&this.el.removeEventListener("corex:tooltip:set-open",this.onSetOpen),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.tooltip)==null||e.destroy()}}});var TS={};pe(TS,{Toggle:()=>WM,pressedChangePayload:()=>IS});function GM(e,t){let{context:n,prop:r,send:i}=e,a=n.get("pressed");return{pressed:a,disabled:!!r("disabled"),setPressed(o){i({type:"PRESS.SET",value:o})},getRootProps(){return t.element(y(h({type:"button"},SS.root.attrs),{disabled:r("disabled"),"aria-pressed":a,"data-state":a?"on":"off","data-pressed":b(a),"data-disabled":b(r("disabled")),onClick(o){o.defaultPrevented||r("disabled")||i({type:"PRESS.TOGGLE"})}}))},getIndicatorProps(){return t.element(y(h({},SS.indicator.attrs),{"data-disabled":b(r("disabled")),"data-pressed":b(a),"data-state":a?"on":"off"}))}}}function IS(e,t){return{id:e.id,pressed:t}}var BM,SS,UM,qM,WM,CS=ee(()=>{"use strict";$e();Ve();be();oe();BM=z("toggle",["root","indicator"]),SS=BM.build();UM=te({props({props:e}){return h({defaultPressed:!1},e)},context({prop:e,bindable:t}){return{pressed:t(()=>({value:e("pressed"),defaultValue:e("defaultPressed"),onChange(n){var r;(r=e("onPressedChange"))==null||r(n)}}))}},initialState(){return"idle"},on:{"PRESS.TOGGLE":{actions:["togglePressed"]},"PRESS.SET":{actions:["setPressed"]}},states:{idle:{}},implementations:{actions:{togglePressed({context:e}){e.set("pressed",!e.get("pressed"))},setPressed({context:e,event:t}){e.set("pressed",t.value)}}}}),qM=class extends X{initMachine(e){return new Y(UM,e)}initApi(){return this.zagConnect(GM)}render(){let e=this.el.querySelector('[data-scope="toggle"][data-part="root"]');if(!e)return;this.spreadProps(e,this.api.getRootProps());let t=e.querySelector(':scope > [data-scope="toggle"][data-part="indicator"]');t&&this.spreadProps(t,this.api.getIndicatorProps())}};WM={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=()=>j(this.liveSocket),r=O(e,"controlled"),i=Ye(e,"pressed"),a=Ye(e,"defaultPressed"),o=new qM(e,y(h({id:e.id},r?{pressed:i===!0}:{defaultPressed:a===!0}),{disabled:O(e,"disabled"),dir:q(e),onPressedChange:c=>{W({el:e,canPushServer:n(),pushEvent:t,payload:IS(e,c),serverEventName:V(e,"onPressedChange"),clientEventName:V(e,"onPressedChangeClient")})}}));o.init(),this.zagToggle=o;let s=ie(e);this.domRegistry=s,s.add("corex:toggle:set-pressed",c=>{var u;let d=(u=c.detail)==null?void 0:u.pressed;typeof d=="boolean"&&o.api.setPressed(d)}),s.add("corex:toggle:toggle-pressed",()=>{o.api.setPressed(!o.api.pressed)});let l=re(this);this.handleRegistry=l,l.add("toggle_set_pressed",c=>{if(!$(e.id,H(c)))return;let d=qh(c);typeof d=="boolean"&&o.api.setPressed(d)}),l.add("toggle_toggle_pressed",c=>{$(e.id,H(c))&&o.api.setPressed(!o.api.pressed)}),l.add("toggle_pressed",c=>{$(e.id,H(c))&&n()&&this.pushEvent("toggle_pressed_response",{id:e.id,value:o.api.pressed})})},updated(){var e;(e=this.zagToggle)==null||e.updateProps(y(h({id:this.el.id},Bh(this.el)),{disabled:O(this.el,"disabled"),dir:q(this.el)}))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.zagToggle)==null||n.destroy()}}});var kS={};pe(kS,{ToggleGroup:()=>t1,readToggleGroupPayloadValue:()=>RS,valueChangePayload:()=>xS});function ZM(e,t){let{context:n,send:r,prop:i,scope:a}=e,o=n.get("value"),s=i("disabled"),l=!i("multiple"),c=i("rovingFocus"),d=i("orientation")==="horizontal";function u(p){let g=zM(a,p.value);return{id:g,disabled:!!(p.disabled||s),pressed:!!o.includes(p.value),focused:n.get("focusedId")===g}}return{value:o,setValue(p){r({type:"VALUE.SET",value:p})},getRootProps(){return t.element(y(h({},wS.root.attrs),{id:xc(a),dir:i("dir"),role:l?"radiogroup":"group",tabIndex:n.get("isTabbingBackward")?-1:0,"data-disabled":b(s),"data-orientation":i("orientation"),"data-focus":b(n.get("focusedId")!=null),style:{outline:"none"},onMouseDown(){s||r({type:"ROOT.MOUSE_DOWN"})},onFocus(p){s||p.currentTarget===ne(p)&&(n.get("isClickFocus")||n.get("isTabbingBackward")||r({type:"ROOT.FOCUS"}))},onBlur(p){let g=p.relatedTarget;ge(p.currentTarget,g)||s||r({type:"ROOT.BLUR"})}}))},getItemState:u,getItemProps(p){let g=u(p),f=g.focused?0:-1;return t.button(y(h({},wS.item.attrs),{id:g.id,type:"button","data-ownedby":xc(a),"data-focus":b(g.focused),disabled:g.disabled,tabIndex:c?f:void 0,role:l?"radio":void 0,"aria-checked":l?g.pressed:void 0,"aria-pressed":l?void 0:g.pressed,"data-disabled":b(g.disabled),"data-orientation":i("orientation"),dir:i("dir"),"data-state":g.pressed?"on":"off",onFocus(){g.disabled||r({type:"TOGGLE.FOCUS",id:g.id})},onClick(m){g.disabled||(r({type:"TOGGLE.CLICK",id:g.id,value:p.value}),wt()&&m.currentTarget.focus({preventScroll:!0}))},onKeyDown(m){if(m.defaultPrevented||!ge(m.currentTarget,ne(m))||g.disabled)return;let T={Tab(w){let I=w.shiftKey;r({type:"TOGGLE.SHIFT_TAB",isShiftTab:I})},ArrowLeft(){!c||!d||r({type:"TOGGLE.FOCUS_PREV"})},ArrowRight(){!c||!d||r({type:"TOGGLE.FOCUS_NEXT"})},ArrowUp(){!c||d||r({type:"TOGGLE.FOCUS_PREV"})},ArrowDown(){!c||d||r({type:"TOGGLE.FOCUS_NEXT"})},Home(){c&&r({type:"TOGGLE.FOCUS_FIRST"})},End(){c&&r({type:"TOGGLE.FOCUS_LAST"})}}[me(m)];T&&(T(m),m.key!=="Tab"&&m.preventDefault())}}))}}}function xS(e,t){return{id:e.id,value:t.value}}function RS(e){var r;if(!e||typeof e!="object")return;let t=e,n=(r=t.value)!=null?r:t.value;if(Array.isArray(n)&&n.every(i=>typeof i=="string"))return n}var KM,wS,xc,zM,AS,Rc,OS,jM,YM,XM,VS,JM,QM,e1,t1,NS=ee(()=>{"use strict";$e();Ve();be();oe();KM=z("toggle-group").parts("root","item"),wS=KM.build(),xc=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`toggle-group:${e.id}`},zM=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.item)==null?void 0:r.call(n,t))!=null?i:`toggle-group:${e.id}:${t}`},AS=e=>e.getById(xc(e)),Rc=e=>{let n=`[data-ownedby='${CSS.escape(xc(e))}']:not([data-disabled])`;return Oe(AS(e),n)},OS=e=>Dt(Rc(e)),jM=e=>en(Rc(e)),YM=(e,t,n)=>mr(Rc(e),t,n),XM=(e,t,n)=>vr(Rc(e),t,n);({not:VS,and:JM}=we()),QM=te({props({props:e}){return h({defaultValue:[],orientation:"horizontal",rovingFocus:!0,loopFocus:!0,deselectable:!0},e)},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var r;(r=e("onValueChange"))==null||r({value:n})}})),focusedId:t(()=>({defaultValue:null})),isTabbingBackward:t(()=>({defaultValue:!1})),isClickFocus:t(()=>({defaultValue:!1})),isWithinToolbar:t(()=>({defaultValue:!1}))}},computed:{currentLoopFocus:({context:e,prop:t})=>t("loopFocus")&&!e.get("isWithinToolbar")},entry:["checkIfWithinToolbar"],on:{"VALUE.SET":{actions:["setValue"]},"TOGGLE.CLICK":{actions:["setValue"]},"ROOT.MOUSE_DOWN":{actions:["setClickFocus"]}},states:{idle:{on:{"ROOT.FOCUS":{target:"focused",guard:VS(JM("isClickFocus","isTabbingBackward")),actions:["focusFirstToggle","clearClickFocus"]},"TOGGLE.FOCUS":{target:"focused",actions:["setFocusedId"]}}},focused:{on:{"ROOT.BLUR":{target:"idle",actions:["clearIsTabbingBackward","clearFocusedId","clearClickFocus"]},"TOGGLE.FOCUS":{actions:["setFocusedId"]},"TOGGLE.FOCUS_NEXT":{actions:["focusNextToggle"]},"TOGGLE.FOCUS_PREV":{actions:["focusPrevToggle"]},"TOGGLE.FOCUS_FIRST":{actions:["focusFirstToggle"]},"TOGGLE.FOCUS_LAST":{actions:["focusLastToggle"]},"TOGGLE.SHIFT_TAB":[{guard:VS("isFirstToggleFocused"),target:"idle",actions:["setIsTabbingBackward"]},{actions:["setIsTabbingBackward"]}]}}},implementations:{guards:{isClickFocus:({context:e})=>e.get("isClickFocus"),isTabbingBackward:({context:e})=>e.get("isTabbingBackward"),isFirstToggleFocused:({context:e,scope:t})=>{var n;return e.get("focusedId")===((n=OS(t))==null?void 0:n.id)}},actions:{setIsTabbingBackward({context:e}){e.set("isTabbingBackward",!0)},clearIsTabbingBackward({context:e}){e.set("isTabbingBackward",!1)},setClickFocus({context:e}){e.set("isClickFocus",!0)},clearClickFocus({context:e}){e.set("isClickFocus",!1)},checkIfWithinToolbar({context:e,scope:t}){var r;let n=(r=AS(t))==null?void 0:r.closest("[role=toolbar]");e.set("isWithinToolbar",!!n)},setFocusedId({context:e,event:t}){e.set("focusedId",t.id)},clearFocusedId({context:e}){e.set("focusedId",null)},setValue({context:e,event:t,prop:n}){gn(t,["value"]);let r=e.get("value");cr(t.value)?r=t.value:n("multiple")?r=tn(r,t.value):r=Ce(r,[t.value])&&n("deselectable")?[]:[t.value],e.set("value",r)},focusNextToggle({context:e,scope:t,prop:n}){B(()=>{var i;let r=e.get("focusedId");r&&((i=YM(t,r,n("loopFocus")))==null||i.focus({preventScroll:!0}))})},focusPrevToggle({context:e,scope:t,prop:n}){B(()=>{var i;let r=e.get("focusedId");r&&((i=XM(t,r,n("loopFocus")))==null||i.focus({preventScroll:!0}))})},focusFirstToggle({scope:e}){B(()=>{var t;(t=OS(e))==null||t.focus({preventScroll:!0})})},focusLastToggle({scope:e}){B(()=>{var t;(t=jM(e))==null||t.focus({preventScroll:!0})})}}}}),e1=class extends X{initMachine(e){return new Y(QM,e)}initApi(){return this.zagConnect(ZM)}render(){let e=this.el.querySelector('[data-scope="toggle-group"][data-part="root"]');if(!e)return;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelectorAll('[data-scope="toggle-group"][data-part="item"]');for(let n=0;nj(this.liveSocket),r=y(h({id:e.id},O(e,"controlled")?{value:Ie(e,"value")}:{defaultValue:Ie(e,"defaultValue")}),{deselectable:O(e,"deselectable"),loopFocus:O(e,"loopFocus"),rovingFocus:O(e,"rovingFocus"),disabled:O(e,"disabled"),multiple:O(e,"multiple"),orientation:V(e,"orientation"),dir:q(e),onValueChange:s=>{W({el:e,canPushServer:n(),pushEvent:t,payload:xS(e,s),serverEventName:V(e,"onValueChange"),clientEventName:V(e,"onValueChangeClient")})}}),i=new e1(e,r);i.init(),this.toggleGroup=i;let a=ie(e);this.domRegistry=a,a.add("corex:toggle-group:set-value",s=>{let{value:l}=s.detail;i.api.setValue(l)});let o=re(this);this.handleRegistry=o,o.add("toggle-group_set_value",s=>{if(!$(e.id,H(s)))return;let l=RS(s);l&&i.api.setValue(l)}),o.add("toggle-group:value",s=>{$(e.id,H(s))&&n()&&this.pushEvent("toggle-group:value_response",{id:e.id,value:i.api.value})})},updated(){var e;(e=this.toggleGroup)==null||e.updateProps(y(h({},Ks(this.el,"value","defaultValue")),{deselectable:O(this.el,"deselectable"),loopFocus:O(this.el,"loopFocus"),rovingFocus:O(this.el,"rovingFocus"),disabled:O(this.el,"disabled"),multiple:O(this.el,"multiple"),orientation:V(this.el,"orientation"),dir:q(this.el)}))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.toggleGroup)==null||n.destroy()}}});var HS={};pe(HS,{TreeView:()=>c1,parseRootNode:()=>fp,readExpandedAttr:()=>pp,readSelectedAttr:()=>hp,readTreeViewInteractionProps:()=>$S});function _S(e,t,n){let r=e.getNodeValue(t);if(!e.isBranchNode(t))return n.includes(r);let i=e.getDescendantValues(r),a=i.every(s=>n.includes(s)),o=i.some(s=>n.includes(s));return a?!0:o?"indeterminate":!1}function i1(e,t,n){let r=e.getDescendantValues(t),i=r.every(a=>n.includes(a));return gt(i?Ft(n,...r):Tt(n,...r))}function a1(e,t){let n=new Map;return e.visit({onEnter:r=>{let i=e.getNodeValue(r),a=e.isBranchNode(r),o=_S(e,r,t);n.set(i,{type:a?"branch":"leaf",checked:o})}}),n}function o1(e,t){let{context:n,scope:r,computed:i,prop:a,send:o}=e,s=a("collection"),l=a("translations"),c=Array.from(n.get("expandedValue")),d=Array.from(n.get("selectedValue")),u=Array.from(n.get("checkedValue")),p=i("isTypingAhead"),g=n.get("focusedValue"),f=n.get("loadingStatus"),m=n.get("renamingValue"),S=({indexPath:P})=>s.getValuePath(P).slice(0,-1).some(E=>!c.includes(E)),T=s.getFirstNode(void 0,{skip:S}),w=T?s.getNodeValue(T):null;function I(P){let{node:v,indexPath:E}=P,R=s.getNodeValue(v);return{id:vp(r,R),value:R,indexPath:E,valuePath:s.getValuePath(E),disabled:!!v.disabled,focused:g==null?w===R:g===R,selected:d.includes(R),expanded:c.includes(R),loading:f[R]==="loading",depth:E.length,isBranch:s.isBranchNode(v),renaming:m===R,get checked(){return _S(s,v,u)}}}return{collection:s,expandedValue:c,selectedValue:d,checkedValue:u,toggleChecked(P,v){o({type:"CHECKED.TOGGLE",value:P,isBranch:v})},setChecked(P){o({type:"CHECKED.SET",value:P})},clearChecked(){o({type:"CHECKED.CLEAR"})},getCheckedMap(){return a1(s,u)},expand(P){o({type:P?"BRANCH.EXPAND":"EXPANDED.ALL",value:P})},collapse(P){o({type:P?"BRANCH.COLLAPSE":"EXPANDED.CLEAR",value:P})},deselect(P){o({type:P?"NODE.DESELECT":"SELECTED.CLEAR",value:P})},select(P){o({type:P?"NODE.SELECT":"SELECTED.ALL",value:P,isTrusted:!1})},getVisibleNodes(){return i("visibleNodes")},focus(P){je(r,P)},selectParent(P){let v=s.getParentNode(P);if(!v)return;let E=Tt(d,s.getNodeValue(v));o({type:"SELECTED.SET",value:E,src:"select.parent"})},expandParent(P){let v=s.getParentNode(P);if(!v)return;let E=Tt(c,s.getNodeValue(v));o({type:"EXPANDED.SET",value:E,src:"expand.parent"})},setExpandedValue(P){let v=gt(P);o({type:"EXPANDED.SET",value:v})},setSelectedValue(P){let v=gt(P);o({type:"SELECTED.SET",value:v})},startRenaming(P){o({type:"NODE.RENAME",value:P})},submitRenaming(P,v){o({type:"RENAME.SUBMIT",value:P,label:v})},cancelRenaming(){o({type:"RENAME.CANCEL"})},getRootProps(){return t.element(y(h({},ct.root.attrs),{id:r1(r),dir:a("dir")}))},getLabelProps(){return t.element(y(h({},ct.label.attrs),{id:LS(r),dir:a("dir")}))},getTreeProps(){return t.element(y(h({},ct.tree.attrs),{id:up(r),dir:a("dir"),role:"tree","aria-label":l.treeLabel,"aria-labelledby":LS(r),"aria-multiselectable":a("selectionMode")==="multiple"||void 0,tabIndex:-1,onKeyDown(P){if(P.defaultPrevented||Me(P))return;let v=ne(P);if($t(v))return;let E=v==null?void 0:v.closest("[data-part=branch-control], [data-part=item]");if(!E)return;let R=E.dataset.value;if(R==null){console.warn("[zag-js/tree-view] Node id not found for node",E);return}let x=E.matches("[data-part=branch-control]"),C={ArrowDown(k){Be(k)||(k.preventDefault(),o({type:"NODE.ARROW_DOWN",id:R,shiftKey:k.shiftKey}))},ArrowUp(k){Be(k)||(k.preventDefault(),o({type:"NODE.ARROW_UP",id:R,shiftKey:k.shiftKey}))},ArrowLeft(k){Be(k)||E.dataset.disabled||(k.preventDefault(),o({type:x?"BRANCH_NODE.ARROW_LEFT":"NODE.ARROW_LEFT",id:R}))},ArrowRight(k){!x||E.dataset.disabled||(k.preventDefault(),o({type:"BRANCH_NODE.ARROW_RIGHT",id:R}))},Home(k){Be(k)||(k.preventDefault(),o({type:"NODE.HOME",id:R,shiftKey:k.shiftKey}))},End(k){Be(k)||(k.preventDefault(),o({type:"NODE.END",id:R,shiftKey:k.shiftKey}))},Space(k){var L;E.dataset.disabled||(p?o({type:"TREE.TYPEAHEAD",key:k.key}):(L=C.Enter)==null||L.call(C,k))},Enter(k){E.dataset.disabled||_t(v)&&Be(k)||(o({type:x?"BRANCH_NODE.CLICK":"NODE.CLICK",id:R,src:"keyboard"}),_t(v)||k.preventDefault())},"*"(k){E.dataset.disabled||(k.preventDefault(),o({type:"SIBLINGS.EXPAND",id:R}))},a(k){!k.metaKey||E.dataset.disabled||(k.preventDefault(),o({type:"SELECTED.ALL",moveFocus:!0}))},F2(k){if(E.dataset.disabled)return;let L=a("canRename");if(!L)return;let K=s.getIndexPath(R);if(K){let J=s.at(K);if(J&&!L(J,K))return}k.preventDefault(),o({type:"NODE.RENAME",value:R})}},A=me(P,{dir:a("dir")}),N=C[A];if(N){N(P);return}ft.isValidEvent(P)&&(o({type:"TREE.TYPEAHEAD",key:P.key,id:R}),P.preventDefault())}}))},getNodeState:I,getItemProps(P){let v=I(P);return t.element(y(h({},ct.item.attrs),{id:v.id,dir:a("dir"),"data-ownedby":up(r),"data-path":P.indexPath.join("/"),"data-value":v.value,tabIndex:v.focused?0:-1,"data-focus":b(v.focused),role:"treeitem","aria-current":v.selected?"true":void 0,"aria-selected":v.disabled?void 0:v.selected,"data-selected":b(v.selected),"aria-disabled":se(v.disabled),"data-disabled":b(v.disabled),"data-renaming":b(v.renaming),"data-checked":b(v.checked===!0),"data-indeterminate":b(v.checked==="indeterminate"),"aria-level":v.depth,"data-depth":v.depth,style:{"--depth":v.depth},onFocus(E){E.stopPropagation(),o({type:"NODE.FOCUS",id:v.value})},onClick(E){if(v.disabled||!fe(E)||_t(E.currentTarget)&&Be(E))return;let R=E.metaKey||E.ctrlKey;o({type:"NODE.CLICK",id:v.value,shiftKey:E.shiftKey,ctrlKey:R}),E.stopPropagation(),_t(E.currentTarget)||E.preventDefault()}}))},getItemTextProps(P){let v=I(P);return t.element(y(h({},ct.itemText.attrs),{"data-disabled":b(v.disabled),"data-selected":b(v.selected),"data-focus":b(v.focused)}))},getItemIndicatorProps(P){let v=I(P);return t.element(y(h({},ct.itemIndicator.attrs),{"aria-hidden":!0,"data-disabled":b(v.disabled),"data-selected":b(v.selected),"data-focus":b(v.focused),hidden:!v.selected}))},getBranchProps(P){let v=I(P);return t.element(y(h({},ct.branch.attrs),{"data-depth":v.depth,dir:a("dir"),"data-branch":v.value,role:"treeitem","data-ownedby":up(r),"data-value":v.value,"aria-level":v.depth,"aria-selected":v.disabled?void 0:v.selected,"data-path":P.indexPath.join("/"),"data-selected":b(v.selected),"aria-expanded":v.expanded,"data-state":v.expanded?"open":"closed","aria-disabled":se(v.disabled),"data-disabled":b(v.disabled),"data-loading":b(v.loading),"aria-busy":se(v.loading),style:{"--depth":v.depth}}))},getBranchIndicatorProps(P){let v=I(P);return t.element(y(h({},ct.branchIndicator.attrs),{"aria-hidden":!0,"data-state":v.expanded?"open":"closed","data-disabled":b(v.disabled),"data-selected":b(v.selected),"data-focus":b(v.focused),"data-loading":b(v.loading)}))},getBranchTriggerProps(P){let v=I(P);return t.element(y(h({},ct.branchTrigger.attrs),{role:"button",dir:a("dir"),"data-disabled":b(v.disabled),"data-state":v.expanded?"open":"closed","data-value":v.value,"data-loading":b(v.loading),disabled:v.loading,onClick(E){v.disabled||v.loading||(o({type:"BRANCH_TOGGLE.CLICK",id:v.value}),E.stopPropagation())}}))},getBranchControlProps(P){let v=I(P);return t.element(y(h({},ct.branchControl.attrs),{role:"button",id:v.id,dir:a("dir"),tabIndex:v.focused?0:-1,"data-path":P.indexPath.join("/"),"data-state":v.expanded?"open":"closed","data-disabled":b(v.disabled),"data-selected":b(v.selected),"data-focus":b(v.focused),"data-renaming":b(v.renaming),"data-checked":b(v.checked===!0),"data-indeterminate":b(v.checked==="indeterminate"),"data-value":v.value,"data-depth":v.depth,"data-loading":b(v.loading),"aria-busy":se(v.loading),onFocus(E){o({type:"NODE.FOCUS",id:v.value}),E.stopPropagation()},onClick(E){if(v.disabled||v.loading||!fe(E)||_t(E.currentTarget)&&Be(E))return;let R=E.metaKey||E.ctrlKey;o({type:"BRANCH_NODE.CLICK",id:v.value,shiftKey:E.shiftKey,ctrlKey:R}),E.stopPropagation()}}))},getBranchTextProps(P){let v=I(P);return t.element(y(h({},ct.branchText.attrs),{dir:a("dir"),"data-disabled":b(v.disabled),"data-state":v.expanded?"open":"closed","data-loading":b(v.loading)}))},getBranchContentProps(P){let v=I(P);return t.element(y(h({},ct.branchContent.attrs),{role:"group",dir:a("dir"),"data-state":v.expanded?"open":"closed","data-depth":v.depth,"data-path":P.indexPath.join("/"),"data-value":v.value,hidden:!v.expanded}))},getBranchIndentGuideProps(P){let v=I(P);return t.element(y(h({},ct.branchIndentGuide.attrs),{"data-depth":v.depth}))},getNodeCheckboxProps(P){let v=I(P),E=v.checked;return t.element(y(h({},ct.nodeCheckbox.attrs),{tabIndex:-1,role:"checkbox","data-state":E===!0?"checked":E===!1?"unchecked":"indeterminate","aria-checked":E===!0?"true":E===!1?"false":"mixed","data-disabled":b(v.disabled),onClick(R){if(R.defaultPrevented||v.disabled||!fe(R))return;o({type:"CHECKED.TOGGLE",value:v.value,isBranch:v.isBranch}),R.stopPropagation();let x=R.currentTarget.closest("[role=treeitem]");x==null||x.focus({preventScroll:!0})}}))},getNodeRenameInputProps(P){let v=I(P);return t.input(y(h({},ct.nodeRenameInput.attrs),{id:MS(r,v.value),type:"text","aria-label":l.renameInputLabel,hidden:!v.renaming,onKeyDown(E){Me(E)||(E.key==="Escape"&&(o({type:"RENAME.CANCEL"}),E.preventDefault()),E.key==="Enter"&&(o({type:"RENAME.SUBMIT",label:E.currentTarget.value}),E.preventDefault()),E.stopPropagation())},onBlur(E){o({type:"RENAME.SUBMIT",label:E.currentTarget.value})}}))}}}function kc(e,t){let{context:n,prop:r,refs:i}=e;if(!r("loadChildren")){n.set("expandedValue",m=>gt(Tt(m,...t)));return}let a=n.get("loadingStatus"),[o,s]=Zc(t,m=>a[m]==="loaded");if(o.length>0&&n.set("expandedValue",m=>gt(Tt(m,...o))),s.length===0)return;let l=r("collection"),[c,d]=Zc(s,m=>{let S=l.findNode(m);return l.getNodeChildren(S).length>0});if(c.length>0&&n.set("expandedValue",m=>gt(Tt(m,...c))),d.length===0)return;n.set("loadingStatus",m=>h(h({},m),d.reduce((S,T)=>y(h({},S),{[T]:"loading"}),{})));let u=d.map(m=>{let S=l.getIndexPath(m),T=l.getValuePath(S),w=l.findNode(m);return{id:m,indexPath:S,valuePath:T,node:w}}),p=i.get("pendingAborts"),g=r("loadChildren");nn(g,()=>"[zag-js/tree-view] `loadChildren` is required for async expansion");let f=u.map(({id:m,indexPath:S,valuePath:T,node:w})=>{let I=p.get(m);I&&(I.abort(),p.delete(m));let P=new AbortController;return p.set(m,P),g({valuePath:T,indexPath:S,node:w,signal:P.signal})});Promise.allSettled(f).then(m=>{var P,v;let S=[],T=[],w=n.get("loadingStatus"),I=r("collection");m.forEach((E,R)=>{let{id:x,indexPath:C,node:A,valuePath:N}=u[R];E.status==="fulfilled"?(w[x]="loaded",S.push(x),I=I.replace(C,y(h({},A),{children:E.value}))):(p.delete(x),Reflect.deleteProperty(w,x),T.push({node:A,error:E.reason,indexPath:C,valuePath:N}))}),n.set("loadingStatus",w),S.length&&(n.set("expandedValue",E=>gt(Tt(E,...S))),(P=r("onLoadChildrenComplete"))==null||P({collection:I})),T.length&&((v=r("onLoadChildrenError"))==null||v({nodes:T}))})}function Ln(e){let{prop:t,context:n}=e;return function({indexPath:i}){return t("collection").getValuePath(i).slice(0,-1).some(o=>!n.get("expandedValue").includes(o))}}function xi(e,t){let{prop:n,scope:r,computed:i}=e,a=n("scrollToIndexFn");if(!a)return!1;let o=n("collection"),s=i("visibleNodes");for(let l=0;lr.getById(vp(r,t))}),!0}return!1}function FS(e){return mp({nodeToValue:t=>t.value,nodeToString:t=>t.name,rootNode:e})}function pp(e){var t,n;return O(e,"controlled")?(t=e.getAttribute("data-expanded-value"))!=null?t:"":(n=e.getAttribute("data-default-expanded-value"))!=null?n:""}function hp(e){var t,n;return O(e,"controlled")?(t=e.getAttribute("data-selected-value"))!=null?t:"":(n=e.getAttribute("data-default-selected-value"))!=null?n:""}function fp(e){let t=e.dataset.tree;if(t==null||t==="")throw new Error("TreeView: missing data-tree");return JSON.parse(t)}function $S(e){var t;return{selectionMode:(t=V(e,"selectionMode"))!=null?t:"single",typeahead:e.dataset.typeahead!=="false",dir:q(e)}}var n1,ct,mp,r1,LS,vp,up,je,MS,DS,Dn,s1,l1,gp,c1,BS=ee(()=>{"use strict";Mc();_s();ca();da();Ve();be();oe();n1=z("tree-view").parts("branch","branchContent","branchControl","branchIndentGuide","branchIndicator","branchText","branchTrigger","item","itemIndicator","itemText","label","nodeCheckbox","nodeRenameInput","root","tree"),ct=n1.build(),mp=e=>new iu(e);mp.empty=()=>new iu({rootNode:{children:[]}});r1=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`tree:${e.id}:root`},LS=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`tree:${e.id}:label`},vp=(e,t)=>{var n,r,i;return(i=(r=(n=e.ids)==null?void 0:n.node)==null?void 0:r.call(n,t))!=null?i:`tree:${e.id}:node:${t}`},up=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.tree)!=null?n:`tree:${e.id}:tree`},je=(e,t)=>{var n;t!=null&&((n=e.getById(vp(e,t)))==null||n.focus())},MS=(e,t)=>`tree:${e.id}:rename-input:${t}`,DS=(e,t)=>e.getById(MS(e,t));({and:Dn}=we()),s1=te({props({props:e}){return y(h({selectionMode:"single",collection:mp.empty(),typeahead:!0,expandOnClick:!0,defaultExpandedValue:[],defaultSelectedValue:[]},e),{translations:h({treeLabel:"Tree View",renameInputLabel:"Rename tree item"},e.translations)})},initialState(){return"idle"},context({prop:e,bindable:t,getContext:n}){return{expandedValue:t(()=>({defaultValue:e("defaultExpandedValue"),value:e("expandedValue"),isEqual:Ce,onChange(r){var o;let a=n().get("focusedValue");(o=e("onExpandedChange"))==null||o({expandedValue:r,focusedValue:a,get expandedNodes(){return e("collection").findNodes(r)}})}})),selectedValue:t(()=>({defaultValue:e("defaultSelectedValue"),value:e("selectedValue"),isEqual:Ce,onChange(r){var o;let a=n().get("focusedValue");(o=e("onSelectionChange"))==null||o({selectedValue:r,focusedValue:a,get selectedNodes(){return e("collection").findNodes(r)}})}})),focusedValue:t(()=>({defaultValue:e("defaultFocusedValue")||null,value:e("focusedValue"),onChange(r){var i;(i=e("onFocusChange"))==null||i({focusedValue:r,get focusedNode(){return r?e("collection").findNode(r):null}})}})),loadingStatus:t(()=>({defaultValue:{}})),checkedValue:t(()=>({defaultValue:e("defaultCheckedValue")||[],value:e("checkedValue"),isEqual:Ce,onChange(r){var i;(i=e("onCheckedChange"))==null||i({checkedValue:r})}})),renamingValue:t(()=>({sync:!0,defaultValue:null}))}},refs(){return{typeaheadState:h({},ft.defaultOptions),pendingAborts:new Map}},computed:{isMultipleSelection:({prop:e})=>e("selectionMode")==="multiple",isTypingAhead:({refs:e})=>e.get("typeaheadState").keysSoFar.length>0,visibleNodes:({prop:e,context:t})=>{let n=[];return e("collection").visit({skip:Ln({prop:e,context:t}),onEnter:(r,i)=>{n.push({node:r,indexPath:i})}}),n}},on:{"EXPANDED.SET":{actions:["setExpanded"]},"EXPANDED.CLEAR":{actions:["clearExpanded"]},"EXPANDED.ALL":{actions:["expandAllBranches"]},"BRANCH.EXPAND":{actions:["expandBranches"]},"BRANCH.COLLAPSE":{actions:["collapseBranches"]},"SELECTED.SET":{actions:["setSelected"]},"SELECTED.ALL":[{guard:Dn("isMultipleSelection","moveFocus"),actions:["selectAllNodes","focusTreeLastNode"]},{guard:"isMultipleSelection",actions:["selectAllNodes"]}],"SELECTED.CLEAR":{actions:["clearSelected"]},"NODE.SELECT":{actions:["selectNode"]},"NODE.DESELECT":{actions:["deselectNode"]},"CHECKED.TOGGLE":{actions:["toggleChecked"]},"CHECKED.SET":{actions:["setChecked"]},"CHECKED.CLEAR":{actions:["clearChecked"]},"NODE.FOCUS":{actions:["setFocusedNode"]},"NODE.ARROW_DOWN":[{guard:Dn("isShiftKey","isMultipleSelection"),actions:["focusTreeNextNode","extendSelectionToNextNode"]},{actions:["focusTreeNextNode"]}],"NODE.ARROW_UP":[{guard:Dn("isShiftKey","isMultipleSelection"),actions:["focusTreePrevNode","extendSelectionToPrevNode"]},{actions:["focusTreePrevNode"]}],"NODE.ARROW_LEFT":{actions:["focusBranchNode"]},"BRANCH_NODE.ARROW_LEFT":[{guard:"isBranchExpanded",actions:["collapseBranch"]},{actions:["focusBranchNode"]}],"BRANCH_NODE.ARROW_RIGHT":[{guard:Dn("isBranchFocused","isBranchExpanded"),actions:["focusBranchFirstNode"]},{actions:["expandBranch"]}],"SIBLINGS.EXPAND":{actions:["expandSiblingBranches"]},"NODE.HOME":[{guard:Dn("isShiftKey","isMultipleSelection"),actions:["extendSelectionToFirstNode","focusTreeFirstNode"]},{actions:["focusTreeFirstNode"]}],"NODE.END":[{guard:Dn("isShiftKey","isMultipleSelection"),actions:["extendSelectionToLastNode","focusTreeLastNode"]},{actions:["focusTreeLastNode"]}],"NODE.CLICK":[{guard:Dn("isCtrlKey","isMultipleSelection"),actions:["toggleNodeSelection"]},{guard:Dn("isShiftKey","isMultipleSelection"),actions:["extendSelectionToNode"]},{actions:["selectNode"]}],"BRANCH_NODE.CLICK":[{guard:Dn("isCtrlKey","isMultipleSelection"),actions:["toggleNodeSelection"]},{guard:Dn("isShiftKey","isMultipleSelection"),actions:["extendSelectionToNode"]},{guard:"expandOnClick",actions:["selectNode","toggleBranchNode"]},{actions:["selectNode"]}],"BRANCH_TOGGLE.CLICK":{actions:["toggleBranchNode"]},"TREE.TYPEAHEAD":{actions:["focusMatchedNode"]}},exit:["clearPendingAborts"],states:{idle:{on:{"NODE.RENAME":{target:"renaming",actions:["setRenamingValue"]}}},renaming:{entry:["syncRenameInput","focusRenameInput"],on:{"RENAME.SUBMIT":{guard:"isRenameLabelValid",target:"idle",actions:["submitRenaming"]},"RENAME.CANCEL":{target:"idle",actions:["cancelRenaming"]}}}},implementations:{guards:{isBranchFocused:({context:e,event:t})=>e.get("focusedValue")===t.id,isBranchExpanded:({context:e,event:t})=>e.get("expandedValue").includes(t.id),isShiftKey:({event:e})=>e.shiftKey,isCtrlKey:({event:e})=>e.ctrlKey,hasSelectedItems:({context:e})=>e.get("selectedValue").length>0,isMultipleSelection:({prop:e})=>e("selectionMode")==="multiple",moveFocus:({event:e})=>!!e.moveFocus,expandOnClick:({prop:e})=>!!e("expandOnClick"),isRenameLabelValid:({event:e})=>e.label.trim()!==""},actions:{selectNode({context:e,event:t}){let n=t.id||t.value;e.set("selectedValue",r=>n==null?r:!t.isTrusted&&cr(n)?r.concat(...n):[cr(n)?en(n):n].filter(Boolean))},deselectNode({context:e,event:t}){let n=$a(t.id||t.value);e.set("selectedValue",r=>Ft(r,...n))},setFocusedNode({context:e,event:t}){e.set("focusedValue",t.id)},clearFocusedNode({context:e}){e.set("focusedValue",null)},clearSelectedItem({context:e}){e.set("selectedValue",[])},toggleBranchNode({context:e,event:t,action:n}){let r=e.get("expandedValue").includes(t.id);n(r?["collapseBranch"]:["expandBranch"])},expandBranch(e){let{event:t}=e;kc(e,[t.id])},expandBranches(e){let{context:t,event:n}=e,r=$a(n.value);kc(e,Ts(r,t.get("expandedValue")))},collapseBranch({context:e,event:t}){e.set("expandedValue",n=>Ft(n,t.id))},collapseBranches(e){let{context:t,event:n}=e,r=$a(n.value);t.set("expandedValue",i=>Ft(i,...r))},setExpanded({context:e,event:t}){cr(t.value)&&e.set("expandedValue",t.value)},clearExpanded({context:e}){e.set("expandedValue",[])},setSelected({context:e,event:t}){cr(t.value)&&e.set("selectedValue",t.value)},clearSelected({context:e}){e.set("selectedValue",[])},focusTreeFirstNode(e){let{prop:t,scope:n}=e,r=t("collection"),i=r.getFirstNode(void 0,{skip:Ln(e)});if(!i)return;let a=r.getNodeValue(i);xi(e,a)?B(()=>je(n,a)):je(n,a)},focusTreeLastNode(e){let{prop:t,scope:n}=e,r=t("collection"),i=r.getLastNode(void 0,{skip:Ln(e)}),a=r.getNodeValue(i);xi(e,a)?B(()=>je(n,a)):je(n,a)},focusBranchFirstNode(e){let{event:t,prop:n,scope:r}=e,i=n("collection"),a=i.findNode(t.id),o=i.getFirstNode(a,{skip:Ln(e)});if(!o)return;let s=i.getNodeValue(o);xi(e,s)?B(()=>je(r,s)):je(r,s)},focusTreeNextNode(e){let{event:t,prop:n,scope:r}=e,i=n("collection"),a=i.getNextNode(t.id,{skip:Ln(e)});if(!a)return;let o=i.getNodeValue(a);xi(e,o)?B(()=>je(r,o)):je(r,o)},focusTreePrevNode(e){let{event:t,prop:n,scope:r}=e,i=n("collection"),a=i.getPreviousNode(t.id,{skip:Ln(e)});if(!a)return;let o=i.getNodeValue(a);xi(e,o)?B(()=>je(r,o)):je(r,o)},focusBranchNode(e){let{event:t,prop:n,scope:r}=e,i=n("collection"),a=i.getParentNode(t.id),o=a?i.getNodeValue(a):void 0;if(!o)return;xi(e,o)?B(()=>je(r,o)):je(r,o)},selectAllNodes({context:e,prop:t}){e.set("selectedValue",t("collection").getValues())},focusMatchedNode(e){let{context:t,prop:n,refs:r,event:i,scope:a,computed:o}=e,l=o("visibleNodes").map(({node:u})=>({textContent:n("collection").stringifyNode(u),id:n("collection").getNodeValue(u)})),c=ft(l,{state:r.get("typeaheadState"),activeId:t.get("focusedValue"),key:i.key});if(!(c!=null&&c.id))return;xi(e,c.id)?B(()=>je(a,c.id)):je(a,c.id)},toggleNodeSelection({context:e,event:t}){let n=tn(e.get("selectedValue"),t.id);e.set("selectedValue",n)},expandAllBranches(e){let{context:t,prop:n}=e,r=n("collection").getBranchValues(),i=Ts(r,t.get("expandedValue"));kc(e,i)},expandSiblingBranches(e){let{context:t,event:n,prop:r}=e,i=r("collection"),a=i.getIndexPath(n.id);if(!a)return;let s=i.getSiblingNodes(a).map(c=>i.getNodeValue(c)),l=Ts(s,t.get("expandedValue"));kc(e,l)},extendSelectionToNode(e){let{context:t,event:n,prop:r,computed:i}=e,a=r("collection"),o=Dt(t.get("selectedValue"))||a.getNodeValue(a.getFirstNode()),s=n.id,l=[o,s],c=0;i("visibleNodes").forEach(({node:u})=>{let p=a.getNodeValue(u);c===1&&l.push(p),(p===o||p===s)&&c++}),t.set("selectedValue",gt(l))},extendSelectionToNextNode(e){let{context:t,event:n,prop:r}=e,i=r("collection"),a=i.getNextNode(n.id,{skip:Ln(e)});if(!a)return;let o=new Set(t.get("selectedValue")),s=i.getNodeValue(a);s!=null&&(o.has(n.id)&&o.has(s)?o.delete(n.id):o.has(s)||o.add(s),t.set("selectedValue",Array.from(o)))},extendSelectionToPrevNode(e){let{context:t,event:n,prop:r}=e,i=r("collection"),a=i.getPreviousNode(n.id,{skip:Ln(e)});if(!a)return;let o=new Set(t.get("selectedValue")),s=i.getNodeValue(a);s!=null&&(o.has(n.id)&&o.has(s)?o.delete(n.id):o.has(s)||o.add(s),t.set("selectedValue",Array.from(o)))},extendSelectionToFirstNode(e){let{context:t,prop:n}=e,r=n("collection"),i=Dt(t.get("selectedValue")),a=[];r.visit({skip:Ln(e),onEnter:o=>{let s=r.getNodeValue(o);if(a.push(s),s===i)return"stop"}}),t.set("selectedValue",a)},extendSelectionToLastNode(e){let{context:t,prop:n}=e,r=n("collection"),i=Dt(t.get("selectedValue")),a=[],o=!1;r.visit({skip:Ln(e),onEnter:s=>{let l=r.getNodeValue(s);l===i&&(o=!0),o&&a.push(l)}}),t.set("selectedValue",a)},clearPendingAborts({refs:e}){let t=e.get("pendingAborts");t.forEach(n=>n.abort()),t.clear()},toggleChecked({context:e,event:t,prop:n}){let r=n("collection");e.set("checkedValue",i=>t.isBranch?i1(r,t.value,i):tn(i,t.value))},setChecked({context:e,event:t}){e.set("checkedValue",t.value)},clearChecked({context:e}){e.set("checkedValue",[])},setRenamingValue({context:e,event:t,prop:n}){e.set("renamingValue",t.value);let r=n("onRenameStart");if(r){let i=n("collection"),a=i.getIndexPath(t.value);if(a){let o=i.at(a);o&&r({value:t.value,node:o,indexPath:a})}}},submitRenaming({context:e,event:t,prop:n,scope:r}){var c;let i=e.get("renamingValue");if(!i)return;let o=n("collection").getIndexPath(i);if(!o)return;let s=t.label.trim(),l=n("onBeforeRename");if(l&&!l({value:i,label:s,indexPath:o})){e.set("renamingValue",null),je(r,i);return}(c=n("onRenameComplete"))==null||c({value:i,label:s,indexPath:o}),e.set("renamingValue",null),je(r,i)},cancelRenaming({context:e,scope:t}){let n=e.get("renamingValue");e.set("renamingValue",null),n&&je(t,n)},syncRenameInput({context:e,scope:t,prop:n}){let r=e.get("renamingValue");if(!r)return;let i=n("collection"),a=i.findNode(r);if(!a)return;let o=i.stringifyNode(a),s=DS(t,r);_e(s,o)},focusRenameInput({context:e,scope:t}){let n=e.get("renamingValue");if(!n)return;let r=DS(t,n);r&&(r.focus(),r.select())}}}});l1=class extends X{constructor(t,n){let o=n,{rootNode:r}=o,i=St(o,["rootNode"]),a=FS(r);super(t,y(h({},i),{collection:a}));Q(this,"treeCollection");Q(this,"syncTree",()=>{let t=this.el.querySelector('[data-scope="tree-view"][data-part="tree"]');t&&(this.spreadProps(t,this.api.getTreeProps()),this.updateExistingTree(t))});this.treeCollection=a}replaceRootNode(t){let n=FS(t);this.treeCollection=n,this.updateProps({collection:n})}initMachine(t){return new Y(s1,h({},t))}initApi(){return this.zagConnect(o1)}getNodeAt(t){var r;if(t.length===0)return;let n=this.treeCollection.rootNode;for(let i of t)if(n=(r=n==null?void 0:n.children)==null?void 0:r[i],!n)return;return n}updateExistingTree(t){var o;this.spreadProps(t,this.api.getTreeProps());let n=(o=this.el.dataset.animation)!=null?o:"instant",r=s=>s.closest('[data-scope="tree-view"][data-part="tree"]')===t,i=t.querySelectorAll('[data-scope="tree-view"][data-part="branch"]');for(let s of i){if(!r(s))continue;let l=s.getAttribute("data-path");if(l==null)continue;let c=l.split("/").map(T=>parseInt(T,10)),d=this.getNodeAt(c);if(!d)continue;let u={indexPath:c,node:d};this.spreadProps(s,this.api.getBranchProps(u));let p=s.querySelector('[data-scope="tree-view"][data-part="branch-control"]');p&&this.spreadProps(p,this.api.getBranchControlProps(u));let g=s.querySelector('[data-scope="tree-view"][data-part="branch-text"]');g&&this.spreadProps(g,this.api.getBranchTextProps(u));let f=s.querySelector('[data-scope="tree-view"][data-part="branch-indicator"]');f&&this.spreadProps(f,this.api.getBranchIndicatorProps(u));let m=s.querySelector('[data-scope="tree-view"][data-part="branch-content"]');if(m){let T=this.api.getBranchContentProps(u);n==="instant"?this.spreadProps(m,T):(n==="js"||n==="custom")&&(this.spreadProps(m,Zr(T)),m.removeAttribute("hidden"))}let S=s.querySelector('[data-scope="tree-view"][data-part="branch-indent-guide"]');S&&this.spreadProps(S,this.api.getBranchIndentGuideProps(u))}let a=t.querySelectorAll('[data-scope="tree-view"][data-part="item"]');for(let s of a){if(!r(s))continue;let l=s.getAttribute("data-path");if(l==null)continue;let c=l.split("/").map(f=>parseInt(f,10)),d=this.getNodeAt(c);if(!d)continue;let u={indexPath:c,node:d};this.spreadProps(s,this.api.getItemProps(u));let p=s.querySelector('[data-scope="tree-view"][data-part="item-text"]');p&&this.spreadProps(p,this.api.getItemTextProps(u));let g=s.querySelector('[data-scope="tree-view"][data-part="item-indicator"]');g&&this.spreadProps(g,this.api.getItemIndicatorProps(u))}}render(){var r;let t=(r=this.el.querySelector('[data-scope="tree-view"][data-part="root"]'))!=null?r:this.el;this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="tree-view"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps()),this.syncTree()}};gp='[data-scope="tree-view"][data-part="branch-content"]';c1={mounted(){var p,g,f,m,S,T,w,I,P;let e=this.el,t=this,n=this.pushEvent.bind(this),r=()=>j(this.liveSocket),i=fp(e);this.lastDataTree=e.dataset.tree;let a=O(e,"controlled");t.lastExpanded=a?(p=Ie(e,"expandedValue"))!=null?p:[]:(g=Ie(e,"defaultExpandedValue"))!=null?g:[],t.lastSelected=a?(f=Ie(e,"selectedValue"))!=null?f:[]:(m=Ie(e,"defaultSelectedValue"))!=null?m:[],t.lastExpandedAttr=pp(e),t.lastSelectedAttr=hp(e);let o=new l1(e,y(h({id:e.id,rootNode:i},a?{expandedValue:(S=Ie(e,"expandedValue"))!=null?S:[],selectedValue:(T=Ie(e,"selectedValue"))!=null?T:[]}:{defaultExpandedValue:(w=Ie(e,"defaultExpandedValue"))!=null?w:[],defaultSelectedValue:(I=Ie(e,"defaultSelectedValue"))!=null?I:[]}),{selectionMode:(P=V(e,"selectionMode"))!=null?P:"single",typeahead:e.dataset.typeahead!=="false",dir:q(e),onSelectionChange:v=>{var J,ue,Z;let E=O(e,"redirect"),R=(J=v.selectedValue)!=null&&J.length?v.selectedValue[0]:void 0,x=R?e.querySelector(`[data-scope="tree-view"][data-part="item"][data-value="${CSS.escape(R)}"]`):null,C=!!x;E&&C&&On(wn(x,R),{liveSocket:this.liveSocket});let A=(ue=v.selectedValue)!=null?ue:[],N=(Z=t.lastSelected)!=null?Z:[],{added:k,removed:L}=Na(A,N);t.lastSelected=A;let K={id:e.id,selectedValue:A,previousSelectedValue:N,added:k,removed:L,focusedValue:v.focusedValue,isItem:C};W({el:e,canPushServer:r(),pushEvent:n,payload:K,serverEventName:V(e,"onSelectionChange"),clientEventName:V(e,"onSelectionChangeClient")})},onExpandedChange:v=>{var N,k;let E=(N=v.expandedValue)!=null?N:[],R=(k=t.lastExpanded)!=null?k:[],{added:x,removed:C}=Na(E,R);t.lastExpanded=E;let A={id:e.id,expandedValue:E,previousExpandedValue:R,added:x,removed:C,focusedValue:v.focusedValue};W({el:e,canPushServer:r(),pushEvent:n,payload:A,serverEventName:V(e,"onExpandedChange"),clientEventName:V(e,"onExpandedChangeClient")}),eo({el:e,selector:gp,prevOpen:R,nextOpen:E,resolveValue:yd})}}));o.init(),this.treeView=o,Ms(e,gp);let s={el:e,pushEvent:n,canPushServer:r},l=ji(s,{getValue:()=>o.api.selectedValue,serverEventName:"tree_view_value_response",domEventName:"tree-view-value"}),c=ji(s,{getValue:()=>o.api.expandedValue,serverEventName:"tree_view_expanded_value_response",domEventName:"tree-view-expanded-value"}),d=ie(e);this.domRegistry=d,d.add("corex:tree-view:set-expanded-value",v=>{o.api.setExpandedValue(v.detail.value)}),d.add("corex:tree-view:set-selected-value",v=>{o.api.setSelectedValue(v.detail.value)}),d.add("corex:tree-view:value",v=>{l(de(v.detail))}),d.add("corex:tree-view:expanded-value",v=>{c(de(v.detail))});let u=re(this);this.handleRegistry=u,u.add("tree_view_set_expanded_value",v=>{$(e.id,H(v))&&o.api.setExpandedValue(v.value)}),u.add("tree_view_set_selected_value",v=>{$(e.id,H(v))&&o.api.setSelectedValue(v.value)}),u.add("tree_view_value",v=>{$(e.id,H(v))&&l(de(v))}),u.add("tree_view_expanded_value",v=>{$(e.id,H(v))&&c(de(v))})},beforeUpdate(){var t;let{el:e}=this;O(e,"controlled")&&Vt(e)&&(this.previousExpanded=(t=Ie(e,"expandedValue"))!=null?t:[])},updated(){var p,g,f,m,S,T;let{el:e}=this,t=this.treeView;if(!t)return;let n=e.dataset.tree;n!=null&&n!==this.lastDataTree&&(this.lastDataTree=n,t.replaceRootNode(fp(e)));let r=O(e,"controlled"),i=$S(e),a=r?(p=Ie(e,"selectedValue"))!=null?p:[]:(g=Ie(e,"defaultSelectedValue"))!=null?g:[],o=r?(f=Ie(e,"expandedValue"))!=null?f:[]:(m=Ie(e,"defaultExpandedValue"))!=null?m:[],s=pp(e),l=hp(e),c=s!==this.lastExpandedAttr,d=l!==this.lastSelectedAttr;if(this.lastExpandedAttr=s,this.lastSelectedAttr=l,!r){t.updateProps(i),c&&t.api.setExpandedValue(o),d&&t.api.setSelectedValue(a);return}let u=(T=(S=this.previousExpanded)!=null?S:this.lastExpanded)!=null?T:[];this.previousExpanded=void 0,c&&(this.lastExpanded=o),d&&(this.lastSelected=a),eo({el:e,selector:gp,prevOpen:u,nextOpen:o,resolveValue:yd}),t.updateProps(y(h({},i),{expandedValue:o,selectedValue:a}))},destroyed(){var e,t,n;(e=this.domRegistry)==null||e.teardown(),(t=this.handleRegistry)==null||t.teardown(),(n=this.treeView)==null||n.destroy()}}});var u1={};pe(u1,{Hooks:()=>GS,animateHeightClose:()=>Vp,animateHeightOpen:()=>Op,animateScaleClose:()=>xp,animateScaleOpen:()=>Ap,applyClosedHeight:()=>ls,applyClosedScale:()=>ds,applyOpenHeight:()=>cs,applyOpenScale:()=>us,default:()=>d1,findAccordionContent:()=>Ip,findDialogBackdrop:()=>Cp,findDialogContent:()=>wp,findTreeBranch:()=>Tp});var gs="ease-out";function ps(){return typeof window!="undefined"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function ls(e){e.style.opacity="0",e.style.height="0px",e.style.overflow="hidden"}function cs(e){e.style.opacity="",e.style.height="",e.style.overflow=""}function Ip(e,t){return e.querySelector(`[data-scope="accordion"][data-part="item"][data-value="${CSS.escape(t)}"] [data-part="item-content"]`)}function Tp(e,t){return e.querySelector(`[data-scope="tree-view"][data-part="branch-content"][data-value="${CSS.escape(t)}"]`)}function Cp(e){return e.querySelector('[data-scope="dialog"][data-part="backdrop"]')}function wp(e){return e.querySelector('[data-scope="dialog"][data-part="content"]')}function ds(e,t={}){var a,o;let n=e.dataset.part==="backdrop",r=(a=t.opacityStart)!=null?a:0,i=(o=t.scaleStart)!=null?o:.96;e.style.opacity=String(r),!n&&i!==1?e.style.transform=`scale(${i})`:e.style.removeProperty("transform")}function us(e){e.style.opacity="",e.style.removeProperty("transform")}function Op(e,t){var s,l,c,d;if(ps())return cs(e),Promise.resolve();let n=(s=t.duration)!=null?s:.3,r=(l=t.easing)!=null?l:gs,i=(c=t.opacityStart)!=null?c:0,a=(d=t.opacityEnd)!=null?d:1,o=`${e.scrollHeight}px`;return e.style.height="0px",e.style.overflow="hidden",Promise.resolve(t.animator(e,{height:["0px",o],opacity:[i,a]},{duration:n,easing:r}).finished.then(()=>{cs(e)})).then(()=>{})}function Vp(e,t){var s,l,c,d;if(ps())return ls(e),Promise.resolve();let n=(s=t.duration)!=null?s:.3,r=(l=t.easing)!=null?l:gs,i=(c=t.opacityStart)!=null?c:0,a=(d=t.opacityEnd)!=null?d:1,o=`${e.scrollHeight}px`;return e.style.height=o,e.style.overflow="hidden",Promise.resolve(t.animator(e,{height:[o,"0px"],opacity:[a,i]},{duration:n,easing:r}).finished.then(()=>{ls(e)})).then(()=>{})}function Ap(e,t){var d,u,p,g,f,m;let n=e.dataset.part==="backdrop";if(ps())return us(e),Promise.resolve();let r=(d=t.duration)!=null?d:.3,i=(u=t.easing)!=null?u:gs,a=(p=t.opacityStart)!=null?p:0,o=(g=t.opacityEnd)!=null?g:1,s=(f=t.scaleStart)!=null?f:.96,l=(m=t.scaleEnd)!=null?m:1,c={opacity:[a,o]};return!n&&(s!==l||s!==1||l!==1)&&(c.transform=[`scale(${s})`,`scale(${l})`]),Promise.resolve(t.animator(e,c,{duration:r,easing:i}).finished.then(()=>{us(e)})).then(()=>{})}function xp(e,t){var d,u,p,g,f,m;let n=e.dataset.part==="backdrop";if(ps())return ds(e,{scaleStart:t.scaleStart,opacityStart:t.opacityStart}),Promise.resolve();let r=(d=t.duration)!=null?d:.3,i=(u=t.easing)!=null?u:gs,a=(p=t.opacityStart)!=null?p:0,o=(g=t.opacityEnd)!=null?g:1,s=(f=t.scaleStart)!=null?f:.96,l=(m=t.scaleEnd)!=null?m:1,c={opacity:[o,a]};return!n&&(s!==l||s!==1||l!==1)&&(c.transform=[`scale(${l})`,`scale(${s})`]),Promise.resolve(t.animator(e,c,{duration:r,easing:i}).finished.then(()=>{ds(e,{scaleStart:s,opacityStart:a})})).then(()=>{})}function he(e,t){return{mounted(){return Ke(this,null,function*(){let r=this.el;try{let a=(yield e())[t];this._realHook=a,a!=null&&a.mounted&&(yield a.mounted.call(this))}finally{r.removeAttribute("data-loading")}})},updated(){var r,i;(i=(r=this._realHook)==null?void 0:r.updated)==null||i.call(this)},destroyed(){var r,i;(i=(r=this._realHook)==null?void 0:r.destroyed)==null||i.call(this)},disconnected(){var r,i;(i=(r=this._realHook)==null?void 0:r.disconnected)==null||i.call(this)},reconnected(){var r,i;(i=(r=this._realHook)==null?void 0:r.reconnected)==null||i.call(this)},beforeUpdate(){var r,i;(i=(r=this._realHook)==null?void 0:r.beforeUpdate)==null||i.call(this)}}}var GS={Accordion:he(()=>Promise.resolve().then(()=>(Xh(),Yh)),"Accordion"),AngleSlider:he(()=>Promise.resolve().then(()=>(Ef(),bf)),"AngleSlider"),Avatar:he(()=>Promise.resolve().then(()=>(Cf(),Tf)),"Avatar"),Carousel:he(()=>Promise.resolve().then(()=>(Df(),Lf)),"Carousel"),Checkbox:he(()=>Promise.resolve().then(()=>(qf(),Uf)),"Checkbox"),Clipboard:he(()=>Promise.resolve().then(()=>(Yf(),jf)),"Clipboard"),Collapsible:he(()=>Promise.resolve().then(()=>(Jf(),Zf)),"Collapsible"),Combobox:he(()=>Promise.resolve().then(()=>(lv(),sv)),"Combobox"),ColorPicker:he(()=>Promise.resolve().then(()=>(Vv(),Ov)),"ColorPicker"),DatePicker:he(()=>Promise.resolve().then(()=>(Ay(),Vy)),"DatePicker"),Dialog:he(()=>Promise.resolve().then(()=>(Uy(),Gy)),"Dialog"),Editable:he(()=>Promise.resolve().then(()=>(Zy(),Xy)),"Editable"),FileUpload:he(()=>Promise.resolve().then(()=>(gb(),ub)),"FileUpload"),FloatingPanel:he(()=>Promise.resolve().then(()=>(kb(),Rb)),"FloatingPanel"),Listbox:he(()=>Promise.resolve().then(()=>(Db(),Lb)),"Listbox"),Marquee:he(()=>Promise.resolve().then(()=>(_b(),Mb)),"Marquee"),Menu:he(()=>Promise.resolve().then(()=>(nE(),tE)),"Menu"),NumberInput:he(()=>Promise.resolve().then(()=>(EE(),bE)),"NumberInput"),Pagination:he(()=>Promise.resolve().then(()=>(wE(),CE)),"Pagination"),PasswordInput:he(()=>Promise.resolve().then(()=>(AE(),VE)),"PasswordInput"),PinInput:he(()=>Promise.resolve().then(()=>(ME(),FE)),"PinInput"),RadioGroup:he(()=>Promise.resolve().then(()=>(WE(),qE)),"RadioGroup"),Select:he(()=>Promise.resolve().then(()=>(nP(),tP)),"Select"),SignaturePad:he(()=>Promise.resolve().then(()=>(TP(),IP)),"SignaturePad"),Switch:he(()=>Promise.resolve().then(()=>(AP(),VP)),"Switch"),TagsInput:he(()=>Promise.resolve().then(()=>(BP(),HP)),"TagsInput"),Tabs:he(()=>Promise.resolve().then(()=>(YP(),jP)),"Tabs"),Timer:he(()=>Promise.resolve().then(()=>(tS(),eS)),"Timer"),Toast:he(()=>Promise.resolve().then(()=>(fS(),hS)),"Toast"),Tooltip:he(()=>Promise.resolve().then(()=>(PS(),ES)),"Tooltip"),Toggle:he(()=>Promise.resolve().then(()=>(CS(),TS)),"Toggle"),ToggleGroup:he(()=>Promise.resolve().then(()=>(NS(),kS)),"ToggleGroup"),TreeView:he(()=>Promise.resolve().then(()=>(BS(),HS)),"TreeView")},d1=GS;return jS(u1);})(); diff --git a/priv/static/date-picker.mjs b/priv/static/date-picker.mjs index a185ad3e..58aadad6 100644 --- a/priv/static/date-picker.mjs +++ b/priv/static/date-picker.mjs @@ -4162,42 +4162,90 @@ var DatePicker = class extends Component { getDayView = () => this.el.querySelector('[data-part="day-view"]'); getMonthView = () => this.el.querySelector('[data-part="month-view"]'); getYearView = () => this.el.querySelector('[data-part="year-view"]'); + ensureTableRow(tbody, rowIndex) { + let tr = tbody.children[rowIndex]; + if (!tr || tr.tagName !== "TR") { + tr = this.doc.createElement("tr"); + const ref = tbody.children[rowIndex] ?? null; + tbody.insertBefore(tr, ref); + } + return tr; + } + ensureTableCell(tr, cellIndex, cellKey) { + let td = tr.children[cellIndex]; + if (td && (td.tagName !== "TD" || td.dataset.dateCell !== cellKey)) { + td.remove(); + td = void 0; + } + if (!td) { + td = this.doc.createElement("td"); + td.dataset.dateCell = cellKey; + const trigger2 = this.doc.createElement("div"); + td.appendChild(trigger2); + const ref = tr.children[cellIndex] ?? null; + tr.insertBefore(td, ref); + } + const trigger = td.querySelector("div"); + return { td, trigger }; + } + trimTableRows(tbody, rowCount) { + while (tbody.children.length > rowCount) { + tbody.lastElementChild?.remove(); + } + } + trimTableCells(tr, cellCount) { + while (tr.children.length > cellCount) { + tr.lastElementChild?.remove(); + } + } renderDayTableHeader = () => { const dayView = this.getDayView(); const thead = dayView?.querySelector("thead"); if (!thead || !this.api.weekDays) return; - const tr = this.doc.createElement("tr"); + let tr = thead.querySelector("tr"); + if (!tr || tr.children.length !== this.api.weekDays.length) { + tr = this.doc.createElement("tr"); + thead.replaceChildren(tr); + this.api.weekDays.forEach(() => { + const th = this.doc.createElement("th"); + th.scope = "col"; + tr.appendChild(th); + }); + } this.spreadProps(tr, this.api.getTableRowProps({ view: "day" })); - this.api.weekDays.forEach((day) => { - const th = this.doc.createElement("th"); - th.scope = "col"; + this.api.weekDays.forEach((day, index) => { + const th = tr.children[index]; th.setAttribute("aria-label", day.long); - th.textContent = day.narrow; - tr.appendChild(th); + if (th.textContent !== day.narrow) { + th.textContent = day.narrow; + } }); - thead.innerHTML = ""; - thead.appendChild(tr); }; renderDayTableBody = () => { const dayView = this.getDayView(); const tbody = dayView?.querySelector("tbody"); if (!tbody) return; this.spreadProps(tbody, this.api.getTableBodyProps({ view: "day" })); - if (!this.api.weeks) return; - tbody.innerHTML = ""; - this.api.weeks.forEach((week) => { - const tr = this.doc.createElement("tr"); + if (!this.api.weeks) { + tbody.replaceChildren(); + return; + } + const weeks = this.api.weeks; + this.trimTableRows(tbody, weeks.length); + weeks.forEach((week, weekIndex) => { + const tr = this.ensureTableRow(tbody, weekIndex); this.spreadProps(tr, this.api.getTableRowProps({ view: "day" })); - week.forEach((value) => { - const td = this.doc.createElement("td"); + this.trimTableCells(tr, week.length); + week.forEach((value, cellIndex) => { + const cellKey = `${value.year}-${value.month}-${value.day}`; + const { td, trigger } = this.ensureTableCell(tr, cellIndex, cellKey); this.spreadProps(td, this.api.getDayTableCellProps({ value })); - const trigger = this.doc.createElement("div"); this.spreadProps(trigger, this.api.getDayTableCellTriggerProps({ value })); - trigger.textContent = String(value.day); - td.appendChild(trigger); - tr.appendChild(td); + const label = String(value.day); + if (trigger.textContent !== label) { + trigger.textContent = label; + } }); - tbody.appendChild(tr); }); }; renderMonthTableBody = () => { @@ -4206,20 +4254,20 @@ var DatePicker = class extends Component { if (!tbody) return; this.spreadProps(tbody, this.api.getTableBodyProps({ view: "month" })); const monthsGrid = this.api.getMonthsGrid({ columns: 4, format: "short" }); - tbody.innerHTML = ""; - monthsGrid.forEach((months) => { - const tr = this.doc.createElement("tr"); + this.trimTableRows(tbody, monthsGrid.length); + monthsGrid.forEach((months, rowIndex) => { + const tr = this.ensureTableRow(tbody, rowIndex); this.spreadProps(tr, this.api.getTableRowProps()); - months.forEach((month) => { - const td = this.doc.createElement("td"); + this.trimTableCells(tr, months.length); + months.forEach((month, cellIndex) => { + const cellKey = `${this.api.visibleRange.start.year}-${month.value}`; + const { td, trigger } = this.ensureTableCell(tr, cellIndex, cellKey); this.spreadProps(td, this.api.getMonthTableCellProps({ ...month, columns: 4 })); - const trigger = this.doc.createElement("div"); this.spreadProps(trigger, this.api.getMonthTableCellTriggerProps({ ...month, columns: 4 })); - trigger.textContent = month.label; - td.appendChild(trigger); - tr.appendChild(td); + if (trigger.textContent !== month.label) { + trigger.textContent = month.label; + } }); - tbody.appendChild(tr); }); }; renderYearTableBody = () => { @@ -4228,20 +4276,20 @@ var DatePicker = class extends Component { if (!tbody) return; this.spreadProps(tbody, this.api.getTableBodyProps()); const yearsGrid = this.api.getYearsGrid({ columns: 4 }); - tbody.innerHTML = ""; - yearsGrid.forEach((years) => { - const tr = this.doc.createElement("tr"); + this.trimTableRows(tbody, yearsGrid.length); + yearsGrid.forEach((years, rowIndex) => { + const tr = this.ensureTableRow(tbody, rowIndex); this.spreadProps(tr, this.api.getTableRowProps({ view: "year" })); - years.forEach((year) => { - const td = this.doc.createElement("td"); + this.trimTableCells(tr, years.length); + years.forEach((year, cellIndex) => { + const cellKey = String(year.value); + const { td, trigger } = this.ensureTableCell(tr, cellIndex, cellKey); this.spreadProps(td, this.api.getYearTableCellProps({ ...year, columns: 4 })); - const trigger = this.doc.createElement("div"); this.spreadProps(trigger, this.api.getYearTableCellTriggerProps({ ...year, columns: 4 })); - trigger.textContent = year.label; - td.appendChild(trigger); - tr.appendChild(td); + if (trigger.textContent !== year.label) { + trigger.textContent = year.label; + } }); - tbody.appendChild(tr); }); }; render() {