"use client"; import { useCallbackRef } from "./chunk-KCFVMCIE.js"; import { useLayoutEffect2 } from "./chunk-5ZB7HMJW.js"; import { createSlot } from "./chunk-GTF7DNNX.js"; import { require_react_dom } from "./chunk-T2SWDQEL.js"; import "./chunk-JDYSANEB.js"; import { require_jsx_runtime } from "./chunk-KBTYAULA.js"; import { require_react } from "./chunk-QCHXOAYK.js"; import { __commonJS, __toESM } from "./chunk-WOOG5QLI.js"; // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js var require_use_sync_external_store_shim_development = __commonJS({ "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) { "use strict"; (function() { function is(x, y) { return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; } function useSyncExternalStore$2(subscribe2, getSnapshot) { didWarnOld18Alpha || void 0 === React4.startTransition || (didWarnOld18Alpha = true, console.error( "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release." )); var value = getSnapshot(); if (!didWarnUncachedGetSnapshot) { var cachedValue = getSnapshot(); objectIs(value, cachedValue) || (console.error( "The result of getSnapshot should be cached to avoid an infinite loop" ), didWarnUncachedGetSnapshot = true); } cachedValue = useState2({ inst: { value, getSnapshot } }); var inst = cachedValue[0].inst, forceUpdate = cachedValue[1]; useLayoutEffect( function() { inst.value = value; inst.getSnapshot = getSnapshot; checkIfSnapshotChanged(inst) && forceUpdate({ inst }); }, [subscribe2, value, getSnapshot] ); useEffect2( function() { checkIfSnapshotChanged(inst) && forceUpdate({ inst }); return subscribe2(function() { checkIfSnapshotChanged(inst) && forceUpdate({ inst }); }); }, [subscribe2] ); useDebugValue(value); return value; } function checkIfSnapshotChanged(inst) { var latestGetSnapshot = inst.getSnapshot; inst = inst.value; try { var nextValue = latestGetSnapshot(); return !objectIs(inst, nextValue); } catch (error) { return true; } } function useSyncExternalStore$1(subscribe2, getSnapshot) { return getSnapshot(); } "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); var React4 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState2 = React4.useState, useEffect2 = React4.useEffect, useLayoutEffect = React4.useLayoutEffect, useDebugValue = React4.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2; exports.useSyncExternalStore = void 0 !== React4.useSyncExternalStore ? React4.useSyncExternalStore : shim; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); })(); } }); // node_modules/use-sync-external-store/shim/index.js var require_shim = __commonJS({ "node_modules/use-sync-external-store/shim/index.js"(exports, module) { "use strict"; if (false) { module.exports = null; } else { module.exports = require_use_sync_external_store_shim_development(); } } }); // node_modules/@radix-ui/react-avatar/dist/index.mjs var React3 = __toESM(require_react(), 1); // node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-context/dist/index.mjs var React = __toESM(require_react(), 1); var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); function createContextScope(scopeName, createContextScopeDeps = []) { let defaultContexts = []; function createContext3(rootComponentName, defaultContext) { const BaseContext = React.createContext(defaultContext); BaseContext.displayName = rootComponentName + "Context"; const index = defaultContexts.length; defaultContexts = [...defaultContexts, defaultContext]; const Provider = (props) => { var _a; const { scope, children, ...context } = props; const Context = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index]) || BaseContext; const value = React.useMemo(() => context, Object.values(context)); return (0, import_jsx_runtime.jsx)(Context.Provider, { value, children }); }; Provider.displayName = rootComponentName + "Provider"; function useContext2(consumerName, scope) { var _a; const Context = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index]) || BaseContext; const context = 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 React.createContext(defaultContext); }); return function useScope(scope) { const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts; return 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 scopeProps = useScope(overrideScopes); const currentScope = scopeProps[`__scope${scopeName}`]; return { ...nextScopes2, ...currentScope }; }, {}); return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]); }; }; createScope.scopeName = baseScope.scopeName; return createScope; } // node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-primitive/dist/index.mjs var React2 = __toESM(require_react(), 1); var ReactDOM = __toESM(require_react_dom(), 1); var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); var NODES = [ "a", "button", "div", "form", "h2", "h3", "img", "input", "label", "li", "nav", "ol", "p", "select", "span", "svg", "ul" ]; var Primitive = NODES.reduce((primitive, node) => { const Slot = createSlot(`Primitive.${node}`); const Node = React2.forwardRef((props, forwardedRef) => { const { asChild, ...primitiveProps } = props; const Comp = asChild ? Slot : node; if (typeof window !== "undefined") { window[Symbol.for("radix-ui")] = true; } return (0, import_jsx_runtime2.jsx)(Comp, { ...primitiveProps, ref: forwardedRef }); }); Node.displayName = `Primitive.${node}`; return { ...primitive, [node]: Node }; }, {}); // node_modules/@radix-ui/react-use-is-hydrated/dist/index.mjs var import_shim = __toESM(require_shim(), 1); function useIsHydrated() { return (0, import_shim.useSyncExternalStore)( subscribe, () => true, () => false ); } function subscribe() { return () => { }; } // node_modules/@radix-ui/react-avatar/dist/index.mjs var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); var AVATAR_NAME = "Avatar"; var [createAvatarContext, createAvatarScope] = createContextScope(AVATAR_NAME); var [AvatarProvider, useAvatarContext] = createAvatarContext(AVATAR_NAME); var Avatar = React3.forwardRef( (props, forwardedRef) => { const { __scopeAvatar, ...avatarProps } = props; const [imageLoadingStatus, setImageLoadingStatus] = React3.useState("idle"); return (0, import_jsx_runtime3.jsx)( AvatarProvider, { scope: __scopeAvatar, imageLoadingStatus, onImageLoadingStatusChange: setImageLoadingStatus, children: (0, import_jsx_runtime3.jsx)(Primitive.span, { ...avatarProps, ref: forwardedRef }) } ); } ); Avatar.displayName = AVATAR_NAME; var IMAGE_NAME = "AvatarImage"; var AvatarImage = React3.forwardRef( (props, forwardedRef) => { const { __scopeAvatar, src, onLoadingStatusChange = () => { }, ...imageProps } = props; const context = useAvatarContext(IMAGE_NAME, __scopeAvatar); const imageLoadingStatus = useImageLoadingStatus(src, imageProps); const handleLoadingStatusChange = useCallbackRef((status) => { onLoadingStatusChange(status); context.onImageLoadingStatusChange(status); }); useLayoutEffect2(() => { if (imageLoadingStatus !== "idle") { handleLoadingStatusChange(imageLoadingStatus); } }, [imageLoadingStatus, handleLoadingStatusChange]); return imageLoadingStatus === "loaded" ? (0, import_jsx_runtime3.jsx)(Primitive.img, { ...imageProps, ref: forwardedRef, src }) : null; } ); AvatarImage.displayName = IMAGE_NAME; var FALLBACK_NAME = "AvatarFallback"; var AvatarFallback = React3.forwardRef( (props, forwardedRef) => { const { __scopeAvatar, delayMs, ...fallbackProps } = props; const context = useAvatarContext(FALLBACK_NAME, __scopeAvatar); const [canRender, setCanRender] = React3.useState(delayMs === void 0); React3.useEffect(() => { if (delayMs !== void 0) { const timerId = window.setTimeout(() => setCanRender(true), delayMs); return () => window.clearTimeout(timerId); } }, [delayMs]); return canRender && context.imageLoadingStatus !== "loaded" ? (0, import_jsx_runtime3.jsx)(Primitive.span, { ...fallbackProps, ref: forwardedRef }) : null; } ); AvatarFallback.displayName = FALLBACK_NAME; function resolveLoadingStatus(image, src) { if (!image) { return "idle"; } if (!src) { return "error"; } if (image.src !== src) { image.src = src; } return image.complete && image.naturalWidth > 0 ? "loaded" : "loading"; } function useImageLoadingStatus(src, { referrerPolicy, crossOrigin }) { const isHydrated = useIsHydrated(); const imageRef = React3.useRef(null); const image = (() => { if (!isHydrated) return null; if (!imageRef.current) { imageRef.current = new window.Image(); } return imageRef.current; })(); const [loadingStatus, setLoadingStatus] = React3.useState( () => resolveLoadingStatus(image, src) ); useLayoutEffect2(() => { setLoadingStatus(resolveLoadingStatus(image, src)); }, [image, src]); useLayoutEffect2(() => { const updateStatus = (status) => () => { setLoadingStatus(status); }; if (!image) return; const handleLoad = updateStatus("loaded"); const handleError = updateStatus("error"); image.addEventListener("load", handleLoad); image.addEventListener("error", handleError); if (referrerPolicy) { image.referrerPolicy = referrerPolicy; } if (typeof crossOrigin === "string") { image.crossOrigin = crossOrigin; } return () => { image.removeEventListener("load", handleLoad); image.removeEventListener("error", handleError); }; }, [image, crossOrigin, referrerPolicy]); return loadingStatus; } var Root = Avatar; var Image = AvatarImage; var Fallback = AvatarFallback; export { Avatar, AvatarFallback, AvatarImage, Fallback, Image, Root, createAvatarScope }; /*! Bundled license information: use-sync-external-store/cjs/use-sync-external-store-shim.development.js: (** * @license React * use-sync-external-store-shim.development.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) */ //# sourceMappingURL=@radix-ui_react-avatar.js.map