644 lines
27 KiB
JavaScript
644 lines
27 KiB
JavaScript
import { o as __toESM, t as require_react } from "./react-B9yD8JC6.js";
|
|
import { t as require_react_dom } from "./react-dom.js";
|
|
import { t as require_jsx_runtime } from "./react_jsx-runtime.js";
|
|
//#region ../../AppData/Local/Yarn/Berry/cache/@radix-ui-primitive-npm-1.1.3-1a99afa9af-10c0.zip/node_modules/@radix-ui/primitive/dist/index.mjs
|
|
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
var import_jsx_runtime = require_jsx_runtime();
|
|
typeof window !== "undefined" && window.document && window.document.createElement;
|
|
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
return function handleEvent(event) {
|
|
originalEventHandler?.(event);
|
|
if (checkForDefaultPrevented === false || !event.defaultPrevented) return ourEventHandler?.(event);
|
|
};
|
|
}
|
|
//#endregion
|
|
//#region .yarn/__virtual__/@radix-ui-react-compose-refs-virtual-c6b21933dd/3/AppData/Local/Yarn/Berry/cache/@radix-ui-react-compose-refs-npm-1.1.2-f0371f8267-10c0.zip/node_modules/@radix-ui/react-compose-refs/dist/index.mjs
|
|
var import_react_dom = /* @__PURE__ */ __toESM(require_react_dom(), 1);
|
|
function setRef(ref, value) {
|
|
if (typeof ref === "function") return ref(value);
|
|
else if (ref !== null && ref !== void 0) ref.current = value;
|
|
}
|
|
function composeRefs(...refs) {
|
|
return (node) => {
|
|
let hasCleanup = false;
|
|
const cleanups = refs.map((ref) => {
|
|
const cleanup = setRef(ref, node);
|
|
if (!hasCleanup && typeof cleanup == "function") hasCleanup = true;
|
|
return cleanup;
|
|
});
|
|
if (hasCleanup) return () => {
|
|
for (let i = 0; i < cleanups.length; i++) {
|
|
const cleanup = cleanups[i];
|
|
if (typeof cleanup == "function") cleanup();
|
|
else setRef(refs[i], null);
|
|
}
|
|
};
|
|
};
|
|
}
|
|
function useComposedRefs(...refs) {
|
|
return import_react.useCallback(composeRefs(...refs), refs);
|
|
}
|
|
//#endregion
|
|
//#region .yarn/__virtual__/@radix-ui-react-context-virtual-0b36a80fc9/3/AppData/Local/Yarn/Berry/cache/@radix-ui-react-context-npm-1.1.2-8b506f5df0-10c0.zip/node_modules/@radix-ui/react-context/dist/index.mjs
|
|
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
let defaultContexts = [];
|
|
function createContext3(rootComponentName, defaultContext) {
|
|
const BaseContext = import_react.createContext(defaultContext);
|
|
const index = defaultContexts.length;
|
|
defaultContexts = [...defaultContexts, defaultContext];
|
|
const Provider = (props) => {
|
|
const { scope, children, ...context } = props;
|
|
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
const value = import_react.useMemo(() => context, Object.values(context));
|
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Provider, {
|
|
value,
|
|
children
|
|
});
|
|
};
|
|
Provider.displayName = rootComponentName + "Provider";
|
|
function useContext2(consumerName, scope) {
|
|
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
const context = import_react.useContext(Context);
|
|
if (context) return context;
|
|
if (defaultContext !== void 0) return defaultContext;
|
|
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
}
|
|
return [Provider, useContext2];
|
|
}
|
|
const createScope = () => {
|
|
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
return import_react.createContext(defaultContext);
|
|
});
|
|
return function useScope(scope) {
|
|
const contexts = scope?.[scopeName] || scopeContexts;
|
|
return import_react.useMemo(() => ({ [`__scope${scopeName}`]: {
|
|
...scope,
|
|
[scopeName]: contexts
|
|
} }), [scope, contexts]);
|
|
};
|
|
};
|
|
createScope.scopeName = scopeName;
|
|
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
}
|
|
function composeContextScopes(...scopes) {
|
|
const baseScope = scopes[0];
|
|
if (scopes.length === 1) return baseScope;
|
|
const createScope = () => {
|
|
const scopeHooks = scopes.map((createScope2) => ({
|
|
useScope: createScope2(),
|
|
scopeName: createScope2.scopeName
|
|
}));
|
|
return function useComposedScopes(overrideScopes) {
|
|
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
const currentScope = useScope(overrideScopes)[`__scope${scopeName}`];
|
|
return {
|
|
...nextScopes2,
|
|
...currentScope
|
|
};
|
|
}, {});
|
|
return import_react.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
};
|
|
};
|
|
createScope.scopeName = baseScope.scopeName;
|
|
return createScope;
|
|
}
|
|
//#endregion
|
|
//#region .yarn/__virtual__/@radix-ui-react-slot-virtual-f3fdb51006/3/AppData/Local/Yarn/Berry/cache/@radix-ui-react-slot-npm-1.2.4-0035a0681c-10c0.zip/node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
var use = import_react[" use ".trim().toString()];
|
|
function isPromiseLike(value) {
|
|
return typeof value === "object" && value !== null && "then" in value;
|
|
}
|
|
function isLazyComponent(element) {
|
|
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
|
|
}
|
|
/* @__NO_SIDE_EFFECTS__ */
|
|
function createSlot(ownerName) {
|
|
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
const Slot2 = import_react.forwardRef((props, forwardedRef) => {
|
|
let { children, ...slotProps } = props;
|
|
if (isLazyComponent(children) && typeof use === "function") children = use(children._payload);
|
|
const childrenArray = import_react.Children.toArray(children);
|
|
const slottable = childrenArray.find(isSlottable);
|
|
if (slottable) {
|
|
const newElement = slottable.props.children;
|
|
const newChildren = childrenArray.map((child) => {
|
|
if (child === slottable) {
|
|
if (import_react.Children.count(newElement) > 1) return import_react.Children.only(null);
|
|
return import_react.isValidElement(newElement) ? newElement.props.children : null;
|
|
} else return child;
|
|
});
|
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SlotClone, {
|
|
...slotProps,
|
|
ref: forwardedRef,
|
|
children: import_react.isValidElement(newElement) ? import_react.cloneElement(newElement, void 0, newChildren) : null
|
|
});
|
|
}
|
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SlotClone, {
|
|
...slotProps,
|
|
ref: forwardedRef,
|
|
children
|
|
});
|
|
});
|
|
Slot2.displayName = `${ownerName}.Slot`;
|
|
return Slot2;
|
|
}
|
|
/* @__NO_SIDE_EFFECTS__ */
|
|
function createSlotClone(ownerName) {
|
|
const SlotClone = import_react.forwardRef((props, forwardedRef) => {
|
|
let { children, ...slotProps } = props;
|
|
if (isLazyComponent(children) && typeof use === "function") children = use(children._payload);
|
|
if (import_react.isValidElement(children)) {
|
|
const childrenRef = getElementRef$1(children);
|
|
const props2 = mergeProps(slotProps, children.props);
|
|
if (children.type !== import_react.Fragment) props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
return import_react.cloneElement(children, props2);
|
|
}
|
|
return import_react.Children.count(children) > 1 ? import_react.Children.only(null) : null;
|
|
});
|
|
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
return SlotClone;
|
|
}
|
|
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
/* @__NO_SIDE_EFFECTS__ */
|
|
function createSlottable(ownerName) {
|
|
const Slottable2 = ({ children }) => {
|
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
};
|
|
Slottable2.displayName = `${ownerName}.Slottable`;
|
|
Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
|
|
return Slottable2;
|
|
}
|
|
function isSlottable(child) {
|
|
return import_react.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
}
|
|
function mergeProps(slotProps, childProps) {
|
|
const overrideProps = { ...childProps };
|
|
for (const propName in childProps) {
|
|
const slotPropValue = slotProps[propName];
|
|
const childPropValue = childProps[propName];
|
|
if (/^on[A-Z]/.test(propName)) {
|
|
if (slotPropValue && childPropValue) overrideProps[propName] = (...args) => {
|
|
const result = childPropValue(...args);
|
|
slotPropValue(...args);
|
|
return result;
|
|
};
|
|
else if (slotPropValue) overrideProps[propName] = slotPropValue;
|
|
} else if (propName === "style") overrideProps[propName] = {
|
|
...slotPropValue,
|
|
...childPropValue
|
|
};
|
|
else if (propName === "className") overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
}
|
|
return {
|
|
...slotProps,
|
|
...overrideProps
|
|
};
|
|
}
|
|
function getElementRef$1(element) {
|
|
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
if (mayWarn) return element.ref;
|
|
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
if (mayWarn) return element.props.ref;
|
|
return element.props.ref || element.ref;
|
|
}
|
|
//#endregion
|
|
//#region .yarn/__virtual__/@radix-ui-react-primitive-virtual-d12ee56307/3/AppData/Local/Yarn/Berry/cache/@radix-ui-react-primitive-npm-2.1.3-6080896851-10c0.zip/node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
var Primitive = [
|
|
"a",
|
|
"button",
|
|
"div",
|
|
"form",
|
|
"h2",
|
|
"h3",
|
|
"img",
|
|
"input",
|
|
"label",
|
|
"li",
|
|
"nav",
|
|
"ol",
|
|
"p",
|
|
"select",
|
|
"span",
|
|
"svg",
|
|
"ul"
|
|
].reduce((primitive, node) => {
|
|
const Slot = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
const Node = import_react.forwardRef((props, forwardedRef) => {
|
|
const { asChild, ...primitiveProps } = props;
|
|
const Comp = asChild ? Slot : node;
|
|
if (typeof window !== "undefined") window[Symbol.for("radix-ui")] = true;
|
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Comp, {
|
|
...primitiveProps,
|
|
ref: forwardedRef
|
|
});
|
|
});
|
|
Node.displayName = `Primitive.${node}`;
|
|
return {
|
|
...primitive,
|
|
[node]: Node
|
|
};
|
|
}, {});
|
|
function dispatchDiscreteCustomEvent(target, event) {
|
|
if (target) import_react_dom.flushSync(() => target.dispatchEvent(event));
|
|
}
|
|
//#endregion
|
|
//#region .yarn/__virtual__/@radix-ui-react-use-callback-ref-virtual-f6bc8d7b3f/3/AppData/Local/Yarn/Berry/cache/@radix-ui-react-use-callback-ref-npm-1.1.1-d0f2aaabce-10c0.zip/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
|
|
function useCallbackRef(callback) {
|
|
const callbackRef = import_react.useRef(callback);
|
|
import_react.useEffect(() => {
|
|
callbackRef.current = callback;
|
|
});
|
|
return import_react.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
}
|
|
//#endregion
|
|
//#region .yarn/__virtual__/@radix-ui-react-use-escape-keydown-virtual-0d056e81ca/3/AppData/Local/Yarn/Berry/cache/@radix-ui-react-use-escape-keydown-npm-1.1.1-dea48a407a-10c0.zip/node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs
|
|
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
|
|
const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
|
|
import_react.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]);
|
|
}
|
|
//#endregion
|
|
//#region .yarn/__virtual__/@radix-ui-react-dismissable-layer-virtual-4257a576cd/3/AppData/Local/Yarn/Berry/cache/@radix-ui-react-dismissable-layer-npm-1.1.11-43da238bf6-10c0.zip/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
|
|
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 = import_react.createContext({
|
|
layers: /* @__PURE__ */ new Set(),
|
|
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
branches: /* @__PURE__ */ new Set()
|
|
});
|
|
var DismissableLayer = import_react.forwardRef((props, forwardedRef) => {
|
|
const { disableOutsidePointerEvents = false, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, onDismiss, ...layerProps } = props;
|
|
const context = import_react.useContext(DismissableLayerContext);
|
|
const [node, setNode] = import_react.useState(null);
|
|
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
|
|
const [, force] = import_react.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?.(event);
|
|
onInteractOutside?.(event);
|
|
if (!event.defaultPrevented) onDismiss?.();
|
|
}, ownerDocument);
|
|
const focusOutside = useFocusOutside((event) => {
|
|
const target = event.target;
|
|
if ([...context.branches].some((branch) => branch.contains(target))) return;
|
|
onFocusOutside?.(event);
|
|
onInteractOutside?.(event);
|
|
if (!event.defaultPrevented) onDismiss?.();
|
|
}, ownerDocument);
|
|
useEscapeKeydown((event) => {
|
|
if (!(index === context.layers.size - 1)) return;
|
|
onEscapeKeyDown?.(event);
|
|
if (!event.defaultPrevented && onDismiss) {
|
|
event.preventDefault();
|
|
onDismiss();
|
|
}
|
|
}, ownerDocument);
|
|
import_react.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
|
|
]);
|
|
import_react.useEffect(() => {
|
|
return () => {
|
|
if (!node) return;
|
|
context.layers.delete(node);
|
|
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
dispatchUpdate();
|
|
};
|
|
}, [node, context]);
|
|
import_react.useEffect(() => {
|
|
const handleUpdate = () => force({});
|
|
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
}, []);
|
|
return /* @__PURE__ */ (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 = import_react.forwardRef((props, forwardedRef) => {
|
|
const context = import_react.useContext(DismissableLayerContext);
|
|
const ref = import_react.useRef(null);
|
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
import_react.useEffect(() => {
|
|
const node = ref.current;
|
|
if (node) {
|
|
context.branches.add(node);
|
|
return () => {
|
|
context.branches.delete(node);
|
|
};
|
|
}
|
|
}, [context.branches]);
|
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.div, {
|
|
...props,
|
|
ref: composedRefs
|
|
});
|
|
});
|
|
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
const isPointerInsideReactTreeRef = import_react.useRef(false);
|
|
const handleClickRef = import_react.useRef(() => {});
|
|
import_react.useEffect(() => {
|
|
const handlePointerDown = (event) => {
|
|
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
handleAndDispatchCustomEvent(POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, { discrete: true });
|
|
};
|
|
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 { onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true };
|
|
}
|
|
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
const handleFocusOutside = useCallbackRef(onFocusOutside);
|
|
const isFocusInsideReactTreeRef = import_react.useRef(false);
|
|
import_react.useEffect(() => {
|
|
const handleFocus = (event) => {
|
|
if (event.target && !isFocusInsideReactTreeRef.current) handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, { originalEvent: event }, { 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);
|
|
}
|
|
var Root$1 = DismissableLayer;
|
|
var Branch = DismissableLayerBranch;
|
|
//#endregion
|
|
//#region .yarn/__virtual__/@radix-ui-react-use-layout-effect-virtual-14a7093336/3/AppData/Local/Yarn/Berry/cache/@radix-ui-react-use-layout-effect-npm-1.1.1-e3c7fd61a2-10c0.zip/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
|
|
var useLayoutEffect2 = globalThis?.document ? import_react.useLayoutEffect : () => {};
|
|
//#endregion
|
|
//#region .yarn/__virtual__/@radix-ui-react-portal-virtual-b597215585/3/AppData/Local/Yarn/Berry/cache/@radix-ui-react-portal-npm-1.1.9-8d4bfbd782-10c0.zip/node_modules/@radix-ui/react-portal/dist/index.mjs
|
|
var PORTAL_NAME = "Portal";
|
|
var Portal = import_react.forwardRef((props, forwardedRef) => {
|
|
const { container: containerProp, ...portalProps } = props;
|
|
const [mounted, setMounted] = import_react.useState(false);
|
|
useLayoutEffect2(() => setMounted(true), []);
|
|
const container = containerProp || mounted && globalThis?.document?.body;
|
|
return container ? import_react_dom.createPortal(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.div, {
|
|
...portalProps,
|
|
ref: forwardedRef
|
|
}), container) : null;
|
|
});
|
|
Portal.displayName = PORTAL_NAME;
|
|
//#endregion
|
|
//#region .yarn/__virtual__/@radix-ui-react-presence-virtual-5bdbfeaf36/3/AppData/Local/Yarn/Berry/cache/@radix-ui-react-presence-npm-1.1.5-7f035d4462-10c0.zip/node_modules/@radix-ui/react-presence/dist/index.mjs
|
|
function useStateMachine(initialState, machine) {
|
|
return import_react.useReducer((state, event) => {
|
|
return machine[state][event] ?? state;
|
|
}, initialState);
|
|
}
|
|
var Presence = (props) => {
|
|
const { present, children } = props;
|
|
const presence = usePresence(present);
|
|
const child = typeof children === "function" ? children({ present: presence.isPresent }) : import_react.Children.only(children);
|
|
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
return typeof children === "function" || presence.isPresent ? import_react.cloneElement(child, { ref }) : null;
|
|
};
|
|
Presence.displayName = "Presence";
|
|
function usePresence(present) {
|
|
const [node, setNode] = import_react.useState();
|
|
const stylesRef = import_react.useRef(null);
|
|
const prevPresentRef = import_react.useRef(present);
|
|
const prevAnimationNameRef = import_react.useRef("none");
|
|
const [state, send] = useStateMachine(present ? "mounted" : "unmounted", {
|
|
mounted: {
|
|
UNMOUNT: "unmounted",
|
|
ANIMATION_OUT: "unmountSuspended"
|
|
},
|
|
unmountSuspended: {
|
|
MOUNT: "mounted",
|
|
ANIMATION_END: "unmounted"
|
|
},
|
|
unmounted: { MOUNT: "mounted" }
|
|
});
|
|
import_react.useEffect(() => {
|
|
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
}, [state]);
|
|
useLayoutEffect2(() => {
|
|
const styles = stylesRef.current;
|
|
const wasPresent = prevPresentRef.current;
|
|
if (wasPresent !== present) {
|
|
const prevAnimationName = prevAnimationNameRef.current;
|
|
const currentAnimationName = getAnimationName(styles);
|
|
if (present) send("MOUNT");
|
|
else if (currentAnimationName === "none" || styles?.display === "none") send("UNMOUNT");
|
|
else if (wasPresent && prevAnimationName !== currentAnimationName) 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 isCurrentAnimation = getAnimationName(stylesRef.current).includes(CSS.escape(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: import_react.useCallback((node2) => {
|
|
stylesRef.current = node2 ? getComputedStyle(node2) : null;
|
|
setNode(node2);
|
|
}, [])
|
|
};
|
|
}
|
|
function getAnimationName(styles) {
|
|
return styles?.animationName || "none";
|
|
}
|
|
function getElementRef(element) {
|
|
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
if (mayWarn) return element.ref;
|
|
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
if (mayWarn) return element.props.ref;
|
|
return element.props.ref || element.ref;
|
|
}
|
|
import_react[" useEffectEvent ".trim().toString()];
|
|
import_react[" useInsertionEffect ".trim().toString()];
|
|
//#endregion
|
|
//#region .yarn/__virtual__/@radix-ui-react-use-controllable-state-virtual-76700ccf6c/3/AppData/Local/Yarn/Berry/cache/@radix-ui-react-use-controllable-state-npm-1.2.2-ddb427f3a3-10c0.zip/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
var useInsertionEffect = import_react[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
|
|
function useControllableState({ prop, defaultProp, onChange = () => {}, caller }) {
|
|
const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
|
|
defaultProp,
|
|
onChange
|
|
});
|
|
const isControlled = prop !== void 0;
|
|
const value = isControlled ? prop : uncontrolledProp;
|
|
{
|
|
const isControlledRef = import_react.useRef(prop !== void 0);
|
|
import_react.useEffect(() => {
|
|
const wasControlled = isControlledRef.current;
|
|
if (wasControlled !== isControlled) console.warn(`${caller} is changing from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);
|
|
isControlledRef.current = isControlled;
|
|
}, [isControlled, caller]);
|
|
}
|
|
return [value, import_react.useCallback((nextValue) => {
|
|
if (isControlled) {
|
|
const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
|
|
if (value2 !== prop) onChangeRef.current?.(value2);
|
|
} else setUncontrolledProp(nextValue);
|
|
}, [
|
|
isControlled,
|
|
prop,
|
|
setUncontrolledProp,
|
|
onChangeRef
|
|
])];
|
|
}
|
|
function useUncontrolledState({ defaultProp, onChange }) {
|
|
const [value, setValue] = import_react.useState(defaultProp);
|
|
const prevValueRef = import_react.useRef(value);
|
|
const onChangeRef = import_react.useRef(onChange);
|
|
useInsertionEffect(() => {
|
|
onChangeRef.current = onChange;
|
|
}, [onChange]);
|
|
import_react.useEffect(() => {
|
|
if (prevValueRef.current !== value) {
|
|
onChangeRef.current?.(value);
|
|
prevValueRef.current = value;
|
|
}
|
|
}, [value, prevValueRef]);
|
|
return [
|
|
value,
|
|
setValue,
|
|
onChangeRef
|
|
];
|
|
}
|
|
function isFunction(value) {
|
|
return typeof value === "function";
|
|
}
|
|
//#endregion
|
|
//#region .yarn/__virtual__/@radix-ui-react-visually-hidden-virtual-4f1480edf6/3/AppData/Local/Yarn/Berry/cache/@radix-ui-react-visually-hidden-npm-1.2.3-8d44397a9a-10c0.zip/node_modules/@radix-ui/react-visually-hidden/dist/index.mjs
|
|
var VISUALLY_HIDDEN_STYLES = Object.freeze({
|
|
position: "absolute",
|
|
border: 0,
|
|
width: 1,
|
|
height: 1,
|
|
padding: 0,
|
|
margin: -1,
|
|
overflow: "hidden",
|
|
clip: "rect(0, 0, 0, 0)",
|
|
whiteSpace: "nowrap",
|
|
wordWrap: "normal"
|
|
});
|
|
var NAME = "VisuallyHidden";
|
|
var VisuallyHidden = import_react.forwardRef((props, forwardedRef) => {
|
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.span, {
|
|
...props,
|
|
ref: forwardedRef,
|
|
style: {
|
|
...VISUALLY_HIDDEN_STYLES,
|
|
...props.style
|
|
}
|
|
});
|
|
});
|
|
VisuallyHidden.displayName = NAME;
|
|
var Root = VisuallyHidden;
|
|
//#endregion
|
|
export { composeEventHandlers as _, Portal as a, DismissableLayer as c, Primitive as d, dispatchDiscreteCustomEvent as f, useComposedRefs as g, createContextScope as h, Presence as i, Root$1 as l, createSlottable as m, VisuallyHidden as n, useLayoutEffect2 as o, createSlot as p, useControllableState as r, Branch as s, Root as t, useCallbackRef as u };
|
|
|
|
//# sourceMappingURL=dist-BW4nuYR0.js.map
|