diff --git "a/dev-ui/node_modules/.vite/deps/bits-ui.js" "b/dev-ui/node_modules/.vite/deps/bits-ui.js" new file mode 100644--- /dev/null +++ "b/dev-ui/node_modules/.vite/deps/bits-ui.js" @@ -0,0 +1,46972 @@ +import "./chunk-MZVN5SDE.js"; +import { + StyleToObject +} from "./chunk-3R76EFEV.js"; +import { + SvelteMap +} from "./chunk-ME63RQ5D.js"; +import "./chunk-P6H3IEOT.js"; +import "./chunk-7RQDXF5S.js"; +import { + add_locations, + append_styles, + assign, + attribute_effect, + bind_this, + bind_value, + check_target, + cleanup_styles, + component, + createAttachmentKey, + create_ownership_validator, + each, + element, + hmr, + if_block, + init, + key, + legacy_api, + log_if_contains_state, + onMount, + prop, + rest_props, + set_attribute, + set_selected, + set_style, + snippet, + spread_props, + validate_binding, + validate_dynamic_element_tag, + validate_each_keys, + validate_snippet_args, + validate_void_dynamic_element, + wrap_snippet +} from "./chunk-W6P35DUF.js"; +import { + clsx +} from "./chunk-U7P2NEEE.js"; +import { + append, + comment, + from_html, + from_svg, + mount, + props_id, + set_text, + text, + unmount +} from "./chunk-RPUUDWWB.js"; +import { + FILENAME, + HMR, + add_svelte_meta, + child, + createSubscriber, + effect_root, + first_child, + get, + getAllContexts, + getContext, + hasContext, + next, + noop, + on, + pop, + proxy, + push, + replay_events, + reset, + set, + setContext, + sibling, + snapshot, + state, + strict_equals, + tag, + tag_proxy, + template_effect, + tick, + track_reactivity_loss, + untrack, + user_derived, + user_effect, + user_pre_effect +} from "./chunk-W7EPGGG4.js"; +import { + true_default +} from "./chunk-ICXW7654.js"; +import "./chunk-JOCHEXZL.js"; +import "./chunk-OHYQYV5R.js"; +import { + __export +} from "./chunk-PZ5AY32C.js"; + +// node_modules/bits-ui/dist/bits/accordion/exports.js +var exports_exports = {}; +__export(exports_exports, { + Content: () => accordion_content_default, + Header: () => accordion_header_default, + Item: () => accordion_item_default, + Root: () => accordion_default, + Trigger: () => accordion_trigger_default +}); + +// node_modules/svelte-toolbelt/dist/utils/is.js +function isFunction(value) { + return typeof value === "function"; +} +function isObject(value) { + return value !== null && typeof value === "object"; +} +var CLASS_VALUE_PRIMITIVE_TYPES = ["string", "number", "bigint", "boolean"]; +function isClassValue(value) { + if (value === null || value === void 0) + return true; + if (CLASS_VALUE_PRIMITIVE_TYPES.includes(typeof value)) + return true; + if (Array.isArray(value)) + return value.every((item) => isClassValue(item)); + if (typeof value === "object") { + if (Object.getPrototypeOf(value) !== Object.prototype) + return false; + return true; + } + return false; +} + +// node_modules/svelte-toolbelt/dist/box/box-extras.svelte.js +var BoxSymbol = Symbol("box"); +var isWritableSymbol = Symbol("is-writable"); +function boxWith(getter, setter) { + const derived = tag(user_derived(getter), "derived"); + if (setter) { + return { + [BoxSymbol]: true, + [isWritableSymbol]: true, + get current() { + return get(derived); + }, + set current(v) { + setter(v); + } + }; + } + return { + [BoxSymbol]: true, + get current() { + return getter(); + } + }; +} +function isBox(value) { + return isObject(value) && BoxSymbol in value; +} +function isWritableBox(value) { + return isBox(value) && isWritableSymbol in value; +} +function boxFrom(value) { + if (isBox(value)) return value; + if (isFunction(value)) return boxWith(value); + return simpleBox(value); +} +function boxFlatten(boxes) { + return Object.entries(boxes).reduce( + (acc, [key2, b]) => { + if (!isBox(b)) { + return Object.assign(acc, { [key2]: b }); + } + if (isWritableBox(b)) { + Object.defineProperty(acc, key2, { + get() { + return b.current; + }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + set(v) { + b.current = v; + } + }); + } else { + Object.defineProperty(acc, key2, { + get() { + return b.current; + } + }); + } + return acc; + }, + {} + ); +} +function toReadonlyBox(b) { + if (!isWritableBox(b)) return b; + return { + [BoxSymbol]: true, + get current() { + return b.current; + } + }; +} +function simpleBox(initialValue) { + let current = tag(state(proxy(initialValue)), "current"); + return { + [BoxSymbol]: true, + [isWritableSymbol]: true, + get current() { + return get(current); + }, + set current(v) { + set(current, v, true); + } + }; +} + +// node_modules/svelte-toolbelt/dist/box/box.svelte.js +function box(initialValue) { + let current = tag(state(proxy(initialValue)), "current"); + return { + [BoxSymbol]: true, + [isWritableSymbol]: true, + get current() { + return get(current); + }, + set current(v) { + set(current, v, true); + } + }; +} +box.from = boxFrom; +box.with = boxWith; +box.flatten = boxFlatten; +box.readonly = toReadonlyBox; +box.isBox = isBox; +box.isWritableBox = isWritableBox; + +// node_modules/svelte-toolbelt/dist/utils/compose-handlers.js +function composeHandlers(...handlers) { + return function(e) { + for (const handler of handlers) { + if (!handler) + continue; + if (e.defaultPrevented) + return; + if (typeof handler === "function") { + handler.call(this, e); + } else { + handler.current?.call(this, e); + } + } + }; +} + +// node_modules/svelte-toolbelt/dist/utils/strings.js +var NUMBER_CHAR_RE = /\d/; +var STR_SPLITTERS = ["-", "_", "/", "."]; +function isUppercase(char = "") { + if (NUMBER_CHAR_RE.test(char)) + return void 0; + return char !== char.toLowerCase(); +} +function splitByCase(str) { + const parts = []; + let buff = ""; + let previousUpper; + let previousSplitter; + for (const char of str) { + const isSplitter = STR_SPLITTERS.includes(char); + if (isSplitter === true) { + parts.push(buff); + buff = ""; + previousUpper = void 0; + continue; + } + const isUpper = isUppercase(char); + if (previousSplitter === false) { + if (previousUpper === false && isUpper === true) { + parts.push(buff); + buff = char; + previousUpper = isUpper; + continue; + } + if (previousUpper === true && isUpper === false && buff.length > 1) { + const lastChar = buff.at(-1); + parts.push(buff.slice(0, Math.max(0, buff.length - 1))); + buff = lastChar + char; + previousUpper = isUpper; + continue; + } + } + buff += char; + previousUpper = isUpper; + previousSplitter = isSplitter; + } + parts.push(buff); + return parts; +} +function pascalCase(str) { + if (!str) + return ""; + return splitByCase(str).map((p2) => upperFirst(p2)).join(""); +} +function camelCase(str) { + return lowerFirst(pascalCase(str || "")); +} +function upperFirst(str) { + return str ? str[0].toUpperCase() + str.slice(1) : ""; +} +function lowerFirst(str) { + return str ? str[0].toLowerCase() + str.slice(1) : ""; +} + +// node_modules/svelte-toolbelt/dist/utils/css-to-style-obj.js +function cssToStyleObj(css) { + if (!css) + return {}; + const styleObj = {}; + function iterator(name, value) { + if (name.startsWith("-moz-") || name.startsWith("-webkit-") || name.startsWith("-ms-") || name.startsWith("-o-")) { + styleObj[pascalCase(name)] = value; + return; + } + if (name.startsWith("--")) { + styleObj[name] = value; + return; + } + styleObj[camelCase(name)] = value; + } + StyleToObject(css, iterator); + return styleObj; +} + +// node_modules/svelte-toolbelt/dist/utils/execute-callbacks.js +function executeCallbacks(...callbacks) { + return (...args) => { + for (const callback of callbacks) { + if (typeof callback === "function") { + callback(...args); + } + } + }; +} + +// node_modules/svelte-toolbelt/dist/utils/style-to-css.js +function createParser(matcher, replacer) { + const regex = RegExp(matcher, "g"); + return (str) => { + if (typeof str !== "string") { + throw new TypeError(`expected an argument of type string, but got ${typeof str}`); + } + if (!str.match(regex)) + return str; + return str.replace(regex, replacer); + }; +} +var camelToKebab = createParser(/[A-Z]/, (match) => `-${match.toLowerCase()}`); +function styleToCSS(styleObj) { + if (!styleObj || typeof styleObj !== "object" || Array.isArray(styleObj)) { + throw new TypeError(`expected an argument of type object, but got ${typeof styleObj}`); + } + return Object.keys(styleObj).map((property) => `${camelToKebab(property)}: ${styleObj[property]};`).join("\n"); +} + +// node_modules/svelte-toolbelt/dist/utils/style.js +function styleToString(style = {}) { + return styleToCSS(style).replace("\n", " "); +} + +// node_modules/svelte-toolbelt/dist/utils/event-list.js +var EVENT_LIST = [ + "onabort", + "onanimationcancel", + "onanimationend", + "onanimationiteration", + "onanimationstart", + "onauxclick", + "onbeforeinput", + "onbeforetoggle", + "onblur", + "oncancel", + "oncanplay", + "oncanplaythrough", + "onchange", + "onclick", + "onclose", + "oncompositionend", + "oncompositionstart", + "oncompositionupdate", + "oncontextlost", + "oncontextmenu", + "oncontextrestored", + "oncopy", + "oncuechange", + "oncut", + "ondblclick", + "ondrag", + "ondragend", + "ondragenter", + "ondragleave", + "ondragover", + "ondragstart", + "ondrop", + "ondurationchange", + "onemptied", + "onended", + "onerror", + "onfocus", + "onfocusin", + "onfocusout", + "onformdata", + "ongotpointercapture", + "oninput", + "oninvalid", + "onkeydown", + "onkeypress", + "onkeyup", + "onload", + "onloadeddata", + "onloadedmetadata", + "onloadstart", + "onlostpointercapture", + "onmousedown", + "onmouseenter", + "onmouseleave", + "onmousemove", + "onmouseout", + "onmouseover", + "onmouseup", + "onpaste", + "onpause", + "onplay", + "onplaying", + "onpointercancel", + "onpointerdown", + "onpointerenter", + "onpointerleave", + "onpointermove", + "onpointerout", + "onpointerover", + "onpointerup", + "onprogress", + "onratechange", + "onreset", + "onresize", + "onscroll", + "onscrollend", + "onsecuritypolicyviolation", + "onseeked", + "onseeking", + "onselect", + "onselectionchange", + "onselectstart", + "onslotchange", + "onstalled", + "onsubmit", + "onsuspend", + "ontimeupdate", + "ontoggle", + "ontouchcancel", + "ontouchend", + "ontouchmove", + "ontouchstart", + "ontransitioncancel", + "ontransitionend", + "ontransitionrun", + "ontransitionstart", + "onvolumechange", + "onwaiting", + "onwebkitanimationend", + "onwebkitanimationiteration", + "onwebkitanimationstart", + "onwebkittransitionend", + "onwheel" +]; +var EVENT_LIST_SET = new Set(EVENT_LIST); + +// node_modules/svelte-toolbelt/dist/utils/merge-props.js +function isEventHandler(key2) { + return EVENT_LIST_SET.has(key2); +} +function mergeProps(...args) { + const result = { ...args[0] }; + for (let i = 1; i < args.length; i++) { + const props = args[i]; + if (!props) + continue; + for (const key2 of Object.keys(props)) { + const a2 = result[key2]; + const b = props[key2]; + const aIsFunction = typeof a2 === "function"; + const bIsFunction = typeof b === "function"; + if (aIsFunction && typeof bIsFunction && isEventHandler(key2)) { + const aHandler = a2; + const bHandler = b; + result[key2] = composeHandlers(aHandler, bHandler); + } else if (aIsFunction && bIsFunction) { + result[key2] = executeCallbacks(a2, b); + } else if (key2 === "class") { + const aIsClassValue = isClassValue(a2); + const bIsClassValue = isClassValue(b); + if (aIsClassValue && bIsClassValue) { + result[key2] = clsx(a2, b); + } else if (aIsClassValue) { + result[key2] = clsx(a2); + } else if (bIsClassValue) { + result[key2] = clsx(b); + } + } else if (key2 === "style") { + const aIsObject = typeof a2 === "object"; + const bIsObject = typeof b === "object"; + const aIsString = typeof a2 === "string"; + const bIsString = typeof b === "string"; + if (aIsObject && bIsObject) { + result[key2] = { ...a2, ...b }; + } else if (aIsObject && bIsString) { + const parsedStyle = cssToStyleObj(b); + result[key2] = { ...a2, ...parsedStyle }; + } else if (aIsString && bIsObject) { + const parsedStyle = cssToStyleObj(a2); + result[key2] = { ...parsedStyle, ...b }; + } else if (aIsString && bIsString) { + const parsedStyleA = cssToStyleObj(a2); + const parsedStyleB = cssToStyleObj(b); + result[key2] = { ...parsedStyleA, ...parsedStyleB }; + } else if (aIsObject) { + result[key2] = a2; + } else if (bIsObject) { + result[key2] = b; + } else if (aIsString) { + result[key2] = a2; + } else if (bIsString) { + result[key2] = b; + } + } else { + result[key2] = b !== void 0 ? b : a2; + } + } + for (const key2 of Object.getOwnPropertySymbols(props)) { + const a2 = result[key2]; + const b = props[key2]; + result[key2] = b !== void 0 ? b : a2; + } + } + if (typeof result.style === "object") { + result.style = styleToString(result.style).replaceAll("\n", " "); + } + if (result.hidden === false) { + result.hidden = void 0; + delete result.hidden; + } + if (result.disabled === false) { + result.disabled = void 0; + delete result.disabled; + } + return result; +} + +// node_modules/svelte-toolbelt/dist/utils/sr-only-styles.js +var srOnlyStyles = { + position: "absolute", + width: "1px", + height: "1px", + padding: "0", + margin: "-1px", + overflow: "hidden", + clip: "rect(0, 0, 0, 0)", + whiteSpace: "nowrap", + borderWidth: "0", + transform: "translateX(-100%)" +}; +var srOnlyStylesString = styleToString(srOnlyStyles); + +// node_modules/runed/dist/internal/configurable-globals.js +var defaultWindow = true_default && typeof window !== "undefined" ? window : void 0; +var defaultDocument = true_default && typeof window !== "undefined" ? window.document : void 0; +var defaultNavigator = true_default && typeof window !== "undefined" ? window.navigator : void 0; +var defaultLocation = true_default && typeof window !== "undefined" ? window.location : void 0; + +// node_modules/runed/dist/internal/utils/dom.js +function getActiveElement(document2) { + let activeElement2 = document2.activeElement; + while (activeElement2?.shadowRoot) { + const node = activeElement2.shadowRoot.activeElement; + if (node === activeElement2) + break; + else + activeElement2 = node; + } + return activeElement2; +} + +// node_modules/runed/dist/utilities/active-element/active-element.svelte.js +var ActiveElement = class { + #document; + #subscribe; + constructor(options = {}) { + const { window: window2 = defaultWindow, document: document2 = window2?.document } = options; + if (strict_equals(window2, void 0)) return; + this.#document = document2; + this.#subscribe = createSubscriber((update2) => { + const cleanupFocusIn = on(window2, "focusin", update2); + const cleanupFocusOut = on(window2, "focusout", update2); + return () => { + cleanupFocusIn(); + cleanupFocusOut(); + }; + }); + } + get current() { + this.#subscribe?.(); + if (!this.#document) return null; + return getActiveElement(this.#document); + } +}; +var activeElement = new ActiveElement(); + +// node_modules/runed/dist/internal/utils/is.js +function isFunction2(value) { + return typeof value === "function"; +} + +// node_modules/runed/dist/utilities/extract/extract.svelte.js +function extract(value, defaultValue) { + if (isFunction2(value)) { + const getter = value; + const gotten = getter(); + if (strict_equals(gotten, void 0)) return defaultValue; + return gotten; + } + if (strict_equals(value, void 0)) return defaultValue; + return value; +} + +// node_modules/runed/dist/utilities/context/context.js +var Context = class { + #name; + #key; + /** + * @param name The name of the context. + * This is used for generating the context key and error messages. + */ + constructor(name) { + this.#name = name; + this.#key = Symbol(name); + } + /** + * The key used to get and set the context. + * + * It is not recommended to use this value directly. + * Instead, use the methods provided by this class. + */ + get key() { + return this.#key; + } + /** + * Checks whether this has been set in the context of a parent component. + * + * Must be called during component initialisation. + */ + exists() { + return hasContext(this.#key); + } + /** + * Retrieves the context that belongs to the closest parent component. + * + * Must be called during component initialisation. + * + * @throws An error if the context does not exist. + */ + get() { + const context = getContext(this.#key); + if (context === void 0) { + throw new Error(`Context "${this.#name}" not found`); + } + return context; + } + /** + * Retrieves the context that belongs to the closest parent component, + * or the given fallback value if the context does not exist. + * + * Must be called during component initialisation. + */ + getOr(fallback) { + const context = getContext(this.#key); + if (context === void 0) { + return fallback; + } + return context; + } + /** + * Associates the given value with the current component and returns it. + * + * Must be called during component initialisation. + */ + set(context) { + return setContext(this.#key, context); + } +}; + +// node_modules/runed/dist/utilities/use-debounce/use-debounce.svelte.js +function useDebounce(callback, wait) { + let context = tag(state(null), "context"); + const wait$ = tag(user_derived(() => extract(wait, 250)), "wait$"); + function debounced(...args) { + if (get(context)) { + if (get(context).timeout) { + clearTimeout(get(context).timeout); + } + } else { + let resolve; + let reject; + const promise = new Promise((res, rej) => { + resolve = res; + reject = rej; + }); + set(context, { timeout: null, runner: null, promise, resolve, reject }, true); + } + get(context).runner = async () => { + if (!get(context)) return; + const ctx = get(context); + set(context, null); + try { + ctx.resolve((await track_reactivity_loss(callback.apply(this, args)))()); + } catch (error) { + ctx.reject(error); + } + }; + get(context).timeout = setTimeout(get(context).runner, get(wait$)); + return get(context).promise; + } + debounced.cancel = async () => { + if (!get(context) || strict_equals(get(context).timeout, null)) { + (await track_reactivity_loss(new Promise((resolve) => setTimeout(resolve, 0))))(); + if (!get(context) || strict_equals(get(context).timeout, null)) return; + } + clearTimeout(get(context).timeout); + get(context).reject("Cancelled"); + set(context, null); + }; + debounced.runScheduledNow = async () => { + if (!get(context) || !get(context).timeout) { + (await track_reactivity_loss(new Promise((resolve) => setTimeout(resolve, 0))))(); + if (!get(context) || !get(context).timeout) return; + } + clearTimeout(get(context).timeout); + get(context).timeout = null; + (await track_reactivity_loss(get(context).runner?.()))(); + }; + Object.defineProperty(debounced, "pending", { + enumerable: true, + get() { + return !!get(context)?.timeout; + } + }); + return debounced; +} + +// node_modules/runed/dist/utilities/watch/watch.svelte.js +function runEffect(flush, effect) { + switch (flush) { + case "post": + user_effect(effect); + break; + case "pre": + user_pre_effect(effect); + break; + } +} +function runWatcher(sources, flush, effect, options = {}) { + const { lazy = false } = options; + let active = !lazy; + let previousValues = Array.isArray(sources) ? [] : void 0; + runEffect(flush, () => { + const values = Array.isArray(sources) ? sources.map((source) => source()) : sources(); + if (!active) { + active = true; + previousValues = values; + return; + } + const cleanup = untrack(() => effect(values, previousValues)); + previousValues = values; + return cleanup; + }); +} +function runWatcherOnce(sources, flush, effect) { + const cleanupRoot = effect_root(() => { + let stop = false; + runWatcher( + sources, + flush, + (values, previousValues) => { + if (stop) { + cleanupRoot(); + return; + } + const cleanup = effect(values, previousValues); + stop = true; + return cleanup; + }, + // Running the effect immediately just once makes no sense at all. + // That's just `onMount` with extra steps. + { lazy: true } + ); + }); + user_effect(() => { + return cleanupRoot; + }); +} +function watch(sources, effect, options) { + runWatcher(sources, "post", effect, options); +} +function watchPre(sources, effect, options) { + runWatcher(sources, "pre", effect, options); +} +watch.pre = watchPre; +function watchOnce(source, effect) { + runWatcherOnce(source, "post", effect); +} +function watchOncePre(source, effect) { + runWatcherOnce(source, "pre", effect); +} +watchOnce.pre = watchOncePre; + +// node_modules/runed/dist/internal/utils/get.js +function get2(value) { + if (isFunction2(value)) { + return value(); + } + return value; +} + +// node_modules/runed/dist/utilities/element-size/element-size.svelte.js +var ElementSize = class { + // no need to use `$state` here since we are using createSubscriber + #size = { width: 0, height: 0 }; + #observed = false; + #options; + #node; + #window; + // we use a derived here to extract the width so that if the width doesn't change we don't get a state update + // which we would get if we would just use a getter since the version of the subscriber will be changing + #width = tag( + user_derived(() => { + get(this.#subscribe)?.(); + return this.getSize().width; + }), + "ElementSize.#width" + ); + // we use a derived here to extract the height so that if the height doesn't change we don't get a state update + // which we would get if we would just use a getter since the version of the subscriber will be changing + #height = tag( + user_derived(() => { + get(this.#subscribe)?.(); + return this.getSize().height; + }), + "ElementSize.#height" + ); + // we need to use a derived here because the class will be created before the node is bound to the ref + #subscribe = tag( + user_derived(() => { + const node$ = get2(this.#node); + if (!node$) return; + return createSubscriber((update2) => { + if (!this.#window) return; + const observer = new this.#window.ResizeObserver((entries) => { + this.#observed = true; + for (const entry of entries) { + const boxSize = strict_equals(this.#options.box, "content-box") ? entry.contentBoxSize : entry.borderBoxSize; + const boxSizeArr = Array.isArray(boxSize) ? boxSize : [boxSize]; + this.#size.width = boxSizeArr.reduce((acc, size3) => Math.max(acc, size3.inlineSize), 0); + this.#size.height = boxSizeArr.reduce((acc, size3) => Math.max(acc, size3.blockSize), 0); + } + update2(); + }); + observer.observe(node$); + return () => { + this.#observed = false; + observer.disconnect(); + }; + }); + }), + "ElementSize.#subscribe" + ); + constructor(node, options = { box: "border-box" }) { + this.#window = options.window ?? defaultWindow; + this.#options = options; + this.#node = node; + this.#size = { width: 0, height: 0 }; + } + calculateSize() { + const element2 = get2(this.#node); + if (!element2 || !this.#window) { + return; + } + const offsetWidth = element2.offsetWidth; + const offsetHeight = element2.offsetHeight; + if (strict_equals(this.#options.box, "border-box")) { + return { width: offsetWidth, height: offsetHeight }; + } + const style = this.#window.getComputedStyle(element2); + const paddingWidth = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight); + const paddingHeight = parseFloat(style.paddingTop) + parseFloat(style.paddingBottom); + const borderWidth = parseFloat(style.borderLeftWidth) + parseFloat(style.borderRightWidth); + const borderHeight = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); + const contentWidth = offsetWidth - paddingWidth - borderWidth; + const contentHeight = offsetHeight - paddingHeight - borderHeight; + return { width: contentWidth, height: contentHeight }; + } + getSize() { + return this.#observed ? this.#size : this.calculateSize() ?? this.#size; + } + get current() { + get(this.#subscribe)?.(); + return this.getSize(); + } + get width() { + return get(this.#width); + } + get height() { + return get(this.#height); + } +}; + +// node_modules/runed/dist/utilities/is-mounted/is-mounted.svelte.js +var IsMounted = class { + #isMounted = tag(state(false), "IsMounted.#isMounted"); + constructor() { + user_effect(() => { + untrack(() => set(this.#isMounted, true)); + return () => { + set(this.#isMounted, false); + }; + }); + } + get current() { + return get(this.#isMounted); + } +}; + +// node_modules/runed/dist/utilities/previous/previous.svelte.js +var Previous = class { + #previousCallback = () => void 0; + #previous = tag(user_derived(() => this.#previousCallback()), "Previous.#previous"); + constructor(getter, initialValue) { + let actualPrevious = void 0; + if (strict_equals(initialValue, void 0, false)) actualPrevious = initialValue; + this.#previousCallback = () => { + try { + return actualPrevious; + } finally { + actualPrevious = getter(); + } + }; + } + get current() { + return get(this.#previous); + } +}; + +// node_modules/runed/dist/utilities/resource/resource.svelte.js +function debounce(fn, delay) { + let timeoutId; + let lastResolve = null; + return (...args) => { + return new Promise((resolve) => { + if (lastResolve) { + lastResolve(void 0); + } + lastResolve = resolve; + clearTimeout(timeoutId); + timeoutId = setTimeout( + async () => { + const result = (await track_reactivity_loss(fn(...args)))(); + if (lastResolve) { + lastResolve(result); + lastResolve = null; + } + }, + delay + ); + }); + }; +} +function throttle(fn, delay) { + let lastRun = 0; + let lastPromise = null; + return (...args) => { + const now = Date.now(); + if (lastRun && now - lastRun < delay) { + return lastPromise ?? Promise.resolve(void 0); + } + lastRun = now; + lastPromise = fn(...args); + return lastPromise; + }; +} +function runResource(source, fetcher, options = {}, effectFn) { + const { + lazy = false, + once = false, + initialValue, + debounce: debounceTime, + throttle: throttleTime + } = options; + let current = tag(state(proxy(initialValue)), "current"); + let loading = tag(state(false), "loading"); + let error = tag(state(void 0), "error"); + let cleanupFns = tag(state(proxy([])), "cleanupFns"); + const runCleanup = () => { + get(cleanupFns).forEach((fn) => fn()); + set(cleanupFns, [], true); + }; + const onCleanup2 = (fn) => { + set(cleanupFns, [...get(cleanupFns), fn], true); + }; + const baseFetcher = async (value, previousValue, refetching = false) => { + try { + set(loading, true); + set(error, void 0); + runCleanup(); + const controller = new AbortController(); + onCleanup2(() => controller.abort()); + const result = (await track_reactivity_loss(fetcher(value, previousValue, { + data: get(current), + refetching, + onCleanup: onCleanup2, + signal: controller.signal + })))(); + set(current, result, true); + return result; + } catch (e) { + if (!(e instanceof DOMException && strict_equals(e.name, "AbortError"))) { + set(error, e, true); + } + return void 0; + } finally { + set(loading, false); + } + }; + const runFetcher = debounceTime ? debounce(baseFetcher, debounceTime) : throttleTime ? throttle(baseFetcher, throttleTime) : baseFetcher; + const sources = Array.isArray(source) ? source : [source]; + let prevValues; + effectFn( + (values, previousValues) => { + if (once && prevValues) { + return; + } + prevValues = values; + runFetcher(Array.isArray(source) ? values : values[0], Array.isArray(source) ? previousValues : previousValues?.[0]); + }, + { lazy } + ); + return { + get current() { + return get(current); + }, + get loading() { + return get(loading); + }, + get error() { + return get(error); + }, + mutate: (value) => { + set(current, value, true); + }, + refetch: (info) => { + const values = sources.map((s) => s()); + return runFetcher(Array.isArray(source) ? values : values[0], Array.isArray(source) ? values : values[0], info ?? true); + } + }; +} +function resource(source, fetcher, options) { + return runResource(source, fetcher, options, (fn, options2) => { + const sources = Array.isArray(source) ? source : [source]; + const getters = () => sources.map((s) => s()); + watch( + getters, + (values, previousValues) => { + fn(values, previousValues ?? []); + }, + options2 + ); + }); +} +function resourcePre(source, fetcher, options) { + return runResource(source, fetcher, options, (fn, options2) => { + const sources = Array.isArray(source) ? source : [source]; + const getter = () => sources.map((s) => s()); + watch.pre( + getter, + (values, previousValues) => { + fn(values, previousValues ?? []); + }, + options2 + ); + }); +} +resource.pre = resourcePre; + +// node_modules/svelte-toolbelt/dist/utils/on-destroy-effect.svelte.js +function onDestroyEffect(fn) { + user_effect(() => { + return () => { + fn(); + }; + }); +} + +// node_modules/svelte-toolbelt/dist/utils/on-mount-effect.svelte.js +function onMountEffect(fn) { + user_effect(() => { + const cleanup = untrack(() => fn()); + return cleanup; + }); +} + +// node_modules/svelte-toolbelt/dist/utils/after-sleep.js +function afterSleep(ms, cb) { + return setTimeout(cb, ms); +} + +// node_modules/svelte-toolbelt/dist/utils/after-tick.js +function afterTick(fn) { + tick().then(fn); +} + +// node_modules/svelte-toolbelt/dist/utils/dom.js +var ELEMENT_NODE = 1; +var DOCUMENT_NODE = 9; +var DOCUMENT_FRAGMENT_NODE = 11; +function isHTMLElement(node) { + return isObject(node) && node.nodeType === ELEMENT_NODE && typeof node.nodeName === "string"; +} +function isDocument(node) { + return isObject(node) && node.nodeType === DOCUMENT_NODE; +} +function isWindow(node) { + return isObject(node) && node.constructor?.name === "VisualViewport"; +} +function isNode(node) { + return isObject(node) && node.nodeType !== void 0; +} +function isShadowRoot(node) { + return isNode(node) && node.nodeType === DOCUMENT_FRAGMENT_NODE && "host" in node; +} +function contains(parent, child2) { + if (!parent || !child2) + return false; + if (!isHTMLElement(parent) || !isHTMLElement(child2)) + return false; + const rootNode = child2.getRootNode?.(); + if (parent === child2) + return true; + if (parent.contains(child2)) + return true; + if (rootNode && isShadowRoot(rootNode)) { + let next3 = child2; + while (next3) { + if (parent === next3) + return true; + next3 = next3.parentNode || next3.host; + } + } + return false; +} +function getDocument(node) { + if (isDocument(node)) + return node; + if (isWindow(node)) + return node.document; + return node?.ownerDocument ?? document; +} +function getWindow(node) { + if (isShadowRoot(node)) + return getWindow(node.host); + if (isDocument(node)) + return node.defaultView ?? window; + if (isHTMLElement(node)) + return node.ownerDocument?.defaultView ?? window; + return window; +} +function getActiveElement2(rootNode) { + let activeElement2 = rootNode.activeElement; + while (activeElement2?.shadowRoot) { + const el = activeElement2.shadowRoot.activeElement; + if (el === activeElement2) + break; + else + activeElement2 = el; + } + return activeElement2; +} + +// node_modules/svelte-toolbelt/dist/utils/dom-context.svelte.js +var DOMContext = class { + element; + #root = tag( + user_derived(() => { + if (!this.element.current) return document; + const rootNode = this.element.current.getRootNode() ?? document; + return rootNode; + }), + "DOMContext.root" + ); + get root() { + return get(this.#root); + } + set root(value) { + set(this.#root, value); + } + constructor(element2) { + if (strict_equals(typeof element2, "function")) { + this.element = boxWith(element2); + } else { + this.element = element2; + } + } + getDocument = () => { + return getDocument(this.root); + }; + getWindow = () => { + return this.getDocument().defaultView ?? window; + }; + getActiveElement = () => { + return getActiveElement2(this.root); + }; + isActiveElement = (node) => { + return strict_equals(node, this.getActiveElement()); + }; + getElementById(id) { + return this.root.getElementById(id); + } + querySelector = (selector) => { + if (!this.root) return null; + return this.root.querySelector(selector); + }; + querySelectorAll = (selector) => { + if (!this.root) return []; + return this.root.querySelectorAll(selector); + }; + setTimeout = (callback, delay) => { + return this.getWindow().setTimeout(callback, delay); + }; + clearTimeout = (timeoutId) => { + return this.getWindow().clearTimeout(timeoutId); + }; +}; + +// node_modules/svelte-toolbelt/dist/utils/attach-ref.js +function attachRef(ref, onChange) { + return { + [createAttachmentKey()]: (node) => { + if (isBox(ref)) { + ref.current = node; + untrack(() => onChange?.(node)); + return () => { + if ("isConnected" in node && node.isConnected) + return; + ref.current = null; + onChange?.(null); + }; + } + ref(node); + untrack(() => onChange?.(node)); + return () => { + if ("isConnected" in node && node.isConnected) + return; + ref(null); + onChange?.(null); + }; + } + }; +} + +// node_modules/bits-ui/dist/internal/attrs.js +function boolToStr(condition) { + return condition ? "true" : "false"; +} +function boolToStrTrueOrUndef(condition) { + return condition ? "true" : void 0; +} +function boolToEmptyStrOrUndef(condition) { + return condition ? "" : void 0; +} +function boolToTrueOrUndef(condition) { + return condition ? true : void 0; +} +function getDataOpenClosed(condition) { + return condition ? "open" : "closed"; +} +function getDataChecked(condition) { + return condition ? "checked" : "unchecked"; +} +function getAriaChecked(checked, indeterminate) { + if (indeterminate) { + return "mixed"; + } + return checked ? "true" : "false"; +} +var BitsAttrs = class { + #variant; + #prefix; + attrs; + constructor(config) { + this.#variant = config.getVariant ? config.getVariant() : null; + this.#prefix = this.#variant ? `data-${this.#variant}-` : `data-${config.component}-`; + this.getAttr = this.getAttr.bind(this); + this.selector = this.selector.bind(this); + this.attrs = Object.fromEntries(config.parts.map((part) => [part, this.getAttr(part)])); + } + getAttr(part, variantOverride) { + if (variantOverride) + return `data-${variantOverride}-${part}`; + return `${this.#prefix}${part}`; + } + selector(part, variantOverride) { + return `[${this.getAttr(part, variantOverride)}]`; + } +}; +function createBitsAttrs(config) { + const bitsAttrs = new BitsAttrs(config); + return { + ...bitsAttrs.attrs, + selector: bitsAttrs.selector, + getAttr: bitsAttrs.getAttr + }; +} + +// node_modules/bits-ui/dist/internal/kbd-constants.js +var kbd_constants_exports = {}; +__export(kbd_constants_exports, { + A: () => A, + ALT: () => ALT, + ARROW_DOWN: () => ARROW_DOWN, + ARROW_LEFT: () => ARROW_LEFT, + ARROW_RIGHT: () => ARROW_RIGHT, + ARROW_UP: () => ARROW_UP, + ASTERISK: () => ASTERISK, + BACKSPACE: () => BACKSPACE, + CAPS_LOCK: () => CAPS_LOCK, + CONTROL: () => CONTROL, + CTRL: () => CTRL, + DELETE: () => DELETE, + END: () => END, + ENTER: () => ENTER, + ESCAPE: () => ESCAPE, + F1: () => F1, + F10: () => F10, + F11: () => F11, + F12: () => F12, + F2: () => F2, + F3: () => F3, + F4: () => F4, + F5: () => F5, + F6: () => F6, + F7: () => F7, + F8: () => F8, + F9: () => F9, + HOME: () => HOME, + META: () => META, + P: () => P, + PAGE_DOWN: () => PAGE_DOWN, + PAGE_UP: () => PAGE_UP, + SHIFT: () => SHIFT, + SPACE: () => SPACE, + TAB: () => TAB, + a: () => a, + h: () => h, + j: () => j, + k: () => k, + l: () => l, + n: () => n, + p: () => p +}); +var ALT = "Alt"; +var ARROW_DOWN = "ArrowDown"; +var ARROW_LEFT = "ArrowLeft"; +var ARROW_RIGHT = "ArrowRight"; +var ARROW_UP = "ArrowUp"; +var BACKSPACE = "Backspace"; +var CAPS_LOCK = "CapsLock"; +var CONTROL = "Control"; +var DELETE = "Delete"; +var END = "End"; +var ENTER = "Enter"; +var ESCAPE = "Escape"; +var F1 = "F1"; +var F10 = "F10"; +var F11 = "F11"; +var F12 = "F12"; +var F2 = "F2"; +var F3 = "F3"; +var F4 = "F4"; +var F5 = "F5"; +var F6 = "F6"; +var F7 = "F7"; +var F8 = "F8"; +var F9 = "F9"; +var HOME = "Home"; +var META = "Meta"; +var PAGE_DOWN = "PageDown"; +var PAGE_UP = "PageUp"; +var SHIFT = "Shift"; +var SPACE = " "; +var TAB = "Tab"; +var CTRL = "Control"; +var ASTERISK = "*"; +var a = "a"; +var P = "P"; +var A = "A"; +var p = "p"; +var n = "n"; +var j = "j"; +var k = "k"; +var h = "h"; +var l = "l"; + +// node_modules/bits-ui/dist/internal/locale.js +function getElemDirection(elem) { + const style = window.getComputedStyle(elem); + const direction = style.getPropertyValue("direction"); + return direction; +} + +// node_modules/bits-ui/dist/internal/get-directional-keys.js +var FIRST_KEYS = [kbd_constants_exports.ARROW_DOWN, kbd_constants_exports.PAGE_UP, kbd_constants_exports.HOME]; +var LAST_KEYS = [kbd_constants_exports.ARROW_UP, kbd_constants_exports.PAGE_DOWN, kbd_constants_exports.END]; +var FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS]; +var SELECTION_KEYS = [kbd_constants_exports.SPACE, kbd_constants_exports.ENTER]; +function getNextKey(dir = "ltr", orientation = "horizontal") { + return { + horizontal: dir === "rtl" ? kbd_constants_exports.ARROW_LEFT : kbd_constants_exports.ARROW_RIGHT, + vertical: kbd_constants_exports.ARROW_DOWN + }[orientation]; +} +function getPrevKey(dir = "ltr", orientation = "horizontal") { + return { + horizontal: dir === "rtl" ? kbd_constants_exports.ARROW_RIGHT : kbd_constants_exports.ARROW_LEFT, + vertical: kbd_constants_exports.ARROW_UP + }[orientation]; +} +function getDirectionalKeys(dir = "ltr", orientation = "horizontal") { + if (!["ltr", "rtl"].includes(dir)) + dir = "ltr"; + if (!["horizontal", "vertical"].includes(orientation)) + orientation = "horizontal"; + return { + nextKey: getNextKey(dir, orientation), + prevKey: getPrevKey(dir, orientation) + }; +} + +// node_modules/bits-ui/dist/internal/is.js +var isBrowser = typeof document !== "undefined"; +var isIOS = getIsIOS(); +function getIsIOS() { + return isBrowser && window?.navigator?.userAgent && (/iP(ad|hone|od)/.test(window.navigator.userAgent) || // The new iPad Pro Gen3 does not identify itself as iPad, but as Macintosh. + window?.navigator?.maxTouchPoints > 2 && /iPad|Macintosh/.test(window?.navigator.userAgent)); +} +function isHTMLElement2(element2) { + return element2 instanceof HTMLElement; +} +function isElement2(element2) { + return element2 instanceof Element; +} +function isElementOrSVGElement(element2) { + return element2 instanceof Element || element2 instanceof SVGElement; +} +function isNumberString(value) { + return !Number.isNaN(Number(value)) && !Number.isNaN(Number.parseFloat(value)); +} +function isNull(value) { + return value === null; +} +function isTouch(e) { + return e.pointerType === "touch"; +} +function isFocusVisible(element2) { + return element2.matches(":focus-visible"); +} +function isNotNull(value) { + return value !== null; +} +function isSelectableInput(element2) { + return element2 instanceof HTMLInputElement && "select" in element2; +} + +// node_modules/bits-ui/dist/internal/roving-focus-group.js +var RovingFocusGroup = class { + #opts; + #currentTabStopId = box(null); + constructor(opts) { + this.#opts = opts; + } + getCandidateNodes() { + if (!true_default || !this.#opts.rootNode.current) + return []; + if (this.#opts.candidateSelector) { + const candidates = Array.from(this.#opts.rootNode.current.querySelectorAll(this.#opts.candidateSelector)); + return candidates; + } else if (this.#opts.candidateAttr) { + const candidates = Array.from(this.#opts.rootNode.current.querySelectorAll(`[${this.#opts.candidateAttr}]:not([data-disabled])`)); + return candidates; + } + return []; + } + focusFirstCandidate() { + const items = this.getCandidateNodes(); + if (!items.length) + return; + items[0]?.focus(); + } + handleKeydown(node, e, both = false) { + const rootNode = this.#opts.rootNode.current; + if (!rootNode || !node) + return; + const items = this.getCandidateNodes(); + if (!items.length) + return; + const currentIndex = items.indexOf(node); + const dir = getElemDirection(rootNode); + const { nextKey, prevKey } = getDirectionalKeys(dir, this.#opts.orientation.current); + const loop = this.#opts.loop.current; + const keyToIndex = { + [nextKey]: currentIndex + 1, + [prevKey]: currentIndex - 1, + [kbd_constants_exports.HOME]: 0, + [kbd_constants_exports.END]: items.length - 1 + }; + if (both) { + const altNextKey = nextKey === kbd_constants_exports.ARROW_DOWN ? kbd_constants_exports.ARROW_RIGHT : kbd_constants_exports.ARROW_DOWN; + const altPrevKey = prevKey === kbd_constants_exports.ARROW_UP ? kbd_constants_exports.ARROW_LEFT : kbd_constants_exports.ARROW_UP; + keyToIndex[altNextKey] = currentIndex + 1; + keyToIndex[altPrevKey] = currentIndex - 1; + } + let itemIndex = keyToIndex[e.key]; + if (itemIndex === void 0) + return; + e.preventDefault(); + if (itemIndex < 0 && loop) { + itemIndex = items.length - 1; + } else if (itemIndex === items.length && loop) { + itemIndex = 0; + } + const itemToFocus = items[itemIndex]; + if (!itemToFocus) + return; + itemToFocus.focus(); + this.#currentTabStopId.current = itemToFocus.id; + this.#opts.onCandidateFocus?.(itemToFocus); + return itemToFocus; + } + getTabIndex(node) { + const items = this.getCandidateNodes(); + const anyActive = this.#currentTabStopId.current !== null; + if (node && !anyActive && items[0] === node) { + this.#currentTabStopId.current = node.id; + return 0; + } else if (node?.id === this.#currentTabStopId.current) { + return 0; + } + return -1; + } + setCurrentTabStopId(id) { + this.#currentTabStopId.current = id; + } + focusCurrentTabStop() { + const currentTabStopId = this.#currentTabStopId.current; + if (!currentTabStopId) + return; + const currentTabStop = this.#opts.rootNode.current?.querySelector(`#${currentTabStopId}`); + if (!currentTabStop || !isHTMLElement2(currentTabStop)) + return; + currentTabStop.focus(); + } +}; + +// node_modules/bits-ui/dist/internal/animations-complete.js +var AnimationsComplete = class { + #opts; + #currentFrame = null; + constructor(opts) { + this.#opts = opts; + onDestroyEffect(() => this.#cleanup()); + } + #cleanup() { + if (!this.#currentFrame) + return; + window.cancelAnimationFrame(this.#currentFrame); + this.#currentFrame = null; + } + run(fn) { + this.#cleanup(); + const node = this.#opts.ref.current; + if (!node) + return; + if (typeof node.getAnimations !== "function") { + this.#executeCallback(fn); + return; + } + this.#currentFrame = window.requestAnimationFrame(() => { + const animations = node.getAnimations(); + if (animations.length === 0) { + this.#executeCallback(fn); + return; + } + Promise.allSettled(animations.map((animation) => animation.finished)).then(() => { + this.#executeCallback(fn); + }); + }); + } + #executeCallback(fn) { + const execute = () => { + fn(); + }; + if (this.#opts.afterTick) { + afterTick(execute); + } else { + execute(); + } + } +}; + +// node_modules/bits-ui/dist/internal/presence-manager.svelte.js +var PresenceManager = class { + #opts; + #enabled; + #afterAnimations; + #shouldRender = tag(state(false), "PresenceManager.#shouldRender"); + constructor(opts) { + this.#opts = opts; + set(this.#shouldRender, opts.open.current, true); + this.#enabled = opts.enabled ?? true; + this.#afterAnimations = new AnimationsComplete({ ref: this.#opts.ref, afterTick: this.#opts.open }); + watch(() => this.#opts.open.current, (isOpen) => { + if (isOpen) set(this.#shouldRender, true); + if (!this.#enabled) return; + this.#afterAnimations.run(() => { + if (strict_equals(isOpen, this.#opts.open.current)) { + if (!this.#opts.open.current) { + set(this.#shouldRender, false); + } + this.#opts.onComplete?.(); + } + }); + }); + } + get shouldRender() { + return get(this.#shouldRender); + } +}; + +// node_modules/bits-ui/dist/bits/accordion/accordion.svelte.js +var accordionAttrs = createBitsAttrs({ + component: "accordion", + parts: ["root", "trigger", "content", "item", "header"] +}); +var AccordionRootContext = new Context("Accordion.Root"); +var AccordionItemContext = new Context("Accordion.Item"); +var AccordionBaseState = class { + opts; + rovingFocusGroup; + attachment; + constructor(opts) { + this.opts = opts; + this.rovingFocusGroup = new RovingFocusGroup({ + rootNode: this.opts.ref, + candidateAttr: accordionAttrs.trigger, + loop: this.opts.loop, + orientation: this.opts.orientation + }); + this.attachment = attachRef(this.opts.ref); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + "data-orientation": this.opts.orientation.current, + "data-disabled": boolToEmptyStrOrUndef(this.opts.disabled.current), + [accordionAttrs.root]: "", + ...this.attachment + })), + "AccordionBaseState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var AccordionSingleState = class extends AccordionBaseState { + opts; + isMulti = false; + constructor(opts) { + super(opts); + this.opts = opts; + this.includesItem = this.includesItem.bind(this); + this.toggleItem = this.toggleItem.bind(this); + } + includesItem(item) { + return strict_equals(this.opts.value.current, item); + } + toggleItem(item) { + this.opts.value.current = this.includesItem(item) ? "" : item; + } +}; +var AccordionMultiState = class extends AccordionBaseState { + #value; + isMulti = true; + constructor(props) { + super(props); + this.#value = props.value; + this.includesItem = this.includesItem.bind(this); + this.toggleItem = this.toggleItem.bind(this); + } + includesItem(item) { + return this.#value.current.includes(item); + } + toggleItem(item) { + this.#value.current = this.includesItem(item) ? this.#value.current.filter((v) => strict_equals(v, item, false)) : [...this.#value.current, item]; + } +}; +var AccordionRootState = class { + static create(props) { + const { type, ...rest } = props; + const rootState = strict_equals(type, "single") ? new AccordionSingleState(rest) : new AccordionMultiState(rest); + return AccordionRootContext.set(rootState); + } +}; +var AccordionItemState = class _AccordionItemState { + static create(props) { + return AccordionItemContext.set(new _AccordionItemState({ ...props, rootState: AccordionRootContext.get() })); + } + opts; + root; + #isActive = tag(user_derived(() => this.root.includesItem(this.opts.value.current)), "AccordionItemState.isActive"); + get isActive() { + return get(this.#isActive); + } + set isActive(value) { + set(this.#isActive, value); + } + #isDisabled = tag(user_derived(() => this.opts.disabled.current || this.root.opts.disabled.current), "AccordionItemState.isDisabled"); + get isDisabled() { + return get(this.#isDisabled); + } + set isDisabled(value) { + set(this.#isDisabled, value); + } + attachment; + #contentNode = tag(state(null), "AccordionItemState.contentNode"); + get contentNode() { + return get(this.#contentNode); + } + set contentNode(value) { + set(this.#contentNode, value, true); + } + contentPresence; + constructor(opts) { + this.opts = opts; + this.root = opts.rootState; + this.updateValue = this.updateValue.bind(this); + this.attachment = attachRef(this.opts.ref); + this.contentPresence = new PresenceManager({ + ref: boxWith(() => this.contentNode), + open: boxWith(() => this.isActive) + }); + } + updateValue() { + this.root.toggleItem(this.opts.value.current); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + "data-state": getDataOpenClosed(this.isActive), + "data-disabled": boolToEmptyStrOrUndef(this.isDisabled), + "data-orientation": this.root.opts.orientation.current, + [accordionAttrs.item]: "", + ...this.attachment + })), + "AccordionItemState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var AccordionTriggerState = class _AccordionTriggerState { + opts; + itemState; + #root; + #isDisabled = tag(user_derived(() => this.opts.disabled.current || this.itemState.opts.disabled.current || this.#root.opts.disabled.current), "AccordionTriggerState.#isDisabled"); + attachment; + constructor(opts, itemState) { + this.opts = opts; + this.itemState = itemState; + this.#root = itemState.root; + this.onclick = this.onclick.bind(this); + this.onkeydown = this.onkeydown.bind(this); + this.attachment = attachRef(this.opts.ref); + } + static create(props) { + return new _AccordionTriggerState(props, AccordionItemContext.get()); + } + onclick(e) { + if (get(this.#isDisabled) || strict_equals(e.button, 0, false)) { + e.preventDefault(); + return; + } + this.itemState.updateValue(); + } + onkeydown(e) { + if (get(this.#isDisabled)) return; + if (strict_equals(e.key, kbd_constants_exports.SPACE) || strict_equals(e.key, kbd_constants_exports.ENTER)) { + e.preventDefault(); + this.itemState.updateValue(); + return; + } + this.#root.rovingFocusGroup.handleKeydown(this.opts.ref.current, e); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + disabled: get(this.#isDisabled), + "aria-expanded": boolToStr(this.itemState.isActive), + "aria-disabled": boolToStr(get(this.#isDisabled)), + "data-disabled": boolToEmptyStrOrUndef(get(this.#isDisabled)), + "data-state": getDataOpenClosed(this.itemState.isActive), + "data-orientation": this.#root.opts.orientation.current, + [accordionAttrs.trigger]: "", + tabindex: 0, + onclick: this.onclick, + onkeydown: this.onkeydown, + ...this.attachment + })), + "AccordionTriggerState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var AccordionContentState = class _AccordionContentState { + opts; + item; + attachment; + #originalStyles = void 0; + #isMountAnimationPrevented = false; + #dimensions = tag(state(proxy({ width: 0, height: 0 })), "AccordionContentState.#dimensions"); + #open = tag( + user_derived(() => { + if (this.opts.hiddenUntilFound.current) return this.item.isActive; + return this.opts.forceMount.current || this.item.isActive; + }), + "AccordionContentState.open" + ); + get open() { + return get(this.#open); + } + set open(value) { + set(this.#open, value); + } + constructor(opts, item) { + this.opts = opts; + this.item = item; + this.#isMountAnimationPrevented = this.item.isActive; + this.attachment = attachRef(this.opts.ref, (v) => this.item.contentNode = v); + user_effect(() => { + const rAF = requestAnimationFrame(() => { + this.#isMountAnimationPrevented = false; + }); + return () => cancelAnimationFrame(rAF); + }); + watch.pre( + [ + () => this.opts.ref.current, + () => this.opts.hiddenUntilFound.current + ], + ([node, hiddenUntilFound]) => { + if (!node || !hiddenUntilFound) return; + const handleBeforeMatch = () => { + if (this.item.isActive) return; + requestAnimationFrame(() => { + this.item.updateValue(); + }); + }; + return on(node, "beforematch", handleBeforeMatch); + } + ); + watch([() => this.open, () => this.opts.ref.current], this.#updateDimensions); + } + static create(props) { + return new _AccordionContentState(props, AccordionItemContext.get()); + } + #updateDimensions = ([_, node]) => { + if (!node) return; + afterTick(() => { + const element2 = this.opts.ref.current; + if (!element2) return; + this.#originalStyles ??= { + transitionDuration: element2.style.transitionDuration, + animationName: element2.style.animationName + }; + element2.style.transitionDuration = "0s"; + element2.style.animationName = "none"; + const rect = element2.getBoundingClientRect(); + set(this.#dimensions, { width: rect.width, height: rect.height }, true); + if (!this.#isMountAnimationPrevented && this.#originalStyles) { + element2.style.transitionDuration = this.#originalStyles.transitionDuration; + element2.style.animationName = this.#originalStyles.animationName; + } + }); + }; + get shouldRender() { + return this.item.contentPresence.shouldRender; + } + #snippetProps = tag(user_derived(() => ({ open: this.item.isActive })), "AccordionContentState.snippetProps"); + get snippetProps() { + return get(this.#snippetProps); + } + set snippetProps(value) { + set(this.#snippetProps, value); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + "data-state": getDataOpenClosed(this.item.isActive), + "data-disabled": boolToEmptyStrOrUndef(this.item.isDisabled), + "data-orientation": this.item.root.opts.orientation.current, + [accordionAttrs.content]: "", + style: { + "--bits-accordion-content-height": `${get(this.#dimensions).height}px`, + "--bits-accordion-content-width": `${get(this.#dimensions).width}px` + }, + hidden: this.opts.hiddenUntilFound.current && !this.item.isActive ? "until-found" : void 0, + ...this.opts.hiddenUntilFound.current && !this.shouldRender ? {} : { + hidden: this.opts.hiddenUntilFound.current ? !this.shouldRender : this.opts.forceMount.current ? void 0 : !this.shouldRender + }, + ...this.attachment + })), + "AccordionContentState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var AccordionHeaderState = class _AccordionHeaderState { + opts; + item; + attachment; + constructor(opts, item) { + this.opts = opts; + this.item = item; + this.attachment = attachRef(this.opts.ref); + } + static create(props) { + return new _AccordionHeaderState(props, AccordionItemContext.get()); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + role: "heading", + "aria-level": this.opts.level.current, + "data-heading-level": this.opts.level.current, + "data-state": getDataOpenClosed(this.item.isActive), + "data-orientation": this.item.root.opts.orientation.current, + [accordionAttrs.header]: "", + ...this.attachment + })), + "AccordionHeaderState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; + +// node_modules/bits-ui/dist/internal/noop.js +function noop3() { +} + +// node_modules/bits-ui/dist/internal/create-id.js +function createId(prefixOrUid, uid) { + if (uid === void 0) + return `bits-${prefixOrUid}`; + return `bits-${prefixOrUid}-${uid}`; +} + +// node_modules/bits-ui/dist/bits/accordion/components/accordion.svelte +Accordion[FILENAME] = "node_modules/bits-ui/dist/bits/accordion/components/accordion.svelte"; +var root_2 = add_locations(from_html(`
`), Accordion[FILENAME], [[66, 1]]); +function Accordion($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Accordion); + let disabled = prop($$props, "disabled", 3, false), value = prop($$props, "value", 15), ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 19, () => createId(uid)), onValueChange = prop($$props, "onValueChange", 3, noop3), loop = prop($$props, "loop", 3, true), orientation = prop($$props, "orientation", 3, "vertical"), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "disabled", + "children", + "child", + "type", + "value", + "ref", + "id", + "onValueChange", + "loop", + "orientation" + ], + "restProps" + ); + function handleDefaultValue() { + if (strict_equals(value(), void 0, false)) return; + value(strict_equals($$props.type, "single") ? "" : []); + } + handleDefaultValue(); + watch.pre(() => value(), () => { + handleDefaultValue(); + }); + const rootState = AccordionRootState.create({ + type: $$props.type, + value: boxWith(() => value(), (v) => { + value(v); + onValueChange()(v); + }), + id: boxWith(() => id()), + disabled: boxWith(() => disabled()), + loop: boxWith(() => loop()), + orientation: boxWith(() => orientation()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, rootState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Accordion, 64, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var div = root_2(); + attribute_effect(div, () => ({ ...get(mergedProps) })); + var node_2 = child(div); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Accordion, 67, 2); + reset(div); + append($$anchor2, div); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Accordion, + 63, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Accordion = hmr(Accordion, () => Accordion[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Accordion[HMR].source; + set(Accordion[HMR].source, module.default[HMR].original); + }); +} +var accordion_default = Accordion; + +// node_modules/bits-ui/dist/bits/accordion/components/accordion-item.svelte +Accordion_item[FILENAME] = "node_modules/bits-ui/dist/bits/accordion/components/accordion-item.svelte"; +var root_22 = add_locations(from_html(`
`), Accordion_item[FILENAME], [[36, 1]]); +function Accordion_item($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Accordion_item); + const defaultId = createId(uid); + let id = prop($$props, "id", 3, defaultId), disabled = prop($$props, "disabled", 3, false), value = prop($$props, "value", 3, defaultId), ref = prop($$props, "ref", 15, null), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "id", + "disabled", + "value", + "children", + "child", + "ref" + ], + "restProps" + ); + const itemState = AccordionItemState.create({ + value: boxWith(() => value()), + disabled: boxWith(() => disabled()), + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, itemState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Accordion_item, 34, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var div = root_22(); + attribute_effect(div, () => ({ ...get(mergedProps) })); + var node_2 = child(div); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Accordion_item, 37, 2); + reset(div); + append($$anchor2, div); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Accordion_item, + 33, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Accordion_item = hmr(Accordion_item, () => Accordion_item[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Accordion_item[HMR].source; + set(Accordion_item[HMR].source, module.default[HMR].original); + }); +} +var accordion_item_default = Accordion_item; + +// node_modules/bits-ui/dist/bits/accordion/components/accordion-header.svelte +Accordion_header[FILENAME] = "node_modules/bits-ui/dist/bits/accordion/components/accordion-header.svelte"; +var root_23 = add_locations(from_html(`
`), Accordion_header[FILENAME], [[33, 1]]); +function Accordion_header($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Accordion_header); + let id = prop($$props, "id", 19, () => createId(uid)), level = prop($$props, "level", 3, 2), ref = prop($$props, "ref", 15, null), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "id", + "level", + "children", + "child", + "ref" + ], + "restProps" + ); + const headerState = AccordionHeaderState.create({ + id: boxWith(() => id()), + level: boxWith(() => level()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, headerState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Accordion_header, 31, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var div = root_23(); + attribute_effect(div, () => ({ ...get(mergedProps) })); + var node_2 = child(div); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Accordion_header, 34, 2); + reset(div); + append($$anchor2, div); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Accordion_header, + 30, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Accordion_header = hmr(Accordion_header, () => Accordion_header[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Accordion_header[HMR].source; + set(Accordion_header[HMR].source, module.default[HMR].original); + }); +} +var accordion_header_default = Accordion_header; + +// node_modules/bits-ui/dist/bits/accordion/components/accordion-trigger.svelte +Accordion_trigger[FILENAME] = "node_modules/bits-ui/dist/bits/accordion/components/accordion-trigger.svelte"; +var root_24 = add_locations(from_html(``), Accordion_trigger[FILENAME], [[33, 1]]); +function Accordion_trigger($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Accordion_trigger); + let disabled = prop($$props, "disabled", 3, false), ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 19, () => createId(uid)), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "disabled", + "ref", + "id", + "children", + "child" + ], + "restProps" + ); + const triggerState = AccordionTriggerState.create({ + disabled: boxWith(() => disabled()), + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, triggerState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Accordion_trigger, 31, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var button = root_24(); + attribute_effect(button, () => ({ type: "button", ...get(mergedProps) })); + var node_2 = child(button); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Accordion_trigger, 34, 2); + reset(button); + append($$anchor2, button); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Accordion_trigger, + 30, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Accordion_trigger = hmr(Accordion_trigger, () => Accordion_trigger[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Accordion_trigger[HMR].source; + set(Accordion_trigger[HMR].source, module.default[HMR].original); + }); +} +var accordion_trigger_default = Accordion_trigger; + +// node_modules/bits-ui/dist/bits/accordion/components/accordion-content.svelte +Accordion_content[FILENAME] = "node_modules/bits-ui/dist/bits/accordion/components/accordion-content.svelte"; +var root_25 = add_locations(from_html(`
`), Accordion_content[FILENAME], [[38, 1]]); +function Accordion_content($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Accordion_content); + let ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 19, () => createId(uid)), forceMount = prop($$props, "forceMount", 3, false), hiddenUntilFound = prop($$props, "hiddenUntilFound", 3, false), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "child", + "ref", + "id", + "forceMount", + "children", + "hiddenUntilFound" + ], + "restProps" + ); + const contentState = AccordionContentState.create({ + forceMount: boxWith(() => forceMount()), + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)), + hiddenUntilFound: boxWith(() => hiddenUntilFound()) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, contentState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + { + let $0 = user_derived(() => ({ props: get(mergedProps), ...contentState.snippetProps })); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => get($0)), "render", Accordion_content, 33, 1); + } + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var div = root_25(); + attribute_effect(div, () => ({ ...get(mergedProps) })); + var node_2 = child(div); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Accordion_content, 39, 2); + reset(div); + append($$anchor2, div); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Accordion_content, + 32, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Accordion_content = hmr(Accordion_content, () => Accordion_content[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Accordion_content[HMR].source; + set(Accordion_content[HMR].source, module.default[HMR].original); + }); +} +var accordion_content_default = Accordion_content; + +// node_modules/bits-ui/dist/bits/alert-dialog/exports.js +var exports_exports2 = {}; +__export(exports_exports2, { + Action: () => alert_dialog_action_default, + Cancel: () => alert_dialog_cancel_default, + Content: () => alert_dialog_content_default, + Description: () => dialog_description_default, + Overlay: () => dialog_overlay_default, + Portal: () => portal_default, + Root: () => alert_dialog_default, + Title: () => dialog_title_default, + Trigger: () => dialog_trigger_default +}); + +// node_modules/bits-ui/dist/bits/dialog/dialog.svelte.js +var dialogAttrs = createBitsAttrs({ + component: "dialog", + parts: [ + "content", + "trigger", + "overlay", + "title", + "description", + "close", + "cancel", + "action" + ] +}); +var DialogRootContext = new Context("Dialog.Root | AlertDialog.Root"); +var DialogRootState = class _DialogRootState { + static create(opts) { + const parent = DialogRootContext.getOr(null); + return DialogRootContext.set(new _DialogRootState(opts, parent)); + } + opts; + #triggerNode = tag(state(null), "DialogRootState.triggerNode"); + get triggerNode() { + return get(this.#triggerNode); + } + set triggerNode(value) { + set(this.#triggerNode, value, true); + } + #contentNode = tag(state(null), "DialogRootState.contentNode"); + get contentNode() { + return get(this.#contentNode); + } + set contentNode(value) { + set(this.#contentNode, value, true); + } + #overlayNode = tag(state(null), "DialogRootState.overlayNode"); + get overlayNode() { + return get(this.#overlayNode); + } + set overlayNode(value) { + set(this.#overlayNode, value, true); + } + #descriptionNode = tag(state(null), "DialogRootState.descriptionNode"); + get descriptionNode() { + return get(this.#descriptionNode); + } + set descriptionNode(value) { + set(this.#descriptionNode, value, true); + } + #contentId = tag(state(void 0), "DialogRootState.contentId"); + get contentId() { + return get(this.#contentId); + } + set contentId(value) { + set(this.#contentId, value, true); + } + #titleId = tag(state(void 0), "DialogRootState.titleId"); + get titleId() { + return get(this.#titleId); + } + set titleId(value) { + set(this.#titleId, value, true); + } + #triggerId = tag(state(void 0), "DialogRootState.triggerId"); + get triggerId() { + return get(this.#triggerId); + } + set triggerId(value) { + set(this.#triggerId, value, true); + } + #descriptionId = tag(state(void 0), "DialogRootState.descriptionId"); + get descriptionId() { + return get(this.#descriptionId); + } + set descriptionId(value) { + set(this.#descriptionId, value, true); + } + #cancelNode = tag(state(null), "DialogRootState.cancelNode"); + get cancelNode() { + return get(this.#cancelNode); + } + set cancelNode(value) { + set(this.#cancelNode, value, true); + } + #nestedOpenCount = tag(state(0), "DialogRootState.nestedOpenCount"); + get nestedOpenCount() { + return get(this.#nestedOpenCount); + } + set nestedOpenCount(value) { + set(this.#nestedOpenCount, value, true); + } + depth; + parent; + contentPresence; + overlayPresence; + constructor(opts, parent) { + this.opts = opts; + this.parent = parent; + this.depth = parent ? parent.depth + 1 : 0; + this.handleOpen = this.handleOpen.bind(this); + this.handleClose = this.handleClose.bind(this); + this.contentPresence = new PresenceManager({ + ref: boxWith(() => this.contentNode), + open: this.opts.open, + enabled: true, + onComplete: () => { + this.opts.onOpenChangeComplete.current(this.opts.open.current); + } + }); + this.overlayPresence = new PresenceManager({ + ref: boxWith(() => this.overlayNode), + open: this.opts.open, + enabled: true + }); + watch( + () => this.opts.open.current, + (isOpen) => { + if (!this.parent) return; + if (isOpen) { + this.parent.incrementNested(); + } else { + this.parent.decrementNested(); + } + }, + { lazy: true } + ); + onDestroyEffect(() => { + if (this.opts.open.current) { + this.parent?.decrementNested(); + } + }); + } + handleOpen() { + if (this.opts.open.current) return; + this.opts.open.current = true; + } + handleClose() { + if (!this.opts.open.current) return; + this.opts.open.current = false; + } + getBitsAttr = (part) => { + return dialogAttrs.getAttr(part, this.opts.variant.current); + }; + incrementNested() { + this.nestedOpenCount++; + this.parent?.incrementNested(); + } + decrementNested() { + if (strict_equals(this.nestedOpenCount, 0)) return; + this.nestedOpenCount--; + this.parent?.decrementNested(); + } + #sharedProps = tag(user_derived(() => ({ "data-state": getDataOpenClosed(this.opts.open.current) })), "DialogRootState.sharedProps"); + get sharedProps() { + return get(this.#sharedProps); + } + set sharedProps(value) { + set(this.#sharedProps, value); + } +}; +var DialogTriggerState = class _DialogTriggerState { + static create(opts) { + return new _DialogTriggerState(opts, DialogRootContext.get()); + } + opts; + root; + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.attachment = attachRef(this.opts.ref, (v) => { + this.root.triggerNode = v; + this.root.triggerId = v?.id; + }); + this.onclick = this.onclick.bind(this); + this.onkeydown = this.onkeydown.bind(this); + } + onclick(e) { + if (this.opts.disabled.current) return; + if (e.button > 0) return; + this.root.handleOpen(); + } + onkeydown(e) { + if (this.opts.disabled.current) return; + if (strict_equals(e.key, kbd_constants_exports.SPACE) || strict_equals(e.key, kbd_constants_exports.ENTER)) { + e.preventDefault(); + this.root.handleOpen(); + } + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + "aria-haspopup": "dialog", + "aria-expanded": boolToStr(this.root.opts.open.current), + "aria-controls": this.root.contentId, + [this.root.getBitsAttr("trigger")]: "", + onkeydown: this.onkeydown, + onclick: this.onclick, + disabled: this.opts.disabled.current ? true : void 0, + ...this.root.sharedProps, + ...this.attachment + })), + "DialogTriggerState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var DialogCloseState = class _DialogCloseState { + static create(opts) { + return new _DialogCloseState(opts, DialogRootContext.get()); + } + opts; + root; + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.attachment = attachRef(this.opts.ref); + this.onclick = this.onclick.bind(this); + this.onkeydown = this.onkeydown.bind(this); + } + onclick(e) { + if (this.opts.disabled.current) return; + if (e.button > 0) return; + this.root.handleClose(); + } + onkeydown(e) { + if (this.opts.disabled.current) return; + if (strict_equals(e.key, kbd_constants_exports.SPACE) || strict_equals(e.key, kbd_constants_exports.ENTER)) { + e.preventDefault(); + this.root.handleClose(); + } + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + [this.root.getBitsAttr(this.opts.variant.current)]: "", + onclick: this.onclick, + onkeydown: this.onkeydown, + disabled: this.opts.disabled.current ? true : void 0, + tabindex: 0, + ...this.root.sharedProps, + ...this.attachment + })), + "DialogCloseState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var DialogActionState = class _DialogActionState { + static create(opts) { + return new _DialogActionState(opts, DialogRootContext.get()); + } + opts; + root; + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.attachment = attachRef(this.opts.ref); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + [this.root.getBitsAttr("action")]: "", + ...this.root.sharedProps, + ...this.attachment + })), + "DialogActionState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var DialogTitleState = class _DialogTitleState { + static create(opts) { + return new _DialogTitleState(opts, DialogRootContext.get()); + } + opts; + root; + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.root.titleId = this.opts.id.current; + this.attachment = attachRef(this.opts.ref); + watch.pre(() => this.opts.id.current, (id) => { + this.root.titleId = id; + }); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + role: "heading", + "aria-level": this.opts.level.current, + [this.root.getBitsAttr("title")]: "", + ...this.root.sharedProps, + ...this.attachment + })), + "DialogTitleState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var DialogDescriptionState = class _DialogDescriptionState { + static create(opts) { + return new _DialogDescriptionState(opts, DialogRootContext.get()); + } + opts; + root; + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.root.descriptionId = this.opts.id.current; + this.attachment = attachRef(this.opts.ref, (v) => { + this.root.descriptionNode = v; + }); + watch.pre(() => this.opts.id.current, (id) => { + this.root.descriptionId = id; + }); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + [this.root.getBitsAttr("description")]: "", + ...this.root.sharedProps, + ...this.attachment + })), + "DialogDescriptionState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var DialogContentState = class _DialogContentState { + static create(opts) { + return new _DialogContentState(opts, DialogRootContext.get()); + } + opts; + root; + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.attachment = attachRef(this.opts.ref, (v) => { + this.root.contentNode = v; + this.root.contentId = v?.id; + }); + } + #snippetProps = tag(user_derived(() => ({ open: this.root.opts.open.current })), "DialogContentState.snippetProps"); + get snippetProps() { + return get(this.#snippetProps); + } + set snippetProps(value) { + set(this.#snippetProps, value); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + role: strict_equals(this.root.opts.variant.current, "alert-dialog") ? "alertdialog" : "dialog", + "aria-modal": "true", + "aria-describedby": this.root.descriptionId, + "aria-labelledby": this.root.titleId, + [this.root.getBitsAttr("content")]: "", + style: { + pointerEvents: "auto", + outline: strict_equals(this.root.opts.variant.current, "alert-dialog") ? "none" : void 0, + "--bits-dialog-depth": this.root.depth, + "--bits-dialog-nested-count": this.root.nestedOpenCount + }, + tabindex: strict_equals(this.root.opts.variant.current, "alert-dialog") ? -1 : void 0, + "data-nested-open": boolToEmptyStrOrUndef(this.root.nestedOpenCount > 0), + "data-nested": boolToEmptyStrOrUndef(strict_equals(this.root.parent, null, false)), + ...this.root.sharedProps, + ...this.attachment + })), + "DialogContentState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } + get shouldRender() { + return this.root.contentPresence.shouldRender; + } +}; +var DialogOverlayState = class _DialogOverlayState { + static create(opts) { + return new _DialogOverlayState(opts, DialogRootContext.get()); + } + opts; + root; + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.attachment = attachRef(this.opts.ref, (v) => this.root.overlayNode = v); + } + #snippetProps = tag(user_derived(() => ({ open: this.root.opts.open.current })), "DialogOverlayState.snippetProps"); + get snippetProps() { + return get(this.#snippetProps); + } + set snippetProps(value) { + set(this.#snippetProps, value); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + [this.root.getBitsAttr("overlay")]: "", + style: { + pointerEvents: "auto", + "--bits-dialog-depth": this.root.depth, + "--bits-dialog-nested-count": this.root.nestedOpenCount + }, + "data-nested-open": boolToEmptyStrOrUndef(this.root.nestedOpenCount > 0), + "data-nested": boolToEmptyStrOrUndef(strict_equals(this.root.parent, null, false)), + ...this.root.sharedProps, + ...this.attachment + })), + "DialogOverlayState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } + get shouldRender() { + return this.root.overlayPresence.shouldRender; + } +}; +var AlertDialogCancelState = class _AlertDialogCancelState { + static create(opts) { + return new _AlertDialogCancelState(opts, DialogRootContext.get()); + } + opts; + root; + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.attachment = attachRef(this.opts.ref, (v) => this.root.cancelNode = v); + this.onclick = this.onclick.bind(this); + this.onkeydown = this.onkeydown.bind(this); + } + onclick(e) { + if (this.opts.disabled.current) return; + if (e.button > 0) return; + this.root.handleClose(); + } + onkeydown(e) { + if (this.opts.disabled.current) return; + if (strict_equals(e.key, kbd_constants_exports.SPACE) || strict_equals(e.key, kbd_constants_exports.ENTER)) { + e.preventDefault(); + this.root.handleClose(); + } + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + [this.root.getBitsAttr("cancel")]: "", + onclick: this.onclick, + onkeydown: this.onkeydown, + tabindex: 0, + ...this.root.sharedProps, + ...this.attachment + })), + "AlertDialogCancelState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; + +// node_modules/bits-ui/dist/bits/alert-dialog/components/alert-dialog.svelte +Alert_dialog[FILENAME] = "node_modules/bits-ui/dist/bits/alert-dialog/components/alert-dialog.svelte"; +function Alert_dialog($$anchor, $$props) { + check_target(new.target); + push($$props, true, Alert_dialog); + let open = prop($$props, "open", 15, false), onOpenChange = prop($$props, "onOpenChange", 3, noop3), onOpenChangeComplete = prop($$props, "onOpenChangeComplete", 3, noop3); + DialogRootState.create({ + variant: boxWith(() => "alert-dialog"), + open: boxWith(() => open(), (v) => { + open(v); + onOpenChange()(v); + }), + onOpenChangeComplete: boxWith(() => onOpenChangeComplete()) + }); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + add_svelte_meta(() => snippet(node, () => $$props.children ?? noop), "render", Alert_dialog, 27, 0); + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Alert_dialog = hmr(Alert_dialog, () => Alert_dialog[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Alert_dialog[HMR].source; + set(Alert_dialog[HMR].source, module.default[HMR].original); + }); +} +var alert_dialog_default = Alert_dialog; + +// node_modules/bits-ui/dist/bits/dialog/components/dialog-title.svelte +Dialog_title[FILENAME] = "node_modules/bits-ui/dist/bits/dialog/components/dialog-title.svelte"; +var root_26 = add_locations(from_html(`
`), Dialog_title[FILENAME], [[33, 1]]); +function Dialog_title($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Dialog_title); + let id = prop($$props, "id", 19, () => createId(uid)), ref = prop($$props, "ref", 15, null), level = prop($$props, "level", 3, 2), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "id", + "ref", + "child", + "children", + "level" + ], + "restProps" + ); + const titleState = DialogTitleState.create({ + id: boxWith(() => id()), + level: boxWith(() => level()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, titleState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Dialog_title, 31, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var div = root_26(); + attribute_effect(div, () => ({ ...get(mergedProps) })); + var node_2 = child(div); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Dialog_title, 34, 2); + reset(div); + append($$anchor2, div); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Dialog_title, + 30, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Dialog_title = hmr(Dialog_title, () => Dialog_title[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Dialog_title[HMR].source; + set(Dialog_title[HMR].source, module.default[HMR].original); + }); +} +var dialog_title_default = Dialog_title; + +// node_modules/bits-ui/dist/bits/alert-dialog/components/alert-dialog-action.svelte +Alert_dialog_action[FILENAME] = "node_modules/bits-ui/dist/bits/alert-dialog/components/alert-dialog-action.svelte"; +var root_27 = add_locations(from_html(``), Alert_dialog_action[FILENAME], [[31, 1]]); +function Alert_dialog_action($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Alert_dialog_action); + let id = prop($$props, "id", 19, () => createId(uid)), ref = prop($$props, "ref", 15, null), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "children", + "child", + "id", + "ref" + ], + "restProps" + ); + const actionState = DialogActionState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, actionState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Alert_dialog_action, 29, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var button = root_27(); + attribute_effect(button, () => ({ ...get(mergedProps) })); + var node_2 = child(button); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Alert_dialog_action, 32, 2); + reset(button); + append($$anchor2, button); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Alert_dialog_action, + 28, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Alert_dialog_action = hmr(Alert_dialog_action, () => Alert_dialog_action[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Alert_dialog_action[HMR].source; + set(Alert_dialog_action[HMR].source, module.default[HMR].original); + }); +} +var alert_dialog_action_default = Alert_dialog_action; + +// node_modules/bits-ui/dist/bits/alert-dialog/components/alert-dialog-cancel.svelte +Alert_dialog_cancel[FILENAME] = "node_modules/bits-ui/dist/bits/alert-dialog/components/alert-dialog-cancel.svelte"; +var root_28 = add_locations(from_html(``), Alert_dialog_cancel[FILENAME], [[33, 1]]); +function Alert_dialog_cancel($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Alert_dialog_cancel); + let id = prop($$props, "id", 19, () => createId(uid)), ref = prop($$props, "ref", 15, null), disabled = prop($$props, "disabled", 3, false), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "id", + "ref", + "children", + "child", + "disabled" + ], + "restProps" + ); + const cancelState = AlertDialogCancelState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)), + disabled: boxWith(() => Boolean(disabled())) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, cancelState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Alert_dialog_cancel, 31, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var button = root_28(); + attribute_effect(button, () => ({ ...get(mergedProps) })); + var node_2 = child(button); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Alert_dialog_cancel, 34, 2); + reset(button); + append($$anchor2, button); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Alert_dialog_cancel, + 30, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Alert_dialog_cancel = hmr(Alert_dialog_cancel, () => Alert_dialog_cancel[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Alert_dialog_cancel[HMR].source; + set(Alert_dialog_cancel[HMR].source, module.default[HMR].original); + }); +} +var alert_dialog_cancel_default = Alert_dialog_cancel; + +// node_modules/bits-ui/dist/bits/utilities/portal/portal-consumer.svelte +Portal_consumer[FILENAME] = "node_modules/bits-ui/dist/bits/utilities/portal/portal-consumer.svelte"; +function Portal_consumer($$anchor, $$props) { + check_target(new.target); + push($$props, true, Portal_consumer); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + add_svelte_meta( + () => key(node, () => $$props.children, ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.children ?? noop), "render", Portal_consumer, 8, 1); + append($$anchor2, fragment_1); + }), + "key", + Portal_consumer, + 7, + 0 + ); + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Portal_consumer = hmr(Portal_consumer, () => Portal_consumer[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Portal_consumer[HMR].source; + set(Portal_consumer[HMR].source, module.default[HMR].original); + }); +} +var portal_consumer_default = Portal_consumer; + +// node_modules/bits-ui/dist/bits/utilities/config/bits-config.js +var BitsConfigContext = new Context("BitsConfig"); +function getBitsConfig() { + const fallback = new BitsConfigState(null, {}); + return BitsConfigContext.getOr(fallback).opts; +} +function useBitsConfig(opts) { + return BitsConfigContext.set(new BitsConfigState(BitsConfigContext.getOr(null), opts)); +} +var BitsConfigState = class { + opts; + constructor(parent, opts) { + const resolveConfigOption = createConfigResolver(parent, opts); + this.opts = { + defaultPortalTo: resolveConfigOption((config) => config.defaultPortalTo), + defaultLocale: resolveConfigOption((config) => config.defaultLocale) + }; + } +}; +function createConfigResolver(parent, currentOpts) { + return (getter) => { + const configOption = boxWith(() => { + const value = getter(currentOpts)?.current; + if (value !== void 0) + return value; + if (parent === null) + return void 0; + return getter(parent.opts)?.current; + }); + return configOption; + }; +} + +// node_modules/bits-ui/dist/bits/utilities/config/prop-resolvers.js +function createPropResolver(configOption, fallback) { + return (getProp) => { + const config = getBitsConfig(); + return boxWith(() => { + const propValue = getProp(); + if (propValue !== void 0) + return propValue; + const option = configOption(config).current; + if (option !== void 0) + return option; + return fallback; + }); + }; +} +var resolveLocaleProp = createPropResolver((config) => config.defaultLocale, "en"); +var resolvePortalToProp = createPropResolver((config) => config.defaultPortalTo, "body"); + +// node_modules/bits-ui/dist/bits/utilities/portal/portal.svelte +Portal[FILENAME] = "node_modules/bits-ui/dist/bits/utilities/portal/portal.svelte"; +function Portal($$anchor, $$props) { + check_target(new.target); + push($$props, true, Portal); + const to = resolvePortalToProp(() => $$props.to); + const context = getAllContexts(); + let target = tag(user_derived(getTarget), "target"); + function getTarget() { + if (!isBrowser || $$props.disabled) return null; + let localTarget = null; + if (strict_equals(typeof to.current, "string")) { + const target2 = document.querySelector(to.current); + if (true_default && strict_equals(target2, null)) { + throw new Error(`Target element "${to.current}" not found.`); + } + localTarget = target2; + } else { + localTarget = to.current; + } + if (true_default && !(localTarget instanceof Element)) { + const type = strict_equals(localTarget, null) ? "null" : typeof localTarget; + throw new TypeError(`Unknown portal target type: ${type}. Allowed types: string (query selector) or Element.`); + } + return localTarget; + } + let instance; + function unmountInstance() { + if (instance) { + unmount(instance); + instance = null; + } + } + watch([() => get(target), () => $$props.disabled], ([target2, disabled]) => { + if (!target2 || disabled) { + unmountInstance(); + return; + } + instance = mount(portal_consumer_default, { target: target2, props: { children: $$props.children }, context }); + return () => { + unmountInstance(); + }; + }); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.children ?? noop), "render", Portal, 69, 1); + append($$anchor2, fragment_1); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.disabled) $$render(consequent); + }), + "if", + Portal, + 68, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Portal = hmr(Portal, () => Portal[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Portal[HMR].source; + set(Portal[HMR].source, module.default[HMR].original); + }); +} +var portal_default = Portal; + +// node_modules/bits-ui/dist/internal/events.js +var CustomEventDispatcher = class { + eventName; + options; + constructor(eventName, options = { bubbles: true, cancelable: true }) { + this.eventName = eventName; + this.options = options; + } + createEvent(detail) { + return new CustomEvent(this.eventName, { + ...this.options, + detail + }); + } + dispatch(element2, detail) { + const event = this.createEvent(detail); + element2.dispatchEvent(event); + return event; + } + listen(element2, callback, options) { + const handler = (event) => { + callback(event); + }; + return on(element2, this.eventName, handler, options); + } +}; + +// node_modules/bits-ui/dist/internal/debounce.js +function debounce2(fn, wait = 500) { + let timeout = null; + const debounced = (...args) => { + if (timeout !== null) { + clearTimeout(timeout); + } + timeout = setTimeout(() => { + fn(...args); + }, wait); + }; + debounced.destroy = () => { + if (timeout !== null) { + clearTimeout(timeout); + timeout = null; + } + }; + return debounced; +} + +// node_modules/bits-ui/dist/internal/elements.js +function isOrContainsTarget2(node, target) { + return node === target || node.contains(target); +} +function getOwnerDocument2(el) { + return el?.ownerDocument ?? document; +} + +// node_modules/bits-ui/dist/internal/dom.js +function getFirstNonCommentChild(element2) { + if (!element2) + return null; + for (const child2 of element2.childNodes) { + if (child2.nodeType !== Node.COMMENT_NODE) { + return child2; + } + } + return null; +} +function isClickTrulyOutside(event, contentNode) { + const { clientX, clientY } = event; + const rect = contentNode.getBoundingClientRect(); + return clientX < rect.left || clientX > rect.right || clientY < rect.top || clientY > rect.bottom; +} + +// node_modules/bits-ui/dist/bits/menu/utils.js +var SELECTION_KEYS2 = [kbd_constants_exports.ENTER, kbd_constants_exports.SPACE]; +var FIRST_KEYS2 = [kbd_constants_exports.ARROW_DOWN, kbd_constants_exports.PAGE_UP, kbd_constants_exports.HOME]; +var LAST_KEYS2 = [kbd_constants_exports.ARROW_UP, kbd_constants_exports.PAGE_DOWN, kbd_constants_exports.END]; +var FIRST_LAST_KEYS2 = [...FIRST_KEYS2, ...LAST_KEYS2]; +var SUB_OPEN_KEYS = { + ltr: [...SELECTION_KEYS2, kbd_constants_exports.ARROW_RIGHT], + rtl: [...SELECTION_KEYS2, kbd_constants_exports.ARROW_LEFT] +}; +var SUB_CLOSE_KEYS = { + ltr: [kbd_constants_exports.ARROW_LEFT], + rtl: [kbd_constants_exports.ARROW_RIGHT] +}; +function isIndeterminate(checked) { + return checked === "indeterminate"; +} +function getCheckedState(checked) { + return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked"; +} +function isMouseEvent(event) { + return event.pointerType === "mouse"; +} + +// node_modules/bits-ui/dist/internal/focus.js +function focus(element2, { select = false } = {}) { + if (!element2 || !element2.focus) + return; + const doc = getDocument(element2); + if (doc.activeElement === element2) + return; + const previouslyFocusedElement = doc.activeElement; + element2.focus({ preventScroll: true }); + if (element2 !== previouslyFocusedElement && isSelectableInput(element2) && select) { + element2.select(); + } +} +function focusFirst(candidates, { select = false } = {}, getActiveElement3) { + const previouslyFocusedElement = getActiveElement3(); + for (const candidate of candidates) { + focus(candidate, { select }); + if (getActiveElement3() !== previouslyFocusedElement) + return true; + } +} +function getTabbableCandidates(container) { + const nodes = []; + const doc = getDocument(container); + const walker = doc.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, { + // oxlint-disable-next-line no-explicit-any + acceptNode: (node) => { + const isHiddenInput3 = node.tagName === "INPUT" && node.type === "hidden"; + if (node.disabled || node.hidden || isHiddenInput3) + return NodeFilter.FILTER_SKIP; + return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; + } + }); + while (walker.nextNode()) + nodes.push(walker.currentNode); + return nodes; +} + +// node_modules/tabbable/dist/index.esm.js +var candidateSelectors = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"]; +var candidateSelector = candidateSelectors.join(","); +var NoElement = typeof Element === "undefined"; +var matches = NoElement ? function() { +} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; +var getRootNode = !NoElement && Element.prototype.getRootNode ? function(element2) { + var _element$getRootNode; + return element2 === null || element2 === void 0 ? void 0 : (_element$getRootNode = element2.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element2); +} : function(element2) { + return element2 === null || element2 === void 0 ? void 0 : element2.ownerDocument; +}; +var _isInert = function isInert(node, lookUp) { + var _node$getAttribute; + if (lookUp === void 0) { + lookUp = true; + } + var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, "inert"); + var inert = inertAtt === "" || inertAtt === "true"; + var result = inert || lookUp && node && _isInert(node.parentNode); + return result; +}; +var isContentEditable = function isContentEditable2(node) { + var _node$getAttribute2; + var attValue = node === null || node === void 0 ? void 0 : (_node$getAttribute2 = node.getAttribute) === null || _node$getAttribute2 === void 0 ? void 0 : _node$getAttribute2.call(node, "contenteditable"); + return attValue === "" || attValue === "true"; +}; +var getCandidates = function getCandidates2(el, includeContainer, filter) { + if (_isInert(el)) { + return []; + } + var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector)); + if (includeContainer && matches.call(el, candidateSelector)) { + candidates.unshift(el); + } + candidates = candidates.filter(filter); + return candidates; +}; +var _getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) { + var candidates = []; + var elementsToCheck = Array.from(elements); + while (elementsToCheck.length) { + var element2 = elementsToCheck.shift(); + if (_isInert(element2, false)) { + continue; + } + if (element2.tagName === "SLOT") { + var assigned = element2.assignedElements(); + var content = assigned.length ? assigned : element2.children; + var nestedCandidates = _getCandidatesIteratively(content, true, options); + if (options.flatten) { + candidates.push.apply(candidates, nestedCandidates); + } else { + candidates.push({ + scopeParent: element2, + candidates: nestedCandidates + }); + } + } else { + var validCandidate = matches.call(element2, candidateSelector); + if (validCandidate && options.filter(element2) && (includeContainer || !elements.includes(element2))) { + candidates.push(element2); + } + var shadowRoot = element2.shadowRoot || // check for an undisclosed shadow + typeof options.getShadowRoot === "function" && options.getShadowRoot(element2); + var validShadowRoot = !_isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element2)); + if (shadowRoot && validShadowRoot) { + var _nestedCandidates = _getCandidatesIteratively(shadowRoot === true ? element2.children : shadowRoot.children, true, options); + if (options.flatten) { + candidates.push.apply(candidates, _nestedCandidates); + } else { + candidates.push({ + scopeParent: element2, + candidates: _nestedCandidates + }); + } + } else { + elementsToCheck.unshift.apply(elementsToCheck, element2.children); + } + } + } + return candidates; +}; +var hasTabIndex = function hasTabIndex2(node) { + return !isNaN(parseInt(node.getAttribute("tabindex"), 10)); +}; +var getTabIndex = function getTabIndex2(node) { + if (!node) { + throw new Error("No node provided"); + } + if (node.tabIndex < 0) { + if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) { + return 0; + } + } + return node.tabIndex; +}; +var getSortOrderTabIndex = function getSortOrderTabIndex2(node, isScope) { + var tabIndex = getTabIndex(node); + if (tabIndex < 0 && isScope && !hasTabIndex(node)) { + return 0; + } + return tabIndex; +}; +var sortOrderedTabbables = function sortOrderedTabbables2(a2, b) { + return a2.tabIndex === b.tabIndex ? a2.documentOrder - b.documentOrder : a2.tabIndex - b.tabIndex; +}; +var isInput = function isInput2(node) { + return node.tagName === "INPUT"; +}; +var isHiddenInput = function isHiddenInput2(node) { + return isInput(node) && node.type === "hidden"; +}; +var isDetailsWithSummary = function isDetailsWithSummary2(node) { + var r = node.tagName === "DETAILS" && Array.prototype.slice.apply(node.children).some(function(child2) { + return child2.tagName === "SUMMARY"; + }); + return r; +}; +var getCheckedRadio = function getCheckedRadio2(nodes, form) { + for (var i = 0; i < nodes.length; i++) { + if (nodes[i].checked && nodes[i].form === form) { + return nodes[i]; + } + } +}; +var isTabbableRadio = function isTabbableRadio2(node) { + if (!node.name) { + return true; + } + var radioScope = node.form || getRootNode(node); + var queryRadios = function queryRadios2(name) { + return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]'); + }; + var radioSet; + if (typeof window !== "undefined" && typeof window.CSS !== "undefined" && typeof window.CSS.escape === "function") { + radioSet = queryRadios(window.CSS.escape(node.name)); + } else { + try { + radioSet = queryRadios(node.name); + } catch (err) { + console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", err.message); + return false; + } + } + var checked = getCheckedRadio(radioSet, node.form); + return !checked || checked === node; +}; +var isRadio = function isRadio2(node) { + return isInput(node) && node.type === "radio"; +}; +var isNonTabbableRadio = function isNonTabbableRadio2(node) { + return isRadio(node) && !isTabbableRadio(node); +}; +var isNodeAttached = function isNodeAttached2(node) { + var _nodeRoot; + var nodeRoot = node && getRootNode(node); + var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host; + var attached = false; + if (nodeRoot && nodeRoot !== node) { + var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument; + attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && (_nodeRootHost$ownerDo = _nodeRootHost.ownerDocument) !== null && _nodeRootHost$ownerDo !== void 0 && _nodeRootHost$ownerDo.contains(nodeRootHost) || node !== null && node !== void 0 && (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 && _node$ownerDocument.contains(node)); + while (!attached && nodeRootHost) { + var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD; + nodeRoot = getRootNode(nodeRootHost); + nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host; + attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost)); + } + } + return attached; +}; +var isZeroArea = function isZeroArea2(node) { + var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height; + return width === 0 && height === 0; +}; +var isHidden = function isHidden2(node, _ref) { + var displayCheck = _ref.displayCheck, getShadowRoot = _ref.getShadowRoot; + if (displayCheck === "full-native") { + if ("checkVisibility" in node) { + var visible = node.checkVisibility({ + // Checking opacity might be desirable for some use cases, but natively, + // opacity zero elements _are_ focusable and tabbable. + checkOpacity: false, + opacityProperty: false, + contentVisibilityAuto: true, + visibilityProperty: true, + // This is an alias for `visibilityProperty`. Contemporary browsers + // support both. However, this alias has wider browser support (Chrome + // >= 105 and Firefox >= 106, vs. Chrome >= 121 and Firefox >= 122), so + // we include it anyway. + checkVisibilityCSS: true + }); + return !visible; + } + } + if (getComputedStyle(node).visibility === "hidden") { + return true; + } + var isDirectSummary = matches.call(node, "details>summary:first-of-type"); + var nodeUnderDetails = isDirectSummary ? node.parentElement : node; + if (matches.call(nodeUnderDetails, "details:not([open]) *")) { + return true; + } + if (!displayCheck || displayCheck === "full" || // full-native can run this branch when it falls through in case + // Element#checkVisibility is unsupported + displayCheck === "full-native" || displayCheck === "legacy-full") { + if (typeof getShadowRoot === "function") { + var originalNode = node; + while (node) { + var parentElement = node.parentElement; + var rootNode = getRootNode(node); + if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true) { + return isZeroArea(node); + } else if (node.assignedSlot) { + node = node.assignedSlot; + } else if (!parentElement && rootNode !== node.ownerDocument) { + node = rootNode.host; + } else { + node = parentElement; + } + } + node = originalNode; + } + if (isNodeAttached(node)) { + return !node.getClientRects().length; + } + if (displayCheck !== "legacy-full") { + return true; + } + } else if (displayCheck === "non-zero-area") { + return isZeroArea(node); + } + return false; +}; +var isDisabledFromFieldset = function isDisabledFromFieldset2(node) { + if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) { + var parentNode = node.parentElement; + while (parentNode) { + if (parentNode.tagName === "FIELDSET" && parentNode.disabled) { + for (var i = 0; i < parentNode.children.length; i++) { + var child2 = parentNode.children.item(i); + if (child2.tagName === "LEGEND") { + return matches.call(parentNode, "fieldset[disabled] *") ? true : !child2.contains(node); + } + } + return true; + } + parentNode = parentNode.parentElement; + } + } + return false; +}; +var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable2(options, node) { + if (node.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor + // because we're limited in the type of selectors we can use in JSDom (see related + // note related to `candidateSelectors`) + _isInert(node) || isHiddenInput(node) || isHidden(node, options) || // For a details element with a summary, the summary element gets the focus + isDetailsWithSummary(node) || isDisabledFromFieldset(node)) { + return false; + } + return true; +}; +var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable2(options, node) { + if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) { + return false; + } + return true; +}; +var isShadowRootTabbable = function isShadowRootTabbable2(shadowHostNode) { + var tabIndex = parseInt(shadowHostNode.getAttribute("tabindex"), 10); + if (isNaN(tabIndex) || tabIndex >= 0) { + return true; + } + return false; +}; +var _sortByOrder = function sortByOrder(candidates) { + var regularTabbables = []; + var orderedTabbables = []; + candidates.forEach(function(item, i) { + var isScope = !!item.scopeParent; + var element2 = isScope ? item.scopeParent : item; + var candidateTabindex = getSortOrderTabIndex(element2, isScope); + var elements = isScope ? _sortByOrder(item.candidates) : element2; + if (candidateTabindex === 0) { + isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element2); + } else { + orderedTabbables.push({ + documentOrder: i, + tabIndex: candidateTabindex, + item, + isScope, + content: elements + }); + } + }); + return orderedTabbables.sort(sortOrderedTabbables).reduce(function(acc, sortable) { + sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content); + return acc; + }, []).concat(regularTabbables); +}; +var tabbable = function tabbable2(container, options) { + options = options || {}; + var candidates; + if (options.getShadowRoot) { + candidates = _getCandidatesIteratively([container], options.includeContainer, { + filter: isNodeMatchingSelectorTabbable.bind(null, options), + flatten: false, + getShadowRoot: options.getShadowRoot, + shadowRootFilter: isShadowRootTabbable + }); + } else { + candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options)); + } + return _sortByOrder(candidates); +}; +var focusable = function focusable2(container, options) { + options = options || {}; + var candidates; + if (options.getShadowRoot) { + candidates = _getCandidatesIteratively([container], options.includeContainer, { + filter: isNodeMatchingSelectorFocusable.bind(null, options), + flatten: true, + getShadowRoot: options.getShadowRoot + }); + } else { + candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options)); + } + return candidates; +}; +var isTabbable = function isTabbable2(node, options) { + options = options || {}; + if (!node) { + throw new Error("No node provided"); + } + if (matches.call(node, candidateSelector) === false) { + return false; + } + return isNodeMatchingSelectorTabbable(options, node); +}; +var focusableCandidateSelector = candidateSelectors.concat("iframe").join(","); +var isFocusable = function isFocusable2(node, options) { + options = options || {}; + if (!node) { + throw new Error("No node provided"); + } + if (matches.call(node, focusableCandidateSelector) === false) { + return false; + } + return isNodeMatchingSelectorFocusable(options, node); +}; + +// node_modules/bits-ui/dist/internal/tabbable.js +function getTabbableOptions() { + return { + getShadowRoot: true, + displayCheck: ( + // JSDOM does not support the `tabbable` library. To solve this we can + // check if `ResizeObserver` is a real function (not polyfilled), which + // determines if the current environment is JSDOM-like. + typeof ResizeObserver === "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none" + ) + }; +} +function getTabbableFrom(currentNode, direction) { + if (!isTabbable(currentNode, getTabbableOptions())) { + return getTabbableFromFocusable(currentNode, direction); + } + const doc = getDocument(currentNode); + const allTabbable = tabbable(doc.body, getTabbableOptions()); + if (direction === "prev") + allTabbable.reverse(); + const activeIndex = allTabbable.indexOf(currentNode); + if (activeIndex === -1) + return doc.body; + const nextTabbableElements = allTabbable.slice(activeIndex + 1); + return nextTabbableElements[0]; +} +function getTabbableFromFocusable(currentNode, direction) { + const doc = getDocument(currentNode); + if (!isFocusable(currentNode, getTabbableOptions())) + return doc.body; + const allFocusable = focusable(doc.body, getTabbableOptions()); + if (direction === "prev") + allFocusable.reverse(); + const activeIndex = allFocusable.indexOf(currentNode); + if (activeIndex === -1) + return doc.body; + const nextFocusableElements = allFocusable.slice(activeIndex + 1); + return nextFocusableElements.find((node) => isTabbable(node, getTabbableOptions())) ?? doc.body; +} + +// node_modules/bits-ui/dist/internal/arrays.js +function arraysAreEqual(arr1, arr2) { + if (arr1.length !== arr2.length) + return false; + return arr1.every((value, index) => isEqual(value, arr2[index])); +} +function isEqual(a2, b) { + if (Number.isNaN(a2) && Number.isNaN(b)) + return true; + if (Array.isArray(a2) && Array.isArray(b)) + return arraysAreEqual(a2, b); + if (typeof a2 === "object" && typeof b === "object") + return isDeepEqual(a2, b); + return Object.is(a2, b); +} +function isDeepEqual(a2, b) { + if (typeof a2 !== "object" || typeof b !== "object" || a2 === null || b === null) + return false; + const aKeys = Object.keys(a2); + const bKeys = Object.keys(b); + if (aKeys.length !== bKeys.length) + return false; + for (const key2 of aKeys) { + if (!bKeys.includes(key2)) + return false; + if (!isEqual(a2[key2], b[key2])) { + return false; + } + } + return true; +} +function chunk(arr, size3) { + if (size3 <= 0) + return []; + const result = []; + for (let i = 0; i < arr.length; i += size3) { + result.push(arr.slice(i, i + size3)); + } + return result; +} +function isValidIndex(index, arr) { + return index >= 0 && index < arr.length; +} +function next2(array, index, loop = true) { + if (array.length === 0 || index < 0 || index >= array.length) + return; + if (array.length === 1 && index === 0) + return array[0]; + if (index === array.length - 1) + return loop ? array[0] : void 0; + return array[index + 1]; +} +function prev(array, index, loop = true) { + if (array.length === 0 || index < 0 || index >= array.length) + return; + if (array.length === 1 && index === 0) + return array[0]; + if (index === 0) + return loop ? array[array.length - 1] : void 0; + return array[index - 1]; +} +function forward(array, index, increment, loop = true) { + if (array.length === 0 || index < 0 || index >= array.length) + return; + let targetIndex = index + increment; + if (loop) { + targetIndex = (targetIndex % array.length + array.length) % array.length; + } else { + targetIndex = Math.max(0, Math.min(targetIndex, array.length - 1)); + } + return array[targetIndex]; +} +function backward(array, index, decrement, loop = true) { + if (array.length === 0 || index < 0 || index >= array.length) + return; + let targetIndex = index - decrement; + if (loop) { + targetIndex = (targetIndex % array.length + array.length) % array.length; + } else { + targetIndex = Math.max(0, Math.min(targetIndex, array.length - 1)); + } + return array[targetIndex]; +} +function getNextMatch(values, search, currentMatch) { + const lowerSearch = search.toLowerCase(); + if (lowerSearch.endsWith(" ")) { + const searchWithoutSpace = lowerSearch.slice(0, -1); + const matchesWithoutSpace = values.filter((value) => value.toLowerCase().startsWith(searchWithoutSpace)); + if (matchesWithoutSpace.length <= 1) { + return getNextMatch(values, searchWithoutSpace, currentMatch); + } + const currentMatchLowercase = currentMatch?.toLowerCase(); + if (currentMatchLowercase && currentMatchLowercase.startsWith(searchWithoutSpace) && currentMatchLowercase.charAt(searchWithoutSpace.length) === " " && search.trim() === searchWithoutSpace) { + return currentMatch; + } + const spacedMatches = values.filter((value) => value.toLowerCase().startsWith(lowerSearch)); + if (spacedMatches.length > 0) { + const currentMatchIndex2 = currentMatch ? values.indexOf(currentMatch) : -1; + let wrappedMatches = wrapArray(spacedMatches, Math.max(currentMatchIndex2, 0)); + const nextMatch2 = wrappedMatches.find((match) => match !== currentMatch); + return nextMatch2 || currentMatch; + } + } + const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]); + const normalizedSearch = isRepeated ? search[0] : search; + const normalizedLowerSearch = normalizedSearch.toLowerCase(); + const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1; + let wrappedValues = wrapArray(values, Math.max(currentMatchIndex, 0)); + const excludeCurrentMatch = normalizedSearch.length === 1; + if (excludeCurrentMatch) + wrappedValues = wrappedValues.filter((v) => v !== currentMatch); + const nextMatch = wrappedValues.find((value) => value?.toLowerCase().startsWith(normalizedLowerSearch)); + return nextMatch !== currentMatch ? nextMatch : void 0; +} +function wrapArray(array, startIndex) { + return array.map((_, index) => array[(startIndex + index) % array.length]); +} + +// node_modules/bits-ui/dist/internal/box-auto-reset.svelte.js +var defaultOptions = { afterMs: 1e4, onChange: noop3 }; +function boxAutoReset(defaultValue, options) { + const { afterMs, onChange, getWindow: getWindow3 } = { ...defaultOptions, ...options }; + let timeout = null; + let value = tag(state(proxy(defaultValue)), "value"); + function resetAfter() { + return getWindow3().setTimeout( + () => { + set(value, defaultValue, true); + onChange?.(defaultValue); + }, + afterMs + ); + } + user_effect(() => { + return () => { + if (timeout) getWindow3().clearTimeout(timeout); + }; + }); + return boxWith(() => get(value), (v) => { + set(value, v, true); + onChange?.(v); + if (timeout) getWindow3().clearTimeout(timeout); + timeout = resetAfter(); + }); +} + +// node_modules/bits-ui/dist/internal/dom-typeahead.svelte.js +var DOMTypeahead = class { + #opts; + #search; + #onMatch = tag( + user_derived(() => { + if (this.#opts.onMatch) return this.#opts.onMatch; + return (node) => node.focus(); + }), + "DOMTypeahead.#onMatch" + ); + #getCurrentItem = tag( + user_derived(() => { + if (this.#opts.getCurrentItem) return this.#opts.getCurrentItem; + return this.#opts.getActiveElement; + }), + "DOMTypeahead.#getCurrentItem" + ); + constructor(opts) { + this.#opts = opts; + this.#search = boxAutoReset("", { afterMs: 1e3, getWindow: opts.getWindow }); + this.handleTypeaheadSearch = this.handleTypeaheadSearch.bind(this); + this.resetTypeahead = this.resetTypeahead.bind(this); + } + handleTypeaheadSearch(key2, candidates) { + if (!candidates.length) return; + this.#search.current = this.#search.current + key2; + const currentItem = get(this.#getCurrentItem)(); + const currentMatch = candidates.find((item) => strict_equals(item, currentItem))?.textContent?.trim() ?? ""; + const values = candidates.map((item) => item.textContent?.trim() ?? ""); + const nextMatch = getNextMatch(values, this.#search.current, currentMatch); + const newItem = candidates.find((item) => strict_equals(item.textContent?.trim(), nextMatch)); + if (newItem) get(this.#onMatch)(newItem); + return newItem; + } + resetTypeahead() { + this.#search.current = ""; + } + get search() { + return this.#search.current; + } +}; + +// node_modules/bits-ui/dist/internal/grace-area.svelte.js +var GraceArea = class { + #opts; + #enabled; + #isPointerInTransit; + #pointerGraceArea = tag(state(null), "GraceArea.#pointerGraceArea"); + constructor(opts) { + this.#opts = opts; + this.#enabled = tag(user_derived(() => this.#opts.enabled()), "GraceArea.#enabled"); + this.#isPointerInTransit = boxAutoReset(false, { + afterMs: opts.transitTimeout ?? 300, + onChange: (value) => { + if (!get(this.#enabled)) return; + this.#opts.setIsPointerInTransit?.(value); + }, + getWindow: () => getWindow(this.#opts.triggerNode()) + }); + watch([opts.triggerNode, opts.contentNode, opts.enabled], ([triggerNode, contentNode, enabled]) => { + if (!triggerNode || !contentNode || !enabled) return; + const handleTriggerLeave = (e) => { + this.#createGraceArea(e, contentNode); + }; + const handleContentLeave = (e) => { + this.#createGraceArea(e, triggerNode); + }; + return executeCallbacks(on(triggerNode, "pointerleave", handleTriggerLeave), on(contentNode, "pointerleave", handleContentLeave)); + }); + watch(() => get(this.#pointerGraceArea), () => { + const handleTrackPointerGrace = (e) => { + if (!get(this.#pointerGraceArea)) return; + const target = e.target; + if (!isElement2(target)) return; + const pointerPosition = { x: e.clientX, y: e.clientY }; + const hasEnteredTarget = opts.triggerNode()?.contains(target) || opts.contentNode()?.contains(target); + const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, get(this.#pointerGraceArea)); + if (hasEnteredTarget) { + this.#removeGraceArea(); + } else if (isPointerOutsideGraceArea) { + this.#removeGraceArea(); + opts.onPointerExit(); + } + }; + const doc = getDocument(opts.triggerNode() ?? opts.contentNode()); + if (!doc) return; + return on(doc, "pointermove", handleTrackPointerGrace); + }); + } + #removeGraceArea() { + set(this.#pointerGraceArea, null); + this.#isPointerInTransit.current = false; + } + #createGraceArea(e, hoverTarget) { + const currentTarget = e.currentTarget; + if (!isHTMLElement2(currentTarget)) return; + const exitPoint = { x: e.clientX, y: e.clientY }; + const exitSide = getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect()); + const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide); + const hoverTargetPoints = getPointsFromRect(hoverTarget.getBoundingClientRect()); + const graceArea = getHull([...paddedExitPoints, ...hoverTargetPoints]); + set(this.#pointerGraceArea, graceArea, true); + this.#isPointerInTransit.current = true; + } +}; +function getExitSideFromRect(point, rect) { + const top = Math.abs(rect.top - point.y); + const bottom = Math.abs(rect.bottom - point.y); + const right = Math.abs(rect.right - point.x); + const left = Math.abs(rect.left - point.x); + switch (Math.min(top, bottom, right, left)) { + case left: + return "left"; + case right: + return "right"; + case top: + return "top"; + case bottom: + return "bottom"; + default: + throw new Error("unreachable"); + } +} +function getPaddedExitPoints(exitPoint, exitSide, padding = 5) { + const tipPadding = padding * 1.5; + switch (exitSide) { + case "top": + return [ + { x: exitPoint.x - padding, y: exitPoint.y + padding }, + { x: exitPoint.x, y: exitPoint.y - tipPadding }, + { x: exitPoint.x + padding, y: exitPoint.y + padding } + ]; + case "bottom": + return [ + { x: exitPoint.x - padding, y: exitPoint.y - padding }, + { x: exitPoint.x, y: exitPoint.y + tipPadding }, + { x: exitPoint.x + padding, y: exitPoint.y - padding } + ]; + case "left": + return [ + { x: exitPoint.x + padding, y: exitPoint.y - padding }, + { x: exitPoint.x - tipPadding, y: exitPoint.y }, + { x: exitPoint.x + padding, y: exitPoint.y + padding } + ]; + case "right": + return [ + { x: exitPoint.x - padding, y: exitPoint.y - padding }, + { x: exitPoint.x + tipPadding, y: exitPoint.y }, + { x: exitPoint.x - padding, y: exitPoint.y + padding } + ]; + } +} +function getPointsFromRect(rect) { + const { top, right, bottom, left } = rect; + return [ + { x: left, y: top }, + { x: right, y: top }, + { x: right, y: bottom }, + { x: left, y: bottom } + ]; +} +function isPointInPolygon(point, polygon) { + const { x, y } = point; + let inside = false; + for (let i = 0, j2 = polygon.length - 1; i < polygon.length; j2 = i++) { + const xi = polygon[i].x; + const yi = polygon[i].y; + const xj = polygon[j2].x; + const yj = polygon[j2].y; + const intersect = strict_equals(yi > y, yj > y, false) && x < (xj - xi) * (y - yi) / (yj - yi) + xi; + if (intersect) inside = !inside; + } + return inside; +} +function getHull(points) { + const newPoints = points.slice(); + newPoints.sort((a2, b) => { + if (a2.x < b.x) return -1; + else if (a2.x > b.x) return 1; + else if (a2.y < b.y) return -1; + else if (a2.y > b.y) return 1; + else return 0; + }); + return getHullPresorted(newPoints); +} +function getHullPresorted(points) { + if (points.length <= 1) return points.slice(); + const upperHull = []; + for (let i = 0; i < points.length; i++) { + const p2 = points[i]; + while (upperHull.length >= 2) { + const q = upperHull[upperHull.length - 1]; + const r = upperHull[upperHull.length - 2]; + if ((q.x - r.x) * (p2.y - r.y) >= (q.y - r.y) * (p2.x - r.x)) upperHull.pop(); + else break; + } + upperHull.push(p2); + } + upperHull.pop(); + const lowerHull = []; + for (let i = points.length - 1; i >= 0; i--) { + const p2 = points[i]; + while (lowerHull.length >= 2) { + const q = lowerHull[lowerHull.length - 1]; + const r = lowerHull[lowerHull.length - 2]; + if ((q.x - r.x) * (p2.y - r.y) >= (q.y - r.y) * (p2.x - r.x)) lowerHull.pop(); + else break; + } + lowerHull.push(p2); + } + lowerHull.pop(); + if (strict_equals(upperHull.length, 1) && strict_equals(lowerHull.length, 1) && strict_equals(upperHull[0].x, lowerHull[0].x) && strict_equals(upperHull[0].y, lowerHull[0].y)) return upperHull; + else return upperHull.concat(lowerHull); +} + +// node_modules/bits-ui/dist/bits/menu/menu.svelte.js +var CONTEXT_MENU_TRIGGER_ATTR = "data-context-menu-trigger"; +var CONTEXT_MENU_CONTENT_ATTR = "data-context-menu-content"; +var MenuRootContext = new Context("Menu.Root"); +var MenuMenuContext = new Context("Menu.Root | Menu.Sub"); +var MenuContentContext = new Context("Menu.Content"); +var MenuGroupContext = new Context("Menu.Group | Menu.RadioGroup"); +var MenuRadioGroupContext = new Context("Menu.RadioGroup"); +var MenuCheckboxGroupContext = new Context("Menu.CheckboxGroup"); +var MenuOpenEvent = new CustomEventDispatcher("bitsmenuopen", { bubbles: false, cancelable: true }); +var menuAttrs = createBitsAttrs({ + component: "menu", + parts: [ + "trigger", + "content", + "sub-trigger", + "item", + "group", + "group-heading", + "checkbox-group", + "checkbox-item", + "radio-group", + "radio-item", + "separator", + "sub-content", + "arrow" + ] +}); +var MenuRootState = class _MenuRootState { + static create(opts) { + const root18 = new _MenuRootState(opts); + return MenuRootContext.set(root18); + } + opts; + isUsingKeyboard = new IsUsingKeyboard(); + #ignoreCloseAutoFocus = tag(state(false), "MenuRootState.ignoreCloseAutoFocus"); + get ignoreCloseAutoFocus() { + return get(this.#ignoreCloseAutoFocus); + } + set ignoreCloseAutoFocus(value) { + set(this.#ignoreCloseAutoFocus, value, true); + } + #isPointerInTransit = tag(state(false), "MenuRootState.isPointerInTransit"); + get isPointerInTransit() { + return get(this.#isPointerInTransit); + } + set isPointerInTransit(value) { + set(this.#isPointerInTransit, value, true); + } + constructor(opts) { + this.opts = opts; + } + getBitsAttr = (part) => { + return menuAttrs.getAttr(part, this.opts.variant.current); + }; +}; +var MenuMenuState = class _MenuMenuState { + static create(opts, root18) { + return MenuMenuContext.set(new _MenuMenuState(opts, root18, null)); + } + opts; + root; + parentMenu; + contentId = boxWith(() => ""); + #contentNode = tag(state(null), "MenuMenuState.contentNode"); + get contentNode() { + return get(this.#contentNode); + } + set contentNode(value) { + set(this.#contentNode, value, true); + } + contentPresence; + #triggerNode = tag(state(null), "MenuMenuState.triggerNode"); + get triggerNode() { + return get(this.#triggerNode); + } + set triggerNode(value) { + set(this.#triggerNode, value, true); + } + constructor(opts, root18, parentMenu) { + this.opts = opts; + this.root = root18; + this.parentMenu = parentMenu; + this.contentPresence = new PresenceManager({ + ref: boxWith(() => this.contentNode), + open: this.opts.open, + onComplete: () => { + this.opts.onOpenChangeComplete.current(this.opts.open.current); + } + }); + if (parentMenu) { + watch(() => parentMenu.opts.open.current, () => { + if (parentMenu.opts.open.current) return; + this.opts.open.current = false; + }); + } + } + toggleOpen() { + this.opts.open.current = !this.opts.open.current; + } + onOpen() { + this.opts.open.current = true; + } + onClose() { + this.opts.open.current = false; + } +}; +var MenuContentState = class _MenuContentState { + static create(opts) { + return MenuContentContext.set(new _MenuContentState(opts, MenuMenuContext.get())); + } + opts; + parentMenu; + rovingFocusGroup; + domContext; + attachment; + #search = tag(state(""), "MenuContentState.search"); + get search() { + return get(this.#search); + } + set search(value) { + set(this.#search, value, true); + } + #timer = 0; + #handleTypeaheadSearch; + #mounted = tag(state(false), "MenuContentState.mounted"); + get mounted() { + return get(this.#mounted); + } + set mounted(value) { + set(this.#mounted, value, true); + } + #isSub; + constructor(opts, parentMenu) { + this.opts = opts; + this.parentMenu = parentMenu; + this.domContext = new DOMContext(opts.ref); + this.attachment = attachRef(this.opts.ref, (v) => { + if (strict_equals(this.parentMenu.contentNode, v, false)) { + this.parentMenu.contentNode = v; + } + }); + parentMenu.contentId = opts.id; + this.#isSub = opts.isSub ?? false; + this.onkeydown = this.onkeydown.bind(this); + this.onblur = this.onblur.bind(this); + this.onfocus = this.onfocus.bind(this); + this.handleInteractOutside = this.handleInteractOutside.bind(this); + new GraceArea({ + contentNode: () => this.parentMenu.contentNode, + triggerNode: () => this.parentMenu.triggerNode, + enabled: () => this.parentMenu.opts.open.current && Boolean(this.parentMenu.triggerNode?.hasAttribute(this.parentMenu.root.getBitsAttr("sub-trigger"))), + onPointerExit: () => { + this.parentMenu.opts.open.current = false; + }, + setIsPointerInTransit: (value) => { + this.parentMenu.root.isPointerInTransit = value; + } + }); + this.#handleTypeaheadSearch = new DOMTypeahead({ + getActiveElement: () => this.domContext.getActiveElement(), + getWindow: () => this.domContext.getWindow() + }).handleTypeaheadSearch; + this.rovingFocusGroup = new RovingFocusGroup({ + rootNode: boxWith(() => this.parentMenu.contentNode), + candidateAttr: this.parentMenu.root.getBitsAttr("item"), + loop: this.opts.loop, + orientation: boxWith(() => "vertical") + }); + watch(() => this.parentMenu.contentNode, (contentNode) => { + if (!contentNode) return; + const handler = () => { + afterTick(() => { + if (!this.parentMenu.root.isUsingKeyboard.current) return; + this.rovingFocusGroup.focusFirstCandidate(); + }); + }; + return MenuOpenEvent.listen(contentNode, handler); + }); + user_effect(() => { + if (!this.parentMenu.opts.open.current) { + this.domContext.getWindow().clearTimeout(this.#timer); + } + }); + } + #getCandidateNodes() { + const node = this.parentMenu.contentNode; + if (!node) return []; + const candidates = Array.from(node.querySelectorAll(`[${this.parentMenu.root.getBitsAttr("item")}]:not([data-disabled])`)); + return candidates; + } + #isPointerMovingToSubmenu() { + return this.parentMenu.root.isPointerInTransit; + } + onCloseAutoFocus = (e) => { + this.opts.onCloseAutoFocus.current?.(e); + if (e.defaultPrevented || this.#isSub) return; + if (this.parentMenu.triggerNode && isTabbable(this.parentMenu.triggerNode)) { + e.preventDefault(); + this.parentMenu.triggerNode.focus(); + } + }; + handleTabKeyDown(e) { + let rootMenu = this.parentMenu; + while (strict_equals(rootMenu.parentMenu, null, false)) { + rootMenu = rootMenu.parentMenu; + } + if (!rootMenu.triggerNode) return; + e.preventDefault(); + const nodeToFocus = getTabbableFrom(rootMenu.triggerNode, e.shiftKey ? "prev" : "next"); + if (nodeToFocus) { + this.parentMenu.root.ignoreCloseAutoFocus = true; + rootMenu.onClose(); + afterTick(() => { + nodeToFocus.focus(); + afterTick(() => { + this.parentMenu.root.ignoreCloseAutoFocus = false; + }); + }); + } else { + this.domContext.getDocument().body.focus(); + } + } + onkeydown(e) { + if (e.defaultPrevented) return; + if (strict_equals(e.key, kbd_constants_exports.TAB)) { + this.handleTabKeyDown(e); + return; + } + const target = e.target; + const currentTarget = e.currentTarget; + if (!isHTMLElement2(target) || !isHTMLElement2(currentTarget)) return; + const isKeydownInside = strict_equals(target.closest(`[${this.parentMenu.root.getBitsAttr("content")}]`)?.id, this.parentMenu.contentId.current); + const isModifierKey = e.ctrlKey || e.altKey || e.metaKey; + const isCharacterKey = strict_equals(e.key.length, 1); + const kbdFocusedEl = this.rovingFocusGroup.handleKeydown(target, e); + if (kbdFocusedEl) return; + if (strict_equals(e.code, "Space")) return; + const candidateNodes = this.#getCandidateNodes(); + if (isKeydownInside) { + if (!isModifierKey && isCharacterKey) { + this.#handleTypeaheadSearch(e.key, candidateNodes); + } + } + if (strict_equals(e.target?.id, this.parentMenu.contentId.current, false)) return; + if (!FIRST_LAST_KEYS2.includes(e.key)) return; + e.preventDefault(); + if (LAST_KEYS2.includes(e.key)) { + candidateNodes.reverse(); + } + focusFirst(candidateNodes, { select: false }, () => this.domContext.getActiveElement()); + } + onblur(e) { + if (!isElement2(e.currentTarget)) return; + if (!isElement2(e.target)) return; + if (!e.currentTarget.contains?.(e.target)) { + this.domContext.getWindow().clearTimeout(this.#timer); + this.search = ""; + } + } + onfocus(_) { + if (!this.parentMenu.root.isUsingKeyboard.current) return; + afterTick(() => this.rovingFocusGroup.focusFirstCandidate()); + } + onItemEnter() { + return this.#isPointerMovingToSubmenu(); + } + onItemLeave(e) { + if (e.currentTarget.hasAttribute(this.parentMenu.root.getBitsAttr("sub-trigger"))) return; + if (this.#isPointerMovingToSubmenu() || this.parentMenu.root.isUsingKeyboard.current) return; + const contentNode = this.parentMenu.contentNode; + contentNode?.focus(); + this.rovingFocusGroup.setCurrentTabStopId(""); + } + onTriggerLeave() { + if (this.#isPointerMovingToSubmenu()) return true; + return false; + } + handleInteractOutside(e) { + if (!isElementOrSVGElement(e.target)) return; + const triggerId = this.parentMenu.triggerNode?.id; + if (strict_equals(e.target.id, triggerId)) { + e.preventDefault(); + return; + } + if (e.target.closest(`#${triggerId}`)) { + e.preventDefault(); + } + } + get shouldRender() { + return this.parentMenu.contentPresence.shouldRender; + } + #snippetProps = tag(user_derived(() => ({ open: this.parentMenu.opts.open.current })), "MenuContentState.snippetProps"); + get snippetProps() { + return get(this.#snippetProps); + } + set snippetProps(value) { + set(this.#snippetProps, value); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + role: "menu", + "aria-orientation": "vertical", + [this.parentMenu.root.getBitsAttr("content")]: "", + "data-state": getDataOpenClosed(this.parentMenu.opts.open.current), + onkeydown: this.onkeydown, + onblur: this.onblur, + onfocus: this.onfocus, + dir: this.parentMenu.root.opts.dir.current, + style: { pointerEvents: "auto" }, + ...this.attachment + })), + "MenuContentState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } + popperProps = { onCloseAutoFocus: (e) => this.onCloseAutoFocus(e) }; +}; +var MenuItemSharedState = class { + opts; + content; + attachment; + #isFocused = tag(state(false), "MenuItemSharedState.#isFocused"); + constructor(opts, content) { + this.opts = opts; + this.content = content; + this.attachment = attachRef(this.opts.ref); + this.onpointermove = this.onpointermove.bind(this); + this.onpointerleave = this.onpointerleave.bind(this); + this.onfocus = this.onfocus.bind(this); + this.onblur = this.onblur.bind(this); + } + onpointermove(e) { + if (e.defaultPrevented) return; + if (!isMouseEvent(e)) return; + if (this.opts.disabled.current) { + this.content.onItemLeave(e); + } else { + const defaultPrevented = this.content.onItemEnter(); + if (defaultPrevented) return; + const item = e.currentTarget; + if (!isHTMLElement2(item)) return; + item.focus(); + } + } + onpointerleave(e) { + if (e.defaultPrevented) return; + if (!isMouseEvent(e)) return; + this.content.onItemLeave(e); + } + onfocus(e) { + afterTick(() => { + if (e.defaultPrevented || this.opts.disabled.current) return; + set(this.#isFocused, true); + }); + } + onblur(e) { + afterTick(() => { + if (e.defaultPrevented) return; + set(this.#isFocused, false); + }); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + tabindex: -1, + role: "menuitem", + "aria-disabled": boolToStr(this.opts.disabled.current), + "data-disabled": boolToEmptyStrOrUndef(this.opts.disabled.current), + "data-highlighted": get(this.#isFocused) ? "" : void 0, + [this.content.parentMenu.root.getBitsAttr("item")]: "", + // + onpointermove: this.onpointermove, + onpointerleave: this.onpointerleave, + onfocus: this.onfocus, + onblur: this.onblur, + ...this.attachment + })), + "MenuItemSharedState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var MenuItemState = class _MenuItemState { + static create(opts) { + const item = new MenuItemSharedState(opts, MenuContentContext.get()); + return new _MenuItemState(opts, item); + } + opts; + item; + root; + #isPointerDown = false; + constructor(opts, item) { + this.opts = opts; + this.item = item; + this.root = item.content.parentMenu.root; + this.onkeydown = this.onkeydown.bind(this); + this.onclick = this.onclick.bind(this); + this.onpointerdown = this.onpointerdown.bind(this); + this.onpointerup = this.onpointerup.bind(this); + } + #handleSelect() { + if (this.item.opts.disabled.current) return; + const selectEvent = new CustomEvent("menuitemselect", { bubbles: true, cancelable: true }); + this.opts.onSelect.current(selectEvent); + if (selectEvent.defaultPrevented) { + this.item.content.parentMenu.root.isUsingKeyboard.current = false; + return; + } + if (this.opts.closeOnSelect.current) { + this.item.content.parentMenu.root.opts.onClose(); + } + } + onkeydown(e) { + const isTypingAhead = strict_equals(this.item.content.search, "", false); + if (this.item.opts.disabled.current || isTypingAhead && strict_equals(e.key, kbd_constants_exports.SPACE)) return; + if (SELECTION_KEYS2.includes(e.key)) { + if (!isHTMLElement2(e.currentTarget)) return; + e.currentTarget.click(); + e.preventDefault(); + } + } + onclick(_) { + if (this.item.opts.disabled.current) return; + this.#handleSelect(); + } + onpointerup(e) { + if (e.defaultPrevented) return; + if (!this.#isPointerDown) { + if (!isHTMLElement2(e.currentTarget)) return; + e.currentTarget?.click(); + } + } + onpointerdown(_) { + this.#isPointerDown = true; + } + #props = tag( + user_derived(() => mergeProps(this.item.props, { + onclick: this.onclick, + onpointerdown: this.onpointerdown, + onpointerup: this.onpointerup, + onkeydown: this.onkeydown + })), + "MenuItemState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var MenuSubTriggerState = class _MenuSubTriggerState { + static create(opts) { + const content = MenuContentContext.get(); + const item = new MenuItemSharedState(opts, content); + const submenu = MenuMenuContext.get(); + return new _MenuSubTriggerState(opts, item, content, submenu); + } + opts; + item; + content; + submenu; + attachment; + #openTimer = null; + constructor(opts, item, content, submenu) { + this.opts = opts; + this.item = item; + this.content = content; + this.submenu = submenu; + this.attachment = attachRef(this.opts.ref, (v) => this.submenu.triggerNode = v); + this.onpointerleave = this.onpointerleave.bind(this); + this.onpointermove = this.onpointermove.bind(this); + this.onkeydown = this.onkeydown.bind(this); + this.onclick = this.onclick.bind(this); + onDestroyEffect(() => { + this.#clearOpenTimer(); + }); + } + #clearOpenTimer() { + if (strict_equals(this.#openTimer, null)) return; + this.content.domContext.getWindow().clearTimeout(this.#openTimer); + this.#openTimer = null; + } + onpointermove(e) { + if (!isMouseEvent(e)) return; + if (!this.item.opts.disabled.current && !this.submenu.opts.open.current && !this.#openTimer && !this.content.parentMenu.root.isPointerInTransit) { + this.#openTimer = this.content.domContext.setTimeout( + () => { + this.submenu.onOpen(); + this.#clearOpenTimer(); + }, + this.opts.openDelay.current + ); + } + } + onpointerleave(e) { + if (!isMouseEvent(e)) return; + this.#clearOpenTimer(); + } + onkeydown(e) { + const isTypingAhead = strict_equals(this.content.search, "", false); + if (this.item.opts.disabled.current || isTypingAhead && strict_equals(e.key, kbd_constants_exports.SPACE)) return; + if (SUB_OPEN_KEYS[this.submenu.root.opts.dir.current].includes(e.key)) { + e.currentTarget.click(); + e.preventDefault(); + } + } + onclick(e) { + if (this.item.opts.disabled.current) return; + if (!isHTMLElement2(e.currentTarget)) return; + e.currentTarget.focus(); + const selectEvent = new CustomEvent("menusubtriggerselect", { bubbles: true, cancelable: true }); + this.opts.onSelect.current(selectEvent); + if (!this.submenu.opts.open.current) { + this.submenu.onOpen(); + afterTick(() => { + const contentNode = this.submenu.contentNode; + if (!contentNode) return; + MenuOpenEvent.dispatch(contentNode); + }); + } + } + #props = tag( + user_derived(() => mergeProps( + { + "aria-haspopup": "menu", + "aria-expanded": boolToStr(this.submenu.opts.open.current), + "data-state": getDataOpenClosed(this.submenu.opts.open.current), + "aria-controls": this.submenu.opts.open.current ? this.submenu.contentId.current : void 0, + [this.submenu.root.getBitsAttr("sub-trigger")]: "", + onclick: this.onclick, + onpointermove: this.onpointermove, + onpointerleave: this.onpointerleave, + onkeydown: this.onkeydown, + ...this.attachment + }, + this.item.props + )), + "MenuSubTriggerState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var MenuCheckboxItemState = class _MenuCheckboxItemState { + static create(opts, checkboxGroup) { + const item = new MenuItemState(opts, new MenuItemSharedState(opts, MenuContentContext.get())); + return new _MenuCheckboxItemState(opts, item, checkboxGroup); + } + opts; + item; + group; + constructor(opts, item, group = null) { + this.opts = opts; + this.item = item; + this.group = group; + if (this.group) { + watch(() => this.group.opts.value.current, (groupValues) => { + this.opts.checked.current = groupValues.includes(this.opts.value.current); + }); + watch(() => this.opts.checked.current, (checked) => { + if (checked) { + this.group.addValue(this.opts.value.current); + } else { + this.group.removeValue(this.opts.value.current); + } + }); + } + } + toggleChecked() { + if (this.opts.indeterminate.current) { + this.opts.indeterminate.current = false; + this.opts.checked.current = true; + } else { + this.opts.checked.current = !this.opts.checked.current; + } + } + #snippetProps = tag( + user_derived(() => ({ + checked: this.opts.checked.current, + indeterminate: this.opts.indeterminate.current + })), + "MenuCheckboxItemState.snippetProps" + ); + get snippetProps() { + return get(this.#snippetProps); + } + set snippetProps(value) { + set(this.#snippetProps, value); + } + #props = tag( + user_derived(() => ({ + ...this.item.props, + role: "menuitemcheckbox", + "aria-checked": getAriaChecked(this.opts.checked.current, this.opts.indeterminate.current), + "data-state": getCheckedState(this.opts.checked.current), + [this.item.root.getBitsAttr("checkbox-item")]: "" + })), + "MenuCheckboxItemState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var MenuGroupState = class _MenuGroupState { + static create(opts) { + return MenuGroupContext.set(new _MenuGroupState(opts, MenuRootContext.get())); + } + opts; + root; + attachment; + #groupHeadingId = tag(state(void 0), "MenuGroupState.groupHeadingId"); + get groupHeadingId() { + return get(this.#groupHeadingId); + } + set groupHeadingId(value) { + set(this.#groupHeadingId, value, true); + } + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.attachment = attachRef(this.opts.ref); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + role: "group", + "aria-labelledby": this.groupHeadingId, + [this.root.getBitsAttr("group")]: "", + ...this.attachment + })), + "MenuGroupState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var MenuGroupHeadingState = class _MenuGroupHeadingState { + static create(opts) { + const checkboxGroup = MenuCheckboxGroupContext.getOr(null); + if (checkboxGroup) return new _MenuGroupHeadingState(opts, checkboxGroup); + const radioGroup = MenuRadioGroupContext.getOr(null); + if (radioGroup) return new _MenuGroupHeadingState(opts, radioGroup); + return new _MenuGroupHeadingState(opts, MenuGroupContext.get()); + } + opts; + group; + attachment; + constructor(opts, group) { + this.opts = opts; + this.group = group; + this.attachment = attachRef(this.opts.ref, (v) => this.group.groupHeadingId = v?.id); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + role: "group", + [this.group.root.getBitsAttr("group-heading")]: "", + ...this.attachment + })), + "MenuGroupHeadingState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var MenuSeparatorState = class _MenuSeparatorState { + static create(opts) { + return new _MenuSeparatorState(opts, MenuRootContext.get()); + } + opts; + root; + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.attachment = attachRef(this.opts.ref); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + role: "group", + [this.root.getBitsAttr("separator")]: "", + ...this.attachment + })), + "MenuSeparatorState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var MenuArrowState = class _MenuArrowState { + static create() { + return new _MenuArrowState(MenuRootContext.get()); + } + root; + constructor(root18) { + this.root = root18; + } + #props = tag(user_derived(() => ({ [this.root.getBitsAttr("arrow")]: "" })), "MenuArrowState.props"); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var MenuRadioGroupState = class _MenuRadioGroupState { + static create(opts) { + return MenuGroupContext.set(MenuRadioGroupContext.set(new _MenuRadioGroupState(opts, MenuContentContext.get()))); + } + opts; + content; + attachment; + #groupHeadingId = tag(state(null), "MenuRadioGroupState.groupHeadingId"); + get groupHeadingId() { + return get(this.#groupHeadingId); + } + set groupHeadingId(value) { + set(this.#groupHeadingId, value, true); + } + root; + constructor(opts, content) { + this.opts = opts; + this.content = content; + this.root = content.parentMenu.root; + this.attachment = attachRef(this.opts.ref); + } + setValue(v) { + this.opts.value.current = v; + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + [this.root.getBitsAttr("radio-group")]: "", + role: "group", + "aria-labelledby": this.groupHeadingId, + ...this.attachment + })), + "MenuRadioGroupState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var MenuRadioItemState = class _MenuRadioItemState { + static create(opts) { + const radioGroup = MenuRadioGroupContext.get(); + const sharedItem = new MenuItemSharedState(opts, radioGroup.content); + const item = new MenuItemState(opts, sharedItem); + return new _MenuRadioItemState(opts, item, radioGroup); + } + opts; + item; + group; + attachment; + #isChecked = tag(user_derived(() => strict_equals(this.group.opts.value.current, this.opts.value.current)), "MenuRadioItemState.isChecked"); + get isChecked() { + return get(this.#isChecked); + } + set isChecked(value) { + set(this.#isChecked, value); + } + constructor(opts, item, group) { + this.opts = opts; + this.item = item; + this.group = group; + this.attachment = attachRef(this.opts.ref); + } + selectValue() { + this.group.setValue(this.opts.value.current); + } + #props = tag( + user_derived(() => ({ + [this.group.root.getBitsAttr("radio-item")]: "", + ...this.item.props, + role: "menuitemradio", + "aria-checked": getAriaChecked(this.isChecked, false), + "data-state": getCheckedState(this.isChecked), + ...this.attachment + })), + "MenuRadioItemState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var DropdownMenuTriggerState = class _DropdownMenuTriggerState { + static create(opts) { + return new _DropdownMenuTriggerState(opts, MenuMenuContext.get()); + } + opts; + parentMenu; + attachment; + constructor(opts, parentMenu) { + this.opts = opts; + this.parentMenu = parentMenu; + this.attachment = attachRef(this.opts.ref, (v) => this.parentMenu.triggerNode = v); + } + onclick = (e) => { + if (this.opts.disabled.current || strict_equals(e.detail, 0, false)) return; + this.parentMenu.toggleOpen(); + e.preventDefault(); + }; + onpointerdown = (e) => { + if (this.opts.disabled.current) return; + if (strict_equals(e.pointerType, "touch")) return e.preventDefault(); + if (strict_equals(e.button, 0) && strict_equals(e.ctrlKey, false)) { + this.parentMenu.toggleOpen(); + if (!this.parentMenu.opts.open.current) e.preventDefault(); + } + }; + onpointerup = (e) => { + if (this.opts.disabled.current) return; + if (strict_equals(e.pointerType, "touch")) { + e.preventDefault(); + this.parentMenu.toggleOpen(); + } + }; + onkeydown = (e) => { + if (this.opts.disabled.current) return; + if (strict_equals(e.key, kbd_constants_exports.SPACE) || strict_equals(e.key, kbd_constants_exports.ENTER)) { + this.parentMenu.toggleOpen(); + e.preventDefault(); + return; + } + if (strict_equals(e.key, kbd_constants_exports.ARROW_DOWN)) { + this.parentMenu.onOpen(); + e.preventDefault(); + } + }; + #ariaControls = tag( + user_derived(() => { + if (this.parentMenu.opts.open.current && this.parentMenu.contentId.current) return this.parentMenu.contentId.current; + return void 0; + }), + "DropdownMenuTriggerState.#ariaControls" + ); + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + disabled: this.opts.disabled.current, + "aria-haspopup": "menu", + "aria-expanded": boolToStr(this.parentMenu.opts.open.current), + "aria-controls": get(this.#ariaControls), + "data-disabled": boolToEmptyStrOrUndef(this.opts.disabled.current), + "data-state": getDataOpenClosed(this.parentMenu.opts.open.current), + [this.parentMenu.root.getBitsAttr("trigger")]: "", + // + onclick: this.onclick, + onpointerdown: this.onpointerdown, + onpointerup: this.onpointerup, + onkeydown: this.onkeydown, + ...this.attachment + })), + "DropdownMenuTriggerState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var ContextMenuTriggerState = class _ContextMenuTriggerState { + static create(opts) { + return new _ContextMenuTriggerState(opts, MenuMenuContext.get()); + } + opts; + parentMenu; + attachment; + #point = tag(state(proxy({ x: 0, y: 0 })), "ContextMenuTriggerState.#point"); + virtualElement = simpleBox({ + getBoundingClientRect: () => DOMRect.fromRect({ width: 0, height: 0, ...get(this.#point) }) + }); + #longPressTimer = null; + constructor(opts, parentMenu) { + this.opts = opts; + this.parentMenu = parentMenu; + this.attachment = attachRef(this.opts.ref, (v) => this.parentMenu.triggerNode = v); + this.oncontextmenu = this.oncontextmenu.bind(this); + this.onpointerdown = this.onpointerdown.bind(this); + this.onpointermove = this.onpointermove.bind(this); + this.onpointercancel = this.onpointercancel.bind(this); + this.onpointerup = this.onpointerup.bind(this); + watch(() => get(this.#point), (point) => { + this.virtualElement.current = { + getBoundingClientRect: () => DOMRect.fromRect({ width: 0, height: 0, ...point }) + }; + }); + watch(() => this.opts.disabled.current, (isDisabled) => { + if (isDisabled) { + this.#clearLongPressTimer(); + } + }); + onDestroyEffect(() => this.#clearLongPressTimer()); + } + #clearLongPressTimer() { + if (strict_equals(this.#longPressTimer, null)) return; + getWindow(this.opts.ref.current).clearTimeout(this.#longPressTimer); + } + #handleOpen(e) { + set(this.#point, { x: e.clientX, y: e.clientY }, true); + this.parentMenu.onOpen(); + } + oncontextmenu(e) { + if (e.defaultPrevented || this.opts.disabled.current) return; + this.#clearLongPressTimer(); + this.#handleOpen(e); + e.preventDefault(); + this.parentMenu.contentNode?.focus(); + } + onpointerdown(e) { + if (this.opts.disabled.current || isMouseEvent(e)) return; + this.#clearLongPressTimer(); + this.#longPressTimer = getWindow(this.opts.ref.current).setTimeout(() => this.#handleOpen(e), 700); + } + onpointermove(e) { + if (this.opts.disabled.current || isMouseEvent(e)) return; + this.#clearLongPressTimer(); + } + onpointercancel(e) { + if (this.opts.disabled.current || isMouseEvent(e)) return; + this.#clearLongPressTimer(); + } + onpointerup(e) { + if (this.opts.disabled.current || isMouseEvent(e)) return; + this.#clearLongPressTimer(); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + disabled: this.opts.disabled.current, + "data-disabled": boolToEmptyStrOrUndef(this.opts.disabled.current), + "data-state": getDataOpenClosed(this.parentMenu.opts.open.current), + [CONTEXT_MENU_TRIGGER_ATTR]: "", + tabindex: -1, + // + onpointerdown: this.onpointerdown, + onpointermove: this.onpointermove, + onpointercancel: this.onpointercancel, + onpointerup: this.onpointerup, + oncontextmenu: this.oncontextmenu, + ...this.attachment + })), + "ContextMenuTriggerState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var MenuCheckboxGroupState = class _MenuCheckboxGroupState { + static create(opts) { + return MenuCheckboxGroupContext.set(new _MenuCheckboxGroupState(opts, MenuContentContext.get())); + } + opts; + content; + root; + attachment; + #groupHeadingId = tag(state(null), "MenuCheckboxGroupState.groupHeadingId"); + get groupHeadingId() { + return get(this.#groupHeadingId); + } + set groupHeadingId(value) { + set(this.#groupHeadingId, value, true); + } + constructor(opts, content) { + this.opts = opts; + this.content = content; + this.root = content.parentMenu.root; + this.attachment = attachRef(this.opts.ref); + } + addValue(checkboxValue) { + if (!checkboxValue) return; + if (!this.opts.value.current.includes(checkboxValue)) { + const newValue = [...snapshot(this.opts.value.current), checkboxValue]; + this.opts.value.current = newValue; + this.opts.onValueChange.current(newValue); + } + } + removeValue(checkboxValue) { + if (!checkboxValue) return; + const index = this.opts.value.current.indexOf(checkboxValue); + if (strict_equals(index, -1)) return; + const newValue = this.opts.value.current.filter((v) => strict_equals(v, checkboxValue, false)); + this.opts.value.current = newValue; + this.opts.onValueChange.current(newValue); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + [this.root.getBitsAttr("checkbox-group")]: "", + role: "group", + "aria-labelledby": this.groupHeadingId, + ...this.attachment + })), + "MenuCheckboxGroupState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var MenuSubmenuState = class { + static create(opts) { + const menu = MenuMenuContext.get(); + return MenuMenuContext.set(new MenuMenuState(opts, menu.root, menu)); + } +}; + +// node_modules/bits-ui/dist/bits/utilities/dismissible-layer/use-dismissable-layer.svelte.js +globalThis.bitsDismissableLayers ??= /* @__PURE__ */ new Map(); +var DismissibleLayerState = class _DismissibleLayerState { + static create(opts) { + return new _DismissibleLayerState(opts); + } + opts; + #interactOutsideProp; + #behaviorType; + #interceptedEvents = { pointerdown: false }; + #isResponsibleLayer = false; + #isFocusInsideDOMTree = false; + #documentObj = void 0; + #onFocusOutside; + #unsubClickListener = noop3; + constructor(opts) { + this.opts = opts; + this.#behaviorType = opts.interactOutsideBehavior; + this.#interactOutsideProp = opts.onInteractOutside; + this.#onFocusOutside = opts.onFocusOutside; + user_effect(() => { + this.#documentObj = getOwnerDocument2(this.opts.ref.current); + }); + let unsubEvents = noop3; + const cleanup = () => { + this.#resetState(); + globalThis.bitsDismissableLayers.delete(this); + this.#handleInteractOutside.destroy(); + unsubEvents(); + }; + watch([() => this.opts.enabled.current, () => this.opts.ref.current], () => { + if (!this.opts.enabled.current || !this.opts.ref.current) return; + afterSleep(1, () => { + if (!this.opts.ref.current) return; + globalThis.bitsDismissableLayers.set(this, this.#behaviorType); + unsubEvents(); + unsubEvents = this.#addEventListeners(); + }); + return cleanup; + }); + onDestroyEffect(() => { + this.#resetState.destroy(); + globalThis.bitsDismissableLayers.delete(this); + this.#handleInteractOutside.destroy(); + this.#unsubClickListener(); + unsubEvents(); + }); + } + #handleFocus = (event) => { + if (event.defaultPrevented) return; + if (!this.opts.ref.current) return; + afterTick(() => { + if (!this.opts.ref.current || this.#isTargetWithinLayer(event.target)) return; + if (event.target && !this.#isFocusInsideDOMTree) { + this.#onFocusOutside.current?.(event); + } + }); + }; + #addEventListeners() { + return executeCallbacks( + /** + * CAPTURE INTERACTION START + * mark interaction-start event as intercepted. + * mark responsible layer during interaction start + * to avoid checking if is responsible layer during interaction end + * when a new floating element may have been opened. + */ + on(this.#documentObj, "pointerdown", executeCallbacks(this.#markInterceptedEvent, this.#markResponsibleLayer), { capture: true }), + /** + * BUBBLE INTERACTION START + * Mark interaction-start event as non-intercepted. Debounce `onInteractOutsideStart` + * to avoid prematurely checking if other events were intercepted. + */ + on(this.#documentObj, "pointerdown", executeCallbacks(this.#markNonInterceptedEvent, this.#handleInteractOutside)), + /** + * HANDLE FOCUS OUTSIDE + */ + on(this.#documentObj, "focusin", this.#handleFocus) + ); + } + #handleDismiss = (e) => { + let event = e; + if (event.defaultPrevented) { + event = createWrappedEvent(e); + } + this.#interactOutsideProp.current(e); + }; + #handleInteractOutside = debounce2( + (e) => { + if (!this.opts.ref.current) { + this.#unsubClickListener(); + return; + } + const isEventValid = this.opts.isValidEvent.current(e, this.opts.ref.current) || isValidEvent(e, this.opts.ref.current); + if (!this.#isResponsibleLayer || this.#isAnyEventIntercepted() || !isEventValid) { + this.#unsubClickListener(); + return; + } + let event = e; + if (event.defaultPrevented) { + event = createWrappedEvent(event); + } + if (strict_equals(this.#behaviorType.current, "close", false) && strict_equals(this.#behaviorType.current, "defer-otherwise-close", false)) { + this.#unsubClickListener(); + return; + } + if (strict_equals(e.pointerType, "touch")) { + this.#unsubClickListener(); + this.#unsubClickListener = on(this.#documentObj, "click", this.#handleDismiss, { once: true }); + } else { + this.#interactOutsideProp.current(event); + } + }, + 10 + ); + #markInterceptedEvent = (e) => { + this.#interceptedEvents[e.type] = true; + }; + #markNonInterceptedEvent = (e) => { + this.#interceptedEvents[e.type] = false; + }; + #markResponsibleLayer = () => { + if (!this.opts.ref.current) return; + this.#isResponsibleLayer = isResponsibleLayer(this.opts.ref.current); + }; + #isTargetWithinLayer = (target) => { + if (!this.opts.ref.current) return false; + return isOrContainsTarget2(this.opts.ref.current, target); + }; + #resetState = debounce2( + () => { + for (const eventType in this.#interceptedEvents) { + this.#interceptedEvents[eventType] = false; + } + this.#isResponsibleLayer = false; + }, + 20 + ); + #isAnyEventIntercepted() { + const i = Object.values(this.#interceptedEvents).some(Boolean); + return i; + } + #onfocuscapture = () => { + this.#isFocusInsideDOMTree = true; + }; + #onblurcapture = () => { + this.#isFocusInsideDOMTree = false; + }; + props = { + onfocuscapture: this.#onfocuscapture, + onblurcapture: this.#onblurcapture + }; +}; +function getTopMostDismissableLayer(layersArr = [...globalThis.bitsDismissableLayers]) { + return layersArr.findLast(([_, { current: behaviorType }]) => strict_equals(behaviorType, "close") || strict_equals(behaviorType, "ignore")); +} +function isResponsibleLayer(node) { + const layersArr = [...globalThis.bitsDismissableLayers]; + const topMostLayer = getTopMostDismissableLayer(layersArr); + if (topMostLayer) return strict_equals(topMostLayer[0].opts.ref.current, node); + const [firstLayerNode] = layersArr[0]; + return strict_equals(firstLayerNode.opts.ref.current, node); +} +function isValidEvent(e, node) { + const target = e.target; + if (!isElementOrSVGElement(target)) return false; + const targetIsContextMenuTrigger = Boolean(target.closest(`[${CONTEXT_MENU_TRIGGER_ATTR}]`)); + if ("button" in e && e.button > 0 && !targetIsContextMenuTrigger) return false; + if ("button" in e && strict_equals(e.button, 0) && targetIsContextMenuTrigger) return true; + const nodeIsContextMenu = Boolean(node.closest(`[${CONTEXT_MENU_CONTENT_ATTR}]`)); + if (targetIsContextMenuTrigger && nodeIsContextMenu) return false; + const ownerDocument = getOwnerDocument2(target); + const isValid = ownerDocument.documentElement.contains(target) && !isOrContainsTarget2(node, target) && isClickTrulyOutside(e, node); + return isValid; +} +function createWrappedEvent(e) { + const capturedCurrentTarget = e.currentTarget; + const capturedTarget = e.target; + let newEvent; + if (e instanceof PointerEvent) { + newEvent = new PointerEvent(e.type, e); + } else { + newEvent = new PointerEvent("pointerdown", e); + } + let isPrevented = false; + const wrappedEvent = new Proxy(newEvent, { + get: (target, prop2) => { + if (strict_equals(prop2, "currentTarget")) { + return capturedCurrentTarget; + } + if (strict_equals(prop2, "target")) { + return capturedTarget; + } + if (strict_equals(prop2, "preventDefault")) { + return () => { + isPrevented = true; + if (strict_equals(typeof target.preventDefault, "function")) { + target.preventDefault(); + } + }; + } + if (strict_equals(prop2, "defaultPrevented")) { + return isPrevented; + } + if (prop2 in target) { + return target[prop2]; + } + return e[prop2]; + } + }); + return wrappedEvent; +} + +// node_modules/bits-ui/dist/bits/utilities/dismissible-layer/dismissible-layer.svelte +Dismissible_layer[FILENAME] = "node_modules/bits-ui/dist/bits/utilities/dismissible-layer/dismissible-layer.svelte"; +function Dismissible_layer($$anchor, $$props) { + check_target(new.target); + push($$props, true, Dismissible_layer); + let interactOutsideBehavior = prop($$props, "interactOutsideBehavior", 3, "close"), onInteractOutside = prop($$props, "onInteractOutside", 3, noop3), onFocusOutside = prop($$props, "onFocusOutside", 3, noop3), isValidEvent2 = prop($$props, "isValidEvent", 3, () => false); + const dismissibleLayerState = DismissibleLayerState.create({ + id: boxWith(() => $$props.id), + interactOutsideBehavior: boxWith(() => interactOutsideBehavior()), + onInteractOutside: boxWith(() => onInteractOutside()), + enabled: boxWith(() => $$props.enabled), + onFocusOutside: boxWith(() => onFocusOutside()), + isValidEvent: boxWith(() => isValidEvent2()), + ref: $$props.ref + }); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + add_svelte_meta(() => snippet(node, () => $$props.children ?? noop, () => ({ props: dismissibleLayerState.props })), "render", Dismissible_layer, 29, 0); + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Dismissible_layer = hmr(Dismissible_layer, () => Dismissible_layer[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Dismissible_layer[HMR].source; + set(Dismissible_layer[HMR].source, module.default[HMR].original); + }); +} +var dismissible_layer_default = Dismissible_layer; + +// node_modules/bits-ui/dist/bits/utilities/escape-layer/use-escape-layer.svelte.js +globalThis.bitsEscapeLayers ??= /* @__PURE__ */ new Map(); +var EscapeLayerState = class _EscapeLayerState { + static create(opts) { + return new _EscapeLayerState(opts); + } + opts; + domContext; + constructor(opts) { + this.opts = opts; + this.domContext = new DOMContext(this.opts.ref); + let unsubEvents = noop3; + watch(() => opts.enabled.current, (enabled) => { + if (enabled) { + globalThis.bitsEscapeLayers.set(this, opts.escapeKeydownBehavior); + unsubEvents = this.#addEventListener(); + } + return () => { + unsubEvents(); + globalThis.bitsEscapeLayers.delete(this); + }; + }); + } + #addEventListener = () => { + return on(this.domContext.getDocument(), "keydown", this.#onkeydown, { passive: false }); + }; + #onkeydown = (e) => { + if (strict_equals(e.key, kbd_constants_exports.ESCAPE, false) || !isResponsibleEscapeLayer(this)) return; + const clonedEvent = new KeyboardEvent(e.type, e); + e.preventDefault(); + const behaviorType = this.opts.escapeKeydownBehavior.current; + if (strict_equals(behaviorType, "close", false) && strict_equals(behaviorType, "defer-otherwise-close", false)) return; + this.opts.onEscapeKeydown.current(clonedEvent); + }; +}; +function isResponsibleEscapeLayer(instance) { + const layersArr = [...globalThis.bitsEscapeLayers]; + const topMostLayer = layersArr.findLast(([_, { current: behaviorType }]) => strict_equals(behaviorType, "close") || strict_equals(behaviorType, "ignore")); + if (topMostLayer) return strict_equals(topMostLayer[0], instance); + const [firstLayerNode] = layersArr[0]; + return strict_equals(firstLayerNode, instance); +} + +// node_modules/bits-ui/dist/bits/utilities/escape-layer/escape-layer.svelte +Escape_layer[FILENAME] = "node_modules/bits-ui/dist/bits/utilities/escape-layer/escape-layer.svelte"; +function Escape_layer($$anchor, $$props) { + check_target(new.target); + push($$props, true, Escape_layer); + let escapeKeydownBehavior = prop($$props, "escapeKeydownBehavior", 3, "close"), onEscapeKeydown = prop($$props, "onEscapeKeydown", 3, noop3); + EscapeLayerState.create({ + escapeKeydownBehavior: boxWith(() => escapeKeydownBehavior()), + onEscapeKeydown: boxWith(() => onEscapeKeydown()), + enabled: boxWith(() => $$props.enabled), + ref: $$props.ref + }); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + add_svelte_meta(() => snippet(node, () => $$props.children ?? noop), "render", Escape_layer, 23, 0); + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Escape_layer = hmr(Escape_layer, () => Escape_layer[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Escape_layer[HMR].source; + set(Escape_layer[HMR].source, module.default[HMR].original); + }); +} +var escape_layer_default = Escape_layer; + +// node_modules/bits-ui/dist/bits/utilities/focus-scope/focus-scope-manager.js +var FocusScopeManager = class _FocusScopeManager { + static instance; + #scopeStack = simpleBox([]); + #focusHistory = /* @__PURE__ */ new WeakMap(); + #preFocusHistory = /* @__PURE__ */ new WeakMap(); + static getInstance() { + if (!this.instance) { + this.instance = new _FocusScopeManager(); + } + return this.instance; + } + register(scope) { + const current = this.getActive(); + if (current && current !== scope) { + current.pause(); + } + const activeElement2 = document.activeElement; + if (activeElement2 && activeElement2 !== document.body) { + this.#preFocusHistory.set(scope, activeElement2); + } + this.#scopeStack.current = this.#scopeStack.current.filter((s) => s !== scope); + this.#scopeStack.current.unshift(scope); + } + unregister(scope) { + this.#scopeStack.current = this.#scopeStack.current.filter((s) => s !== scope); + const next3 = this.getActive(); + if (next3) { + next3.resume(); + } + } + getActive() { + return this.#scopeStack.current[0]; + } + setFocusMemory(scope, element2) { + this.#focusHistory.set(scope, element2); + } + getFocusMemory(scope) { + return this.#focusHistory.get(scope); + } + isActiveScope(scope) { + return this.getActive() === scope; + } + setPreFocusMemory(scope, element2) { + this.#preFocusHistory.set(scope, element2); + } + getPreFocusMemory(scope) { + return this.#preFocusHistory.get(scope); + } + clearPreFocusMemory(scope) { + this.#preFocusHistory.delete(scope); + } +}; + +// node_modules/bits-ui/dist/bits/utilities/focus-scope/focus-scope.svelte.js +var FocusScope = class _FocusScope { + #paused = false; + #container = null; + #manager = FocusScopeManager.getInstance(); + #cleanupFns = []; + #opts; + constructor(opts) { + this.#opts = opts; + } + get paused() { + return this.#paused; + } + pause() { + this.#paused = true; + } + resume() { + this.#paused = false; + } + #cleanup() { + for (const fn of this.#cleanupFns) { + fn(); + } + this.#cleanupFns = []; + } + mount(container) { + if (this.#container) { + this.unmount(); + } + this.#container = container; + this.#manager.register(this); + this.#setupEventListeners(); + this.#handleOpenAutoFocus(); + } + unmount() { + if (!this.#container) return; + this.#cleanup(); + this.#handleCloseAutoFocus(); + this.#manager.unregister(this); + this.#manager.clearPreFocusMemory(this); + this.#container = null; + } + #handleOpenAutoFocus() { + if (!this.#container) return; + const event = new CustomEvent("focusScope.onOpenAutoFocus", { bubbles: false, cancelable: true }); + this.#opts.onOpenAutoFocus.current(event); + if (!event.defaultPrevented) { + requestAnimationFrame(() => { + if (!this.#container) return; + const firstTabbable = this.#getFirstTabbable(); + if (firstTabbable) { + firstTabbable.focus(); + this.#manager.setFocusMemory(this, firstTabbable); + } else { + this.#container.focus(); + } + }); + } + } + #handleCloseAutoFocus() { + const event = new CustomEvent("focusScope.onCloseAutoFocus", { bubbles: false, cancelable: true }); + this.#opts.onCloseAutoFocus.current?.(event); + if (!event.defaultPrevented) { + const preFocusedElement = this.#manager.getPreFocusMemory(this); + if (preFocusedElement && document.contains(preFocusedElement)) { + try { + preFocusedElement.focus(); + } catch { + document.body.focus(); + } + } + } + } + #setupEventListeners() { + if (!this.#container || !this.#opts.trap.current) return; + const container = this.#container; + const doc = container.ownerDocument; + const handleFocus = (e) => { + if (this.#paused || !this.#manager.isActiveScope(this)) return; + const target = e.target; + if (!target) return; + const isInside = container.contains(target); + if (isInside) { + this.#manager.setFocusMemory(this, target); + } else { + const lastFocused = this.#manager.getFocusMemory(this); + if (lastFocused && container.contains(lastFocused) && isFocusable(lastFocused)) { + e.preventDefault(); + lastFocused.focus(); + } else { + const firstTabbable = this.#getFirstTabbable(); + const firstFocusable = this.#getAllFocusables()[0]; + (firstTabbable || firstFocusable || container).focus(); + } + } + }; + const handleKeydown = (e) => { + if (!this.#opts.loop || this.#paused || strict_equals(e.key, "Tab", false)) return; + if (!this.#manager.isActiveScope(this)) return; + const tabbables = this.#getTabbables(); + if (tabbables.length < 2) return; + const first = tabbables[0]; + const last = tabbables[tabbables.length - 1]; + if (!e.shiftKey && strict_equals(doc.activeElement, last)) { + e.preventDefault(); + first.focus(); + } else if (e.shiftKey && strict_equals(doc.activeElement, first)) { + e.preventDefault(); + last.focus(); + } + }; + this.#cleanupFns.push(on(doc, "focusin", handleFocus, { capture: true }), on(container, "keydown", handleKeydown)); + const observer = new MutationObserver(() => { + const lastFocused = this.#manager.getFocusMemory(this); + if (lastFocused && !container.contains(lastFocused)) { + const firstTabbable = this.#getFirstTabbable(); + const firstFocusable = this.#getAllFocusables()[0]; + const elementToFocus = firstTabbable || firstFocusable; + if (elementToFocus) { + elementToFocus.focus(); + this.#manager.setFocusMemory(this, elementToFocus); + } else { + container.focus(); + } + } + }); + observer.observe(container, { childList: true, subtree: true }); + this.#cleanupFns.push(() => observer.disconnect()); + } + #getTabbables() { + if (!this.#container) return []; + return tabbable(this.#container, { includeContainer: false, getShadowRoot: true }); + } + #getFirstTabbable() { + const tabbables = this.#getTabbables(); + return tabbables[0] || null; + } + #getAllFocusables() { + if (!this.#container) return []; + return focusable(this.#container, { includeContainer: false, getShadowRoot: true }); + } + static use(opts) { + let scope = null; + watch([() => opts.ref.current, () => opts.enabled.current], ([ref, enabled]) => { + if (ref && enabled) { + if (!scope) { + scope = new _FocusScope(opts); + } + scope.mount(ref); + } else if (scope) { + scope.unmount(); + scope = null; + } + }); + onDestroyEffect(() => { + scope?.unmount(); + }); + return { + get props() { + return { tabindex: -1 }; + } + }; + } +}; + +// node_modules/bits-ui/dist/bits/utilities/focus-scope/focus-scope.svelte +Focus_scope[FILENAME] = "node_modules/bits-ui/dist/bits/utilities/focus-scope/focus-scope.svelte"; +function Focus_scope($$anchor, $$props) { + check_target(new.target); + push($$props, true, Focus_scope); + let enabled = prop($$props, "enabled", 3, false), trapFocus = prop($$props, "trapFocus", 3, false), loop = prop($$props, "loop", 3, false), onCloseAutoFocus = prop($$props, "onCloseAutoFocus", 3, noop3), onOpenAutoFocus = prop($$props, "onOpenAutoFocus", 3, noop3); + const focusScopeState = FocusScope.use({ + enabled: boxWith(() => enabled()), + trap: boxWith(() => trapFocus()), + loop: loop(), + onCloseAutoFocus: boxWith(() => onCloseAutoFocus()), + onOpenAutoFocus: boxWith(() => onOpenAutoFocus()), + ref: $$props.ref + }); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + add_svelte_meta(() => snippet(node, () => $$props.focusScope ?? noop, () => ({ props: focusScopeState.props })), "render", Focus_scope, 27, 0); + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Focus_scope = hmr(Focus_scope, () => Focus_scope[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Focus_scope[HMR].source; + set(Focus_scope[HMR].source, module.default[HMR].original); + }); +} +var focus_scope_default = Focus_scope; + +// node_modules/bits-ui/dist/bits/utilities/text-selection-layer/use-text-selection-layer.svelte.js +globalThis.bitsTextSelectionLayers ??= /* @__PURE__ */ new Map(); +var TextSelectionLayerState = class _TextSelectionLayerState { + static create(opts) { + return new _TextSelectionLayerState(opts); + } + opts; + domContext; + #unsubSelectionLock = noop3; + constructor(opts) { + this.opts = opts; + this.domContext = new DOMContext(opts.ref); + let unsubEvents = noop3; + watch(() => this.opts.enabled.current, (isEnabled) => { + if (isEnabled) { + globalThis.bitsTextSelectionLayers.set(this, this.opts.enabled); + unsubEvents(); + unsubEvents = this.#addEventListeners(); + } + return () => { + unsubEvents(); + this.#resetSelectionLock(); + globalThis.bitsTextSelectionLayers.delete(this); + }; + }); + } + #addEventListeners() { + return executeCallbacks(on(this.domContext.getDocument(), "pointerdown", this.#pointerdown), on(this.domContext.getDocument(), "pointerup", composeHandlers(this.#resetSelectionLock, this.opts.onPointerUp.current))); + } + #pointerdown = (e) => { + const node = this.opts.ref.current; + const target = e.target; + if (!isHTMLElement2(node) || !isHTMLElement2(target) || !this.opts.enabled.current) return; + if (!isHighestLayer(this) || !contains(node, target)) return; + this.opts.onPointerDown.current(e); + if (e.defaultPrevented) return; + this.#unsubSelectionLock = preventTextSelectionOverflow(node, this.domContext.getDocument().body); + }; + #resetSelectionLock = () => { + this.#unsubSelectionLock(); + this.#unsubSelectionLock = noop3; + }; +}; +var getUserSelect = (node) => node.style.userSelect || node.style.webkitUserSelect; +function preventTextSelectionOverflow(node, body) { + const originalBodyUserSelect = getUserSelect(body); + const originalNodeUserSelect = getUserSelect(node); + setUserSelect(body, "none"); + setUserSelect(node, "text"); + return () => { + setUserSelect(body, originalBodyUserSelect); + setUserSelect(node, originalNodeUserSelect); + }; +} +function setUserSelect(node, value) { + node.style.userSelect = value; + node.style.webkitUserSelect = value; +} +function isHighestLayer(instance) { + const layersArr = [...globalThis.bitsTextSelectionLayers]; + if (!layersArr.length) return false; + const highestLayer = layersArr.at(-1); + if (!highestLayer) return false; + return strict_equals(highestLayer[0], instance); +} + +// node_modules/bits-ui/dist/bits/utilities/text-selection-layer/text-selection-layer.svelte +Text_selection_layer[FILENAME] = "node_modules/bits-ui/dist/bits/utilities/text-selection-layer/text-selection-layer.svelte"; +function Text_selection_layer($$anchor, $$props) { + check_target(new.target); + push($$props, true, Text_selection_layer); + let preventOverflowTextSelection = prop($$props, "preventOverflowTextSelection", 3, true), onPointerDown = prop($$props, "onPointerDown", 3, noop3), onPointerUp = prop($$props, "onPointerUp", 3, noop3); + TextSelectionLayerState.create({ + id: boxWith(() => $$props.id), + onPointerDown: boxWith(() => onPointerDown()), + onPointerUp: boxWith(() => onPointerUp()), + enabled: boxWith(() => $$props.enabled && preventOverflowTextSelection()), + ref: $$props.ref + }); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + add_svelte_meta(() => snippet(node, () => $$props.children ?? noop), "render", Text_selection_layer, 26, 0); + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Text_selection_layer = hmr(Text_selection_layer, () => Text_selection_layer[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Text_selection_layer[HMR].source; + set(Text_selection_layer[HMR].source, module.default[HMR].original); + }); +} +var text_selection_layer_default = Text_selection_layer; + +// node_modules/bits-ui/dist/internal/use-id.js +globalThis.bitsIdCounter ??= { current: 0 }; +function useId(prefix = "bits") { + globalThis.bitsIdCounter.current++; + return `${prefix}-${globalThis.bitsIdCounter.current}`; +} + +// node_modules/bits-ui/dist/internal/shared-state.svelte.js +var SharedState = class { + #factory; + #subscribers = 0; + #state = tag(state(), "SharedState.#state"); + #scope; + constructor(factory) { + this.#factory = factory; + } + #dispose() { + this.#subscribers -= 1; + if (this.#scope && this.#subscribers <= 0) { + this.#scope(); + set(this.#state, void 0); + this.#scope = void 0; + } + } + get(...args) { + this.#subscribers += 1; + if (strict_equals(get(this.#state), void 0)) { + this.#scope = effect_root(() => { + set(this.#state, this.#factory(...args), true); + }); + } + user_effect(() => { + return () => { + this.#dispose(); + }; + }); + return get(this.#state); + } +}; + +// node_modules/bits-ui/dist/internal/body-scroll-lock.svelte.js +var lockMap = new SvelteMap(); +var initialBodyStyle = tag(state(null), "initialBodyStyle"); +var stopTouchMoveListener = null; +var cleanupTimeoutId = null; +var isInCleanupTransition = false; +var anyLocked = boxWith(() => { + for (const value of lockMap.values()) { + if (value) return true; + } + return false; +}); +var cleanupScheduledAt = null; +var bodyLockStackCount = new SharedState(() => { + function resetBodyStyle() { + if (!true_default) return; + document.body.setAttribute("style", get(initialBodyStyle) ?? ""); + document.body.style.removeProperty("--scrollbar-width"); + isIOS && stopTouchMoveListener?.(); + set(initialBodyStyle, null); + } + function cancelPendingCleanup() { + if (strict_equals(cleanupTimeoutId, null)) return; + window.clearTimeout(cleanupTimeoutId); + cleanupTimeoutId = null; + } + function scheduleCleanupIfNoNewLocks(delay, callback) { + cancelPendingCleanup(); + isInCleanupTransition = true; + cleanupScheduledAt = Date.now(); + const currentCleanupId = cleanupScheduledAt; + const cleanupFn = () => { + cleanupTimeoutId = null; + if (strict_equals(cleanupScheduledAt, currentCleanupId, false)) return; + if (!isAnyLocked(lockMap)) { + isInCleanupTransition = false; + callback(); + } else { + isInCleanupTransition = false; + } + }; + const actualDelay = strict_equals(delay, null) ? 24 : delay; + cleanupTimeoutId = window.setTimeout(cleanupFn, actualDelay); + } + function ensureInitialStyleCaptured() { + if (strict_equals(get(initialBodyStyle), null) && strict_equals(lockMap.size, 0) && !isInCleanupTransition) { + set(initialBodyStyle, document.body.getAttribute("style"), true); + } + } + watch(() => anyLocked.current, () => { + if (!anyLocked.current) return; + ensureInitialStyleCaptured(); + isInCleanupTransition = false; + const bodyStyle = getComputedStyle(document.body); + const verticalScrollbarWidth = window.innerWidth - document.documentElement.clientWidth; + const paddingRight = Number.parseInt(bodyStyle.paddingRight ?? "0", 10); + const config = { + padding: paddingRight + verticalScrollbarWidth, + margin: Number.parseInt(bodyStyle.marginRight ?? "0", 10) + }; + if (verticalScrollbarWidth > 0) { + document.body.style.paddingRight = `${config.padding}px`; + document.body.style.marginRight = `${config.margin}px`; + document.body.style.setProperty("--scrollbar-width", `${verticalScrollbarWidth}px`); + document.body.style.overflow = "hidden"; + } + if (isIOS) { + stopTouchMoveListener = on( + document, + "touchmove", + (e) => { + if (strict_equals(e.target, document.documentElement, false)) return; + if (e.touches.length > 1) return; + e.preventDefault(); + }, + { passive: false } + ); + } + afterTick(() => { + document.body.style.pointerEvents = "none"; + document.body.style.overflow = "hidden"; + }); + }); + onDestroyEffect(() => { + return () => { + stopTouchMoveListener?.(); + }; + }); + return { + get lockMap() { + return lockMap; + }, + resetBodyStyle, + scheduleCleanupIfNoNewLocks, + cancelPendingCleanup, + ensureInitialStyleCaptured + }; +}); +var BodyScrollLock = class { + #id = useId(); + #initialState; + #restoreScrollDelay = () => null; + #countState; + locked; + constructor(initialState, restoreScrollDelay = () => null) { + this.#initialState = initialState; + this.#restoreScrollDelay = restoreScrollDelay; + this.#countState = bodyLockStackCount.get(); + if (!this.#countState) return; + this.#countState.cancelPendingCleanup(); + this.#countState.ensureInitialStyleCaptured(); + this.#countState.lockMap.set(this.#id, this.#initialState ?? false); + this.locked = boxWith(() => this.#countState.lockMap.get(this.#id) ?? false, (v) => this.#countState.lockMap.set(this.#id, v)); + onDestroyEffect(() => { + this.#countState.lockMap.delete(this.#id); + if (isAnyLocked(this.#countState.lockMap)) return; + const restoreScrollDelay2 = this.#restoreScrollDelay(); + this.#countState.scheduleCleanupIfNoNewLocks(restoreScrollDelay2, () => { + this.#countState.resetBodyStyle(); + }); + }); + } +}; +function isAnyLocked(map) { + for (const [_, value] of map) { + if (value) return true; + } + return false; +} + +// node_modules/bits-ui/dist/bits/utilities/scroll-lock/scroll-lock.svelte +Scroll_lock[FILENAME] = "node_modules/bits-ui/dist/bits/utilities/scroll-lock/scroll-lock.svelte"; +function Scroll_lock($$anchor, $$props) { + check_target(new.target); + push($$props, true, Scroll_lock); + let preventScroll = prop($$props, "preventScroll", 3, true), restoreScrollDelay = prop($$props, "restoreScrollDelay", 3, null); + if (preventScroll()) { + new BodyScrollLock(preventScroll(), () => restoreScrollDelay()); + } + var $$exports = { ...legacy_api() }; + return pop($$exports); +} +if (import.meta.hot) { + Scroll_lock = hmr(Scroll_lock, () => Scroll_lock[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Scroll_lock[HMR].source; + set(Scroll_lock[HMR].source, module.default[HMR].original); + }); +} +var scroll_lock_default = Scroll_lock; + +// node_modules/bits-ui/dist/bits/alert-dialog/components/alert-dialog-content.svelte +Alert_dialog_content[FILENAME] = "node_modules/bits-ui/dist/bits/alert-dialog/components/alert-dialog-content.svelte"; +var root_6 = add_locations(from_html(` `, 1), Alert_dialog_content[FILENAME], []); +var root_8 = add_locations(from_html(`
`, 1), Alert_dialog_content[FILENAME], [[94, 7]]); +function Alert_dialog_content($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Alert_dialog_content); + let id = prop($$props, "id", 19, () => createId(uid)), ref = prop($$props, "ref", 15, null), forceMount = prop($$props, "forceMount", 3, false), interactOutsideBehavior = prop($$props, "interactOutsideBehavior", 3, "ignore"), onCloseAutoFocus = prop($$props, "onCloseAutoFocus", 3, noop3), onEscapeKeydown = prop($$props, "onEscapeKeydown", 3, noop3), onOpenAutoFocus = prop($$props, "onOpenAutoFocus", 3, noop3), onInteractOutside = prop($$props, "onInteractOutside", 3, noop3), preventScroll = prop($$props, "preventScroll", 3, true), trapFocus = prop($$props, "trapFocus", 3, true), restoreScrollDelay = prop($$props, "restoreScrollDelay", 3, null), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "id", + "children", + "child", + "ref", + "forceMount", + "interactOutsideBehavior", + "onCloseAutoFocus", + "onEscapeKeydown", + "onOpenAutoFocus", + "onInteractOutside", + "preventScroll", + "trapFocus", + "restoreScrollDelay" + ], + "restProps" + ); + const contentState = DialogContentState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, contentState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent_2 = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + { + const focusScope = wrap_snippet(Alert_dialog_content, function($$anchor3, $$arg0) { + validate_snippet_args(...arguments); + let focusScopeProps = () => $$arg0?.().props; + focusScopeProps(); + var fragment_2 = comment(); + var node_2 = first_child(fragment_2); + add_svelte_meta( + () => escape_layer_default(node_2, spread_props(() => get(mergedProps), { + get enabled() { + return contentState.root.opts.open.current; + }, + get ref() { + return contentState.opts.ref; + }, + onEscapeKeydown: (e) => { + onEscapeKeydown()(e); + if (e.defaultPrevented) return; + contentState.root.handleClose(); + }, + children: wrap_snippet(Alert_dialog_content, ($$anchor4, $$slotProps) => { + var fragment_3 = comment(); + var node_3 = first_child(fragment_3); + add_svelte_meta( + () => dismissible_layer_default(node_3, spread_props(() => get(mergedProps), { + get ref() { + return contentState.opts.ref; + }, + get enabled() { + return contentState.root.opts.open.current; + }, + get interactOutsideBehavior() { + return interactOutsideBehavior(); + }, + onInteractOutside: (e) => { + onInteractOutside()(e); + if (e.defaultPrevented) return; + contentState.root.handleClose(); + }, + children: wrap_snippet(Alert_dialog_content, ($$anchor5, $$slotProps2) => { + var fragment_4 = comment(); + var node_4 = first_child(fragment_4); + add_svelte_meta( + () => text_selection_layer_default(node_4, spread_props(() => get(mergedProps), { + get ref() { + return contentState.opts.ref; + }, + get enabled() { + return contentState.root.opts.open.current; + }, + children: wrap_snippet(Alert_dialog_content, ($$anchor6, $$slotProps3) => { + var fragment_5 = comment(); + var node_5 = first_child(fragment_5); + { + var consequent_1 = ($$anchor7) => { + var fragment_6 = root_6(); + var node_6 = first_child(fragment_6); + { + var consequent = ($$anchor8) => { + var fragment_7 = comment(); + var node_7 = first_child(fragment_7); + add_svelte_meta( + () => scroll_lock_default(node_7, { + get preventScroll() { + return preventScroll(); + }, + get restoreScrollDelay() { + return restoreScrollDelay(); + } + }), + "component", + Alert_dialog_content, + 86, + 8, + { componentTag: "ScrollLock" } + ); + append($$anchor8, fragment_7); + }; + add_svelte_meta( + () => if_block(node_6, ($$render) => { + if (contentState.root.opts.open.current) $$render(consequent); + }), + "if", + Alert_dialog_content, + 85, + 7 + ); + } + var node_8 = sibling(node_6, 2); + { + let $0 = user_derived(() => ({ + props: mergeProps(get(mergedProps), focusScopeProps()), + ...contentState.snippetProps + })); + add_svelte_meta(() => snippet(node_8, () => $$props.child, () => get($0)), "render", Alert_dialog_content, 88, 7); + } + append($$anchor7, fragment_6); + }; + var alternate = ($$anchor7) => { + var fragment_8 = root_8(); + var node_9 = first_child(fragment_8); + add_svelte_meta( + () => scroll_lock_default(node_9, { + get preventScroll() { + return preventScroll(); + } + }), + "component", + Alert_dialog_content, + 93, + 7, + { componentTag: "ScrollLock" } + ); + var div = sibling(node_9, 2); + attribute_effect(div, ($0) => ({ ...$0 }), [() => mergeProps(get(mergedProps), focusScopeProps())]); + var node_10 = child(div); + add_svelte_meta(() => snippet(node_10, () => $$props.children ?? noop), "render", Alert_dialog_content, 95, 8); + reset(div); + append($$anchor7, fragment_8); + }; + add_svelte_meta( + () => if_block(node_5, ($$render) => { + if ($$props.child) $$render(consequent_1); + else $$render(alternate, false); + }), + "if", + Alert_dialog_content, + 84, + 6 + ); + } + append($$anchor6, fragment_5); + }), + $$slots: { default: true } + })), + "component", + Alert_dialog_content, + 79, + 5, + { componentTag: "TextSelectionLayer" } + ); + append($$anchor5, fragment_4); + }), + $$slots: { default: true } + })), + "component", + Alert_dialog_content, + 68, + 4, + { componentTag: "DismissibleLayer" } + ); + append($$anchor4, fragment_3); + }), + $$slots: { default: true } + })), + "component", + Alert_dialog_content, + 58, + 3, + { componentTag: "EscapeLayer" } + ); + append($$anchor3, fragment_2); + }); + add_svelte_meta( + () => focus_scope_default(node_1, { + get ref() { + return contentState.opts.ref; + }, + loop: true, + get trapFocus() { + return trapFocus(); + }, + get enabled() { + return contentState.root.opts.open.current; + }, + get onCloseAutoFocus() { + return onCloseAutoFocus(); + }, + onOpenAutoFocus: (e) => { + onOpenAutoFocus()(e); + if (e.defaultPrevented) return; + e.preventDefault(); + afterSleep(0, () => contentState.opts.ref.current?.focus()); + }, + focusScope, + $$slots: { focusScope: true } + }), + "component", + Alert_dialog_content, + 44, + 1, + { componentTag: "FocusScope" } + ); + } + append($$anchor2, fragment_1); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if (contentState.shouldRender || forceMount()) $$render(consequent_2); + }), + "if", + Alert_dialog_content, + 43, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Alert_dialog_content = hmr(Alert_dialog_content, () => Alert_dialog_content[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Alert_dialog_content[HMR].source; + set(Alert_dialog_content[HMR].source, module.default[HMR].original); + }); +} +var alert_dialog_content_default = Alert_dialog_content; + +// node_modules/bits-ui/dist/bits/dialog/components/dialog-overlay.svelte +Dialog_overlay[FILENAME] = "node_modules/bits-ui/dist/bits/dialog/components/dialog-overlay.svelte"; +var root_3 = add_locations(from_html(`
`), Dialog_overlay[FILENAME], [[33, 2]]); +function Dialog_overlay($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Dialog_overlay); + let id = prop($$props, "id", 19, () => createId(uid)), forceMount = prop($$props, "forceMount", 3, false), ref = prop($$props, "ref", 15, null), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "id", + "forceMount", + "child", + "children", + "ref" + ], + "restProps" + ); + const overlayState = DialogOverlayState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, overlayState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent_1 = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + { + var consequent = ($$anchor3) => { + var fragment_2 = comment(); + var node_2 = first_child(fragment_2); + { + let $0 = user_derived(() => ({ + props: mergeProps(get(mergedProps)), + ...overlayState.snippetProps + })); + add_svelte_meta(() => snippet(node_2, () => $$props.child, () => get($0)), "render", Dialog_overlay, 31, 2); + } + append($$anchor3, fragment_2); + }; + var alternate = ($$anchor3) => { + var div = root_3(); + attribute_effect(div, ($0) => ({ ...$0 }), [() => mergeProps(get(mergedProps))]); + var node_3 = child(div); + add_svelte_meta(() => snippet(node_3, () => $$props.children ?? noop, () => overlayState.snippetProps), "render", Dialog_overlay, 34, 3); + reset(div); + append($$anchor3, div); + }; + add_svelte_meta( + () => if_block(node_1, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Dialog_overlay, + 30, + 1 + ); + } + append($$anchor2, fragment_1); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if (overlayState.shouldRender || forceMount()) $$render(consequent_1); + }), + "if", + Dialog_overlay, + 29, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Dialog_overlay = hmr(Dialog_overlay, () => Dialog_overlay[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Dialog_overlay[HMR].source; + set(Dialog_overlay[HMR].source, module.default[HMR].original); + }); +} +var dialog_overlay_default = Dialog_overlay; + +// node_modules/bits-ui/dist/bits/dialog/components/dialog-trigger.svelte +Dialog_trigger[FILENAME] = "node_modules/bits-ui/dist/bits/dialog/components/dialog-trigger.svelte"; +var root_29 = add_locations(from_html(``), Dialog_trigger[FILENAME], [[33, 1]]); +function Dialog_trigger($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Dialog_trigger); + let id = prop($$props, "id", 19, () => createId(uid)), ref = prop($$props, "ref", 15, null), disabled = prop($$props, "disabled", 3, false), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "id", + "ref", + "children", + "child", + "disabled" + ], + "restProps" + ); + const triggerState = DialogTriggerState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)), + disabled: boxWith(() => Boolean(disabled())) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, triggerState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Dialog_trigger, 31, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var button = root_29(); + attribute_effect(button, () => ({ ...get(mergedProps) })); + var node_2 = child(button); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Dialog_trigger, 34, 2); + reset(button); + append($$anchor2, button); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Dialog_trigger, + 30, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Dialog_trigger = hmr(Dialog_trigger, () => Dialog_trigger[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Dialog_trigger[HMR].source; + set(Dialog_trigger[HMR].source, module.default[HMR].original); + }); +} +var dialog_trigger_default = Dialog_trigger; + +// node_modules/bits-ui/dist/bits/dialog/components/dialog-description.svelte +Dialog_description[FILENAME] = "node_modules/bits-ui/dist/bits/dialog/components/dialog-description.svelte"; +var root_210 = add_locations(from_html(`
`), Dialog_description[FILENAME], [[31, 1]]); +function Dialog_description($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Dialog_description); + let id = prop($$props, "id", 19, () => createId(uid)), ref = prop($$props, "ref", 15, null), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "id", + "children", + "child", + "ref" + ], + "restProps" + ); + const descriptionState = DialogDescriptionState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, descriptionState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Dialog_description, 29, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var div = root_210(); + attribute_effect(div, () => ({ ...get(mergedProps) })); + var node_2 = child(div); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Dialog_description, 32, 2); + reset(div); + append($$anchor2, div); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Dialog_description, + 28, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Dialog_description = hmr(Dialog_description, () => Dialog_description[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Dialog_description[HMR].source; + set(Dialog_description[HMR].source, module.default[HMR].original); + }); +} +var dialog_description_default = Dialog_description; + +// node_modules/bits-ui/dist/bits/aspect-ratio/exports.js +var exports_exports3 = {}; +__export(exports_exports3, { + Root: () => aspect_ratio_default +}); + +// node_modules/bits-ui/dist/bits/aspect-ratio/aspect-ratio.svelte.js +var aspectRatioAttrs = createBitsAttrs({ component: "aspect-ratio", parts: ["root"] }); +var AspectRatioRootState = class _AspectRatioRootState { + static create(opts) { + return new _AspectRatioRootState(opts); + } + opts; + attachment; + constructor(opts) { + this.opts = opts; + this.attachment = attachRef(this.opts.ref); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + style: { position: "absolute", top: 0, right: 0, bottom: 0, left: 0 }, + [aspectRatioAttrs.root]: "", + ...this.attachment + })), + "AspectRatioRootState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; + +// node_modules/bits-ui/dist/bits/aspect-ratio/components/aspect-ratio.svelte +Aspect_ratio[FILENAME] = "node_modules/bits-ui/dist/bits/aspect-ratio/components/aspect-ratio.svelte"; +var root_211 = add_locations(from_html(`
`), Aspect_ratio[FILENAME], [[34, 2]]); +var root = add_locations(from_html(`
`), Aspect_ratio[FILENAME], [[30, 0]]); +function Aspect_ratio($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Aspect_ratio); + let ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 19, () => createId(uid)), ratio = prop($$props, "ratio", 3, 1), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "ref", + "id", + "ratio", + "children", + "child" + ], + "restProps" + ); + const rootState = AspectRatioRootState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)), + ratio: boxWith(() => ratio()) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, rootState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var div = root(); + let styles; + var node = child(div); + { + var consequent = ($$anchor2) => { + var fragment = comment(); + var node_1 = first_child(fragment); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Aspect_ratio, 32, 2); + append($$anchor2, fragment); + }; + var alternate = ($$anchor2) => { + var div_1 = root_211(); + attribute_effect(div_1, () => ({ ...get(mergedProps) })); + var node_2 = child(div_1); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Aspect_ratio, 35, 3); + reset(div_1); + append($$anchor2, div_1); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Aspect_ratio, + 31, + 1 + ); + } + reset(div); + template_effect(() => styles = set_style(div, "", styles, { + position: "relative", + width: "100%", + "padding-bottom": `${ratio() ? 100 / ratio() : 0}%` + })); + append($$anchor, div); + return pop($$exports); +} +if (import.meta.hot) { + Aspect_ratio = hmr(Aspect_ratio, () => Aspect_ratio[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Aspect_ratio[HMR].source; + set(Aspect_ratio[HMR].source, module.default[HMR].original); + }); +} +var aspect_ratio_default = Aspect_ratio; + +// node_modules/bits-ui/dist/bits/avatar/exports.js +var exports_exports4 = {}; +__export(exports_exports4, { + Fallback: () => avatar_fallback_default, + Image: () => avatar_image_default, + Root: () => avatar_default +}); + +// node_modules/bits-ui/dist/bits/avatar/avatar.svelte.js +var avatarAttrs = createBitsAttrs({ component: "avatar", parts: ["root", "image", "fallback"] }); +var AvatarRootContext = new Context("Avatar.Root"); +var AvatarRootState = class _AvatarRootState { + static create(opts) { + return AvatarRootContext.set(new _AvatarRootState(opts)); + } + opts; + domContext; + attachment; + constructor(opts) { + this.opts = opts; + this.domContext = new DOMContext(this.opts.ref); + this.loadImage = this.loadImage.bind(this); + this.attachment = attachRef(this.opts.ref); + } + loadImage(src, crossorigin, referrerPolicy) { + if (strict_equals(this.opts.loadingStatus.current, "loaded")) return; + let imageTimerId; + const image = new Image(); + image.src = src; + if (strict_equals(crossorigin, void 0, false)) image.crossOrigin = crossorigin; + if (referrerPolicy) image.referrerPolicy = referrerPolicy; + this.opts.loadingStatus.current = "loading"; + image.onload = () => { + imageTimerId = this.domContext.setTimeout( + () => { + this.opts.loadingStatus.current = "loaded"; + }, + this.opts.delayMs.current + ); + }; + image.onerror = () => { + this.opts.loadingStatus.current = "error"; + }; + return () => { + if (!imageTimerId) return; + this.domContext.clearTimeout(imageTimerId); + }; + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + [avatarAttrs.root]: "", + "data-status": this.opts.loadingStatus.current, + ...this.attachment + })), + "AvatarRootState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var AvatarImageState = class _AvatarImageState { + static create(opts) { + return new _AvatarImageState(opts, AvatarRootContext.get()); + } + opts; + root; + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.attachment = attachRef(this.opts.ref); + watch.pre( + [ + () => this.opts.src.current, + () => this.opts.crossOrigin.current + ], + ([src, crossOrigin]) => { + if (!src) { + this.root.opts.loadingStatus.current = "error"; + return; + } + this.root.loadImage(src, crossOrigin, this.opts.referrerPolicy.current); + } + ); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + style: { + display: strict_equals(this.root.opts.loadingStatus.current, "loaded") ? "block" : "none" + }, + "data-status": this.root.opts.loadingStatus.current, + [avatarAttrs.image]: "", + src: this.opts.src.current, + crossorigin: this.opts.crossOrigin.current, + referrerpolicy: this.opts.referrerPolicy.current, + ...this.attachment + })), + "AvatarImageState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var AvatarFallbackState = class _AvatarFallbackState { + static create(opts) { + return new _AvatarFallbackState(opts, AvatarRootContext.get()); + } + opts; + root; + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.attachment = attachRef(this.opts.ref); + } + #style = tag(user_derived(() => strict_equals(this.root.opts.loadingStatus.current, "loaded") ? { display: "none" } : void 0), "AvatarFallbackState.style"); + get style() { + return get(this.#style); + } + set style(value) { + set(this.#style, value); + } + #props = tag( + user_derived(() => ({ + style: this.style, + "data-status": this.root.opts.loadingStatus.current, + [avatarAttrs.fallback]: "", + ...this.attachment + })), + "AvatarFallbackState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; + +// node_modules/bits-ui/dist/bits/avatar/components/avatar.svelte +Avatar[FILENAME] = "node_modules/bits-ui/dist/bits/avatar/components/avatar.svelte"; +var root_212 = add_locations(from_html(`
`), Avatar[FILENAME], [[44, 1]]); +function Avatar($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Avatar); + let delayMs = prop($$props, "delayMs", 3, 0), loadingStatus = prop($$props, "loadingStatus", 15, "loading"), id = prop($$props, "id", 19, () => createId(uid)), ref = prop($$props, "ref", 15, null), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "delayMs", + "loadingStatus", + "onLoadingStatusChange", + "child", + "children", + "id", + "ref" + ], + "restProps" + ); + const rootState = AvatarRootState.create({ + delayMs: boxWith(() => delayMs()), + loadingStatus: boxWith(() => loadingStatus(), (v) => { + if (strict_equals(loadingStatus(), v, false)) { + loadingStatus(v); + $$props.onLoadingStatusChange?.(v); + } + }), + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, rootState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Avatar, 42, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var div = root_212(); + attribute_effect(div, () => ({ ...get(mergedProps) })); + var node_2 = child(div); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Avatar, 45, 2); + reset(div); + append($$anchor2, div); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Avatar, + 41, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Avatar = hmr(Avatar, () => Avatar[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Avatar[HMR].source; + set(Avatar[HMR].source, module.default[HMR].original); + }); +} +var avatar_default = Avatar; + +// node_modules/bits-ui/dist/bits/avatar/components/avatar-image.svelte +Avatar_image[FILENAME] = "node_modules/bits-ui/dist/bits/avatar/components/avatar-image.svelte"; +var root_213 = add_locations(from_html(``), Avatar_image[FILENAME], [[36, 1]]); +function Avatar_image($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Avatar_image); + let id = prop($$props, "id", 19, () => createId(uid)), ref = prop($$props, "ref", 15, null), crossorigin = prop($$props, "crossorigin", 3, void 0), referrerpolicy = prop($$props, "referrerpolicy", 3, void 0), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "src", + "child", + "id", + "ref", + "crossorigin", + "referrerpolicy" + ], + "restProps" + ); + const imageState = AvatarImageState.create({ + src: boxWith(() => $$props.src), + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)), + crossOrigin: boxWith(() => crossorigin()), + referrerPolicy: boxWith(() => referrerpolicy()) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, imageState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Avatar_image, 34, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var img = root_213(); + attribute_effect(img, () => ({ ...get(mergedProps), src: $$props.src })); + replay_events(img); + append($$anchor2, img); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Avatar_image, + 33, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Avatar_image = hmr(Avatar_image, () => Avatar_image[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Avatar_image[HMR].source; + set(Avatar_image[HMR].source, module.default[HMR].original); + }); +} +var avatar_image_default = Avatar_image; + +// node_modules/bits-ui/dist/bits/avatar/components/avatar-fallback.svelte +Avatar_fallback[FILENAME] = "node_modules/bits-ui/dist/bits/avatar/components/avatar-fallback.svelte"; +var root_214 = add_locations(from_html(``), Avatar_fallback[FILENAME], [[31, 1]]); +function Avatar_fallback($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Avatar_fallback); + let id = prop($$props, "id", 19, () => createId(uid)), ref = prop($$props, "ref", 15, null), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "children", + "child", + "id", + "ref" + ], + "restProps" + ); + const fallbackState = AvatarFallbackState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, fallbackState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Avatar_fallback, 29, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var span = root_214(); + attribute_effect(span, () => ({ ...get(mergedProps) })); + var node_2 = child(span); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Avatar_fallback, 32, 2); + reset(span); + append($$anchor2, span); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Avatar_fallback, + 28, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Avatar_fallback = hmr(Avatar_fallback, () => Avatar_fallback[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Avatar_fallback[HMR].source; + set(Avatar_fallback[HMR].source, module.default[HMR].original); + }); +} +var avatar_fallback_default = Avatar_fallback; + +// node_modules/bits-ui/dist/bits/utilities/config/components/bits-config.svelte +Bits_config[FILENAME] = "node_modules/bits-ui/dist/bits/utilities/config/components/bits-config.svelte"; +function Bits_config($$anchor, $$props) { + check_target(new.target); + push($$props, true, Bits_config); + useBitsConfig({ + defaultPortalTo: boxWith(() => $$props.defaultPortalTo), + defaultLocale: boxWith(() => $$props.defaultLocale) + }); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + add_svelte_meta(() => snippet(node, () => $$props.children ?? noop), "render", Bits_config, 14, 0); + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Bits_config = hmr(Bits_config, () => Bits_config[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Bits_config[HMR].source; + set(Bits_config[HMR].source, module.default[HMR].original); + }); +} +var bits_config_default = Bits_config; + +// node_modules/bits-ui/dist/bits/button/exports.js +var exports_exports5 = {}; +__export(exports_exports5, { + Root: () => button_default +}); + +// node_modules/bits-ui/dist/bits/button/components/button.svelte +Button[FILENAME] = "node_modules/bits-ui/dist/bits/button/components/button.svelte"; +function Button($$anchor, $$props) { + check_target(new.target); + push($$props, true, Button); + let disabled = prop($$props, "disabled", 3, false), ref = prop($$props, "ref", 15, null), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "href", + "type", + "children", + "disabled", + "ref" + ], + "restProps" + ); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + validate_void_dynamic_element(() => $$props.href ? "a" : "button"); + validate_dynamic_element_tag(() => $$props.href ? "a" : "button"); + element( + node, + () => $$props.href ? "a" : "button", + false, + ($$element, $$anchor2) => { + bind_this($$element, ($$value) => ref($$value), () => ref()); + attribute_effect($$element, () => ({ + "data-button-root": true, + type: $$props.href ? void 0 : $$props.type, + href: $$props.href && !disabled() ? $$props.href : void 0, + disabled: $$props.href ? void 0 : disabled(), + "aria-disabled": $$props.href ? disabled() : void 0, + role: $$props.href && disabled() ? "link" : void 0, + tabindex: $$props.href && disabled() ? -1 : 0, + ...restProps + })); + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.children ?? noop), "render", Button, 26, 1); + append($$anchor2, fragment_1); + }, + void 0, + [14, 0] + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Button = hmr(Button, () => Button[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Button[HMR].source; + set(Button[HMR].source, module.default[HMR].original); + }); +} +var button_default = Button; + +// node_modules/bits-ui/dist/bits/calendar/exports.js +var exports_exports6 = {}; +__export(exports_exports6, { + Cell: () => calendar_cell_default, + Day: () => calendar_day_default, + Grid: () => calendar_grid_default, + GridBody: () => calendar_grid_body_default, + GridHead: () => calendar_grid_head_default, + GridRow: () => calendar_grid_row_default, + HeadCell: () => calendar_head_cell_default, + Header: () => calendar_header_default, + Heading: () => calendar_heading_default, + MonthSelect: () => calendar_month_select_default, + NextButton: () => calendar_next_button_default, + PrevButton: () => calendar_prev_button_default, + Root: () => calendar_default, + YearSelect: () => calendar_year_select_default +}); + +// node_modules/@internationalized/date/dist/utils.mjs +function $2b4dce13dd5a17fa$export$842a2cf37af977e1(amount, numerator) { + return amount - numerator * Math.floor(amount / numerator); +} + +// node_modules/@internationalized/date/dist/GregorianCalendar.mjs +var $3b62074eb05584b2$var$EPOCH = 1721426; +function $3b62074eb05584b2$export$f297eb839006d339(era, year, month, day) { + year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year); + let y1 = year - 1; + let monthOffset = -2; + if (month <= 2) monthOffset = 0; + else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year)) monthOffset = -1; + return $3b62074eb05584b2$var$EPOCH - 1 + 365 * y1 + Math.floor(y1 / 4) - Math.floor(y1 / 100) + Math.floor(y1 / 400) + Math.floor((367 * month - 362) / 12 + monthOffset + day); +} +function $3b62074eb05584b2$export$553d7fa8e3805fc0(year) { + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); +} +function $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year) { + return era === "BC" ? 1 - year : year; +} +function $3b62074eb05584b2$export$4475b7e617eb123c(year) { + let era = "AD"; + if (year <= 0) { + era = "BC"; + year = 1 - year; + } + return [ + era, + year + ]; +} +var $3b62074eb05584b2$var$daysInMonth = { + 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 + ] +}; +var $3b62074eb05584b2$export$80ee6245ec4f29ec = class { + fromJulianDay(jd) { + let jd0 = jd; + let depoch = jd0 - $3b62074eb05584b2$var$EPOCH; + let quadricent = Math.floor(depoch / 146097); + let dqc = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(depoch, 146097); + let cent = Math.floor(dqc / 36524); + let dcent = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(dqc, 36524); + let quad = Math.floor(dcent / 1461); + let dquad = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(dcent, 1461); + let yindex = Math.floor(dquad / 365); + let extendedYear = quadricent * 400 + cent * 100 + quad * 4 + yindex + (cent !== 4 && yindex !== 4 ? 1 : 0); + let [era, year] = $3b62074eb05584b2$export$4475b7e617eb123c(extendedYear); + let yearDay = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, 1, 1); + let leapAdj = 2; + if (jd0 < $3b62074eb05584b2$export$f297eb839006d339(era, year, 3, 1)) leapAdj = 0; + else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year)) leapAdj = 1; + let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367); + let day = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, month, 1) + 1; + return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(era, year, month, day); + } + toJulianDay(date) { + return $3b62074eb05584b2$export$f297eb839006d339(date.era, date.year, date.month, date.day); + } + getDaysInMonth(date) { + return $3b62074eb05584b2$var$daysInMonth[$3b62074eb05584b2$export$553d7fa8e3805fc0(date.year) ? "leapyear" : "standard"][date.month - 1]; + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + getMonthsInYear(date) { + return 12; + } + getDaysInYear(date) { + return $3b62074eb05584b2$export$553d7fa8e3805fc0(date.year) ? 366 : 365; + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + getYearsInEra(date) { + return 9999; + } + getEras() { + return [ + "BC", + "AD" + ]; + } + isInverseEra(date) { + return date.era === "BC"; + } + balanceDate(date) { + if (date.year <= 0) { + date.era = date.era === "BC" ? "AD" : "BC"; + date.year = 1 - date.year; + } + } + constructor() { + this.identifier = "gregory"; + } +}; + +// node_modules/@internationalized/date/dist/weekStartData.mjs +var $2fe286d2fb449abb$export$7a5acbd77d414bd9 = { + "001": 1, + AD: 1, + AE: 6, + AF: 6, + AI: 1, + AL: 1, + AM: 1, + AN: 1, + AR: 1, + AT: 1, + AU: 1, + AX: 1, + AZ: 1, + BA: 1, + BE: 1, + BG: 1, + BH: 6, + BM: 1, + BN: 1, + BY: 1, + CH: 1, + CL: 1, + CM: 1, + CN: 1, + CR: 1, + CY: 1, + CZ: 1, + DE: 1, + DJ: 6, + DK: 1, + DZ: 6, + EC: 1, + EE: 1, + EG: 6, + ES: 1, + FI: 1, + FJ: 1, + FO: 1, + FR: 1, + GB: 1, + GE: 1, + GF: 1, + GP: 1, + GR: 1, + HR: 1, + HU: 1, + IE: 1, + IQ: 6, + IR: 6, + IS: 1, + IT: 1, + JO: 6, + KG: 1, + KW: 6, + KZ: 1, + LB: 1, + LI: 1, + LK: 1, + LT: 1, + LU: 1, + LV: 1, + LY: 6, + MC: 1, + MD: 1, + ME: 1, + MK: 1, + MN: 1, + MQ: 1, + MV: 5, + MY: 1, + NL: 1, + NO: 1, + NZ: 1, + OM: 6, + PL: 1, + QA: 6, + RE: 1, + RO: 1, + RS: 1, + RU: 1, + SD: 6, + SE: 1, + SI: 1, + SK: 1, + SM: 1, + SY: 6, + TJ: 1, + TM: 1, + TR: 1, + UA: 1, + UY: 1, + UZ: 1, + VA: 1, + VN: 1, + XK: 1 +}; + +// node_modules/@internationalized/date/dist/queries.mjs +function $14e0f24ef4ac5c92$export$ea39ec197993aef0(a2, b) { + b = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)(b, a2.calendar); + return a2.era === b.era && a2.year === b.year && a2.month === b.month && a2.day === b.day; +} +function $14e0f24ef4ac5c92$export$a18c89cbd24170ff(a2, b) { + b = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)(b, a2.calendar); + a2 = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(a2); + b = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(b); + return a2.era === b.era && a2.year === b.year && a2.month === b.month; +} +function $14e0f24ef4ac5c92$export$dbc69fd56b53d5e(a2, b) { + var _a_isEqual, _b_isEqual; + var _a_isEqual1, _ref; + return (_ref = (_a_isEqual1 = (_a_isEqual = a2.isEqual) === null || _a_isEqual === void 0 ? void 0 : _a_isEqual.call(a2, b)) !== null && _a_isEqual1 !== void 0 ? _a_isEqual1 : (_b_isEqual = b.isEqual) === null || _b_isEqual === void 0 ? void 0 : _b_isEqual.call(b, a2)) !== null && _ref !== void 0 ? _ref : a2.identifier === b.identifier; +} +function $14e0f24ef4ac5c92$export$629b0a497aa65267(date, timeZone) { + return $14e0f24ef4ac5c92$export$ea39ec197993aef0(date, $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(timeZone)); +} +var $14e0f24ef4ac5c92$var$DAY_MAP = { + sun: 0, + mon: 1, + tue: 2, + wed: 3, + thu: 4, + fri: 5, + sat: 6 +}; +function $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date, locale, firstDayOfWeek) { + let julian = date.calendar.toJulianDay(date); + let weekStart = firstDayOfWeek ? $14e0f24ef4ac5c92$var$DAY_MAP[firstDayOfWeek] : $14e0f24ef4ac5c92$var$getWeekStart(locale); + let dayOfWeek = Math.ceil(julian + 1 - weekStart) % 7; + if (dayOfWeek < 0) dayOfWeek += 7; + return dayOfWeek; +} +function $14e0f24ef4ac5c92$export$461939dd4422153(timeZone) { + return (0, $11d87f3f76e88657$export$1b96692a1ba042ac)(Date.now(), timeZone); +} +function $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(timeZone) { + return (0, $11d87f3f76e88657$export$93522d1a439f3617)($14e0f24ef4ac5c92$export$461939dd4422153(timeZone)); +} +function $14e0f24ef4ac5c92$export$68781ddf31c0090f(a2, b) { + return a2.calendar.toJulianDay(a2) - b.calendar.toJulianDay(b); +} +function $14e0f24ef4ac5c92$export$c19a80a9721b80f6(a2, b) { + return $14e0f24ef4ac5c92$var$timeToMs(a2) - $14e0f24ef4ac5c92$var$timeToMs(b); +} +function $14e0f24ef4ac5c92$var$timeToMs(a2) { + return a2.hour * 36e5 + a2.minute * 6e4 + a2.second * 1e3 + a2.millisecond; +} +var $14e0f24ef4ac5c92$var$localTimeZone = null; +function $14e0f24ef4ac5c92$export$aa8b41735afcabd2() { + if ($14e0f24ef4ac5c92$var$localTimeZone == null) $14e0f24ef4ac5c92$var$localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone; + return $14e0f24ef4ac5c92$var$localTimeZone; +} +function $14e0f24ef4ac5c92$export$a5a3b454ada2268e(date) { + return date.subtract({ + days: date.day - 1 + }); +} +function $14e0f24ef4ac5c92$export$a2258d9c4118825c(date) { + return date.add({ + days: date.calendar.getDaysInMonth(date) - date.day + }); +} +var $14e0f24ef4ac5c92$var$cachedRegions = /* @__PURE__ */ new Map(); +var $14e0f24ef4ac5c92$var$cachedWeekInfo = /* @__PURE__ */ new Map(); +function $14e0f24ef4ac5c92$var$getRegion(locale) { + if (Intl.Locale) { + let region = $14e0f24ef4ac5c92$var$cachedRegions.get(locale); + if (!region) { + region = new Intl.Locale(locale).maximize().region; + if (region) $14e0f24ef4ac5c92$var$cachedRegions.set(locale, region); + } + return region; + } + let part = locale.split("-")[1]; + return part === "u" ? void 0 : part; +} +function $14e0f24ef4ac5c92$var$getWeekStart(locale) { + let weekInfo = $14e0f24ef4ac5c92$var$cachedWeekInfo.get(locale); + if (!weekInfo) { + if (Intl.Locale) { + let localeInst = new Intl.Locale(locale); + if ("getWeekInfo" in localeInst) { + weekInfo = localeInst.getWeekInfo(); + if (weekInfo) { + $14e0f24ef4ac5c92$var$cachedWeekInfo.set(locale, weekInfo); + return weekInfo.firstDay; + } + } + } + let region = $14e0f24ef4ac5c92$var$getRegion(locale); + if (locale.includes("-fw-")) { + let day = locale.split("-fw-")[1].split("-")[0]; + if (day === "mon") weekInfo = { + firstDay: 1 + }; + else if (day === "tue") weekInfo = { + firstDay: 2 + }; + else if (day === "wed") weekInfo = { + firstDay: 3 + }; + else if (day === "thu") weekInfo = { + firstDay: 4 + }; + else if (day === "fri") weekInfo = { + firstDay: 5 + }; + else if (day === "sat") weekInfo = { + firstDay: 6 + }; + else weekInfo = { + firstDay: 0 + }; + } else if (locale.includes("-ca-iso8601")) weekInfo = { + firstDay: 1 + }; + else weekInfo = { + firstDay: region ? (0, $2fe286d2fb449abb$export$7a5acbd77d414bd9)[region] || 0 : 0 + }; + $14e0f24ef4ac5c92$var$cachedWeekInfo.set(locale, weekInfo); + } + return weekInfo.firstDay; +} + +// node_modules/@internationalized/date/dist/conversion.mjs +function $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) { + date = $11d87f3f76e88657$export$b4a036af3fc0b032(date, new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)()); + let year = (0, $3b62074eb05584b2$export$c36e0ecb2d4fa69d)(date.era, date.year); + return $11d87f3f76e88657$var$epochFromParts(year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond); +} +function $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, millisecond) { + let date = /* @__PURE__ */ new Date(); + date.setUTCHours(hour, minute, second, millisecond); + date.setUTCFullYear(year, month - 1, day); + return date.getTime(); +} +function $11d87f3f76e88657$export$59c99f3515d3493f(ms, timeZone) { + if (timeZone === "UTC") return 0; + if (ms > 0 && timeZone === (0, $14e0f24ef4ac5c92$export$aa8b41735afcabd2)()) return new Date(ms).getTimezoneOffset() * -6e4; + let { year, month, day, hour, minute, second } = $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone); + let utc = $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, 0); + return utc - Math.floor(ms / 1e3) * 1e3; +} +var $11d87f3f76e88657$var$formattersByTimeZone = /* @__PURE__ */ new Map(); +function $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone) { + let formatter = $11d87f3f76e88657$var$formattersByTimeZone.get(timeZone); + if (!formatter) { + formatter = new Intl.DateTimeFormat("en-US", { + timeZone, + hour12: false, + era: "short", + year: "numeric", + month: "numeric", + day: "numeric", + hour: "numeric", + minute: "numeric", + second: "numeric" + }); + $11d87f3f76e88657$var$formattersByTimeZone.set(timeZone, formatter); + } + let parts = formatter.formatToParts(new Date(ms)); + let namedParts = {}; + for (let part of parts) if (part.type !== "literal") namedParts[part.type] = part.value; + return { + // Firefox returns B instead of BC... https://bugzilla.mozilla.org/show_bug.cgi?id=1752253 + year: namedParts.era === "BC" || namedParts.era === "B" ? -namedParts.year + 1 : +namedParts.year, + month: +namedParts.month, + day: +namedParts.day, + hour: namedParts.hour === "24" ? 0 : +namedParts.hour, + minute: +namedParts.minute, + second: +namedParts.second + }; +} +var $11d87f3f76e88657$var$DAYMILLIS = 864e5; +function $11d87f3f76e88657$export$136f38efe7caf549(date, timeZone) { + let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date); + let earlier = ms - $11d87f3f76e88657$export$59c99f3515d3493f(ms - $11d87f3f76e88657$var$DAYMILLIS, timeZone); + let later = ms - $11d87f3f76e88657$export$59c99f3515d3493f(ms + $11d87f3f76e88657$var$DAYMILLIS, timeZone); + return $11d87f3f76e88657$var$getValidWallTimes(date, timeZone, earlier, later); +} +function $11d87f3f76e88657$var$getValidWallTimes(date, timeZone, earlier, later) { + let found = earlier === later ? [ + earlier + ] : [ + earlier, + later + ]; + return found.filter((absolute) => $11d87f3f76e88657$var$isValidWallTime(date, timeZone, absolute)); +} +function $11d87f3f76e88657$var$isValidWallTime(date, timeZone, absolute) { + let parts = $11d87f3f76e88657$var$getTimeZoneParts(absolute, timeZone); + return date.year === parts.year && date.month === parts.month && date.day === parts.day && date.hour === parts.hour && date.minute === parts.minute && date.second === parts.second; +} +function $11d87f3f76e88657$export$5107c82f94518f5c(date, timeZone, disambiguation = "compatible") { + let dateTime = $11d87f3f76e88657$export$b21e0b124e224484(date); + if (timeZone === "UTC") return $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime); + if (timeZone === (0, $14e0f24ef4ac5c92$export$aa8b41735afcabd2)() && disambiguation === "compatible") { + dateTime = $11d87f3f76e88657$export$b4a036af3fc0b032(dateTime, new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)()); + let date2 = /* @__PURE__ */ new Date(); + let year = (0, $3b62074eb05584b2$export$c36e0ecb2d4fa69d)(dateTime.era, dateTime.year); + date2.setFullYear(year, dateTime.month - 1, dateTime.day); + date2.setHours(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond); + return date2.getTime(); + } + let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime); + let offsetBefore = $11d87f3f76e88657$export$59c99f3515d3493f(ms - $11d87f3f76e88657$var$DAYMILLIS, timeZone); + let offsetAfter = $11d87f3f76e88657$export$59c99f3515d3493f(ms + $11d87f3f76e88657$var$DAYMILLIS, timeZone); + let valid = $11d87f3f76e88657$var$getValidWallTimes(dateTime, timeZone, ms - offsetBefore, ms - offsetAfter); + if (valid.length === 1) return valid[0]; + if (valid.length > 1) switch (disambiguation) { + // 'compatible' means 'earlier' for "fall back" transitions + case "compatible": + case "earlier": + return valid[0]; + case "later": + return valid[valid.length - 1]; + case "reject": + throw new RangeError("Multiple possible absolute times found"); + } + switch (disambiguation) { + case "earlier": + return Math.min(ms - offsetBefore, ms - offsetAfter); + // 'compatible' means 'later' for "spring forward" transitions + case "compatible": + case "later": + return Math.max(ms - offsetBefore, ms - offsetAfter); + case "reject": + throw new RangeError("No such absolute time found"); + } +} +function $11d87f3f76e88657$export$e67a095c620b86fe(dateTime, timeZone, disambiguation = "compatible") { + return new Date($11d87f3f76e88657$export$5107c82f94518f5c(dateTime, timeZone, disambiguation)); +} +function $11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone) { + let offset3 = $11d87f3f76e88657$export$59c99f3515d3493f(ms, timeZone); + let date = new Date(ms + offset3); + let year = date.getUTCFullYear(); + let month = date.getUTCMonth() + 1; + let day = date.getUTCDate(); + let hour = date.getUTCHours(); + let minute = date.getUTCMinutes(); + let second = date.getUTCSeconds(); + let millisecond = date.getUTCMilliseconds(); + return new (0, $35ea8db9cb2ccb90$export$d3b7288e7994edea)(year < 1 ? "BC" : "AD", year < 1 ? -year + 1 : year, month, day, timeZone, offset3, hour, minute, second, millisecond); +} +function $11d87f3f76e88657$export$93522d1a439f3617(dateTime) { + return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(dateTime.calendar, dateTime.era, dateTime.year, dateTime.month, dateTime.day); +} +function $11d87f3f76e88657$export$b21e0b124e224484(date, time) { + let hour = 0, minute = 0, second = 0, millisecond = 0; + if ("timeZone" in date) ({ hour, minute, second, millisecond } = date); + else if ("hour" in date && !time) return date; + if (time) ({ hour, minute, second, millisecond } = time); + return new (0, $35ea8db9cb2ccb90$export$ca871e8dbb80966f)(date.calendar, date.era, date.year, date.month, date.day, hour, minute, second, millisecond); +} +function $11d87f3f76e88657$export$b4a036af3fc0b032(date, calendar) { + if ((0, $14e0f24ef4ac5c92$export$dbc69fd56b53d5e)(date.calendar, calendar)) return date; + let calendarDate = calendar.fromJulianDay(date.calendar.toJulianDay(date)); + let copy = date.copy(); + copy.calendar = calendar; + copy.era = calendarDate.era; + copy.year = calendarDate.year; + copy.month = calendarDate.month; + copy.day = calendarDate.day; + (0, $735220c2d4774dd3$export$c4e2ecac49351ef2)(copy); + return copy; +} +function $11d87f3f76e88657$export$84c95a83c799e074(date, timeZone, disambiguation) { + if (date instanceof (0, $35ea8db9cb2ccb90$export$d3b7288e7994edea)) { + if (date.timeZone === timeZone) return date; + return $11d87f3f76e88657$export$538b00033cc11c75(date, timeZone); + } + let ms = $11d87f3f76e88657$export$5107c82f94518f5c(date, timeZone, disambiguation); + return $11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone); +} +function $11d87f3f76e88657$export$83aac07b4c37b25(date) { + let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) - date.offset; + return new Date(ms); +} +function $11d87f3f76e88657$export$538b00033cc11c75(date, timeZone) { + let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) - date.offset; + return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone), date.calendar); +} + +// node_modules/@internationalized/date/dist/manipulation.mjs +var $735220c2d4774dd3$var$ONE_HOUR = 36e5; +function $735220c2d4774dd3$export$e16d8520af44a096(date, duration) { + let mutableDate = date.copy(); + let days = "hour" in mutableDate ? $735220c2d4774dd3$var$addTimeFields(mutableDate, duration) : 0; + $735220c2d4774dd3$var$addYears(mutableDate, duration.years || 0); + if (mutableDate.calendar.balanceYearMonth) mutableDate.calendar.balanceYearMonth(mutableDate, date); + mutableDate.month += duration.months || 0; + $735220c2d4774dd3$var$balanceYearMonth(mutableDate); + $735220c2d4774dd3$var$constrainMonthDay(mutableDate); + mutableDate.day += (duration.weeks || 0) * 7; + mutableDate.day += duration.days || 0; + mutableDate.day += days; + $735220c2d4774dd3$var$balanceDay(mutableDate); + if (mutableDate.calendar.balanceDate) mutableDate.calendar.balanceDate(mutableDate); + if (mutableDate.year < 1) { + mutableDate.year = 1; + mutableDate.month = 1; + mutableDate.day = 1; + } + let maxYear = mutableDate.calendar.getYearsInEra(mutableDate); + if (mutableDate.year > maxYear) { + var _mutableDate_calendar_isInverseEra, _mutableDate_calendar; + let isInverseEra = (_mutableDate_calendar_isInverseEra = (_mutableDate_calendar = mutableDate.calendar).isInverseEra) === null || _mutableDate_calendar_isInverseEra === void 0 ? void 0 : _mutableDate_calendar_isInverseEra.call(_mutableDate_calendar, mutableDate); + mutableDate.year = maxYear; + mutableDate.month = isInverseEra ? 1 : mutableDate.calendar.getMonthsInYear(mutableDate); + mutableDate.day = isInverseEra ? 1 : mutableDate.calendar.getDaysInMonth(mutableDate); + } + if (mutableDate.month < 1) { + mutableDate.month = 1; + mutableDate.day = 1; + } + let maxMonth = mutableDate.calendar.getMonthsInYear(mutableDate); + if (mutableDate.month > maxMonth) { + mutableDate.month = maxMonth; + mutableDate.day = mutableDate.calendar.getDaysInMonth(mutableDate); + } + mutableDate.day = Math.max(1, Math.min(mutableDate.calendar.getDaysInMonth(mutableDate), mutableDate.day)); + return mutableDate; +} +function $735220c2d4774dd3$var$addYears(date, years) { + var _date_calendar_isInverseEra, _date_calendar; + if ((_date_calendar_isInverseEra = (_date_calendar = date.calendar).isInverseEra) === null || _date_calendar_isInverseEra === void 0 ? void 0 : _date_calendar_isInverseEra.call(_date_calendar, date)) years = -years; + date.year += years; +} +function $735220c2d4774dd3$var$balanceYearMonth(date) { + while (date.month < 1) { + $735220c2d4774dd3$var$addYears(date, -1); + date.month += date.calendar.getMonthsInYear(date); + } + let monthsInYear = 0; + while (date.month > (monthsInYear = date.calendar.getMonthsInYear(date))) { + date.month -= monthsInYear; + $735220c2d4774dd3$var$addYears(date, 1); + } +} +function $735220c2d4774dd3$var$balanceDay(date) { + while (date.day < 1) { + date.month--; + $735220c2d4774dd3$var$balanceYearMonth(date); + date.day += date.calendar.getDaysInMonth(date); + } + while (date.day > date.calendar.getDaysInMonth(date)) { + date.day -= date.calendar.getDaysInMonth(date); + date.month++; + $735220c2d4774dd3$var$balanceYearMonth(date); + } +} +function $735220c2d4774dd3$var$constrainMonthDay(date) { + date.month = Math.max(1, Math.min(date.calendar.getMonthsInYear(date), date.month)); + date.day = Math.max(1, Math.min(date.calendar.getDaysInMonth(date), date.day)); +} +function $735220c2d4774dd3$export$c4e2ecac49351ef2(date) { + if (date.calendar.constrainDate) date.calendar.constrainDate(date); + date.year = Math.max(1, Math.min(date.calendar.getYearsInEra(date), date.year)); + $735220c2d4774dd3$var$constrainMonthDay(date); +} +function $735220c2d4774dd3$export$3e2544e88a25bff8(duration) { + let inverseDuration = {}; + for (let key2 in duration) if (typeof duration[key2] === "number") inverseDuration[key2] = -duration[key2]; + return inverseDuration; +} +function $735220c2d4774dd3$export$4e2d2ead65e5f7e3(date, duration) { + return $735220c2d4774dd3$export$e16d8520af44a096(date, $735220c2d4774dd3$export$3e2544e88a25bff8(duration)); +} +function $735220c2d4774dd3$export$adaa4cf7ef1b65be(date, fields) { + let mutableDate = date.copy(); + if (fields.era != null) mutableDate.era = fields.era; + if (fields.year != null) mutableDate.year = fields.year; + if (fields.month != null) mutableDate.month = fields.month; + if (fields.day != null) mutableDate.day = fields.day; + $735220c2d4774dd3$export$c4e2ecac49351ef2(mutableDate); + return mutableDate; +} +function $735220c2d4774dd3$export$e5d5e1c1822b6e56(value, fields) { + let mutableValue = value.copy(); + if (fields.hour != null) mutableValue.hour = fields.hour; + if (fields.minute != null) mutableValue.minute = fields.minute; + if (fields.second != null) mutableValue.second = fields.second; + if (fields.millisecond != null) mutableValue.millisecond = fields.millisecond; + $735220c2d4774dd3$export$7555de1e070510cb(mutableValue); + return mutableValue; +} +function $735220c2d4774dd3$var$balanceTime(time) { + time.second += Math.floor(time.millisecond / 1e3); + time.millisecond = $735220c2d4774dd3$var$nonNegativeMod(time.millisecond, 1e3); + time.minute += Math.floor(time.second / 60); + time.second = $735220c2d4774dd3$var$nonNegativeMod(time.second, 60); + time.hour += Math.floor(time.minute / 60); + time.minute = $735220c2d4774dd3$var$nonNegativeMod(time.minute, 60); + let days = Math.floor(time.hour / 24); + time.hour = $735220c2d4774dd3$var$nonNegativeMod(time.hour, 24); + return days; +} +function $735220c2d4774dd3$export$7555de1e070510cb(time) { + time.millisecond = Math.max(0, Math.min(time.millisecond, 1e3)); + time.second = Math.max(0, Math.min(time.second, 59)); + time.minute = Math.max(0, Math.min(time.minute, 59)); + time.hour = Math.max(0, Math.min(time.hour, 23)); +} +function $735220c2d4774dd3$var$nonNegativeMod(a2, b) { + let result = a2 % b; + if (result < 0) result += b; + return result; +} +function $735220c2d4774dd3$var$addTimeFields(time, duration) { + time.hour += duration.hours || 0; + time.minute += duration.minutes || 0; + time.second += duration.seconds || 0; + time.millisecond += duration.milliseconds || 0; + return $735220c2d4774dd3$var$balanceTime(time); +} +function $735220c2d4774dd3$export$7ed87b6bc2506470(time, duration) { + let res = time.copy(); + $735220c2d4774dd3$var$addTimeFields(res, duration); + return res; +} +function $735220c2d4774dd3$export$fe34d3a381cd7501(time, duration) { + return $735220c2d4774dd3$export$7ed87b6bc2506470(time, $735220c2d4774dd3$export$3e2544e88a25bff8(duration)); +} +function $735220c2d4774dd3$export$d52ced6badfb9a4c(value, field, amount, options) { + let mutable = value.copy(); + switch (field) { + case "era": { + let eras = value.calendar.getEras(); + let eraIndex = eras.indexOf(value.era); + if (eraIndex < 0) throw new Error("Invalid era: " + value.era); + eraIndex = $735220c2d4774dd3$var$cycleValue(eraIndex, amount, 0, eras.length - 1, options === null || options === void 0 ? void 0 : options.round); + mutable.era = eras[eraIndex]; + $735220c2d4774dd3$export$c4e2ecac49351ef2(mutable); + break; + } + case "year": + var _mutable_calendar_isInverseEra, _mutable_calendar; + if ((_mutable_calendar_isInverseEra = (_mutable_calendar = mutable.calendar).isInverseEra) === null || _mutable_calendar_isInverseEra === void 0 ? void 0 : _mutable_calendar_isInverseEra.call(_mutable_calendar, mutable)) amount = -amount; + mutable.year = $735220c2d4774dd3$var$cycleValue(value.year, amount, -Infinity, 9999, options === null || options === void 0 ? void 0 : options.round); + if (mutable.year === -Infinity) mutable.year = 1; + if (mutable.calendar.balanceYearMonth) mutable.calendar.balanceYearMonth(mutable, value); + break; + case "month": + mutable.month = $735220c2d4774dd3$var$cycleValue(value.month, amount, 1, value.calendar.getMonthsInYear(value), options === null || options === void 0 ? void 0 : options.round); + break; + case "day": + mutable.day = $735220c2d4774dd3$var$cycleValue(value.day, amount, 1, value.calendar.getDaysInMonth(value), options === null || options === void 0 ? void 0 : options.round); + break; + default: + throw new Error("Unsupported field " + field); + } + if (value.calendar.balanceDate) value.calendar.balanceDate(mutable); + $735220c2d4774dd3$export$c4e2ecac49351ef2(mutable); + return mutable; +} +function $735220c2d4774dd3$export$dd02b3e0007dfe28(value, field, amount, options) { + let mutable = value.copy(); + switch (field) { + case "hour": { + let hours = value.hour; + let min2 = 0; + let max2 = 23; + if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) { + let isPM = hours >= 12; + min2 = isPM ? 12 : 0; + max2 = isPM ? 23 : 11; + } + mutable.hour = $735220c2d4774dd3$var$cycleValue(hours, amount, min2, max2, options === null || options === void 0 ? void 0 : options.round); + break; + } + case "minute": + mutable.minute = $735220c2d4774dd3$var$cycleValue(value.minute, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round); + break; + case "second": + mutable.second = $735220c2d4774dd3$var$cycleValue(value.second, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round); + break; + case "millisecond": + mutable.millisecond = $735220c2d4774dd3$var$cycleValue(value.millisecond, amount, 0, 999, options === null || options === void 0 ? void 0 : options.round); + break; + default: + throw new Error("Unsupported field " + field); + } + return mutable; +} +function $735220c2d4774dd3$var$cycleValue(value, amount, min2, max2, round2 = false) { + if (round2) { + value += Math.sign(amount); + if (value < min2) value = max2; + let div = Math.abs(amount); + if (amount > 0) value = Math.ceil(value / div) * div; + else value = Math.floor(value / div) * div; + if (value > max2) value = min2; + } else { + value += amount; + if (value < min2) value = max2 - (min2 - value - 1); + else if (value > max2) value = min2 + (value - max2 - 1); + } + return value; +} +function $735220c2d4774dd3$export$96b1d28349274637(dateTime, duration) { + let ms; + if (duration.years != null && duration.years !== 0 || duration.months != null && duration.months !== 0 || duration.weeks != null && duration.weeks !== 0 || duration.days != null && duration.days !== 0) { + let res2 = $735220c2d4774dd3$export$e16d8520af44a096((0, $11d87f3f76e88657$export$b21e0b124e224484)(dateTime), { + years: duration.years, + months: duration.months, + weeks: duration.weeks, + days: duration.days + }); + ms = (0, $11d87f3f76e88657$export$5107c82f94518f5c)(res2, dateTime.timeZone); + } else + ms = (0, $11d87f3f76e88657$export$bd4fb2bc8bb06fb)(dateTime) - dateTime.offset; + ms += duration.milliseconds || 0; + ms += (duration.seconds || 0) * 1e3; + ms += (duration.minutes || 0) * 6e4; + ms += (duration.hours || 0) * 36e5; + let res = (0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone); + return (0, $11d87f3f76e88657$export$b4a036af3fc0b032)(res, dateTime.calendar); +} +function $735220c2d4774dd3$export$6814caac34ca03c7(dateTime, duration) { + return $735220c2d4774dd3$export$96b1d28349274637(dateTime, $735220c2d4774dd3$export$3e2544e88a25bff8(duration)); +} +function $735220c2d4774dd3$export$9a297d111fc86b79(dateTime, field, amount, options) { + switch (field) { + case "hour": { + let min2 = 0; + let max2 = 23; + if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) { + let isPM = dateTime.hour >= 12; + min2 = isPM ? 12 : 0; + max2 = isPM ? 23 : 11; + } + let plainDateTime = (0, $11d87f3f76e88657$export$b21e0b124e224484)(dateTime); + let minDate = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)($735220c2d4774dd3$export$e5d5e1c1822b6e56(plainDateTime, { + hour: min2 + }), new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)()); + let minAbsolute = [ + (0, $11d87f3f76e88657$export$5107c82f94518f5c)(minDate, dateTime.timeZone, "earlier"), + (0, $11d87f3f76e88657$export$5107c82f94518f5c)(minDate, dateTime.timeZone, "later") + ].filter((ms2) => (0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms2, dateTime.timeZone).day === minDate.day)[0]; + let maxDate = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)($735220c2d4774dd3$export$e5d5e1c1822b6e56(plainDateTime, { + hour: max2 + }), new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)()); + let maxAbsolute = [ + (0, $11d87f3f76e88657$export$5107c82f94518f5c)(maxDate, dateTime.timeZone, "earlier"), + (0, $11d87f3f76e88657$export$5107c82f94518f5c)(maxDate, dateTime.timeZone, "later") + ].filter((ms2) => (0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms2, dateTime.timeZone).day === maxDate.day).pop(); + let ms = (0, $11d87f3f76e88657$export$bd4fb2bc8bb06fb)(dateTime) - dateTime.offset; + let hours = Math.floor(ms / $735220c2d4774dd3$var$ONE_HOUR); + let remainder = ms % $735220c2d4774dd3$var$ONE_HOUR; + ms = $735220c2d4774dd3$var$cycleValue(hours, amount, Math.floor(minAbsolute / $735220c2d4774dd3$var$ONE_HOUR), Math.floor(maxAbsolute / $735220c2d4774dd3$var$ONE_HOUR), options === null || options === void 0 ? void 0 : options.round) * $735220c2d4774dd3$var$ONE_HOUR + remainder; + return (0, $11d87f3f76e88657$export$b4a036af3fc0b032)((0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone), dateTime.calendar); + } + case "minute": + case "second": + case "millisecond": + return $735220c2d4774dd3$export$dd02b3e0007dfe28(dateTime, field, amount, options); + case "era": + case "year": + case "month": + case "day": { + let res = $735220c2d4774dd3$export$d52ced6badfb9a4c((0, $11d87f3f76e88657$export$b21e0b124e224484)(dateTime), field, amount, options); + let ms = (0, $11d87f3f76e88657$export$5107c82f94518f5c)(res, dateTime.timeZone); + return (0, $11d87f3f76e88657$export$b4a036af3fc0b032)((0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone), dateTime.calendar); + } + default: + throw new Error("Unsupported field " + field); + } +} +function $735220c2d4774dd3$export$31b5430eb18be4f8(dateTime, fields, disambiguation) { + let plainDateTime = (0, $11d87f3f76e88657$export$b21e0b124e224484)(dateTime); + let res = $735220c2d4774dd3$export$e5d5e1c1822b6e56($735220c2d4774dd3$export$adaa4cf7ef1b65be(plainDateTime, fields), fields); + if (res.compare(plainDateTime) === 0) return dateTime; + let ms = (0, $11d87f3f76e88657$export$5107c82f94518f5c)(res, dateTime.timeZone, disambiguation); + return (0, $11d87f3f76e88657$export$b4a036af3fc0b032)((0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone), dateTime.calendar); +} + +// node_modules/@internationalized/date/dist/string.mjs +var $fae977aafc393c5c$var$DATE_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/; +var $fae977aafc393c5c$var$DATE_TIME_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/; +var $fae977aafc393c5c$var$ZONED_DATE_TIME_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:([+-]\d{2})(?::?(\d{2}))?(?::?(\d{2}))?)?\[(.*?)\]$/; +var $fae977aafc393c5c$var$requiredDurationTimeGroups = [ + "hours", + "minutes", + "seconds" +]; +var $fae977aafc393c5c$var$requiredDurationGroups = [ + "years", + "months", + "weeks", + "days", + ...$fae977aafc393c5c$var$requiredDurationTimeGroups +]; +function $fae977aafc393c5c$export$6b862160d295c8e(value) { + let m = value.match($fae977aafc393c5c$var$DATE_RE); + if (!m) throw new Error("Invalid ISO 8601 date string: " + value); + let date = new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)($fae977aafc393c5c$var$parseNumber(m[1], 0, 9999), $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1); + date.day = $fae977aafc393c5c$var$parseNumber(m[3], 1, date.calendar.getDaysInMonth(date)); + return date; +} +function $fae977aafc393c5c$export$588937bcd60ade55(value) { + let m = value.match($fae977aafc393c5c$var$DATE_TIME_RE); + if (!m) throw new Error("Invalid ISO 8601 date time string: " + value); + let year = $fae977aafc393c5c$var$parseNumber(m[1], -9999, 9999); + let era = year < 1 ? "BC" : "AD"; + let date = new (0, $35ea8db9cb2ccb90$export$ca871e8dbb80966f)(era, year < 1 ? -year + 1 : year, $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1e3 : 0); + date.day = $fae977aafc393c5c$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date)); + return date; +} +function $fae977aafc393c5c$export$fd7893f06e92a6a4(value, disambiguation) { + let m = value.match($fae977aafc393c5c$var$ZONED_DATE_TIME_RE); + if (!m) throw new Error("Invalid ISO 8601 date time string: " + value); + let year = $fae977aafc393c5c$var$parseNumber(m[1], -9999, 9999); + let era = year < 1 ? "BC" : "AD"; + let date = new (0, $35ea8db9cb2ccb90$export$d3b7288e7994edea)(era, year < 1 ? -year + 1 : year, $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, m[11], 0, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1e3 : 0); + date.day = $fae977aafc393c5c$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date)); + let plainDateTime = (0, $11d87f3f76e88657$export$b21e0b124e224484)(date); + let ms; + if (m[8]) { + let hourOffset = $fae977aafc393c5c$var$parseNumber(m[8], -23, 23); + var _m_, _m_1; + date.offset = Math.sign(hourOffset) * (Math.abs(hourOffset) * 36e5 + $fae977aafc393c5c$var$parseNumber((_m_ = m[9]) !== null && _m_ !== void 0 ? _m_ : "0", 0, 59) * 6e4 + $fae977aafc393c5c$var$parseNumber((_m_1 = m[10]) !== null && _m_1 !== void 0 ? _m_1 : "0", 0, 59) * 1e3); + ms = (0, $11d87f3f76e88657$export$bd4fb2bc8bb06fb)(date) - date.offset; + let absolutes = (0, $11d87f3f76e88657$export$136f38efe7caf549)(plainDateTime, date.timeZone); + if (!absolutes.includes(ms)) throw new Error(`Offset ${$fae977aafc393c5c$var$offsetToString(date.offset)} is invalid for ${$fae977aafc393c5c$export$4223de14708adc63(date)} in ${date.timeZone}`); + } else + ms = (0, $11d87f3f76e88657$export$5107c82f94518f5c)((0, $11d87f3f76e88657$export$b21e0b124e224484)(plainDateTime), date.timeZone, disambiguation); + return (0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, date.timeZone); +} +function $fae977aafc393c5c$var$parseNumber(value, min2, max2) { + let val = Number(value); + if (val < min2 || val > max2) throw new RangeError(`Value out of range: ${min2} <= ${val} <= ${max2}`); + return val; +} +function $fae977aafc393c5c$export$f59dee82248f5ad4(time) { + return `${String(time.hour).padStart(2, "0")}:${String(time.minute).padStart(2, "0")}:${String(time.second).padStart(2, "0")}${time.millisecond ? String(time.millisecond / 1e3).slice(1) : ""}`; +} +function $fae977aafc393c5c$export$60dfd74aa96791bd(date) { + let gregorianDate = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)(date, new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)()); + let year; + if (gregorianDate.era === "BC") year = gregorianDate.year === 1 ? "0000" : "-" + String(Math.abs(1 - gregorianDate.year)).padStart(6, "00"); + else year = String(gregorianDate.year).padStart(4, "0"); + return `${year}-${String(gregorianDate.month).padStart(2, "0")}-${String(gregorianDate.day).padStart(2, "0")}`; +} +function $fae977aafc393c5c$export$4223de14708adc63(date) { + return `${$fae977aafc393c5c$export$60dfd74aa96791bd(date)}T${$fae977aafc393c5c$export$f59dee82248f5ad4(date)}`; +} +function $fae977aafc393c5c$var$offsetToString(offset3) { + let sign = Math.sign(offset3) < 0 ? "-" : "+"; + offset3 = Math.abs(offset3); + let offsetHours = Math.floor(offset3 / 36e5); + let offsetMinutes = Math.floor(offset3 % 36e5 / 6e4); + let offsetSeconds = Math.floor(offset3 % 36e5 % 6e4 / 1e3); + let stringOffset = `${sign}${String(offsetHours).padStart(2, "0")}:${String(offsetMinutes).padStart(2, "0")}`; + if (offsetSeconds !== 0) stringOffset += `:${String(offsetSeconds).padStart(2, "0")}`; + return stringOffset; +} +function $fae977aafc393c5c$export$bf79f1ebf4b18792(date) { + return `${$fae977aafc393c5c$export$4223de14708adc63(date)}${$fae977aafc393c5c$var$offsetToString(date.offset)}[${date.timeZone}]`; +} + +// node_modules/@swc/helpers/esm/_check_private_redeclaration.js +function _check_private_redeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError("Cannot initialize the same private elements twice on an object"); + } +} + +// node_modules/@swc/helpers/esm/_class_private_field_init.js +function _class_private_field_init(obj, privateMap, value) { + _check_private_redeclaration(obj, privateMap); + privateMap.set(obj, value); +} + +// node_modules/@internationalized/date/dist/CalendarDate.mjs +function $35ea8db9cb2ccb90$var$shiftArgs(args) { + let calendar = typeof args[0] === "object" ? args.shift() : new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)(); + let era; + if (typeof args[0] === "string") era = args.shift(); + else { + let eras = calendar.getEras(); + era = eras[eras.length - 1]; + } + let year = args.shift(); + let month = args.shift(); + let day = args.shift(); + return [ + calendar, + era, + year, + month, + day + ]; +} +var $35ea8db9cb2ccb90$var$_type = /* @__PURE__ */ new WeakMap(); +var $35ea8db9cb2ccb90$export$99faa760c7908e4f = class _$35ea8db9cb2ccb90$export$99faa760c7908e4f { + /** Returns a copy of this date. */ + copy() { + if (this.era) return new _$35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.era, this.year, this.month, this.day); + else return new _$35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.year, this.month, this.day); + } + /** Returns a new `CalendarDate` with the given duration added to it. */ + add(duration) { + return (0, $735220c2d4774dd3$export$e16d8520af44a096)(this, duration); + } + /** Returns a new `CalendarDate` with the given duration subtracted from it. */ + subtract(duration) { + return (0, $735220c2d4774dd3$export$4e2d2ead65e5f7e3)(this, duration); + } + /** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */ + set(fields) { + return (0, $735220c2d4774dd3$export$adaa4cf7ef1b65be)(this, fields); + } + /** + * Returns a new `CalendarDate` with the given field adjusted by a specified amount. + * When the resulting value reaches the limits of the field, it wraps around. + */ + cycle(field, amount, options) { + return (0, $735220c2d4774dd3$export$d52ced6badfb9a4c)(this, field, amount, options); + } + /** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */ + toDate(timeZone) { + return (0, $11d87f3f76e88657$export$e67a095c620b86fe)(this, timeZone); + } + /** Converts the date to an ISO 8601 formatted string. */ + toString() { + return (0, $fae977aafc393c5c$export$60dfd74aa96791bd)(this); + } + /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */ + compare(b) { + return (0, $14e0f24ef4ac5c92$export$68781ddf31c0090f)(this, b); + } + constructor(...args) { + (0, _class_private_field_init)(this, $35ea8db9cb2ccb90$var$_type, { + writable: true, + value: void 0 + }); + let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args); + this.calendar = calendar; + this.era = era; + this.year = year; + this.month = month; + this.day = day; + (0, $735220c2d4774dd3$export$c4e2ecac49351ef2)(this); + } +}; +var $35ea8db9cb2ccb90$var$_type1 = /* @__PURE__ */ new WeakMap(); +var $35ea8db9cb2ccb90$export$680ea196effce5f = class _$35ea8db9cb2ccb90$export$680ea196effce5f { + /** Returns a copy of this time. */ + copy() { + return new _$35ea8db9cb2ccb90$export$680ea196effce5f(this.hour, this.minute, this.second, this.millisecond); + } + /** Returns a new `Time` with the given duration added to it. */ + add(duration) { + return (0, $735220c2d4774dd3$export$7ed87b6bc2506470)(this, duration); + } + /** Returns a new `Time` with the given duration subtracted from it. */ + subtract(duration) { + return (0, $735220c2d4774dd3$export$fe34d3a381cd7501)(this, duration); + } + /** Returns a new `Time` with the given fields set to the provided values. Other fields will be constrained accordingly. */ + set(fields) { + return (0, $735220c2d4774dd3$export$e5d5e1c1822b6e56)(this, fields); + } + /** + * Returns a new `Time` with the given field adjusted by a specified amount. + * When the resulting value reaches the limits of the field, it wraps around. + */ + cycle(field, amount, options) { + return (0, $735220c2d4774dd3$export$dd02b3e0007dfe28)(this, field, amount, options); + } + /** Converts the time to an ISO 8601 formatted string. */ + toString() { + return (0, $fae977aafc393c5c$export$f59dee82248f5ad4)(this); + } + /** Compares this time with another. A negative result indicates that this time is before the given one, and a positive time indicates that it is after. */ + compare(b) { + return (0, $14e0f24ef4ac5c92$export$c19a80a9721b80f6)(this, b); + } + constructor(hour = 0, minute = 0, second = 0, millisecond = 0) { + (0, _class_private_field_init)(this, $35ea8db9cb2ccb90$var$_type1, { + writable: true, + value: void 0 + }); + this.hour = hour; + this.minute = minute; + this.second = second; + this.millisecond = millisecond; + (0, $735220c2d4774dd3$export$7555de1e070510cb)(this); + } +}; +var $35ea8db9cb2ccb90$var$_type2 = /* @__PURE__ */ new WeakMap(); +var $35ea8db9cb2ccb90$export$ca871e8dbb80966f = class _$35ea8db9cb2ccb90$export$ca871e8dbb80966f { + /** Returns a copy of this date. */ + copy() { + if (this.era) return new _$35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond); + else return new _$35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond); + } + /** Returns a new `CalendarDateTime` with the given duration added to it. */ + add(duration) { + return (0, $735220c2d4774dd3$export$e16d8520af44a096)(this, duration); + } + /** Returns a new `CalendarDateTime` with the given duration subtracted from it. */ + subtract(duration) { + return (0, $735220c2d4774dd3$export$4e2d2ead65e5f7e3)(this, duration); + } + /** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */ + set(fields) { + return (0, $735220c2d4774dd3$export$adaa4cf7ef1b65be)((0, $735220c2d4774dd3$export$e5d5e1c1822b6e56)(this, fields), fields); + } + /** + * Returns a new `CalendarDateTime` with the given field adjusted by a specified amount. + * When the resulting value reaches the limits of the field, it wraps around. + */ + cycle(field, amount, options) { + switch (field) { + case "era": + case "year": + case "month": + case "day": + return (0, $735220c2d4774dd3$export$d52ced6badfb9a4c)(this, field, amount, options); + default: + return (0, $735220c2d4774dd3$export$dd02b3e0007dfe28)(this, field, amount, options); + } + } + /** Converts the date to a native JavaScript Date object in the given time zone. */ + toDate(timeZone, disambiguation) { + return (0, $11d87f3f76e88657$export$e67a095c620b86fe)(this, timeZone, disambiguation); + } + /** Converts the date to an ISO 8601 formatted string. */ + toString() { + return (0, $fae977aafc393c5c$export$4223de14708adc63)(this); + } + /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */ + compare(b) { + let res = (0, $14e0f24ef4ac5c92$export$68781ddf31c0090f)(this, b); + if (res === 0) return (0, $14e0f24ef4ac5c92$export$c19a80a9721b80f6)(this, (0, $11d87f3f76e88657$export$b21e0b124e224484)(b)); + return res; + } + constructor(...args) { + (0, _class_private_field_init)(this, $35ea8db9cb2ccb90$var$_type2, { + writable: true, + value: void 0 + }); + let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args); + this.calendar = calendar; + this.era = era; + this.year = year; + this.month = month; + this.day = day; + this.hour = args.shift() || 0; + this.minute = args.shift() || 0; + this.second = args.shift() || 0; + this.millisecond = args.shift() || 0; + (0, $735220c2d4774dd3$export$c4e2ecac49351ef2)(this); + } +}; +var $35ea8db9cb2ccb90$var$_type3 = /* @__PURE__ */ new WeakMap(); +var $35ea8db9cb2ccb90$export$d3b7288e7994edea = class _$35ea8db9cb2ccb90$export$d3b7288e7994edea { + /** Returns a copy of this date. */ + copy() { + if (this.era) return new _$35ea8db9cb2ccb90$export$d3b7288e7994edea(this.calendar, this.era, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond); + else return new _$35ea8db9cb2ccb90$export$d3b7288e7994edea(this.calendar, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond); + } + /** Returns a new `ZonedDateTime` with the given duration added to it. */ + add(duration) { + return (0, $735220c2d4774dd3$export$96b1d28349274637)(this, duration); + } + /** Returns a new `ZonedDateTime` with the given duration subtracted from it. */ + subtract(duration) { + return (0, $735220c2d4774dd3$export$6814caac34ca03c7)(this, duration); + } + /** Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */ + set(fields, disambiguation) { + return (0, $735220c2d4774dd3$export$31b5430eb18be4f8)(this, fields, disambiguation); + } + /** + * Returns a new `ZonedDateTime` with the given field adjusted by a specified amount. + * When the resulting value reaches the limits of the field, it wraps around. + */ + cycle(field, amount, options) { + return (0, $735220c2d4774dd3$export$9a297d111fc86b79)(this, field, amount, options); + } + /** Converts the date to a native JavaScript Date object. */ + toDate() { + return (0, $11d87f3f76e88657$export$83aac07b4c37b25)(this); + } + /** Converts the date to an ISO 8601 formatted string, including the UTC offset and time zone identifier. */ + toString() { + return (0, $fae977aafc393c5c$export$bf79f1ebf4b18792)(this); + } + /** Converts the date to an ISO 8601 formatted string in UTC. */ + toAbsoluteString() { + return this.toDate().toISOString(); + } + /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */ + compare(b) { + return this.toDate().getTime() - (0, $11d87f3f76e88657$export$84c95a83c799e074)(b, this.timeZone).toDate().getTime(); + } + constructor(...args) { + (0, _class_private_field_init)(this, $35ea8db9cb2ccb90$var$_type3, { + writable: true, + value: void 0 + }); + let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args); + let timeZone = args.shift(); + let offset3 = args.shift(); + this.calendar = calendar; + this.era = era; + this.year = year; + this.month = month; + this.day = day; + this.timeZone = timeZone; + this.offset = offset3; + this.hour = args.shift() || 0; + this.minute = args.shift() || 0; + this.second = args.shift() || 0; + this.millisecond = args.shift() || 0; + (0, $735220c2d4774dd3$export$c4e2ecac49351ef2)(this); + } +}; + +// node_modules/@internationalized/date/dist/HebrewCalendar.mjs +var $7c5f6fbf42389787$var$HOUR_PARTS = 1080; +var $7c5f6fbf42389787$var$DAY_PARTS = 24 * $7c5f6fbf42389787$var$HOUR_PARTS; +var $7c5f6fbf42389787$var$MONTH_DAYS = 29; +var $7c5f6fbf42389787$var$MONTH_FRACT = 12 * $7c5f6fbf42389787$var$HOUR_PARTS + 793; +var $7c5f6fbf42389787$var$MONTH_PARTS = $7c5f6fbf42389787$var$MONTH_DAYS * $7c5f6fbf42389787$var$DAY_PARTS + $7c5f6fbf42389787$var$MONTH_FRACT; + +// node_modules/@internationalized/date/dist/DateFormatter.mjs +var $fb18d541ea1ad717$var$formatterCache = /* @__PURE__ */ new Map(); +var $fb18d541ea1ad717$export$ad991b66133851cf = class { + /** Formats a date as a string according to the locale and format options passed to the constructor. */ + format(value) { + return this.formatter.format(value); + } + /** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */ + formatToParts(value) { + return this.formatter.formatToParts(value); + } + /** Formats a date range as a string. */ + formatRange(start, end) { + if (typeof this.formatter.formatRange === "function") + return this.formatter.formatRange(start, end); + if (end < start) throw new RangeError("End date must be >= start date"); + return `${this.formatter.format(start)} – ${this.formatter.format(end)}`; + } + /** Formats a date range as an array of parts. */ + formatRangeToParts(start, end) { + if (typeof this.formatter.formatRangeToParts === "function") + return this.formatter.formatRangeToParts(start, end); + if (end < start) throw new RangeError("End date must be >= start date"); + let startParts = this.formatter.formatToParts(start); + let endParts = this.formatter.formatToParts(end); + return [ + ...startParts.map((p2) => ({ + ...p2, + source: "startRange" + })), + { + type: "literal", + value: " – ", + source: "shared" + }, + ...endParts.map((p2) => ({ + ...p2, + source: "endRange" + })) + ]; + } + /** Returns the resolved formatting options based on the values passed to the constructor. */ + resolvedOptions() { + let resolvedOptions = this.formatter.resolvedOptions(); + if ($fb18d541ea1ad717$var$hasBuggyResolvedHourCycle()) { + if (!this.resolvedHourCycle) this.resolvedHourCycle = $fb18d541ea1ad717$var$getResolvedHourCycle(resolvedOptions.locale, this.options); + resolvedOptions.hourCycle = this.resolvedHourCycle; + resolvedOptions.hour12 = this.resolvedHourCycle === "h11" || this.resolvedHourCycle === "h12"; + } + if (resolvedOptions.calendar === "ethiopic-amete-alem") resolvedOptions.calendar = "ethioaa"; + return resolvedOptions; + } + constructor(locale, options = {}) { + this.formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale, options); + this.options = options; + } +}; +var $fb18d541ea1ad717$var$hour12Preferences = { + true: { + // Only Japanese uses the h11 style for 12 hour time. All others use h12. + ja: "h11" + }, + false: {} +}; +function $fb18d541ea1ad717$var$getCachedDateFormatter(locale, options = {}) { + if (typeof options.hour12 === "boolean" && $fb18d541ea1ad717$var$hasBuggyHour12Behavior()) { + options = { + ...options + }; + let pref = $fb18d541ea1ad717$var$hour12Preferences[String(options.hour12)][locale.split("-")[0]]; + let defaultHourCycle = options.hour12 ? "h12" : "h23"; + options.hourCycle = pref !== null && pref !== void 0 ? pref : defaultHourCycle; + delete options.hour12; + } + let cacheKey = locale + (options ? Object.entries(options).sort((a2, b) => a2[0] < b[0] ? -1 : 1).join() : ""); + if ($fb18d541ea1ad717$var$formatterCache.has(cacheKey)) return $fb18d541ea1ad717$var$formatterCache.get(cacheKey); + let numberFormatter = new Intl.DateTimeFormat(locale, options); + $fb18d541ea1ad717$var$formatterCache.set(cacheKey, numberFormatter); + return numberFormatter; +} +var $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = null; +function $fb18d541ea1ad717$var$hasBuggyHour12Behavior() { + if ($fb18d541ea1ad717$var$_hasBuggyHour12Behavior == null) $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = new Intl.DateTimeFormat("en-US", { + hour: "numeric", + hour12: false + }).format(new Date(2020, 2, 3, 0)) === "24"; + return $fb18d541ea1ad717$var$_hasBuggyHour12Behavior; +} +var $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = null; +function $fb18d541ea1ad717$var$hasBuggyResolvedHourCycle() { + if ($fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle == null) $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat("fr", { + hour: "numeric", + hour12: false + }).resolvedOptions().hourCycle === "h12"; + return $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle; +} +function $fb18d541ea1ad717$var$getResolvedHourCycle(locale, options) { + if (!options.timeStyle && !options.hour) return void 0; + locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, ""); + locale += (locale.includes("-u-") ? "" : "-u") + "-nu-latn"; + let formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale, { + ...options, + timeZone: void 0 + // use local timezone + }); + let min2 = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find((p2) => p2.type === "hour").value, 10); + let max2 = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find((p2) => p2.type === "hour").value, 10); + if (min2 === 0 && max2 === 23) return "h23"; + if (min2 === 24 && max2 === 23) return "h24"; + if (min2 === 0 && max2 === 11) return "h11"; + if (min2 === 12 && max2 === 11) return "h12"; + throw new Error("Unexpected hour cycle result"); +} + +// node_modules/bits-ui/dist/internal/date-time/announcer.js +function initAnnouncer(doc) { + if (!isBrowser || !doc) + return null; + let el = doc.querySelector("[data-bits-announcer]"); + const createLog = (kind) => { + const log = doc.createElement("div"); + log.role = "log"; + log.ariaLive = kind; + log.setAttribute("aria-relevant", "additions"); + return log; + }; + if (!isHTMLElement2(el)) { + const div = doc.createElement("div"); + div.style.cssText = srOnlyStylesString; + div.setAttribute("data-bits-announcer", ""); + div.appendChild(createLog("assertive")); + div.appendChild(createLog("polite")); + el = div; + doc.body.insertBefore(el, doc.body.firstChild); + } + const getLog = (kind) => { + if (!isHTMLElement2(el)) + return null; + const log = el.querySelector(`[aria-live="${kind}"]`); + if (!isHTMLElement2(log)) + return null; + return log; + }; + return { + getLog + }; +} +function getAnnouncer(doc) { + const announcer = initAnnouncer(doc); + function announce(value, kind = "assertive", timeout = 7500) { + if (!announcer || !isBrowser || !doc) + return; + const log = announcer.getLog(kind); + const content = doc.createElement("div"); + if (typeof value === "number") { + value = value.toString(); + } else if (value === null) { + value = "Empty"; + } else { + value = value.trim(); + } + content.innerText = value; + if (kind === "assertive") { + log?.replaceChildren(content); + } else { + log?.appendChild(content); + } + return setTimeout(() => { + content.remove(); + }, timeout); + } + return { + announce + }; +} + +// node_modules/bits-ui/dist/internal/date-time/utils.js +var defaultDateDefaults = { + defaultValue: void 0, + granularity: "day" +}; +var defaultTimeDefaults = { + defaultValue: void 0, + granularity: "minute" +}; +function getDefaultDate(opts) { + const withDefaults = { ...defaultDateDefaults, ...opts }; + const { defaultValue, granularity, minValue, maxValue } = withDefaults; + if (Array.isArray(defaultValue) && defaultValue.length) { + return defaultValue[defaultValue.length - 1]; + } + if (defaultValue && !Array.isArray(defaultValue)) { + return defaultValue; + } else { + let date = /* @__PURE__ */ new Date(); + if (minValue && date < minValue.toDate($14e0f24ef4ac5c92$export$aa8b41735afcabd2())) { + date = minValue.toDate($14e0f24ef4ac5c92$export$aa8b41735afcabd2()); + } else if (maxValue && date > maxValue.toDate($14e0f24ef4ac5c92$export$aa8b41735afcabd2())) { + date = maxValue.toDate($14e0f24ef4ac5c92$export$aa8b41735afcabd2()); + } + const year = date.getFullYear(); + const month = date.getMonth() + 1; + const day = date.getDate(); + const calendarDateTimeGranularities = ["hour", "minute", "second"]; + if (calendarDateTimeGranularities.includes(granularity ?? "day")) { + return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(year, month, day, 0, 0, 0); + } + return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(year, month, day); + } +} +function getDefaultTime(opts) { + const withDefaults = { ...defaultTimeDefaults, ...opts }; + const { defaultValue } = withDefaults; + if (defaultValue) { + return defaultValue; + } else { + return new $35ea8db9cb2ccb90$export$680ea196effce5f(0, 0, 0); + } +} +function parseStringToDateValue(dateStr, referenceVal) { + let dateValue; + if (referenceVal instanceof $35ea8db9cb2ccb90$export$d3b7288e7994edea) { + dateValue = $fae977aafc393c5c$export$fd7893f06e92a6a4(dateStr); + } else if (referenceVal instanceof $35ea8db9cb2ccb90$export$ca871e8dbb80966f) { + dateValue = $fae977aafc393c5c$export$588937bcd60ade55(dateStr); + } else { + dateValue = $fae977aafc393c5c$export$6b862160d295c8e(dateStr); + } + return dateValue.calendar !== referenceVal.calendar ? $11d87f3f76e88657$export$b4a036af3fc0b032(dateValue, referenceVal.calendar) : dateValue; +} +function toDate(dateValue, tz = $14e0f24ef4ac5c92$export$aa8b41735afcabd2()) { + if (dateValue instanceof $35ea8db9cb2ccb90$export$d3b7288e7994edea) { + return dateValue.toDate(); + } else { + return dateValue.toDate(tz); + } +} +function getDateValueType(date) { + if (date instanceof $35ea8db9cb2ccb90$export$99faa760c7908e4f) + return "date"; + if (date instanceof $35ea8db9cb2ccb90$export$ca871e8dbb80966f) + return "datetime"; + if (date instanceof $35ea8db9cb2ccb90$export$d3b7288e7994edea) + return "zoneddatetime"; + throw new Error("Unknown date type"); +} +function parseAnyDateValue(value, type) { + switch (type) { + case "date": + return $fae977aafc393c5c$export$6b862160d295c8e(value); + case "datetime": + return $fae977aafc393c5c$export$588937bcd60ade55(value); + case "zoneddatetime": + return $fae977aafc393c5c$export$fd7893f06e92a6a4(value); + default: + throw new Error(`Unknown date type: ${type}`); + } +} +function isCalendarDateTime(dateValue) { + return dateValue instanceof $35ea8db9cb2ccb90$export$ca871e8dbb80966f; +} +function isZonedDateTime(dateValue) { + return dateValue instanceof $35ea8db9cb2ccb90$export$d3b7288e7994edea; +} +function hasTime(dateValue) { + return isCalendarDateTime(dateValue) || isZonedDateTime(dateValue); +} +function getDaysInMonth(date) { + if (date instanceof Date) { + const year = date.getFullYear(); + const month = date.getMonth() + 1; + return new Date(year, month, 0).getDate(); + } else { + return date.set({ day: 100 }).day; + } +} +function isBefore(dateToCompare, referenceDate) { + return dateToCompare.compare(referenceDate) < 0; +} +function isAfter(dateToCompare, referenceDate) { + return dateToCompare.compare(referenceDate) > 0; +} +function isBeforeOrSame(dateToCompare, referenceDate) { + return dateToCompare.compare(referenceDate) <= 0; +} +function isAfterOrSame(dateToCompare, referenceDate) { + return dateToCompare.compare(referenceDate) >= 0; +} +function isBetweenInclusive(date, start, end) { + return isAfterOrSame(date, start) && isBeforeOrSame(date, end); +} +function getLastFirstDayOfWeek(date, firstDayOfWeek, locale) { + const day = $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date, locale); + if (firstDayOfWeek > day) { + return date.subtract({ days: day + 7 - firstDayOfWeek }); + } + if (firstDayOfWeek === day) { + return date; + } + return date.subtract({ days: day - firstDayOfWeek }); +} +function getNextLastDayOfWeek(date, firstDayOfWeek, locale) { + const day = $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date, locale); + const lastDayOfWeek = firstDayOfWeek === 0 ? 6 : firstDayOfWeek - 1; + if (day === lastDayOfWeek) { + return date; + } + if (day > lastDayOfWeek) { + return date.add({ days: 7 - day + lastDayOfWeek }); + } + return date.add({ days: lastDayOfWeek - day }); +} +function areAllDaysBetweenValid(start, end, isUnavailable, isDisabled) { + if (isUnavailable === void 0 && isDisabled === void 0) { + return true; + } + let dCurrent = start.add({ days: 1 }); + if (isDisabled?.(dCurrent) || isUnavailable?.(dCurrent)) { + return false; + } + const dEnd = end; + while (dCurrent.compare(dEnd) < 0) { + dCurrent = dCurrent.add({ days: 1 }); + if (isDisabled?.(dCurrent) || isUnavailable?.(dCurrent)) { + return false; + } + } + return true; +} + +// node_modules/bits-ui/dist/internal/date-time/field/parts.js +var DATE_SEGMENT_PARTS = ["day", "month", "year"]; +var EDITABLE_TIME_SEGMENT_PARTS = ["hour", "minute", "second", "dayPeriod"]; +var NON_EDITABLE_SEGMENT_PARTS = ["literal", "timeZoneName"]; +var EDITABLE_SEGMENT_PARTS = [ + ...DATE_SEGMENT_PARTS, + ...EDITABLE_TIME_SEGMENT_PARTS +]; +var ALL_SEGMENT_PARTS = [ + ...EDITABLE_SEGMENT_PARTS, + ...NON_EDITABLE_SEGMENT_PARTS +]; +var ALL_TIME_SEGMENT_PARTS = [ + ...EDITABLE_TIME_SEGMENT_PARTS, + ...NON_EDITABLE_SEGMENT_PARTS +]; +var ALL_EXCEPT_LITERAL_PARTS = ALL_SEGMENT_PARTS.filter((part) => part !== "literal"); +var ALL_TIME_EXCEPT_LITERAL_PARTS = ALL_TIME_SEGMENT_PARTS.filter((part) => part !== "literal"); + +// node_modules/bits-ui/dist/internal/date-time/placeholders.js +var supportedLocales = [ + "ach", + "af", + "am", + "an", + "ar", + "ast", + "az", + "be", + "bg", + "bn", + "br", + "bs", + "ca", + "cak", + "ckb", + "cs", + "cy", + "da", + "de", + "dsb", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fr", + "fy", + "ga", + "gd", + "gl", + "he", + "hr", + "hsb", + "hu", + "ia", + "id", + "it", + "ja", + "ka", + "kk", + "kn", + "ko", + "lb", + "lo", + "lt", + "lv", + "meh", + "ml", + "ms", + "nl", + "nn", + "no", + "oc", + "pl", + "pt", + "rm", + "ro", + "ru", + "sc", + "scn", + "sk", + "sl", + "sr", + "sv", + "szl", + "tg", + "th", + "tr", + "uk", + "zh-CN", + "zh-TW" +]; +var placeholderFields = ["year", "month", "day"]; +var placeholders = { + ach: { year: "mwaka", month: "dwe", day: "nino" }, + af: { year: "jjjj", month: "mm", day: "dd" }, + am: { year: "ዓዓዓዓ", month: "ሚሜ", day: "ቀቀ" }, + an: { year: "aaaa", month: "mm", day: "dd" }, + ar: { year: "سنة", month: "شهر", day: "يوم" }, + ast: { year: "aaaa", month: "mm", day: "dd" }, + az: { year: "iiii", month: "aa", day: "gg" }, + be: { year: "гггг", month: "мм", day: "дд" }, + bg: { year: "гггг", month: "мм", day: "дд" }, + bn: { year: "yyyy", month: "মিমি", day: "dd" }, + br: { year: "bbbb", month: "mm", day: "dd" }, + bs: { year: "gggg", month: "mm", day: "dd" }, + ca: { year: "aaaa", month: "mm", day: "dd" }, + cak: { year: "jjjj", month: "ii", day: "q'q'" }, + ckb: { year: "ساڵ", month: "مانگ", day: "ڕۆژ" }, + cs: { year: "rrrr", month: "mm", day: "dd" }, + cy: { year: "bbbb", month: "mm", day: "dd" }, + da: { year: "åååå", month: "mm", day: "dd" }, + de: { year: "jjjj", month: "mm", day: "tt" }, + dsb: { year: "llll", month: "mm", day: "źź" }, + el: { year: "εεεε", month: "μμ", day: "ηη" }, + en: { year: "yyyy", month: "mm", day: "dd" }, + eo: { year: "jjjj", month: "mm", day: "tt" }, + es: { year: "aaaa", month: "mm", day: "dd" }, + et: { year: "aaaa", month: "kk", day: "pp" }, + eu: { year: "uuuu", month: "hh", day: "ee" }, + fa: { year: "سال", month: "ماه", day: "روز" }, + ff: { year: "hhhh", month: "ll", day: "ññ" }, + fi: { year: "vvvv", month: "kk", day: "pp" }, + fr: { year: "aaaa", month: "mm", day: "jj" }, + fy: { year: "jjjj", month: "mm", day: "dd" }, + ga: { year: "bbbb", month: "mm", day: "ll" }, + gd: { year: "bbbb", month: "mm", day: "ll" }, + gl: { year: "aaaa", month: "mm", day: "dd" }, + he: { year: "שנה", month: "חודש", day: "יום" }, + hr: { year: "gggg", month: "mm", day: "dd" }, + hsb: { year: "llll", month: "mm", day: "dd" }, + hu: { year: "éééé", month: "hh", day: "nn" }, + ia: { year: "aaaa", month: "mm", day: "dd" }, + id: { year: "tttt", month: "bb", day: "hh" }, + it: { year: "aaaa", month: "mm", day: "gg" }, + ja: { year: " 年 ", month: "月", day: "日" }, + ka: { year: "წწწწ", month: "თთ", day: "რრ" }, + kk: { year: "жжжж", month: "аа", day: "кк" }, + kn: { year: "ವವವವ", month: "ಮಿಮೀ", day: "ದಿದಿ" }, + ko: { year: "연도", month: "월", day: "일" }, + lb: { year: "jjjj", month: "mm", day: "dd" }, + lo: { year: "ປປປປ", month: "ດດ", day: "ວວ" }, + lt: { year: "mmmm", month: "mm", day: "dd" }, + lv: { year: "gggg", month: "mm", day: "dd" }, + meh: { year: "aaaa", month: "mm", day: "dd" }, + ml: { year: "വർഷം", month: "മാസം", day: "തീയതി" }, + ms: { year: "tttt", month: "mm", day: "hh" }, + nl: { year: "jjjj", month: "mm", day: "dd" }, + nn: { year: "åååå", month: "mm", day: "dd" }, + no: { year: "åååå", month: "mm", day: "dd" }, + oc: { year: "aaaa", month: "mm", day: "jj" }, + pl: { year: "rrrr", month: "mm", day: "dd" }, + pt: { year: "aaaa", month: "mm", day: "dd" }, + rm: { year: "oooo", month: "mm", day: "dd" }, + ro: { year: "aaaa", month: "ll", day: "zz" }, + ru: { year: "гггг", month: "мм", day: "дд" }, + sc: { year: "aaaa", month: "mm", day: "dd" }, + scn: { year: "aaaa", month: "mm", day: "jj" }, + sk: { year: "rrrr", month: "mm", day: "dd" }, + sl: { year: "llll", month: "mm", day: "dd" }, + sr: { year: "гггг", month: "мм", day: "дд" }, + sv: { year: "åååå", month: "mm", day: "dd" }, + szl: { year: "rrrr", month: "mm", day: "dd" }, + tg: { year: "сссс", month: "мм", day: "рр" }, + th: { year: "ปปปป", month: "ดด", day: "วว" }, + tr: { year: "yyyy", month: "aa", day: "gg" }, + uk: { year: "рррр", month: "мм", day: "дд" }, + "zh-CN": { year: "年", month: "月", day: "日" }, + "zh-TW": { year: "年", month: "月", day: "日" } +}; +function getPlaceholderObj(locale) { + if (!isSupportedLocale(locale)) { + const localeLanguage = getLocaleLanguage(locale); + if (!isSupportedLocale(localeLanguage)) { + return placeholders.en; + } else { + return placeholders[localeLanguage]; + } + } else { + return placeholders[locale]; + } +} +function getPlaceholder(field, value, locale) { + if (isPlaceholderField(field)) + return getPlaceholderObj(locale)[field]; + if (isDefaultField(field)) + return value; + if (isTimeField(field)) + return "––"; + return ""; +} +function isSupportedLocale(locale) { + return supportedLocales.includes(locale); +} +function isPlaceholderField(field) { + return placeholderFields.includes(field); +} +function isTimeField(field) { + return field === "hour" || field === "minute" || field === "second"; +} +function isDefaultField(field) { + return field === "era" || field === "dayPeriod"; +} +function getLocaleLanguage(locale) { + if (Intl.Locale) { + return new Intl.Locale(locale).language; + } + return locale.split("-")[0]; +} + +// node_modules/bits-ui/dist/internal/date-time/field/helpers.js +function initializeSegmentValues(granularity) { + const calendarDateTimeGranularities = ["hour", "minute", "second"]; + const initialParts = EDITABLE_SEGMENT_PARTS.map((part) => { + if (part === "dayPeriod") { + return [part, "AM"]; + } + return [part, null]; + }).filter(([key2]) => { + if (key2 === "literal" || key2 === null) + return false; + if (granularity === "day") { + return !calendarDateTimeGranularities.includes(key2); + } else { + return true; + } + }); + return Object.fromEntries(initialParts); +} +function createContentObj(props) { + const { segmentValues, formatter, locale, dateRef } = props; + const content = Object.keys(segmentValues).reduce((obj, part) => { + if (!isSegmentPart(part)) + return obj; + if ("hour" in segmentValues && part === "dayPeriod") { + const value = segmentValues[part]; + if (!isNull(value)) { + obj[part] = value; + } else { + obj[part] = getPlaceholder(part, "AM", locale); + } + } else { + obj[part] = getPartContent(part); + } + return obj; + }, {}); + function getPartContent(part) { + if ("hour" in segmentValues) { + const value = segmentValues[part]; + const leadingZero = typeof value === "string" && value?.startsWith("0"); + const intValue = value !== null ? Number.parseInt(value) : null; + if (value === "0" && part !== "year") { + return "0"; + } else if (!isNull(value) && !isNull(intValue)) { + const formatted = formatter.part(dateRef.set({ [part]: value }), part, { + hourCycle: props.hourCycle === 24 ? "h23" : void 0 + }); + const is12HourMode = props.hourCycle === 12 || props.hourCycle === void 0 && getDefaultHourCycle(locale) === 12; + if (part === "hour" && is12HourMode) { + if (intValue > 12) { + const hour = intValue - 12; + if (hour === 0) { + return "12"; + } else if (hour < 10) { + return `0${hour}`; + } else { + return `${hour}`; + } + } + if (intValue === 0) { + return "12"; + } + if (intValue < 10) { + return `0${intValue}`; + } + return `${intValue}`; + } + if (part === "year") { + return `${value}`; + } + if (leadingZero && formatted.length === 1) { + return `0${formatted}`; + } + return formatted; + } else { + return getPlaceholder(part, "", locale); + } + } else { + if (isDateSegmentPart(part)) { + const value = segmentValues[part]; + const leadingZero = typeof value === "string" && value?.startsWith("0"); + if (value === "0") { + return "0"; + } else if (!isNull(value)) { + const formatted = formatter.part(dateRef.set({ [part]: value }), part); + if (part === "year") { + return `${value}`; + } + if (leadingZero && formatted.length === 1) { + return `0${formatted}`; + } + return formatted; + } else { + return getPlaceholder(part, "", locale); + } + } + return ""; + } + } + return content; +} +function createContentArr(props) { + const { granularity, dateRef, formatter, contentObj, hideTimeZone, hourCycle } = props; + const parts = formatter.toParts(dateRef, getOptsByGranularity(granularity, hourCycle)); + const segmentContentArr = parts.map((part) => { + const defaultParts = ["literal", "dayPeriod", "timeZoneName", null]; + if (defaultParts.includes(part.type) || !isSegmentPart(part.type)) { + return { + part: part.type, + value: part.value + }; + } + return { + part: part.type, + value: contentObj[part.type] + }; + }).filter((segment) => { + if (isNull(segment.part) || isNull(segment.value)) + return false; + if (segment.part === "timeZoneName" && (!isZonedDateTime(dateRef) || hideTimeZone)) { + return false; + } + return true; + }); + return segmentContentArr; +} +function createContent(props) { + const contentObj = createContentObj(props); + const contentArr = createContentArr({ + contentObj, + ...props + }); + return { + obj: contentObj, + arr: contentArr + }; +} +function getOptsByGranularity(granularity, hourCycle) { + const opts = { + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + second: "2-digit", + timeZoneName: "short", + hourCycle: hourCycle === 24 ? "h23" : void 0, + hour12: hourCycle === 24 ? false : void 0 + }; + if (granularity === "day") { + delete opts.second; + delete opts.hour; + delete opts.minute; + delete opts.timeZoneName; + } + if (granularity === "hour") { + delete opts.minute; + } + if (granularity === "minute") { + delete opts.second; + } + return opts; +} +function initSegmentStates() { + return EDITABLE_SEGMENT_PARTS.reduce((acc, key2) => { + acc[key2] = { + lastKeyZero: false, + hasLeftFocus: true, + updating: null + }; + return acc; + }, {}); +} +function isDateSegmentPart(part) { + return DATE_SEGMENT_PARTS.includes(part); +} +function isSegmentPart(part) { + return EDITABLE_SEGMENT_PARTS.includes(part); +} +function isAnySegmentPart(part) { + return ALL_SEGMENT_PARTS.includes(part); +} +function getUsedSegments(fieldNode) { + if (!isBrowser || !fieldNode) + return []; + const usedSegments = getSegments(fieldNode).map((el) => el.dataset.segment).filter((part) => { + return EDITABLE_SEGMENT_PARTS.includes(part); + }); + return usedSegments; +} +function getValueFromSegments(props) { + const { segmentObj, fieldNode, dateRef } = props; + const usedSegments = getUsedSegments(fieldNode); + let date = dateRef; + for (const part of usedSegments) { + if ("hour" in segmentObj) { + const value = segmentObj[part]; + if (isNull(value)) + continue; + date = date.set({ [part]: segmentObj[part] }); + } else if (isDateSegmentPart(part)) { + const value = segmentObj[part]; + if (isNull(value)) + continue; + date = date.set({ [part]: segmentObj[part] }); + } + } + return date; +} +function areAllSegmentsFilled(segmentValues, fieldNode) { + const usedSegments = getUsedSegments(fieldNode); + for (const part of usedSegments) { + if ("hour" in segmentValues) { + if (segmentValues[part] === null) { + return false; + } + } else if (isDateSegmentPart(part)) { + if (segmentValues[part] === null) { + return false; + } + } + } + return true; +} +function isDateAndTimeSegmentObj(obj) { + if (typeof obj !== "object" || obj === null) { + return false; + } + return Object.entries(obj).every(([key2, value]) => { + const validKey = EDITABLE_TIME_SEGMENT_PARTS.includes(key2) || DATE_SEGMENT_PARTS.includes(key2); + const validValue = key2 === "dayPeriod" ? value === "AM" || value === "PM" || value === null : typeof value === "string" || typeof value === "number" || value === null; + return validKey && validValue; + }); +} +function inferGranularity(value, granularity) { + if (granularity) + return granularity; + if (hasTime(value)) + return "minute"; + return "day"; +} +function isAcceptableSegmentKey(key2) { + const acceptableSegmentKeys = [ + kbd_constants_exports.ENTER, + kbd_constants_exports.ARROW_UP, + kbd_constants_exports.ARROW_DOWN, + kbd_constants_exports.ARROW_LEFT, + kbd_constants_exports.ARROW_RIGHT, + kbd_constants_exports.BACKSPACE, + kbd_constants_exports.SPACE + ]; + if (acceptableSegmentKeys.includes(key2)) + return true; + if (isNumberString(key2)) + return true; + return false; +} +function isFirstSegment(id, fieldNode) { + if (!isBrowser) + return false; + const segments = getSegments(fieldNode); + return segments.length ? segments[0].id === id : false; +} +function setDescription(props) { + const { id, formatter, value, doc } = props; + if (!isBrowser) + return; + const valueString = formatter.selectedDate(value); + const el = doc.getElementById(id); + if (!el) { + const div = doc.createElement("div"); + div.style.cssText = styleToString({ + display: "none" + }); + div.id = id; + div.innerText = `Selected Date: ${valueString}`; + doc.body.appendChild(div); + } else { + el.innerText = `Selected Date: ${valueString}`; + } +} +function removeDescriptionElement(id, doc) { + if (!isBrowser) + return; + const el = doc.getElementById(id); + if (!el) + return; + doc.body.removeChild(el); +} +function getDefaultHourCycle(locale) { + const formatter = new Intl.DateTimeFormat(locale, { hour: "numeric" }); + const parts = formatter.formatToParts(/* @__PURE__ */ new Date("2023-01-01T13:00:00")); + const hourPart = parts.find((part) => part.type === "hour"); + return hourPart?.value === "1" ? 12 : 24; +} + +// node_modules/bits-ui/dist/internal/date-time/field/segments.js +function handleSegmentNavigation(e, fieldNode) { + const currentTarget = e.currentTarget; + if (!isHTMLElement2(currentTarget)) + return; + const { prev: prev2, next: next3 } = getPrevNextSegments(currentTarget, fieldNode); + if (e.key === kbd_constants_exports.ARROW_LEFT) { + if (!prev2) + return; + prev2.focus(); + } else if (e.key === kbd_constants_exports.ARROW_RIGHT) { + if (!next3) + return; + next3.focus(); + } +} +function handleTimeSegmentNavigation(e, fieldNode) { + const currentTarget = e.currentTarget; + if (!isHTMLElement2(currentTarget)) + return; + const { prev: prev2, next: next3 } = getPrevNextTimeSegments(currentTarget, fieldNode); + if (e.key === kbd_constants_exports.ARROW_LEFT) { + if (!prev2) + return; + prev2.focus(); + } else if (e.key === kbd_constants_exports.ARROW_RIGHT) { + if (!next3) + return; + next3.focus(); + } +} +function getNextSegment(node, segments) { + const index = segments.indexOf(node); + if (index === segments.length - 1 || index === -1) + return null; + const nextIndex = index + 1; + const nextSegment = segments[nextIndex]; + return nextSegment; +} +function getPrevSegment(node, segments) { + const index = segments.indexOf(node); + if (index === 0 || index === -1) + return null; + const prevIndex = index - 1; + const prevSegment = segments[prevIndex]; + return prevSegment; +} +function getPrevNextSegments(startingNode, fieldNode) { + const segments = getSegments(fieldNode); + if (!segments.length) { + return { + next: null, + prev: null + }; + } + return { + next: getNextSegment(startingNode, segments), + prev: getPrevSegment(startingNode, segments) + }; +} +function getPrevNextTimeSegments(startingNode, fieldNode) { + const segments = getTimeSegments(fieldNode); + if (!segments.length) { + return { + next: null, + prev: null + }; + } + return { + next: getNextSegment(startingNode, segments), + prev: getPrevSegment(startingNode, segments) + }; +} +function moveToNextSegment(e, fieldNode) { + const node = e.currentTarget; + if (!isHTMLElement2(node)) + return; + const { next: next3 } = getPrevNextSegments(node, fieldNode); + if (!next3) + return; + next3.focus(); +} +function moveToNextTimeSegment(e, fieldNode) { + const node = e.currentTarget; + if (!isHTMLElement2(node)) + return; + const { next: next3 } = getPrevNextTimeSegments(node, fieldNode); + if (!next3) + return; + next3.focus(); +} +function moveToPrevTimeSegment(e, fieldNode) { + const node = e.currentTarget; + if (!isHTMLElement2(node)) + return; + const { prev: prev2 } = getPrevNextTimeSegments(node, fieldNode); + if (!prev2) + return; + prev2.focus(); +} +function moveToPrevSegment(e, fieldNode) { + const node = e.currentTarget; + if (!isHTMLElement2(node)) + return; + const { prev: prev2 } = getPrevNextSegments(node, fieldNode); + if (!prev2) + return; + prev2.focus(); +} +function isSegmentNavigationKey(key2) { + if (key2 === kbd_constants_exports.ARROW_RIGHT || key2 === kbd_constants_exports.ARROW_LEFT) + return true; + return false; +} +function getSegments(fieldNode) { + if (!fieldNode) + return []; + const segments = Array.from(fieldNode.querySelectorAll("[data-segment]")).filter((el) => { + if (!isHTMLElement2(el)) + return false; + const segment = el.dataset.segment; + if (segment === "trigger") + return true; + if (!isAnySegmentPart(segment) || segment === "literal") + return false; + return true; + }); + return segments; +} +function getTimeSegments(fieldNode) { + if (!fieldNode) + return []; + const segments = Array.from(fieldNode.querySelectorAll("[data-segment]")).filter((el) => { + if (!isHTMLElement2(el)) + return false; + const segment = el.dataset.segment; + if (segment === "trigger") + return true; + if (segment === "literal") + return false; + return true; + }); + return segments; +} +function getFirstTimeSegment(fieldNode) { + return getTimeSegments(fieldNode)[0]; +} +function getFirstSegment(fieldNode) { + return getSegments(fieldNode)[0]; +} + +// node_modules/bits-ui/dist/internal/date-time/field/time-helpers.js +function createTimeContentObj(props) { + const { segmentValues, formatter, locale, timeRef } = props; + const content = Object.keys(segmentValues).reduce((obj, part) => { + if (!isEditableTimeSegmentPart(part)) + return obj; + if (part === "dayPeriod") { + const value = segmentValues[part]; + if (!isNull(value)) { + obj[part] = value; + } else { + obj[part] = getPlaceholder(part, "AM", locale); + } + } else { + obj[part] = getPartContent(part); + } + return obj; + }, {}); + function getPartContent(part) { + const value = segmentValues[part]; + const leadingZero = typeof value === "string" && value?.startsWith("0"); + const intValue = value !== null ? Number.parseInt(value) : null; + if (!isNull(value) && !isNull(intValue)) { + const formatted = formatter.part(timeRef.set({ [part]: value }), part, { + hourCycle: props.hourCycle === 24 ? "h23" : void 0 + }); + const is12HourMode = props.hourCycle === 12 || props.hourCycle === void 0 && getDefaultHourCycle(locale) === 12; + if (part === "hour" && is12HourMode) { + if (intValue > 12) { + const hour = intValue - 12; + if (hour === 0) { + return "12"; + } else if (hour < 10) { + return `0${hour}`; + } else { + return `${hour}`; + } + } + if (intValue === 0) { + return "12"; + } + if (intValue < 10) { + return `0${intValue}`; + } + return `${intValue}`; + } + if (leadingZero && formatted.length === 1) { + return `0${formatted}`; + } + return formatted; + } else { + return getPlaceholder(part, "", locale); + } + } + return content; +} +function createTimeContentArr(props) { + const { granularity, timeRef, formatter, contentObj, hideTimeZone, hourCycle } = props; + const parts = formatter.toParts(timeRef, getOptsByGranularity2(granularity, hourCycle)); + const timeSegmentContentArr = parts.map((part) => { + const defaultParts = ["literal", "timeZoneName", null]; + if (defaultParts.includes(part.type) || !isEditableTimeSegmentPart(part.type)) { + return { + part: part.type, + value: part.value + }; + } + return { + part: part.type, + value: contentObj[part.type] + }; + }).filter((segment) => { + if (isNull(segment.part) || isNull(segment.value)) + return false; + if (segment.part === "timeZoneName" && (!isZonedDateTime(timeRef) || hideTimeZone)) { + return false; + } + return true; + }); + return timeSegmentContentArr; +} +function createTimeContent(props) { + const contentObj = createTimeContentObj(props); + const contentArr = createTimeContentArr({ + contentObj, + ...props + }); + return { + obj: contentObj, + arr: contentArr + }; +} +function getOptsByGranularity2(granularity, hourCycle) { + const opts = { + hour: "2-digit", + minute: "2-digit", + second: "2-digit", + timeZoneName: "short", + hourCycle: hourCycle === 24 ? "h23" : void 0, + hour12: hourCycle === 24 ? false : void 0 + }; + if (granularity === "hour") { + delete opts.minute; + delete opts.second; + } + if (granularity === "minute") { + delete opts.second; + } + return opts; +} +function initTimeSegmentStates() { + return EDITABLE_TIME_SEGMENT_PARTS.reduce((acc, key2) => { + acc[key2] = { + lastKeyZero: false, + hasLeftFocus: true, + updating: null + }; + return acc; + }, {}); +} +function isEditableTimeSegmentPart(part) { + return EDITABLE_TIME_SEGMENT_PARTS.includes(part); +} +function getUsedTimeSegments(fieldNode) { + if (!isBrowser || !fieldNode) + return []; + const usedSegments = getTimeSegments(fieldNode).map((el) => el.dataset.segment).filter((part) => { + return EDITABLE_TIME_SEGMENT_PARTS.includes(part); + }); + return usedSegments; +} +function getTimeValueFromSegments(props) { + const usedSegments = getUsedTimeSegments(props.fieldNode); + for (const part of usedSegments) { + const value = props.segmentObj[part]; + if (isNull(value)) + continue; + props.timeRef = props.timeRef.set({ [part]: props.segmentObj[part] }); + } + return props.timeRef; +} +function areAllTimeSegmentsFilled(segmentValues, fieldNode) { + const usedSegments = getUsedTimeSegments(fieldNode); + for (const part of usedSegments) { + if (segmentValues[part] === null) + return false; + } + return true; +} +function isFirstTimeSegment(id, fieldNode) { + if (!isBrowser) + return false; + const segments = getTimeSegments(fieldNode); + return segments.length ? segments[0].id === id : false; +} +function setTimeDescription(props) { + if (!isBrowser) + return; + const valueString = props.formatter.selectedTime(props.value); + const el = props.doc.getElementById(props.id); + if (!el) { + const div = props.doc.createElement("div"); + div.style.cssText = styleToString({ + display: "none" + }); + div.id = props.id; + div.innerText = `Selected Time: ${valueString}`; + props.doc.body.appendChild(div); + } else { + el.innerText = `Selected Time: ${valueString}`; + } +} +function removeTimeDescriptionElement(id, doc) { + if (!isBrowser) + return; + const el = doc.getElementById(id); + if (!el) + return; + doc.body.removeChild(el); +} +function convertTimeValueToDateValue(time) { + if (time instanceof $35ea8db9cb2ccb90$export$680ea196effce5f) { + return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(2020, 1, 1, time.hour, time.minute, time.second, time.millisecond); + } + return time; +} +function convertTimeValueToTime(time) { + if (time instanceof $35ea8db9cb2ccb90$export$680ea196effce5f) + return time; + return new $35ea8db9cb2ccb90$export$680ea196effce5f(time.hour, time.minute, time.second, time.millisecond); +} +function isTimeBefore(timeToCompare, referenceTime) { + return timeToCompare.compare(referenceTime) < 0; +} +function getISOTimeValue(time) { + return convertTimeValueToTime(time).toString(); +} + +// node_modules/bits-ui/dist/internal/date-time/formatter.js +var defaultPartOptions = { + year: "numeric", + month: "numeric", + day: "numeric", + hour: "numeric", + minute: "numeric", + second: "numeric" +}; +function createFormatter(opts) { + let locale = opts.initialLocale; + function setLocale(newLocale) { + locale = newLocale; + } + function getLocale() { + return locale; + } + function custom(date, options) { + return new $fb18d541ea1ad717$export$ad991b66133851cf(locale, options).format(date); + } + function selectedDate(date, includeTime = true) { + if (hasTime(date) && includeTime) { + return custom(toDate(date), { + dateStyle: "long", + timeStyle: "long" + }); + } else { + return custom(toDate(date), { + dateStyle: "long" + }); + } + } + function fullMonthAndYear(date) { + if (typeof opts.monthFormat.current !== "function" && typeof opts.yearFormat.current !== "function") { + return new $fb18d541ea1ad717$export$ad991b66133851cf(locale, { + month: opts.monthFormat.current, + year: opts.yearFormat.current + }).format(date); + } + const formattedMonth = typeof opts.monthFormat.current === "function" ? opts.monthFormat.current(date.getMonth() + 1) : new $fb18d541ea1ad717$export$ad991b66133851cf(locale, { month: opts.monthFormat.current }).format(date); + const formattedYear = typeof opts.yearFormat.current === "function" ? opts.yearFormat.current(date.getFullYear()) : new $fb18d541ea1ad717$export$ad991b66133851cf(locale, { year: opts.yearFormat.current }).format(date); + return `${formattedMonth} ${formattedYear}`; + } + function fullMonth(date) { + return new $fb18d541ea1ad717$export$ad991b66133851cf(locale, { month: "long" }).format(date); + } + function fullYear(date) { + return new $fb18d541ea1ad717$export$ad991b66133851cf(locale, { year: "numeric" }).format(date); + } + function toParts(date, options) { + if (isZonedDateTime(date)) { + return new $fb18d541ea1ad717$export$ad991b66133851cf(locale, { + ...options, + timeZone: date.timeZone + }).formatToParts(toDate(date)); + } else { + return new $fb18d541ea1ad717$export$ad991b66133851cf(locale, options).formatToParts(toDate(date)); + } + } + function dayOfWeek(date, length = "narrow") { + return new $fb18d541ea1ad717$export$ad991b66133851cf(locale, { weekday: length }).format(date); + } + function dayPeriod(date, hourCycle = void 0) { + const parts = new $fb18d541ea1ad717$export$ad991b66133851cf(locale, { + hour: "numeric", + minute: "numeric", + hourCycle: hourCycle === 24 ? "h23" : void 0 + }).formatToParts(date); + const value = parts.find((p2) => p2.type === "dayPeriod")?.value; + if (value === "PM") { + return "PM"; + } + return "AM"; + } + function part(dateObj, type, options = {}) { + const opts2 = { ...defaultPartOptions, ...options }; + const parts = toParts(dateObj, opts2); + const part2 = parts.find((p2) => p2.type === type); + return part2 ? part2.value : ""; + } + return { + setLocale, + getLocale, + fullMonth, + fullYear, + fullMonthAndYear, + toParts, + custom, + part, + dayPeriod, + selectedDate, + dayOfWeek + }; +} +function createTimeFormatter(initialLocale) { + let locale = initialLocale; + function setLocale(newLocale) { + locale = newLocale; + } + function getLocale() { + return locale; + } + function custom(date, options) { + return new $fb18d541ea1ad717$export$ad991b66133851cf(locale, options).format(date); + } + function selectedTime(date) { + return custom(toDate(convertTimeValueToDateValue(date)), { + timeStyle: "long" + }); + } + function toParts(timeValue, options) { + const dateValue = convertTimeValueToDateValue(timeValue); + if (isZonedDateTime(dateValue)) { + return new $fb18d541ea1ad717$export$ad991b66133851cf(locale, { + ...options, + timeZone: dateValue.timeZone + }).formatToParts(toDate(dateValue)); + } else { + return new $fb18d541ea1ad717$export$ad991b66133851cf(locale, options).formatToParts(toDate(dateValue)); + } + } + function dayPeriod(date, hourCycle = void 0) { + const parts = new $fb18d541ea1ad717$export$ad991b66133851cf(locale, { + hour: "numeric", + minute: "numeric", + hourCycle: hourCycle === 24 ? "h23" : void 0 + }).formatToParts(date); + const value = parts.find((p2) => p2.type === "dayPeriod")?.value; + if (value === "PM") + return "PM"; + return "AM"; + } + function part(dateObj, type, options = {}) { + const opts = { ...defaultPartOptions, ...options }; + const parts = toParts(dateObj, opts); + const part2 = parts.find((p2) => p2.type === type); + return part2 ? part2.value : ""; + } + return { + setLocale, + getLocale, + toParts, + custom, + part, + dayPeriod, + selectedTime + }; +} + +// node_modules/bits-ui/dist/internal/date-time/calendar-helpers.svelte.js +function isCalendarDayNode(node) { + if (!isHTMLElement2(node)) return false; + if (!node.hasAttribute("data-bits-day")) return false; + return true; +} +function getDaysBetween(start, end) { + const days = []; + let dCurrent = start.add({ days: 1 }); + const dEnd = end; + while (dCurrent.compare(dEnd) < 0) { + days.push(dCurrent); + dCurrent = dCurrent.add({ days: 1 }); + } + return days; +} +function createMonth(props) { + const { dateObj, weekStartsOn, fixedWeeks, locale } = props; + const daysInMonth = getDaysInMonth(dateObj); + const datesArray = Array.from({ length: daysInMonth }, (_, i) => dateObj.set({ day: i + 1 })); + const firstDayOfMonth = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(dateObj); + const lastDayOfMonth = $14e0f24ef4ac5c92$export$a2258d9c4118825c(dateObj); + const lastSunday = strict_equals(weekStartsOn, void 0, false) ? getLastFirstDayOfWeek(firstDayOfMonth, weekStartsOn, "en-US") : getLastFirstDayOfWeek(firstDayOfMonth, 0, locale); + const nextSaturday = strict_equals(weekStartsOn, void 0, false) ? getNextLastDayOfWeek(lastDayOfMonth, weekStartsOn, "en-US") : getNextLastDayOfWeek(lastDayOfMonth, 0, locale); + const lastMonthDays = getDaysBetween(lastSunday.subtract({ days: 1 }), firstDayOfMonth); + const nextMonthDays = getDaysBetween(lastDayOfMonth, nextSaturday.add({ days: 1 })); + const totalDays = lastMonthDays.length + datesArray.length + nextMonthDays.length; + if (fixedWeeks && totalDays < 42) { + const extraDays = 42 - totalDays; + let startFrom = nextMonthDays[nextMonthDays.length - 1]; + if (!startFrom) { + startFrom = dateObj.add({ months: 1 }).set({ day: 1 }); + } + let length = extraDays; + if (strict_equals(nextMonthDays.length, 0)) { + length = extraDays - 1; + nextMonthDays.push(startFrom); + } + const extraDaysArray = Array.from({ length }, (_, i) => { + const incr = i + 1; + return startFrom.add({ days: incr }); + }); + nextMonthDays.push(...extraDaysArray); + } + const allDays = lastMonthDays.concat(datesArray, nextMonthDays); + const weeks = chunk(allDays, 7); + return { value: dateObj, dates: allDays, weeks }; +} +function createMonths(props) { + const { numberOfMonths, dateObj, ...monthProps } = props; + const months = []; + if (!numberOfMonths || strict_equals(numberOfMonths, 1)) { + months.push(createMonth({ ...monthProps, dateObj })); + return months; + } + months.push(createMonth({ ...monthProps, dateObj })); + for (let i = 1; i < numberOfMonths; i++) { + const nextMonth = dateObj.add({ months: i }); + months.push(createMonth({ ...monthProps, dateObj: nextMonth })); + } + return months; +} +function getSelectableCells(calendarNode) { + if (!calendarNode) return []; + const selectableSelector = `[data-bits-day]:not([data-disabled]):not([data-outside-visible-months])`; + return Array.from(calendarNode.querySelectorAll(selectableSelector)).filter((el) => isHTMLElement2(el)); +} +function setPlaceholderToNodeValue(node, placeholder) { + const cellValue = node.getAttribute("data-value"); + if (!cellValue) return; + placeholder.current = parseStringToDateValue(cellValue, placeholder.current); +} +function shiftCalendarFocus({ + node, + add, + placeholder, + calendarNode, + isPrevButtonDisabled, + isNextButtonDisabled, + months, + numberOfMonths +}) { + const candidateCells = getSelectableCells(calendarNode); + if (!candidateCells.length) return; + const index = candidateCells.indexOf(node); + const nextIndex = index + add; + if (isValidIndex(nextIndex, candidateCells)) { + const nextCell = candidateCells[nextIndex]; + setPlaceholderToNodeValue(nextCell, placeholder); + return nextCell.focus(); + } + if (nextIndex < 0) { + if (isPrevButtonDisabled) return; + const firstMonth = months[0]?.value; + if (!firstMonth) return; + placeholder.current = firstMonth.subtract({ months: numberOfMonths }); + afterTick(() => { + const newCandidateCells = getSelectableCells(calendarNode); + if (!newCandidateCells.length) return; + const newIndex = newCandidateCells.length - Math.abs(nextIndex); + if (isValidIndex(newIndex, newCandidateCells)) { + const newCell = newCandidateCells[newIndex]; + setPlaceholderToNodeValue(newCell, placeholder); + return newCell.focus(); + } + }); + } + if (nextIndex >= candidateCells.length) { + if (isNextButtonDisabled) return; + const firstMonth = months[0]?.value; + if (!firstMonth) return; + placeholder.current = firstMonth.add({ months: numberOfMonths }); + afterTick(() => { + const newCandidateCells = getSelectableCells(calendarNode); + if (!newCandidateCells.length) return; + const newIndex = nextIndex - candidateCells.length; + if (isValidIndex(newIndex, newCandidateCells)) { + const nextCell = newCandidateCells[newIndex]; + return nextCell.focus(); + } + }); + } +} +var ARROW_KEYS = [ + kbd_constants_exports.ARROW_DOWN, + kbd_constants_exports.ARROW_UP, + kbd_constants_exports.ARROW_LEFT, + kbd_constants_exports.ARROW_RIGHT +]; +var SELECT_KEYS = [kbd_constants_exports.ENTER, kbd_constants_exports.SPACE]; +function handleCalendarKeydown({ event, handleCellClick, shiftFocus, placeholderValue }) { + const currentCell = event.target; + if (!isCalendarDayNode(currentCell)) return; + if (!ARROW_KEYS.includes(event.key) && !SELECT_KEYS.includes(event.key)) return; + event.preventDefault(); + const kbdFocusMap = { + [kbd_constants_exports.ARROW_DOWN]: 7, + [kbd_constants_exports.ARROW_UP]: -7, + [kbd_constants_exports.ARROW_LEFT]: -1, + [kbd_constants_exports.ARROW_RIGHT]: 1 + }; + if (ARROW_KEYS.includes(event.key)) { + const add = kbdFocusMap[event.key]; + if (strict_equals(add, void 0, false)) { + shiftFocus(currentCell, add); + } + } + if (SELECT_KEYS.includes(event.key)) { + const cellValue = currentCell.getAttribute("data-value"); + if (!cellValue) return; + handleCellClick(event, parseStringToDateValue(cellValue, placeholderValue)); + } +} +function handleCalendarNextPage({ + months, + setMonths, + numberOfMonths, + pagedNavigation, + weekStartsOn, + locale, + fixedWeeks, + setPlaceholder +}) { + const firstMonth = months[0]?.value; + if (!firstMonth) return; + if (pagedNavigation) { + setPlaceholder(firstMonth.add({ months: numberOfMonths })); + } else { + const targetDate = firstMonth.add({ months: 1 }); + const newMonths = createMonths({ + dateObj: targetDate, + weekStartsOn, + locale, + fixedWeeks, + numberOfMonths + }); + setPlaceholder(targetDate); + setMonths(newMonths); + } +} +function handleCalendarPrevPage({ + months, + setMonths, + numberOfMonths, + pagedNavigation, + weekStartsOn, + locale, + fixedWeeks, + setPlaceholder +}) { + const firstMonth = months[0]?.value; + if (!firstMonth) return; + if (pagedNavigation) { + setPlaceholder(firstMonth.subtract({ months: numberOfMonths })); + } else { + const targetDate = firstMonth.subtract({ months: 1 }); + const newMonths = createMonths({ + dateObj: targetDate, + weekStartsOn, + locale, + fixedWeeks, + numberOfMonths + }); + setPlaceholder(targetDate); + setMonths(newMonths); + } +} +function getWeekdays({ months, formatter, weekdayFormat }) { + if (!months.length) return []; + const firstMonth = months[0]; + const firstWeek = firstMonth.weeks[0]; + if (!firstWeek) return []; + return firstWeek.map((date) => formatter.dayOfWeek(toDate(date), weekdayFormat)); +} +function useMonthViewOptionsSync(props) { + user_effect(() => { + const weekStartsOn = props.weekStartsOn.current; + const locale = props.locale.current; + const fixedWeeks = props.fixedWeeks.current; + const numberOfMonths = props.numberOfMonths.current; + untrack(() => { + const placeholder = props.placeholder.current; + if (!placeholder) return; + const defaultMonthProps = { weekStartsOn, locale, fixedWeeks, numberOfMonths }; + props.setMonths(createMonths({ ...defaultMonthProps, dateObj: placeholder })); + }); + }); +} +function createAccessibleHeading({ calendarNode, label, accessibleHeadingId }) { + const doc = getDocument(calendarNode); + const div = doc.createElement("div"); + div.style.cssText = styleToString({ + border: "0px", + clip: "rect(0px, 0px, 0px, 0px)", + clipPath: "inset(50%)", + height: "1px", + margin: "-1px", + overflow: "hidden", + padding: "0px", + position: "absolute", + whiteSpace: "nowrap", + width: "1px" + }); + const h2 = doc.createElement("div"); + h2.textContent = label; + h2.id = accessibleHeadingId; + h2.role = "heading"; + h2.ariaLevel = "2"; + calendarNode.insertBefore(div, calendarNode.firstChild); + div.appendChild(h2); + return () => { + const h22 = doc.getElementById(accessibleHeadingId); + if (!h22) return; + div.parentElement?.removeChild(div); + h22.remove(); + }; +} +function useMonthViewPlaceholderSync({ + placeholder, + getVisibleMonths, + weekStartsOn, + locale, + fixedWeeks, + numberOfMonths, + setMonths +}) { + user_effect(() => { + placeholder.current; + untrack(() => { + if (getVisibleMonths().some((month) => $14e0f24ef4ac5c92$export$a18c89cbd24170ff(month, placeholder.current))) { + return; + } + const defaultMonthProps = { + weekStartsOn: weekStartsOn.current, + locale: locale.current, + fixedWeeks: fixedWeeks.current, + numberOfMonths: numberOfMonths.current + }; + setMonths(createMonths({ ...defaultMonthProps, dateObj: placeholder.current })); + }); + }); +} +function getIsNextButtonDisabled({ maxValue, months, disabled }) { + if (!maxValue || !months.length) return false; + if (disabled) return true; + const lastMonthInView = months[months.length - 1]?.value; + if (!lastMonthInView) return false; + const firstMonthOfNextPage = lastMonthInView.add({ months: 1 }).set({ day: 1 }); + return isAfter(firstMonthOfNextPage, maxValue); +} +function getIsPrevButtonDisabled({ minValue, months, disabled }) { + if (!minValue || !months.length) return false; + if (disabled) return true; + const firstMonthInView = months[0]?.value; + if (!firstMonthInView) return false; + const lastMonthOfPrevPage = firstMonthInView.subtract({ months: 1 }).set({ day: 35 }); + return isBefore(lastMonthOfPrevPage, minValue); +} +function getCalendarHeadingValue({ months, locale, formatter }) { + if (!months.length) return ""; + if (strict_equals(locale, formatter.getLocale(), false)) { + formatter.setLocale(locale); + } + if (strict_equals(months.length, 1)) { + const month = toDate(months[0].value); + return `${formatter.fullMonthAndYear(month)}`; + } + const startMonth = toDate(months[0].value); + const endMonth = toDate(months[months.length - 1].value); + const startMonthName = formatter.fullMonth(startMonth); + const endMonthName = formatter.fullMonth(endMonth); + const startMonthYear = formatter.fullYear(startMonth); + const endMonthYear = formatter.fullYear(endMonth); + const content = strict_equals(startMonthYear, endMonthYear) ? `${startMonthName} - ${endMonthName} ${endMonthYear}` : `${startMonthName} ${startMonthYear} - ${endMonthName} ${endMonthYear}`; + return content; +} +function getCalendarElementProps({ fullCalendarLabel, id, isInvalid, disabled, readonly }) { + return { + id, + role: "application", + "aria-label": fullCalendarLabel, + "data-invalid": boolToEmptyStrOrUndef(isInvalid), + "data-disabled": boolToEmptyStrOrUndef(disabled), + "data-readonly": boolToEmptyStrOrUndef(readonly) + }; +} +function pickerOpenFocus(e) { + const doc = getDocument(e.target); + const nodeToFocus = doc.querySelector("[data-bits-day][data-focused]"); + if (nodeToFocus) { + e.preventDefault(); + nodeToFocus?.focus(); + } +} +function getFirstNonDisabledDateInView(calendarRef) { + if (!isBrowser) return; + const daysInView = Array.from(calendarRef.querySelectorAll("[data-bits-day]:not([aria-disabled=true])")); + if (strict_equals(daysInView.length, 0)) return; + const element2 = daysInView[0]; + const value = element2?.getAttribute("data-value"); + const type = element2?.getAttribute("data-type"); + if (!value || !type) return; + return parseAnyDateValue(value, type); +} +function useEnsureNonDisabledPlaceholder({ + ref, + placeholder, + defaultPlaceholder, + minValue, + maxValue, + isDateDisabled +}) { + function isDisabled(date) { + if (isDateDisabled.current(date)) return true; + if (minValue.current && isBefore(date, minValue.current)) return true; + if (maxValue.current && isBefore(maxValue.current, date)) return true; + return false; + } + watch(() => ref.current, () => { + if (!ref.current) return; + if (placeholder.current && $14e0f24ef4ac5c92$export$ea39ec197993aef0(placeholder.current, defaultPlaceholder) && isDisabled(defaultPlaceholder)) { + placeholder.current = getFirstNonDisabledDateInView(ref.current) ?? defaultPlaceholder; + } + }); +} +function getDateWithPreviousTime(date, prev2) { + if (!date || !prev2) return date; + if (hasTime(date) && hasTime(prev2)) { + return date.set({ + hour: prev2.hour, + minute: prev2.minute, + millisecond: prev2.millisecond, + second: prev2.second + }); + } + return date; +} +var calendarAttrs = createBitsAttrs({ + component: "calendar", + parts: [ + "root", + "grid", + "cell", + "next-button", + "prev-button", + "day", + "grid-body", + "grid-head", + "grid-row", + "head-cell", + "header", + "heading", + "month-select", + "year-select" + ] +}); +function getDefaultYears(opts) { + const currentYear = (/* @__PURE__ */ new Date()).getFullYear(); + const latestYear = Math.max(opts.placeholderYear, currentYear); + let minYear; + let maxYear; + if (opts.minValue) { + minYear = opts.minValue.year; + } else { + const initialMinYear = latestYear - 100; + minYear = opts.placeholderYear < initialMinYear ? opts.placeholderYear - 10 : initialMinYear; + } + if (opts.maxValue) { + maxYear = opts.maxValue.year; + } else { + maxYear = latestYear + 10; + } + if (minYear > maxYear) { + minYear = maxYear; + } + const totalYears = maxYear - minYear + 1; + return Array.from({ length: totalYears }, (_, i) => minYear + i); +} + +// node_modules/bits-ui/dist/bits/calendar/calendar.svelte.js +var CalendarRootContext = new Context("Calendar.Root | RangeCalender.Root"); +var CalendarRootState = class _CalendarRootState { + static create(opts) { + return CalendarRootContext.set(new _CalendarRootState(opts)); + } + opts; + #visibleMonths = tag(user_derived(() => this.months.map((month) => month.value)), "CalendarRootState.visibleMonths"); + get visibleMonths() { + return get(this.#visibleMonths); + } + set visibleMonths(value) { + set(this.#visibleMonths, value); + } + formatter; + accessibleHeadingId = useId(); + domContext; + attachment; + #months = tag(state(proxy([])), "CalendarRootState.months"); + get months() { + return get(this.#months); + } + set months(value) { + set(this.#months, value, true); + } + announcer; + constructor(opts) { + this.opts = opts; + this.attachment = attachRef(this.opts.ref); + this.domContext = new DOMContext(opts.ref); + this.announcer = getAnnouncer(null); + this.formatter = createFormatter({ + initialLocale: this.opts.locale.current, + monthFormat: this.opts.monthFormat, + yearFormat: this.opts.yearFormat + }); + this.setMonths = this.setMonths.bind(this); + this.nextPage = this.nextPage.bind(this); + this.prevPage = this.prevPage.bind(this); + this.prevYear = this.prevYear.bind(this); + this.nextYear = this.nextYear.bind(this); + this.setYear = this.setYear.bind(this); + this.setMonth = this.setMonth.bind(this); + this.isOutsideVisibleMonths = this.isOutsideVisibleMonths.bind(this); + this.isDateDisabled = this.isDateDisabled.bind(this); + this.isDateSelected = this.isDateSelected.bind(this); + this.shiftFocus = this.shiftFocus.bind(this); + this.handleCellClick = this.handleCellClick.bind(this); + this.handleMultipleUpdate = this.handleMultipleUpdate.bind(this); + this.handleSingleUpdate = this.handleSingleUpdate.bind(this); + this.onkeydown = this.onkeydown.bind(this); + this.getBitsAttr = this.getBitsAttr.bind(this); + onMount(() => { + this.announcer = getAnnouncer(this.domContext.getDocument()); + }); + this.months = createMonths({ + dateObj: this.opts.placeholder.current, + weekStartsOn: this.opts.weekStartsOn.current, + locale: this.opts.locale.current, + fixedWeeks: this.opts.fixedWeeks.current, + numberOfMonths: this.opts.numberOfMonths.current + }); + this.#setupInitialFocusEffect(); + this.#setupAccessibleHeadingEffect(); + this.#setupFormatterEffect(); + useMonthViewPlaceholderSync({ + placeholder: this.opts.placeholder, + getVisibleMonths: () => this.visibleMonths, + weekStartsOn: this.opts.weekStartsOn, + locale: this.opts.locale, + fixedWeeks: this.opts.fixedWeeks, + numberOfMonths: this.opts.numberOfMonths, + setMonths: (months) => this.months = months + }); + useMonthViewOptionsSync({ + fixedWeeks: this.opts.fixedWeeks, + locale: this.opts.locale, + numberOfMonths: this.opts.numberOfMonths, + placeholder: this.opts.placeholder, + setMonths: this.setMonths, + weekStartsOn: this.opts.weekStartsOn + }); + watch(() => this.fullCalendarLabel, (label) => { + const node = this.domContext.getElementById(this.accessibleHeadingId); + if (!node) return; + node.textContent = label; + }); + watch(() => this.opts.value.current, () => { + const value = this.opts.value.current; + if (Array.isArray(value) && value.length) { + const lastValue = value[value.length - 1]; + if (lastValue && strict_equals(this.opts.placeholder.current, lastValue, false)) { + this.opts.placeholder.current = lastValue; + } + } else if (!Array.isArray(value) && value && strict_equals(this.opts.placeholder.current, value, false)) { + this.opts.placeholder.current = value; + } + }); + useEnsureNonDisabledPlaceholder({ + placeholder: opts.placeholder, + defaultPlaceholder: opts.defaultPlaceholder, + isDateDisabled: opts.isDateDisabled, + maxValue: opts.maxValue, + minValue: opts.minValue, + ref: opts.ref + }); + } + setMonths(months) { + this.months = months; + } + #weekdays = tag( + user_derived( + /** + * This derived state holds an array of localized day names for the current + * locale and calendar view. It dynamically syncs with the 'weekStartsOn' option, + * updating its content when the option changes. Using this state to render the + * calendar's days of the week is strongly recommended, as it guarantees that + * the days are correctly formatted for the current locale and calendar view. + */ + () => { + return getWeekdays({ + months: this.months, + formatter: this.formatter, + weekdayFormat: this.opts.weekdayFormat.current + }); + } + ), + "CalendarRootState.weekdays" + ); + get weekdays() { + return get(this.#weekdays); + } + set weekdays(value) { + set(this.#weekdays, value); + } + #initialPlaceholderYear = tag(user_derived(() => untrack(() => this.opts.placeholder.current.year)), "CalendarRootState.initialPlaceholderYear"); + get initialPlaceholderYear() { + return get(this.#initialPlaceholderYear); + } + set initialPlaceholderYear(value) { + set(this.#initialPlaceholderYear, value); + } + #defaultYears = tag( + user_derived(() => { + return getDefaultYears({ + minValue: this.opts.minValue.current, + maxValue: this.opts.maxValue.current, + placeholderYear: this.initialPlaceholderYear + }); + }), + "CalendarRootState.defaultYears" + ); + get defaultYears() { + return get(this.#defaultYears); + } + set defaultYears(value) { + set(this.#defaultYears, value); + } + #setupInitialFocusEffect() { + user_effect(() => { + const initialFocus = untrack(() => this.opts.initialFocus.current); + if (initialFocus) { + const firstFocusedDay = this.opts.ref.current?.querySelector(`[data-focused]`); + if (firstFocusedDay) { + firstFocusedDay.focus(); + } + } + }); + } + #setupAccessibleHeadingEffect() { + user_effect(() => { + if (!this.opts.ref.current) return; + const removeHeading = createAccessibleHeading({ + calendarNode: this.opts.ref.current, + label: this.fullCalendarLabel, + accessibleHeadingId: this.accessibleHeadingId + }); + return removeHeading; + }); + } + #setupFormatterEffect() { + user_pre_effect(() => { + if (strict_equals(this.formatter.getLocale(), this.opts.locale.current)) return; + this.formatter.setLocale(this.opts.locale.current); + }); + } + /** + * Navigates to the next page of the calendar. + */ + nextPage() { + handleCalendarNextPage({ + fixedWeeks: this.opts.fixedWeeks.current, + locale: this.opts.locale.current, + numberOfMonths: this.opts.numberOfMonths.current, + pagedNavigation: this.opts.pagedNavigation.current, + setMonths: this.setMonths, + setPlaceholder: (date) => this.opts.placeholder.current = date, + weekStartsOn: this.opts.weekStartsOn.current, + months: this.months + }); + } + /** + * Navigates to the previous page of the calendar. + */ + prevPage() { + handleCalendarPrevPage({ + fixedWeeks: this.opts.fixedWeeks.current, + locale: this.opts.locale.current, + numberOfMonths: this.opts.numberOfMonths.current, + pagedNavigation: this.opts.pagedNavigation.current, + setMonths: this.setMonths, + setPlaceholder: (date) => this.opts.placeholder.current = date, + weekStartsOn: this.opts.weekStartsOn.current, + months: this.months + }); + } + nextYear() { + this.opts.placeholder.current = this.opts.placeholder.current.add({ years: 1 }); + } + prevYear() { + this.opts.placeholder.current = this.opts.placeholder.current.subtract({ years: 1 }); + } + setYear(year) { + this.opts.placeholder.current = this.opts.placeholder.current.set({ year }); + } + setMonth(month) { + this.opts.placeholder.current = this.opts.placeholder.current.set({ month }); + } + #isNextButtonDisabled = tag( + user_derived(() => { + return getIsNextButtonDisabled({ + maxValue: this.opts.maxValue.current, + months: this.months, + disabled: this.opts.disabled.current + }); + }), + "CalendarRootState.isNextButtonDisabled" + ); + get isNextButtonDisabled() { + return get(this.#isNextButtonDisabled); + } + set isNextButtonDisabled(value) { + set(this.#isNextButtonDisabled, value); + } + #isPrevButtonDisabled = tag( + user_derived(() => { + return getIsPrevButtonDisabled({ + minValue: this.opts.minValue.current, + months: this.months, + disabled: this.opts.disabled.current + }); + }), + "CalendarRootState.isPrevButtonDisabled" + ); + get isPrevButtonDisabled() { + return get(this.#isPrevButtonDisabled); + } + set isPrevButtonDisabled(value) { + set(this.#isPrevButtonDisabled, value); + } + #isInvalid = tag( + user_derived(() => { + const value = this.opts.value.current; + const isDateDisabled = this.opts.isDateDisabled.current; + const isDateUnavailable = this.opts.isDateUnavailable.current; + if (Array.isArray(value)) { + if (!value.length) return false; + for (const date of value) { + if (isDateDisabled(date)) return true; + if (isDateUnavailable(date)) return true; + } + } else { + if (!value) return false; + if (isDateDisabled(value)) return true; + if (isDateUnavailable(value)) return true; + } + return false; + }), + "CalendarRootState.isInvalid" + ); + get isInvalid() { + return get(this.#isInvalid); + } + set isInvalid(value) { + set(this.#isInvalid, value); + } + #headingValue = tag( + user_derived(() => { + this.opts.monthFormat.current; + this.opts.yearFormat.current; + return getCalendarHeadingValue({ + months: this.months, + formatter: this.formatter, + locale: this.opts.locale.current + }); + }), + "CalendarRootState.headingValue" + ); + get headingValue() { + return get(this.#headingValue); + } + set headingValue(value) { + set(this.#headingValue, value); + } + #fullCalendarLabel = tag( + user_derived(() => { + return `${this.opts.calendarLabel.current} ${this.headingValue}`; + }), + "CalendarRootState.fullCalendarLabel" + ); + get fullCalendarLabel() { + return get(this.#fullCalendarLabel); + } + set fullCalendarLabel(value) { + set(this.#fullCalendarLabel, value); + } + isOutsideVisibleMonths(date) { + return !this.visibleMonths.some((month) => $14e0f24ef4ac5c92$export$a18c89cbd24170ff(date, month)); + } + isDateDisabled(date) { + if (this.opts.isDateDisabled.current(date) || this.opts.disabled.current) return true; + const minValue = this.opts.minValue.current; + const maxValue = this.opts.maxValue.current; + if (minValue && isBefore(date, minValue)) return true; + if (maxValue && isBefore(maxValue, date)) return true; + return false; + } + isDateSelected(date) { + const value = this.opts.value.current; + if (Array.isArray(value)) { + return value.some((d) => $14e0f24ef4ac5c92$export$ea39ec197993aef0(d, date)); + } else if (!value) { + return false; + } + return $14e0f24ef4ac5c92$export$ea39ec197993aef0(value, date); + } + shiftFocus(node, add) { + return shiftCalendarFocus({ + node, + add, + placeholder: this.opts.placeholder, + calendarNode: this.opts.ref.current, + isPrevButtonDisabled: this.isPrevButtonDisabled, + isNextButtonDisabled: this.isNextButtonDisabled, + months: this.months, + numberOfMonths: this.opts.numberOfMonths.current + }); + } + #isMultipleSelectionValid(selectedDates) { + if (strict_equals(this.opts.type.current, "multiple", false)) return true; + if (!this.opts.maxDays.current) return true; + const selectedCount = selectedDates.length; + if (this.opts.maxDays.current && selectedCount > this.opts.maxDays.current) return false; + return true; + } + handleCellClick(_, date) { + if (this.opts.readonly.current || this.opts.isDateDisabled.current?.(date) || this.opts.isDateUnavailable.current?.(date)) { + return; + } + const prev2 = this.opts.value.current; + const multiple = strict_equals(this.opts.type.current, "multiple"); + if (multiple) { + if (Array.isArray(prev2) || strict_equals(prev2, void 0)) { + this.opts.value.current = this.handleMultipleUpdate(prev2, date); + } + } else if (!Array.isArray(prev2)) { + const next3 = this.handleSingleUpdate(prev2, date); + if (!next3) { + this.announcer.announce("Selected date is now empty.", "polite", 5e3); + } else { + this.announcer.announce(`Selected Date: ${this.formatter.selectedDate(next3, false)}`, "polite"); + } + this.opts.value.current = getDateWithPreviousTime(next3, prev2); + if (strict_equals(next3, void 0, false)) { + this.opts.onDateSelect?.current?.(); + } + } + } + handleMultipleUpdate(prev2, date) { + if (!prev2) { + const newSelection = [date]; + return this.#isMultipleSelectionValid(newSelection) ? newSelection : [date]; + } + if (!Array.isArray(prev2)) { + if (true_default) throw new Error("Invalid value for multiple prop."); + return; + } + const index = prev2.findIndex((d) => $14e0f24ef4ac5c92$export$ea39ec197993aef0(d, date)); + const preventDeselect = this.opts.preventDeselect.current; + if (strict_equals(index, -1)) { + const newSelection = [...prev2, date]; + if (this.#isMultipleSelectionValid(newSelection)) { + return newSelection; + } else { + return [date]; + } + } else if (preventDeselect) { + return prev2; + } else { + const next3 = prev2.filter((d) => !$14e0f24ef4ac5c92$export$ea39ec197993aef0(d, date)); + if (!next3.length) { + this.opts.placeholder.current = date; + return void 0; + } + return next3; + } + } + handleSingleUpdate(prev2, date) { + if (Array.isArray(prev2)) { + if (true_default) throw new Error("Invalid value for single prop."); + } + if (!prev2) return date; + const preventDeselect = this.opts.preventDeselect.current; + if (!preventDeselect && $14e0f24ef4ac5c92$export$ea39ec197993aef0(prev2, date)) { + this.opts.placeholder.current = date; + return void 0; + } + return date; + } + onkeydown(event) { + handleCalendarKeydown({ + event, + handleCellClick: this.handleCellClick, + shiftFocus: this.shiftFocus, + placeholderValue: this.opts.placeholder.current + }); + } + #snippetProps = tag(user_derived(() => ({ months: this.months, weekdays: this.weekdays })), "CalendarRootState.snippetProps"); + get snippetProps() { + return get(this.#snippetProps); + } + set snippetProps(value) { + set(this.#snippetProps, value); + } + getBitsAttr = (part) => { + return calendarAttrs.getAttr(part); + }; + #props = tag( + user_derived(() => ({ + ...getCalendarElementProps({ + fullCalendarLabel: this.fullCalendarLabel, + id: this.opts.id.current, + isInvalid: this.isInvalid, + disabled: this.opts.disabled.current, + readonly: this.opts.readonly.current + }), + [this.getBitsAttr("root")]: "", + // + onkeydown: this.onkeydown, + ...this.attachment + })), + "CalendarRootState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var CalendarHeadingState = class _CalendarHeadingState { + static create(opts) { + return new _CalendarHeadingState(opts, CalendarRootContext.get()); + } + opts; + root; + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.attachment = attachRef(this.opts.ref); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + "aria-hidden": boolToStrTrueOrUndef(true), + "data-disabled": boolToEmptyStrOrUndef(this.root.opts.disabled.current), + "data-readonly": boolToEmptyStrOrUndef(this.root.opts.readonly.current), + [this.root.getBitsAttr("heading")]: "", + ...this.attachment + })), + "CalendarHeadingState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var CalendarCellContext = new Context("Calendar.Cell | RangeCalendar.Cell"); +var CalendarCellState = class _CalendarCellState { + static create(opts) { + return CalendarCellContext.set(new _CalendarCellState(opts, CalendarRootContext.get())); + } + opts; + root; + #cellDate = tag(user_derived(() => toDate(this.opts.date.current)), "CalendarCellState.cellDate"); + get cellDate() { + return get(this.#cellDate); + } + set cellDate(value) { + set(this.#cellDate, value); + } + #isUnavailable = tag(user_derived(() => this.root.opts.isDateUnavailable.current(this.opts.date.current)), "CalendarCellState.isUnavailable"); + get isUnavailable() { + return get(this.#isUnavailable); + } + set isUnavailable(value) { + set(this.#isUnavailable, value); + } + #isDateToday = tag(user_derived(() => $14e0f24ef4ac5c92$export$629b0a497aa65267(this.opts.date.current, $14e0f24ef4ac5c92$export$aa8b41735afcabd2())), "CalendarCellState.isDateToday"); + get isDateToday() { + return get(this.#isDateToday); + } + set isDateToday(value) { + set(this.#isDateToday, value); + } + #isOutsideMonth = tag(user_derived(() => !$14e0f24ef4ac5c92$export$a18c89cbd24170ff(this.opts.date.current, this.opts.month.current)), "CalendarCellState.isOutsideMonth"); + get isOutsideMonth() { + return get(this.#isOutsideMonth); + } + set isOutsideMonth(value) { + set(this.#isOutsideMonth, value); + } + #isOutsideVisibleMonths = tag(user_derived(() => this.root.isOutsideVisibleMonths(this.opts.date.current)), "CalendarCellState.isOutsideVisibleMonths"); + get isOutsideVisibleMonths() { + return get(this.#isOutsideVisibleMonths); + } + set isOutsideVisibleMonths(value) { + set(this.#isOutsideVisibleMonths, value); + } + #isDisabled = tag(user_derived(() => this.root.isDateDisabled(this.opts.date.current) || this.isOutsideMonth && this.root.opts.disableDaysOutsideMonth.current), "CalendarCellState.isDisabled"); + get isDisabled() { + return get(this.#isDisabled); + } + set isDisabled(value) { + set(this.#isDisabled, value); + } + #isFocusedDate = tag(user_derived(() => $14e0f24ef4ac5c92$export$ea39ec197993aef0(this.opts.date.current, this.root.opts.placeholder.current)), "CalendarCellState.isFocusedDate"); + get isFocusedDate() { + return get(this.#isFocusedDate); + } + set isFocusedDate(value) { + set(this.#isFocusedDate, value); + } + #isSelectedDate = tag(user_derived(() => this.root.isDateSelected(this.opts.date.current)), "CalendarCellState.isSelectedDate"); + get isSelectedDate() { + return get(this.#isSelectedDate); + } + set isSelectedDate(value) { + set(this.#isSelectedDate, value); + } + #labelText = tag( + user_derived(() => this.root.formatter.custom(this.cellDate, { + weekday: "long", + month: "long", + day: "numeric", + year: "numeric" + })), + "CalendarCellState.labelText" + ); + get labelText() { + return get(this.#labelText); + } + set labelText(value) { + set(this.#labelText, value); + } + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.attachment = attachRef(this.opts.ref); + } + #snippetProps = tag( + user_derived(() => ({ + disabled: this.isDisabled, + unavailable: this.isUnavailable, + selected: this.isSelectedDate, + day: `${this.opts.date.current.day}` + })), + "CalendarCellState.snippetProps" + ); + get snippetProps() { + return get(this.#snippetProps); + } + set snippetProps(value) { + set(this.#snippetProps, value); + } + #ariaDisabled = tag( + user_derived(() => { + return this.isDisabled || this.isOutsideMonth && this.root.opts.disableDaysOutsideMonth.current || this.isUnavailable; + }), + "CalendarCellState.ariaDisabled" + ); + get ariaDisabled() { + return get(this.#ariaDisabled); + } + set ariaDisabled(value) { + set(this.#ariaDisabled, value); + } + #sharedDataAttrs = tag( + user_derived(() => ({ + "data-unavailable": boolToEmptyStrOrUndef(this.isUnavailable), + "data-today": this.isDateToday ? "" : void 0, + "data-outside-month": this.isOutsideMonth ? "" : void 0, + "data-outside-visible-months": this.isOutsideVisibleMonths ? "" : void 0, + "data-focused": this.isFocusedDate ? "" : void 0, + "data-selected": boolToEmptyStrOrUndef(this.isSelectedDate), + "data-value": this.opts.date.current.toString(), + "data-type": getDateValueType(this.opts.date.current), + "data-disabled": boolToEmptyStrOrUndef(this.isDisabled || this.isOutsideMonth && this.root.opts.disableDaysOutsideMonth.current) + })), + "CalendarCellState.sharedDataAttrs" + ); + get sharedDataAttrs() { + return get(this.#sharedDataAttrs); + } + set sharedDataAttrs(value) { + set(this.#sharedDataAttrs, value); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + role: "gridcell", + "aria-selected": boolToStr(this.isSelectedDate), + "aria-disabled": boolToStr(this.ariaDisabled), + ...this.sharedDataAttrs, + [this.root.getBitsAttr("cell")]: "", + ...this.attachment + })), + "CalendarCellState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var CalendarDayState = class _CalendarDayState { + static create(opts) { + return new _CalendarDayState(opts, CalendarCellContext.get()); + } + opts; + cell; + attachment; + constructor(opts, cell) { + this.opts = opts; + this.cell = cell; + this.onclick = this.onclick.bind(this); + this.attachment = attachRef(this.opts.ref); + } + #tabindex = tag(user_derived(() => this.cell.isOutsideMonth && this.cell.root.opts.disableDaysOutsideMonth.current || this.cell.isDisabled ? void 0 : this.cell.isFocusedDate ? 0 : -1), "CalendarDayState.#tabindex"); + onclick(e) { + if (this.cell.isDisabled) return; + this.cell.root.handleCellClick(e, this.cell.opts.date.current); + } + #snippetProps = tag( + user_derived(() => ({ + disabled: this.cell.isDisabled, + unavailable: this.cell.isUnavailable, + selected: this.cell.isSelectedDate, + day: `${this.cell.opts.date.current.day}` + })), + "CalendarDayState.snippetProps" + ); + get snippetProps() { + return get(this.#snippetProps); + } + set snippetProps(value) { + set(this.#snippetProps, value); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + role: "button", + "aria-label": this.cell.labelText, + "aria-disabled": boolToStr(this.cell.ariaDisabled), + ...this.cell.sharedDataAttrs, + tabindex: get(this.#tabindex), + [this.cell.root.getBitsAttr("day")]: "", + "data-bits-day": "", + onclick: this.onclick, + ...this.attachment + })), + "CalendarDayState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var CalendarNextButtonState = class _CalendarNextButtonState { + static create(opts) { + return new _CalendarNextButtonState(opts, CalendarRootContext.get()); + } + opts; + root; + #isDisabled = tag(user_derived(() => this.root.isNextButtonDisabled), "CalendarNextButtonState.isDisabled"); + get isDisabled() { + return get(this.#isDisabled); + } + set isDisabled(value) { + set(this.#isDisabled, value); + } + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.onclick = this.onclick.bind(this); + this.attachment = attachRef(this.opts.ref); + } + onclick(_) { + if (this.isDisabled) return; + this.root.nextPage(); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + role: "button", + type: "button", + "aria-label": "Next", + "aria-disabled": boolToStr(this.isDisabled), + "data-disabled": boolToEmptyStrOrUndef(this.isDisabled), + disabled: this.isDisabled, + [this.root.getBitsAttr("next-button")]: "", + // + onclick: this.onclick, + ...this.attachment + })), + "CalendarNextButtonState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var CalendarPrevButtonState = class _CalendarPrevButtonState { + static create(opts) { + return new _CalendarPrevButtonState(opts, CalendarRootContext.get()); + } + opts; + root; + #isDisabled = tag(user_derived(() => this.root.isPrevButtonDisabled), "CalendarPrevButtonState.isDisabled"); + get isDisabled() { + return get(this.#isDisabled); + } + set isDisabled(value) { + set(this.#isDisabled, value); + } + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.onclick = this.onclick.bind(this); + this.attachment = attachRef(this.opts.ref); + } + onclick(_) { + if (this.isDisabled) return; + this.root.prevPage(); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + role: "button", + type: "button", + "aria-label": "Previous", + "aria-disabled": boolToStr(this.isDisabled), + "data-disabled": boolToEmptyStrOrUndef(this.isDisabled), + disabled: this.isDisabled, + [this.root.getBitsAttr("prev-button")]: "", + // + onclick: this.onclick, + ...this.attachment + })), + "CalendarPrevButtonState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var CalendarGridState = class _CalendarGridState { + static create(opts) { + return new _CalendarGridState(opts, CalendarRootContext.get()); + } + opts; + root; + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.attachment = attachRef(this.opts.ref); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + tabindex: -1, + role: "grid", + "aria-readonly": boolToStr(this.root.opts.readonly.current), + "aria-disabled": boolToStr(this.root.opts.disabled.current), + "data-readonly": boolToEmptyStrOrUndef(this.root.opts.readonly.current), + "data-disabled": boolToEmptyStrOrUndef(this.root.opts.disabled.current), + [this.root.getBitsAttr("grid")]: "", + ...this.attachment + })), + "CalendarGridState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var CalendarGridBodyState = class _CalendarGridBodyState { + static create(opts) { + return new _CalendarGridBodyState(opts, CalendarRootContext.get()); + } + opts; + root; + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.attachment = attachRef(this.opts.ref); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + "data-disabled": boolToEmptyStrOrUndef(this.root.opts.disabled.current), + "data-readonly": boolToEmptyStrOrUndef(this.root.opts.readonly.current), + [this.root.getBitsAttr("grid-body")]: "", + ...this.attachment + })), + "CalendarGridBodyState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var CalendarGridHeadState = class _CalendarGridHeadState { + static create(opts) { + return new _CalendarGridHeadState(opts, CalendarRootContext.get()); + } + opts; + root; + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.attachment = attachRef(this.opts.ref); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + "data-disabled": boolToEmptyStrOrUndef(this.root.opts.disabled.current), + "data-readonly": boolToEmptyStrOrUndef(this.root.opts.readonly.current), + [this.root.getBitsAttr("grid-head")]: "", + ...this.attachment + })), + "CalendarGridHeadState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var CalendarGridRowState = class _CalendarGridRowState { + static create(opts) { + return new _CalendarGridRowState(opts, CalendarRootContext.get()); + } + opts; + root; + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.attachment = attachRef(this.opts.ref); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + "data-disabled": boolToEmptyStrOrUndef(this.root.opts.disabled.current), + "data-readonly": boolToEmptyStrOrUndef(this.root.opts.readonly.current), + [this.root.getBitsAttr("grid-row")]: "", + ...this.attachment + })), + "CalendarGridRowState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var CalendarHeadCellState = class _CalendarHeadCellState { + static create(opts) { + return new _CalendarHeadCellState(opts, CalendarRootContext.get()); + } + opts; + root; + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.attachment = attachRef(this.opts.ref); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + "data-disabled": boolToEmptyStrOrUndef(this.root.opts.disabled.current), + "data-readonly": boolToEmptyStrOrUndef(this.root.opts.readonly.current), + [this.root.getBitsAttr("head-cell")]: "", + ...this.attachment + })), + "CalendarHeadCellState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var CalendarHeaderState = class _CalendarHeaderState { + static create(opts) { + return new _CalendarHeaderState(opts, CalendarRootContext.get()); + } + opts; + root; + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.attachment = attachRef(this.opts.ref); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + "data-disabled": boolToEmptyStrOrUndef(this.root.opts.disabled.current), + "data-readonly": boolToEmptyStrOrUndef(this.root.opts.readonly.current), + [this.root.getBitsAttr("header")]: "", + ...this.attachment + })), + "CalendarHeaderState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var CalendarMonthSelectState = class _CalendarMonthSelectState { + static create(opts) { + return new _CalendarMonthSelectState(opts, CalendarRootContext.get()); + } + opts; + root; + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.onchange = this.onchange.bind(this); + this.attachment = attachRef(this.opts.ref); + } + #monthItems = tag( + user_derived(() => { + this.root.opts.locale.current; + const monthNumbers = this.opts.months.current; + const monthFormat = this.opts.monthFormat.current; + const months = []; + for (const month of monthNumbers) { + const date = this.root.opts.placeholder.current.set({ month }); + let label; + if (strict_equals(typeof monthFormat, "function")) { + label = monthFormat(month); + } else { + label = this.root.formatter.custom(toDate(date), { month: monthFormat }); + } + months.push({ value: month, label }); + } + return months; + }), + "CalendarMonthSelectState.monthItems" + ); + get monthItems() { + return get(this.#monthItems); + } + set monthItems(value) { + set(this.#monthItems, value); + } + #currentMonth = tag(user_derived(() => this.root.opts.placeholder.current.month), "CalendarMonthSelectState.currentMonth"); + get currentMonth() { + return get(this.#currentMonth); + } + set currentMonth(value) { + set(this.#currentMonth, value); + } + #isDisabled = tag(user_derived(() => this.root.opts.disabled.current || this.opts.disabled.current), "CalendarMonthSelectState.isDisabled"); + get isDisabled() { + return get(this.#isDisabled); + } + set isDisabled(value) { + set(this.#isDisabled, value); + } + #snippetProps = tag( + user_derived(() => { + return { + monthItems: this.monthItems, + selectedMonthItem: this.monthItems.find((month) => strict_equals(month.value, this.currentMonth)) + }; + }), + "CalendarMonthSelectState.snippetProps" + ); + get snippetProps() { + return get(this.#snippetProps); + } + set snippetProps(value) { + set(this.#snippetProps, value); + } + onchange(event) { + if (this.isDisabled) return; + const target = event.target; + const month = parseInt(target.value, 10); + if (!isNaN(month)) { + this.root.opts.placeholder.current = this.root.opts.placeholder.current.set({ month }); + } + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + value: this.currentMonth, + disabled: this.isDisabled, + "data-disabled": boolToEmptyStrOrUndef(this.isDisabled), + [this.root.getBitsAttr("month-select")]: "", + // + onchange: this.onchange, + ...this.attachment + })), + "CalendarMonthSelectState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var CalendarYearSelectState = class _CalendarYearSelectState { + static create(opts) { + return new _CalendarYearSelectState(opts, CalendarRootContext.get()); + } + opts; + root; + attachment; + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.onchange = this.onchange.bind(this); + this.attachment = attachRef(this.opts.ref); + } + #years = tag( + user_derived(() => { + if (this.opts.years.current && this.opts.years.current.length) return this.opts.years.current; + return this.root.defaultYears; + }), + "CalendarYearSelectState.years" + ); + get years() { + return get(this.#years); + } + set years(value) { + set(this.#years, value); + } + #yearItems = tag( + user_derived(() => { + this.root.opts.locale.current; + const yearFormat = this.opts.yearFormat.current; + const localYears = []; + for (const year of this.years) { + const date = this.root.opts.placeholder.current.set({ year }); + let label; + if (strict_equals(typeof yearFormat, "function")) { + label = yearFormat(year); + } else { + label = this.root.formatter.custom(toDate(date), { year: yearFormat }); + } + localYears.push({ value: year, label }); + } + return localYears; + }), + "CalendarYearSelectState.yearItems" + ); + get yearItems() { + return get(this.#yearItems); + } + set yearItems(value) { + set(this.#yearItems, value); + } + #currentYear = tag(user_derived(() => this.root.opts.placeholder.current.year), "CalendarYearSelectState.currentYear"); + get currentYear() { + return get(this.#currentYear); + } + set currentYear(value) { + set(this.#currentYear, value); + } + #isDisabled = tag(user_derived(() => this.root.opts.disabled.current || this.opts.disabled.current), "CalendarYearSelectState.isDisabled"); + get isDisabled() { + return get(this.#isDisabled); + } + set isDisabled(value) { + set(this.#isDisabled, value); + } + #snippetProps = tag( + user_derived(() => { + return { + yearItems: this.yearItems, + selectedYearItem: this.yearItems.find((year) => strict_equals(year.value, this.currentYear)) + }; + }), + "CalendarYearSelectState.snippetProps" + ); + get snippetProps() { + return get(this.#snippetProps); + } + set snippetProps(value) { + set(this.#snippetProps, value); + } + onchange(event) { + if (this.isDisabled) return; + const target = event.target; + const year = parseInt(target.value, 10); + if (!isNaN(year)) { + this.root.opts.placeholder.current = this.root.opts.placeholder.current.set({ year }); + } + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + value: this.currentYear, + disabled: this.isDisabled, + "data-disabled": boolToEmptyStrOrUndef(this.isDisabled), + [this.root.getBitsAttr("year-select")]: "", + // + onchange: this.onchange, + ...this.attachment + })), + "CalendarYearSelectState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; + +// node_modules/bits-ui/dist/bits/calendar/components/calendar.svelte +Calendar[FILENAME] = "node_modules/bits-ui/dist/bits/calendar/components/calendar.svelte"; +var root_215 = add_locations(from_html(`
`), Calendar[FILENAME], [[130, 1]]); +function Calendar($$anchor, $$props) { + check_target(new.target); + push($$props, true, Calendar); + let id = prop($$props, "id", 19, useId), ref = prop($$props, "ref", 15, null), value = prop($$props, "value", 15), onValueChange = prop($$props, "onValueChange", 3, noop3), placeholder = prop($$props, "placeholder", 15), onPlaceholderChange = prop($$props, "onPlaceholderChange", 3, noop3), weekdayFormat = prop($$props, "weekdayFormat", 3, "narrow"), pagedNavigation = prop($$props, "pagedNavigation", 3, false), isDateDisabled = prop($$props, "isDateDisabled", 3, () => false), isDateUnavailable = prop($$props, "isDateUnavailable", 3, () => false), fixedWeeks = prop($$props, "fixedWeeks", 3, false), numberOfMonths = prop($$props, "numberOfMonths", 3, 1), calendarLabel = prop($$props, "calendarLabel", 3, "Event"), disabled = prop($$props, "disabled", 3, false), readonly = prop($$props, "readonly", 3, false), minValue = prop($$props, "minValue", 3, void 0), maxValue = prop($$props, "maxValue", 3, void 0), preventDeselect = prop($$props, "preventDeselect", 3, false), disableDaysOutsideMonth = prop($$props, "disableDaysOutsideMonth", 3, true), initialFocus = prop($$props, "initialFocus", 3, false), monthFormat = prop($$props, "monthFormat", 3, "long"), yearFormat = prop($$props, "yearFormat", 3, "numeric"), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "child", + "children", + "id", + "ref", + "value", + "onValueChange", + "placeholder", + "onPlaceholderChange", + "weekdayFormat", + "weekStartsOn", + "pagedNavigation", + "isDateDisabled", + "isDateUnavailable", + "fixedWeeks", + "numberOfMonths", + "locale", + "calendarLabel", + "disabled", + "readonly", + "minValue", + "maxValue", + "preventDeselect", + "type", + "disableDaysOutsideMonth", + "initialFocus", + "maxDays", + "monthFormat", + "yearFormat" + ], + "restProps" + ); + const defaultPlaceholder = getDefaultDate({ + defaultValue: value(), + minValue: minValue(), + maxValue: maxValue() + }); + function handleDefaultPlaceholder() { + if (strict_equals(placeholder(), void 0, false)) return; + placeholder(defaultPlaceholder); + } + handleDefaultPlaceholder(); + watch.pre(() => placeholder(), () => { + handleDefaultPlaceholder(); + }); + function handleDefaultValue() { + if (strict_equals(value(), void 0, false)) return; + value(strict_equals($$props.type, "single") ? void 0 : []); + } + handleDefaultValue(); + watch.pre(() => value(), () => { + handleDefaultValue(); + }); + const rootState = CalendarRootState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)), + weekdayFormat: boxWith(() => weekdayFormat()), + weekStartsOn: boxWith(() => $$props.weekStartsOn), + pagedNavigation: boxWith(() => pagedNavigation()), + isDateDisabled: boxWith(() => isDateDisabled()), + isDateUnavailable: boxWith(() => isDateUnavailable()), + fixedWeeks: boxWith(() => fixedWeeks()), + numberOfMonths: boxWith(() => numberOfMonths()), + locale: resolveLocaleProp(() => $$props.locale), + calendarLabel: boxWith(() => calendarLabel()), + readonly: boxWith(() => readonly()), + disabled: boxWith(() => disabled()), + minValue: boxWith(() => minValue()), + maxValue: boxWith(() => maxValue()), + disableDaysOutsideMonth: boxWith(() => disableDaysOutsideMonth()), + initialFocus: boxWith(() => initialFocus()), + maxDays: boxWith(() => $$props.maxDays), + placeholder: boxWith(() => placeholder(), (v) => { + placeholder(v); + onPlaceholderChange()(v); + }), + preventDeselect: boxWith(() => preventDeselect()), + value: boxWith(() => value(), (v) => { + value(v); + onValueChange()(v); + }), + type: boxWith(() => $$props.type), + monthFormat: boxWith(() => monthFormat()), + yearFormat: boxWith(() => yearFormat()), + defaultPlaceholder + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, rootState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + { + let $0 = user_derived(() => ({ props: get(mergedProps), ...rootState.snippetProps })); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => get($0)), "render", Calendar, 128, 1); + } + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var div = root_215(); + attribute_effect(div, () => ({ ...get(mergedProps) })); + var node_2 = child(div); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop, () => rootState.snippetProps), "render", Calendar, 131, 2); + reset(div); + append($$anchor2, div); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Calendar, + 127, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Calendar = hmr(Calendar, () => Calendar[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Calendar[HMR].source; + set(Calendar[HMR].source, module.default[HMR].original); + }); +} +var calendar_default = Calendar; + +// node_modules/bits-ui/dist/bits/calendar/components/calendar-day.svelte +Calendar_day[FILENAME] = "node_modules/bits-ui/dist/bits/calendar/components/calendar-day.svelte"; +var root_216 = add_locations(from_html(`
`), Calendar_day[FILENAME], [[34, 1]]); +function Calendar_day($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Calendar_day); + let ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 19, () => createId(uid)), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "children", + "child", + "ref", + "id" + ], + "restProps" + ); + const dayState = CalendarDayState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, dayState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + { + let $0 = user_derived(() => ({ props: get(mergedProps), ...dayState.snippetProps })); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => get($0)), "render", Calendar_day, 29, 1); + } + append($$anchor2, fragment_1); + }; + var alternate_1 = ($$anchor2) => { + var div = root_216(); + attribute_effect(div, () => ({ ...get(mergedProps) })); + var node_2 = child(div); + { + var consequent_1 = ($$anchor3) => { + var fragment_2 = comment(); + var node_3 = first_child(fragment_2); + add_svelte_meta(() => snippet(node_3, () => $$props.children ?? noop, () => dayState.snippetProps), "render", Calendar_day, 36, 3); + append($$anchor3, fragment_2); + }; + var alternate = ($$anchor3) => { + var text2 = text(); + template_effect(() => set_text(text2, dayState.cell.opts.date.current.day)); + append($$anchor3, text2); + }; + add_svelte_meta( + () => if_block(node_2, ($$render) => { + if ($$props.children) $$render(consequent_1); + else $$render(alternate, false); + }), + "if", + Calendar_day, + 35, + 2 + ); + } + reset(div); + append($$anchor2, div); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate_1, false); + }), + "if", + Calendar_day, + 28, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Calendar_day = hmr(Calendar_day, () => Calendar_day[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Calendar_day[HMR].source; + set(Calendar_day[HMR].source, module.default[HMR].original); + }); +} +var calendar_day_default = Calendar_day; + +// node_modules/bits-ui/dist/bits/calendar/components/calendar-grid.svelte +Calendar_grid[FILENAME] = "node_modules/bits-ui/dist/bits/calendar/components/calendar-grid.svelte"; +var root_217 = add_locations(from_html(`
`), Calendar_grid[FILENAME], [[31, 1]]); +function Calendar_grid($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Calendar_grid); + let ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 19, () => createId(uid)), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "children", + "child", + "ref", + "id" + ], + "restProps" + ); + const gridState = CalendarGridState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, gridState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Calendar_grid, 29, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var table = root_217(); + attribute_effect(table, () => ({ ...get(mergedProps) })); + var node_2 = child(table); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Calendar_grid, 32, 2); + reset(table); + append($$anchor2, table); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Calendar_grid, + 28, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Calendar_grid = hmr(Calendar_grid, () => Calendar_grid[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Calendar_grid[HMR].source; + set(Calendar_grid[HMR].source, module.default[HMR].original); + }); +} +var calendar_grid_default = Calendar_grid; + +// node_modules/bits-ui/dist/bits/calendar/components/calendar-grid-body.svelte +Calendar_grid_body[FILENAME] = "node_modules/bits-ui/dist/bits/calendar/components/calendar-grid-body.svelte"; +var root_218 = add_locations(from_html(``), Calendar_grid_body[FILENAME], [[31, 1]]); +function Calendar_grid_body($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Calendar_grid_body); + let ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 19, () => createId(uid)), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "children", + "child", + "ref", + "id" + ], + "restProps" + ); + const gridBodyState = CalendarGridBodyState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, gridBodyState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Calendar_grid_body, 29, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var tbody = root_218(); + attribute_effect(tbody, () => ({ ...get(mergedProps) })); + var node_2 = child(tbody); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Calendar_grid_body, 32, 2); + reset(tbody); + append($$anchor2, tbody); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Calendar_grid_body, + 28, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Calendar_grid_body = hmr(Calendar_grid_body, () => Calendar_grid_body[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Calendar_grid_body[HMR].source; + set(Calendar_grid_body[HMR].source, module.default[HMR].original); + }); +} +var calendar_grid_body_default = Calendar_grid_body; + +// node_modules/bits-ui/dist/bits/calendar/components/calendar-cell.svelte +Calendar_cell[FILENAME] = "node_modules/bits-ui/dist/bits/calendar/components/calendar-cell.svelte"; +var root_219 = add_locations(from_html(``), Calendar_cell[FILENAME], [[38, 1]]); +function Calendar_cell($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Calendar_cell); + let ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 19, () => createId(uid)), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "children", + "child", + "ref", + "id", + "date", + "month" + ], + "restProps" + ); + const cellState = CalendarCellState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)), + date: boxWith(() => $$props.date), + month: boxWith(() => $$props.month) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, cellState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + { + let $0 = user_derived(() => ({ props: get(mergedProps), ...cellState.snippetProps })); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => get($0)), "render", Calendar_cell, 33, 1); + } + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var td = root_219(); + attribute_effect(td, () => ({ ...get(mergedProps) })); + var node_2 = child(td); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop, () => cellState.snippetProps), "render", Calendar_cell, 39, 2); + reset(td); + append($$anchor2, td); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Calendar_cell, + 32, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Calendar_cell = hmr(Calendar_cell, () => Calendar_cell[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Calendar_cell[HMR].source; + set(Calendar_cell[HMR].source, module.default[HMR].original); + }); +} +var calendar_cell_default = Calendar_cell; + +// node_modules/bits-ui/dist/bits/calendar/components/calendar-grid-head.svelte +Calendar_grid_head[FILENAME] = "node_modules/bits-ui/dist/bits/calendar/components/calendar-grid-head.svelte"; +var root_220 = add_locations(from_html(``), Calendar_grid_head[FILENAME], [[31, 1]]); +function Calendar_grid_head($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Calendar_grid_head); + let ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 19, () => createId(uid)), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "children", + "child", + "ref", + "id" + ], + "restProps" + ); + const gridHeadState = CalendarGridHeadState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, gridHeadState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Calendar_grid_head, 29, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var thead = root_220(); + attribute_effect(thead, () => ({ ...get(mergedProps) })); + var node_2 = child(thead); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Calendar_grid_head, 32, 2); + reset(thead); + append($$anchor2, thead); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Calendar_grid_head, + 28, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Calendar_grid_head = hmr(Calendar_grid_head, () => Calendar_grid_head[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Calendar_grid_head[HMR].source; + set(Calendar_grid_head[HMR].source, module.default[HMR].original); + }); +} +var calendar_grid_head_default = Calendar_grid_head; + +// node_modules/bits-ui/dist/bits/calendar/components/calendar-head-cell.svelte +Calendar_head_cell[FILENAME] = "node_modules/bits-ui/dist/bits/calendar/components/calendar-head-cell.svelte"; +var root_221 = add_locations(from_html(``), Calendar_head_cell[FILENAME], [[31, 1]]); +function Calendar_head_cell($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Calendar_head_cell); + let ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 19, () => createId(uid)), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "children", + "child", + "ref", + "id" + ], + "restProps" + ); + const headCellState = CalendarHeadCellState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, headCellState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Calendar_head_cell, 29, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var th = root_221(); + attribute_effect(th, () => ({ ...get(mergedProps) })); + var node_2 = child(th); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Calendar_head_cell, 32, 2); + reset(th); + append($$anchor2, th); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Calendar_head_cell, + 28, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Calendar_head_cell = hmr(Calendar_head_cell, () => Calendar_head_cell[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Calendar_head_cell[HMR].source; + set(Calendar_head_cell[HMR].source, module.default[HMR].original); + }); +} +var calendar_head_cell_default = Calendar_head_cell; + +// node_modules/bits-ui/dist/bits/calendar/components/calendar-grid-row.svelte +Calendar_grid_row[FILENAME] = "node_modules/bits-ui/dist/bits/calendar/components/calendar-grid-row.svelte"; +var root_222 = add_locations(from_html(``), Calendar_grid_row[FILENAME], [[31, 1]]); +function Calendar_grid_row($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Calendar_grid_row); + let ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 19, () => createId(uid)), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "children", + "child", + "ref", + "id" + ], + "restProps" + ); + const gridRowState = CalendarGridRowState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, gridRowState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Calendar_grid_row, 29, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var tr = root_222(); + attribute_effect(tr, () => ({ ...get(mergedProps) })); + var node_2 = child(tr); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Calendar_grid_row, 32, 2); + reset(tr); + append($$anchor2, tr); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Calendar_grid_row, + 28, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Calendar_grid_row = hmr(Calendar_grid_row, () => Calendar_grid_row[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Calendar_grid_row[HMR].source; + set(Calendar_grid_row[HMR].source, module.default[HMR].original); + }); +} +var calendar_grid_row_default = Calendar_grid_row; + +// node_modules/bits-ui/dist/bits/calendar/components/calendar-header.svelte +Calendar_header[FILENAME] = "node_modules/bits-ui/dist/bits/calendar/components/calendar-header.svelte"; +var root_223 = add_locations(from_html(`
`), Calendar_header[FILENAME], [[31, 1]]); +function Calendar_header($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Calendar_header); + let ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 19, () => createId(uid)), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "children", + "child", + "ref", + "id" + ], + "restProps" + ); + const headerState = CalendarHeaderState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, headerState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Calendar_header, 29, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var header = root_223(); + attribute_effect(header, () => ({ ...get(mergedProps) })); + var node_2 = child(header); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Calendar_header, 32, 2); + reset(header); + append($$anchor2, header); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Calendar_header, + 28, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Calendar_header = hmr(Calendar_header, () => Calendar_header[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Calendar_header[HMR].source; + set(Calendar_header[HMR].source, module.default[HMR].original); + }); +} +var calendar_header_default = Calendar_header; + +// node_modules/bits-ui/dist/bits/calendar/components/calendar-heading.svelte +Calendar_heading[FILENAME] = "node_modules/bits-ui/dist/bits/calendar/components/calendar-heading.svelte"; +var root_224 = add_locations(from_html(`
`), Calendar_heading[FILENAME], [[31, 1]]); +function Calendar_heading($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Calendar_heading); + let ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 19, () => createId(uid)), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "children", + "child", + "ref", + "id" + ], + "restProps" + ); + const headingState = CalendarHeadingState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, headingState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta( + () => snippet(node_1, () => $$props.child, () => ({ + props: get(mergedProps), + headingValue: headingState.root.headingValue + })), + "render", + Calendar_heading, + 29, + 1 + ); + append($$anchor2, fragment_1); + }; + var alternate_1 = ($$anchor2) => { + var div = root_224(); + attribute_effect(div, () => ({ ...get(mergedProps) })); + var node_2 = child(div); + { + var consequent_1 = ($$anchor3) => { + var fragment_2 = comment(); + var node_3 = first_child(fragment_2); + add_svelte_meta(() => snippet(node_3, () => $$props.children ?? noop, () => ({ headingValue: headingState.root.headingValue })), "render", Calendar_heading, 33, 3); + append($$anchor3, fragment_2); + }; + var alternate = ($$anchor3) => { + var text2 = text(); + template_effect(() => set_text(text2, headingState.root.headingValue)); + append($$anchor3, text2); + }; + add_svelte_meta( + () => if_block(node_2, ($$render) => { + if ($$props.children) $$render(consequent_1); + else $$render(alternate, false); + }), + "if", + Calendar_heading, + 32, + 2 + ); + } + reset(div); + append($$anchor2, div); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate_1, false); + }), + "if", + Calendar_heading, + 28, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Calendar_heading = hmr(Calendar_heading, () => Calendar_heading[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Calendar_heading[HMR].source; + set(Calendar_heading[HMR].source, module.default[HMR].original); + }); +} +var calendar_heading_default = Calendar_heading; + +// node_modules/bits-ui/dist/bits/calendar/components/calendar-month-select.svelte +Calendar_month_select[FILENAME] = "node_modules/bits-ui/dist/bits/calendar/components/calendar-month-select.svelte"; +var root_5 = add_locations(from_html(``), Calendar_month_select[FILENAME], [[45, 4]]); +var root_225 = add_locations(from_html(``), Calendar_month_select[FILENAME], [[40, 1]]); +function Calendar_month_select($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Calendar_month_select); + let ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 19, () => createId(uid)), months = prop($$props, "months", 19, () => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]), monthFormat = prop($$props, "monthFormat", 3, "long"), disabled = prop($$props, "disabled", 3, false), ariaLabel = prop($$props, "aria-label", 3, "Select a month"), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "children", + "child", + "ref", + "id", + "months", + "monthFormat", + "disabled", + "aria-label" + ], + "restProps" + ); + const monthSelectState = CalendarMonthSelectState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)), + months: boxWith(() => months()), + monthFormat: boxWith(() => monthFormat()), + disabled: boxWith(() => Boolean(disabled())) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, monthSelectState.props, { "aria-label": ariaLabel() })), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + { + let $0 = user_derived(() => ({ props: get(mergedProps), ...monthSelectState.snippetProps })); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => get($0)), "render", Calendar_month_select, 38, 1); + } + append($$anchor2, fragment_1); + }; + var alternate_1 = ($$anchor2) => { + var select = root_225(); + attribute_effect(select, () => ({ ...get(mergedProps) })); + var node_2 = child(select); + { + var consequent_1 = ($$anchor3) => { + var fragment_2 = comment(); + var node_3 = first_child(fragment_2); + add_svelte_meta(() => snippet(node_3, () => $$props.children ?? noop, () => monthSelectState.snippetProps), "render", Calendar_month_select, 42, 3); + append($$anchor3, fragment_2); + }; + var alternate = ($$anchor3) => { + var fragment_3 = comment(); + var node_4 = first_child(fragment_3); + validate_each_keys(() => monthSelectState.monthItems, (month) => month.value); + add_svelte_meta( + () => each(node_4, 17, () => monthSelectState.monthItems, (month) => month.value, ($$anchor4, month) => { + var option = root_5(); + var text2 = child(option, true); + reset(option); + var option_value = {}; + template_effect(() => { + set_selected(option, strict_equals(get(month).value, monthSelectState.currentMonth)); + set_text(text2, get(month).label); + if (option_value !== (option_value = get(month).value)) { + option.value = (option.__value = get(month).value) ?? ""; + } + }); + append($$anchor4, option); + }), + "each", + Calendar_month_select, + 44, + 3 + ); + append($$anchor3, fragment_3); + }; + add_svelte_meta( + () => if_block(node_2, ($$render) => { + if ($$props.children) $$render(consequent_1); + else $$render(alternate, false); + }), + "if", + Calendar_month_select, + 41, + 2 + ); + } + reset(select); + append($$anchor2, select); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate_1, false); + }), + "if", + Calendar_month_select, + 37, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Calendar_month_select = hmr(Calendar_month_select, () => Calendar_month_select[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Calendar_month_select[HMR].source; + set(Calendar_month_select[HMR].source, module.default[HMR].original); + }); +} +var calendar_month_select_default = Calendar_month_select; + +// node_modules/bits-ui/dist/bits/calendar/components/calendar-next-button.svelte +Calendar_next_button[FILENAME] = "node_modules/bits-ui/dist/bits/calendar/components/calendar-next-button.svelte"; +var root_226 = add_locations(from_html(``), Calendar_next_button[FILENAME], [[33, 1]]); +function Calendar_next_button($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Calendar_next_button); + let id = prop($$props, "id", 19, () => createId(uid)), ref = prop($$props, "ref", 15, null), tabindex = prop($$props, "tabindex", 3, 0), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "children", + "child", + "id", + "ref", + "tabindex" + ], + "restProps" + ); + const nextButtonState = CalendarNextButtonState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, nextButtonState.props, { tabindex: tabindex() })), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Calendar_next_button, 31, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var button = root_226(); + attribute_effect(button, () => ({ ...get(mergedProps) })); + var node_2 = child(button); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Calendar_next_button, 34, 2); + reset(button); + append($$anchor2, button); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Calendar_next_button, + 30, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Calendar_next_button = hmr(Calendar_next_button, () => Calendar_next_button[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Calendar_next_button[HMR].source; + set(Calendar_next_button[HMR].source, module.default[HMR].original); + }); +} +var calendar_next_button_default = Calendar_next_button; + +// node_modules/bits-ui/dist/bits/calendar/components/calendar-prev-button.svelte +Calendar_prev_button[FILENAME] = "node_modules/bits-ui/dist/bits/calendar/components/calendar-prev-button.svelte"; +var root_227 = add_locations(from_html(``), Calendar_prev_button[FILENAME], [[33, 1]]); +function Calendar_prev_button($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Calendar_prev_button); + let id = prop($$props, "id", 19, () => createId(uid)), ref = prop($$props, "ref", 15, null), tabindex = prop($$props, "tabindex", 3, 0), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "children", + "child", + "id", + "ref", + "tabindex" + ], + "restProps" + ); + const prevButtonState = CalendarPrevButtonState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, prevButtonState.props, { tabindex: tabindex() })), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Calendar_prev_button, 31, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var button = root_227(); + attribute_effect(button, () => ({ ...get(mergedProps) })); + var node_2 = child(button); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Calendar_prev_button, 34, 2); + reset(button); + append($$anchor2, button); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Calendar_prev_button, + 30, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Calendar_prev_button = hmr(Calendar_prev_button, () => Calendar_prev_button[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Calendar_prev_button[HMR].source; + set(Calendar_prev_button[HMR].source, module.default[HMR].original); + }); +} +var calendar_prev_button_default = Calendar_prev_button; + +// node_modules/bits-ui/dist/bits/calendar/components/calendar-year-select.svelte +Calendar_year_select[FILENAME] = "node_modules/bits-ui/dist/bits/calendar/components/calendar-year-select.svelte"; +var root_52 = add_locations(from_html(``), Calendar_year_select[FILENAME], [[45, 4]]); +var root_228 = add_locations(from_html(``), Calendar_year_select[FILENAME], [[40, 1]]); +function Calendar_year_select($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Calendar_year_select); + let ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 19, () => createId(uid)), yearFormat = prop($$props, "yearFormat", 3, "numeric"), disabled = prop($$props, "disabled", 3, false), ariaLabel = prop($$props, "aria-label", 3, "Select a year"), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "children", + "child", + "ref", + "id", + "years", + "yearFormat", + "disabled", + "aria-label" + ], + "restProps" + ); + const yearSelectState = CalendarYearSelectState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)), + years: boxWith(() => $$props.years), + yearFormat: boxWith(() => yearFormat()), + disabled: boxWith(() => Boolean(disabled())) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, yearSelectState.props, { "aria-label": ariaLabel() })), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + { + let $0 = user_derived(() => ({ props: get(mergedProps), ...yearSelectState.snippetProps })); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => get($0)), "render", Calendar_year_select, 38, 1); + } + append($$anchor2, fragment_1); + }; + var alternate_1 = ($$anchor2) => { + var select = root_228(); + attribute_effect(select, () => ({ ...get(mergedProps) })); + var node_2 = child(select); + { + var consequent_1 = ($$anchor3) => { + var fragment_2 = comment(); + var node_3 = first_child(fragment_2); + add_svelte_meta(() => snippet(node_3, () => $$props.children ?? noop, () => yearSelectState.snippetProps), "render", Calendar_year_select, 42, 3); + append($$anchor3, fragment_2); + }; + var alternate = ($$anchor3) => { + var fragment_3 = comment(); + var node_4 = first_child(fragment_3); + validate_each_keys(() => yearSelectState.yearItems, (year) => year.value); + add_svelte_meta( + () => each(node_4, 17, () => yearSelectState.yearItems, (year) => year.value, ($$anchor4, year) => { + var option = root_52(); + var text2 = child(option, true); + reset(option); + var option_value = {}; + template_effect(() => { + set_selected(option, strict_equals(get(year).value, yearSelectState.currentYear)); + set_text(text2, get(year).label); + if (option_value !== (option_value = get(year).value)) { + option.value = (option.__value = get(year).value) ?? ""; + } + }); + append($$anchor4, option); + }), + "each", + Calendar_year_select, + 44, + 3 + ); + append($$anchor3, fragment_3); + }; + add_svelte_meta( + () => if_block(node_2, ($$render) => { + if ($$props.children) $$render(consequent_1); + else $$render(alternate, false); + }), + "if", + Calendar_year_select, + 41, + 2 + ); + } + reset(select); + append($$anchor2, select); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate_1, false); + }), + "if", + Calendar_year_select, + 37, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Calendar_year_select = hmr(Calendar_year_select, () => Calendar_year_select[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Calendar_year_select[HMR].source; + set(Calendar_year_select[HMR].source, module.default[HMR].original); + }); +} +var calendar_year_select_default = Calendar_year_select; + +// node_modules/bits-ui/dist/bits/checkbox/exports.js +var exports_exports7 = {}; +__export(exports_exports7, { + Group: () => checkbox_group_default, + GroupLabel: () => checkbox_group_label_default, + Root: () => checkbox_default +}); + +// node_modules/bits-ui/dist/bits/checkbox/checkbox.svelte.js +var checkboxAttrs = createBitsAttrs({ + component: "checkbox", + parts: ["root", "group", "group-label", "input"] +}); +var CheckboxGroupContext = new Context("Checkbox.Group"); +var CheckboxGroupState = class _CheckboxGroupState { + static create(opts) { + return CheckboxGroupContext.set(new _CheckboxGroupState(opts)); + } + opts; + attachment; + #labelId = tag(state(void 0), "CheckboxGroupState.labelId"); + get labelId() { + return get(this.#labelId); + } + set labelId(value) { + set(this.#labelId, value, true); + } + constructor(opts) { + this.opts = opts; + this.attachment = attachRef(this.opts.ref); + } + addValue(checkboxValue) { + if (!checkboxValue) return; + if (!this.opts.value.current.includes(checkboxValue)) { + const newValue = [...snapshot(this.opts.value.current), checkboxValue]; + this.opts.value.current = newValue; + if (arraysAreEqual(this.opts.value.current, newValue)) return; + this.opts.onValueChange.current(newValue); + } + } + removeValue(checkboxValue) { + if (!checkboxValue) return; + const index = this.opts.value.current.indexOf(checkboxValue); + if (strict_equals(index, -1)) return; + const newValue = this.opts.value.current.filter((v) => strict_equals(v, checkboxValue, false)); + this.opts.value.current = newValue; + if (arraysAreEqual(this.opts.value.current, newValue)) return; + this.opts.onValueChange.current(newValue); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + role: "group", + "aria-labelledby": this.labelId, + "data-disabled": boolToEmptyStrOrUndef(this.opts.disabled.current), + [checkboxAttrs.group]: "", + ...this.attachment + })), + "CheckboxGroupState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var CheckboxGroupLabelState = class _CheckboxGroupLabelState { + static create(opts) { + return new _CheckboxGroupLabelState(opts, CheckboxGroupContext.get()); + } + opts; + group; + attachment; + constructor(opts, group) { + this.opts = opts; + this.group = group; + this.group.labelId = this.opts.id.current; + this.attachment = attachRef(this.opts.ref); + watch.pre(() => this.opts.id.current, (id) => { + this.group.labelId = id; + }); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + "data-disabled": boolToEmptyStrOrUndef(this.group.opts.disabled.current), + [checkboxAttrs["group-label"]]: "", + ...this.attachment + })), + "CheckboxGroupLabelState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var CheckboxRootContext = new Context("Checkbox.Root"); +var CheckboxRootState = class _CheckboxRootState { + static create(opts, group = null) { + return CheckboxRootContext.set(new _CheckboxRootState(opts, group)); + } + opts; + group; + #trueName = tag( + user_derived(() => { + if (this.group && this.group.opts.name.current) return this.group.opts.name.current; + return this.opts.name.current; + }), + "CheckboxRootState.trueName" + ); + get trueName() { + return get(this.#trueName); + } + set trueName(value) { + set(this.#trueName, value); + } + #trueRequired = tag( + user_derived(() => { + if (this.group && this.group.opts.required.current) return true; + return this.opts.required.current; + }), + "CheckboxRootState.trueRequired" + ); + get trueRequired() { + return get(this.#trueRequired); + } + set trueRequired(value) { + set(this.#trueRequired, value); + } + #trueDisabled = tag( + user_derived(() => { + if (this.group && this.group.opts.disabled.current) return true; + return this.opts.disabled.current; + }), + "CheckboxRootState.trueDisabled" + ); + get trueDisabled() { + return get(this.#trueDisabled); + } + set trueDisabled(value) { + set(this.#trueDisabled, value); + } + #trueReadonly = tag( + user_derived(() => { + if (this.group && this.group.opts.readonly.current) return true; + return this.opts.readonly.current; + }), + "CheckboxRootState.trueReadonly" + ); + get trueReadonly() { + return get(this.#trueReadonly); + } + set trueReadonly(value) { + set(this.#trueReadonly, value); + } + attachment; + constructor(opts, group) { + this.opts = opts; + this.group = group; + this.attachment = attachRef(this.opts.ref); + this.onkeydown = this.onkeydown.bind(this); + this.onclick = this.onclick.bind(this); + watch.pre( + [ + () => snapshot(this.group?.opts.value.current), + () => this.opts.value.current + ], + ([groupValue, value]) => { + if (!groupValue || !value) return; + this.opts.checked.current = groupValue.includes(value); + } + ); + watch.pre(() => this.opts.checked.current, (checked) => { + if (!this.group) return; + if (checked) { + this.group?.addValue(this.opts.value.current); + } else { + this.group?.removeValue(this.opts.value.current); + } + }); + } + onkeydown(e) { + if (this.trueDisabled || this.trueReadonly) return; + if (strict_equals(e.key, kbd_constants_exports.ENTER)) e.preventDefault(); + if (strict_equals(e.key, kbd_constants_exports.SPACE)) { + e.preventDefault(); + this.#toggle(); + } + } + #toggle() { + if (this.opts.indeterminate.current) { + this.opts.indeterminate.current = false; + this.opts.checked.current = true; + } else { + this.opts.checked.current = !this.opts.checked.current; + } + } + onclick(e) { + if (this.trueDisabled || this.trueReadonly) return; + if (strict_equals(this.opts.type.current, "submit")) { + this.#toggle(); + return; + } + e.preventDefault(); + this.#toggle(); + } + #snippetProps = tag( + user_derived(() => ({ + checked: this.opts.checked.current, + indeterminate: this.opts.indeterminate.current + })), + "CheckboxRootState.snippetProps" + ); + get snippetProps() { + return get(this.#snippetProps); + } + set snippetProps(value) { + set(this.#snippetProps, value); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + role: "checkbox", + type: this.opts.type.current, + disabled: this.trueDisabled, + "aria-checked": getAriaChecked(this.opts.checked.current, this.opts.indeterminate.current), + "aria-required": boolToStr(this.trueRequired), + "aria-readonly": boolToStr(this.trueReadonly), + "data-disabled": boolToEmptyStrOrUndef(this.trueDisabled), + "data-readonly": boolToEmptyStrOrUndef(this.trueReadonly), + "data-state": getCheckboxDataState(this.opts.checked.current, this.opts.indeterminate.current), + [checkboxAttrs.root]: "", + onclick: this.onclick, + onkeydown: this.onkeydown, + ...this.attachment + })), + "CheckboxRootState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var CheckboxInputState = class _CheckboxInputState { + static create() { + return new _CheckboxInputState(CheckboxRootContext.get()); + } + root; + #trueChecked = tag( + user_derived(() => { + if (!this.root.group) return this.root.opts.checked.current; + if (strict_equals(this.root.opts.value.current, void 0, false) && this.root.group.opts.value.current.includes(this.root.opts.value.current)) { + return true; + } + return false; + }), + "CheckboxInputState.trueChecked" + ); + get trueChecked() { + return get(this.#trueChecked); + } + set trueChecked(value) { + set(this.#trueChecked, value); + } + #shouldRender = tag(user_derived(() => Boolean(this.root.trueName)), "CheckboxInputState.shouldRender"); + get shouldRender() { + return get(this.#shouldRender); + } + set shouldRender(value) { + set(this.#shouldRender, value); + } + constructor(root18) { + this.root = root18; + this.onfocus = this.onfocus.bind(this); + } + onfocus(_) { + if (!isHTMLElement2(this.root.opts.ref.current)) return; + this.root.opts.ref.current.focus(); + } + #props = tag( + user_derived(() => ({ + type: "checkbox", + checked: strict_equals(this.root.opts.checked.current, true), + disabled: this.root.trueDisabled, + required: this.root.trueRequired, + name: this.root.trueName, + value: this.root.opts.value.current, + readonly: this.root.trueReadonly, + onfocus: this.onfocus + })), + "CheckboxInputState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +function getCheckboxDataState(checked, indeterminate) { + if (indeterminate) return "indeterminate"; + return checked ? "checked" : "unchecked"; +} + +// node_modules/bits-ui/dist/bits/utilities/hidden-input.svelte +Hidden_input[FILENAME] = "node_modules/bits-ui/dist/bits/utilities/hidden-input.svelte"; +var root_1 = add_locations(from_html(``), Hidden_input[FILENAME], [[17, 1]]); +var root_229 = add_locations(from_html(``), Hidden_input[FILENAME], [[19, 1]]); +function Hidden_input($$anchor, $$props) { + check_target(new.target); + push($$props, true, Hidden_input); + let value = prop($$props, "value", 15), restProps = rest_props($$props, ["$$slots", "$$events", "$$legacy", "value"], "restProps"); + const mergedProps = tag( + user_derived(() => mergeProps(restProps, { + "aria-hidden": "true", + tabindex: -1, + style: srOnlyStylesString + })), + "mergedProps" + ); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var input = root_1(); + attribute_effect(input, () => ({ ...get(mergedProps), value: value() }), void 0, void 0, void 0, void 0, true); + append($$anchor2, input); + }; + var alternate = ($$anchor2) => { + var input_1 = root_229(); + attribute_effect(input_1, () => ({ ...get(mergedProps) }), void 0, void 0, void 0, void 0, true); + bind_value(input_1, value); + append($$anchor2, input_1); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if (strict_equals(get(mergedProps).type, "checkbox")) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Hidden_input, + 16, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Hidden_input = hmr(Hidden_input, () => Hidden_input[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Hidden_input[HMR].source; + set(Hidden_input[HMR].source, module.default[HMR].original); + }); +} +var hidden_input_default = Hidden_input; + +// node_modules/bits-ui/dist/bits/checkbox/components/checkbox-input.svelte +Checkbox_input[FILENAME] = "node_modules/bits-ui/dist/bits/checkbox/components/checkbox-input.svelte"; +function Checkbox_input($$anchor, $$props) { + check_target(new.target); + push($$props, false, Checkbox_input); + const inputState = CheckboxInputState.create(); + var $$exports = { ...legacy_api() }; + init(); + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => hidden_input_default(node_1, spread_props(() => inputState.props)), "component", Checkbox_input, 9, 1, { componentTag: "HiddenInput" }); + append($$anchor2, fragment_1); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if (inputState.shouldRender) $$render(consequent); + }), + "if", + Checkbox_input, + 8, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Checkbox_input = hmr(Checkbox_input, () => Checkbox_input[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Checkbox_input[HMR].source; + set(Checkbox_input[HMR].source, module.default[HMR].original); + }); +} +var checkbox_input_default = Checkbox_input; + +// node_modules/bits-ui/dist/bits/checkbox/components/checkbox.svelte +Checkbox[FILENAME] = "node_modules/bits-ui/dist/bits/checkbox/components/checkbox.svelte"; +var root_230 = add_locations(from_html(``), Checkbox[FILENAME], [[92, 1]]); +var root2 = add_locations(from_html(` `, 1), Checkbox[FILENAME], []); +function Checkbox($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Checkbox); + let checked = prop($$props, "checked", 15, false), ref = prop($$props, "ref", 15, null), disabled = prop($$props, "disabled", 3, false), required = prop($$props, "required", 3, false), name = prop($$props, "name", 3, void 0), value = prop($$props, "value", 3, "on"), id = prop($$props, "id", 19, () => createId(uid)), indeterminate = prop($$props, "indeterminate", 15, false), type = prop($$props, "type", 3, "button"), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "checked", + "ref", + "onCheckedChange", + "children", + "disabled", + "required", + "name", + "value", + "id", + "indeterminate", + "onIndeterminateChange", + "child", + "type", + "readonly" + ], + "restProps" + ); + const group = CheckboxGroupContext.getOr(null); + if (group && value()) { + if (group.opts.value.current.includes(value())) { + checked(true); + } else { + checked(false); + } + } + watch.pre(() => value(), () => { + if (group && value()) { + if (group.opts.value.current.includes(value())) { + checked(true); + } else { + checked(false); + } + } + }); + const rootState = CheckboxRootState.create( + { + checked: boxWith(() => checked(), (v) => { + checked(v); + $$props.onCheckedChange?.(v); + }), + disabled: boxWith(() => disabled() ?? false), + required: boxWith(() => required()), + name: boxWith(() => name()), + value: boxWith(() => value()), + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)), + indeterminate: boxWith(() => indeterminate(), (v) => { + indeterminate(v); + $$props.onIndeterminateChange?.(v); + }), + type: boxWith(() => type()), + readonly: boxWith(() => Boolean($$props.readonly)) + }, + group + ); + const mergedProps = tag(user_derived(() => mergeProps({ ...restProps }, rootState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = root2(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + { + let $0 = user_derived(() => ({ props: get(mergedProps), ...rootState.snippetProps })); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => get($0)), "render", Checkbox, 87, 1); + } + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var button = root_230(); + attribute_effect(button, () => ({ ...get(mergedProps) })); + var node_2 = child(button); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop, () => rootState.snippetProps), "render", Checkbox, 93, 2); + reset(button); + append($$anchor2, button); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Checkbox, + 86, + 0 + ); + } + var node_3 = sibling(node, 2); + add_svelte_meta(() => checkbox_input_default(node_3, {}), "component", Checkbox, 97, 0, { componentTag: "CheckboxInput" }); + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Checkbox = hmr(Checkbox, () => Checkbox[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Checkbox[HMR].source; + set(Checkbox[HMR].source, module.default[HMR].original); + }); +} +var checkbox_default = Checkbox; + +// node_modules/bits-ui/dist/bits/checkbox/components/checkbox-group.svelte +Checkbox_group[FILENAME] = "node_modules/bits-ui/dist/bits/checkbox/components/checkbox-group.svelte"; +var root_231 = add_locations(from_html(`
`), Checkbox_group[FILENAME], [[52, 1]]); +function Checkbox_group($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Checkbox_group); + let ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 19, () => createId(uid)), value = prop($$props, "value", 31, () => tag_proxy(proxy([]), "value")), onValueChange = prop($$props, "onValueChange", 3, noop3), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "ref", + "id", + "value", + "onValueChange", + "name", + "required", + "disabled", + "children", + "child", + "readonly" + ], + "restProps" + ); + const groupState = CheckboxGroupState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)), + disabled: boxWith(() => Boolean($$props.disabled)), + required: boxWith(() => Boolean($$props.required)), + readonly: boxWith(() => Boolean($$props.readonly)), + name: boxWith(() => $$props.name), + value: boxWith(() => snapshot(value()), (v) => { + if (arraysAreEqual(value(), v)) return; + value(snapshot(v)); + onValueChange()(v); + }), + onValueChange: boxWith(() => onValueChange()) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, groupState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Checkbox_group, 50, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var div = root_231(); + attribute_effect(div, () => ({ ...get(mergedProps) })); + var node_2 = child(div); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Checkbox_group, 53, 2); + reset(div); + append($$anchor2, div); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Checkbox_group, + 49, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Checkbox_group = hmr(Checkbox_group, () => Checkbox_group[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Checkbox_group[HMR].source; + set(Checkbox_group[HMR].source, module.default[HMR].original); + }); +} +var checkbox_group_default = Checkbox_group; + +// node_modules/bits-ui/dist/bits/checkbox/components/checkbox-group-label.svelte +Checkbox_group_label[FILENAME] = "node_modules/bits-ui/dist/bits/checkbox/components/checkbox-group-label.svelte"; +var root_232 = add_locations(from_html(``), Checkbox_group_label[FILENAME], [[31, 1]]); +function Checkbox_group_label($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Checkbox_group_label); + let ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 19, () => createId(uid)), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "ref", + "id", + "child", + "children" + ], + "restProps" + ); + const labelState = CheckboxGroupLabelState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, labelState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Checkbox_group_label, 29, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var span = root_232(); + attribute_effect(span, () => ({ ...get(mergedProps) })); + var node_2 = child(span); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Checkbox_group_label, 32, 2); + reset(span); + append($$anchor2, span); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Checkbox_group_label, + 28, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Checkbox_group_label = hmr(Checkbox_group_label, () => Checkbox_group_label[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Checkbox_group_label[HMR].source; + set(Checkbox_group_label[HMR].source, module.default[HMR].original); + }); +} +var checkbox_group_label_default = Checkbox_group_label; + +// node_modules/bits-ui/dist/bits/collapsible/exports.js +var exports_exports8 = {}; +__export(exports_exports8, { + Content: () => collapsible_content_default, + Root: () => collapsible_default, + Trigger: () => collapsible_trigger_default +}); + +// node_modules/bits-ui/dist/bits/collapsible/collapsible.svelte.js +var collapsibleAttrs = createBitsAttrs({ + component: "collapsible", + parts: ["root", "content", "trigger"] +}); +var CollapsibleRootContext = new Context("Collapsible.Root"); +var CollapsibleRootState = class _CollapsibleRootState { + static create(opts) { + return CollapsibleRootContext.set(new _CollapsibleRootState(opts)); + } + opts; + attachment; + #contentNode = tag(state(null), "CollapsibleRootState.contentNode"); + get contentNode() { + return get(this.#contentNode); + } + set contentNode(value) { + set(this.#contentNode, value, true); + } + contentPresence; + #contentId = tag(state(void 0), "CollapsibleRootState.contentId"); + get contentId() { + return get(this.#contentId); + } + set contentId(value) { + set(this.#contentId, value, true); + } + constructor(opts) { + this.opts = opts; + this.toggleOpen = this.toggleOpen.bind(this); + this.attachment = attachRef(this.opts.ref); + this.contentPresence = new PresenceManager({ + ref: boxWith(() => this.contentNode), + open: this.opts.open, + onComplete: () => { + this.opts.onOpenChangeComplete.current(this.opts.open.current); + } + }); + } + toggleOpen() { + this.opts.open.current = !this.opts.open.current; + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + "data-state": getDataOpenClosed(this.opts.open.current), + "data-disabled": boolToEmptyStrOrUndef(this.opts.disabled.current), + [collapsibleAttrs.root]: "", + ...this.attachment + })), + "CollapsibleRootState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var CollapsibleContentState = class _CollapsibleContentState { + static create(opts) { + return new _CollapsibleContentState(opts, CollapsibleRootContext.get()); + } + opts; + root; + attachment; + #present = tag( + user_derived(() => { + if (this.opts.hiddenUntilFound.current) return this.root.opts.open.current; + return this.opts.forceMount.current || this.root.opts.open.current; + }), + "CollapsibleContentState.present" + ); + get present() { + return get(this.#present); + } + set present(value) { + set(this.#present, value); + } + #originalStyles; + #isMountAnimationPrevented = tag(state(false), "CollapsibleContentState.#isMountAnimationPrevented"); + #width = tag(state(0), "CollapsibleContentState.#width"); + #height = tag(state(0), "CollapsibleContentState.#height"); + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + set(this.#isMountAnimationPrevented, root18.opts.open.current, true); + this.root.contentId = this.opts.id.current; + this.attachment = attachRef(this.opts.ref, (v) => this.root.contentNode = v); + watch.pre(() => this.opts.id.current, (id) => { + this.root.contentId = id; + }); + user_pre_effect(() => { + const rAF = requestAnimationFrame(() => { + set(this.#isMountAnimationPrevented, false); + }); + return () => { + cancelAnimationFrame(rAF); + }; + }); + watch.pre( + [ + () => this.opts.ref.current, + () => this.opts.hiddenUntilFound.current + ], + ([node, hiddenUntilFound]) => { + if (!node || !hiddenUntilFound) return; + const handleBeforeMatch = () => { + if (this.root.opts.open.current) return; + requestAnimationFrame(() => { + this.root.opts.open.current = true; + }); + }; + return on(node, "beforematch", handleBeforeMatch); + } + ); + watch([() => this.opts.ref.current, () => this.present], ([node]) => { + if (!node) return; + afterTick(() => { + if (!this.opts.ref.current) return; + this.#originalStyles = this.#originalStyles || { + transitionDuration: node.style.transitionDuration, + animationName: node.style.animationName + }; + node.style.transitionDuration = "0s"; + node.style.animationName = "none"; + const rect = node.getBoundingClientRect(); + set(this.#height, rect.height, true); + set(this.#width, rect.width, true); + if (!get(this.#isMountAnimationPrevented)) { + const { animationName, transitionDuration } = this.#originalStyles; + node.style.transitionDuration = transitionDuration; + node.style.animationName = animationName; + } + }); + }); + } + get shouldRender() { + return this.root.contentPresence.shouldRender; + } + #snippetProps = tag(user_derived(() => ({ open: this.root.opts.open.current })), "CollapsibleContentState.snippetProps"); + get snippetProps() { + return get(this.#snippetProps); + } + set snippetProps(value) { + set(this.#snippetProps, value); + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + style: { + "--bits-collapsible-content-height": get(this.#height) ? `${get(this.#height)}px` : void 0, + "--bits-collapsible-content-width": get(this.#width) ? `${get(this.#width)}px` : void 0 + }, + hidden: this.opts.hiddenUntilFound.current && !this.root.opts.open.current ? "until-found" : void 0, + "data-state": getDataOpenClosed(this.root.opts.open.current), + "data-disabled": boolToEmptyStrOrUndef(this.root.opts.disabled.current), + [collapsibleAttrs.content]: "", + ...this.opts.hiddenUntilFound.current && !this.shouldRender ? {} : { + hidden: this.opts.hiddenUntilFound.current ? !this.shouldRender : this.opts.forceMount.current ? void 0 : !this.shouldRender + }, + ...this.attachment + })), + "CollapsibleContentState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; +var CollapsibleTriggerState = class _CollapsibleTriggerState { + static create(opts) { + return new _CollapsibleTriggerState(opts, CollapsibleRootContext.get()); + } + opts; + root; + attachment; + #isDisabled = tag(user_derived(() => this.opts.disabled.current || this.root.opts.disabled.current), "CollapsibleTriggerState.#isDisabled"); + constructor(opts, root18) { + this.opts = opts; + this.root = root18; + this.attachment = attachRef(this.opts.ref); + this.onclick = this.onclick.bind(this); + this.onkeydown = this.onkeydown.bind(this); + } + onclick(e) { + if (get(this.#isDisabled)) return; + if (strict_equals(e.button, 0, false)) return e.preventDefault(); + this.root.toggleOpen(); + } + onkeydown(e) { + if (get(this.#isDisabled)) return; + if (strict_equals(e.key, kbd_constants_exports.SPACE) || strict_equals(e.key, kbd_constants_exports.ENTER)) { + e.preventDefault(); + this.root.toggleOpen(); + } + } + #props = tag( + user_derived(() => ({ + id: this.opts.id.current, + type: "button", + disabled: get(this.#isDisabled), + "aria-controls": this.root.contentId, + "aria-expanded": boolToStr(this.root.opts.open.current), + "data-state": getDataOpenClosed(this.root.opts.open.current), + "data-disabled": boolToEmptyStrOrUndef(get(this.#isDisabled)), + [collapsibleAttrs.trigger]: "", + // + onclick: this.onclick, + onkeydown: this.onkeydown, + ...this.attachment + })), + "CollapsibleTriggerState.props" + ); + get props() { + return get(this.#props); + } + set props(value) { + set(this.#props, value); + } +}; + +// node_modules/bits-ui/dist/bits/collapsible/components/collapsible.svelte +Collapsible[FILENAME] = "node_modules/bits-ui/dist/bits/collapsible/components/collapsible.svelte"; +var root_233 = add_locations(from_html(`
`), Collapsible[FILENAME], [[45, 1]]); +function Collapsible($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Collapsible); + let id = prop($$props, "id", 19, () => createId(uid)), ref = prop($$props, "ref", 15, null), open = prop($$props, "open", 15, false), disabled = prop($$props, "disabled", 3, false), onOpenChange = prop($$props, "onOpenChange", 3, noop3), onOpenChangeComplete = prop($$props, "onOpenChangeComplete", 3, noop3), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "children", + "child", + "id", + "ref", + "open", + "disabled", + "onOpenChange", + "onOpenChangeComplete" + ], + "restProps" + ); + const rootState = CollapsibleRootState.create({ + open: boxWith(() => open(), (v) => { + open(v); + onOpenChange()(v); + }), + disabled: boxWith(() => disabled()), + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)), + onOpenChangeComplete: boxWith(() => onOpenChangeComplete()) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, rootState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Collapsible, 43, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var div = root_233(); + attribute_effect(div, () => ({ ...get(mergedProps) })); + var node_2 = child(div); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Collapsible, 46, 2); + reset(div); + append($$anchor2, div); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Collapsible, + 42, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Collapsible = hmr(Collapsible, () => Collapsible[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Collapsible[HMR].source; + set(Collapsible[HMR].source, module.default[HMR].original); + }); +} +var collapsible_default = Collapsible; + +// node_modules/bits-ui/dist/bits/collapsible/components/collapsible-content.svelte +Collapsible_content[FILENAME] = "node_modules/bits-ui/dist/bits/collapsible/components/collapsible-content.svelte"; +var root_234 = add_locations(from_html(`
`), Collapsible_content[FILENAME], [[38, 1]]); +function Collapsible_content($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Collapsible_content); + let ref = prop($$props, "ref", 15, null), forceMount = prop($$props, "forceMount", 3, false), hiddenUntilFound = prop($$props, "hiddenUntilFound", 3, false), id = prop($$props, "id", 19, () => createId(uid)), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "child", + "ref", + "forceMount", + "hiddenUntilFound", + "children", + "id" + ], + "restProps" + ); + const contentState = CollapsibleContentState.create({ + id: boxWith(() => id()), + forceMount: boxWith(() => forceMount()), + hiddenUntilFound: boxWith(() => hiddenUntilFound()), + ref: boxWith(() => ref(), (v) => ref(v)) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, contentState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + { + let $0 = user_derived(() => ({ ...contentState.snippetProps, props: get(mergedProps) })); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => get($0)), "render", Collapsible_content, 33, 1); + } + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var div = root_234(); + attribute_effect(div, () => ({ ...get(mergedProps) })); + var node_2 = child(div); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Collapsible_content, 39, 2); + reset(div); + append($$anchor2, div); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Collapsible_content, + 32, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Collapsible_content = hmr(Collapsible_content, () => Collapsible_content[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Collapsible_content[HMR].source; + set(Collapsible_content[HMR].source, module.default[HMR].original); + }); +} +var collapsible_content_default = Collapsible_content; + +// node_modules/bits-ui/dist/bits/collapsible/components/collapsible-trigger.svelte +Collapsible_trigger[FILENAME] = "node_modules/bits-ui/dist/bits/collapsible/components/collapsible-trigger.svelte"; +var root_235 = add_locations(from_html(``), Collapsible_trigger[FILENAME], [[33, 1]]); +function Collapsible_trigger($$anchor, $$props) { + const uid = props_id(); + check_target(new.target); + push($$props, true, Collapsible_trigger); + let ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 19, () => createId(uid)), disabled = prop($$props, "disabled", 3, false), restProps = rest_props( + $$props, + [ + "$$slots", + "$$events", + "$$legacy", + "children", + "child", + "ref", + "id", + "disabled" + ], + "restProps" + ); + const triggerState = CollapsibleTriggerState.create({ + id: boxWith(() => id()), + ref: boxWith(() => ref(), (v) => ref(v)), + disabled: boxWith(() => disabled()) + }); + const mergedProps = tag(user_derived(() => mergeProps(restProps, triggerState.props)), "mergedProps"); + var $$exports = { ...legacy_api() }; + var fragment = comment(); + var node = first_child(fragment); + { + var consequent = ($$anchor2) => { + var fragment_1 = comment(); + var node_1 = first_child(fragment_1); + add_svelte_meta(() => snippet(node_1, () => $$props.child, () => ({ props: get(mergedProps) })), "render", Collapsible_trigger, 31, 1); + append($$anchor2, fragment_1); + }; + var alternate = ($$anchor2) => { + var button = root_235(); + attribute_effect(button, () => ({ ...get(mergedProps) })); + var node_2 = child(button); + add_svelte_meta(() => snippet(node_2, () => $$props.children ?? noop), "render", Collapsible_trigger, 34, 2); + reset(button); + append($$anchor2, button); + }; + add_svelte_meta( + () => if_block(node, ($$render) => { + if ($$props.child) $$render(consequent); + else $$render(alternate, false); + }), + "if", + Collapsible_trigger, + 30, + 0 + ); + } + append($$anchor, fragment); + return pop($$exports); +} +if (import.meta.hot) { + Collapsible_trigger = hmr(Collapsible_trigger, () => Collapsible_trigger[HMR].source); + import.meta.hot.accept((module) => { + module.default[HMR].source = Collapsible_trigger[HMR].source; + set(Collapsible_trigger[HMR].source, module.default[HMR].original); + }); +} +var collapsible_trigger_default = Collapsible_trigger; + +// node_modules/bits-ui/dist/bits/combobox/exports.js +var exports_exports9 = {}; +__export(exports_exports9, { + Arrow: () => arrow_default, + Content: () => select_content_default, + ContentStatic: () => select_content_static_default, + Group: () => select_group_default, + GroupHeading: () => select_group_heading_default, + Input: () => combobox_input_default, + Item: () => select_item_default, + Portal: () => portal_default, + Root: () => combobox_default, + ScrollDownButton: () => select_scroll_down_button_default, + ScrollUpButton: () => select_scroll_up_button_default, + Separator: () => separator_default, + Trigger: () => combobox_trigger_default, + Viewport: () => select_viewport_default +}); + +// node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs +var sides = ["top", "right", "bottom", "left"]; +var alignments = ["start", "end"]; +var placements = sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []); +var min = Math.min; +var max = Math.max; +var round = Math.round; +var floor = Math.floor; +var createCoords = (v) => ({ + x: v, + y: v +}); +var oppositeSideMap = { + left: "right", + right: "left", + bottom: "top", + top: "bottom" +}; +var oppositeAlignmentMap = { + start: "end", + end: "start" +}; +function clamp(start, value, end) { + return max(start, min(value, end)); +} +function evaluate(value, param) { + return typeof value === "function" ? value(param) : value; +} +function getSide(placement) { + return placement.split("-")[0]; +} +function getAlignment(placement) { + return placement.split("-")[1]; +} +function getOppositeAxis(axis) { + return axis === "x" ? "y" : "x"; +} +function getAxisLength(axis) { + return axis === "y" ? "height" : "width"; +} +var yAxisSides = /* @__PURE__ */ new Set(["top", "bottom"]); +function getSideAxis(placement) { + return yAxisSides.has(getSide(placement)) ? "y" : "x"; +} +function getAlignmentAxis(placement) { + return getOppositeAxis(getSideAxis(placement)); +} +function getAlignmentSides(placement, rects, rtl) { + if (rtl === void 0) { + rtl = false; + } + const alignment = getAlignment(placement); + const alignmentAxis = getAlignmentAxis(placement); + const length = getAxisLength(alignmentAxis); + let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; + if (rects.reference[length] > rects.floating[length]) { + mainAlignmentSide = getOppositePlacement(mainAlignmentSide); + } + return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; +} +function getExpandedPlacements(placement) { + const oppositePlacement = getOppositePlacement(placement); + return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; +} +function getOppositeAlignmentPlacement(placement) { + return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]); +} +var lrPlacement = ["left", "right"]; +var rlPlacement = ["right", "left"]; +var tbPlacement = ["top", "bottom"]; +var btPlacement = ["bottom", "top"]; +function getSideList(side, isStart, rtl) { + switch (side) { + case "top": + case "bottom": + if (rtl) return isStart ? rlPlacement : lrPlacement; + return isStart ? lrPlacement : rlPlacement; + case "left": + case "right": + return isStart ? tbPlacement : btPlacement; + default: + return []; + } +} +function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { + const alignment = getAlignment(placement); + let list = getSideList(getSide(placement), direction === "start", rtl); + if (alignment) { + list = list.map((side) => side + "-" + alignment); + if (flipAlignment) { + list = list.concat(list.map(getOppositeAlignmentPlacement)); + } + } + return list; +} +function getOppositePlacement(placement) { + return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]); +} +function expandPaddingObject(padding) { + return { + top: 0, + right: 0, + bottom: 0, + left: 0, + ...padding + }; +} +function getPaddingObject(padding) { + return typeof padding !== "number" ? expandPaddingObject(padding) : { + top: padding, + right: padding, + bottom: padding, + left: padding + }; +} +function rectToClientRect(rect) { + const { + x, + y, + width, + height + } = rect; + return { + width, + height, + top: y, + left: x, + right: x + width, + bottom: y + height, + x, + y + }; +} + +// node_modules/@floating-ui/core/dist/floating-ui.core.mjs +function computeCoordsFromPlacement(_ref, placement, rtl) { + let { + reference, + floating + } = _ref; + const sideAxis = getSideAxis(placement); + const alignmentAxis = getAlignmentAxis(placement); + const alignLength = getAxisLength(alignmentAxis); + const side = getSide(placement); + const isVertical = sideAxis === "y"; + const commonX = reference.x + reference.width / 2 - floating.width / 2; + const commonY = reference.y + reference.height / 2 - floating.height / 2; + const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; + let coords; + switch (side) { + case "top": + coords = { + x: commonX, + y: reference.y - floating.height + }; + break; + case "bottom": + coords = { + x: commonX, + y: reference.y + reference.height + }; + break; + case "right": + coords = { + x: reference.x + reference.width, + y: commonY + }; + break; + case "left": + coords = { + x: reference.x - floating.width, + y: commonY + }; + break; + default: + coords = { + x: reference.x, + y: reference.y + }; + } + switch (getAlignment(placement)) { + case "start": + coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); + break; + case "end": + coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); + break; + } + return coords; +} +var computePosition = async (reference, floating, config) => { + const { + placement = "bottom", + strategy = "absolute", + middleware = [], + platform: platform2 + } = config; + const validMiddleware = middleware.filter(Boolean); + const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating)); + let rects = await platform2.getElementRects({ + reference, + floating, + strategy + }); + let { + x, + y + } = computeCoordsFromPlacement(rects, placement, rtl); + let statefulPlacement = placement; + let middlewareData = {}; + let resetCount = 0; + for (let i = 0; i < validMiddleware.length; i++) { + const { + name, + fn + } = validMiddleware[i]; + const { + x: nextX, + y: nextY, + data, + reset: reset2 + } = await fn({ + x, + y, + initialPlacement: placement, + placement: statefulPlacement, + strategy, + middlewareData, + rects, + platform: platform2, + elements: { + reference, + floating + } + }); + x = nextX != null ? nextX : x; + y = nextY != null ? nextY : y; + middlewareData = { + ...middlewareData, + [name]: { + ...middlewareData[name], + ...data + } + }; + if (reset2 && resetCount <= 50) { + resetCount++; + if (typeof reset2 === "object") { + if (reset2.placement) { + statefulPlacement = reset2.placement; + } + if (reset2.rects) { + rects = reset2.rects === true ? await platform2.getElementRects({ + reference, + floating, + strategy + }) : reset2.rects; + } + ({ + x, + y + } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); + } + i = -1; + } + } + return { + x, + y, + placement: statefulPlacement, + strategy, + middlewareData + }; +}; +async function detectOverflow(state2, options) { + var _await$platform$isEle; + if (options === void 0) { + options = {}; + } + const { + x, + y, + platform: platform2, + rects, + elements, + strategy + } = state2; + const { + boundary = "clippingAncestors", + rootBoundary = "viewport", + elementContext = "floating", + altBoundary = false, + padding = 0 + } = evaluate(options, state2); + const paddingObject = getPaddingObject(padding); + const altContext = elementContext === "floating" ? "reference" : "floating"; + const element2 = elements[altBoundary ? altContext : elementContext]; + const clippingClientRect = rectToClientRect(await platform2.getClippingRect({ + element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element2))) != null ? _await$platform$isEle : true) ? element2 : element2.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)), + boundary, + rootBoundary, + strategy + })); + const rect = elementContext === "floating" ? { + x, + y, + width: rects.floating.width, + height: rects.floating.height + } : rects.reference; + const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating)); + const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || { + x: 1, + y: 1 + } : { + x: 1, + y: 1 + }; + const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({ + elements, + rect, + offsetParent, + strategy + }) : rect); + return { + top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, + bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, + left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, + right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x + }; +} +var arrow = (options) => ({ + name: "arrow", + options, + async fn(state2) { + const { + x, + y, + placement, + rects, + platform: platform2, + elements, + middlewareData + } = state2; + const { + element: element2, + padding = 0 + } = evaluate(options, state2) || {}; + if (element2 == null) { + return {}; + } + const paddingObject = getPaddingObject(padding); + const coords = { + x, + y + }; + const axis = getAlignmentAxis(placement); + const length = getAxisLength(axis); + const arrowDimensions = await platform2.getDimensions(element2); + const isYAxis = axis === "y"; + const minProp = isYAxis ? "top" : "left"; + const maxProp = isYAxis ? "bottom" : "right"; + const clientProp = isYAxis ? "clientHeight" : "clientWidth"; + const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; + const startDiff = coords[axis] - rects.reference[axis]; + const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element2)); + let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0; + if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) { + clientSize = elements.floating[clientProp] || rects.floating[length]; + } + const centerToReference = endDiff / 2 - startDiff / 2; + const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; + const minPadding = min(paddingObject[minProp], largestPossiblePadding); + const maxPadding = min(paddingObject[maxProp], largestPossiblePadding); + const min$1 = minPadding; + const max2 = clientSize - arrowDimensions[length] - maxPadding; + const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; + const offset3 = clamp(min$1, center, max2); + const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset3 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; + const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0; + return { + [axis]: coords[axis] + alignmentOffset, + data: { + [axis]: offset3, + centerOffset: center - offset3 - alignmentOffset, + ...shouldAddOffset && { + alignmentOffset + } + }, + reset: shouldAddOffset + }; + } +}); +var flip = function(options) { + if (options === void 0) { + options = {}; + } + return { + name: "flip", + options, + async fn(state2) { + var _middlewareData$arrow, _middlewareData$flip; + const { + placement, + middlewareData, + rects, + initialPlacement, + platform: platform2, + elements + } = state2; + const { + mainAxis: checkMainAxis = true, + crossAxis: checkCrossAxis = true, + fallbackPlacements: specifiedFallbackPlacements, + fallbackStrategy = "bestFit", + fallbackAxisSideDirection = "none", + flipAlignment = true, + ...detectOverflowOptions + } = evaluate(options, state2); + if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { + return {}; + } + const side = getSide(placement); + const initialSideAxis = getSideAxis(initialPlacement); + const isBasePlacement = getSide(initialPlacement) === initialPlacement; + const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)); + const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); + const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none"; + if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { + fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); + } + const placements2 = [initialPlacement, ...fallbackPlacements]; + const overflow = await detectOverflow(state2, detectOverflowOptions); + const overflows = []; + let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; + if (checkMainAxis) { + overflows.push(overflow[side]); + } + if (checkCrossAxis) { + const sides2 = getAlignmentSides(placement, rects, rtl); + overflows.push(overflow[sides2[0]], overflow[sides2[1]]); + } + overflowsData = [...overflowsData, { + placement, + overflows + }]; + if (!overflows.every((side2) => side2 <= 0)) { + var _middlewareData$flip2, _overflowsData$filter; + const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; + const nextPlacement = placements2[nextIndex]; + if (nextPlacement) { + const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false; + if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis + // overflows the main axis. + overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) { + return { + data: { + index: nextIndex, + overflows: overflowsData + }, + reset: { + placement: nextPlacement + } + }; + } + } + let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a2, b) => a2.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement; + if (!resetPlacement) { + switch (fallbackStrategy) { + case "bestFit": { + var _overflowsData$filter2; + const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => { + if (hasFallbackAxisSideDirection) { + const currentSideAxis = getSideAxis(d.placement); + return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal + // reading directions favoring greater width. + currentSideAxis === "y"; + } + return true; + }).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a2, b) => a2[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0]; + if (placement2) { + resetPlacement = placement2; + } + break; + } + case "initialPlacement": + resetPlacement = initialPlacement; + break; + } + } + if (placement !== resetPlacement) { + return { + reset: { + placement: resetPlacement + } + }; + } + } + return {}; + } + }; +}; +function getSideOffsets(overflow, rect) { + return { + top: overflow.top - rect.height, + right: overflow.right - rect.width, + bottom: overflow.bottom - rect.height, + left: overflow.left - rect.width + }; +} +function isAnySideFullyClipped(overflow) { + return sides.some((side) => overflow[side] >= 0); +} +var hide = function(options) { + if (options === void 0) { + options = {}; + } + return { + name: "hide", + options, + async fn(state2) { + const { + rects + } = state2; + const { + strategy = "referenceHidden", + ...detectOverflowOptions + } = evaluate(options, state2); + switch (strategy) { + case "referenceHidden": { + const overflow = await detectOverflow(state2, { + ...detectOverflowOptions, + elementContext: "reference" + }); + const offsets = getSideOffsets(overflow, rects.reference); + return { + data: { + referenceHiddenOffsets: offsets, + referenceHidden: isAnySideFullyClipped(offsets) + } + }; + } + case "escaped": { + const overflow = await detectOverflow(state2, { + ...detectOverflowOptions, + altBoundary: true + }); + const offsets = getSideOffsets(overflow, rects.floating); + return { + data: { + escapedOffsets: offsets, + escaped: isAnySideFullyClipped(offsets) + } + }; + } + default: { + return {}; + } + } + } + }; +}; +var originSides = /* @__PURE__ */ new Set(["left", "top"]); +async function convertValueToCoords(state2, options) { + const { + placement, + platform: platform2, + elements + } = state2; + const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)); + const side = getSide(placement); + const alignment = getAlignment(placement); + const isVertical = getSideAxis(placement) === "y"; + const mainAxisMulti = originSides.has(side) ? -1 : 1; + const crossAxisMulti = rtl && isVertical ? -1 : 1; + const rawValue = evaluate(options, state2); + let { + mainAxis, + crossAxis, + alignmentAxis + } = typeof rawValue === "number" ? { + mainAxis: rawValue, + crossAxis: 0, + alignmentAxis: null + } : { + mainAxis: rawValue.mainAxis || 0, + crossAxis: rawValue.crossAxis || 0, + alignmentAxis: rawValue.alignmentAxis + }; + if (alignment && typeof alignmentAxis === "number") { + crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; + } + return isVertical ? { + x: crossAxis * crossAxisMulti, + y: mainAxis * mainAxisMulti + } : { + x: mainAxis * mainAxisMulti, + y: crossAxis * crossAxisMulti + }; +} +var offset = function(options) { + if (options === void 0) { + options = 0; + } + return { + name: "offset", + options, + async fn(state2) { + var _middlewareData$offse, _middlewareData$arrow; + const { + x, + y, + placement, + middlewareData + } = state2; + const diffCoords = await convertValueToCoords(state2, options); + if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { + return {}; + } + return { + x: x + diffCoords.x, + y: y + diffCoords.y, + data: { + ...diffCoords, + placement + } + }; + } + }; +}; +var shift = function(options) { + if (options === void 0) { + options = {}; + } + return { + name: "shift", + options, + async fn(state2) { + const { + x, + y, + placement + } = state2; + const { + mainAxis: checkMainAxis = true, + crossAxis: checkCrossAxis = false, + limiter = { + fn: (_ref) => { + let { + x: x2, + y: y2 + } = _ref; + return { + x: x2, + y: y2 + }; + } + }, + ...detectOverflowOptions + } = evaluate(options, state2); + const coords = { + x, + y + }; + const overflow = await detectOverflow(state2, detectOverflowOptions); + const crossAxis = getSideAxis(getSide(placement)); + const mainAxis = getOppositeAxis(crossAxis); + let mainAxisCoord = coords[mainAxis]; + let crossAxisCoord = coords[crossAxis]; + if (checkMainAxis) { + const minSide = mainAxis === "y" ? "top" : "left"; + const maxSide = mainAxis === "y" ? "bottom" : "right"; + const min2 = mainAxisCoord + overflow[minSide]; + const max2 = mainAxisCoord - overflow[maxSide]; + mainAxisCoord = clamp(min2, mainAxisCoord, max2); + } + if (checkCrossAxis) { + const minSide = crossAxis === "y" ? "top" : "left"; + const maxSide = crossAxis === "y" ? "bottom" : "right"; + const min2 = crossAxisCoord + overflow[minSide]; + const max2 = crossAxisCoord - overflow[maxSide]; + crossAxisCoord = clamp(min2, crossAxisCoord, max2); + } + const limitedCoords = limiter.fn({ + ...state2, + [mainAxis]: mainAxisCoord, + [crossAxis]: crossAxisCoord + }); + return { + ...limitedCoords, + data: { + x: limitedCoords.x - x, + y: limitedCoords.y - y, + enabled: { + [mainAxis]: checkMainAxis, + [crossAxis]: checkCrossAxis + } + } + }; + } + }; +}; +var limitShift = function(options) { + if (options === void 0) { + options = {}; + } + return { + options, + fn(state2) { + const { + x, + y, + placement, + rects, + middlewareData + } = state2; + const { + offset: offset3 = 0, + mainAxis: checkMainAxis = true, + crossAxis: checkCrossAxis = true + } = evaluate(options, state2); + const coords = { + x, + y + }; + const crossAxis = getSideAxis(placement); + const mainAxis = getOppositeAxis(crossAxis); + let mainAxisCoord = coords[mainAxis]; + let crossAxisCoord = coords[crossAxis]; + const rawOffset = evaluate(offset3, state2); + const computedOffset = typeof rawOffset === "number" ? { + mainAxis: rawOffset, + crossAxis: 0 + } : { + mainAxis: 0, + crossAxis: 0, + ...rawOffset + }; + if (checkMainAxis) { + const len = mainAxis === "y" ? "height" : "width"; + const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; + const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; + if (mainAxisCoord < limitMin) { + mainAxisCoord = limitMin; + } else if (mainAxisCoord > limitMax) { + mainAxisCoord = limitMax; + } + } + if (checkCrossAxis) { + var _middlewareData$offse, _middlewareData$offse2; + const len = mainAxis === "y" ? "width" : "height"; + const isOriginSide = originSides.has(getSide(placement)); + const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis); + const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0); + if (crossAxisCoord < limitMin) { + crossAxisCoord = limitMin; + } else if (crossAxisCoord > limitMax) { + crossAxisCoord = limitMax; + } + } + return { + [mainAxis]: mainAxisCoord, + [crossAxis]: crossAxisCoord + }; + } + }; +}; +var size = function(options) { + if (options === void 0) { + options = {}; + } + return { + name: "size", + options, + async fn(state2) { + var _state$middlewareData, _state$middlewareData2; + const { + placement, + rects, + platform: platform2, + elements + } = state2; + const { + apply = () => { + }, + ...detectOverflowOptions + } = evaluate(options, state2); + const overflow = await detectOverflow(state2, detectOverflowOptions); + const side = getSide(placement); + const alignment = getAlignment(placement); + const isYAxis = getSideAxis(placement) === "y"; + const { + width, + height + } = rects.floating; + let heightSide; + let widthSide; + if (side === "top" || side === "bottom") { + heightSide = side; + widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right"; + } else { + widthSide = side; + heightSide = alignment === "end" ? "top" : "bottom"; + } + const maximumClippingHeight = height - overflow.top - overflow.bottom; + const maximumClippingWidth = width - overflow.left - overflow.right; + const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight); + const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth); + const noShift = !state2.middlewareData.shift; + let availableHeight = overflowAvailableHeight; + let availableWidth = overflowAvailableWidth; + if ((_state$middlewareData = state2.middlewareData.shift) != null && _state$middlewareData.enabled.x) { + availableWidth = maximumClippingWidth; + } + if ((_state$middlewareData2 = state2.middlewareData.shift) != null && _state$middlewareData2.enabled.y) { + availableHeight = maximumClippingHeight; + } + if (noShift && !alignment) { + const xMin = max(overflow.left, 0); + const xMax = max(overflow.right, 0); + const yMin = max(overflow.top, 0); + const yMax = max(overflow.bottom, 0); + if (isYAxis) { + availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right)); + } else { + availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom)); + } + } + await apply({ + ...state2, + availableWidth, + availableHeight + }); + const nextDimensions = await platform2.getDimensions(elements.floating); + if (width !== nextDimensions.width || height !== nextDimensions.height) { + return { + reset: { + rects: true + } + }; + } + return {}; + } + }; +}; + +// node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs +function hasWindow() { + return typeof window !== "undefined"; +} +function getNodeName2(node) { + if (isNode2(node)) { + return (node.nodeName || "").toLowerCase(); + } + return "#document"; +} +function getWindow2(node) { + var _node$ownerDocument; + return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; +} +function getDocumentElement2(node) { + var _ref; + return (_ref = (isNode2(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; +} +function isNode2(value) { + if (!hasWindow()) { + return false; + } + return value instanceof Node || value instanceof getWindow2(value).Node; +} +function isElement3(value) { + if (!hasWindow()) { + return false; + } + return value instanceof Element || value instanceof getWindow2(value).Element; +} +function isHTMLElement3(value) { + if (!hasWindow()) { + return false; + } + return value instanceof HTMLElement || value instanceof getWindow2(value).HTMLElement; +} +function isShadowRoot2(value) { + if (!hasWindow() || typeof ShadowRoot === "undefined") { + return false; + } + return value instanceof ShadowRoot || value instanceof getWindow2(value).ShadowRoot; +} +var invalidOverflowDisplayValues = /* @__PURE__ */ new Set(["inline", "contents"]); +function isOverflowElement(element2) { + const { + overflow, + overflowX, + overflowY, + display + } = getComputedStyle2(element2); + return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display); +} +var tableElements = /* @__PURE__ */ new Set(["table", "td", "th"]); +function isTableElement(element2) { + return tableElements.has(getNodeName2(element2)); +} +var topLayerSelectors = [":popover-open", ":modal"]; +function isTopLayer(element2) { + return topLayerSelectors.some((selector) => { + try { + return element2.matches(selector); + } catch (_e) { + return false; + } + }); +} +var transformProperties = ["transform", "translate", "scale", "rotate", "perspective"]; +var willChangeValues = ["transform", "translate", "scale", "rotate", "perspective", "filter"]; +var containValues = ["paint", "layout", "strict", "content"]; +function isContainingBlock(elementOrCss) { + const webkit = isWebKit(); + const css = isElement3(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss; + return transformProperties.some((value) => css[value] ? css[value] !== "none" : false) || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || willChangeValues.some((value) => (css.willChange || "").includes(value)) || containValues.some((value) => (css.contain || "").includes(value)); +} +function getContainingBlock(element2) { + let currentNode = getParentNode2(element2); + while (isHTMLElement3(currentNode) && !isLastTraversableNode(currentNode)) { + if (isContainingBlock(currentNode)) { + return currentNode; + } else if (isTopLayer(currentNode)) { + return null; + } + currentNode = getParentNode2(currentNode); + } + return null; +} +function isWebKit() { + if (typeof CSS === "undefined" || !CSS.supports) return false; + return CSS.supports("-webkit-backdrop-filter", "none"); +} +var lastTraversableNodeNames = /* @__PURE__ */ new Set(["html", "body", "#document"]); +function isLastTraversableNode(node) { + return lastTraversableNodeNames.has(getNodeName2(node)); +} +function getComputedStyle2(element2) { + return getWindow2(element2).getComputedStyle(element2); +} +function getNodeScroll(element2) { + if (isElement3(element2)) { + return { + scrollLeft: element2.scrollLeft, + scrollTop: element2.scrollTop + }; + } + return { + scrollLeft: element2.scrollX, + scrollTop: element2.scrollY + }; +} +function getParentNode2(node) { + if (getNodeName2(node) === "html") { + return node; + } + const result = ( + // Step into the shadow DOM of the parent of a slotted node. + node.assignedSlot || // DOM Element detected. + node.parentNode || // ShadowRoot detected. + isShadowRoot2(node) && node.host || // Fallback. + getDocumentElement2(node) + ); + return isShadowRoot2(result) ? result.host : result; +} +function getNearestOverflowAncestor(node) { + const parentNode = getParentNode2(node); + if (isLastTraversableNode(parentNode)) { + return node.ownerDocument ? node.ownerDocument.body : node.body; + } + if (isHTMLElement3(parentNode) && isOverflowElement(parentNode)) { + return parentNode; + } + return getNearestOverflowAncestor(parentNode); +} +function getOverflowAncestors(node, list, traverseIframes) { + var _node$ownerDocument2; + if (list === void 0) { + list = []; + } + if (traverseIframes === void 0) { + traverseIframes = true; + } + const scrollableAncestor = getNearestOverflowAncestor(node); + const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); + const win = getWindow2(scrollableAncestor); + if (isBody) { + const frameElement = getFrameElement(win); + return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); + } + return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); +} +function getFrameElement(win) { + return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; +} + +// node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs +function getCssDimensions(element2) { + const css = getComputedStyle2(element2); + let width = parseFloat(css.width) || 0; + let height = parseFloat(css.height) || 0; + const hasOffset = isHTMLElement3(element2); + const offsetWidth = hasOffset ? element2.offsetWidth : width; + const offsetHeight = hasOffset ? element2.offsetHeight : height; + const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; + if (shouldFallback) { + width = offsetWidth; + height = offsetHeight; + } + return { + width, + height, + $: shouldFallback + }; +} +function unwrapElement(element2) { + return !isElement3(element2) ? element2.contextElement : element2; +} +function getScale(element2) { + const domElement = unwrapElement(element2); + if (!isHTMLElement3(domElement)) { + return createCoords(1); + } + const rect = domElement.getBoundingClientRect(); + const { + width, + height, + $ + } = getCssDimensions(domElement); + let x = ($ ? round(rect.width) : rect.width) / width; + let y = ($ ? round(rect.height) : rect.height) / height; + if (!x || !Number.isFinite(x)) { + x = 1; + } + if (!y || !Number.isFinite(y)) { + y = 1; + } + return { + x, + y + }; +} +var noOffsets = createCoords(0); +function getVisualOffsets(element2) { + const win = getWindow2(element2); + if (!isWebKit() || !win.visualViewport) { + return noOffsets; + } + return { + x: win.visualViewport.offsetLeft, + y: win.visualViewport.offsetTop + }; +} +function shouldAddVisualOffsets(element2, isFixed, floatingOffsetParent) { + if (isFixed === void 0) { + isFixed = false; + } + if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow2(element2)) { + return false; + } + return isFixed; +} +function getBoundingClientRect(element2, includeScale, isFixedStrategy, offsetParent) { + if (includeScale === void 0) { + includeScale = false; + } + if (isFixedStrategy === void 0) { + isFixedStrategy = false; + } + const clientRect = element2.getBoundingClientRect(); + const domElement = unwrapElement(element2); + let scale = createCoords(1); + if (includeScale) { + if (offsetParent) { + if (isElement3(offsetParent)) { + scale = getScale(offsetParent); + } + } else { + scale = getScale(element2); + } + } + const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); + let x = (clientRect.left + visualOffsets.x) / scale.x; + let y = (clientRect.top + visualOffsets.y) / scale.y; + let width = clientRect.width / scale.x; + let height = clientRect.height / scale.y; + if (domElement) { + const win = getWindow2(domElement); + const offsetWin = offsetParent && isElement3(offsetParent) ? getWindow2(offsetParent) : offsetParent; + let currentWin = win; + let currentIFrame = getFrameElement(currentWin); + while (currentIFrame && offsetParent && offsetWin !== currentWin) { + const iframeScale = getScale(currentIFrame); + const iframeRect = currentIFrame.getBoundingClientRect(); + const css = getComputedStyle2(currentIFrame); + const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; + const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; + x *= iframeScale.x; + y *= iframeScale.y; + width *= iframeScale.x; + height *= iframeScale.y; + x += left; + y += top; + currentWin = getWindow2(currentIFrame); + currentIFrame = getFrameElement(currentWin); + } + } + return rectToClientRect({ + width, + height, + x, + y + }); +} +function getWindowScrollBarX(element2, rect) { + const leftScroll = getNodeScroll(element2).scrollLeft; + if (!rect) { + return getBoundingClientRect(getDocumentElement2(element2)).left + leftScroll; + } + return rect.left + leftScroll; +} +function getHTMLOffset(documentElement, scroll) { + const htmlRect = documentElement.getBoundingClientRect(); + const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect); + const y = htmlRect.top + scroll.scrollTop; + return { + x, + y + }; +} +function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { + let { + elements, + rect, + offsetParent, + strategy + } = _ref; + const isFixed = strategy === "fixed"; + const documentElement = getDocumentElement2(offsetParent); + const topLayer = elements ? isTopLayer(elements.floating) : false; + if (offsetParent === documentElement || topLayer && isFixed) { + return rect; + } + let scroll = { + scrollLeft: 0, + scrollTop: 0 + }; + let scale = createCoords(1); + const offsets = createCoords(0); + const isOffsetParentAnElement = isHTMLElement3(offsetParent); + if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { + if (getNodeName2(offsetParent) !== "body" || isOverflowElement(documentElement)) { + scroll = getNodeScroll(offsetParent); + } + if (isHTMLElement3(offsetParent)) { + const offsetRect = getBoundingClientRect(offsetParent); + scale = getScale(offsetParent); + offsets.x = offsetRect.x + offsetParent.clientLeft; + offsets.y = offsetRect.y + offsetParent.clientTop; + } + } + const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); + return { + width: rect.width * scale.x, + height: rect.height * scale.y, + x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, + y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y + }; +} +function getClientRects(element2) { + return Array.from(element2.getClientRects()); +} +function getDocumentRect(element2) { + const html = getDocumentElement2(element2); + const scroll = getNodeScroll(element2); + const body = element2.ownerDocument.body; + const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); + const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); + let x = -scroll.scrollLeft + getWindowScrollBarX(element2); + const y = -scroll.scrollTop; + if (getComputedStyle2(body).direction === "rtl") { + x += max(html.clientWidth, body.clientWidth) - width; + } + return { + width, + height, + x, + y + }; +} +var SCROLLBAR_MAX = 25; +function getViewportRect(element2, strategy) { + const win = getWindow2(element2); + const html = getDocumentElement2(element2); + const visualViewport = win.visualViewport; + let width = html.clientWidth; + let height = html.clientHeight; + let x = 0; + let y = 0; + if (visualViewport) { + width = visualViewport.width; + height = visualViewport.height; + const visualViewportBased = isWebKit(); + if (!visualViewportBased || visualViewportBased && strategy === "fixed") { + x = visualViewport.offsetLeft; + y = visualViewport.offsetTop; + } + } + const windowScrollbarX = getWindowScrollBarX(html); + if (windowScrollbarX <= 0) { + const doc = html.ownerDocument; + const body = doc.body; + const bodyStyles = getComputedStyle(body); + const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0; + const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline); + if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) { + width -= clippingStableScrollbarWidth; + } + } else if (windowScrollbarX <= SCROLLBAR_MAX) { + width += windowScrollbarX; + } + return { + width, + height, + x, + y + }; +} +var absoluteOrFixed = /* @__PURE__ */ new Set(["absolute", "fixed"]); +function getInnerBoundingClientRect(element2, strategy) { + const clientRect = getBoundingClientRect(element2, true, strategy === "fixed"); + const top = clientRect.top + element2.clientTop; + const left = clientRect.left + element2.clientLeft; + const scale = isHTMLElement3(element2) ? getScale(element2) : createCoords(1); + const width = element2.clientWidth * scale.x; + const height = element2.clientHeight * scale.y; + const x = left * scale.x; + const y = top * scale.y; + return { + width, + height, + x, + y + }; +} +function getClientRectFromClippingAncestor(element2, clippingAncestor, strategy) { + let rect; + if (clippingAncestor === "viewport") { + rect = getViewportRect(element2, strategy); + } else if (clippingAncestor === "document") { + rect = getDocumentRect(getDocumentElement2(element2)); + } else if (isElement3(clippingAncestor)) { + rect = getInnerBoundingClientRect(clippingAncestor, strategy); + } else { + const visualOffsets = getVisualOffsets(element2); + rect = { + x: clippingAncestor.x - visualOffsets.x, + y: clippingAncestor.y - visualOffsets.y, + width: clippingAncestor.width, + height: clippingAncestor.height + }; + } + return rectToClientRect(rect); +} +function hasFixedPositionAncestor(element2, stopNode) { + const parentNode = getParentNode2(element2); + if (parentNode === stopNode || !isElement3(parentNode) || isLastTraversableNode(parentNode)) { + return false; + } + return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode); +} +function getClippingElementAncestors(element2, cache) { + const cachedResult = cache.get(element2); + if (cachedResult) { + return cachedResult; + } + let result = getOverflowAncestors(element2, [], false).filter((el) => isElement3(el) && getNodeName2(el) !== "body"); + let currentContainingBlockComputedStyle = null; + const elementIsFixed = getComputedStyle2(element2).position === "fixed"; + let currentNode = elementIsFixed ? getParentNode2(element2) : element2; + while (isElement3(currentNode) && !isLastTraversableNode(currentNode)) { + const computedStyle = getComputedStyle2(currentNode); + const currentNodeIsContaining = isContainingBlock(currentNode); + if (!currentNodeIsContaining && computedStyle.position === "fixed") { + currentContainingBlockComputedStyle = null; + } + const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element2, currentNode); + if (shouldDropCurrentNode) { + result = result.filter((ancestor) => ancestor !== currentNode); + } else { + currentContainingBlockComputedStyle = computedStyle; + } + currentNode = getParentNode2(currentNode); + } + cache.set(element2, result); + return result; +} +function getClippingRect(_ref) { + let { + element: element2, + boundary, + rootBoundary, + strategy + } = _ref; + const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element2) ? [] : getClippingElementAncestors(element2, this._c) : [].concat(boundary); + const clippingAncestors = [...elementClippingAncestors, rootBoundary]; + const firstClippingAncestor = clippingAncestors[0]; + const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => { + const rect = getClientRectFromClippingAncestor(element2, clippingAncestor, strategy); + accRect.top = max(rect.top, accRect.top); + accRect.right = min(rect.right, accRect.right); + accRect.bottom = min(rect.bottom, accRect.bottom); + accRect.left = max(rect.left, accRect.left); + return accRect; + }, getClientRectFromClippingAncestor(element2, firstClippingAncestor, strategy)); + return { + width: clippingRect.right - clippingRect.left, + height: clippingRect.bottom - clippingRect.top, + x: clippingRect.left, + y: clippingRect.top + }; +} +function getDimensions(element2) { + const { + width, + height + } = getCssDimensions(element2); + return { + width, + height + }; +} +function getRectRelativeToOffsetParent(element2, offsetParent, strategy) { + const isOffsetParentAnElement = isHTMLElement3(offsetParent); + const documentElement = getDocumentElement2(offsetParent); + const isFixed = strategy === "fixed"; + const rect = getBoundingClientRect(element2, true, isFixed, offsetParent); + let scroll = { + scrollLeft: 0, + scrollTop: 0 + }; + const offsets = createCoords(0); + function setLeftRTLScrollbarOffset() { + offsets.x = getWindowScrollBarX(documentElement); + } + if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { + if (getNodeName2(offsetParent) !== "body" || isOverflowElement(documentElement)) { + scroll = getNodeScroll(offsetParent); + } + if (isOffsetParentAnElement) { + const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); + offsets.x = offsetRect.x + offsetParent.clientLeft; + offsets.y = offsetRect.y + offsetParent.clientTop; + } else if (documentElement) { + setLeftRTLScrollbarOffset(); + } + } + if (isFixed && !isOffsetParentAnElement && documentElement) { + setLeftRTLScrollbarOffset(); + } + const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); + const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x; + const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y; + return { + x, + y, + width: rect.width, + height: rect.height + }; +} +function isStaticPositioned(element2) { + return getComputedStyle2(element2).position === "static"; +} +function getTrueOffsetParent(element2, polyfill) { + if (!isHTMLElement3(element2) || getComputedStyle2(element2).position === "fixed") { + return null; + } + if (polyfill) { + return polyfill(element2); + } + let rawOffsetParent = element2.offsetParent; + if (getDocumentElement2(element2) === rawOffsetParent) { + rawOffsetParent = rawOffsetParent.ownerDocument.body; + } + return rawOffsetParent; +} +function getOffsetParent(element2, polyfill) { + const win = getWindow2(element2); + if (isTopLayer(element2)) { + return win; + } + if (!isHTMLElement3(element2)) { + let svgOffsetParent = getParentNode2(element2); + while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { + if (isElement3(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { + return svgOffsetParent; + } + svgOffsetParent = getParentNode2(svgOffsetParent); + } + return win; + } + let offsetParent = getTrueOffsetParent(element2, polyfill); + while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) { + offsetParent = getTrueOffsetParent(offsetParent, polyfill); + } + if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) { + return win; + } + return offsetParent || getContainingBlock(element2) || win; +} +var getElementRects = async function(data) { + const getOffsetParentFn = this.getOffsetParent || getOffsetParent; + const getDimensionsFn = this.getDimensions; + const floatingDimensions = await getDimensionsFn(data.floating); + return { + reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), + floating: { + x: 0, + y: 0, + width: floatingDimensions.width, + height: floatingDimensions.height + } + }; +}; +function isRTL(element2) { + return getComputedStyle2(element2).direction === "rtl"; +} +var platform = { + convertOffsetParentRelativeRectToViewportRelativeRect, + getDocumentElement: getDocumentElement2, + getClippingRect, + getOffsetParent, + getElementRects, + getClientRects, + getDimensions, + getScale, + isElement: isElement3, + isRTL +}; +function rectsAreEqual(a2, b) { + return a2.x === b.x && a2.y === b.y && a2.width === b.width && a2.height === b.height; +} +function observeMove(element2, onMove) { + let io = null; + let timeoutId; + const root18 = getDocumentElement2(element2); + function cleanup() { + var _io; + clearTimeout(timeoutId); + (_io = io) == null || _io.disconnect(); + io = null; + } + function refresh(skip, threshold) { + if (skip === void 0) { + skip = false; + } + if (threshold === void 0) { + threshold = 1; + } + cleanup(); + const elementRectForRootMargin = element2.getBoundingClientRect(); + const { + left, + top, + width, + height + } = elementRectForRootMargin; + if (!skip) { + onMove(); + } + if (!width || !height) { + return; + } + const insetTop = floor(top); + const insetRight = floor(root18.clientWidth - (left + width)); + const insetBottom = floor(root18.clientHeight - (top + height)); + const insetLeft = floor(left); + const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; + const options = { + rootMargin, + threshold: max(0, min(1, threshold)) || 1 + }; + let isFirstUpdate = true; + function handleObserve(entries) { + const ratio = entries[0].intersectionRatio; + if (ratio !== threshold) { + if (!isFirstUpdate) { + return refresh(); + } + if (!ratio) { + timeoutId = setTimeout(() => { + refresh(false, 1e-7); + }, 1e3); + } else { + refresh(false, ratio); + } + } + if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element2.getBoundingClientRect())) { + refresh(); + } + isFirstUpdate = false; + } + try { + io = new IntersectionObserver(handleObserve, { + ...options, + // Handle