1889 lines
69 KiB
JavaScript
1889 lines
69 KiB
JavaScript
"use client";
|
|
import {
|
|
Primitive,
|
|
Slot,
|
|
createContext2,
|
|
createContextScope,
|
|
dispatchDiscreteCustomEvent,
|
|
useComposedRefs
|
|
} from "./chunk-QHTSRVLB.js";
|
|
import {
|
|
require_react_dom
|
|
} from "./chunk-FD5SMSK5.js";
|
|
import {
|
|
require_jsx_runtime
|
|
} from "./chunk-7CC4PDZ5.js";
|
|
import {
|
|
require_react
|
|
} from "./chunk-YHPANKLD.js";
|
|
import {
|
|
__toESM
|
|
} from "./chunk-PR4QN5HX.js";
|
|
|
|
// node_modules/@radix-ui/react-dialog/dist/index.mjs
|
|
var React20 = __toESM(require_react(), 1);
|
|
|
|
// node_modules/@radix-ui/primitive/dist/index.mjs
|
|
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
return function handleEvent(event) {
|
|
originalEventHandler == null ? void 0 : originalEventHandler(event);
|
|
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
return ourEventHandler == null ? void 0 : ourEventHandler(event);
|
|
}
|
|
};
|
|
}
|
|
|
|
// node_modules/@radix-ui/react-id/dist/index.mjs
|
|
var React2 = __toESM(require_react(), 1);
|
|
|
|
// node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
|
|
var React = __toESM(require_react(), 1);
|
|
var useLayoutEffect2 = Boolean(globalThis == null ? void 0 : globalThis.document) ? React.useLayoutEffect : () => {
|
|
};
|
|
|
|
// node_modules/@radix-ui/react-id/dist/index.mjs
|
|
var useReactId = React2["useId".toString()] || (() => void 0);
|
|
var count = 0;
|
|
function useId(deterministicId) {
|
|
const [id, setId] = React2.useState(useReactId());
|
|
useLayoutEffect2(() => {
|
|
if (!deterministicId) setId((reactId) => reactId ?? String(count++));
|
|
}, [deterministicId]);
|
|
return deterministicId || (id ? `radix-${id}` : "");
|
|
}
|
|
|
|
// node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
var React4 = __toESM(require_react(), 1);
|
|
|
|
// node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
|
|
var React3 = __toESM(require_react(), 1);
|
|
function useCallbackRef(callback) {
|
|
const callbackRef = React3.useRef(callback);
|
|
React3.useEffect(() => {
|
|
callbackRef.current = callback;
|
|
});
|
|
return React3.useMemo(() => (...args) => {
|
|
var _a;
|
|
return (_a = callbackRef.current) == null ? void 0 : _a.call(callbackRef, ...args);
|
|
}, []);
|
|
}
|
|
|
|
// node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
function useControllableState({
|
|
prop,
|
|
defaultProp,
|
|
onChange = () => {
|
|
}
|
|
}) {
|
|
const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });
|
|
const isControlled = prop !== void 0;
|
|
const value = isControlled ? prop : uncontrolledProp;
|
|
const handleChange = useCallbackRef(onChange);
|
|
const setValue = React4.useCallback(
|
|
(nextValue) => {
|
|
if (isControlled) {
|
|
const setter = nextValue;
|
|
const value2 = typeof nextValue === "function" ? setter(prop) : nextValue;
|
|
if (value2 !== prop) handleChange(value2);
|
|
} else {
|
|
setUncontrolledProp(nextValue);
|
|
}
|
|
},
|
|
[isControlled, prop, setUncontrolledProp, handleChange]
|
|
);
|
|
return [value, setValue];
|
|
}
|
|
function useUncontrolledState({
|
|
defaultProp,
|
|
onChange
|
|
}) {
|
|
const uncontrolledState = React4.useState(defaultProp);
|
|
const [value] = uncontrolledState;
|
|
const prevValueRef = React4.useRef(value);
|
|
const handleChange = useCallbackRef(onChange);
|
|
React4.useEffect(() => {
|
|
if (prevValueRef.current !== value) {
|
|
handleChange(value);
|
|
prevValueRef.current = value;
|
|
}
|
|
}, [value, prevValueRef, handleChange]);
|
|
return uncontrolledState;
|
|
}
|
|
|
|
// node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
|
|
var React6 = __toESM(require_react(), 1);
|
|
|
|
// node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs
|
|
var React5 = __toESM(require_react(), 1);
|
|
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
|
|
React5.useEffect(() => {
|
|
const handleKeyDown = (event) => {
|
|
if (event.key === "Escape") {
|
|
onEscapeKeyDown(event);
|
|
}
|
|
};
|
|
ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
}, [onEscapeKeyDown, ownerDocument]);
|
|
}
|
|
|
|
// node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
|
|
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
|
|
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
var originalBodyPointerEvents;
|
|
var DismissableLayerContext = React6.createContext({
|
|
layers: /* @__PURE__ */ new Set(),
|
|
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
branches: /* @__PURE__ */ new Set()
|
|
});
|
|
var DismissableLayer = React6.forwardRef(
|
|
(props, forwardedRef) => {
|
|
const {
|
|
disableOutsidePointerEvents = false,
|
|
onEscapeKeyDown,
|
|
onPointerDownOutside,
|
|
onFocusOutside,
|
|
onInteractOutside,
|
|
onDismiss,
|
|
...layerProps
|
|
} = props;
|
|
const context = React6.useContext(DismissableLayerContext);
|
|
const [node, setNode] = React6.useState(null);
|
|
const ownerDocument = (node == null ? void 0 : node.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document);
|
|
const [, force] = React6.useState({});
|
|
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
|
|
const layers = Array.from(context.layers);
|
|
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
const index = node ? layers.indexOf(node) : -1;
|
|
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
const target = event.target;
|
|
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
onPointerDownOutside == null ? void 0 : onPointerDownOutside(event);
|
|
onInteractOutside == null ? void 0 : onInteractOutside(event);
|
|
if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
|
|
}, ownerDocument);
|
|
const focusOutside = useFocusOutside((event) => {
|
|
const target = event.target;
|
|
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
if (isFocusInBranch) return;
|
|
onFocusOutside == null ? void 0 : onFocusOutside(event);
|
|
onInteractOutside == null ? void 0 : onInteractOutside(event);
|
|
if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
|
|
}, ownerDocument);
|
|
useEscapeKeydown((event) => {
|
|
const isHighestLayer = index === context.layers.size - 1;
|
|
if (!isHighestLayer) return;
|
|
onEscapeKeyDown == null ? void 0 : onEscapeKeyDown(event);
|
|
if (!event.defaultPrevented && onDismiss) {
|
|
event.preventDefault();
|
|
onDismiss();
|
|
}
|
|
}, ownerDocument);
|
|
React6.useEffect(() => {
|
|
if (!node) return;
|
|
if (disableOutsidePointerEvents) {
|
|
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
ownerDocument.body.style.pointerEvents = "none";
|
|
}
|
|
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
}
|
|
context.layers.add(node);
|
|
dispatchUpdate();
|
|
return () => {
|
|
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
}
|
|
};
|
|
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
React6.useEffect(() => {
|
|
return () => {
|
|
if (!node) return;
|
|
context.layers.delete(node);
|
|
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
dispatchUpdate();
|
|
};
|
|
}, [node, context]);
|
|
React6.useEffect(() => {
|
|
const handleUpdate = () => force({});
|
|
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
}, []);
|
|
return (0, import_jsx_runtime.jsx)(
|
|
Primitive.div,
|
|
{
|
|
...layerProps,
|
|
ref: composedRefs,
|
|
style: {
|
|
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
...props.style
|
|
},
|
|
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
onPointerDownCapture: composeEventHandlers(
|
|
props.onPointerDownCapture,
|
|
pointerDownOutside.onPointerDownCapture
|
|
)
|
|
}
|
|
);
|
|
}
|
|
);
|
|
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
var BRANCH_NAME = "DismissableLayerBranch";
|
|
var DismissableLayerBranch = React6.forwardRef((props, forwardedRef) => {
|
|
const context = React6.useContext(DismissableLayerContext);
|
|
const ref = React6.useRef(null);
|
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
React6.useEffect(() => {
|
|
const node = ref.current;
|
|
if (node) {
|
|
context.branches.add(node);
|
|
return () => {
|
|
context.branches.delete(node);
|
|
};
|
|
}
|
|
}, [context.branches]);
|
|
return (0, import_jsx_runtime.jsx)(Primitive.div, { ...props, ref: composedRefs });
|
|
});
|
|
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
const isPointerInsideReactTreeRef = React6.useRef(false);
|
|
const handleClickRef = React6.useRef(() => {
|
|
});
|
|
React6.useEffect(() => {
|
|
const handlePointerDown = (event) => {
|
|
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
handleAndDispatchCustomEvent(
|
|
POINTER_DOWN_OUTSIDE,
|
|
handlePointerDownOutside,
|
|
eventDetail,
|
|
{ discrete: true }
|
|
);
|
|
};
|
|
var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;
|
|
const eventDetail = { originalEvent: event };
|
|
if (event.pointerType === "touch") {
|
|
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
} else {
|
|
handleAndDispatchPointerDownOutsideEvent2();
|
|
}
|
|
} else {
|
|
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
}
|
|
isPointerInsideReactTreeRef.current = false;
|
|
};
|
|
const timerId = window.setTimeout(() => {
|
|
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
}, 0);
|
|
return () => {
|
|
window.clearTimeout(timerId);
|
|
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
};
|
|
}, [ownerDocument, handlePointerDownOutside]);
|
|
return {
|
|
// ensures we check React component tree (not just DOM tree)
|
|
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
};
|
|
}
|
|
function useFocusOutside(onFocusOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
const handleFocusOutside = useCallbackRef(onFocusOutside);
|
|
const isFocusInsideReactTreeRef = React6.useRef(false);
|
|
React6.useEffect(() => {
|
|
const handleFocus = (event) => {
|
|
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
const eventDetail = { originalEvent: event };
|
|
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
discrete: false
|
|
});
|
|
}
|
|
};
|
|
ownerDocument.addEventListener("focusin", handleFocus);
|
|
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
|
}, [ownerDocument, handleFocusOutside]);
|
|
return {
|
|
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
|
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
};
|
|
}
|
|
function dispatchUpdate() {
|
|
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
document.dispatchEvent(event);
|
|
}
|
|
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
const target = detail.originalEvent.target;
|
|
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
if (handler) target.addEventListener(name, handler, { once: true });
|
|
if (discrete) {
|
|
dispatchDiscreteCustomEvent(target, event);
|
|
} else {
|
|
target.dispatchEvent(event);
|
|
}
|
|
}
|
|
|
|
// node_modules/@radix-ui/react-focus-scope/dist/index.mjs
|
|
var React7 = __toESM(require_react(), 1);
|
|
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
|
|
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
var FOCUS_SCOPE_NAME = "FocusScope";
|
|
var FocusScope = React7.forwardRef((props, forwardedRef) => {
|
|
const {
|
|
loop = false,
|
|
trapped = false,
|
|
onMountAutoFocus: onMountAutoFocusProp,
|
|
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
|
...scopeProps
|
|
} = props;
|
|
const [container, setContainer] = React7.useState(null);
|
|
const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp);
|
|
const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);
|
|
const lastFocusedElementRef = React7.useRef(null);
|
|
const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
|
|
const focusScope = React7.useRef({
|
|
paused: false,
|
|
pause() {
|
|
this.paused = true;
|
|
},
|
|
resume() {
|
|
this.paused = false;
|
|
}
|
|
}).current;
|
|
React7.useEffect(() => {
|
|
if (trapped) {
|
|
let handleFocusIn2 = function(event) {
|
|
if (focusScope.paused || !container) return;
|
|
const target = event.target;
|
|
if (container.contains(target)) {
|
|
lastFocusedElementRef.current = target;
|
|
} else {
|
|
focus(lastFocusedElementRef.current, { select: true });
|
|
}
|
|
}, handleFocusOut2 = function(event) {
|
|
if (focusScope.paused || !container) return;
|
|
const relatedTarget = event.relatedTarget;
|
|
if (relatedTarget === null) return;
|
|
if (!container.contains(relatedTarget)) {
|
|
focus(lastFocusedElementRef.current, { select: true });
|
|
}
|
|
}, handleMutations2 = function(mutations) {
|
|
const focusedElement = document.activeElement;
|
|
if (focusedElement !== document.body) return;
|
|
for (const mutation of mutations) {
|
|
if (mutation.removedNodes.length > 0) focus(container);
|
|
}
|
|
};
|
|
var handleFocusIn = handleFocusIn2, handleFocusOut = handleFocusOut2, handleMutations = handleMutations2;
|
|
document.addEventListener("focusin", handleFocusIn2);
|
|
document.addEventListener("focusout", handleFocusOut2);
|
|
const mutationObserver = new MutationObserver(handleMutations2);
|
|
if (container) mutationObserver.observe(container, { childList: true, subtree: true });
|
|
return () => {
|
|
document.removeEventListener("focusin", handleFocusIn2);
|
|
document.removeEventListener("focusout", handleFocusOut2);
|
|
mutationObserver.disconnect();
|
|
};
|
|
}
|
|
}, [trapped, container, focusScope.paused]);
|
|
React7.useEffect(() => {
|
|
if (container) {
|
|
focusScopesStack.add(focusScope);
|
|
const previouslyFocusedElement = document.activeElement;
|
|
const hasFocusedCandidate = container.contains(previouslyFocusedElement);
|
|
if (!hasFocusedCandidate) {
|
|
const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
|
|
container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
container.dispatchEvent(mountEvent);
|
|
if (!mountEvent.defaultPrevented) {
|
|
focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
|
|
if (document.activeElement === previouslyFocusedElement) {
|
|
focus(container);
|
|
}
|
|
}
|
|
}
|
|
return () => {
|
|
container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
setTimeout(() => {
|
|
const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
|
|
container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
container.dispatchEvent(unmountEvent);
|
|
if (!unmountEvent.defaultPrevented) {
|
|
focus(previouslyFocusedElement ?? document.body, { select: true });
|
|
}
|
|
container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
focusScopesStack.remove(focusScope);
|
|
}, 0);
|
|
};
|
|
}
|
|
}, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
|
|
const handleKeyDown = React7.useCallback(
|
|
(event) => {
|
|
if (!loop && !trapped) return;
|
|
if (focusScope.paused) return;
|
|
const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
const focusedElement = document.activeElement;
|
|
if (isTabKey && focusedElement) {
|
|
const container2 = event.currentTarget;
|
|
const [first, last] = getTabbableEdges(container2);
|
|
const hasTabbableElementsInside = first && last;
|
|
if (!hasTabbableElementsInside) {
|
|
if (focusedElement === container2) event.preventDefault();
|
|
} else {
|
|
if (!event.shiftKey && focusedElement === last) {
|
|
event.preventDefault();
|
|
if (loop) focus(first, { select: true });
|
|
} else if (event.shiftKey && focusedElement === first) {
|
|
event.preventDefault();
|
|
if (loop) focus(last, { select: true });
|
|
}
|
|
}
|
|
}
|
|
},
|
|
[loop, trapped, focusScope.paused]
|
|
);
|
|
return (0, import_jsx_runtime2.jsx)(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
});
|
|
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
function focusFirst(candidates, { select = false } = {}) {
|
|
const previouslyFocusedElement = document.activeElement;
|
|
for (const candidate of candidates) {
|
|
focus(candidate, { select });
|
|
if (document.activeElement !== previouslyFocusedElement) return;
|
|
}
|
|
}
|
|
function getTabbableEdges(container) {
|
|
const candidates = getTabbableCandidates(container);
|
|
const first = findVisible(candidates, container);
|
|
const last = findVisible(candidates.reverse(), container);
|
|
return [first, last];
|
|
}
|
|
function getTabbableCandidates(container) {
|
|
const nodes = [];
|
|
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
acceptNode: (node) => {
|
|
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
|
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
}
|
|
});
|
|
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
return nodes;
|
|
}
|
|
function findVisible(elements, container) {
|
|
for (const element of elements) {
|
|
if (!isHidden(element, { upTo: container })) return element;
|
|
}
|
|
}
|
|
function isHidden(node, { upTo }) {
|
|
if (getComputedStyle(node).visibility === "hidden") return true;
|
|
while (node) {
|
|
if (upTo !== void 0 && node === upTo) return false;
|
|
if (getComputedStyle(node).display === "none") return true;
|
|
node = node.parentElement;
|
|
}
|
|
return false;
|
|
}
|
|
function isSelectableInput(element) {
|
|
return element instanceof HTMLInputElement && "select" in element;
|
|
}
|
|
function focus(element, { select = false } = {}) {
|
|
if (element && element.focus) {
|
|
const previouslyFocusedElement = document.activeElement;
|
|
element.focus({ preventScroll: true });
|
|
if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
|
|
element.select();
|
|
}
|
|
}
|
|
var focusScopesStack = createFocusScopesStack();
|
|
function createFocusScopesStack() {
|
|
let stack = [];
|
|
return {
|
|
add(focusScope) {
|
|
const activeFocusScope = stack[0];
|
|
if (focusScope !== activeFocusScope) {
|
|
activeFocusScope == null ? void 0 : activeFocusScope.pause();
|
|
}
|
|
stack = arrayRemove(stack, focusScope);
|
|
stack.unshift(focusScope);
|
|
},
|
|
remove(focusScope) {
|
|
var _a;
|
|
stack = arrayRemove(stack, focusScope);
|
|
(_a = stack[0]) == null ? void 0 : _a.resume();
|
|
}
|
|
};
|
|
}
|
|
function arrayRemove(array, item) {
|
|
const updatedArray = [...array];
|
|
const index = updatedArray.indexOf(item);
|
|
if (index !== -1) {
|
|
updatedArray.splice(index, 1);
|
|
}
|
|
return updatedArray;
|
|
}
|
|
function removeLinks(items) {
|
|
return items.filter((item) => item.tagName !== "A");
|
|
}
|
|
|
|
// node_modules/@radix-ui/react-portal/dist/index.mjs
|
|
var React8 = __toESM(require_react(), 1);
|
|
var import_react_dom = __toESM(require_react_dom(), 1);
|
|
var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
|
|
var PORTAL_NAME = "Portal";
|
|
var Portal = React8.forwardRef((props, forwardedRef) => {
|
|
var _a;
|
|
const { container: containerProp, ...portalProps } = props;
|
|
const [mounted, setMounted] = React8.useState(false);
|
|
useLayoutEffect2(() => setMounted(true), []);
|
|
const container = containerProp || mounted && ((_a = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : _a.body);
|
|
return container ? import_react_dom.default.createPortal((0, import_jsx_runtime3.jsx)(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
});
|
|
Portal.displayName = PORTAL_NAME;
|
|
|
|
// node_modules/@radix-ui/react-presence/dist/index.mjs
|
|
var React22 = __toESM(require_react(), 1);
|
|
var React9 = __toESM(require_react(), 1);
|
|
function useStateMachine(initialState, machine) {
|
|
return React9.useReducer((state, event) => {
|
|
const nextState = machine[state][event];
|
|
return nextState ?? state;
|
|
}, initialState);
|
|
}
|
|
var Presence = (props) => {
|
|
const { present, children } = props;
|
|
const presence = usePresence(present);
|
|
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React22.Children.only(children);
|
|
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
const forceMount = typeof children === "function";
|
|
return forceMount || presence.isPresent ? React22.cloneElement(child, { ref }) : null;
|
|
};
|
|
Presence.displayName = "Presence";
|
|
function usePresence(present) {
|
|
const [node, setNode] = React22.useState();
|
|
const stylesRef = React22.useRef({});
|
|
const prevPresentRef = React22.useRef(present);
|
|
const prevAnimationNameRef = React22.useRef("none");
|
|
const initialState = present ? "mounted" : "unmounted";
|
|
const [state, send] = useStateMachine(initialState, {
|
|
mounted: {
|
|
UNMOUNT: "unmounted",
|
|
ANIMATION_OUT: "unmountSuspended"
|
|
},
|
|
unmountSuspended: {
|
|
MOUNT: "mounted",
|
|
ANIMATION_END: "unmounted"
|
|
},
|
|
unmounted: {
|
|
MOUNT: "mounted"
|
|
}
|
|
});
|
|
React22.useEffect(() => {
|
|
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
}, [state]);
|
|
useLayoutEffect2(() => {
|
|
const styles = stylesRef.current;
|
|
const wasPresent = prevPresentRef.current;
|
|
const hasPresentChanged = wasPresent !== present;
|
|
if (hasPresentChanged) {
|
|
const prevAnimationName = prevAnimationNameRef.current;
|
|
const currentAnimationName = getAnimationName(styles);
|
|
if (present) {
|
|
send("MOUNT");
|
|
} else if (currentAnimationName === "none" || (styles == null ? void 0 : styles.display) === "none") {
|
|
send("UNMOUNT");
|
|
} else {
|
|
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
if (wasPresent && isAnimating) {
|
|
send("ANIMATION_OUT");
|
|
} else {
|
|
send("UNMOUNT");
|
|
}
|
|
}
|
|
prevPresentRef.current = present;
|
|
}
|
|
}, [present, send]);
|
|
useLayoutEffect2(() => {
|
|
if (node) {
|
|
let timeoutId;
|
|
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
const handleAnimationEnd = (event) => {
|
|
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
|
|
if (event.target === node && isCurrentAnimation) {
|
|
send("ANIMATION_END");
|
|
if (!prevPresentRef.current) {
|
|
const currentFillMode = node.style.animationFillMode;
|
|
node.style.animationFillMode = "forwards";
|
|
timeoutId = ownerWindow.setTimeout(() => {
|
|
if (node.style.animationFillMode === "forwards") {
|
|
node.style.animationFillMode = currentFillMode;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
};
|
|
const handleAnimationStart = (event) => {
|
|
if (event.target === node) {
|
|
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
}
|
|
};
|
|
node.addEventListener("animationstart", handleAnimationStart);
|
|
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
node.addEventListener("animationend", handleAnimationEnd);
|
|
return () => {
|
|
ownerWindow.clearTimeout(timeoutId);
|
|
node.removeEventListener("animationstart", handleAnimationStart);
|
|
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
node.removeEventListener("animationend", handleAnimationEnd);
|
|
};
|
|
} else {
|
|
send("ANIMATION_END");
|
|
}
|
|
}, [node, send]);
|
|
return {
|
|
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
ref: React22.useCallback((node2) => {
|
|
if (node2) stylesRef.current = getComputedStyle(node2);
|
|
setNode(node2);
|
|
}, [])
|
|
};
|
|
}
|
|
function getAnimationName(styles) {
|
|
return (styles == null ? void 0 : styles.animationName) || "none";
|
|
}
|
|
function getElementRef(element) {
|
|
var _a, _b;
|
|
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
if (mayWarn) {
|
|
return element.ref;
|
|
}
|
|
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
if (mayWarn) {
|
|
return element.props.ref;
|
|
}
|
|
return element.props.ref || element.ref;
|
|
}
|
|
|
|
// node_modules/@radix-ui/react-focus-guards/dist/index.mjs
|
|
var React10 = __toESM(require_react(), 1);
|
|
var count2 = 0;
|
|
function useFocusGuards() {
|
|
React10.useEffect(() => {
|
|
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
|
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
|
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
|
count2++;
|
|
return () => {
|
|
if (count2 === 1) {
|
|
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
|
}
|
|
count2--;
|
|
};
|
|
}, []);
|
|
}
|
|
function createFocusGuard() {
|
|
const element = document.createElement("span");
|
|
element.setAttribute("data-radix-focus-guard", "");
|
|
element.tabIndex = 0;
|
|
element.style.outline = "none";
|
|
element.style.opacity = "0";
|
|
element.style.position = "fixed";
|
|
element.style.pointerEvents = "none";
|
|
return element;
|
|
}
|
|
|
|
// node_modules/tslib/tslib.es6.mjs
|
|
var __assign = function() {
|
|
__assign = Object.assign || function __assign2(t) {
|
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
s = arguments[i];
|
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
}
|
|
return t;
|
|
};
|
|
return __assign.apply(this, arguments);
|
|
};
|
|
function __rest(s, e) {
|
|
var t = {};
|
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
t[p] = s[p];
|
|
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
t[p[i]] = s[p[i]];
|
|
}
|
|
return t;
|
|
}
|
|
function __spreadArray(to, from, pack) {
|
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
if (ar || !(i in from)) {
|
|
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
ar[i] = from[i];
|
|
}
|
|
}
|
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
}
|
|
|
|
// node_modules/react-remove-scroll/dist/es2015/Combination.js
|
|
var React19 = __toESM(require_react());
|
|
|
|
// node_modules/react-remove-scroll/dist/es2015/UI.js
|
|
var React15 = __toESM(require_react());
|
|
|
|
// node_modules/react-remove-scroll-bar/dist/es2015/constants.js
|
|
var zeroRightClassName = "right-scroll-bar-position";
|
|
var fullWidthClassName = "width-before-scroll-bar";
|
|
var noScrollbarsClassName = "with-scroll-bars-hidden";
|
|
var removedBarSizeVariable = "--removed-body-scroll-bar-size";
|
|
|
|
// node_modules/use-callback-ref/dist/es2015/assignRef.js
|
|
function assignRef(ref, value) {
|
|
if (typeof ref === "function") {
|
|
ref(value);
|
|
} else if (ref) {
|
|
ref.current = value;
|
|
}
|
|
return ref;
|
|
}
|
|
|
|
// node_modules/use-callback-ref/dist/es2015/useRef.js
|
|
var import_react = __toESM(require_react());
|
|
function useCallbackRef2(initialValue, callback) {
|
|
var ref = (0, import_react.useState)(function() {
|
|
return {
|
|
// value
|
|
value: initialValue,
|
|
// last callback
|
|
callback,
|
|
// "memoized" public interface
|
|
facade: {
|
|
get current() {
|
|
return ref.value;
|
|
},
|
|
set current(value) {
|
|
var last = ref.value;
|
|
if (last !== value) {
|
|
ref.value = value;
|
|
ref.callback(value, last);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
})[0];
|
|
ref.callback = callback;
|
|
return ref.facade;
|
|
}
|
|
|
|
// node_modules/use-callback-ref/dist/es2015/useMergeRef.js
|
|
var React11 = __toESM(require_react());
|
|
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React11.useLayoutEffect : React11.useEffect;
|
|
var currentValues = /* @__PURE__ */ new WeakMap();
|
|
function useMergeRefs(refs, defaultValue) {
|
|
var callbackRef = useCallbackRef2(defaultValue || null, function(newValue) {
|
|
return refs.forEach(function(ref) {
|
|
return assignRef(ref, newValue);
|
|
});
|
|
});
|
|
useIsomorphicLayoutEffect(function() {
|
|
var oldValue = currentValues.get(callbackRef);
|
|
if (oldValue) {
|
|
var prevRefs_1 = new Set(oldValue);
|
|
var nextRefs_1 = new Set(refs);
|
|
var current_1 = callbackRef.current;
|
|
prevRefs_1.forEach(function(ref) {
|
|
if (!nextRefs_1.has(ref)) {
|
|
assignRef(ref, null);
|
|
}
|
|
});
|
|
nextRefs_1.forEach(function(ref) {
|
|
if (!prevRefs_1.has(ref)) {
|
|
assignRef(ref, current_1);
|
|
}
|
|
});
|
|
}
|
|
currentValues.set(callbackRef, refs);
|
|
}, [refs]);
|
|
return callbackRef;
|
|
}
|
|
|
|
// node_modules/use-sidecar/dist/es2015/hoc.js
|
|
var React12 = __toESM(require_react());
|
|
|
|
// node_modules/use-sidecar/dist/es2015/hook.js
|
|
var import_react2 = __toESM(require_react());
|
|
|
|
// node_modules/use-sidecar/dist/es2015/medium.js
|
|
function ItoI(a) {
|
|
return a;
|
|
}
|
|
function innerCreateMedium(defaults, middleware) {
|
|
if (middleware === void 0) {
|
|
middleware = ItoI;
|
|
}
|
|
var buffer = [];
|
|
var assigned = false;
|
|
var medium = {
|
|
read: function() {
|
|
if (assigned) {
|
|
throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
|
|
}
|
|
if (buffer.length) {
|
|
return buffer[buffer.length - 1];
|
|
}
|
|
return defaults;
|
|
},
|
|
useMedium: function(data) {
|
|
var item = middleware(data, assigned);
|
|
buffer.push(item);
|
|
return function() {
|
|
buffer = buffer.filter(function(x) {
|
|
return x !== item;
|
|
});
|
|
};
|
|
},
|
|
assignSyncMedium: function(cb) {
|
|
assigned = true;
|
|
while (buffer.length) {
|
|
var cbs = buffer;
|
|
buffer = [];
|
|
cbs.forEach(cb);
|
|
}
|
|
buffer = {
|
|
push: function(x) {
|
|
return cb(x);
|
|
},
|
|
filter: function() {
|
|
return buffer;
|
|
}
|
|
};
|
|
},
|
|
assignMedium: function(cb) {
|
|
assigned = true;
|
|
var pendingQueue = [];
|
|
if (buffer.length) {
|
|
var cbs = buffer;
|
|
buffer = [];
|
|
cbs.forEach(cb);
|
|
pendingQueue = buffer;
|
|
}
|
|
var executeQueue = function() {
|
|
var cbs2 = pendingQueue;
|
|
pendingQueue = [];
|
|
cbs2.forEach(cb);
|
|
};
|
|
var cycle = function() {
|
|
return Promise.resolve().then(executeQueue);
|
|
};
|
|
cycle();
|
|
buffer = {
|
|
push: function(x) {
|
|
pendingQueue.push(x);
|
|
cycle();
|
|
},
|
|
filter: function(filter) {
|
|
pendingQueue = pendingQueue.filter(filter);
|
|
return buffer;
|
|
}
|
|
};
|
|
}
|
|
};
|
|
return medium;
|
|
}
|
|
function createSidecarMedium(options) {
|
|
if (options === void 0) {
|
|
options = {};
|
|
}
|
|
var medium = innerCreateMedium(null);
|
|
medium.options = __assign({ async: true, ssr: false }, options);
|
|
return medium;
|
|
}
|
|
|
|
// node_modules/use-sidecar/dist/es2015/renderProp.js
|
|
var React13 = __toESM(require_react());
|
|
var import_react3 = __toESM(require_react());
|
|
|
|
// node_modules/use-sidecar/dist/es2015/exports.js
|
|
var React14 = __toESM(require_react());
|
|
var SideCar = function(_a) {
|
|
var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
|
|
if (!sideCar) {
|
|
throw new Error("Sidecar: please provide `sideCar` property to import the right car");
|
|
}
|
|
var Target = sideCar.read();
|
|
if (!Target) {
|
|
throw new Error("Sidecar medium not found");
|
|
}
|
|
return React14.createElement(Target, __assign({}, rest));
|
|
};
|
|
SideCar.isSideCarExport = true;
|
|
function exportSidecar(medium, exported) {
|
|
medium.useMedium(exported);
|
|
return SideCar;
|
|
}
|
|
|
|
// node_modules/react-remove-scroll/dist/es2015/medium.js
|
|
var effectCar = createSidecarMedium();
|
|
|
|
// node_modules/react-remove-scroll/dist/es2015/UI.js
|
|
var nothing = function() {
|
|
return;
|
|
};
|
|
var RemoveScroll = React15.forwardRef(function(props, parentRef) {
|
|
var ref = React15.useRef(null);
|
|
var _a = React15.useState({
|
|
onScrollCapture: nothing,
|
|
onWheelCapture: nothing,
|
|
onTouchMoveCapture: nothing
|
|
}), callbacks = _a[0], setCallbacks = _a[1];
|
|
var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noRelative = props.noRelative, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? "div" : _b, gapMode = props.gapMode, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
|
|
var SideCar2 = sideCar;
|
|
var containerRef = useMergeRefs([ref, parentRef]);
|
|
var containerProps = __assign(__assign({}, rest), callbacks);
|
|
return React15.createElement(
|
|
React15.Fragment,
|
|
null,
|
|
enabled && React15.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noRelative, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
|
|
forwardProps ? React15.cloneElement(React15.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React15.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
|
|
);
|
|
});
|
|
RemoveScroll.defaultProps = {
|
|
enabled: true,
|
|
removeScrollBar: true,
|
|
inert: false
|
|
};
|
|
RemoveScroll.classNames = {
|
|
fullWidth: fullWidthClassName,
|
|
zeroRight: zeroRightClassName
|
|
};
|
|
|
|
// node_modules/react-remove-scroll/dist/es2015/SideEffect.js
|
|
var React18 = __toESM(require_react());
|
|
|
|
// node_modules/react-remove-scroll-bar/dist/es2015/component.js
|
|
var React17 = __toESM(require_react());
|
|
|
|
// node_modules/react-style-singleton/dist/es2015/hook.js
|
|
var React16 = __toESM(require_react());
|
|
|
|
// node_modules/get-nonce/dist/es2015/index.js
|
|
var currentNonce;
|
|
var getNonce = function() {
|
|
if (currentNonce) {
|
|
return currentNonce;
|
|
}
|
|
if (typeof __webpack_nonce__ !== "undefined") {
|
|
return __webpack_nonce__;
|
|
}
|
|
return void 0;
|
|
};
|
|
|
|
// node_modules/react-style-singleton/dist/es2015/singleton.js
|
|
function makeStyleTag() {
|
|
if (!document)
|
|
return null;
|
|
var tag = document.createElement("style");
|
|
tag.type = "text/css";
|
|
var nonce = getNonce();
|
|
if (nonce) {
|
|
tag.setAttribute("nonce", nonce);
|
|
}
|
|
return tag;
|
|
}
|
|
function injectStyles(tag, css) {
|
|
if (tag.styleSheet) {
|
|
tag.styleSheet.cssText = css;
|
|
} else {
|
|
tag.appendChild(document.createTextNode(css));
|
|
}
|
|
}
|
|
function insertStyleTag(tag) {
|
|
var head = document.head || document.getElementsByTagName("head")[0];
|
|
head.appendChild(tag);
|
|
}
|
|
var stylesheetSingleton = function() {
|
|
var counter = 0;
|
|
var stylesheet = null;
|
|
return {
|
|
add: function(style) {
|
|
if (counter == 0) {
|
|
if (stylesheet = makeStyleTag()) {
|
|
injectStyles(stylesheet, style);
|
|
insertStyleTag(stylesheet);
|
|
}
|
|
}
|
|
counter++;
|
|
},
|
|
remove: function() {
|
|
counter--;
|
|
if (!counter && stylesheet) {
|
|
stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
|
|
stylesheet = null;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
// node_modules/react-style-singleton/dist/es2015/hook.js
|
|
var styleHookSingleton = function() {
|
|
var sheet = stylesheetSingleton();
|
|
return function(styles, isDynamic) {
|
|
React16.useEffect(function() {
|
|
sheet.add(styles);
|
|
return function() {
|
|
sheet.remove();
|
|
};
|
|
}, [styles && isDynamic]);
|
|
};
|
|
};
|
|
|
|
// node_modules/react-style-singleton/dist/es2015/component.js
|
|
var styleSingleton = function() {
|
|
var useStyle = styleHookSingleton();
|
|
var Sheet = function(_a) {
|
|
var styles = _a.styles, dynamic = _a.dynamic;
|
|
useStyle(styles, dynamic);
|
|
return null;
|
|
};
|
|
return Sheet;
|
|
};
|
|
|
|
// node_modules/react-remove-scroll-bar/dist/es2015/utils.js
|
|
var zeroGap = {
|
|
left: 0,
|
|
top: 0,
|
|
right: 0,
|
|
gap: 0
|
|
};
|
|
var parse = function(x) {
|
|
return parseInt(x || "", 10) || 0;
|
|
};
|
|
var getOffset = function(gapMode) {
|
|
var cs = window.getComputedStyle(document.body);
|
|
var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
|
|
var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
|
|
var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
|
|
return [parse(left), parse(top), parse(right)];
|
|
};
|
|
var getGapWidth = function(gapMode) {
|
|
if (gapMode === void 0) {
|
|
gapMode = "margin";
|
|
}
|
|
if (typeof window === "undefined") {
|
|
return zeroGap;
|
|
}
|
|
var offsets = getOffset(gapMode);
|
|
var documentWidth = document.documentElement.clientWidth;
|
|
var windowWidth = window.innerWidth;
|
|
return {
|
|
left: offsets[0],
|
|
top: offsets[1],
|
|
right: offsets[2],
|
|
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
|
|
};
|
|
};
|
|
|
|
// node_modules/react-remove-scroll-bar/dist/es2015/component.js
|
|
var Style = styleSingleton();
|
|
var lockAttribute = "data-scroll-locked";
|
|
var getStyles = function(_a, allowRelative, gapMode, important) {
|
|
var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
|
|
if (gapMode === void 0) {
|
|
gapMode = "margin";
|
|
}
|
|
return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
|
|
allowRelative && "position: relative ".concat(important, ";"),
|
|
gapMode === "margin" && "\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
|
|
gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
|
|
].filter(Boolean).join(""), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
|
|
};
|
|
var getCurrentUseCounter = function() {
|
|
var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
|
|
return isFinite(counter) ? counter : 0;
|
|
};
|
|
var useLockAttribute = function() {
|
|
React17.useEffect(function() {
|
|
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
|
|
return function() {
|
|
var newCounter = getCurrentUseCounter() - 1;
|
|
if (newCounter <= 0) {
|
|
document.body.removeAttribute(lockAttribute);
|
|
} else {
|
|
document.body.setAttribute(lockAttribute, newCounter.toString());
|
|
}
|
|
};
|
|
}, []);
|
|
};
|
|
var RemoveScrollBar = function(_a) {
|
|
var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
|
|
useLockAttribute();
|
|
var gap = React17.useMemo(function() {
|
|
return getGapWidth(gapMode);
|
|
}, [gapMode]);
|
|
return React17.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
|
|
};
|
|
|
|
// node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js
|
|
var passiveSupported = false;
|
|
if (typeof window !== "undefined") {
|
|
try {
|
|
options = Object.defineProperty({}, "passive", {
|
|
get: function() {
|
|
passiveSupported = true;
|
|
return true;
|
|
}
|
|
});
|
|
window.addEventListener("test", options, options);
|
|
window.removeEventListener("test", options, options);
|
|
} catch (err) {
|
|
passiveSupported = false;
|
|
}
|
|
}
|
|
var options;
|
|
var nonPassive = passiveSupported ? { passive: false } : false;
|
|
|
|
// node_modules/react-remove-scroll/dist/es2015/handleScroll.js
|
|
var alwaysContainsScroll = function(node) {
|
|
return node.tagName === "TEXTAREA";
|
|
};
|
|
var elementCanBeScrolled = function(node, overflow) {
|
|
if (!(node instanceof Element)) {
|
|
return false;
|
|
}
|
|
var styles = window.getComputedStyle(node);
|
|
return (
|
|
// not-not-scrollable
|
|
styles[overflow] !== "hidden" && // contains scroll inside self
|
|
!(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
|
|
);
|
|
};
|
|
var elementCouldBeVScrolled = function(node) {
|
|
return elementCanBeScrolled(node, "overflowY");
|
|
};
|
|
var elementCouldBeHScrolled = function(node) {
|
|
return elementCanBeScrolled(node, "overflowX");
|
|
};
|
|
var locationCouldBeScrolled = function(axis, node) {
|
|
var ownerDocument = node.ownerDocument;
|
|
var current = node;
|
|
do {
|
|
if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
|
|
current = current.host;
|
|
}
|
|
var isScrollable = elementCouldBeScrolled(axis, current);
|
|
if (isScrollable) {
|
|
var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
|
|
if (scrollHeight > clientHeight) {
|
|
return true;
|
|
}
|
|
}
|
|
current = current.parentNode;
|
|
} while (current && current !== ownerDocument.body);
|
|
return false;
|
|
};
|
|
var getVScrollVariables = function(_a) {
|
|
var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
|
|
return [
|
|
scrollTop,
|
|
scrollHeight,
|
|
clientHeight
|
|
];
|
|
};
|
|
var getHScrollVariables = function(_a) {
|
|
var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
return [
|
|
scrollLeft,
|
|
scrollWidth,
|
|
clientWidth
|
|
];
|
|
};
|
|
var elementCouldBeScrolled = function(axis, node) {
|
|
return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
|
|
};
|
|
var getScrollVariables = function(axis, node) {
|
|
return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
|
|
};
|
|
var getDirectionFactor = function(axis, direction) {
|
|
return axis === "h" && direction === "rtl" ? -1 : 1;
|
|
};
|
|
var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
|
|
var delta = directionFactor * sourceDelta;
|
|
var target = event.target;
|
|
var targetInLock = endTarget.contains(target);
|
|
var shouldCancelScroll = false;
|
|
var isDeltaPositive = delta > 0;
|
|
var availableScroll = 0;
|
|
var availableScrollTop = 0;
|
|
do {
|
|
if (!target) {
|
|
break;
|
|
}
|
|
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
|
|
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
if (position || elementScroll) {
|
|
if (elementCouldBeScrolled(axis, target)) {
|
|
availableScroll += elementScroll;
|
|
availableScrollTop += position;
|
|
}
|
|
}
|
|
var parent_1 = target.parentNode;
|
|
target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
|
|
} while (
|
|
// portaled content
|
|
!targetInLock && target !== document.body || // self content
|
|
targetInLock && (endTarget.contains(target) || endTarget === target)
|
|
);
|
|
if (isDeltaPositive && (noOverscroll && Math.abs(availableScroll) < 1 || !noOverscroll && delta > availableScroll)) {
|
|
shouldCancelScroll = true;
|
|
} else if (!isDeltaPositive && (noOverscroll && Math.abs(availableScrollTop) < 1 || !noOverscroll && -delta > availableScrollTop)) {
|
|
shouldCancelScroll = true;
|
|
}
|
|
return shouldCancelScroll;
|
|
};
|
|
|
|
// node_modules/react-remove-scroll/dist/es2015/SideEffect.js
|
|
var getTouchXY = function(event) {
|
|
return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
|
|
};
|
|
var getDeltaXY = function(event) {
|
|
return [event.deltaX, event.deltaY];
|
|
};
|
|
var extractRef = function(ref) {
|
|
return ref && "current" in ref ? ref.current : ref;
|
|
};
|
|
var deltaCompare = function(x, y) {
|
|
return x[0] === y[0] && x[1] === y[1];
|
|
};
|
|
var generateStyle = function(id) {
|
|
return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n");
|
|
};
|
|
var idCounter = 0;
|
|
var lockStack = [];
|
|
function RemoveScrollSideCar(props) {
|
|
var shouldPreventQueue = React18.useRef([]);
|
|
var touchStartRef = React18.useRef([0, 0]);
|
|
var activeAxis = React18.useRef();
|
|
var id = React18.useState(idCounter++)[0];
|
|
var Style2 = React18.useState(styleSingleton)[0];
|
|
var lastProps = React18.useRef(props);
|
|
React18.useEffect(function() {
|
|
lastProps.current = props;
|
|
}, [props]);
|
|
React18.useEffect(function() {
|
|
if (props.inert) {
|
|
document.body.classList.add("block-interactivity-".concat(id));
|
|
var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
|
|
allow_1.forEach(function(el) {
|
|
return el.classList.add("allow-interactivity-".concat(id));
|
|
});
|
|
return function() {
|
|
document.body.classList.remove("block-interactivity-".concat(id));
|
|
allow_1.forEach(function(el) {
|
|
return el.classList.remove("allow-interactivity-".concat(id));
|
|
});
|
|
};
|
|
}
|
|
return;
|
|
}, [props.inert, props.lockRef.current, props.shards]);
|
|
var shouldCancelEvent = React18.useCallback(function(event, parent) {
|
|
if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) {
|
|
return !lastProps.current.allowPinchZoom;
|
|
}
|
|
var touch = getTouchXY(event);
|
|
var touchStart = touchStartRef.current;
|
|
var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0];
|
|
var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1];
|
|
var currentAxis;
|
|
var target = event.target;
|
|
var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v";
|
|
if ("touches" in event && moveDirection === "h" && target.type === "range") {
|
|
return false;
|
|
}
|
|
var selection = window.getSelection();
|
|
var anchorNode = selection && selection.anchorNode;
|
|
var isTouchingSelection = anchorNode ? anchorNode === target || anchorNode.contains(target) : false;
|
|
if (isTouchingSelection) {
|
|
return false;
|
|
}
|
|
var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
if (!canBeScrolledInMainDirection) {
|
|
return true;
|
|
}
|
|
if (canBeScrolledInMainDirection) {
|
|
currentAxis = moveDirection;
|
|
} else {
|
|
currentAxis = moveDirection === "v" ? "h" : "v";
|
|
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
}
|
|
if (!canBeScrolledInMainDirection) {
|
|
return false;
|
|
}
|
|
if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) {
|
|
activeAxis.current = currentAxis;
|
|
}
|
|
if (!currentAxis) {
|
|
return true;
|
|
}
|
|
var cancelingAxis = activeAxis.current || currentAxis;
|
|
return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY, true);
|
|
}, []);
|
|
var shouldPrevent = React18.useCallback(function(_event) {
|
|
var event = _event;
|
|
if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
|
|
return;
|
|
}
|
|
var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event);
|
|
var sourceEvent = shouldPreventQueue.current.filter(function(e) {
|
|
return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta);
|
|
})[0];
|
|
if (sourceEvent && sourceEvent.should) {
|
|
if (event.cancelable) {
|
|
event.preventDefault();
|
|
}
|
|
return;
|
|
}
|
|
if (!sourceEvent) {
|
|
var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node) {
|
|
return node.contains(event.target);
|
|
});
|
|
var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
|
|
if (shouldStop) {
|
|
if (event.cancelable) {
|
|
event.preventDefault();
|
|
}
|
|
}
|
|
}
|
|
}, []);
|
|
var shouldCancel = React18.useCallback(function(name, delta, target, should) {
|
|
var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
|
|
shouldPreventQueue.current.push(event);
|
|
setTimeout(function() {
|
|
shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) {
|
|
return e !== event;
|
|
});
|
|
}, 1);
|
|
}, []);
|
|
var scrollTouchStart = React18.useCallback(function(event) {
|
|
touchStartRef.current = getTouchXY(event);
|
|
activeAxis.current = void 0;
|
|
}, []);
|
|
var scrollWheel = React18.useCallback(function(event) {
|
|
shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
}, []);
|
|
var scrollTouchMove = React18.useCallback(function(event) {
|
|
shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
}, []);
|
|
React18.useEffect(function() {
|
|
lockStack.push(Style2);
|
|
props.setCallbacks({
|
|
onScrollCapture: scrollWheel,
|
|
onWheelCapture: scrollWheel,
|
|
onTouchMoveCapture: scrollTouchMove
|
|
});
|
|
document.addEventListener("wheel", shouldPrevent, nonPassive);
|
|
document.addEventListener("touchmove", shouldPrevent, nonPassive);
|
|
document.addEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
return function() {
|
|
lockStack = lockStack.filter(function(inst) {
|
|
return inst !== Style2;
|
|
});
|
|
document.removeEventListener("wheel", shouldPrevent, nonPassive);
|
|
document.removeEventListener("touchmove", shouldPrevent, nonPassive);
|
|
document.removeEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
};
|
|
}, []);
|
|
var removeScrollBar = props.removeScrollBar, inert = props.inert;
|
|
return React18.createElement(
|
|
React18.Fragment,
|
|
null,
|
|
inert ? React18.createElement(Style2, { styles: generateStyle(id) }) : null,
|
|
removeScrollBar ? React18.createElement(RemoveScrollBar, { noRelative: props.noRelative, gapMode: props.gapMode }) : null
|
|
);
|
|
}
|
|
function getOutermostShadowParent(node) {
|
|
var shadowParent = null;
|
|
while (node !== null) {
|
|
if (node instanceof ShadowRoot) {
|
|
shadowParent = node.host;
|
|
node = node.host;
|
|
}
|
|
node = node.parentNode;
|
|
}
|
|
return shadowParent;
|
|
}
|
|
|
|
// node_modules/react-remove-scroll/dist/es2015/sidecar.js
|
|
var sidecar_default = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
|
|
// node_modules/react-remove-scroll/dist/es2015/Combination.js
|
|
var ReactRemoveScroll = React19.forwardRef(function(props, ref) {
|
|
return React19.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: sidecar_default }));
|
|
});
|
|
ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
var Combination_default = ReactRemoveScroll;
|
|
|
|
// node_modules/aria-hidden/dist/es2015/index.js
|
|
var getDefaultParent = function(originalTarget) {
|
|
if (typeof document === "undefined") {
|
|
return null;
|
|
}
|
|
var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
|
|
return sampleTarget.ownerDocument.body;
|
|
};
|
|
var counterMap = /* @__PURE__ */ new WeakMap();
|
|
var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
var markerMap = {};
|
|
var lockCount = 0;
|
|
var unwrapHost = function(node) {
|
|
return node && (node.host || unwrapHost(node.parentNode));
|
|
};
|
|
var correctTargets = function(parent, targets) {
|
|
return targets.map(function(target) {
|
|
if (parent.contains(target)) {
|
|
return target;
|
|
}
|
|
var correctedTarget = unwrapHost(target);
|
|
if (correctedTarget && parent.contains(correctedTarget)) {
|
|
return correctedTarget;
|
|
}
|
|
console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
|
|
return null;
|
|
}).filter(function(x) {
|
|
return Boolean(x);
|
|
});
|
|
};
|
|
var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
|
|
var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
if (!markerMap[markerName]) {
|
|
markerMap[markerName] = /* @__PURE__ */ new WeakMap();
|
|
}
|
|
var markerCounter = markerMap[markerName];
|
|
var hiddenNodes = [];
|
|
var elementsToKeep = /* @__PURE__ */ new Set();
|
|
var elementsToStop = new Set(targets);
|
|
var keep = function(el) {
|
|
if (!el || elementsToKeep.has(el)) {
|
|
return;
|
|
}
|
|
elementsToKeep.add(el);
|
|
keep(el.parentNode);
|
|
};
|
|
targets.forEach(keep);
|
|
var deep = function(parent) {
|
|
if (!parent || elementsToStop.has(parent)) {
|
|
return;
|
|
}
|
|
Array.prototype.forEach.call(parent.children, function(node) {
|
|
if (elementsToKeep.has(node)) {
|
|
deep(node);
|
|
} else {
|
|
try {
|
|
var attr = node.getAttribute(controlAttribute);
|
|
var alreadyHidden = attr !== null && attr !== "false";
|
|
var counterValue = (counterMap.get(node) || 0) + 1;
|
|
var markerValue = (markerCounter.get(node) || 0) + 1;
|
|
counterMap.set(node, counterValue);
|
|
markerCounter.set(node, markerValue);
|
|
hiddenNodes.push(node);
|
|
if (counterValue === 1 && alreadyHidden) {
|
|
uncontrolledNodes.set(node, true);
|
|
}
|
|
if (markerValue === 1) {
|
|
node.setAttribute(markerName, "true");
|
|
}
|
|
if (!alreadyHidden) {
|
|
node.setAttribute(controlAttribute, "true");
|
|
}
|
|
} catch (e) {
|
|
console.error("aria-hidden: cannot operate on ", node, e);
|
|
}
|
|
}
|
|
});
|
|
};
|
|
deep(parentNode);
|
|
elementsToKeep.clear();
|
|
lockCount++;
|
|
return function() {
|
|
hiddenNodes.forEach(function(node) {
|
|
var counterValue = counterMap.get(node) - 1;
|
|
var markerValue = markerCounter.get(node) - 1;
|
|
counterMap.set(node, counterValue);
|
|
markerCounter.set(node, markerValue);
|
|
if (!counterValue) {
|
|
if (!uncontrolledNodes.has(node)) {
|
|
node.removeAttribute(controlAttribute);
|
|
}
|
|
uncontrolledNodes.delete(node);
|
|
}
|
|
if (!markerValue) {
|
|
node.removeAttribute(markerName);
|
|
}
|
|
});
|
|
lockCount--;
|
|
if (!lockCount) {
|
|
counterMap = /* @__PURE__ */ new WeakMap();
|
|
counterMap = /* @__PURE__ */ new WeakMap();
|
|
uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
markerMap = {};
|
|
}
|
|
};
|
|
};
|
|
var hideOthers = function(originalTarget, parentNode, markerName) {
|
|
if (markerName === void 0) {
|
|
markerName = "data-aria-hidden";
|
|
}
|
|
var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
var activeParentNode = parentNode || getDefaultParent(originalTarget);
|
|
if (!activeParentNode) {
|
|
return function() {
|
|
return null;
|
|
};
|
|
}
|
|
targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script")));
|
|
return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
|
|
};
|
|
|
|
// node_modules/@radix-ui/react-dialog/dist/index.mjs
|
|
var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
|
|
var DIALOG_NAME = "Dialog";
|
|
var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
|
|
var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
|
|
var Dialog = (props) => {
|
|
const {
|
|
__scopeDialog,
|
|
children,
|
|
open: openProp,
|
|
defaultOpen,
|
|
onOpenChange,
|
|
modal = true
|
|
} = props;
|
|
const triggerRef = React20.useRef(null);
|
|
const contentRef = React20.useRef(null);
|
|
const [open = false, setOpen] = useControllableState({
|
|
prop: openProp,
|
|
defaultProp: defaultOpen,
|
|
onChange: onOpenChange
|
|
});
|
|
return (0, import_jsx_runtime4.jsx)(
|
|
DialogProvider,
|
|
{
|
|
scope: __scopeDialog,
|
|
triggerRef,
|
|
contentRef,
|
|
contentId: useId(),
|
|
titleId: useId(),
|
|
descriptionId: useId(),
|
|
open,
|
|
onOpenChange: setOpen,
|
|
onOpenToggle: React20.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
modal,
|
|
children
|
|
}
|
|
);
|
|
};
|
|
Dialog.displayName = DIALOG_NAME;
|
|
var TRIGGER_NAME = "DialogTrigger";
|
|
var DialogTrigger = React20.forwardRef(
|
|
(props, forwardedRef) => {
|
|
const { __scopeDialog, ...triggerProps } = props;
|
|
const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
|
|
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
return (0, import_jsx_runtime4.jsx)(
|
|
Primitive.button,
|
|
{
|
|
type: "button",
|
|
"aria-haspopup": "dialog",
|
|
"aria-expanded": context.open,
|
|
"aria-controls": context.contentId,
|
|
"data-state": getState(context.open),
|
|
...triggerProps,
|
|
ref: composedTriggerRef,
|
|
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
}
|
|
);
|
|
}
|
|
);
|
|
DialogTrigger.displayName = TRIGGER_NAME;
|
|
var PORTAL_NAME2 = "DialogPortal";
|
|
var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME2, {
|
|
forceMount: void 0
|
|
});
|
|
var DialogPortal = (props) => {
|
|
const { __scopeDialog, forceMount, children, container } = props;
|
|
const context = useDialogContext(PORTAL_NAME2, __scopeDialog);
|
|
return (0, import_jsx_runtime4.jsx)(PortalProvider, { scope: __scopeDialog, forceMount, children: React20.Children.map(children, (child) => (0, import_jsx_runtime4.jsx)(Presence, { present: forceMount || context.open, children: (0, import_jsx_runtime4.jsx)(Portal, { asChild: true, container, children: child }) })) });
|
|
};
|
|
DialogPortal.displayName = PORTAL_NAME2;
|
|
var OVERLAY_NAME = "DialogOverlay";
|
|
var DialogOverlay = React20.forwardRef(
|
|
(props, forwardedRef) => {
|
|
const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
|
|
const { forceMount = portalContext.forceMount, ...overlayProps } = props;
|
|
const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
|
|
return context.modal ? (0, import_jsx_runtime4.jsx)(Presence, { present: forceMount || context.open, children: (0, import_jsx_runtime4.jsx)(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
|
|
}
|
|
);
|
|
DialogOverlay.displayName = OVERLAY_NAME;
|
|
var DialogOverlayImpl = React20.forwardRef(
|
|
(props, forwardedRef) => {
|
|
const { __scopeDialog, ...overlayProps } = props;
|
|
const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
|
|
return (
|
|
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
// ie. when `Overlay` and `Content` are siblings
|
|
(0, import_jsx_runtime4.jsx)(Combination_default, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: (0, import_jsx_runtime4.jsx)(
|
|
Primitive.div,
|
|
{
|
|
"data-state": getState(context.open),
|
|
...overlayProps,
|
|
ref: forwardedRef,
|
|
style: { pointerEvents: "auto", ...overlayProps.style }
|
|
}
|
|
) })
|
|
);
|
|
}
|
|
);
|
|
var CONTENT_NAME = "DialogContent";
|
|
var DialogContent = React20.forwardRef(
|
|
(props, forwardedRef) => {
|
|
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
|
|
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
return (0, import_jsx_runtime4.jsx)(Presence, { present: forceMount || context.open, children: context.modal ? (0, import_jsx_runtime4.jsx)(DialogContentModal, { ...contentProps, ref: forwardedRef }) : (0, import_jsx_runtime4.jsx)(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
|
|
}
|
|
);
|
|
DialogContent.displayName = CONTENT_NAME;
|
|
var DialogContentModal = React20.forwardRef(
|
|
(props, forwardedRef) => {
|
|
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
const contentRef = React20.useRef(null);
|
|
const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
|
|
React20.useEffect(() => {
|
|
const content = contentRef.current;
|
|
if (content) return hideOthers(content);
|
|
}, []);
|
|
return (0, import_jsx_runtime4.jsx)(
|
|
DialogContentImpl,
|
|
{
|
|
...props,
|
|
ref: composedRefs,
|
|
trapFocus: context.open,
|
|
disableOutsidePointerEvents: true,
|
|
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
var _a;
|
|
event.preventDefault();
|
|
(_a = context.triggerRef.current) == null ? void 0 : _a.focus();
|
|
}),
|
|
onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
|
|
const originalEvent = event.detail.originalEvent;
|
|
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
if (isRightClick) event.preventDefault();
|
|
}),
|
|
onFocusOutside: composeEventHandlers(
|
|
props.onFocusOutside,
|
|
(event) => event.preventDefault()
|
|
)
|
|
}
|
|
);
|
|
}
|
|
);
|
|
var DialogContentNonModal = React20.forwardRef(
|
|
(props, forwardedRef) => {
|
|
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
const hasInteractedOutsideRef = React20.useRef(false);
|
|
const hasPointerDownOutsideRef = React20.useRef(false);
|
|
return (0, import_jsx_runtime4.jsx)(
|
|
DialogContentImpl,
|
|
{
|
|
...props,
|
|
ref: forwardedRef,
|
|
trapFocus: false,
|
|
disableOutsidePointerEvents: false,
|
|
onCloseAutoFocus: (event) => {
|
|
var _a, _b;
|
|
(_a = props.onCloseAutoFocus) == null ? void 0 : _a.call(props, event);
|
|
if (!event.defaultPrevented) {
|
|
if (!hasInteractedOutsideRef.current) (_b = context.triggerRef.current) == null ? void 0 : _b.focus();
|
|
event.preventDefault();
|
|
}
|
|
hasInteractedOutsideRef.current = false;
|
|
hasPointerDownOutsideRef.current = false;
|
|
},
|
|
onInteractOutside: (event) => {
|
|
var _a, _b;
|
|
(_a = props.onInteractOutside) == null ? void 0 : _a.call(props, event);
|
|
if (!event.defaultPrevented) {
|
|
hasInteractedOutsideRef.current = true;
|
|
if (event.detail.originalEvent.type === "pointerdown") {
|
|
hasPointerDownOutsideRef.current = true;
|
|
}
|
|
}
|
|
const target = event.target;
|
|
const targetIsTrigger = (_b = context.triggerRef.current) == null ? void 0 : _b.contains(target);
|
|
if (targetIsTrigger) event.preventDefault();
|
|
if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
|
|
event.preventDefault();
|
|
}
|
|
}
|
|
}
|
|
);
|
|
}
|
|
);
|
|
var DialogContentImpl = React20.forwardRef(
|
|
(props, forwardedRef) => {
|
|
const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
|
|
const context = useDialogContext(CONTENT_NAME, __scopeDialog);
|
|
const contentRef = React20.useRef(null);
|
|
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
useFocusGuards();
|
|
return (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
(0, import_jsx_runtime4.jsx)(
|
|
FocusScope,
|
|
{
|
|
asChild: true,
|
|
loop: true,
|
|
trapped: trapFocus,
|
|
onMountAutoFocus: onOpenAutoFocus,
|
|
onUnmountAutoFocus: onCloseAutoFocus,
|
|
children: (0, import_jsx_runtime4.jsx)(
|
|
DismissableLayer,
|
|
{
|
|
role: "dialog",
|
|
id: context.contentId,
|
|
"aria-describedby": context.descriptionId,
|
|
"aria-labelledby": context.titleId,
|
|
"data-state": getState(context.open),
|
|
...contentProps,
|
|
ref: composedRefs,
|
|
onDismiss: () => context.onOpenChange(false)
|
|
}
|
|
)
|
|
}
|
|
),
|
|
(0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
(0, import_jsx_runtime4.jsx)(TitleWarning, { titleId: context.titleId }),
|
|
(0, import_jsx_runtime4.jsx)(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
|
|
] })
|
|
] });
|
|
}
|
|
);
|
|
var TITLE_NAME = "DialogTitle";
|
|
var DialogTitle = React20.forwardRef(
|
|
(props, forwardedRef) => {
|
|
const { __scopeDialog, ...titleProps } = props;
|
|
const context = useDialogContext(TITLE_NAME, __scopeDialog);
|
|
return (0, import_jsx_runtime4.jsx)(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
|
|
}
|
|
);
|
|
DialogTitle.displayName = TITLE_NAME;
|
|
var DESCRIPTION_NAME = "DialogDescription";
|
|
var DialogDescription = React20.forwardRef(
|
|
(props, forwardedRef) => {
|
|
const { __scopeDialog, ...descriptionProps } = props;
|
|
const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
|
|
return (0, import_jsx_runtime4.jsx)(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
|
|
}
|
|
);
|
|
DialogDescription.displayName = DESCRIPTION_NAME;
|
|
var CLOSE_NAME = "DialogClose";
|
|
var DialogClose = React20.forwardRef(
|
|
(props, forwardedRef) => {
|
|
const { __scopeDialog, ...closeProps } = props;
|
|
const context = useDialogContext(CLOSE_NAME, __scopeDialog);
|
|
return (0, import_jsx_runtime4.jsx)(
|
|
Primitive.button,
|
|
{
|
|
type: "button",
|
|
...closeProps,
|
|
ref: forwardedRef,
|
|
onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
|
|
}
|
|
);
|
|
}
|
|
);
|
|
DialogClose.displayName = CLOSE_NAME;
|
|
function getState(open) {
|
|
return open ? "open" : "closed";
|
|
}
|
|
var TITLE_WARNING_NAME = "DialogTitleWarning";
|
|
var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
|
|
contentName: CONTENT_NAME,
|
|
titleName: TITLE_NAME,
|
|
docsSlug: "dialog"
|
|
});
|
|
var TitleWarning = ({ titleId }) => {
|
|
const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
|
|
const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
|
|
|
|
If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
|
|
For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
|
|
React20.useEffect(() => {
|
|
if (titleId) {
|
|
const hasTitle = document.getElementById(titleId);
|
|
if (!hasTitle) console.error(MESSAGE);
|
|
}
|
|
}, [MESSAGE, titleId]);
|
|
return null;
|
|
};
|
|
var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
|
|
var DescriptionWarning = ({ contentRef, descriptionId }) => {
|
|
const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
|
|
const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
|
|
React20.useEffect(() => {
|
|
var _a;
|
|
const describedById = (_a = contentRef.current) == null ? void 0 : _a.getAttribute("aria-describedby");
|
|
if (descriptionId && describedById) {
|
|
const hasDescription = document.getElementById(descriptionId);
|
|
if (!hasDescription) console.warn(MESSAGE);
|
|
}
|
|
}, [MESSAGE, contentRef, descriptionId]);
|
|
return null;
|
|
};
|
|
var Root = Dialog;
|
|
var Trigger = DialogTrigger;
|
|
var Portal2 = DialogPortal;
|
|
var Overlay = DialogOverlay;
|
|
var Content = DialogContent;
|
|
var Title = DialogTitle;
|
|
var Description = DialogDescription;
|
|
var Close = DialogClose;
|
|
export {
|
|
Close,
|
|
Content,
|
|
Description,
|
|
Dialog,
|
|
DialogClose,
|
|
DialogContent,
|
|
DialogDescription,
|
|
DialogOverlay,
|
|
DialogPortal,
|
|
DialogTitle,
|
|
DialogTrigger,
|
|
Overlay,
|
|
Portal2 as Portal,
|
|
Root,
|
|
Title,
|
|
Trigger,
|
|
WarningProvider,
|
|
createDialogScope
|
|
};
|
|
//# sourceMappingURL=@radix-ui_react-dialog.js.map
|