UNPKG

@syngrisi/syngrisi

Version:
1,492 lines 525 kB
import { r as react, b as jsx, d as useMantineTheme, aw as Global$1, ax as css, ay as useDidUpdate, az as useReducedMotion, aA as useWindowEvent, aB as mergeRefs, aC as reactDom, K as useComponentDefaultProps, R as extractSystemStyles, B as Box, aD as OptionalPortal, aE as packSx, aF as getDefaultZIndex, V as ActionIcon, aG as createPolymorphicComponent, c as createStyles, j as jsxs, a0 as Fragment, T as Text, aH as _extends, a5 as React, U as useUncontrolled, aI as useFloating, aJ as size, aK as useFloatingAutoUpdate, aL as offset, aM as shift, aN as limitShift, aO as flip, aP as inline, aQ as arrow, aR as isElement, aS as useMergedRef, aT as clsx, a6 as Transition$2, aU as FloatingArrow, O as useId, aV as getFloatingPosition, aW as UnstyledButton, P as Paper, G as Group, aX as CheckIcon, aY as useTransition, aZ as getTransitionStyles, a_ as Overlay, a4 as Loader, a2 as Tooltip, a$ as useIsomorphicEffect$1, b0 as useInputProps, W as Input, b1 as keyframes, b2 as QueryObserver, b3 as infiniteQueryBehavior, b4 as hasNextPage, b5 as hasPreviousPage, b6 as Subscribable, b7 as shallowEqualObjects, b8 as getDefaultState, b9 as notifyManager, ba as parseMutationArgs, a1 as useQueryClient, bb as useSyncExternalStore, bc as shouldThrowError, bd as parseQueryArgs, be as useBaseQuery, bf as ReactDOM, bg as Portal, l as log, bh as NavigationContext, at as useNavigate, bi as useLocation, i as Progress, C as Center, q as TextInput, D as useHotkeys, e as Container, k as ky, a as config$1, X as queryString, u as useQuery, bj as B9, bk as wue, bl as gW, bm as wz, bn as mF, bo as Uye, z as zB, bp as Lqe, bq as Iqe, br as I9, bs as N9, h as Button, bt as P5, m as dj, bu as NP, bv as Qa, S as Switch, t as GCe, v as Nie, y as useLocalStorage, bw as L3, bx as CMe, by as _He, bz as Iee, n as lAe, bA as commonjsGlobal, p as useForm, bB as rle, bC as Nme } from "./use-form.2c921e76.js"; function findElementAncestor(element, selector) { let _element = element; while ((_element = _element.parentElement) && !_element.matches(selector)) ; return _element; } function getPreviousIndex(current, elements, loop) { for (let i = current - 1; i >= 0; i -= 1) { if (!elements[i].disabled) { return i; } } if (loop) { for (let i = elements.length - 1; i > -1; i -= 1) { if (!elements[i].disabled) { return i; } } } return current; } function getNextIndex(current, elements, loop) { for (let i = current + 1; i < elements.length; i += 1) { if (!elements[i].disabled) { return i; } } if (loop) { for (let i = 0; i < elements.length; i += 1) { if (!elements[i].disabled) { return i; } } } return current; } function onSameLevel(target, sibling, parentSelector) { return findElementAncestor(target, parentSelector) === findElementAncestor(sibling, parentSelector); } function createScopedKeydownHandler({ parentSelector, siblingSelector, onKeyDown, loop = true, activateOnFocus = false, dir = "rtl", orientation }) { return (event) => { var _a; onKeyDown == null ? void 0 : onKeyDown(event); const elements = Array.from(((_a = findElementAncestor(event.currentTarget, parentSelector)) == null ? void 0 : _a.querySelectorAll(siblingSelector)) || []).filter((node) => onSameLevel(event.currentTarget, node, parentSelector)); const current = elements.findIndex((el) => event.currentTarget === el); const _nextIndex = getNextIndex(current, elements, loop); const _previousIndex = getPreviousIndex(current, elements, loop); const nextIndex = dir === "rtl" ? _previousIndex : _nextIndex; const previousIndex = dir === "rtl" ? _nextIndex : _previousIndex; switch (event.key) { case "ArrowRight": { if (orientation === "horizontal") { event.stopPropagation(); event.preventDefault(); elements[nextIndex].focus(); activateOnFocus && elements[nextIndex].click(); } break; } case "ArrowLeft": { if (orientation === "horizontal") { event.stopPropagation(); event.preventDefault(); elements[previousIndex].focus(); activateOnFocus && elements[previousIndex].click(); } break; } case "ArrowUp": { if (orientation === "vertical") { event.stopPropagation(); event.preventDefault(); elements[_previousIndex].focus(); activateOnFocus && elements[_previousIndex].click(); } break; } case "ArrowDown": { if (orientation === "vertical") { event.stopPropagation(); event.preventDefault(); elements[_nextIndex].focus(); activateOnFocus && elements[_nextIndex].click(); } break; } case "Home": { event.stopPropagation(); event.preventDefault(); !elements[0].disabled && elements[0].focus(); break; } case "End": { event.stopPropagation(); event.preventDefault(); const last = elements.length - 1; !elements[last].disabled && elements[last].focus(); break; } } }; } function getContextItemIndex(elementSelector, parentSelector, node) { var _a; if (!node) { return null; } return Array.from(((_a = findElementAncestor(node, parentSelector)) == null ? void 0 : _a.querySelectorAll(elementSelector)) || []).findIndex((element) => element === node); } function createSafeContext(errorMessage) { const Context = react.exports.createContext(null); const useSafeContext = () => { const ctx = react.exports.useContext(Context); if (ctx === null) { throw new Error(errorMessage); } return ctx; }; const Provider = ({ children, value }) => /* @__PURE__ */ jsx(Context.Provider, { value, children }); return [Provider, useSafeContext]; } const noop$3 = () => { }; function closeOnEscape(callback, options = { active: true }) { if (typeof callback !== "function" || !options.active) { return options.onKeyDown || noop$3; } return (event) => { var _a; if (event.key === "Escape") { callback(event); (_a = options.onTrigger) == null ? void 0 : _a.call(options); } }; } function createEventHandler(parentEventHandler, eventHandler) { return (event) => { parentEventHandler == null ? void 0 : parentEventHandler(event); eventHandler == null ? void 0 : eventHandler(event); }; } function useHovered() { const [hovered, setHovered] = react.exports.useState(-1); const resetHovered = () => setHovered(-1); return [hovered, { setHovered, resetHovered }]; } function groupOptions({ data }) { const sortedData = []; const unGroupedData = []; const groupedData = data.reduce((acc, item, index) => { if (item.group) { if (acc[item.group]) acc[item.group].push(index); else acc[item.group] = [index]; } else { unGroupedData.push(index); } return acc; }, {}); Object.keys(groupedData).forEach((groupName) => { sortedData.push(...groupedData[groupName].map((index) => data[index])); }); sortedData.push(...unGroupedData.map((itemIndex) => data[itemIndex])); return sortedData; } function getGroupedOptions(data) { const sorted = groupOptions({ data }); const unGrouped = []; const grouped = []; let groupName = null; sorted.forEach((item, index) => { if (!item.group) { unGrouped.push({ type: "item", item, index }); } else { if (groupName !== item.group) { groupName = item.group; grouped.push({ type: "label", label: groupName }); } grouped.push({ type: "item", item, index }); } }); return { grouped, unGrouped, items: [...grouped, ...unGrouped], hasItems: grouped.length > 0 || unGrouped.length > 0 }; } function dispatchEvent(type, detail) { window.dispatchEvent(new CustomEvent(type, { detail })); } const useIsomorphicEffect = typeof window !== "undefined" ? react.exports.useLayoutEffect : react.exports.useEffect; function createUseExternalEvents(prefix) { function _useExternalEvents(events) { const handlers = Object.keys(events).reduce((acc, eventKey) => { acc[`${prefix}:${eventKey}`] = (event) => events[eventKey](event.detail); return acc; }, {}); useIsomorphicEffect(() => { Object.keys(handlers).forEach((eventKey) => { window.removeEventListener(eventKey, handlers[eventKey]); window.addEventListener(eventKey, handlers[eventKey]); }); return () => Object.keys(handlers).forEach((eventKey) => { window.removeEventListener(eventKey, handlers[eventKey]); }); }, [handlers]); } function createEvent2(event) { return (...payload) => dispatchEvent(`${prefix}:${String(event)}`, payload[0]); } return [_useExternalEvents, createEvent2]; } function Global({ styles }) { const theme = useMantineTheme(); return /* @__PURE__ */ jsx(Global$1, { styles: css(typeof styles === "function" ? styles(theme) : styles) }); } const DEFAULT_EVENTS = ["mousedown", "touchstart"]; function useClickOutside(handler, events, nodes) { const ref = react.exports.useRef(); react.exports.useEffect(() => { const listener = (event) => { const { target } = event != null ? event : {}; if (Array.isArray(nodes)) { const shouldIgnore = (target == null ? void 0 : target.hasAttribute("data-ignore-outside-clicks")) || !document.body.contains(target) && target.tagName !== "HTML"; const shouldTrigger = nodes.every((node) => !!node && !event.composedPath().includes(node)); shouldTrigger && !shouldIgnore && handler(); } else if (ref.current && !ref.current.contains(target)) { handler(); } }; (events || DEFAULT_EVENTS).forEach((fn) => document.addEventListener(fn, listener)); return () => { (events || DEFAULT_EVENTS).forEach((fn) => document.removeEventListener(fn, listener)); }; }, [ref, handler, nodes]); return ref; } function useClipboard({ timeout = 2e3 } = {}) { const [error, setError] = react.exports.useState(null); const [copied, setCopied] = react.exports.useState(false); const [copyTimeout, setCopyTimeout] = react.exports.useState(null); const handleCopyResult = (value) => { clearTimeout(copyTimeout); setCopyTimeout(setTimeout(() => setCopied(false), timeout)); setCopied(value); }; const copy = (valueToCopy) => { if ("clipboard" in navigator) { navigator.clipboard.writeText(valueToCopy).then(() => handleCopyResult(true)).catch((err) => setError(err)); } else { setError(new Error("useClipboard: navigator.clipboard is not supported")); } }; const reset = () => { setCopied(false); setError(null); clearTimeout(copyTimeout); }; return { copy, reset, error, copied }; } function useFocusReturn({ opened, shouldReturnFocus = true }) { const lastActiveElement = react.exports.useRef(); const returnFocus = () => { var _a; if (lastActiveElement.current && "focus" in lastActiveElement.current && typeof lastActiveElement.current.focus === "function") { (_a = lastActiveElement.current) == null ? void 0 : _a.focus({ preventScroll: true }); } }; useDidUpdate(() => { let timeout = -1; const clearFocusTimeout = (event) => { if (event.key === "Tab") { window.clearTimeout(timeout); } }; document.addEventListener("keydown", clearFocusTimeout); if (opened) { lastActiveElement.current = document.activeElement; } else if (shouldReturnFocus) { timeout = window.setTimeout(returnFocus, 10); } return () => { window.clearTimeout(timeout); document.removeEventListener("keydown", clearFocusTimeout); }; }, [opened, shouldReturnFocus]); return returnFocus; } const TABBABLE_NODES = /input|select|textarea|button|object/; const FOCUS_SELECTOR = "a, input, select, textarea, button, object, [tabindex]"; function hidden(element) { return element.style.display === "none"; } function visible(element) { const isHidden = element.getAttribute("aria-hidden") || element.getAttribute("hidden") || element.getAttribute("type") === "hidden"; if (isHidden) { return false; } let parentElement = element; while (parentElement) { if (parentElement === document.body || parentElement.nodeType === 11) { break; } if (hidden(parentElement)) { return false; } parentElement = parentElement.parentNode; } return true; } function getElementTabIndex(element) { let tabIndex = element.getAttribute("tabindex"); if (tabIndex === null) { tabIndex = void 0; } return parseInt(tabIndex, 10); } function focusable(element) { const nodeName = element.nodeName.toLowerCase(); const isTabIndexNotNaN = !Number.isNaN(getElementTabIndex(element)); const res = TABBABLE_NODES.test(nodeName) && !element.disabled || (element instanceof HTMLAnchorElement ? element.href || isTabIndexNotNaN : isTabIndexNotNaN); return res && visible(element); } function tabbable(element) { const tabIndex = getElementTabIndex(element); const isTabIndexNaN = Number.isNaN(tabIndex); return (isTabIndexNaN || tabIndex >= 0) && focusable(element); } function findTabbableDescendants(element) { return Array.from(element.querySelectorAll(FOCUS_SELECTOR)).filter(tabbable); } function scopeTab(node, event) { const tabbable2 = findTabbableDescendants(node); if (!tabbable2.length) { event.preventDefault(); return; } const finalTabbable = tabbable2[event.shiftKey ? 0 : tabbable2.length - 1]; const root = node.getRootNode(); const leavingFinalTabbable = finalTabbable === root.activeElement || node === root.activeElement; if (!leavingFinalTabbable) { return; } event.preventDefault(); const target = tabbable2[event.shiftKey ? tabbable2.length - 1 : 0]; if (target) { target.focus(); } } function createAriaHider(containerNode, selector = "body > :not(script)") { const rootNodes = Array.from(document.querySelectorAll(selector)).map((node) => { var _a; if (((_a = node == null ? void 0 : node.shadowRoot) == null ? void 0 : _a.contains(containerNode)) || node.contains(containerNode)) { return void 0; } const ariaHidden = node.getAttribute("aria-hidden"); if (ariaHidden === null || ariaHidden === "false") { node.setAttribute("aria-hidden", "true"); } return { node, ariaHidden }; }); return () => { rootNodes.forEach((item) => { if (!item) { return; } if (item.ariaHidden === null) { item.node.removeAttribute("aria-hidden"); } else { item.node.setAttribute("aria-hidden", item.ariaHidden); } }); }; } function useFocusTrap(active = true) { const ref = react.exports.useRef(); const restoreAria = react.exports.useRef(null); const setRef = react.exports.useCallback((node) => { if (!active) { return; } if (node === null) { return; } restoreAria.current = createAriaHider(node); if (ref.current === node) { return; } if (node) { const processNode = () => { let focusElement = node.querySelector("[data-autofocus]"); if (!focusElement) { const children = Array.from(node.querySelectorAll(FOCUS_SELECTOR)); focusElement = children.find(tabbable) || children.find(focusable) || null; if (!focusElement && focusable(node)) focusElement = node; } if (focusElement) { focusElement.focus({ preventScroll: true }); } }; setTimeout(() => { if (node.getRootNode()) { processNode(); } }); ref.current = node; } else { ref.current = null; } }, [active]); react.exports.useEffect(() => { if (!active) { return void 0; } const handleKeyDown = (event) => { if (event.key === "Tab" && ref.current) { scopeTab(ref.current, event); } }; document.addEventListener("keydown", handleKeyDown); return () => { document.removeEventListener("keydown", handleKeyDown); if (restoreAria.current) { restoreAria.current(); } }; }, [active]); return setRef; } const reducer = (value) => (value + 1) % 1e6; function useForceUpdate() { const [, update] = react.exports.useReducer(reducer, 0); return update; } function useInterval(fn, interval) { const [active, setActive] = react.exports.useState(false); const intervalRef = react.exports.useRef(); const fnRef = react.exports.useRef(); react.exports.useEffect(() => { fnRef.current = fn; }, [fn]); const start = () => { setActive((old) => { if (!old && !intervalRef.current) { intervalRef.current = window.setInterval(fnRef.current, interval); } return true; }); }; const stop = () => { setActive(false); window.clearInterval(intervalRef.current); intervalRef.current = void 0; }; const toggle = () => { if (active) { stop(); } else { start(); } }; return { start, stop, toggle, active }; } function useQueue({ initialValues = [], limit }) { const [{ state, queue }, setState] = react.exports.useState({ state: initialValues.slice(0, limit), queue: initialValues.slice(limit) }); const add = (...items) => setState((current) => { const results = [...current.state, ...current.queue, ...items]; return { state: results.slice(0, limit), queue: results.slice(limit) }; }); const update = (fn) => setState((current) => { const results = fn([...current.state, ...current.queue]); return { state: results.slice(0, limit), queue: results.slice(limit) }; }); const cleanQueue = () => setState((current) => ({ state: current.state, queue: [] })); return { state, queue, add, update, cleanQueue }; } const easeInOutQuad = (t) => t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t; const getRelativePosition = ({ axis, target, parent, alignment, offset: offset2, isList }) => { if (!target || !parent && typeof document === "undefined") { return 0; } const isCustomParent = !!parent; const parentElement = parent || document.body; const parentPosition = parentElement.getBoundingClientRect(); const targetPosition = target.getBoundingClientRect(); const getDiff = (property) => targetPosition[property] - parentPosition[property]; if (axis === "y") { const diff = getDiff("top"); if (diff === 0) return 0; if (alignment === "start") { const distance = diff - offset2; const shouldScroll = distance <= targetPosition.height * (isList ? 0 : 1) || !isList; return shouldScroll ? distance : 0; } const parentHeight = isCustomParent ? parentPosition.height : window.innerHeight; if (alignment === "end") { const distance = diff + offset2 - parentHeight + targetPosition.height; const shouldScroll = distance >= -targetPosition.height * (isList ? 0 : 1) || !isList; return shouldScroll ? distance : 0; } if (alignment === "center") { return diff - parentHeight / 2 + targetPosition.height / 2; } return 0; } if (axis === "x") { const diff = getDiff("left"); if (diff === 0) return 0; if (alignment === "start") { const distance = diff - offset2; const shouldScroll = distance <= targetPosition.width || !isList; return shouldScroll ? distance : 0; } const parentWidth = isCustomParent ? parentPosition.width : window.innerWidth; if (alignment === "end") { const distance = diff + offset2 - parentWidth + targetPosition.width; const shouldScroll = distance >= -targetPosition.width || !isList; return shouldScroll ? distance : 0; } if (alignment === "center") { return diff - parentWidth / 2 + targetPosition.width / 2; } return 0; } return 0; }; const getScrollStart = ({ axis, parent }) => { if (!parent && typeof document === "undefined") { return 0; } const method = axis === "y" ? "scrollTop" : "scrollLeft"; if (parent) { return parent[method]; } const { body, documentElement } = document; return body[method] + documentElement[method]; }; const setScrollParam = ({ axis, parent, distance }) => { if (!parent && typeof document === "undefined") { return; } const method = axis === "y" ? "scrollTop" : "scrollLeft"; if (parent) { parent[method] = distance; } else { const { body, documentElement } = document; body[method] = distance; documentElement[method] = distance; } }; function useScrollIntoView({ duration = 1250, axis = "y", onScrollFinish, easing = easeInOutQuad, offset: offset2 = 0, cancelable = true, isList = false } = {}) { const frameID = react.exports.useRef(0); const startTime = react.exports.useRef(0); const shouldStop = react.exports.useRef(false); const scrollableRef = react.exports.useRef(null); const targetRef = react.exports.useRef(null); const reducedMotion = useReducedMotion(); const cancel = () => { if (frameID.current) { cancelAnimationFrame(frameID.current); } }; const scrollIntoView = react.exports.useCallback(({ alignment = "start" } = {}) => { var _a; shouldStop.current = false; if (frameID.current) { cancel(); } const start = (_a = getScrollStart({ parent: scrollableRef.current, axis })) != null ? _a : 0; const change = getRelativePosition({ parent: scrollableRef.current, target: targetRef.current, axis, alignment, offset: offset2, isList }) - (scrollableRef.current ? 0 : start); function animateScroll() { if (startTime.current === 0) { startTime.current = performance.now(); } const now = performance.now(); const elapsed = now - startTime.current; const t = reducedMotion || duration === 0 ? 1 : elapsed / duration; const distance = start + change * easing(t); setScrollParam({ parent: scrollableRef.current, axis, distance }); if (!shouldStop.current && t < 1) { frameID.current = requestAnimationFrame(animateScroll); } else { typeof onScrollFinish === "function" && onScrollFinish(); startTime.current = 0; frameID.current = 0; cancel(); } } animateScroll(); }, [axis, duration, easing, isList, offset2, onScrollFinish, reducedMotion]); const handleStop = () => { if (cancelable) { shouldStop.current = true; } }; useWindowEvent("wheel", handleStop, { passive: true }); useWindowEvent("touchmove", handleStop, { passive: true }); react.exports.useEffect(() => cancel, []); return { scrollableRef, targetRef, scrollIntoView, cancel }; } const defaultState = { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0 }; function useResizeObserver() { const frameID = react.exports.useRef(0); const ref = react.exports.useRef(null); const [rect, setRect] = react.exports.useState(defaultState); const observer = react.exports.useMemo(() => typeof window !== "undefined" ? new ResizeObserver((entries) => { const entry = entries[0]; if (entry) { cancelAnimationFrame(frameID.current); frameID.current = requestAnimationFrame(() => { if (ref.current) { setRect(entry.contentRect); } }); } }) : null, []); react.exports.useEffect(() => { if (ref.current) { observer.observe(ref.current); } return () => { observer.disconnect(); if (frameID.current) { cancelAnimationFrame(frameID.current); } }; }, [ref.current]); return [ref, rect]; } function useElementSize() { const [ref, { width, height }] = useResizeObserver(); return { ref, width, height }; } function getScrollWidth() { if (typeof window === "undefined" || typeof document === "undefined") return 0; const paddingRight = parseInt(window.getComputedStyle(document.body).paddingRight, 10); const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth; return paddingRight + scrollbarWidth; } const getLockStyles = ({ disableBodyPadding }) => { const scrollWidth = disableBodyPadding ? null : getScrollWidth(); const styles = `body { --removed-scroll-width: ${scrollWidth}px; touch-action: none; overflow: hidden !important; position: relative !important; ${scrollWidth ? "padding-right: var(--removed-scroll-width) !important;" : ""} `; return styles; }; function injectStyles(tag, css2) { if (tag.styleSheet) { tag.styleSheet.cssText = css2; } else { tag.appendChild(document.createTextNode(css2)); } } function insertStyleTag(tag) { const head = document.head || document.getElementsByTagName("head")[0]; head.appendChild(tag); } function makeStyleTag() { const tag = document.createElement("style"); tag.type = "text/css"; tag.setAttribute("mantine-scroll-lock", ""); return tag; } function useScrollLock(lock, options = { disableBodyPadding: false }) { const [scrollLocked, setScrollLocked] = react.exports.useState(lock || false); const scrollTop = react.exports.useRef(0); const { disableBodyPadding } = options; const stylesheet = react.exports.useRef(null); const lockScroll = () => { scrollTop.current = window.scrollY; const styles = getLockStyles({ disableBodyPadding }); const sheet = makeStyleTag(); injectStyles(sheet, styles); insertStyleTag(sheet); stylesheet.current = sheet; }; const unlockScroll = () => { if (!(stylesheet == null ? void 0 : stylesheet.current)) return; stylesheet.current.parentNode.removeChild(stylesheet.current); stylesheet.current = null; }; react.exports.useEffect(() => { if (scrollLocked) { lockScroll(); } else { unlockScroll(); } return unlockScroll; }, [scrollLocked]); react.exports.useEffect(() => { if (lock !== void 0) { setScrollLocked(lock); } }, [lock]); react.exports.useEffect(() => { if (lock === void 0 && typeof window !== "undefined") { window.document.body.style.overflow === "hidden" && setScrollLocked(true); } }, [setScrollLocked]); return [scrollLocked, setScrollLocked]; } function useToggle(options = [false, true]) { const [[option], toggle] = react.exports.useReducer((state, action) => { const value = action instanceof Function ? action(state[0]) : action; const index = Math.abs(state.indexOf(value)); return state.slice(index).concat(state.slice(0, index)); }, options); return [option, toggle]; } function getOS() { const { userAgent } = window.navigator; const macosPlatforms = /(Macintosh)|(MacIntel)|(MacPPC)|(Mac68K)/i; const windowsPlatforms = /(Win32)|(Win64)|(Windows)|(WinCE)/i; const iosPlatforms = /(iPhone)|(iPad)|(iPod)/i; if (macosPlatforms.test(userAgent)) { return "macos"; } if (iosPlatforms.test(userAgent)) { return "ios"; } if (windowsPlatforms.test(userAgent)) { return "windows"; } if (/Android/i.test(userAgent)) { return "android"; } if (/Linux/i.test(userAgent)) { return "linux"; } return "undetermined"; } function useOs() { if (typeof window !== "undefined") { return getOS(); } return "undetermined"; } function getInputOnChange(setValue) { return (val) => { if (!val) { setValue(val); } else if (typeof val === "function") { setValue(val); } else if (typeof val === "object" && "nativeEvent" in val) { const { currentTarget } = val; if (currentTarget.type === "checkbox") { setValue(currentTarget.checked); } else { setValue(currentTarget.value); } } else { setValue(val); } }; } function useInputState(initialState) { const [value, setValue] = react.exports.useState(initialState); return [value, getInputOnChange(setValue)]; } function useDisclosure(initialState, callbacks) { const [opened, setOpened] = react.exports.useState(initialState); const open = () => { var _a; if (!opened) { setOpened(true); (_a = callbacks == null ? void 0 : callbacks.onOpen) == null ? void 0 : _a.call(callbacks); } }; const close = () => { var _a; if (opened) { setOpened(false); (_a = callbacks == null ? void 0 : callbacks.onClose) == null ? void 0 : _a.call(callbacks); } }; const toggle = () => { opened ? close() : open(); }; return [opened, { open, close, toggle }]; } function randomId() { return `mantine-${Math.random().toString(36).slice(2, 11)}`; } function upperFirst(value) { return typeof value !== "string" ? "" : value.charAt(0).toUpperCase() + value.slice(1); } var __defProp$1v = Object.defineProperty; var __defProps$I = Object.defineProperties; var __getOwnPropDescs$I = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols$1w = Object.getOwnPropertySymbols; var __hasOwnProp$1w = Object.prototype.hasOwnProperty; var __propIsEnum$1w = Object.prototype.propertyIsEnumerable; var __defNormalProp$1v = (obj, key, value) => key in obj ? __defProp$1v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$1v = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$1w.call(b, prop)) __defNormalProp$1v(a, prop, b[prop]); if (__getOwnPropSymbols$1w) for (var prop of __getOwnPropSymbols$1w(b)) { if (__propIsEnum$1w.call(b, prop)) __defNormalProp$1v(a, prop, b[prop]); } return a; }; var __spreadProps$I = (a, b) => __defProps$I(a, __getOwnPropDescs$I(b)); var __objRest$10 = (source, exclude) => { var target = {}; for (var prop in source) if (__hasOwnProp$1w.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && __getOwnPropSymbols$1w) for (var prop of __getOwnPropSymbols$1w(source)) { if (exclude.indexOf(prop) < 0 && __propIsEnum$1w.call(source, prop)) target[prop] = source[prop]; } return target; }; function getAutoHeightDuration(height) { if (!height || typeof height === "string") { return 0; } const constant = height / 36; return Math.round((4 + 15 * constant ** 0.25 + constant / 5) * 10); } function getElementHeight(el) { return (el == null ? void 0 : el.current) ? el.current.scrollHeight : "auto"; } const raf = typeof window !== "undefined" && window.requestAnimationFrame; function useCollapse({ transitionDuration, transitionTimingFunction = "ease", onTransitionEnd = () => { }, opened }) { const el = react.exports.useRef(null); const collapsedHeight = "0px"; const collapsedStyles = { display: "none", height: "0px", overflow: "hidden" }; const [styles, setStylesRaw] = react.exports.useState(opened ? {} : collapsedStyles); const setStyles = (newStyles) => { reactDom.exports.flushSync(() => setStylesRaw(newStyles)); }; const mergeStyles = (newStyles) => { setStyles((oldStyles) => __spreadValues$1v(__spreadValues$1v({}, oldStyles), newStyles)); }; function getTransitionStyles2(height) { const _duration = transitionDuration || getAutoHeightDuration(height); return { transition: `height ${_duration}ms ${transitionTimingFunction}` }; } useDidUpdate(() => { if (opened) { raf(() => { mergeStyles({ willChange: "height", display: "block", overflow: "hidden" }); raf(() => { const height = getElementHeight(el); mergeStyles(__spreadProps$I(__spreadValues$1v({}, getTransitionStyles2(height)), { height })); }); }); } else { raf(() => { const height = getElementHeight(el); mergeStyles(__spreadProps$I(__spreadValues$1v({}, getTransitionStyles2(height)), { willChange: "height", height })); raf(() => mergeStyles({ height: collapsedHeight, overflow: "hidden" })); }); } }, [opened]); const handleTransitionEnd = (e) => { if (e.target !== el.current || e.propertyName !== "height") { return; } if (opened) { const height = getElementHeight(el); if (height === styles.height) { setStyles({}); } else { mergeStyles({ height }); } onTransitionEnd(); } else if (styles.height === collapsedHeight) { setStyles(collapsedStyles); onTransitionEnd(); } }; function getCollapseProps(_a = {}) { var _b = _a, { style = {}, refKey = "ref" } = _b, rest = __objRest$10(_b, ["style", "refKey"]); const theirRef = rest[refKey]; return __spreadProps$I(__spreadValues$1v({ "aria-hidden": !opened }, rest), { [refKey]: mergeRefs(el, theirRef), onTransitionEnd: handleTransitionEnd, style: __spreadValues$1v(__spreadValues$1v({ boxSizing: "border-box" }, style), styles) }); } return getCollapseProps; } var __defProp$1u = Object.defineProperty; var __getOwnPropSymbols$1v = Object.getOwnPropertySymbols; var __hasOwnProp$1v = Object.prototype.hasOwnProperty; var __propIsEnum$1v = Object.prototype.propertyIsEnumerable; var __defNormalProp$1u = (obj, key, value) => key in obj ? __defProp$1u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$1u = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$1v.call(b, prop)) __defNormalProp$1u(a, prop, b[prop]); if (__getOwnPropSymbols$1v) for (var prop of __getOwnPropSymbols$1v(b)) { if (__propIsEnum$1v.call(b, prop)) __defNormalProp$1u(a, prop, b[prop]); } return a; }; var __objRest$$ = (source, exclude) => { var target = {}; for (var prop in source) if (__hasOwnProp$1v.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && __getOwnPropSymbols$1v) for (var prop of __getOwnPropSymbols$1v(source)) { if (exclude.indexOf(prop) < 0 && __propIsEnum$1v.call(source, prop)) target[prop] = source[prop]; } return target; }; const defaultProps$G = { transitionDuration: 200, transitionTimingFunction: "ease", animateOpacity: true }; const Collapse = react.exports.forwardRef((props, ref) => { const _a = useComponentDefaultProps("Collapse", defaultProps$G, props), { children, in: opened, transitionDuration, transitionTimingFunction, style, onTransitionEnd, animateOpacity } = _a, others = __objRest$$(_a, ["children", "in", "transitionDuration", "transitionTimingFunction", "style", "onTransitionEnd", "animateOpacity"]); const theme = useMantineTheme(); const shouldReduceMotion = useReducedMotion(); const reduceMotion = theme.respectReducedMotion ? shouldReduceMotion : false; const duration = reduceMotion ? 0 : transitionDuration; const { systemStyles, rest } = extractSystemStyles(others); const getCollapseProps = useCollapse({ opened, transitionDuration: duration, transitionTimingFunction, onTransitionEnd }); if (duration === 0) { return opened ? /* @__PURE__ */ jsx(Box, { ...__spreadValues$1u({}, rest), children }) : null; } return /* @__PURE__ */ jsx(Box, { ...__spreadValues$1u({}, getCollapseProps(__spreadValues$1u(__spreadValues$1u({ style, ref }, rest), systemStyles))), children: /* @__PURE__ */ jsx("div", { style: { opacity: opened || !animateOpacity ? 1 : 0, transition: animateOpacity ? `opacity ${duration}ms ${transitionTimingFunction}` : "none" }, children }) }); }); Collapse.displayName = "@mantine/core/Collapse"; var __defProp$1t = Object.defineProperty; var __getOwnPropSymbols$1u = Object.getOwnPropertySymbols; var __hasOwnProp$1u = Object.prototype.hasOwnProperty; var __propIsEnum$1u = Object.prototype.propertyIsEnumerable; var __defNormalProp$1t = (obj, key, value) => key in obj ? __defProp$1t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$1t = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$1u.call(b, prop)) __defNormalProp$1t(a, prop, b[prop]); if (__getOwnPropSymbols$1u) for (var prop of __getOwnPropSymbols$1u(b)) { if (__propIsEnum$1u.call(b, prop)) __defNormalProp$1t(a, prop, b[prop]); } return a; }; var __objRest$_ = (source, exclude) => { var target = {}; for (var prop in source) if (__hasOwnProp$1u.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && __getOwnPropSymbols$1u) for (var prop of __getOwnPropSymbols$1u(source)) { if (exclude.indexOf(prop) < 0 && __propIsEnum$1u.call(source, prop)) target[prop] = source[prop]; } return target; }; const defaultProps$F = { position: { bottom: 0, right: 0 }, zIndex: getDefaultZIndex("modal"), withinPortal: true }; const Affix = react.exports.forwardRef((props, ref) => { const _a = useComponentDefaultProps("Affix", defaultProps$F, props), { target, position, zIndex, sx, withinPortal } = _a, others = __objRest$_(_a, ["target", "position", "zIndex", "sx", "withinPortal"]); return /* @__PURE__ */ jsx(OptionalPortal, { withinPortal, target, children: /* @__PURE__ */ jsx(Box, { ...__spreadValues$1t({ sx: [__spreadValues$1t({ position: "fixed", zIndex }, position), ...packSx(sx)], ref }, others) }) }); }); Affix.displayName = "@mantine/core/Affix"; var __defProp$1s = Object.defineProperty; var __getOwnPropSymbols$1t = Object.getOwnPropertySymbols; var __hasOwnProp$1t = Object.prototype.hasOwnProperty; var __propIsEnum$1t = Object.prototype.propertyIsEnumerable; var __defNormalProp$1s = (obj, key, value) => key in obj ? __defProp$1s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$1s = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$1t.call(b, prop)) __defNormalProp$1s(a, prop, b[prop]); if (__getOwnPropSymbols$1t) for (var prop of __getOwnPropSymbols$1t(b)) { if (__propIsEnum$1t.call(b, prop)) __defNormalProp$1s(a, prop, b[prop]); } return a; }; function CloseIcon(props) { return /* @__PURE__ */ jsx("svg", { ...__spreadValues$1s({ viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props), children: /* @__PURE__ */ jsx("path", { d: "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z", fill: "currentColor", fillRule: "evenodd", clipRule: "evenodd" }) }); } CloseIcon.displayName = "@mantine/core/CloseIcon"; var __defProp$1r = Object.defineProperty; var __getOwnPropSymbols$1s = Object.getOwnPropertySymbols; var __hasOwnProp$1s = Object.prototype.hasOwnProperty; var __propIsEnum$1s = Object.prototype.propertyIsEnumerable; var __defNormalProp$1r = (obj, key, value) => key in obj ? __defProp$1r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$1r = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$1s.call(b, prop)) __defNormalProp$1r(a, prop, b[prop]); if (__getOwnPropSymbols$1s) for (var prop of __getOwnPropSymbols$1s(b)) { if (__propIsEnum$1s.call(b, prop)) __defNormalProp$1r(a, prop, b[prop]); } return a; }; var __objRest$Z = (source, exclude) => { var target = {}; for (var prop in source) if (__hasOwnProp$1s.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && __getOwnPropSymbols$1s) for (var prop of __getOwnPropSymbols$1s(source)) { if (exclude.indexOf(prop) < 0 && __propIsEnum$1s.call(source, prop)) target[prop] = source[prop]; } return target; }; const iconSizes$3 = { xs: 12, sm: 14, md: 16, lg: 20, xl: 24 }; const defaultProps$E = { size: "md" }; const _CloseButton = react.exports.forwardRef((props, ref) => { const _a = useComponentDefaultProps("CloseButton", defaultProps$E, props), { iconSize, size: size2 = "md" } = _a, others = __objRest$Z(_a, ["iconSize", "size"]); const theme = useMantineTheme(); const _iconSize = iconSize || theme.fn.size({ size: size2, sizes: iconSizes$3 }); return /* @__PURE__ */ jsx(ActionIcon, { ...__spreadValues$1r({ size: size2, ref }, others), children: /* @__PURE__ */ jsx(CloseIcon, { width: _iconSize, height: _iconSize }) }); }); _CloseButton.displayName = "@mantine/core/CloseButton"; const CloseButton = createPolymorphicComponent(_CloseButton); const AppShellContext = react.exports.createContext({ zIndex: 1e3, fixed: false, layout: "default" }); const AppShellProvider = AppShellContext.Provider; function useAppShellContext() { return react.exports.useContext(AppShellContext); } function getSortedBreakpoints(breakpoints, theme) { if (!breakpoints) { return []; } const values2 = Object.keys(breakpoints).filter((breakpoint) => breakpoint !== "base").map((breakpoint) => [ theme.fn.size({ size: breakpoint, sizes: theme.breakpoints }), breakpoints[breakpoint] ]); values2.sort((a, b) => a[0] - b[0]); return values2; } var __defProp$1q = Object.defineProperty; var __defProps$H = Object.defineProperties; var __getOwnPropDescs$H = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols$1r = Object.getOwnPropertySymbols; var __hasOwnProp$1r = Object.prototype.hasOwnProperty; var __propIsEnum$1r = Object.prototype.propertyIsEnumerable; var __defNormalProp$1q = (obj, key, value) => key in obj ? __defProp$1q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$1q = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$1r.call(b, prop)) __defNormalProp$1q(a, prop, b[prop]); if (__getOwnPropSymbols$1r) for (var prop of __getOwnPropSymbols$1r(b)) { if (__propIsEnum$1r.call(b, prop)) __defNormalProp$1q(a, prop, b[prop]); } return a; }; var __spreadProps$H = (a, b) => __defProps$H(a, __getOwnPropDescs$H(b)); var useStyles$1l = createStyles((theme, { height, width, fixed, position, hiddenBreakpoint, zIndex, section, withBorder, layout }) => { const breakpoints = typeof width === "object" && width !== null ? getSortedBreakpoints(width, theme).reduce((acc, [breakpoint, breakpointSize]) => { acc[`@media (min-width: ${breakpoint}px)`] = { width: breakpointSize, minWidth: breakpointSize }; return acc; }, {}) : null; const borderStyles = withBorder ? { [section === "navbar" ? "borderRight" : "borderLeft"]: `1px solid ${theme.colorScheme === "dark" ? theme.colors.dark[5] : theme.colors.gray[2]}` } : {}; return { root: __spreadProps$H(__spreadValues$1q(__spreadValues$1q(__spreadProps$H(__spreadValues$1q(__spreadValues$1q({}, theme.fn.fontStyles()), position), { top: layout === "alt" ? 0 : (position == null ? void 0 : position.top) || "var(--mantine-header-height)", bottom: 0, zIndex, height: height || (layout === "alt" ? "auto" : "calc(100vh - var(--mantine-header-height, 0px) - var(--mantine-footer-height, 0px))"), width: (width == null ? void 0 : width.base) || "100%", position: fixed ? "fixed" : "static", boxSizing: "border-box", display: "flex", flexDirection: "column", backgroundColor: theme.colorScheme === "dark" ? theme.colors.dark[7] : theme.white }), borderStyles), breakpoints), { "&[data-hidden]": { [`@media (max-width: ${theme.fn.size({ size: hiddenBreakpoint, sizes: theme.breakpoints }) - 1}px)`]: { display: "none" } } }) }; }); const useStyles$1m = useStyles$1l; var __defProp$1p = Object.defineProperty; var __getOwnPropSymbols$1q = Object.getOwnPropertySymbols; var __hasOwnProp$1q = Object.prototype.hasOwnProperty; var __propIsEnum$1q = Object.prototype.propertyIsEnumerable; var __defNormalProp$1p = (obj, key, value) => key in obj ? __defProp$1p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$1p = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$1q.call(b, prop)) __defNormalProp$1p(a, prop, b[prop]); if (__getOwnPropSymbols$1q) for (var prop of __getOwnPropSymbols$1q(b)) { if (__propIsEnum$1q.call(b, prop)) __defNormalProp$1p(a, prop, b[prop]); } return a; }; var __objRest$Y = (source, exclude) => { var target = {}; for (var prop in source) if (__hasOwnProp$1q.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && __getOwnPropSymbols$1q) for (var prop of __getOwnPropSymbols$1q(source)) { if (exclude.indexOf(prop) < 0 && __propIsEnum$1q.call(source, prop)) target[prop] = source[prop]; } return target; }; const HorizontalSection = react.exports.forwardRef((_a, ref) => { var _b = _a, { width, height, fixed = false, position, zIndex, hiddenBreakpoint = "md", hidden: hidden2 = false, withBorder = true, className, classNames, styles, children, section, __staticSelector, unstyled } = _b, others = __objRest$Y(_b, ["width", "height", "fixed", "position", "zIndex", "hiddenBreakpoint", "hidden", "withBorder", "className", "classNames", "styles", "children", "section", "__staticSelector", "unstyled"]); const ctx = useAppShellContext(); const { classes, cx, theme } = useStyles$1m({ width, height, fixed: ctx.fixed || fixed, position, hiddenBreakpoint, zIndex: zIndex || ctx.zIndex || getDefaultZIndex("app"), section, withBorder, layout: ctx.layout }, { classNames, styles, name: __staticSelector, unstyled }); const breakpoints = getSortedBreakpoints(width, theme).reduce((acc, [breakpoint, breakpointSize]) => { acc[`@media (min-width: ${breakpoint}px)`] = { [`--mantine-${section}-width`]: `${breakpointSize}px` }; return acc; }, {}); return /* @__PURE__ */ jsxs(Box, { ...__spreadValues$1p({ component: section === "navbar" ? "nav" : "aside", ref, "data-hidden": hidden2 || void 0, className: cx(classes.root, className) }, others), children: [children, /* @__PURE__ */ jsx(Global, { styles: () => ({ ":root": __spreadValues$1p({ [`--mantine-${section}-width`]: (width == null ? void 0 : width.base) ? `${width.base}px` : "0px" }, breakpoints) }) })] }); }); HorizontalSection.displayName = "@mantine/core/HorizontalSection"; var __defProp$1o = Object.defineProperty; var __getOwnPropSymbols$1p = Object.getOwnPropertySymbols; var __hasOwnProp$1p = Object.prototype.hasOwnProperty; var __propIsEnum$1p = Object.prototype.propertyIsEnumerable; var __defNormalProp$1o = (obj, key, value) => key in obj ? __defProp$1o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$1o = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$1p.call(b, prop)) __defNormalProp$1o(a, prop, b[prop]); if (__getOwnPropSymbols$1p) for (var prop of __getOwnPropSymbols$1p(b)) { if (__propIsEnum$1p.call(b, prop)) __defNormalProp$1o(a, prop, b[prop]); } return a; }; var __objRest$X = (source, exclude) => { var target = {}; for (var prop in source) if (__hasOwnProp$1p.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && __getOwnPropSymbols$1p) for (var prop of __getOwnPropSymbols$1p(source)) { if (exclude.indexOf(prop) < 0 && __propIsEnum$1p.call(source, prop)) target[prop] = source[prop]; } return target; }; const _Section = react.exports.forwardRef((_a, ref) => { var _b = _a, { children, grow = false, sx } = _b, others = __objRest$X(_b, ["children", "grow", "sx"]); return /* @__PURE__ */ jsx(Box, { ...__spreadValues$1o({ ref, sx: [{ flex: grow ? 1 : 0, boxSizing: "border-box" }, ...packSx(sx)] }, others), children }); }); _Section.displayName = "@mantine/core/Section"; const Section = createPolymorphicComponent(_Section); var __defProp$1n = Object.defineProperty; var __getOwnPropSymbols$1o = Object.getOwnPropertySymbols; var __hasOwnProp$1o = Object.prototype.hasOwnProperty; var __propIsEnum$1o = Object.prototype.propertyIsEnumerable; var __defNormalProp$1n = (obj, key, value) => key in obj ? __defProp$1n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$1n = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$1o.call(b, prop)) __defNormalProp$1n(a, prop, b[prop]); if (__getOwnPropSymbols$1o) for (var prop of __getOwnPropSymbols$1o(b)) { if (__propIsEnum$1o.call(b