{"version":3,"names":["createEffect","createSignal","onCleanup","untrack","useContext","ContextMenuRootContext","useBaseUiId","createChangeEventDetails","REASONS","createControlledState","FloatingNode","FloatingTree","useFloatingNodeId","useFloatingParentNodeId","useFloatingTree","useDismiss","useFloatingRootContext","useInteractions","useListNavigation","useRole","useTypeahead","readOption","useOpenChangeComplete","useOpenInteractionType","useTimeout","useTransitionStatus","MenubarContext","createMenu","MenuStore","useMenuSubmenuRootContext","MenuRootContext","useMenuRootContext","MenuRootComponent","props","submenuContext","parentMenu","nested","parentMenubarContext","parentContextMenuContext","modalProp","modal","disabledProp","disabled","loopFocusProp","loopFocus","orientationProp","orientation","highlightItemOnHoverProp","highlightItemOnHover","closeParentOnEscProp","closeParentOnEsc","resolvedOpen","setUncontrolledOpen","controlled","open","undefined","Boolean","default","defaultOpen","fallback","name","state","menuPrimitive","activeTriggerId","setActiveTriggerId","triggerId","ownedWrite","activeIndex","setActiveIndex","payload","setPayload","activeTriggerElement","setActiveTriggerElement","lastOpenChangeReason","setLastOpenChangeReason","instantType","setInstantType","popupRef","current","positionerRef","listRef","labelsRef","typingRef","closeDelayRef","beforeContentFocusGuardRef","triggerFocusTargetRef","store","handle","rootId","parentType","nestedInsideContextMenu","mounted","transitionStatus","setMounted","ref","onComplete","onOpenChangeComplete","floatingNodeIdFromContext","floatingParentNodeIdFromContext","floatingTreeFromContext","openMethod","triggerProps","openInteractionTypeProps","floatingRootContext","onOpenChange","nextOpen","details","setOpen","o","trigger","s","anchor","update","referenceElement","domReferenceElement","positionReference","reason","prevOpen","rawEvent","event","openEventType","type","isCanceled","nativeEvent","isKeyboardClick","triggerPress","itemPress","detail","isTrusted","isDismissClose","escapeKey","tree","events","emit","nodeId","parentNodeId","attachSetOpen","next","setOpenMirror","context","triggerElements","size","entry","entries","done","id","el","value","handleUnmount","handleClose","imperativeAction","actions","unmount","close","ar","actionsRef","cm","ownPositionerRef","mb","unregister","isOpen","registerOpenMenu","siblingOpen","allowOutsidePressDismissal","allowOutsidePressTimeout","clear","start","dismiss","enabled","bubbles","outsidePress","role","listNavigation","onNavigate","nextIndex","focusItemOnHover","openOnArrowKeyDown","typeahead","resetMs","onMatch","index","onTypingChange","interactions","parentAccessor","contextValue","parent","floatingNodeId","floatingTreeRoot","floatingParentNodeId","renderChildren","c","children","treeNodeId","MenuRoot"],"sources":["menu-root.tsx"],"sourcesContent":["import type { JSX } from \"@solidjs/web\";\n/**\n * `<Menu.Root>` — Solid 2 port of Base UI React's `MenuRoot`\n * (`packages/react/src/menu/root/MenuRoot.tsx`).\n *\n * Groups every menu part. Owns the open/closed state (controlled `open`\n * prop or internal signal seeded from `defaultOpen`, per Base UI) and the\n * interaction-hook bundle (click + dismiss + listnav + typeahead). Wraps\n * itself in a `<FloatingTree>` when it's the top-level root so submenus\n * can participate in the tree.\n *\n * ### Port deviations from React\n *\n *  - The React port threads a shared store + selectors across every part.\n *    The Solid port instead exposes plain signal-accessors on the root\n *    context (same shape as `<Select.Root>`). `MenuStore` + `MenuHandle`\n *    exist for the imperative + multi-trigger surface;\n *    their internal state mirrors the root's signals and is the only\n *    surface the handle reads.\n *  - `useOpenInteractionType` is threaded; `openMethod`\n *    + trigger-props are exposed on `MenuRootContext`. Downstream\n *    behavior gating (touch-bypass, focus-on-open decisions) needs\n *    browser coverage to observe actual pointerType values.\n *  - Floating-tree cross-menu events are emitted:\n *    `menuopenchange` fires from `setOpen`, `itemhover` from\n *    `<Menu.Item>`'s `onPointerEnter`. `\"close\"` (cancel-on-mouseup)\n *    still pending the mouseup-on-item window.\n *  - Trigger focus-guard sentinels wired; hover-to-open\n *    + safe-polygon sibling auto-close still pending.\n *  - `closeParentOnEsc` is wired via `useDismiss`'s `bubbles.escapeKey`\n *    (latched at init).\n */\n\nimport {\n\ttype Accessor,\n\tcreateEffect,\n\tcreateSignal,\n\tonCleanup,\n\tuntrack,\n\tuseContext,\n} from \"solid-js\";\nimport { ContextMenuRootContext } from \"../../context-menu/root/context-menu-root-context\";\nimport { useBaseUiId } from \"../../internals/base-ui-id\";\nimport {\n\tcreateChangeEventDetails,\n\tREASONS,\n} from \"../../internals/change-event-details\";\nimport { createControlledState } from \"../../internals/create-controlled-state\";\nimport {\n\tFloatingNode,\n\tFloatingTree,\n\tuseFloatingNodeId,\n\tuseFloatingParentNodeId,\n\tuseFloatingTree,\n} from \"../../internals/floating-ui/components/floating-tree\";\nimport { useDismiss } from \"../../internals/floating-ui/hooks/use-dismiss\";\nimport { useFloatingRootContext } from \"../../internals/floating-ui/hooks/use-floating-root-context\";\nimport { useInteractions } from \"../../internals/floating-ui/hooks/use-interactions\";\nimport { useListNavigation } from \"../../internals/floating-ui/hooks/use-list-navigation\";\nimport { useRole } from \"../../internals/floating-ui/hooks/use-role\";\nimport { useTypeahead } from \"../../internals/floating-ui/hooks/use-typeahead\";\nimport type { MutableRef } from \"../../internals/floating-ui/types\";\nimport { type MaybeAccessor, readOption } from \"../../internals/maybe-accessor\";\nimport { useOpenChangeComplete } from \"../../internals/popups/use-open-change-complete\";\nimport { useOpenInteractionType } from \"../../internals/popups/use-open-interaction-type\";\nimport { useTimeout } from \"../../internals/use-timeout\";\nimport { useTransitionStatus } from \"../../internals/use-transition-status/use-transition-status\";\nimport { MenubarContext } from \"../../menubar/menubar-context\";\nimport { createMenu } from \"../create-menu\";\nimport type { MenuHandle } from \"../store/menu-store\";\nimport { MenuStore } from \"../store/menu-store\";\nimport { useMenuSubmenuRootContext } from \"../submenu-root/menu-submenu-root-context\";\nimport {\n\ttype MenuPayloadChildRenderFunction,\n\ttype MenuRootChangeEventDetails,\n\ttype MenuRootChangeEventReason,\n\tMenuRootContext,\n\ttype MenuRootContextValue,\n\ttype MenuRootOrientation,\n\tuseMenuRootContext,\n} from \"./menu-root-context\";\n\nexport type { MenuRootChangeEventDetails, MenuRootChangeEventReason };\n\nexport interface MenuRootActions {\n\t/** Force-unmount the menu popup subtree. */\n\tunmount: () => void;\n\t/** Imperatively close the menu. */\n\tclose: () => void;\n}\n\nexport type MenuRootState = Record<string, never>;\n\nexport interface MenuRootProps<Payload = unknown> {\n\t/**\n\t * Controlled open state. When provided (resolved value not\n\t * `undefined`), the consumer owns the state — pair with\n\t * {@link onOpenChange}. When omitted, the menu manages its own open\n\t * state (seeded from {@link defaultOpen}).\n\t */\n\topen?: MaybeAccessor<boolean | undefined>;\n\t/**\n\t * Initial open state when uncontrolled. Read once at mount.\n\t * @default false\n\t */\n\tdefaultOpen?: MaybeAccessor<boolean | undefined>;\n\t/** Whether arrow keys loop at the ends. @default true */\n\tloopFocus?: boolean | undefined;\n\t/** Highlight items on hover. @default true */\n\thighlightItemOnHover?: boolean | undefined;\n\t/** Modal mode — locks outside interaction while open. @default true */\n\tmodal?: boolean | undefined;\n\t/** Called when the menu opens or closes. */\n\tonOpenChange?:\n\t\t| ((open: boolean, eventDetails: MenuRootChangeEventDetails) => void)\n\t\t| undefined;\n\t/** Called after any animations complete when the menu is closed. */\n\tonOpenChangeComplete?: ((open: boolean) => void) | undefined;\n\t/** Visual/keyboard orientation. @default \"vertical\" */\n\torientation?: MenuRootOrientation | undefined;\n\t/** Whether the menu ignores user interaction. @default false */\n\tdisabled?: boolean | undefined;\n\t/** Escape-key bubbling in submenus. @default false */\n\tcloseParentOnEsc?: boolean | undefined;\n\t/** Imperative actions surface. */\n\tactionsRef?:\n\t\t| ((actions: MenuRootActions | null) => void)\n\t\t| { current: MenuRootActions | null }\n\t\t| undefined;\n\t/**\n\t * ID of the trigger associated with the menu (controlled). When supplied,\n\t * the root uses this as the active trigger id for positioning + focus return.\n\t */\n\ttriggerId?: string | null | undefined;\n\t/**\n\t * Handle to connect the root with detached `<Menu.Trigger handle=...>`\n\t * components. Allows external triggers to drive the menu's open\n\t * state and to associate multiple triggers with one menu.\n\t */\n\thandle?: MenuHandle<Payload> | undefined;\n\t/**\n\t * Children. May be a regular node or a render function that receives the\n\t * active trigger's payload.\n\t */\n\tchildren?: JSX.Element | MenuPayloadChildRenderFunction<Payload>;\n}\n\nfunction MenuRootComponent<Payload>(\n\tprops: MenuRootProps<Payload>,\n): JSX.Element {\n\tconst submenuContext = useMenuSubmenuRootContext();\n\tconst parentMenu = useMenuRootContext(true);\n\tconst nested = submenuContext != null && parentMenu != null;\n\n\t// Menubar interop — when this Menu.Root is nested inside a `<Menubar>` as\n\t// a TOP-LEVEL menu (not a submenu), we coordinate sibling\n\t// auto-close and the `data-has-submenu-open` flag on the menubar. Keep\n\t// the branching minimal: only read the context + register an opener/closer\n\t// slot. All cross-menu logic lives in the menubar; menu-root only emits\n\t// the \"I opened/closed\" signal.\n\tconst parentMenubarContext = !nested ? useContext(MenubarContext) : null;\n\n\t// Context-menu interop — when this Menu.Root is\n\t// wrapped by `<ContextMenu.Root>`, we read the virtual-anchor signal\n\t// it owns and thread it into the floating-root context (as the\n\t// `positionReference` slot, which `useFloating` prefers over the raw\n\t// `referenceElement`). We also populate the context's `actionsRef`\n\t// with our `setOpen` so `<ContextMenu.Trigger>` can open imperatively,\n\t// and mirror the positioner element back to the context's\n\t// `positionerRef` so the trigger's mouseup handler knows whether a\n\t// release landed inside the popup. React's `<ContextMenu.Root>`\n\t// wraps the inner menu in `<MenuRootContext value={undefined}>` to\n\t// prevent outer menus from shadowing the context-menu detection; the\n\t// Solid port passes `null` for the same purpose, so `parentMenu`\n\t// reads null here. Nested context-menu detection (React's\n\t// `'nested-context-menu'` parent type) is scoped out of this pass.\n\tconst parentContextMenuContext =\n\t\t!nested && parentMenu == null ? useContext(ContextMenuRootContext) : null;\n\n\tconst modalProp = (): boolean => props.modal ?? true;\n\tconst disabledProp = (): boolean => props.disabled ?? false;\n\tconst loopFocusProp = (): boolean => props.loopFocus ?? true;\n\tconst orientationProp = (): MenuRootOrientation =>\n\t\tprops.orientation ?? \"vertical\";\n\tconst highlightItemOnHoverProp = (): boolean =>\n\t\tprops.highlightItemOnHover ?? true;\n\tconst closeParentOnEscProp = (): boolean => props.closeParentOnEsc ?? false;\n\n\t// Controlled / uncontrolled open state (Base UI `open` / `defaultOpen`\n\t// contract): the `open` prop wins while its resolved value is defined;\n\t// otherwise an internal signal (seeded once from `defaultOpen`) backs\n\t// the state and the root's `setOpen` writes it.\n\tconst [resolvedOpen, setUncontrolledOpen] = createControlledState<boolean>({\n\t\tcontrolled: () => {\n\t\t\tconst controlled = readOption(props.open);\n\t\t\treturn controlled === undefined ? undefined : Boolean(controlled);\n\t\t},\n\t\tdefault: () => readOption(props.defaultOpen),\n\t\tfallback: false,\n\t\tname: \"<Menu.Root>\",\n\t\tstate: \"open\",\n\t});\n\n\t// Compose the headless Menu primitive — owns open, disabled, modal,\n\t// activeIndex, and payload. The wrapper layers floating-UI, focus trap,\n\t// portal, and animation on top.\n\tconst menuPrimitive = createMenu<Payload>({\n\t\topen: resolvedOpen,\n\t\tdisabled: () => props.disabled ?? false,\n\t\tmodal: () => (props.modal ?? true) && !nested,\n\t\t// onOpenChange is NOT wired here — the wrapper's own setOpen (below)\n\t\t// is the sole writer so it can thread reason/event details through the\n\t\t// full floating-UI pipeline. The primitive's setOpen is unused in the\n\t\t// wrapper path.\n\t});\n\n\tconst open = menuPrimitive.open;\n\n\t// `activeTriggerId` is purely-internal coordination state — it tracks\n\t// which trigger spawned this menu instance for positioning + focus-return.\n\t// It is NOT a consumer-facing controlled prop (consumers use `triggerId`\n\t// to seed the initial value, but they don't own the signal). A plain\n\t// `createSignal` with `ownedWrite: true` is correct here; this is an\n\t// internal implementation detail, not the same kind of consumer-owned\n\t// state as `open`.\n\tconst [activeTriggerId, setActiveTriggerId] = createSignal<string | null>(\n\t\tprops.triggerId ?? null,\n\t\t{ ownedWrite: true, name: \"menu.activeTriggerId\" },\n\t);\n\n\t// Delegate activeIndex + payload to the primitive for unified ownership.\n\tconst activeIndex = menuPrimitive.activeIndex;\n\tconst setActiveIndex = menuPrimitive.setActiveIndex;\n\tconst payload = menuPrimitive.payload;\n\tconst setPayload = menuPrimitive.setPayload as (\n\t\tpayload: Payload | undefined,\n\t) => void;\n\n\tconst [activeTriggerElement, setActiveTriggerElement] =\n\t\tcreateSignal<HTMLElement | null>(null, { ownedWrite: true });\n\tconst [lastOpenChangeReason, setLastOpenChangeReason] =\n\t\tcreateSignal<MenuRootChangeEventReason | null>(null, { ownedWrite: true });\n\tconst [instantType, setInstantType] = createSignal<\n\t\t\"dismiss\" | \"click\" | \"group\" | \"trigger-change\" | undefined\n\t>(undefined, { ownedWrite: true });\n\n\t// Element refs.\n\tconst popupRef: MutableRef<HTMLElement | null> = { current: null };\n\tconst positionerRef: MutableRef<HTMLElement | null> = { current: null };\n\tconst listRef: MutableRef<Array<HTMLElement | null>> = { current: [] };\n\tconst labelsRef: MutableRef<Array<string | null>> = { current: [] };\n\tconst typingRef: MutableRef<boolean> = { current: false };\n\tconst closeDelayRef: MutableRef<number> = { current: 0 };\n\n\t// Focus-guard refs — populated by `<Menu.Trigger>`'s\n\t// `useTriggerFocusGuards` integration. The root owns these slots so\n\t// other parts can reach them if needed.\n\tconst beforeContentFocusGuardRef: MutableRef<HTMLElement | null> = {\n\t\tcurrent: null,\n\t};\n\tconst triggerFocusTargetRef: MutableRef<HTMLElement | null> = {\n\t\tcurrent: null,\n\t};\n\n\t// Adopt the handle's store if supplied; otherwise own one. Mirrors the\n\t// popover pattern so `MenuHandle.open(triggerId)` writes\n\t// through to the same registry triggers read from.\n\tconst store = (props.handle?.store ?? new MenuStore<Payload>()) as\n\t\t| MenuStore<Payload>\n\t\t| MenuStore<unknown>;\n\n\t// Menu root id — useful for context-menu `data-rootownerid` attribution.\n\tconst rootId = useBaseUiId();\n\n\t// Parent-type discriminant (mirrors React's `parent.type`). When the\n\t// outer `<ContextMenu.Root>` itself is nested inside another context-\n\t// menu, mark the inner menu's parent as `'nested-context-menu'` so\n\t// dismissal / open-behavior routes like a regular submenu.\n\tconst parentType = (():\n\t\t| \"menu\"\n\t\t| \"menubar\"\n\t\t| \"context-menu\"\n\t\t| \"nested-context-menu\"\n\t\t| undefined => {\n\t\tif (nested) return \"menu\";\n\t\tif (parentMenubarContext != null) return \"menubar\";\n\t\tif (parentContextMenuContext != null) {\n\t\t\treturn parentContextMenuContext.nestedInsideContextMenu\n\t\t\t\t? \"nested-context-menu\"\n\t\t\t\t: \"context-menu\";\n\t\t}\n\t\treturn undefined;\n\t})();\n\n\t// Mount / transition machinery.\n\tconst { mounted, transitionStatus, setMounted } = useTransitionStatus(\n\t\topen,\n\t\t() => true,\n\t\t() => false,\n\t);\n\n\t// Deferred unmount on exit animation.\n\tuseOpenChangeComplete({\n\t\topen,\n\t\tref: popupRef,\n\t\tonComplete: () => {\n\t\t\tif (!open()) {\n\t\t\t\tsetMounted(false);\n\t\t\t\tsetActiveIndex(null);\n\t\t\t\tprops.onOpenChangeComplete?.(false);\n\t\t\t} else {\n\t\t\t\tprops.onOpenChangeComplete?.(true);\n\t\t\t}\n\t\t},\n\t});\n\n\t// Floating node id + parent id for submenus / cross-tree events.\n\tconst floatingNodeIdFromContext = useFloatingNodeId();\n\tconst floatingParentNodeIdFromContext = useFloatingParentNodeId();\n\tconst floatingTreeFromContext = useFloatingTree();\n\n\t// `useOpenInteractionType` — captures mouse/keyboard/touch at open time\n\t// Trigger spreads `openInteractionTypeProps`; `openMethod`\n\t// reads reactive and gates focus-on-open downstream.\n\tconst { openMethod, triggerProps: openInteractionTypeProps } =\n\t\tuseOpenInteractionType(open);\n\n\tconst floatingRootContext = useFloatingRootContext({\n\t\topen: untrack(open),\n\t\tonOpenChange: (nextOpen, details) => {\n\t\t\tsetOpen(nextOpen, details as MenuRootChangeEventDetails);\n\t\t},\n\t});\n\n\tcreateEffect(\n\t\t() => ({\n\t\t\to: open(),\n\t\t\ttrigger: activeTriggerElement(),\n\t\t\ts: transitionStatus(),\n\t\t\t// When wrapped by a context-menu, the anchor becomes the\n\t\t\t// virtual-element source of truth. Re-read on each tick so\n\t\t\t// positioning tracks the most recent right-click point.\n\t\t\tanchor: parentContextMenuContext?.anchor(),\n\t\t}),\n\t\t({ o, trigger, s, anchor }) => {\n\t\t\tfloatingRootContext.update({\n\t\t\t\topen: o,\n\t\t\t\treferenceElement: trigger,\n\t\t\t\tdomReferenceElement: trigger,\n\t\t\t\ttransitionStatus: s,\n\t\t\t});\n\t\t\t// Prefer the virtual anchor for positioning when supplied —\n\t\t\t// `useFloating` uses `positionReference` over `referenceElement`.\n\t\t\tif (parentContextMenuContext != null && anchor) {\n\t\t\t\tfloatingRootContext.update({\n\t\t\t\t\tpositionReference: anchor,\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t);\n\n\t// setOpen — mirrors Base UI's change flow: fire `props.onOpenChange`,\n\t// honor `details.cancel()`, then write the uncontrolled state (the write\n\t// is ignored for reads while the `open` prop is controlled — the\n\t// consumer's signal is the source of truth), then trigger mirroring.\n\tconst setOpen = (\n\t\tnextOpen: boolean,\n\t\tdetails: MenuRootChangeEventDetails,\n\t): void => {\n\t\tconst reason = details.reason as MenuRootChangeEventReason;\n\t\tconst prevOpen = untrack(open);\n\n\t\tif (\n\t\t\tprevOpen === nextOpen &&\n\t\t\tdetails.trigger === untrack(activeTriggerElement) &&\n\t\t\tuntrack(lastOpenChangeReason) === reason\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetLastOpenChangeReason(reason);\n\t\t// Stash the native event type so the context-menu outside-press\n\t\t// grace window can distinguish a `contextmenu`-initiated open\n\t\t// (dismiss-through allowed) from a `mousedown`/long-press open\n\t\t// (dismiss-through gated by the 500ms timer).\n\t\tconst rawEvent = details.event as Event | undefined;\n\t\tif (nextOpen && rawEvent != null) {\n\t\t\topenEventType = rawEvent.type;\n\t\t}\n\t\tprops.onOpenChange?.(nextOpen, details);\n\n\t\tif (details.isCanceled) return;\n\n\t\t// Uncontrolled write — inert while the `open` prop is controlled.\n\t\tsetUncontrolledOpen(nextOpen);\n\n\t\t// Track the trigger across close for focus-return / exit animations.\n\t\tif (details.trigger) {\n\t\t\tsetActiveTriggerElement(details.trigger as HTMLElement);\n\t\t}\n\n\t\t// On close, retain the trigger element briefly (React pattern).\n\t\tif (!nextOpen && details.trigger == null) {\n\t\t\t// leave element in place\n\t\t}\n\n\t\t// Skip entry animation for dismiss + keyboard clicks.\n\t\tconst nativeEvent = details.event as MouseEvent | KeyboardEvent | undefined;\n\t\tconst isKeyboardClick =\n\t\t\t(reason === REASONS.triggerPress || reason === REASONS.itemPress) &&\n\t\t\tnativeEvent != null &&\n\t\t\t\"detail\" in nativeEvent &&\n\t\t\t(nativeEvent as MouseEvent).detail === 0 &&\n\t\t\tnativeEvent.isTrusted;\n\t\tconst isDismissClose =\n\t\t\t!nextOpen && (reason === REASONS.escapeKey || reason == null);\n\n\t\tif (isKeyboardClick) setInstantType(\"click\");\n\t\telse if (isDismissClose) setInstantType(\"dismiss\");\n\t\telse setInstantType(undefined);\n\n\t\t// Emit `menuopenchange` on the top-level floating tree so menubar /\n\t\t// typeahead-routing / sibling-menu coordinators can react.\n\t\t// Matches React's `floatingTreeRoot.events.emit(\"menuopenchange\",\n\t\t// ...)` emission shape.\n\t\tconst tree = floatingTreeFromContext;\n\t\tif (tree != null) {\n\t\t\ttree.events.emit(\"menuopenchange\", {\n\t\t\t\topen: nextOpen,\n\t\t\t\tnodeId: floatingNodeIdFromContext,\n\t\t\t\tparentNodeId: floatingParentNodeIdFromContext,\n\t\t\t\treason,\n\t\t\t\ttrigger: details.trigger ?? null,\n\t\t\t});\n\t\t}\n\t};\n\n\t// Wire the store's imperative setOpen so `MenuHandle.open/close` flows\n\t// through the same reason-threading setOpen every other entry point uses.\n\tstore.attachSetOpen((next, details) => {\n\t\tsetOpen(next, details);\n\t});\n\tonCleanup(() => {\n\t\tstore.attachSetOpen(null);\n\t});\n\n\t// Mirror reactive open into the store's synchronous `isOpen` for\n\t// `handle.isOpen` reads.\n\tcreateEffect(\n\t\t() => open(),\n\t\t(o) => {\n\t\t\tstore.setOpenMirror(o);\n\t\t},\n\t);\n\n\t// Implicit active-trigger selection — when a handle-driven consumer opens\n\t// without setting a `triggerId`, pick the sole registered trigger so\n\t// positioning + focus return still have a DOM anchor.\n\tcreateEffect(\n\t\t() => open(),\n\t\t(o) => {\n\t\t\tif (!o) return;\n\t\t\tif (untrack(activeTriggerId) !== null) return;\n\t\t\tif (store.context.triggerElements.size !== 1) return;\n\t\t\tconst entry = store.context.triggerElements.entries().next();\n\t\t\tif (!entry.done) {\n\t\t\t\tconst [id, el] = entry.value;\n\t\t\t\tsetActiveTriggerId(id);\n\t\t\t\tsetActiveTriggerElement(el as HTMLElement);\n\t\t\t}\n\t\t},\n\t);\n\n\t// Imperative actions.\n\tconst handleUnmount = (): void => {\n\t\tsetMounted(false);\n\t\tsetActiveIndex(null);\n\t};\n\tconst handleClose = (): void => {\n\t\tsetOpen(\n\t\t\tfalse,\n\t\t\tcreateChangeEventDetails(\n\t\t\t\tREASONS.imperativeAction,\n\t\t\t) as MenuRootChangeEventDetails,\n\t\t);\n\t};\n\tconst actions: MenuRootActions = {\n\t\tunmount: handleUnmount,\n\t\tclose: handleClose,\n\t};\n\tconst ar = props.actionsRef;\n\tif (typeof ar === \"function\") {\n\t\tar(actions);\n\t\tonCleanup(() => ar(null));\n\t} else if (ar && typeof ar === \"object\") {\n\t\tar.current = actions;\n\t\tonCleanup(() => {\n\t\t\tar.current = null;\n\t\t});\n\t}\n\n\t// Context-menu interop: populate the outer context's `actionsRef` so\n\t// `<ContextMenu.Trigger>` can call `setOpen(true, ...)` imperatively\n\t// after writing the anchor. The `setOpen` captured here is the same\n\t// reason-threading path used by every other menu entry point.\n\tif (parentContextMenuContext != null) {\n\t\tconst cm = parentContextMenuContext;\n\t\tcm.actionsRef.current = {\n\t\t\tsetOpen: (nextOpen, details) => {\n\t\t\t\tsetOpen(nextOpen, details);\n\t\t\t},\n\t\t};\n\t\tonCleanup(() => {\n\t\t\tif (cm.actionsRef.current != null) {\n\t\t\t\tcm.actionsRef.current = null;\n\t\t\t}\n\t\t});\n\t}\n\n\t// Mirror our positioner element back to the context-menu context so\n\t// the trigger's mouseup listener can tell whether a release landed\n\t// inside the popup (and therefore shouldn't cancel the open).\n\tconst ownPositionerRef = positionerRef;\n\tif (parentContextMenuContext != null) {\n\t\tconst cm = parentContextMenuContext;\n\t\tcreateEffect(\n\t\t\t() => mounted(),\n\t\t\t() => {\n\t\t\t\tcm.positionerRef.current = ownPositionerRef.current;\n\t\t\t},\n\t\t);\n\t\tonCleanup(() => {\n\t\t\tcm.positionerRef.current = null;\n\t\t});\n\t}\n\n\t// Menubar interop — when mounted under a `<Menubar>`, emit\n\t// our open state to the parent so sibling menus can auto-close and the\n\t// menubar's `data-has-submenu-open` flag stays live.\n\tif (parentMenubarContext != null) {\n\t\tconst mb = parentMenubarContext;\n\t\tlet unregister: (() => void) | null = null;\n\t\tcreateEffect(\n\t\t\t() => open(),\n\t\t\t(isOpen) => {\n\t\t\t\tif (isOpen) {\n\t\t\t\t\tunregister?.();\n\t\t\t\t\tunregister = mb.registerOpenMenu(() => {\n\t\t\t\t\t\tsetOpen(\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\tcreateChangeEventDetails(\n\t\t\t\t\t\t\t\tREASONS.siblingOpen,\n\t\t\t\t\t\t\t) as MenuRootChangeEventDetails,\n\t\t\t\t\t\t);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tunregister?.();\n\t\t\t\t\tunregister = null;\n\t\t\t\t}\n\t\t\t\treturn undefined;\n\t\t\t},\n\t\t);\n\t\tonCleanup(() => {\n\t\t\tunregister?.();\n\t\t\tunregister = null;\n\t\t});\n\t}\n\n\t// Context-menu outside-press grace window. Mirrors React's\n\t// `allowOutsidePressDismissalRef` + 500ms post-open timer. After\n\t// `<ContextMenu.Trigger>` opens the menu, a racing `mousedown` on the\n\t// page can otherwise fire `outsidePress` → close before the user even\n\t// sees the menu. We gate the dismiss callback on this flag.\n\t//\n\t// Writes happen from an event handler (mount open-flip → timer callback),\n\t// both of which run in unowned scopes — no `ownedWrite` escape needed.\n\tlet allowOutsidePressDismissal = parentType !== \"context-menu\";\n\tconst allowOutsidePressTimeout = useTimeout();\n\n\t// React tracks the native event that opened the menu so a `contextmenu`\n\t// open is allowed to dismiss through immediately (the same native event\n\t// is what triggered the open — otherwise the very first right-click\n\t// outside the menu wouldn't close it). Mirror by stashing the reason.\n\tlet openEventType: string | null = null;\n\n\tcreateEffect(\n\t\t() => open(),\n\t\t(isOpen) => {\n\t\t\tif (!isOpen) {\n\t\t\t\topenEventType = null;\n\t\t\t}\n\t\t\tif (parentType !== \"context-menu\") return;\n\t\t\tif (!isOpen) {\n\t\t\t\tallowOutsidePressTimeout.clear();\n\t\t\t\tallowOutsidePressDismissal = false;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tallowOutsidePressTimeout.start(500, () => {\n\t\t\t\tallowOutsidePressDismissal = true;\n\t\t\t});\n\t\t},\n\t);\n\n\t// Interaction hooks. `enabled` / `bubbles` accept accessors (P3);\n\t// reactive flips re-install on the fly.\n\t//\n\t// `outsidePress` is a function, so `createStableCallback` re-reads our\n\t// closure on each dispatch — this is safe to wire reactively.\n\t// Floating-UI interaction hooks build their prop bags eagerly at body time\n\t// and read store-backed signals while doing so. Those reads are intentional\n\t// snapshots (the hooks themselves expose getters that re-fire on tracked\n\t// reads), so wrap each call in `untrack(...)` to clear the\n\t// `[STRICT_READ_UNTRACKED]` label inherited from the `MenuRootComponent`\n\t// devComponent wrapper. The hooks aren't Solid components, so the outer\n\t// `untrack` is effective (not \"futile\" the way it is for child component\n\t// bodies that re-set their own `strictRead` label).\n\tconst dismiss = untrack(() =>\n\t\tuseDismiss(floatingRootContext, {\n\t\t\tenabled: () => !disabledProp(),\n\t\t\tbubbles: { escapeKey: () => closeParentOnEscProp() && nested },\n\t\t\toutsidePress: () => {\n\t\t\t\tif (parentType !== \"context-menu\" || openEventType === \"contextmenu\") {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn allowOutsidePressDismissal;\n\t\t\t},\n\t\t}),\n\t);\n\n\tconst role = untrack(() => useRole(floatingRootContext, { role: \"menu\" }));\n\n\tconst listNavigation = untrack(() =>\n\t\tuseListNavigation(floatingRootContext, {\n\t\t\tenabled: () => !disabledProp(),\n\t\t\tlistRef,\n\t\t\tactiveIndex,\n\t\t\tnested: () => nested,\n\t\t\tloopFocus: loopFocusProp,\n\t\t\torientation: orientationProp,\n\t\t\tonNavigate: (nextIndex) => {\n\t\t\t\tsetActiveIndex(nextIndex);\n\t\t\t},\n\t\t\tfocusItemOnHover: highlightItemOnHoverProp,\n\t\t\t// Suppress the arrow-key open path when the parent is\n\t\t\t// a context menu (React parity). Context-menu triggers don't\n\t\t\t// receive keyboard focus by default, but this closes the\n\t\t\t// corner-case where a trigger is inside a focusable wrapper.\n\t\t\topenOnArrowKeyDown:\n\t\t\t\tparentType !== \"context-menu\" && parentType !== \"nested-context-menu\",\n\t\t}),\n\t);\n\n\tconst typeahead = untrack(() =>\n\t\tuseTypeahead(floatingRootContext, {\n\t\t\tenabled: () => !disabledProp() && open(),\n\t\t\tlistRef: labelsRef,\n\t\t\tactiveIndex,\n\t\t\tresetMs: 500,\n\t\t\tonMatch: (index) => {\n\t\t\t\tif (untrack(open) && index !== untrack(activeIndex)) {\n\t\t\t\t\tsetActiveIndex(index);\n\t\t\t\t}\n\t\t\t},\n\t\t\tonTypingChange: (next) => {\n\t\t\t\ttypingRef.current = next;\n\t\t\t},\n\t\t}),\n\t);\n\n\tconst interactions = useInteractions([\n\t\tdismiss,\n\t\trole,\n\t\tlistNavigation,\n\t\ttypeahead,\n\t]);\n\n\tconst parentAccessor: Accessor<MenuRootContextValue<unknown> | null> = () =>\n\t\tparentMenu;\n\n\tconst contextValue: MenuRootContextValue<Payload> = {\n\t\tnested: () => nested,\n\t\tparent: parentAccessor,\n\t\topen,\n\t\tmounted,\n\t\ttransitionStatus,\n\t\tmodal: () => (nested ? false : modalProp()),\n\t\tdisabled: disabledProp,\n\t\torientation: orientationProp,\n\t\tloopFocus: loopFocusProp,\n\t\thighlightItemOnHover: highlightItemOnHoverProp,\n\t\tactiveIndex,\n\t\tsetActiveIndex,\n\t\tpayload,\n\t\tsetPayload,\n\t\tactiveTriggerElement,\n\t\tsetActiveTriggerElement,\n\t\tactiveTriggerId,\n\t\tsetActiveTriggerId: (id) => {\n\t\t\tsetActiveTriggerId(id as string | null);\n\t\t},\n\t\tlastOpenChangeReason,\n\t\tinstantType,\n\t\tsetOpen,\n\t\tfloatingRootContext,\n\t\tinteractions,\n\t\tlistRef,\n\t\tlabelsRef,\n\t\ttypingRef,\n\t\tcloseDelayRef,\n\t\tpopupRef,\n\t\tpositionerRef,\n\t\tonOpenChangeComplete: props.onOpenChangeComplete,\n\t\tfloatingNodeId: () => floatingNodeIdFromContext,\n\t\tcloseParentOnEsc: closeParentOnEscProp,\n\t\trootId: () => rootId,\n\t\tparentType: () => parentType,\n\t\tstore: store as MenuStore<Payload>,\n\t\topenMethod,\n\t\topenInteractionTypeProps,\n\t\tbeforeContentFocusGuardRef,\n\t\ttriggerFocusTargetRef,\n\t\tfloatingTreeRoot: () => floatingTreeFromContext,\n\t\tfloatingParentNodeId: () => floatingParentNodeIdFromContext,\n\t};\n\n\t// Render children inside a `get children()` context so the provider is\n\t// visible before JSX evaluates (papercut #1).\n\tconst renderChildren = (): JSX.Element => {\n\t\tconst c = props.children;\n\t\tif (typeof c === \"function\") {\n\t\t\treturn (c as MenuPayloadChildRenderFunction<Payload>)({\n\t\t\t\tpayload: payload(),\n\t\t\t});\n\t\t}\n\t\treturn c as JSX.Element;\n\t};\n\n\tconst treeNodeId = floatingNodeIdFromContext;\n\n\treturn (\n\t\t<MenuRootContext value={contextValue as MenuRootContextValue<unknown>}>\n\t\t\t<FloatingNode id={treeNodeId}>{renderChildren()}</FloatingNode>\n\t\t</MenuRootContext>\n\t);\n}\n\n/**\n * Groups all parts of a menu. Renders no DOM element — the root is a pure\n * context provider. Wraps itself in a `<FloatingTree>` when not already\n * inside one.\n */\nexport function MenuRoot<Payload = unknown>(\n\tprops: MenuRootProps<Payload>,\n): JSX.Element {\n\t// Reuse the outer `FloatingTree` if one is already mounted (e.g. from\n\t// `<Menubar>` / `<ContextMenu.Root>`). A `FloatingNode` parent id isn't\n\t// required — the shared tree is what matters for cross-menu events.\n\t// Check the tree context directly rather than the parent\n\t// node id so standalone consumers that mount their own `<FloatingTree>`\n\t// can subscribe to `menuopenchange` without nesting under a\n\t// `<FloatingNode>`.\n\tif (useFloatingTree() != null) {\n\t\treturn <MenuRootComponent<Payload> {...props} />;\n\t}\n\treturn (\n\t\t<FloatingTree>\n\t\t\t<MenuRootComponent<Payload> {...props} />\n\t\t</FloatingTree>\n\t);\n}\n"],"mappings":"AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAECA,YAAY,EACZC,YAAY,EACZC,SAAS,EACTC,OAAO,EACPC,UAAU,QACJ,UAAU;AACjB,SAASC,sBAAsB,QAAQ,mDAAmD;AAC1F,SAASC,WAAW,QAAQ,4BAA4B;AACxD,SACCC,wBAAwB,EACxBC,OAAO,QACD,sCAAsC;AAC7C,SAASC,qBAAqB,QAAQ,yCAAyC;AAC/E,SACCC,YAAY,EACZC,YAAY,EACZC,iBAAiB,EACjBC,uBAAuB,EACvBC,eAAe,QACT,sDAAsD;AAC7D,SAASC,UAAU,QAAQ,+CAA+C;AAC1E,SAASC,sBAAsB,QAAQ,6DAA6D;AACpG,SAASC,eAAe,QAAQ,oDAAoD;AACpF,SAASC,iBAAiB,QAAQ,uDAAuD;AACzF,SAASC,OAAO,QAAQ,4CAA4C;AACpE,SAASC,YAAY,QAAQ,iDAAiD;AAE9E,SAA6BC,UAAU,QAAQ,gCAAgC;AAC/E,SAASC,qBAAqB,QAAQ,iDAAiD;AACvF,SAASC,sBAAsB,QAAQ,kDAAkD;AACzF,SAASC,UAAU,QAAQ,6BAA6B;AACxD,SAASC,mBAAmB,QAAQ,6DAA6D;AACjG,SAASC,cAAc,QAAQ,+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